// Added temporarily, till it is in FPC

{
    Copyright:  © 1985-2002 by Apple Computer, Inc., all rights reserved.
    Release:    Universal Interfaces 3.4.2

    Modified for use with Free Pascal by make-common-interfaces.pl version 1.1.0
    Please report any bugs to <gpc@microbizz.nl>


    This file is assembled from all the Universal Interface files.
}

{$mode macpas}
{$macro on}

{$IFDEF darwin}
// To be able to test compile the carbon interface under non darwin, enable this
// special calling convention only for this target.
{$CALLING MWPASCAL}
{$ENDIF}


unit FPCMacOSAll;
interface
{$ifc undefined USE_CFSTR_CONSTANT_MACROS}
    {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
{$endc}


{$setc UNIVERSAL_INTERFACES_VERSION := $0342}
{$setc GAP_INTERFACES_VERSION := $0110}

{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
{$setc CALL_NOT_IN_CARBON := FALSE}
{$setc OLDROUTINENAMES := FALSE}
{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
{$setc OPAQUE_UPP_TYPES := TRUE}
{$setc OTCARBONAPPLICATION := TRUE}
{$setc OTKERNEL := FALSE}
{$setc PM_USE_SESSION_APIS := TRUE}
{$setc TARGET_API_MAC_CARBON := TRUE}
{$setc TARGET_API_MAC_OS8 := FALSE}
{$setc TARGET_API_MAC_OSX := TRUE}
{$setc TARGET_CARBON := TRUE}
{$setc TARGET_CPU_68K := FALSE}
{$setc TARGET_CPU_MIPS := FALSE}
{$setc TARGET_CPU_PPC := TRUE}
{$setc TARGET_CPU_SPARC := FALSE}
{$setc TARGET_CPU_X86 := FALSE}
{$setc TARGET_OS_MAC := TRUE}
{$setc TARGET_OS_UNIX := FALSE}
{$setc TARGET_OS_WIN32 := FALSE}
{$setc TARGET_RT_BIG_ENDIAN := TRUE}
{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
{$setc TARGET_RT_MAC_68881 := FALSE}
{$setc TARGET_RT_MAC_CFM := FALSE}
{$setc TARGET_RT_MAC_MACHO := TRUE}
{$setc TYPED_FUNCTION_POINTERS := TRUE}
{$setc TYPE_BOOL := FALSE}
{$setc TYPE_EXTENDED := FALSE}
{$setc TYPE_LONGLONG := TRUE}


{unit ConditionalMacros}
{$ALIGN MAC68K}





{***************************************************************************************************
    UNIVERSAL_INTERFACES_VERSION

        0x0400 --> version 4.0 (Mac OS X only)
        0x0341 --> version 3.4.1
        0x0340 --> version 3.4
        0x0331 --> version 3.3.1
        0x0330 --> version 3.3
        0x0320 --> version 3.2
        0x0310 --> version 3.1
        0x0301 --> version 3.0.1
        0x0300 --> version 3.0
        0x0210 --> version 2.1
        This conditional did not exist prior to version 2.1
***************************************************************************************************}


{***************************************************************************************************

    TARGET_CPU_Å
    These conditionals specify which microprocessor instruction set is being
    generated.  At most one of these is true, the rest are false.

        TARGET_CPU_PPC          - Compiler is generating PowerPC instructions
        TARGET_CPU_68K          - Compiler is generating 680x0 instructions
        TARGET_CPU_X86          - Compiler is generating x86 instructions
        TARGET_CPU_MIPS         - Compiler is generating MIPS instructions
        TARGET_CPU_SPARC        - Compiler is generating Sparc instructions
        TARGET_CPU_ALPHA        - Compiler is generating Dec Alpha instructions


    TARGET_OS_Å
    These conditionals specify in which Operating System the generated code will
    run. At most one of the these is true, the rest are false.

        TARGET_OS_MAC           - Generate code will run under Mac OS
        TARGET_OS_WIN32         - Generate code will run under 32-bit Windows
        TARGET_OS_UNIX          - Generate code will run under some unix


    TARGET_RT_Å
    These conditionals specify in which runtime the generated code will
    run. This is needed when the OS and CPU support more than one runtime
    (e.g. MacOS on 68K supports CFM68K and Classic 68k).

        TARGET_RT_LITTLE_ENDIAN - Generated code uses little endian format for integers
        TARGET_RT_BIG_ENDIAN    - Generated code uses big endian format for integers
        TARGET_RT_MAC_CFM       - TARGET_OS_MAC is true and CFM68K or PowerPC CFM (TVectors) are used
        TARGET_RT_MAC_MACHO     - TARGET_OS_MAC is true and Mach-O style runtime
        TARGET_RT_MAC_68881     - TARGET_OS_MAC is true and 68881 floating point instructions used


    TARGET__API_Å_Å
    These conditionals are used to differentiate between sets of API's on the same
    processor under the same OS.  The first section after _API_ is the OS.  The
    second section is the API set.  Unlike TARGET_OS_ and TARGET_CPU_, these
    conditionals are not mutally exclusive. This file will attempt to auto-configure
    all TARGET_API_Å_Å values, but will often need a TARGET_API_Å_Å value predefined
    in order to disambiguate.

        TARGET_API_MAC_OS8      - Code is being compiled to run on System 7 through Mac OS 8.x
        TARGET_API_MAC_CARBON   - Code is being compiled to run on Mac OS 8 and Mac OS X via CarbonLib
        TARGET_API_MAC_OSX      - Code is being compiled to run on Mac OS X


    PRAGMA_Å
    These conditionals specify whether the compiler supports particular #pragma's

        PRAGMA_IMPORT           - Compiler supports: #pragma import on/off/reset
        PRAGMA_ONCE             - Compiler supports: #pragma once
        PRAGMA_STRUCT_ALIGN     - Compiler supports: #pragma options align=mac68k/power/reset
        PRAGMA_STRUCT_PACK      - Compiler supports: #pragma pack(n)
        PRAGMA_STRUCT_PACKPUSH  - Compiler supports: #pragma pack(push, n)/pack(pop)
        PRAGMA_ENUM_PACK        - Compiler supports: #pragma options(!pack_enums)
        PRAGMA_ENUM_ALWAYSINT   - Compiler supports: #pragma enumsalwaysint on/off/reset
        PRAGMA_ENUM_OPTIONS     - Compiler supports: #pragma options enum=int/small/reset


    FOUR_CHAR_CODE
    This conditional does the proper byte swapping to assue that a four character code (e.g. 'TEXT')
    is compiled down to the correct value on all compilers.

        $61626364 (* 'abcd' *)  - Convert a four-char-code to the correct 32-bit value


    TYPE_Å
    These conditionals specify whether the compiler supports particular types.

        TYPE_LONGLONG               - Compiler supports "long long" 64-bit integers
        TYPE_BOOL                   - Compiler supports "bool"
        TYPE_EXTENDED               - Compiler supports "extended" 80/96 bit floating point
        TYPE_LONGDOUBLE_IS_DOUBLE   - Compiler implements "long double" same as "double"


    FUNCTION_Å
    These conditionals specify whether the compiler supports particular language extensions
    to function prototypes and definitions.

        FUNCTION_PASCAL         - Compiler supports "pascal void Foo()"
        FUNCTION_DECLSPEC       - Compiler supports "__declspec(xxx) void Foo()"
        FUNCTION_WIN32CC        - Compiler supports "void __cdecl Foo()" and "void __stdcall Foo()"

***************************************************************************************************}


{***************************************************************************************************
    Backward compatibility for clients expecting 2.x version on ConditionalMacros.h

    GENERATINGPOWERPC       - Compiler is generating PowerPC instructions
    GENERATING68K           - Compiler is generating 68k family instructions
    GENERATING68881         - Compiler is generating mc68881 floating point instructions
    GENERATINGCFM           - Code being generated assumes CFM calling conventions
    CFMSYSTEMCALLS          - No A-traps.  Systems calls are made using CFM and UPP's
    PRAGMA_ALIGN_SUPPORTED  - Compiler supports: #pragma options align=mac68k/power/reset
    PRAGMA_IMPORT_SUPPORTED - Compiler supports: #pragma import on/off/reset
    CGLUESUPPORTED          - Clients can use all lowercase toolbox functions that take C strings instead of pascal strings

***************************************************************************************************}


{***************************************************************************************************

    OLDROUTINENAMES         - "Old" names for Macintosh system calls are allowed in source code.
                              (e.g. DisposPtr instead of DisposePtr). The names of system routine
                              are now more sensitive to change because CFM binds by name.  In the
                              past, system routine names were compiled out to just an A-Trap.
                              Macros have been added that each map an old name to its new name.
                              This allows old routine names to be used in existing source files,
                              but the macros only work if OLDROUTINENAMES is true.  This support
                              will be removed in the near future.  Thus, all source code should
                              be changed to use the new names! You can set OLDROUTINENAMES to false
                              to see if your code has any old names left in it.

***************************************************************************************************}


{***************************************************************************************************

    TARGET_CARBON                   - default: false. Switches all of the above as described.  Overrides all others
                                    - NOTE: If you set TARGET_CARBON to 1, then the other switches will be setup by
                                            ConditionalMacros, and should not be set manually.

    If you wish to do development for pre-Carbon Systems, you can set the following:

    OPAQUE_TOOLBOX_STRUCTS          - default: false. True for Carbon builds, hides struct fields.
    OPAQUE_UPP_TYPES                - default: false. True for Carbon builds, UPP types are unique and opaque.
    ACCESSOR_CALLS_ARE_FUNCTIONS    - default: false. True for Carbon builds, enables accessor functions.
    CALL_NOT_IN_CARBON              - default: true.  False for Carbon builds, hides calls not supported in Carbon.

    Specifically, if you are building a non-Carbon application (one that links against InterfaceLib)
    but you wish to use some of the accessor functions, you can set ACCESSOR_CALLS_ARE_FUNCTIONS to 1
    and link with CarbonAccessors.o, which implements just the accessor functions. This will help you
    preserve source compatibility between your Carbon and non-Carbon application targets.

    MIXEDMODE_CALLS_ARE_FUNCTIONS   - deprecated.

***************************************************************************************************}
{unit MacTypes}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}


{*******************************************************************************

    Base SInt16 types for all target OS's and CPU's

        UInt8            8-bit unsigned SInt16
        SInt8            8-bit signed SInt16
        UInt16          16-bit unsigned SInt16
        SInt16          16-bit signed SInt16
        UInt32          32-bit unsigned SInt16
        SInt32          32-bit signed SInt16
        UInt64          64-bit unsigned SInt16
        SInt64          64-bit signed SInt16

********************************************************************************}
type
    SInt8                               = -128..127;
    SInt8Ptr                            = ^SInt8;
    SInt16                              = Integer;
    SInt16Ptr                           = ^SInt16;
    SInt32                              = LongInt;
    SInt32Ptr                           = ^SInt32;
    UInt8                               = 0..255;
    UInt8Ptr                            = ^UInt8;
    UInt16                              = Word;
    UInt16Ptr                           = ^UInt16;
    UInt32                              = Longword;
    UInt32Ptr                           = ^UInt32;


type
    widePtr = ^wide;
    wide = record
        hi:                     SInt32;
        lo:                     UInt32;
    end;

    UnsignedWidePtr = ^UnsignedWide;
    UnsignedWide = record
        hi:                     UInt32;
        lo:                     UInt32;
    end;


   SInt64                              = wide;
   SInt64Ptr                           = ^SInt64;
   UInt64                              = UnsignedWide;
   UInt64Ptr                           = ^UInt64;

    {   *******************************************************************************

        Special types for pascal

            ByteParameter       UInt8 passed as an 8-bit parameter

        Note:   The conventions for Pascal on 68K require that a UInt8 when
                passed as a parameter occupy 16-bits on the stack, whereas
                an SInt8 would only occupy 8-bits.  To make C and Pascal
                compatable, in pascal all function parameters of type UInt8
                or equivalent are changed to ByteParameter.

    ********************************************************************************    }
    ByteParameter                       = SInt8;


    {   *******************************************************************************

        Base fixed point types

            Fixed           16-bit signed SInt16 plus 16-bit fraction
            UnsignedFixed   16-bit unsigned SInt16 plus 16-bit fraction
            Fract           2-bit signed SInt16 plus 30-bit fraction
            ShortFixed      8-bit signed SInt16 plus 8-bit fraction

    ********************************************************************************    }
    Fixed                               = SInt32;
    FixedPtr                            = ^Fixed;
    Fract                               = SInt32;
    FractPtr                            = ^Fract;
    UnsignedFixed                       = UInt32;
    UnsignedFixedPtr                    = ^UnsignedFixed;
    ShortFixed                          = SInt16;
    ShortFixedPtr                       = ^ShortFixed;


    {   *******************************************************************************

        Base floating point types

            Float32         32 bit IEEE float:  1 sign bit, 8 exponent bits, 23 fraction bits
            Float64         64 bit IEEE float:  1 sign bit, 11 exponent bits, 52 fraction bits
            Float80         80 bit MacOS float: 1 sign bit, 15 exponent bits, 1 SInt16 bit, 63 fraction bits
            Float96         96 bit 68881 float: 1 sign bit, 15 exponent bits, 16 pad bits, 1 SInt16 bit, 63 fraction bits

        Note: These are fixed size floating point types, useful when writing a floating
              point value to disk.  If your compiler does not support a particular size
              float, a struct is used instead.
              Use of of the NCEG types (e.g. double_t) or an ANSI C type (e.g. double) if
              you want a floating point representation that is natural for any given
              compiler, but might be a different size on different compilers.

    ********************************************************************************    }
type
    Float32 =   SINGLE;
    Float32Ptr =   ^Float32;
    Float64 =   DOUBLE;
    Float64Ptr =   ^Float64;
    LongDouble = DOUBLE;
    Float80 = record
        exp:    SInt16;
        man:    array [0..3] of UInt16;
    end;
    Float96 = record
        exp:    SInt16;
        filler: SInt16;
        man:    array [0..3] of UInt16;
    end;
Float32Point = record
    x:  Float32;
    y:  Float32;
end;

    {   *******************************************************************************

        MacOS Memory Manager types

            Ptr             Pointer to a non-relocatable block
            Handle          Pointer to a master pointer to a relocatable block
            Size            The number of bytes in a block (signed for historical reasons)

    ********************************************************************************    }
    Ptr                                 = ^SInt8;
    PtrPtr                              = ^Ptr;
    Handle                              = ^Ptr;
    Size                                = SInt32;
    SizePtr                             = ^Size; { when a VAR xx: Size parameter can be nil, it is changed to xx: SizePtr }
    UnivPtr                             = Pointer;
    UnivHandle                              = Pointer;

    {   *******************************************************************************

        Higher level basic types

            OSErr                   16-bit result error code
            OSStatus                32-bit result error code
            LogicalAddress          Address in the clients virtual address space
            ConstLogicalAddress     Address in the clients virtual address space that will only be read
            PhysicalAddress         Real address as used on the hardware bus
            BytePtr                 Pointer to an array of bytes
            ByteCount               The size of an array of bytes
            ByteOffset              An offset into an array of bytes
            ItemCount               32-bit iteration count
            OptionBits              Standard 32-bit set of bit flags
            PBVersion               ?
            Duration                32-bit millisecond timer for drivers
            AbsoluteTime            64-bit clock
            ScriptCode              A particular set of written characters (e.g. Roman vs Cyrillic) and their encoding
            LangCode                A particular language (e.g. English), as represented using a particular ScriptCode
            RegionCode              Designates a language as used in a particular region (e.g. British vs American
                                    English) together with other region-dependent characteristics (e.g. date format)
            FourCharCode            A 32-bit value made by packing four 1 byte characters together
            OSType                  A FourCharCode used in the OS and file system (e.g. creator)
            ResType                 A FourCharCode used to tag resources (e.g. 'DLOG')

    ********************************************************************************    }
    OSErr                               = SInt16;
    OSStatus                            = SInt32;
    LogicalAddress                      = Ptr;
    ConstLogicalAddress                 = Ptr;
    PhysicalAddress                     = Ptr;
    BytePtr                             = ^UInt8;
    ByteCount                           = UInt32;
    ByteCountPtr                        = ^ByteCount; { when a VAR xx: ByteCount parameter can be nil, it is changed to xx: ByteCountPtr }
    ByteOffset                          = UInt32;
    ByteOffsetPtr                       = ^ByteOffset; { when a VAR xx: ByteOffset parameter can be nil, it is changed to xx: ByteOffsetPtr }
    Duration                            = SInt32;
    AbsoluteTime                        = UnsignedWide;
    AbsoluteTimePtr                     = ^AbsoluteTime;
    OptionBits                          = UInt32;
    ItemCount                           = UInt32;
    ItemCountPtr                            = ^ItemCount;
    PBVersion                           = UInt32;
    ScriptCode                          = SInt16;
    ScriptCodePtr                       = ^ScriptCode; { when a VAR xx: ScriptCode parameter can be nil, it is changed to xx: ScriptCodePtr }
    LangCode                            = SInt16;
    LangCodePtr                         = ^LangCode; { when a VAR xx: LangCode parameter can be nil, it is changed to xx: LangCodePtr }
    RegionCode                          = SInt16;
    RegionCodePtr                       = ^RegionCode; { when a VAR xx: RegionCode parameter can be nil, it is changed to xx: RegionCodePtr }
    FourCharCode                        = UInt32;
    OSType                              = FourCharCode;
    ResType                             = FourCharCode;
    OSTypePtr                           = ^OSType;
    ResTypePtr                          = ^ResType;

    {   *******************************************************************************

        Boolean types and values

            Boolean         A one byte value, holds "false" (0) or "true" (1)
            false           The Boolean value of zero (0)
            true            The Boolean value of one (1)

    ********************************************************************************    }
{ "Boolean", "true", and "false" are built into the Pascal language }
    BooleanPtr                          = ^Boolean; { when a VAR xx: Boolean parameter can be nil, it is changed to xx: BooleanPtr }

    {   *******************************************************************************

        Function Pointer Types

            ProcPtr                 Generic pointer to a function
            Register68kProcPtr      Pointer to a 68K function that expects parameters in registers
            UniversalProcPtr        Pointer to classic 68K code or a RoutineDescriptor

            ProcHandle              Pointer to a ProcPtr
            UniversalProcHandle     Pointer to a UniversalProcPtr

    ********************************************************************************    }
    ProcPtr                             = Ptr;
    Register68kProcPtr                  = ProcPtr;
    {    UniversalProcPtr is ^RoutineDescriptor on a PowerPC machine    }
    UniversalProcPtr                    = ProcPtr;
    ProcHandle                          = ^ProcPtr;
    UniversalProcHandle                 = ^UniversalProcPtr;


    {   *******************************************************************************

        Common Constants

            noErr                   OSErr: function performed properly - no error
            kNilOptions             OptionBits: all flags false
            kInvalidID              KernelID: NULL is for pointers as kInvalidID is for ID's
            kVariableLengthArray    array bounds: variable length array

        Note: kVariableLengthArray is used in array bounds to specify a variable length array.
              It is ususally used in variable length structs when the last field is an array
              of any size.  Before ANSI C, we used zero as the bounds of variable length
              array, but zero length array are illegal in ANSI C.  Example usage:

            struct FooList
            (
                short   listLength;
                Foo     elements[kVariableLengthArray];
            );

    ********************************************************************************    }

const
    noErr                       = 0;

    kNilOptions                 = 0;

    kInvalidID                  = 0;

    kVariableLengthArray        = 1;

    kUnknownType                = $3F3F3F3F;                    {  "????" QuickTime 3.0: default unknown ResType or OSType  }



    {   *******************************************************************************

        String Types and Unicode Types

            UnicodeScalarValue,     A complete Unicode character in UTF-32 format, with
            UTF32Char               values from 0 through 0x10FFFF (excluding the surrogate
                                    range 0xD800-0xDFFF and certain disallowed values).

            UniChar,                A 16-bit Unicode code value in the default UTF-16 format.
            UTF16Char               UnicodeScalarValues 0-0xFFFF are expressed in UTF-16
                                    format using a single UTF16Char with the same value.
                                    UnicodeScalarValues 0x10000-0x10FFFF are expressed in
                                    UTF-16 format using a pair of UTF16Chars - one in the
                                    high surrogate range (0xD800-0xDBFF) followed by one in
                                    the low surrogate range (0xDC00-0xDFFF). All of the
                                    characters defined in Unicode versions through 3.0 are
                                    in the range 0-0xFFFF and can be expressed using a single
                                    UTF16Char, thus the term "Unicode character" generally
                                    refers to a UniChar = UTF16Char.

            UTF8Char                An 8-bit code value in UTF-8 format. UnicodeScalarValues
                                    0-0x7F are expressed in UTF-8 format using one UTF8Char
                                    with the same value. UnicodeScalarValues above 0x7F are
                                    expressed in UTF-8 format using 2-4 UTF8Chars, all with
                                    values in the range 0x80-0xF4 (UnicodeScalarValues
                                    0x100-0xFFFF use two or three UTF8Chars,
                                    UnicodeScalarValues 0x10000-0x10FFFF use four UTF8Chars).

            UniCharCount            A count of UTF-16 code values in an array or buffer.

            StrNNN                  Pascal string holding up to NNN bytes
            StringPtr               Pointer to a pascal string
            StringHandle            Pointer to a StringPtr
            ConstStringPtr          Pointer to a read-only pascal string
            ConstStrNNNParam        For function parameters only - means string is const

            CStringPtr              Pointer to a C string           (in C:  char*)
            ConstCStringPtr         Pointer to a read-only C string (in C:  const char*)

        Note: The length of a pascal string is stored as the first byte.
              A pascal string does not have a termination byte.
              A pascal string can hold at most 255 bytes of data.
              The first character in a pascal string is offset one byte from the start of the string.

              A C string is terminated with a byte of value zero.
              A C string has no length limitation.
              The first character in a C string is the zeroth byte of the string.


    ********************************************************************************    }

type
    UnicodeScalarValue                  = UInt32;
    UTF32Char                           = UInt32;
    UniChar                             = UInt16;
    UTF16Char                           = UInt16;
    UTF8Char                            = UInt8;
    UniCharPtr                          = ^UniChar;
    ConstUniCharPtr             = UniCharPtr;
    UniCharCount                        = UInt32;
    UniCharCountPtr                     = ^UniCharCount;
    Str15                               = STRING[15];
    Str27                               = STRING[27];
    Str31                               = STRING[31];
    Str32                               = STRING[32];
    Str36                               = STRING[36];
    Str63                               = STRING[63];
    Str255                              = STRING[255];
    {
        The type Str32 is used in many AppleTalk based data structures.
        It holds up to 32 one byte chars.  The problem is that with the
        length byte it is 33 bytes long.  This can cause weird alignment
        problems in structures.  To fix this the type "Str32Field" has
        been created.  It should only be used to hold 32 chars, but
        it is 34 bytes long so that there are no alignment problems.
        }
    Str32Field = Str32;
    {
        QuickTime 3.0:
        The type StrFileName is used to make MacOS structs work
        cross-platform.  For example FSSpec or SFReply previously
        contained a Str63 field.  They now contain a StrFileName
        field which is the same when targeting the MacOS but is
        a 256 char buffer for Win32 and unix, allowing them to
        contain long file names.
        }
    StrFileName                         = Str63;

    StringPtr                           = ^Str255;
    StringHandle                        = ^StringPtr;
    ConstStringPtr                      = StringPtr;
    CStringPtr                          = Ptr;
    CStringPtrPtr                       = ^CStringPtr;
    ConstCStringPtr                     = Ptr;
    ConstCStringPtrPtr                  = ^ConstCStringPtr;
    ConstStr255Param                    = Str255;
    ConstStr63Param                     = Str63;
    ConstStr36Param                     = Str36;
    ConstStr32Param                     = Str32;
    ConstStr31Param                     = Str31;
    ConstStr27Param                     = Str27;
    ConstStr15Param                     = Str15;
    ConstStrFileNameParam               = Str63;

    {   *******************************************************************************

        Quickdraw Types

            Point               2D Quickdraw coordinate, range: -32K to +32K
            Rect                Rectangular Quickdraw area
            Style               Quickdraw font rendering styles
            StyleParameter      Style when used as a parameter (historical 68K convention)
            StyleField          Style when used as a field (historical 68K convention)
            CharParameter       Char when used as a parameter (historical 68K convention)

        Note:   The original Macintosh toolbox in 68K Pascal defined Style as a set.
                Both Style and char occupy 8-bits in packed records or 16-bits when
                used as fields in non-packed records or as parameters.

    ********************************************************************************    }
    PointPtr = ^Point;
    Point = record
        case SInt16 of
        0: (
            v:                  SInt16;
            h:                  SInt16;
           );
        1: (
            vh:                 array [0..1] of SInt16;
            );
    end;

    RectPtr = ^Rect;
    Rect = record
        case SInt16 of
        0: (
            top:                SInt16;
            left:               SInt16;
            bottom:             SInt16;
            right:              SInt16;
           );
        1: (
            topLeft:            Point;
            botRight:           Point;
           );
    end;

    FixedPointPtr = ^FixedPoint;
    FixedPoint = record
        x:                      Fixed;
        y:                      Fixed;
    end;

    FixedRectPtr = ^FixedRect;
    FixedRect = record
        left:                   Fixed;
        top:                    Fixed;
        right:                  Fixed;
        bottom:                 Fixed;
    end;

    CharParameter = char;

const
    bold = 1;
    italic = 2;
    underline = 4;
    outline = 8;
    shadow = 16;
    condense = 32;
    extend = 64;

type
    Style = UInt8;
    StyleField = SInt16;
    StyleParameter = SInt16;


    {   *******************************************************************************

        QuickTime TimeBase types (previously in Movies.h)

            TimeValue           Count of units
            TimeScale           Units per second
            CompTimeValue       64-bit count of units (always a struct)
            TimeValue64         64-bit count of units (long long or struct)
            TimeBase            An opaque reference to a time base
            TimeRecord          Package of TimeBase, duration, and scale

    ********************************************************************************    }
    TimeValue                           = SInt32;
    TimeScale                           = SInt32;
    CompTimeValue                       = wide;
    CompTimeValuePtr                    = ^CompTimeValue;
    TimeValue64                         = SInt64;
    TimeValue64Ptr                      = ^TimeValue64;
    TimeBase    = ^SInt32; { an opaque 32-bit type }
    TimeBasePtr = ^TimeBase;  { when a var xx:TimeBase parameter can be nil, it is changed to xx: TimeBasePtr }
    TimeRecordPtr = ^TimeRecord;
    TimeRecord = record
        value:                  CompTimeValue;                          {  units (duration or absolute)  }
        scale:                  TimeScale;                              {  units per second  }
        base:                   TimeBase;                               {  refernce to the time base  }
    end;




    {   *******************************************************************************

        MacOS versioning structures

            VersRec                 Contents of a 'vers' resource
            VersRecPtr              Pointer to a VersRecPtr
            VersRecHndl             Resource Handle containing a VersRec
            NumVersion              Packed BCD version representation (e.g. "4.2.1a3" is 0x04214003)
            UniversalProcPtr        Pointer to classic 68K code or a RoutineDescriptor

            ProcHandle              Pointer to a ProcPtr
            UniversalProcHandle     Pointer to a UniversalProcPtr

    ********************************************************************************    }
    NumVersionPtr = ^NumVersion;
    NumVersion = packed record
                                                                        {  Numeric version part of 'vers' resource  }
        majorRev:               UInt8;                                  { 1st part of version number in BCD }
        minorAndBugRev:         UInt8;                                  { 2nd & 3rd part of version number share a byte }
        stage:                  UInt8;                                  { stage code: dev, alpha, beta, final }
        nonRelRev:              UInt8;                                  { revision level of non-released version }
    end;



const
                                                                {  Version Release Stage Codes  }
    developStage                = $20;
    alphaStage                  = $40;
    betaStage                   = $60;
    finalStage                  = $80;


type
    NumVersionVariantPtr = ^NumVersionVariant;
    NumVersionVariant = record
        case SInt16 of
                                                                        {  NumVersionVariant is a wrapper so NumVersion can be accessed as a 32-bit value  }
        0: (
            parts:              NumVersion;
            );
        1: (
            whole:              UInt32;
            );
    end;

    NumVersionVariantHandle             = ^NumVersionVariantPtr;
    VersRecPtr = ^VersRec;
    VersRec = record
                                                                        {  'vers' resource format  }
        numericVersion:         NumVersion;                             { encoded version number }
        countryCode:            SInt16;                             { country code from intl utilities }
        shortVersion:           Str255;                                 { version number string - worst case }
        reserved:               Str255;                                 { longMessage string packed after shortVersion }
    end;

    VersRecHndl                         = ^VersRecPtr;
    {   ********************************************************************************

        Old names for types

    ********************************************************************************    }
    Byte                                = UInt8;
    SignedByte                          = SInt8;
    extended80                          = Float80;
    extended80Ptr                       = ^extended80;
    extended96                          = Float96;
    extended96Ptr                       = ^extended96;
    VHSelect                            = SInt8;
    SinglePtr                           = ^Single;
    {   ********************************************************************************

        Debugger functions

    ********************************************************************************    }
    {
     *  Debugger()
     *
     *  Availability:
     *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
procedure Debugger; external name '_Debugger';
{
 *  DebugStr()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DebugStr(const (*var*) debuggerMsg: Str255); external name '_DebugStr';
{ Only for Mac OS native drivers }
{ SADE break points }
{
 *  SysBreak()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SysBreak; external name '_SysBreak';
{
 *  SysBreakStr()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SysBreakStr(const (*var*) debuggerMsg: Str255); external name '_SysBreakStr';
{
 *  SysBreakFunc()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SysBreakFunc(const (*var*) debuggerMsg: Str255); external name '_SysBreakFunc';


{$ALIGN MAC68K}
{#POP}
{unit Math64}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}


{
 *  S64Max()
 *
 *  Discussion:
 *    Returns largest possible SInt64 value
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function S64Max: SInt64; external name '_S64Max';

{
 *  S64Min()
 *
 *  Discussion:
 *    Returns smallest possible SInt64 value
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function S64Min: SInt64; external name '_S64Min';


{
 *  S64Add()
 *
 *  Discussion:
 *    Adds two integers, producing an SInt16 result.  If an overflow
 *    occurs the result is congruent mod (2^64) as if the operands and
 *    result were unsigned.  No overflow is signaled.
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function S64Add(left: SInt64; right: SInt64): SInt64; external name '_S64Add';


{
 *  S64Subtract()
 *
 *  Discussion:
 *    Subtracts two integers, producing an SInt16 result.  If an
 *    overflow occurs the result is congruent mod (2^64) as if the
 *    operands and result were unsigned.  No overflow is signaled.
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function S64Subtract(left: SInt64; right: SInt64): SInt64; external name '_S64Subtract';


{
 *  S64Negate()
 *
 *  Discussion:
 *    Returns the additive inverse of a signed number (i.e. it returns
 *    0 - the number).  S64Negate (S64Min) is not representable (in
 *    fact, it returns S64Min).
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function S64Negate(value: SInt64): SInt64; external name '_S64Negate';



{
 *  S64Multiply()
 *
 *  Discussion:
 *    Multiplies two signed numbers, producing a signed result.
 *    Overflow is ignored and the low-order part of the product is
 *    returned.  The sign of the result is not guaranteed to be correct
 *    if the magnitude of the product is not representable.
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function S64Multiply(left: SInt64; right: SInt64): SInt64; external name '_S64Multiply';



{
 *  S64Divide()
 *
 *  Discussion:
 *    Divides dividend by divisor, returning the quotient.  The
 *    remainder is returned in *remainder if remainder (the pointer) is
 *    non-NULL. The sign of the remainder is the same as the sign of
 *    the dividend (i.e. it takes the absolute values of the operands,
 *    does the division, then fixes the sign of the quotient and
 *    remainder).  If the divisor is zero, then S64Max() will be
 *    returned (or S64Min() if the dividend is negative), and the
 *    remainder will be the dividend; no error is reported.
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function S64Divide(dividend: SInt64; divisor: SInt64; remainder: SInt64Ptr): SInt64; external name '_S64Divide';



{
 *  S64Set()
 *
 *  Discussion:
 *    Given an SInt32, returns an SInt64 with the same value.  Use this
 *    routine instead of coding 64-bit constants (at least when the
 *    constant will fit in an SInt32).
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function S64Set(value: SInt32): SInt64; external name '_S64Set';


{
 *  S64SetU()
 *
 *  Discussion:
 *    Given a UInt32, returns a SInt64 with the same value.
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function S64SetU(value: UInt32): SInt64; external name '_S64SetU';

{
 *  S32Set()
 *
 *  Discussion:
 *    Given an SInt64, returns an SInt32 by discarding the high-order
 *    32 bits.
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function S32Set(value: SInt64): SInt32; external name '_S32Set';


{
 *  S64And()
 *
 *  Discussion:
 *    Returns one if left and right are non-zero, otherwise returns zero
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function S64And(left: SInt64; right: SInt64): boolean; external name '_S64And';


{
 *  S64Or()
 *
 *  Discussion:
 *    Returns one if left or right are non-zero, otherwise returns zero
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function S64Or(left: SInt64; right: SInt64): boolean; external name '_S64Or';


{
 *  S64Eor()
 *
 *  Discussion:
 *    Returns one if left xor right are non-zero, otherwise returns zero
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function S64Eor(left: SInt64; right: SInt64): boolean; external name '_S64Eor';


{
 *  S64Not()
 *
 *  Discussion:
 *    Returns one if value is non-zero, otherwisze returns zero.
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function S64Not(value: SInt64): boolean; external name '_S64Not';


{
 *  S64Compare()
 *
 *  Discussion:
 *    Given two signed numbers, left and right, returns an SInt32 that
 *    compares with zero the same way left compares with right.  If you
 *    wanted to perform a comparison on 64-bit integers of the
 *    form:
 *    operand_1 <operation> operand_2
 *    then you could use an expression of the form:
 *     xxxS64Compare(operand_1,operand_2) <operation> 0
 *    to test for the same condition. CAUTION: DO NOT depend on the
 *    exact value returned by this routine. Only the sign (i.e.
 *    positive, zero, or negative) of the result is guaranteed.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function S64Compare(left: SInt64; right: SInt64): SInt32; external name '_S64Compare';


{
 *  S64BitwiseAnd()
 *
 *  Discussion:
 *    bitwise AND
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function S64BitwiseAnd(left: SInt64; right: SInt64): SInt64; external name '_S64BitwiseAnd';


{
 *  S64BitwiseOr()
 *
 *  Discussion:
 *    bitwise OR
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function S64BitwiseOr(left: SInt64; right: SInt64): SInt64; external name '_S64BitwiseOr';


{
 *  S64BitwiseEor()
 *
 *  Discussion:
 *    bitwise XOR
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function S64BitwiseEor(left: SInt64; right: SInt64): SInt64; external name '_S64BitwiseEor';


{
 *  S64BitwiseNot()
 *
 *  Discussion:
 *    bitwise negate
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function S64BitwiseNot(value: SInt64): SInt64; external name '_S64BitwiseNot';


{
 *  S64ShiftRight()
 *
 *  Discussion:
 *    Arithmetic shift of value by the lower 7 bits of the shift.
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function S64ShiftRight(value: SInt64; shift: UInt32): SInt64; external name '_S64ShiftRight';


{
 *  S64ShiftLeft()
 *
 *  Discussion:
 *    Logical shift of value by the lower 7 bits of the shift.
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function S64ShiftLeft(value: SInt64; shift: UInt32): SInt64; external name '_S64ShiftLeft';



{
 *  U64Max()
 *
 *  Discussion:
 *    Returns largest possible UInt64 value
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function U64Max: UInt64; external name '_U64Max';

{
 *  U64Add()
 *
 *  Discussion:
 *    Adds two unsigned integers, producing an SInt16 result.  If an
 *    overflow occurs the result is congruent mod (2^64) as if the
 *    operands and result were unsigned.  No overflow is signaled.
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function U64Add(left: UInt64; right: UInt64): UInt64; external name '_U64Add';

{
 *  U64Subtract()
 *
 *  Discussion:
 *    Subtracts two unsigned integers, producing an SInt16 result.  If
 *    an overflow occurs the result is congruent mod (2^64) as if the
 *    operands and result were unsigned.  No overflow is signaled.
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function U64Subtract(left: UInt64; right: UInt64): UInt64; external name '_U64Subtract';


{
 *  U64Multiply()
 *
 *  Discussion:
 *    Multiplies two unsigned numbers, producing a signed result.
 *    Overflow is ignored and the low-order part of the product is
 *    returned.  The sign of the result is not guaranteed to be correct
 *    if the magnitude of the product is not representable.
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function U64Multiply(left: UInt64; right: UInt64): UInt64; external name '_U64Multiply';



{
 *  U64Divide()
 *
 *  Discussion:
 *    Divides dividend by divisor, returning the quotient.  The
 *    remainder is returned in *remainder if remainder (the pointer) is
 *    non-NULL. The sign of the remainder is the same as the sign of
 *    the dividend (i.e. it takes the absolute values of the operands,
 *    does the division, then fixes the sign of the quotient and
 *    remainder).  If the divisor is zero, then U64Max() will be
 *    returned (or U64Min() if the dividend is negative), and the
 *    remainder will be the dividend; no error is reported.
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function U64Divide(dividend: UInt64; divisor: UInt64; remainder: UInt64Ptr): UInt64; external name '_U64Divide';



{
 *  U64Set()
 *
 *  Discussion:
 *    Given an SInt32, returns an UInt64 with the same value.  Use this
 *    routine instead of coding 64-bit constants (at least when the
 *    constant will fit in an SInt32).
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function U64Set(value: SInt32): UInt64; external name '_U64Set';


{
 *  U64SetU()
 *
 *  Discussion:
 *    Given a UInt32, returns a UInt64 with the same value.
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function U64SetU(value: UInt32): UInt64; external name '_U64SetU';

{
 *  U32SetU()
 *
 *  Discussion:
 *    Given an UInt64, returns an UInt32 by discarding the high-order
 *    32 bits.
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function U32SetU(value: UInt64): UInt32; external name '_U32SetU';


{
 *  U64And()
 *
 *  Discussion:
 *    Returns one if left and right are non-zero, otherwise returns zero
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function U64And(left: UInt64; right: UInt64): boolean; external name '_U64And';


{
 *  U64Or()
 *
 *  Discussion:
 *    Returns one if left or right are non-zero, otherwise returns zero
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function U64Or(left: UInt64; right: UInt64): boolean; external name '_U64Or';


{
 *  U64Eor()
 *
 *  Discussion:
 *    Returns one if left xor right are non-zero, otherwise returns zero
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function U64Eor(left: UInt64; right: UInt64): boolean; external name '_U64Eor';


{
 *  U64Not()
 *
 *  Discussion:
 *    Returns one if value is non-zero, otherwisze returns zero.
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function U64Not(value: UInt64): boolean; external name '_U64Not';


{
 *  U64Compare()
 *
 *  Discussion:
 *    Given two unsigned numbers, left and right, returns an SInt32
 *    that compares with zero the same way left compares with right.
 *    If you wanted to perform a comparison on 64-bit integers of the
 *    form:
 *    operand_1 <operation> operand_2
 *    then you could use an expression of the form:
 *     xxxU64Compare(operand_1,operand_2) <operation> 0
 *    to test for the same condition. CAUTION: DO NOT depend on the
 *    exact value returned by this routine. Only the sign (i.e.
 *    positive, zero, or negative) of the result is guaranteed.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function U64Compare(left: UInt64; right: UInt64): SInt32; external name '_U64Compare';

{
 *  U64BitwiseAnd()
 *
 *  Discussion:
 *    bitwise AND
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function U64BitwiseAnd(left: UInt64; right: UInt64): UInt64; external name '_U64BitwiseAnd';


{
 *  U64BitwiseOr()
 *
 *  Discussion:
 *    bitwise OR
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function U64BitwiseOr(left: UInt64; right: UInt64): UInt64; external name '_U64BitwiseOr';


{
 *  U64BitwiseEor()
 *
 *  Discussion:
 *    bitwise XOR
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function U64BitwiseEor(left: UInt64; right: UInt64): UInt64; external name '_U64BitwiseEor';


{
 *  U64BitwiseNot()
 *
 *  Discussion:
 *    bitwise negate
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function U64BitwiseNot(value: UInt64): UInt64; external name '_U64BitwiseNot';


{
 *  U64ShiftRight()
 *
 *  Discussion:
 *    Arithmetic shift of value by the lower 7 bits of the shift.
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function U64ShiftRight(value: UInt64; shift: UInt32): UInt64; external name '_U64ShiftRight';


{
 *  U64ShiftLeft()
 *
 *  Discussion:
 *    Logical shift of value by the lower 7 bits of the shift.
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function U64ShiftLeft(value: UInt64; shift: UInt32): UInt64; external name '_U64ShiftLeft';



{
 *  UInt64ToSInt64()
 *
 *  Discussion:
 *    converts UInt64 -> SInt64
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function UInt64ToSInt64(value: UInt64): SInt64; external name '_UInt64ToSInt64';


{
 *  SInt64ToUInt64()
 *
 *  Discussion:
 *    converts SInt64 -> UInt64
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SInt64ToUInt64(value: SInt64): UInt64; external name '_SInt64ToUInt64';






{$ALIGN MAC68K}
{#POP}
{unit MixedMode}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}

{ Mixed Mode constants }
{ Current Routine Descriptor Version }

const
    kRoutineDescriptorVersion   = 7;

    {    MixedModeMagic Magic Cookie/Trap number    }
    _MixedModeMagic             = $AAFE;

    {    MixedModeState Version for CFM68K Mixed Mode   }
    kCurrentMixedModeStateRecord = 1;

    {    Calling Conventions    }

type
    CallingConventionType               = UInt16;

const
    kPascalStackBased           = 0;
    kCStackBased                = 1;
    kRegisterBased              = 2;
    kD0DispatchedPascalStackBased = 8;
    kD1DispatchedPascalStackBased = 12;
    kD0DispatchedCStackBased    = 9;
    kStackDispatchedPascalStackBased = 14;
    kThinkCStackBased           = 5;

    {    ISA Types  }

type
    ISAType                             = SInt8;

const
    kM68kISA                    = 0;
    kPowerPCISA                 = 1;

    {    RTA Types  }

type
    RTAType                             = SInt8;

const
    kOld68kRTA                  = $00;
    kPowerPCRTA                 = $00;
    kCFM68kRTA                  = $10;


    GetCurrentISA               = kPowerPCISA;
 GetCurrentRTA               = kPowerPCRTA;
    GetCurrentArchitecture      = GetCurrentISA + GetCurrentRTA;

    {    Constants for specifing 68k 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;                           {  A7 is the same as the PowerPC SP  }
    kCCRegisterCBit             = 16;
    kCCRegisterVBit             = 17;
    kCCRegisterZBit             = 18;
    kCCRegisterNBit             = 19;
    kCCRegisterXBit             = 20;


type
    registerSelectorType                = UInt16;
    {    SizeCodes we use everywhere    }

const
    kNoByteCode                 = 0;
    kOneByteCode                = 1;
    kTwoByteCode                = 2;
    kFourByteCode               = 3;

    {    Mixed Mode Routine Records     }

type
    ProcInfoType                        = UInt32;
    {    Routine Flag Bits  }
    RoutineFlagsType                    = UInt16;

const
    kProcDescriptorIsAbsolute   = $00;
    kProcDescriptorIsRelative   = $01;

    kFragmentIsPrepared         = $00;
    kFragmentNeedsPreparing     = $02;

    kUseCurrentISA              = $00;
    kUseNativeISA               = $04;

    kPassSelector               = $00;
    kDontPassSelector           = $08;

    kRoutineIsNotDispatchedDefaultRoutine = $00;
    kRoutineIsDispatchedDefaultRoutine = $10;

    kProcDescriptorIsProcPtr    = $00;
    kProcDescriptorIsIndex      = $20;


type
    RoutineRecordPtr = ^RoutineRecord;
    RoutineRecord = 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:              UInt32;                                 {  Must be 0  }
        selector:               UInt32;                                 {  For dispatched routines, the selector  }
    end;

    RoutineRecordHandle                 = ^RoutineRecordPtr;
    {    Mixed Mode Routine Descriptors     }
    {    Definitions of the Routine Descriptor Flag Bits    }
    RDFlagsType                         = UInt8;

const
    kSelectorsAreNotIndexable   = $00;
    kSelectorsAreIndexable      = $01;

    {    Routine Descriptor Structure   }

type
    RoutineDescriptorPtr = ^RoutineDescriptor;
    RoutineDescriptor = packed record
        goMixedModeTrap:        UInt16;                                 {  Our A-Trap  }
        version:                SInt8;                                  {  Current Routine Descriptor version  }
        routineDescriptorFlags: RDFlagsType;                            {  Routine Descriptor Flags  }
        reserved1:              UInt32;                                 {  Unused, must be zero  }
        reserved2:              UInt8;                                  {  Unused, must be zero  }
        selectorInfo:           UInt8;                                  {  If a dispatched routine, calling convention, else 0  }
        routineCount:           UInt16;                                 {  Number of routines in this RD  }
        routineRecords:         array [0..0] of RoutineRecord;          {  The individual routines  }
    end;

    RoutineDescriptorHandle             = ^RoutineDescriptorPtr;
    {    68K MixedModeStateRecord   }
    MixedModeStateRecordPtr = ^MixedModeStateRecord;
    MixedModeStateRecord = record
        state1:                 UInt32;
        state2:                 UInt32;
        state3:                 UInt32;
        state4:                 UInt32;
    end;


    {    Mixed Mode ProcInfos   }

const
                                                                {  Calling Convention Offsets  }
    kCallingConventionWidth     = 4;
    kCallingConventionPhase     = 0;
    kCallingConventionMask      = $0F;                          {  Result Offsets  }
    kResultSizeWidth            = 2;
    kResultSizePhase            = 4;
    kResultSizeMask             = $30;                          {  Parameter offsets & widths  }
    kStackParameterWidth        = 2;
    kStackParameterPhase        = 6;
    kStackParameterMask         = $FFFFFFC0;                    {  Register Result Location offsets & widths  }
    kRegisterResultLocationWidth = 5;
    kRegisterResultLocationPhase = 6;                           {  Register Parameter offsets & widths  }
    kRegisterParameterWidth     = 5;
    kRegisterParameterPhase     = 11;
    kRegisterParameterMask      = $7FFFF800;
    kRegisterParameterSizePhase = 0;
    kRegisterParameterSizeWidth = 2;
    kRegisterParameterWhichPhase = 2;
    kRegisterParameterWhichWidth = 3;                           {  Dispatched Stack Routine Selector offsets & widths  }
    kDispatchedSelectorSizeWidth = 2;
    kDispatchedSelectorSizePhase = 6;                           {  Dispatched Stack Routine Parameter offsets  }
    kDispatchedParameterPhase   = 8;                            {  Special Case offsets & widths  }
    kSpecialCaseSelectorWidth   = 6;
    kSpecialCaseSelectorPhase   = 4;
    kSpecialCaseSelectorMask    = $03F0;

    kSpecialCase                = $000F;                        {  (CallingConventionType)  }

                                                                {  all of the special cases enumerated.  The selector field is 6 bits wide  }
    kSpecialCaseHighHook        = 0;
    kSpecialCaseCaretHook       = 0;                            {  same as kSpecialCaseHighHook  }
    kSpecialCaseEOLHook         = 1;
    kSpecialCaseWidthHook       = 2;
    kSpecialCaseTextWidthHook   = 2;                            {  same as kSpecialCaseWidthHook  }
    kSpecialCaseNWidthHook      = 3;
    kSpecialCaseDrawHook        = 4;
    kSpecialCaseHitTestHook     = 5;
    kSpecialCaseTEFindWord      = 6;
    kSpecialCaseProtocolHandler = 7;
    kSpecialCaseSocketListener  = 8;
    kSpecialCaseTERecalc        = 9;
    kSpecialCaseTEDoText        = 10;
    kSpecialCaseGNEFilterProc   = 11;
    kSpecialCaseMBarHook        = 12;


    {
        NOTES ON USING ROUTINE DESCRIPTOR FUNCTIONS

        When calling these routine from classic 68k code there are two possible intentions.

        The first is source compatibility with code ported to CFM (either PowerPC or 68k CFM). When
        the code is compiled for CFM the functions create routine descriptors that can be used by
        the mixed mode manager operating on that machine. When the code is compiled for classic 68k
        these functions do nothing so that the code will run on Macintoshes that do not have a
        mixed mode manager. The dual nature of these functions is achieved by turning the CFM calls
        into "no-op" macros for classic 68k: You can put "NewRoutineDescriptor" in your source,
        compile it for any runtime or instruction set architecture, and it will run correctly on the
        intended runtime/instruction platform. All without source changes and/or conditional source.

        The other intention is for code that "knows" that it is executing as classic 68k runtime
        and is specifically trying to call code of another architecture using mixed mode. Since the
        routines were designed with classic <-> CFM source compatibility in mind this second case
        is treated special. For classic 68k code to create routines descriptors for use by mixed mode
        it must call the "Trap" versions of the routines (NewRoutineDescriptorTrap). These versions
        are only available to classic 68k callers: rigging the interfaces to allow calling them
        from CFM code will result in runtime failure because no shared library implements or exports
        the functions.


        This almost appears seamless until you consider "fat" routine descriptors and the advent of
        CFM-68K. What does "fat" mean? CFM-68K is not emulated on PowerPC and PowerPC is not emulated
        on CFM-68K. It makes no sense to create a routine descriptor having both a CFM-68K routine
        and a PowerPC native routine pointer. Therefore "fat" is defined to be a mix of classic and
        CFM for the hardware's native instruction set: on PowerPC fat is classic and PowerPC native,
        on a 68k machine with CFM-68K installed fat is classic and CFM-68K.

        By definition fat routine descriptors are only constructed by code that is aware of the
        architecture it is executing as and that another architecture exists. Source compatibility
        between code intented as pure classic and pure CFM is not an issue and so NewFatRoutineDescriptor
        is not available when building pure classic code.

        NewFatRoutineDescriptorTrap is available to classic code on both PowerPC and CFM-68K. The
        classic code can use the code fragment manager routine "FindSymbol" to obtain the address of
        a routine in a shared library and then construct a routine descriptor with both the CFM routine
        and classic routine.
        }




{
    CallUniversalProc is defined for all targets except classic 68k code.  This will
    catch accidental calls from classic 68K code that previously only showed up as
    linker errors.
}


{ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 *
 *  Macros for building ProcInfos.  Examples:
 *
 *
 *  uppModalFilterProcInfo = kPascalStackBased
 *       | RESULT_SIZE(SIZE_CODE(sizeof(Boolean)))
 *       | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(DialogRef)))
 *       | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(EventRecord*)))
 *       | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(short*))),
 *
 *  uppDeskHookProcInfo = kRegisterBased
 *       | REGISTER_ROUTINE_PARAMETER(1, kRegisterD0, SIZE_CODE(sizeof(Boolean)))
 *       | REGISTER_ROUTINE_PARAMETER(2, kRegisterA0, SIZE_CODE(sizeof(EventRecord*)))
 *
 *  uppGXSpoolResourceProcInfo = kCStackBased
 *       | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
 *       | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(gxSpoolFile)))
 *       | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(Handle)))
 *       | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(ResType)))
 *       | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(long)))
 *
 *  uppTEFindWordProcInfo = SPECIAL_CASE_PROCINFO( 6 ),
 *
 }





{$ALIGN MAC68K}
{#POP}
{unit Multiprocessing}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN POWER}
{#LibExport+}


{
   ===========================================================================================
   This is the header file for version 2.4 of the Mac OS multiprocessing support.  This version
   has been totally reimplemented and has significant new services.  The main goal of the
   reimplementation has been to transfer task management into the core operating system to provide
   much more reliable and more efficient operation, including on single processor machines.
   The memory management has also been massively improved, it is much faster and wastes much
   less space.  New services include POSIX style per-task storage, timers with millisecond and
   microsecond resolutions, memory allocation at a specified alignment, and system pageable
   and RAM resident memory pools.  See the MP API documentation for details.
   The old "DayStar" debugging services (whose names began with an underscore) have been
   removed from this header.  A very few are still implemented for binary compatibility, or in
   cases where they happened to be exposed inappropriately.  (E.g. _MPIsFullyInitialized must
   be called to see if the MP API is ReallyTrulyª usable.)  New code and recompiles of old
   code should avoid use of these defunct services, except for _MPIsFullyInitialized.
   ===========================================================================================
}


{
   ===========================================================================================
   The following services are from the original MP API and remain supported in version 2.0:
    MPProcessors
    MPCreateTask
    MPTerminateTask
    MPCurrentTaskID
    MPYield
    MPExit
    MPCreateQueue
    MPDeleteQueue
    MPNotifyQueue
    MPWaitOnQueue
    MPCreateSemaphore
    MPCreateBinarySemaphore     (In C only, a macro that calls MPCreateSemaphore.)
    MPDeleteSemaphore
    MPSignalSemaphore
    MPWaitOnSemaphore
    MPCreateCriticalRegion
    MPDeleteCriticalRegion
    MPEnterCriticalRegion
    MPExitCriticalRegion
    MPAllocate                  (Deprecated, use MPAllocateAligned for new builds.)
    MPFree
    MPBlockCopy
    MPLibraryIsLoaded           (In C only, a macro.)
    _MPIsFullyInitialized       (See comments about checking for MP API availability.)
   ===========================================================================================
}


{
   ===========================================================================================
   The following services are new in version 2.0:
    MPProcessorsScheduled
    MPSetTaskWeight
    MPTaskIsPreemptive
    MPAllocateTaskStorageIndex
    MPDeallocateTaskStorageIndex
    MPSetTaskStorageValue
    MPGetTaskStorageValue
    MPSetQueueReserve
    MPCreateEvent
    MPDeleteEvent
    MPSetEvent
    MPWaitForEvent
    UpTime
    DurationToAbsolute
    AbsoluteToDuration
    MPDelayUntil
    MPCreateTimer
    MPDeleteTimer
    MPSetTimerNotify
    MPArmTimer
    MPCancelTimer
    MPSetExceptionHandler
    MPThrowException
    MPDisposeTaskException
    MPExtractTaskState
    MPSetTaskState
    MPRegisterDebugger
    MPUnregisterDebugger
    MPAllocateAligned           (Preferred over MPAllocate.)
    MPGetAllocatedBlockSize
    MPBlockClear
    MPDataToCode
    MPRemoteCall                (Preferred over _MPRPC.)
   ===========================================================================================
}


{
   ===========================================================================================
   The following services are new in version 2.1:
    MPCreateNotification
    MPDeleteNotification
    MPModifyNotification
    MPCauseNotification
    MPGetNextTaskID
    MPGetNextCpuID
   ===========================================================================================
}


{
   ===========================================================================================
   The following services are "unofficial" extensions to the original API.  They are not in
   the multiprocessing API documentation, but were in previous versions of this header.  They
   remain supported in version 2.0.  They may not be supported in other environments.
    _MPRPC                      (Deprecated, use MPRemoteCall for new builds.)
    _MPAllocateSys              (Deprecated, use MPAllocateAligned for new builds.)
    _MPTaskIsToolboxSafe
    _MPLibraryVersion
    _MPLibraryIsCompatible
   ===========================================================================================
}


{
   ===========================================================================================
   The following services were in previous versions of this header for "debugging only" use.
   They are NOT implemented in version 2.0.  For old builds they can be accessed by defining
   the symbol MPIncludeDefunctServices to have a nonzero value.
    _MPInitializePrintf
    _MPPrintf
    _MPDebugStr
    _MPStatusPString
    _MPStatusCString
   ===========================================================================================
}


{
   ¤
   ===========================================================================================
   General Types and Constants
   ===========================
}




const
    MPLibrary_MajorVersion      = 2;                            {  ! When these change be sure to update the build versions }
    MPLibrary_MinorVersion      = 4;                            {  !  used in the startup check in MPInitializeAPI! }
    MPLibrary_Release           = 1;
    MPLibrary_DevelopmentRevision = 1;




type
    MPProcessID    = ^SInt32; { an opaque 32-bit type }
    MPProcessIDPtr = ^MPProcessID;  { when a var xx:MPProcessID parameter can be nil, it is changed to xx: MPProcessIDPtr }
    MPTaskID    = ^SInt32; { an opaque 32-bit type }
    MPTaskIDPtr = ^MPTaskID;  { when a var xx:MPTaskID parameter can be nil, it is changed to xx: MPTaskIDPtr }
    MPQueueID    = ^SInt32; { an opaque 32-bit type }
    MPQueueIDPtr = ^MPQueueID;  { when a var xx:MPQueueID parameter can be nil, it is changed to xx: MPQueueIDPtr }
    MPSemaphoreID    = ^SInt32; { an opaque 32-bit type }
    MPSemaphoreIDPtr = ^MPSemaphoreID;  { when a var xx:MPSemaphoreID parameter can be nil, it is changed to xx: MPSemaphoreIDPtr }
    MPCriticalRegionID    = ^SInt32; { an opaque 32-bit type }
    MPCriticalRegionIDPtr = ^MPCriticalRegionID;  { when a var xx:MPCriticalRegionID parameter can be nil, it is changed to xx: MPCriticalRegionIDPtr }
    MPTimerID    = ^SInt32; { an opaque 32-bit type }
    MPTimerIDPtr = ^MPTimerID;  { when a var xx:MPTimerID parameter can be nil, it is changed to xx: MPTimerIDPtr }
    MPEventID    = ^SInt32; { an opaque 32-bit type }
    MPEventIDPtr = ^MPEventID;  { when a var xx:MPEventID parameter can be nil, it is changed to xx: MPEventIDPtr }
    MPAddressSpaceID    = ^SInt32; { an opaque 32-bit type }
    MPAddressSpaceIDPtr = ^MPAddressSpaceID;  { when a var xx:MPAddressSpaceID parameter can be nil, it is changed to xx: MPAddressSpaceIDPtr }
    MPNotificationID    = ^SInt32; { an opaque 32-bit type }
    MPNotificationIDPtr = ^MPNotificationID;  { when a var xx:MPNotificationID parameter can be nil, it is changed to xx: MPNotificationIDPtr }
    MPCoherenceID    = ^SInt32; { an opaque 32-bit type }
    MPCoherenceIDPtr = ^MPCoherenceID;  { when a var xx:MPCoherenceID parameter can be nil, it is changed to xx: MPCoherenceIDPtr }
    MPCpuID    = ^SInt32; { an opaque 32-bit type }
    MPCpuIDPtr = ^MPCpuID;  { when a var xx:MPCpuID parameter can be nil, it is changed to xx: MPCpuIDPtr }
    MPAreaID    = ^SInt32; { an opaque 32-bit type }
    MPAreaIDPtr = ^MPAreaID;  { when a var xx:MPAreaID parameter can be nil, it is changed to xx: MPAreaIDPtr }
    MPConsoleID    = ^SInt32; { an opaque 32-bit type }
    MPConsoleIDPtr = ^MPConsoleID;  { when a var xx:MPConsoleID parameter can be nil, it is changed to xx: MPConsoleIDPtr }
    MPOpaqueID    = ^SInt32; { an opaque 32-bit type }
    MPOpaqueIDPtr = ^MPOpaqueID;  { when a var xx:MPOpaqueID parameter can be nil, it is changed to xx: MPOpaqueIDPtr }

const
                                                                {  Values for MPOpaqueIDClass. }
    kOpaqueAnyID                = 0;
    kOpaqueProcessID            = 1;
    kOpaqueTaskID               = 2;
    kOpaqueTimerID              = 3;
    kOpaqueQueueID              = 4;
    kOpaqueSemaphoreID          = 5;
    kOpaqueCriticalRegionID     = 6;
    kOpaqueCpuID                = 7;
    kOpaqueAddressSpaceID       = 8;
    kOpaqueEventID              = 9;
    kOpaqueCoherenceID          = 10;
    kOpaqueAreaID               = 11;
    kOpaqueNotificationID       = 12;
    kOpaqueConsoleID            = 13;


type
    MPOpaqueIDClass                     = UInt32;


const
    kMPNoID                     = 0;                            {  New code should use kInvalidID everywhere. }



type
    MPTaskOptions                       = OptionBits;
    TaskStorageIndex                    = UInt32;
    TaskStorageValue                    = UInt32;
    MPSemaphoreCount                    = ItemCount;
    MPTaskWeight                        = UInt32;
    MPEventFlags                        = UInt32;
    MPEventFlagsPtr                     = ^MPEventFlags; { when a VAR xx: MPEventFlags parameter can be nil, it is changed to xx: MPEventFlagsPtr }
    MPExceptionKind                     = UInt32;
    MPTaskStateKind                     = UInt32;
    MPPageSizeClass                     = UInt32;


const
    kDurationImmediate          = 0;
    kDurationForever            = $7FFFFFFF;
    kDurationMillisecond        = 1;
    kDurationMicrosecond        = -1;


    {
       ¤
       ===========================================================================================
       Process/Processor Services
       ==========================
    }



    {
     *  MPProcessors()
     *
     *  Availability:
     *    Non-Carbon CFM:   in MPLibrary 1.0 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function MPProcessors: ItemCount; external name '_MPProcessors';

{  The physical total. }

{
 *  MPProcessorsScheduled()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MPLibrary 2.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function MPProcessorsScheduled: ItemCount; external name '_MPProcessorsScheduled';

{  Those currently in use. }

{
   ¤
   ===========================================================================================
   Tasking Services
   ================
}




const
                                                                {  For MPCreateTask options }
    kMPCreateTaskTakesAllExceptionsMask = $00000002;
    kMPCreateTaskNotDebuggableMask = $00000004;
    kMPCreateTaskValidOptionsMask = $00000006;


    {  ------------------------------------------------------------------------------------------- }





type
    TaskProc = function(parameter: UnivPtr): OSStatus;


    {
     *  MPCreateTask()
     *
     *  Availability:
     *    Non-Carbon CFM:   in MPLibrary 1.0 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function MPCreateTask(entryPoint: TaskProc; parameter: UnivPtr; stackSize: ByteCount; notifyQueue: MPQueueID; terminationParameter1: UnivPtr; terminationParameter2: UnivPtr; options: MPTaskOptions; task: MPTaskIDPtr): OSStatus; external name '_MPCreateTask';



{
 *  MPTerminateTask()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MPLibrary 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function MPTerminateTask(task: MPTaskID; terminationStatus: OSStatus): OSStatus; external name '_MPTerminateTask';



{
 *  MPSetTaskWeight()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MPLibrary 2.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function MPSetTaskWeight(task: MPTaskID; weight: MPTaskWeight): OSStatus; external name '_MPSetTaskWeight';



{
 *  MPTaskIsPreemptive()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MPLibrary 2.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function MPTaskIsPreemptive(taskID: MPTaskID): boolean; external name '_MPTaskIsPreemptive';

{  May be kInvalidID. }

{
 *  MPExit()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MPLibrary 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure MPExit(status: OSStatus); external name '_MPExit';



{
 *  MPYield()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MPLibrary 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure MPYield; external name '_MPYield';



{
 *  MPCurrentTaskID()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MPLibrary 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function MPCurrentTaskID: MPTaskID; external name '_MPCurrentTaskID';



{
 *  MPSetTaskType()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MPLibrary 2.3 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function MPSetTaskType(task: MPTaskID; taskType: OSType): OSStatus; external name '_MPSetTaskType';


{  ------------------------------------------------------------------------------------------- }


{
   ---------------------------------------------------
   ! The task storage services are new in version 2.0.
}



{
 *  MPAllocateTaskStorageIndex()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MPLibrary 2.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function MPAllocateTaskStorageIndex(var index: TaskStorageIndex): OSStatus; external name '_MPAllocateTaskStorageIndex';



{
 *  MPDeallocateTaskStorageIndex()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MPLibrary 2.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function MPDeallocateTaskStorageIndex(index: TaskStorageIndex): OSStatus; external name '_MPDeallocateTaskStorageIndex';



{
 *  MPSetTaskStorageValue()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MPLibrary 2.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function MPSetTaskStorageValue(index: TaskStorageIndex; value: TaskStorageValue): OSStatus; external name '_MPSetTaskStorageValue';



{
 *  MPGetTaskStorageValue()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MPLibrary 2.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function MPGetTaskStorageValue(index: TaskStorageIndex): TaskStorageValue; external name '_MPGetTaskStorageValue';


{
   ¤
   ===========================================================================================
   Synchronization Services
   ========================
}



{
 *  MPCreateQueue()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MPLibrary 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function MPCreateQueue(var queue: MPQueueID): OSStatus; external name '_MPCreateQueue';



{
 *  MPDeleteQueue()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MPLibrary 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function MPDeleteQueue(queue: MPQueueID): OSStatus; external name '_MPDeleteQueue';



{
 *  MPNotifyQueue()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MPLibrary 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function MPNotifyQueue(queue: MPQueueID; param1: UnivPtr; param2: UnivPtr; param3: UnivPtr): OSStatus; external name '_MPNotifyQueue';



{
 *  MPWaitOnQueue()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MPLibrary 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function MPWaitOnQueue(queue: MPQueueID; param1: UnivPtr; param2: UnivPtr; param3: UnivPtr; timeout: Duration): OSStatus; external name '_MPWaitOnQueue';



{
 *  MPSetQueueReserve()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MPLibrary 2.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function MPSetQueueReserve(queue: MPQueueID; count: ItemCount): OSStatus; external name '_MPSetQueueReserve';


{  ------------------------------------------------------------------------------------------- }



{
 *  MPCreateSemaphore()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MPLibrary 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function MPCreateSemaphore(maximumValue: MPSemaphoreCount; initialValue: MPSemaphoreCount; var semaphore: MPSemaphoreID): OSStatus; external name '_MPCreateSemaphore';



{
 *  MPDeleteSemaphore()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MPLibrary 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function MPDeleteSemaphore(semaphore: MPSemaphoreID): OSStatus; external name '_MPDeleteSemaphore';



{
 *  MPSignalSemaphore()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MPLibrary 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function MPSignalSemaphore(semaphore: MPSemaphoreID): OSStatus; external name '_MPSignalSemaphore';



{
 *  MPWaitOnSemaphore()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MPLibrary 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function MPWaitOnSemaphore(semaphore: MPSemaphoreID; timeout: Duration): OSStatus; external name '_MPWaitOnSemaphore';



{  ------------------------------------------------------------------------------------------- }



{
 *  MPCreateCriticalRegion()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MPLibrary 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function MPCreateCriticalRegion(var criticalRegion: MPCriticalRegionID): OSStatus; external name '_MPCreateCriticalRegion';



{
 *  MPDeleteCriticalRegion()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MPLibrary 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function MPDeleteCriticalRegion(criticalRegion: MPCriticalRegionID): OSStatus; external name '_MPDeleteCriticalRegion';



{
 *  MPEnterCriticalRegion()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MPLibrary 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function MPEnterCriticalRegion(criticalRegion: MPCriticalRegionID; timeout: Duration): OSStatus; external name '_MPEnterCriticalRegion';



{
 *  MPExitCriticalRegion()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MPLibrary 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function MPExitCriticalRegion(criticalRegion: MPCriticalRegionID): OSStatus; external name '_MPExitCriticalRegion';


{  ------------------------------------------------------------------------------------------- }


{
 *  MPCreateEvent()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MPLibrary 2.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function MPCreateEvent(var event: MPEventID): OSStatus; external name '_MPCreateEvent';


{
 *  MPDeleteEvent()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MPLibrary 2.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function MPDeleteEvent(event: MPEventID): OSStatus; external name '_MPDeleteEvent';



{
 *  MPSetEvent()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MPLibrary 2.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function MPSetEvent(event: MPEventID; flags: MPEventFlags): OSStatus; external name '_MPSetEvent';


{
 *  MPWaitForEvent()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MPLibrary 2.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function MPWaitForEvent(event: MPEventID; flags: MPEventFlagsPtr; timeout: Duration): OSStatus; external name '_MPWaitForEvent';

{
   ¤
   ===========================================================================================
   Notification Services (API)
   =====================
}



{
 *  MPCreateNotification()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MPLibrary 2.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function MPCreateNotification(var notificationID: MPNotificationID): OSStatus; external name '_MPCreateNotification';



{
 *  MPDeleteNotification()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MPLibrary 2.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function MPDeleteNotification(notificationID: MPNotificationID): OSStatus; external name '_MPDeleteNotification';



{
 *  MPModifyNotification()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MPLibrary 2.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function MPModifyNotification(notificationID: MPNotificationID; anID: MPOpaqueID; notifyParam1: UnivPtr; notifyParam2: UnivPtr; notifyParam3: UnivPtr): OSStatus; external name '_MPModifyNotification';



{
 *  MPModifyNotificationParameters()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MPLibrary 2.3 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function MPModifyNotificationParameters(notificationID: MPNotificationID; kind: MPOpaqueIDClass; notifyParam1: UnivPtr; notifyParam2: UnivPtr; notifyParam3: UnivPtr): OSStatus; external name '_MPModifyNotificationParameters';



{
 *  MPCauseNotification()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MPLibrary 2.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function MPCauseNotification(notificationID: MPNotificationID): OSStatus; external name '_MPCauseNotification';


{
   ¤
   ===========================================================================================
   Timer Services
   ==============
}


{
   --------------------------------------------
   ! The timer services are new in version 2.0.
}


{
   Utilities you might want to use from DriverServices
    extern AbsoluteTime UpTime              ( void );
    extern AbsoluteTime DurationToAbsolute  ( Duration      duration );
    extern Duration     AbsoluteToDuration  ( AbsoluteTime  time );
}





const
                                                                {  For MPArmTimer options }
    kMPPreserveTimerIDMask      = $00000001;
    kMPTimeIsDeltaMask          = $00000002;
    kMPTimeIsDurationMask       = $00000004;



    {
     *  MPDelayUntil()
     *
     *  Availability:
     *    Non-Carbon CFM:   in MPLibrary 2.0 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function MPDelayUntil(var expirationTime: AbsoluteTime): OSStatus; external name '_MPDelayUntil';




{
 *  MPCreateTimer()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MPLibrary 2.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function MPCreateTimer(var timerID: MPTimerID): OSStatus; external name '_MPCreateTimer';



{
 *  MPDeleteTimer()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MPLibrary 2.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function MPDeleteTimer(timerID: MPTimerID): OSStatus; external name '_MPDeleteTimer';



{
 *  MPSetTimerNotify()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MPLibrary 2.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function MPSetTimerNotify(timerID: MPTimerID; anID: MPOpaqueID; notifyParam1: UnivPtr; notifyParam2: UnivPtr; notifyParam3: UnivPtr): OSStatus; external name '_MPSetTimerNotify';



{
 *  MPArmTimer()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MPLibrary 2.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function MPArmTimer(timerID: MPTimerID; var expirationTime: AbsoluteTime; options: OptionBits): OSStatus; external name '_MPArmTimer';



{
 *  MPCancelTimer()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MPLibrary 2.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function MPCancelTimer(timerID: MPTimerID; timeRemaining: AbsoluteTimePtr): OSStatus; external name '_MPCancelTimer';


{
   ¤
   ===========================================================================================
   Memory Services
   ===============
}



const
                                                                {  Maximum allocation request size is 1GB. }
    kMPMaxAllocSize             = 1073741824;

                                                                {  Values for the alignment parameter to MPAllocateAligned. }
    kMPAllocateDefaultAligned   = 0;
    kMPAllocate8ByteAligned     = 3;
    kMPAllocate16ByteAligned    = 4;
    kMPAllocate32ByteAligned    = 5;
    kMPAllocate1024ByteAligned  = 10;
    kMPAllocate4096ByteAligned  = 12;
    kMPAllocateMaxAlignment     = 16;                           {  Somewhat arbitrary limit on expectations. }
    kMPAllocateAltiVecAligned   = 4;                            {  The P.C. name. }
    kMPAllocateVMXAligned       = 4;                            {  The older, common name. }
    kMPAllocateVMPageAligned    = 254;                          {  Pseudo value, converted at runtime. }
    kMPAllocateInterlockAligned = 255;                          {  Pseudo value, converted at runtime. }



                                                                {  Values for the options parameter to MPAllocateAligned. }
    kMPAllocateClearMask        = $0001;                        {  Zero the allocated block. }
    kMPAllocateGloballyMask     = $0002;                        {  Allocate from the globally visible pool. }
    kMPAllocateResidentMask     = $0004;                        {  Allocate from the RAM-resident pool. }
    kMPAllocateNoGrowthMask     = $0010;                        {  Do not attempt to grow the pool. }
    kMPAllocateNoCreateMask     = $0020;                        {  Do not attempt to create the pool if it doesn't exist yet. }


    {  ------------------------------------------------------------------------------------------- }



    {
     *  MPAllocateAligned()
     *
     *  Availability:
     *    Non-Carbon CFM:   in MPLibrary 2.0 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function MPAllocateAligned(size: ByteCount; alignment: ByteParameter; options: OptionBits): LogicalAddress; external name '_MPAllocateAligned';

{  ! MPAllocateAligned is new in version 2.0. }

{
 *  MPAllocate()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MPLibrary 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function MPAllocate(size: ByteCount): LogicalAddress; external name '_MPAllocate';

{  Use MPAllocateAligned instead. }

{
 *  MPFree()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MPLibrary 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure MPFree(objct: LogicalAddress); external name '_MPFree';



{
 *  MPGetAllocatedBlockSize()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MPLibrary 2.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function MPGetAllocatedBlockSize(objct: LogicalAddress): ByteCount; external name '_MPGetAllocatedBlockSize';


{  ------------------------------------------------------------------------------------------- }



{
 *  MPBlockCopy()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MPLibrary 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure MPBlockCopy(source: LogicalAddress; destination: LogicalAddress; size: ByteCount); external name '_MPBlockCopy';



{
 *  MPBlockClear()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MPLibrary 2.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure MPBlockClear(address: LogicalAddress; size: ByteCount); external name '_MPBlockClear';

{  ! MPBlockClear is new in version 2.0. }

{
 *  MPDataToCode()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MPLibrary 2.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure MPDataToCode(address: LogicalAddress; size: ByteCount); external name '_MPDataToCode';

{  ! MPDataToCode is new in version 2.0. }
{
   ¤
   ===========================================================================================
   Exception/Debugging Services
   ============================
}


{
   -------------------------------------------------------------------------------------------
   *** Important Note ***
   ----------------------

   The functions MPExtractTaskState and MPSetTaskState infer the size of the "info" buffer
   from the "kind" parameter.  A given value for MPTaskStateKind will always refer to a
   single specific physical buffer layout.  Should new register sets be added, or the size
   or number of any registers change, new values of MPTaskStateKind will be introduced to
   refer to the new buffer layouts.

   The following types for the buffers are in MachineExceptions. The correspondence between
   MPTaskStateKind values and MachineExceptions types is:

        kMPTaskStateRegisters               -> RegisterInformation
        kMPTaskStateFPU                     -> FPUInformation
        kMPTaskStateVectors                 -> VectorInformation
        kMPTaskStateMachine                 -> MachineInformation
        kMPTaskState32BitMemoryException    -> ExceptionInfo for old-style 32-bit memory exceptions

    For reference, on PowerPC the MachineExceptions types contain:

        RegisterInformation -> The GPRs, 32 values of 64 bits each.
        FPUInformation      -> The FPRs plus FPSCR, 32 values of 64 bits each, one value of
                                32 bits.
        VectorInformation   -> The AltiVec vector registers plus VSCR and VRSave, 32 values
                                of 128 bits each, one value of 128 bits, and one 32 bit value.
        MachineInformation  -> The CTR, LR, PC, each of 64 bits.  The CR, XER, MSR, MQ,
                                exception kind, and DSISR, each of 32 bits.  The 64 bit DAR.
        ExceptionInfo       -> Only memory exceptions are specified, 4 fields of 32 bits each.
                                Note that this type only covers memory exceptions on 32-bit CPUs!
   The following types are declared here:
        kMPTaskStateTaskInfo                -> MPTaskInfo
}




const
                                                                {  Values for the TaskStateKind to MPExtractTaskState and MPSetTaskState. }
    kMPTaskStateRegisters       = 0;                            {  The task general registers. }
    kMPTaskStateFPU             = 1;                            {  The task floating point registers }
    kMPTaskStateVectors         = 2;                            {  The task vector registers }
    kMPTaskStateMachine         = 3;                            {  The task machine registers }
    kMPTaskState32BitMemoryException = 4;                       {  The task memory exception information for 32-bit CPUs. }
    kMPTaskStateTaskInfo        = 5;                            {  Static and dynamic information about the task. }



                                                                {  Option bits and numbers for MPDisposeTaskException. }
    kMPTaskPropagate            = 0;                            {  The exception is propagated. }
    kMPTaskResumeStep           = 1;                            {  The task is resumed and single step is enabled. }
    kMPTaskResumeBranch         = 2;                            {  The task is resumed and branch stepping is enabled. }
    kMPTaskResumeMask           = $0000;                        {  The task is resumed. }
    kMPTaskPropagateMask        = $01;                          {  The exception is propagated. }
    kMPTaskResumeStepMask       = $02;                          {  The task is resumed and single step is enabled. }
    kMPTaskResumeBranchMask     = $04;                          {  The task is resumed and branch stepping is enabled. }



                                                                {  For kMPTaskStateTaskInfo, the task's runState }
    kMPTaskBlocked              = 0;                            {  Task is blocked (queued on resource) }
    kMPTaskReady                = 1;                            {  Task is runnable }
    kMPTaskRunning              = 2;                            {  Task is running }

                                                                {  For kMPTaskStateTaskInfo, the version of the MPTaskInfo structure requested. }
    kMPTaskInfoVersion          = 3;



type
    MPTaskInfoPtr = ^MPTaskInfo;
    MPTaskInfo = record
        version:                PBVersion;                              {  Version 3 of the data structure requested }
        name:                   OSType;                                 {  Task name }
        queueName:              OSType;                                 {  Task's queue owner name }
        runState:               UInt16;                                 {  Running, ready, blocked }
        lastCPU:                UInt16;                                 {  Address of CPU where task previously ran }
        weight:                 UInt32;                                 {  Processing weight: 1 - 10,000 }
        processID:              MPProcessID;                            {  Owning process ID }
        cpuTime:                AbsoluteTime;                           {  Accumulated task time }
        schedTime:              AbsoluteTime;                           {  Time when last scheduled }
        creationTime:           AbsoluteTime;                           {  Time when task created }
        codePageFaults:         ItemCount;                              {  Page faults from code execution }
        dataPageFaults:         ItemCount;                              {  Page faults from data access }
        preemptions:            ItemCount;                              {  Number of times task was preempted }
        cpuID:                  MPCpuID;                                {  ID of CPU where task previously ran. }
        blockedObject:          MPOpaqueID;                             {  ID of blocked object. }
        spaceID:                MPAddressSpaceID;                       {  Address space ID of this task. }
        stackBase:              LogicalAddress;                         {  Base of stack (lowest address). }
        stackLimit:             LogicalAddress;                         {  Stack limit (highest address). }
        stackCurr:              LogicalAddress;                         {  Current stack address. }
    end;

    {
        Upon a task exception, the following message is sent to the designated queue:
          1. The MPTaskID,
          2. The exception kind. These are enumerated in the interfaces header MachineExceptions.h
          3. N/A
    }


    {  ------------------------------------------------------------------------------------------- }



    {
     *  MPSetExceptionHandler()
     *
     *  Availability:
     *    Non-Carbon CFM:   in MPLibrary 2.0 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function MPSetExceptionHandler(task: MPTaskID; exceptionQ: MPQueueID): OSStatus; external name '_MPSetExceptionHandler';



{
 *  MPDisposeTaskException()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MPLibrary 2.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function MPDisposeTaskException(task: MPTaskID; action: OptionBits): OSStatus; external name '_MPDisposeTaskException';



{
 *  MPExtractTaskState()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MPLibrary 2.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function MPExtractTaskState(task: MPTaskID; kind: MPTaskStateKind; info: UnivPtr): OSStatus; external name '_MPExtractTaskState';



{
 *  MPSetTaskState()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MPLibrary 2.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function MPSetTaskState(task: MPTaskID; kind: MPTaskStateKind; info: UnivPtr): OSStatus; external name '_MPSetTaskState';



{
 *  MPThrowException()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MPLibrary 2.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function MPThrowException(task: MPTaskID; kind: MPExceptionKind): OSStatus; external name '_MPThrowException';


{  ------------------------------------------------------------------------------------------- }



type
    MPDebuggerLevel             = UInt32;
const
    kMPLowLevelDebugger         = $00000000;                    {  MacsBug-like }
    kMPMidLevelDebugger         = $10000000;                    {  Jasik-like }
    kMPHighLevelDebugger        = $20000000;                    {  Metrowerks-like }



    {
     *  MPRegisterDebugger()
     *
     *  Availability:
     *    Non-Carbon CFM:   in MPLibrary 2.0 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function MPRegisterDebugger(queue: MPQueueID; level: MPDebuggerLevel): OSStatus; external name '_MPRegisterDebugger';



{
 *  MPUnregisterDebugger()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MPLibrary 2.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function MPUnregisterDebugger(queue: MPQueueID): OSStatus; external name '_MPUnregisterDebugger';


{
   ¤
   ===========================================================================================
   Remote Call Services
   ====================
}




type
    MPRemoteProcedure = function(parameter: UnivPtr): Ptr;

    MPRemoteContext                     = UInt8;

const
    kMPAnyRemoteContext         = 0;
    kMPOwningProcessRemoteContext = 1;
    kMPInterruptRemoteContext   = 2;
    kMPAsyncInterruptRemoteContext = 3;



    {
     *  MPRemoteCall()
     *
     *  Availability:
     *    Non-Carbon CFM:   in MPLibrary 2.0 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function MPRemoteCall(remoteProc: MPRemoteProcedure; parameter: UnivPtr; context: ByteParameter): Ptr; external name '_MPRemoteCall';

{  ! MPRemoteCall is new in version 2.0. }
{
   ¤
   ===========================================================================================
   Checking API Availability
   =========================
}


{
   ===========================================================================================
   *** WARNING: You must properly check the availability of MP services before calling them!
   ===========================================================================================

   Checking for the availability of the MP API is rather ugly.  This is a historical problem,
   caused by the original implementation letting itself get prepared when it really wasn't
   usable and complicated by some important clients then depending on weak linking to "work".
   (And further complicated by CFM not supporting "deferred" imports, which is how many
   programmers think weak imports work.)

   The end result is that the MP API library may get prepared by CFM but be totally unusable.
   This means that if you import from the MP API library, you cannot simply check for a
   resolved import to decide if MP services are available.  Worse, if you explicitly prepare
   the MP API library you cannot assume that a noErr result from GetSharedLibrary means that
   MP services are available.

   ¥ If you import from the MP API library you MUST:

        Use the MPLibraryIsLoaded macro (or equivalent code in languages other than C) to tell
        if the MP API services are available.  It is not sufficient to simply check that an
        imported symbol is resolved as is commonly done for other libraries.  The macro expands
        to the expression:

            ( ( (UInt32)_MPIsFullyInitialized != (UInt32)kUnresolvedCFragSymbolAddress ) &&
              ( _MPIsFullyInitialized () ) )

        This checks if the imported symbol _MPIsFullyInitialized is resolved and if resolved
        calls it.  Both parts must succeed for the MP API services to be available.

   ¥ If you explicitly prepare the MP API library you MUST:

        Use code similar to the following example to tell if the MP API services are available.
        It is not sufficient to depend on just a noErr result from GetSharedLibrary.

            OSErr                       err;
            Boolean                     mpIsAvailable           = false;
            CFragConnectionID           connID                  = kInvalidID;
            MPIsFullyInitializedProc    mpIsFullyInitialized    = NULL;

            err = GetSharedLibrary  ( "\pMPLibrary", kCompiledCFragArch, kReferenceCFrag,
                                      &connID, NULL, NULL );

            if ( err == noErr ) (
                err = FindSymbol    ( connID, "\p_MPIsFullyInitialized",
                                      (Ptr *) &mpIsFullyInitialized, NULL );
            )

            if ( err == noErr ) (
                mpIsAvailable = (* mpIsFullyInitialized) ();
            )

   ===========================================================================================
}


{
 *  _MPIsFullyInitialized()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MPLibrary 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function _MPIsFullyInitialized: boolean; external name '__MPIsFullyInitialized';


type
    MPIsFullyInitializedProc = function: boolean;

    {
       ===========================================================================================
       The MPLibraryIsLoaded service is a macro under C that expands to the logical expression:
            ( (UInt32)MPProcessors != (UInt32)kUnresolvedCFragSymbolAddress )
       The intention is to check if the imported symbol MPProcessors is resolved.  For other
       languages use the equivalent expression.
       ===========================================================================================
    }
    {
       ¤
       ===========================================================================================
       Miscellaneous Services
       ======================
    }



    {
     *  _MPLibraryVersion()
     *
     *  Availability:
     *    Non-Carbon CFM:   in MPLibrary 1.0 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
procedure _MPLibraryVersion(versionCString: ConstCStringPtrPtr; major: UInt32Ptr; minor: UInt32Ptr; release: UInt32Ptr; revision: UInt32Ptr); external name '__MPLibraryVersion';



{
   ¤
   ===========================================================================================
   Unofficial Services
   ===================
}


{
   ===========================================================================================
   *** WARNING ***
   These services are not part of the officially documented multiprocessing API.  They may not
   be avaliable in future versions of Mac OS multiprocessing support, or in environments that
   have a different underlying OS architecture such as Mac OS on top of a microkernel, the
   Mac OS Blue Box under Mac OS X, native MP support in Mac OS X, etc.
   ===========================================================================================
}


{
 *  _MPLibraryIsCompatible()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MPLibrary 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function _MPLibraryIsCompatible(versionCString: ConstCStringPtr; major: UInt32; minor: UInt32; release: UInt32; revision: UInt32): boolean; external name '__MPLibraryIsCompatible';



{
   ¤
   ===========================================================================================
   Defunct Services
   ================
}


{  =========================================================================================== }


{$ALIGN MAC68K}
{#POP}
{unit NameRegistry}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN POWER}
{#LibExport+}

{******************************************************************************
 *
 * Foundation Types
 *
 }
{ Value of a property }

type
    RegPropertyValue                    = Ptr;
    {    Length of property value   }
    RegPropertyValueSize                = UInt32;
    {   ******************************************************************************
     *
     * RegEntryID   :   The Global x-Namespace Entry Identifier
     *
        }
    RegEntryIDPtr = ^RegEntryID;
    RegEntryID = record
        contents:               array [0..3] of UInt32;
    end;

    {   ******************************************************************************
     *
     * Root Entry Name Definitions  (Applies to all Names in the RootNameSpace)
     *
     *  ¥ Names are a colon-separated list of name components.  Name components
     *    may not themselves contain colons.
     *  ¥ Names are presented as null-terminated ASCII character strings.
     *  ¥ Names follow similar parsing rules to Apple file system absolute
     *    and relative paths.  However the '::' parent directory syntax is
     *    not currently supported.
        }
    {    Max length of Entry Name   }

const
    kRegCStrMaxEntryNameLength  = 47;

    {    Entry Names are single byte ASCII  }

type
    RegCStrEntryName                    = char;
    RegCStrEntryNamePtr                 = ^char;
    {  length of RegCStrEntryNameBuf =  kRegCStrMaxEntryNameLength+1 }
    RegCStrEntryNameBuf                 = packed array [0..47] of char;
    RegCStrPathName                     = char;
    RegPathNameSize                     = UInt32;

const
    kRegPathNameSeparator       = 58;                           {  0x3A  }
    kRegEntryNameTerminator     = $00;                          {  '\0'  }
    kRegPathNameTerminator      = $00;                          {  '\0'  }

    {   ******************************************************************************
     *
     * Property Name and ID Definitions
     *  (Applies to all Properties Regardless of NameSpace)
        }
    kRegMaximumPropertyNameLength = 31;                         {  Max length of Property Name  }
    kRegPropertyNameTerminator  = $00;                          {  '\0'  }


type
    RegPropertyNameBuf                  = packed array [0..31] of char;
    RegPropertyName                     = char;
    RegPropertyNamePtr                  = ^char;
    {   ******************************************************************************
     *
     * Iteration Operations
     *
     *  These specify direction when traversing the name relationships
        }
    RegIterationOp                      = UInt32;
    RegEntryIterationOp                 = RegIterationOp;

const
                                                                {  Absolute locations }
    kRegIterRoot                = $00000002;                    {  "Upward" Relationships  }
    kRegIterParents             = $00000003;                    {  include all  parent(s) of entry  }
                                                                {  "Downward" Relationships }
    kRegIterChildren            = $00000004;                    {  include all children  }
    kRegIterSubTrees            = $00000005;                    {  include all sub trees of entry  }
    kRegIterDescendants         = $00000005;                    {  include all descendants of entry  }
                                                                {  "Horizontal" Relationships  }
    kRegIterSibling             = $00000006;                    {  include all siblings  }
                                                                {  Keep doing the same thing }
    kRegIterContinue            = $00000001;

    {   ******************************************************************************
     *
     * Name Entry and Property Modifiers
     *
     *
     *
     * Modifiers describe special characteristics of names
     * and properties.  Modifiers might be supported for
     * some names and not others.
     *
     * Device Drivers should not rely on functionality
     * specified as a modifier.
        }

type
    RegModifiers                        = UInt32;
    RegEntryModifiers                   = RegModifiers;
    RegPropertyModifiers                = RegModifiers;

const
    kRegNoModifiers             = $00000000;                    {  no entry modifiers in place  }
    kRegUniversalModifierMask   = $0000FFFF;                    {  mods to all entries  }
    kRegNameSpaceModifierMask   = $00FF0000;                    {  mods to all entries within namespace  }
    kRegModifierMask            = $FF000000;                    {  mods to just this entry  }

    {    Universal Property Modifiers   }
    kRegPropertyValueIsSavedToNVRAM = $00000020;                {  property is non-volatile (saved in NVRAM)  }
    kRegPropertyValueIsSavedToDisk = $00000040;                 {  property is non-volatile (saved on disk)  }

    {    NameRegistry version, Gestalt/PEF-style -- MUST BE KEPT IN SYNC WITH MAKEFILE !!   }
    LatestNR_PEFVersion         = $01030000;                    {  latest NameRegistryLib version (Gestalt/PEF-style)  }

    {    ///////////////////////
    //
    // The Registry API
    //
    ///////////////////////     }
    {    NameRegistry dispatch indexes  }
    kSelectRegistryEntryIDInit  = 0;
    kSelectRegistryEntryIDCompare = 1;
    kSelectRegistryEntryIDCopy  = 2;
    kSelectRegistryEntryIDDispose = 3;
    kSelectRegistryCStrEntryCreate = 4;
    kSelectRegistryEntryDelete  = 5;
    kSelectRegistryEntryCopy    = 6;
    kSelectRegistryEntryIterateCreate = 7;
    kSelectRegistryEntryIterateDispose = 8;
    kSelectRegistryEntryIterateSet = 9;
    kSelectRegistryEntryIterate = 10;
    kSelectRegistryEntrySearch  = 11;
    kSelectRegistryCStrEntryLookup = 12;
    kSelectRegistryEntryToPathSize = 13;
    kSelectRegistryCStrEntryToPath = 14;
    kSelectRegistryCStrEntryToName = 15;
    kSelectRegistryPropertyCreate = 16;
    kSelectRegistryPropertyDelete = 17;
    kSelectRegistryPropertyRename = 18;
    kSelectRegistryPropertyIterateCreate = 19;
    kSelectRegistryPropertyIterateDispose = 20;
    kSelectRegistryPropertyIterate = 21;
    kSelectRegistryPropertyGetSize = 22;
    kSelectRegistryPropertyGet  = 23;
    kSelectRegistryPropertySet  = 24;
    kSelectRegistryEntryGetMod  = 25;
    kSelectRegistryEntrySetMod  = 26;
    kSelectRegistryPropertyGetMod = 27;
    kSelectRegistryPropertySetMod = 28;
    kSelectRegistryEntryMod     = 29;
    kSelectRegistryEntryPropertyMod = 30;                       {  if you add more selectors here, remember to change 'kSelectRegistryHighestSelector' below }
    kSelectRegistryHighestSelector = 30;


    {    ///////////////////////
    //
    // Entry Management
    //
    ///////////////////////     }

    {   -------------------------------
     * EntryID handling
        }
    {
     * Initialize an EntryID to a known invalid state
     *   note: invalid != uninitialized
        }


type
    RegEntryIter    = ^SInt32; { an opaque 32-bit type }
    RegEntryIterPtr = ^RegEntryIter;  { when a var xx:RegEntryIter parameter can be nil, it is changed to xx: RegEntryIterPtr }
    {
     * create/dispose the iterator structure
     *   defaults to root with relationship = kRegIterDescendants
        }


type
    RegPropertyIter    = ^SInt32; { an opaque 32-bit type }
    RegPropertyIterPtr = ^RegPropertyIter;  { when a var xx:RegPropertyIter parameter can be nil, it is changed to xx: RegPropertyIterPtr }

{$ALIGN MAC68K}
{#POP}
{unit PEFBinaryFormat}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}


{ -------------------------------------------------------------------------------------------- }
{ Almost all types are padded for natural alignment.  However the PEFExportedSymbol type is    }
{ 10 bytes long, containing two 32 bit fields and one 16 bit field.  Arrays of it must be      }
{ packed, so it requires "68K" alignment.  Setting this globally to 68K should also help       }
{ ensure consistent treatment across compilers.                                                }

{ ======================================================================================== }
{ Overall Structure }
{ ================= }

{ -------------------------------------------------------------------------------------------- }
{ This header contains a complete set of types and macros for dealing with the PEF executable  }
{ format.  While some description is provided, this header is not meant as a primary source    }
{ of documentation on PEF.  An excellent specification of PEF can be found in the Macintosh    }
{ Runtime Architectures book.  This header is primarily a physical format description.  Thus   }
{ it depends on as few other headers as possible and structure fields have obvious sizes.      }
{                                                                                              }
{ The physical storage for a PEF executable is known as a "container".  This refers to just    }
{ the executable itself, not the file etc.  E.g. if five DLLs are packaged in a single file's  }
{ data fork, that one data fork has five containers within it.                                 }
{                                                                                              }
{ A PEF container consists of an overall header, followed by one or more section headers,      }
{ followed by the section name table, followed by the contents for the sections.  Some kinds   }
{ of sections have specific internal representation.  The "loader" section is the most common  }
{ of these special sections.  It contains information on the exports, imports, and runtime     }
{ relocations required to prepare the executable.  PEF containers are self contained, all      }
{ portions are located via relative offsets.                                                   }
{                                                                                              }
{                                                                                              }
{          +-------------------------------+                                                   }
{          |       Container Header        |   40 bytes                                        }
{          +-------------------------------+                                                   }
{          |       Section 0 header        |   28 bytes each                                   }
{          |...............................|                                                   }
{          |           - - - -             |                                                   }
{          |...............................|                                                   }
{          |       Section n-1 header      |                                                   }
{          +-------------------------------+                                                   }
{          |       Section Name Table      |                                                   }
{          +-------------------------------+                                                   }
{          |       Section x raw data      |                                                   }
{          +-------------------------------+                                                   }
{          |           - - - -             |                                                   }
{          +-------------------------------+                                                   }
{          |       Section y raw data      |                                                   }
{          +-------------------------------+                                                   }
{                                                                                              }
{                                                                                              }
{ The sections are implicitly numbered from 0 to n according to the order of their headers.    }
{ The headers of the instantiated sections must precede those of the non-instantiated          }
{ sections.  The ordering of the raw data is independent of the section header ordering.       }
{ Each section header contains the offset for that section's raw data.                         }

{ =========================================================================================== }
{ Container Header }
{ ================ }


type
    PEFContainerHeaderPtr = ^PEFContainerHeader;
    PEFContainerHeader = record
        tag1:                   OSType;                                 {  Must contain 'Joy!'. }
        tag2:                   OSType;                                 {  Must contain 'peff'.  (Yes, with two 'f's.) }
        architecture:           OSType;                                 {  The ISA for code sections.  Constants in CodeFragments.h. }
        formatVersion:          UInt32;                                 {  The physical format version. }
        dateTimeStamp:          UInt32;                                 {  Macintosh format creation/modification stamp. }
        oldDefVersion:          UInt32;                                 {  Old definition version number for the code fragment. }
        oldImpVersion:          UInt32;                                 {  Old implementation version number for the code fragment. }
        currentVersion:         UInt32;                                 {  Current version number for the code fragment. }
        sectionCount:           UInt16;                                 {  Total number of section headers that follow. }
        instSectionCount:       UInt16;                                 {  Number of instantiated sections. }
        reservedA:              UInt32;                                 {  Reserved, must be written as zero. }
    end;


const
    kPEFTag1                    = $4A6F7921 (* 'Joy!' *);                       {  For non-Apple compilers: 0x4A6F7921. }
    kPEFTag2                    = $70656666 (* 'peff' *);                       {  For non-Apple compilers: 0x70656666. }
    kPEFVersion                 = $00000001;


    kPEFFirstSectionHeaderOffset = 40;


    {    ===========================================================================================    }
    {    Section Headers    }
    {    ===============    }


type
    PEFSectionHeaderPtr = ^PEFSectionHeader;
    PEFSectionHeader = record
        nameOffset:             SInt32;                                 {  Offset of name within the section name table, -1 => none. }
        defaultAddress:         UInt32;                                 {  Default address, affects relocations. }
        totalLength:            UInt32;                                 {  Fully expanded size in bytes of the section contents. }
        unpackedLength:         UInt32;                                 {  Size in bytes of the "initialized" part of the contents. }
        containerLength:        UInt32;                                 {  Size in bytes of the raw data in the container. }
        containerOffset:        UInt32;                                 {  Offset of section's raw data. }
        sectionKind:            SInt8;                                  {  Kind of section contents/usage. }
        shareKind:              SInt8;                                  {  Sharing level, if a writeable section. }
        alignment:              SInt8;                                  {  Preferred alignment, expressed as log 2. }
        reservedA:              SInt8;                                  {  Reserved, must be zero. }
    end;


const
                                                                {  Values for the sectionKind field. }
                                                                {     Section kind values for instantiated sections. }
    kPEFCodeSection             = 0;                            {  Code, presumed pure & position independent. }
    kPEFUnpackedDataSection     = 1;                            {  Unpacked writeable data. }
    kPEFPackedDataSection       = 2;                            {  Packed writeable data. }
    kPEFConstantSection         = 3;                            {  Read-only data. }
    kPEFExecDataSection         = 6;                            {  Intermixed code and writeable data. }
                                                                {  Section kind values for non-instantiated sections. }
    kPEFLoaderSection           = 4;                            {  Loader tables. }
    kPEFDebugSection            = 5;                            {  Reserved for future use. }
    kPEFExceptionSection        = 7;                            {  Reserved for future use. }
    kPEFTracebackSection        = 8;                            {  Reserved for future use. }


                                                                {  Values for the shareKind field. }
    kPEFProcessShare            = 1;                            {  Shared within a single process. }
    kPEFGlobalShare             = 4;                            {  Shared across the entire system. }
    kPEFProtectedShare          = 5;                            {  Readable across the entire system, writeable only to privileged code. }


    {    ===========================================================================================    }
    {    Packed Data Contents   }
    {    ====================   }

    {    --------------------------------------------------------------------------------------------   }
    {    The raw contents of a packed data section are a sequence of byte codes.  The basic format      }
    {    has a 3 bit opcode followed by a 5 bit count.  Additional bytes might be used to contain       }
    {    counts larger than 31, and to contain a second or third count.  Further additional bytes       }
    {    contain actual data values to transfer.                                                        }
    {                                                                                                   }
    {    All counts are represented in a variable length manner.  A zero in the initial 5 bit count     }
    {    indicates the actual value follows.  In this case, and for the second and third counts, the    }
    {    count is represented as a variable length sequence of bytes.  The bytes are stored in big      }
    {    endian manner, most significant part first.  The high order bit is set in all but the last     }
    {    byte.  The value is accumulated by shifting the current value up 7 bits and adding in the      }
    {    low order 7 bits of the next byte.                                                             }

                                                                {  The packed data opcodes. }
    kPEFPkDataZero              = 0;                            {  Zero fill "count" bytes. }
    kPEFPkDataBlock             = 1;                            {  Block copy "count" bytes. }
    kPEFPkDataRepeat            = 2;                            {  Repeat "count" bytes "count2"+1 times. }
    kPEFPkDataRepeatBlock       = 3;                            {  Interleaved repeated and unique data. }
    kPEFPkDataRepeatZero        = 4;                            {  Interleaved zero and unique data. }


    kPEFPkDataOpcodeShift       = 5;
    kPEFPkDataCount5Mask        = $1F;
    kPEFPkDataMaxCount5         = 31;
    kPEFPkDataVCountShift       = 7;
    kPEFPkDataVCountMask        = $7F;
    kPEFPkDataVCountEndMask     = $80;



    {    --------------------------------------------------------------------------------------------   }
    {    The following code snippet can be used to input a variable length count.                       }
    {                                                                                                   }
    {         count = 0;                                                                                }
    {         do (                                                                                      }
    {             byte = *bytePtr++;                                                                    }
    {             count = (count << kPEFPkDataVCountShift) | (byte & kPEFPkDataVCountMask);             }
    {         ) while ( (byte & kPEFPkDataVCountEndMask) != 0 );                                        }
    {                                                                                                   }
    {    The following code snippet can be used to output a variable length count to a byte array.      }
    {    This is more complex than the input code because the chunks are output in big endian order.    }
    {    Think about handling values like 0 or 0x030000.                                                }
    {                                                                                                   }
    {         count = 1;.                                                                               }
    {         tempValue = value >> kPEFPkDataCountShift;                                                }
    {         while ( tempValue != 0 ) (                                                                }
    {             count += 1;                                                                           }
    {             tempValue = tempValue >> kPEFPkDataCountShift;                                        }
    {         )                                                                                         }
    {                                                                                                   }
    {         bytePtr += count;                                                                         }
    {         tempPtr = bytePtr - 1;                                                                    }
    {         *tempPtr-- = value;     // ! No need to mask, only the low order byte is stored.          }
    {         for ( count -= 1; count != 0; count -= 1 ) (                                              }
    {             value = value >> kPEFPkDataCountShift;                                                }
    {             *tempPtr-- = value | kPEFPkDataCountEndMask;                                          }
    {         )                                                                                         }

    {    ===========================================================================================    }
    {    Loader Section     }
    {    ==============     }

    {    --------------------------------------------------------------------------------------------   }
    {    The loader section contains information needed to prepare the code fragment for execution.     }
    {    This includes this fragment's exports, the import libraries and the imported symbols from      }
    {    each library, and the relocations for the writeable sections.                                  }
    {                                                                                                   }
    {             +-----------------------------------+               <-- containerOffset --------+     }
    {             |       Loader Info Header          |   56 bytes                                |     }
    {             |-----------------------------------|                                           |     }
    {             |       Imported Library 0          |   24 bytes each                           |     }
    {             |...................................|                                           |     }
    {             |           - - -                   |                                           |     }
    {             |...................................|                                           |     }
    {             |       Imported Library l-1        |                                           |     }
    {             |-----------------------------------|                                           |     }
    {             |       Imported Symbol 0           |   4 bytes each                            |     }
    {             |...................................|                                           |     }
    {             |           - - -                   |                                           |     }
    {             |...................................|                                           |     }
    {             |       Imported Symbol i-1         |                                           |     }
    {             |-----------------------------------|                                           |     }
    {             |       Relocation Header 0         |   12 bytes each                           |     }
    {             |...................................|                                           |     }
    {             |           - - -                   |                                           |     }
    {             |...................................|                                           |     }
    {             |       Relocation Header r-1       |                                           |     }
    {             |-----------------------------------|               <-- + relocInstrOffset -----|     }
    {             |       Relocation Instructions     |                                           |     }
    {             |-----------------------------------|               <-- + loaderStringsOffset --|     }
    {             |       Loader String Table         |                                           |     }
    {             |-----------------------------------|               <-- + exportHashOffset -----+     }
    {             |       Export Hash Slot 0          |   4 bytes each                                  }
    {             |...................................|                                                 }
    {             |           - - -                   |                                                 }
    {             |...................................|                                                 }
    {             |       Export Hash Slot h-1        |                                                 }
    {             |-----------------------------------|                                                 }
    {             |       Export Symbol Key 0         |   4 bytes each                                  }
    {             |...................................|                                                 }
    {             |           - - -                   |                                                 }
    {             |...................................|                                                 }
    {             |       Export Symbol Key e-1       |                                                 }
    {             |-----------------------------------|                                                 }
    {             |       Export Symbol 0             |   10 bytes each                                 }
    {             |...................................|                                                 }
    {             |           - - -                   |                                                 }
    {             |...................................|                                                 }
    {             |       Export Symbol e-1           |                                                 }
    {             +-----------------------------------+                                                 }


type
    PEFLoaderInfoHeaderPtr = ^PEFLoaderInfoHeader;
    PEFLoaderInfoHeader = record
        mainSection:            SInt32;                                 {  Section containing the main symbol, -1 => none. }
        mainOffset:             UInt32;                                 {  Offset of main symbol. }
        initSection:            SInt32;                                 {  Section containing the init routine's TVector, -1 => none. }
        initOffset:             UInt32;                                 {  Offset of the init routine's TVector. }
        termSection:            SInt32;                                 {  Section containing the term routine's TVector, -1 => none. }
        termOffset:             UInt32;                                 {  Offset of the term routine's TVector. }
        importedLibraryCount:   UInt32;                                 {  Number of imported libraries.  ('l') }
        totalImportedSymbolCount: UInt32;                               {  Total number of imported symbols.  ('i') }
        relocSectionCount:      UInt32;                                 {  Number of sections with relocations.  ('r') }
        relocInstrOffset:       UInt32;                                 {  Offset of the relocation instructions. }
        loaderStringsOffset:    UInt32;                                 {  Offset of the loader string table. }
        exportHashOffset:       UInt32;                                 {  Offset of the export hash table. }
        exportHashTablePower:   UInt32;                                 {  Export hash table size as log 2.  (Log2('h')) }
        exportedSymbolCount:    UInt32;                                 {  Number of exported symbols.  ('e') }
    end;

    {    ===========================================================================================    }
    {    Imported Libraries     }
    {    ------------------     }
    PEFImportedLibraryPtr = ^PEFImportedLibrary;
    PEFImportedLibrary = record
        nameOffset:             UInt32;                                 {  Loader string table offset of library's name. }
        oldImpVersion:          UInt32;                                 {  Oldest compatible implementation version. }
        currentVersion:         UInt32;                                 {  Current version at build time. }
        importedSymbolCount:    UInt32;                                 {  Imported symbol count for this library. }
        firstImportedSymbol:    UInt32;                                 {  Index of first imported symbol from this library. }
        options:                SInt8;                                  {  Option bits for this library. }
        reservedA:              SInt8;                                  {  Reserved, must be zero. }
        reservedB:              UInt16;                                 {  Reserved, must be zero. }
    end;


const
                                                                {  Bits for the PEFImportedLibrary options field. }
    kPEFWeakImportLibMask       = $40;                          {  The imported library is allowed to be missing. }
    kPEFInitLibBeforeMask       = $80;                          {  The imported library must be initialized first. }


    {    ===========================================================================================    }
    {    Imported Symbols   }
    {    ----------------   }

    {    --------------------------------------------------------------------------------------------   }
    {    The PEFImportedSymbol type has the following bit field layout.                                 }
    {                                                                                                   }
    {                                                                        3                          }
    {          0             7 8                                             1                          }
    {         +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                         }
    {         | symbol class  | offset of symbol name in loader string table  |                         }
    {         +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                         }
    {         |<-- 8 bits --->|<-- 24 bits ---------------------------------->|                         }


type
    PEFImportedSymbolPtr = ^PEFImportedSymbol;
    PEFImportedSymbol = record
        classAndName:           UInt32;
    end;


const
    kPEFImpSymClassShift        = 24;
    kPEFImpSymNameOffsetMask    = $00FFFFFF;
    kPEFImpSymMaxNameOffset     = $00FFFFFF;                    {  16,777,215 }


                                                                {  Imported and exported symbol classes. }
    kPEFCodeSymbol              = $00;
    kPEFDataSymbol              = $01;
    kPEFTVectorSymbol           = $02;
    kPEFTOCSymbol               = $03;
    kPEFGlueSymbol              = $04;
    kPEFUndefinedSymbol         = $0F;
    kPEFWeakImportSymMask       = $80;


    {    ===========================================================================================    }
    {    Exported Symbol Hash Table     }
    {    --------------------------     }

    {    --------------------------------------------------------------------------------------------   }
    {    Exported symbols are described in four parts, optimized for speed of lookup.  These parts      }
    {    are the "export hash table", the "export key table", the "export symbol table", and the        }
    {    "export name table".  Overall they contain a flattened representation of a fairly normal       }
    {    hashed symbol table.                                                                           }
    {                                                                                                   }
    {    The export hash table is an array of small fixed size elements.  The number of elements is     }
    {    a power of 2.  A 32 bit hash word for a symbol is converted into an index into this array.     }
    {    Each hash slot contains a count of the number of exported symbols that map to this slot and    }
    {    the index of the first of those symbols in the key and symbol tables.  Of course some hash     }
    {    slots will have a zero count.                                                                  }
    {                                                                                                   }
    {    The key and symbol tables are also arrays of fixed size elements, one for each exported        }
    {    symbol.  Their entries are grouped by hash slot, those elements mapping to the same hash       }
    {    slot are contiguous.  The key table contains just the full 32 bit hash word for each           }
    {    exported symbol.  The symbol table contains the offset of the symbol's name in the string      }
    {    table and other information about the exported symbol.                                         }
    {                                                                                                   }
    {    To look up an export you take the hashword and compute the hash slot index.  You then scan     }
    {    the indicated portion of the key table for matching hashwords.  If a hashword matches, you     }
    {    look at the corresponding symbol table entry to find the full symbol name.  If the names       }
    {    match the symbol is found.                                                                     }

    {    --------------------------------------------------------------------------------------------   }
    {    The following function may be used to compute the hash table size.  Signed values are used     }
    {    just to avoid potential code generation overhead for unsigned division.                        }
    {                                                                                                   }
    {         UInt8   PEFComputeHashTableExponent ( SInt32    exportCount )                             }
    {         (                                                                                         }
    {             SInt32  exponent;                                                                     }
    {                                                                                                   }
    {             const SInt32    kExponentLimit      = 16;   // Arbitrary, but must not exceed 30.     }
    {             const SInt32    kAverageChainLimit  = 10;   // Arbitrary, for space/time tradeoff.    }
    {                                                                                                   }
    {             for ( exponent = 0; exponent < kExponentLimit; exponent += 1 ) (                      }
    {                 if ( (exportCount / (1 << exponent)) < kAverageChainLimit ) break;                }
    {             )                                                                                     }
    {                                                                                                   }
    {             return exponent;                                                                      }
    {                                                                                                   }
    {         )   // PEFComputeHashTableExponent ()                                                     }

    {    --------------------------------------------------------------------------------------------   }
    {    The PEFExportedSymbolHashSlot type has the following bit field layout.                         }
    {                                                                                                   }
    {                                    1 1                                 3                          }
    {          0                         3 4                                 1                          }
    {         +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                         }
    {         | symbol count              | index of first export key         |                         }
    {         +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                         }
    {         |<-- 14 bits -------------->|<-- 18 bits ---------------------->|                         }


type
    PEFExportedSymbolHashSlotPtr = ^PEFExportedSymbolHashSlot;
    PEFExportedSymbolHashSlot = record
        countAndStart:          UInt32;
    end;


const
    kPEFHashSlotSymCountShift   = 18;
    kPEFHashSlotFirstKeyMask    = $0003FFFF;
    kPEFHashSlotMaxSymbolCount  = $00003FFF;                    {   16,383 }
    kPEFHashSlotMaxKeyIndex     = $0003FFFF;                    {  262,143 }


    {    ===========================================================================================    }
    {    Exported Symbol Hash Key   }
    {    ------------------------   }


type
    PEFSplitHashWordPtr = ^PEFSplitHashWord;
    PEFSplitHashWord = record
        nameLength:             UInt16;
        hashValue:              UInt16;
    end;

    PEFExportedSymbolKeyPtr = ^PEFExportedSymbolKey;
    PEFExportedSymbolKey = record
        case SInt16 of
        0: (
            fullHashWord:       UInt32;
            );
        1: (
            splitHashWord:      PEFSplitHashWord;
            );
    end;


const
    kPEFHashLengthShift         = 16;
    kPEFHashValueMask           = $0000FFFF;
    kPEFHashMaxLength           = $0000FFFF;                    {  65,535 }


    {    ----------------------------------------------------------------------------------------------------   }
    {    The following function computes the full 32 bit hash word.                                             }
    {                                                                                                           }
    {         UInt32  PEFComputeHashWord  ( BytePtr   nameText,       // ! First "letter", not length byte.     }
    {                                       UInt32    nameLength )    // ! The text may be zero terminated.     }
    {         (                                                                                                 }
    {             BytePtr charPtr     = nameText;                                                               }
    {             SInt32  hashValue   = 0;        // ! Signed to match old published algorithm.                 }
    {             UInt32  length      = 0;                                                                      }
    {             UInt32  limit;                                                                                }
    {             UInt32  result;                                                                               }
    {             UInt8   currChar;                                                                             }
    {                                                                                                           }
    {             #define PseudoRotate(x)  ( ( (x) << 1 ) - ( (x) >> 16 ) )                                     }
    {                                                                                                           }
    {             for ( limit = nameLength; limit > 0; limit -= 1 ) (                                           }
    {                 currChar = *charPtr++;                                                                    }
    {                 if ( currChar == NULL ) break;                                                            }
    {                 length += 1;                                                                              }
    {                 hashValue = PseudoRotate ( hashValue ) ^ currChar;                                        }
    {             )                                                                                             }
    {                                                                                                           }
    {             result  = (length << kPEFHashLengthShift) |                                                   }
    {                       ((UInt16) ((hashValue ^ (hashValue >> 16)) & kPEFHashValueMask));                   }
    {                                                                                                           }
    {             return result;                                                                                }
    {                                                                                                           }
    {         )   // PEFComputeHashWord ()                                                                      }

    {    ===========================================================================================    }
    {    Exported Symbols   }
    {    ----------------   }


type
    PEFExportedSymbolPtr = ^PEFExportedSymbol;
    PEFExportedSymbol = record
                                                                        {  ! This structure is 10 bytes long and arrays are packed. }
        classAndName:           UInt32;                                 {  A combination of class and name offset. }
        symbolValue:            UInt32;                                 {  Typically the symbol's offset within a section. }
        sectionIndex:           SInt16;                                 {  The index of the section, or pseudo-section, for the symbol. }
    end;

    {    --------------------------------------------------------------------------------------------   }
    {    The classAndName field of the PEFExportedSymbol type has the following bit field layout.       }
    {                                                                                                   }
    {                                                                        3                          }
    {          0             7 8                                             1                          }
    {         +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                         }
    {         | symbol class  | offset of symbol name in loader string table  |                         }
    {         +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                         }
    {         |<-- 8 bits --->|<-- 24 bits ---------------------------------->|                         }


const
    kPEFExpSymClassShift        = 24;
    kPEFExpSymNameOffsetMask    = $00FFFFFF;
    kPEFExpSymMaxNameOffset     = $00FFFFFF;                    {  16,777,215 }


                                                                {  Negative section indices indicate pseudo-sections. }
    kPEFAbsoluteExport          = -2;                           {  The symbol value is an absolute address. }
    kPEFReexportedImport        = -3;                           {  The symbol value is the index of a reexported import. }


    {    ===========================================================================================    }
    {    Loader Relocations     }
    {    ==================     }

    {    --------------------------------------------------------------------------------------------   }
    {    The relocations for a section are defined by a sequence of instructions for an abstract        }
    {    machine that is specifically geared to performing relocations commonly needed for the "CFM"    }
    {    code generation model.  These instructions occur in 16 bit chunks.  Most instructions have     }
    {    just a single chunk.  Instructions that are larger than 16 bits have an opcode and some of     }
    {    the operands in the first chunk, with other operands in following chunks.                      }
    {                                                                                                   }
    {    ! Note that the multi-chunk relocations have separate "Compose" macros for each chunk.  The    }
    {    ! macros have the same basic name with a positional suffix of "_1st", "_2nd", etc.             }


type
    PEFRelocChunk                       = UInt16;
    PEFLoaderRelocationHeaderPtr = ^PEFLoaderRelocationHeader;
    PEFLoaderRelocationHeader = record
        sectionIndex:           UInt16;                                 {  Index of the section to be fixed up. }
        reservedA:              UInt16;                                 {  Reserved, must be zero. }
        relocCount:             UInt32;                                 {  Number of 16 bit relocation chunks. }
        firstRelocOffset:       UInt32;                                 {  Offset of first relocation instruction. }
    end;

    {    --------------------------------------------------------------------------------------------   }
    {    ! Note that the relocCount field is the number of 16 bit relocation chunks, i.e. 1/2 the       }
    {    ! total number of bytes of relocation instructions.  While most relocation instructions are    }
    {    ! 16 bits long, some are longer so the number of complete relocation instructions may be       }
    {    ! less than the relocCount value.                                                              }

    {    ------------------------------------------------------------------------------------   }
    {    The PEFRelocField macro is a utility for extracting relocation instruction fields.     }

    {    ===========================================================================================    }
    {    Basic Relocation Opcodes   }
    {    ------------------------   }
    {    --------------------------------------------------------------------------------------------   }
    {    The number of opcode bits varies from 2 to 7.  The enumeration and switch table given here     }
    {    are defined in terms of the most significant 7 bits of the first instruction chunk.  An        }
    {    instruction is decoded by using the most significant 7 bits as an index into the opcode        }
    {    table, which in turn contains appropriately masked forms of the most significant 7 bits.       }
    {    The macro PEFRelocBasicOpcode assumes a declaration of the form.                               }
    {                                                                                                   }
    {         UInt8 kPEFRelocBasicOpcodes [kPEFRelocBasicOpcodeRange] = ( PEFMaskedBasicOpcodes );      }


const
    kPEFRelocBasicOpcodeRange   = 128;


    {    --------------------------------------------------------------------------------------------   }
    {    The relocation opcodes, clustered by major and minor groups.  The instructions within a        }
    {    cluster all have the same bit field layout.  The enumeration values use the high order 7       }
    {    bits of the relocation instruction.  Unused low order bits are set to zero.                    }
    kPEFRelocBySectDWithSkip    = $00;                          {  Binary: 00x_xxxx }
    kPEFRelocBySectC            = $20;                          {  Binary: 010_0000, group is "RelocRun" }
    kPEFRelocBySectD            = $21;                          {  Binary: 010_0001 }
    kPEFRelocTVector12          = $22;                          {  Binary: 010_0010 }
    kPEFRelocTVector8           = $23;                          {  Binary: 010_0011 }
    kPEFRelocVTable8            = $24;                          {  Binary: 010_0100 }
    kPEFRelocImportRun          = $25;                          {  Binary: 010_0101 }
    kPEFRelocSmByImport         = $30;                          {  Binary: 011_0000, group is "RelocSmIndex" }
    kPEFRelocSmSetSectC         = $31;                          {  Binary: 011_0001 }
    kPEFRelocSmSetSectD         = $32;                          {  Binary: 011_0010 }
    kPEFRelocSmBySection        = $33;                          {  Binary: 011_0011 }
    kPEFRelocIncrPosition       = $40;                          {  Binary: 100_0xxx }
    kPEFRelocSmRepeat           = $48;                          {  Binary: 100_1xxx }
    kPEFRelocSetPosition        = $50;                          {  Binary: 101_000x }
    kPEFRelocLgByImport         = $52;                          {  Binary: 101_001x }
    kPEFRelocLgRepeat           = $58;                          {  Binary: 101_100x }
    kPEFRelocLgSetOrBySection   = $5A;                          {  Binary: 101_101x }
    kPEFRelocUndefinedOpcode    = $FF;                          {  Used in masking table for all undefined values. }


    {    ----------------------------------------------------------------------------   }
    {    The RelocLgSetOrBySection instruction has an additional 4 bits of subopcode    }
    {    beyond the 7 used by the dispatch table.  To be precise it has 6 plus 4 but    }
    {    the dispatch table ignores the 7th bit, so the subdispatch is on all 4 extra   }
    {    subopcode bits.                                                                }
    kPEFRelocLgBySectionSubopcode = $00;                        {  Binary: 0000 }
    kPEFRelocLgSetSectCSubopcode = $01;                         {  Binary: 0001 }
    kPEFRelocLgSetSectDSubopcode = $02;                         {  Binary: 0010 }


    {    --------------------------------------------------------------------------------------------   }
    {    The initial values for the opcode "masking" table.  This has the enumeration values from       }
    {    above with appropriate replications for "don't care" bits.  It is almost certainly shorter     }
    {    and faster to look up the masked value in a table than to use a branch tree.                   }

    {    ===========================================================================================    }
    {    RelocBySectDWithSkip Instruction (DDAT)    }
    {    ---------------------------------------    }

    {    --------------------------------------------------------------------------------------------   }
    {    The "RelocBySectDWithSkip" (DDAT) instruction has the following bit field layout.              }
    {                                                                                                   }
    {                              1         1                                                          }
    {          0 1 2             9 0         5                                                          }
    {         +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                                                         }
    {         |0 0| skip count    | rel count |                                                         }
    {         +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                                                         }
    {         | 2 |<-- 8 bits --->|<--  6 --->|                                                         }
    {                                                                                                   }
    {    ! Note that the stored skip count and reloc count are the actual values!                       }
    kPEFRelocWithSkipMaxSkipCount = 255;
    kPEFRelocWithSkipMaxRelocCount = 63;


    {    ===========================================================================================    }
    {    RelocRun Group (CODE, DATA, DESC, DSC2, VTBL, SYMR)    }
    {    ---------------------------------------------------    }

    {    --------------------------------------------------------------------------------------------   }
    {    The "RelocRun" group includes the "RelocBySectC" (CODE), "RelocBySectD" (DATA),                }
    {    "RelocTVector12" (DESC), "RelocTVector8" (DSC2), "RelocVTable8" (VTBL), and                    }
    {    "RelocImportRun" (SYMR) instructions.  This group has the following bit field layout.          }
    {                                                                                                   }
    {                                        1                                                          }
    {          0   2 3     6 7               5                                                          }
    {         +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                                                         }
    {         |0 1 0| subop.| run length      |                                                         }
    {         +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                                                         }
    {         |  3  |<- 4 ->|<-- 9 bits ----->|                                                         }
    {                                                                                                   }
    {    ! Note that the stored run length is the actual value minus 1, but the macros deal with the    }
    {    ! actual value!                                                                                }
    kPEFRelocRunMaxRunLength    = 512;


    {    ===========================================================================================    }
    {    RelocSmIndex Group (SYMB, CDIS, DTIS, SECN)    }
    {    -------------------------------------------    }

    {    --------------------------------------------------------------------------------------------   }
    {    The "RelocSmIndex" group includes the "RelocSmByImport" (SYMB), "RelocSmSetSectC" (CDIS),      }
    {    "RelocSmSetSectD" (DTIS) and "RelocSmBySection" (SECN) instructions.  This group has the       }
    {    following bit field layout.                                                                    }
    {                                                                                                   }
    {                                        1                                                          }
    {          0   2 3     6 7               5                                                          }
    {         +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                                                         }
    {         |0 1 1| subop.| index           |                                                         }
    {         +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                                                         }
    {         |  3  |<- 4 ->|<-- 9 bits ----->|                                                         }
    {                                                                                                   }
    {    ! Note that the stored index is the actual value!                                              }
    kPEFRelocSmIndexMaxIndex    = 511;


    {    ===========================================================================================    }
    {    RelocIncrPosition Instruction (DELT)   }
    {    ------------------------------------   }

    {    --------------------------------------------------------------------------------------------   }
    {    The "RelocIncrPosition" (DELT) instruction has the following bit field layout.                 }
    {                                                                                                   }
    {                                        1                                                          }
    {          0     3 4                     5                                                          }
    {         +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                                                         }
    {         |1 0 0 0| offset                |                                                         }
    {         +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                                                         }
    {         |<- 4 ->|<-- 12 bits ---------->|                                                         }
    {                                                                                                   }
    {    ! Note that the stored offset is the actual value minus 1, but the macros deal with the        }
    {    ! actual value!                                                                                }
    kPEFRelocIncrPositionMaxOffset = 4096;


    {    ===========================================================================================    }
    {    RelocSmRepeat Instruction (RPT)    }
    {    -------------------------------    }

    {    --------------------------------------------------------------------------------------------   }
    {    The "RelocSmRepeat" (RPT) instruction has the following bit field layout.                      }
    {                                                                                                   }
    {                                        1                                                          }
    {          0     3 4     7 8             5                                                          }
    {         +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                                                         }
    {         |1 0 0 1| chnks | repeat count  |                                                         }
    {         +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                                                         }
    {         |<- 4 ->|<- 4 ->|<-- 8 bits --->|                                                         }
    {                                                                                                   }
    {    ! Note that the stored chunk count and repeat count are the actual values minus 1, but the     }
    {    ! macros deal with the actual values!                                                          }
    kPEFRelocSmRepeatMaxChunkCount = 16;
    kPEFRelocSmRepeatMaxRepeatCount = 256;


    {    ===========================================================================================    }
    {    RelocSetPosition Instruction (LABS)    }
    {    -----------------------------------    }

    {    --------------------------------------------------------------------------------------------   }
    {    The "RelocSetPosition" (LABS) instruction has the following bit field layout.                  }
    {                                                                                                   }
    {                                        1                                   1                      }
    {          0         5 6                 5     0                             5                      }
    {         +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                     }
    {         |1 0 1 0 0 0| offset (high)     |   | offset (low)                  |                     }
    {         +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                     }
    {         |<-- 6 ---->|<-- 10 bits ------>|   |<-- 16 bits ------------------>|                     }
    {                                                                                                   }
    {    ! Note that the stored offset is the actual value!                                             }
    kPEFRelocSetPosMaxOffset    = $03FFFFFF;                    {  67,108,863 }


    {    ===========================================================================================    }
    {    RelocLgByImport Instruction (LSYM)     }
    {    ----------------------------------     }

    {    --------------------------------------------------------------------------------------------   }
    {    The "RelocLgByImport" (LSYM) instruction has the following bit field layout.                   }
    {                                                                                                   }
    {                                        1                                   1                      }
    {          0         5 6                 5     0                             5                      }
    {         +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                     }
    {         |1 0 1 0 0 1| index (high)      |   | index (low)                   |                     }
    {         +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                     }
    {         |<-- 6 ---->|<-- 10 bits ------>|   |<-- 16 bits ------------------>|                     }
    {                                                                                                   }
    {    ! Note that the stored offset is the actual value!                                             }
    kPEFRelocLgByImportMaxIndex = $03FFFFFF;                    {  67,108,863 }


    {    ===========================================================================================    }
    {    RelocLgRepeat Instruction (LRPT)   }
    {    --------------------------------   }

    {    --------------------------------------------------------------------------------------------   }
    {    The "RelocLgRepeat" (LRPT) instruction has the following bit field layout.                     }
    {                                                                                                   }
    {                              1         1                                   1                      }
    {          0         5 6     9 0         5     0                             5                      }
    {         +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                     }
    {         |1 0 1 1 0 0| chnks | rpt (high)|   | repeat count (low)            |                     }
    {         +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                     }
    {         |<--  6 --->|<- 4 ->|<--  6 --->|   |<-- 16 bits ------------------>|                     }
    {                                                                                                   }
    {    ! Note that the stored chunk count is the actual value minus 1, but the macros deal with       }
    {    ! the actual value!  The stored repeat count is the actual value!                              }
    kPEFRelocLgRepeatMaxChunkCount = 16;
    kPEFRelocLgRepeatMaxRepeatCount = $003FFFFF;                {  4,194,303 }


    {    ===========================================================================================    }
    {    RelocLgSetOrBySection Group (LSEC)     }
    {    ----------------------------------     }

    {    --------------------------------------------------------------------------------------------   }
    {    The "RelocLgSetOrBySection" (LSEC) instruction is a group including the "RelocLgBySection",    }
    {    "RelocLgSetSectC" and "RelocLgSetSectD" instructions.  This group has the following bit        }
    {    field layout.                                                                                  }
    {                                                                                                   }
    {                              1         1                                   1                      }
    {          0         5 6     9 0         5     0                             5                      }
    {         +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                     }
    {         |1 0 1 1 0 1| subop | idx (high)|   | index (low)                   |                     }
    {         +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                     }
    {         |<--  6 --->|<- 4 ->|<--  6 --->|   |<-- 16 bits ------------------>|                     }
    {                                                                                                   }
    {    ! Note that the stored index is the actual value!                                              }
    kPEFRelocLgSetOrBySectionMaxIndex = $003FFFFF;              {  4,194,303 }



{$ALIGN MAC68K}
{#POP}
{unit PLStringFuncs}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}

{
 *  PLstrcmp()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PLstrcmp(const (*var*) str1: Str255; const (*var*) str2: Str255): SInt16; external name '_PLstrcmp';

{
 *  PLstrncmp()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PLstrncmp(const (*var*) str1: Str255; const (*var*) str2: Str255; num: SInt16): SInt16; external name '_PLstrncmp';

{
 *  PLstrcpy()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PLstrcpy(str1: StringPtr; const (*var*) str2: Str255): StringPtr; external name '_PLstrcpy';

{
 *  PLstrncpy()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PLstrncpy(str1: StringPtr; const (*var*) str2: Str255; num: SInt16): StringPtr; external name '_PLstrncpy';

{
 *  PLstrcat()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PLstrcat(str1: StringPtr; const (*var*) str2: Str255): StringPtr; external name '_PLstrcat';

{
 *  PLstrncat()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PLstrncat(str1: StringPtr; const (*var*) str2: Str255; num: SInt16): StringPtr; external name '_PLstrncat';

{
 *  PLstrchr()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PLstrchr(const (*var*) str1: Str255; ch1: SInt16): Ptr; external name '_PLstrchr';

{
 *  PLstrrchr()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PLstrrchr(const (*var*) str1: Str255; ch1: SInt16): Ptr; external name '_PLstrrchr';

{
 *  PLstrpbrk()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PLstrpbrk(const (*var*) str1: Str255; const (*var*) str2: Str255): Ptr; external name '_PLstrpbrk';

{
 *  PLstrspn()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PLstrspn(const (*var*) str1: Str255; const (*var*) str2: Str255): SInt16; external name '_PLstrspn';

{
 *  PLstrstr()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PLstrstr(const (*var*) str1: Str255; const (*var*) str2: Str255): Ptr; external name '_PLstrstr';

{
 *  PLstrlen()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PLstrlen(const (*var*) str: Str255): SInt16; external name '_PLstrlen';

{
 *  PLpos()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PLpos(const (*var*) str1: Str255; const (*var*) str2: Str255): SInt16; external name '_PLpos';


{$ALIGN MAC68K}
{#POP}
{unit SFNTLayoutTypes}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}

{ ----------------------------------------------------------------------------------------- }
{ CONSTANTS }
{
    The following values can be used to set run feature values. Note that unless the
    feature is defaulted differently in different fonts, the zero value for the
    selectors represents the default value.  Check the following URL site for further info:
    "http://fonts.apple.com/Registry"
}


{
 *  Summary:
 *    Feature types
 }

const
    kAllTypographicFeaturesType = 0;
    kLigaturesType              = 1;
    kCursiveConnectionType      = 2;
    kLetterCaseType             = 3;
    kVerticalSubstitutionType   = 4;
    kLinguisticRearrangementType = 5;
    kNumberSpacingType          = 6;
    kSmartSwashType             = 8;
    kDiacriticsType             = 9;
    kVerticalPositionType       = 10;
    kFractionsType              = 11;
    kOverlappingCharactersType  = 13;
    kTypographicExtrasType      = 14;
    kMathematicalExtrasType     = 15;
    kOrnamentSetsType           = 16;
    kCharacterAlternativesType  = 17;
    kDesignComplexityType       = 18;
    kStyleOptionsType           = 19;
    kCharacterShapeType         = 20;
    kNumberCaseType             = 21;
    kTextSpacingType            = 22;
    kTransliterationType        = 23;
    kAnnotationType             = 24;
    kKanaSpacingType            = 25;
    kIdeographicSpacingType     = 26;
    kUnicodeDecompositionType   = 27;
    kRubyKanaType               = 28;
    kCJKSymbolAlternativesType  = 29;
    kIdeographicAlternativesType = 30;
    kCJKVerticalRomanPlacementType = 31;
    kItalicCJKRomanType         = 32;
    kCJKRomanSpacingType        = 103;
    kLastFeatureType            = -1;


    {
     *  Summary:
     *    Selectors for feature type kAllTypographicFeaturesType
        }
    kAllTypeFeaturesOnSelector  = 0;
    kAllTypeFeaturesOffSelector = 1;



    {
     *  Summary:
     *    Selectors for feature type kLigaturesType
        }
    kRequiredLigaturesOnSelector = 0;
    kRequiredLigaturesOffSelector = 1;
    kCommonLigaturesOnSelector  = 2;
    kCommonLigaturesOffSelector = 3;
    kRareLigaturesOnSelector    = 4;
    kRareLigaturesOffSelector   = 5;
    kLogosOnSelector            = 6;
    kLogosOffSelector           = 7;
    kRebusPicturesOnSelector    = 8;
    kRebusPicturesOffSelector   = 9;
    kDiphthongLigaturesOnSelector = 10;
    kDiphthongLigaturesOffSelector = 11;
    kSquaredLigaturesOnSelector = 12;
    kSquaredLigaturesOffSelector = 13;
    kAbbrevSquaredLigaturesOnSelector = 14;
    kAbbrevSquaredLigaturesOffSelector = 15;
    kSymbolLigaturesOnSelector  = 16;
    kSymbolLigaturesOffSelector = 17;


    {
     *  Summary:
     *    Selectors for feature type kCursiveConnectionType
        }
    kUnconnectedSelector        = 0;
    kPartiallyConnectedSelector = 1;
    kCursiveSelector            = 2;


    {
     *  Summary:
     *    Selectors for feature type kLetterCaseType
        }
    kUpperAndLowerCaseSelector  = 0;
    kAllCapsSelector            = 1;
    kAllLowerCaseSelector       = 2;
    kSmallCapsSelector          = 3;
    kInitialCapsSelector        = 4;
    kInitialCapsAndSmallCapsSelector = 5;


    {
     *  Summary:
     *    Selectors for feature type kVerticalSubstitutionType
        }
    kSubstituteVerticalFormsOnSelector = 0;
    kSubstituteVerticalFormsOffSelector = 1;


    {
     *  Summary:
     *    Selectors for feature type kLinguisticRearrangementType
        }
    kLinguisticRearrangementOnSelector = 0;
    kLinguisticRearrangementOffSelector = 1;


    {
     *  Summary:
     *    Selectors for feature type kNumberSpacingType
        }
    kMonospacedNumbersSelector  = 0;
    kProportionalNumbersSelector = 1;
    kThirdWidthNumbersSelector  = 2;
    kQuarterWidthNumbersSelector = 3;


    {
     *  Summary:
     *    Selectors for feature type kSmartSwashType
        }
    kWordInitialSwashesOnSelector = 0;
    kWordInitialSwashesOffSelector = 1;
    kWordFinalSwashesOnSelector = 2;
    kWordFinalSwashesOffSelector = 3;
    kLineInitialSwashesOnSelector = 4;
    kLineInitialSwashesOffSelector = 5;
    kLineFinalSwashesOnSelector = 6;
    kLineFinalSwashesOffSelector = 7;
    kNonFinalSwashesOnSelector  = 8;
    kNonFinalSwashesOffSelector = 9;


    {
     *  Summary:
     *    Selectors for feature type kDiacriticsType
        }
    kShowDiacriticsSelector     = 0;
    kHideDiacriticsSelector     = 1;
    kDecomposeDiacriticsSelector = 2;


    {
     *  Summary:
     *    Selectors for feature type kVerticalPositionType
        }
    kNormalPositionSelector     = 0;
    kSuperiorsSelector          = 1;
    kInferiorsSelector          = 2;
    kOrdinalsSelector           = 3;


    {
     *  Summary:
     *    Selectors for feature type kFractionsType
        }
    kNoFractionsSelector        = 0;
    kVerticalFractionsSelector  = 1;
    kDiagonalFractionsSelector  = 2;


    {
     *  Summary:
     *    Selectors for feature type kOverlappingCharactersType
        }
    kPreventOverlapOnSelector   = 0;
    kPreventOverlapOffSelector  = 1;


    {
     *  Summary:
     *    Selectors for feature type kTypographicExtrasType
        }
    kHyphensToEmDashOnSelector  = 0;
    kHyphensToEmDashOffSelector = 1;
    kHyphenToEnDashOnSelector   = 2;
    kHyphenToEnDashOffSelector  = 3;
    kSlashedZeroOnSelector      = 4;
    kSlashedZeroOffSelector     = 5;
    kFormInterrobangOnSelector  = 6;
    kFormInterrobangOffSelector = 7;
    kSmartQuotesOnSelector      = 8;
    kSmartQuotesOffSelector     = 9;
    kPeriodsToEllipsisOnSelector = 10;
    kPeriodsToEllipsisOffSelector = 11;


    {
     *  Summary:
     *    Selectors for feature type kMathematicalExtrasType
        }
    kHyphenToMinusOnSelector    = 0;
    kHyphenToMinusOffSelector   = 1;
    kAsteriskToMultiplyOnSelector = 2;
    kAsteriskToMultiplyOffSelector = 3;
    kSlashToDivideOnSelector    = 4;
    kSlashToDivideOffSelector   = 5;
    kInequalityLigaturesOnSelector = 6;
    kInequalityLigaturesOffSelector = 7;
    kExponentsOnSelector        = 8;
    kExponentsOffSelector       = 9;


    {
     *  Summary:
     *    Selectors for feature type kOrnamentSetsType
        }
    kNoOrnamentsSelector        = 0;
    kDingbatsSelector           = 1;
    kPiCharactersSelector       = 2;
    kFleuronsSelector           = 3;
    kDecorativeBordersSelector  = 4;
    kInternationalSymbolsSelector = 5;
    kMathSymbolsSelector        = 6;


    {
     *  Summary:
     *    Selectors for feature type kCharacterAlternativesType
        }
    kNoAlternatesSelector       = 0;


    {
     *  Summary:
     *    Selectors for feature type kDesignComplexityType
        }
    kDesignLevel1Selector       = 0;
    kDesignLevel2Selector       = 1;
    kDesignLevel3Selector       = 2;
    kDesignLevel4Selector       = 3;
    kDesignLevel5Selector       = 4;


    {
     *  Summary:
     *    Selectors for feature type kStyleOptionsType
        }
    kNoStyleOptionsSelector     = 0;
    kDisplayTextSelector        = 1;
    kEngravedTextSelector       = 2;
    kIlluminatedCapsSelector    = 3;
    kTitlingCapsSelector        = 4;
    kTallCapsSelector           = 5;


    {
     *  Summary:
     *    Selectors for feature type kCharacterShapeType
        }
    kTraditionalCharactersSelector = 0;
    kSimplifiedCharactersSelector = 1;
    kJIS1978CharactersSelector  = 2;
    kJIS1983CharactersSelector  = 3;
    kJIS1990CharactersSelector  = 4;
    kTraditionalAltOneSelector  = 5;
    kTraditionalAltTwoSelector  = 6;
    kTraditionalAltThreeSelector = 7;
    kTraditionalAltFourSelector = 8;
    kTraditionalAltFiveSelector = 9;
    kExpertCharactersSelector   = 10;


    {
     *  Summary:
     *    Selectors for feature type kNumberCaseType
        }
    kLowerCaseNumbersSelector   = 0;
    kUpperCaseNumbersSelector   = 1;


    {
     *  Summary:
     *    Selectors for feature type kTextSpacingType
        }
    kProportionalTextSelector   = 0;
    kMonospacedTextSelector     = 1;
    kHalfWidthTextSelector      = 2;
    kNormallySpacedTextSelector = 3;


    {
     *  Summary:
     *    Selectors for feature type kTransliterationType
        }
    kNoTransliterationSelector  = 0;
    kHanjaToHangulSelector      = 1;
    kHiraganaToKatakanaSelector = 2;
    kKatakanaToHiraganaSelector = 3;
    kKanaToRomanizationSelector = 4;
    kRomanizationToHiraganaSelector = 5;
    kRomanizationToKatakanaSelector = 6;
    kHanjaToHangulAltOneSelector = 7;
    kHanjaToHangulAltTwoSelector = 8;
    kHanjaToHangulAltThreeSelector = 9;


    {
     *  Summary:
     *    Selectors for feature type kAnnotationType
        }
    kNoAnnotationSelector       = 0;
    kBoxAnnotationSelector      = 1;
    kRoundedBoxAnnotationSelector = 2;
    kCircleAnnotationSelector   = 3;
    kInvertedCircleAnnotationSelector = 4;
    kParenthesisAnnotationSelector = 5;
    kPeriodAnnotationSelector   = 6;
    kRomanNumeralAnnotationSelector = 7;
    kDiamondAnnotationSelector  = 8;
    kInvertedBoxAnnotationSelector = 9;
    kInvertedRoundedBoxAnnotationSelector = 10;


    {
     *  Summary:
     *    Selectors for feature type kKanaSpacingType
        }
    kFullWidthKanaSelector      = 0;
    kProportionalKanaSelector   = 1;


    {
     *  Summary:
     *    Selectors for feature type kIdeographicSpacingType
        }
    kFullWidthIdeographsSelector = 0;
    kProportionalIdeographsSelector = 1;
    kHalfWidthIdeographsSelector = 2;


    {
     *  Summary:
     *    Selectors for feature type kUnicodeDecompositionType
        }
    kCanonicalCompositionOnSelector = 0;
    kCanonicalCompositionOffSelector = 1;
    kCompatibilityCompositionOnSelector = 2;
    kCompatibilityCompositionOffSelector = 3;
    kTranscodingCompositionOnSelector = 4;
    kTranscodingCompositionOffSelector = 5;


    {
     *  Summary:
     *    Selectors for feature type kRubyKanaType
        }
    kNoRubyKanaSelector         = 0;
    kRubyKanaSelector           = 1;


    {
     *  Summary:
     *    Selectors for feature type kCJKSymbolAlternativesType
        }
    kNoCJKSymbolAlternativesSelector = 0;
    kCJKSymbolAltOneSelector    = 1;
    kCJKSymbolAltTwoSelector    = 2;
    kCJKSymbolAltThreeSelector  = 3;
    kCJKSymbolAltFourSelector   = 4;
    kCJKSymbolAltFiveSelector   = 5;


    {
     *  Summary:
     *    Selectors for feature type kIdeographicAlternativesType
        }
    kNoIdeographicAlternativesSelector = 0;
    kIdeographicAltOneSelector  = 1;
    kIdeographicAltTwoSelector  = 2;
    kIdeographicAltThreeSelector = 3;
    kIdeographicAltFourSelector = 4;
    kIdeographicAltFiveSelector = 5;


    {
     *  Summary:
     *    Selectors for feature type kCJKVerticalRomanPlacementType
        }
    kCJKVerticalRomanCenteredSelector = 0;
    kCJKVerticalRomanHBaselineSelector = 1;


    {
     *  Summary:
     *    Selectors for feature type kItalicCJKRomanType
        }
    kNoCJKItalicRomanSelector   = 0;
    kCJKItalicRomanSelector     = 1;


    {
     *  Summary:
     *    Selectors for feature type kCJKRomanSpacingType
        }
    kHalfWidthCJKRomanSelector  = 0;
    kProportionalCJKRomanSelector = 1;
    kDefaultCJKRomanSelector    = 2;
    kFullWidthCJKRomanSelector  = 3;

    {    ---------------------------------------------------------------------------    }
    {    ---------------- Table Specific Typedefs and Constants --------------------    }
    {    ---------------------------------------------------------------------------    }
    {    FORMATS FOR TABLE: lookup tables - used within various other tables    }
    kSFNTLookupSimpleArray      = 0;                            {  a simple array indexed by glyph code  }
    kSFNTLookupSegmentSingle    = 2;                            {  segment mapping to single value  }
    kSFNTLookupSegmentArray     = 4;                            {  segment mapping to lookup array  }
    kSFNTLookupSingleTable      = 6;                            {  sorted list of glyph, value pairs  }
    kSFNTLookupTrimmedArray     = 8;                            {  a simple trimmed array indexed by glyph code  }


type
    SFNTLookupTableFormat               = UInt16;
    SFNTLookupValue                     = UInt16;
    SFNTLookupOffset                    = UInt16;
    SFNTLookupKind                      = UInt32;
    {
        A BinarySearchHeader defines the five standard fields needed to perform quick
        lookups in a lookup table (note that using UInt16s, and not ItemCounts or
        similar types, is important here, since these tables are in fonts, and the
        documented font formats specify 16-bit quantities).
        }
    SFNTLookupBinarySearchHeaderPtr = ^SFNTLookupBinarySearchHeader;
    SFNTLookupBinarySearchHeader = record
        unitSize:               UInt16;                                 {  size of a unit in bytes  }
        nUnits:                 UInt16;                                 {  number of units in table  }
        searchRange:            UInt16;                                 {  (largest power of two <= nUnits) * unitSize  }
        entrySelector:          UInt16;                                 {  log2 (largest power of two <= nUnits)  }
        rangeShift:             UInt16;                                 {  (nUnits - largest power of two <= nUnits) * unitSize  }
    end;

    {    A format 0 lookup table maps all glyphs in the font to lookup values   }
    SFNTLookupArrayHeaderPtr = ^SFNTLookupArrayHeader;
    SFNTLookupArrayHeader = record
        lookupValues:           array [0..0] of SFNTLookupValue;
    end;

    {    A format 8 lookup table maps some range of glyphs in the font to lookup values     }
    SFNTLookupTrimmedArrayHeaderPtr = ^SFNTLookupTrimmedArrayHeader;
    SFNTLookupTrimmedArrayHeader = record
        firstGlyph:             UInt16;
        count:                  UInt16;
        valueArray:             array [0..0] of SFNTLookupValue;
    end;

    {
        Format 2 and format 4 lookup tables map ranges of glyphs to either single lookup
        values (format 2), or per-glyph lookup values (format 4). Since both formats
        use the same kind of data, only one unified set of segment-related structures
        is defined.
        }
    SFNTLookupSegmentPtr = ^SFNTLookupSegment;
    SFNTLookupSegment = record
        lastGlyph:              UInt16;
        firstGlyph:             UInt16;
        value:                  array [0..0] of UInt16;
    end;

    SFNTLookupSegmentHeaderPtr = ^SFNTLookupSegmentHeader;
    SFNTLookupSegmentHeader = record
        binSearch:              SFNTLookupBinarySearchHeader;
        segments:               array [0..0] of SFNTLookupSegment;
    end;

    {    A format 6 lookup table maps single glyphs to lookup values.   }
    SFNTLookupSinglePtr = ^SFNTLookupSingle;
    SFNTLookupSingle = record
        glyph:                  UInt16;
        value:                  array [0..0] of UInt16;
    end;

    SFNTLookupSingleHeaderPtr = ^SFNTLookupSingleHeader;
    SFNTLookupSingleHeader = record
        binSearch:              SFNTLookupBinarySearchHeader;
        entries:                array [0..0] of SFNTLookupSingle;
    end;

    {    The format-specific part of the subtable header    }
    SFNTLookupFormatSpecificHeaderPtr = ^SFNTLookupFormatSpecificHeader;
    SFNTLookupFormatSpecificHeader = record
        case SInt16 of
        0: (
            theArray:           SFNTLookupArrayHeader;
            );
        1: (
            segment:            SFNTLookupSegmentHeader;
            );
        2: (
            single:             SFNTLookupSingleHeader;
            );
        3: (
            trimmedArray:       SFNTLookupTrimmedArrayHeader;
            );
    end;

    {    The overall subtable header    }
    SFNTLookupTablePtr = ^SFNTLookupTable;
    SFNTLookupTable = record
        format:                 SFNTLookupTableFormat;                  {  table format  }
        fsHeader:               SFNTLookupFormatSpecificHeader;         {  format specific header  }
    end;

    SFNTLookupTableHandle               = ^SFNTLookupTablePtr;
    {    ---------------------------------------------------------------------------    }
    {    GENERAL FORMATS FOR STATE TABLES -- prefix "ST"    }

const
    kSTClassEndOfText           = 0;
    kSTClassOutOfBounds         = 1;
    kSTClassDeletedGlyph        = 2;
    kSTClassEndOfLine           = 3;
    kSTSetMark                  = $8000;
    kSTNoAdvance                = $4000;
    kSTMarkEnd                  = $2000;
    kSTLigActionMask            = $3FFF;
    kSTRearrVerbMask            = $000F;


type
    STClass                             = UInt8;
    STEntryIndex                        = UInt8;
    STHeaderPtr = ^STHeader;
    STHeader = record
        filler:                 SInt8;
        nClasses:               SInt8;
        classTableOffset:       UInt16;
        stateArrayOffset:       UInt16;
        entryTableOffset:       UInt16;
    end;

    STClassTablePtr = ^STClassTable;
    STClassTable = record
        firstGlyph:             UInt16;
        nGlyphs:                UInt16;
        classes:                SInt8;
    end;

    STEntryZeroPtr = ^STEntryZero;
    STEntryZero = record
        newState:               UInt16;
        flags:                  UInt16;
    end;

    STEntryOnePtr = ^STEntryOne;
    STEntryOne = record
        newState:               UInt16;
        flags:                  UInt16;
        offset1:                UInt16;
    end;

    STEntryTwoPtr = ^STEntryTwo;
    STEntryTwo = record
        newState:               UInt16;
        flags:                  UInt16;
        offset1:                UInt16;
        offset2:                UInt16;
    end;

    {    ---------------------------------------------------------------------------    }
    {    GENERAL FORMATS FOR STATE TABLES to be used with 'morx' tables -- prefix "STX"     }

const
    kSTXHasLigAction            = $2000;


type
    STXClass                            = UInt16;
    STXStateIndex                       = UInt16;
    STXEntryIndex                       = UInt16;
    STXHeaderPtr = ^STXHeader;
    STXHeader = record
        nClasses:               UInt32;
        classTableOffset:       UInt32;
        stateArrayOffset:       UInt32;
        entryTableOffset:       UInt32;
    end;

    STXClassTable                       = SFNTLookupTable;
    STXClassTablePtr                    = ^STXClassTable;
    STXEntryZeroPtr = ^STXEntryZero;
    STXEntryZero = record
        newState:               STXStateIndex;
        flags:                  UInt16;
    end;

    STXEntryOnePtr = ^STXEntryOne;
    STXEntryOne = record
        newState:               STXStateIndex;
        flags:                  UInt16;
        index1:                 UInt16;
    end;

    STXEntryTwoPtr = ^STXEntryTwo;
    STXEntryTwo = record
        newState:               STXStateIndex;
        flags:                  UInt16;
        index1:                 UInt16;
        index2:                 UInt16;
    end;

    {    ---------------------------------------------------------------------------    }
    {    FORMATS FOR TABLE: 'lcar'  }
    {    CONSTANTS  }

const
    kLCARTag                    = $6C636172;                    {  'lcar'  }
    kLCARCurrentVersion         = $00010000;                    {  current version number for 'lcar' table  }
    kLCARLinearFormat           = 0;
    kLCARCtlPointFormat         = 1;

    {    TYPES  }

type
    LcarCaretClassEntryPtr = ^LcarCaretClassEntry;
    LcarCaretClassEntry = record
        count:                  UInt16;
        partials:               array [0..0] of UInt16;                 {  these are either FUnits or control-point numbers  }
    end;

    LcarCaretTablePtr = ^LcarCaretTable;
    LcarCaretTable = record
        version:                Fixed;
        format:                 UInt16;
        lookup:                 SFNTLookupTable;
    end;

    {    ---------------------------------------------------------------------------    }
    {    FORMATS FOR TABLE: 'just'  }
    {    CONSTANTS  }

const
    kJUSTTag                    = $6A757374;                    {  'just'  }
    kJUSTCurrentVersion         = $00010000;
    kJUSTStandardFormat         = 0;
    kJUSTnoGlyphcode            = $FFFF;                        {  used in a pcConditionalAddAction  }
    kJUSTpcDecompositionAction  = 0;
    kJUSTpcUnconditionalAddAction = 1;
    kJUSTpcConditionalAddAction = 2;
    kJUSTpcGlyphStretchAction   = 3;
    kJUSTpcDuctilityAction      = 4;
    kJUSTpcGlyphRepeatAddAction = 5;

    {    Justification priority levels  }
    kJUSTKashidaPriority        = 0;
    kJUSTSpacePriority          = 1;
    kJUSTLetterPriority         = 2;
    kJUSTNullPriority           = 3;
    kJUSTPriorityCount          = 4;

    {    Justification flags    }
    kJUSTOverridePriority       = $8000;
    kJUSTOverrideLimits         = $4000;
    kJUSTOverrideUnlimited      = $2000;
    kJUSTUnlimited              = $1000;
    kJUSTPriorityMask           = $0003;

    {    TYPES  }

type
    JustPCActionType                    = UInt16;
    JustificationFlags                  = UInt16;
    {    A JustPCDecompositionAction defines a ligature decomposition action.   }
    JustPCDecompositionActionPtr = ^JustPCDecompositionAction;
    JustPCDecompositionAction = record
        lowerLimit:             Fixed;
        upperLimit:             Fixed;
        order:                  UInt16;
        count:                  UInt16;
        glyphs:                 array [0..0] of UInt16;
    end;

    {    A JUSTPCUnconditionalAddAction defines an unconditional glyph add action.  }
    JustPCUnconditionalAddAction        = UInt16;
    {
        A JUSTPCConditionalAddAction defines a glyph substitution and add action. If the addGlyph
        is equal to kJUSTnoGlyphcode, then no glyph will be added, and the justification for
        the line will be redone.
        }
    JustPCConditionalAddActionPtr = ^JustPCConditionalAddAction;
    JustPCConditionalAddAction = record
        substThreshhold:        Fixed;                                  {  threshhold of growth factor at which subst occurs  }
        addGlyph:               UInt16;
        substGlyph:             UInt16;
    end;

    {    A PCDuctilityAction defines a ductile axis along which the glyph will be varied.   }
    JustPCDuctilityActionPtr = ^JustPCDuctilityAction;
    JustPCDuctilityAction = record
        ductilityAxis:          UInt32;
        minimumLimit:           Fixed;
        noStretchValue:         Fixed;
        maximumLimit:           Fixed;
    end;

    {
        A PCGlyphRepetitionAction defines a glyph which will not be stretched or otherwise
        transformed, but rather which will be emplaced however many times are needed to fill
        the needed gap.
        }
    JustPCGlyphRepeatAddActionPtr = ^JustPCGlyphRepeatAddAction;
    JustPCGlyphRepeatAddAction = record
        flags:                  UInt16;
        glyph:                  UInt16;
    end;

    {    PCActionSubrecords contain the actual postcompensation actions.    }
    JustPCActionSubrecordPtr = ^JustPCActionSubrecord;
    JustPCActionSubrecord = record
        theClass:               UInt16;                                 {  justification class value associated with this rec  }
        theType:                JustPCActionType;
        length:                 UInt32;
        data:                   UInt32;                                 {  not really a UInt32; cast as ptr to appropriate action  }
    end;

    {    The set of postcompensation records is defined in a PCAction struct.   }
    JustPCActionPtr = ^JustPCAction;
    JustPCAction = record
        actionCount:            UInt32;                                 {  long for alignment purposes  }
        actions:                array [0..0] of JustPCActionSubrecord;
    end;

    {
        JustWidthDeltaEntry is the justification table entry structure.  The justClass value (which is
        actually limited to 7 bits by the state table structure) is defined as a long for PPC alignment reasons.
        }
    JustWidthDeltaEntryPtr = ^JustWidthDeltaEntry;
    JustWidthDeltaEntry = record
        justClass:              UInt32;
        beforeGrowLimit:        Fixed;                                  {  ems AW can grow by at most on LT  }
        beforeShrinkLimit:      Fixed;                                  {  ems AW can shrink by at most on LT  }
        afterGrowLimit:         Fixed;                                  {  ems AW can grow by at most on RB  }
        afterShrinkLimit:       Fixed;                                  {  ems AW can shrink by at most on RB  }
        growFlags:              JustificationFlags;                     {  flags controlling grow case  }
        shrinkFlags:            JustificationFlags;                     {  flags controlling shrink case  }
    end;

    JustWidthDeltaGroupPtr = ^JustWidthDeltaGroup;
    JustWidthDeltaGroup = record
        count:                  UInt32;
        entries:                array [0..0] of JustWidthDeltaEntry;
    end;

    {    Overall structure of a postcompensation table is defined in PostcompTable.     }
    JustPostcompTablePtr = ^JustPostcompTable;
    JustPostcompTable = record
        lookupTable:            SFNTLookupTable;
                                                                        {  action records here  }
    end;

    JustDirectionTablePtr = ^JustDirectionTable;
    JustDirectionTable = record
        justClass:              UInt16;                                 {  offset to state table (0=none)  }
        widthDeltaClusters:     UInt16;                                 {  offset to clusters  }
        postcomp:               UInt16;                                 {  offset to postcomp table (0=none)  }
        lookup:                 SFNTLookupTable;
    end;

    JustTablePtr = ^JustTable;
    JustTable = record
        version:                Fixed;
        format:                 UInt16;
        horizHeaderOffset:      UInt16;
        vertHeaderOffset:       UInt16;
    end;

    {    ---------------------------------------------------------------------------    }
    {    FORMATS FOR TABLE: 'opbd'  }
    {    CONSTANTS  }

const
    kOPBDTag                    = $6F706264;                    {  'opbd'  }
    kOPBDCurrentVersion         = $00010000;
    kOPBDDistanceFormat         = 0;
    kOPBDControlPointFormat     = 1;

    {    TYPES  }

type
    OpbdTableFormat                     = UInt16;
    {
        The OpbdSideValues struct is the lookup result from the FindSingle call for the
        optical tables. It contains the 4 FUnit values that are relevant to the specified
        glyph, or the 4 control gxPoint values.
        }
    OpbdSideValuesPtr = ^OpbdSideValues;
    OpbdSideValues = record
        leftSideShift:          SInt16;
        topSideShift:           SInt16;
        rightSideShift:         SInt16;
        bottomSideShift:        SInt16;
    end;

    OpbdTablePtr = ^OpbdTable;
    OpbdTable = record
        version:                Fixed;
        format:                 OpbdTableFormat;
        lookupTable:            SFNTLookupTable;
    end;

    {    ---------------------------------------------------------------------------    }
    {    FORMATS FOR TABLE: 'mort'  }
    {    CONSTANTS  }

const
    kMORTTag                    = $6D6F7274;                    {  'mort'  }
    kMORTCurrentVersion         = $00010000;                    {  current version number for 'mort' table  }
                                                                {  Coverage masks  }
    kMORTCoverVertical          = $8000;
    kMORTCoverDescending        = $4000;
    kMORTCoverIgnoreVertical    = $2000;
    kMORTCoverTypeMask          = $000F;                        {  Subtable types  }
    kMORTRearrangementType      = 0;
    kMORTContextualType         = 1;
    kMORTLigatureType           = 2;
    kMORTSwashType              = 4;
    kMORTInsertionType          = 5;                            {  Ligature subtable constants  }
    kMORTLigLastAction          = $80000000;
    kMORTLigStoreLigature       = $40000000;
    kMORTLigFormOffsetMask      = $3FFFFFFF;
    kMORTLigFormOffsetShift     = 2;                            {  Rearrangement subtable actions  }
    kMORTraNoAction             = 0;                            {     no action    }
    kMORTraxA                   = 1;                            {       Ax => xA     }
    kMORTraDx                   = 2;                            {       xD => Dx     }
    kMORTraDxA                  = 3;                            {      AxD => DxA    }
    kMORTraxAB                  = 4;                            {    ABx => xAB    }
    kMORTraxBA                  = 5;                            {    ABx => xBA    }
    kMORTraCDx                  = 6;                            {    xCD => CDx    }
    kMORTraDCx                  = 7;                            {    xCD => DCx    }
    kMORTraCDxA                 = 8;                            {   AxCD => CDxA   }
    kMORTraDCxA                 = 9;                            {   AxCD => DCxA   }
    kMORTraDxAB                 = 10;                           {   ABxD => DxAB   }
    kMORTraDxBA                 = 11;                           {   ABxD => DxBA   }
    kMORTraCDxAB                = 12;                           {  ABxCD => CDxAB  }
    kMORTraCDxBA                = 13;                           {  ABxCD => CDxBA  }
    kMORTraDCxAB                = 14;                           {  ABxCD => DCxAB  }
    kMORTraDCxBA                = 15;                           {  ABxCD => DCxBA  }
                                                                {  Insertion subtable constants  }
    kMORTDoInsertionsBefore     = $80;
    kMORTIsSplitVowelPiece      = $40;
    kMORTInsertionsCountMask    = $3F;
    kMORTCurrInsertKashidaLike  = $2000;
    kMORTMarkInsertKashidaLike  = $1000;
    kMORTCurrInsertBefore       = $0800;
    kMORTMarkInsertBefore       = $0400;
    kMORTMarkJustTableCountMask = $3F80;
    kMORTMarkJustTableCountShift = 7;                           {  JustTableIndex for marked character  }
    kMORTCurrJustTableCountMask = $007F;
    kMORTCurrJustTableCountShift = 0;                           {  JustTableIndex for current character  }
    kMORTCurrInsertCountMask    = $03E0;
    kMORTCurrInsertCountShift   = 5;                            {  count to insert after current glyphRec  }
    kMORTMarkInsertCountMask    = $001F;
    kMORTMarkInsertCountShift   = 0;                            {  count to insert after marked glyphRec  }

    {    TYPES  }

type
    MortSubtableMaskFlags               = UInt32;
    MortLigatureActionEntry             = UInt32;
    MortRearrangementSubtablePtr = ^MortRearrangementSubtable;
    MortRearrangementSubtable = record
        header:                 STHeader;
    end;

    MortContextualSubtablePtr = ^MortContextualSubtable;
    MortContextualSubtable = record
        header:                 STHeader;
        substitutionTableOffset: UInt16;
    end;

    MortLigatureSubtablePtr = ^MortLigatureSubtable;
    MortLigatureSubtable = record
        header:                 STHeader;
        ligatureActionTableOffset: UInt16;
        componentTableOffset:   UInt16;
        ligatureTableOffset:    UInt16;
    end;

    MortSwashSubtablePtr = ^MortSwashSubtable;
    MortSwashSubtable = record
        lookup:                 SFNTLookupTable;
    end;

    MortInsertionSubtablePtr = ^MortInsertionSubtable;
    MortInsertionSubtable = record
        header:                 STHeader;
    end;

    MortSpecificSubtablePtr = ^MortSpecificSubtable;
    MortSpecificSubtable = record
        case SInt16 of
        0: (
            rearrangement:      MortRearrangementSubtable;
            );
        1: (
            contextual:         MortContextualSubtable;
            );
        2: (
            ligature:           MortLigatureSubtable;
            );
        3: (
            swash:              MortSwashSubtable;
            );
        4: (
            insertion:          MortInsertionSubtable;
            );
    end;

    MortSubtablePtr = ^MortSubtable;
    MortSubtable = record
        length:                 UInt16;
        coverage:               UInt16;
        flags:                  MortSubtableMaskFlags;
        u:                      MortSpecificSubtable;
    end;

    MortFeatureEntryPtr = ^MortFeatureEntry;
    MortFeatureEntry = record
        featureType:            UInt16;
        featureSelector:        UInt16;
        enableFlags:            MortSubtableMaskFlags;
        disableFlags:           MortSubtableMaskFlags;
    end;

    MortChainPtr = ^MortChain;
    MortChain = record
        defaultFlags:           MortSubtableMaskFlags;                  {  default flags for this chain  }
        length:                 UInt32;                                 {  byte length of this chain  }
        nFeatures:              UInt16;                                 {  number of feature entries  }
        nSubtables:             UInt16;                                 {  number of subtables  }
        featureEntries:         array [0..0] of MortFeatureEntry;
                                                                        {  the subtables follow  }
    end;

    MortTablePtr = ^MortTable;
    MortTable = record
        version:                Fixed;
        nChains:                UInt32;
        chains:                 array [0..0] of MortChain;
    end;

    {    ---------------------------------------------------------------------------    }
    {    FORMATS FOR TABLE: 'morx' (version 2 and beyond metamorphosis tables)  }
    {    CONSTANTS  }

const
    kMORXTag                    = $6D6F7278;                    {  'morx'  }
    kMORXCurrentVersion         = $00020000;                    {  version number for current 'morx' table  }
                                                                {  Coverage masks  }
    kMORXCoverVertical          = $80000000;
    kMORXCoverDescending        = $40000000;
    kMORXCoverIgnoreVertical    = $20000000;
    kMORXCoverTypeMask          = $000000FF;

    {    TYPES  }

type
    MorxRearrangementSubtablePtr = ^MorxRearrangementSubtable;
    MorxRearrangementSubtable = record
        header:                 STXHeader;
    end;

    MorxContextualSubtablePtr = ^MorxContextualSubtable;
    MorxContextualSubtable = record
        header:                 STXHeader;
        substitutionTableOffset: UInt32;
    end;

    MorxLigatureSubtablePtr = ^MorxLigatureSubtable;
    MorxLigatureSubtable = record
        header:                 STXHeader;
        ligatureActionTableOffset: UInt32;
        componentTableOffset:   UInt32;
        ligatureTableOffset:    UInt32;
    end;

    MorxInsertionSubtablePtr = ^MorxInsertionSubtable;
    MorxInsertionSubtable = record
        header:                 STXHeader;
        insertionGlyphTableOffset: UInt32;
    end;

    MorxSpecificSubtablePtr = ^MorxSpecificSubtable;
    MorxSpecificSubtable = record
        case SInt16 of
        0: (
            rearrangement:      MorxRearrangementSubtable;
            );
        1: (
            contextual:         MorxContextualSubtable;
            );
        2: (
            ligature:           MorxLigatureSubtable;
            );
        3: (
            swash:              MortSwashSubtable;
            );
        4: (
            insertion:          MorxInsertionSubtable;
            );
    end;

    MorxSubtablePtr = ^MorxSubtable;
    MorxSubtable = record
        length:                 UInt32;
        coverage:               UInt32;
        flags:                  MortSubtableMaskFlags;
        u:                      MorxSpecificSubtable;
    end;

    MorxChainPtr = ^MorxChain;
    MorxChain = record
        defaultFlags:           MortSubtableMaskFlags;                  {  default flags for this chain  }
        length:                 UInt32;                                 {  byte length of this chain  }
        nFeatures:              UInt32;                                 {  number of feature entries  }
        nSubtables:             UInt32;                                 {  number of subtables  }
        featureEntries:         array [0..0] of MortFeatureEntry;
                                                                        {  the subtables follow  }
    end;

    MorxTablePtr = ^MorxTable;
    MorxTable = record
        version:                Fixed;
        nChains:                UInt32;
        chains:                 array [0..0] of MorxChain;
    end;

    {    ---------------------------------------------------------------------------    }
    {    FORMATS FOR TABLE: 'prop'  }
    {    CONSTANTS  }

const
    kPROPTag                    = $70726F70;                    {  'prop'  }
    kPROPCurrentVersion         = $00020000;                    {  current version number for 'prop' table  }
    kPROPPairOffsetShift        = 8;
    kPROPPairOffsetSign         = 7;
    kPROPIsFloaterMask          = $8000;                        {  glyph is floater  }
    kPROPCanHangLTMask          = $4000;                        {  glyph can hang left/top  }
    kPROPCanHangRBMask          = $2000;                        {  glyph can hang right/bottom  }
    kPROPUseRLPairMask          = $1000;                        {  if glyph lands in RL streak, use paired glyph  }
    kPROPPairOffsetMask         = $0F00;                        {  4-bit signed offset to other pair member  }
    kPROPRightConnectMask       = $0080;                        {  glyph connects to glyph on right  }
    kPROPZeroReserved           = $0060;                        {  must be zero  }
    kPROPDirectionMask          = $001F;                        {  direction bits  }

    {    These are the Unicode direction classes (plus the Special European Number class).  }
    kPROPLDirectionClass        = 0;                            {  Left-to-Right  }
    kPROPRDirectionClass        = 1;                            {  Right-to-Left  }
    kPROPALDirectionClass       = 2;                            {  Right-to-Left Arabic Letter  }
    kPROPENDirectionClass       = 3;                            {  European Number  }
    kPROPESDirectionClass       = 4;                            {  European Number Seperator  }
    kPROPETDirectionClass       = 5;                            {  European Number Terminator  }
    kPROPANDirectionClass       = 6;                            {  Arabic Number  }
    kPROPCSDirectionClass       = 7;                            {  Common Number Seperator  }
    kPROPPSDirectionClass       = 8;                            {  Paragraph Seperator (also referred to as Block Separator)  }
    kPROPSDirectionClass        = 9;                            {  Segment Seperator  }
    kPROPWSDirectionClass       = 10;                           {  Whitespace  }
    kPROPONDirectionClass       = 11;                           {  Other Neutral  }
    kPROPSENDirectionClass      = 12;                           {  Special European Number (not a Unicode class)  }
    kPROPLREDirectionClass      = 13;                           {  Left-to-Right Embeding  }
    kPROPLRODirectionClass      = 14;                           {  Left-to-Right Override  }
    kPROPRLEDirectionClass      = 15;                           {  Right-to-Left Embeding  }
    kPROPRLODirectionClass      = 16;                           {  Right-to-Left Override  }
    kPROPPDFDirectionClass      = 17;                           {  Pop Directional Format  }
    kPROPNSMDirectionClass      = 18;                           {  Non-Spacing Mark  }
    kPROPBNDirectionClass       = 19;                           {  Boundary Neutral  }
    kPROPNumDirectionClasses    = 20;                           {  Number of Unicode directional types + Special European Number  }

    {    TYPES  }

type
    PropCharProperties                  = UInt16;
    PropTablePtr = ^PropTable;
    PropTable = record
        version:                Fixed;
        format:                 UInt16;
        defaultProps:           PropCharProperties;
        lookup:                 SFNTLookupTable;
    end;

    PropLookupSegmentPtr = ^PropLookupSegment;
    PropLookupSegment = record
        lastGlyph:              UInt16;
        firstGlyph:             UInt16;
        value:                  UInt16;
    end;

    PropLookupSinglePtr = ^PropLookupSingle;
    PropLookupSingle = record
        glyph:                  UInt16;
        props:                  PropCharProperties;
    end;

    {    ---------------------------------------------------------------------------    }
    {    FORMATS FOR TABLE: 'trak'  }
    {    CONSTANTS  }

const
    kTRAKTag                    = $7472616B;                    {  'trak'  }
    kTRAKCurrentVersion         = $00010000;                    {  current version number for 'trak' table  }
    kTRAKUniformFormat          = 0;                            {     kTRAKPerGlyphFormat         = 2 }

    {    TYPES  }

type
    TrakValue                           = SInt16;
    TrakTableEntryPtr = ^TrakTableEntry;
    TrakTableEntry = record
        track:                  Fixed;
        nameTableIndex:         UInt16;
        sizesOffset:            UInt16;                                 {  offset to array of TrackingValues  }
    end;

    TrakTableDataPtr = ^TrakTableData;
    TrakTableData = record
        nTracks:                UInt16;
        nSizes:                 UInt16;
        sizeTableOffset:        UInt32;
        trakTable:              array [0..0] of TrakTableEntry;
    end;

    TrakTablePtr = ^TrakTable;
    TrakTable = record
        version:                Fixed;
        format:                 UInt16;
        horizOffset:            UInt16;
        vertOffset:             UInt16;
    end;

    {    ---------------------------------------------------------------------------    }
    {    FORMATS FOR TABLE: 'kern'  }
    {    CONSTANTS  }

const
    kKERNTag                    = $6B65726E;                    {  'kern'  }
    kKERNCurrentVersion         = $00010000;
    kKERNVertical               = $8000;                        {  set if this table has vertical kerning information  }
    kKERNResetCrossStream       = $8000;                        {  this value in a cross-stream table means reset to zero  }
    kKERNCrossStream            = $4000;                        {  set if this table contains cross-stream kerning values  }
    kKERNVariation              = $2000;                        {  set if this table contains variation kerning values  }
    kKERNUnusedBits             = $1F00;                        {  UNUSED, MUST BE ZERO  }
    kKERNFormatMask             = $00FF;                        {  format of this subtable  }

    kKERNOrderedList            = 0;                            {  ordered list of kerning pairs  }
    kKERNStateTable             = 1;                            {  state table for n-way contextual kerning  }
    kKERNSimpleArray            = 2;                            {  simple n X m array of kerning values  }
    kKERNIndexArray             = 3;                            {  modifed version of SimpleArray  }

    {    Message Type Flags     }
    kKERNLineStart              = $00000001;                    {  Array of glyphs starts a line  }
    kKERNLineEndKerning         = $00000002;                    {  Array of glyphs ends a line  }
    kKERNNoCrossKerning         = $00000004;                    {  Prohibit cross kerning  }
    kKERNNotesRequested         = $00000008;                    {  Caller wants kerning notes  }
    kKERNNoStakeNote            = 1;                            {  Indicates a glyph was involved in a kerning pair/group  }
    kKERNCrossStreamResetNote   = 2;                            {  Indicates a return-to-baseline in cross-stream kerning  }
    kKERNNotApplied             = $00000001;                    {  All kerning values were zero, kerning call had no effect  }

    {    TYPES  }

type
    KernTableFormat                     = UInt8;
    KernSubtableInfo                    = UInt16;
    KernKerningValue                    = SInt16;
    KernArrayOffset                     = UInt16;
    {    header for version 0 kerning table     }
    KernVersion0HeaderPtr = ^KernVersion0Header;
    KernVersion0Header = record
        version:                UInt16;                                 {  font version number (will be 0!)  }
        nTables:                UInt16;                                 {  number of subtables present  }
        firstSubtable:          array [0..0] of UInt16;                 {  first subtable starts here  }
    end;

    {    Header for a kerning table     }
    KernTableHeaderPtr = ^KernTableHeader;
    KernTableHeader = record
        version:                Fixed;                                  {  font version number (currently 1.0)  }
        nTables:                SInt32;                                 {  number of subtables present  }
        firstSubtable:          array [0..0] of UInt16;                 {  first subtable starts here  }
    end;

    KernTableHeaderHandle               = ^KernTableHeaderPtr;
    {
        F O R M A T   S P E C I F I C   D E F I N I T I O N S

        kernOrderedList:

        The table is a sorted list of [left glyph, right glyph, value] triples.
        There's enough information in the header so that the list can be
        efficiently binary searched.
        }
    {    defines a single kerning pair of Glyphcodes    }
    KernKerningPairPtr = ^KernKerningPair;
    KernKerningPair = record
        left:                   UInt16;
        right:                  UInt16;
    end;

    {    a single list entry    }
    KernOrderedListEntryPtr = ^KernOrderedListEntry;
    KernOrderedListEntry = record
        pair:                   KernKerningPair;                        {  the kerning pair  }
        value:                  KernKerningValue;                       {  the kerning value for the above pair  }
    end;

    {    the header information for binary searching the list   }
    KernOrderedListHeaderPtr = ^KernOrderedListHeader;
    KernOrderedListHeader = record
        nPairs:                 UInt16;                                 {  number of kerning pairs in table  }
        searchRange:            UInt16;                                 {  (largest power of two <= nPairs) * entry size  }
        entrySelector:          UInt16;                                 {  log2 (largest power of two <= nPairs)  }
        rangeShift:             UInt16;                                 {  (nPairs - largest power of two <= nPairs) * entry size  }
        table:                  array [0..0] of UInt16;                 {  entries are first glyph, second glyph, and value  }
    end;

    {    KernStateTable: like the the generic state tables  }
    KernStateHeaderPtr = ^KernStateHeader;
    KernStateHeader = record
        header:                 STHeader;                               {  state table header  }
        valueTable:             UInt16;                                 {  offset to kerning value table  }
        firstTable:             SInt8;                                  {  first table starts here  }
    end;

    KernStateEntryPtr = ^KernStateEntry;
    KernStateEntry = record
        newState:               UInt16;
        flags:                  UInt16;                                 {  flags per above enum  }
    end;

    {
        Kern offset table header.
        The offset table is a trimmed array from firstGlyph to limitGlyph.
        Glyphs outside of this range should get zero for right-hand glyphs
        and the offset of the beginning of the kerning array for left-hand glyphs.
        }
    KernOffsetTablePtr = ^KernOffsetTable;
    KernOffsetTable = record
        firstGlyph:             UInt16;                                 {  first glyph in class range  }
        nGlyphs:                UInt16;                                 {  number of glyphs in class range  }
        offsetTable:            array [0..0] of KernArrayOffset;        {  offset table starts here  }
    end;

    {    Header information for accessing offset tables and kerning array   }
    {
        KernSimpleArray:

        The array is an nXm array of kenring values. Each row in the array
        represents one left-hand glyph, and each column one right-hand glyph.
        The zeroth row and column always represent glyphs that are out of bounds
        and will always contain zero.

        A pair is looked up by indexing the left-hand glyph through the left
        offset table, the right-hand glyph through the right offset table,
        adding both offsets to the starting address of the kerning array,
        and fetching the kerning value pointed to.
        }
    {    Kern offset table header.  }
    {    The offset table is a trimmed array from firstGlyph to limitGlyph.     }
    {    Glyphs outside of this range should get zero for right-hand glyphs     }
    {    and the offset of the beginning of the kerning array for left-     }
    {    hand glyphs.   }
    KernSimpleArrayHeaderPtr = ^KernSimpleArrayHeader;
    KernSimpleArrayHeader = record
        rowWidth:               UInt16;                                 {  width, in bytes, of a row in the table  }
        leftOffsetTable:        UInt16;                                 {  offset to left-hand offset table  }
        rightOffsetTable:       UInt16;                                 {  offset to right-hand offset table  }
        theArray:               KernArrayOffset;                        {  offset to start of kerning array  }
        firstTable:             array [0..0] of UInt16;                 {  first offset table starts here...  }
    end;

    {    Index Array    }
    KernIndexArrayHeaderPtr = ^KernIndexArrayHeader;
    KernIndexArrayHeader = record
        glyphCount:             UInt16;
        kernValueCount:         SInt8;
        leftClassCount:         SInt8;
        rightClassCount:        SInt8;
        flags:                  SInt8;                                  {  set to 0 for now  }
        kernValue:              array [0..0] of SInt16;                 {  actual kerning values reference by index in kernIndex  }
        leftClass:              SInt8;                                  {  maps left glyph to offset into kern index  }
        rightClass:             SInt8;                                  {  maps right glyph to offset into kern index  }
        kernIndex:              SInt8;                                  {  contains indicies into kernValue  }
    end;

    {    format specific part of subtable header    }
    KernFormatSpecificHeaderPtr = ^KernFormatSpecificHeader;
    KernFormatSpecificHeader = record
        case SInt16 of
        0: (
            orderedList:        KernOrderedListHeader;
            );
        1: (
            stateTable:         KernStateHeader;
            );
        2: (
            simpleArray:        KernSimpleArrayHeader;
            );
        3: (
            indexArray:         KernIndexArrayHeader;
            );
    end;

    {    version 0 subtable header  }
    KernVersion0SubtableHeaderPtr = ^KernVersion0SubtableHeader;
    KernVersion0SubtableHeader = record
        version:                UInt16;                                 {  kerning table version number  }
        length:                 UInt16;                                 {  length in bytes (including this header)  }
        stInfo:                 KernSubtableInfo;                       {  sub-table info  }
        fsHeader:               KernFormatSpecificHeader;               {  format specific sub-header  }
    end;

    {    Overall Subtable header format     }
    KernSubtableHeaderPtr = ^KernSubtableHeader;
    KernSubtableHeader = record
        length:                 SInt32;                                 {  length in bytes (including this header)  }
        stInfo:                 KernSubtableInfo;                       {  subtable info  }
        tupleIndex:             SInt16;                                 {  tuple index for variation subtables  }
        fsHeader:               KernFormatSpecificHeader;               {  format specific sub-header  }
    end;

    {    ---------------------------------------------------------------------------    }
    {    FORMATS FOR TABLE: 'bsln'  }
    {    CONSTANTS  }

const
    kBSLNTag                    = $62736C6E;                    {  'bsln'  }
    kBSLNCurrentVersion         = $00010000;                    {  current version number for 'bsln' table  }
    kBSLNDistanceFormatNoMap    = 0;
    kBSLNDistanceFormatWithMap  = 1;
    kBSLNControlPointFormatNoMap = 2;
    kBSLNControlPointFormatWithMap = 3;

    {    Baseline classes and constants     }
    kBSLNRomanBaseline          = 0;
    kBSLNIdeographicCenterBaseline = 1;
    kBSLNIdeographicLowBaseline = 2;
    kBSLNHangingBaseline        = 3;
    kBSLNMathBaseline           = 4;
    kBSLNLastBaseline           = 31;
    kBSLNNumBaselineClasses     = 32;
    kBSLNNoBaselineOverride     = 255;

    {    TYPES  }

type
    BslnBaselineClass                   = UInt32;
    {    The BslnBaselineRecord array defines the baseline deltas for the line.     }
    BslnBaselineRecord                  = array [0..31] of Fixed;
    {
        BslnFormat0Part is the format-specific data for a distance table with no mapping (i.e.
        all the glyphs belong to the defaultBaseline).
        }
    BslnFormat0PartPtr = ^BslnFormat0Part;
    BslnFormat0Part = record
        deltas:                 array [0..31] of SInt16;
    end;

    {    BslnFormat1Part is the format-specific data for a distance table with a gxMapping.     }
    BslnFormat1PartPtr = ^BslnFormat1Part;
    BslnFormat1Part = record
        deltas:                 array [0..31] of SInt16;
        mappingData:            SFNTLookupTable;
    end;

    {
        BslnFormat2Part is the format-specific data for a control-point table with no
        mapping (i.e. all the glyphs belong to the defaultBaseline). It specifies a single
        glyph to use and the set of control points in that glyph that designate each of
        the baselines.
        }
    BslnFormat2PartPtr = ^BslnFormat2Part;
    BslnFormat2Part = record
        stdGlyph:               UInt16;
        ctlPoints:              array [0..31] of SInt16;
    end;

    {
        BslnFormat3Part is the format-specific data for a distance table with a mapping. Like
        format 2, it contains a single glyph and its set of control-point values for each
        of the baselines.
        }
    BslnFormat3PartPtr = ^BslnFormat3Part;
    BslnFormat3Part = record
        stdGlyph:               UInt16;
        ctlPoints:              array [0..31] of SInt16;
        mappingData:            SFNTLookupTable;
    end;

    {    The BslnFormatUnion is a union containing the format-specific parts of the baseline table.     }
    BslnFormatUnionPtr = ^BslnFormatUnion;
    BslnFormatUnion = record
        case SInt16 of
        0: (
            fmt0Part:           BslnFormat0Part;
            );
        1: (
            fmt1Part:           BslnFormat1Part;
            );
        2: (
            fmt2Part:           BslnFormat2Part;
            );
        3: (
            fmt3Part:           BslnFormat3Part;
            );
    end;

    {    The table format used in BaselineTable     }
    BslnTableFormat                     = UInt16;
    {    BaselineTable defines the top-level format of the baseline table in the font.  }
    BslnTablePtr = ^BslnTable;
    BslnTable = record
        version:                Fixed;
        format:                 BslnTableFormat;
        defaultBaseline:        UInt16;
        parts:                  BslnFormatUnion;
    end;

    {    ---------------------------------------------------------------------------    }
{$ALIGN MAC68K}
{#POP}
{unit SFNTTypes}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}


type
    sfntDirectoryEntryPtr = ^sfntDirectoryEntry;
    sfntDirectoryEntry = record
        tableTag:               FourCharCode;
        checkSum:               UInt32;
        offset:                 UInt32;
        length:                 UInt32;
    end;

    {    The search fields limits numOffsets to 4096.   }
    sfntDirectoryPtr = ^sfntDirectory;
    sfntDirectory = record
        format:                 FourCharCode;
        numOffsets:             UInt16;                                 {  number of tables  }
        searchRange:            UInt16;                                 {  (max2 <= numOffsets)*16  }
        entrySelector:          UInt16;                                 {  log2(max2 <= numOffsets)  }
        rangeShift:             UInt16;                                 {  numOffsets*16-searchRange }
        table:                  array [0..0] of sfntDirectoryEntry;     {  table[numOffsets]  }
    end;


const
    sizeof_sfntDirectory        = 12;

    {    Cmap - character id to glyph id mapping    }
    cmapFontTableTag            = $636D6170 (* 'cmap' *);

    kFontUnicodePlatform        = 0;
    kFontMacintoshPlatform      = 1;
    kFontReservedPlatform       = 2;
    kFontMicrosoftPlatform      = 3;
    kFontCustomPlatform         = 4;

    kFontUnicodeDefaultSemantics = 0;
    kFontUnicodeV1_1Semantics   = 1;
    kFontISO10646_1993Semantics = 2;

    kFontRomanScript            = 0;
    kFontJapaneseScript         = 1;
    kFontTraditionalChineseScript = 2;
    kFontChineseScript          = 2;
    kFontKoreanScript           = 3;
    kFontArabicScript           = 4;
    kFontHebrewScript           = 5;
    kFontGreekScript            = 6;
    kFontCyrillicScript         = 7;
    kFontRussian                = 7;
    kFontRSymbolScript          = 8;
    kFontDevanagariScript       = 9;
    kFontGurmukhiScript         = 10;
    kFontGujaratiScript         = 11;
    kFontOriyaScript            = 12;
    kFontBengaliScript          = 13;
    kFontTamilScript            = 14;
    kFontTeluguScript           = 15;
    kFontKannadaScript          = 16;
    kFontMalayalamScript        = 17;
    kFontSinhaleseScript        = 18;
    kFontBurmeseScript          = 19;
    kFontKhmerScript            = 20;
    kFontThaiScript             = 21;
    kFontLaotianScript          = 22;
    kFontGeorgianScript         = 23;
    kFontArmenianScript         = 24;
    kFontSimpleChineseScript    = 25;
    kFontTibetanScript          = 26;
    kFontMongolianScript        = 27;
    kFontGeezScript             = 28;
    kFontEthiopicScript         = 28;
    kFontAmharicScript          = 28;
    kFontSlavicScript           = 29;
    kFontEastEuropeanRomanScript = 29;
    kFontVietnameseScript       = 30;
    kFontExtendedArabicScript   = 31;
    kFontSindhiScript           = 31;
    kFontUninterpretedScript    = 32;

    kFontMicrosoftSymbolScript  = 0;
    kFontMicrosoftStandardScript = 1;
    kFontMicrosoftUCS4Script    = 10;


    kFontCustom8BitScript       = 0;
    kFontCustom816BitScript     = 1;
    kFontCustom16BitScript      = 2;

    {    Language codes are zero based everywhere but within a 'cmap' table     }
    kFontEnglishLanguage        = 0;
    kFontFrenchLanguage         = 1;
    kFontGermanLanguage         = 2;
    kFontItalianLanguage        = 3;
    kFontDutchLanguage          = 4;
    kFontSwedishLanguage        = 5;
    kFontSpanishLanguage        = 6;
    kFontDanishLanguage         = 7;
    kFontPortugueseLanguage     = 8;
    kFontNorwegianLanguage      = 9;
    kFontHebrewLanguage         = 10;
    kFontJapaneseLanguage       = 11;
    kFontArabicLanguage         = 12;
    kFontFinnishLanguage        = 13;
    kFontGreekLanguage          = 14;
    kFontIcelandicLanguage      = 15;
    kFontMalteseLanguage        = 16;
    kFontTurkishLanguage        = 17;
    kFontCroatianLanguage       = 18;
    kFontTradChineseLanguage    = 19;
    kFontUrduLanguage           = 20;
    kFontHindiLanguage          = 21;
    kFontThaiLanguage           = 22;
    kFontKoreanLanguage         = 23;
    kFontLithuanianLanguage     = 24;
    kFontPolishLanguage         = 25;
    kFontHungarianLanguage      = 26;
    kFontEstonianLanguage       = 27;
    kFontLettishLanguage        = 28;
    kFontLatvianLanguage        = 28;
    kFontSaamiskLanguage        = 29;
    kFontLappishLanguage        = 29;
    kFontFaeroeseLanguage       = 30;
    kFontFarsiLanguage          = 31;
    kFontPersianLanguage        = 31;
    kFontRussianLanguage        = 32;
    kFontSimpChineseLanguage    = 33;
    kFontFlemishLanguage        = 34;
    kFontIrishLanguage          = 35;
    kFontAlbanianLanguage       = 36;
    kFontRomanianLanguage       = 37;
    kFontCzechLanguage          = 38;
    kFontSlovakLanguage         = 39;
    kFontSlovenianLanguage      = 40;
    kFontYiddishLanguage        = 41;
    kFontSerbianLanguage        = 42;
    kFontMacedonianLanguage     = 43;
    kFontBulgarianLanguage      = 44;
    kFontUkrainianLanguage      = 45;
    kFontByelorussianLanguage   = 46;
    kFontUzbekLanguage          = 47;
    kFontKazakhLanguage         = 48;
    kFontAzerbaijaniLanguage    = 49;
    kFontAzerbaijanArLanguage   = 50;
    kFontArmenianLanguage       = 51;
    kFontGeorgianLanguage       = 52;
    kFontMoldavianLanguage      = 53;
    kFontKirghizLanguage        = 54;
    kFontTajikiLanguage         = 55;
    kFontTurkmenLanguage        = 56;
    kFontMongolianLanguage      = 57;
    kFontMongolianCyrLanguage   = 58;
    kFontPashtoLanguage         = 59;
    kFontKurdishLanguage        = 60;
    kFontKashmiriLanguage       = 61;
    kFontSindhiLanguage         = 62;
    kFontTibetanLanguage        = 63;
    kFontNepaliLanguage         = 64;
    kFontSanskritLanguage       = 65;
    kFontMarathiLanguage        = 66;
    kFontBengaliLanguage        = 67;
    kFontAssameseLanguage       = 68;
    kFontGujaratiLanguage       = 69;
    kFontPunjabiLanguage        = 70;
    kFontOriyaLanguage          = 71;
    kFontMalayalamLanguage      = 72;
    kFontKannadaLanguage        = 73;
    kFontTamilLanguage          = 74;
    kFontTeluguLanguage         = 75;
    kFontSinhaleseLanguage      = 76;
    kFontBurmeseLanguage        = 77;
    kFontKhmerLanguage          = 78;
    kFontLaoLanguage            = 79;
    kFontVietnameseLanguage     = 80;
    kFontIndonesianLanguage     = 81;
    kFontTagalogLanguage        = 82;
    kFontMalayRomanLanguage     = 83;
    kFontMalayArabicLanguage    = 84;
    kFontAmharicLanguage        = 85;
    kFontTigrinyaLanguage       = 86;
    kFontGallaLanguage          = 87;
    kFontOromoLanguage          = 87;
    kFontSomaliLanguage         = 88;
    kFontSwahiliLanguage        = 89;
    kFontRuandaLanguage         = 90;
    kFontRundiLanguage          = 91;
    kFontChewaLanguage          = 92;
    kFontMalagasyLanguage       = 93;
    kFontEsperantoLanguage      = 94;
    kFontWelshLanguage          = 128;
    kFontBasqueLanguage         = 129;
    kFontCatalanLanguage        = 130;
    kFontLatinLanguage          = 131;
    kFontQuechuaLanguage        = 132;
    kFontGuaraniLanguage        = 133;
    kFontAymaraLanguage         = 134;
    kFontTatarLanguage          = 135;
    kFontUighurLanguage         = 136;
    kFontDzongkhaLanguage       = 137;
    kFontJavaneseRomLanguage    = 138;
    kFontSundaneseRomLanguage   = 139;

    {    The following are special "don't care" values to be used in interfaces     }
    kFontNoPlatform             = $FFFFFFFF;
    kFontNoScript               = $FFFFFFFF;
    kFontNoLanguage             = $FFFFFFFF;


type
    sfntCMapSubHeaderPtr = ^sfntCMapSubHeader;
    sfntCMapSubHeader = record
        format:                 UInt16;
        length:                 UInt16;
        languageID:             UInt16;                                 {  base-1  }
    end;


const
    sizeof_sfntCMapSubHeader    = 6;


type
    sfntCMapEncodingPtr = ^sfntCMapEncoding;
    sfntCMapEncoding = record
        platformID:             UInt16;                                 {  base-0  }
        scriptID:               UInt16;                                 {  base-0  }
        offset:                 UInt32;
    end;


const
    sizeof_sfntCMapEncoding     = 8;


type
    sfntCMapHeaderPtr = ^sfntCMapHeader;
    sfntCMapHeader = record
        version:                UInt16;
        numTables:              UInt16;
        encoding:               array [0..0] of sfntCMapEncoding;
    end;


const
    sizeof_sfntCMapHeader       = 4;

    {    Name table     }
    nameFontTableTag            = $6E616D65 (* 'name' *);

    kFontCopyrightName          = 0;
    kFontFamilyName             = 1;
    kFontStyleName              = 2;
    kFontUniqueName             = 3;
    kFontFullName               = 4;
    kFontVersionName            = 5;
    kFontPostscriptName         = 6;
    kFontTrademarkName          = 7;
    kFontManufacturerName       = 8;
    kFontDesignerName           = 9;
    kFontDescriptionName        = 10;
    kFontVendorURLName          = 11;
    kFontDesignerURLName        = 12;
    kFontLicenseDescriptionName = 13;
    kFontLicenseInfoURLName     = 14;
    kFontLastReservedName       = 255;

    {    The following is a special "don't care" value to be used in interfaces     }
    kFontNoName                 = $FFFFFFFF;


type
    sfntNameRecordPtr = ^sfntNameRecord;
    sfntNameRecord = record
        platformID:             UInt16;                                 {  base-0  }
        scriptID:               UInt16;                                 {  base-0  }
        languageID:             UInt16;                                 {  base-0  }
        nameID:                 UInt16;                                 {  base-0  }
        length:                 UInt16;
        offset:                 UInt16;
    end;


const
    sizeof_sfntNameRecord       = 12;


type
    sfntNameHeaderPtr = ^sfntNameHeader;
    sfntNameHeader = record
        format:                 UInt16;
        count:                  UInt16;
        stringOffset:           UInt16;
        rec:                    array [0..0] of sfntNameRecord;
    end;


const
    sizeof_sfntNameHeader       = 6;

    {    Fvar table - font variations   }
    variationFontTableTag       = $66766172 (* 'fvar' *);

    {    These define each font variation   }

type
    sfntVariationAxisPtr = ^sfntVariationAxis;
    sfntVariationAxis = record
        axisTag:                FourCharCode;
        minValue:               Fixed;
        defaultValue:           Fixed;
        maxValue:               Fixed;
        flags:                  SInt16;
        nameID:                 SInt16;
    end;


const
    sizeof_sfntVariationAxis    = 20;

    {    These are named locations in style-space for the user  }

type
    sfntInstancePtr = ^sfntInstance;
    sfntInstance = record
        nameID:                 SInt16;
        flags:                  SInt16;
        coord:                  array [0..0] of Fixed;                  {  [axisCount]  }
                                                                        {  room to grow since the header carries a tupleSize field  }
    end;


const
    sizeof_sfntInstance         = 4;


type
    sfntVariationHeaderPtr = ^sfntVariationHeader;
    sfntVariationHeader = record
        version:                Fixed;                                  {  1.0 Fixed  }
        offsetToData:           UInt16;                                 {  to first axis = 16 }
        countSizePairs:         UInt16;                                 {  axis+inst = 2  }
        axisCount:              UInt16;
        axisSize:               UInt16;
        instanceCount:          UInt16;
        instanceSize:           UInt16;
                                                                        {  Éother <count,size> pairs  }
        axis:                   array [0..0] of sfntVariationAxis;      {  [axisCount]  }
        instance:               array [0..0] of sfntInstance;           {  [instanceCount]  Éother arrays of data  }
    end;


const
    sizeof_sfntVariationHeader  = 16;

    {    Fdsc table - font descriptor   }
    descriptorFontTableTag      = $66647363 (* 'fdsc' *);


type
    sfntFontDescriptorPtr = ^sfntFontDescriptor;
    sfntFontDescriptor = record
        name:                   FourCharCode;
        value:                  Fixed;
    end;

    sfntDescriptorHeaderPtr = ^sfntDescriptorHeader;
    sfntDescriptorHeader = record
        version:                Fixed;                                  {  1.0 in Fixed  }
        descriptorCount:        SInt32;
        descriptor:             array [0..0] of sfntFontDescriptor;
    end;


const
    sizeof_sfntDescriptorHeader = 8;

    {    Feat Table - layout feature table  }
    featureFontTableTag         = $66656174 (* 'feat' *);


type
    sfntFeatureNamePtr = ^sfntFeatureName;
    sfntFeatureName = record
        featureType:            UInt16;
        settingCount:           UInt16;
        offsetToSettings:       SInt32;
        featureFlags:           UInt16;
        nameID:                 UInt16;
    end;

    sfntFontFeatureSettingPtr = ^sfntFontFeatureSetting;
    sfntFontFeatureSetting = record
        setting:                UInt16;
        nameID:                 UInt16;
    end;

    sfntFontRunFeaturePtr = ^sfntFontRunFeature;
    sfntFontRunFeature = record
        featureType:            UInt16;
        setting:                UInt16;
    end;

    sfntFeatureHeaderPtr = ^sfntFeatureHeader;
    sfntFeatureHeader = record
        version:                SInt32;                                 {  1.0  }
        featureNameCount:       UInt16;
        featureSetCount:        UInt16;
        reserved:               SInt32;                                 {  set to 0  }
        names:                  array [0..0] of sfntFeatureName;
        settings:               array [0..0] of sfntFontFeatureSetting;
        runs:                   array [0..0] of sfntFontRunFeature;
    end;

    {    OS/2 Table     }

const
    os2FontTableTag             = $4F532F32 (* 'OS/2' *);

    {     Special invalid glyph ID value, useful as a sentinel value, for example   }
    nonGlyphID                  = 65535;

    {     Data type used to access names from font name table   }

type
    FontNameCode                        = UInt32;
    FontNameCodePtr                     = ^FontNameCode; { when a VAR xx: FontNameCode parameter can be nil, it is changed to xx: FontNameCodePtr }
    {    Data types for encoding components as used in interfaces   }
    FontPlatformCode                    = UInt32;
    FontPlatformCodePtr                 = ^FontPlatformCode; { when a VAR xx: FontPlatformCode parameter can be nil, it is changed to xx: FontPlatformCodePtr }
    FontScriptCode                      = UInt32;
    FontScriptCodePtr                   = ^FontScriptCode; { when a VAR xx: FontScriptCode parameter can be nil, it is changed to xx: FontScriptCodePtr }
    FontLanguageCode                    = UInt32;
    FontLanguageCodePtr                 = ^FontLanguageCode; { when a VAR xx: FontLanguageCode parameter can be nil, it is changed to xx: FontLanguageCodePtr }
    {
    **  FontVariation is used to specify a coordinate along a variation axis. The name
    **  identifies the axes to be applied, and value is the setting to be used.
        }
    FontVariationPtr = ^FontVariation;
    FontVariation = record
        name:                   FourCharCode;
        value:                  Fixed;
    end;

{$ALIGN MAC68K}
{#POP}
{unit fenv}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}

{
    A collection of functions designed to provide access to the floating
    point environment for numerical programming. It is modeled after
    the floating-point requirements in C9X.

    The file <fenv.h> declares many functions in support of numerical
    programming.  It provides a set of environmental controls similar to
    the ones found in <SANE.h>.  Programs that test flags or run under
    non-default modes must do so under the effect of an enabling
    "fenv_access" pragma.
}

{*******************************************************************************
*                                                                               *
*    fenv_t         is a type for representing the entire floating-point        *
*                   environment in a single object.                             *
*                                                                               *
*    fexcept_t      is a type for representing the floating-point               *
*                   exception flag state collectively.                          *
*                                                                               *
*******************************************************************************}

type
    fenv_t                              = SInt32;
    fexcept_t                           = SInt32;
    {       Definitions of floating-point exception macros                              }

const
    FE_INEXACT                  = $02000000;
    FE_DIVBYZERO                = $04000000;
    FE_UNDERFLOW                = $08000000;
    FE_OVERFLOW                 = $10000000;
    FE_INVALID                  = $20000000;
    FE_ALL_EXCEPT               = $3E000000;                    {  FE_INEXACT | FE_DIVBYZERO | FE_UNDERFLOW | FE_OVERFLOW | FE_INVALID }


    {       Definitions of rounding direction macros                                    }
    FE_TONEAREST                = $00000000;
    FE_TOWARDZERO               = $00000001;
    FE_UPWARD                   = $00000002;
    FE_DOWNWARD                 = $00000003;

{ default environment object        }
var
 _FE_DFL_ENV: fenv_t; external name '__FE_DFL_ENV';               { default environment object        }
{******************************************************************************
*     The following functions provide access to the exception flags.  The      *
*     "int" input argument can be constructed by bitwise ORs of the exception  *
*     macros: for example: FE_OVERFLOW | FE_INEXACT.                           *
******************************************************************************}
{******************************************************************************
*     The function "feclearexcept" clears the supported exceptions represented *
*     by its argument.                                                         *
******************************************************************************}
{
 *  feclearexcept()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure feclearexcept(excepts: SInt32); external name '_feclearexcept';



{******************************************************************************
*    The function "fegetexcept" stores a representation of the exception       *
*     flags indicated by the argument "excepts" through the pointer argument   *
*     "flagp".                                                                 *
******************************************************************************}
{
 *  fegetexcept()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure fegetexcept(var flagp: fexcept_t; excepts: SInt32); external name '_fegetexcept';



{******************************************************************************
*     The function "feraiseexcept" raises the supported exceptions             *
*     represented by its argument.                                             *
******************************************************************************}
{
 *  feraiseexcept()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure feraiseexcept(excepts: SInt32); external name '_feraiseexcept';



{******************************************************************************
*     The function "fesetexcept" sets or clears the exception flags indicated  *
*     by the int argument "excepts" according to the representation in the     *
*     object pointed to by the pointer argument "flagp".  The value of         *
*     "*flagp" must have been set by a previous call to "fegetexcept".         *
*     This function does not raise exceptions; it just sets the state of       *
*     the flags.                                                               *
******************************************************************************}
{
 *  fesetexcept()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure fesetexcept((*const*) var flagp: fexcept_t; excepts: SInt32); external name '_fesetexcept';



{******************************************************************************
*     The function "fetestexcept" determines which of the specified subset of  *
*     the exception flags are currently set.  The argument "excepts" specifies *
*     the exception flags to be queried as a bitwise OR of the exception       *
*     macros.  This function returns the bitwise OR of the exception macros    *
*     corresponding to the currently set exceptions included in "excepts".     *
******************************************************************************}
{
 *  fetestexcept()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function fetestexcept(excepts: SInt32): SInt32; external name '_fetestexcept';



{******************************************************************************
*     The following functions provide control of rounding direction modes.     *
******************************************************************************}
{******************************************************************************
*     The function "fegetround" returns the value of the rounding direction    *
*     macro which represents the current rounding direction.                   *
******************************************************************************}
{
 *  fegetround()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function fegetround: SInt32; external name '_fegetround';



{******************************************************************************
*     The function "fesetround" establishes the rounding direction represented *
*     by its argument.  It returns nonzero if and only if the argument matches *
*     a rounding direction macro.  If not, the rounding direction is not       *
*     changed.                                                                 *
******************************************************************************}
{
 *  fesetround()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function fesetround(round: SInt32): SInt32; external name '_fesetround';



{******************************************************************************
*    The following functions manage the floating-point environment, exception  *
*    flags and dynamic modes, as one entity.                                   *
******************************************************************************}
{******************************************************************************
*     The function "fegetenv" stores the current floating-point environment    *
*     in the object pointed to by its pointer argument "envp".                 *
******************************************************************************}
{
 *  fegetenv()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure fegetenv(var envp: fenv_t); external name '_fegetenv';



{******************************************************************************
*     The function "feholdexcept" saves the current environment in the object  *
*     pointed to by its pointer argument "envp", clears the exception flags,   *
*     and clears floating-point exception enables.  This function supersedes   *
*     the SANE function "procentry", but it does not change the current        *
*     rounding direction mode.                                                 *
******************************************************************************}
{
 *  feholdexcept()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function feholdexcept(var envp: fenv_t): SInt32; external name '_feholdexcept';



{******************************************************************************
*     The function "fesetenv" installs the floating-point environment          *
*     environment represented by the object pointed to by its argument         *
*     "envp".  The value of "*envp" must be set by a call to "fegetenv" or     *
*     "feholdexcept", by an implementation-defined macro of type "fenv_t",     *
*     or by the use of the pointer macro FE_DFL_ENV as the argument.           *
******************************************************************************}
{
 *  fesetenv()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure fesetenv((*const*) var envp: fenv_t); external name '_fesetenv';



{******************************************************************************
*     The function "feupdateenv" saves the current exceptions into its         *
*     automatic storage, installs the environment represented through its      *
*     pointer argument "envp", and then re-raises the saved exceptions.        *
*     This function, which supersedes the SANE function "procexit", can be     *
*     used in conjunction with "feholdexcept" to write routines which hide     *
*     spurious exceptions from their callers.                                  *
******************************************************************************}
{
 *  feupdateenv()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure feupdateenv((*const*) var envp: fenv_t); external name '_feupdateenv';





{$ALIGN MAC68K}
{#POP}
{unit fp}
{$ALIGN MAC68K}








{*******************************************************************************
*                                                                               *
*    A collection of numerical functions designed to facilitate a wide          *
*    range of numerical programming as required by C9X.                         *
*                                                                               *
*    The <fp.h> declares many functions in support of numerical programming.    *
*    It provides a superset of <math.h> and <SANE.h> functions.  Some           *
*    functionality previously found in <SANE.h> and not in the FPCE <fp.h>      *
*    can be found in this <fp.h> under the heading "__NOEXTENSIONS__".          *
*                                                                               *
*    All of these functions are IEEE 754 aware and treat exceptions, NaNs,      *
*    positive and negative zero and infinity consistent with the floating-      *
*    point standard.                                                            *
*                                                                               *
*******************************************************************************}


{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}

{*******************************************************************************
*                                                                               *
*                            Efficient types                                    *
*                                                                               *
*    float_t         Most efficient type at least as wide as float              *
*    double_t        Most efficient type at least as wide as double             *
*                                                                               *
*      CPU            float_t(bits)                double_t(bits)               *
*    --------        -----------------            -----------------             *
*    PowerPC          float(32)                    double(64)                   *
*    68K              long double(80/96)           long double(80/96)           *
*    x86              double(64)                   double(64)                   *
*                                                                               *
*******************************************************************************}

type
    float_t                             = Single;
    double_t                            = Double;

{*******************************************************************************
*                                                                               *
*                              Define some constants.                           *
*                                                                               *
*    HUGE_VAL            IEEE 754 value of infinity.                            *
*    INFINITY            IEEE 754 value of infinity.                            *
*    NAN                 A generic NaN (Not A Number).                          *
*    DECIMAL_DIG         Satisfies the constraint that the conversion from      *
*                        double to decimal and back is the identity function.   *
*                                                                               *
*******************************************************************************}
const
    DECIMAL_DIG                         = 17;
{*******************************************************************************
*                                                                               *
*                            Trigonometric functions                            *
*                                                                               *
*   acos        result is in [0,pi].                                            *
*   asin        result is in [-pi/2,pi/2].                                      *
*   atan        result is in [-pi/2,pi/2].                                      *
*   atan2       Computes the arc tangent of y/x in [-pi,pi] using the sign of   *
*               both arguments to determine the quadrant of the computed value. *
*                                                                               *
*******************************************************************************}
{
 *  cos()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function cos(x: double_t): double_t; external name '_cos';

{
 *  sin()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function sin(x: double_t): double_t; external name '_sin';

{
 *  tan()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function tan(x: double_t): double_t; external name '_tan';

{
 *  acos()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function acos(x: double_t): double_t; external name '_acos';

{
 *  asin()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function asin(x: double_t): double_t; external name '_asin';

{
 *  atan()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function atan(x: double_t): double_t; external name '_atan';

{
 *  atan2()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function atan2(y: double_t; x: double_t): double_t; external name '_atan2';



{*******************************************************************************
*                                                                               *
*                              Hyperbolic functions                             *
*                                                                               *
*******************************************************************************}
{
 *  cosh()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function cosh(x: double_t): double_t; external name '_cosh';

{
 *  sinh()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function sinh(x: double_t): double_t; external name '_sinh';

{
 *  tanh()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function tanh(x: double_t): double_t; external name '_tanh';

{
 *  acosh()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function acosh(x: double_t): double_t; external name '_acosh';

{
 *  asinh()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function asinh(x: double_t): double_t; external name '_asinh';

{
 *  atanh()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function atanh(x: double_t): double_t; external name '_atanh';



{*******************************************************************************
*                                                                               *
*                              Exponential functions                            *
*                                                                               *
*   expm1       expm1(x) = exp(x) - 1.  But, for small enough arguments,        *
*               expm1(x) is expected to be more accurate than exp(x) - 1.       *
*   frexp       Breaks a floating-point number into a normalized fraction       *
*               and an integral power of 2.  It stores the SInt16 in the       *
*               object pointed by *exponent.                                    *
*   ldexp       Multiplies a floating-point number by an SInt16 power of 2.    *
*   log1p       log1p = log(1 + x). But, for small enough arguments,            *
*               log1p is expected to be more accurate than log(1 + x).          *
*   logb        Extracts the exponent of its argument, as a signed integral     *
*               value. A subnormal argument is treated as though it were first  *
*               normalized. Thus:                                               *
*                                  1   <=   x * 2^(-logb(x))   <   2            *
*   modf        Returns fractional part of x as function result and returns     *
*               integral part of x via iptr. Note C9X uses double not double_t. *
*   scalb       Computes x * 2^n efficently.  This is not normally done by      *
*               computing 2^n explicitly.                                       *
*                                                                               *
*******************************************************************************}
{
 *  exp()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function exp(x: double_t): double_t; external name '_exp';

{
 *  expm1()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function expm1(x: double_t): double_t; external name '_expm1';

{
 *  exp2()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function exp2(x: double_t): double_t; external name '_exp2';

{
 *  frexp()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function frexp(x: double_t; var exponent: SInt32): double_t; external name '_frexp';

{
 *  ldexp()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ldexp(x: double_t; n: SInt32): double_t; external name '_ldexp';

{
 *  log()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function log(x: double_t): double_t; external name '_log';

{
 *  log2()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function log2(x: double_t): double_t; external name '_log2';

{
 *  log1p()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function log1p(x: double_t): double_t; external name '_log1p';

{
 *  log10()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function log10(x: double_t): double_t; external name '_log10';

{
 *  logb()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function logb(x: double_t): double_t; external name '_logb';

{
 *  modf()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function modf(x: double_t; var iptr: double_t): double_t; external name '_modf';

{
 *  modff()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function modff(x: Single; var iptrf: Single): Single; external name '_modff';


{
    Note: For compatiblity scalb(x,n) has n of type
            int  on Mac OS X
            long on Mac OS
}

type
    _scalb_n_type                       = SInt32;
    {
     *  scalb()
     *
     *  Availability:
     *    Non-Carbon CFM:   in MathLib 1.0 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function scalb(x: double_t; n: _scalb_n_type): double_t; external name '_scalb';



{*******************************************************************************
*                                                                               *
*                     Power and absolute value functions                        *
*                                                                               *
*   hypot       Computes the square root of the sum of the squares of its       *
*               arguments, without undue overflow or underflow.                 *
*   pow         Returns x raised to the power of y.  Result is more accurate    *
*               than using exp(log(x)*y).                                       *
*                                                                               *
*******************************************************************************}
{
 *  fabs()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function fabs(x: double_t): double_t; external name '_fabs';

{
 *  hypot()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function hypot(x: double_t; y: double_t): double_t; external name '_hypot';

{
 *  pow()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function pow(x: double_t; y: double_t): double_t; external name '_pow';

{
 *  sqrt()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function sqrt(x: double_t): double_t; external name '_sqrt';



{*******************************************************************************
*                                                                               *
*                        Gamma and Error functions                              *
*                                                                               *
*   erf         The error function.                                             *
*   erfc        Complementary error function.                                   *
*   gamma       The gamma function.                                             *
*   lgamma      Computes the base-e logarithm of the absolute value of          *
*               gamma of its argument x, for x > 0.                             *
*                                                                               *
*******************************************************************************}
{
 *  erf()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function erf(x: double_t): double_t; external name '_erf';

{
 *  erfc()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function erfc(x: double_t): double_t; external name '_erfc';

{
 *  gamma()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function gamma(x: double_t): double_t; external name '_gamma';

{
 *  lgamma()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function lgamma(x: double_t): double_t; external name '_lgamma';



{*******************************************************************************
*                                                                               *
*                        Nearest SInt16 functions                              *
*                                                                               *
*   rint        Rounds its argument to an integral value in floating point      *
*               format, honoring the current rounding direction.                *
*                                                                               *
*   nearbyint   Differs from rint only in that it does not raise the inexact    *
*               exception. It is the nearbyint function recommended by the      *
*               IEEE floating-point standard 854.                               *
*                                                                               *
*   rinttol     Rounds its argument to the nearest long int using the current   *
*               rounding direction.  NOTE: if the rounded value is outside      *
*               the range of long int, then the result is undefined.            *
*                                                                               *
*   round       Rounds the argument to the nearest integral value in floating   *
*               point format similar to the Fortran "anint" function. That is:  *
*               add half to the magnitude and chop.                             *
*                                                                               *
*   roundtol    Similar to the Fortran function nint or to the Pascal round.    *
*               NOTE: if the rounded value is outside the range of long int,    *
*               then the result is undefined.                                   *
*                                                                               *
*   trunc       Computes the integral value, in floating format, nearest to     *
*               but no larger in magnitude than its argument.   NOTE: on 68K    *
*               compilers when using -elems881, trunc must return an int        *
*                                                                               *
*******************************************************************************}
{
 *  ceil()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ceil(x: double_t): double_t; external name '_ceil';

{
 *  floor()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function floor(x: double_t): double_t; external name '_floor';

{
 *  rint()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function rint(x: double_t): double_t; external name '_rint';

{
 *  nearbyint()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function nearbyint(x: double_t): double_t; external name '_nearbyint';

{
 *  rinttol()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function rinttol(x: double_t): SInt32; external name '_rinttol';

{
 *  round()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function roundd(x: double_t): double_t; external name '_round';

{
 *  roundtol()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function roundtol(round: double_t): SInt32; external name '_roundtol';

{
    Note: For compatiblity trunc(x) has a return type of
            int       for classic 68K with FPU enabled
            double_t  everywhere else
}

type
    _trunc_return_type                  = double_t;
    {
     *  trunc()
     *
     *  Availability:
     *    Non-Carbon CFM:   in MathLib 1.0 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function truncd(x: double_t): _trunc_return_type; external name '_trunc';




{*******************************************************************************
*                                                                               *
*                            Remainder functions                                *
*                                                                               *
*   remainder       IEEE 754 floating point standard for remainder.             *
*   remquo          SANE remainder.  It stores into 'quotient' the 7 low-order  *
*                   bits of the SInt16 quotient x/y, such that:                *
*                       -127 <= quotient <= 127.                                *
*                                                                               *
*******************************************************************************}
{
 *  fmod()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function fmod(x: double_t; y: double_t): double_t; external name '_fmod';

{
 *  remainder()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function remainder(x: double_t; y: double_t): double_t; external name '_remainder';

{
 *  remquo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function remquo(x: double_t; y: double_t; var quo: SInt32): double_t; external name '_remquo';



{*******************************************************************************
*                                                                               *
*                             Auxiliary functions                               *
*                                                                               *
*   copysign        Produces a value with the magnitude of its first argument   *
*                   and sign of its second argument.  NOTE: the order of the    *
*                   arguments matches the recommendation of the IEEE 754        *
*                   floating point standard,  which is opposite from the SANE   *
*                   copysign function.                                          *
*                                                                               *
*   nan             The call 'nan("n-char-sequence")' returns a quiet NaN       *
*                   with content indicated through tagp in the selected         *
*                   data type format.                                           *
*                                                                               *
*   nextafter       Computes the next representable value after 'x' in the      *
*                   direction of 'y'.  if x == y, then y is returned.           *
*                                                                               *
*******************************************************************************}
{
 *  copysign()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function copysign(x: double_t; y: double_t): double_t; external name '_copysign';

{
 *  nan()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function nan(tagp: ConstCStringPtr): Double; external name '_nan';

{
 *  nanf()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function nanf(tagp: ConstCStringPtr): Single; external name '_nanf';

{
 *  nextafterd()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function nextafterd(x: Double; y: Double): Double; external name '_nextafterd';

{
 *  nextafterf()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function nextafterf(x: Single; y: Single): Single; external name '_nextafterf';


{
 *  __fpclassifyd()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function __fpclassifyd(x: Double): SInt32; external name '___fpclassifyd';

{
 *  __fpclassifyf()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function __fpclassifyf(x: Single): SInt32; external name '___fpclassifyf';

{
 *  __isnormald()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function __isnormald(x: Double): SInt32; external name '___isnormald';

{
 *  __isnormalf()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function __isnormalf(x: Single): SInt32; external name '___isnormalf';

{
 *  __isfinited()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function __isfinited(x: Double): SInt32; external name '___isfinited';

{
 *  __isfinitef()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function __isfinitef(x: Single): SInt32; external name '___isfinitef';

{
 *  __isnand()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function __isnand(x: Double): SInt32; external name '___isnand';

{
 *  __isnanf()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function __isnanf(x: Single): SInt32; external name '___isnanf';

{
 *  __signbitd()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function __signbitd(x: Double): SInt32; external name '___signbitd';

{
 *  __signbitf()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function __signbitf(x: Single): SInt32; external name '___signbitf';

{
 *  __inf()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function __inf: double_t; external name '___inf';



{*******************************************************************************
*                                                                               *
*                              Inquiry macros                                   *
*                                                                               *
*   fpclassify      Returns one of the FP_Å values.                             *
*   isnormal        Non-zero if and only if the argument x is normalized.       *
*   isfinite        Non-zero if and only if the argument x is finite.           *
*   isnan           Non-zero if and only if the argument x is a NaN.            *
*   signbit         Non-zero if and only if the sign of the argument x is       *
*                   negative.  This includes, NaNs, infinities and zeros.       *
*                                                                               *
*******************************************************************************}

const
    FP_SNAN                     = 0;                            {       signaling NaN                          }
    FP_QNAN                     = 1;                            {       quiet NaN                              }
    FP_INFINITE                 = 2;                            {       + or - infinity                        }
    FP_ZERO                     = 3;                            {       + or - zero                            }
    FP_NORMAL                   = 4;                            {       all normal numbers                     }
    FP_SUBNORMAL                = 5;                            {       denormal numbers                       }





    {   *******************************************************************************
    *                                                                               *
    *                      Max, Min and Positive Difference                         *
    *                                                                               *
    *   fdim        Determines the 'positive difference' between its arguments:     *
    *               ( x - y, if x > y ), ( +0, if x <= y ).  If one argument is     *
    *               NaN, then fdim returns that NaN.  if both arguments are NaNs,   *
    *               then fdim returns the first argument.                           *
    *                                                                               *
    *   fmax        Returns the maximum of the two arguments.  Corresponds to the   *
    *               max function in FORTRAN.  NaN arguments are treated as missing  *
    *               data.  If one argument is NaN and the other is a number, then   *
    *               the number is returned.  If both are NaNs then the first        *
    *               argument is returned.                                           *
    *                                                                               *
    *   fmin        Returns the minimum of the two arguments.  Corresponds to the   *
    *               min function in FORTRAN.  NaN arguments are treated as missing  *
    *               data.  If one argument is NaN and the other is a number, then   *
    *               the number is returned.  If both are NaNs then the first        *
    *               argument is returned.                                           *
    *                                                                               *
    ******************************************************************************* }
    {
     *  fdim()
     *
     *  Availability:
     *    Non-Carbon CFM:   in MathLib 1.0 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function fdim(x: double_t; y: double_t): double_t; external name '_fdim';

{
 *  fmax()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function fmax(x: double_t; y: double_t): double_t; external name '_fmax';

{
 *  fmin()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function fmin(x: double_t; y: double_t): double_t; external name '_fmin';


{******************************************************************************
*                                Constants                                     *
******************************************************************************}

{*******************************************************************************
*                                                                               *
*                              Non NCEG extensions                              *
*                                                                               *
*******************************************************************************}
{*******************************************************************************
*                                                                               *
*                              Financial functions                              *
*                                                                               *
*   compound        Computes the compound interest factor "(1 + rate)^periods"  *
*                   more accurately than the straightforward computation with   *
*                   the Power function.  This is SANE's compound function.      *
*                                                                               *
*   annuity         Computes the present value factor for an annuity            *
*                   "(1 - (1 + rate)^(-periods)) /rate" more accurately than    *
*                   the straightforward computation with the Power function.    *
*                   This is SANE's annuity function.                            *
*                                                                               *
*******************************************************************************}
{
 *  compound()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function compound(rate: double_t; periods: double_t): double_t; external name '_compound';

{
 *  annuity()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function annuity(rate: double_t; periods: double_t): double_t; external name '_annuity';



{*******************************************************************************
*                                                                               *
*                              Random function                                  *
*                                                                               *
*   randomx         A pseudorandom number generator.  It uses the iteration:    *
*                               (7^5*x)mod(2^31-1)                              *
*                                                                               *
*******************************************************************************}
{
 *  randomx()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function randomx(var x: double_t): double_t; external name '_randomx';



{******************************************************************************
*                              Relational operator                             *
******************************************************************************}
{      relational operator      }

type
    relop                               = SInt16;

const
    GREATERTHAN                 = 0;
    LESSTHAN                    = 1;
    EQUALTO                     = 2;
    UNORDERED                   = 3;

    {
     *  relation()
     *
     *  Availability:
     *    Non-Carbon CFM:   in MathLib 1.0 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function relation(x: double_t; y: double_t): relop; external name '_relation';



{*******************************************************************************
*                                                                               *
*                         Binary to decimal conversions                         *
*                                                                               *
*   SIGDIGLEN   Significant decimal digits.                                     *
*                                                                               *
*   decimal     A record which provides an intermediate unpacked form for       *
*               programmers who wish to do their own parsing of numeric input   *
*               or formatting of numeric output.                                *
*                                                                               *
*   decform     Controls each conversion to a decimal string.  The style field  *
*               is either FLOATDECIMAL or FIXEDDECIMAL. If FLOATDECIMAL, the    *
*               value of the field digits is the number of significant digits.  *
*               If FIXEDDECIMAL value of the field digits is the number of      *
*               digits to the right of the decimal point.                       *
*                                                                               *
*   num2dec     Converts a double_t to a decimal record using a decform.        *
*   dec2num     Converts a decimal record d to a double_t value.                *
*   dec2str     Converts a decform and decimal to a string using a decform.     *
*   str2dec     Converts a string to a decimal struct.                          *
*   dec2d       Similar to dec2num except a double is returned (68k only).      *
*   dec2f       Similar to dec2num except a float is returned.                  *
*   dec2s       Similar to dec2num except a short is returned.                  *
*   dec2l       Similar to dec2num except a long is returned.                   *
*                                                                               *
*******************************************************************************}
const
    SIGDIGLEN                   = 36;
    DECSTROUTLEN                = 80;
type
    DecimalKind = (FLOATDECIMAL, FIXEDDECIMAL);


    decimal = record
        sgn:    0..1;           { sign 0 for +, 1 for -  }
        exp:    SInt16;
        sig:    Str36;
    end;

    decform = record
        style:  DecimalKind;
        digits: SInt16;
    end;

{
 *  num2dec()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure num2dec((*const*) var f: decform; x: double_t; var d: decimal); external name '_num2dec';

{
 *  dec2num()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function dec2num(const (*var*) d: decimal): double_t; external name '_dec2num';

{
 *  dec2str()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure dec2str((*const*) var f: decform; const (*var*) d: decimal; s: CStringPtr); external name '_dec2str';

{
 *  str2dec()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure str2dec(s: ConstCStringPtr; var ix: SInt16; var d: decimal; var vp: SInt16); external name '_str2dec';

{
 *  dec2f()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function dec2f(const (*var*) d: decimal): Single; external name '_dec2f';

{
 *  dec2s()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function dec2s(const (*var*) d: decimal): SInt16; external name '_dec2s';

{
 *  dec2l()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function dec2l(const (*var*) d: decimal): SInt32; external name '_dec2l';




{*******************************************************************************
*                                                                               *
*                         68k-only Transfer Function Prototypes                 *
*                                                                               *
*******************************************************************************}
{*******************************************************************************
*                                                                               *
*                         PowerPC-only Function Prototypes                      *
*                                                                               *
*******************************************************************************}


{
 *  cosl()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later or as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         not available
 }
function cosl(x: LongDouble): LongDouble; external name '_cosl';


{
 *  sinl()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later or as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         not available
 }
function sinl(x: LongDouble): LongDouble; external name '_sinl';


{
 *  tanl()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later or as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         not available
 }
function tanl(x: LongDouble): LongDouble; external name '_tanl';


{
 *  acosl()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later or as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         not available
 }
function acosl(x: LongDouble): LongDouble; external name '_acosl';


{
 *  asinl()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later or as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         not available
 }
function asinl(x: LongDouble): LongDouble; external name '_asinl';


{
 *  atanl()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later or as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         not available
 }
function atanl(x: LongDouble): LongDouble; external name '_atanl';


{
 *  atan2l()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later or as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         not available
 }
function atan2l(y: LongDouble; x: LongDouble): LongDouble; external name '_atan2l';


{
 *  coshl()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later or as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         not available
 }
function coshl(x: LongDouble): LongDouble; external name '_coshl';


{
 *  sinhl()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later or as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         not available
 }
function sinhl(x: LongDouble): LongDouble; external name '_sinhl';


{
 *  tanhl()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later or as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         not available
 }
function tanhl(x: LongDouble): LongDouble; external name '_tanhl';


{
 *  acoshl()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later or as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         not available
 }
function acoshl(x: LongDouble): LongDouble; external name '_acoshl';


{
 *  asinhl()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later or as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         not available
 }
function asinhl(x: LongDouble): LongDouble; external name '_asinhl';


{
 *  atanhl()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later or as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         not available
 }
function atanhl(x: LongDouble): LongDouble; external name '_atanhl';


{
 *  expl()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later or as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         not available
 }
function expl(x: LongDouble): LongDouble; external name '_expl';


{
 *  expm1l()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later or as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         not available
 }
function expm1l(x: LongDouble): LongDouble; external name '_expm1l';


{
 *  exp2l()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later or as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         not available
 }
function exp2l(x: LongDouble): LongDouble; external name '_exp2l';


{
 *  frexpl()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later or as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         not available
 }
function frexpl(x: LongDouble; var exponent: SInt32): LongDouble; external name '_frexpl';


{
 *  ldexpl()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later or as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         not available
 }
function ldexpl(x: LongDouble; n: SInt32): LongDouble; external name '_ldexpl';


{
 *  logl()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later or as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         not available
 }
function logl(x: LongDouble): LongDouble; external name '_logl';


{
 *  log1pl()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later or as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         not available
 }
function log1pl(x: LongDouble): LongDouble; external name '_log1pl';


{
 *  log10l()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later or as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         not available
 }
function log10l(x: LongDouble): LongDouble; external name '_log10l';


{
 *  log2l()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later or as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         not available
 }
function log2l(x: LongDouble): LongDouble; external name '_log2l';


{
 *  logbl()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later or as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         not available
 }
function logbl(x: LongDouble): LongDouble; external name '_logbl';


{
 *  scalbl()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later or as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         not available
 }
function scalbl(x: LongDouble; n: SInt32): LongDouble; external name '_scalbl';


{
 *  fabsl()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later or as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         not available
 }
function fabsl(x: LongDouble): LongDouble; external name '_fabsl';


{
 *  hypotl()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later or as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         not available
 }
function hypotl(x: LongDouble; y: LongDouble): LongDouble; external name '_hypotl';


{
 *  powl()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later or as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         not available
 }
function powl(x: LongDouble; y: LongDouble): LongDouble; external name '_powl';


{
 *  sqrtl()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later or as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         not available
 }
function sqrtl(x: LongDouble): LongDouble; external name '_sqrtl';


{
 *  erfl()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later or as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         not available
 }
function erfl(x: LongDouble): LongDouble; external name '_erfl';


{
 *  erfcl()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later or as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         not available
 }
function erfcl(x: LongDouble): LongDouble; external name '_erfcl';


{
 *  gammal()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later or as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         not available
 }
function gammal(x: LongDouble): LongDouble; external name '_gammal';


{
 *  lgammal()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later or as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         not available
 }
function lgammal(x: LongDouble): LongDouble; external name '_lgammal';


{
 *  ceill()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 2.0 and later or as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         not available
 }
function ceill(x: LongDouble): LongDouble; external name '_ceill';


{
 *  floorl()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later or as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         not available
 }
function floorl(x: LongDouble): LongDouble; external name '_floorl';


{
 *  rintl()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later or as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         not available
 }
function rintl(x: LongDouble): LongDouble; external name '_rintl';


{
 *  nearbyintl()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later or as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         not available
 }
function nearbyintl(x: LongDouble): LongDouble; external name '_nearbyintl';


{
 *  rinttoll()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later or as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         not available
 }
function rinttoll(x: LongDouble): SInt32; external name '_rinttoll';


{
 *  roundl()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later or as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         not available
 }
function roundl(x: LongDouble): LongDouble; external name '_roundl';


{
 *  roundtoll()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later or as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         not available
 }
function roundtoll(x: LongDouble): SInt32; external name '_roundtoll';


{
 *  truncl()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later or as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         not available
 }
function truncl(x: LongDouble): LongDouble; external name '_truncl';


{
 *  remainderl()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later or as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         not available
 }
function remainderl(x: LongDouble; y: LongDouble): LongDouble; external name '_remainderl';


{
 *  remquol()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later or as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         not available
 }
function remquol(x: LongDouble; y: LongDouble; var quo: SInt32): LongDouble; external name '_remquol';


{
 *  copysignl()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later or as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         not available
 }
function copysignl(x: LongDouble; y: LongDouble): LongDouble; external name '_copysignl';


{
 *  fdiml()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later or as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         not available
 }
function fdiml(x: LongDouble; y: LongDouble): LongDouble; external name '_fdiml';


{
 *  fmaxl()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later or as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         not available
 }
function fmaxl(x: LongDouble; y: LongDouble): LongDouble; external name '_fmaxl';


{
 *  fminl()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later or as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         not available
 }
function fminl(x: LongDouble; y: LongDouble): LongDouble; external name '_fminl';

{
 *  relationl()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later or as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         not available
 }
function relationl(x: LongDouble; y: LongDouble): relop; external name '_relationl';


{
 *  num2decl()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later or as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         not available
 }
procedure num2decl((*const*) var f: decform; x: LongDouble; var d: decimal); external name '_num2decl';


{
 *  dec2numl()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later or as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         not available
 }
function dec2numl(const (*var*) d: decimal): LongDouble; external name '_dec2numl';


{
        MathLib v2 has two new transfer functions: x80tod and dtox80.  They can
        be used to directly transform 68k 80-bit extended data types to double
        and back for PowerPC based machines without using the functions
        x80told or ldtox80.  Double rounding may occur.
    }
{
 *  x80tod()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function x80tod(const (*var*) x80: extended80): Double; external name '_x80tod';

{
 *  dtox80()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure dtox80((*const*) var x: Double; var x80: extended80); external name '_dtox80';

{
 *  x80told()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later or as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         not available
 }
procedure x80told(const (*var*) x80: extended80; var x: LongDouble); external name '_x80told';


{
 *  ldtox80()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MathLib 1.0 and later or as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         not available
 }
procedure ldtox80((*const*) var x: LongDouble; var x80: extended80); external name '_ldtox80';


{$ALIGN MAC68K}
{#POP}
{unit vBLAS}
{$ALIGN MAC68K}








{#PUSH}
{$ALIGN POWER}
{#LibExport+}


{
   ==========================================================================================================================
   Types and constants
   ===================
}



type
    CBLAS_ORDER                 = SInt32;
const
    CblasRowMajor               = 101;
    CblasColMajor               = 102;


type
    CBLAS_TRANSPOSE             = SInt32;
const
    CblasNoTrans                = 111;
    CblasTrans                  = 112;
    CblasConjTrans              = 113;


type
    CBLAS_UPLO                  = SInt32;
const
    CblasUpper                  = 121;
    CblasLower                  = 122;


type
    CBLAS_DIAG                  = SInt32;
const
    CblasNonUnit                = 131;
    CblasUnit                   = 132;


type
    CBLAS_SIDE                  = SInt32;
const
    CblasLeft                   = 141;
    CblasRight                  = 142;


    {
       ------------------------------------------------------------------------------------------------------------------
       IsAlignedCount   - True if an SInt16 is positive and a multiple of 4.  Negative strides are considered unaligned.
       IsAlignedAddr    - True if an address is a multiple of 16.
    }


    {
       ==========================================================================================================================
       ==========================================================================================================================
       Legacy BLAS Functions
       ==========================================================================================================================
       ==========================================================================================================================
    }


    {
       ==========================================================================================================================
       Level 1 Single Precision Functions
       ==================================
    }


    {
     *  cblas_sdot()
     *
     *  Availability:
     *    Non-Carbon CFM:   in vecLib 1.0.2 and later
     *    CarbonLib:        not in Carbon, but vecLib is compatible with Carbon
     *    Mac OS X:         in version 10.0 and later
        }
function cblas_sdot(N: SInt32; (*const*) var X: Single; incX: SInt32; (*const*) var Y: Single; incY: SInt32): Single; external name '_cblas_sdot';

{
 *  cblas_snrm2()
 *
 *  Availability:
 *    Non-Carbon CFM:   in vecLib 1.0.2 and later
 *    CarbonLib:        not in Carbon, but vecLib is compatible with Carbon
 *    Mac OS X:         in version 10.0 and later
 }
function cblas_snrm2(N: SInt32; (*const*) var X: Single; incX: SInt32): Single; external name '_cblas_snrm2';

{
 *  cblas_sasum()
 *
 *  Availability:
 *    Non-Carbon CFM:   in vecLib 1.0.2 and later
 *    CarbonLib:        not in Carbon, but vecLib is compatible with Carbon
 *    Mac OS X:         in version 10.0 and later
 }
function cblas_sasum(N: SInt32; (*const*) var X: Single; incX: SInt32): Single; external name '_cblas_sasum';

{
 *  cblas_isamax()
 *
 *  Availability:
 *    Non-Carbon CFM:   in vecLib 1.0.2 and later
 *    CarbonLib:        not in Carbon, but vecLib is compatible with Carbon
 *    Mac OS X:         in version 10.0 and later
 }
function cblas_isamax(N: SInt32; (*const*) var X: Single; incX: SInt32): SInt32; external name '_cblas_isamax';

{
 *  cblas_sswap()
 *
 *  Availability:
 *    Non-Carbon CFM:   in vecLib 1.0.2 and later
 *    CarbonLib:        not in Carbon, but vecLib is compatible with Carbon
 *    Mac OS X:         in version 10.0 and later
 }
procedure cblas_sswap(N: SInt32; var X: Single; incX: SInt32; var Y: Single; incY: SInt32); external name '_cblas_sswap';

{
 *  cblas_scopy()
 *
 *  Availability:
 *    Non-Carbon CFM:   in vecLib 1.0.2 and later
 *    CarbonLib:        not in Carbon, but vecLib is compatible with Carbon
 *    Mac OS X:         in version 10.0 and later
 }
procedure cblas_scopy(N: SInt32; (*const*) var X: Single; incX: SInt32; var Y: Single; incY: SInt32); external name '_cblas_scopy';

{
 *  cblas_saxpy()
 *
 *  Availability:
 *    Non-Carbon CFM:   in vecLib 1.0.2 and later
 *    CarbonLib:        not in Carbon, but vecLib is compatible with Carbon
 *    Mac OS X:         in version 10.0 and later
 }
procedure cblas_saxpy(N: SInt32; alpha: Single; (*const*) var X: Single; incX: SInt32; var Y: Single; incY: SInt32); external name '_cblas_saxpy';

{
 *  cblas_srot()
 *
 *  Availability:
 *    Non-Carbon CFM:   in vecLib 1.0.2 and later
 *    CarbonLib:        not in Carbon, but vecLib is compatible with Carbon
 *    Mac OS X:         in version 10.0 and later
 }
procedure cblas_srot(N: SInt32; var X: Single; incX: SInt32; var Y: Single; incY: SInt32; c: Single; s: Single); external name '_cblas_srot';

{
 *  cblas_sscal()
 *
 *  Availability:
 *    Non-Carbon CFM:   in vecLib 1.0.2 and later
 *    CarbonLib:        not in Carbon, but vecLib is compatible with Carbon
 *    Mac OS X:         in version 10.0 and later
 }
procedure cblas_sscal(N: SInt32; alpha: Single; var X: Single; incX: SInt32); external name '_cblas_sscal';


{
   ==========================================================================================================================
   Level 1 Double Precision Functions
   ==================================
}


{  *** TBD *** }


{
   ==========================================================================================================================
   Level 1 Complex Single Precision Functions
   ==========================================
}


{  *** TBD *** }


{
   ==========================================================================================================================
   Level 2 Single Precision Functions
   ==================================
}


{
 *  cblas_sgemv()
 *
 *  Availability:
 *    Non-Carbon CFM:   in vecLib 1.0.2 and later
 *    CarbonLib:        not in Carbon, but vecLib is compatible with Carbon
 *    Mac OS X:         in version 10.0 and later
 }
procedure cblas_sgemv(order: CBLAS_ORDER; transA: CBLAS_TRANSPOSE; M: SInt32; N: SInt32; alpha: Single; (*const*) var A: Single; lda: SInt32; (*const*) var X: Single; incX: SInt32; beta: Single; var Y: Single; incY: SInt32); external name '_cblas_sgemv';


{
   ==========================================================================================================================
   Level 2 Double Precision Functions
   ==================================
}


{  *** TBD *** }


{
   ==========================================================================================================================
   Level 2 Complex Single Precision Functions
   ==========================================
}


{  *** TBD *** }


{
   ==========================================================================================================================
   Level 3 Single Precision Functions
   ==================================
}


{
 *  cblas_sgemm()
 *
 *  Availability:
 *    Non-Carbon CFM:   in vecLib 1.0.2 and later
 *    CarbonLib:        not in Carbon, but vecLib is compatible with Carbon
 *    Mac OS X:         in version 10.0 and later
 }
procedure cblas_sgemm(order: CBLAS_ORDER; transA: CBLAS_TRANSPOSE; transB: CBLAS_TRANSPOSE; M: SInt32; N: SInt32; K: SInt32; alpha: Single; (*const*) var A: Single; lda: SInt32; (*const*) var B: Single; ldb: SInt32; beta: Single; var C: Single; ldc: SInt32); external name '_cblas_sgemm';


{
   ==========================================================================================================================
   Level 3 Double Precision Functions
   ==================================
}


{  *** TBD *** }


{
   ==========================================================================================================================
   Level 3 Complex Single Precision Functions
   ==========================================
}


{  *** TBD *** }


{
   ==========================================================================================================================
   ==========================================================================================================================
   Latest Standard BLAS Functions
   ==========================================================================================================================
   ==========================================================================================================================
}


{  *** TBD *** }


{
   ==========================================================================================================================
   ==========================================================================================================================
   Additional Functions from Apple
   ==========================================================================================================================
   ==========================================================================================================================
}


{
   -------------------------------------------------------------------------------------------------
   These routines provide optimized, AltiVec-only support for common small matrix multiplications.
   They do not check for the availability of AltiVec instructions or parameter errors.  They just do
   the multiplication as fast as possible.  Matrices are presumed to use row major storage.  Because
   these are all square, column major matrices can be multiplied by simply reversing the parameters.
}


{
   ==========================================================================================================================
   Error handling
   ==============
}


{
   -------------------------------------------------------------------------------------------------
   The BLAS standard requires that parameter errors be reported and cause the program to terminate.
   The default behavior for the Mac OS implementation of the BLAS is to print a message in English
   to stdout using printf and call exit with EXIT_FAILURE as the status.  If this is adequate, then
   you need do nothing more or worry about error handling.
   The BLAS standard also mentions a function, cblas_xerbla, suggesting that a program provide its
   own implementation to override the default error handling.  This will not work in the shared
   library environment of Mac OS 9.  Instead the Mac OS implementation provides a means to install
   an error handler.  There can only be one active error handler, installing a new one causes any
   previous handler to be forgotten.  Passing a null function pointer installs the default handler.
   The default handler is automatically installed at startup and implements the default behavior
   defined above.
   An error handler may return, it need not abort the program.  If the error handler returns, the
   BLAS routine also returns immediately without performing any processing.  Level 1 functions that
   return a numeric value return zero if the error handler returns.
}


type
    BLASParamErrorProc = procedure(funcName: ConstCStringPtr; paramName: ConstCStringPtr; (*const*) var paramPos: SInt32; (*const*) var paramValue: SInt32);

    {
     *  SetBLASParamErrorProc()
     *
     *  Availability:
     *    Non-Carbon CFM:   in vecLib 1.0.2 and later
     *    CarbonLib:        not in Carbon, but vecLib is compatible with Carbon
     *    Mac OS X:         in version 10.0 and later
        }
procedure SetBLASParamErrorProc(ErrorProc: BLASParamErrorProc); external name '_SetBLASParamErrorProc';


{  ========================================================================================================================== }



{$ALIGN MAC68K}
{#POP}
{unit vDSP}
{$ALIGN MAC68K}








{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}


type
    DSPComplexPtr = ^DSPComplex;
    DSPComplex = record
        real:                   Single;
        imag:                   Single;
    end;

    DSPSplitComplexPtr = ^DSPSplitComplex;
    DSPSplitComplex = record
        realp:                  ^Single;
        imagp:                  ^Single;
    end;

    FFTSetup    = ^SInt32; { an opaque 32-bit type }
    FFTSetupPtr = ^FFTSetup;  { when a var xx:FFTSetup parameter can be nil, it is changed to xx: FFTSetupPtr }
    FFTDirection                = SInt32;
const
    kFFTDirection_Forward       = 1;
    kFFTDirection_Inverse       = -1;


type
    FFTRadix                    = SInt32;
const
    kFFTRadix2                  = 0;
    kFFTRadix3                  = 1;
    kFFTRadix5                  = 2;

    {
    ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
        The criteria to invoke the PowerPC vector implementation is subject to
        change and become less restrictive in the future.
    ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
        }
    {
    ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
        Functions create_fftsetup and destroy_fftsetup.

        create_fftsetup will allocate memory and setup a weight array used by
        the FFT. The call destroy_fftsetup will free the array.
    ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
        }
    {
     *  create_fftsetup()
     *
     *  Availability:
     *    Non-Carbon CFM:   in vecLib 1.0 and later
     *    CarbonLib:        not in Carbon, but vecLib is compatible with Carbon
     *    Mac OS X:         in version 10.0 and later
        }
function create_fftsetup(log2n: UInt32; radix: FFTRadix): FFTSetup; external name '_create_fftsetup';

{
 *  destroy_fftsetup()
 *
 *  Availability:
 *    Non-Carbon CFM:   in vecLib 1.0 and later
 *    CarbonLib:        not in Carbon, but vecLib is compatible with Carbon
 *    Mac OS X:         in version 10.0 and later
 }
procedure destroy_fftsetup(setup: FFTSetup); external name '_destroy_fftsetup';



{
ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
    Functions ctoz and ztoc.

    ctoz converts a complex array to a complex-split array
    ztoc converts a complex-split array to a complex array

    Criteria to invoke PowerPC vector code:
        1. size > 3
        2. strideC = 2
        3. strideZ = 1
        4. Z.realp and Z.imagp are relatively aligned.
        5. C is 8-byte aligned if Z.realp and Z.imagp are 4-byte- aligned
           or C is 16-byte aligned if Z.realp and Z.imagp are at least
           8-byte aligned.
ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
}
{
 *  ctoz()
 *
 *  Availability:
 *    Non-Carbon CFM:   in vecLib 1.0 and later
 *    CarbonLib:        not in Carbon, but vecLib is compatible with Carbon
 *    Mac OS X:         in version 10.0 and later
 }
procedure ctoz(const (*var*) C: DSPComplex; strideC: SInt32; var Z: DSPSplitComplex; strideZ: SInt32; size: UInt32); external name '_ctoz';

{
 *  ztoc()
 *
 *  Availability:
 *    Non-Carbon CFM:   in vecLib 1.0 and later
 *    CarbonLib:        not in Carbon, but vecLib is compatible with Carbon
 *    Mac OS X:         in version 10.0 and later
 }
procedure ztoc(const (*var*) Z: DSPSplitComplex; strideZ: SInt32; var C: DSPComplex; strideC: SInt32; size: UInt32); external name '_ztoc';



{
ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
    Functions fft_zip and fft_zipt

    In-place Split Complex Fourier Transform with or without temporary memory.

      Criteria to invoke PowerPC vector code:

        1. ioData.realp and ioData.imagp must be 16-byte aligned.
        2. stride = 1
        3. 2 <= log2n <= 20
        4. bufferTemp.realp and bufferTemp.imagp must be 16-byte aligned.

      If any of the above criteria are not satisfied, the PowerPC scalor code
      implementation will be used.  The size of temporary memory for each part
      is the lower value of 4*n and 16k.  Direction can be either
      kFFTDirection_Forward or kFFTDirection_Inverse.
ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
}
{
 *  fft_zip()
 *
 *  Availability:
 *    Non-Carbon CFM:   in vecLib 1.0 and later
 *    CarbonLib:        not in Carbon, but vecLib is compatible with Carbon
 *    Mac OS X:         in version 10.0 and later
 }
procedure fft_zip(setup: FFTSetup; var ioData: DSPSplitComplex; stride: SInt32; log2n: UInt32; direction: FFTDirection); external name '_fft_zip';

{
 *  fft_zipt()
 *
 *  Availability:
 *    Non-Carbon CFM:   in vecLib 1.0 and later
 *    CarbonLib:        not in Carbon, but vecLib is compatible with Carbon
 *    Mac OS X:         in version 10.0 and later
 }
procedure fft_zipt(setup: FFTSetup; var ioData: DSPSplitComplex; stride: SInt32; var bufferTemp: DSPSplitComplex; log2n: UInt32; direction: FFTDirection); external name '_fft_zipt';



{
ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
     Functions fft_zop and fft_zopt

     Out-of-place Split Complex Fourier Transform with or without temporary
     memory

      Criteria to invoke PowerPC vector code:

        1. signal.realp and signal.imagp must be 16-byte aligned.
        2. signalStride = 1
        3. result.realp and result.imagp must be 16-byte aligned.
        4. strideResult = 1
        5. 2 <= log2n <= 20
        6. bufferTemp.realp and bufferTemp.imagp must be 16-byte aligned.

      If any of the above criteria are not satisfied, the PowerPC scalor code
      implementation will be used.  The size of temporary memory for each part
      is the lower value of 4*n and 16k.  Direction can be either
      kFFTDirection_Forward or kFFTDirection_Inverse.
ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
}
{
 *  fft_zop()
 *
 *  Availability:
 *    Non-Carbon CFM:   in vecLib 1.0 and later
 *    CarbonLib:        not in Carbon, but vecLib is compatible with Carbon
 *    Mac OS X:         in version 10.0 and later
 }
procedure fft_zop(setup: FFTSetup; var signal: DSPSplitComplex; signalStride: SInt32; var result: DSPSplitComplex; strideResult: SInt32; log2n: UInt32; direction: FFTDirection); external name '_fft_zop';

{
 *  fft_zopt()
 *
 *  Availability:
 *    Non-Carbon CFM:   in vecLib 1.0 and later
 *    CarbonLib:        not in Carbon, but vecLib is compatible with Carbon
 *    Mac OS X:         in version 10.0 and later
 }
procedure fft_zopt(setup: FFTSetup; var signal: DSPSplitComplex; signalStride: SInt32; var result: DSPSplitComplex; strideResult: SInt32; var bufferTemp: DSPSplitComplex; log2n: UInt32; direction: FFTDirection); external name '_fft_zopt';



{
ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
    Functions fft_zrip and fft_zript

    In-Place Real Fourier Transform with or without temporary memory,
    split Complex Format

      Criteria to invoke PowerPC vector code:
        1. ioData.realp and ioData.imagp must be 16-byte aligned.
        2. stride = 1
        3. 3 <= log2n <= 13

      If any of the above criteria are not satisfied, the PowerPC scalor code
      implementation will be used.  The size of temporary memory for each part
      is the lower value of 4*n and 16k.  Direction can be either
      kFFTDirection_Forward or kFFTDirection_Inverse.
ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
}
{
 *  fft_zrip()
 *
 *  Availability:
 *    Non-Carbon CFM:   in vecLib 1.0 and later
 *    CarbonLib:        not in Carbon, but vecLib is compatible with Carbon
 *    Mac OS X:         in version 10.0 and later
 }
procedure fft_zrip(setup: FFTSetup; var ioData: DSPSplitComplex; stride: SInt32; log2n: UInt32; direction: FFTDirection); external name '_fft_zrip';

{
 *  fft_zript()
 *
 *  Availability:
 *    Non-Carbon CFM:   in vecLib 1.0 and later
 *    CarbonLib:        not in Carbon, but vecLib is compatible with Carbon
 *    Mac OS X:         in version 10.0 and later
 }
procedure fft_zript(setup: FFTSetup; var ioData: DSPSplitComplex; stride: SInt32; var bufferTemp: DSPSplitComplex; log2n: UInt32; direction: FFTDirection); external name '_fft_zript';



{
ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
    Functions fft_zrop and fft_zropt

    Out-of-Place Real Fourier Transform with or without temporary memory,
    split Complex Format

      Criteria to invoke PowerPC vector code:
        1. signal.realp and signal.imagp must be 16-byte aligned.
        2. signalStride = 1
        3. result.realp and result.imagp must be be 16-byte aligned.
        4. strideResult = 1
        5. 3 <= log2n <= 13

      If any of the above criteria are not satisfied, the PowerPC scalor code
      implementation will be used.  The size of temporary memory for each part
      is the lower value of 4*n and 16k.  Direction can be either
      kFFTDirection_Forward or kFFTDirection_Inverse.
ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
}
{
 *  fft_zrop()
 *
 *  Availability:
 *    Non-Carbon CFM:   in vecLib 1.0 and later
 *    CarbonLib:        not in Carbon, but vecLib is compatible with Carbon
 *    Mac OS X:         in version 10.0 and later
 }
procedure fft_zrop(setup: FFTSetup; var signal: DSPSplitComplex; signalStride: SInt32; var result: DSPSplitComplex; strideResult: SInt32; log2n: UInt32; direction: FFTDirection); external name '_fft_zrop';

{
 *  fft_zropt()
 *
 *  Availability:
 *    Non-Carbon CFM:   in vecLib 1.0 and later
 *    CarbonLib:        not in Carbon, but vecLib is compatible with Carbon
 *    Mac OS X:         in version 10.0 and later
 }
procedure fft_zropt(setup: FFTSetup; var signal: DSPSplitComplex; signalStride: SInt32; var result: DSPSplitComplex; strideResult: SInt32; var bufferTemp: DSPSplitComplex; log2n: UInt32; direction: FFTDirection); external name '_fft_zropt';



{
ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
    Functions fft2d_zip and fft2d_zipt

    In-place two dimensional Split Complex Fourier Transform with or without
    temporary memory

      Criteria to invoke PowerPC vector code:
        1. ioData.realp and ioData.imagp must be 16-byte aligned.
        2. strideInRow = 1;
        3. strideInCol must be a multiple of 4
        4. 2 <= log2nInRow <= 12
        5. 2 <= log2nInCol <= 12
        6. bufferTemp.realp and bufferTemp.imagp must be 16-byte aligned.

      If any of the above criteria are not satisfied, the PowerPC scalor code
      implementation will be used.  The size of temporary memory for each part
      is the lower value of 4*n and 16k.  ( log2n = log2nInRow + log2nInCol )
      Direction can be either kFFTDirection_Forward or kFFTDirection_Inverse.
ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
}
{
 *  fft2d_zip()
 *
 *  Availability:
 *    Non-Carbon CFM:   in vecLib 1.0 and later
 *    CarbonLib:        not in Carbon, but vecLib is compatible with Carbon
 *    Mac OS X:         in version 10.0 and later
 }
procedure fft2d_zip(setup: FFTSetup; var ioData: DSPSplitComplex; strideInRow: SInt32; strideInCol: SInt32; log2nInCol: UInt32; log2nInRow: UInt32; direction: FFTDirection); external name '_fft2d_zip';

{
 *  fft2d_zipt()
 *
 *  Availability:
 *    Non-Carbon CFM:   in vecLib 1.0 and later
 *    CarbonLib:        not in Carbon, but vecLib is compatible with Carbon
 *    Mac OS X:         in version 10.0 and later
 }
procedure fft2d_zipt(setup: FFTSetup; var ioData: DSPSplitComplex; strideInRow: SInt32; strideInCol: SInt32; var bufferTemp: DSPSplitComplex; log2nInCol: UInt32; log2nInRow: UInt32; direction: FFTDirection); external name '_fft2d_zipt';



{
ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
    Functions fft2d_zop and fft2d_zopt

    Out-of-Place two dimemsional Split Complex Fourier Transform with or
    without temporary memory

      Criteria to invoke PowerPC vector code:

        1. signal.realp and signal.imagp must be 16-byte aligned.
        2. signalStrideInRow = 1;
        3. signalStrideInCol must be a multiple of 4
        4. result.realp and result.imagp must be 16-byte aligned.
        5. strideResultInRow = 1;
        6. strideResultInCol must be a multiple of 4
        7. 2 <= log2nInRow <= 12
        8. 2 <= log2nInCol <= 12
        9. bufferTemp.realp and bufferTemp.imagp must be 16-byte aligned.

      If any of the above criteria are not satisfied, the PowerPC scalor code
      implementation will be used.  The size of temporary memory for each part
      is the lower value of 4*n and 16k.  ( log2n = log2nInRow + log2nInCol )
      Direction can be either kFFTDirection_Forward or kFFTDirection_Inverse.
ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
}
{
 *  fft2d_zop()
 *
 *  Availability:
 *    Non-Carbon CFM:   in vecLib 1.0 and later
 *    CarbonLib:        not in Carbon, but vecLib is compatible with Carbon
 *    Mac OS X:         in version 10.0 and later
 }
procedure fft2d_zop(setup: FFTSetup; var signal: DSPSplitComplex; signalStrideInRow: SInt32; signalStrideInCol: SInt32; var result: DSPSplitComplex; strideResultInRow: SInt32; strideResultInCol: SInt32; log2nInCol: UInt32; log2nInRow: UInt32; flag: SInt32); external name '_fft2d_zop';

{
 *  fft2d_zopt()
 *
 *  Availability:
 *    Non-Carbon CFM:   in vecLib 1.0 and later
 *    CarbonLib:        not in Carbon, but vecLib is compatible with Carbon
 *    Mac OS X:         in version 10.0 and later
 }
procedure fft2d_zopt(setup: FFTSetup; var signal: DSPSplitComplex; signalStrideInRow: SInt32; signalStrideInCol: SInt32; var result: DSPSplitComplex; strideResultInRow: SInt32; strideResultInCol: SInt32; var bufferTemp: DSPSplitComplex; log2nInCol: UInt32; log2nInRow: UInt32; flag: SInt32); external name '_fft2d_zopt';



{
ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
    Functions fft2d_zrip and fft2d_zript

    In-place two dimensional Real Fourier Transform with or without temporary
    memory, Split Complex Format

      Criteria to invoke PowerPC vector code:
        1. ioData.realp and ioData.imagp must be 16-byte aligned.
        2. strideInRow = 1;
        3. strideInCol must be a multiple of 4
        4. 3 <= log2nInRow <= 12
        5. 3 <= log2nInCol <= 13
        6. bufferTemp.realp and bufferTemp.imagp must be 16-byte aligned.

      If any of the above criteria are not satisfied, the PowerPC scalor code
      implementation will be used.  The size of temporary memory for each part
      is the lower value of 4*n and 16k.  ( log2n = log2nInRow + log2nInCol )
      Direction can be either kFFTDirection_Forward or kFFTDirection_Inverse.
ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
}
{
 *  fft2d_zrip()
 *
 *  Availability:
 *    Non-Carbon CFM:   in vecLib 1.0 and later
 *    CarbonLib:        not in Carbon, but vecLib is compatible with Carbon
 *    Mac OS X:         in version 10.0 and later
 }
procedure fft2d_zrip(setup: FFTSetup; var ioData: DSPSplitComplex; strideInRow: SInt32; strideInCol: SInt32; log2nInCol: UInt32; log2nInRow: UInt32; direction: FFTDirection); external name '_fft2d_zrip';

{
 *  fft2d_zript()
 *
 *  Availability:
 *    Non-Carbon CFM:   in vecLib 1.0 and later
 *    CarbonLib:        not in Carbon, but vecLib is compatible with Carbon
 *    Mac OS X:         in version 10.0 and later
 }
procedure fft2d_zript(setup: FFTSetup; var ioData: DSPSplitComplex; strideInRow: SInt32; strideInCol: SInt32; var bufferTemp: DSPSplitComplex; log2nInCol: UInt32; log2nInRow: UInt32; direction: FFTDirection); external name '_fft2d_zript';



{
ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
    Functions fft2d_zrop and fft2d_zropt

    Out-of-Place Two-Dimemsional Real Fourier Transform with or without
    temporary memory, Split Complex Format

      Criteria to invoke PowerPC vector code:
        1. signal.realp and signal.imagp must be 16-byte aligned.
        2. signalStrideInRow = 1;
        3. signalStrideInCol must be a multiple of 4
        4. result.realp and result.imagp must be 16-byte aligned.
        5. strideResultInRow = 1;
        6. strideResultInCol must be a multiple of 4
        7. 3 <= log2nInRow <= 12
        8. 3 <= log2nInCol <= 13
        9. bufferTemp.realp and bufferTemp.imagp must be 16-byte aligned.

      If any of the above criteria are not satisfied, the PowerPC scalor code
      implementation will be used.  The size of temporary memory for each part
      is the lower value of 4*n and 16k.  ( log2n = log2nInRow + log2nInCol )
      Direction can be either kFFTDirection_Forward or kFFTDirection_Inverse.
ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
}
{
 *  fft2d_zrop()
 *
 *  Availability:
 *    Non-Carbon CFM:   in vecLib 1.0 and later
 *    CarbonLib:        not in Carbon, but vecLib is compatible with Carbon
 *    Mac OS X:         in version 10.0 and later
 }
procedure fft2d_zrop(setup: FFTSetup; var signal: DSPSplitComplex; signalStrideInRow: SInt32; signalStrideInCol: SInt32; var result: DSPSplitComplex; strideResultInRow: SInt32; strideResultInCol: SInt32; log2nInCol: UInt32; log2nInRow: UInt32; flag: SInt32); external name '_fft2d_zrop';

{
 *  fft2d_zropt()
 *
 *  Availability:
 *    Non-Carbon CFM:   in vecLib 1.0 and later
 *    CarbonLib:        not in Carbon, but vecLib is compatible with Carbon
 *    Mac OS X:         in version 10.0 and later
 }
procedure fft2d_zropt(setup: FFTSetup; var signal: DSPSplitComplex; signalStrideInRow: SInt32; signalStrideInCol: SInt32; var result: DSPSplitComplex; strideResultInRow: SInt32; strideResultInCol: SInt32; var bufferTemp: DSPSplitComplex; log2nInCol: UInt32; log2nInRow: UInt32; flag: SInt32); external name '_fft2d_zropt';



{
ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
    Function conv

    Floating Point Convolution and Correlation

      Criteria to invoke PowerPC vector code:
        1. signal and result must have relative alignement.
        2. 4 <= lenFilter <= 256
        3. lenResult > 36
        4. signalStride = 1
        5. strideResult = 1

      If any of the above criteria are not satisfied, the PowerPC scalor code
      implementation will be used.  strideFilter can be positive for
      correlation or negative for convolution.
ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
}
{
 *  conv()
 *
 *  Availability:
 *    Non-Carbon CFM:   in vecLib 1.0 and later
 *    CarbonLib:        not in Carbon, but vecLib is compatible with Carbon
 *    Mac OS X:         in version 10.0 and later
 }
procedure conv((*const*) var signal: Single; signalStride: SInt32; (*const*) var filter: Single; strideFilter: SInt32; var result: Single; strideResult: SInt32; lenResult: SInt32; lenFilter: SInt32); external name '_conv';



{
ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
    Function vadd

    Floating Point Add

      Criteria to invoke PowerPC vector code:
        1. input1 and input2 and result are all relatively aligned.
        2. size >= 8
        3. stride1 = 1
        4. stride2 = 1
        5. strideResult = 1

      If any of the above criteria are not satisfied, the PowerPC scalor code
      implementation will be used.
ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
}
{
 *  vadd()
 *
 *  Availability:
 *    Non-Carbon CFM:   in vecLib 1.0 and later
 *    CarbonLib:        not in Carbon, but vecLib is compatible with Carbon
 *    Mac OS X:         in version 10.0 and later
 }
procedure vadd((*const*) var input1: Single; stride1: SInt32; (*const*) var input2: Single; stride2: SInt32; var result: Single; strideResult: SInt32; size: UInt32); external name '_vadd';



{
ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
    Function vsub

     Floating Point Substract

      Criteria to invoke PowerPC vector code:
        1. input1 and input2 and result are all relatively aligned.
        2. size >= 8
        3. stride1 = 1
        4. stride2 = 1
        5. strideResult = 1

      If any of the above criteria are not satisfied, the PowerPC scalor code
      implementation will be used.
ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
}
{
 *  vsub()
 *
 *  Availability:
 *    Non-Carbon CFM:   in vecLib 1.0 and later
 *    CarbonLib:        not in Carbon, but vecLib is compatible with Carbon
 *    Mac OS X:         in version 10.0 and later
 }
procedure vsub((*const*) var input1: Single; stride1: SInt32; (*const*) var input2: Single; stride2: SInt32; var result: Single; strideResult: SInt32; size: UInt32); external name '_vsub';



{
ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
    Function vmul

    Floating Point Multiply

      Criteria to invoke PowerPC vector code:
        1. input1 and input2 and result must be all relatively aligned.
        2. size >= 8
        3. stride1 = 1
        4. stride2 = 1
        5. strideResult = 1

      If any of the above criteria are not satisfied, the PowerPC scalor code
      implementation will be used.
ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
}
{
 *  vmul()
 *
 *  Availability:
 *    Non-Carbon CFM:   in vecLib 1.0 and later
 *    CarbonLib:        not in Carbon, but vecLib is compatible with Carbon
 *    Mac OS X:         in version 10.0 and later
 }
procedure vmul((*const*) var input1: Single; stride1: SInt32; (*const*) var input2: Single; stride2: SInt32; var result: Single; strideResult: SInt32; size: UInt32); external name '_vmul';



{
ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
    Function vsmul

    Floating Point - Scalar Multiply

      Criteria to invoke PowerPC vector code:
        1. input1 and result are all relatively aligned.
        2. size >= 8
        3. stride1 = 1
        5. strideResult = 1

      If any of the above criteria are not satisfied, the PowerPC scalor code
      implementation will be used.
ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
}
{
 *  vsmul()
 *
 *  Availability:
 *    Non-Carbon CFM:   in vecLib 1.0 and later
 *    CarbonLib:        not in Carbon, but vecLib is compatible with Carbon
 *    Mac OS X:         in version 10.0 and later
 }
procedure vsmul((*const*) var input1: Single; stride1: SInt32; (*const*) var input2: Single; var result: Single; strideResult: SInt32; size: UInt32); external name '_vsmul';



{
ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
    Function vsq

    Floating Point Square

      Criteria to invoke PowerPC vector code:
        1. input and result are relatively aligned.
        2. size >= 8
        3. strideInput = 1
        4. strideResult = 1

      If any of the above criteria are not satisfied, the PowerPC scalor code
      implementation will be used.
ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
}
{
 *  vsq()
 *
 *  Availability:
 *    Non-Carbon CFM:   in vecLib 1.0 and later
 *    CarbonLib:        not in Carbon, but vecLib is compatible with Carbon
 *    Mac OS X:         in version 10.0 and later
 }
procedure vsq((*const*) var input: Single; strideInput: SInt32; var result: Single; strideResult: SInt32; size: UInt32); external name '_vsq';



{
ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
    Function vssq

    Floating Point Signed Square

      Criteria to invoke PowerPC vector code:
        1. input and result must be all relatively aligned.
        2. size >= 8
        3. strideInput = 1
        4. strideResult = 1

      If any of the above criteria are not satisfied, the PowerPC scalor code
      implementation will be used.
ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
}
{
 *  vssq()
 *
 *  Availability:
 *    Non-Carbon CFM:   in vecLib 1.0 and later
 *    CarbonLib:        not in Carbon, but vecLib is compatible with Carbon
 *    Mac OS X:         in version 10.0 and later
 }
procedure vssq((*const*) var input: Single; strideInput: SInt32; var result: Single; strideResult: SInt32; size: UInt32); external name '_vssq';



{
ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
    Function dotpr

    Floating Point Dot product

      Criteria to invoke PowerPC vector code:
        1. input1 and input2 are relatively aligned.
        2. size >= 20
        3. stride1 = 1
        4. stride2 = 1

      If any of the above criteria are not satisfied, the PowerPC scalor code
      implementation will be used.
ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
}
{
 *  dotpr()
 *
 *  Availability:
 *    Non-Carbon CFM:   in vecLib 1.0 and later
 *    CarbonLib:        not in Carbon, but vecLib is compatible with Carbon
 *    Mac OS X:         in version 10.0 and later
 }
procedure dotpr((*const*) var input1: Single; stride1: SInt32; (*const*) var input2: Single; stride2: SInt32; var result: Single; size: UInt32); external name '_dotpr';



{
ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
    Function vam

    Floating Point vadd and Multiply

      Criteria to invoke PowerPC vector code:
        1. input1, input2, input_3 and result are all relatively aligned.
        2. size >= 8
        3. stride1 = 1
        4. stride2 = 1
        5. stride_3 = 1
        6. strideResult = 1

      If any of the above criteria are not satisfied, the PowerPC scalor code
      implementation will be used.
ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
}
{
 *  vam()
 *
 *  Availability:
 *    Non-Carbon CFM:   in vecLib 1.0 and later
 *    CarbonLib:        not in Carbon, but vecLib is compatible with Carbon
 *    Mac OS X:         in version 10.0 and later
 }
procedure vam((*const*) var input1: Single; stride1: SInt32; (*const*) var input2: Single; stride2: SInt32; (*const*) var input3: Single; stride3: SInt32; var result: Single; strideResult: SInt32; size: UInt32); external name '_vam';



{
ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
    Function zconv

    Split Complex Convolution and Correlation

      Criteria to invoke PowerPC vector code:
        1. signal->realp, signal->imagp, result->realp, result->imagp
           must be relatively aligned.
        2. 4 <= lenFilter <= 128
        3. lenResult > 20
        4. signalStride = 1
        5. strideResult = 1

      If any of the above criteria are not satisfied, the PowerPC scalor code
      implementation will be used.  strideFilter can be positive for correlation
      or negative for convolution
ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
}
{
 *  zconv()
 *
 *  Availability:
 *    Non-Carbon CFM:   in vecLib 1.0 and later
 *    CarbonLib:        not in Carbon, but vecLib is compatible with Carbon
 *    Mac OS X:         in version 10.0 and later
 }
procedure zconv(var signal: DSPSplitComplex; signalStride: SInt32; var filter: DSPSplitComplex; strideFilter: SInt32; var result: DSPSplitComplex; strideResult: SInt32; lenResult: SInt32; lenFilter: SInt32); external name '_zconv';



{
ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
    Function zvadd

    Split Complex vadd

      Criteria to invoke PowerPC vector code:
        1. input1.realp, input1.imagp, input2.realp, input2.imagp,
           result.realp, result.imagp must be all relatively aligned.
        2. size >= 8
        3. stride1 = 1
        4. stride2 = 1
        5. strideResult = 1

      If any of the above criteria are not satisfied, the PowerPC scalor code
      implementation will be used.
ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
}
{
 *  zvadd()
 *
 *  Availability:
 *    Non-Carbon CFM:   in vecLib 1.0 and later
 *    CarbonLib:        not in Carbon, but vecLib is compatible with Carbon
 *    Mac OS X:         in version 10.0 and later
 }
procedure zvadd(var input1: DSPSplitComplex; stride1: SInt32; var input2: DSPSplitComplex; stride2: SInt32; var result: DSPSplitComplex; strideResult: SInt32; size: UInt32); external name '_zvadd';



{
ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
    Function zvsub

    Split Complex Substract

      Criteria to invoke PowerPC vector code:
        1. input1.realp, input1.imagp, input2.realp, input2.imagp,
           result.realp, result.imagp must be all relatively aligned.
        2. size >= 8
        3. stride1 = 1
        4. stride2 = 1
        5. strideResult = 1

      If any of the above criteria are not satisfied, the PowerPC scalor code
      implementation will be used.
ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
}
{
 *  zvsub()
 *
 *  Availability:
 *    Non-Carbon CFM:   in vecLib 1.0 and later
 *    CarbonLib:        not in Carbon, but vecLib is compatible with Carbon
 *    Mac OS X:         in version 10.0 and later
 }
procedure zvsub(var input1: DSPSplitComplex; stride1: SInt32; var input2: DSPSplitComplex; stride2: SInt32; var result: DSPSplitComplex; strideResult: SInt32; size: UInt32); external name '_zvsub';



{
ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
    Function zvmul

    Split Complex Multiply

      Criteria to invoke PowerPC vector code:
        1. input1.realp, input1.imagp, input2.realp, input2.imagp,
           result.realp, result.imagp must be all relatively aligned.
        2. size >= 8
        3. stride1 = 1
        4. stride2 = 1
        5. strideResult = 1

      If any of the above criteria are not satisfied, the PowerPC scalor code
      implementation will be used.  The conjugate value can be 1 or -1.
ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
}
{
 *  zvmul()
 *
 *  Availability:
 *    Non-Carbon CFM:   in vecLib 1.0 and later
 *    CarbonLib:        not in Carbon, but vecLib is compatible with Carbon
 *    Mac OS X:         in version 10.0 and later
 }
procedure zvmul(var input1: DSPSplitComplex; stride1: SInt32; var input2: DSPSplitComplex; stride2: SInt32; var result: DSPSplitComplex; strideResult: SInt32; size: UInt32; conjugate: SInt32); external name '_zvmul';



{
ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
    Function zdotpr

    Split Complex Dot product

      Criteria to invoke PowerPC vector code:
        1. input1.realp, input1.imagp, input2.realp, input2.imagp are all
           relatively aligned.
        2. size >= 20
        3. stride1 = 1
        4. stride2 = 1

      If any of the above criteria are not satisfied, the PowerPC scalor code
      implementation will be used.
ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
}
{
 *  zdotpr()
 *
 *  Availability:
 *    Non-Carbon CFM:   in vecLib 1.0 and later
 *    CarbonLib:        not in Carbon, but vecLib is compatible with Carbon
 *    Mac OS X:         in version 10.0 and later
 }
procedure zdotpr(var input1: DSPSplitComplex; stride1: SInt32; var input2: DSPSplitComplex; stride2: SInt32; var result: DSPSplitComplex; size: UInt32); external name '_zdotpr';



{
ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
    Function zidotpr

    Split Complex Inner Dot product

      Criteria to invoke PowerPC vector code:
        1. input1.realp, input1.imagp, input2.realp, input2.imagp must be
           all relatively aligned.
        2. size >= 20
        3. stride1 = 1
        4. stride2 = 1

      If any of the above criteria are not satisfied, the PowerPC scalor code
      implementation will be used.
ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
}
{
 *  zidotpr()
 *
 *  Availability:
 *    Non-Carbon CFM:   in vecLib 1.0 and later
 *    CarbonLib:        not in Carbon, but vecLib is compatible with Carbon
 *    Mac OS X:         in version 10.0 and later
 }
procedure zidotpr(var input1: DSPSplitComplex; stride1: SInt32; var input2: DSPSplitComplex; stride2: SInt32; var result: DSPSplitComplex; size: UInt32); external name '_zidotpr';



{
ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
    Function zrdotpr

    Split Complex - Real Dot product

      Criteria to invoke PowerPC vector code:
        1. input1.realp, input1.imagp, input2 are must be relatively aligned.
        2. size >= 16
        3. stride1 = 1
        4. stride2 = 1

      If any of the above criteria are not satisfied, the PowerPC scalor code
      implementation will be used.
ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
}
{
 *  zrdotpr()
 *
 *  Availability:
 *    Non-Carbon CFM:   in vecLib 1.0 and later
 *    CarbonLib:        not in Carbon, but vecLib is compatible with Carbon
 *    Mac OS X:         in version 10.0 and later
 }
procedure zrdotpr(var input1: DSPSplitComplex; stride1: SInt32; (*const*) var input2: Single; stride2: SInt32; var result: DSPSplitComplex; size: UInt32); external name '_zrdotpr';



{
ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
    Function zvcma

    Split Complex Conjugate Multiply And vadd

      Criteria to invoke PowerPC vector code:
        1. input1.realp, input1.imagp, input2.realp, input2.imagp,
          input_3.realp, input_3.imagp, result.realp, result.imagp
          must be all relatively aligned.
        2. size >= 8
        3. stride1 = 1
        4. stride2 = 1
        5. stride_3 = 1
        6. strideResult = 1

      If any of the above criteria are not satisfied, the PowerPC scalor code
      implementation will be used.
ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
}
{
 *  zvcma()
 *
 *  Availability:
 *    Non-Carbon CFM:   in vecLib 1.0 and later
 *    CarbonLib:        not in Carbon, but vecLib is compatible with Carbon
 *    Mac OS X:         in version 10.0 and later
 }
procedure zvcma(var input1: DSPSplitComplex; stride1: SInt32; var input2: DSPSplitComplex; stride2: SInt32; var input3: DSPSplitComplex; stride3: SInt32; var result: DSPSplitComplex; strideResult: SInt32; size: UInt32); external name '_zvcma';



{
ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
    Function zrvadd

    Split Complex - Real Add

      Criteria to invoke PowerPC vector code:
        1. input1.realp, input1.imagp, input2, result.realp, result.imagp
           are all relatively aligned.
        2. size >= 8
        3. stride1 = 1
        4. stride2 = 1
        5. strideResult = 1

      If any of the above criteria are not satisfied, the PowerPC scalor code
      implementation will be used.
ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
}
{
 *  zrvadd()
 *
 *  Availability:
 *    Non-Carbon CFM:   in vecLib 1.0 and later
 *    CarbonLib:        not in Carbon, but vecLib is compatible with Carbon
 *    Mac OS X:         in version 10.0 and later
 }
procedure zrvadd(var input1: DSPSplitComplex; stride1: SInt32; (*const*) var input2: Single; stride2: SInt32; var result: DSPSplitComplex; strideResult: SInt32; size: UInt32); external name '_zrvadd';



{
ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
    Function zrvsub

    Split Complex - Real Substract

      Criteria to invoke PowerPC vector code:
        1. input1.realp, input1.imagp, input2, result.realp, result.imagp
           must be all relatively aligned.
        2. size >= 8
        3. stride1 = 1
        4. stride2 = 1
        5. strideResult = 1

      If any of the above criteria are not satisfied, the PowerPC scalor code
      implementation will be used.
ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
}
{
 *  zrvsub()
 *
 *  Availability:
 *    Non-Carbon CFM:   in vecLib 1.0 and later
 *    CarbonLib:        not in Carbon, but vecLib is compatible with Carbon
 *    Mac OS X:         in version 10.0 and later
 }
procedure zrvsub(var input1: DSPSplitComplex; stride1: SInt32; (*const*) var input2: Single; stride2: SInt32; var result: DSPSplitComplex; strideResult: SInt32; size: UInt32); external name '_zrvsub';



{
ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
    Function zrvmul

    Split Complex - Real Multiply

      Criteria to invoke PowerPC vector code:
        1. input1.realp, input1.imagp, input2, result.realp, result.imagp
           must be all relatively aligned.
        2. size >= 8
        3. stride1 = 1
        4. stride2 = 1
        5. strideResult = 1

      If any of the above criteria are not satisfied, the PowerPC scalor code
      implementation will be used.
ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
}
{
 *  zrvmul()
 *
 *  Availability:
 *    Non-Carbon CFM:   in vecLib 1.0 and later
 *    CarbonLib:        not in Carbon, but vecLib is compatible with Carbon
 *    Mac OS X:         in version 10.0 and later
 }
procedure zrvmul(var input1: DSPSplitComplex; stride1: SInt32; (*const*) var input2: Single; stride2: SInt32; var result: DSPSplitComplex; strideResult: SInt32; size: UInt32); external name '_zrvmul';




{$setc USE_NONE_APPLE_STANDARD_DATATYPES := 1}


const
    FFT_FORWARD                 = 1;
    FFT_INVERSE                 = -1;

    FFT_RADIX2                  = 0;
    FFT_RADIX3                  = 1;
    FFT_RADIX5                  = 2;


type
    COMPLEX                             = DSPComplex;
    COMPLEXPtr                          = ^COMPLEX;
    COMPLEX_SPLIT                       = DSPSplitComplex;
    COMPLEX_SPLITPtr                    = ^COMPLEX_SPLIT;

{$ALIGN MAC68K}
{#POP}
{unit ABTypedefs}
{$ALIGN MAC68K}






const
    kABMultiValueMask  = $100;

type
    ABPropertyType = SInt32;
const
    kABErrorInProperty           = 0;
    kABStringProperty            = 1;
    kABIntegerProperty           = 2;
    kABRealProperty              = 3;
    kABDateProperty              = 4;
    kABArrayProperty             = 5;
    kABDictionaryProperty        = 6;
    kABDataProperty              = 7;
    kABMultiStringProperty       = kABMultiValueMask or kABStringProperty;
    kABMultiIntegerProperty      = kABMultiValueMask or kABIntegerProperty;
    kABMultiRealProperty         = kABMultiValueMask or kABRealProperty;
    kABMultiDateProperty         = kABMultiValueMask or kABDateProperty;
    kABMultiArrayProperty        = kABMultiValueMask or kABArrayProperty;
    kABMultiDictionaryProperty   = kABMultiValueMask or kABDictionaryProperty;
    kABMultiDataProperty         = kABMultiValueMask or kABDataProperty;

// ================================================================
//      Search APIs
// ================================================================

type
    ABSearchComparison = SInt32;
const
        kABEqual = 0;
        kABNotEqual = 1;
        kABLessThan = 2;
        kABLessThanOrEqual = 3;
        kABGreaterThan = 4;
        kABGreaterThanOrEqual = 5;

        kABEqualCaseInsensitive = 6;
        kABContainsSubString = 7;
        kABContainsSubStringCaseInsensitive = 8;
        kABPrefixMatch = 9;
        kABPrefixMatchCaseInsensitive = 10;
// #if MAC_OS_X_VERSION_10_3 <= MAC_OS_X_VERSION_MAX_ALLOWED
        kABBitsInBitFieldMatch = 11;
// #endif

type
    ABSearchConjunction = SInt32;
const
        kABSearchAnd = 0;
        kABSearchOr = 1;
{unit AEDataModel}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}

{ Apple event descriptor types }

const
    typeBoolean                 = $626F6F6C (* 'bool' *);
    typeChar                    = $54455854 (* 'TEXT' *);

    {    Preferred numeric Apple event descriptor types     }
    typeSInt16                  = $73686F72 (* 'shor' *);
    typeSInt32                  = $6C6F6E67 (* 'long' *);
    typeUInt32                  = $6D61676E (* 'magn' *);
    typeSInt64                  = $636F6D70 (* 'comp' *);
    typeIEEE32BitFloatingPoint  = $73696E67 (* 'sing' *);
    typeIEEE64BitFloatingPoint  = $646F7562 (* 'doub' *);
    type128BitFloatingPoint     = $6C64626C (* 'ldbl' *);
    typeDecimalStruct           = $6465636D (* 'decm' *);

    {    Non-preferred Apple event descriptor types     }
    typeSMInt                   = $73686F72 (* 'shor' *);
    typeShortInteger            = $73686F72 (* 'shor' *);
    typeInteger                 = $6C6F6E67 (* 'long' *);
    typeLongInteger             = $6C6F6E67 (* 'long' *);
    typeMagnitude               = $6D61676E (* 'magn' *);
    typeComp                    = $636F6D70 (* 'comp' *);
    typeSMFloat                 = $73696E67 (* 'sing' *);
    typeShortFloat              = $73696E67 (* 'sing' *);
    typeFloat                   = $646F7562 (* 'doub' *);
    typeLongFloat               = $646F7562 (* 'doub' *);
    typeExtended                = $65787465 (* 'exte' *);

    {    More Apple event descriptor types  }
    typeAEList                  = $6C697374 (* 'list' *);
    typeAERecord                = $7265636F (* 'reco' *);
    typeAppleEvent              = $61657674 (* 'aevt' *);
    typeEventRecord             = $65767263 (* 'evrc' *);
    typeTrue                    = $74727565 (* 'true' *);
    typeFalse                   = $66616C73 (* 'fals' *);
    typeAlias                   = $616C6973 (* 'alis' *);
    typeEnumerated              = $656E756D (* 'enum' *);
    typeType                    = $74797065 (* 'type' *);
    typeAppParameters           = $61707061 (* 'appa' *);
    typeProperty                = $70726F70 (* 'prop' *);
    typeFSS                     = $66737320 (* 'fss ' *);
    typeFSRef                   = $66737266 (* 'fsrf' *);
    typeFileURL                 = $6675726C (* 'furl' *);
    typeKeyword                 = $6B657977 (* 'keyw' *);
    typeSectionH                = $73656374 (* 'sect' *);
    typeWildCard                = $2A2A2A2A (* '****' *);
    typeApplSignature           = $7369676E (* 'sign' *);
    typeQDRectangle             = $71647274 (* 'qdrt' *);
    typeFixed                   = $66697864 (* 'fixd' *);
    typeProcessSerialNumber     = $70736E20 (* 'psn ' *);
    typeApplicationURL          = $6170726C (* 'aprl' *);
    typeNull                    = $6E756C6C (* 'null' *);                       {  null or nonexistent data  }


    {    Keywords for Apple event attributes    }
    keyTransactionIDAttr        = $7472616E (* 'tran' *);
    keyReturnIDAttr             = $72746964 (* 'rtid' *);
    keyEventClassAttr           = $6576636C (* 'evcl' *);
    keyEventIDAttr              = $65766964 (* 'evid' *);
    keyAddressAttr              = $61646472 (* 'addr' *);
    keyOptionalKeywordAttr      = $6F70746B (* 'optk' *);
    keyTimeoutAttr              = $74696D6F (* 'timo' *);
    keyInteractLevelAttr        = $696E7465 (* 'inte' *);                       {  this attribute is read only - will be set in AESend  }
    keyEventSourceAttr          = $65737263 (* 'esrc' *);                       {  this attribute is read only - returned as typeShortInteger  }
    keyMissedKeywordAttr        = $6D697373 (* 'miss' *);                       {  this attribute is read only  }
    keyOriginalAddressAttr      = $66726F6D (* 'from' *);                       {  new in 1.0.1  }
    keyAcceptTimeoutAttr        = $6163746D (* 'actm' *);                       {  new for Mac OS X  }


    {     Constants used for specifying the factoring of AEDescLists.   }
    kAEDescListFactorNone       = 0;
    kAEDescListFactorType       = 4;
    kAEDescListFactorTypeAndSize = 8;

    {    Constants used creating an AppleEvent  }
                                                                {  Constant for the returnID param of AECreateAppleEvent  }
    kAutoGenerateReturnID       = -1;                           {  AECreateAppleEvent will generate a session-unique ID  }
                                                                {  Constant for transaction IDÕs  }
    kAnyTransactionID           = 0;                            {  no transaction is in use  }

    {    Apple event manager data types     }

type
    DescType                            = ResType;
    AEKeyword                           = FourCharCode;
    AEDataStorage    = ^SInt32; { an opaque 32-bit type }
    AEDataStoragePtr = ^AEDataStorage;  { when a var xx:AEDataStorage parameter can be nil, it is changed to xx: AEDataStoragePtr }

    AEDescPtr = ^AEDesc;
    AEDesc = record
        descriptorType:         DescType;
        dataHandle:             AEDataStorage;
    end;

    AEKeyDescPtr = ^AEKeyDesc;
    AEKeyDesc = record
        descKey:                AEKeyword;
        descContent:            AEDesc;
    end;

    {    a list of AEDesc's is a special kind of AEDesc     }
    AEDescList                          = AEDesc;
    AEDescListPtr                       = ^AEDescList;
    {    AERecord is a list of keyworded AEDesc's   }
    AERecord                            = AEDescList;
    AERecordPtr                         = ^AERecord;
    {    an AEDesc which contains address data  }
    AEAddressDesc                       = AEDesc;
    AEAddressDescPtr                    = ^AEAddressDesc;
    {    an AERecord that contains an AppleEvent, and related data types    }
    AppleEvent                          = AERecord;
    AppleEventPtr                       = ^AppleEvent;
    AEReturnID                          = SInt16;
    AETransactionID                     = SInt32;
    AEEventClass                        = FourCharCode;
    AEEventID                           = FourCharCode;
    AEArrayType                         = SInt8;

const
    kAEDataArray                = 0;
    kAEPackedArray              = 1;
    kAEDescArray                = 3;
    kAEKeyDescArray             = 4;


    kAEHandleArray              = 2;


type
    AEArrayDataPtr = ^AEArrayData;
    AEArrayData = record
        case SInt16 of
        0: (
            kAEDataArray:       array [0..0] of SInt16;
            );
        1: (
            kAEPackedArray:     SInt8;
            );
        2: (
            kAEHandleArray:     array [0..0] of Handle;
            );
        3: (
            kAEDescArray:       array [0..0] of AEDesc;
            );
        4: (
            kAEKeyDescArray:    array [0..0] of AEKeyDesc;
            );
    end;

    AEArrayDataPointer                  = ^AEArrayData;
    AEArrayDataPointerPtr               = ^AEArrayDataPointer;
    {   *************************************************************************
      These constants are used by AEMach and AEInteraction APIs.  They are not
      strictly part of the data format, but are declared here due to layering.
    *************************************************************************   }
    AESendPriority              = SInt16;
const
    kAENormalPriority           = $00000000;                    {  post message at the end of the event queue  }
    kAEHighPriority             = $00000001;                    {  post message at the front of the event queue (same as nAttnMsg)  }



type
    AESendMode                  = SInt32;
const
    kAENoReply                  = $00000001;                    {  sender doesn't want a reply to event  }
    kAEQueueReply               = $00000002;                    {  sender wants a reply but won't wait  }
    kAEWaitReply                = $00000003;                    {  sender wants a reply and will wait  }
    kAEDontReconnect            = $00000080;                    {  don't reconnect if there is a sessClosedErr from PPCToolbox  }
    kAEWantReceipt              = $00000200;                    {  (nReturnReceipt) sender wants a receipt of message  }
    kAENeverInteract            = $00000010;                    {  server should not interact with user  }
    kAECanInteract              = $00000020;                    {  server may try to interact with user  }
    kAEAlwaysInteract           = $00000030;                    {  server should always interact with user where appropriate  }
    kAECanSwitchLayer           = $00000040;                    {  interaction may switch layer  }
    kAEDontRecord               = $00001000;                    {  don't record this event - available only in vers 1.0.1 and greater  }
    kAEDontExecute              = $00002000;                    {  don't send the event for recording - available only in vers 1.0.1 and greater  }
    kAEProcessNonReplyEvents    = $00008000;                    {  allow processing of non-reply events while awaiting synchronous AppleEvent reply  }


    {    Constants for timeout durations    }
    kAEDefaultTimeout           = -1;                           {  timeout value determined by AEM  }
    kNoTimeOut                  = -2;                           {  wait until reply comes back, however long it takes  }


    {   *************************************************************************
      These calls are used to set up and modify the coercion dispatch table.
    *************************************************************************   }

type
    AECoerceDescProcPtr = function(const (*var*) fromDesc: AEDesc; toType: DescType; handlerRefcon: SInt32; var toDesc: AEDesc): OSErr;

    AECoercePtrProcPtr = function(typeCode: DescType; dataPtr: UnivPtr; dataSize: Size; toType: DescType; handlerRefcon: SInt32; var result: AEDesc): OSErr;

    AECoerceDescUPP = ^SInt32; { an opaque UPP }
    AECoercePtrUPP = ^SInt32; { an opaque UPP }

const
    uppAECoerceDescProcInfo = $00003FE0;
    uppAECoercePtrProcInfo = $0003FFE0;
    {
     *  NewAECoerceDescUPP()
     *
     *  Availability:
     *    Non-Carbon CFM:   available as macro/inline
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function NewAECoerceDescUPP(userRoutine: AECoerceDescProcPtr): AECoerceDescUPP; external name '_NewAECoerceDescUPP'; { old name was NewAECoerceDescProc }
{
 *  NewAECoercePtrUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewAECoercePtrUPP(userRoutine: AECoercePtrProcPtr): AECoercePtrUPP; external name '_NewAECoercePtrUPP'; { old name was NewAECoercePtrProc }
{
 *  DisposeAECoerceDescUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeAECoerceDescUPP(userUPP: AECoerceDescUPP); external name '_DisposeAECoerceDescUPP';
{
 *  DisposeAECoercePtrUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeAECoercePtrUPP(userUPP: AECoercePtrUPP); external name '_DisposeAECoercePtrUPP';
{
 *  InvokeAECoerceDescUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeAECoerceDescUPP(const (*var*) fromDesc: AEDesc; toType: DescType; handlerRefcon: SInt32; var toDesc: AEDesc; userRoutine: AECoerceDescUPP): OSErr; external name '_InvokeAECoerceDescUPP'; { old name was CallAECoerceDescProc }
{
 *  InvokeAECoercePtrUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeAECoercePtrUPP(typeCode: DescType; dataPtr: UnivPtr; dataSize: Size; toType: DescType; handlerRefcon: SInt32; var result: AEDesc; userRoutine: AECoercePtrUPP): OSErr; external name '_InvokeAECoercePtrUPP'; { old name was CallAECoercePtrProc }
{ a AECoercionHandlerUPP is by default a AECoerceDescUPP.  If you are registering a
    Ptr based coercion handler you will have to add a cast to AECoerceDescUPP from
    your AECoercePtrUPP type.  A future release of the interfaces will fix this by
    introducing seperate Desc and Ptr coercion handler installation/remove/query routines. }

type
    AECoercionHandlerUPP                = AECoerceDescUPP;
    {
     *  AEInstallCoercionHandler()
     *
     *  Availability:
     *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function AEInstallCoercionHandler(fromType: DescType; toType: DescType; handler: AECoercionHandlerUPP; handlerRefcon: SInt32; fromTypeIsDesc: boolean; isSysHandler: boolean): OSErr; external name '_AEInstallCoercionHandler';
{
 *  AERemoveCoercionHandler()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function AERemoveCoercionHandler(fromType: DescType; toType: DescType; handler: AECoercionHandlerUPP; isSysHandler: boolean): OSErr; external name '_AERemoveCoercionHandler';
{
 *  AEGetCoercionHandler()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function AEGetCoercionHandler(fromType: DescType; toType: DescType; var handler: AECoercionHandlerUPP; var handlerRefcon: SInt32; var fromTypeIsDesc: boolean; isSysHandler: boolean): OSErr; external name '_AEGetCoercionHandler';
{*************************************************************************
  The following calls provide for a coercion interface.
*************************************************************************}
{
 *  AECoercePtr()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function AECoercePtr(typeCode: DescType; dataPtr: UnivPtr; dataSize: Size; toType: DescType; var result: AEDesc): OSErr; external name '_AECoercePtr';
{
 *  AECoerceDesc()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function AECoerceDesc(const (*var*) theAEDesc: AEDesc; toType: DescType; var result: AEDesc): OSErr; external name '_AECoerceDesc';
{*************************************************************************
 The following calls apply to any AEDesc. Every 'result' descriptor is
 created for you, so you will be responsible for memory management
 (including disposing) of the descriptors so created.
*************************************************************************}
{ because AEDescs are opaque under Carbon, this AEInitializeDesc provides a
   'clean' way of initializating them to be empty. }
{
 *  AEInitializeDesc()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.4 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure AEInitializeDesc(var desc: AEDesc); external name '_AEInitializeDesc';


{
 *  AECreateDesc()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function AECreateDesc(typeCode: DescType; dataPtr: UnivPtr; dataSize: Size; var result: AEDesc): OSErr; external name '_AECreateDesc';
{
 *  AEDisposeDesc()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function AEDisposeDesc(var theAEDesc: AEDesc): OSErr; external name '_AEDisposeDesc';
{
 *  AEDuplicateDesc()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function AEDuplicateDesc(const (*var*) theAEDesc: AEDesc; var result: AEDesc): OSErr; external name '_AEDuplicateDesc';
{*************************************************************************
  The following calls apply to AEDescList. Since AEDescList is a subtype of
  AEDesc, the calls in the previous section can also be used for AEDescList.
  All list and array indices are 1-based. If the data was greater than
  maximumSize in the routines below, then actualSize will be greater than
  maximumSize, but only maximumSize bytes will actually be retrieved.
*************************************************************************}
{
 *  AECreateList()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function AECreateList(factoringPtr: UnivPtr; factoredSize: Size; isRecord: boolean; var resultList: AEDescList): OSErr; external name '_AECreateList';
{
 *  AECountItems()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function AECountItems(const (*var*) theAEDescList: AEDescList; var theCount: SInt32): OSErr; external name '_AECountItems';
{
 *  AEPutPtr()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function AEPutPtr(var theAEDescList: AEDescList; index: SInt32; typeCode: DescType; dataPtr: UnivPtr; dataSize: Size): OSErr; external name '_AEPutPtr';
{
 *  AEPutDesc()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function AEPutDesc(var theAEDescList: AEDescList; index: SInt32; const (*var*) theAEDesc: AEDesc): OSErr; external name '_AEPutDesc';
{
 *  AEGetNthPtr()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function AEGetNthPtr(const (*var*) theAEDescList: AEDescList; index: SInt32; desiredType: DescType; var theAEKeyword: AEKeyword; var typeCode: DescType; dataPtr: UnivPtr; maximumSize: Size; var actualSize: Size): OSErr; external name '_AEGetNthPtr';
{
 *  AEGetNthDesc()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function AEGetNthDesc(const (*var*) theAEDescList: AEDescList; index: SInt32; desiredType: DescType; var theAEKeyword: AEKeyword; var result: AEDesc): OSErr; external name '_AEGetNthDesc';
{
 *  AESizeOfNthItem()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function AESizeOfNthItem(const (*var*) theAEDescList: AEDescList; index: SInt32; var typeCode: DescType; var dataSize: Size): OSErr; external name '_AESizeOfNthItem';
{
 *  AEGetArray()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function AEGetArray(const (*var*) theAEDescList: AEDescList; arrayType: AEArrayType; arrayPtr: AEArrayDataPointer; maximumSize: Size; var itemType: DescType; var itemSize: Size; var itemCount: SInt32): OSErr; external name '_AEGetArray';
{
 *  AEPutArray()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function AEPutArray(var theAEDescList: AEDescList; arrayType: AEArrayType; const (*var*) arrayPtr: AEArrayData; itemType: DescType; itemSize: Size; itemCount: SInt32): OSErr; external name '_AEPutArray';
{
 *  AEDeleteItem()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function AEDeleteItem(var theAEDescList: AEDescList; index: SInt32): OSErr; external name '_AEDeleteItem';
{*************************************************************************
 The following calls apply to AERecord. Since AERecord is a subtype of
 AEDescList, the calls in the previous sections can also be used for
 AERecord an AERecord can be created by using AECreateList with isRecord
 set to true.
*************************************************************************}
{************************************************************************
 AERecords can have an abitrary descriptorType.  This allows you to
 check if desc is truly an AERecord
***********************************************************************}
{
 *  AECheckIsRecord()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.4 and later
 *    Mac OS X:         in version 10.0 and later
 }
function AECheckIsRecord(const (*var*) theDesc: AEDesc): boolean; external name '_AECheckIsRecord';

{
  Note: none of the ÒkeyÓ calls were available in the PowerPC 7.x IntefaceLib.
  In C, a #define is used to map ÒkeyÓ calls to ÒparamÓ calls.  In pascal
  this mapping is done in externally linked glue code.
}

{*************************************************************************
  The following calls create and manipulate the AppleEvent data type.
*************************************************************************}
{
 *  AECreateAppleEvent()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function AECreateAppleEvent(theAEEventClass: AEEventClass; theAEEventID: AEEventID; const (*var*) target: AEAddressDesc; returnID: AEReturnID; transactionID: AETransactionID; var result: AppleEvent): OSErr; external name '_AECreateAppleEvent';
{*************************************************************************
  The following calls are used to pack and unpack parameters from records
  of type AppleEvent. Since AppleEvent is a subtype of AERecord, the calls
  in the previous sections can also be used for variables of type
  AppleEvent. The next six calls are in fact identical to the six calls
  for AERecord.
*************************************************************************}
{
 *  AEPutParamPtr()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function AEPutParamPtr(var theAppleEvent: AppleEvent; theAEKeyword: AEKeyword; typeCode: DescType; dataPtr: UnivPtr; dataSize: Size): OSErr; external name '_AEPutParamPtr';
{
 *  AEPutParamDesc()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function AEPutParamDesc(var theAppleEvent: AppleEvent; theAEKeyword: AEKeyword; const (*var*) theAEDesc: AEDesc): OSErr; external name '_AEPutParamDesc';
{
 *  AEGetParamPtr()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function AEGetParamPtr(const (*var*) theAppleEvent: AppleEvent; theAEKeyword: AEKeyword; desiredType: DescType; var typeCode: DescType; dataPtr: UnivPtr; maximumSize: Size; var actualSize: Size): OSErr; external name '_AEGetParamPtr';
{
 *  AEGetParamDesc()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function AEGetParamDesc(const (*var*) theAppleEvent: AppleEvent; theAEKeyword: AEKeyword; desiredType: DescType; var result: AEDesc): OSErr; external name '_AEGetParamDesc';
{
 *  AESizeOfParam()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function AESizeOfParam(const (*var*) theAppleEvent: AppleEvent; theAEKeyword: AEKeyword; var typeCode: DescType; var dataSize: Size): OSErr; external name '_AESizeOfParam';
{
 *  AEDeleteParam()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function AEDeleteParam(var theAppleEvent: AppleEvent; theAEKeyword: AEKeyword): OSErr; external name '_AEDeleteParam';
{*************************************************************************
 The following calls also apply to type AppleEvent. Message attributes are
 far more restricted, and can only be accessed through the following 5
 calls. The various list and record routines cannot be used to access the
 attributes of an event.
*************************************************************************}
{
 *  AEGetAttributePtr()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function AEGetAttributePtr(const (*var*) theAppleEvent: AppleEvent; theAEKeyword: AEKeyword; desiredType: DescType; var typeCode: DescType; dataPtr: UnivPtr; maximumSize: Size; var actualSize: Size): OSErr; external name '_AEGetAttributePtr';
{
 *  AEGetAttributeDesc()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function AEGetAttributeDesc(const (*var*) theAppleEvent: AppleEvent; theAEKeyword: AEKeyword; desiredType: DescType; var result: AEDesc): OSErr; external name '_AEGetAttributeDesc';
{
 *  AESizeOfAttribute()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function AESizeOfAttribute(const (*var*) theAppleEvent: AppleEvent; theAEKeyword: AEKeyword; var typeCode: DescType; var dataSize: Size): OSErr; external name '_AESizeOfAttribute';
{
 *  AEPutAttributePtr()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function AEPutAttributePtr(var theAppleEvent: AppleEvent; theAEKeyword: AEKeyword; typeCode: DescType; dataPtr: UnivPtr; dataSize: Size): OSErr; external name '_AEPutAttributePtr';
{
 *  AEPutAttributeDesc()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function AEPutAttributeDesc(var theAppleEvent: AppleEvent; theAEKeyword: AEKeyword; const (*var*) theAEDesc: AEDesc): OSErr; external name '_AEPutAttributeDesc';
{*************************************************************************
 AppleEvent Serialization Support

    AESizeOfFlattenedDesc, AEFlattenDesc, AEUnflattenDesc

    These calls will work for all AppleEvent data types and between different
    versions of the OS (including between Mac OS 9 and X)

    Basic types, AEDesc, AEList and AERecord are OK, but AppleEvent records
    themselves may not be reliably flattened for storage.
*************************************************************************}
{
   AEFlattenDesc
   Returns the amount of buffer space needed to flatten the
   AEDesc. Call this before AEFlattenDesc to make sure your
   buffer has enough room for the operation.
}

{
 *  AESizeOfFlattenedDesc()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.4 and later
 *    Mac OS X:         in version 10.0 and later
 }
function AESizeOfFlattenedDesc(const (*var*) theAEDesc: AEDesc): Size; external name '_AESizeOfFlattenedDesc';

{
   AEFlattenDesc
   Fills a buffer with a flattened representation of the
   AEDesc and returns the amount of buffer used in actualSize.
   If bufferSize was too small it returns errAEBufferTooSmall
   (-1741) and does not fill in any of the buffer. The resulting
   buffer is only useful with an AEUnflattenDesc call.

   Note: if you pass a NULL buffer pointer it returns noErr but
   fills in the actualSize field anyway.
}

{
 *  AEFlattenDesc()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.4 and later
 *    Mac OS X:         in version 10.0 and later
 }
function AEFlattenDesc(const (*var*) theAEDesc: AEDesc; buffer: Ptr; bufferSize: Size; var actualSize: Size): OSStatus; external name '_AEFlattenDesc';

{
   AEUnflattenDesc
   Allocates an AEDesc (given a Null Desc) given a flattened
   data buffer. It assumes it was given a good buffer filled
   in by AEFlattenDesc. It returns paramErr if it discovers
   something fishy about the buffer.
}

{
 *  AEUnflattenDesc()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.4 and later
 *    Mac OS X:         in version 10.0 and later
 }
function AEUnflattenDesc(buffer: Ptr; var result: AEDesc): OSStatus; external name '_AEUnflattenDesc';

{*************************************************************************
 The following calls are necessary to deal with opaque data in AEDescs, because the
 traditional way of dealing with a basic AEDesc has been to dereference the dataHandle
 directly.  This is not supported under Carbon.
*************************************************************************}
{
        AEGetDescData no longer supports automatic coercion. If you'd like to
        coerce the descriptor use AECoerceDesc.
    }
{
 *  AEGetDescData()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function AEGetDescData(const (*var*) theAEDesc: AEDesc; dataPtr: UnivPtr; maximumSize: Size): OSErr; external name '_AEGetDescData';

{
 *  AEGetDescDataSize()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function AEGetDescDataSize(const (*var*) theAEDesc: AEDesc): Size; external name '_AEGetDescDataSize';

{
 *  AEReplaceDescData()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function AEReplaceDescData(typeCode: DescType; dataPtr: UnivPtr; dataSize: Size; var theAEDesc: AEDesc): OSErr; external name '_AEReplaceDescData';



{*************************************************************************
  A AEEventHandler is installed to process an AppleEvent
*************************************************************************}

type
    AEEventHandlerProcPtr = function(const (*var*) theAppleEvent: AppleEvent; var reply: AppleEvent; handlerRefcon: SInt32): OSErr;

    AEEventHandlerUPP = ^SInt32; { an opaque UPP }

const
    uppAEEventHandlerProcInfo = $00000FE0;
    {
     *  NewAEEventHandlerUPP()
     *
     *  Availability:
     *    Non-Carbon CFM:   available as macro/inline
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function NewAEEventHandlerUPP(userRoutine: AEEventHandlerProcPtr): AEEventHandlerUPP; external name '_NewAEEventHandlerUPP'; { old name was NewAEEventHandlerProc }
{
 *  DisposeAEEventHandlerUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeAEEventHandlerUPP(userUPP: AEEventHandlerUPP); external name '_DisposeAEEventHandlerUPP';
{
 *  InvokeAEEventHandlerUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeAEEventHandlerUPP(const (*var*) theAppleEvent: AppleEvent; var reply: AppleEvent; handlerRefcon: SInt32; userRoutine: AEEventHandlerUPP): OSErr; external name '_InvokeAEEventHandlerUPP'; { old name was CallAEEventHandlerProc }
{$ALIGN MAC68K}
{#POP}
{unit AEMach}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}

{-
 * AE Mach API --
 *
 * AppleEvents on OS X are implemented in terms of mach messages.
 * To facilitate writing server processes that can send and receive
 * AppleEvents, the following APIs are provided.
 *
 * AppleEvents are directed to a well known port uniquely tied to a
 * process.  The AE framework will discover this port based on the
 * keyAddressAttr of the event (as specifed in AECreateAppleEvent by
 * the target parameter.)  If a port cannot be found,
 * procNotFound (-600) will be returned on AESend.
 *
 * Of note is a new attribute for an AppleEvent, typeReplyPortAttr.
 * This specifies the mach_port_t to which an AppleEvent reply
 * should be directed.  By default, replies are sent to the
 * processes registered port where they are culled from the normal
 * event stream if there is an outstanding AESend + kAEWaitReply.
 * But it may be desirable for a client to specify their own port to
 * receive quued replies.
 * (In the case of AESendMessage with kAEWaitReply specified, an
 * anonymous port will be used to block until the reply is received.)
 *
 * Not supplied is a convenience routine to block a server and
 * process AppleEvents.  This implementation will be detailed in a
 * tech note.
 *}

const
    typeReplyPortAttr           = $72657070 (* 'repp' *);


{$ALIGN MAC68K}
{#POP}
{unit AEUserTermTypes}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}


const
    kAEUserTerminology          = $61657574 (* 'aeut' *);                       {   0x61657574   }
    kAETerminologyExtension     = $61657465 (* 'aete' *);                       {   0x61657465   }
    kAEScriptingSizeResource    = $7363737A (* 'scsz' *);                       {   0x7363737a   }
    kAEOSAXSizeResource         = $6F73697A (* 'osiz' *);

    kAEUTHasReturningParam      = 31;                           {  if event has a keyASReturning param  }
    kAEUTOptional               = 15;                           {  if something is optional  }
    kAEUTlistOfItems            = 14;                           {  if property or reply is a list.  }
    kAEUTEnumerated             = 13;                           {  if property or reply is of an enumerated type.  }
    kAEUTReadWrite              = 12;                           {  if property is writable.  }
    kAEUTChangesState           = 12;                           {  if an event changes state.  }
    kAEUTTightBindingFunction   = 12;                           {  if this is a tight-binding precedence function.  }
                                                                {  AppleScript 1.3: new bits for reply, direct parameter, parameter, and property flags  }
    kAEUTEnumsAreTypes          = 11;                           {  if the enumeration is a list of types, not constants  }
    kAEUTEnumListIsExclusive    = 10;                           {  if the list of enumerations is a proper set  }
    kAEUTReplyIsReference       = 9;                            {  if the reply is a reference, not a value  }
    kAEUTDirectParamIsReference = 9;                            {  if the direct parameter is a reference, not a value  }
    kAEUTParamIsReference       = 9;                            {  if the parameter is a reference, not a value  }
    kAEUTPropertyIsReference    = 9;                            {  if the property is a reference, not a value  }
    kAEUTNotDirectParamIsTarget = 8;                            {  if the direct parameter is not the target of the event  }
    kAEUTParamIsTarget          = 8;                            {  if the parameter is the target of the event  }
    kAEUTApostrophe             = 3;                            {  if a term contains an apostrophe.  }
    kAEUTFeminine               = 2;                            {  if a term is feminine gender.  }
    kAEUTMasculine              = 1;                            {  if a term is masculine gender.  }
    kAEUTPlural                 = 0;                            {  if a term is plural.  }


type
    TScriptingSizeResourcePtr = ^TScriptingSizeResource;
    TScriptingSizeResource = record
        scriptingSizeFlags:     SInt16;
        minStackSize:           UInt32;
        preferredStackSize:     UInt32;
        maxStackSize:           UInt32;
        minHeapSize:            UInt32;
        preferredHeapSize:      UInt32;
        maxHeapSize:            UInt32;
    end;


const
    kLaunchToGetTerminology     = $8000;                        {     If kLaunchToGetTerminology is 0, 'aete' is read directly from res file.  If set to 1, then launch and use 'gdut' to get terminology.  }
    kDontFindAppBySignature     = $4000;                        {     If kDontFindAppBySignature is 0, then find app with signature if lost.  If 1, then don't  }
    kAlwaysSendSubject          = $2000;                        {     If kAlwaysSendSubject 0, then send subject when appropriate. If 1, then every event has Subject Attribute  }

    {    old names for above bits.  }
    kReadExtensionTermsMask     = $8000;

                                                                {  AppleScript 1.3: Bit positions for osiz resource  }
                                                                {  AppleScript 1.3: Bit masks for osiz resources  }
    kOSIZDontOpenResourceFile   = 15;                           {  If set, resource file is not opened when osax is loaded  }
    kOSIZdontAcceptRemoteEvents = 14;                           {  If set, handler will not be called with events from remote machines  }
    kOSIZOpenWithReadPermission = 13;                           {  If set, file will be opened with read permission only  }
    kOSIZCodeInSharedLibraries  = 11;                           {  If set, loader will look for handler in shared library, not osax resources  }

{$ALIGN MAC68K}
{#POP}
{unit AIFF}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}


const
    AIFFID                      = $41494646 (* 'AIFF' *);
    AIFCID                      = $41494643 (* 'AIFC' *);
    FormatVersionID             = $46564552 (* 'FVER' *);
    CommonID                    = $434F4D4D (* 'COMM' *);
    FORMID                      = $464F524D (* 'FORM' *);
    SoundDataID                 = $53534E44 (* 'SSND' *);
    MarkerID                    = $4D41524B (* 'MARK' *);
    InstrumentID                = $494E5354 (* 'INST' *);
    MIDIDataID                  = $4D494449 (* 'MIDI' *);
    AudioRecordingID            = $41455344 (* 'AESD' *);
    ApplicationSpecificID       = $4150504C (* 'APPL' *);
    CommentID                   = $434F4D54 (* 'COMT' *);
    NameID                      = $4E414D45 (* 'NAME' *);
    AuthorID                    = $41555448 (* 'AUTH' *);
    CopyrightID                 = $28632920 (* '(c) ' *);
    AnnotationID                = $414E4E4F (* 'ANNO' *);

    NoLooping                   = 0;
    ForwardLooping              = 1;
    ForwardBackwardLooping      = 2;

                                                                {  AIFF-C Versions  }
    AIFCVersion1                = $A2805140;

    {    Compression Names  }
    NoneName                    = 'not compressed';
    ACE2to1Name                 = 'ACE 2-to-1';
    ACE8to3Name                 = 'ACE 8-to-3';
    MACE3to1Name                = 'MACE 3-to-1';
    MACE6to1Name                = 'MACE 6-to-1';
                                                                {  Compression Types  }
    NoneType                    = $4E4F4E45 (* 'NONE' *);
    ACE2Type                    = $41434532 (* 'ACE2' *);
    ACE8Type                    = $41434538 (* 'ACE8' *);
    MACE3Type                   = $4D414333 (* 'MAC3' *);
    MACE6Type                   = $4D414336 (* 'MAC6' *);


type
    ID                                  = UInt32;
    MarkerIdType                        = SInt16;
    ChunkHeaderPtr = ^ChunkHeader;
    ChunkHeader = record
        ckID:                   ID;
        ckSize:                 SInt32;
    end;

    ContainerChunkPtr = ^ContainerChunk;
    ContainerChunk = record
        ckID:                   ID;
        ckSize:                 SInt32;
        formType:               ID;
    end;

    FormatVersionChunkPtr = ^FormatVersionChunk;
    FormatVersionChunk = record
        ckID:                   ID;
        ckSize:                 SInt32;
        timestamp:              UInt32;
    end;

    CommonChunkPtr = ^CommonChunk;
    CommonChunk = record
        ckID:                   ID;
        ckSize:                 SInt32;
        numChannels:            SInt16;
        numSampleFrames:        UInt32;
        sampleSize:             SInt16;
        sampleRate:             extended80;
    end;

    ExtCommonChunkPtr = ^ExtCommonChunk;
    ExtCommonChunk = record
        ckID:                   ID;
        ckSize:                 SInt32;
        numChannels:            SInt16;
        numSampleFrames:        UInt32;
        sampleSize:             SInt16;
        sampleRate:             extended80;
        compressionType:        ID;
        compressionName:        SInt8;                                  {  variable length array, Pascal string  }
    end;

    SoundDataChunkPtr = ^SoundDataChunk;
    SoundDataChunk = record
        ckID:                   ID;
        ckSize:                 SInt32;
        offset:                 UInt32;
        blockSize:              UInt32;
    end;

    MarkerPtr = ^Marker;
    Marker = record
        id:                     MarkerIdType;
        position:               UInt32;
        markerName:             Str255;
    end;

    MarkerChunkPtr = ^MarkerChunk;
    MarkerChunk = record
        ckID:                   ID;
        ckSize:                 SInt32;
        numMarkers:             UInt16;
        Markers:                array [0..0] of Marker;                 {  variable length array  }
    end;

    AIFFLoopPtr = ^AIFFLoop;
    AIFFLoop = record
        playMode:               SInt16;
        beginLoop:              MarkerIdType;
        endLoop:                MarkerIdType;
    end;

    InstrumentChunkPtr = ^InstrumentChunk;
    InstrumentChunk = packed record
        ckID:                   ID;
        ckSize:                 SInt32;
        baseFrequency:          UInt8;
        detune:                 UInt8;
        lowFrequency:           UInt8;
        highFrequency:          UInt8;
        lowVelocity:            UInt8;
        highVelocity:           UInt8;
        gain:                   SInt16;
        sustainLoop:            AIFFLoop;
        releaseLoop:            AIFFLoop;
    end;

    MIDIDataChunkPtr = ^MIDIDataChunk;
    MIDIDataChunk = record
        ckID:                   ID;
        ckSize:                 SInt32;
        MIDIdata:               SInt8;                                  {  variable length array  }
    end;

    AudioRecordingChunkPtr = ^AudioRecordingChunk;
    AudioRecordingChunk = record
        ckID:                   ID;
        ckSize:                 SInt32;
        AESChannelStatus:       packed array [0..23] of UInt8;
    end;

    ApplicationSpecificChunkPtr = ^ApplicationSpecificChunk;
    ApplicationSpecificChunk = record
        ckID:                   ID;
        ckSize:                 SInt32;
        applicationSignature:   OSType;
        data:                   SInt8;                                  {  variable length array  }
    end;

    CommentPtr = ^Comment;
    Comment = record
        timeStamp:              UInt32;
        marker:                 MarkerIdType;
        count:                  UInt16;
        text:                   SInt8;                                  {  variable length array, Pascal string  }
    end;

    CommentsChunkPtr = ^CommentsChunk;
    CommentsChunk = record
        ckID:                   ID;
        ckSize:                 SInt32;
        numComments:            UInt16;
        comments:               array [0..0] of Comment;                {  variable length array  }
    end;

    TextChunkPtr = ^TextChunk;
    TextChunk = record
        ckID:                   ID;
        ckSize:                 SInt32;
        text:                   SInt8;                                  {  variable length array, Pascal string  }
    end;

{$ALIGN MAC68K}
{#POP}
{unit AVLTree}
{$ALIGN MAC68K}










{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}


type
    AVLFlags                    = UInt32;
const
    kAVLFlagUseHandleForDataStorageMask = $00000001;

    {    The visit stage for AVLWalk() walkProcs    }

type
    AVLVisitStage               = UInt16;
const
    kAVLPreOrder                = 0;
    kAVLInOrder                 = 1;
    kAVLPostOrder               = 2;

    {    The order the tree is walked or disposed of.   }

type
    AVLOrder                    = UInt16;
const
    kAVLLeftToRight             = 0;
    kAVLRightToLeft             = 1;

    {    The type of the node being passed to a callback proc.  }

type
    AVLNodeType                 = UInt16;
const
    kAVLIsTree                  = 0;
    kAVLIsLeftBranch            = 1;
    kAVLIsRightBranch           = 2;
    kAVLIsLeaf                  = 3;
    kAVLNullNode                = 4;

    errItemAlreadyInTree        = -960;
    errNotValidTree             = -961;
    errItemNotFoundInTree       = -962;
    errCanNotInsertWhileWalkProcInProgress = -963;
    errTreeIsLocked             = -964;
    errTreeIsCorrupt            = -965;

    {   The structure of a tree.  It's opaque; don't assume it's 52 bytes in size. }

type
    AVLTreeStructPtr = ^AVLTreeStruct;
    AVLTreeStruct = record
        signature:              OSType;
        privateStuff:           array [0..11] of UInt32;
    end;

    AVLTreePtr                          = ^AVLTreeStruct;
    {
        Every tree must have a function which compares the data for two items and returns < 0, 0, or >0
        for the items - < 0 if the first item is 'before' the second item according to some criteria,
        == 0 if the two items are identical according to the criteria, or > 0 if the first item is
        'after' the second item according to the criteria.  The comparison function is also passed the
        node type, but most of the time this can be ignored.
    }
    AVLCompareItemsProcPtr = function(tree: AVLTreePtr; i1: UnivPtr; i2: UnivPtr; nd_typ: AVLNodeType): SInt32;

    {
        Every tree must have a itemSizeProc; this routine gets passed a pointer to the item's data and
        returns the size of the data.  If a tree contains records of a fixed size, this function can
        just return sizeof( that-struct ); otherwise it should calculate the size of the item based on
        the data for the item.
    }
    AVLItemSizeProcPtr = function(tree: AVLTreePtr; itemPtr: UnivPtr): UInt32;

    {
        A tree may have an optional disposeItemProc, which gets called whenever an item is removed
        from the tree ( via AVLRemove() or when AVLDispose() deletes all of the items in the tree ).
        This might be useful if the nodes in the tree own 'resources'  ( like, open files ) which
        should be released before the item is removed.
    }
    AVLDisposeItemProcPtr = procedure(tree: AVLTreePtr; dataP: UnivPtr);

    {
        The common way to iterate across all of the items in a tree is via AVLWalk(), which takes
        a walkProcPtr.  This function will get called for every item in the tree three times, as
        the tree is being walked across.  First, the walkProc will get called with visitStage ==
        kAVLPreOrder, at which point internally the node of the tree for the given data has just
        been reached.  Later, this function will get called with visitStage == kAVLInOrder, and
        lastly this function will get called with visitStage == kAVLPostOrder.
        The 'minimum' item in the tree will get called with visitStage == kInOrder first, followed
        by the 'next' item in the tree, up until the last item in the tree structure is called.
        In general, you'll only care about calls to this function when visitStage == kAVLInOrder.
    }
    AVLWalkProcPtr = function(tree: AVLTreePtr; dataP: UnivPtr; visitStage: AVLVisitStage; node: AVLNodeType; level: UInt32; balance: SInt32; refCon: UnivPtr): OSErr;

    AVLCompareItemsUPP = ^SInt32; { an opaque UPP }
    AVLItemSizeUPP = ^SInt32; { an opaque UPP }
    AVLDisposeItemUPP = ^SInt32; { an opaque UPP }
    AVLWalkUPP = ^SInt32; { an opaque UPP }

const
    uppAVLCompareItemsProcInfo = $00002FF0;
    uppAVLItemSizeProcInfo = $000003F0;
    uppAVLDisposeItemProcInfo = $000003C0;
    uppAVLWalkProcInfo = $000FEBE0;
    {
     *  NewAVLCompareItemsUPP()
     *
     *  Availability:
     *    Non-Carbon CFM:   available as macro/inline
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function NewAVLCompareItemsUPP(userRoutine: AVLCompareItemsProcPtr): AVLCompareItemsUPP; external name '_NewAVLCompareItemsUPP'; { old name was NewAVLCompareItemsProc }
{
 *  NewAVLItemSizeUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewAVLItemSizeUPP(userRoutine: AVLItemSizeProcPtr): AVLItemSizeUPP; external name '_NewAVLItemSizeUPP'; { old name was NewAVLItemSizeProc }
{
 *  NewAVLDisposeItemUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewAVLDisposeItemUPP(userRoutine: AVLDisposeItemProcPtr): AVLDisposeItemUPP; external name '_NewAVLDisposeItemUPP'; { old name was NewAVLDisposeItemProc }
{
 *  NewAVLWalkUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewAVLWalkUPP(userRoutine: AVLWalkProcPtr): AVLWalkUPP; external name '_NewAVLWalkUPP'; { old name was NewAVLWalkProc }
{
 *  DisposeAVLCompareItemsUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeAVLCompareItemsUPP(userUPP: AVLCompareItemsUPP); external name '_DisposeAVLCompareItemsUPP';
{
 *  DisposeAVLItemSizeUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeAVLItemSizeUPP(userUPP: AVLItemSizeUPP); external name '_DisposeAVLItemSizeUPP';
{
 *  DisposeAVLDisposeItemUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeAVLDisposeItemUPP(userUPP: AVLDisposeItemUPP); external name '_DisposeAVLDisposeItemUPP';
{
 *  DisposeAVLWalkUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeAVLWalkUPP(userUPP: AVLWalkUPP); external name '_DisposeAVLWalkUPP';
{
 *  InvokeAVLCompareItemsUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeAVLCompareItemsUPP(tree: AVLTreePtr; i1: UnivPtr; i2: UnivPtr; nd_typ: AVLNodeType; userRoutine: AVLCompareItemsUPP): SInt32; external name '_InvokeAVLCompareItemsUPP'; { old name was CallAVLCompareItemsProc }
{
 *  InvokeAVLItemSizeUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeAVLItemSizeUPP(tree: AVLTreePtr; itemPtr: UnivPtr; userRoutine: AVLItemSizeUPP): UInt32; external name '_InvokeAVLItemSizeUPP'; { old name was CallAVLItemSizeProc }
{
 *  InvokeAVLDisposeItemUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvokeAVLDisposeItemUPP(tree: AVLTreePtr; dataP: UnivPtr; userRoutine: AVLDisposeItemUPP); external name '_InvokeAVLDisposeItemUPP'; { old name was CallAVLDisposeItemProc }
{
 *  InvokeAVLWalkUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeAVLWalkUPP(tree: AVLTreePtr; dataP: UnivPtr; visitStage: AVLVisitStage; node: AVLNodeType; level: UInt32; balance: SInt32; refCon: UnivPtr; userRoutine: AVLWalkUPP): OSErr; external name '_InvokeAVLWalkUPP'; { old name was CallAVLWalkProc }
{
    Create an AVL tree.  The compareItemsProc and the sizeItemProc are required; disposeItemProc is
    optional and can be nil.  The refCon is stored with the list, and is passed back to the
    compareItemsProc, sizeItemProc, and disposeItemsProc calls.  The allocation of the tree ( and all
    nodes later added to the list with AVLInsert ) will be created in what is the current zone at the
    time AVLInit() is called.  Always call AVLDispose() to dispose of a list created with AVLInit().
}
{
 *  AVLInit()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function AVLInit(flags: UInt32; compareItemsProc: AVLCompareItemsUPP; sizeItemProc: AVLItemSizeUPP; disposeItemProc: AVLDisposeItemUPP; refCon: UnivPtr; var tree: AVLTreePtr): OSErr; external name '_AVLInit';
{
    Dispose of an AVL tree.  This will dispose of each item in the tree in the order specified,
    call the tree's disposeProc proc for each item, and then dispose of the space allocated for
    the tree itself.
}
{
 *  AVLDispose()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function AVLDispose(var tree: AVLTreePtr; order: AVLOrder): OSErr; external name '_AVLDispose';
{
    Iterate across all of the items in the tree, in the order specified.  kLeftToRight is
    basically lowest-to-highest order, kRightToLeft is highest-to-lowest order.  For each
    node in the tree, it will call the walkProc with three messages ( at the appropriate
    time ).  First, with kAVLPreOrder when the walking gets to this node in the tree,
    before handling either the left or right subtree, secondly, with kAVLInOrder after
    handling one subtree but before handling the other, and lastly with kAVLPostOrder after
    handling both subtrees.  If you want to handle items in order, then only do something
    if the visit stage is kAVLInOrder.  You can only call AVLRemove() from inside a walkProc
    if visit stage is kAVLPostOrder ( because if you remove a node during the pre or in order
    stages you will corrupt the list ) OR if you return a non-zero result from the walkProc
    call which called AVLRemove() to immediately terminate the walkProc.  Do not call AVLInsert()
    to insert a node into the tree from inside a walkProc.
    The walkProc function gets called with the AVLTreePtr, a pointer to the data for the
    current node ( which you can change in place as long as you do not affect the order within
    the tree ), the visit stage, the type of the current node ( leaf node, right or left branch,
    or full tree ), the level within the tree ( the root is level 1 ), the balance for the
    current node, and the refCon passed to AVLWalk().  This refCon is different from the one passed
    into AVLInit(); use AVLGetRefCon() to get that refCon if you want it inside a walkProc.
    ( Most walkProcs will not care about the values for node type, level, or balance. )
}
{
 *  AVLWalk()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function AVLWalk(tree: AVLTreePtr; walkProc: AVLWalkUPP; order: AVLOrder; walkRefCon: UnivPtr): OSErr; external name '_AVLWalk';
{   Return  the number of items in the given tree. }
{
 *  AVLCount()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function AVLCount(tree: AVLTreePtr; var count: UInt32): OSErr; external name '_AVLCount';
{
    Return the one-based index-th item from the tree by putting it's data at dataPtr
    if dataPtr is non-nil, and it's size into *itemSize if itemSize is non-nil.
    If index is out of range, return errItemNotFoundInTree.  ( Internally, this does
    an AVLWalk(), so the tree can not be modified while this call is in progress ).
}
{
 *  AVLGetIndItem()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function AVLGetIndItem(tree: AVLTreePtr; index: UInt32; dataPtr: UnivPtr; var itemSize: UInt32): OSErr; external name '_AVLGetIndItem';
{
    Insert the given item into the tree.  This will call the tree's sizeItemProc
    to determine how big the item at data is, and then will make a copy of the
    item and insert it into the tree in the appropriate place.  If an item already
    exists in the tree with the same key ( so that the compareItemsUPP returns 0
    when asked to compare this item to an existing one ), then it will return
    errItemNotFoundInTree.
}
{
 *  AVLInsert()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function AVLInsert(tree: AVLTreePtr; data: UnivPtr): OSErr; external name '_AVLInsert';
{
    Remove any item from the tree with the given key.  If dataPtr != nil, then
    copy the item's data to dataPtr before removing it from the tree.  Before
    removing the item, call the tree's disposeItemProc to let it release anything
    used by the data in the tree.  It is not necessary to fill in a complete
    record for key, only that the compareItemsProc return 0 when asked to compare
    the data at key with the node in the tree to be deleted.  If the item cannot
    be found in the tree, this will return errItemNotFoundInTree.
}
{
 *  AVLRemove()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function AVLRemove(tree: AVLTreePtr; key: UnivPtr; dataPtr: UnivPtr; var itemSize: UInt32): OSErr; external name '_AVLRemove';
{
    Find the item in the tree with the given key, and return it's data in
    dataPtr ( if dataPtr != nil ), and it's size in *itemSize ( if itemSize
    != nil ).  It is not necessary to fill in a complete record for key,
    only that the compareItemsProc return 0 when asked to compare the data
    at key with the node in the tree to be deleted.  If the item cannot
    be found in the tree, this will return errItemNotFoundInTree.
}
{
 *  AVLFind()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function AVLFind(tree: AVLTreePtr; key: UnivPtr; dataPtr: UnivPtr; var itemSize: UInt32): OSErr; external name '_AVLFind';
{
    Get the refCon for the given tree ( set in AVLInit ) and return it.
    If the given tree is invalid, then return nil.
}
{
 *  AVLGetRefcon()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function AVLGetRefcon(tree: AVLTreePtr; var refCon: UnivPtr): OSErr; external name '_AVLGetRefcon';
{
    Get the refCon for the given tree ( set in AVLInit ) and return it.
    If the given tree is invalid, then return nil.
}

{$ALIGN MAC68K}
{#POP}
{unit AXConstants}
{$ALIGN MAC68K}





// standard attributes
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXRoleAttribute CFSTRP('AXRole')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXRoleDescriptionAttribute CFSTRP('AXRoleDescription')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXSubroleAttribute CFSTRP('AXSubrole')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXHelpAttribute CFSTRP('AXHelp')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXTitleAttribute CFSTRP('AXTitle')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXValueAttribute CFSTRP('AXValue')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXMinValueAttribute CFSTRP('AXMinValue')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXMaxValueAttribute CFSTRP('AXMaxValue')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXEnabledAttribute CFSTRP('AXEnabled')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXFocusedAttribute CFSTRP('AXFocused')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXParentAttribute CFSTRP('AXParent')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXChildrenAttribute CFSTRP('AXChildren')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXSelectedChildrenAttribute CFSTRP('AXSelectedChildren')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXVisibleChildrenAttribute CFSTRP('AXVisibleChildren')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXWindowAttribute CFSTRP('AXWindow')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXPositionAttribute CFSTRP('AXPosition')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXSizeAttribute CFSTRP('AXSize')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXOrientationAttribute CFSTRP('AXOrientation')}
{$endc}

// text-specific attributes
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXTextAttribute CFSTRP('AXText')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXSelectedTextAttribute CFSTRP('AXSelectedText')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXSelectedTextRangeAttribute CFSTRP('AXSelectedTextRange')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXVisibleTextAttribute CFSTRP('AXVisibleText')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXVisibleCharacterRangeAttribute CFSTRP('AXVisibleCharacterRange')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXNumberOfCharactersAttribute CFSTRP('AXNumberOfCharacters')}
{$endc}

// window-specific attributes
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXMainAttribute CFSTRP('AXMain')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXMinimizedAttribute CFSTRP('AXMinimized')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXCloseButtonAttribute CFSTRP('AXCloseButton')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXZoomButtonAttribute CFSTRP('AXZoomButton')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXMinimizeButtonAttribute CFSTRP('AXMinimizeButton')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXToolbarButtonAttribute CFSTRP('AXToolbarButton')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXProxyAttribute CFSTRP('AXProxy')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXGrowAreaAttribute CFSTRP('AXGrowArea')}
{$endc}

// new window-specific attributes
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXModalAttribute CFSTRP('AXModal')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXDefaultButtonAttribute CFSTRP('AXDefaultButton')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXCancelButtonAttribute CFSTRP('AXCancelButton')}
{$endc}

// menu-specific attributes
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXMenuItemCmdCharAttribute CFSTRP('AXMenuItemCmdChar')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXMenuItemCmdVirtualKeyAttribute CFSTRP('AXMenuItemCmdVirtualKey')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXMenuItemCmdGlyphAttribute CFSTRP('AXMenuItemCmdGlyph')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXMenuItemCmdModifiersAttribute CFSTRP('AXMenuItemCmdModifiers')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXMenuItemMarkCharAttribute CFSTRP('AXMenuItemMarkChar')}
{$endc}

// application-specific attributes
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXMenuBarAttribute CFSTRP('AXMenuBar')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXWindowsAttribute CFSTRP('AXWindows')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXFrontmostAttribute CFSTRP('AXFrontmost')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXHiddenAttribute CFSTRP('AXHidden')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXMainWindowAttribute CFSTRP('AXMainWindow')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXFocusedWindowAttribute CFSTRP('AXFocusedWindow')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXFocusedUIElementAttribute CFSTRP('AXFocusedUIElement')}
{$endc}

// misc attributes
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXHeaderAttribute CFSTRP('AXHeader')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXEditedAttribute CFSTRP('AXEdited')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXValueIncrementAttribute CFSTRP('AXValueIncrement')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXValueWrapsAttribute CFSTRP('AXValueWraps')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXTabsAttribute CFSTRP('AXTabs')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXTitleUIElementAttribute CFSTRP('AXTitleUIElement')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXHorizontalScrollBarAttribute CFSTRP('AXHorizontalScrollBar')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXVerticalScrollBarAttribute CFSTRP('AXVerticalScrollBar')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXOverflowButtonAttribute CFSTRP('AXOverflowButton')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXFilenameAttribute CFSTRP('AXFilename')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXExpandedAttribute CFSTRP('AXExpanded')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXSelectedAttribute CFSTRP('AXSelected')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXSplittersAttribute CFSTRP('AXSplitters')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXNextContentsAttribute CFSTRP('AXNextContents')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXDocumentAttribute CFSTRP('AXDocument')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXDecrementButtonAttribute CFSTRP('AXDecrementButton')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXIncrementButtonAttribute CFSTRP('AXIncrementButton')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXPreviousContentsAttribute CFSTRP('AXPreviousContents')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXContentsAttribute CFSTRP('AXContents')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXIncrementorAttribute CFSTRP('AXIncrementor')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXHourFieldAttribute CFSTRP('AXHourField')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXMinuteFieldAttribute CFSTRP('AXMinuteField')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXSecondFieldAttribute CFSTRP('AXSecondField')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXAMPMFieldAttribute CFSTRP('AXAMPMField')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXDayFieldAttribute CFSTRP('AXDayField')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXMonthFieldAttribute CFSTRP('AXMonthField')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXYearFieldAttribute CFSTRP('AXYearField')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXColumnTitlesAttribute CFSTRP('AXColumnTitles')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXURLAttribute CFSTRP('AXURL')}
{$endc}

// table/outline view attributes
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXRowsAttribute CFSTRP('AXRows')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXVisibleRowsAttribute CFSTRP('AXVisibleRows')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXSelectedRowsAttribute CFSTRP('AXSelectedRows')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXColumnsAttribute CFSTRP('AXColumns')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXVisibleColumnsAttribute CFSTRP('AXVisibleColumns')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXSelectedColumnsAttribute CFSTRP('AXSelectedColumns')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXSortDirectionAttribute CFSTRP('AXSortDirection')}
{$endc}

// outline attributes
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXDisclosingAttribute CFSTRP('AXDisclosing')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXDisclosedRowsAttribute CFSTRP('AXDisclosedRows')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXDisclosedByRowAttribute CFSTRP('AXDisclosedByRow')}
{$endc}

// system-wide attributes
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXFocusedApplicationAttribute CFSTRP('AXFocusedApplication')}
{$endc}

//
// Parameterized Attributes
//

// Text Suite Parameterized Attributes
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXLineForIndexParameterizedAttribute CFSTRP('AXLineForIndex')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXRangeForLineParameterizedAttribute CFSTRP('AXRangeForLine')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXStringForRangeParameterizedAttribute CFSTRP('AXStringForRange')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXRangeForPositionParameterizedAttribute CFSTRP('AXRangeForPosition')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXRangeForIndexParameterizedAttribute CFSTRP('AXRangeForIndex')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXBoundsForRangeParameterizedAttribute CFSTRP('AXBoundsForRange')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXRTFForRangeParameterizedAttribute CFSTRP('AXRTFForRange')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXStyleRangeForIndexParameterizedAttribute CFSTRP('AXStyleRangeForIndex')}
{$endc}

//
// standard values
//

// orientations (see kAXOrientationAttribute)
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXHorizontalOrientationValue CFSTRP('AXHorizontalOrientation')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXVerticalOrientationValue CFSTRP('AXVerticalOrientation')}
{$endc}

// standard actions
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXPressAction CFSTRP('AXPress')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXIncrementAction CFSTRP('AXIncrement')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXDecrementAction CFSTRP('AXDecrement')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXConfirmAction CFSTRP('AXConfirm')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXPickAction CFSTRP('AXPick')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXCancelAction CFSTRP('AXCancel')}
{$endc}

// new actions
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXRaiseAction CFSTRP('AXRaise')}
{$endc}

// standard roles
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXApplicationRole CFSTRP('AXApplication')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXSystemWideRole CFSTRP('AXSystemWide')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXWindowRole CFSTRP('AXWindow')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXSheetRole CFSTRP('AXSheet')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXDrawerRole CFSTRP('AXDrawer')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXGrowAreaRole CFSTRP('AXGrowArea')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXImageRole CFSTRP('AXImage')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXUnknownRole CFSTRP('AXUnknown')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXButtonRole CFSTRP('AXButton')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXRadioButtonRole CFSTRP('AXRadioButton')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXCheckBoxRole CFSTRP('AXCheckBox')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXPopUpButtonRole CFSTRP('AXPopUpButton')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXMenuButtonRole CFSTRP('AXMenuButton')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXTabGroupRole CFSTRP('AXTabGroup')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXTableRole CFSTRP('AXTable')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXColumnRole CFSTRP('AXColumn')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXRowRole CFSTRP('AXRow')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXOutlineRole CFSTRP('AXOutline')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXBrowserRole CFSTRP('AXBrowser')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXScrollAreaRole CFSTRP('AXScrollArea')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXScrollBarRole CFSTRP('AXScrollBar')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXRadioGroupRole CFSTRP('AXRadioGroup')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXListRole CFSTRP('AXList')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXGroupRole CFSTRP('AXGroup')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXValueIndicatorRole CFSTRP('AXValueIndicator')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXComboBoxRole CFSTRP('AXComboBox')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXSliderRole CFSTRP('AXSlider')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXIncrementorRole CFSTRP('AXIncrementor')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXBusyIndicatorRole CFSTRP('AXBusyIndicator')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXProgressIndicatorRole CFSTRP('AXProgressIndicator')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXToolbarRole CFSTRP('AXToolbar')}
{$endc}

{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXTextFieldRole CFSTRP('AXTextField')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXTextAreaRole CFSTRP('AXTextArea')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXStaticTextRole CFSTRP('AXStaticText')}
{$endc}

{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXMenuBarRole CFSTRP('AXMenuBar')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXMenuBarItemRole CFSTRP('AXMenuBarItem')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXMenuRole CFSTRP('AXMenu')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXMenuItemRole CFSTRP('AXMenuItem')}
{$endc}

{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXSplitGroupRole CFSTRP('AXSplitGroup')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXSplitterRole CFSTRP('AXSplitter')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXColorWellRole CFSTRP('AXColorWell')}
{$endc}

{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXTimeFieldRole CFSTRP('AXTimeField')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXDateFieldRole CFSTRP('AXDateField')}
{$endc}

// standard subroles
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXCloseButtonSubrole CFSTRP('AXCloseButton')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXMinimizeButtonSubrole CFSTRP('AXMinimizeButton')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXZoomButtonSubrole CFSTRP('AXZoomButton')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXToolbarButtonSubrole CFSTRP('AXToolbarButton')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXSecureTextFieldSubrole CFSTRP('AXSecureTextField')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXTableRowSubrole CFSTRP('AXTableRow')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXOutlineRowSubrole CFSTRP('AXOutlineRow')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXUnknownSubrole CFSTRP('AXUnknown')}
{$endc}

// new subroles
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXStandardWindowSubrole CFSTRP('AXStandardWindow')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXDialogSubrole CFSTRP('AXDialog')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXSystemDialogSubrole CFSTRP('AXSystemDialog')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXFloatingWindowSubrole CFSTRP('AXFloatingWindow')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXSystemFloatingWindowSubrole CFSTRP('AXSystemFloatingWindow')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXIncrementArrowSubrole CFSTRP('AXIncrementArrow')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXDecrementArrowSubrole CFSTRP('AXDecrementArrow')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXIncrementPageSubrole CFSTRP('AXIncrementPage')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXDecrementPageSubrole CFSTRP('AXDecrementPage')}
{$endc}

// focus notifications
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXMainWindowChangedNotification CFSTRP('AXMainWindowChanged')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXFocusedWindowChangedNotification CFSTRP('AXFocusedWindowChanged')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXFocusedUIElementChangedNotification CFSTRP('AXFocusedUIElementChanged')}
{$endc}

// application notifications
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXApplicationActivatedNotification CFSTRP('AXApplicationActivated')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXApplicationDeactivatedNotification CFSTRP('AXApplicationDeactivated')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXApplicationHiddenNotification CFSTRP('AXApplicationHidden')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXApplicationShownNotification CFSTRP('AXApplicationShown')}
{$endc}

// window notifications
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXWindowCreatedNotification CFSTRP('AXWindowCreated')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXWindowMovedNotification CFSTRP('AXWindowMoved')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXWindowResizedNotification CFSTRP('AXWindowResized')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXWindowMiniaturizedNotification CFSTRP('AXWindowMiniaturized')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXWindowDeminiaturizedNotification CFSTRP('AXWindowDeminiaturized')}
{$endc}

// new drawer & sheet notifications
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXDrawerCreatedNotification CFSTRP('AXDrawerCreated')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXSheetCreatedNotification CFSTRP('AXSheetCreated')}
{$endc}

// element notifications
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXValueChangedNotification CFSTRP('AXValueChanged')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXUIElementDestroyedNotification CFSTRP('AXUIElementDestroyed')}
{$endc}

// menu notifications
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXMenuOpenedNotification CFSTRP('AXMenuOpened')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXMenuClosedNotification CFSTRP('AXMenuClosed')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXMenuItemSelectedNotification CFSTRP('AXMenuItemSelected')}
{$endc}


// obsolete constants will be removed soon
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXRelevanceIndicatorRole CFSTRP('AXRelevanceIndicator')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kAXIsEditableAttribute CFSTRP('AXIsEditable')}
{$endc}
{unit AXErrors}
{$ALIGN MAC68K}





const
    kAXErrorSuccess                 = 0;
    kAXErrorFailure             = -25200;
    kAXErrorIllegalArgument         = -25201;
    kAXErrorInvalidUIElement            = -25202;
    kAXErrorInvalidUIElementObserver        = -25203;
    kAXErrorCannotComplete          = -25204;
    kAXErrorAttributeUnsupported        = -25205;
    kAXErrorActionUnsupported           = -25206;
    kAXErrorNotificationUnsupported     = -25207;
    kAXErrorNotImplemented          = -25208;
    kAXErrorNotificationAlreadyRegistered   = -25209;
    kAXErrorNotificationNotRegistered       = -25210;
    kAXErrorAPIDisabled             = -25211;
    kAXErrorNoValue             = -25212;
    kAXErrorParameterizedAttributeUnsupported   = -25213;

type
  AXError = SInt32;
{unit AppleDiskPartitions}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}

{ Block 0 Definitions }

const
    sbSIGWord                   = $4552;                        {  signature word for Block 0 ('ER')  }
    sbMac                       = 1;                            {  system type for Mac  }

    {    Partition Map Signatures   }
    pMapSIG                     = $504D;                        {  partition map signature ('PM')  }
    pdSigWord                   = $5453;                        {  partition map signature ('TS')  }
    oldPMSigWord                = $5453;
    newPMSigWord                = $504D;


    {    Driver Descriptor Map  }

type
    Block0Ptr = ^Block0;
    Block0 = packed record
        sbSig:                  UInt16;                                 {  unique value for SCSI block 0  }
        sbBlkSize:              UInt16;                                 {  block size of device  }
        sbBlkCount:             UInt32;                                 {  number of blocks on device  }
        sbDevType:              UInt16;                                 {  device type  }
        sbDevId:                UInt16;                                 {  device id  }
        sbData:                 UInt32;                                 {  not used  }
        sbDrvrCount:            UInt16;                                 {  driver descriptor count  }
        ddBlock:                UInt32;                                 {  1st driver's starting block  }
        ddSize:                 UInt16;                                 {  size of 1st driver (512-byte blks)  }
        ddType:                 UInt16;                                 {  system type (1 for Mac+)  }
        ddPad:                  array [0..242] of UInt16;               {  array[0..242] of SInt16; not used  }
    end;

    {    Driver descriptor  }
    DDMapPtr = ^DDMap;
    DDMap = record
        ddBlock:                UInt32;                                 {  1st driver's starting block  }
        ddSize:                 UInt16;                                 {  size of 1st driver (512-byte blks)  }
        ddType:                 UInt16;                                 {  system type (1 for Mac+)  }
    end;

    {    Constants for the ddType field of the DDMap structure.     }

const
    kDriverTypeMacSCSI          = $0001;
    kDriverTypeMacATA           = $0701;
    kDriverTypeMacSCSIChained   = $FFFF;
    kDriverTypeMacATAChained    = $F8FF;

    {    Partition Map Entry    }

type
    PartitionPtr = ^Partition;
    Partition = packed record
        pmSig:                  UInt16;                                 {  unique value for map entry blk  }
        pmSigPad:               UInt16;                                 {  currently unused  }
        pmMapBlkCnt:            UInt32;                                 {  # of blks in partition map  }
        pmPyPartStart:          UInt32;                                 {  physical start blk of partition  }
        pmPartBlkCnt:           UInt32;                                 {  # of blks in this partition  }
        pmPartName:             packed array [0..31] of UInt8;          {  ASCII partition name  }
        pmParType:              packed array [0..31] of UInt8;          {  ASCII partition type  }
        pmLgDataStart:          UInt32;                                 {  log. # of partition's 1st data blk  }
        pmDataCnt:              UInt32;                                 {  # of blks in partition's data area  }
        pmPartStatus:           UInt32;                                 {  bit field for partition status  }
        pmLgBootStart:          UInt32;                                 {  log. blk of partition's boot code  }
        pmBootSize:             UInt32;                                 {  number of bytes in boot code  }
        pmBootAddr:             UInt32;                                 {  memory load address of boot code  }
        pmBootAddr2:            UInt32;                                 {  currently unused  }
        pmBootEntry:            UInt32;                                 {  entry point of boot code  }
        pmBootEntry2:           UInt32;                                 {  currently unused  }
        pmBootCksum:            UInt32;                                 {  checksum of boot code  }
        pmProcessor:            packed array [0..15] of UInt8;          {  ASCII for the processor type  }
        pmPad:                  array [0..187] of UInt16;               {  array[0..187] of SInt16; not used  }
    end;


    {    Flags for the pmPartStatus field of the Partition data structure.  }

const
    kPartitionAUXIsValid        = $00000001;
    kPartitionAUXIsAllocated    = $00000002;
    kPartitionAUXIsInUse        = $00000004;
    kPartitionAUXIsBootValid    = $00000008;
    kPartitionAUXIsReadable     = $00000010;
    kPartitionAUXIsWriteable    = $00000020;
    kPartitionAUXIsBootCodePositionIndependent = $00000040;
    kPartitionIsWriteable       = $00000020;
    kPartitionIsMountedAtStartup = $40000000;
    kPartitionIsStartup         = $80000000;
    kPartitionIsChainCompatible = $00000100;
    kPartitionIsRealDeviceDriver = $00000200;
    kPartitionCanChainToNext    = $00000400;




    {    Well known driver signatures, stored in the first four byte of pmPad.  }
    kPatchDriverSignature       = $70744452 (* 'ptDR' *);                       {  SCSI and ATA[PI] patch driver     }
    kSCSIDriverSignature        = $00010600;                    {  SCSI  hard disk driver            }
    kATADriverSignature         = $77696B69 (* 'wiki' *);                       {  ATA   hard disk driver            }
    kSCSICDDriverSignature      = $43447672 (* 'CDvr' *);                       {  SCSI  CD-ROM    driver            }
    kATAPIDriverSignature       = $41545049 (* 'ATPI' *);                       {  ATAPI CD-ROM    driver            }
    kDriveSetupHFSSignature     = $44535531 (* 'DSU1' *);                       {  Drive Setup HFS partition         }



{$ALIGN MAC68K}
{#POP}
{unit Authorization}
{$ALIGN MAC68K}





{!
    @header Authorization
    Version 1.0 10/16/2000

    The Authorization API contains all the APIs that a application or tool that need pre-authorization or need an authorization desision made.

    A typical use cases are a preference panel that would start off calling AuthorizationCreate() (without UI) to get an authorization object.  Then call AuthorizationCopyRights() to figure out what is currently allowed.

    If any of the operations that the preference panel wishes to perform are currently not allowed the lock icon in the window would show up in the locked state.  Otherwise it would show up unlocked.

    When the user locks the lock AuthorizationFree() is called with the kAuthorizationFlagDestroyRights to destroy any authorization rights that have been aquired.

    When the user unlocks the lock AuthorizationCreate() is called with the kAuthorizationFlagInteractionAllowed and kAuthorizationFlagExtendRights flags to obtain all required rights.  The old authorization object can be freed by calling AuthorizationFree() with no flags.

}



{!
    @defined kAuthorizationEmptyEnvironment
    Parameter to specify to AuthorizationCreate when no environment is being provided.
}
const kAuthorizationEmptyEnvironment = nil;


{!
    @enum AuthorizationStatus
    Error codes returned by Authorization API.
}

{
    Note: the comments that appear after these errors are used to create SecErrorMessages.strings.
    The comments must not be multi-line, and should be in a form meaningful to an end user. If
    a different or additional comment is needed, it can be put in the header doc format, or on a
    line that does not start with errZZZ.
}

const
    errAuthorizationSuccess                 = 0;      { The operation completed successfully. }
    errAuthorizationInvalidSet              = -60001; { The set parameter is invalid. }
    errAuthorizationInvalidRef              = -60002; { The authorization parameter is invalid. }
    errAuthorizationInvalidTag              = -60003; { The tag parameter is invalid. }
    errAuthorizationInvalidPointer          = -60004; { The authorizedRights parameter is invalid. }
    errAuthorizationDenied                  = -60005; { The authorization was denied. }
    errAuthorizationCanceled                = -60006; { The authorization was cancelled by the user. }
    errAuthorizationInteractionNotAllowed   = -60007; { The authorization was denied since no user interaction was possible. }
    errAuthorizationInternal                = -60008; { something else went wrong }
    errAuthorizationExternalizeNotAllowed   = -60009; { authorization externalization denied }
    errAuthorizationInternalizeNotAllowed   = -60010; { authorization internalization denied }
    errAuthorizationInvalidFlags            = -60011; { invalid option flag(s) }
    errAuthorizationToolExecuteFailure      = -60031; { cannot execute privileged tool }
    errAuthorizationToolEnvironmentError    = -60032; { privileged tool environment error }
    errAuthorizationBadAddress              = -60033; { invalid socket address requested }


{!
    @enum AuthorizationFlags
    Optional flags passed in to serveral Authorization APIs. See the description of AuthorizationCreate, AuthorizationCopyRights and AuthorizationFree for a description of how they affect those calls.
}
const
    kAuthorizationFlagDefaults              = 0;
    kAuthorizationFlagInteractionAllowed    = (1 shl 0);
    kAuthorizationFlagExtendRights          = (1 shl 1);
    kAuthorizationFlagPartialRights         = (1 shl 2);
    kAuthorizationFlagDestroyRights         = (1 shl 3);
    kAuthorizationFlagPreAuthorize          = (1 shl 4);

    // private bits (do not use)
    kAuthorizationFlagNoData                = (1 shl 20);


{!
    @typedef AuthorizationFlags
    Optional flags passed in to AuthorizationCreate.
}
type AuthorizationFlags = UInt32;


{!
    @enum AuthorizationRightFlags
    Flags returned in the flags field of ItemSet Items when calling AuthorizationCopyRights().
}
const
    kAuthorizationFlagCanNotPreAuthorize = (1 shl 0);


{!
    @typedef AuthorizationRef
    Opaque reference to an authorization object.
}
type
    AuthorizationRef                            = ^SInt32;


{!
    @typedef AuthorizationString
    A zero terminated string in UTF-8 encoding.
}
type AuthorizationString = CStringPtr;


{!
    @struct AuthorizationItem
    Each AuthorizationItem describes a single string-named item with optional
    parameter value. The value must be contiguous memory of valueLength bytes;
    internal structure is defined separately for each name.

    @field name name of the item, as an AuthorizationString. Mandatory.
    @field valueLength Number of bytes in parameter value. Must be 0 if no parameter value.
    @field value Pointer to the optional parameter value associated with name.
    Must be NULL if no parameter value.
    @field flags Reserved field. Must be set to 0 on creation. Do not modify after that.
}
type
    AuthorizationItem = record
        name: AuthorizationString;
        valueLength: UInt32;
        value: Ptr;
        flags: UInt32;
    end;
    AuthorizationItemPtr = ^AuthorizationItem;


{!
    @struct AuthorizationItemSet
    An AuthorizationItemSet structure represents a set of zero or more AuthorizationItems.  Since it is a set it should not contain any identical AuthorizationItems.

    @field count Number of items identified by items.
    @field items Pointer to an array of items.
}
type
    AuthorizationItemSet = record
        count: UInt32;
        items: AuthorizationItemPtr;
    end;
    AuthorizationItemSetPtr = ^AuthorizationItemSet;

{!
    @struct AuthorizationExternalForm
    An AuthorizationExternalForm structure can hold the externalized form of
    an AuthorizationRef. As such, it can be transmitted across IPC channels
    to other processes, which can re-internalize it to recover a valid AuthorizationRef
    handle.
    The data contained in an AuthorizationExternalForm should be considered opaque.

    SECURITY NOTE: Applications should take care to not disclose the AuthorizationExternalForm to
    potential attackers since it would authorize rights to them.
}
const kAuthorizationExternalFormLength = 32;

type
    AuthorizationExternalForm = record
        bytes: packed array[0..(kAuthorizationExternalFormLength)-1] of char;
    end;


{!
    @typedef AuthorizationRights
    An AuthorizationItemSet representing a set of rights each with an associated argument (value).
    Each argument value is as defined for the specific right they belong to.  Argument values may not contain pointers as the should be copyable to different address spaces.
}
type AuthorizationRights = AuthorizationItemSet;
type AuthorizationRightsPtr = ^AuthorizationRights;
type AuthorizationRightsPtrPtr = ^AuthorizationRightsPtr;


{!
    @typedef AuthorizationEnvironment
    An AuthorizationItemSet representing environmental information of potential use
    to authorization decisions.
}
type AuthorizationEnvironment = AuthorizationItemSet;
type AuthorizationEnvironmentPtr = ^AuthorizationEnvironment;


{!
    @function AuthorizationCreate
    Create a new autorization object which can be used in other authorization calls.  When the authorization is no longer needed AuthorizationFree should be called.

    When the kAuthorizationFlagInteractionAllowed flag is set, user interaction will happen when required.  Failing to set this flag will result in this call failing with a errAuthorizationInteractionNotAllowed status when interaction is required.

    Setting the kAuthorizationFlagExtendRights flag will extend the currently available rights. If this flag is set the returned AuthorizationRef will grant all the rights requested when errAuthorizationSuccess is returned. If this flag is not set the operation will almost certainly succeed, but no attempt will be made to make the requested rights availible.
        Call AuthorizationCopyRights to figure out which of the requested rights are granted by the returned AuthorizationRef.

    Setting the kAuthorizationFlagPartialRights flag will cause this call to succeed if only some of the requested rights are being granted by the returned AuthorizationRef. Unless this flag is set this API will fail if not all the requested rights could be obtained.

    Setting the kAuthorizationFlagDestroyRights flag will prevent any rights obtained during this call from being preserved after returning from this API (This is most useful when the authorization parameter is NULL and the caller doesn't want to affect the session state in any way).

    Setting the kAuthorizationFlagPreAuthorize flag will pre authorize the requested rights so that at a later time -- by calling AuthorizationMakeExternalForm() follow by AuthorizationCreateFromExternalForm() -- the obtained rights can be used in a different process.  Rights that can't be preauthorized will be treated as if they were authorized for the sake of returning an error (in other words if all rights are either authorized or could not be preauthorized this call will still succeed).
        The rights which could not be preauthorized are not currently authorized and may fail to authorize when a later call to AuthorizationCopyRights() is made, unless the kAuthorizationFlagExtendRights and kAuthorizationFlagInteractionAllowed flags are set.  Even then they might still fail if the user does not supply the correct credentials.
        The reason for passing in this flag is to provide correct audit trail information and to avoid unnecessary user interaction.

    @param rights (input/optional) An AuthorizationItemSet containing rights for which authorization is being requested.  If none are specified the resulting AuthorizationRef will authorize nothing at all.
    @param environment (input/optional) An AuthorizationItemSet containing enviroment state used when making the autorization decision.  See the AuthorizationEnvironment type for details.
    @param flags (input) options specified by the AuthorizationFlags enum.  set all unused bits to zero to allow for future expansion.
    @param authorization (output optional) A pointer to an AuthorizationRef to be returned.  When the returned AuthorizationRef is no longer needed AuthorizationFree should be called to prevent anyone from using the aquired rights.  If NULL is specified no new rights are returned, but the system will attempt to authorize all the requested rights and return the appropriate status.

    @result errAuthorizationSuccess 0 authorization or all requested rights succeeded.

    errAuthorizationDenied -60005 The authorization for one or more of the requested rights was denied.

    errAuthorizationCanceled -60006 The authorization was cancelled by the user.

    errAuthorizationInteractionNotAllowed -60007 The authorization was denied since no interaction with the user was allowed.
}
function AuthorizationCreate(rights: AuthorizationRightsPtr; environment: AuthorizationEnvironmentPtr; flags: AuthorizationFlags; var authorization: AuthorizationRef): OSStatus; external name '_AuthorizationCreate';


{!
    @function AuthorizationFree
    Destroy an AutorizationRef object. If the kAuthorizationFlagDestroyRights flag is passed,
    any rights associated with the authorization are lost. Otherwise, only local resources
    are released, and the rights may still be available to other clients.

    Setting the kAuthorizationFlagDestroyRights flag will prevent any rights that were obtained by the specified authorization object to be preserved after returning from this API.  This effectivaly locks down all potentially shared authorizations.

    @param authorization (input) The authorization object on which this operation is performed.

    @param flags (input) Bit mask of option flags to this call.

    @result errAuthorizationSuccess 0 No error.

    errAuthorizationInvalidRef -60002 The authorization parameter is invalid.
}
function AuthorizationFree(authorization: AuthorizationRef;flags: AuthorizationFlags): OSStatus; external name '_AuthorizationFree'; (* attribute ignoreable *)

{!
    @function AuthorizationCopyRights
    Given a set of rights, return the subset that is currently authorized
    by the AuthorizationRef given.

    When the kAuthorizationFlagInteractionAllowed flag is set, user interaction will happen when required.  Failing to set this flag will result in this call failing with a errAuthorizationInteractionNotAllowed status when interaction is required.

    Setting the kAuthorizationFlagExtendRights flag will extend the currently available rights.

    Setting the kAuthorizationFlagPartialRights flag will cause this call to succeed if only some of the requested rights are being granted by the returned AuthorizationRef.  Unless this flag is set this API will fail if not all the requested rights could be obtained.

    Setting the kAuthorizationFlagDestroyRights flag will prevent any additional rights obtained during this call from being preserved after returning from this API.

    Setting the kAuthorizationFlagPreAuthorize flag will pre authorize the requested rights so that at a later time -- by calling AuthorizationMakeExternalForm() follow by AuthorizationCreateFromExternalForm() -- the obtained rights can be used in a different process.  Rights that can't be preauthorized will be treated as if they were authorized for the sake of returning an error (in other words if all rights are either authorized or could not be preauthorized this call will still succeed), and they will be returned in authorizedRights with their kAuthorizationFlagCanNotPreAuthorize bit in the flags field set to 1.
        The rights which could not be preauthorized are not currently authorized and may fail to authorize when a later call to AuthorizationCopyRights() is made, unless the kAuthorizationFlagExtendRights and kAuthorizationFlagInteractionAllowed flags are set.  Even then they might still fail if the user does not supply the correct credentials.
        The reason for passing in this flag is to provide correct audit trail information and to avoid unnecessary user interaction.

    Setting the kAuthorizationFlagPreAuthorize flag will pre authorize the requested rights so that at a later time -- by calling AuthorizationMakeExternalForm() follow by AuthorizationCreateFromExternalForm() -- the obtained rights can be used in a different process.  When this flags is specified rights that can't be preauthorized will be returned as if they were authorized with their kAuthorizationFlagCanNotPreAuthorize bit in the flags field set to 1.  These rights are not currently authorized and may fail to authorize later unless kAuthorizationFlagExtendRights and kAuthorizationFlagInteractionAllowed flags are set when the actual authorization is done.  And even then they might still fail if the user does not supply the correct credentials.

    @param authorization (input) The authorization object on which this operation is performed.
    @param rights (input) A rights set (see AuthorizationCreate).
    @param environment (input/optional) An AuthorizationItemSet containing enviroment state used when making the autorization decision.  See the AuthorizationEnvironment type for details.
    @param flags (input) options specified by the AuthorizationFlags enum.  set all unused bits to zero to allow for future expansion.
    @param authorizedRights (output/optional) A pointer to a newly allocated AuthorizationInfoSet in which the authorized subset of rights are returned (authorizedRights should be deallocated by calling AuthorizationFreeItemSet() when it is no longer needed).  If NULL the only information returned is the status.  Note that if the kAuthorizationFlagPreAuthorize flag was specified rights that could not be preauthorized are returned in authorizedRights, but their flags contains the kAuthorizationFlagCanNotPreAuthorize bit.

    @result errAuthorizationSuccess 0 No error.

    errAuthorizationInvalidRef -60002 The authorization parameter is invalid.

    errAuthorizationInvalidSet -60001 The rights parameter is invalid.

    errAuthorizationInvalidPointer -60004 The authorizedRights parameter is invalid.
}
function AuthorizationCopyRights(authorization: AuthorizationRef; const (*var*) rights: AuthorizationRights; environment: AuthorizationEnvironmentPtr; flags: AuthorizationFlags; authorizedRights: AuthorizationRightsPtrPtr): OSStatus; external name '_AuthorizationCopyRights';

{!
    @function AuthorizationCopyInfo
    Returns sideband information (e.g. access credentials) obtained from a call to AuthorizationCreate.  The format of this data depends of the tag specified.

    @param authorization (input) The authorization object on which this operation is performed.
    @param tag (input/optional) An optional string tag specifing which sideband information should be returned.  When NULL is specified all available information is returned.
    @param flags (input) options specified by the AuthorizationFlags enum.  set all unused bits to zero to allow for future expansion.
    @param info (output) A pointer to a newly allocated AuthorizationInfoSet in which the requested sideband infomation is returned (info should be deallocated by calling AuthorizationFreeItemSet() when it is no longer needed).

    @result errAuthorizationSuccess 0 No error.

    errAuthorizationInvalidRef -60002 The authorization parameter is invalid.

    errAuthorizationInvalidTag -60003 The tag parameter is invalid.

    errAuthorizationInvalidPointer -60004 The info parameter is invalid.
}
function AuthorizationCopyInfo(authorization: AuthorizationRef; tag: AuthorizationString; var info: AuthorizationItemSetPtr): OSStatus; external name '_AuthorizationCopyInfo';

{!
    @function AuthorizationMakeExternalForm
    Turn an Authorization into an external "byte blob" form so it can be
    transmitted to another process.
    Note that *storing* the external form somewhere will probably not do what
    you want, since authorizations are bounded by sessions, processes, and possibly
    time limits. This is for online transmission of authorizations.

    @param authorization The (valid) authorization reference to externalize
    @param extForm Pointer to an AuthorizationExternalForm variable to fill.

        @result errAuthorizationSuccess 0 No error.

        errAuthorizationExternalizeNotAllowed -60009 Externalizing this authorization is not allowed.

        errAuthorizationInvalidRef -60002 The authorization parameter is invalid.


}
function AuthorizationMakeExternalForm(authorization: AuthorizationRef; var extForm: AuthorizationExternalForm): OSStatus; external name '_AuthorizationMakeExternalForm';


{!
    @function AuthorizationCreateFromExternalForm
    Turn an Authorization into an external "byte blob" form so it can be
    transmitted to another process.
    Note that *storing* the external form somewhere will probably not do what
    you want, since authorizations are bounded by sessions, processes, and possibly
    time limits. This is for online transmission of authorizations.

    @param extForm Pointer to an AuthorizationExternalForm value.
    @param authorization Will be filled with a valid AuthorizationRef on success.

    @result errAuthorizationInternalizeNotAllowed -60010 Internalizing this authorization is not allowed.
}
function AuthorizationCreateFromExternalForm(const (*var*) extForm: AuthorizationExternalForm; var authorization: AuthorizationRef): OSStatus; external name '_AuthorizationCreateFromExternalForm';


{!
    @function AuthorizationFreeItemSet
    Release the memory allocated for an AuthorizationItemSet that was allocated
    by an API call.

    @param set The AuthorizationItemSet to deallocate.

    @result errAuthorizationSuccess 0 No error.

    errAuthorizationInvalidSet -60001 The set parameter is invalid.
}
function AuthorizationFreeItemSet(var setx: AuthorizationItemSet): OSStatus; external name '_AuthorizationFreeItemSet';


{!
    @function AuthorizationExecuteWithPrivileges
    Run an executable tool with enhanced privileges after passing
    suitable authorization procedures.

    @param authorization An authorization reference that is used to authorize
    access to the enhanced privileges. It is also passed to the tool for
    further access control.
    @param pathToTool Full pathname to the tool that should be executed
    with enhanced privileges.
    @param options Option bits (reserved). Must be zero.
    @param arguments An argv-style vector of strings to be passed to the tool.
    @param communicationsPipe Assigned a UNIX stdio FILE pointer for
    a bidirectional pipe to communicate with the tool. The tool will have
    this pipe as its standard I/O channels (stdin/stdout). If NULL, do not
    establish a communications pipe.
 }
type
  Arg10000Type = array[0..10000] of CStringPtr;
  Arg10000TypePtr = ^Arg10000Type;
function AuthorizationExecuteWithPrivileges(authorization: AuthorizationRef; pathToTool: CStringPtr; options: AuthorizationFlags; arguments: Arg10000TypePtr; communicationsPipe: UnivPtr): OSStatus; external name '_AuthorizationExecuteWithPrivileges';
// communicationsPipe not yet supported


{!
    @function AuthorizationCopyPrivilegedReference
    From within a tool launched via the AuthorizationExecuteWithPrivileges function
    ONLY, retrieve the AuthorizationRef originally passed to that function.
    While AuthorizationExecuteWithPrivileges already verified the authorization to
    launch your tool, the tool may want to avail itself of any additional pre-authorizations
    the caller may have obtained through that reference.
 }
function AuthorizationCopyPrivilegedReference(var authorization: AuthorizationRef; flags: AuthorizationFlags): OSStatus; external name '_AuthorizationCopyPrivilegedReference';
{unit AuthorizationTags}
{$ALIGN MAC68K}





{!
    @header AuthorizationTags
    Draft version 2 01/23/2001

    This header defines some of the supported rights tags to be used in the Authorization API.
}


{!
    @define kAuthorizationEnvironmentUsername
    The name of the AuthorizationItem that should be passed into the environment when specifying a username.  The value and valueLength should contain the username itself.
}
const kAuthorizationEnvironmentUsername = 'username';

{!
    @define kAuthorizationEnvironmentPassword
    The name of the AuthorizationItem that should be passed into the environment when specifying a password for a given username.  The value and valueLength should contain the actual password data.
}
const kAuthorizationEnvironmentPassword = 'password';

{!
    @define kAuthorizationEnvironmentShared
    The name of the AuthorizationItem that should be passed into the environment when specifying a username and password.  Adding this entry to the environment will cause the username/password to be added to the shared credential pool of the calling applications session.  This means that further calls by other applications in this session will automatically have this credential availible to them.  The value is ignored.
}
const kAuthorizationEnvironmentShared = 'shared';

{!
    @define kAuthorizationRightExecute
    The name of the AuthorizationItem that should be passed into the rights when preauthorizing for a call to AuthorizationExecuteWithPrivileges().

    You need to aquire this right to be able to perform a AuthorizationExecuteWithPrivileges() operation.  In addtion to this right you should obtain whatever rights the tool you are executing with privileges need to perform it's operation on your behalf.  Currently no options are supported but you should pass in the full path of the tool you wish to execute in the value and valueLength fields.  In the future we will limit the right to only execute the requested path, and we will display this information to the user.
}
const kAuthorizationRightExecute = 'system.privilege.admin';

{!
    @define kAuthorizationEnvironmentPrompt
    The name of the AuthorizationItem that should be passed into the environment when specifying a invocation specific additional text.  The value should be a localized UTF8 string.
}
const kAuthorizationEnvironmentPrompt = 'prompt';

{!
    @define kAuthorizationEnvironmentIcon
    The name of the AuthorizationItem that should be passed into the environment when specifying an alternate icon to be used.  The value should be a full path to and image NSImage can deal with.
}
const kAuthorizationEnvironmentIcon = 'icon';
{unit CFBase}
{$ALIGN MAC68K}










{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}


{ Base "type" of all "CF objects", and polymorphic functions on them }
type
    CFTypeRef                           = ^SInt32;

type
    CFTypeID                            = UInt32;
    CFOptionFlags                       = UInt32;
    CFHashCode                          = UInt32;
    CFIndex                             = SInt32;
    CFIndexPtr = ^CFIndex; { when a VAR xx: CFIndex parameter can be nil, it is changed to xx: CFIndexPtr }
    CFStringRef    = ^SInt32; { an opaque 32-bit type }
    CFStringRefPtr = ^CFStringRef;  { when a var xx:CFStringRef parameter can be nil, it is changed to xx: CFStringRefPtr }
    CFMutableStringRef    = CFStringRef;
    CFMutableStringRefPtr = ^CFMutableStringRef;  { when a var xx:CFMutableStringRef parameter can be nil, it is changed to xx: CFMutableStringRefPtr }
    {    Values returned from comparison functions  }
    CFComparisonResult          = SInt32;
const
    kCFCompareLessThan          = -1;
    kCFCompareEqualTo           = 0;
    kCFCompareGreaterThan       = 1;

    {    A standard comparison function     }

type
    CFComparatorFunction = function(val1: UnivPtr; val2: UnivPtr; context: UnivPtr): CFComparisonResult;

    {    Constant used by some functions to indicate failed searches.   }
    {    This is of type CFIndex.   }
    CFNotFound                  = SInt32;
const
    kCFNotFound                 = -1;

    {    Range type     }

type
    CFRangePtr = ^CFRange;
    CFRange = record
        location:               CFIndex;
        length:                 CFIndex;
    end;

    {    Allocator API

       Most of the time when specifying an allocator to Create functions, the NULL
       argument indicates "use the default"; this is the same as using kCFAllocatorDefault
       or the return value from CFAllocatorGetDefault().  This assures that you will use
       the allocator in effect at that time.

       You should rarely use kCFAllocatorSystemDefault, the default default allocator.
        }
    CFAllocatorRef    = ^SInt32; { an opaque 32-bit type }
    CFAllocatorRefPtr = ^CFAllocatorRef;  { when a var xx:CFAllocatorRef parameter can be nil, it is changed to xx: CFAllocatorRefPtr }
    {    This is a synonym for NULL, if you'd rather use a named constant.  }
var kCFAllocatorDefault: CFAllocatorRef; external name '_kCFAllocatorDefault'; (* attribute const *)
    {
     *  kCFAllocatorDefault
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.1 and later
     *    Mac OS X:         in version 10.0 and later
        }
    {    Default system allocator; you rarely need to use this.     }
var kCFAllocatorSystemDefault: CFAllocatorRef; external name '_kCFAllocatorSystemDefault'; (* attribute const *)
    {
     *  kCFAllocatorSystemDefault
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
    {    This allocator uses malloc(), realloc(), and free(). This should not be
       generally used; stick to kCFAllocatorDefault whenever possible. This
       allocator is useful as the "bytesDeallocator" in CFData or
       "contentsDeallocator" in CFString where the memory was obtained as a
       result of malloc() type functions.
        }
var kCFAllocatorMalloc: CFAllocatorRef; external name '_kCFAllocatorMalloc'; (* attribute const *)
    {
     *  kCFAllocatorMalloc
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.1 and later
     *    Mac OS X:         in version 10.0 and later
        }
    {    Null allocator which does nothing and allocates no memory. This allocator
       is useful as the "bytesDeallocator" in CFData or "contentsDeallocator"
       in CFString where the memory should not be freed.
        }
var kCFAllocatorNull: CFAllocatorRef; external name '_kCFAllocatorNull'; (* attribute const *)
    {
     *  kCFAllocatorNull
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
    {    Special allocator argument to CFAllocatorCreate() which means
       "use the functions given in the context to allocate the allocator
       itself as well".
        }
var kCFAllocatorUseContext: CFAllocatorRef; external name '_kCFAllocatorUseContext'; (* attribute const *)
    {
     *  kCFAllocatorUseContext
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
type
    CFAllocatorRetainCallBack = function(info: UnivPtr): Ptr;

    CFAllocatorReleaseCallBack = procedure(info: UnivPtr);

    CFAllocatorCopyDescriptionCallBack = function(info: UnivPtr): CFStringRef;

    CFAllocatorAllocateCallBack = function(allocSize: CFIndex; hint: CFOptionFlags; info: UnivPtr): Ptr;

    CFAllocatorReallocateCallBack = function(ptr: UnivPtr; newsize: CFIndex; hint: CFOptionFlags; info: UnivPtr): Ptr;

    CFAllocatorDeallocateCallBack = procedure(ptr: UnivPtr; info: UnivPtr);

    CFAllocatorPreferredSizeCallBack = function(size: CFIndex; hint: CFOptionFlags; info: UnivPtr): CFIndex;

    CFAllocatorContextPtr = ^CFAllocatorContext;
    CFAllocatorContext = record
        version:                CFIndex;
        info:                   Ptr;
        retain:                 CFAllocatorRetainCallBack;
        release:                CFAllocatorReleaseCallBack;
        copyDescription:        CFAllocatorCopyDescriptionCallBack;
        allocate:               CFAllocatorAllocateCallBack;
        reallocate:             CFAllocatorReallocateCallBack;
        deallocate:             CFAllocatorDeallocateCallBack;
        preferredSize:          CFAllocatorPreferredSizeCallBack;
    end;

    {
     *  CFAllocatorGetTypeID()
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function CFAllocatorGetTypeID: CFTypeID; external name '_CFAllocatorGetTypeID';

{
    CFAllocatorSetDefault() sets the allocator that is used in the current
    thread whenever NULL is specified as an allocator argument. This means
    that most, if not all allocations will go through this allocator. It
    also means that any allocator set as the default needs to be ready to
    deal with arbitrary memory allocation requests; in addition, the size
    and number of requests will change between releases.

    An allocator set as the default will never be released, even if later
    another allocator replaces it as the default. Not only is it impractical
    for it to be released (as there might be caches created under the covers
    that refer to the allocator), in general it's also safer and more
    efficient to keep it around.

    If you wish to use a custom allocator in a context, it's best to provide
    it as the argument to the various creation functions rather than setting
    it as the default. Setting the default allocator is not encouraged.

    If you do set an allocator as the default, either do it for all time in
    your app, or do it in a nested fashion (by restoring the previous allocator
    when you exit your context). The latter might be appropriate for plug-ins
    or libraries that wish to set the default allocator.
}
{
 *  CFAllocatorSetDefault()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CFAllocatorSetDefault(allocator: CFAllocatorRef); external name '_CFAllocatorSetDefault';

{
 *  CFAllocatorGetDefault()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFAllocatorGetDefault: CFAllocatorRef; external name '_CFAllocatorGetDefault';

{
 *  CFAllocatorCreate()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFAllocatorCreate(allocator: CFAllocatorRef; var context: CFAllocatorContext): CFAllocatorRef; external name '_CFAllocatorCreate';

{
 *  CFAllocatorAllocate()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFAllocatorAllocate(allocator: CFAllocatorRef; size: CFIndex; hint: CFOptionFlags): Ptr; external name '_CFAllocatorAllocate';

{
 *  CFAllocatorReallocate()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFAllocatorReallocate(allocator: CFAllocatorRef; ptr: UnivPtr; newsize: CFIndex; hint: CFOptionFlags): Ptr; external name '_CFAllocatorReallocate';

{
 *  CFAllocatorDeallocate()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CFAllocatorDeallocate(allocator: CFAllocatorRef; ptr: UnivPtr); external name '_CFAllocatorDeallocate';

{
 *  CFAllocatorGetPreferredSizeForSize()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFAllocatorGetPreferredSizeForSize(allocator: CFAllocatorRef; size: CFIndex; hint: CFOptionFlags): CFIndex; external name '_CFAllocatorGetPreferredSizeForSize';

{
 *  CFAllocatorGetContext()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CFAllocatorGetContext(allocator: CFAllocatorRef; var context: CFAllocatorContext); external name '_CFAllocatorGetContext';

    {
     *  CFGetTypeID()
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function CFGetTypeID(cf: CFTypeRef): CFTypeID; external name '_CFGetTypeID';

{
 *  CFCopyTypeIDDescription()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFCopyTypeIDDescription(type_id: CFTypeID): CFStringRef; external name '_CFCopyTypeIDDescription';

{
 *  CFRetain()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFRetain(cf: CFTypeRef): CFTypeRef; external name '_CFRetain';

{
 *  CFRelease()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CFRelease(cf: CFTypeRef); external name '_CFRelease';

{
 *  CFGetRetainCount()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFGetRetainCount(cf: CFTypeRef): CFIndex; external name '_CFGetRetainCount';

{
 *  CFEqual()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFEqual(cf1: CFTypeRef; cf2: CFTypeRef): boolean; external name '_CFEqual';

{
 *  CFHash()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFHash(cf: CFTypeRef): CFHashCode; external name '_CFHash';

{
 *  CFCopyDescription()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFCopyDescription(cf: CFTypeRef): CFStringRef; external name '_CFCopyDescription';

{
 *  CFGetAllocator()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFGetAllocator(cf: CFTypeRef): CFAllocatorRef; external name '_CFGetAllocator';

{$ALIGN MAC68K}
{#POP}
{unit CFBinaryHeap}
{$ALIGN MAC68K}






type
    CFBinaryHeapCompareContext = record
    version: CFIndex;
    info: Ptr;
        retain: function( info: Ptr ): Ptr;
        release: procedure( info: Ptr );
        copyDescription: function( info: Ptr ): CFStringRef;
    end;
    CFBinaryHeapCompareContextPtr = ^CFBinaryHeapCompareContext;

{!
        @typedef CFBinaryHeapCallBacks
    Structure containing the callbacks for values of a CFBinaryHeap.
        @field version The version number of the structure type being passed
                in as a parameter to the CFBinaryHeap creation functions.
                This structure is version 0.
    @field retain The callback used to add a retain for the binary heap
        on values as they are put into the binary heap.
        This callback returns the value to use as the value in the
        binary heap, which is usually the value parameter passed to
        this callback, but may be a different value if a different
        value should be added to the binary heap. The binary heap's
        allocator is passed as the first argument.
    @field release The callback used to remove a retain previously added
        for the binary heap from values as they are removed from
        the binary heap. The binary heap's allocator is passed as the
        first argument.
    @field copyDescription The callback used to create a descriptive
        string representation of each value in the binary heap. This
        is used by the CFCopyDescription() function.
    @field compare The callback used to compare values in the binary heap for
        equality in some operations.
}
type
    CFBinaryHeapCallBacks = record
    version: CFIndex;
        retain: function( allocator: CFAllocatorRef; info: Ptr ): Ptr;
        release: procedure( allocator: CFAllocatorRef; info: Ptr );
        copyDescription: function( info: Ptr ): CFStringRef;
        compare: function( info1, info2: Ptr; context: UnivPtr ): CFComparisonResult;
    end;
    CFBinaryHeapCallBacksPtr = ^CFBinaryHeapCallBacks;

{!
    @constant kCFStringBinaryHeapCallBacks
    Predefined CFBinaryHeapCallBacks structure containing a set
    of callbacks appropriate for use when the values in a CFBinaryHeap
    are all CFString types.
}
var kCFStringBinaryHeapCallBacks: CFBinaryHeapCallBacks; external name '_kCFStringBinaryHeapCallBacks'; (* attribute const *)

{!
    @typedef CFBinaryHeapApplierFunction
    Type of the callback function used by the apply functions of
        CFBinaryHeap.
    @param value The current value from the binary heap.
    @param context The user-defined context parameter given to the apply
        function.
}
type CFBinaryHeapApplierFunction = procedure( val: UnivPtr; context: UnivPtr );

{!
    @typedef CFBinaryHeapRef
    This is the type of a reference to CFBinaryHeaps.
}
type
    CFBinaryHeapRef                         = ^SInt32;

{!
    @function CFBinaryHeapGetTypeID
    Returns the type identifier of all CFBinaryHeap instances.
}
function CFBinaryHeapGetTypeID: CFTypeID; external name '_CFBinaryHeapGetTypeID';

{!
    @function CFBinaryHeapCreate
    Creates a new mutable or fixed-mutable binary heap with the given values.
    @param allocator The CFAllocator which should be used to allocate
        memory for the binary heap and its storage for values. This
        parameter may be NULL in which case the current default
        CFAllocator is used. If this reference is not a valid
        CFAllocator, the behavior is undefined.
    @param capacity The maximum number of values that can be contained
        by the CFBinaryHeap. The binary heap starts empty, and can grow to this
        number of values (and it can have less). If this parameter
        is 0, the binary heap's maximum capacity is unlimited (or rather,
        only limited by address space and available memory
        constraints). If this parameter is negative, the behavior is
        undefined.
    @param callBacks A pointer to a CFBinaryHeapCallBacks structure
        initialized with the callbacks for the binary heap to use on
        each value in the binary heap. A copy of the contents of the
        callbacks structure is made, so that a pointer to a structure
        on the stack can be passed in, or can be reused for multiple
        binary heap creations. If the version field of this callbacks
        structure is not one of the defined ones for CFBinaryHeap, the
        behavior is undefined. The retain field may be NULL, in which
        case the CFBinaryHeap will do nothing to add a retain to values
        as they are put into the binary heap. The release field may be
        NULL, in which case the CFBinaryHeap will do nothing to remove
        the binary heap's retain (if any) on the values when the
        heap is destroyed or a key-value pair is removed. If the
        copyDescription field is NULL, the binary heap will create a
        simple description for a value. If the equal field is NULL, the
        binary heap will use pointer equality to test for equality of
        values. This callbacks parameter itself may be NULL, which is
        treated as if a valid structure of version 0 with all fields
        NULL had been passed in. Otherwise,
        if any of the fields are not valid pointers to functions
        of the correct type, or this parameter is not a valid
        pointer to a CFBinaryHeapCallBacks callbacks structure,
        the behavior is undefined. If any of the values put into the
        binary heap is not one understood by one of the callback functions
        the behavior when that callback function is used is undefined.
        @param compareContext A pointer to a CFBinaryHeapCompareContext structure.
    @result A reference to the new CFBinaryHeap.
}
function CFBinaryHeapCreate( allocator: CFAllocatorRef; capacity: CFIndex; callBacks: CFBinaryHeapCallBacksPtr; const (*var*) compareContext: CFBinaryHeapCompareContext ): CFBinaryHeapRef; external name '_CFBinaryHeapCreate';

{!
    @function CFBinaryHeapCreateCopy
    Creates a new mutable or fixed-mutable binary heap with the values from the given binary heap.
    @param allocator The CFAllocator which should be used to allocate
        memory for the binary heap and its storage for values. This
        parameter may be NULL in which case the current default
        CFAllocator is used. If this reference is not a valid
        CFAllocator, the behavior is undefined.
    @param capacity The maximum number of values that can be contained
        by the CFBinaryHeap. The binary heap starts empty, and can grow to this
        number of values (and it can have less). If this parameter
        is 0, the binary heap's maximum capacity is unlimited (or rather,
        only limited by address space and available memory
        constraints). If this parameter is negative, or less than the number of
                values in the given binary heap, the behavior is undefined.
    @param heap The binary heap which is to be copied. The values from the
        binary heap are copied as pointers into the new binary heap (that is,
        the values themselves are copied, not that which the values
        point to, if anything). However, the values are also
        retained by the new binary heap. The count of the new binary will
        be the same as the given binary heap. The new binary heap uses the same
        callbacks as the binary heap to be copied. If this parameter is
        not a valid CFBinaryHeap, the behavior is undefined.
    @result A reference to the new mutable or fixed-mutable binary heap.
}
function CFBinaryHeapCreateCopy( allocator: CFAllocatorRef; capacity: CFIndex; heap: CFBinaryHeapRef ): CFBinaryHeapRef; external name '_CFBinaryHeapCreateCopy';

{!
    @function CFBinaryHeapGetCount
    Returns the number of values currently in the binary heap.
    @param heap The binary heap to be queried. If this parameter is not a valid
        CFBinaryHeap, the behavior is undefined.
    @result The number of values in the binary heap.
}
function CFBinaryHeapGetCount( heap: CFBinaryHeapRef ): CFIndex; external name '_CFBinaryHeapGetCount';

{!
    @function CFBinaryHeapGetCountOfValue
    Counts the number of times the given value occurs in the binary heap.
    @param heap The binary heap to be searched. If this parameter is not a
        valid CFBinaryHeap, the behavior is undefined.
    @param value The value for which to find matches in the binary heap. The
        compare() callback provided when the binary heap was created is
        used to compare. If the compare() callback was NULL, pointer
        equality (in C, ==) is used. If value, or any of the values
        in the binary heap, are not understood by the compare() callback,
        the behavior is undefined.
    @result The number of times the given value occurs in the binary heap.
}
function CFBinaryHeapGetCountOfValue( heap: CFBinaryHeapRef; value: UnivPtr ): CFIndex; external name '_CFBinaryHeapGetCountOfValue';

{!
    @function CFBinaryHeapContainsValue
    Reports whether or not the value is in the binary heap.
    @param heap The binary heap to be searched. If this parameter is not a
        valid CFBinaryHeap, the behavior is undefined.
    @param value The value for which to find matches in the binary heap. The
        compare() callback provided when the binary heap was created is
        used to compare. If the compare() callback was NULL, pointer
        equality (in C, ==) is used. If value, or any of the values
        in the binary heap, are not understood by the compare() callback,
        the behavior is undefined.
    @result true, if the value is in the specified binary heap, otherwise false.
}
function CFBinaryHeapContainsValue( heap: CFBinaryHeapRef; value: UnivPtr ): Boolean; external name '_CFBinaryHeapContainsValue';

{!
    @function CFBinaryHeapGetMinimum
    Returns the minimum value is in the binary heap.  If the heap contains several equal
                minimum values, any one may be returned.
    @param heap The binary heap to be searched. If this parameter is not a
        valid CFBinaryHeap, the behavior is undefined.
    @result A reference to the minimum value in the binary heap, or NULL if the
                binary heap contains no values.
}
function CFBinaryHeapGetMinimum( heap: CFBinaryHeapRef ): Ptr; external name '_CFBinaryHeapGetMinimum';

{!
    @function CFBinaryHeapGetMinimumIfPresent
    Returns the minimum value is in the binary heap, if present.  If the heap contains several equal
                minimum values, any one may be returned.
    @param heap The binary heap to be searched. If this parameter is not a
        valid CFBinaryHeap, the behavior is undefined.
        @param value A C pointer to pointer-sized storage to be filled with the minimum value in
                the binary heap.  If this value is not a valid C pointer to a pointer-sized block
                of storage, the result is undefined.  If the result of the function is false, the value
                stored at this address is undefined.
    @result true, if a minimum value was found in the specified binary heap, otherwise false.
}
function CFBinaryHeapGetMinimumIfPresent( heap: CFBinaryHeapRef; var value: UnivPtr ): Boolean; external name '_CFBinaryHeapGetMinimumIfPresent';

{!
    @function CFBinaryHeapGetValues
    Fills the buffer with values from the binary heap.
    @param heap The binary heap to be queried. If this parameter is not a
        valid CFBinaryHeap, the behavior is undefined.
    @param values A C array of pointer-sized values to be filled with
        values from the binary heap. The values in the C array are ordered
        from least to greatest. If this parameter is not a valid pointer to a
                C array of at least CFBinaryHeapGetCount() pointers, the behavior is undefined.
}
type
    CFBinaryHeapValues = array[0..($7FFFFFF div SizeOf(Ptr))] of Ptr;
    CFBinaryHeapValuesPtr = ^CFBinaryHeapValues;
procedure CFBinaryHeapGetValues( heap: CFBinaryHeapRef; values: CFBinaryHeapValuesPtr ); external name '_CFBinaryHeapGetValues';
{!
    @function CFBinaryHeapApplyFunction
    Calls a function once for each value in the binary heap.
    @param heap The binary heap to be operated upon. If this parameter is not a
        valid CFBinaryHeap, the behavior is undefined.
    @param applier The callback function to call once for each value in
        the given binary heap. If this parameter is not a
        pointer to a function of the correct prototype, the behavior
        is undefined. If there are values in the binary heap which the
        applier function does not expect or cannot properly apply
        to, the behavior is undefined.
    @param context A pointer-sized user-defined value, which is passed
        as the second parameter to the applier function, but is
        otherwise unused by this function. If the context is not
        what is expected by the applier function, the behavior is
        undefined.
}
procedure CFBinaryHeapApplyFunction( heap: CFBinaryHeapRef; applier: CFBinaryHeapApplierFunction; context: UnivPtr ); external name '_CFBinaryHeapApplyFunction';

{!
    @function CFBinaryHeapAddValue
    Adds the value to the binary heap.
    @param heap The binary heap to which the value is to be added. If this parameter is not a
        valid mutable CFBinaryHeap, the behavior is undefined.
                If the binary heap is a fixed-capacity binary heap and it
        is full before this operation, the behavior is undefined.
    @param value The value to add to the binary heap. The value is retained by
        the binary heap using the retain callback provided when the binary heap
        was created. If the value is not of the sort expected by the
        retain callback, the behavior is undefined.
}
procedure CFBinaryHeapAddValue( heap: CFBinaryHeapRef; value: UnivPtr ); external name '_CFBinaryHeapAddValue';

{!
    @function CFBinaryHeapRemoveMinimumValue
    Removes the minimum value from the binary heap.
    @param heap The binary heap from which the minimum value is to be removed. If this
                parameter is not a valid mutable CFBinaryHeap, the behavior is undefined.
}
procedure CFBinaryHeapRemoveMinimumValue( heap: CFBinaryHeapRef ); external name '_CFBinaryHeapRemoveMinimumValue';

{!
    @function CFBinaryHeapRemoveAllValues
    Removes all the values from the binary heap, making it empty.
    @param heap The binary heap from which all of the values are to be
        removed. If this parameter is not a valid mutable CFBinaryHeap,
        the behavior is undefined.
}
procedure CFBinaryHeapRemoveAllValues( heap: CFBinaryHeapRef ); external name '_CFBinaryHeapRemoveAllValues';
{unit CFBitVector}
{$ALIGN MAC68K}






type CFBit = UInt32;

type
    CFBitVectorRef                          = ^SInt32;
    CFMutableBitVectorRef                           = ^SInt32;

function CFBitVectorGetTypeID: CFTypeID; external name '_CFBitVectorGetTypeID';

function CFBitVectorCreate( allocator: CFAllocatorRef; bytes: UnivPtr; numBits: CFIndex ): CFBitVectorRef; external name '_CFBitVectorCreate';
function CFBitVectorCreateCopy( allocator: CFAllocatorRef; bv: CFBitVectorRef ): CFBitVectorRef; external name '_CFBitVectorCreateCopy';
function CFBitVectorCreateMutable( allocator: CFAllocatorRef; capacity: CFIndex ): CFMutableBitVectorRef; external name '_CFBitVectorCreateMutable';
function CFBitVectorCreateMutableCopy( allocator: CFAllocatorRef; capacity: CFIndex; bv: CFBitVectorRef ): CFMutableBitVectorRef; external name '_CFBitVectorCreateMutableCopy';

function CFBitVectorGetCount( bv: CFBitVectorRef ): CFIndex; external name '_CFBitVectorGetCount';
function CFBitVectorGetCountOfBit( bv: CFBitVectorRef; range: CFRange; value: CFBit ): CFIndex; external name '_CFBitVectorGetCountOfBit';
function CFBitVectorContainsBit( bv: CFBitVectorRef; range: CFRange; value: CFBit ): Boolean; external name '_CFBitVectorContainsBit';
function CFBitVectorGetBitAtIndex( bv: CFBitVectorRef; idx: CFIndex ): CFBit; external name '_CFBitVectorGetBitAtIndex';
procedure CFBitVectorGetBits( bv: CFBitVectorRef; range: CFRange; bytes: UnivPtr ); external name '_CFBitVectorGetBits';
function CFBitVectorGetFirstIndexOfBit( bv: CFBitVectorRef; range: CFRange; value: CFBit ): CFIndex; external name '_CFBitVectorGetFirstIndexOfBit';
function CFBitVectorGetLastIndexOfBit( bv: CFBitVectorRef; range: CFRange; value: CFBit ): CFIndex; external name '_CFBitVectorGetLastIndexOfBit';

procedure CFBitVectorSetCount( bv: CFMutableBitVectorRef; count: CFIndex ); external name '_CFBitVectorSetCount';
procedure CFBitVectorFlipBitAtIndex( bv: CFMutableBitVectorRef; idx: CFIndex ); external name '_CFBitVectorFlipBitAtIndex';
procedure CFBitVectorFlipBits( bv: CFMutableBitVectorRef; range: CFRange ); external name '_CFBitVectorFlipBits';
procedure CFBitVectorSetBitAtIndex( bv: CFMutableBitVectorRef; idx: CFIndex; value: CFBit ); external name '_CFBitVectorSetBitAtIndex';
procedure CFBitVectorSetBits( bv: CFMutableBitVectorRef; range: CFRange; value: CFBit ); external name '_CFBitVectorSetBits';
procedure CFBitVectorSetAllBits( bv: CFMutableBitVectorRef; value: CFBit ); external name '_CFBitVectorSetAllBits';
{unit CFData}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}


type
    CFDataRef    = ^SInt32; { an opaque 32-bit type }
    CFDataRefPtr = ^CFDataRef;  { when a var xx:CFDataRef parameter can be nil, it is changed to xx: CFDataRefPtr }
    CFMutableDataRef    = CFDataRef;
    CFMutableDataRefPtr = ^CFMutableDataRef;  { when a var xx:CFMutableDataRef parameter can be nil, it is changed to xx: CFMutableDataRefPtr }
    {
     *  CFDataGetTypeID()
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function CFDataGetTypeID: CFTypeID; external name '_CFDataGetTypeID';

{
 *  CFDataCreate()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFDataCreate(allocator: CFAllocatorRef; bytes: UnivPtr; length: CFIndex): CFDataRef; external name '_CFDataCreate';

{
 *  CFDataCreateWithBytesNoCopy()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFDataCreateWithBytesNoCopy(allocator: CFAllocatorRef; bytes: UnivPtr; length: CFIndex; bytesDeallocator: CFAllocatorRef): CFDataRef; external name '_CFDataCreateWithBytesNoCopy';

{ Pass kCFAllocatorNull as bytesDeallocator to assure the bytes aren't freed }
{
 *  CFDataCreateCopy()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFDataCreateCopy(allocator: CFAllocatorRef; theData: CFDataRef): CFDataRef; external name '_CFDataCreateCopy';

{
 *  CFDataCreateMutable()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFDataCreateMutable(allocator: CFAllocatorRef; capacity: CFIndex): CFMutableDataRef; external name '_CFDataCreateMutable';

{
 *  CFDataCreateMutableCopy()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFDataCreateMutableCopy(allocator: CFAllocatorRef; capacity: CFIndex; theData: CFDataRef): CFMutableDataRef; external name '_CFDataCreateMutableCopy';

{
 *  CFDataGetLength()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFDataGetLength(theData: CFDataRef): CFIndex; external name '_CFDataGetLength';

{
 *  CFDataGetBytePtr()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFDataGetBytePtr(theData: CFDataRef): Ptr; external name '_CFDataGetBytePtr';

{
 *  CFDataGetMutableBytePtr()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFDataGetMutableBytePtr(theData: CFMutableDataRef): Ptr; external name '_CFDataGetMutableBytePtr';

{
 *  CFDataGetBytes()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CFDataGetBytes(theData: CFDataRef; range: CFRange; buffer: UnivPtr); external name '_CFDataGetBytes';

{
 *  CFDataSetLength()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CFDataSetLength(theData: CFMutableDataRef; length: CFIndex); external name '_CFDataSetLength';

{
 *  CFDataIncreaseLength()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CFDataIncreaseLength(theData: CFMutableDataRef; extraLength: CFIndex); external name '_CFDataIncreaseLength';

{
 *  CFDataAppendBytes()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CFDataAppendBytes(theData: CFMutableDataRef; bytes: UnivPtr; length: CFIndex); external name '_CFDataAppendBytes';

{
 *  CFDataReplaceBytes()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CFDataReplaceBytes(theData: CFMutableDataRef; range: CFRange; newBytes: UnivPtr; newLength: CFIndex); external name '_CFDataReplaceBytes';

{
 *  CFDataDeleteBytes()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CFDataDeleteBytes(theData: CFMutableDataRef; range: CFRange); external name '_CFDataDeleteBytes';

{$ALIGN MAC68K}
{#POP}
{unit CFDate}
{$ALIGN MAC68K}










{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}


type
    CFTimeInterval                      = Double;
    CFAbsoluteTime                      = CFTimeInterval;
    CFAbsoluteTimePtr = ^CFAbsoluteTime;
    {    absolute time is the time interval since the reference date    }
    {    the reference date (epoch) is 00:00:00 1 January 2001.     }
    {
     *  CFAbsoluteTimeGetCurrent()
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function CFAbsoluteTimeGetCurrent: CFAbsoluteTime; external name '_CFAbsoluteTimeGetCurrent';

var kCFAbsoluteTimeIntervalSince1970: CFTimeInterval; external name '_kCFAbsoluteTimeIntervalSince1970'; (* attribute const *)
{
 *  kCFAbsoluteTimeIntervalSince1970
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
var kCFAbsoluteTimeIntervalSince1904: CFTimeInterval; external name '_kCFAbsoluteTimeIntervalSince1904'; (* attribute const *)
{
 *  kCFAbsoluteTimeIntervalSince1904
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }

type
    CFDateRef    = ^SInt32; { an opaque 32-bit type }
    CFDateRefPtr = ^CFDateRef;  { when a var xx:CFDateRef parameter can be nil, it is changed to xx: CFDateRefPtr }
    {
     *  CFDateGetTypeID()
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function CFDateGetTypeID: CFTypeID; external name '_CFDateGetTypeID';

{
 *  CFDateCreate()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFDateCreate(allocator: CFAllocatorRef; at: CFAbsoluteTime): CFDateRef; external name '_CFDateCreate';

{
 *  CFDateGetAbsoluteTime()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFDateGetAbsoluteTime(theDate: CFDateRef): CFAbsoluteTime; external name '_CFDateGetAbsoluteTime';

{
 *  CFDateGetTimeIntervalSinceDate()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFDateGetTimeIntervalSinceDate(theDate: CFDateRef; otherDate: CFDateRef): CFTimeInterval; external name '_CFDateGetTimeIntervalSinceDate';

{
 *  CFDateCompare()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFDateCompare(theDate: CFDateRef; otherDate: CFDateRef; context: UnivPtr): CFComparisonResult; external name '_CFDateCompare';


type
    CFTimeZoneRef    = ^SInt32; { an opaque 32-bit type }
    CFTimeZoneRefPtr = ^CFTimeZoneRef;  { when a var xx:CFTimeZoneRef parameter can be nil, it is changed to xx: CFTimeZoneRefPtr }
    CFGregorianDatePtr = ^CFGregorianDate;
    CFGregorianDate = record
        year:                   SInt32;
        month:                  SInt8;
        day:                    SInt8;
        hour:                   SInt8;
        minute:                 SInt8;
        second:                 Double;
    end;

    CFGregorianUnitsPtr = ^CFGregorianUnits;
    CFGregorianUnits = record
        years:                  SInt32;
        months:                 SInt32;
        days:                   SInt32;
        hours:                  SInt32;
        minutes:                SInt32;
        seconds:                Double;
    end;

    CFGregorianUnitFlags        = SInt32;
const
    kCFGregorianUnitsYears      = $01;
    kCFGregorianUnitsMonths     = $02;
    kCFGregorianUnitsDays       = $04;
    kCFGregorianUnitsHours      = $08;
    kCFGregorianUnitsMinutes    = $10;
    kCFGregorianUnitsSeconds    = $20;
    kCFGregorianAllUnits        = $00FFFFFF;

    {
     *  CFGregorianDateIsValid()
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function CFGregorianDateIsValid(gdate: CFGregorianDate; unitFlags: CFOptionFlags): boolean; external name '_CFGregorianDateIsValid';

{
 *  CFGregorianDateGetAbsoluteTime()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFGregorianDateGetAbsoluteTime(gdate: CFGregorianDate; tz: CFTimeZoneRef): CFAbsoluteTime; external name '_CFGregorianDateGetAbsoluteTime';

{
 *  CFAbsoluteTimeGetGregorianDate()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFAbsoluteTimeGetGregorianDate(at: CFAbsoluteTime; tz: CFTimeZoneRef): CFGregorianDate; external name '_CFAbsoluteTimeGetGregorianDate';

{
 *  CFAbsoluteTimeAddGregorianUnits()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFAbsoluteTimeAddGregorianUnits(at: CFAbsoluteTime; tz: CFTimeZoneRef; units: CFGregorianUnits): CFAbsoluteTime; external name '_CFAbsoluteTimeAddGregorianUnits';

{
 *  CFAbsoluteTimeGetDifferenceAsGregorianUnits()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFAbsoluteTimeGetDifferenceAsGregorianUnits(at1: CFAbsoluteTime; at2: CFAbsoluteTime; tz: CFTimeZoneRef; unitFlags: CFOptionFlags): CFGregorianUnits; external name '_CFAbsoluteTimeGetDifferenceAsGregorianUnits';

{
 *  CFAbsoluteTimeGetDayOfWeek()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFAbsoluteTimeGetDayOfWeek(at: CFAbsoluteTime; tz: CFTimeZoneRef): SInt32; external name '_CFAbsoluteTimeGetDayOfWeek';

{
 *  CFAbsoluteTimeGetDayOfYear()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFAbsoluteTimeGetDayOfYear(at: CFAbsoluteTime; tz: CFTimeZoneRef): SInt32; external name '_CFAbsoluteTimeGetDayOfYear';

{
 *  CFAbsoluteTimeGetWeekOfYear()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFAbsoluteTimeGetWeekOfYear(at: CFAbsoluteTime; tz: CFTimeZoneRef): SInt32; external name '_CFAbsoluteTimeGetWeekOfYear';

{$ALIGN MAC68K}
{#POP}
{unit CFDictionary}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}


{
 *  CFDictionary
 *
 *  Discussion:
 *    CFDictionary implements a container which pairs pointer-sized
 *    keys with pointer-sized values. Values are accessed via arbitrary
 *    user-defined keys. A CFDictionary differs from a CFArray in that
 *    the key used to access a particular value in the dictionary
 *    remains the same as values are added to or removed from the
 *    dictionary, unless a value associated with its particular key is
 *    replaced or removed. In a CFArray, the key (or index) used to
 *    retrieve a particular value can change over time as values are
 *    added to or deleted from the array. Also unlike an array, there
 *    is no ordering among values in a dictionary. To enable later
 *    retrieval of a value, the key of the key-value pair should be
 *    constant (or treated as constant); if the key changes after being
 *    used to put a value in the dictionary, the value may not be
 *    retrievable. The keys of a dictionary form a set; that is, no two
 *    keys which are equal to one another are present in the dictionary
 *    at any time.
 *
 *    Dictionaries come in two flavors, immutable, which cannot have
 *    values added to them or removed from them after the dictionary is
 *    created, and mutable, to which you can add values or from which
 *    remove values. Mutable dictionaries have two subflavors,
 *    fixed-capacity, for which there is a maximum number set at
 *    creation time of values which can be put into the dictionary, and
 *    variable capacity, which can have an unlimited number of values
 *    (or rather, limited only by constraints external to CFDictionary,
 *    like the amount of available memory). Fixed-capacity dictionaries
 *    can be somewhat higher performing, if you can put a definate
 *    upper limit on the number of values that might be put into the
 *    dictionary.
 *
 *    As with all CoreFoundation collection types, dictionaries
 *    maintain hard references on the values you put in them, but the
 *    retaining and releasing functions are user-defined callbacks that
 *    can actually do whatever the user wants (for example, nothing).
 *
 *
 *    Although a particular implementation of CFDictionary may not use
 *    hashing and a hash table for storage of the values, the keys have
 *    a hash-code generating function defined for them, and a function
 *    to test for equality of two keys. These two functions together
 *    must maintain the invariant that if equal(X, Y), then hash(X) ==
 *    hash(Y). Note that the converse will not generally be true (but
 *    the contrapositive, if hash(X) != hash(Y), then !equal(X, Y),
 *    will be as required by Boolean logic). If the hash() and equal()
 *    key callbacks are NULL, the key is used as a pointer-sized
 *    SInt16, and pointer equality is used. Care should be taken to
 *    provide a hash() callback which will compute sufficiently
 *    dispersed hash codes for the key set for best performance.
 *
 *
 *    Computational Complexity The access time for a value in the
 *    dictionary is guaranteed to be at worst O(lg N) for any
 *    implementation, current and future, but will often be O(1)
 *    (constant time). Insertion or deletion operations will typically
 *    be constant time as well, but are O(N*lg N) in the worst case in
 *    some implementations. Access of values through a key is faster
 *    than accessing values directly (if there are any such
 *    operations). Dictionaries will tend to use significantly more
 *    memory than a array with the same number of values.
 }

type
    CFDictionaryRetainCallBack = function(allocator: CFAllocatorRef; value: UnivPtr): Ptr;

    CFDictionaryReleaseCallBack = procedure(allocator: CFAllocatorRef; value: UnivPtr);

    CFDictionaryCopyDescriptionCallBack = function(value: UnivPtr): CFStringRef;

    CFDictionaryEqualCallBack = function(value1: UnivPtr; value2: UnivPtr): boolean;

    CFDictionaryHashCallBack = function(value: UnivPtr): CFHashCode;


    {
     *  CFDictionaryKeyCallBacks
     *
     *  Discussion:
     *    Structure containing the callbacks for keys of a CFDictionary.
        }
    CFDictionaryKeyCallBacksPtr = ^CFDictionaryKeyCallBacks;
    CFDictionaryKeyCallBacks = record
        version:                CFIndex;
        retain:                 CFDictionaryRetainCallBack;
        release:                CFDictionaryReleaseCallBack;
        copyDescription:        CFDictionaryCopyDescriptionCallBack;
        equal:                  CFDictionaryEqualCallBack;
        hash:                   CFDictionaryHashCallBack;
    end;

var kCFTypeDictionaryKeyCallBacks: CFDictionaryKeyCallBacks; external name '_kCFTypeDictionaryKeyCallBacks'; (* attribute const *)
    {
     *  kCFTypeDictionaryKeyCallBacks
     *
     *  Discussion:
     *    Predefined CFDictionaryKeyCallBacks structure containing a set of
     *    callbacks appropriate for use when the keys of a CFDictionary are
     *    all CFTypes.
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
var kCFCopyStringDictionaryKeyCallBacks: CFDictionaryKeyCallBacks; external name '_kCFCopyStringDictionaryKeyCallBacks'; (* attribute const *)
    {
     *  kCFCopyStringDictionaryKeyCallBacks
     *
     *  Discussion:
     *    Predefined CFDictionaryKeyCallBacks structure containing a set of
     *    callbacks appropriate for use when the keys of a CFDictionary are
     *    all CFStrings, which may be mutable and need to be copied in
     *    order to serve as constant keys for the values in the dictionary.
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }

    {
     *  CFDictionaryValueCallBacks
     *
     *  Discussion:
     *    Structure containing the callbacks for values of a CFDictionary.
        }
type
    CFDictionaryValueCallBacksPtr = ^CFDictionaryValueCallBacks;
    CFDictionaryValueCallBacks = record
        version:                CFIndex;
        retain:                 CFDictionaryRetainCallBack;
        release:                CFDictionaryReleaseCallBack;
        copyDescription:        CFDictionaryCopyDescriptionCallBack;
        equal:                  CFDictionaryEqualCallBack;
    end;

var kCFTypeDictionaryValueCallBacks: CFDictionaryValueCallBacks; external name '_kCFTypeDictionaryValueCallBacks'; (* attribute const *)
    {
     *  kCFTypeDictionaryValueCallBacks
     *
     *  Discussion:
     *    Predefined CFDictionaryValueCallBacks structure containing a set
     *    of callbacks appropriate for use when the values in a
     *    CFDictionary are all CFTypes.
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }

    {
     *  CFDictionaryApplierFunction
     *
     *  Discussion:
     *    Type of the callback function used by the apply functions of
     *    CFDictionarys.
     *
     *  Parameters:
     *
     *    key:
     *      The current key for the value.
     *
     *    value:
     *      The current value from the dictionary.
     *
     *    context:
     *      The user-defined context parameter given to the apply function.
        }
type
    CFDictionaryApplierFunction = procedure(key: UnivPtr; value: UnivPtr; context: UnivPtr);


    {
     *  CFDictionaryRef
     *
     *  Discussion:
     *    This is the type of a reference to immutable CFDictionarys.
        }
    CFDictionaryRef    = ^SInt32; { an opaque 32-bit type }
    CFDictionaryRefPtr = ^CFDictionaryRef;  { when a var xx:CFDictionaryRef parameter can be nil, it is changed to xx: CFDictionaryRefPtr }

    {
     *  CFMutableDictionaryRef
     *
     *  Discussion:
     *    This is the type of a reference to mutable CFDictionarys.
        }
    CFMutableDictionaryRef    = CFDictionaryRef;
    CFMutableDictionaryRefPtr = ^CFMutableDictionaryRef;  { when a var xx:CFMutableDictionaryRef parameter can be nil, it is changed to xx: CFMutableDictionaryRefPtr }
    {
     *  CFDictionaryGetTypeID()
     *
     *  Discussion:
     *    Returns the type identifier of all CFDictionary instances.
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function CFDictionaryGetTypeID: CFTypeID; external name '_CFDictionaryGetTypeID';

{
 *  CFDictionaryCreate()
 *
 *  Discussion:
 *    Creates a new immutable dictionary with the given values.
 *
 *  Parameters:
 *
 *    allocator:
 *      The CFAllocator which should be used to allocate memory for the
 *      dictionary and its storage for values. This parameter may be
 *      NULL in which case the current default CFAllocator is used. If
 *      this reference is not a valid CFAllocator, the behavior is
 *      undefined.
 *
 *    keys:
 *      A C array of the pointer-sized keys to be used for the parallel
 *      C array of values to be put into the dictionary. This parameter
 *      may be NULL if the numValues parameter is 0. This C array is
 *      not changed or freed by this function. If this parameter is not
 *      a valid pointer to a C array of at least numValues pointers,
 *      the behavior is undefined.
 *
 *    values:
 *      A C array of the pointer-sized values to be in the dictionary.
 *      This parameter may be NULL if the numValues parameter is 0.
 *      This C array is not changed or freed by this function. If this
 *      parameter is not a valid pointer to a C array of at least
 *      numValues pointers, the behavior is undefined.
 *
 *    numValues:
 *      The number of values to copy from the keys and values C arrays
 *      into the CFDictionary. This number will be the count of the
 *      dictionary. If this parameter is negative, or greater than the
 *      number of values actually in the keys or values C arrays, the
 *      behavior is undefined.
 *
 *    keyCallBacks:
 *      A pointer to a CFDictionaryKeyCallBacks structure initialized
 *      with the callbacks for the dictionary to use on each key in the
 *      dictionary. The retain callback will be used within this
 *      function, for example, to retain all of the new keys from the
 *      keys C array. A copy of the contents of the callbacks structure
 *      is made, so that a pointer to a structure on the stack can be
 *      passed in, or can be reused for multiple dictionary creations.
 *      If the version field of this callbacks structure is not one of
 *      the defined ones for CFDictionary, the behavior is undefined.
 *      The retain field may be NULL, in which case the CFDictionary
 *      will do nothing to add a retain to the keys of the contained
 *      values. The release field may be NULL, in which case the
 *      CFDictionary will do nothing to remove the dictionary's retain
 *      (if any) on the keys when the dictionary is destroyed or a
 *      key-value pair is removed. If the copyDescription field is
 *      NULL, the dictionary will create a simple description for a
 *      key. If the equal field is NULL, the dictionary will use
 *      pointer equality to test for equality of keys. If the hash
 *      field is NULL, a key will be converted from a pointer to an
 *      SInt16 to compute the hash code. This callbacks parameter
 *      itself may be NULL, which is treated as if a valid structure of
 *      version 0 with all fields NULL had been passed in. Otherwise,
 *      if any of the fields are not valid pointers to functions of the
 *      correct type, or this parameter is not a valid pointer to a
 *      CFDictionaryKeyCallBacks callbacks structure, the behavior is
 *      undefined. If any of the keys put into the dictionary is not
 *      one understood by one of the callback functions the behavior
 *      when that callback function is used is undefined.
 *
 *    valueCallBacks:
 *      A pointer to a CFDictionaryValueCallBacks structure initialized
 *      with the callbacks for the dictionary to use on each value in
 *      the dictionary. The retain callback will be used within this
 *      function, for example, to retain all of the new values from the
 *      values C array. A copy of the contents of the callbacks
 *      structure is made, so that a pointer to a structure on the
 *      stack can be passed in, or can be reused for multiple
 *      dictionary creations. If the version field of this callbacks
 *      structure is not one of the defined ones for CFDictionary, the
 *      behavior is undefined. The retain field may be NULL, in which
 *      case the CFDictionary will do nothing to add a retain to values
 *      as they are put into the dictionary. The release field may be
 *      NULL, in which case the CFDictionary will do nothing to remove
 *      the dictionary's retain (if any) on the values when the
 *      dictionary is destroyed or a key-value pair is removed. If the
 *      copyDescription field is NULL, the dictionary will create a
 *      simple description for a value. If the equal field is NULL, the
 *      dictionary will use pointer equality to test for equality of
 *      values. This callbacks parameter itself may be NULL, which is
 *      treated as if a valid structure of version 0 with all fields
 *      NULL had been passed in. Otherwise, if any of the fields are
 *      not valid pointers to functions of the correct type, or this
 *      parameter is not a valid pointer to a
 *      CFDictionaryValueCallBacks callbacks structure, the behavior is
 *      undefined. If any of the values put into the dictionary is not
 *      one understood by one of the callback functions the behavior
 *      when that callback function is used is undefined.
 *
 *  Result:
 *    A reference to the new immutable CFDictionary.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFDictionaryCreate(allocator: CFAllocatorRef; var keys: UnivPtr; var values: UnivPtr; numValues: CFIndex; const (*var*) keyCallBacks: CFDictionaryKeyCallBacks; const (*var*) valueCallBacks: CFDictionaryValueCallBacks): CFDictionaryRef; external name '_CFDictionaryCreate';

{
 *  CFDictionaryCreateCopy()
 *
 *  Discussion:
 *    Creates a new immutable dictionary with the key-value pairs from
 *    the given dictionary.
 *
 *  Parameters:
 *
 *    allocator:
 *      The CFAllocator which should be used to allocate memory for the
 *      dictionary and its storage for values. This parameter may be
 *      NULL in which case the current default CFAllocator is used. If
 *      this reference is not a valid CFAllocator, the behavior is
 *      undefined.
 *
 *    theDict:
 *      The dictionary which is to be copied. The keys and values from
 *      the dictionary are copied as pointers into the new dictionary
 *      (that is, the values themselves are copied, not that which the
 *      values point to, if anything). However, the keys and values are
 *      also retained by the new dictionary using the retain function
 *      of the original dictionary. The count of the new dictionary
 *      will be the same as the given dictionary. The new dictionary
 *      uses the same callbacks as the dictionary to be copied. If this
 *      parameter is not a valid CFDictionary, the behavior is
 *      undefined.
 *
 *  Result:
 *    A reference to the new immutable CFDictionary.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFDictionaryCreateCopy(allocator: CFAllocatorRef; theDict: CFDictionaryRef): CFDictionaryRef; external name '_CFDictionaryCreateCopy';

{
 *  CFDictionaryCreateMutable()
 *
 *  Discussion:
 *    Creates a new mutable dictionary.
 *
 *  Parameters:
 *
 *    allocator:
 *      The CFAllocator which should be used to allocate memory for the
 *      dictionary and its storage for values. This parameter may be
 *      NULL in which case the current default CFAllocator is used. If
 *      this reference is not a valid CFAllocator, the behavior is
 *      undefined.
 *
 *    capacity:
 *      The maximum number of values that can be contained by the
 *      CFDictionary. The dictionary starts empty, and can grow to this
 *      number of values (and it can have less). If this parameter is
 *      0, the dictionary's maximum capacity is unlimited (or rather,
 *      only limited by address space and available memory
 *      constraints). If this parameter is negative, the behavior is
 *      undefined.
 *
 *    keyCallBacks:
 *      A pointer to a CFDictionaryKeyCallBacks structure initialized
 *      with the callbacks for the dictionary to use on each key in the
 *      dictionary. A copy of the contents of the callbacks structure
 *      is made, so that a pointer to a structure on the stack can be
 *      passed in, or can be reused for multiple dictionary creations.
 *      If the version field of this callbacks structure is not one of
 *      the defined ones for CFDictionary, the behavior is undefined.
 *      The retain field may be NULL, in which case the CFDictionary
 *      will do nothing to add a retain to the keys of the contained
 *      values. The release field may be NULL, in which case the
 *      CFDictionary will do nothing to remove the dictionary's retain
 *      (if any) on the keys when the dictionary is destroyed or a
 *      key-value pair is removed. If the copyDescription field is
 *      NULL, the dictionary will create a simple description for a
 *      key. If the equal field is NULL, the dictionary will use
 *      pointer equality to test for equality of keys. If the hash
 *      field is NULL, a key will be converted from a pointer to an
 *      SInt16 to compute the hash code. This callbacks parameter
 *      itself may be NULL, which is treated as if a valid structure of
 *      version 0 with all fields NULL had been passed in. Otherwise,
 *      if any of the fields are not valid pointers to functions of the
 *      correct type, or this parameter is not a valid pointer to a
 *      CFDictionaryKeyCallBacks callbacks structure, the behavior is
 *      undefined. If any of the keys put into the dictionary is not
 *      one understood by one of the callback functions the behavior
 *      when that callback function is used is undefined.
 *
 *    valueCallBacks:
 *      A pointer to a CFDictionaryValueCallBacks structure initialized
 *      with the callbacks for the dictionary to use on each value in
 *      the dictionary. The retain callback will be used within this
 *      function, for example, to retain all of the new values from the
 *      values C array. A copy of the contents of the callbacks
 *      structure is made, so that a pointer to a structure on the
 *      stack can be passed in, or can be reused for multiple
 *      dictionary creations. If the version field of this callbacks
 *      structure is not one of the defined ones for CFDictionary, the
 *      behavior is undefined. The retain field may be NULL, in which
 *      case the CFDictionary will do nothing to add a retain to values
 *      as they are put into the dictionary. The release field may be
 *      NULL, in which case the CFDictionary will do nothing to remove
 *      the dictionary's retain (if any) on the values when the
 *      dictionary is destroyed or a key-value pair is removed. If the
 *      copyDescription field is NULL, the dictionary will create a
 *      simple description for a value. If the equal field is NULL, the
 *      dictionary will use pointer equality to test for equality of
 *      values. This callbacks parameter itself may be NULL, which is
 *      treated as if a valid structure of version 0 with all fields
 *      NULL had been passed in. Otherwise, if any of the fields are
 *      not valid pointers to functions of the correct type, or this
 *      parameter is not a valid pointer to a
 *      CFDictionaryValueCallBacks callbacks structure, the behavior is
 *      undefined. If any of the values put into the dictionary is not
 *      one understood by one of the callback functions the behavior
 *      when that callback function is used is undefined.
 *
 *  Result:
 *    A reference to the new mutable CFDictionary.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFDictionaryCreateMutable(allocator: CFAllocatorRef; capacity: CFIndex; const (*var*) keyCallBacks: CFDictionaryKeyCallBacks; const (*var*) valueCallBacks: CFDictionaryValueCallBacks): CFMutableDictionaryRef; external name '_CFDictionaryCreateMutable';

{
 *  CFDictionaryCreateMutableCopy()
 *
 *  Discussion:
 *    Creates a new mutable dictionary with the key-value pairs from
 *    the given dictionary.
 *
 *  Parameters:
 *
 *    allocator:
 *      The CFAllocator which should be used to allocate memory for the
 *      dictionary and its storage for values. This parameter may be
 *      NULL in which case the current default CFAllocator is used. If
 *      this reference is not a valid CFAllocator, the behavior is
 *      undefined.
 *
 *    capacity:
 *      The maximum number of values that can be contained by the
 *      CFDictionary. The dictionary starts empty, and can grow to this
 *      number of values (and it can have less). If this parameter is
 *      0, the dictionary's maximum capacity is unlimited (or rather,
 *      only limited by address space and available memory
 *      constraints). This parameter must be greater than or equal to
 *      the count of the dictionary which is to be copied, or the
 *      behavior is undefined. If this parameter is negative, the
 *      behavior is undefined.
 *
 *    theDict:
 *      The dictionary which is to be copied. The keys and values from
 *      the dictionary are copied as pointers into the new dictionary
 *      (that is, the values themselves are copied, not that which the
 *      values point to, if anything). However, the keys and values are
 *      also retained by the new dictionary using the retain function
 *      of the original dictionary. The count of the new dictionary
 *      will be the same as the given dictionary. The new dictionary
 *      uses the same callbacks as the dictionary to be copied. If this
 *      parameter is not a valid CFDictionary, the behavior is
 *      undefined.
 *
 *  Result:
 *    A reference to the new mutable CFDictionary.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFDictionaryCreateMutableCopy(allocator: CFAllocatorRef; capacity: CFIndex; theDict: CFDictionaryRef): CFMutableDictionaryRef; external name '_CFDictionaryCreateMutableCopy';

{
 *  CFDictionaryGetCount()
 *
 *  Discussion:
 *    Returns the number of values currently in the dictionary.
 *
 *  Parameters:
 *
 *    theDict:
 *      The dictionary to be queried. If this parameter is not a valid
 *      CFDictionary, the behavior is undefined.
 *
 *  Result:
 *    The number of values in the dictionary.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFDictionaryGetCount(theDict: CFDictionaryRef): CFIndex; external name '_CFDictionaryGetCount';

{
 *  CFDictionaryGetCountOfKey()
 *
 *  Discussion:
 *    Counts the number of times the given key occurs in the dictionary.
 *
 *  Parameters:
 *
 *    theDict:
 *      The dictionary to be searched. If this parameter is not a valid
 *      CFDictionary, the behavior is undefined.
 *
 *    key:
 *      The key for which to find matches in the dictionary. The hash()
 *      and equal() key callbacks provided when the dictionary was
 *      created are used to compare. If the hash() key callback was
 *      NULL, the key is treated as a pointer and converted to an
 *      SInt16. If the equal() key callback was NULL, pointer equality
 *      (in C, ==) is used. If key, or any of the keys in the
 *      dictionary, are not understood by the equal() callback, the
 *      behavior is undefined.
 *
 *  Result:
 *    Returns 1 if a matching key is used by the dictionary, 0
 *    otherwise.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFDictionaryGetCountOfKey(theDict: CFDictionaryRef; key: UnivPtr): CFIndex; external name '_CFDictionaryGetCountOfKey';

{
 *  CFDictionaryGetCountOfValue()
 *
 *  Discussion:
 *    Counts the number of times the given value occurs in the
 *    dictionary.
 *
 *  Parameters:
 *
 *    theDict:
 *      The dictionary to be searched. If this parameter is not a valid
 *      CFDictionary, the behavior is undefined.
 *
 *    value:
 *      The value for which to find matches in the dictionary. The
 *      equal() callback provided when the dictionary was created is
 *      used to compare. If the equal() value callback was NULL,
 *      pointer equality (in C, ==) is used. If value, or any of the
 *      values in the dictionary, are not understood by the equal()
 *      callback, the behavior is undefined.
 *
 *  Result:
 *    The number of times the given value occurs in the dictionary.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFDictionaryGetCountOfValue(theDict: CFDictionaryRef; value: UnivPtr): CFIndex; external name '_CFDictionaryGetCountOfValue';

{
 *  CFDictionaryContainsKey()
 *
 *  Discussion:
 *    Reports whether or not the key is in the dictionary.
 *
 *  Parameters:
 *
 *    theDict:
 *      The dictionary to be searched. If this parameter is not a valid
 *      CFDictionary, the behavior is undefined.
 *
 *    key:
 *      The key for which to find matches in the dictionary. The hash()
 *      and equal() key callbacks provided when the dictionary was
 *      created are used to compare. If the hash() key callback was
 *      NULL, the key is treated as a pointer and converted to an
 *      SInt16. If the equal() key callback was NULL, pointer equality
 *      (in C, ==) is used. If key, or any of the keys in the
 *      dictionary, are not understood by the equal() callback, the
 *      behavior is undefined.
 *
 *  Result:
 *    TRUE, if the key is in the dictionary, otherwise FALSE.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFDictionaryContainsKey(theDict: CFDictionaryRef; key: UnivPtr): boolean; external name '_CFDictionaryContainsKey';

{
 *  CFDictionaryContainsValue()
 *
 *  Discussion:
 *    Reports whether or not the value is in the dictionary.
 *
 *  Parameters:
 *
 *    theDict:
 *      The dictionary to be searched. If this parameter is not a valid
 *      CFDictionary, the behavior is undefined.
 *
 *    value:
 *      The value for which to find matches in the dictionary. The
 *      equal() callback provided when the dictionary was created is
 *      used to compare. If the equal() callback was NULL, pointer
 *      equality (in C, ==) is used. If value, or any of the values in
 *      the dictionary, are not understood by the equal() callback, the
 *      behavior is undefined.
 *
 *  Result:
 *    TRUE, if the value is in the dictionary, otherwise FALSE.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFDictionaryContainsValue(theDict: CFDictionaryRef; value: UnivPtr): boolean; external name '_CFDictionaryContainsValue';

{
 *  CFDictionaryGetValue()
 *
 *  Discussion:
 *    Retrieves the value associated with the given key.
 *
 *  Parameters:
 *
 *    theDict:
 *      The dictionary to be queried. If this parameter is not a valid
 *      CFDictionary, the behavior is undefined.
 *
 *    key:
 *      The key for which to find a match in the dictionary. The hash()
 *      and equal() key callbacks provided when the dictionary was
 *      created are used to compare. If the hash() key callback was
 *      NULL, the key is treated as a pointer and converted to an
 *      SInt16. If the equal() key callback was NULL, pointer equality
 *      (in C, ==) is used. If key, or any of the keys in the
 *      dictionary, are not understood by the equal() callback, the
 *      behavior is undefined.
 *
 *  Result:
 *    The value with the given key in the dictionary, or NULL if no
 *    key-value pair with a matching key exists. Since NULL can be a
 *    valid value in some dictionaries, the function
 *    CFDictionaryGetValueIfPresent() must be used to distinguish
 *    NULL-no-found from NULL-is-the-value.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFDictionaryGetValue(theDict: CFDictionaryRef; key: UnivPtr): Ptr; external name '_CFDictionaryGetValue';

{
 *  CFDictionaryGetValueIfPresent()
 *
 *  Discussion:
 *    Retrieves the value associated with the given key.
 *
 *  Parameters:
 *
 *    theDict:
 *      The dictionary to be queried. If this parameter is not a valid
 *      CFDictionary, the behavior is undefined.
 *
 *    key:
 *      The key for which to find a match in the dictionary. The hash()
 *      and equal() key callbacks provided when the dictionary was
 *      created are used to compare. If the hash() key callback was
 *      NULL, the key is treated as a pointer and converted to an
 *      SInt16. If the equal() key callback was NULL, pointer equality
 *      (in C, ==) is used. If key, or any of the keys in the
 *      dictionary, are not understood by the equal() callback, the
 *      behavior is undefined.
 *
 *    value:
 *      A pointer to memory which should be filled with the
 *      pointer-sized value if a matching key is found. If no key match
 *      is found, the contents of the storage pointed to by this
 *      parameter are undefined. This parameter may be NULL, in which
 *      case the value from the dictionary is not returned (but the
 *      return value of this function still indicates whether or not
 *      the key-value pair was present).
 *
 *  Result:
 *    TRUE, if a matching key was found, FALSE otherwise.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFDictionaryGetValueIfPresent(theDict: CFDictionaryRef; key: UnivPtr; var value: UnivPtr): boolean; external name '_CFDictionaryGetValueIfPresent';

{
 *  CFDictionaryGetKeysAndValues()
 *
 *  Discussion:
 *    Fills the two buffers with the keys and values from the
 *    dictionary.
 *
 *  Parameters:
 *
 *    theDict:
 *      The dictionary to be queried. If this parameter is not a valid
 *      CFDictionary, the behavior is undefined.
 *
 *    keys:
 *      A C array of pointer-sized values to be filled with keys from
 *      the dictionary. The keys and values C arrays are parallel to
 *      each other (that is, the items at the same indices form a
 *      key-value pair from the dictionary). This parameter may be NULL
 *      if the keys are not desired. If this parameter is not a valid
 *      pointer to a C array of at least CFDictionaryGetCount()
 *      pointers, or NULL, the behavior is undefined.
 *
 *    values:
 *      A C array of pointer-sized values to be filled with values from
 *      the dictionary. The keys and values C arrays are parallel to
 *      each other (that is, the items at the same indices form a
 *      key-value pair from the dictionary). This parameter may be NULL
 *      if the values are not desired. If this parameter is not a valid
 *      pointer to a C array of at least CFDictionaryGetCount()
 *      pointers, or NULL, the behavior is undefined.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CFDictionaryGetKeysAndValues(theDict: CFDictionaryRef; var keys: UnivPtr; var values: UnivPtr); external name '_CFDictionaryGetKeysAndValues';

{
 *  CFDictionaryApplyFunction()
 *
 *  Discussion:
 *    Calls a function once for each value in the dictionary.
 *
 *  Parameters:
 *
 *    theDict:
 *      The dictionary to be queried. If this parameter is not a valid
 *      CFDictionary, the behavior is undefined.
 *
 *    applier:
 *      The callback function to call once for each value in the
 *      dictionary. If this parameter is not a pointer to a function of
 *      the correct prototype, the behavior is undefined. If there are
 *      keys or values which the applier function does not expect or
 *      cannot properly apply to, the behavior is undefined.
 *
 *    context:
 *      A pointer-sized user-defined value, which is passed as the
 *      third parameter to the applier function, but is otherwise
 *      unused by this function. If the context is not what is expected
 *      by the applier function, the behavior is undefined.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CFDictionaryApplyFunction(theDict: CFDictionaryRef; applier: CFDictionaryApplierFunction; context: UnivPtr); external name '_CFDictionaryApplyFunction';

{
 *  CFDictionaryAddValue()
 *
 *  Discussion:
 *    Adds the key-value pair to the dictionary if no such key already
 *    exists.
 *
 *  Parameters:
 *
 *    theDict:
 *      The dictionary to which the value is to be added. If this
 *      parameter is not a valid mutable CFDictionary, the behavior is
 *      undefined. If the dictionary is a fixed-capacity dictionary and
 *      it is full before this operation, the behavior is undefined.
 *
 *    key:
 *      The key of the value to add to the dictionary. The key is
 *      retained by the dictionary using the retain callback provided
 *      when the dictionary was created. If the key is not of the sort
 *      expected by the retain callback, the behavior is undefined. If
 *      a key which matches this key is already present in the
 *      dictionary, this function does nothing ("add if absent").
 *
 *    value:
 *      The value to add to the dictionary. The value is retained by
 *      the dictionary using the retain callback provided when the
 *      dictionary was created. If the value is not of the sort
 *      expected by the retain callback, the behavior is undefined.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CFDictionaryAddValue(theDict: CFMutableDictionaryRef; key: UnivPtr; value: UnivPtr); external name '_CFDictionaryAddValue';

{
 *  CFDictionarySetValue()
 *
 *  Discussion:
 *    Sets the value of the key in the dictionary.
 *
 *  Parameters:
 *
 *    theDict:
 *      The dictionary to which the value is to be set. If this
 *      parameter is not a valid mutable CFDictionary, the behavior is
 *      undefined. If the dictionary is a fixed-capacity dictionary and
 *      it is full before this operation, and the key does not exist in
 *      the dictionary, the behavior is undefined.
 *
 *    key:
 *      The key of the value to set into the dictionary. If a key which
 *      matches this key is already present in the dictionary, only the
 *      value is changed ("add if absent, replace if present"). If no
 *      key matches the given key, the key-value pair is added to the
 *      dictionary. If added, the key is retained by the dictionary,
 *      using the retain callback provided when the dictionary was
 *      created. If the key is not of the sort expected by the key
 *      retain callback, the behavior is undefined.
 *
 *    value:
 *      The value to add to or replace into the dictionary. The value
 *      is retained by the dictionary using the retain callback
 *      provided when the dictionary was created, and the previous
 *      value if any is released. If the value is not of the sort
 *      expected by the retain or release callbacks, the behavior is
 *      undefined.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CFDictionarySetValue(theDict: CFMutableDictionaryRef; key: UnivPtr; value: UnivPtr); external name '_CFDictionarySetValue';

{
 *  CFDictionaryReplaceValue()
 *
 *  Discussion:
 *    Replaces the value of the key in the dictionary.
 *
 *  Parameters:
 *
 *    theDict:
 *      The dictionary to which the value is to be replaced. If this
 *      parameter is not a valid mutable CFDictionary, the behavior is
 *      undefined.
 *
 *    key:
 *      The key of the value to replace in the dictionary. If a key
 *      which matches this key is present in the dictionary, the value
 *      is changed to the given value, otherwise this function does
 *      nothing ("replace if present").
 *
 *    value:
 *      The value to replace into the dictionary. The value is retained
 *      by the dictionary using the retain callback provided when the
 *      dictionary was created, and the previous value is released. If
 *      the value is not of the sort expected by the retain or release
 *      callbacks, the behavior is undefined.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CFDictionaryReplaceValue(theDict: CFMutableDictionaryRef; key: UnivPtr; value: UnivPtr); external name '_CFDictionaryReplaceValue';

{
 *  CFDictionaryRemoveValue()
 *
 *  Discussion:
 *    Removes the value of the key from the dictionary.
 *
 *  Parameters:
 *
 *    theDict:
 *      The dictionary from which the value is to be removed. If this
 *      parameter is not a valid mutable CFDictionary, the behavior is
 *      undefined.
 *
 *    key:
 *      The key of the value to remove from the dictionary. If a key
 *      which matches this key is present in the dictionary, the
 *      key-value pair is removed from the dictionary, otherwise this
 *      function does nothing ("remove if present").
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CFDictionaryRemoveValue(theDict: CFMutableDictionaryRef; key: UnivPtr); external name '_CFDictionaryRemoveValue';

{
 *  CFDictionaryRemoveAllValues()
 *
 *  Discussion:
 *    Removes all the values from the dictionary, making it empty.
 *
 *  Parameters:
 *
 *    theDict:
 *      The dictionary from which all of the values are to be removed.
 *      If this parameter is not a valid mutable CFDictionary, the
 *      behavior is undefined.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CFDictionaryRemoveAllValues(theDict: CFMutableDictionaryRef); external name '_CFDictionaryRemoveAllValues';

{$ALIGN MAC68K}
{#POP}
{unit CFLocale}
{$ALIGN MAC68K}






// #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3

type
    CFLocaleRef    = ^SInt32; { an opaque 32-bit type }

// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function CFLocaleGetTypeID: CFTypeID; external name '_CFLocaleGetTypeID';

// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function CFLocaleGetSystem: CFLocaleRef; external name '_CFLocaleGetSystem';
    // Returns the "root", canonical locale.  Contains fixed "backstop" settings.

// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function CFLocaleCopyCurrent: CFLocaleRef; external name '_CFLocaleCopyCurrent';
    // Returns the logical "user" locale for the current user.
    // [This is Copy in the sense that you get a retain you have to release,
    // but we may return the same cached object over and over.]  Settings
    // you get from this locale do not change under you as CFPreferences
    // are changed (for safety and correctness).  Generally you would not
    // grab this and hold onto it forever, but use it to do the operations
    // you need to do at the moment, then throw it away.  (The non-changing
    // ensures that all the results of your operations are consistent.)

// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function CFLocaleCreateCanonicalLocaleIdentifierFromString( allocator: CFAllocatorRef; localeIdentifier: CFStringRef ): CFStringRef; external name '_CFLocaleCreateCanonicalLocaleIdentifierFromString';
    // Map an arbitrary locale identification string (something close at
    // least) to the canonical identifier.

// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function CFLocaleCreateCanonicalLocaleIdentifierFromScriptManagerCodes( allocator: CFAllocatorRef; lcode: LangCode; rcode: RegionCode ): CFStringRef; external name '_CFLocaleCreateCanonicalLocaleIdentifierFromScriptManagerCodes';
    // Map a Mac OS LangCode and RegionCode to the canonical locale identifier.

// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function CFLocaleCreate( allocator: CFAllocatorRef; localeIdentifier: CFStringRef ): CFLocaleRef; external name '_CFLocaleCreate';
    // Returns a CFLocaleRef for the locale named by the "arbitrary" locale identifier.

// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function CFLocaleCreateCopy( allocator: CFAllocatorRef; locale: CFLocaleRef ): CFLocaleRef; external name '_CFLocaleCreateCopy';
    // Having gotten a CFLocale from somebody, code should make a copy
    // if it is going to use it for several operations
    // or hold onto it.  In the future, there may be mutable locales.

// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function CFLocaleGetIdentifier( locale: CFLocaleRef ): CFStringRef; external name '_CFLocaleGetIdentifier';
    // Returns the locale's identifier.  This may not be the same string
    // that the locale was created with (CFLocale may canonicalize it).

// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function CFLocaleGetValue( locale: CFLocaleRef; key: CFStringRef ): CFTypeRef; external name '_CFLocaleGetValue';
    // Returns the value for the given key.  This is how settings and state
    // are accessed via a CFLocale.  Values might be of any CF type.


// Locale Keys
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
var kCFLocaleMeasurementSystem: CFStringRef; external name '_kCFLocaleMeasurementSystem'; (* attribute const *) // "Metric" or "U.S."
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
var kCFLocaleDecimalSeparator: CFStringRef; external name '_kCFLocaleDecimalSeparator'; (* attribute const *)
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
var kCFLocaleGroupingSeparator: CFStringRef; external name '_kCFLocaleGroupingSeparator'; (* attribute const *)
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
var kCFLocaleCurrencySymbol: CFStringRef; external name '_kCFLocaleCurrencySymbol'; (* attribute const *)
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
var kCFLocaleCurrencyCode: CFStringRef; external name '_kCFLocaleCurrencyCode'; (* attribute const *) // ISO 3-letter currency code
{unit CFNotificationCenter}
{$ALIGN MAC68K}





type
    CFNotificationCenterRef    = ^SInt32; { an opaque 32-bit type }

type
    CFNotificationCallback = procedure( center: CFNotificationCenterRef; observer: UnivPtr; name: CFStringRef; obj: UnivPtr; userInfo: CFDictionaryRef );

type
    CFNotificationSuspensionBehavior = SInt32;
const
    CFNotificationSuspensionBehaviorDrop = 1;
        // The server will not queue any notifications with this name and object while the process/app is in the background.
    CFNotificationSuspensionBehaviorCoalesce = 2;
        // The server will only queue the last notification of the specified name and object; earlier notifications are dropped.
    CFNotificationSuspensionBehaviorHold = 3;
        // The server will hold all matching notifications until the queue has been filled (queue size determined by the server) at which point the server may flush queued notifications.
    CFNotificationSuspensionBehaviorDeliverImmediately = 4;
        // The server will deliver notifications matching this registration whether or not the process is in the background.  When a notification with this suspension behavior is matched, it has the effect of first flushing any queued notifications.

function CFNotificationCenterGetTypeID: CFTypeID; external name '_CFNotificationCenterGetTypeID';

function CFNotificationCenterGetDistributedCenter: CFNotificationCenterRef; external name '_CFNotificationCenterGetDistributedCenter';

procedure CFNotificationCenterAddObserver( center: CFNotificationCenterRef; observer: UnivPtr; callBack: CFNotificationCallback; name: CFStringRef; obj: UnivPtr; suspensionBehavior: CFNotificationSuspensionBehavior ); external name '_CFNotificationCenterAddObserver';

procedure CFNotificationCenterRemoveObserver( center: CFNotificationCenterRef; observer: UnivPtr; name: CFStringRef; obj: UnivPtr ); external name '_CFNotificationCenterRemoveObserver';
procedure CFNotificationCenterRemoveEveryObserver( center: CFNotificationCenterRef; observer: UnivPtr ); external name '_CFNotificationCenterRemoveEveryObserver';

procedure CFNotificationCenterPostNotification( center: CFNotificationCenterRef; name: CFStringRef; obj: UnivPtr; userInfo: CFDictionaryRef; deliverImmediately: Boolean ); external name '_CFNotificationCenterPostNotification';

// #if MAC_OS_X_VERSION_10_3 <= MAC_OS_X_VERSION_MAX_ALLOWED

const
    kCFNotificationDeliverImmediately = (1 shl 0);
    kCFNotificationPostToAllSessions = (1 shl 1);

// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
procedure CFNotificationCenterPostNotificationWithOptions( center: CFNotificationCenterRef; name: CFStringRef; obj: UnivPtr; userInfo: CFDictionaryRef; options: CFOptionFlags ); external name '_CFNotificationCenterPostNotificationWithOptions';

// #endif
{unit CFNumber}
{$ALIGN MAC68K}










{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}


type
    CFBooleanRef    = ^SInt32; { an opaque 32-bit type }
    CFBooleanRefPtr = ^CFBooleanRef;  { when a var xx:CFBooleanRef parameter can be nil, it is changed to xx: CFBooleanRefPtr }
var kCFBooleanTrue: CFBooleanRef; external name '_kCFBooleanTrue'; (* attribute const *)
    {
     *  kCFBooleanTrue
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
var kCFBooleanFalse: CFBooleanRef; external name '_kCFBooleanFalse'; (* attribute const *)
    {
     *  kCFBooleanFalse
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
    {
     *  CFBooleanGetTypeID()
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function CFBooleanGetTypeID: CFTypeID; external name '_CFBooleanGetTypeID';

{
 *  CFBooleanGetValue()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFBooleanGetValue(boolean: CFBooleanRef): boolean; external name '_CFBooleanGetValue';


type
    CFNumberType                = SInt32;
const
                                                                {  Types from MacTypes.h  }
    kCFNumberSInt8Type          = 1;
    kCFNumberSInt16Type         = 2;
    kCFNumberSInt32Type         = 3;
    kCFNumberSInt64Type         = 4;
    kCFNumberFloat32Type        = 5;
    kCFNumberFloat64Type        = 6;                            {  64-bit IEEE 754  }
                                                                {  Basic C types  }
    kCFNumberCharType           = 7;
    kCFNumberShortType          = 8;
    kCFNumberIntType            = 9;
    kCFNumberLongType           = 10;
    kCFNumberLongLongType       = 11;
    kCFNumberFloatType          = 12;
    kCFNumberDoubleType         = 13;                           {  Other  }
    kCFNumberCFIndexType        = 14;
    kCFNumberMaxType            = 14;


type
    CFNumberRef    = ^SInt32; { an opaque 32-bit type }
    CFNumberRefPtr = ^CFNumberRef;  { when a var xx:CFNumberRef parameter can be nil, it is changed to xx: CFNumberRefPtr }
var kCFNumberPositiveInfinity: CFNumberRef; external name '_kCFNumberPositiveInfinity'; (* attribute const *)
    {
     *  kCFNumberPositiveInfinity
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
var kCFNumberNegativeInfinity: CFNumberRef; external name '_kCFNumberNegativeInfinity'; (* attribute const *)
    {
     *  kCFNumberNegativeInfinity
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
var kCFNumberNaN: CFNumberRef; external name '_kCFNumberNaN'; (* attribute const *)
    {
     *  kCFNumberNaN
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
    {
     *  CFNumberGetTypeID()
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function CFNumberGetTypeID: CFTypeID; external name '_CFNumberGetTypeID';

{
    Creates a CFNumber with the given value. The type of number pointed
    to by the valuePtr is specified by type. If type is a floating point
    type and the value represents one of the infinities or NaN, the
    well-defined CFNumber for that value is returned. If either of
    valuePtr or type is an invalid value, the result is undefined.
}
{
 *  CFNumberCreate()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFNumberCreate(allocator: CFAllocatorRef; theType: CFNumberType; valuePtr: UnivPtr): CFNumberRef; external name '_CFNumberCreate';

{
    Returns the storage format of the CFNumber's value.  Note that
    this is not necessarily the type provided in CFNumberCreate().
}
{
 *  CFNumberGetType()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFNumberGetType(number: CFNumberRef): CFNumberType; external name '_CFNumberGetType';

{
    Returns the size in bytes of the type of the number.
}
{
 *  CFNumberGetByteSize()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFNumberGetByteSize(number: CFNumberRef): CFIndex; external name '_CFNumberGetByteSize';

{
    Returns TRUE if the type of the CFNumber's value is one of
    the defined floating point types.
}
{
 *  CFNumberIsFloatType()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFNumberIsFloatType(number: CFNumberRef): boolean; external name '_CFNumberIsFloatType';

{
    Copies the CFNumber's value into the space pointed to by
    valuePtr, as the specified type. If conversion needs to take
    place, the conversion rules follow human expectation and not
    C's promotion and truncation rules. If the conversion is
    lossy, or the value is out of range, FALSE is returned. Best
    attempt at conversion will still be in *valuePtr.
}
{
 *  CFNumberGetValue()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFNumberGetValue(number: CFNumberRef; theType: CFNumberType; valuePtr: UnivPtr): boolean; external name '_CFNumberGetValue';

{
    Compares the two CFNumber instances. If conversion of the
    types of the values is needed, the conversion and comparison
    follow human expectations and not C's promotion and comparison
    rules. Negative zero compares less than positive zero.
    Positive infinity compares greater than everything except
    itself, to which it compares equal. Negative infinity compares
    less than everything except itself, to which it compares equal.
    Unlike standard practice, if both numbers are NaN, then they
    compare equal; if only one of the numbers is NaN, then the NaN
    compares greater than the other number if it is negative, and
    smaller than the other number if it is positive. (Note that in
    CFEqual() with two CFNumbers, if either or both of the numbers
    is NaN, FALSE is returned.)
}
{
 *  CFNumberCompare()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFNumberCompare(number: CFNumberRef; otherNumber: CFNumberRef; context: UnivPtr): CFComparisonResult; external name '_CFNumberCompare';

{$ALIGN MAC68K}
{#POP}
{unit CFNumberFormatter}
{$ALIGN MAC68K}






// #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3

type
    CFNumberFormatterRef    = ^SInt32; { an opaque 32-bit type }

// CFNumberFormatters are not thread-safe.  Do not use one from multiple threads!

// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function CFNumberFormatterGetTypeID: CFTypeID; external name '_CFNumberFormatterGetTypeID';

// number format styles
type
    CFNumberFormatterStyle = SInt32;
const
    kCFNumberFormatterNoStyle = 0;
    kCFNumberFormatterDecimalStyle = 1;
    kCFNumberFormatterCurrencyStyle = 2;
    kCFNumberFormatterPercentStyle = 3;
    kCFNumberFormatterScientificStyle = 4;

// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function CFNumberFormatterCreate( allocator: CFAllocatorRef; locale: CFLocaleRef; style: CFNumberFormatterStyle ): CFNumberFormatterRef; external name '_CFNumberFormatterCreate';
    // Returns a CFNumberFormatter, localized to the given locale, which
    // will format numbers to the given style.

// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function CFNumberFormatterGetLocale( formatter: CFNumberFormatterRef ): CFLocaleRef; external name '_CFNumberFormatterGetLocale';

// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function CFNumberFormatterGetStyle( formatter: CFNumberFormatterRef ): CFNumberFormatterStyle; external name '_CFNumberFormatterGetStyle';
    // Get the properties with which the number formatter was created.

// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function CFNumberFormatterGetFormat( formatter: CFNumberFormatterRef ): CFStringRef; external name '_CFNumberFormatterGetFormat';

// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
procedure CFNumberFormatterSetFormat( formatter: CFNumberFormatterRef; formatString: CFStringRef ); external name '_CFNumberFormatterSetFormat';
    // Set the format description string of the number formatter.  This
    // overrides the style settings.  The format of the format string
    // is as defined by the ICU library, and is similar to that found
    // in Microsoft Excel and NSNumberFormatter (and Java I believe).
    // The number formatter starts with a default format string defined
    // by the style argument with which it was created.


// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function CFNumberFormatterCreateStringWithNumber( allocator: CFAllocatorRef; formatter: CFNumberFormatterRef; number: CFNumberRef ): CFStringRef; external name '_CFNumberFormatterCreateStringWithNumber';

// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function CFNumberFormatterCreateStringWithValue( allocator: CFAllocatorRef; formatter: CFNumberFormatterRef; numberType: CFNumberType; valuePtr: UnivPtr ): CFStringRef; external name '_CFNumberFormatterCreateStringWithValue';
    // Create a string representation of the given number or value
    // using the current state of the number formatter.


type
    CFNumberFormatterOptionFlags = SInt32;
const
    kCFNumberFormatterParseIntegersOnly = 1;    { only parse integers }

// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function CFNumberFormatterCreateNumberFromString( allocator: CFAllocatorRef; formatter: CFNumberFormatterRef; str: CFStringRef; rangep: CFRangePtr; options: CFOptionFlags ): CFNumberRef; external name '_CFNumberFormatterCreateNumberFromString';

// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function CFNumberFormatterGetValueFromString( formatter: CFNumberFormatterRef; str: CFStringRef; rangep: CFRangePtr; numberType: CFNumberType; valuePtr: UnivPtr ): Boolean; external name '_CFNumberFormatterGetValueFromString';
    // Parse a string representation of a number using the current state
    // of the number formatter.  The range parameter specifies the range
    // of the string in which the parsing should occur in input, and on
    // output indicates the extent that was used; this parameter can
    // be NULL, in which case the whole string may be used.  The
    // return value indicates whether some number was computed and
    // (if valuePtr is not NULL) stored at the location specified by
    // valuePtr.  The numberType indicates the type of value pointed
    // to by valuePtr.


// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
procedure CFNumberFormatterSetProperty( formatter: CFNumberFormatterRef; key: CFStringRef; value: CFTypeRef ); external name '_CFNumberFormatterSetProperty';

// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function CFNumberFormatterCopyProperty( formatter: CFNumberFormatterRef; key: CFStringRef ): CFTypeRef; external name '_CFNumberFormatterCopyProperty';
    // Set and get various properties of the number formatter, the set of
    // which may be expanded in the future.

// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
var kCFNumberFormatterCurrencyCode: CFStringRef; external name '_kCFNumberFormatterCurrencyCode'; (* attribute const *)     // CFString
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
var kCFNumberFormatterDecimalSeparator: CFStringRef; external name '_kCFNumberFormatterDecimalSeparator'; (* attribute const *) // CFString
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
var kCFNumberFormatterCurrencyDecimalSeparator: CFStringRef; external name '_kCFNumberFormatterCurrencyDecimalSeparator'; (* attribute const *) // CFString
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
var kCFNumberFormatterAlwaysShowDecimalSeparator: CFStringRef; external name '_kCFNumberFormatterAlwaysShowDecimalSeparator'; (* attribute const *) // CFBoolean
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
var kCFNumberFormatterGroupingSeparator: CFStringRef; external name '_kCFNumberFormatterGroupingSeparator'; (* attribute const *)   // CFString
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
var kCFNumberFormatterUseGroupingSeparator: CFStringRef; external name '_kCFNumberFormatterUseGroupingSeparator'; (* attribute const *) // CFBoolean
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
var kCFNumberFormatterPercentSymbol: CFStringRef; external name '_kCFNumberFormatterPercentSymbol'; (* attribute const *)       // CFString
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
var kCFNumberFormatterZeroSymbol: CFStringRef; external name '_kCFNumberFormatterZeroSymbol'; (* attribute const *)     // CFString
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
var kCFNumberFormatterNaNSymbol: CFStringRef; external name '_kCFNumberFormatterNaNSymbol'; (* attribute const *)       // CFString
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
var kCFNumberFormatterInfinitySymbol: CFStringRef; external name '_kCFNumberFormatterInfinitySymbol'; (* attribute const *)     // CFString
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
var kCFNumberFormatterMinusSign: CFStringRef; external name '_kCFNumberFormatterMinusSign'; (* attribute const *)       // CFString
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
var kCFNumberFormatterPlusSign: CFStringRef; external name '_kCFNumberFormatterPlusSign'; (* attribute const *)     // CFString
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
var kCFNumberFormatterCurrencySymbol: CFStringRef; external name '_kCFNumberFormatterCurrencySymbol'; (* attribute const *)     // CFString
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
var kCFNumberFormatterExponentSymbol: CFStringRef; external name '_kCFNumberFormatterExponentSymbol'; (* attribute const *)     // CFString
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
var kCFNumberFormatterMinIntegerDigits: CFStringRef; external name '_kCFNumberFormatterMinIntegerDigits'; (* attribute const *) // CFNumber
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
var kCFNumberFormatterMaxIntegerDigits: CFStringRef; external name '_kCFNumberFormatterMaxIntegerDigits'; (* attribute const *) // CFNumber
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
var kCFNumberFormatterMinFractionDigits: CFStringRef; external name '_kCFNumberFormatterMinFractionDigits'; (* attribute const *)   // CFNumber
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
var kCFNumberFormatterMaxFractionDigits: CFStringRef; external name '_kCFNumberFormatterMaxFractionDigits'; (* attribute const *)   // CFNumber
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
var kCFNumberFormatterGroupingSize: CFStringRef; external name '_kCFNumberFormatterGroupingSize'; (* attribute const *)     // CFNumber
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
var kCFNumberFormatterSecondaryGroupingSize: CFStringRef; external name '_kCFNumberFormatterSecondaryGroupingSize'; (* attribute const *)   // CFNumber
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
var kCFNumberFormatterRoundingMode: CFStringRef; external name '_kCFNumberFormatterRoundingMode'; (* attribute const *)     // CFNumber
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
var kCFNumberFormatterRoundingIncrement: CFStringRef; external name '_kCFNumberFormatterRoundingIncrement'; (* attribute const *)   // CFNumber
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
var kCFNumberFormatterFormatWidth: CFStringRef; external name '_kCFNumberFormatterFormatWidth'; (* attribute const *)       // CFNumber
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
var kCFNumberFormatterPaddingPosition: CFStringRef; external name '_kCFNumberFormatterPaddingPosition'; (* attribute const *)   // CFNumber
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
var kCFNumberFormatterPaddingCharacter: CFStringRef; external name '_kCFNumberFormatterPaddingCharacter'; (* attribute const *) // CFString
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
var kCFNumberFormatterDefaultFormat: CFStringRef; external name '_kCFNumberFormatterDefaultFormat'; (* attribute const *)       // CFString

type
    CFNumberFormatterRoundingMode = SInt32;
const
    kCFNumberFormatterRoundCeiling = 0;
    kCFNumberFormatterRoundFloor = 1;
    kCFNumberFormatterRoundDown = 2;
    kCFNumberFormatterRoundUp = 3;
    kCFNumberFormatterRoundHalfEven = 4;
    kCFNumberFormatterRoundHalfDown = 5;
    kCFNumberFormatterRoundHalfUp = 6;

type
    CFNumberFormatterPadPosition = SInt32;
const
    kCFNumberFormatterPadBeforePrefix = 0;
    kCFNumberFormatterPadAfterPrefix = 1;
    kCFNumberFormatterPadBeforeSuffix = 2;
    kCFNumberFormatterPadAfterSuffix = 3;


// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function CFNumberFormatterGetDecimalInfoForCurrencyCode( currencyCode: CFStringRef; defaultFractionDigits: SInt32Ptr; roundingIncrement: Float64Ptr ): Boolean; external name '_CFNumberFormatterGetDecimalInfoForCurrencyCode';
    // Returns the number of fraction digits that should be displayed, and
    // the rounding increment (or 0.0 if no rounding is done by the currency)
    // for the given currency.  Returns false if the currency code is unknown
    // or the information is not available.
    // Not localized because these are properties of the currency.
{unit CFSet}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}


type
    CFSetRetainCallBack = function(allocator: CFAllocatorRef; value: UnivPtr): Ptr;

    CFSetReleaseCallBack = procedure(allocator: CFAllocatorRef; value: UnivPtr);

    CFSetCopyDescriptionCallBack = function(value: UnivPtr): CFStringRef;

    CFSetEqualCallBack = function(value1: UnivPtr; value2: UnivPtr): boolean;

    CFSetHashCallBack = function(value: UnivPtr): CFHashCode;

    CFSetCallBacksPtr = ^CFSetCallBacks;
    CFSetCallBacks = record
        version:                CFIndex;
        retain:                 CFSetRetainCallBack;
        release:                CFSetReleaseCallBack;
        copyDescription:        CFSetCopyDescriptionCallBack;
        equal:                  CFSetEqualCallBack;
        hash:                   CFSetHashCallBack;
    end;

var kCFTypeSetCallBacks: CFSetCallBacks; external name '_kCFTypeSetCallBacks'; (* attribute const *)
    {
     *  kCFTypeSetCallBacks
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
var kCFCopyStringSetCallBacks: CFSetCallBacks; external name '_kCFCopyStringSetCallBacks'; (* attribute const *)
    {
     *  kCFCopyStringSetCallBacks
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
type
    CFSetApplierFunction = procedure(value: UnivPtr; context: UnivPtr);

    CFSetRef    = ^SInt32; { an opaque 32-bit type }
    CFSetRefPtr = ^CFSetRef;  { when a var xx:CFSetRef parameter can be nil, it is changed to xx: CFSetRefPtr }
    CFMutableSetRef    = CFSetRef;
    CFMutableSetRefPtr = ^CFMutableSetRef;  { when a var xx:CFMutableSetRef parameter can be nil, it is changed to xx: CFMutableSetRefPtr }
    {
     *  CFSetGetTypeID()
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function CFSetGetTypeID: CFTypeID; external name '_CFSetGetTypeID';

{
 *  CFSetCreate()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFSetCreate(allocator: CFAllocatorRef; var values: UnivPtr; numValues: CFIndex; const (*var*) callBacks: CFSetCallBacks): CFSetRef; external name '_CFSetCreate';

{
 *  CFSetCreateCopy()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFSetCreateCopy(allocator: CFAllocatorRef; theSet: CFSetRef): CFSetRef; external name '_CFSetCreateCopy';

{
 *  CFSetCreateMutable()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFSetCreateMutable(allocator: CFAllocatorRef; capacity: CFIndex; const (*var*) callBacks: CFSetCallBacks): CFMutableSetRef; external name '_CFSetCreateMutable';

{
 *  CFSetCreateMutableCopy()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFSetCreateMutableCopy(allocator: CFAllocatorRef; capacity: CFIndex; theSet: CFSetRef): CFMutableSetRef; external name '_CFSetCreateMutableCopy';

{
 *  CFSetGetCount()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFSetGetCount(theSet: CFSetRef): CFIndex; external name '_CFSetGetCount';

{
 *  CFSetGetCountOfValue()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFSetGetCountOfValue(theSet: CFSetRef; value: UnivPtr): CFIndex; external name '_CFSetGetCountOfValue';

{
 *  CFSetContainsValue()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFSetContainsValue(theSet: CFSetRef; value: UnivPtr): boolean; external name '_CFSetContainsValue';

{
 *  CFSetGetValue()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFSetGetValue(theSet: CFSetRef; value: UnivPtr): Ptr; external name '_CFSetGetValue';

{
 *  CFSetGetValueIfPresent()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFSetGetValueIfPresent(theSet: CFSetRef; candidate: UnivPtr; var value: UnivPtr): boolean; external name '_CFSetGetValueIfPresent';

{
 *  CFSetGetValues()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CFSetGetValues(theSet: CFSetRef; var values: UnivPtr); external name '_CFSetGetValues';

{
 *  CFSetApplyFunction()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CFSetApplyFunction(theSet: CFSetRef; applier: CFSetApplierFunction; context: UnivPtr); external name '_CFSetApplyFunction';

{
 *  CFSetAddValue()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CFSetAddValue(theSet: CFMutableSetRef; value: UnivPtr); external name '_CFSetAddValue';

{
 *  CFSetReplaceValue()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CFSetReplaceValue(theSet: CFMutableSetRef; value: UnivPtr); external name '_CFSetReplaceValue';

{
 *  CFSetSetValue()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CFSetSetValue(theSet: CFMutableSetRef; value: UnivPtr); external name '_CFSetSetValue';

{
 *  CFSetRemoveValue()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CFSetRemoveValue(theSet: CFMutableSetRef; value: UnivPtr); external name '_CFSetRemoveValue';

{
 *  CFSetRemoveAllValues()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CFSetRemoveAllValues(theSet: CFMutableSetRef); external name '_CFSetRemoveAllValues';

{$ALIGN MAC68K}
{#POP}
{unit CFStringEncodingExt}
{$ALIGN MAC68K}










{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}


type
    CFStringEncodings           = SInt32;
const
                                                                {   kCFStringEncodingMacRoman = 0L, defined in CoreFoundation/CFString.h  }
    kCFStringEncodingMacJapanese = 1;
    kCFStringEncodingMacChineseTrad = 2;
    kCFStringEncodingMacKorean  = 3;
    kCFStringEncodingMacArabic  = 4;
    kCFStringEncodingMacHebrew  = 5;
    kCFStringEncodingMacGreek   = 6;
    kCFStringEncodingMacCyrillic = 7;
    kCFStringEncodingMacDevanagari = 9;
    kCFStringEncodingMacGurmukhi = 10;
    kCFStringEncodingMacGujarati = 11;
    kCFStringEncodingMacOriya   = 12;
    kCFStringEncodingMacBengali = 13;
    kCFStringEncodingMacTamil   = 14;
    kCFStringEncodingMacTelugu  = 15;
    kCFStringEncodingMacKannada = 16;
    kCFStringEncodingMacMalayalam = 17;
    kCFStringEncodingMacSinhalese = 18;
    kCFStringEncodingMacBurmese = 19;
    kCFStringEncodingMacKhmer   = 20;
    kCFStringEncodingMacThai    = 21;
    kCFStringEncodingMacLaotian = 22;
    kCFStringEncodingMacGeorgian = 23;
    kCFStringEncodingMacArmenian = 24;
    kCFStringEncodingMacChineseSimp = 25;
    kCFStringEncodingMacTibetan = 26;
    kCFStringEncodingMacMongolian = 27;
    kCFStringEncodingMacEthiopic = 28;
    kCFStringEncodingMacCentralEurRoman = 29;
    kCFStringEncodingMacVietnamese = 30;
    kCFStringEncodingMacExtArabic = 31;                         {  The following use script code 0, smRoman  }
    kCFStringEncodingMacSymbol  = 33;
    kCFStringEncodingMacDingbats = 34;
    kCFStringEncodingMacTurkish = 35;
    kCFStringEncodingMacCroatian = 36;
    kCFStringEncodingMacIcelandic = 37;
    kCFStringEncodingMacRomanian = 38;
    kCFStringEncodingMacCeltic  = 39;
    kCFStringEncodingMacGaelic  = 40;                           {  The following use script code 4, smArabic  }
    kCFStringEncodingMacFarsi   = $8C;                          {  Like MacArabic but uses Farsi digits  }
                                                                {  The following use script code 7, smCyrillic  }
    kCFStringEncodingMacUkrainian = $98;                        {  The following use script code 32, smUnimplemented  }
    kCFStringEncodingMacInuit   = $EC;
    kCFStringEncodingMacVT100   = $FC;                          {  VT100/102 font from Comm Toolbox: Latin-1 repertoire + box drawing etc  }
                                                                {  Special Mac OS encodings }
    kCFStringEncodingMacHFS     = $FF;                          {  Meta-value, should never appear in a table  }
                                                                {  Unicode & ISO UCS encodings begin at 0x100  }
                                                                {  We don't use Unicode variations defined in TextEncoding; use the ones in CFString.h, instead.  }
                                                                {  ISO 8-bit and 7-bit encodings begin at 0x200  }
                                                                {   kCFStringEncodingISOLatin1 = 0x0201, defined in CoreFoundation/CFString.h  }
    kCFStringEncodingISOLatin2  = $0202;                        {  ISO 8859-2  }
    kCFStringEncodingISOLatin3  = $0203;                        {  ISO 8859-3  }
    kCFStringEncodingISOLatin4  = $0204;                        {  ISO 8859-4  }
    kCFStringEncodingISOLatinCyrillic = $0205;                  {  ISO 8859-5  }
    kCFStringEncodingISOLatinArabic = $0206;                    {  ISO 8859-6, =ASMO 708, =DOS CP 708  }
    kCFStringEncodingISOLatinGreek = $0207;                     {  ISO 8859-7  }
    kCFStringEncodingISOLatinHebrew = $0208;                    {  ISO 8859-8  }
    kCFStringEncodingISOLatin5  = $0209;                        {  ISO 8859-9  }
    kCFStringEncodingISOLatin6  = $020A;                        {  ISO 8859-10  }
    kCFStringEncodingISOLatinThai = $020B;                      {  ISO 8859-11  }
    kCFStringEncodingISOLatin7  = $020D;                        {  ISO 8859-13  }
    kCFStringEncodingISOLatin8  = $020E;                        {  ISO 8859-14  }
    kCFStringEncodingISOLatin9  = $020F;                        {  ISO 8859-15  }
                                                                {  MS-DOS & Windows encodings begin at 0x400  }
    kCFStringEncodingDOSLatinUS = $0400;                        {  code page 437  }
    kCFStringEncodingDOSGreek   = $0405;                        {  code page 737 (formerly code page 437G)  }
    kCFStringEncodingDOSBalticRim = $0406;                      {  code page 775  }
    kCFStringEncodingDOSLatin1  = $0410;                        {  code page 850, "Multilingual"  }
    kCFStringEncodingDOSGreek1  = $0411;                        {  code page 851  }
    kCFStringEncodingDOSLatin2  = $0412;                        {  code page 852, Slavic  }
    kCFStringEncodingDOSCyrillic = $0413;                       {  code page 855, IBM Cyrillic  }
    kCFStringEncodingDOSTurkish = $0414;                        {  code page 857, IBM Turkish  }
    kCFStringEncodingDOSPortuguese = $0415;                     {  code page 860  }
    kCFStringEncodingDOSIcelandic = $0416;                      {  code page 861  }
    kCFStringEncodingDOSHebrew  = $0417;                        {  code page 862  }
    kCFStringEncodingDOSCanadianFrench = $0418;                 {  code page 863  }
    kCFStringEncodingDOSArabic  = $0419;                        {  code page 864  }
    kCFStringEncodingDOSNordic  = $041A;                        {  code page 865  }
    kCFStringEncodingDOSRussian = $041B;                        {  code page 866  }
    kCFStringEncodingDOSGreek2  = $041C;                        {  code page 869, IBM Modern Greek  }
    kCFStringEncodingDOSThai    = $041D;                        {  code page 874, also for Windows  }
    kCFStringEncodingDOSJapanese = $0420;                       {  code page 932, also for Windows  }
    kCFStringEncodingDOSChineseSimplif = $0421;                 {  code page 936, also for Windows  }
    kCFStringEncodingDOSKorean  = $0422;                        {  code page 949, also for Windows; Unified Hangul Code  }
    kCFStringEncodingDOSChineseTrad = $0423;                    {  code page 950, also for Windows  }
                                                                {   kCFStringEncodingWindowsLatin1 = 0x0500, defined in CoreFoundation/CFString.h  }
    kCFStringEncodingWindowsLatin2 = $0501;                     {  code page 1250, Central Europe  }
    kCFStringEncodingWindowsCyrillic = $0502;                   {  code page 1251, Slavic Cyrillic  }
    kCFStringEncodingWindowsGreek = $0503;                      {  code page 1253  }
    kCFStringEncodingWindowsLatin5 = $0504;                     {  code page 1254, Turkish  }
    kCFStringEncodingWindowsHebrew = $0505;                     {  code page 1255  }
    kCFStringEncodingWindowsArabic = $0506;                     {  code page 1256  }
    kCFStringEncodingWindowsBalticRim = $0507;                  {  code page 1257  }
    kCFStringEncodingWindowsKoreanJohab = $0510;                {  code page 1361, for Windows NT  }
    kCFStringEncodingWindowsVietnamese = $0508;                 {  code page 1258  }
                                                                {  Various national standards begin at 0x600  }
                                                                {   kCFStringEncodingASCII = 0x0600, defined in CoreFoundation/CFString.h  }
    kCFStringEncodingJIS_X0201_76 = $0620;
    kCFStringEncodingJIS_X0208_83 = $0621;
    kCFStringEncodingJIS_X0208_90 = $0622;
    kCFStringEncodingJIS_X0212_90 = $0623;
    kCFStringEncodingJIS_C6226_78 = $0624;
    kCFStringEncodingGB_2312_80 = $0630;
    kCFStringEncodingGBK_95     = $0631;                        {  annex to GB 13000-93; for Windows 95  }
    kCFStringEncodingKSC_5601_87 = $0640;                       {  same as KSC 5601-92 without Johab annex  }
    kCFStringEncodingKSC_5601_92_Johab = $0641;                 {  KSC 5601-92 Johab annex  }
    kCFStringEncodingCNS_11643_92_P1 = $0651;                   {  CNS 11643-1992 plane 1  }
    kCFStringEncodingCNS_11643_92_P2 = $0652;                   {  CNS 11643-1992 plane 2  }
    kCFStringEncodingCNS_11643_92_P3 = $0653;                   {  CNS 11643-1992 plane 3 (was plane 14 in 1986 version)  }
                                                                {  ISO 2022 collections begin at 0x800  }
    kCFStringEncodingISO_2022_JP = $0820;
    kCFStringEncodingISO_2022_JP_2 = $0821;
    kCFStringEncodingISO_2022_CN = $0830;
    kCFStringEncodingISO_2022_CN_EXT = $0831;
    kCFStringEncodingISO_2022_KR = $0840;                       {  EUC collections begin at 0x900  }
    kCFStringEncodingEUC_JP     = $0920;                        {  ISO 646, 1-byte katakana, JIS 208, JIS 212  }
    kCFStringEncodingEUC_CN     = $0930;                        {  ISO 646, GB 2312-80  }
    kCFStringEncodingEUC_TW     = $0931;                        {  ISO 646, CNS 11643-1992 Planes 1-16  }
    kCFStringEncodingEUC_KR     = $0940;                        {  ISO 646, KS C 5601-1987  }
                                                                {  Misc standards begin at 0xA00  }
    kCFStringEncodingShiftJIS   = $0A01;                        {  plain Shift-JIS  }
    kCFStringEncodingKOI8_R     = $0A02;                        {  Russian internet standard  }
    kCFStringEncodingBig5       = $0A03;                        {  Big-5 (has variants)  }
    kCFStringEncodingMacRomanLatin1 = $0A04;                    {  Mac OS Roman permuted to align with ISO Latin-1  }
    kCFStringEncodingHZ_GB_2312 = $0A05;                        {  HZ (RFC 1842, for Chinese mail & news)  }
                                                                {  Other platform encodings }
                                                                {   kCFStringEncodingNextStepLatin = 0x0B01, defined in CoreFoundation/CFString.h  }
                                                                {  EBCDIC & IBM host encodings begin at 0xC00  }
    kCFStringEncodingEBCDIC_US  = $0C01;                        {  basic EBCDIC-US  }
    kCFStringEncodingEBCDIC_CP037 = $0C02;                      {  code page 037, extended EBCDIC (Latin-1 set) for US,Canada...  }

{$ALIGN MAC68K}
{#POP}
{unit CFTree}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}


type
    CFTreeRetainCallBack = function(info: UnivPtr): Ptr;

    CFTreeReleaseCallBack = procedure(info: UnivPtr);

    CFTreeCopyDescriptionCallBack = function(info: UnivPtr): CFStringRef;

    CFTreeContextPtr = ^CFTreeContext;
    CFTreeContext = record
        version:                CFIndex;
        info:                   Ptr;
        retain:                 CFTreeRetainCallBack;
        release:                CFTreeReleaseCallBack;
        copyDescription:        CFTreeCopyDescriptionCallBack;
    end;

    CFTreeApplierFunction = procedure(value: UnivPtr; context: UnivPtr);

    CFTreeRef    = ^SInt32; { an opaque 32-bit type }
    CFTreeRefPtr = ^CFTreeRef;  { when a var xx:CFTreeRef parameter can be nil, it is changed to xx: CFTreeRefPtr }
    {
     *  CFTreeGetTypeID()
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.1 and later
     *    Mac OS X:         in version 10.0 and later
        }
function CFTreeGetTypeID: CFTypeID; external name '_CFTreeGetTypeID';

{
 *  CFTreeCreate()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFTreeCreate(allocator: CFAllocatorRef; const (*var*) context: CFTreeContext): CFTreeRef; external name '_CFTreeCreate';

{
 *  CFTreeGetParent()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFTreeGetParent(tree: CFTreeRef): CFTreeRef; external name '_CFTreeGetParent';

{
 *  CFTreeGetNextSibling()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFTreeGetNextSibling(tree: CFTreeRef): CFTreeRef; external name '_CFTreeGetNextSibling';

{
 *  CFTreeGetFirstChild()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFTreeGetFirstChild(tree: CFTreeRef): CFTreeRef; external name '_CFTreeGetFirstChild';

{
 *  CFTreeGetContext()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CFTreeGetContext(tree: CFTreeRef; var context: CFTreeContext); external name '_CFTreeGetContext';

{
 *  CFTreeGetChildCount()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFTreeGetChildCount(tree: CFTreeRef): CFIndex; external name '_CFTreeGetChildCount';

{
 *  CFTreeGetChildAtIndex()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFTreeGetChildAtIndex(tree: CFTreeRef; idx: CFIndex): CFTreeRef; external name '_CFTreeGetChildAtIndex';

{
 *  CFTreeGetChildren()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CFTreeGetChildren(tree: CFTreeRef; var children: CFTreeRef); external name '_CFTreeGetChildren';

{
 *  CFTreeApplyFunctionToChildren()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CFTreeApplyFunctionToChildren(tree: CFTreeRef; applier: CFTreeApplierFunction; context: UnivPtr); external name '_CFTreeApplyFunctionToChildren';

{
 *  CFTreeFindRoot()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFTreeFindRoot(tree: CFTreeRef): CFTreeRef; external name '_CFTreeFindRoot';

{
 *  CFTreeSetContext()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CFTreeSetContext(tree: CFTreeRef; const (*var*) context: CFTreeContext); external name '_CFTreeSetContext';

{ adds newChild as tree's first child }
{
 *  CFTreePrependChild()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CFTreePrependChild(tree: CFTreeRef; newChild: CFTreeRef); external name '_CFTreePrependChild';

{ adds newChild as tree's last child }
{
 *  CFTreeAppendChild()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CFTreeAppendChild(tree: CFTreeRef; newChild: CFTreeRef); external name '_CFTreeAppendChild';

{ Inserts newSibling after tree.  tree and newSibling will have the same parent }
{
 *  CFTreeInsertSibling()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CFTreeInsertSibling(tree: CFTreeRef; newSibling: CFTreeRef); external name '_CFTreeInsertSibling';

{ Removes tree from its parent }
{
 *  CFTreeRemove()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CFTreeRemove(tree: CFTreeRef); external name '_CFTreeRemove';

{ Removes all the children of tree }
{
 *  CFTreeRemoveAllChildren()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CFTreeRemoveAllChildren(tree: CFTreeRef); external name '_CFTreeRemoveAllChildren';

{
 *  CFTreeSortChildren()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CFTreeSortChildren(tree: CFTreeRef; comparator: CFComparatorFunction; context: UnivPtr); external name '_CFTreeSortChildren';

{$ALIGN MAC68K}
{#POP}
{unit CGBase}
{$ALIGN MAC68K}








{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}


type
    size_t                              = UInt32;
    int32_t                             = SInt32;
    boolean_t                           = SInt32;
    u_int8_t                            = UInt8;
    u_int16_t                           = UInt16;
    u_int32_t                           = UInt32;
{$ALIGN MAC68K}
{#POP}
{unit CGErrors}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}

{ Types used for error and error handler }

type
    CGError                     = SInt32;
const
    kCGErrorSuccess             = 0;
    kCGErrorFirst               = 1000;
    kCGErrorFailure             = 1000;
    kCGErrorIllegalArgument     = 1001;
    kCGErrorInvalidConnection   = 1002;
    kCGErrorInvalidContext      = 1003;
    kCGErrorCannotComplete      = 1004;
    kCGErrorNameTooLong         = 1005;
    kCGErrorNotImplemented      = 1006;
    kCGErrorRangeCheck          = 1007;
    kCGErrorTypeCheck           = 1008;
    kCGErrorNoCurrentPoint      = 1009;
    kCGErrorInvalidOperation    = 1010;
    kCGErrorNoneAvailable       = 1011;
    kCGErrorLast                = 1011;

{$ALIGN MAC68K}
{#POP}
{unit CGFont}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}


type
    CGFontRef    = ^SInt32; { an opaque 32-bit type }
    CGFontRefPtr = ^CGFontRef;  { when a var xx:CGFontRef parameter can be nil, it is changed to xx: CGFontRefPtr }
    CGGlyph                             = UInt16;
    CGGlyphPtr                              = ^CGGlyph;
    {   ** Font creation. **    }
    {    Create a CGFont using `platformFontReference', a pointer to a
     * platform-specific font reference.  For MacOS X, `platformFontReference'
     * should be a pointer to an ATSFontRef.    }
    {
     *  CGFontCreateWithPlatformFont()
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        not available
     *    Mac OS X:         in version 10.0 and later
        }
function CGFontCreateWithPlatformFont(platformFontReference: UnivPtr): CGFontRef; external name '_CGFontCreateWithPlatformFont';

{** Retain & release. **}
{ Increment the retain count of `font' and return it.  All fonts are
 * created with an initial retain count of 1. }
{
 *  CGFontRetain()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGFontRetain(font: CGFontRef): CGFontRef; external name '_CGFontRetain';

{ Decrement the retain count of `font'.  If the retain count reaches 0,
 * then release it and any associated resources. }
{
 *  CGFontRelease()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
procedure CGFontRelease(font: CGFontRef); external name '_CGFontRelease';




{$ALIGN MAC68K}
{#POP}
{unit CGGeometry}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}

{ Points. }

type
    CGPointPtr = ^CGPoint;
    CGPoint = record
        x:                      Single;
        y:                      Single;
    end;

    {    Sizes.     }
    CGSizePtr = ^CGSize;
    CGSize = record
        width:                  Single;
        height:                 Single;
    end;

    {    Rectangles.    }
    CGRectPtr = ^CGRect;
    CGRect = record
        origin:                 CGPoint;
        size:                   CGSize;
    end;

    {    Rectangle edges.   }
    CGRectEdge                  = SInt32;
const
    CGRectMinXEdge              = 0;
    CGRectMinYEdge              = 1;
    CGRectMaxXEdge              = 2;
    CGRectMaxYEdge              = 3;

    {    The "zero" point -- equivalent to CGPointMake(0, 0).   }
var CGPointZero: CGPoint; external name '_CGPointZero'; (* attribute const *)
    {
     *  CGPointZero
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        not available
     *    Mac OS X:         in version 10.0 and later
        }
    {    The "zero" size -- equivalent to CGSizeMake(0, 0).     }
var CGSizeZero: CGSize; external name '_CGSizeZero'; (* attribute const *)
    {
     *  CGSizeZero
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        not available
     *    Mac OS X:         in version 10.0 and later
        }
    {    The "zero" rectangle -- equivalent to CGRectMake(0, 0, 0, 0).  }
var CGRectZero: CGRect; external name '_CGRectZero'; (* attribute const *)
    {
     *  CGRectZero
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        not available
     *    Mac OS X:         in version 10.0 and later
        }
    {    The "empty" rect.  This is the rectangle returned when, for example, we
     * intersect two disjoint rectangles.  Note that the null rect is not the
     * same as the zero rect.   }
var CGRectNull: CGRect; external name '_CGRectNull'; (* attribute const *)
    {
     *  CGRectNull
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        not available
     *    Mac OS X:         in version 10.0 and later
        }

    {    Make a point from `(x, y)'.    }
    {
     *  CGPointMake()
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        not available
     *    Mac OS X:         in version 10.0 and later
        }
function CGPointMake(x: Single; y: Single): CGPoint; external name '_CGPointMake';

{ Make a size from `(width, height)'. }
{
 *  CGSizeMake()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGSizeMake(width: Single; height: Single): CGSize; external name '_CGSizeMake';

{ Make a rect from `(x, y; width, height)'. }
{
 *  CGRectMake()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGRectMake(x: Single; y: Single; width: Single; height: Single): CGRect; external name '_CGRectMake';

{ Return the leftmost x-value of `rect'. }
{
 *  CGRectGetMinX()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGRectGetMinX(rect: CGRect): Single; external name '_CGRectGetMinX';

{ Return the midpoint x-value of `rect'. }
{
 *  CGRectGetMidX()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGRectGetMidX(rect: CGRect): Single; external name '_CGRectGetMidX';

{ Return the rightmost x-value of `rect'. }
{
 *  CGRectGetMaxX()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGRectGetMaxX(rect: CGRect): Single; external name '_CGRectGetMaxX';

{ Return the bottommost y-value of `rect'. }
{
 *  CGRectGetMinY()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGRectGetMinY(rect: CGRect): Single; external name '_CGRectGetMinY';

{ Return the midpoint y-value of `rect'. }
{
 *  CGRectGetMidY()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGRectGetMidY(rect: CGRect): Single; external name '_CGRectGetMidY';

{ Return the topmost y-value of `rect'. }
{
 *  CGRectGetMaxY()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGRectGetMaxY(rect: CGRect): Single; external name '_CGRectGetMaxY';

{ Return the width of `rect'. }
{
 *  CGRectGetWidth()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGRectGetWidth(rect: CGRect): Single; external name '_CGRectGetWidth';

{ Return the height of `rect'. }
{
 *  CGRectGetHeight()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGRectGetHeight(rect: CGRect): Single; external name '_CGRectGetHeight';

{ Return 1 if `point1' and `point2' are the same, 0 otherwise. }
{
 *  CGPointEqualToPoint()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGPointEqualToPoint(point1: CGPoint; point2: CGPoint): SInt32; external name '_CGPointEqualToPoint';

{ Return 1 if `size1' and `size2' are the same, 0 otherwise. }
{
 *  CGSizeEqualToSize()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGSizeEqualToSize(size1: CGSize; size2: CGSize): SInt32; external name '_CGSizeEqualToSize';

{ Return 1 if `rect1' and `rect2' are the same, 0 otherwise. }
{
 *  CGRectEqualToRect()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGRectEqualToRect(rect1: CGRect; rect2: CGRect): SInt32; external name '_CGRectEqualToRect';

{ Standardize `rect' -- i.e., convert it to an equivalent rect which has
 * positive width and height. }
{
 *  CGRectStandardize()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGRectStandardize(rect: CGRect): CGRect; external name '_CGRectStandardize';

{ Return 1 if `rect' is empty -- i.e., if it has zero width or height.  A
 * null rect is defined to be empty. }
{
 *  CGRectIsEmpty()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGRectIsEmpty(rect: CGRect): SInt32; external name '_CGRectIsEmpty';

{ Return 1 if `rect' is null -- e.g., the result of intersecting two
 * disjoint rectangles is a null rect. }
{
 *  CGRectIsNull()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGRectIsNull(rect: CGRect): SInt32; external name '_CGRectIsNull';

{ Inset `rect' by `(dx, dy)' -- i.e., offset its origin by `(dx, dy)', and
 * decrease its size by `(2*dx, 2*dy)'. }
{
 *  CGRectInset()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGRectInset(rect: CGRect; dx: Single; dy: Single): CGRect; external name '_CGRectInset';

{ Expand `rect' to the smallest rect containing it with integral origin
 * and size. }
{
 *  CGRectIntegral()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGRectIntegral(rect: CGRect): CGRect; external name '_CGRectIntegral';

{ Return the union of `r1' and `r2'. }
{
 *  CGRectUnion()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGRectUnion(r1: CGRect; r2: CGRect): CGRect; external name '_CGRectUnion';

{ Return the intersection of `r1' and `r2'.  This may return a null
 * rect. }
{
 *  CGRectIntersection()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGRectIntersection(r1: CGRect; r2: CGRect): CGRect; external name '_CGRectIntersection';

{ Offset `rect' by `(dx, dy)'. }
{
 *  CGRectOffset()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGRectOffset(rect: CGRect; dx: Single; dy: Single): CGRect; external name '_CGRectOffset';

{ Make two new rectangles, `slice' and `remainder', by dividing `rect'
 * with a line that's parallel to one of its sides, specified by `edge' --
 * either `CGRectMinXEdge', `CGRectMinYEdge', `CGRectMaxXEdge', or
 * `CGRectMaxYEdge'.  The size of `slice' is determined by `amount', which
 * measures the distance from the specified edge. }
{
 *  CGRectDivide()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
procedure CGRectDivide(rect: CGRect; var slice: CGRect; var remainder: CGRect; amount: Single; edge: CGRectEdge); external name '_CGRectDivide';

{ Return 1 if `point' is contained in `rect', 0 otherwise. }
{
 *  CGRectContainsPoint()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGRectContainsPoint(rect: CGRect; point: CGPoint): SInt32; external name '_CGRectContainsPoint';

{ Return 1 if `rect2' is contained in `rect1', 0 otherwise.  `rect2' is
 * contained in `rect1' if the union of `rect1' and `rect2' is equal to
 * `rect1'. }
{
 *  CGRectContainsRect()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGRectContainsRect(rect1: CGRect; rect2: CGRect): SInt32; external name '_CGRectContainsRect';

{ Return 1 if `rect1' intersects `rect2', 0 otherwise.  `rect1' intersects
 * `rect2' if the intersection of `rect1' and `rect2' is not the null
 * rect. }
{
 *  CGRectIntersectsRect()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGRectIntersectsRect(rect1: CGRect; rect2: CGRect): SInt32; external name '_CGRectIntersectsRect';




{$ALIGN MAC68K}
{#POP}
{unit CGRemoteOperation}
{$ALIGN MAC68K}










{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}


type
    CGEventErr                          = CGError;

const
    CGEventNoErr                = 0;


    {    Screen refresh or drawing notification     }
    {
     * Callback function pointer;
     * Declare your callback function in this form.  When an area of the display is
     * modified or refreshed, your callback function will be invoked with a count
     * of the number of rectangles in the refreshed areas, and a list of the refreshed
     * rectangles.  The rectangles are in global coordinates.
     *
     * Your function should not modify, deallocate or free memory pointed to by rectArray.
     *
     * The system continues to accumulate refreshed areas constantly.  Whenever new
     * information is available, your callback function is invoked.The list of rects
     * passed to the callback function are cleared from the accumulated refreshed area
     * when the callback is made.
     *
     * This callback may be triggered by drawing operations, window movement, and
     * display reconfiguration.
     *
     * Bear in mind that a single rectangle may occupy multiple displays,
     * either by overlapping the displays, or by residing on coincident displays
     * when mirroring is active.  Use the CGGetDisplaysWithRect() to determine
     * the displays a rectangle occupies.
        }

type
    CGRectCount                         = u_int32_t;
    CGScreenRefreshCallback = procedure(count: CGRectCount; const (*var*) rectArray: CGRect; userParameter: UnivPtr);

    {
     * Register a callback function to be invoked when an area of the display
     * is refreshed, or modified.  The function is invoked on the same thread
     * of execution that is processing events within your application.
     * userParameter is passed back with each invocation of the callback function.
        }
    {
     *  CGRegisterScreenRefreshCallback()
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        not available
     *    Mac OS X:         in version 10.0 and later
        }
procedure CGRegisterScreenRefreshCallback(callback: CGScreenRefreshCallback; userParameter: UnivPtr); external name '_CGRegisterScreenRefreshCallback';

{
 * Remove a previously registered calback function.
 * Both the function and the userParameter must match the registered entry to be removed.
 }
{
 *  CGUnregisterScreenRefreshCallback()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
procedure CGUnregisterScreenRefreshCallback(callback: CGScreenRefreshCallback; userParameter: UnivPtr); external name '_CGUnregisterScreenRefreshCallback';


{
 * In some applications it may be preferable to have a seperate thread wait for screen refresh data.
 * This function should be called on a thread seperate from the event processing thread.
 * If screen refresh callback functions are registered, this function should not be used.
 * The mechanisms are mutually exclusive.
 *
 * Deallocate screen refresh rects using CGReleaseScreenRefreshRects().
 *
 * Returns an error code if parameters are invalid or an error occurs in retrieving
 * dirty screen rects from the server.
 }
{
 *  CGWaitForScreenRefreshRects()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGWaitForScreenRefreshRects(var pRectArray: UnivPtr; var pCount: CGRectCount): CGEventErr; external name '_CGWaitForScreenRefreshRects';

{
 * Deallocate the list of rects recieved from CGWaitForScreenRefreshRects()
 }
{
 *  CGReleaseScreenRefreshRects()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
procedure CGReleaseScreenRefreshRects(var rectArray: CGRect); external name '_CGReleaseScreenRefreshRects';

{
 * Posting events: These functions post events into the system.  Use for remote
 * operation and virtualization.
 *
 * Note that remote operation requires a valid connection to the server, which
 * must be owned by either the root/Administrator user or the logged in console
 * user.  This means that your application must be running as root/Administrator
 * user or the logged in console user.
 }

{
 * Synthesize keyboard events.  Based on the values entered,
 * the appropriate key down, key up, and flags changed events are generated.
 * If keyChar is NUL (0), an apropriate value will be guessed at, based on the
 * default keymapping.
 *
 * All keystrokes needed to generate a character must be entered, including
 * SHIFT, CONTROL, OPTION, and COMMAND keys.  For example, to produce a 'Z',
 * the SHIFT key must be down, the 'z' key must go down, and then the SHIFT
 * and 'z' key must be released:
 *  CGPostKeyboardEvent( (CGCharCode)0, (CGKeyCode)56, true ); // shift down
 *  CGPostKeyboardEvent( (CGCharCode)'Z', (CGKeyCode)6, true ); // 'z' down
 *  CGPostKeyboardEvent( (CGCharCode)'Z', (CGKeyCode)6, false ); // 'z' up
 *  CGPostKeyboardEvent( (CGCharCode)0, (CGKeyCode)56, false ); // 'shift up
 }

type
    CGCharCode                          = u_int16_t;
    CGKeyCode                           = u_int16_t;
    {
     *  CGPostKeyboardEvent()
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        not available
     *    Mac OS X:         in version 10.0 and later
        }
function CGPostKeyboardEvent(keyChar: CGCharCode; virtualKey: CGKeyCode; keyDown: boolean_t): CGEventErr; external name '_CGPostKeyboardEvent';

{
 * Warp the mouse cursor to the desired position in global
 * coordinates without generating events
 }
{
 *  CGWarpMouseCursorPosition()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGWarpMouseCursorPosition(newCursorPosition: CGPoint): CGEventErr; external name '_CGWarpMouseCursorPosition';

{
 * Remote operation may want to inhibit local events (events from
 * the machine's keyboard and mouse).  This may be done either as a
 * explicit request (tracked per app) or as a short term side effect of
 * posting an event.
 *
 * CGInhibitLocalEvents() is typically used for long term remote operation
 * of a system, as in automated system testing or telecommuting applications.
 * Local device state changes are discarded.
 *
 * Local event inhibition is turned off if the app that requested it terminates.
 }
{
 *  CGInhibitLocalEvents()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGInhibitLocalEvents(doInhibit: boolean_t): CGEventErr; external name '_CGInhibitLocalEvents';

{
 * Set the period of time in seconds that local hardware events (keyboard and mouse)
 * are supressed after posting an event.  Defaults to 0.25 second.
 }
{
 *  CGSetLocalEventsSuppressionInterval()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGSetLocalEventsSuppressionInterval(seconds: CFTimeInterval): CGEventErr; external name '_CGSetLocalEventsSuppressionInterval';

{
 * By default, the flags that indicate modifier key state (Command, Alt, Shift, etc.)
 * from the system's keyboard and from other event sources are ORed together as an event is
 * posted into the system, and current key and mouse button state is considered in generating new events.
 * This function allows your application to enable or disable the
 * merging of event state.  When combining is turned off, the event state propagated in the events
 * posted by your app reflect state built up only by your app.  The state within your app's generated
 * event will not be combined with the system's current state, so the system-wide state reflecting key
 * and mouse button state will remain unchanged
 *
 * When called with doCombineState equal to FALSE, this function initializes local (per application)
 * state tracking information to a state of all keys, modifiers, and mouse buttons up.
 *
 * When called with doCombineState equal to TRUE, the current global state of keys, modifiers,
 * and mouse buttons are used in generating events.
 }
{
 *  CGEnableEventStateCombining()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.1 and later
 }
function CGEnableEventStateCombining(doCombineState: boolean_t): CGEventErr; external name '_CGEnableEventStateCombining';

{
 * By default the system supresses local hardware events from the keyboard and mouse during
 * a short interval after a synthetic event is posted (see CGSetLocalEventsSuppressionInterval())
 * and while a synthetic mouse drag (mouse movement with the left/only mouse button down).
 * Some classes of applications may want to enable events from some of the local hardware.
 * For example, an app may want to post only mouse events, and so may wish to permit local
 * keyboard hardware events to pass through.
 *
 * This interface lets an app specify a state (event supression interval, or mouse drag), and
 * a mask of event categories to be passed through.
 }

type
    CGEventFilterMask           = SInt32;
const
    kCGEventFilterMaskPermitLocalMouseEvents = $00000001;       {  Mouse, scroll wheel  }
    kCGEventFilterMaskPermitLocalKeyboardEvents = $00000002;    {  Alphanumeric keys and Command, Option, Control, Shift, AlphaLock  }
    kCGEventFilterMaskPermitSystemDefinedEvents = $00000004;    {  Power key, bezel buttons, sticky keys  }
    kCGEventFilterMaskPermitAllEvents = $00000007;


type
    CGEventSupressionState      = SInt32;
const
    kCGEventSupressionStateSupressionInterval = 0;
    kCGEventSupressionStateRemoteMouseDrag = 1;
    kCGNumberOfEventSupressionStates = 2;

    {
     *  CGSetLocalEventsFilterDuringSupressionState()
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        not available
     *    Mac OS X:         in version 10.1 and later
        }
function CGSetLocalEventsFilterDuringSupressionState(filter: CGEventFilterMask; state: CGEventSupressionState): CGEventErr; external name '_CGSetLocalEventsFilterDuringSupressionState';

{
 * Helper function to connect or disconnect the mouse and mouse cursor.
 * CGAssociateMouseAndMouseCursorPosition(false) has the same effect
 * as the following, without actually modifying the supression interval:
 *
 *  CGSetLocalEventsSuppressionInterval(MAX_DOUBLE);
 *  CGWarpMouseCursorPosition(currentPosition);
 *
 * While disconnected, mouse move and drag events will reflect the current position of
 * the mouse cursor position, which will not change with mouse movement. Use the
 * <CoreGraphics/CGDirectDisplay.h> function:
 *
 *  void CGGetLastMouseDelta( CGMouseDelta * deltaX, CGMouseDelta * deltaY );
 *
 * This will report mouse movement associated with the last mouse move or drag event.
 *
 * To update the display cursor position, use the function defined in this module:
 *
 *  CGEventErr CGWarpMouseCursorPosition( CGPoint newCursorPosition );
 }
{
 *  CGAssociateMouseAndMouseCursorPosition()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGAssociateMouseAndMouseCursorPosition(connected: boolean_t): CGEventErr; external name '_CGAssociateMouseAndMouseCursorPosition';

{
 * Some classes of applications need to detect when the window server process dies, or
 * is not running.  The easiest way to do this is to use a CFMachPortRef.
 *
 * If the CoreGraphics window server is not running, this function returns NULL.
 * If the server is running, a CFMachPortRef is returned.
 *
 * A program can register a callback function to use a CFMachPortRef to determine
 * when the CoreGraphics window server exits:
 *
 * static void handleWindowServerDeath( CFMachPortRef port, void *info )
 * (
 *     printf( "Window Server port death detected!\n" );
 *     CFRelease( port );
 *     exit( 1 );
 * )
 *
 * static void watchForServerDeath()
 * (
 *     CFMachPortRef        port;
 *
 *     port = CGWindowServerCFMachPort();
 *     CFMachPortSetInvalidationCallBack( port, handleWindowServerDeath );
 * )
 *
 * Note that when the window server exits, there may be a few seconds during which
 * no window server is running, until the operating system starts a new
 * window server/loginwindow pair of processes.  This function will return NULL
 * until a new window server is running.
 *
 * Multiple calls to this function may return multiple CFMachPortRefs, each referring
 * to the same Mach port.  Multiple callbacks registered on multiple CFMachPortRefs
 * obtained in this way may fire in a nondetermanistic manner.
 *
 * Your program will need to run a CFRunLoop for the port death
 * callback to function.  A program which does not use a CFRunLoop may use
 * CFMachPortIsValid(CFMachPortRef port) periodically to check if the port is valid.
 }
{$ALIGN MAC68K}
{#POP}
{unit CGWindowLevels}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}

{
 * Windows may be assigned to a particular level. When assigned to a level,
 * the window is ordered relative to all other windows in that level.
 * Windows with a higher level are sorted in front of windows with a lower
 * level.
 *
 * A common set of window levels is defined here for use within higher
 * level frameworks.  The levels are accessed via a key and function,
 * so that levels may be changed or adjusted in future releases without
 * breaking binary compatability.
 }

type
    CGWindowLevel                       = int32_t;
    CGWindowLevelKey                    = int32_t;
    _CGCommonWindowLevelKey     = SInt32;
const
    kCGBaseWindowLevelKey       = 0;
    kCGMinimumWindowLevelKey    = 1;
    kCGDesktopWindowLevelKey    = 2;
    kCGBackstopMenuLevelKey     = 3;
    kCGNormalWindowLevelKey     = 4;
    kCGFloatingWindowLevelKey   = 5;
    kCGTornOffMenuWindowLevelKey = 6;
    kCGDockWindowLevelKey       = 7;
    kCGMainMenuWindowLevelKey   = 8;
    kCGStatusWindowLevelKey     = 9;
    kCGModalPanelWindowLevelKey = 10;
    kCGPopUpMenuWindowLevelKey  = 11;
    kCGDraggingWindowLevelKey   = 12;
    kCGScreenSaverWindowLevelKey = 13;
    kCGMaximumWindowLevelKey    = 14;
    kCGOverlayWindowLevelKey    = 15;
    kCGHelpWindowLevelKey       = 16;
    kCGUtilityWindowLevelKey    = 17;
    kCGDesktopIconWindowLevelKey = 18;
    kCGNumberOfWindowLevelKeys  = 19;                           {  Internal bookkeeping; must be last  }

    {
     *  CGWindowLevelForKey()
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        not available
     *    Mac OS X:         in version 10.0 and later
        }
function CGWindowLevelForKey(key: CGWindowLevelKey): CGWindowLevel; external name '_CGWindowLevelForKey';

{ number of levels above kCGMaximumWindowLevel reserved for internal use }

const
    kCGNumReservedWindowLevels  = 16;

{$ALIGN MAC68K}
{#POP}
{unit CMICCProfile}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}

{ ICC Profile version constants  }

const
    cmICCProfileVersion2        = $02000000;
    cmICCProfileVersion21       = $02100000;
    cmCS2ProfileVersion         = $02000000;
    cmCS1ProfileVersion         = $00000100;                    {  ColorSync 1.0 profile version  }

    {    Current Major version number   }
    cmProfileMajorVersionMask   = $FF000000;
    cmCurrentProfileMajorVersion = $02000000;

    {    magic cookie number for anonymous file ID  }
    cmMagicNumber               = $61637370 (* 'acsp' *);


    {   **********************************************************************  }
    {   ************** ColorSync 2.0 profile specification *******************  }
    {   **********************************************************************  }
    {   *** flags field  ***    }
    cmICCReservedFlagsMask      = $0000FFFF;                    {  these bits of the flags field are defined and reserved by ICC  }
    cmEmbeddedMask              = $00000001;                    {  if bit 0 is 0 then not embedded profile, if 1 then embedded profile  }
    cmEmbeddedUseMask           = $00000002;                    {  if bit 1 is 0 then ok to use anywhere, if 1 then ok to use as embedded profile only  }
    cmCMSReservedFlagsMask      = $FFFF0000;                    {  these bits of the flags field are defined and reserved by CMS vendor  }
    cmQualityMask               = $00030000;                    {  if bits 16-17 is 0 then normal, if 1 then draft, if 2 then best  }
    cmInterpolationMask         = $00040000;                    {  if bit 18 is 0 then interpolation, if 1 then lookup only  }
    cmGamutCheckingMask         = $00080000;                    {  if bit 19 is 0 then create gamut checking info, if 1 then no gamut checking info  }

    {    copyright-protection flag options  }
    cmEmbeddedProfile           = 0;                            {  0 is not embedded profile, 1 is embedded profile  }
    cmEmbeddedUse               = 1;                            {  0 is to use anywhere, 1 is to use as embedded profile only  }

    {    speed and quality flag options     }
    cmNormalMode                = 0;                            {  it uses the least significent two bits in the high word of flag  }
    cmDraftMode                 = 1;                            {  it should be evaulated like this: right shift 16 bits first, mask off the  }
    cmBestMode                  = 2;                            {  high 14 bits, and then compare with the enum to determine the option value  }


    {   *** deviceAttributes fields *** }
    {    deviceAttributes[0] is defined by and reserved for device vendors  }
    {    deviceAttributes[1] is defined by and reserved for ICC     }
    {    The following bits of deviceAttributes[1] are currently defined    }
    cmReflectiveTransparentMask = $00000001;                    {  if bit 0 is 0 then reflective media, if 1 then transparency media  }
    cmGlossyMatteMask           = $00000002;                    {  if bit 1 is 0 then glossy, if 1 then matte  }

    {    device/media attributes element values     }
    cmReflective                = 0;                            {  if bit 0 is 0 then reflective media, if 1 then transparency media  }
    cmGlossy                    = 1;                            {  if bit 1 is 0 then glossy, if 1 then matte  }


    {   *** renderingIntent field ***   }
    cmPerceptual                = 0;                            {  Photographic images  }
    cmRelativeColorimetric      = 1;                            {  Logo Colors  }
    cmSaturation                = 2;                            {  Business graphics  }
    cmAbsoluteColorimetric      = 3;                            {  Logo Colors  }



    {    data type element values   }
    cmAsciiData                 = 0;
    cmBinaryData                = 1;

    {    screen encodings   }
    cmPrtrDefaultScreens        = 0;                            {  Use printer default screens.  0 is false, 1 is ture  }
    cmLinesPer                  = 1;                            {  0 is LinesPerCm, 1 is LinesPerInch  }

    {    2.0 tag type information   }
    cmNumHeaderElements         = 10;

    {    public tags    }
    cmAToB0Tag                  = $41324230 (* 'A2B0' *);
    cmAToB1Tag                  = $41324231 (* 'A2B1' *);
    cmAToB2Tag                  = $41324232 (* 'A2B2' *);
    cmBlueColorantTag           = $6258595A (* 'bXYZ' *);
    cmBlueTRCTag                = $62545243 (* 'bTRC' *);
    cmBToA0Tag                  = $42324130 (* 'B2A0' *);
    cmBToA1Tag                  = $42324131 (* 'B2A1' *);
    cmBToA2Tag                  = $42324132 (* 'B2A2' *);
    cmCalibrationDateTimeTag    = $63616C74 (* 'calt' *);
    cmChromaticAdaptationTag    = $63686164 (* 'chad' *);
    cmCharTargetTag             = $74617267 (* 'targ' *);
    cmCopyrightTag              = $63707274 (* 'cprt' *);
    cmDeviceMfgDescTag          = $646D6E64 (* 'dmnd' *);
    cmDeviceModelDescTag        = $646D6464 (* 'dmdd' *);
    cmGamutTag                  = $67616D74 (* 'gamt' *);
    cmGrayTRCTag                = $6B545243 (* 'kTRC' *);
    cmGreenColorantTag          = $6758595A (* 'gXYZ' *);
    cmGreenTRCTag               = $67545243 (* 'gTRC' *);
    cmLuminanceTag              = $6C756D69 (* 'lumi' *);
    cmMeasurementTag            = $6D656173 (* 'meas' *);
    cmMediaBlackPointTag        = $626B7074 (* 'bkpt' *);
    cmMediaWhitePointTag        = $77747074 (* 'wtpt' *);
    cmNamedColorTag             = $6E636F6C (* 'ncol' *);
    cmNamedColor2Tag            = $6E636C32 (* 'ncl2' *);
    cmPreview0Tag               = $70726530 (* 'pre0' *);
    cmPreview1Tag               = $70726531 (* 'pre1' *);
    cmPreview2Tag               = $70726532 (* 'pre2' *);
    cmProfileDescriptionTag     = $64657363 (* 'desc' *);
    cmProfileSequenceDescTag    = $70736571 (* 'pseq' *);
    cmPS2CRD0Tag                = $70736430 (* 'psd0' *);
    cmPS2CRD1Tag                = $70736431 (* 'psd1' *);
    cmPS2CRD2Tag                = $70736432 (* 'psd2' *);
    cmPS2CRD3Tag                = $70736433 (* 'psd3' *);
    cmPS2CSATag                 = $70733273 (* 'ps2s' *);
    cmPS2RenderingIntentTag     = $70733269 (* 'ps2i' *);
    cmRedColorantTag            = $7258595A (* 'rXYZ' *);
    cmRedTRCTag                 = $72545243 (* 'rTRC' *);
    cmScreeningDescTag          = $73637264 (* 'scrd' *);
    cmScreeningTag              = $7363726E (* 'scrn' *);
    cmTechnologyTag             = $74656368 (* 'tech' *);
    cmUcrBgTag                  = $62666420 (* 'bfd ' *);
    cmViewingConditionsDescTag  = $76756564 (* 'vued' *);
    cmViewingConditionsTag      = $76696577 (* 'view' *);

    {    custom tags    }
    cmPS2CRDVMSizeTag           = $7073766D (* 'psvm' *);
    cmVideoCardGammaTag         = $76636774 (* 'vcgt' *);
    cmMakeAndModelTag           = $6D6D6F64 (* 'mmod' *);
    cmProfileDescriptionMLTag   = $6473636D (* 'dscm' *);

    {    technology tag descriptions    }
    cmTechnologyFilmScanner     = $6673636E (* 'fscn' *);
    cmTechnologyReflectiveScanner = $7273636E (* 'rscn' *);
    cmTechnologyInkJetPrinter   = $696A6574 (* 'ijet' *);
    cmTechnologyThermalWaxPrinter = $74776178 (* 'twax' *);
    cmTechnologyElectrophotographicPrinter = $6570686F (* 'epho' *);
    cmTechnologyElectrostaticPrinter = $65737461 (* 'esta' *);
    cmTechnologyDyeSublimationPrinter = $64737562 (* 'dsub' *);
    cmTechnologyPhotographicPaperPrinter = $7270686F (* 'rpho' *);
    cmTechnologyFilmWriter      = $6670726E (* 'fprn' *);
    cmTechnologyVideoMonitor    = $7669646D (* 'vidm' *);
    cmTechnologyVideoCamera     = $76696463 (* 'vidc' *);
    cmTechnologyProjectionTelevision = $706A7476 (* 'pjtv' *);
    cmTechnologyCRTDisplay      = $43525420 (* 'CRT ' *);
    cmTechnologyPMDisplay       = $504D4420 (* 'PMD ' *);
    cmTechnologyAMDisplay       = $414D4420 (* 'AMD ' *);
    cmTechnologyPhotoCD         = $4B504344 (* 'KPCD' *);
    cmTechnologyPhotoImageSetter = $696D6773 (* 'imgs' *);
    cmTechnologyGravure         = $67726176 (* 'grav' *);
    cmTechnologyOffsetLithography = $6F666673 (* 'offs' *);
    cmTechnologySilkscreen      = $73696C6B (* 'silk' *);
    cmTechnologyFlexography     = $666C6578 (* 'flex' *);

    {    public type signatures     }
    cmSigCurveType              = $63757276 (* 'curv' *);
    cmSigDataType               = $64617461 (* 'data' *);
    cmSigDateTimeType           = $6474696D (* 'dtim' *);
    cmSigLut16Type              = $6D667432 (* 'mft2' *);
    cmSigLut8Type               = $6D667431 (* 'mft1' *);
    cmSigMeasurementType        = $6D656173 (* 'meas' *);
    cmSigNamedColorType         = $6E636F6C (* 'ncol' *);
    cmSigNamedColor2Type        = $6E636C32 (* 'ncl2' *);
    cmSigProfileDescriptionType = $64657363 (* 'desc' *);
    cmSigScreeningType          = $7363726E (* 'scrn' *);
    cmSigS15Fixed16Type         = $73663332 (* 'sf32' *);
    cmSigSignatureType          = $73696720 (* 'sig ' *);
    cmSigTextType               = $74657874 (* 'text' *);
    cmSigU16Fixed16Type         = $75663332 (* 'uf32' *);
    cmSigU1Fixed15Type          = $75663136 (* 'uf16' *);
    cmSigUInt8Type              = $75693038 (* 'ui08' *);
    cmSigUInt16Type             = $75693136 (* 'ui16' *);
    cmSigUInt32Type             = $75693332 (* 'ui32' *);
    cmSigUInt64Type             = $75693634 (* 'ui64' *);
    cmSigUcrBgType              = $62666420 (* 'bfd ' *);
    cmSigUnicodeTextType        = $75747874 (* 'utxt' *);
    cmSigViewingConditionsType  = $76696577 (* 'view' *);
    cmSigXYZType                = $58595A20 (* 'XYZ ' *);

    {    custom type signatures     }
    cmSigPS2CRDVMSizeType       = $7073766D (* 'psvm' *);
    cmSigVideoCardGammaType     = $76636774 (* 'vcgt' *);
    cmSigMakeAndModelType       = $6D6D6F64 (* 'mmod' *);
    cmSigMultiLocalizedUniCodeType = $6D6C7563 (* 'mluc' *);


    {    Measurement type encodings     }
    {    Measurement Flare  }
    cmFlare0                    = $00000000;
    cmFlare100                  = $00000001;

    {    Measurement Geometry   }
    cmGeometryUnknown           = $00000000;
    cmGeometry045or450          = $00000001;
    cmGeometry0dord0            = $00000002;

    {    Standard Observer      }
    cmStdobsUnknown             = $00000000;
    cmStdobs1931TwoDegrees      = $00000001;
    cmStdobs1964TenDegrees      = $00000002;

    {    Standard Illuminant    }
    cmIlluminantUnknown         = $00000000;
    cmIlluminantD50             = $00000001;
    cmIlluminantD65             = $00000002;
    cmIlluminantD93             = $00000003;
    cmIlluminantF2              = $00000004;
    cmIlluminantD55             = $00000005;
    cmIlluminantA               = $00000006;
    cmIlluminantEquiPower       = $00000007;
    cmIlluminantF8              = $00000008;

    {    Spot Function Value    }
    cmSpotFunctionUnknown       = 0;
    cmSpotFunctionDefault       = 1;
    cmSpotFunctionRound         = 2;
    cmSpotFunctionDiamond       = 3;
    cmSpotFunctionEllipse       = 4;
    cmSpotFunctionLine          = 5;
    cmSpotFunctionSquare        = 6;
    cmSpotFunctionCross         = 7;

    {    Color Space Signatures     }
    cmXYZData                   = $58595A20 (* 'XYZ ' *);
    cmLabData                   = $4C616220 (* 'Lab ' *);
    cmLuvData                   = $4C757620 (* 'Luv ' *);
    cmYxyData                   = $59787920 (* 'Yxy ' *);
    cmRGBData                   = $52474220 (* 'RGB ' *);
    cmSRGBData                  = $73524742 (* 'sRGB' *);
    cmGrayData                  = $47524159 (* 'GRAY' *);
    cmHSVData                   = $48535620 (* 'HSV ' *);
    cmHLSData                   = $484C5320 (* 'HLS ' *);
    cmCMYKData                  = $434D594B (* 'CMYK' *);
    cmCMYData                   = $434D5920 (* 'CMY ' *);
    cmMCH5Data                  = $4D434835 (* 'MCH5' *);
    cmMCH6Data                  = $4D434836 (* 'MCH6' *);
    cmMCH7Data                  = $4D434837 (* 'MCH7' *);
    cmMCH8Data                  = $4D434838 (* 'MCH8' *);
    cm3CLRData                  = $33434C52 (* '3CLR' *);
    cm4CLRData                  = $34434C52 (* '4CLR' *);
    cm5CLRData                  = $35434C52 (* '5CLR' *);
    cm6CLRData                  = $36434C52 (* '6CLR' *);
    cm7CLRData                  = $37434C52 (* '7CLR' *);
    cm8CLRData                  = $38434C52 (* '8CLR' *);
    cmNamedData                 = $4E414D45 (* 'NAME' *);

    {    profileClass enumerations  }
    cmInputClass                = $73636E72 (* 'scnr' *);
    cmDisplayClass              = $6D6E7472 (* 'mntr' *);
    cmOutputClass               = $70727472 (* 'prtr' *);
    cmLinkClass                 = $6C696E6B (* 'link' *);
    cmAbstractClass             = $61627374 (* 'abst' *);
    cmColorSpaceClass           = $73706163 (* 'spac' *);
    cmNamedColorClass           = $6E6D636C (* 'nmcl' *);

    {    platform enumerations  }
    cmMacintosh                 = $4150504C (* 'APPL' *);
    cmMicrosoft                 = $4D534654 (* 'MSFT' *);
    cmSolaris                   = $53554E57 (* 'SUNW' *);
    cmSiliconGraphics           = $53474920 (* 'SGI ' *);
    cmTaligent                  = $54474E54 (* 'TGNT' *);

    {    ColorSync 1.0 elements     }
    cmCS1ChromTag               = $6368726D (* 'chrm' *);
    cmCS1TRCTag                 = $74726320 (* 'trc ' *);
    cmCS1NameTag                = $6E616D65 (* 'name' *);
    cmCS1CustTag                = $63757374 (* 'cust' *);

    {    General element data types     }

type
    CMDateTimePtr = ^CMDateTime;
    CMDateTime = record
        year:                   UInt16;
        month:                  UInt16;
        dayOfTheMonth:          UInt16;
        hours:                  UInt16;
        minutes:                UInt16;
        seconds:                UInt16;
    end;

    CMFixedXYZColorPtr = ^CMFixedXYZColor;
    CMFixedXYZColor = record
        X:                      Fixed;
        Y:                      Fixed;
        Z:                      Fixed;
    end;

    CMXYZComponent                      = UInt16;
    CMXYZColorPtr = ^CMXYZColor;
    CMXYZColor = record
        X:                      CMXYZComponent;
        Y:                      CMXYZComponent;
        Z:                      CMXYZComponent;
    end;

    CM2HeaderPtr = ^CM2Header;
    CM2Header = record
        size:                   UInt32;                                 {  This is the total size of the Profile  }
        CMMType:                OSType;                                 {  CMM signature,  Registered with CS2 consortium   }
        profileVersion:         UInt32;                                 {  Version of CMProfile format  }
        profileClass:           OSType;                                 {  input, display, output, devicelink, abstract, or color conversion profile type  }
        dataColorSpace:         OSType;                                 {  color space of data  }
        profileConnectionSpace: OSType;                                 {  profile connection color space  }
        dateTime:               CMDateTime;                             {  date and time of profile creation  }
        CS2profileSignature:    OSType;                                 {  'acsp' constant ColorSync 2.0 file ID  }
        platform:               OSType;                                 {  primary profile platform, Registered with CS2 consortium  }
        flags:                  UInt32;                                 {  profile flags  }
        deviceManufacturer:     OSType;                                 {  Registered with ICC consortium  }
        deviceModel:            UInt32;                                 {  Registered with ICC consortium  }
        deviceAttributes:       array [0..1] of UInt32;                 {  Attributes[0] is for device vendors, [1] is for ICC  }
        renderingIntent:        UInt32;                                 {  preferred rendering intent of tagged object  }
        white:                  CMFixedXYZColor;                        {  profile illuminant  }
        creator:                OSType;                                 {  profile creator  }
        reserved:               packed array [0..43] of char;           {  reserved for future use  }
    end;

    CMTagRecordPtr = ^CMTagRecord;
    CMTagRecord = record
        tag:                    OSType;                                 {  Registered with CS2 consortium  }
        elementOffset:          UInt32;                                 {  Relative to start of CMProfile  }
        elementSize:            UInt32;
    end;

    CMTagElemTablePtr = ^CMTagElemTable;
    CMTagElemTable = record
        count:                  UInt32;
        tagList:                array [0..0] of CMTagRecord;            {  variable size, determined by count  }
    end;

    CM2ProfilePtr = ^CM2Profile;
    CM2Profile = record
        header:                 CM2Header;
        tagTable:               CMTagElemTable;
        elemData:               SInt8;                                  {  variable size data for tagged element storage  }
    end;

    CM2ProfileHandle                    = ^CM2ProfilePtr;
    {    Tag Type Definitions   }
    CMAdaptationMatrixTypePtr = ^CMAdaptationMatrixType;
    CMAdaptationMatrixType = record
        typeDescriptor:         OSType;                                 {  'sf32' = cmSigS15Fixed16Type  }
        reserved:               UInt32;                                 {  fill with 0x00  }
        adaptationMatrix:       array [0..8] of Fixed;                  {  fixed size of nine matrix entries  }
    end;

    CMCurveTypePtr = ^CMCurveType;
    CMCurveType = record
        typeDescriptor:         OSType;                                 {  'curv' = cmSigCurveType  }
        reserved:               UInt32;                                 {  fill with 0x00  }
        countValue:             UInt32;                                 {  number of entries in table that follows  }
        data:                   array [0..0] of UInt16;                 {  variable size, determined by countValue  }
    end;

    CMDataTypePtr = ^CMDataType;
    CMDataType = record
        typeDescriptor:         OSType;                                 {  'data' = cmSigDataType }
        reserved:               UInt32;                                 {  fill with 0x00  }
        dataFlag:               UInt32;                                 {  0 = ASCII, 1 = binary  }
        data:                   SInt8;                                  {  variable size, determined by tag element size  }
    end;

    CMDateTimeTypePtr = ^CMDateTimeType;
    CMDateTimeType = record
        typeDescriptor:         OSType;                                 {  'dtim' = cmSigDateTimeType  }
        reserved:               UInt32;                                 {  fill with 0x00  }
        dateTime:               CMDateTime;                             {   }
    end;

    CMLut16TypePtr = ^CMLut16Type;
    CMLut16Type = record
        typeDescriptor:         OSType;                                 {  'mft2' = cmSigLut16Type  }
        reserved:               UInt32;                                 {  fill with 0x00  }
        inputChannels:          SInt8;                                  {  Number of input channels  }
        outputChannels:         SInt8;                                  {  Number of output channels  }
        gridPoints:             SInt8;                                  {  Number of clutTable grid points  }
        reserved2:              SInt8;                                  {  fill with 0x00  }
        matrix:                 array [0..2,0..2] of Fixed;             {   }
        inputTableEntries:      UInt16;                                 {  Number of entries in 1-D input luts  }
        outputTableEntries:     UInt16;                                 {  Number of entries in 1-D output luts  }
        inputTable:             array [0..0] of UInt16;                 {  variable size, determined by inputChannels*inputTableEntries  }
    end;

    CMLut8TypePtr = ^CMLut8Type;
    CMLut8Type = record
        typeDescriptor:         OSType;                                 {  'mft1' = cmSigLut8Type  }
        reserved:               UInt32;                                 {  fill with 0x00  }
        inputChannels:          SInt8;                                  {  Number of input channels  }
        outputChannels:         SInt8;                                  {  Number of output channels  }
        gridPoints:             SInt8;                                  {  Number of clutTable grid points  }
        reserved2:              SInt8;                                  {  fill with 0x00  }
        matrix:                 array [0..2,0..2] of Fixed;             {   }
        inputTable:             SInt8;                                  {  variable size, determined by inputChannels*256  }
    end;

    CMMeasurementTypePtr = ^CMMeasurementType;
    CMMeasurementType = record
        typeDescriptor:         OSType;                                 {  'meas' = cmSigMeasurementType  }
        reserved:               UInt32;                                 {  fill with 0x00  }
        standardObserver:       UInt32;                                 {  cmStdobsUnknown, cmStdobs1931TwoDegrees, cmStdobs1964TenDegrees  }
        backingXYZ:             CMFixedXYZColor;                        {  absolute XYZ values of backing  }
        geometry:               UInt32;                                 {  cmGeometryUnknown, cmGeometry045or450 (0/45), cmGeometry0dord0 (0/d or d/0)  }
        flare:                  UInt32;                                 {  cmFlare0, cmFlare100  }
        illuminant:             UInt32;                                 {  cmIlluminantUnknown, cmIlluminantD50, ...  }
    end;

    CMNamedColorTypePtr = ^CMNamedColorType;
    CMNamedColorType = record
        typeDescriptor:         OSType;                                 {  'ncol' = cmSigNamedColorType  }
        reserved:               UInt32;                                 {  fill with 0x00  }
        vendorFlag:             UInt32;                                 {   }
        count:                  UInt32;                                 {  count of named colors in array that follows  }
        prefixName:             SInt8;                                  {  variable size, max = 32  }
    end;

    CMNamedColor2EntryTypePtr = ^CMNamedColor2EntryType;
    CMNamedColor2EntryType = record
        rootName:               packed array [0..31] of UInt8;          {  32 byte field.  7 bit ASCII null terminated  }
        PCSColorCoords:         array [0..2] of UInt16;                 {  Lab or XYZ color  }
        DeviceColorCoords:      array [0..0] of UInt16;                 {  variable size  }
    end;

    CMNamedColor2TypePtr = ^CMNamedColor2Type;
    CMNamedColor2Type = record
        typeDescriptor:         OSType;                                 {  'ncl2' = cmSigNamedColor2Type  }
        reserved:               UInt32;                                 {  fill with 0x00  }
        vendorFlag:             UInt32;                                 {  lower 16 bits reserved for ICC use  }
        count:                  UInt32;                                 {  count of named colors in array that follows  }
        deviceChannelCount:     UInt32;                                 {  number of device channels, 0 indicates no device value available  }
        prefixName:             packed array [0..31] of UInt8;          {  Fixed 32 byte size.  7 bit ASCII null terminated  }
        suffixName:             packed array [0..31] of UInt8;          {  Fixed 32 byte size.  7 bit ASCII null terminated  }
        data:                   SInt8;                                  {  variable size data for CMNamedColor2EntryType  }
    end;

    CMTextDescriptionTypePtr = ^CMTextDescriptionType;
    CMTextDescriptionType = packed record
        typeDescriptor:         OSType;                                 {  'desc' = cmSigProfileDescriptionType  }
        reserved:               UInt32;                                 {  fill with 0x00  }
        ASCIICount:             UInt32;                                 {  Count of bytes (including null terminator)   }
        ASCIIName:              packed array [0..1] of UInt8;           {  variable size, determined by ASCIICount.  7 bit ASCII null terminated  }
    end;

    CMTextTypePtr = ^CMTextType;
    CMTextType = record
        typeDescriptor:         OSType;                                 {  'text' = cmSigTextType  }
        reserved:               UInt32;                                 {  fill with 0x00  }
        text:                   SInt8;                                  {  variable size, determined by tag element size  }
    end;

    CMUnicodeTextTypePtr = ^CMUnicodeTextType;
    CMUnicodeTextType = record
        typeDescriptor:         OSType;                                 {  'utxt' = cmSigUnicodeTextType  }
        reserved:               UInt32;                                 {  fill with 0x00  }
        text:                   array [0..0] of UniChar;                {  variable size, determined by tag element size   }
    end;

    CMScreeningChannelRecPtr = ^CMScreeningChannelRec;
    CMScreeningChannelRec = record
        frequency:              Fixed;
        angle:                  Fixed;
        spotFunction:           UInt32;
    end;

    CMScreeningTypePtr = ^CMScreeningType;
    CMScreeningType = record
        typeDescriptor:         OSType;                                 {  'scrn' = cmSigScreeningType  }
        reserved:               UInt32;                                 {  fill with 0x00  }
        screeningFlag:          UInt32;                                 {  bit 0 : use printer default screens, bit 1 : inch/cm  }
        channelCount:           UInt32;                                 {   }
        channelInfo:            array [0..0] of CMScreeningChannelRec;  {  variable size, determined by channelCount  }
    end;

    CMSignatureTypePtr = ^CMSignatureType;
    CMSignatureType = record
        typeDescriptor:         OSType;                                 {  'sig ' = cmSigSignatureType  }
        reserved:               UInt32;                                 {  fill with 0x00  }
        signature:              OSType;
    end;

    CMS15Fixed16ArrayTypePtr = ^CMS15Fixed16ArrayType;
    CMS15Fixed16ArrayType = record
        typeDescriptor:         OSType;                                 {  'sf32' = cmSigS15Fixed16Type  }
        reserved:               UInt32;                                 {  fill with 0x00  }
        value:                  array [0..0] of Fixed;                  {  variable size, determined by tag element size  }
    end;

    CMU16Fixed16ArrayTypePtr = ^CMU16Fixed16ArrayType;
    CMU16Fixed16ArrayType = record
        typeDescriptor:         OSType;                                 {  'uf32' = cmSigU16Fixed16Type  }
        reserved:               UInt32;                                 {  fill with 0x00  }
        value:                  array [0..0] of UInt32;                 {  variable size, determined by tag element size  }
    end;

    CMUInt8ArrayTypePtr = ^CMUInt8ArrayType;
    CMUInt8ArrayType = record
        typeDescriptor:         OSType;                                 {  'ui08' = cmSigUInt8Type  }
        reserved:               UInt32;                                 {  fill with 0x00  }
        value:                  SInt8;                                  {  variable size, determined by tag element size  }
    end;

    CMUInt16ArrayTypePtr = ^CMUInt16ArrayType;
    CMUInt16ArrayType = record
        typeDescriptor:         OSType;                                 {  'ui16' = cmSigUInt16Type  }
        reserved:               UInt32;                                 {  fill with 0x00  }
        value:                  array [0..0] of UInt16;                 {  variable size, determined by tag element size  }
    end;

    CMUInt32ArrayTypePtr = ^CMUInt32ArrayType;
    CMUInt32ArrayType = record
        typeDescriptor:         OSType;                                 {  'ui32' = cmSigUInt32Type  }
        reserved:               UInt32;                                 {  fill with 0x00  }
        value:                  array [0..0] of UInt32;                 {  variable size, determined by tag element size  }
    end;

    CMUInt64ArrayTypePtr = ^CMUInt64ArrayType;
    CMUInt64ArrayType = record
        typeDescriptor:         OSType;                                 {  'ui64' = cmSigUInt64Type  }
        reserved:               UInt32;                                 {  fill with 0x00  }
        value:                  array [0..0] of UInt32;                 {  variable size, determined by tag element size  }
    end;

    CMViewingConditionsTypePtr = ^CMViewingConditionsType;
    CMViewingConditionsType = record
        typeDescriptor:         OSType;                                 {  'view' = cmSigViewingConditionsType  }
        reserved:               UInt32;                                 {  fill with 0x00  }
        illuminant:             CMFixedXYZColor;                        {  absolute XYZs of illuminant  in cd/m^2  }
        surround:               CMFixedXYZColor;                        {  absolute XYZs of surround in cd/m^2  }
        stdIlluminant:          UInt32;                                 {  see definitions of std illuminants  }
    end;

    CMXYZTypePtr = ^CMXYZType;
    CMXYZType = record
        typeDescriptor:         OSType;                                 {  'XYZ ' = cmSigXYZType  }
        reserved:               UInt32;                                 {  fill with 0x00  }
        XYZ:                    array [0..0] of CMFixedXYZColor;        {  variable size, determined by tag element size  }
    end;

    CMProfileSequenceDescTypePtr = ^CMProfileSequenceDescType;
    CMProfileSequenceDescType = record
        typeDescriptor:         OSType;                                 {  'pseq' = cmProfileSequenceDescTag  }
        reserved:               UInt32;                                 {  fill with 0x00  }
        count:                  UInt32;                                 {  Number of descriptions  }
        data:                   SInt8;                                  {  variable size data explained in ICC spec  }
    end;

    CMUcrBgTypePtr = ^CMUcrBgType;
    CMUcrBgType = record
        typeDescriptor:         OSType;                                 {  'bfd ' = cmSigUcrBgType  }
        reserved:               UInt32;                                 {  fill with 0x00  }
        ucrCount:               UInt32;                                 {  Number of UCR entries  }
        ucrValues:              array [0..0] of UInt16;                 {  variable size, determined by ucrCount  }
    end;

    {    Private Tag Type Definitions   }
    CMIntentCRDVMSizePtr = ^CMIntentCRDVMSize;
    CMIntentCRDVMSize = record
        renderingIntent:        SInt32;                             {  rendering intent  }
        VMSize:                 UInt32;                                 {  VM size taken up by the CRD  }
    end;

    CMPS2CRDVMSizeTypePtr = ^CMPS2CRDVMSizeType;
    CMPS2CRDVMSizeType = record
        typeDescriptor:         OSType;                                 {  'psvm' = cmSigPS2CRDVMSizeType  }
        reserved:               UInt32;                                 {  fill with 0x00  }
        count:                  UInt32;                                 {  number of intent entries  }
        intentCRD:              array [0..0] of CMIntentCRDVMSize;      {  variable size, determined by count  }
    end;


const
    cmVideoCardGammaTableType   = 0;
    cmVideoCardGammaFormulaType = 1;


type
    CMVideoCardGammaTablePtr = ^CMVideoCardGammaTable;
    CMVideoCardGammaTable = record
        channels:               UInt16;                                 {  # of gamma channels (1 or 3)  }
        entryCount:             UInt16;                                 {  1-based number of entries per channel  }
        entrySize:              UInt16;                                 {  size in bytes of each entry  }
        data:                   SInt8;                                  {  variable size, determined by channels*entryCount*entrySize  }
    end;

    CMVideoCardGammaFormulaPtr = ^CMVideoCardGammaFormula;
    CMVideoCardGammaFormula = record
        redGamma:               Fixed;                                  {  must be > 0.0  }
        redMin:                 Fixed;                                  {  must be > 0.0 and < 1.0  }
        redMax:                 Fixed;                                  {  must be > 0.0 and < 1.0  }
        greenGamma:             Fixed;                                  {  must be > 0.0  }
        greenMin:               Fixed;                                  {  must be > 0.0 and < 1.0  }
        greenMax:               Fixed;                                  {  must be > 0.0 and < 1.0  }
        blueGamma:              Fixed;                                  {  must be > 0.0  }
        blueMin:                Fixed;                                  {  must be > 0.0 and < 1.0  }
        blueMax:                Fixed;                                  {  must be > 0.0 and < 1.0  }
    end;

    CMVideoCardGammaPtr = ^CMVideoCardGamma;
    CMVideoCardGamma = record
        tagType:                UInt32;
        case SInt16 of
        0: (
            table:              CMVideoCardGammaTable;
            );
        1: (
            formula:            CMVideoCardGammaFormula;
            );
    end;

    CMVideoCardGammaTypePtr = ^CMVideoCardGammaType;
    CMVideoCardGammaType = record
        typeDescriptor:         OSType;                                 {  'vcgt' = cmSigVideoCardGammaType  }
        reserved:               UInt32;                                 {  fill with 0x00  }
        gamma:                  CMVideoCardGamma;
    end;

    CMMakeAndModelPtr = ^CMMakeAndModel;
    CMMakeAndModel = record
        manufacturer:           OSType;
        model:                  UInt32;
        serialNumber:           UInt32;
        manufactureDate:        UInt32;
        reserved1:              UInt32;                                 {  fill with 0x00  }
        reserved2:              UInt32;                                 {  fill with 0x00  }
        reserved3:              UInt32;                                 {  fill with 0x00  }
        reserved4:              UInt32;                                 {  fill with 0x00  }
    end;

    CMMakeAndModelTypePtr = ^CMMakeAndModelType;
    CMMakeAndModelType = record
        typeDescriptor:         OSType;                                 {  'mmod' = cmSigMakeAndModelType  }
        reserved:               UInt32;                                 {  fill with 0x00  }
        makeAndModel:           CMMakeAndModel;
    end;

    CMMultiLocalizedUniCodeEntryRecPtr = ^CMMultiLocalizedUniCodeEntryRec;
    CMMultiLocalizedUniCodeEntryRec = record
        languageCode:           packed array [0..1] of char;            {  language code from ISO-639  }
        regionCode:             packed array [0..1] of char;            {  region code from ISO-3166  }
        textLength:             UInt32;                                 {  the length in bytes of the string  }
        textOffset:             UInt32;                                 {  the offset from the start of tag in bytes  }
    end;

    CMMultiLocalizedUniCodeTypePtr = ^CMMultiLocalizedUniCodeType;
    CMMultiLocalizedUniCodeType = record
        typeDescriptor:         OSType;                                 {  'mluc' = cmSigMultiLocalizedUniCodeType  }
        reserved:               UInt32;                                 {  fill with 0x00  }
        entryCount:             UInt32;                                 {  1-based number of name records that follow  }
        entrySize:              UInt32;                                 {  size in bytes of name records that follow  }
                                                                        {  variable-length data for storage of CMMultiLocalizedUniCodeEntryRec  }
                                                                        {  variable-length data for storage of Unicode strings }
    end;

    {   **********************************************************************  }
    {   ************** ColorSync 1.0 profile specification *******************  }
    {   **********************************************************************  }

const
    cmGrayResponse              = 0;
    cmRedResponse               = 1;
    cmGreenResponse             = 2;
    cmBlueResponse              = 3;
    cmCyanResponse              = 4;
    cmMagentaResponse           = 5;
    cmYellowResponse            = 6;
    cmUcrResponse               = 7;
    cmBgResponse                = 8;
    cmOnePlusLastResponse       = 9;


    {    Device types   }
    cmMonitorDevice             = $6D6E7472 (* 'mntr' *);
    cmScannerDevice             = $73636E72 (* 'scnr' *);
    cmPrinterDevice             = $70727472 (* 'prtr' *);



type
    CMIStringPtr = ^CMIString;
    CMIString = record
        theScript:              ScriptCode;
        theString:              Str63;
    end;

    {    Profile options    }

const
    cmPerceptualMatch           = $0000;                        {  Default. For photographic images  }
    cmColorimetricMatch         = $0001;                        {  Exact matching when possible  }
    cmSaturationMatch           = $0002;                        {  For solid colors  }

    {    Profile flags  }
    cmNativeMatchingPreferred   = $00000001;                    {  Default to native not preferred  }
    cmTurnOffCache              = $00000002;                    {  Default to turn on CMM cache  }


type
    CMMatchOption                       = SInt32;
    CMMatchFlag                         = SInt32;
    CMHeaderPtr = ^CMHeader;
    CMHeader = record
        size:                   UInt32;
        CMMType:                OSType;
        applProfileVersion:     UInt32;
        dataType:               OSType;
        deviceType:             OSType;
        deviceManufacturer:     OSType;
        deviceModel:            UInt32;
        deviceAttributes:       array [0..1] of UInt32;
        profileNameOffset:      UInt32;
        customDataOffset:       UInt32;
        flags:                  CMMatchFlag;
        options:                CMMatchOption;
        white:                  CMXYZColor;
        black:                  CMXYZColor;
    end;

    CMProfileChromaticitiesPtr = ^CMProfileChromaticities;
    CMProfileChromaticities = record
        red:                    CMXYZColor;
        green:                  CMXYZColor;
        blue:                   CMXYZColor;
        cyan:                   CMXYZColor;
        magenta:                CMXYZColor;
        yellow:                 CMXYZColor;
    end;

    CMProfileResponsePtr = ^CMProfileResponse;
    CMProfileResponse = record
        counts:                 array [0..8] of UInt16;
        data:                   array [0..0] of UInt16;                 {  Variable size  }
    end;

    CMProfilePtr = ^CMProfile;
    CMProfile = record
        header:                 CMHeader;
        profile:                CMProfileChromaticities;
        response:               CMProfileResponse;
        profileName:            CMIString;
        customData:             SInt8;                                  {  Variable size  }
    end;

    CMProfileHandle                     = ^CMProfilePtr;


{$ALIGN MAC68K}
{#POP}
{unit CMTypes}
{$ALIGN MAC68K}











{ Standard type for ColorSync and other system error codes }

{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}


type
    CMError                             = SInt32;
    {    Abstract data type for memory-based Profile    }
    CMProfileRef    = ^SInt32; { an opaque 32-bit type }
    CMProfileRefPtr = ^CMProfileRef;  { when a var xx:CMProfileRef parameter can be nil, it is changed to xx: CMProfileRefPtr }
    {    Abstract data type for Profile search result   }
    CMProfileSearchRef    = ^SInt32; { an opaque 32-bit type }
    CMProfileSearchRefPtr = ^CMProfileSearchRef;  { when a var xx:CMProfileSearchRef parameter can be nil, it is changed to xx: CMProfileSearchRefPtr }
    {    Abstract data type for BeginMatching(É) reference  }
    CMMatchRef    = ^SInt32; { an opaque 32-bit type }
    CMMatchRefPtr = ^CMMatchRef;  { when a var xx:CMMatchRef parameter can be nil, it is changed to xx: CMMatchRefPtr }
    {    Abstract data type for ColorWorld reference    }
    CMWorldRef    = ^SInt32; { an opaque 32-bit type }
    CMWorldRefPtr = ^CMWorldRef;  { when a var xx:CMWorldRef parameter can be nil, it is changed to xx: CMWorldRefPtr }
    {    Data type for ColorSync DisplayID reference    }
    {    On 8 & 9 this is a AVIDType    }
    {    On X this is a CGSDisplayID    }
    CMDisplayIDType                     = UInt32;

    {    Caller-supplied flatten function   }
    CMFlattenProcPtr = function(command: SInt32; var size: SInt32; data: UnivPtr; refCon: UnivPtr): OSErr;

    {    Caller-supplied progress function for Bitmap & PixMap matching routines    }
    CMBitmapCallBackProcPtr = function(progress: SInt32; refCon: UnivPtr): boolean;

    {    Caller-supplied progress function for NCMMConcatInit & NCMMNewLinkProfile routines     }
    CMConcatCallBackProcPtr = function(progress: SInt32; refCon: UnivPtr): boolean;

    {    Caller-supplied filter function for Profile search     }
    CMProfileFilterProcPtr = function(prof: CMProfileRef; refCon: UnivPtr): boolean;

    {    Caller-supplied function for profile access    }
    CMProfileAccessProcPtr = function(command: SInt32; offset: SInt32; var size: SInt32; data: UnivPtr; refCon: UnivPtr): OSErr;

    CMFlattenUPP = ^SInt32; { an opaque UPP }
    CMBitmapCallBackUPP = ^SInt32; { an opaque UPP }
    CMConcatCallBackUPP = ^SInt32; { an opaque UPP }
    CMProfileFilterUPP = ^SInt32; { an opaque UPP }
    CMProfileAccessUPP = ^SInt32; { an opaque UPP }

const
    uppCMFlattenProcInfo = $00003FE0;
    uppCMBitmapCallBackProcInfo = $000003D0;
    uppCMConcatCallBackProcInfo = $000003D0;
    uppCMProfileFilterProcInfo = $000003D0;
    uppCMProfileAccessProcInfo = $0000FFE0;
    {
     *  NewCMFlattenUPP()
     *
     *  Availability:
     *    Non-Carbon CFM:   available as macro/inline
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in 3.0 and later
        }
function NewCMFlattenUPP(userRoutine: CMFlattenProcPtr): CMFlattenUPP; external name '_NewCMFlattenUPP'; { old name was NewCMFlattenProc }
{
 *  NewCMBitmapCallBackUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
function NewCMBitmapCallBackUPP(userRoutine: CMBitmapCallBackProcPtr): CMBitmapCallBackUPP; external name '_NewCMBitmapCallBackUPP'; { old name was NewCMBitmapCallBackProc }
{
 *  NewCMConcatCallBackUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
function NewCMConcatCallBackUPP(userRoutine: CMConcatCallBackProcPtr): CMConcatCallBackUPP; external name '_NewCMConcatCallBackUPP'; { old name was NewCMConcatCallBackProc }
{
 *  NewCMProfileFilterUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
function NewCMProfileFilterUPP(userRoutine: CMProfileFilterProcPtr): CMProfileFilterUPP; external name '_NewCMProfileFilterUPP'; { old name was NewCMProfileFilterProc }
{
 *  NewCMProfileAccessUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
function NewCMProfileAccessUPP(userRoutine: CMProfileAccessProcPtr): CMProfileAccessUPP; external name '_NewCMProfileAccessUPP'; { old name was NewCMProfileAccessProc }
{
 *  DisposeCMFlattenUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
procedure DisposeCMFlattenUPP(userUPP: CMFlattenUPP); external name '_DisposeCMFlattenUPP';
{
 *  DisposeCMBitmapCallBackUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
procedure DisposeCMBitmapCallBackUPP(userUPP: CMBitmapCallBackUPP); external name '_DisposeCMBitmapCallBackUPP';
{
 *  DisposeCMConcatCallBackUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
procedure DisposeCMConcatCallBackUPP(userUPP: CMConcatCallBackUPP); external name '_DisposeCMConcatCallBackUPP';
{
 *  DisposeCMProfileFilterUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
procedure DisposeCMProfileFilterUPP(userUPP: CMProfileFilterUPP); external name '_DisposeCMProfileFilterUPP';
{
 *  DisposeCMProfileAccessUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
procedure DisposeCMProfileAccessUPP(userUPP: CMProfileAccessUPP); external name '_DisposeCMProfileAccessUPP';
{
 *  InvokeCMFlattenUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
function InvokeCMFlattenUPP(command: SInt32; var size: SInt32; data: UnivPtr; refCon: UnivPtr; userRoutine: CMFlattenUPP): OSErr; external name '_InvokeCMFlattenUPP'; { old name was CallCMFlattenProc }
{
 *  InvokeCMBitmapCallBackUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
function InvokeCMBitmapCallBackUPP(progress: SInt32; refCon: UnivPtr; userRoutine: CMBitmapCallBackUPP): boolean; external name '_InvokeCMBitmapCallBackUPP'; { old name was CallCMBitmapCallBackProc }
{
 *  InvokeCMConcatCallBackUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
function InvokeCMConcatCallBackUPP(progress: SInt32; refCon: UnivPtr; userRoutine: CMConcatCallBackUPP): boolean; external name '_InvokeCMConcatCallBackUPP'; { old name was CallCMConcatCallBackProc }
{
 *  InvokeCMProfileFilterUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
function InvokeCMProfileFilterUPP(prof: CMProfileRef; refCon: UnivPtr; userRoutine: CMProfileFilterUPP): boolean; external name '_InvokeCMProfileFilterUPP'; { old name was CallCMProfileFilterProc }
{
 *  InvokeCMProfileAccessUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
function InvokeCMProfileAccessUPP(command: SInt32; offset: SInt32; var size: SInt32; data: UnivPtr; refCon: UnivPtr; userRoutine: CMProfileAccessUPP): OSErr; external name '_InvokeCMProfileAccessUPP'; { old name was CallCMProfileAccessProc }
{$ALIGN MAC68K}
{#POP}
{unit Collections}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}

{***********}
{ Constants }
{***********}
{ Convenience constants for functions which optionally return values }

const
    kCollectionDontWantTag      = 0;
    kCollectionDontWantId       = 0;
    kCollectionDontWantSize     = 0;
    kCollectionDontWantAttributes = 0;
    kCollectionDontWantIndex    = 0;
    kCollectionDontWantData     = 0;


    {    attributes bits    }
    kCollectionNoAttributes     = $00000000;                    {  no attributes bits set  }
    kCollectionAllAttributes    = $FFFFFFFF;                    {  all attributes bits set  }
    kCollectionUserAttributes   = $0000FFFF;                    {  user attributes bits  }
    kCollectionDefaultAttributes = $40000000;                   {  default attributes - unlocked, persistent  }


    {
        Attribute bits 0 through 15 (entire low word) are reserved for use by the application.
        Attribute bits 16 through 31 (entire high word) are reserved for use by the Collection Manager.
        Only bits 31 (kCollectionLockBit) and 30 (kCollectionPersistenceBit) currently have meaning.
        }
    kCollectionUser0Bit         = 0;
    kCollectionUser1Bit         = 1;
    kCollectionUser2Bit         = 2;
    kCollectionUser3Bit         = 3;
    kCollectionUser4Bit         = 4;
    kCollectionUser5Bit         = 5;
    kCollectionUser6Bit         = 6;
    kCollectionUser7Bit         = 7;
    kCollectionUser8Bit         = 8;
    kCollectionUser9Bit         = 9;
    kCollectionUser10Bit        = 10;
    kCollectionUser11Bit        = 11;
    kCollectionUser12Bit        = 12;
    kCollectionUser13Bit        = 13;
    kCollectionUser14Bit        = 14;
    kCollectionUser15Bit        = 15;
    kCollectionReserved0Bit     = 16;
    kCollectionReserved1Bit     = 17;
    kCollectionReserved2Bit     = 18;
    kCollectionReserved3Bit     = 19;
    kCollectionReserved4Bit     = 20;
    kCollectionReserved5Bit     = 21;
    kCollectionReserved6Bit     = 22;
    kCollectionReserved7Bit     = 23;
    kCollectionReserved8Bit     = 24;
    kCollectionReserved9Bit     = 25;
    kCollectionReserved10Bit    = 26;
    kCollectionReserved11Bit    = 27;
    kCollectionReserved12Bit    = 28;
    kCollectionReserved13Bit    = 29;
    kCollectionPersistenceBit   = 30;
    kCollectionLockBit          = 31;


    {    attribute masks    }
    kCollectionUser0Mask        = $00000001;
    kCollectionUser1Mask        = $00000002;
    kCollectionUser2Mask        = $00000004;
    kCollectionUser3Mask        = $00000008;
    kCollectionUser4Mask        = $00000010;
    kCollectionUser5Mask        = $00000020;
    kCollectionUser6Mask        = $00000040;
    kCollectionUser7Mask        = $00000080;
    kCollectionUser8Mask        = $00000100;
    kCollectionUser9Mask        = $00000200;
    kCollectionUser10Mask       = $00000400;
    kCollectionUser11Mask       = $00000800;
    kCollectionUser12Mask       = $00001000;
    kCollectionUser13Mask       = $00002000;
    kCollectionUser14Mask       = $00004000;
    kCollectionUser15Mask       = $00008000;
    kCollectionReserved0Mask    = $00010000;
    kCollectionReserved1Mask    = $00020000;
    kCollectionReserved2Mask    = $00040000;
    kCollectionReserved3Mask    = $00080000;
    kCollectionReserved4Mask    = $00100000;
    kCollectionReserved5Mask    = $00200000;
    kCollectionReserved6Mask    = $00400000;
    kCollectionReserved7Mask    = $00800000;
    kCollectionReserved8Mask    = $01000000;
    kCollectionReserved9Mask    = $02000000;
    kCollectionReserved10Mask   = $04000000;
    kCollectionReserved11Mask   = $08000000;
    kCollectionReserved12Mask   = $10000000;
    kCollectionReserved13Mask   = $20000000;
    kCollectionPersistenceMask  = $40000000;
    kCollectionLockMask         = $80000000;


    {   *********   }
    {    Types      }
    {   *********   }
    {    abstract data type for a collection    }

type
    Collection    = ^SInt32; { an opaque 32-bit type }
    CollectionPtr = ^Collection;  { when a var xx:Collection parameter can be nil, it is changed to xx: CollectionPtr }
    {    collection member 4 byte tag   }
    CollectionTag                       = FourCharCode;
    CollectionFlattenProcPtr = function(size: SInt32; data: UnivPtr; refCon: UnivPtr): OSErr;

    CollectionExceptionProcPtr = function(c: Collection; status: OSErr): OSErr;

    CollectionFlattenUPP = ^SInt32; { an opaque UPP }
    CollectionExceptionUPP = ^SInt32; { an opaque UPP }

const
    uppCollectionFlattenProcInfo = $00000FE0;
    uppCollectionExceptionProcInfo = $000002E0;
    {
     *  NewCollectionFlattenUPP()
     *
     *  Availability:
     *    Non-Carbon CFM:   available as macro/inline
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function NewCollectionFlattenUPP(userRoutine: CollectionFlattenProcPtr): CollectionFlattenUPP; external name '_NewCollectionFlattenUPP'; { old name was NewCollectionFlattenProc }
{
 *  NewCollectionExceptionUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewCollectionExceptionUPP(userRoutine: CollectionExceptionProcPtr): CollectionExceptionUPP; external name '_NewCollectionExceptionUPP'; { old name was NewCollectionExceptionProc }
{
 *  DisposeCollectionFlattenUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeCollectionFlattenUPP(userUPP: CollectionFlattenUPP); external name '_DisposeCollectionFlattenUPP';
{
 *  DisposeCollectionExceptionUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeCollectionExceptionUPP(userUPP: CollectionExceptionUPP); external name '_DisposeCollectionExceptionUPP';
{
 *  InvokeCollectionFlattenUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeCollectionFlattenUPP(size: SInt32; data: UnivPtr; refCon: UnivPtr; userRoutine: CollectionFlattenUPP): OSErr; external name '_InvokeCollectionFlattenUPP'; { old name was CallCollectionFlattenProc }
{
 *  InvokeCollectionExceptionUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeCollectionExceptionUPP(c: Collection; status: OSErr; userRoutine: CollectionExceptionUPP): OSErr; external name '_InvokeCollectionExceptionUPP'; { old name was CallCollectionExceptionProc }
{*******************************************}
{************ Public interfaces ************}
{*******************************************}
{
 *  NewCollection()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CollectionsLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewCollection: Collection; external name '_NewCollection';
{
 *  DisposeCollection()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CollectionsLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeCollection(c: Collection); external name '_DisposeCollection';
{
 *  CloneCollection()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CollectionsLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CloneCollection(c: Collection): Collection; external name '_CloneCollection';
{
 *  CountCollectionOwners()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CollectionsLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CountCollectionOwners(c: Collection): SInt32; external name '_CountCollectionOwners';
{
 *  RetainCollection()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function RetainCollection(c: Collection): OSStatus; external name '_RetainCollection';


{
 *  ReleaseCollection()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ReleaseCollection(c: Collection): OSStatus; external name '_ReleaseCollection';


{
 *  GetCollectionRetainCount()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetCollectionRetainCount(c: Collection): ItemCount; external name '_GetCollectionRetainCount';


{
 *  CopyCollection()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CollectionsLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CopyCollection(srcCollection: Collection; dstCollection: Collection): Collection; external name '_CopyCollection';
{
 *  GetCollectionDefaultAttributes()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CollectionsLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetCollectionDefaultAttributes(c: Collection): SInt32; external name '_GetCollectionDefaultAttributes';
{
 *  SetCollectionDefaultAttributes()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CollectionsLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetCollectionDefaultAttributes(c: Collection; whichAttributes: SInt32; newAttributes: SInt32); external name '_SetCollectionDefaultAttributes';
{
 *  CountCollectionItems()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CollectionsLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CountCollectionItems(c: Collection): SInt32; external name '_CountCollectionItems';
{
 *  AddCollectionItem()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CollectionsLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function AddCollectionItem(c: Collection; tag: CollectionTag; id: SInt32; itemSize: SInt32; itemData: UnivPtr): OSErr; external name '_AddCollectionItem';
{
 *  GetCollectionItem()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CollectionsLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetCollectionItem(c: Collection; tag: CollectionTag; id: SInt32; var itemSize: SInt32; itemData: UnivPtr): OSErr; external name '_GetCollectionItem';
{
 *  RemoveCollectionItem()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CollectionsLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function RemoveCollectionItem(c: Collection; tag: CollectionTag; id: SInt32): OSErr; external name '_RemoveCollectionItem';
{
 *  SetCollectionItemInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CollectionsLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetCollectionItemInfo(c: Collection; tag: CollectionTag; id: SInt32; whichAttributes: SInt32; newAttributes: SInt32): OSErr; external name '_SetCollectionItemInfo';
{
 *  GetCollectionItemInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CollectionsLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetCollectionItemInfo(c: Collection; tag: CollectionTag; id: SInt32; var index: SInt32; var itemSize: SInt32; var attributes: SInt32): OSErr; external name '_GetCollectionItemInfo';
{
 *  ReplaceIndexedCollectionItem()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CollectionsLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ReplaceIndexedCollectionItem(c: Collection; index: SInt32; itemSize: SInt32; itemData: UnivPtr): OSErr; external name '_ReplaceIndexedCollectionItem';
{
 *  GetIndexedCollectionItem()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CollectionsLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetIndexedCollectionItem(c: Collection; index: SInt32; var itemSize: SInt32; itemData: UnivPtr): OSErr; external name '_GetIndexedCollectionItem';
{
 *  RemoveIndexedCollectionItem()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CollectionsLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function RemoveIndexedCollectionItem(c: Collection; index: SInt32): OSErr; external name '_RemoveIndexedCollectionItem';
{
 *  SetIndexedCollectionItemInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CollectionsLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetIndexedCollectionItemInfo(c: Collection; index: SInt32; whichAttributes: SInt32; newAttributes: SInt32): OSErr; external name '_SetIndexedCollectionItemInfo';
{
 *  GetIndexedCollectionItemInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CollectionsLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetIndexedCollectionItemInfo(c: Collection; index: SInt32; var tag: CollectionTag; var id: SInt32; var itemSize: SInt32; var attributes: SInt32): OSErr; external name '_GetIndexedCollectionItemInfo';
{
 *  CollectionTagExists()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CollectionsLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CollectionTagExists(c: Collection; tag: CollectionTag): boolean; external name '_CollectionTagExists';
{
 *  CountCollectionTags()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CollectionsLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CountCollectionTags(c: Collection): SInt32; external name '_CountCollectionTags';
{
 *  GetIndexedCollectionTag()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CollectionsLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetIndexedCollectionTag(c: Collection; tagIndex: SInt32; var tag: CollectionTag): OSErr; external name '_GetIndexedCollectionTag';
{
 *  CountTaggedCollectionItems()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CollectionsLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CountTaggedCollectionItems(c: Collection; tag: CollectionTag): SInt32; external name '_CountTaggedCollectionItems';
{
 *  GetTaggedCollectionItem()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CollectionsLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetTaggedCollectionItem(c: Collection; tag: CollectionTag; whichItem: SInt32; var itemSize: SInt32; itemData: UnivPtr): OSErr; external name '_GetTaggedCollectionItem';
{
 *  GetTaggedCollectionItemInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CollectionsLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetTaggedCollectionItemInfo(c: Collection; tag: CollectionTag; whichItem: SInt32; var id: SInt32; var index: SInt32; var itemSize: SInt32; var attributes: SInt32): OSErr; external name '_GetTaggedCollectionItemInfo';
{
 *  PurgeCollection()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CollectionsLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure PurgeCollection(c: Collection; whichAttributes: SInt32; matchingAttributes: SInt32); external name '_PurgeCollection';
{
 *  PurgeCollectionTag()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CollectionsLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure PurgeCollectionTag(c: Collection; tag: CollectionTag); external name '_PurgeCollectionTag';
{
 *  EmptyCollection()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CollectionsLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure EmptyCollection(c: Collection); external name '_EmptyCollection';
{
 *  FlattenCollection()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CollectionsLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FlattenCollection(c: Collection; flattenProc: CollectionFlattenUPP; refCon: UnivPtr): OSErr; external name '_FlattenCollection';
{
 *  FlattenPartialCollection()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CollectionsLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FlattenPartialCollection(c: Collection; flattenProc: CollectionFlattenUPP; refCon: UnivPtr; whichAttributes: SInt32; matchingAttributes: SInt32): OSErr; external name '_FlattenPartialCollection';
{
 *  UnflattenCollection()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CollectionsLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function UnflattenCollection(c: Collection; flattenProc: CollectionFlattenUPP; refCon: UnivPtr): OSErr; external name '_UnflattenCollection';
{
 *  GetCollectionExceptionProc()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CollectionsLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetCollectionExceptionProc(c: Collection): CollectionExceptionUPP; external name '_GetCollectionExceptionProc';
{
 *  SetCollectionExceptionProc()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CollectionsLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetCollectionExceptionProc(c: Collection; exceptionProc: CollectionExceptionUPP); external name '_SetCollectionExceptionProc';
{
 *  GetNewCollection()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CollectionsLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetNewCollection(collectionID: SInt16): Collection; external name '_GetNewCollection';
{********************************************************************}
{************* Utility routines for handle-based access *************}
{********************************************************************}
{
 *  AddCollectionItemHdl()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CollectionsLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function AddCollectionItemHdl(aCollection: Collection; tag: CollectionTag; id: SInt32; itemData: Handle): OSErr; external name '_AddCollectionItemHdl';
{
 *  GetCollectionItemHdl()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CollectionsLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetCollectionItemHdl(aCollection: Collection; tag: CollectionTag; id: SInt32; itemData: Handle): OSErr; external name '_GetCollectionItemHdl';
{
 *  ReplaceIndexedCollectionItemHdl()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CollectionsLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ReplaceIndexedCollectionItemHdl(aCollection: Collection; index: SInt32; itemData: Handle): OSErr; external name '_ReplaceIndexedCollectionItemHdl';
{
 *  GetIndexedCollectionItemHdl()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CollectionsLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetIndexedCollectionItemHdl(aCollection: Collection; index: SInt32; itemData: Handle): OSErr; external name '_GetIndexedCollectionItemHdl';
{
 *  FlattenCollectionToHdl()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CollectionsLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FlattenCollectionToHdl(aCollection: Collection; flattened: Handle): OSErr; external name '_FlattenCollectionToHdl';
{
 *  UnflattenCollectionFromHdl()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CollectionsLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function UnflattenCollectionFromHdl(aCollection: Collection; flattened: Handle): OSErr; external name '_UnflattenCollectionFromHdl';


{$ALIGN MAC68K}
{#POP}
{unit DHCPClientPreferences}
{$ALIGN MAC68K}






{!
    @header DHCPClientPreferences.h
 }

{!
    @function DHCPClientPreferencesSetApplicationOptions
    @discussion Updates the DHCP client preferences to include the
        given list of options for the given "applicationID".
    @param applicationID The application's preference ID, for example:
        "com.apple.SystemPreferences".
    @param options An array of 8-bit values containing the
        DHCP option codes (see RFC 2132) for this applicationID.
        A NULL value will clear the list of options for this
        application ID.
    @param count The number of elements in "options".
    @result TRUE if the operation succeeded, FALSE otherwise.
 }

function DHCPClientPreferencesSetApplicationOptions( applicationID: CFStringRef; options: UInt8Ptr; count: CFIndex ): Boolean; external name '_DHCPClientPreferencesSetApplicationOptions';

{!
    @function DHCPClientPreferencesCopyApplicationOptions
    @discussion Copies the requested DHCP options for the
        given "applicationID".
    @param applicationID The application's preference ID, for example
        "com.apple.SystemPreferences".
    @param count The number of elements in the returned array.
    @result The list of options for the given "applicationID", or
        NULL if no options are defined or an error occurred.

        When done, use free() to release a non-NULL return value.
 }

function DHCPClientPreferencesCopyApplicationOptions( applicationID: CFStringRef; var count: CFIndex ): UInt8Ptr; external name '_DHCPClientPreferencesCopyApplicationOptions';
{unit DateTimeUtils}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}

{

    Here are the current routine names and the translations to the older forms.
    Please use the newer forms in all new code and migrate the older names out of existing
    code as maintainance permits.

    New Name                    Old Name(s)

    DateString                  IUDatePString IUDateString
    InitDateCache
    LongDateString              IULDateString
    LongTimeString              IULTimeString
    StringToDate                String2Date
    StringToTime
    TimeString                  IUTimeString IUTimePString
    LongDateToSeconds           LongDate2Secs
    LongSecondsToDate           LongSecs2Date
    DateToSeconds               Date2Secs
    SecondsToDate               Secs2Date


    Carbon only supports the new names.  The old names are undefined for Carbon targets.
    This is true for C, Assembly and Pascal.

    InterfaceLib always has exported the old names.  For C macros have been defined to allow
    the use of the new names.  For Pascal and Assembly using the new names will result
    in link errors.

}


type
    ToggleResults               = SInt16;
const
                                                                {  Toggle results  }
    toggleUndefined             = 0;
    toggleOK                    = 1;
    toggleBadField              = 2;
    toggleBadDelta              = 3;
    toggleBadChar               = 4;
    toggleUnknown               = 5;
    toggleBadNum                = 6;
    toggleOutOfRange            = 7;                            { synonym for toggleErr3 }
    toggleErr3                  = 7;
    toggleErr4                  = 8;
    toggleErr5                  = 9;

                                                                {  Date equates  }
    smallDateBit                = 31;                           { Restrict valid date/time to range of Time global }
    togChar12HourBit            = 30;                           { If toggling hour by char, accept hours 1..12 only }
    togCharZCycleBit            = 29;                           { Modifier for togChar12HourBit: accept hours 0..11 only }
    togDelta12HourBit           = 28;                           { If toggling hour up/down, restrict to 12-hour range (am/pm) }
    genCdevRangeBit             = 27;                           { Restrict date/time to range used by genl CDEV }
    validDateFields             = -1;
    maxDateField                = 10;

    eraMask                     = $0001;
    yearMask                    = $0002;
    monthMask                   = $0004;
    dayMask                     = $0008;
    hourMask                    = $0010;
    minuteMask                  = $0020;
    secondMask                  = $0040;
    dayOfWeekMask               = $0080;
    dayOfYearMask               = $0100;
    weekOfYearMask              = $0200;
    pmMask                      = $0400;
    dateStdMask                 = $007F;                        { default for ValidDate flags and ToggleDate TogglePB.togFlags }


type
    LongDateField               = SInt8;
const
    eraField                    = 0;
    yearField                   = 1;
    monthField                  = 2;
    dayField                    = 3;
    hourField                   = 4;
    minuteField                 = 5;
    secondField                 = 6;
    dayOfWeekField              = 7;
    dayOfYearField              = 8;
    weekOfYearField             = 9;
    pmField                     = 10;
    res1Field                   = 11;
    res2Field                   = 12;
    res3Field                   = 13;


type
    DateForm                    = SInt8;
const
    shortDate                   = 0;
    longDate                    = 1;
    abbrevDate                  = 2;

                                                                {  StringToDate status values  }
    fatalDateTime               = $8000;                        {  StringToDate and String2Time mask to a fatal error  }
    longDateFound               = 1;                            {  StringToDate mask to long date found  }
    leftOverChars               = 2;                            {  StringToDate & Time mask to warn of left over characters  }
    sepNotIntlSep               = 4;                            {  StringToDate & Time mask to warn of non-standard separators  }
    fieldOrderNotIntl           = 8;                            {  StringToDate & Time mask to warn of non-standard field order  }
    extraneousStrings           = 16;                           {  StringToDate & Time mask to warn of unparsable strings in text  }
    tooManySeps                 = 32;                           {  StringToDate & Time mask to warn of too many separators  }
    sepNotConsistent            = 64;                           {  StringToDate & Time mask to warn of inconsistent separators  }
    tokenErr                    = $8100;                        {  StringToDate & Time mask for 'tokenizer err encountered'  }
    cantReadUtilities           = $8200;
    dateTimeNotFound            = $8400;
    dateTimeInvalid             = $8800;


type
    StringToDateStatus                  = SInt16;
    String2DateStatus                   = StringToDateStatus;
    DateCacheRecordPtr = ^DateCacheRecord;
    DateCacheRecord = packed record
        hidden:                 array [0..255] of SInt16;               {  only for temporary use  }
    end;

    DateCachePtr                        = ^DateCacheRecord;
    DateTimeRecPtr = ^DateTimeRec;
    DateTimeRec = record
        year:                   SInt16;
        month:                  SInt16;
        day:                    SInt16;
        hour:                   SInt16;
        minute:                 SInt16;
        second:                 SInt16;
        dayOfWeek:              SInt16;
    end;

    LongDateTime                        = SInt64;
    LongDateTimePtr                     = ^LongDateTime;
    LongDateCvtPtr = ^LongDateCvt;
    LongDateCvt = record
        case SInt16 of
        0: (
            c:                  SInt64;
            );
        1: (
            lHigh:              UInt32;
            lLow:               UInt32;
           );
    end;

    LongDateRecPtr = ^LongDateRec;
    LongDateRec = record
        case SInt16 of
        0: (
            era:                SInt16;
            year:               SInt16;
            month:              SInt16;
            day:                SInt16;
            hour:               SInt16;
            minute:             SInt16;
            second:             SInt16;
            dayOfWeek:          SInt16;
            dayOfYear:          SInt16;
            weekOfYear:         SInt16;
            pm:                 SInt16;
            res1:               SInt16;
            res2:               SInt16;
            res3:               SInt16;
           );
        1: (
            list:               array [0..13] of SInt16;                { Index by LongDateField! }
            );
        2: (
            eraAlt:             SInt16;
            oldDate:            DateTimeRec;
           );
    end;

    DateDelta                           = SInt8;
    TogglePBPtr = ^TogglePB;
    TogglePB = record
        togFlags:               SInt32;                             { caller normally sets low word to dateStdMask=$7F }
        amChars:                ResType;                                { from 'itl0', but uppercased }
        pmChars:                ResType;                                { from 'itl0', but uppercased }
        reserved:               array [0..3] of SInt32;
    end;

    {
        These routine are available in Carbon with their new name
        }
    {
     *  DateString()
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
procedure DateString(dateTime: UInt32; longFlag: ByteParameter; var result: Str255; intlHandle: Handle); external name '_DateString';
{
 *  TimeString()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure TimeString(dateTime: UInt32; wantSeconds: boolean; var result: Str255; intlHandle: Handle); external name '_TimeString';
{
 *  LongDateString()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure LongDateString(const (*var*) dateTime: LongDateTime; longFlag: ByteParameter; var result: Str255; intlHandle: Handle); external name '_LongDateString';
{
 *  LongTimeString()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure LongTimeString(const (*var*) dateTime: LongDateTime; wantSeconds: boolean; var result: Str255; intlHandle: Handle); external name '_LongTimeString';
{
    These routine are available in Carbon and InterfaceLib with their new name
}
{
 *  InitDateCache()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InitDateCache(theCache: DateCachePtr): OSErr; external name '_InitDateCache';
{
 *  StringToDate()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function StringToDate(textPtr: Ptr; textLen: SInt32; theCache: DateCachePtr; var lengthUsed: SInt32; var dateTime: LongDateRec): StringToDateStatus; external name '_StringToDate';
{
 *  StringToTime()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function StringToTime(textPtr: Ptr; textLen: SInt32; theCache: DateCachePtr; var lengthUsed: SInt32; var dateTime: LongDateRec): StringToDateStatus; external name '_StringToTime';
{
 *  LongDateToSeconds()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure LongDateToSeconds(const (*var*) lDate: LongDateRec; var lSecs: LongDateTime); external name '_LongDateToSeconds';
{
 *  LongSecondsToDate()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure LongSecondsToDate(const (*var*) lSecs: LongDateTime; var lDate: LongDateRec); external name '_LongSecondsToDate';
{
 *  ToggleDate()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ToggleDate(var lSecs: LongDateTime; field: ByteParameter; delta: DateDelta; ch: SInt16; const (*var*) params: TogglePB): ToggleResults; external name '_ToggleDate';
{
 *  ValidDate()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ValidDate(const (*var*) vDate: LongDateRec; flags: SInt32; var newSecs: LongDateTime): SInt16; external name '_ValidDate';
{
 *  ReadDateTime()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ReadDateTime(var time: UInt32): OSErr; external name '_ReadDateTime';
{
 *  GetDateTime()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure GetDateTime(var secs: UInt32); external name '_GetDateTime';
{
 *  SetDateTime()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetDateTime(time: UInt32): OSErr; external name '_SetDateTime';
{
 *  SetTime()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetTime(const (*var*) d: DateTimeRec); external name '_SetTime';
{
 *  GetTime()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure GetTime(var d: DateTimeRec); external name '_GetTime';
{
 *  DateToSeconds()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DateToSeconds(const (*var*) d: DateTimeRec; var secs: UInt32); external name '_DateToSeconds';

{
 *  SecondsToDate()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SecondsToDate(secs: UInt32; var d: DateTimeRec); external name '_SecondsToDate';
{
    These routine are available in InterfaceLib using their old name.
    Macros allow using the new names in all source code.
}





{$ALIGN MAC68K}
{#POP}
{unit DriverSynchronization}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}


{
 *  CompareAndSwap()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CompareAndSwap(oldVvalue: UInt32; newValue: UInt32; var OldValueAdr: UInt32): boolean; external name '_CompareAndSwap';

{
 *  TestAndClear()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TestAndClear(bit: UInt32; startAddress: UnivPtr): boolean; external name '_TestAndClear';

{
 *  TestAndSet()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TestAndSet(bit: UInt32; startAddress: UnivPtr): boolean; external name '_TestAndSet';

{
 *  IncrementAtomic8()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function IncrementAtomic8(var value: SInt8): SInt8; external name '_IncrementAtomic8';

{
 *  DecrementAtomic8()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DecrementAtomic8(var value: SInt8): SInt8; external name '_DecrementAtomic8';

{
 *  AddAtomic8()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function AddAtomic8(amount: SInt32; var value: SInt8): SInt8; external name '_AddAtomic8';

{
 *  BitAndAtomic8()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function BitAndAtomic8(mask: UInt32; var value: UInt8): ByteParameter; external name '_BitAndAtomic8';

{
 *  BitOrAtomic8()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function BitOrAtomic8(mask: UInt32; var value: UInt8): ByteParameter; external name '_BitOrAtomic8';

{
 *  BitXorAtomic8()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function BitXorAtomic8(mask: UInt32; var value: UInt8): ByteParameter; external name '_BitXorAtomic8';

{
 *  IncrementAtomic16()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function IncrementAtomic16(var value: SInt16): SInt16; external name '_IncrementAtomic16';

{
 *  DecrementAtomic16()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DecrementAtomic16(var value: SInt16): SInt16; external name '_DecrementAtomic16';

{
 *  AddAtomic16()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function AddAtomic16(amount: SInt32; var value: SInt16): SInt16; external name '_AddAtomic16';

{
 *  BitAndAtomic16()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function BitAndAtomic16(mask: UInt32; var value: UInt16): UInt16; external name '_BitAndAtomic16';

{
 *  BitOrAtomic16()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function BitOrAtomic16(mask: UInt32; var value: UInt16): UInt16; external name '_BitOrAtomic16';

{
 *  BitXorAtomic16()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function BitXorAtomic16(mask: UInt32; var value: UInt16): UInt16; external name '_BitXorAtomic16';

{
 *  IncrementAtomic()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function IncrementAtomic(var value: SInt32): SInt32; external name '_IncrementAtomic';

{
 *  DecrementAtomic()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DecrementAtomic(var value: SInt32): SInt32; external name '_DecrementAtomic';

{
 *  AddAtomic()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function AddAtomic(amount: SInt32; var value: SInt32): SInt32; external name '_AddAtomic';

{
 *  BitAndAtomic()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function BitAndAtomic(mask: UInt32; var value: UInt32): UInt32; external name '_BitAndAtomic';

{
 *  BitOrAtomic()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function BitOrAtomic(mask: UInt32; var value: UInt32): UInt32; external name '_BitOrAtomic';

{
 *  BitXorAtomic()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function BitXorAtomic(mask: UInt32; var value: UInt32): UInt32; external name '_BitXorAtomic';


{$ALIGN MAC68K}
{#POP}
{unit Endian}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}

{
    This file provides Endian Flipping routines for dealing with converting data
    between Big-Endian and Little-Endian machines.  These routines are useful
    when writing code to compile for both Big and Little Endian machines and
    which must handle other endian number formats, such as reading or writing
    to a file or network packet.

    These routines are named as follows:

        Endian<U><W>_<S>to<D>

    where
        <U> is whether the SInt16 is signed ('S') or unsigned ('U')
        <W> is SInt16 bit width: 16, 32, or 64
        <S> is the source endian format: 'B' for big, 'L' for little, or 'N' for native
        <D> is the destination endian format: 'B' for big, 'L' for little, or 'N' for native

    For example, to convert a Big Endian 32-bit unsigned SInt16 to the current native format use:

        long i = EndianU32_BtoN(data);

    This file is set up so that the function macro to nothing when the target runtime already
    is the desired format (e.g. on Big Endian machines, EndianU32_BtoN() macros away).

    If long long's are not supported, you cannot get 64-bit quantities as a single value.
    The macros are not defined in that case.



                                <<< W A R N I N G >>>

    It is very important not to put any autoincrements inside the macros.  This
    will produce erroneous results because each time the address is accessed in the macro,
    the increment occurs.

 }
{
   Note: These functions are currently not implemented in any library
         and are only listed here as function prototypes to document the macros
}


{
   These types are used for structures that contain data that is
   always in BigEndian format.  This extra typing prevents little
   endian code from directly changing the data, thus saving much
   time in the debugger.
}


type
    BigEndianLong                       = SInt32;
    BigEndianUnsignedLong               = UInt32;
    BigEndianShort                      = SInt16;
    BigEndianUnsignedShort              = UInt16;
    BigEndianFixed                      = Fixed;
    BigEndianUnsignedFixed              = UnsignedFixed;
    BigEndianOSType                     = OSType;





    {
        Implement low level Å_Swap functions.

            extern UInt16 Endian16_Swap(UInt16 value);
            extern UInt32 Endian32_Swap(UInt32 value);
            extern UInt64 Endian64_Swap(UInt64 value);

        Note: Depending on the processor, you might want to implement
              these as function calls instead of macros.

        }



{$ALIGN MAC68K}
{#POP}
{unit FileTypesAndCreators}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}

{

Motivation for FileTypesAndCreators.h

    The TranslationMgr (Macintosh Easy Open) uses ÒFileTypesÓ to express and manage
    translation capabilities.  This works well for most Macintosh applications.  It
    simply uses the file type stored in the catalog info by HFS.  But, the TranslationMgr
    needs to work with non-Macintosh files.  These do not have file types (or creators).
    Another problem is some Macintosh applications keep the same file type for a file
    after changing the file format from one version to the next.  Thus, the HFS file type
    cannot be used to distinguish between formats.

    This file is an effort to define FileTypes and creator codes for non-Macintosh file
    formats and define FileTypes that distinguish between formats.


There are two main categories of constants defined in FileTypesAndCreators.h.  One is
creator signatures of applications the other is file types.  To make this easier to use,
some style guidelines are provided.

Creators:

    The symbolic constant for all creator codes begin with ÒsigÓ. Following ÒsigÓ is the
    application name.  Example:

        sigSurfWriter = 'SURF'

    If the application name is localized for different markets, the name of the U.S.
    version is always used. It is optional to make symbolic constants for localized names.
    If a U.S. is not available, another Roman name is used (this is for ease of editing
    in MPW.)  Example:

        sigSurfWriter = 'SURF',
        sigSkiWriter =  'SURF'  // optional definition of Canadian name of app

    If multiple versions of an application exist, and the creator codes are different,
    then the version number is added to the end of the symbolic name, for the first version
    in which the signature changed.  Example:

        sigDirtWriter =     'DIRT', // version 1 and 2 used same signature
        sigDirtWriter3 =    'DRT3'

    If a developer has the same application on another platform as is on the Mac, then the
    creator for a file from the other platform should be the same as the creator of the
    Macintosh application.   Example:

        sigMicrosoftWord =  'MSWD'  // used for Mac and Windows documents

    If there is no similar Macintosh product, then the signature of the platform is used.
    Example:

        sigPCDOS =          'mdos', // for DOS and Windows
        sigAppleProDos =    'pdos'


FileTypes:

    The symbolic constant for all file types begin with ÒftÓ. Following ÒftÓ is the ideal
    kind for that document.  Example:

        ftSurfWriterDocument =  'SRFD'

    If the application name is localized for different markets, the kind string of the U.S.
    version is always used. It is optional to make symbolic constants for localized kind
    strings.  If a U.S. is not available, another Roman kind string is used (this is for
    ease of editing in MPW.)  Example:

        ftSurfWriterDocument =  'SRFD,
        ftSkiWriterDocument =   'SRFD'  // optional Canadian name

    If multiple versions of an application exist, and the document for files created by each
    are different (meaning one version of the app can not read the documents of a newer
    version), then the version number is added to the end of the symbolic name, for the
    first version in which the format changed.  Example:

       // version 1 and 2 docs have same format, version 3 has a different format
        ftDirtWriterDocument =          'DDRT',
        ftDirtWriter3Document =         '3DRT'

    If multiple versions of an application exist, and the document for files created by each
    are different, but the catInfo file type has always been the same, then constants are
    made for each unique format and one is made for the catInfo type actually used.

        ftWordDocument =        'WDBN',
        ftWord3Document =       'WDB3',
        ftWord4Document =       'WDB4',
        ftWord5Document =       'WDB5'

    If a developer has the same application on another platform as is on the Mac and the file
    formats are the same (binary interchangeable), then the file type for a file from the other
    platform should be the same as the file type of the Macintosh document.   Example:

        ftPageMakerPublication = 'ALB4' // used for Mac and PC documents

    If there is no similar Macintosh document format, then a file type is made up.  If the
    program is used on two different non-Mac platforms and their file formats are not the
    same, the platform name is added to the name.  Typically after the program name and before
    document.  Example:

        ftXyWriteIIIDocument =  'XyWr'  // XyWriteIII only has a PC format
        ftSurfWindowsDocument = 'SRFW'  // Surf Windows file format
        ftSurfPCDocument =      'SRFP'  // Surf PC file format
}

{************* Macintosh applications and FileTypes *************}


const
                                                                {  Mac word processors  }
    sigWord                     = $4D535744 (* 'MSWD' *);
    ftWord3Document             = $4D535733 (* 'MSW3' *);
    ftWord4Document             = $4D535734 (* 'MSW4' *);
    ftWord5Document             = $4D535735 (* 'MSW5' *);
    ftWordDocument              = $5744424E (* 'WDBN' *);
    ftWordDocumentPC            = $4D575043 (* 'MWPC' *);                       {  not registered  }
    ftWord1DocumentWindows      = $57573120 (* 'WW1 ' *);                       {  not registered  }
    ftWord2DocumentWindows      = $57573220 (* 'WW2 ' *);                       {  not registered  }
    ftRTFDocument               = $52544620 (* 'RTF ' *);                       {  not registered  }
    sigWordPerfect              = $53534957 (* 'SSIW' *);
    ftWordPerfectDocument       = $57504430 (* 'WPD0' *);
    sigWordPerfect2             = $57504332 (* 'WPC2' *);
    ftWordPerfect2Document      = $57504431 (* 'WPD1' *);
    ftWordPerfect21Document     = $57504432 (* 'WPD2' *);
    ftWordPerfect42DocumentPC   = $2E575034 (* '.WP4' *);                       {  not registered  }
    ftWordPerfect50DocumentPC   = $2E575035 (* '.WP5' *);                       {  not registered  }
    ftWordPerfect51DocumentPC   = $57503531 (* 'WP51' *);                       {  not registered  }
    ftWordPerfectGraphicsPC     = $57504766 (* 'WPGf' *);                       {  not registered  }
    sigMacWriteII               = $4D574949 (* 'MWII' *);
    ftMacWriteIIDocument        = $4D573244 (* 'MW2D' *);
    sigWriteNow                 = $6E585E6E (* 'nX^n' *);
    ftWriteNow2Document         = $6E585E64 (* 'nX^d' *);
    ftWriteNow3Document         = $6E585E32 (* 'nX^2' *);
    sigMacWrite                 = $4D414341 (* 'MACA' *);
    ftMacWrite5Document         = $574F5244 (* 'WORD' *);
    sigFrameMaker               = $4672616D (* 'Fram' *);
    ftFrameMakerDocument        = $4641534C (* 'FASL' *);
    ftFrameMakerMIFDocument     = $4D494620 (* 'MIF ' *);
    ftFrameMakerMIF2Document    = $4D494632 (* 'MIF2' *);
    ftFrameMakerMIF3Document    = $4D494633 (* 'MIF3' *);
    sigMSWrite                  = $4D535754 (* 'MSWT' *);
    sigActa                     = $41435441 (* 'ACTA' *);
    sigTHINKPascal              = $504A4D4D (* 'PJMM' *);
    sigTHINKC                   = $4B41484C (* 'KAHL' *);
    sigFullWrite                = $46575254 (* 'FWRT' *);
    sigTeachText                = $74747874 (* 'ttxt' *);
    ftTeachTextDocument         = $7474726F (* 'ttro' *);
    sigSimpleText               = $74747874 (* 'ttxt' *);
    ftSimpleTextDocument        = $7474726F (* 'ttro' *);
    sigMPWShell                 = $4D505320 (* 'MPS ' *);
    sigQuarkXPress              = $58505233 (* 'XPR3' *);
    sigNisus                    = $4E495349 (* 'NISI' *);
    sigOmniPage                 = $50525443 (* 'PRTC' *);
    sigPersonalPress            = $53435047 (* 'SCPG' *);
    sigPublishItEZ              = $32435459 (* '2CTY' *);
    sigReadySetGo               = $4D454D52 (* 'MEMR' *);
    sigRagTime                  = $52232B41 (* 'R#+A' *);
    sigLetraStudio              = $4C535450 (* 'LSTP' *);
    sigLetterPerfect            = $57504349 (* 'WPCI' *);
    sigTheWritingCenter         = $0A1A5750;                    {  this 'unprintable unprintable WP' One of the unprintables is a line feed.   }
    sigInstantUpdate            = $49554130 (* 'IUA0' *);

                                                                {  databases  }
    sig4thDimension             = $34443033 (* '4D03' *);
    ft4thDimensionDB            = $42415333 (* 'BAS3' *);
    sigFileMakerPro             = $464D5052 (* 'FMPR' *);
    ftFileMakerProDatabase      = $464D5052 (* 'FMPR' *);
    sigHyperCard                = $57494C44 (* 'WILD' *);
    ftHyperCard                 = $5354414B (* 'STAK' *);
    sigSmartFormAsst            = $4B43464D (* 'KCFM' *);
    ftSmartFormAsst             = $5354434B (* 'STCK' *);
    sigSmartFormDesign          = $4B434644 (* 'KCFD' *);
    ftSmartFormDesign           = $4346524D (* 'CFRM' *);
    sigFileForce                = $34443933 (* '4D93' *);
    ftFileForceDatabase         = $46494C33 (* 'FIL3' *);
    sigFileMaker2               = $464D4B34 (* 'FMK4' *);
    ftFileMaker2Database        = $464D4B24 (* 'FMK$' *);
    sigSuperCard                = $52554E54 (* 'RUNT' *);
    sigDoubleHelix              = $48454C58 (* 'HELX' *);
    sigGeoQuery                 = $52476771 (* 'RGgq' *);
    sigFoxBASE                  = $464F582B (* 'FOX+' *);
    sigINSPIRATION              = $43455233 (* 'CER3' *);
    sigPanorama                 = $4B415331 (* 'KAS1' *);
    sigSilverrunLDM             = $43444D4C (* 'CDML' *);
    sigSilverrunDFD             = $43444446 (* 'CDDF' *);                       {  finance  }
    sigQuicken                  = $494E5455 (* 'INTU' *);
    sigMacInTax91               = $4D495431 (* 'MIT1' *);
    ftMacInTax91                = $4D495446 (* 'MITF' *);
    sigAccountantInc            = $4150524F (* 'APRO' *);
    sigAtOnce                   = $4B495353 (* 'KISS' *);
    sigCAT3                     = $74436174 (* 'tCat' *);
    sigDollarsNSense            = $45414750 (* 'EAGP' *);
    sigInsightExpert            = $4C53474C (* 'LSGL' *);
    sigMYOB                     = $4D594F42 (* 'MYOB' *);
    sigMacMoney                 = $53534C41 (* 'SSLA' *);
    sigManagingYourMoney        = $4D594D43 (* 'MYMC' *);
    sigPlainsAndSimple          = $50454747 (* 'PEGG' *);                       {  scheduling  }
    sigMacProject2              = $4D505258 (* 'MPRX' *);
    ftMacProject                = $4D505244 (* 'MPRD' *);
    sigMSProject                = $4D53504A (* 'MSPJ' *);
    sigMacProjectPro            = $4D505250 (* 'MPRP' *);                       {  utilities  }
    sigStuffIt                  = $53495421 (* 'SIT!' *);
    ftStuffItArchive            = $53495421 (* 'SIT!' *);
    sigCompactPro               = $43504354 (* 'CPCT' *);
    ftCompactProArchive         = $50414354 (* 'PACT' *);
    sigFontographer             = $61436132 (* 'aCa2' *);
    sigMetamorphosis            = $4D457450 (* 'MEtP' *);
    sigCorrectGrammar           = $4C734347 (* 'LsCG' *);
    sigDynodex                  = $44594E4F (* 'DYNO' *);
    sigMariah                   = $4D617248 (* 'MarH' *);
    sigAddressBook              = $4164426B (* 'AdBk' *);
    sigThePrintShop             = $50534850 (* 'PSHP' *);
    sigQuicKeys2                = $516B7932 (* 'Qky2' *);
    sigReadStar2Plus            = $494E4F56 (* 'INOV' *);
    sigSoftPC                   = $50435854 (* 'PCXT' *);
    sigMacMenlo                 = $4D4E4C4F (* 'MNLO' *);
    sigDisinfectant             = $44324354 (* 'D2CT' *);                       {  communications  }
    sigSmartcom2                = $53434F4D (* 'SCOM' *);
    sigVersaTermPRO             = $5650524F (* 'VPRO' *);
    sigVersaTerm                = $5641544D (* 'VATM' *);
    sigWhiteKnight              = $574B3131 (* 'WK11' *);
    sigNCSATelnet               = $4E435341 (* 'NCSA' *);
    sigDynaComm                 = $50415232 (* 'PAR2' *);
    sigQMForms                  = $4D4C544D (* 'MLTM' *);                       {  math and statistics  }
    sigMathematica              = $4F4D4547 (* 'OMEG' *);
    sigMathCAD                  = $4D434144 (* 'MCAD' *);
    sigStatView2                = $53544154 (* 'STAT' *);
    sigDataDesk                 = $4444534B (* 'DDSK' *);
    sigPowerMath2               = $4D415448 (* 'MATH' *);
    sigSuperANOVA               = $53757041 (* 'SupA' *);
    sigSystat                   = $53595431 (* 'SYT1' *);
    sigTheorist                 = $5468656F (* 'Theo' *);

                                                                {  spreadsheets  }
    sigExcel                    = $5843454C (* 'XCEL' *);
    ftExcel2Spreadsheet         = $584C5320 (* 'XLS ' *);
    ftExcel2Macro               = $584C4D20 (* 'XLM ' *);
    ftExcel2Chart               = $584C4320 (* 'XLC ' *);
    ftExcel3Spreadsheet         = $584C5333 (* 'XLS3' *);
    ftExcel3Macro               = $584C4D33 (* 'XLM3' *);
    ftExcel3Chart               = $584C4333 (* 'XLC3' *);
    ftExcel4Spreadsheet         = $584C5334 (* 'XLS4' *);
    ftExcel4Macro               = $584C4D34 (* 'XLM4' *);
    ftSYLKSpreadsheet           = $53594C4B (* 'SYLK' *);
    sigLotus123                 = $4C313233 (* 'L123' *);
    ft123Spreadsheet            = $4C574B53 (* 'LWKS' *);
    sigWingz                    = $574E475A (* 'WNGZ' *);
    ftWingzSpreadsheet          = $575A5353 (* 'WZSS' *);
    ftWingzScript               = $575A5343 (* 'WZSC' *);
    sigResolve                  = $52736C76 (* 'Rslv' *);
    ftResolve                   = $52735773 (* 'RsWs' *);
    ftResolveScript             = $52735763 (* 'RsWc' *);
    sigFullImpact2              = $466C7632 (* 'Flv2' *);

                                                                {  graphics  }
    sigIllustrator              = $41525435 (* 'ART5' *);
    ftPostScriptMac             = $45505346 (* 'EPSF' *);
    sigMacPaint                 = $4D504E54 (* 'MPNT' *);
    ftMacPaintGraphic           = $504E5447 (* 'PNTG' *);
    sigSuperPaint               = $53504E54 (* 'SPNT' *);
    ftSuperPaintGraphic         = $53505447 (* 'SPTG' *);
    sigCanvas                   = $44414432 (* 'DAD2' *);
    ftCanvasGraphic             = $64727732 (* 'drw2' *);
    sigUltraPaint               = $554C5452 (* 'ULTR' *);
    ftUltraPaint                = $55504E54 (* 'UPNT' *);
    sigPhotoshop                = $3842494D (* '8BIM' *);
    ftPhotoshopGraphic          = $3842494D (* '8BIM' *);
    sigMacDrawPro               = $6450726F (* 'dPro' *);
    ftMacDrawProDrawing         = $64446F63 (* 'dDoc' *);
    sigPageMaker                = $414C4434 (* 'ALD4' *);
    ftPageMakerPublication      = $414C4234 (* 'ALB4' *);
    sigFreeHand                 = $46484133 (* 'FHA3' *);
    ftFreeHandDrawing           = $46484433 (* 'FHD3' *);
    sigClarisCAD                = $43434144 (* 'CCAD' *);
    ftClarisCAD                 = $43414432 (* 'CAD2' *);
    sigMacDrawII                = $4D44504C (* 'MDPL' *);
    ftMacDrawIIDrawing          = $44525747 (* 'DRWG' *);
    sigMacroMindDirector        = $4D4D4452 (* 'MMDR' *);
    ftMMDirectorMovie           = $56574D44 (* 'VWMD' *);
    ftMMDirectorSound           = $4D4D5344 (* 'MMSD' *);
    sigOptix                    = $5049584C (* 'PIXL' *);                       {  was previously PixelPerfect  }
    sigPixelPaint               = $50495852 (* 'PIXR' *);
    ftPixelPaint                = $50583031 (* 'PX01' *);
    sigAldusSuper3D             = $53503344 (* 'SP3D' *);
    ftSuper3DDrawing            = $33444258 (* '3DBX' *);
    sigSwivel3D                 = $5357564C (* 'SWVL' *);
    ftSwivel3DDrawing           = $534D444C (* 'SMDL' *);
    sigCricketDraw              = $43524457 (* 'CRDW' *);
    ftCricketDrawing            = $434B4454 (* 'CKDT' *);
    sigCricketGraph             = $43475246 (* 'CGRF' *);
    ftCricketChart              = $43475043 (* 'CGPC' *);
    sigDesignCAD                = $41534243 (* 'ASBC' *);
    ftDesignCADDrawing          = $44434144 (* 'DCAD' *);
    sigImageStudio              = $46535045 (* 'FSPE' *);
    ftImageStudioGraphic        = $52494646 (* 'RIFF' *);
    sigVersaCad                 = $56434144 (* 'VCAD' *);
    ftVersaCADDrawing           = $32442020 (* '2D  ' *);
    sigAdobePremiere            = $50724D72 (* 'PrMr' *);                       {  was previously misspelled as sigAdobePremier }
    ftAdobePremiereMovie        = $4D6F6F56 (* 'MooV' *);                       {  was previously misspelled as ftAdobePremierMovie }
    sigAfterDark                = $4144726B (* 'ADrk' *);
    ftAfterDarkModule           = $4144676D (* 'ADgm' *);
    sigClip3D                   = $455A3345 (* 'EZ3E' *);
    ftClip3Dgraphic             = $455A3344 (* 'EZ3D' *);
    sigKaleidaGraph             = $514B5054 (* 'QKPT' *);
    ftKaleidaGraphGraphic       = $51504354 (* 'QPCT' *);
    sigMacFlow                  = $4D43464C (* 'MCFL' *);
    ftMacFlowChart              = $464C4348 (* 'FLCH' *);
    sigMoviePlayer              = $54564F44 (* 'TVOD' *);
    ftMoviePlayerMovie          = $4D6F6F56 (* 'MooV' *);
    sigMacSpin                  = $44325350 (* 'D2SP' *);
    ftMacSpinDataSet            = $4432424E (* 'D2BN' *);
    sigAutoCAD                  = $41434144 (* 'ACAD' *);
    sigLabVIEW                  = $4C425657 (* 'LBVW' *);
    sigColorMacCheese           = $434D43C6 (* 'CMCÆ' *);
    sigMiniCad                  = $43445033 (* 'CDP3' *);
    sigDreams                   = $50484E58 (* 'PHNX' *);
    sigOmnis5                   = $51322424 (* 'Q2$$' *);
    sigPhotoMac                 = $504D4143 (* 'PMAC' *);
    sigGraphMaster              = $4752414D (* 'GRAM' *);
    sigInfiniD                  = $5349B044 (* 'SI°D' *);
    sigOfoto                    = $41504C53 (* 'APLS' *);
    sigMacDraw                  = $4D445257 (* 'MDRW' *);
    sigDeltagraphPro            = $44475248 (* 'DGRH' *);
    sigDesign2                  = $44455347 (* 'DESG' *);
    sigDesignStudio             = $4D524A4E (* 'MRJN' *);
    sigDynaperspective          = $50455253 (* 'PERS' *);
    sigGenericCADD              = $43414433 (* 'CAD3' *);
    sigMacDraft                 = $4D443230 (* 'MD20' *);
    sigModelShop                = $4D445350 (* 'MDSP' *);
    sigOasis                    = $54414F41 (* 'TAOA' *);
    sigOBJECTMASTER             = $42524F57 (* 'BROW' *);
    sigMovieRecorder            = $6D726372 (* 'mrcr' *);
    sigPictureCompressor        = $70707869 (* 'ppxi' *);
    sigPICTViewer               = $4D445453 (* 'MDTS' *);
    sigSmoothie                 = $536D6F6F (* 'Smoo' *);
    sigScreenPlay               = $53504C59 (* 'SPLY' *);
    sigStudio1                  = $53542F31 (* 'ST/1' *);
    sigStudio32                 = $53543332 (* 'ST32' *);
    sigStudio8                  = $53542F38 (* 'ST/8' *);
    sigKidPix                   = $4B696432 (* 'Kid2' *);
    sigDigDarkroom              = $44494452 (* 'DIDR' *);

                                                                {  presentations  }
    sigMore                     = $4D4F5232 (* 'MOR2' *);
    ftMore3Document             = $4D4F5233 (* 'MOR3' *);
    ftMore2Document             = $4D4F5232 (* 'MOR2' *);
    sigPersuasion               = $504C5032 (* 'PLP2' *);
    ftPersuasion1Presentation   = $50525331 (* 'PRS1' *);
    ftPersuasion2Presentation   = $50525332 (* 'PRS2' *);
    sigPowerPoint               = $50504E54 (* 'PPNT' *);
    ftPowerPointPresentation    = $534C4453 (* 'SLDS' *);
    sigCricketPresents          = $43525052 (* 'CRPR' *);
    ftCricketPresentation       = $50524446 (* 'PRDF' *);                       {  works  }
    sigMSWorks                  = $50534932 (* 'PSI2' *);
    sigMSWorks3                 = $4D53574B (* 'MSWK' *);
    ftMSWorksWordProcessor      = $41575750 (* 'AWWP' *);
    ftMSWorksSpreadsheet        = $41575353 (* 'AWSS' *);
    ftMSWorksDataBase           = $41574442 (* 'AWDB' *);
    ftMSWorksComm               = $41574443 (* 'AWDC' *);
    ftMSWorksMacros             = $41574D43 (* 'AWMC' *);
    ftMSWorks1WordProcessor     = $41575731 (* 'AWW1' *);                       {  not registered  }
    ftMSWorks1Spreadsheet       = $41575331 (* 'AWS1' *);                       {  not registered  }
    ftMSWorks1DataBase          = $41574431 (* 'AWD1' *);                       {  not registered  }
    ftMSWorks2WordProcessor     = $41575732 (* 'AWW2' *);                       {  not registered  }
    ftMSWorks2Spreadsheet       = $41575332 (* 'AWS2' *);                       {  not registered  }
    ftMSWorks2DataBase          = $41574432 (* 'AWD2' *);                       {  not registered  }
    ftMSWorks3WordProcessor     = $41575733 (* 'AWW3' *);                       {  not registered  }
    ftMSWorks3Spreadsheet       = $41575333 (* 'AWS3' *);                       {  not registered  }
    ftMSWorks3DataBase          = $41574433 (* 'AWD3' *);                       {  not registered  }
    ftMSWorks3Comm              = $41574333 (* 'AWC3' *);                       {  not registered  }
    ftMSWorks3Macro             = $41574D33 (* 'AWM3' *);                       {  not registered  }
    ftMSWorks3Draw              = $41575233 (* 'AWR3' *);                       {  not registered  }
    ftMSWorks2WordProcessorPC   = $50575732 (* 'PWW2' *);                       {  not registered  }
    ftMSWorks2DatabasePC        = $50574442 (* 'PWDB' *);                       {  not registered  }
    sigGreatWorks               = $5A454252 (* 'ZEBR' *);
    ftGreatWorksWordProcessor   = $5A575254 (* 'ZWRT' *);
    ftGreatWorksSpreadsheet     = $5A43414C (* 'ZCAL' *);
    ftGreatWorksPaint           = $5A504E54 (* 'ZPNT' *);
    sigClarisWorks              = $424F424F (* 'BOBO' *);
    ftClarisWorksWordProcessor  = $43575750 (* 'CWWP' *);
    ftClarisWorksSpreadsheet    = $43575353 (* 'CWSS' *);
    ftClarisWorksGraphics       = $43574752 (* 'CWGR' *);
    sigBeagleWorks              = $42576B73 (* 'BWks' *);
    ftBeagleWorksWordProcessor  = $42577770 (* 'BWwp' *);
    ftBeagleWorksDatabase       = $42576462 (* 'BWdb' *);
    ftBeagleWorksSpreadsheet    = $42577373 (* 'BWss' *);
    ftBeagleWorksComm           = $4257636D (* 'BWcm' *);
    ftBeagleWorksDrawing        = $42576472 (* 'BWdr' *);
    ftBeagleWorksGraphic        = $42577074 (* 'BWpt' *);
    ftPICTFile                  = $50494354 (* 'PICT' *);

                                                                {  entertainment  }
    sigPGATourGolf              = $674F4C46 (* 'gOLF' *);
    sigSimCity                  = $4D435250 (* 'MCRP' *);
    sigHellCats                 = $48454C4C (* 'HELL' *);                       {  education  }
    sigReaderRabbit3            = $52445233 (* 'RDR3' *);                       {  Translation applications  }
    sigDataVizDesktop           = $44564454 (* 'DVDT' *);
    sigSotwareBridge            = $6D646F73 (* 'mdos' *);
    sigWordForWord              = $4D535452 (* 'MSTR' *);
    sigAppleFileExchange        = $50535054 (* 'PSPT' *);                       {  Apple software  }
    sigAppleLink                = $47454F4C (* 'GEOL' *);
    ftAppleLinkAddressBook      = $41445253 (* 'ADRS' *);
    ftAppleLinkImageFile        = $53494D41 (* 'SIMA' *);
    ftAppleLinkPackage          = $48425346 (* 'HBSF' *);
    ftAppleLinkConnFile         = $50455445 (* 'PETE' *);
    ftAppleLinkHelp             = $484C5046 (* 'HLPF' *);
    sigInstaller                = $626A6263 (* 'bjbc' *);
    ftInstallerScript           = $626A6263 (* 'bjbc' *);
    sigDiskCopy                 = $64437079 (* 'dCpy' *);
    ftDiskCopyImage             = $64496D67 (* 'dImg' *);
    sigResEdit                  = $52534544 (* 'RSED' *);
    ftResEditResourceFile       = $72737263 (* 'rsrc' *);
    sigAardvark                 = $41415244 (* 'AARD' *);
    sigCompatibilityChkr        = $776B7270 (* 'wkrp' *);
    sigMacTerminal              = $5465726D (* 'Term' *);
    sigSADE                     = $73616465 (* 'sade' *);
    sigCurare                   = $43757261 (* 'Cura' *);
    sigPCXChange                = $646F7361 (* 'dosa' *);
    sigAtEase                   = $6D666472 (* 'mfdr' *);
    sigStockItToMe              = $5349544D (* 'SITM' *);
    sigAppleSearch              = $61736973 (* 'asis' *);
    sigAppleSearchToo           = $686F6273 (* 'hobs' *);                       {  the following are files types for system files  }
    ftScriptSystemResourceCollection = $6966696C (* 'ifil' *);
    ftSoundFile                 = $7366696C (* 'sfil' *);
    ftFontFile                  = $6666696C (* 'ffil' *);
    ftTrueTypeFontFile          = $7466696C (* 'tfil' *);
    ftKeyboardLayout            = $6B66696C (* 'kfil' *);
    ftFontSuitcase              = $4646494C (* 'FFIL' *);
    ftDASuitcase                = $4446494C (* 'DFIL' *);
    ftSystemExtension           = $494E4954 (* 'INIT' *);
    ftDAMQueryDocument          = $71657279 (* 'qery' *);



    {   ************* Special FileTypes and creators *************  }
    ftApplicationName           = $61706E6D (* 'apnm' *);                       {  this is the type used to define the application name in a kind resource  }
    sigIndustryStandard         = $69737464 (* 'istd' *);                       {  this is the creator used to define a kind string in a kind resource for a FileType that has many creators   }
    ftXTND13TextImport          = $78743133 (* 'xt13' *);                       {  this is a pseduo-format used by "XTND for Apps". The taDstIsAppTranslation bit is set  }


    {   ************* Apple][ applications and FileTypes *************  }
    sigAppleProDOS              = $70646F73 (* 'pdos' *);                       {  not registered  }
    ftAppleWorksWordProcessor   = $31412020 (* '1A  ' *);                       {  not registered  }
    ftAppleWorks1WordProcessor  = $31413120 (* '1A1 ' *);                       {  not registered  }
    ftAppleWorks2WordProcessor  = $31413220 (* '1A2 ' *);                       {  not registered  }
    ftAppleWorks3WordProcessor  = $31413320 (* '1A3 ' *);                       {  not registered  }
    ftAppleWorksDataBase        = $31392020 (* '19  ' *);                       {  not registered  }
    ftAppleWorks1DataBase       = $31393120 (* '191 ' *);                       {  not registered  }
    ftAppleWorks2DataBase       = $31393220 (* '192 ' *);                       {  not registered  }
    ftAppleWorks3DataBase       = $31393320 (* '193 ' *);                       {  not registered  }
    ftAppleWorksSpreadsheet     = $31422020 (* '1B  ' *);                       {  not registered  }
    ftAppleWorks1Spreadsheet    = $31423120 (* '1B1 ' *);                       {  not registered  }
    ftAppleWorks2Spreadsheet    = $31423220 (* '1B2 ' *);                       {  not registered  }
    ftAppleWorks3Spreadsheet    = $31423320 (* '1B3 ' *);                       {  not registered  }
    ftAppleWorksWordProcessorGS = $35302020 (* '50  ' *);                       {  not registered  }
    ftApple2GS_SuperHiRes       = $41325355 (* 'A2SU' *);                       {  not registered  }
    ftApple2GS_SuperHiResPacked = $41325350 (* 'A2SP' *);                       {  not registered  }
    ftApple2GS_PaintWorks       = $41325057 (* 'A2PW' *);                       {  not registered  }
    ftApple2_DoubleHiRes        = $41324455 (* 'A2DU' *);                       {  not registered  }
    ftApple2_DoubleHiResPacked  = $41324450 (* 'A2DP' *);                       {  not registered  }
    ftApple2_DoubleHiRes16colors = $41324443 (* 'A2DC' *);                      {  not registered  }
    ftApple2_SingleHiRes        = $41324855 (* 'A2HU' *);                       {  not registered  }
    ftApple2_SingleHiResPacked  = $41324850 (* 'A2HP' *);                       {  not registered  }
    ftApple2_SingleHiRes8colors = $41324843 (* 'A2HC' *);                       {  not registered  }


    {   ************* PC-DOS applications and FileTypes *************   }
    sigPCDOS                    = $6D646F73 (* 'mdos' *);                       {  not registered  }
    ftGenericDocumentPC         = $54455854 (* 'TEXT' *);                       {     word processor formats  }
    ftWordStarDocumentPC        = $57537472 (* 'WStr' *);                       {  not registered  }
    ftWordStar4DocumentPC       = $57537434 (* 'WSt4' *);                       {  not registered  }
    ftWordStar5DocumentPC       = $57537435 (* 'WSt5' *);                       {  not registered  }
    ftWordStar55DocumentPC      = $57533535 (* 'WS55' *);                       {  not registered  }
    ftWordStar6DocumentPC       = $57537436 (* 'WSt6' *);                       {  not registered  }
    ftWordStar2000DocumentPC    = $57533230 (* 'WS20' *);                       {  not registered  }
    ftXyWriteIIIDocumentPC      = $58795772 (* 'XyWr' *);                       {  registered???  }
    ftDecDXDocumentPC           = $44582020 (* 'DX  ' *);                       {  registered???  }
    ftDecWPSPlusDocumentPC      = $5750532B (* 'WPS+' *);                       {  registered???  }
    ftDisplayWrite3DocumentPC   = $44573320 (* 'DW3 ' *);                       {  registered???  }
    ftDisplayWrite4DocumentPC   = $44573420 (* 'DW4 ' *);                       {  registered???  }
    ftDisplayWrite5DocumentPC   = $44573520 (* 'DW5 ' *);                       {  registered???  }
    ftIBMWritingAsstDocumentPC  = $41535354 (* 'ASST' *);                       {  registered???  }
    ftManuscript1DocumentPC     = $4D414E31 (* 'MAN1' *);                       {  registered???  }
    ftManuscript2DocumentPC     = $4D414E32 (* 'MAN2' *);                       {  registered???  }
    ftMass11PCDocumentPC        = $4D313150 (* 'M11P' *);                       {  registered???  }
    ftMass11VaxDocumentPC       = $4D313156 (* 'M11V' *);                       {  registered???  }
    ftMultiMateDocumentPC       = $4D4D4154 (* 'MMAT' *);                       {  registered???  }
    ftMultiMate36DocumentPC     = $4D4D3336 (* 'MM36' *);                       {  registered???  }
    ftMultiMate40DocumentPC     = $4D4D3430 (* 'MM40' *);                       {  registered???  }
    ftMultiMateAdvDocumentPC    = $4D4D4144 (* 'MMAD' *);                       {  registered???  }
    ftMultiMateNoteDocumentPC   = $4D4D4E54 (* 'MMNT' *);                       {  registered???  }
    ftOfficeWriterDocumentPC    = $4F464657 (* 'OFFW' *);                       {  registered???  }
    ftPCFileLetterDocumentPC    = $5043464C (* 'PCFL' *);                       {  registered???  }
    ftPFSWriteADocumentPC       = $50465341 (* 'PFSA' *);                       {  registered???  }
    ftPFSWriteBDocumentPC       = $50465342 (* 'PFSB' *);                       {  registered???  }
    ftPFSPlanDocumentPC         = $50465350 (* 'PFSP' *);                       {  registered???  }
    ftProWrite1DocumentPC       = $50573120 (* 'PW1 ' *);                       {  registered???  }
    ftProWrite2DocumentPC       = $50573220 (* 'PW2 ' *);                       {  registered???  }
    ftProWritePlusDocumentPC    = $50572B20 (* 'PW+ ' *);                       {  registered???  }
    ftFirstChoiceDocumentPC     = $46434820 (* 'FCH ' *);                       {  registered???  }
    ftFirstChoice3DocumentPC    = $46434833 (* 'FCH3' *);                       {  registered???  }
    ftDCARFTDocumentPC          = $52465420 (* 'RFT ' *);                       {  registered???  }
    ftSamnaDocumentPC           = $53414D4E (* 'SAMN' *);                       {  registered???  }
    ftSmartDocumentPC           = $534D5254 (* 'SMRT' *);                       {  registered???  }
    ftSprintDocumentPC          = $53505254 (* 'SPRT' *);                       {  registered???  }
    ftTotalWordDocumentPC       = $544F544C (* 'TOTL' *);                       {  registered???  }
    ftVolksWriterDocumentPC     = $564F4C4B (* 'VOLK' *);                       {  registered???  }
    ftWangWPSDocumentPC         = $57505320 (* 'WPS ' *);                       {  registered???  }
    ftWordMarcDocumentPC        = $4D415243 (* 'MARC' *);                       {  registered???  }
    ftAmiDocumentPC             = $414D4920 (* 'AMI ' *);                       {  registered???  }
    ftAmiProDocumentPC          = $4150524F (* 'APRO' *);                       {  registered???  }
    ftAmiPro2DocumentPC         = $41505232 (* 'APR2' *);                       {  registered???  }
    ftEnableDocumentPC          = $454E5750 (* 'ENWP' *);                       {  registered???  }
                                                                {     data base formats  }
    ftdBaseDatabasePC           = $44424620 (* 'DBF ' *);                       {  registered???  }
    ftdBase3DatabasePC          = $44423320 (* 'DB3 ' *);                       {  registered???  }
    ftdBase4DatabasePC          = $44423420 (* 'DB4 ' *);                       {  registered???  }
    ftDataEaseDatabasePC        = $4454455A (* 'DTEZ' *);                       {  registered???  }
    ftFrameWorkIIIDatabasePC    = $46574B33 (* 'FWK3' *);                       {  registered???  }
    ftRBaseVDatabasePC          = $52427356 (* 'RBsV' *);                       {  registered???  }
    ftRBase5000DatabasePC       = $52423530 (* 'RB50' *);                       {  registered???  }
    ftRBaseFile1DatabasePC      = $52427331 (* 'RBs1' *);                       {  registered???  }
    ftRBaseFile3DatabasePC      = $52427333 (* 'RBs3' *);                       {  registered???  }
    ftReflexDatabasePC          = $52464C58 (* 'RFLX' *);                       {  registered???  }
    ftQAWriteDatabasePC         = $51415754 (* 'QAWT' *);                       {  registered???  }
    ftQADBaseDatabasePC         = $51414442 (* 'QADB' *);                       {  registered???  }
    ftSmartDataBasePC           = $534D5444 (* 'SMTD' *);                       {  registered???  }
    ftFirstChoiceDataBasePC     = $46434442 (* 'FCDB' *);                       {  registered???  }

                                                                {     spread sheet formats  }
    ftDIFSpreadsheetPC          = $44494620 (* 'DIF ' *);                       {  registered???  }
    ftEnableSpreadsheetPC       = $454E4142 (* 'ENAB' *);                       {  registered???  }
    ft123R1SpreadsheetPC        = $574B5331 (* 'WKS1' *);                       {  registered???  }
    ft123R2SpreadsheetPC        = $574B5332 (* 'WKS2' *);                       {  registered???  }
    ft123R3SpreadsheetPC        = $574B5333 (* 'WKS3' *);                       {  registered???  }
    ftParadox3SpreadsheetPC     = $50445833 (* 'PDX3' *);                       {  registered???  }
    ftParadox35SpreadsheetPC    = $50443335 (* 'PD35' *);                       {  registered???  }
    ftQuattroSpreadsheetPC      = $5154524F (* 'QTRO' *);                       {  registered???  }
    ftQuattroProSpreadsheetPC   = $51545235 (* 'QTR5' *);                       {  registered???  }
    ftSuperCalc5SpreadsheetPC   = $53504335 (* 'SPC5' *);                       {  registered???  }
    ftSymphony1SpreadsheetPC    = $53594D31 (* 'SYM1' *);                       {  registered???  }
    ftTwinSpreadsheetPC         = $5457494E (* 'TWIN' *);                       {  registered???  }
    ftVPPlannerSpreadsheetPC    = $5650504C (* 'VPPL' *);                       {  registered???  }
    ftSmartSpeadsheetPC         = $534D5348 (* 'SMSH' *);                       {  registered???  }
    ftFirstChoiceSpeadsheetPC   = $46435353 (* 'FCSS' *);                       {  registered???  }
                                                                {     graphics formats  }
    ftPCPaintBrushGraphicPC     = $50435820 (* 'PCX ' *);                       {  not registered  }
    ftLotusPICGraphicPC         = $2E504943 (* '.PIC' *);                       {  not registered  }
    ftCGMGraphicPC              = $2E43474D (* '.CGM' *);                       {  not registered  }
    ftGEMGraphicPC              = $2E47454D (* '.GEM' *);                       {  not registered  }
    ftIMGGraphicPC              = $2E494D47 (* '.IMG' *);                       {  not registered  }
    ftDXFGraphicPC              = $2E445846 (* '.DXF' *);                       {  not registered  }
    ftBitmapWindows             = $2E424D50 (* '.BMP' *);                       {  not registered  }
    ftMetaFileWindows           = $2E574D46 (* '.WMF' *);                       {  not registered  }
    ftTIFFGraphic               = $54494646 (* 'TIFF' *);                       {  not registered  }
    ftPostScriptPC              = $45505350 (* 'EPSP' *);
    ftPostScriptWindows         = $45505357 (* 'EPSW' *);                       {  not registered  }
    ftDigitalFX_TitleMan        = $5444494D (* 'TDIM' *);                       {  registered???  }
    ftDigitalFX_VideoFX         = $47524146 (* 'GRAF' *);                       {  registered???  }
    ftAutodeskFLIandFLC         = $464C4943 (* 'FLIC' *);                       {  registered???  }
    ftGIF                       = $47494666 (* 'GIFf' *);                       {  registered???  }
    ftIFF                       = $494C424D (* 'ILBM' *);                       {  registered???  }
    ftMicrosoftPaint            = $2E4D5350 (* '.MSP' *);                       {  registered???  }
    ftPixar                     = $50584152 (* 'PXAR' *);                       {  registered???  }
    ftQDV                       = $2E514456 (* '.QDV' *);                       {  registered???  }
    ftRLE_Compuserve            = $524C4543 (* 'RLEC' *);                       {  registered???  }
                                                                {     Generic vector formats  }
    ftIGESGraphicPC             = $49474553 (* 'IGES' *);                       {  not registered  }
    ftDDES2GraphicPC            = $44444553 (* 'DDES' *);                       {  not registered  }
    ft3DGFGraphicPC             = $33444746 (* '3DGF' *);                       {  not registered  }
                                                                {     Plotter formats  }
    ftHPGLGraphicPC             = $4850474C (* 'HPGL' *);                       {  not registered  }
    ftDMPLGraphicPC             = $444D504C (* 'DMPL' *);                       {  not registered  }
    ftCalComp906GraphicPC       = $43393036 (* 'C906' *);                       {  not registered  }
    ftCalComp907GraphicPC       = $43393037 (* 'C907' *);                       {  not registered  }
                                                                {     Vendor-specific formats  }
    ftStereoLithographyGraphicPC = $53544C20 (* 'STL ' *);                      {     3D Systems     - not registered  }
    ftZoomGraphicPC             = $5A4F4F4D (* 'ZOOM' *);                       {     Abvent          - not registered  }
    ftFocusGraphicPC            = $464F4353 (* 'FOCS' *);                       {     Abvent          - not registered  }
    ftWaveFrontGraphicPC        = $574F424A (* 'WOBJ' *);                       {     WaveFront      - not registered  }
    ftSculpt4DGraphicPC         = $53636E32 (* 'Scn2' *);                       {     Byte By Byte   - not registered  }
    ftMiniPascal3GraphicPC      = $4D505433 (* 'MPT3' *);                       {     Graphsoft      - not registered  }
    ftMiniPascal4GraphicPC      = $4D505434 (* 'MPT4' *);                       {     Graphsoft      - not registered  }
    ftWalkThroughGraphicPC      = $56574C4B (* 'VWLK' *);                       {     Virtus          - not registered  }
    ftSiliconGraphics           = $2E534749 (* '.SGI' *);                       {  registered???  }
    ftSunRaster                 = $2E53554E (* '.SUN' *);                       {  registered???  }
    ftTarga                     = $54504943 (* 'TPIC' *);                       {  registered???  }
                                                                {  misc DOS   }
    ftDOSComPC                  = $2E434F4D (* '.COM' *);                       {  registered???  }
    ftDOSExecutablePC           = $2E455845 (* '.EXE' *);                       {  registered???  }
    ftDOSArcPC                  = $2E415243 (* '.ARC' *);                       {  registered???  }
    ftAbekas                    = $4142454B (* 'ABEK' *);                       {  registered???  }
    ftDrHaloCUT                 = $2E435554 (* '.CUT' *);                       {  registered???  }
                                                                {  misc Atari  }
    ftDegas                     = $44454741 (* 'DEGA' *);                       {  not registered  }
    ftNEO                       = $2E4E454F (* '.NEO' *);                       {  not registered  }




{$ALIGN MAC68K}
{#POP}
{unit Finder}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}

{ Creator and type of clipping files }

const
    kClippingCreator            = $64726167 (* 'drag' *);
    kClippingPictureType        = $636C7070 (* 'clpp' *);
    kClippingTextType           = $636C7074 (* 'clpt' *);
    kClippingSoundType          = $636C7073 (* 'clps' *);
    kClippingUnknownType        = $636C7075 (* 'clpu' *);


    {    Creator and type of Internet Location files    }
    kInternetLocationCreator    = $64726167 (* 'drag' *);
    kInternetLocationHTTP       = $696C6874 (* 'ilht' *);
    kInternetLocationFTP        = $696C6674 (* 'ilft' *);
    kInternetLocationFile       = $696C6669 (* 'ilfi' *);
    kInternetLocationMail       = $696C6D61 (* 'ilma' *);
    kInternetLocationNNTP       = $696C6E77 (* 'ilnw' *);
    kInternetLocationAFP        = $696C6166 (* 'ilaf' *);
    kInternetLocationAppleTalk  = $696C6174 (* 'ilat' *);
    kInternetLocationNSL        = $696C6E73 (* 'ilns' *);
    kInternetLocationGeneric    = $696C6765 (* 'ilge' *);



    kCustomIconResource         = -16455;                       {  Custom icon family resource ID  }

    {    In order to specify any of the information described in the    }
    {    CustomBadgeResource data structure you must clear the kExtendedFlagsAreInvalid     }
    {    and set kExtendedFlagHasCustomBadge of the FXInfo.fdXFlags or DXInfo.frXFlags field,   }
    {    and add a resource of type kCustomBadgeResourceType and ID kCustomBadgeResourceID to   }
    {    the file or to the "Icon/n" file for a folder  }
    kCustomBadgeResourceType    = $62616467 (* 'badg' *);
    kCustomBadgeResourceID      = -16455;
    kCustomBadgeResourceVersion = 0;


type
    CustomBadgeResourcePtr = ^CustomBadgeResource;
    CustomBadgeResource = record
        version:                SInt16;                                 {  This is version kCustomBadgeResourceVersion }
        customBadgeResourceID:  SInt16;                                 {  If not 0, the ID of a resource to use on top }
                                                                        {  of the icon for this file or folder }
        customBadgeType:        OSType;                                 {  If not 0, the type and creator of an icon }
        customBadgeCreator:     OSType;                                 {  to use on top of the icon }
        windowBadgeType:        OSType;                                 {  If not 0, the type and creator of an icon }
        windowBadgeCreator:     OSType;                                 {  to display in the header of the window for this  }
                                                                        {  file or folder }
        overrideType:           OSType;                                 {  If not 0, the type and creator of an icon to }
        overrideCreator:        OSType;                                 {  use INSTEAD of the icon for this file or folder }
    end;

    CustomBadgeResourceHandle           = ^CustomBadgeResourcePtr;
    {    You can specify routing information for a file by including a 'rout' 0
        resource in it and setting the kExtendedFlagHasRoutingInfo bit in the extended
        Finder flags.
        The 'rout' resource is an array of RoutingResourceEntry. Each entry is considered
        in turn. The first matching entry is used.
        If the creator and fileType match the file being dropped and targetFolder match
        the folder ID of the folder being dropped onto, then the file is rerouted
        into the specified destination folder.
        The only target folder currently supported is the system folder,
        kSystemFolderType = 'macs'.
        }

const
    kRoutingResourceType        = $726F7574 (* 'rout' *);
    kRoutingResourceID          = 0;


type
    RoutingResourceEntryPtr = ^RoutingResourceEntry;
    RoutingResourceEntry = record
        creator:                OSType;                                 {  Use '****' or 0 to match any creator  }
        fileType:               OSType;                                 {  Use '****' or 0 to match any file type  }
        targetFolder:           OSType;                                 {  Folder ID of the folder this file was dropped onto  }
        destinationFolder:      OSType;                                 {  Folder that the source will be routed to  }
        reservedField:          OSType;                                 {  Set to 0  }
    end;

    RoutingResourcePtr                  = ^RoutingResourceEntry;
    RoutingResourceHandle               = ^RoutingResourcePtr;

    {    Types for special container aliases    }

const
    kContainerFolderAliasType   = $66647270 (* 'fdrp' *);                       {  type for folder aliases  }
    kContainerTrashAliasType    = $74727368 (* 'trsh' *);                       {  type for trash folder aliases  }
    kContainerHardDiskAliasType = $6864736B (* 'hdsk' *);                       {  type for hard disk aliases  }
    kContainerFloppyAliasType   = $666C7079 (* 'flpy' *);                       {  type for floppy aliases  }
    kContainerServerAliasType   = $73727672 (* 'srvr' *);                       {  type for server aliases  }
    kApplicationAliasType       = $61647270 (* 'adrp' *);                       {  type for application aliases  }
    kContainerAliasType         = $64726F70 (* 'drop' *);                       {  type for all other containers  }
    kDesktopPrinterAliasType    = $64747061 (* 'dtpa' *);                       {  type for Desktop Printer alias  }
    kContainerCDROMAliasType    = $63646472 (* 'cddr' *);                       {  type for CD-ROM alias  }
    kApplicationCPAliasType     = $61636470 (* 'acdp' *);                       {  type for application control panel alias  }
    kApplicationDAAliasType     = $61646470 (* 'addp' *);                       {  type for application DA alias  }
    kPackageAliasType           = $66706B61 (* 'fpka' *);                       {  type for plain package alias  }
    kAppPackageAliasType        = $66617061 (* 'fapa' *);                       {  type for application package alias  }

    {    Types for Special folder aliases   }
    kSystemFolderAliasType      = $66617379 (* 'fasy' *);
    kAppleMenuFolderAliasType   = $6661616D (* 'faam' *);
    kStartupFolderAliasType     = $66617374 (* 'fast' *);
    kPrintMonitorDocsFolderAliasType = $6661706E (* 'fapn' *);
    kPreferencesFolderAliasType = $66617066 (* 'fapf' *);
    kControlPanelFolderAliasType = $66616374 (* 'fact' *);
    kExtensionFolderAliasType   = $66616578 (* 'faex' *);

    {    Types for AppleShare folder aliases    }
    kExportedFolderAliasType    = $66616574 (* 'faet' *);
    kDropFolderAliasType        = $66616472 (* 'fadr' *);
    kSharedFolderAliasType      = $66617368 (* 'fash' *);
    kMountedFolderAliasType     = $66616D6E (* 'famn' *);

    {    Finder flags (finderFlags, fdFlags and frFlags)    }
    {    Any flag reserved or not specified should be set to 0.     }
    {    If a flag applies to a file, but not to a folder, make sure to check   }
    {    that the item is not a folder by checking ((ParamBlockRec.ioFlAttrib & ioDirMask) == 0)    }
    kIsOnDesk                   = $0001;                        {  Files and folders (System 6)  }
    kColor                      = $000E;                        {  Files and folders  }
                                                                {  bit 0x0020 was kRequireSwitchLaunch, but is now reserved for future use }
    kIsShared                   = $0040;                        {  Files only (Applications only)  }
                                                                {  If clear, the application needs to write to  }
                                                                {  its resource fork, and therefore cannot be  }
                                                                {  shared on a server  }
    kHasNoINITs                 = $0080;                        {  Files only (Extensions/Control Panels only)  }
                                                                {  This file contains no INIT resource  }
    kHasBeenInited              = $0100;                        {  Files only  }
                                                                {  Clear if the file contains desktop database  }
                                                                {  resources ('BNDL', 'FREF', 'open', 'kind'...)  }
                                                                {  that have not been added yet. Set only by the Finder  }
                                                                {  Reserved for folders - make sure this bit is cleared for folders  }
                                                                {  bit 0x0200 was the letter bit for AOCE, but is now reserved for future use  }
    kHasCustomIcon              = $0400;                        {  Files and folders  }
    kIsStationery               = $0800;                        {  Files only  }
    kNameLocked                 = $1000;                        {  Files and folders  }
    kHasBundle                  = $2000;                        {  Files only  }
    kIsInvisible                = $4000;                        {  Files and folders  }
    kIsAlias                    = $8000;                        {  Files only  }

    {    Obsolete. Use names defined above.     }
    fOnDesk                     = $0001;
    fHasBundle                  = $2000;
    fInvisible                  = $4000;

    {    Obsolete   }
    fTrash                      = -3;
    fDesktop                    = -2;
    fDisk                       = 0;


    {    Extended flags (extendedFinderFlags, fdXFlags and frXFlags)    }
    {    Any flag not specified should be set to 0.     }
    kExtendedFlagsAreInvalid    = $8000;                        {  If set the other extended flags are ignored  }
    kExtendedFlagHasCustomBadge = $0100;                        {  Set if the file or folder has a badge resource  }
    kExtendedFlagHasRoutingInfo = $0004;                        {  Set if the file contains routing info resource  }



    {    Use a filetype in this range to indicate that a file is temporarily busy   }
    {    (while it is being downloaded or installed, for example).  This prevents   }
    {    Finder 8.5 and later from trying to change the item's attributes before it     }
    {    is fully created. -- If you provide a series of 'BNDL' icons for your creator  }
    {    and some of these filetypes, you can achieve limited icon animation while  }
    {    the file creation progresses.  }
    kFirstMagicBusyFiletype     = $627A7920 (* 'bzy ' *);
    kLastMagicBusyFiletype      = $627A793F (* 'bzy?' *);

    {    Use this date as a file's or folder's creation date to indicate that it is     }
    {    temporarily busy (while it is being downloaded or installed, for example).     }
    {    This prevents Finder from trying to change the item's attributes before it     }
    {    is fully created (Finder 8.5 and 8.6 check file creation dates; later Finders  }
    {    may check folder creation dates as well).  }
    kMagicBusyCreationDate      = $4F3AFDB0;


    {   ------------------------------------------------------------------------    }
    {
       The following data structures are binary compatible with FInfo, DInfo,
       FXInfo and DXInfo but represent the Mac OS 8 semantic of the fields.
       Use these data structures preferably to FInfo, etc...
    }
    {   ------------------------------------------------------------------------    }


type
    FileInfoPtr = ^FileInfo;
    FileInfo = record
        fileType:               OSType;                                 {  The type of the file  }
        fileCreator:            OSType;                                 {  The file's creator  }
        finderFlags:            UInt16;                                 {  ex: kHasBundle, kIsInvisible...  }
        location:               Point;                                  {  File's location in the folder  }
                                                                        {  If set to (0, 0), the Finder will place the item automatically  }
        reservedField:          UInt16;                                 {  (set to 0)  }
    end;

    FolderInfoPtr = ^FolderInfo;
    FolderInfo = record
        windowBounds:           Rect;                                   {  The position and dimension of the folder's window  }
        finderFlags:            UInt16;                                 {  ex. kIsInvisible, kNameLocked, etc. }
        location:               Point;                                  {  Folder's location in the parent folder  }
                                                                        {  If set to (0, 0), the Finder will place the item automatically  }
        reservedField:          UInt16;                                 {  (set to 0)  }
    end;

    ExtendedFileInfoPtr = ^ExtendedFileInfo;
    ExtendedFileInfo = record
        reserved1:              array [0..3] of SInt16;                 {  Reserved (set to 0)  }
        extendedFinderFlags:    UInt16;                                 {  Extended flags (custom badge, routing info...)  }
        reserved2:              SInt16;                                 {  Reserved (set to 0). Comment ID if high-bit is clear  }
        putAwayFolderID:        SInt32;                                 {  Put away folder ID  }
    end;

    ExtendedFolderInfoPtr = ^ExtendedFolderInfo;
    ExtendedFolderInfo = record
        scrollPosition:         Point;                                  {  Scroll position (for icon views)  }
        reserved1:              SInt32;                                 {  Reserved (set to 0)  }
        extendedFinderFlags:    UInt16;                                 {  Extended flags (custom badge, routing info...)  }
        reserved2:              SInt16;                                 {  Reserved (set to 0). Comment ID if high-bit is clear  }
        putAwayFolderID:        SInt32;                                 {  Put away folder ID  }
    end;

    {   ------------------------------------------------------------------------    }
    {
       The following data structures are here for compatibility.
       Use the new data structures replacing them if possible (i.e. FileInfo
       instead of FInfo, etc...)
    }
    {   ------------------------------------------------------------------------    }
    {    File info  }
    {
         IMPORTANT:
         In MacOS 8, the fdFldr field has become reserved for the Finder.
    }
    FInfoPtr = ^FInfo;
    FInfo = record
        fdType:                 OSType;                                 {  The type of the file  }
        fdCreator:              OSType;                                 {  The file's creator  }
        fdFlags:                UInt16;                                 {  Flags ex. kHasBundle, kIsInvisible, etc.  }
        fdLocation:             Point;                                  {  File's location in folder.  }
                                                                        {  If set to (0, 0), the Finder will place the item automatically  }
        fdFldr:                 SInt16;                                 {  Reserved (set to 0)  }
    end;

    {    Extended file info     }
    {
         IMPORTANT:
         In MacOS 8, the fdIconID and fdComment fields were changed
         to become reserved fields for the Finder.
         The fdScript has become an extended flag.
    }
    FXInfoPtr = ^FXInfo;
    FXInfo = record
        fdIconID:               SInt16;                                 {  Reserved (set to 0)  }
        fdReserved:             array [0..2] of SInt16;                 {  Reserved (set to 0)  }
        fdScript:               SInt8;                                  {  Extended flags. Script code if high-bit is set  }
        fdXFlags:               SInt8;                                  {  Extended flags  }
        fdComment:              SInt16;                                 {  Reserved (set to 0). Comment ID if high-bit is clear  }
        fdPutAway:              SInt32;                                 {  Put away folder ID  }
    end;

    {    Folder info    }
    {
         IMPORTANT:
         In MacOS 8, the frView field was changed to become reserved
         field for the Finder.
    }
    DInfoPtr = ^DInfo;
    DInfo = record
        frRect:                 Rect;                                   {  Folder's window bounds  }
        frFlags:                UInt16;                                 {  Flags ex. kIsInvisible, kNameLocked, etc. }
        frLocation:             Point;                                  {  Folder's location in parent folder  }
                                                                        {  If set to (0, 0), the Finder will place the item automatically  }
        frView:                 SInt16;                                 {  Reserved (set to 0)  }
    end;

    {    Extended folder info   }
    {
         IMPORTANT:
         In MacOS 8, the frOpenChain and frComment fields were changed
         to become reserved fields for the Finder.
         The frScript has become an extended flag.
    }
    DXInfoPtr = ^DXInfo;
    DXInfo = record
        frScroll:               Point;                                  {  Scroll position  }
        frOpenChain:            SInt32;                                 {  Reserved (set to 0)  }
        frScript:               SInt8;                                  {  Extended flags. Script code if high-bit is set  }
        frXFlags:               SInt8;                                  {  Extended flags  }
        frComment:              SInt16;                                 {  Reserved (set to 0). Comment ID if high-bit is clear  }
        frPutAway:              SInt32;                                 {  Put away folder ID  }
    end;

    {  ControlPanelDefProcPtr and cdev constants have all been moved to Processes.i }
{$ALIGN MAC68K}
{#POP}
{unit FixMath}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}



const
    fixed1                      = $00010000;
    fract1                      = $40000000;
    positiveInfinity            = $7FFFFFFF;
    negativeInfinity            = $80000000;

    {
        FixRatio, FixMul, and FixRound were previously in ToolUtils.h
        }
    {
     *  FixRatio()
     *
     *  Availability:
     *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function FixRatio(numer: SInt16; denom: SInt16): Fixed; external name '_FixRatio';
{
 *  FixMul()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FixMul(a: Fixed; b: Fixed): Fixed; external name '_FixMul';
{
 *  FixRound()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FixRound(x: Fixed): SInt16; external name '_FixRound';
{
 *  Fix2Frac()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function Fix2Frac(x: Fixed): Fract; external name '_Fix2Frac';
{
 *  Fix2Long()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function Fix2Long(x: Fixed): SInt32; external name '_Fix2Long';
{
 *  Long2Fix()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function Long2Fix(x: SInt32): Fixed; external name '_Long2Fix';
{
 *  Frac2Fix()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function Frac2Fix(x: Fract): Fixed; external name '_Frac2Fix';
{
 *  FracMul()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FracMul(x: Fract; y: Fract): Fract; external name '_FracMul';
{
 *  FixDiv()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FixDiv(x: Fixed; y: Fixed): Fixed; external name '_FixDiv';
{
 *  FracDiv()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FracDiv(x: Fract; y: Fract): Fract; external name '_FracDiv';
{
 *  FracSqrt()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FracSqrt(x: Fract): Fract; external name '_FracSqrt';
{
 *  FracSin()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FracSin(x: Fixed): Fract; external name '_FracSin';
{
 *  FracCos()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FracCos(x: Fixed): Fract; external name '_FracCos';
{
 *  FixATan2()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FixATan2(x: SInt32; y: SInt32): Fixed; external name '_FixATan2';
{
    Frac2X, Fix2X, X2Fix, and X2Frac translate to and from
    the floating point type "extended" (that's what the X is for).
    On the original Mac this was 80-bits and the functions could be
    accessed via A-Traps.  When the 68881 co-processor was added,
    it used 96-bit floating point types, so the A-Traps could not
    be used.  When PowerPC was added, it used 64-bit floating point
    types, so yet another prototype was added.
}
{
 *  Frac2X()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function Frac2X(x: Fract): Double; external name '_Frac2X';

{
 *  Fix2X()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function Fix2X(x: Fixed): Double; external name '_Fix2X';

{
 *  X2Fix()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function X2Fix(x: Double): Fixed; external name '_X2Fix';

{
 *  X2Frac()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function X2Frac(x: Double): Fract; external name '_X2Frac';


{  QuickTime 3.0 makes these Wide routines available on other platforms }
{
 *  WideCompare()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function WideCompare(const (*var*) target: wide; const (*var*) source: wide): SInt16; external name '_WideCompare';

{
 *  WideAdd()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function WideAdd(var target: wide; const (*var*) source: wide): widePtr; external name '_WideAdd';

{
 *  WideSubtract()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function WideSubtract(var target: wide; const (*var*) source: wide): widePtr; external name '_WideSubtract';

{
 *  WideNegate()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function WideNegate(var target: wide): widePtr; external name '_WideNegate';

{
 *  WideShift()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function WideShift(var target: wide; shift: SInt32): widePtr; external name '_WideShift';

{
 *  WideSquareRoot()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function WideSquareRoot(const (*var*) source: wide): UInt32; external name '_WideSquareRoot';

{
 *  WideMultiply()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function WideMultiply(multiplicand: SInt32; multiplier: SInt32; var target: wide): widePtr; external name '_WideMultiply';

{ returns the quotient }
{
 *  WideDivide()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function WideDivide(const (*var*) dividend: wide; divisor: SInt32; var remainder: SInt32): SInt32; external name '_WideDivide';

{ quotient replaces dividend }
{
 *  WideWideDivide()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function WideWideDivide(var dividend: wide; divisor: SInt32; var remainder: SInt32): widePtr; external name '_WideWideDivide';

{
 *  WideBitShift()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function WideBitShift(var src: wide; shift: SInt32): widePtr; external name '_WideBitShift';



{$ALIGN MAC68K}
{#POP}
{unit GXTypes}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}




type
    gxShape    = ^SInt32; { an opaque 32-bit type }
    gxShapePtr = ^gxShape;  { when a var xx:gxShape parameter can be nil, it is changed to xx: gxShapePtr }
    gxStyle    = ^SInt32; { an opaque 32-bit type }
    gxStylePtr = ^gxStyle;  { when a var xx:gxStyle parameter can be nil, it is changed to xx: gxStylePtr }
    gxInk    = ^SInt32; { an opaque 32-bit type }
    gxInkPtr = ^gxInk;  { when a var xx:gxInk parameter can be nil, it is changed to xx: gxInkPtr }
    gxTransform    = ^SInt32; { an opaque 32-bit type }
    gxTransformPtr = ^gxTransform;  { when a var xx:gxTransform parameter can be nil, it is changed to xx: gxTransformPtr }
    gxTag    = ^SInt32; { an opaque 32-bit type }
    gxTagPtr = ^gxTag;  { when a var xx:gxTag parameter can be nil, it is changed to xx: gxTagPtr }
    gxColorSet    = ^SInt32; { an opaque 32-bit type }
    gxColorSetPtr = ^gxColorSet;  { when a var xx:gxColorSet parameter can be nil, it is changed to xx: gxColorSetPtr }
    gxColorProfile    = ^SInt32; { an opaque 32-bit type }
    gxColorProfilePtr = ^gxColorProfile;  { when a var xx:gxColorProfile parameter can be nil, it is changed to xx: gxColorProfilePtr }
    gxGraphicsClient    = ^SInt32; { an opaque 32-bit type }
    gxGraphicsClientPtr = ^gxGraphicsClient;  { when a var xx:gxGraphicsClient parameter can be nil, it is changed to xx: gxGraphicsClientPtr }
    gxViewGroup    = ^SInt32; { an opaque 32-bit type }
    gxViewGroupPtr = ^gxViewGroup;  { when a var xx:gxViewGroup parameter can be nil, it is changed to xx: gxViewGroupPtr }
    gxViewPort    = ^SInt32; { an opaque 32-bit type }
    gxViewPortPtr = ^gxViewPort;  { when a var xx:gxViewPort parameter can be nil, it is changed to xx: gxViewPortPtr }
    gxViewDevice    = ^SInt32; { an opaque 32-bit type }
    gxViewDevicePtr = ^gxViewDevice;  { when a var xx:gxViewDevice parameter can be nil, it is changed to xx: gxViewDevicePtr }

    gxColorSpace                        = SInt32;
    {    gxShape enumerations   }

const
    gxEmptyType                 = 1;
    gxPointType                 = 2;
    gxLineType                  = 3;
    gxCurveType                 = 4;
    gxRectangleType             = 5;
    gxPolygonType               = 6;
    gxPathType                  = 7;
    gxBitmapType                = 8;
    gxTextType                  = 9;
    gxGlyphType                 = 10;
    gxLayoutType                = 11;
    gxFullType                  = 12;
    gxPictureType               = 13;


type
    gxShapeType                         = SInt32;

const
    gxNoFill                    = 0;
    gxOpenFrameFill             = 1;
    gxFrameFill                 = 1;
    gxClosedFrameFill           = 2;
    gxHollowFill                = 2;
    gxEvenOddFill               = 3;
    gxSolidFill                 = 3;
    gxWindingFill               = 4;
    gxInverseEvenOddFill        = 5;
    gxInverseSolidFill          = 5;
    gxInverseFill               = 5;
    gxInverseWindingFill        = 6;


type
    gxShapeFill                         = SInt32;

const
    gxNoAttributes              = 0;
    gxDirectShape               = $0001;
    gxRemoteShape               = $0002;
    gxCachedShape               = $0004;
    gxLockedShape               = $0008;
    gxGroupShape                = $0010;
    gxMapTransformShape         = $0020;
    gxUniqueItemsShape          = $0040;
    gxIgnorePlatformShape       = $0080;
    gxNoMetricsGridShape        = $0100;
    gxDiskShape                 = $0200;
    gxMemoryShape               = $0400;


type
    gxShapeAttribute                    = SInt32;
    {    gxShape editing enumerations   }

const
    gxBreakNeitherEdit          = 0;
    gxBreakLeftEdit             = $0001;
    gxBreakRightEdit            = $0002;
    gxRemoveDuplicatePointsEdit = $0004;

    {    if the new first (or last) point exactly matches the point before it in    }
    {    the same contour, then remove it)  }

type
    gxEditShapeFlag                     = SInt32;

const
    gxSelectToEnd               = -1;

    gxAnyNumber                 = 1;
    gxSetToNil                  = -1;

    gxCounterclockwiseDirection = 0;
    gxClockwiseDirection        = 1;


type
    gxPointPtr = ^gxPoint;
    gxPoint = record
        x:                      Fixed;
        y:                      Fixed;
    end;
    gxColorValue                        = UInt16;
    gxPolarPtr = ^gxPolar;
    gxPolar = record
        radius:                 Fixed;
        angle:                  Fixed;
    end;

    gxMappingPtr = ^gxMapping;
    gxMapping = record
        map:                    array [0..2,0..2] OF Fixed;
    end;

type

    gxContourDirection                  = SInt32;
    {    gxShape structures     }
    {    The type 'gxPoint' is defined in "GXMath.h"    }
    gxLinePtr = ^gxLine;
    gxLine = record
        first:                  gxPoint;
        last:                   gxPoint;
    end;

    gxCurvePtr = ^gxCurve;
    gxCurve = record
        first:                  gxPoint;
        control:                gxPoint;
        last:                   gxPoint;
    end;

    gxRectanglePtr = ^gxRectangle;
    gxRectangle = record
        left:                   Fixed;
        top:                    Fixed;
        right:                  Fixed;
        bottom:                 Fixed;
    end;

    gxPolygonPtr = ^gxPolygon;
    gxPolygon = record
        vectors:                SInt32;
        vector:                 array [0..0] of gxPoint;
    end;

    gxPolygonsPtr = ^gxPolygons;
    gxPolygons = record
        contours:               SInt32;
        contour:                array [0..0] of gxPolygon;
    end;

    gxPathPtr = ^gxPath;
    gxPath = record
        vectors:                SInt32;
        controlBits:            array [0..0] of SInt32;
        vector:                 array [0..0] of gxPoint;
    end;

    gxPathsPtr = ^gxPaths;
    gxPaths = record
        contours:               SInt32;
        contour:                array [0..0] of gxPath;
    end;

    gxBitmapPtr = ^gxBitmap;
    gxBitmap = record
        image:                  CStringPtr;                             {  pointer to pixels  }
        width:                  SInt32;                             {  width in pixels  }
        height:                 SInt32;                             {  height in pixels  }
        rowBytes:               SInt32;                             {  width in bytes  }
        pixelSize:              SInt32;                             {  physical bits per pixel  }
        space:                  gxColorSpace;
        colorSet:               gxColorSet;
        profile:                gxColorProfile;
    end;

    gxLongRectanglePtr = ^gxLongRectangle;
    gxLongRectangle = record
        left:                   SInt32;
        top:                    SInt32;
        right:                  SInt32;
        bottom:                 SInt32;
    end;

    {    gxStyle enumerations   }

const
    gxCenterFrameStyle          = 0;
    gxSourceGridStyle           = $0001;
    gxDeviceGridStyle           = $0002;
    gxInsideFrameStyle          = $0004;
    gxOutsideFrameStyle         = $0008;
    gxAutoInsetStyle            = $0010;


type
    gxStyleAttribute                    = SInt32;

const
    gxBendDash                  = $0001;
    gxBreakDash                 = $0002;
    gxClipDash                  = $0004;
    gxLevelDash                 = $0008;
    gxAutoAdvanceDash           = $0010;


type
    gxDashAttribute                     = SInt32;

const
    gxPortAlignPattern          = $0001;
    gxPortMapPattern            = $0002;


type
    gxPatternAttribute                  = SInt32;

const
    gxSharpJoin                 = $0000;
    gxCurveJoin                 = $0001;
    gxLevelJoin                 = $0002;
    gxSnapJoin                  = $0004;


type
    gxJoinAttribute                     = SInt32;

const
    gxLevelStartCap             = $0001;
    gxLevelEndCap               = $0002;


type
    gxCapAttribute                      = SInt32;

const
    gxAutoAdvanceText           = $0001;
    gxNoContourGridText         = $0002;
    gxNoMetricsGridText         = $0004;
    gxAnchorPointsText          = $0008;
    gxVerticalText              = $0010;
    gxNoOpticalScaleText        = $0020;


type
    gxTextAttribute                     = SInt32;

const
    gxLeftJustify               = 0;
    gxCenterJustify             = $20000000;
    gxRightJustify              = $40000000;
    gxFillJustify               = -1;

    gxUnderlineAdvanceLayer     = $0001;                        {  a gxLine is drawn through the advances  }
    gxSkipWhiteSpaceLayer       = $0002;                        {  except characters describing white space  }
    gxUnderlineIntervalLayer    = $0004;                        {  (+ gxStringLayer) a gxLine is drawn through the gaps between advances  }
    gxUnderlineContinuationLayer = $0008;                       {  (+ gxStringLayer) join this underline with another face  }
    gxWhiteLayer                = $0010;                        {  the layer draws to white instead of black  }
    gxClipLayer                 = $0020;                        {  the characters define a clip  }
    gxStringLayer               = $0040;                        {  all characters in run are combined  }


type
    gxLayerFlag                         = SInt32;
    {    gxStyle structures     }
    gxFaceLayerPtr = ^gxFaceLayer;
    gxFaceLayer = record
        outlineFill:            gxShapeFill;                            {  outline framed or filled  }
        flags:                  gxLayerFlag;                            {  various additional effects  }
        outlineStyle:           gxStyle;                                {  outline  }
        outlineTransform:       gxTransform;                            {  italic, condense, extend  }
        boldOutset:             gxPoint;                                {  bold  }
    end;

    gxTextFacePtr = ^gxTextFace;
    gxTextFace = record
        faceLayers:             SInt32;                             {  layer to implement shadow  }
        advanceMapping:         gxMapping;                              {  algorithmic change to advance width  }
        faceLayer:              array [0..0] of gxFaceLayer;            {  zero or more face layers describing the face  }
    end;

    gxJoinRecordPtr = ^gxJoinRecord;
    gxJoinRecord = record
        attributes:             gxJoinAttribute;
        join:                   gxShape;
        miter:                  Fixed;
    end;

    gxDashRecordPtr = ^gxDashRecord;
    gxDashRecord = record
        attributes:             gxDashAttribute;
        dash:                   gxShape;                                {  similar to pattern, except rotated to gxLine slope  }
        advance:                Fixed;                                  {  specifies repeating frequency of dash  }
        phase:                  Fract;                                  {  specifies offset into the gxPath to start dashing  }
        scale:                  Fixed;                                  {  specifies height of dash to be mapped to penWidth  }
    end;

    gxPatternRecordPtr = ^gxPatternRecord;
    gxPatternRecord = record
        attributes:             gxPatternAttribute;
        pattern:                gxShape;
        u:                      gxPoint;
        v:                      gxPoint;
    end;

    gxCapRecordPtr = ^gxCapRecord;
    gxCapRecord = record
        attributes:             gxCapAttribute;
        startCap:               gxShape;
        endCap:                 gxShape;
    end;


    {    gxInk enumerations     }

const
    gxPortAlignDitherInk        = $0001;
    gxForceDitherInk            = $0002;
    gxSuppressDitherInk         = $0004;
    gxSuppressHalftoneInk       = $0008;


type
    gxInkAttribute                      = SInt32;

const
    gxNoMode                    = 0;
    gxCopyMode                  = 1;
    gxAddMode                   = 2;
    gxBlendMode                 = 3;
    gxMigrateMode               = 4;
    gxMinimumMode               = 5;
    gxMaximumMode               = 6;
    gxHighlightMode             = 7;
    gxAndMode                   = 8;
    gxOrMode                    = 9;
    gxXorMode                   = 10;
    gxRampAndMode               = 11;
    gxRampOrMode                = 12;
    gxRampXorMode               = 13;
    gxOverMode                  = 14;                           {  Alpha channel modes           }
    gxAtopMode                  = 15;                           {  Note: In England = Beta channel modes    }
    gxExcludeMode               = 16;
    gxFadeMode                  = 17;


type
    gxComponentMode                     = SInt8;

const
    gxRejectSourceTransfer      = $0001;                        {  at least one component must be out of range        }
    gxRejectDeviceTransfer      = $0002;                        {  at least one component must be out of range        }
    gxSingleComponentTransfer   = $0004;                        {  duplicate gxTransferComponent[0] for all components in transfer  }


type
    gxTransferFlag                      = SInt32;

const
    gxOverResultComponent       = $01;                          {  & result gxColor with 0xFFFF before clamping    }
    gxReverseComponent          = $02;                          {  reverse source and device before moding        }


type
    gxComponentFlag                     = SInt8;
    {    gxInk structures   }
    gxTransferComponentPtr = ^gxTransferComponent;
    gxTransferComponent = record
        mode:                   gxComponentMode;                        {  how the component is operated upon  }
        flags:                  gxComponentFlag;                        {  flags for each component    }
        sourceMinimum:          gxColorValue;
        sourceMaximum:          gxColorValue;                           {  input filter range  }
        deviceMinimum:          gxColorValue;
        deviceMaximum:          gxColorValue;                           {  output filter range  }
        clampMinimum:           gxColorValue;
        clampMaximum:           gxColorValue;                           {  output clamping range  }
        operand:                gxColorValue;                           {  ratio for blend, step for migrate, gxColor for highlight    }
    end;

    gxTransferModePtr = ^gxTransferMode;
    gxTransferMode = record
        space:                  gxColorSpace;                           {  the gxColor-space the transfer mode is to operate in    }
        colorSet:               gxColorSet;
        profile:                gxColorProfile;
        sourceMatrix:           array [0..4,0..3] of Fixed;
        deviceMatrix:           array [0..4,0..3] of Fixed;
        resultMatrix:           array [0..4,0..3] of Fixed;
        flags:                  gxTransferFlag;
        component:              array [0..3] of gxTransferComponent;    {  how each component is operated upon          }
    end;


    {    gxColor space enumerations     }

const
    gxNoColorPacking            = $0000;                        {  16 bits per channel  }
    gxAlphaSpace                = $0080;                        {  space includes alpha channel  }
    gxWord5ColorPacking         = $0500;                        {  5 bits per channel, right-justified  }
    gxLong8ColorPacking         = $0800;                        {  8 bits per channel, right-justified  }
    gxLong10ColorPacking        = $0A00;                        {  10 bits per channel, right-justified  }
    gxAlphaFirstPacking         = $1000;                        {  alpha channel is the first field in the packed space  }

    gxNoSpace                   = 0;
    gxRGBSpace                  = 1;
    gxCMYKSpace                 = 2;
    gxHSVSpace                  = 3;
    gxHLSSpace                  = 4;
    gxYXYSpace                  = 5;
    gxXYZSpace                  = 6;
    gxLUVSpace                  = 7;
    gxLABSpace                  = 8;
    gxYIQSpace                  = 9;
    gxNTSCSpace                 = 9;
    gxPALSpace                  = 9;
    gxGraySpace                 = 10;
    gxIndexedSpace              = 11;
    gxRGBASpace                 = 129;
    gxGrayASpace                = 138;
    gxRGB16Space                = $0501;
    gxRGB32Space                = $0801;
    gxARGB32Space               = $1881;
    gxCMYK32Space               = $0802;
    gxHSV32Space                = $0A03;
    gxHLS32Space                = $0A04;
    gxYXY32Space                = $0A05;
    gxXYZ32Space                = $0A06;
    gxLUV32Space                = $0A07;
    gxLAB32Space                = $0A08;
    gxYIQ32Space                = $0A09;
    gxNTSC32Space               = $0A09;
    gxPAL32Space                = $0A09;

    {    gxColor space structures   }

type
    gxRGBColorPtr = ^gxRGBColor;
    gxRGBColor = record
        red:                    gxColorValue;
        green:                  gxColorValue;
        blue:                   gxColorValue;
    end;

    gxRGBAColorPtr = ^gxRGBAColor;
    gxRGBAColor = record
        red:                    gxColorValue;
        green:                  gxColorValue;
        blue:                   gxColorValue;
        alpha:                  gxColorValue;
    end;

    gxHSVColorPtr = ^gxHSVColor;
    gxHSVColor = record
        hue:                    gxColorValue;
        saturation:             gxColorValue;
        value:                  gxColorValue;
    end;

    gxHLSColorPtr = ^gxHLSColor;
    gxHLSColor = record
        hue:                    gxColorValue;
        lightness:              gxColorValue;
        saturation:             gxColorValue;
    end;

    gxCMYKColorPtr = ^gxCMYKColor;
    gxCMYKColor = record
        cyan:                   gxColorValue;
        magenta:                gxColorValue;
        yellow:                 gxColorValue;
        black:                  gxColorValue;
    end;

    gxXYZColorPtr = ^gxXYZColor;
    gxXYZColor = record
        x:                      gxColorValue;
        y:                      gxColorValue;
        z:                      gxColorValue;
    end;

    gxYXYColorPtr = ^gxYXYColor;
    gxYXYColor = record
        capY:                   gxColorValue;
        x:                      gxColorValue;
        y:                      gxColorValue;
    end;

    gxLUVColorPtr = ^gxLUVColor;
    gxLUVColor = record
        l:                      gxColorValue;
        u:                      gxColorValue;
        v:                      gxColorValue;
    end;

    gxLABColorPtr = ^gxLABColor;
    gxLABColor = record
        l:                      gxColorValue;
        a:                      gxColorValue;
        b:                      gxColorValue;
    end;

    gxYIQColorPtr = ^gxYIQColor;
    gxYIQColor = record
        y:                      gxColorValue;
        i:                      gxColorValue;
        q:                      gxColorValue;
    end;

    gxGrayAColorPtr = ^gxGrayAColor;
    gxGrayAColor = record
        gray:                   gxColorValue;
        alpha:                  gxColorValue;
    end;

    gxColorIndex                        = SInt32;
    gxIndexedColorPtr = ^gxIndexedColor;
    gxIndexedColor = record
        index:                  gxColorIndex;
        colorSet:               gxColorSet;
    end;

    gxColorPtr = ^gxColor;
    gxColor = record
        space:                  gxColorSpace;
        profile:                gxColorProfile;
        case SInt16 of
        0: (
            cmyk:               gxCMYKColor;
            );
        1: (
            rgb:                gxRGBColor;
            );
        2: (
            rgba:               gxRGBAColor;
            );
        3: (
            hsv:                gxHSVColor;
            );
        4: (
            hls:                gxHLSColor;
            );
        5: (
            xyz:                gxXYZColor;
            );
        6: (
            yxy:                gxYXYColor;
            );
        7: (
            luv:                gxLUVColor;
            );
        8: (
            lab:                gxLABColor;
            );
        9: (
            yiq:                gxYIQColor;
            );
        10: (
            gray:               gxColorValue;
            );
        11: (
            graya:              gxGrayAColor;
            );
        12: (
            pixel16:            UInt16;
            );
        13: (
            pixel32:            UInt32;
            );
        14: (
            indexed:            gxIndexedColor;
            );
        15: (
            component:          array [0..3] of gxColorValue;
            );
    end;


    {    gxColorSet structures  }
    gxSetColorPtr = ^gxSetColor;
    gxSetColor = record
        case SInt16 of
        0: (
            cmyk:               gxCMYKColor;
            );
        1: (
            rgb:                gxRGBColor;
            );
        2: (
            rgba:               gxRGBAColor;
            );
        3: (
            hsv:                gxHSVColor;
            );
        4: (
            hls:                gxHLSColor;
            );
        5: (
            xyz:                gxXYZColor;
            );
        6: (
            yxy:                gxYXYColor;
            );
        7: (
            luv:                gxLUVColor;
            );
        8: (
            lab:                gxLABColor;
            );
        9: (
            yiq:                gxYIQColor;
            );
        10: (
            gray:               gxColorValue;
            );
        11: (
            graya:              gxGrayAColor;
            );
        12: (
            pixel16:            UInt16;
            );
        13: (
            pixel32:            UInt32;
            );
        14: (
            component:          array [0..3] of gxColorValue;
            );
    end;

    {    gxTransform enumerations   }
    {    parts of a gxShape considered in hit testing:  }

const
    gxNoPart                    = 0;                            {  (in order of evaluation)  }
    gxBoundsPart                = $0001;
    gxGeometryPart              = $0002;
    gxPenPart                   = $0004;
    gxCornerPointPart           = $0008;
    gxControlPointPart          = $0010;
    gxEdgePart                  = $0020;
    gxJoinPart                  = $0040;
    gxStartCapPart              = $0080;
    gxEndCapPart                = $0100;
    gxDashPart                  = $0200;
    gxPatternPart               = $0400;
    gxGlyphBoundsPart           = $0040;
    gxGlyphFirstPart            = $0080;
    gxGlyphLastPart             = $0100;
    gxSideBearingPart           = $0200;
    gxAnyPart                   = $07FF;


type
    gxShapePart                         = SInt32;
    {    gxTransform structures     }
    gxHitTestInfoPtr = ^gxHitTestInfo;
    gxHitTestInfo = record
        what:                   gxShapePart;                            {  which part of gxShape  }
        index:                  SInt32;                             {  control gxPoint index  }
        distance:               Fixed;                                  {  how far from gxPoint or outside of area click was  }
                                                                        {  these fields are only set by GXHitTestPicture  }
        which:                  gxShape;
        containerPicture:       gxShape;                                {  picture which contains gxShape hit  }
        containerIndex:         SInt32;                             {  the index within that picture   }
        totalIndex:             SInt32;                             {  the total index within the root picture  }
    end;

    {    gxViewPort enumerations    }

const
    gxGrayPort                  = $0001;
    gxAlwaysGridPort            = $0002;
    gxEnableMatchPort           = $0004;


type
    gxPortAttribute                     = SInt32;
    {    gxViewDevice enumerations  }

const
    gxDirectDevice              = $01;                          {  for the device gxBitmap baseAddr pointer  }
    gxRemoteDevice              = $02;
    gxInactiveDevice            = $04;


type
    gxDeviceAttribute                   = SInt32;

const
    gxRoundDot                  = 1;
    gxSpiralDot                 = 2;
    gxSquareDot                 = 3;
    gxLineDot                   = 4;
    gxEllipticDot               = 5;
    gxTriangleDot               = 6;
    gxDispersedDot              = 7;
    gxCustomDot                 = 8;


type
    gxDotType                           = SInt32;
    {    gxViewPort structures  }

const
    gxNoTint                    = 0;
    gxLuminanceTint             = 1;                            {  use the luminance of the gxColor  }
    gxAverageTint               = 2;                            {  add all the components and divide by the number of components  }
    gxMixtureTint               = 3;                            {  find the closest gxColor on the axis between the foreground and background  }
    gxComponent1Tint            = 4;                            {  use the value of the first component of the gxColor  }
    gxComponent2Tint            = 5;                            {  ... etc.  }
    gxComponent3Tint            = 6;
    gxComponent4Tint            = 7;


type
    gxTintType                          = SInt32;
    gxHalftonePtr = ^gxHalftone;
    gxHalftone = record
        angle:                  Fixed;
        frequency:              Fixed;
        method:                 gxDotType;
        tinting:                gxTintType;
        dotColor:               gxColor;
        backgroundColor:        gxColor;
        tintSpace:              gxColorSpace;
    end;

    gxHalftoneMatrixPtr = ^gxHalftoneMatrix;
    gxHalftoneMatrix = record
        dpiX:                   Fixed;                                  {  intended resolution  }
        dpiY:                   Fixed;
        width:                  SInt32;                             {  width of matrix (in device pixels)  }
        height:                 SInt32;                             {  height of matrix (in device pixels)  }
        tileShift:              SInt32;                             {  shift amount (in samples) for rectangular tiling  }
        samples:                array [0..0] of UInt16;                 {  samples from 0..MAX(halftone tintSpace)  }
    end;

    {    gxViewGroup enumerations   }

const
    gxAllViewDevices            = 0;
    gxScreenViewDevices         = 1;

    {    graphics stream constants and structures   }
    gxOpenReadSpool             = 1;
    gxOpenWriteSpool            = 2;
    gxReadSpool                 = 3;
    gxWriteSpool                = 4;
    gxCloseSpool                = 5;


type
    gxSpoolCommand                      = SInt32;
    gxGraphicsOpcode                    = SInt8;
    gxSpoolBlockPtr = ^gxSpoolBlock;
    gxSpoolProcPtr = function(command: gxSpoolCommand; block: gxSpoolBlockPtr): SInt32;

    gxSpoolUPP = ^SInt32; { an opaque UPP }
    gxSpoolBlock = record
        spoolProcedure:         gxSpoolUPP;                             {  these fields are read only  }
        buffer:                 Ptr;                                    {  source/destination pointer to data  }
        bufferSize:             SInt32;                             {  how many bytes for the system to read (flatten) / write (unflatten)  }
                                                                        {  these fields are written to (but are not read from)  }
        count:                  SInt32;                             {  how many bytes for the caller to read (unflatten) /write (flatten)  }
        operationSize:          SInt32;                             {  operation size (including operand byte)  }
        operationOffset:        SInt32;                             {  the data offset, if any, within the current operation  }
        lastTypeOpcode:         gxGraphicsOpcode;                       {  type of last created object  }
        currentOperation:       gxGraphicsOpcode;                       {  operation emitted by flatten, or intrepreted by last unflatten  }
        currentOperand:         gxGraphicsOpcode;                       {  e.g., gxTransformTypeOpcode, gxInkTagOpcode  }
        compressed:             SInt8;                                  {  one of: gxTwoBitCompressionValues  }
    end;


const
    uppgxSpoolProcInfo = $000003F1;



const
    gxFontListFlatten           = $01;                          {  if set, generate a gxTag containing list of each gxFont referenced  }
    gxFontGlyphsFlatten         = $02;                          {  if set, generate a gxTag containing the list of glyphs referenced inside the gxFont  }
    gxFontVariationsFlatten     = $04;                          {  if set, append the gxTag with separate [variation] coordinates  }
    gxBitmapAliasFlatten        = $08;                          {  if set, open bitmap alias files and flatten out their image data  }



type
    gxFlattenFlag                       = SInt32;
    {    gxGraphicsClient constants     }

const
    gxGraphicsSystemClient      = -1;

    gxStaticHeapClient          = $0001;


type
    gxClientAttribute                   = SInt32;
    {    graphics patching constants    }

const
    gxOriginalGraphicsFunction  = -1;
    gxOriginalGraphicsIdentifier = $67726678 (* 'grfx' *);


type
    gxBitmapDataSourceAliasPtr = ^gxBitmapDataSourceAlias;
    gxBitmapDataSourceAlias = record
        fileOffset:             UInt32;                                 {  file offset (in bytes) of top-left pixel  }
        aliasRecordSize:        UInt32;                                 {  size of alias record below  }
        aliasRecord:            SInt8;                                  {  the actual alias record data  }
    end;


const
    gxBitmapFileAliasTagType    = $6266696C (* 'bfil' *);
    gxPICTFileAliasTagType      = $70696374 (* 'pict' *);
    gxBitmapFileAliasImageValue = 1;


type
    gxFont    = ^SInt32; { an opaque 32-bit type }
    gxFontPtr = ^gxFont;  { when a var xx:gxFont parameter can be nil, it is changed to xx: gxFontPtr }

const
    gxNoPlatform                = 0;
    gxNoScript                  = 0;
    gxNoLanguage                = 0;
    gxNoFontName                = 0;
    gxGlyphPlatform             = -1;

    gxUnicodePlatform           = 1;
    gxMacintoshPlatform         = 2;
    gxReservedPlatform          = 3;
    gxMicrosoftPlatform         = 4;
    gxCustomPlatform            = 5;


type
    gxFontPlatform                      = SInt32;

const
    gxUnicodeDefaultSemantics   = 1;
    gxUnicodeV1_1Semantics      = 2;
    gxISO10646_1993Semantics    = 3;

    gxRomanScript               = 1;
    gxJapaneseScript            = 2;
    gxTraditionalChineseScript  = 3;
    gxChineseScript             = 3;
    gxKoreanScript              = 4;
    gxArabicScript              = 5;
    gxHebrewScript              = 6;
    gxGreekScript               = 7;
    gxCyrillicScript            = 8;
    gxRussian                   = 8;
    gxRSymbolScript             = 9;
    gxDevanagariScript          = 10;
    gxGurmukhiScript            = 11;
    gxGujaratiScript            = 12;
    gxOriyaScript               = 13;
    gxBengaliScript             = 14;
    gxTamilScript               = 15;
    gxTeluguScript              = 16;
    gxKannadaScript             = 17;
    gxMalayalamScript           = 18;
    gxSinhaleseScript           = 19;
    gxBurmeseScript             = 20;
    gxKhmerScript               = 21;
    gxThaiScript                = 22;
    gxLaotianScript             = 23;
    gxGeorgianScript            = 24;
    gxArmenianScript            = 25;
    gxSimpleChineseScript       = 26;
    gxTibetanScript             = 27;
    gxMongolianScript           = 28;
    gxGeezScript                = 29;
    gxEthiopicScript            = 29;
    gxAmharicScript             = 29;
    gxSlavicScript              = 30;
    gxEastEuropeanRomanScript   = 30;
    gxVietnameseScript          = 31;
    gxExtendedArabicScript      = 32;
    gxSindhiScript              = 32;
    gxUninterpretedScript       = 33;

    gxMicrosoftSymbolScript     = 1;
    gxMicrosoftStandardScript   = 2;

    gxCustom8BitScript          = 1;
    gxCustom816BitScript        = 2;
    gxCustom16BitScript         = 3;


type
    gxFontScript                        = SInt32;

const
    gxEnglishLanguage           = 1;
    gxFrenchLanguage            = 2;
    gxGermanLanguage            = 3;
    gxItalianLanguage           = 4;
    gxDutchLanguage             = 5;
    gxSwedishLanguage           = 6;
    gxSpanishLanguage           = 7;
    gxDanishLanguage            = 8;
    gxPortugueseLanguage        = 9;
    gxNorwegianLanguage         = 10;
    gxHebrewLanguage            = 11;
    gxJapaneseLanguage          = 12;
    gxArabicLanguage            = 13;
    gxFinnishLanguage           = 14;
    gxGreekLanguage             = 15;
    gxIcelandicLanguage         = 16;
    gxMalteseLanguage           = 17;
    gxTurkishLanguage           = 18;
    gxCroatianLanguage          = 19;
    gxTradChineseLanguage       = 20;
    gxUrduLanguage              = 21;
    gxHindiLanguage             = 22;
    gxThaiLanguage              = 23;
    gxKoreanLanguage            = 24;
    gxLithuanianLanguage        = 25;
    gxPolishLanguage            = 26;
    gxHungarianLanguage         = 27;
    gxEstonianLanguage          = 28;
    gxLettishLanguage           = 29;
    gxLatvianLanguage           = 29;
    gxSaamiskLanguage           = 30;
    gxLappishLanguage           = 30;
    gxFaeroeseLanguage          = 31;
    gxFarsiLanguage             = 32;
    gxPersianLanguage           = 32;
    gxRussianLanguage           = 33;
    gxSimpChineseLanguage       = 34;
    gxFlemishLanguage           = 35;
    gxIrishLanguage             = 36;
    gxAlbanianLanguage          = 37;
    gxRomanianLanguage          = 38;
    gxCzechLanguage             = 39;
    gxSlovakLanguage            = 40;
    gxSlovenianLanguage         = 41;
    gxYiddishLanguage           = 42;
    gxSerbianLanguage           = 43;
    gxMacedonianLanguage        = 44;
    gxBulgarianLanguage         = 45;
    gxUkrainianLanguage         = 46;
    gxByelorussianLanguage      = 47;
    gxUzbekLanguage             = 48;
    gxKazakhLanguage            = 49;
    gxAzerbaijaniLanguage       = 50;
    gxAzerbaijanArLanguage      = 51;
    gxArmenianLanguage          = 52;
    gxGeorgianLanguage          = 53;
    gxMoldavianLanguage         = 54;
    gxKirghizLanguage           = 55;
    gxTajikiLanguage            = 56;
    gxTurkmenLanguage           = 57;
    gxMongolianLanguage         = 58;
    gxMongolianCyrLanguage      = 59;
    gxPashtoLanguage            = 60;
    gxKurdishLanguage           = 61;
    gxKashmiriLanguage          = 62;
    gxSindhiLanguage            = 63;
    gxTibetanLanguage           = 64;
    gxNepaliLanguage            = 65;
    gxSanskritLanguage          = 66;
    gxMarathiLanguage           = 67;
    gxBengaliLanguage           = 68;
    gxAssameseLanguage          = 69;
    gxGujaratiLanguage          = 70;
    gxPunjabiLanguage           = 71;
    gxOriyaLanguage             = 72;
    gxMalayalamLanguage         = 73;
    gxKannadaLanguage           = 74;
    gxTamilLanguage             = 75;
    gxTeluguLanguage            = 76;
    gxSinhaleseLanguage         = 77;
    gxBurmeseLanguage           = 78;
    gxKhmerLanguage             = 79;
    gxLaoLanguage               = 80;
    gxVietnameseLanguage        = 81;
    gxIndonesianLanguage        = 82;
    gxTagalogLanguage           = 83;
    gxMalayRomanLanguage        = 84;
    gxMalayArabicLanguage       = 85;
    gxAmharicLanguage           = 86;
    gxTigrinyaLanguage          = 87;
    gxGallaLanguage             = 88;
    gxOromoLanguage             = 88;
    gxSomaliLanguage            = 89;
    gxSwahiliLanguage           = 90;
    gxRuandaLanguage            = 91;
    gxRundiLanguage             = 92;
    gxChewaLanguage             = 93;
    gxMalagasyLanguage          = 94;
    gxEsperantoLanguage         = 95;
    gxWelshLanguage             = 129;
    gxBasqueLanguage            = 130;
    gxCatalanLanguage           = 131;
    gxLatinLanguage             = 132;
    gxQuechuaLanguage           = 133;
    gxGuaraniLanguage           = 134;
    gxAymaraLanguage            = 135;
    gxTatarLanguage             = 136;
    gxUighurLanguage            = 137;
    gxDzongkhaLanguage          = 138;
    gxJavaneseRomLanguage       = 139;
    gxSundaneseRomLanguage      = 140;


type
    gxFontLanguage                      = SInt32;

const
    gxCopyrightFontName         = 1;
    gxFamilyFontName            = 2;
    gxStyleFontName             = 3;
    gxUniqueFontName            = 4;
    gxFullFontName              = 5;
    gxVersionFontName           = 6;
    gxPostscriptFontName        = 7;
    gxTrademarkFontName         = 8;
    gxManufacturerFontName      = 9;
    gxLastReservedFontName      = 256;


type
    gxFontName                          = SInt32;
    gxFontTableTag                      = SInt32;
    gxFontVariationTag                  = SInt32;
    gxFontFormatTag                     = SInt32;
    gxFontStorageTag                    = SInt32;
    gxFontDescriptorTag                 = gxFontVariationTag;
    gxFontVariationPtr = ^gxFontVariation;
    gxFontVariation = record
        name:                   gxFontVariationTag;
        value:                  Fixed;
    end;

    gxFontDescriptor                    = gxFontVariation;
    gxFontDescriptorPtr                 = ^gxFontDescriptor;
    gxFontFeatureSettingPtr = ^gxFontFeatureSetting;
    gxFontFeatureSetting = record
        setting:                UInt16;
        nameID:                 UInt16;
    end;


const
    gxSystemFontAttribute       = $0001;
    gxReadOnlyFontAttribute     = $0002;


type
    gxFontAttribute                     = SInt32;

const
    gxMutuallyExclusiveFeature  = $00008000;


type
    gxFontFeatureFlag                   = SInt32;
    gxFontFeature                       = SInt32;

const
    gxResourceFontStorage       = $72737263 (* 'rsrc' *);
    gxHandleFontStorage         = $686E646C (* 'hndl' *);
    gxFileFontStorage           = $62617373 (* 'bass' *);
    gxNfntFontStorage           = $6E666E74 (* 'nfnt' *);


type
    gxFontStorageReference              = Ptr;
    gxGlyphcode                         = UInt16;
    {    single glyph in a font     }
    {    byte offset within backing store   }
    gxByteOffset                        = SInt32;
    {    The actual constants for feature types and selectors have been moved to a library.     }
    gxRunFeatureType                    = UInt16;
    gxRunFeatureSelector                = UInt16;
    {    If tracking is not desired, specify the following value in the track field in the
            gxRunControls record (note that a track of 0 does *not* mean to turn tracking off;
            rather, it means to use normal tracking).   }

const
    gxNoTracking                = $80000000;

    {    The special "gxNoStake" value is returned by the GXGetLayoutBreakOffset call to
            indicate the absence of a character offset that is stable with respect to
            metamorphosis and contextual kerning.   }
    gxNoStake                   = -1;

    {    A glyph's behavior with respect to other glyphs on its line is defined in part by its
            gxBaselineType. These types allow correct alignment of the baselines of all glyphs on
            the line.   }
    gxRomanBaseline             = 0;
    gxIdeographicCenterBaseline = 1;
    gxIdeographicLowBaseline    = 2;
    gxHangingBaseline           = 3;
    gxMathBaseline              = 4;
    gxLastBaseline              = 31;
    gxNumberOfBaselineTypes     = 32;
    gxNoOverrideBaseline        = 255;


type
    gxBaselineType                      = UInt32;
    gxBaselineDeltas                    = array [0..31] of Fixed;
    {    gxJustificationPriority defines the point during the justification process at which a
        glyph will begin to receive deltas before and after itself.     }

const
    gxKashidaPriority           = 0;
    gxWhiteSpacePriority        = 1;
    gxInterCharPriority         = 2;
    gxNullJustificationPriority = 3;
    gxNumberOfJustificationPriorities = 4;


type
    gxJustificationPriority             = UInt8;
    {    gxJustificationFlags are used to control which fields of a gxWidthDeltaRecord are to
            be overridden and which are not if a gxPriorityJustificationOverride or
            gxGlyphJustificationOverride (qq.v.) is specified.  }

const
    gxOverridePriority          = $8000;                        {  use priority value from override  }
    gxOverrideLimits            = $4000;                        {  use limits values from override  }
    gxOverrideUnlimited         = $2000;                        {  use unlimited flag from override  }
    gxUnlimitedGapAbsorption    = $1000;                        {  glyph can take unlimited gap  }
    gxJustificationPriorityMask = $000F;                        {  justification priority  }
    gxAllJustificationFlags     = $F00F;


type
    gxJustificationFlags                = UInt16;
    {    The directional behavior of a glyph can be overridden using a gxDirectionOverride.     }

const
    gxNoDirectionOverride       = 0;
    gxImposeLeftToRight         = 1;
    gxImposeRightToLeft         = 2;
    gxImposeArabic              = 3;


type
    gxDirectionOverride                 = UInt16;
    {    gxRunControlFlags describe the nonparametric layout options contained in a gxStyle.    }

const
    gxNoCaretAngle              = $40000000;
    gxImposeWidth               = $20000000;
    gxNoCrossKerning            = $10000000;
    gxNoOpticalAlignment        = $08000000;
    gxForceHanging              = $04000000;
    gxNoSpecialJustification    = $02000000;
    gxDirectionOverrideMask     = $00000003;
    gxNoLigatureSplits          = $80000000;

    gxAllRunControlFlags        = $FE000003;


type
    gxRunControlFlags                   = UInt32;
    {    gxHighlightType is used to distinguish various highlighting methods, both in terms of
            character offset based vs. visual based, and in terms of angled sides vs. non-angled
            sides.  }

const
    gxHighlightStraight         = 0;                            {  straight-edged simple highlighting  }
    gxHighlightAverageAngle     = 1;                            {  takes average of two edge angles  }


type
    gxHighlightType                     = UInt32;
    {    gxCaretType is used to control whether the caret that is returned from GXGetLayoutCaret
            is a split caret or a (keyboard-syncronized) single caret.  }

const
    gxSplitCaretType            = 0;                            {  returns Mac-style split caret (default)  }
    gxLeftRightKeyboardCaret    = 1;                            {  single caret in left-right position  }
    gxRightLeftKeyboardCaret    = 2;                            {  single caret in right-left position  }


type
    gxCaretType                         = UInt32;
    {    gxLayoutOffsetState describes the characteristics of a given gxByteOffset in some
            layout. It is returned by the GXGetOffsetGlyphs call. Note that the
            gxOffsetInsideLigature value is returned in addition to the 8/16 (or invalid)
            indication.     }

const
    gxOffset8_8                 = 0;
    gxOffset8_16                = 1;
    gxOffset16_8                = 2;
    gxOffset16_16               = 3;
    gxOffsetInvalid             = 4;

    gxOffsetInsideLigature      = $8000;


type
    gxLayoutOffsetState                 = UInt16;
    {    gxLayoutOptionsFlags are single-bit flags contained in a gxLayoutOptions record. We
        also define here some utility constants that are useful in setting various fields in
        the gxLayoutOptions record.     }

const
    gxNoLayoutOptions           = 0;
    gxLineIsDisplayOnly         = $00000001;
    gxKeepSpacesInMargin        = $00000002;
    gxLimitReorderingToTwoLevels = $00000004;
    gxLineLeftEdgeNotAtMargin   = $00000008;
    gxLineRightEdgeNotAtMargin  = $00000010;
    gxAllLayoutOptionsFlags     = $0000001F;
    gxMaxRunLevel               = 15;
    gxFlushLeft                 = 0;
    gxFlushCenter               = $20000000;
    gxFlushRight                = $40000000;
    gxNoJustification           = 0;
    gxFullJustification         = $40000000;


type
    gxLayoutOptionsFlags                = UInt32;
    {    A gxRunFeature describes a feature and a level for that feature.   }
    gxRunFeaturePtr = ^gxRunFeature;
    gxRunFeature = record
        featureType:            gxRunFeatureType;
        featureSelector:        gxRunFeatureSelector;
    end;

    {    A gxWidthDeltaRecord contains all of the information needed to describe the behavior of one
            class of glyphs during the justification process.   }
    gxWidthDeltaRecordPtr = ^gxWidthDeltaRecord;
    gxWidthDeltaRecord = record
        beforeGrowLimit:        Fixed;                                  {  ems AW can grow by at most on LT  }
        beforeShrinkLimit:      Fixed;                                  {  ems AW can shrink by at most on LT  }
        afterGrowLimit:         Fixed;                                  {  ems AW can grow by at most on RB  }
        afterShrinkLimit:       Fixed;                                  {  ems AW can shrink by at most on RB  }
        growFlags:              gxJustificationFlags;                   {  flags controlling grow case  }
        shrinkFlags:            gxJustificationFlags;                   {  flags controlling shrink case  }
    end;

    {    A gxPriorityJustificationOverride contains an array of WidthDeltaRecords, one for each
            gxJustificationPriority.    }
    gxPriorityJustificationOverridePtr = ^gxPriorityJustificationOverride;
    gxPriorityJustificationOverride = record
        deltas:                 array [0..3] of gxWidthDeltaRecord;     {  overrides for each of the priorities  }
    end;

    {    A gxGlyphJustificationOverride contains a gxWidthDeltaRecord that is to be used for a
            specific glyph in a specific run (this limitation is because glyphcodes vary by font).  }
    gxGlyphJustificationOverridePtr = ^gxGlyphJustificationOverride;
    gxGlyphJustificationOverride = record
        glyph:                  gxGlyphcode;
        override:               gxWidthDeltaRecord;
    end;


    {    gxRunControls contains flags, shifts, imposed widths and overrides for a run.  }
    {    NOTE: a value of "gxNoTracking" (see above) in track disables tracking     }
    gxRunControlsPtr = ^gxRunControls;
    gxRunControls = record
        flags:                  gxRunControlFlags;
        beforeWithStreamShift:  Fixed;
        afterWithStreamShift:   Fixed;
        crossStreamShift:       Fixed;
        imposedWidth:           Fixed;
        track:                  Fixed;
        hangingInhibitFactor:   Fract;
        kerningInhibitFactor:   Fract;
        decompositionAdjustmentFactor: Fixed;
        baselineType:           gxBaselineType;
    end;

    {    A gxGlyphSubstitution describes one client-provided substitution that occurs after all
            other automatic glyph changes have happened.    }
    gxGlyphSubstitutionPtr = ^gxGlyphSubstitution;
    gxGlyphSubstitution = record
        originalGlyph:          gxGlyphcode;                            {  Whenever you see this glyph...  }
        substituteGlyph:        gxGlyphcode;                            {  ...change it to this one.  }
    end;

    {    gxKerningAdjustmentFactors specify an adjustment to automatic kerning. The adjustment
            is ax + b where x is the automatic kerning value, a is scaleFactor, and b is
            adjustmentPointSizeFactor times the run's point size.   }
    gxKerningAdjustmentFactorsPtr = ^gxKerningAdjustmentFactors;
    gxKerningAdjustmentFactors = record
        scaleFactor:            Fract;
        adjustmentPointSizeFactor: Fixed;
    end;

    {    A gxKerningAdjustment identifies with- and cross-stream kerning adjustments
            for specific glyph pairs.   }
    gxKerningAdjustmentPtr = ^gxKerningAdjustment;
    gxKerningAdjustment = record
        firstGlyph:             gxGlyphcode;
        secondGlyph:            gxGlyphcode;
        withStreamFactors:      gxKerningAdjustmentFactors;
        crossStreamFactors:     gxKerningAdjustmentFactors;
    end;

    {    A value of gxResetCrossStreamFactor in crossStreamFactors.adjustmentPointSizeFactor
            will reset the cross-stream kerning to the baseline.    }

const
    gxResetCrossStreamFactor    = $80000000;

    {    gxLayoutHitInfo contains the output from the GXHitTestLayout call.     }

type
    gxLayoutHitInfoPtr = ^gxLayoutHitInfo;
    gxLayoutHitInfo = record
        firstPartialDist:       Fixed;
        lastPartialDist:        Fixed;
        hitSideOffset:          gxByteOffset;
        nonHitSideOffset:       gxByteOffset;
        leadingEdge:            boolean;
        inLoose:                boolean;
    end;

    {    A gxLineBaselineRecord contains the deltas from 0 to all the different baselines for
            the layout. It can be filled via a call to GetBaselineDeltas (q.v.).    }
    gxLineBaselineRecordPtr = ^gxLineBaselineRecord;
    gxLineBaselineRecord = record
        deltas:                 gxBaselineDeltas;
    end;

    {    The gxLayoutOptions type contains information about the layout characteristics of the
            whole line.     }
    gxLayoutOptionsPtr = ^gxLayoutOptions;
    gxLayoutOptions = record
        width:                  Fixed;
        flush:                  Fract;
        just:                   Fract;
        flags:                  gxLayoutOptionsFlags;
        baselineRec:            gxLineBaselineRecordPtr;
    end;


const
    gxNewObjectOpcode           = $00;                          {  create new object  }
    gxSetDataOpcode             = $40;                          {  add reference to current object  }
    gxSetDefaultOpcode          = $80;                          {  replace current default with this object  }
    gxReservedOpcode            = $C0;                          {  (may be used in future expansion)  }
    gxNextOpcode                = $FF;                          {  used by currentOperand field to say opcode is coming  }

    {    new object types (new object opcode)   }
    gxHeaderTypeOpcode          = $00;                          {  byte following new object uses bottom 6 bits for type  }
                                                                {  gxShape types use values 1 (gxEmptyType) through 13 (gxPictureType)  }
    gxStyleTypeOpcode           = $28;
    gxInkTypeOpcode             = $29;
    gxTransformTypeOpcode       = $2A;
    gxColorProfileTypeOpcode    = $2B;
    gxColorSetTypeOpcode        = $2C;
    gxTagTypeOpcode             = $2D;
    gxBitImageOpcode            = $2E;
    gxFontNameTypeOpcode        = $2F;
    gxTrailerTypeOpcode         = $3F;

    {    fields of objects (set data opcodes)   }
    gxShapeAttributesOpcode     = 0;
    gxShapeTagOpcode            = 1;
    gxShapeFillOpcode           = 2;

    gxOmitPathPositionXMask     = $C0;
    gxOmitPathPositionYMask     = $30;
    gxOmitPathDeltaXMask        = $0C;
    gxOmitPathDeltaYMask        = $03;

    gxOmitPathPositionXShift    = 6;
    gxOmitPathPositionYShift    = 4;
    gxOmitPathDeltaXShift       = 2;
    gxOmitPathDeltaYShift       = 0;

    gxOmitBitmapImageMask       = $C0;
    gxOmitBitmapWidthMask       = $30;
    gxOmitBitmapHeightMask      = $0C;
    gxOmitBitmapRowBytesMask    = $03;

    gxOmitBitmapImageShift      = 6;
    gxOmitBitmapWidthShift      = 4;
    gxOmitBitmapHeightShift     = 2;
    gxOmitBitmapRowBytesShift   = 0;

    gxOmitBitmapPixelSizeMask   = $C0;
    gxOmitBitmapSpaceMask       = $30;
    gxOmitBitmapSetMask         = $0C;
    gxOmitBitmapProfileMask     = $03;

    gxOmitBitmapPixelSizeShift  = 6;
    gxOmitBitmapSpaceShift      = 4;
    gxOmitBitmapSetShift        = 2;
    gxOmitBitmapProfileShift    = 0;

    gxOmitBitmapPositionXMask   = $C0;
    gxOmitBitmapPositionYMask   = $30;

    gxOmitBitmapPositionXShift  = 6;
    gxOmitBitmapPositionYShift  = 4;

    gxOmitBitImageRowBytesMask  = $C0;
    gxOmitBitImageHeightMask    = $30;
    gxOmitBitImageDataMask      = $08;

    gxOmitBitImageRowBytesShift = 6;
    gxOmitBitImageHeightShift   = 4;
    gxOmitBitImageDataShift     = 3;

    gxCopyBitImageBytesOpcode   = $00;
    gxRepeatBitImageBytesOpcode = $40;
    gxLookupBitImageBytesOpcode = $80;
    gxRepeatBitImageScanOpcode  = $C0;

    gxOmitTextCharactersMask    = $C0;
    gxOmitTextPositionXMask     = $30;
    gxOmitTextPositionYMask     = $0C;
    gxOmitTextDataMask          = $02;

    gxOmitTextCharactersShift   = 6;
    gxOmitTextPositionXShift    = 4;
    gxOmitTextPositionYShift    = 2;
    gxOmitTextDataShift         = 1;

    gxOmitGlyphCharactersMask   = $C0;
    gxOmitGlyphLengthMask       = $30;
    gxOmitGlyphRunNumberMask    = $0C;
    gxOmitGlyphOnePositionMask  = $02;
    gxOmitGlyphDataMask         = $01;

    gxOmitGlyphCharactersShift  = 6;
    gxOmitGlyphLengthShift      = 4;
    gxOmitGlyphRunNumberShift   = 2;
    gxOmitGlyphOnePositionShift = 1;
    gxOmitGlyphDataShift        = 0;

    gxOmitGlyphPositionsMask    = $C0;
    gxOmitGlyphAdvancesMask     = $20;
    gxOmitGlyphTangentsMask     = $18;
    gxOmitGlyphRunsMask         = $04;
    gxOmitGlyphStylesMask       = $03;

    gxOmitGlyphPositionsShift   = 6;
    gxOmitGlyphAdvancesShift    = 5;
    gxOmitGlyphTangentsShift    = 3;
    gxOmitGlyphRunsShift        = 2;
    gxOmitGlyphStylesShift      = 0;

    gxOmitLayoutLengthMask      = $C0;
    gxOmitLayoutPositionXMask   = $30;
    gxOmitLayoutPositionYMask   = $0C;
    gxOmitLayoutDataMask        = $02;

    gxOmitLayoutLengthShift     = 6;
    gxOmitLayoutPositionXShift  = 4;
    gxOmitLayoutPositionYShift  = 2;
    gxOmitLayoutDataShift       = 1;

    gxOmitLayoutWidthMask       = $C0;
    gxOmitLayoutFlushMask       = $30;
    gxOmitLayoutJustMask        = $0C;
    gxOmitLayoutOptionsMask     = $03;

    gxOmitLayoutWidthShift      = 6;
    gxOmitLayoutFlushShift      = 4;
    gxOmitLayoutJustShift       = 2;
    gxOmitLayoutOptionsShift    = 0;

    gxOmitLayoutStyleRunNumberMask = $C0;
    gxOmitLayoutLevelRunNumberMask = $30;
    gxOmitLayoutHasBaselineMask = $08;
    gxOmitLayoutStyleRunsMask   = $04;
    gxOmitLayoutStylesMask      = $03;

    gxOmitLayoutStyleRunNumberShift = 6;
    gxOmitLayoutLevelRunNumberShift = 4;
    gxOmitLayoutHasBaselineShift = 3;
    gxOmitLayoutStyleRunsShift  = 2;
    gxOmitLayoutStylesShift     = 0;

    gxOmitLayoutLevelRunsMask   = $80;
    gxOmitLayoutLevelsMask      = $40;

    gxOmitLayoutLevelRunsShift  = 7;
    gxOmitLayoutLevelsShift     = 6;

    gxInkAttributesOpcode       = 0;
    gxInkTagOpcode              = 1;
    gxInkColorOpcode            = 2;
    gxInkTransferModeOpcode     = 3;

    gxOmitColorsSpaceMask       = $C0;
    gxOmitColorsProfileMask     = $30;
    gxOmitColorsComponentsMask  = $0F;
    gxOmitColorsIndexMask       = $0C;
    gxOmitColorsIndexSetMask    = $03;

    gxOmitColorsSpaceShift      = 6;
    gxOmitColorsProfileShift    = 4;
    gxOmitColorsComponentsShift = 0;
    gxOmitColorsIndexShift      = 2;
    gxOmitColorsIndexSetShift   = 0;

    gxOmitTransferSpaceMask     = $C0;
    gxOmitTransferSetMask       = $30;
    gxOmitTransferProfileMask   = $0C;

    gxOmitTransferSpaceShift    = 6;
    gxOmitTransferSetShift      = 4;
    gxOmitTransferProfileShift  = 2;

    gxOmitTransferSourceMatrixMask = $C0;
    gxOmitTransferDeviceMatrixMask = $30;
    gxOmitTransferResultMatrixMask = $0C;
    gxOmitTransferFlagsMask     = $03;

    gxOmitTransferSourceMatrixShift = 6;
    gxOmitTransferDeviceMatrixShift = 4;
    gxOmitTransferResultMatrixShift = 2;
    gxOmitTransferFlagsShift    = 0;

    gxOmitTransferComponentModeMask = $80;
    gxOmitTransferComponentFlagsMask = $40;
    gxOmitTransferComponentSourceMinimumMask = $30;
    gxOmitTransferComponentSourceMaximumMask = $0C;
    gxOmitTransferComponentDeviceMinimumMask = $03;

    gxOmitTransferComponentModeShift = 7;
    gxOmitTransferComponentFlagsShift = 6;
    gxOmitTransferComponentSourceMinimumShift = 4;
    gxOmitTransferComponentSourceMaximumShift = 2;
    gxOmitTransferComponentDeviceMinimumShift = 0;

    gxOmitTransferComponentDeviceMaximumMask = $C0;
    gxOmitTransferComponentClampMinimumMask = $30;
    gxOmitTransferComponentClampMaximumMask = $0C;
    gxOmitTransferComponentOperandMask = $03;

    gxOmitTransferComponentDeviceMaximumShift = 6;
    gxOmitTransferComponentClampMinimumShift = 4;
    gxOmitTransferComponentClampMaximumShift = 2;
    gxOmitTransferComponentOperandShift = 0;

    gxStyleAttributesOpcode     = 0;
    gxStyleTagOpcode            = 1;
    gxStyleCurveErrorOpcode     = 2;
    gxStylePenOpcode            = 3;
    gxStyleJoinOpcode           = 4;
    gxStyleDashOpcode           = 5;
    gxStyleCapsOpcode           = 6;
    gxStylePatternOpcode        = 7;
    gxStyleTextAttributesOpcode = 8;
    gxStyleTextSizeOpcode       = 9;
    gxStyleFontOpcode           = 10;
    gxStyleTextFaceOpcode       = 11;
    gxStylePlatformOpcode       = 12;
    gxStyleFontVariationsOpcode = 13;
    gxStyleRunControlsOpcode    = 14;
    gxStyleRunPriorityJustOverrideOpcode = 15;
    gxStyleRunGlyphJustOverridesOpcode = 16;
    gxStyleRunGlyphSubstitutionsOpcode = 17;
    gxStyleRunFeaturesOpcode    = 18;
    gxStyleRunKerningAdjustmentsOpcode = 19;
    gxStyleJustificationOpcode  = 20;

    gxOmitDashAttributesMask    = $C0;
    gxOmitDashShapeMask         = $30;
    gxOmitDashAdvanceMask       = $0C;
    gxOmitDashPhaseMask         = $03;

    gxOmitDashAttributesShift   = 6;
    gxOmitDashShapeShift        = 4;
    gxOmitDashAdvanceShift      = 2;
    gxOmitDashPhaseShift        = 0;

    gxOmitDashScaleMask         = $C0;

    gxOmitDashScaleShift        = 6;

    gxOmitPatternAttributesMask = $C0;
    gxOmitPatternShapeMask      = $30;
    gxOmitPatternUXMask         = $0C;
    gxOmitPatternUYMask         = $03;

    gxOmitPatternAttributesShift = 6;
    gxOmitPatternShapeShift     = 4;
    gxOmitPatternUXShift        = 2;
    gxOmitPatternUYShift        = 0;

    gxOmitPatternVXMask         = $C0;
    gxOmitPatternVYMask         = $30;

    gxOmitPatternVXShift        = 6;
    gxOmitPatternVYShift        = 4;

    gxOmitJoinAttributesMask    = $C0;
    gxOmitJoinShapeMask         = $30;
    gxOmitJoinMiterMask         = $0C;

    gxOmitJoinAttributesShift   = 6;
    gxOmitJoinShapeShift        = 4;
    gxOmitJoinMiterShift        = 2;

    gxOmitCapAttributesMask     = $C0;
    gxOmitCapStartShapeMask     = $30;
    gxOmitCapEndShapeMask       = $0C;

    gxOmitCapAttributesShift    = 6;
    gxOmitCapStartShapeShift    = 4;
    gxOmitCapEndShapeShift      = 2;

    gxOmitFaceLayersMask        = $C0;
    gxOmitFaceMappingMask       = $30;

    gxOmitFaceLayersShift       = 6;
    gxOmitFaceMappingShift      = 4;

    gxOmitFaceLayerFillMask     = $C0;
    gxOmitFaceLayerFlagsMask    = $30;
    gxOmitFaceLayerStyleMask    = $0C;
    gxOmitFaceLayerTransformMask = $03;

    gxOmitFaceLayerFillShift    = 6;
    gxOmitFaceLayerFlagsShift   = 4;
    gxOmitFaceLayerStyleShift   = 2;
    gxOmitFaceLayerTransformShift = 0;

    gxOmitFaceLayerBoldXMask    = $C0;
    gxOmitFaceLayerBoldYMask    = $30;

    gxOmitFaceLayerBoldXShift   = 6;
    gxOmitFaceLayerBoldYShift   = 4;

    gxColorSetReservedOpcode    = 0;
    gxColorSetTagOpcode         = 1;

    gxColorProfileReservedOpcode = 0;
    gxColorProfileTagOpcode     = 1;

    gxTransformReservedOpcode   = 0;
    gxTransformTagOpcode        = 1;
    gxTransformClipOpcode       = 2;
    gxTransformMappingOpcode    = 3;
    gxTransformPartMaskOpcode   = 4;
    gxTransformToleranceOpcode  = 5;

    gxTypeOpcode                = 0;
    gxSizeOpcode                = 1;

    {    used by currentOperand when currentOperation is gxNextOpcode   }
    {       format of top byte:
    xx yyyyyy   xx == 0x00, 0x40, 0x80, 0xC0: defines graphics operation (see gxGraphicsOperationOpcode)
                yyyyyy == size of operation in bytes
                if (yyyyyy == 0), byte size follows. If byte following == 0, word size follows; if == 0, long follows
                word and long, if present, are specified in high-endian order (first byte is largest magnitude)

    format of byte following size specifiers, if any:
    xx yyyyyy   xx == 0x00, 0x40, 0x80, 0xC0: defines compression level (0 == none, 0xC0 == most)
                exact method of compression is defined by type of data
                yyyyyy == data type selector (0 to 63): see gxGraphicsNewOpcode, __DataOpcode
        }
    gxOpcodeShift               = 6;
    gxObjectSizeMask            = $3F;
    gxCompressionShift          = 6;
    gxObjectTypeMask            = $3F;
    gxBitImageOpcodeMask        = $C0;
    gxBitImageCountMask         = $3F;
    gxBitImageOpcodeShift       = 6;

    gxNoCompression             = 0;
    gxWordCompression           = 1;
    gxByteCompression           = 2;
    gxOmitCompression           = 3;
    gxCompressionMask           = $03;

    {       the following structures define how primitives without a public geometry
        are stored (their format mirrors that of the New call to create them)       }

type
    gxFlatFontNamePtr = ^gxFlatFontName;
    gxFlatFontName = record
        name:                   SInt8;                                  {  gxFontName  }
        platform:               SInt8;                                  {  gxFontPlatform  }
        script:                 SInt8;                                  {  gxFontScript  }
        language:               SInt8;                                  {  gxFontLanguage  }
        length:                 SInt16;                             {  byte length  }
    end;


const
    gxFlatFontListItemTag       = $666C7374 (* 'flst' *);


type
    gxFlatFontListItemPtr = ^gxFlatFontListItem;
    gxFlatFontListItem = record
        fontID:                 gxFont;                                 { ** if we get rid of this, remove #include "font types.h", above  }
        name:                   SInt8;                                  {  gxFontName  }
        platform:               SInt8;                                  {  gxFontPlatform  }
        script:                 SInt8;                                  {  gxFontScript  }
        language:               SInt8;                                  {  gxFontLanguage  }
        length:                 SInt16;                             {  byte length of the name that follows  }
        glyphCount:             UInt16;                                 {  CountFontGlyphs or 0 if gxFontGlyphsFlatten is false  }
        axisCount:              UInt16;                                 {  CountFontVariations or 0 if gxFontVariationsFlatten is false  }
        variationCount:         UInt16;                                 {  number of bitsVariationPairs that follow the (optional) glyphBits  }
    end;

    gxFlatFontListPtr = ^gxFlatFontList;
    gxFlatFontList = record
        count:                  SInt32;
        items:                  array [0..0] of gxFlatFontListItem;
    end;

    gxFlattenHeaderPtr = ^gxFlattenHeader;
    gxFlattenHeader = record
        version:                Fixed;
        flatFlags:              SInt8;
        padding:                SInt8;
    end;


const
    gxOmitPictureShapeMask      = $C0;
    gxOmitOverrideStyleMask     = $30;
    gxOmitOverrideInkMask       = $0C;
    gxOmitOverrideTransformMask = $03;

    gxOmitPictureShapeShift     = $06;
    gxOmitOverrideStyleShift    = $04;
    gxOmitOverrideInkShift      = $02;
    gxOmitOverrideTransformShift = $00;

    gxPostScriptTag             = $706F7374 (* 'post' *);
    gxPostControlTag            = $70736374 (* 'psct' *);

    gxNoSave                    = 1;                            {  don't do save-restore around PS data  }
    gxPSContinueNext            = 2;                            {  next shape is continuation of this shape's PS -- only obeyed if gxNoSave is true  }


type
    gxPostControlPtr = ^gxPostControl;
    gxPostControl = record
        flags:                  SInt32;                             {  PostScript state flags  }
    end;


const
    gxDashSynonymTag            = $73647368 (* 'sdsh' *);


type
    gxDashSynonymPtr = ^gxDashSynonym;
    gxDashSynonym = record
        size:                   SInt32;                             {  number of elements in array  }
        dashLength:             array [0..0] of Fixed;                  {  Array of dash lengths  }
    end;


const
    gxLineCapSynonymTag         = $6C636170 (* 'lcap' *);

    gxButtCap                   = 0;
    gxRoundCap                  = 1;
    gxSquareCap                 = 2;
    gxTriangleCap               = 3;

    {    gxLine cap type    }

type
    gxLineCapSynonym                    = SInt32;

const
    gxCubicSynonymTag           = $63756278 (* 'cubx' *);

    gxIgnoreFlag                = $0000;                        {  Ignore this word, get next one  }
    gxLineToFlag                = $0001;                        {  Draw a gxLine to gxPoint following this flag  }
    gxCurveToFlag               = $0002;                        {  Draw a gxCurve through the 3 points following this flag  }
    gxMoveToFlag                = $0003;                        {  Start a new contour at the gxPoint following this flag  }
    gxClosePathFlag             = $0004;                        {  Close the contour  }


type
    gxCubicSynonym                      = SInt32;

const
    gxCubicInstructionMask      = $000F;                        {  low four bits are gxPoint instructions  }

    {    Low four bits are instruction (moveto, lineto, curveto, closepath)     }

type
    gxCubicSynonymFlags                 = SInt16;

const
    gxPatternSynonymTag         = $7074726E (* 'ptrn' *);

    gxHatch                     = 0;
    gxCrossHatch                = 1;


type
    gxPatternSynonymPtr = ^gxPatternSynonym;
    gxPatternSynonym = record
        patternType:            SInt32;                             {  one of the gxPatterns: gxHatch or gxCrossHatch  }
        angle:                  Fixed;                                  {  angle at which pattern is drawn  }
        spacing:                Fixed;                                  {  distance between two parallel pattern lines  }
        thickness:              Fixed;                                  {  thickness of the pattern  }
        anchorPoint:            gxPoint;                                {  gxPoint with with respect to which pattern position is calculated  }
    end;


const
    gxURLTag                    = $75726C74 (* 'urlt' *);

{$ALIGN MAC68K}
{#POP}
{unit GestaltEqu}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}




type
    SelectorFunctionProcPtr = function(selector: OSType; var response: SInt32): OSErr;

    SelectorFunctionUPP = ^SInt32; { an opaque UPP }
    {
     *  Gestalt()
     *
     *  Availability:
     *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function Gestalt(selector: OSType; var response: SInt32): OSErr; external name '_Gestalt';
{
 *  ReplaceGestalt()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ReplaceGestalt(selector: OSType; gestaltFunction: SelectorFunctionUPP; var oldGestaltFunction: SelectorFunctionUPP): OSErr; external name '_ReplaceGestalt';
{
 *  NewGestalt()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewGestalt(selector: OSType; gestaltFunction: SelectorFunctionUPP): OSErr; external name '_NewGestalt';
{   The GestaltValue functions are available in System 7.5 and later }

{
 *  NewGestaltValue()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewGestaltValue(selector: OSType; newValue: SInt32): OSErr; external name '_NewGestaltValue';
{
 *  ReplaceGestaltValue()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ReplaceGestaltValue(selector: OSType; replacementValue: SInt32): OSErr; external name '_ReplaceGestaltValue';
{
 *  SetGestaltValue()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetGestaltValue(selector: OSType; newValue: SInt32): OSErr; external name '_SetGestaltValue';
{
 *  DeleteGestaltValue()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DeleteGestaltValue(selector: OSType): OSErr; external name '_DeleteGestaltValue';
const
    uppSelectorFunctionProcInfo = $000003E0;
    {
     *  NewSelectorFunctionUPP()
     *
     *  Availability:
     *    Non-Carbon CFM:   available as macro/inline
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function NewSelectorFunctionUPP(userRoutine: SelectorFunctionProcPtr): SelectorFunctionUPP; external name '_NewSelectorFunctionUPP'; { old name was NewSelectorFunctionProc }
{
 *  DisposeSelectorFunctionUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeSelectorFunctionUPP(userUPP: SelectorFunctionUPP); external name '_DisposeSelectorFunctionUPP';
{
 *  InvokeSelectorFunctionUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeSelectorFunctionUPP(selector: OSType; var response: SInt32; userRoutine: SelectorFunctionUPP): OSErr; external name '_InvokeSelectorFunctionUPP'; { old name was CallSelectorFunctionProc }
{ Environment Selectors }

const
    gestaltAddressingModeAttr   = $61646472 (* 'addr' *);                       {  addressing mode attributes  }
    gestalt32BitAddressing      = 0;                            {  using 32-bit addressing mode  }
    gestalt32BitSysZone         = 1;                            {  32-bit compatible system zone  }
    gestalt32BitCapable         = 2;                            {  Machine is 32-bit capable  }

    gestaltAFPClient            = $61667073 (* 'afps' *);
    gestaltAFPClientVersionMask = $0000FFFF;                    {  low word of long is the  }
                                                                {  client version 0x0001 -> 0x0007 }
    gestaltAFPClient3_5         = $0001;
    gestaltAFPClient3_6         = $0002;
    gestaltAFPClient3_6_1       = $0003;
    gestaltAFPClient3_6_2       = $0004;
    gestaltAFPClient3_6_3       = $0005;                        {  including 3.6.4, 3.6.5 }
    gestaltAFPClient3_7         = $0006;                        {  including 3.7.1 }
    gestaltAFPClient3_7_2       = $0007;                        {  including 3.7.3, 3.7.4 }
    gestaltAFPClient3_8         = $0008;
    gestaltAFPClient3_8_1       = $0009;                        {  including 3.8.2  }
    gestaltAFPClient3_8_3       = $000A;
    gestaltAFPClient3_8_4       = $000B;                        {  including 3.8.5, 3.8.6  }
    gestaltAFPClientAttributeMask = $FFFF0000;                  {  high word of long is a  }
                                                                {  set of attribute bits }
    gestaltAFPClientCfgRsrc     = 16;                           {  Client uses config resources }
    gestaltAFPClientSupportsIP  = 29;                           {  Client supports AFP over TCP/IP }
    gestaltAFPClientVMUI        = 30;                           {  Client can put up UI from the PBVolMount trap }
    gestaltAFPClientMultiReq    = 31;                           {  Client supports multiple outstanding requests }


    gestaltAliasMgrAttr         = $616C6973 (* 'alis' *);                       {  Alias Mgr Attributes  }
    gestaltAliasMgrPresent      = 0;                            {  True if the Alias Mgr is present  }
    gestaltAliasMgrSupportsRemoteAppletalk = 1;                 {  True if the Alias Mgr knows about Remote Appletalk  }
    gestaltAliasMgrSupportsAOCEKeychain = 2;                    {  True if the Alias Mgr knows about the AOCE Keychain  }
    gestaltAliasMgrResolveAliasFileWithMountOptions = 3;        {  True if the Alias Mgr implements gestaltAliasMgrResolveAliasFileWithMountOptions() and IsAliasFile()  }
    gestaltAliasMgrFollowsAliasesWhenResolving = 4;
    gestaltAliasMgrSupportsExtendedCalls = 5;
    gestaltAliasMgrSupportsFSCalls = 6;                         {  true if Alias Mgr supports HFS+ Calls  }

    {    Gestalt selector and values for the Appearance Manager     }
    gestaltAppearanceAttr       = $61707072 (* 'appr' *);
    gestaltAppearanceExists     = 0;
    gestaltAppearanceCompatMode = 1;

    {    Gestalt selector for determining Appearance Manager version    }
    {    If this selector does not exist, but gestaltAppearanceAttr     }
    {    does, it indicates that the 1.0 version is installed. This     }
    {    gestalt returns a BCD number representing the version of the   }
    {    Appearance Manager that is currently running, e.g. 0x0101 for  }
    {    version 1.0.1.                                                 }
    gestaltAppearanceVersion    = $61707672 (* 'apvr' *);

    gestaltArbitorAttr          = $61726220 (* 'arb ' *);
    gestaltSerialArbitrationExists = 0;                         {  this bit if the serial port arbitrator exists }

    gestaltAppleScriptVersion   = $61736376 (* 'ascv' *);                       {  AppleScript version }

    gestaltAppleScriptAttr      = $61736372 (* 'ascr' *);                       {  AppleScript attributes }
    gestaltAppleScriptPresent   = 0;
    gestaltAppleScriptPowerPCSupport = 1;

    gestaltATAAttr              = $61746120 (* 'ata ' *);                       {  ATA is the driver to support IDE hard disks  }
    gestaltATAPresent           = 0;                            {  if set, ATA Manager is present  }

    gestaltATalkVersion         = $61746B76 (* 'atkv' *);                       {  Detailed AppleTalk version; see comment above for format  }

    gestaltAppleTalkVersion     = $61746C6B (* 'atlk' *);                       {  appletalk version  }

    {
        FORMAT of gestaltATalkVersion RESPONSE
        --------------------------------------
        The version is stored in the high three bytes of the response value.  Let us number
        the bytes in the response value from 0 to 3, where 0 is the least-significant byte.

            Byte#:     3 2 1 0
            Value:  0xMMNNRR00

        Byte 3 (MM) contains the major revision number, byte 2 (NN) contains the minor
        revision number, and byte 1 (RR) contains a constant that represents the release
        stage.  Byte 0 always contains 0x00.  The constants for the release stages are:

            development = 0x20
            alpha       = 0x40
            beta        = 0x60
            final       = 0x80
            release     = 0x80

        For example, if you call Gestalt with the 'atkv' selector when AppleTalk version 57
        is loaded, you receive the long SInt16 response value 0x39008000.
        }
    gestaltAUXVersion           = $612F7578 (* 'a/ux' *);                       {  a/ux version, if present  }

    gestaltMacOSCompatibilityBoxAttr = $62626F78 (* 'bbox' *);                  {  Classic presence and features  }
    gestaltMacOSCompatibilityBoxPresent = 0;                    {  True if running under the Classic  }
    gestaltMacOSCompatibilityBoxHasSerial = 1;                  {  True if Classic serial support is implemented.  }
    gestaltMacOSCompatibilityBoxless = 2;                       {  True if we're Boxless (screen shared with Carbon/Cocoa)  }

    gestaltBusClkSpeed          = $62636C6B (* 'bclk' *);                       {  main I/O bus clock speed in hertz  }

    gestaltCloseViewAttr        = $42534461 (* 'BSDa' *);                       {  CloseView attributes  }
    gestaltCloseViewEnabled     = 0;                            {  Closeview enabled (dynamic bit - returns current state)  }
    gestaltCloseViewDisplayMgrFriendly = 1;                     {  Closeview compatible with Display Manager (FUTURE)  }

    gestaltCarbonVersion        = $63626F6E (* 'cbon' *);                       {  version of Carbon API present in system  }

    gestaltCFMAttr              = $63667267 (* 'cfrg' *);                       {  Selector for information about the Code Fragment Manager  }
    gestaltCFMPresent           = 0;                            {  True if the Code Fragment Manager is present  }
    gestaltCFMPresentMask       = $0001;
    gestaltCFM99Present         = 2;                            {  True if the CFM-99 features are present.  }
    gestaltCFM99PresentMask     = $0004;

    gestaltCollectionMgrVersion = $636C746E (* 'cltn' *);                       {  Collection Manager version  }

    gestaltColorMatchingAttr    = $636D7461 (* 'cmta' *);                       {  ColorSync attributes  }
    gestaltHighLevelMatching    = 0;
    gestaltColorMatchingLibLoaded = 1;

    gestaltColorMatchingVersion = $636D7463 (* 'cmtc' *);
    gestaltColorSync10          = $0100;                        {  0x0100 & 0x0110 _Gestalt versions for 1.0-1.0.3 product  }
    gestaltColorSync11          = $0110;                        {    0x0100 == low-level matching only  }
    gestaltColorSync104         = $0104;                        {  Real version, by popular demand  }
    gestaltColorSync105         = $0105;
    gestaltColorSync20          = $0200;                        {  ColorSync 2.0  }
    gestaltColorSync21          = $0210;
    gestaltColorSync211         = $0211;
    gestaltColorSync212         = $0212;
    gestaltColorSync213         = $0213;
    gestaltColorSync25          = $0250;
    gestaltColorSync26          = $0260;
    gestaltColorSync261         = $0261;
    gestaltColorSync30          = $0300;

    gestaltControlMgrVersion    = $636D7672 (* 'cmvr' *);                       {  NOTE: The first version we return is 3.0.1, on Mac OS X plus update 2 }

    gestaltControlMgrAttr       = $636E746C (* 'cntl' *);                       {  Control Mgr }
    gestaltControlMgrPresent    = $00000001;                    {  NOTE: this is a bit mask, whereas all other Gestalt constants of }
                                                                {  this type are bit index values.   Universal Interfaces 3.2 slipped }
                                                                {  out the door with this mistake. }
    gestaltControlMgrPresentBit = 0;                            {  bit number }
    gestaltControlMsgPresentMask = $00000001;

    gestaltConnMgrAttr          = $636F6E6E (* 'conn' *);                       {  connection mgr attributes     }
    gestaltConnMgrPresent       = 0;
    gestaltConnMgrCMSearchFix   = 1;                            {  Fix to CMAddSearch?      }
    gestaltConnMgrErrorString   = 2;                            {  has CMGetErrorString()  }
    gestaltConnMgrMultiAsyncIO  = 3;                            {  CMNewIOPB, CMDisposeIOPB, CMPBRead, CMPBWrite, CMPBIOKill  }

    gestaltColorPickerVersion   = $63706B72 (* 'cpkr' *);                       {  returns version of ColorPicker  }
    gestaltColorPicker          = $63706B72 (* 'cpkr' *);                       {  gestaltColorPicker is old name for gestaltColorPickerVersion  }

    gestaltComponentMgr         = $63706E74 (* 'cpnt' *);                       {  Component Mgr version  }
    gestaltComponentPlatform    = $636F706C (* 'copl' *);                       {  Component Platform number  }

    {
        The gestaltNativeCPUtype ('cput') selector can be used to determine the
        native CPU type for all Macs running System 7.5 or later.

        The 'cput' selector is not available when running System 7.0 (or earlier)
        on most 68K machines.  If 'cput' is not available, then the 'proc' selector
        should be used to determine the processor type.

        An application should always try the 'cput' selector first.  This is because,
        on PowerPC machines, the 'proc' selector will reflect the CPU type of the
        emulator's "virtual processor" rather than the native CPU type.

        The values specified below are accurate.  Prior versions of the Gestalt
        interface file contained values that were off by one.

        The Quadra 840AV and the Quadra 660AV contain a bug in the ROM code that
        causes the 'cput' selector to respond with the value 5.  This behavior
        occurs only when running System 7.1.  System 7.5 fixes the bug by replacing
        the faulty 'cput' selector function with the correct one.

        The gestaltNativeCPUfamily ('cpuf') selector can be used to determine the
        general family the native CPU is in. This can be helpful for determing how
        blitters and things should be written. In general, it is smarter to use this
        selector (when available) than gestaltNativeCPUtype since newer processors
        in the same family can be handled without revising your code.

        gestaltNativeCPUfamily uses the same results as gestaltNativeCPUtype, but
        will only return certain CPU values.
        }
    gestaltNativeCPUtype        = $63707574 (* 'cput' *);                       {  Native CPU type                           }
    gestaltNativeCPUfamily      = $63707566 (* 'cpuf' *);                       {  Native CPU family                       }
    gestaltCPU68000             = 0;                            {  Various 68k CPUs...     }
    gestaltCPU68010             = 1;
    gestaltCPU68020             = 2;
    gestaltCPU68030             = 3;
    gestaltCPU68040             = 4;
    gestaltCPU601               = $0101;                        {  IBM 601                                }
    gestaltCPU603               = $0103;
    gestaltCPU604               = $0104;
    gestaltCPU603e              = $0106;
    gestaltCPU603ev             = $0107;
    gestaltCPU750               = $0108;                        {  Also 740 - "G3"  }
    gestaltCPU604e              = $0109;
    gestaltCPU604ev             = $010A;                        {  Mach 5, 250Mhz and up  }
    gestaltCPUG4                = $010C;                        {  Max  }
    gestaltCPUG47450            = $0110;                        {  Vger , Altivec  }


    gestaltCRMAttr              = $63726D20 (* 'crm ' *);                       {  comm resource mgr attributes  }
    gestaltCRMPresent           = 0;
    gestaltCRMPersistentFix     = 1;                            {  fix for persistent tools  }
    gestaltCRMToolRsrcCalls     = 2;                            {  has CRMGetToolResource/ReleaseToolResource  }

    gestaltControlStripVersion  = $63737672 (* 'csvr' *);                       {  Control Strip version (was 'sdvr')  }

    gestaltCTBVersion           = $63746276 (* 'ctbv' *);                       {  CommToolbox version  }

    gestaltDBAccessMgrAttr      = $64626163 (* 'dbac' *);                       {  Database Access Mgr attributes  }
    gestaltDBAccessMgrPresent   = 0;                            {  True if Database Access Mgr present  }

    gestaltDiskCacheSize        = $6463737A (* 'dcsz' *);                       {  Size of disk cache's buffers, in bytes  }

    gestaltSDPFindVersion       = $64666E64 (* 'dfnd' *);                       {  OCE Standard Directory Panel }

    gestaltDictionaryMgrAttr    = $64696374 (* 'dict' *);                       {  Dictionary Manager attributes  }
    gestaltDictionaryMgrPresent = 0;                            {  Dictionary Manager attributes  }

    gestaltDITLExtAttr          = $6469746C (* 'ditl' *);                       {  AppenDITL, etc. calls from CTB  }
    gestaltDITLExtPresent       = 0;                            {  True if calls are present  }
    gestaltDITLExtSupportsIctb  = 1;                            {  True if AppendDITL, ShortenDITL support 'ictb's  }

    gestaltDialogMgrAttr        = $646C6F67 (* 'dlog' *);                       {  Dialog Mgr }
    gestaltDialogMgrPresent     = $00000001;                    {  NOTE: this is a bit mask, whereas all other Gestalt constants of }
                                                                {  this type are bit index values.   Universal Interfaces 3.2 slipped }
                                                                {  out the door with this mistake. }
    gestaltDialogMgrPresentBit  = 0;                            {  bit number }
    gestaltDialogMgrHasAquaAlertBit = 2;                        {  bit number }
    gestaltDialogMgrPresentMask = $00000001;
    gestaltDialogMgrHasAquaAlertMask = $00000004;
    gestaltDialogMsgPresentMask = $00000001;                    {  compatibility mask }

    gestaltDesktopPicturesAttr  = $646B7078 (* 'dkpx' *);                       {  Desktop Pictures attributes  }
    gestaltDesktopPicturesInstalled = 0;                        {  True if control panel is installed  }
    gestaltDesktopPicturesDisplayed = 1;                        {  True if a picture is currently displayed  }

    gestaltDisplayMgrVers       = $64706C76 (* 'dplv' *);                       {  Display Manager version  }

    gestaltDisplayMgrAttr       = $64706C79 (* 'dply' *);                       {  Display Manager attributes  }
    gestaltDisplayMgrPresent    = 0;                            {  True if Display Mgr is present  }
    gestaltDisplayMgrCanSwitchMirrored = 2;                     {  True if Display Mgr can switch modes on mirrored displays  }
    gestaltDisplayMgrSetDepthNotifies = 3;                      {  True SetDepth generates displays mgr notification  }
    gestaltDisplayMgrCanConfirm = 4;                            {  True Display Manager supports DMConfirmConfiguration  }
    gestaltDisplayMgrColorSyncAware = 5;                        {  True if Display Manager supports profiles for displays  }
    gestaltDisplayMgrGeneratesProfiles = 6;                     {  True if Display Manager will automatically generate profiles for displays  }

    gestaltDragMgrAttr          = $64726167 (* 'drag' *);                       {  Drag Manager attributes  }
    gestaltDragMgrPresent       = 0;                            {  Drag Manager is present  }
    gestaltDragMgrFloatingWind  = 1;                            {  Drag Manager supports floating windows  }
    gestaltPPCDragLibPresent    = 2;                            {  Drag Manager PPC DragLib is present  }
    gestaltDragMgrHasImageSupport = 3;                          {  Drag Manager allows SetDragImage call  }
    gestaltCanStartDragInFloatWindow = 4;                       {  Drag Manager supports starting a drag in a floating window  }
    gestaltSetDragImageUpdates  = 5;                            {  Drag Manager supports drag image updating via SetDragImage  }

    gestaltDrawSprocketVersion  = $64737076 (* 'dspv' *);                       {  Draw Sprocket version (as a NumVersion)  }

    gestaltDigitalSignatureVersion = $64736967 (* 'dsig' *);                    {  returns Digital Signature Toolbox version in low-order word }

    {
       Desktop Printing Feature Gestalt
       Use this gestalt to check if third-party printer driver support is available
    }
    gestaltDTPFeatures          = $64747066 (* 'dtpf' *);
    kDTPThirdPartySupported     = $00000004;                    {  mask for checking if third-party drivers are supported }


    {
       Desktop Printer Info Gestalt
       Use this gestalt to get a hold of information for all of the active desktop printers
    }
    gestaltDTPInfo              = $64747078 (* 'dtpx' *);                       {  returns GestaltDTPInfoHdle }

    gestaltEasyAccessAttr       = $65617379 (* 'easy' *);                       {  Easy Access attributes  }
    gestaltEasyAccessOff        = 0;                            {  if Easy Access present, but off (no icon)  }
    gestaltEasyAccessOn         = 1;                            {  if Easy Access "On"  }
    gestaltEasyAccessSticky     = 2;                            {  if Easy Access "Sticky"  }
    gestaltEasyAccessLocked     = 3;                            {  if Easy Access "Locked"  }

    gestaltEditionMgrAttr       = $6564746E (* 'edtn' *);                       {  Edition Mgr attributes  }
    gestaltEditionMgrPresent    = 0;                            {  True if Edition Mgr present  }
    gestaltEditionMgrTranslationAware = 1;                      {  True if edition manager is translation manager aware  }

    gestaltAppleEventsAttr      = $65766E74 (* 'evnt' *);                       {  Apple Events attributes  }
    gestaltAppleEventsPresent   = 0;                            {  True if Apple Events present  }
    gestaltScriptingSupport     = 1;
    gestaltOSLInSystem          = 2;                            {  OSL is in system so donÕt use the one linked in to app  }
    gestaltSupportsApplicationURL = 4;                          {  Supports the typeApplicationURL addressing mode  }

    gestaltExtensionTableVersion = $6574626C (* 'etbl' *);                      {  ExtensionTable version  }


    gestaltFBCIndexingState     = $66626369 (* 'fbci' *);                       {  Find By Content indexing state }
    gestaltFBCindexingSafe      = 0;                            {  any search will result in synchronous wait }
    gestaltFBCindexingCritical  = 1;                            {  any search will execute immediately }

    gestaltFBCVersion           = $66626376 (* 'fbcv' *);                       {  Find By Content version }
    gestaltFBCCurrentVersion    = $0011;                        {  First release for OS 8/9 }
    gestaltOSXFBCCurrentVersion = $0100;                        {  First release for OS X }


    gestaltFileMappingAttr      = $666C6D70 (* 'flmp' *);                       {  File mapping attributes }
    gestaltFileMappingPresent   = 0;                            {  bit is set if file mapping APIs are present }
    gestaltFileMappingMultipleFilesFix = 1;                     {  bit is set if multiple files per volume can be mapped }

    gestaltFloppyAttr           = $666C7079 (* 'flpy' *);                       {  Floppy disk drive/driver attributes  }
    gestaltFloppyIsMFMOnly      = 0;                            {  Floppy driver only supports MFM disk formats  }
    gestaltFloppyIsManualEject  = 1;                            {  Floppy drive, driver, and file system are in manual-eject mode  }
    gestaltFloppyUsesDiskInPlace = 2;                           {  Floppy drive must have special DISK-IN-PLACE output; standard DISK-CHANGED not used  }

    gestaltFinderAttr           = $666E6472 (* 'fndr' *);                       {  Finder attributes  }
    gestaltFinderDropEvent      = 0;                            {  Finder recognizes drop event  }
    gestaltFinderMagicPlacement = 1;                            {  Finder supports magic icon placement  }
    gestaltFinderCallsAEProcess = 2;                            {  Finder calls AEProcessAppleEvent  }
    gestaltOSLCompliantFinder   = 3;                            {  Finder is scriptable and recordable  }
    gestaltFinderSupports4GBVolumes = 4;                        {  Finder correctly handles 4GB volumes  }
    gestaltFinderHasClippings   = 6;                            {  Finder supports Drag Manager clipping files  }
    gestaltFinderFullDragManagerSupport = 7;                    {  Finder accepts 'hfs ' flavors properly  }
    gestaltFinderFloppyRootComments = 8;                        {  in MacOS 8 and later, will be set if Finder ever supports comments on Floppy icons  }
    gestaltFinderLargeAndNotSavedFlavorsOK = 9;                 {  in MacOS 8 and later, this bit is set if drags with >1024-byte flavors and flavorNotSaved flavors work reliably  }
    gestaltFinderUsesExtensibleFolderManager = 10;              {  Finder uses Extensible Folder Manager (for example, for Magic Routing)  }
    gestaltFinderUnderstandsRedirectedDesktopFolder = 11;       {  Finder deals with startup disk's desktop folder residing on another disk  }

    gestaltFindFolderAttr       = $666F6C64 (* 'fold' *);                       {  Folder Mgr attributes  }
    gestaltFindFolderPresent    = 0;                            {  True if Folder Mgr present  }
    gestaltFolderDescSupport    = 1;                            {  True if Folder Mgr has FolderDesc calls  }
    gestaltFolderMgrFollowsAliasesWhenResolving = 2;            {  True if Folder Mgr follows folder aliases  }
    gestaltFolderMgrSupportsExtendedCalls = 3;                  {  True if Folder Mgr supports the Extended calls  }
    gestaltFolderMgrSupportsDomains = 4;                        {  True if Folder Mgr supports domains for the first parameter to FindFolder  }
    gestaltFolderMgrSupportsFSCalls = 5;                        {  True if FOlder manager supports __FindFolderFSRef & __FindFolderExtendedFSRef  }

    gestaltFindFolderRedirectionAttr = $666F6C65 (* 'fole' *);


    gestaltFontMgrAttr          = $666F6E74 (* 'font' *);                       {  Font Mgr attributes  }
    gestaltOutlineFonts         = 0;                            {  True if Outline Fonts supported  }

    gestaltFPUType              = $66707520 (* 'fpu ' *);                       {  fpu type  }
    gestaltNoFPU                = 0;                            {  no FPU  }
    gestalt68881                = 1;                            {  68881 FPU  }
    gestalt68882                = 2;                            {  68882 FPU  }
    gestalt68040FPU             = 3;                            {  68040 built-in FPU  }

    gestaltFSAttr               = $66732020 (* 'fs  ' *);                       {  file system attributes  }
    gestaltFullExtFSDispatching = 0;                            {  has really cool new HFSDispatch dispatcher  }
    gestaltHasFSSpecCalls       = 1;                            {  has FSSpec calls  }
    gestaltHasFileSystemManager = 2;                            {  has a file system manager  }
    gestaltFSMDoesDynamicLoad   = 3;                            {  file system manager supports dynamic loading  }
    gestaltFSSupports4GBVols    = 4;                            {  file system supports 4 gigabyte volumes  }
    gestaltFSSupports2TBVols    = 5;                            {  file system supports 2 terabyte volumes  }
    gestaltHasExtendedDiskInit  = 6;                            {  has extended Disk Initialization calls  }
    gestaltDTMgrSupportsFSM     = 7;                            {  Desktop Manager support FSM-based foreign file systems  }
    gestaltFSNoMFSVols          = 8;                            {  file system doesn't supports MFS volumes  }
    gestaltFSSupportsHFSPlusVols = 9;                           {  file system supports HFS Plus volumes  }
    gestaltFSIncompatibleDFA82  = 10;                           {  VCB and FCB structures changed; DFA 8.2 is incompatible  }

    gestaltHasHFSPlusAPIs       = 12;                           {  file system supports HFS Plus APIs  }
    gestaltMustUseFCBAccessors  = 13;                           {  FCBSPtr and FSFCBLen are invalid - must use FSM FCB accessor functions }
    gestaltFSUsesPOSIXPathsForConversion = 14;                  {  The path interchange routines operate on POSIX paths instead of HFS paths  }

    gestaltAdminFeaturesFlagsAttr = $66726564 (* 'fred' *);                     {  a set of admin flags, mostly useful internally.  }
    gestaltFinderUsesSpecialOpenFoldersFile = 0;                {  the Finder uses a special file to store the list of open folders  }

    gestaltFSMVersion           = $66736D20 (* 'fsm ' *);                       {  returns version of HFS External File Systems Manager (FSM)  }

    gestaltFXfrMgrAttr          = $66786672 (* 'fxfr' *);                       {  file transfer manager attributes  }
    gestaltFXfrMgrPresent       = 0;
    gestaltFXfrMgrMultiFile     = 1;                            {  supports FTSend and FTReceive  }
    gestaltFXfrMgrErrorString   = 2;                            {  supports FTGetErrorString  }
    gestaltFXfrMgrAsync         = 3;                            { supports FTSendAsync, FTReceiveAsync, FTCompletionAsync }

    gestaltGraphicsAttr         = $67667861 (* 'gfxa' *);                       {  Quickdraw GX attributes selector  }
    gestaltGraphicsIsDebugging  = $00000001;
    gestaltGraphicsIsLoaded     = $00000002;
    gestaltGraphicsIsPowerPC    = $00000004;

    gestaltGraphicsVersion      = $67726678 (* 'grfx' *);                       {  Quickdraw GX version selector  }
    gestaltCurrentGraphicsVersion = $00010200;                  {  the version described in this set of headers  }

    gestaltHardwareAttr         = $68647772 (* 'hdwr' *);                       {  hardware attributes  }
    gestaltHasVIA1              = 0;                            {  VIA1 exists  }
    gestaltHasVIA2              = 1;                            {  VIA2 exists  }
    gestaltHasASC               = 3;                            {  Apple Sound Chip exists  }
    gestaltHasSCC               = 4;                            {  SCC exists  }
    gestaltHasSCSI              = 7;                            {  SCSI exists  }
    gestaltHasSoftPowerOff      = 19;                           {  Capable of software power off  }
    gestaltHasSCSI961           = 21;                           {  53C96 SCSI controller on internal bus  }
    gestaltHasSCSI962           = 22;                           {  53C96 SCSI controller on external bus  }
    gestaltHasUniversalROM      = 24;                           {  Do we have a Universal ROM?  }
    gestaltHasEnhancedLtalk     = 30;                           {  Do we have Enhanced LocalTalk?  }

    gestaltHelpMgrAttr          = $68656C70 (* 'help' *);                       {  Help Mgr Attributes  }
    gestaltHelpMgrPresent       = 0;                            {  true if help mgr is present  }
    gestaltHelpMgrExtensions    = 1;                            {  true if help mgr extensions are installed  }
    gestaltAppleGuideIsDebug    = 30;
    gestaltAppleGuidePresent    = 31;                           {  true if AppleGuide is installed  }

    gestaltHardwareVendorCode   = $68726164 (* 'hrad' *);                       {  Returns hardware vendor information  }
    gestaltHardwareVendorApple  = $4170706C (* 'Appl' *);                       {  Hardware built by Apple  }

    gestaltCompressionMgr       = $69636D70 (* 'icmp' *);                       {  returns version of the Image Compression Manager  }

    gestaltIconUtilitiesAttr    = $69636F6E (* 'icon' *);                       {  Icon Utilities attributes  (Note: available in System 7.0, despite gestalt)  }
    gestaltIconUtilitiesPresent = 0;                            {  true if icon utilities are present  }
    gestaltIconUtilitiesHas48PixelIcons = 1;                    {  true if 48x48 icons are supported by IconUtilities  }
    gestaltIconUtilitiesHas32BitIcons = 2;                      {  true if 32-bit deep icons are supported  }
    gestaltIconUtilitiesHas8BitDeepMasks = 3;                   {  true if 8-bit deep masks are supported  }
    gestaltIconUtilitiesHasIconServices = 4;                    {  true if IconServices is present  }

    gestaltInternalDisplay      = $69647370 (* 'idsp' *);                       {  slot number of internal display location  }

    {
        To obtain information about the connected keyboard(s), one should
        use the ADB Manager API.  See Technical Note OV16 for details.
        }
    gestaltKeyboardType         = $6B626420 (* 'kbd ' *);                       {  keyboard type  }
    gestaltMacKbd               = 1;
    gestaltMacAndPad            = 2;
    gestaltMacPlusKbd           = 3;
    gestaltExtADBKbd            = 4;
    gestaltStdADBKbd            = 5;
    gestaltPrtblADBKbd          = 6;
    gestaltPrtblISOKbd          = 7;
    gestaltStdISOADBKbd         = 8;
    gestaltExtISOADBKbd         = 9;
    gestaltADBKbdII             = 10;
    gestaltADBISOKbdII          = 11;
    gestaltPwrBookADBKbd        = 12;
    gestaltPwrBookISOADBKbd     = 13;
    gestaltAppleAdjustKeypad    = 14;
    gestaltAppleAdjustADBKbd    = 15;
    gestaltAppleAdjustISOKbd    = 16;
    gestaltJapanAdjustADBKbd    = 17;                           {  Japan Adjustable Keyboard  }
    gestaltPwrBkExtISOKbd       = 20;                           {  PowerBook Extended International Keyboard with function keys  }
    gestaltPwrBkExtJISKbd       = 21;                           {  PowerBook Extended Japanese Keyboard with function keys       }
    gestaltPwrBkExtADBKbd       = 24;                           {  PowerBook Extended Domestic Keyboard with function keys       }
    gestaltPS2Keyboard          = 27;                           {  PS2 keyboard  }
    gestaltPwrBkSubDomKbd       = 28;                           {  PowerBook Subnote Domestic Keyboard with function keys w/  inverted T   }
    gestaltPwrBkSubISOKbd       = 29;                           {  PowerBook Subnote International Keyboard with function keys w/  inverted T      }
    gestaltPwrBkSubJISKbd       = 30;                           {  PowerBook Subnote Japanese Keyboard with function keys w/ inverted T     }
    gestaltPwrBkEKDomKbd        = 195;                          {  (0xC3) PowerBook Domestic Keyboard with Embedded Keypad, function keys & inverted T     }
    gestaltPwrBkEKISOKbd        = 196;                          {  (0xC4) PowerBook International Keyboard with Embedded Keypad, function keys & inverted T    }
    gestaltPwrBkEKJISKbd        = 197;                          {  (0xC5) PowerBook Japanese Keyboard with Embedded Keypad, function keys & inverted T       }
    gestaltUSBCosmoANSIKbd      = 198;                          {  (0xC6) original USB Domestic (ANSI) Keyboard  }
    gestaltUSBCosmoISOKbd       = 199;                          {  (0xC7) original USB International (ISO) Keyboard  }
    gestaltUSBCosmoJISKbd       = 200;                          {  (0xC8) original USB Japanese (JIS) Keyboard  }
    gestaltPwrBk99JISKbd        = 201;                          {  (0xC9) '99 PowerBook JIS Keyboard with Embedded Keypad, function keys & inverted T                }
    gestaltUSBAndyANSIKbd       = 204;                          {  (0xCC) USB Pro Keyboard Domestic (ANSI) Keyboard                                  }
    gestaltUSBAndyISOKbd        = 205;                          {  (0xCD) USB Pro Keyboard International (ISO) Keyboard                                }
    gestaltUSBAndyJISKbd        = 206;                          {  (0xCE) USB Pro Keyboard Japanese (JIS) Keyboard                                     }


    {
        This gestalt indicates the highest UDF version that the active UDF implementation supports.
        The value should be assembled from a read version (upper word) and a write version (lower word)
    }
    gestaltUDFSupport           = $6B756466 (* 'kudf' *);                       {     Used for communication between UDF implementations }

    gestaltLowMemorySize        = $6C6D656D (* 'lmem' *);                       {  size of low memory area  }

    gestaltLogicalRAMSize       = $6C72616D (* 'lram' *);                       {  logical ram size  }

    {
        MACHINE type CONSTANTS NAMING CONVENTION

            All future machine type constant names take the following form:

                gestalt<lineName><modelNumber>

        Line Names

            The following table contains the lines currently produced by Apple and the
            lineName substrings associated with them:

                Line                        lineName
                -------------------------   ------------
                Macintosh LC                "MacLC"
                Macintosh Performa          "Performa"
                Macintosh PowerBook         "PowerBook"
                Macintosh PowerBook Duo     "PowerBookDuo"
                Power Macintosh             "PowerMac"
                Apple Workgroup Server      "AWS"

            The following table contains lineNames for some discontinued lines:

                Line                        lineName
                -------------------------   ------------
                Macintosh Quadra            "MacQuadra" (preferred)
                                            "Quadra" (also used, but not preferred)
                Macintosh Centris           "MacCentris"

        Model Numbers

            The modelNumber is a string representing the specific model of the machine
            within its particular line.  For example, for the Power Macintosh 8100/80,
            the modelNumber is "8100".

            Some Performa & LC model numbers contain variations in the rightmost 1 or 2
            digits to indicate different RAM and Hard Disk configurations.  A single
            machine type is assigned for all variations of a specific model number.  In
            this case, the modelNumber string consists of the constant leftmost part
            of the model number with 0s for the variant digits.  For example, the
            Performa 6115 and Performa 6116 are both return the same machine type
            constant:  gestaltPerforma6100.


        OLD NAMING CONVENTIONS

        The "Underscore Speed" suffix

            In the past, Apple differentiated between machines that had the same model
            number but different speeds.  For example, the Power Macintosh 8100/80 and
            Power Macintosh 8100/100 return different machine type constants.  This is
            why some existing machine type constant names take the form:

                gestalt<lineName><modelNumber>_<speed>

            e.g.

                gestaltPowerMac8100_110
                gestaltPowerMac7100_80
                gestaltPowerMac7100_66

            It is no longer necessary to use the "underscore speed" suffix.  Starting with
            the Power Surge machines (Power Macintosh 7200, 7500, 8500 and 9500), speed is
            no longer used to differentiate between machine types.  This is why a Power
            Macintosh 7200/75 and a Power Macintosh 7200/90 return the same machine type
            constant:  gestaltPowerMac7200.

        The "Screen Type" suffix

            All PowerBook models prior to the PowerBook 190, and all PowerBook Duo models
            before the PowerBook Duo 2300 take the form:

                gestalt<lineName><modelNumber><screenType>

            Where <screenType> is "c" or the empty string.

            e.g.

                gestaltPowerBook100
                gestaltPowerBookDuo280
                gestaltPowerBookDuo280c
                gestaltPowerBook180
                gestaltPowerBook180c

            Starting with the PowerBook 190 series and the PowerBook Duo 2300 series, machine
            types are no longer differentiated based on screen type.  This is why a PowerBook
            5300cs/100 and a PowerBook 5300c/100 both return the same machine type constant:
            gestaltPowerBook5300.

            Macintosh LC 630                gestaltMacLC630
            Macintosh Performa 6200         gestaltPerforma6200
            Macintosh Quadra 700            gestaltQuadra700
            Macintosh PowerBook 5300        gestaltPowerBook5300
            Macintosh PowerBook Duo 2300    gestaltPowerBookDuo2300
            Power Macintosh 8500            gestaltPowerMac8500
        }

    gestaltMachineType          = $6D616368 (* 'mach' *);                       {  machine type  }
    gestaltClassic              = 1;
    gestaltMacXL                = 2;
    gestaltMac512KE             = 3;
    gestaltMacPlus              = 4;
    gestaltMacSE                = 5;
    gestaltMacII                = 6;
    gestaltMacIIx               = 7;
    gestaltMacIIcx              = 8;
    gestaltMacSE030             = 9;
    gestaltPortable             = 10;
    gestaltMacIIci              = 11;
    gestaltPowerMac8100_120     = 12;
    gestaltMacIIfx              = 13;
    gestaltMacClassic           = 17;
    gestaltMacIIsi              = 18;
    gestaltMacLC                = 19;
    gestaltMacQuadra900         = 20;
    gestaltPowerBook170         = 21;
    gestaltMacQuadra700         = 22;
    gestaltClassicII            = 23;
    gestaltPowerBook100         = 24;
    gestaltPowerBook140         = 25;
    gestaltMacQuadra950         = 26;
    gestaltMacLCIII             = 27;
    gestaltPerforma450          = 27;
    gestaltPowerBookDuo210      = 29;
    gestaltMacCentris650        = 30;
    gestaltPowerBookDuo230      = 32;
    gestaltPowerBook180         = 33;
    gestaltPowerBook160         = 34;
    gestaltMacQuadra800         = 35;
    gestaltMacQuadra650         = 36;
    gestaltMacLCII              = 37;
    gestaltPowerBookDuo250      = 38;
    gestaltAWS9150_80           = 39;
    gestaltPowerMac8100_110     = 40;
    gestaltAWS8150_110          = 40;
    gestaltPowerMac5200         = 41;
    gestaltPowerMac5260         = 41;
    gestaltPerforma5300         = 41;
    gestaltPowerMac6200         = 42;
    gestaltPerforma6300         = 42;
    gestaltMacIIvi              = 44;
    gestaltMacIIvm              = 45;
    gestaltPerforma600          = 45;
    gestaltPowerMac7100_80      = 47;
    gestaltMacIIvx              = 48;
    gestaltMacColorClassic      = 49;
    gestaltPerforma250          = 49;
    gestaltPowerBook165c        = 50;
    gestaltMacCentris610        = 52;
    gestaltMacQuadra610         = 53;
    gestaltPowerBook145         = 54;
    gestaltPowerMac8100_100     = 55;
    gestaltMacLC520             = 56;
    gestaltAWS9150_120          = 57;
    gestaltPowerMac6400         = 58;
    gestaltPerforma6400         = 58;
    gestaltPerforma6360         = 58;
    gestaltMacCentris660AV      = 60;
    gestaltMacQuadra660AV       = 60;
    gestaltPerforma46x          = 62;
    gestaltPowerMac8100_80      = 65;
    gestaltAWS8150_80           = 65;
    gestaltPowerMac9500         = 67;
    gestaltPowerMac9600         = 67;
    gestaltPowerMac7500         = 68;
    gestaltPowerMac7600         = 68;
    gestaltPowerMac8500         = 69;
    gestaltPowerMac8600         = 69;
    gestaltAWS8550              = 68;
    gestaltPowerBook180c        = 71;
    gestaltPowerBook520         = 72;
    gestaltPowerBook520c        = 72;
    gestaltPowerBook540         = 72;
    gestaltPowerBook540c        = 72;
    gestaltPowerMac5400         = 74;
    gestaltPowerMac6100_60      = 75;
    gestaltAWS6150_60           = 75;
    gestaltPowerBookDuo270c     = 77;
    gestaltMacQuadra840AV       = 78;
    gestaltPerforma550          = 80;
    gestaltPowerBook165         = 84;
    gestaltPowerBook190         = 85;
    gestaltMacTV                = 88;
    gestaltMacLC475             = 89;
    gestaltPerforma47x          = 89;
    gestaltMacLC575             = 92;
    gestaltMacQuadra605         = 94;
    gestaltMacQuadra630         = 98;
    gestaltMacLC580             = 99;
    gestaltPerforma580          = 99;
    gestaltPowerMac6100_66      = 100;
    gestaltAWS6150_66           = 100;
    gestaltPowerBookDuo280      = 102;
    gestaltPowerBookDuo280c     = 103;
    gestaltPowerMacLC475        = 104;                          {  Mac LC 475 & PPC Processor Upgrade Card }
    gestaltPowerMacPerforma47x  = 104;
    gestaltPowerMacLC575        = 105;                          {  Mac LC 575 & PPC Processor Upgrade Card  }
    gestaltPowerMacPerforma57x  = 105;
    gestaltPowerMacQuadra630    = 106;                          {  Quadra 630 & PPC Processor Upgrade Card }
    gestaltPowerMacLC630        = 106;                          {  Mac LC 630 & PPC Processor Upgrade Card }
    gestaltPowerMacPerforma63x  = 106;                          {  Performa 63x & PPC Processor Upgrade Card }
    gestaltPowerMac7200         = 108;
    gestaltPowerMac7300         = 109;
    gestaltPowerMac7100_66      = 112;
    gestaltPowerBook150         = 115;
    gestaltPowerMacQuadra700    = 116;                          {  Quadra 700 & Power PC Upgrade Card }
    gestaltPowerMacQuadra900    = 117;                          {  Quadra 900 & Power PC Upgrade Card  }
    gestaltPowerMacQuadra950    = 118;                          {  Quadra 950 & Power PC Upgrade Card  }
    gestaltPowerMacCentris610   = 119;                          {  Centris 610 & Power PC Upgrade Card  }
    gestaltPowerMacCentris650   = 120;                          {  Centris 650 & Power PC Upgrade Card  }
    gestaltPowerMacQuadra610    = 121;                          {  Quadra 610 & Power PC Upgrade Card  }
    gestaltPowerMacQuadra650    = 122;                          {  Quadra 650 & Power PC Upgrade Card  }
    gestaltPowerMacQuadra800    = 123;                          {  Quadra 800 & Power PC Upgrade Card  }
    gestaltPowerBookDuo2300     = 124;
    gestaltPowerBook500PPCUpgrade = 126;
    gestaltPowerBook5300        = 128;
    gestaltPowerBook1400        = 310;
    gestaltPowerBook3400        = 306;
    gestaltPowerBook2400        = 307;
    gestaltPowerBookG3Series    = 312;
    gestaltPowerBookG3          = 313;
    gestaltPowerBookG3Series2   = 314;
    gestaltPowerMacNewWorld     = 406;                          {  All NewWorld architecture Macs (iMac, blue G3, etc.) }
    gestaltPowerMacG3           = 510;
    gestaltPowerMac5500         = 512;
    gestalt20thAnniversary      = 512;
    gestaltPowerMac6500         = 513;
    gestaltPowerMac4400_160     = 514;                          {  slower machine has different machine ID }
    gestaltPowerMac4400         = 515;
    gestaltMacOSCompatibility   = 1206;                         {     Mac OS Compatibility on Mac OS X (Classic) }


    gestaltQuadra605            = 94;
    gestaltQuadra610            = 53;
    gestaltQuadra630            = 98;
    gestaltQuadra650            = 36;
    gestaltQuadra660AV          = 60;
    gestaltQuadra700            = 22;
    gestaltQuadra800            = 35;
    gestaltQuadra840AV          = 78;
    gestaltQuadra900            = 20;
    gestaltQuadra950            = 26;

    kMachineNameStrID           = -16395;

    gestaltSMPMailerVersion     = $6D616C72 (* 'malr' *);                       {  OCE StandardMail }

    gestaltMediaBay             = $6D626568 (* 'mbeh' *);                       {  media bay driver type  }
    gestaltMBLegacy             = 0;                            {  media bay support in PCCard 2.0  }
    gestaltMBSingleBay          = 1;                            {  single bay media bay driver  }
    gestaltMBMultipleBays       = 2;                            {  multi-bay media bay driver  }

    gestaltMessageMgrVersion    = $6D657373 (* 'mess' *);                       {  GX Printing Message Manager Gestalt Selector  }


    {   Menu Manager Gestalt (Mac OS 8.5 and later) }
    gestaltMenuMgrAttr          = $6D656E75 (* 'menu' *);                       {  If this Gestalt exists, the Mac OS 8.5 Menu Manager is installed  }
    gestaltMenuMgrPresent       = $00000001;                    {  NOTE: this is a bit mask, whereas all other Gestalt constants of this nature  }
                                                                {  are bit index values. 3.2 interfaces slipped out with this mistake unnoticed.  }
                                                                {  Sincere apologies for any inconvenience. }
    gestaltMenuMgrPresentBit    = 0;                            {  bit number  }
    gestaltMenuMgrAquaLayoutBit = 1;                            {  menus have the Aqua 1.0 layout }
    gestaltMenuMgrMultipleItemsWithCommandIDBit = 2;            {  CountMenuItemsWithCommandID/GetIndMenuItemWithCommandID support multiple items with the same command ID }
    gestaltMenuMgrRetainsIconRefBit = 3;                        {  SetMenuItemIconHandle, when passed an IconRef, calls AcquireIconRef }
    gestaltMenuMgrSendsMenuBoundsToDefProcBit = 4;              {  kMenuSizeMsg and kMenuPopUpMsg have menu bounding rect information }
                                                                {  masks for the above bits }
    gestaltMenuMgrPresentMask   = $00000001;
    gestaltMenuMgrAquaLayoutMask = $00000002;
    gestaltMenuMgrMultipleItemsWithCommandIDMask = $00000004;
    gestaltMenuMgrRetainsIconRefMask = $00000008;
    gestaltMenuMgrSendsMenuBoundsToDefProcMask = $00000010;


    gestaltMultipleUsersState   = $6D666472 (* 'mfdr' *);                       {  Gestalt selector returns MultiUserGestaltHandle (in Folders.h) }


    gestaltMachineIcon          = $6D69636E (* 'micn' *);                       {  machine icon  }

    gestaltMiscAttr             = $6D697363 (* 'misc' *);                       {  miscellaneous attributes  }
    gestaltScrollingThrottle    = 0;                            {  true if scrolling throttle on  }
    gestaltSquareMenuBar        = 2;                            {  true if menu bar is square  }


    {
        The name gestaltMixedModeVersion for the 'mixd' selector is semantically incorrect.
        The same selector has been renamed gestaltMixedModeAttr to properly reflect the
        Inside Mac: PowerPC System Software documentation.  The gestaltMixedModeVersion
        symbol has been preserved only for backwards compatibility.

        Developers are forewarned that gestaltMixedModeVersion has a limited lifespan and
        will be removed in a future release of the Interfaces.

        For the first version of Mixed Mode, both meanings of the 'mixd' selector are
        functionally identical.  They both return 0x00000001.  In subsequent versions
        of Mixed Mode, however, the 'mixd' selector will not respond with an increasing
        version number, but rather, with 32 attribute bits with various meanings.
        }
    gestaltMixedModeVersion     = $6D697864 (* 'mixd' *);                       {  returns version of Mixed Mode  }

    gestaltMixedModeAttr        = $6D697864 (* 'mixd' *);                       {  returns Mixed Mode attributes  }
    gestaltMixedModePowerPC     = 0;                            {  true if Mixed Mode supports PowerPC ABI calling conventions  }
    gestaltPowerPCAware         = 0;                            {  old name for gestaltMixedModePowerPC  }
    gestaltMixedModeCFM68K      = 1;                            {  true if Mixed Mode supports CFM-68K calling conventions  }
    gestaltMixedModeCFM68KHasTrap = 2;                          {  true if CFM-68K Mixed Mode implements _MixedModeDispatch (versions 1.0.1 and prior did not)  }
    gestaltMixedModeCFM68KHasState = 3;                         {  true if CFM-68K Mixed Mode exports Save/RestoreMixedModeState  }

    gestaltQuickTimeConferencing = $6D746C6B (* 'mtlk' *);                      {  returns QuickTime Conferencing version  }

    gestaltMemoryMapAttr        = $6D6D6170 (* 'mmap' *);                       {  Memory map type  }
    gestaltMemoryMapSparse      = 0;                            {  Sparse memory is on  }

    gestaltMMUType              = $6D6D7520 (* 'mmu ' *);                       {  mmu type  }
    gestaltNoMMU                = 0;                            {  no MMU  }
    gestaltAMU                  = 1;                            {  address management unit  }
    gestalt68851                = 2;                            {  68851 PMMU  }
    gestalt68030MMU             = 3;                            {  68030 built-in MMU  }
    gestalt68040MMU             = 4;                            {  68040 built-in MMU  }
    gestaltEMMU1                = 5;                            {  Emulated MMU type 1   }

    gestaltUserVisibleMachineName = $6D6E616D (* 'mnam' *);                     {  Coerce response into a StringPtr to get a user visible machine name  }

    gestaltMPCallableAPIsAttr   = $6D707363 (* 'mpsc' *);                       {  Bitmap of toolbox/OS managers that can be called from MPLibrary MPTasks  }
    gestaltMPFileManager        = 0;                            {  True if File Manager calls can be made from MPTasks  }
    gestaltMPDeviceManager      = 1;                            {  True if synchronous Device Manager calls can be made from MPTasks  }
    gestaltMPTrapCalls          = 2;                            {  True if most trap-based calls can be made from MPTasks  }

    gestaltStdNBPAttr           = $6E6C7570 (* 'nlup' *);                       {  standard nbp attributes  }
    gestaltStdNBPPresent        = 0;
    gestaltStdNBPSupportsAutoPosition = 1;                      {  StandardNBP takes (-1,-1) to mean alert position main screen  }

    gestaltNotificationMgrAttr  = $6E6D6772 (* 'nmgr' *);                       {  notification manager attributes  }
    gestaltNotificationPresent  = 0;                            {  notification manager exists  }

    gestaltNameRegistryVersion  = $6E726567 (* 'nreg' *);                       {  NameRegistryLib version number, for System 7.5.2+ usage  }

    gestaltNuBusSlotCount       = $6E756273 (* 'nubs' *);                       {  count of logical NuBus slots present  }

    gestaltOCEToolboxVersion    = $6F636574 (* 'ocet' *);                       {  OCE Toolbox version  }
    gestaltOCETB                = $0102;                        {  OCE Toolbox version 1.02  }
    gestaltSFServer             = $0100;                        {  S&F Server version 1.0  }

    gestaltOCEToolboxAttr       = $6F636575 (* 'oceu' *);                       {  OCE Toolbox attributes  }
    gestaltOCETBPresent         = $01;                          {  OCE toolbox is present, not running  }
    gestaltOCETBAvailable       = $02;                          {  OCE toolbox is running and available  }
    gestaltOCESFServerAvailable = $04;                          {  S&F Server is running and available  }
    gestaltOCETBNativeGlueAvailable = $10;                      {  Native PowerPC Glue routines are availible  }

    gestaltOpenFirmwareInfo     = $6F706677 (* 'opfw' *);                       {  Open Firmware info  }

    gestaltOSAttr               = $6F732020 (* 'os  ' *);                       {  o/s attributes  }
    gestaltSysZoneGrowable      = 0;                            {  system heap is growable  }
    gestaltLaunchCanReturn      = 1;                            {  can return from launch  }
    gestaltLaunchFullFileSpec   = 2;                            {  can launch from full file spec  }
    gestaltLaunchControl        = 3;                            {  launch control support available  }
    gestaltTempMemSupport       = 4;                            {  temp memory support  }
    gestaltRealTempMemory       = 5;                            {  temp memory handles are real  }
    gestaltTempMemTracked       = 6;                            {  temporary memory handles are tracked  }
    gestaltIPCSupport           = 7;                            {  IPC support is present  }
    gestaltSysDebuggerSupport   = 8;                            {  system debugger support is present  }
    gestaltNativeProcessMgrBit  = 19;                           {  the process manager itself is native  }
    gestaltAltivecRegistersSwappedCorrectlyBit = 20;            {  Altivec registers are saved correctly on process switches  }

    gestaltOSTable              = $6F737474 (* 'ostt' *);                       {   OS trap table base   }


    {   ******************************************************************************
    *   Gestalt Selectors for Open Transport Network Setup
    *
    *   Note: possible values for the version "stage" byte are:
    *   development = 0x20, alpha = 0x40, beta = 0x60, final & release = 0x80
    ******************************************************************************* }
    gestaltOpenTptNetworkSetup  = $6F746366 (* 'otcf' *);
    gestaltOpenTptNetworkSetupLegacyImport = 0;
    gestaltOpenTptNetworkSetupLegacyExport = 1;
    gestaltOpenTptNetworkSetupSupportsMultihoming = 2;

    gestaltOpenTptNetworkSetupVersion = $6F746376 (* 'otcv' *);

    {   ******************************************************************************
    *   Gestalt Selectors for Open Transport-based Remote Access/PPP
    *
    *   Note: possible values for the version "stage" byte are:
    *   development = 0x20, alpha = 0x40, beta = 0x60, final & release = 0x80
    ******************************************************************************* }
    gestaltOpenTptRemoteAccess  = $6F747261 (* 'otra' *);
    gestaltOpenTptRemoteAccessPresent = 0;
    gestaltOpenTptRemoteAccessLoaded = 1;
    gestaltOpenTptRemoteAccessClientOnly = 2;
    gestaltOpenTptRemoteAccessPServer = 3;
    gestaltOpenTptRemoteAccessMPServer = 4;
    gestaltOpenTptPPPPresent    = 5;
    gestaltOpenTptARAPPresent   = 6;

    gestaltOpenTptRemoteAccessVersion = $6F747276 (* 'otrv' *);


    {  ***** Open Transport Gestalt ***** }


    gestaltOpenTptVersions      = $6F747672 (* 'otvr' *);                       {  Defined by OT 1.1 and higher, response is NumVersion. }

    gestaltOpenTpt              = $6F74616E (* 'otan' *);                       {  Defined by all versions, response is defined below. }
    gestaltOpenTptPresentMask   = $00000001;
    gestaltOpenTptLoadedMask    = $00000002;
    gestaltOpenTptAppleTalkPresentMask = $00000004;
    gestaltOpenTptAppleTalkLoadedMask = $00000008;
    gestaltOpenTptTCPPresentMask = $00000010;
    gestaltOpenTptTCPLoadedMask = $00000020;
    gestaltOpenTptIPXSPXPresentMask = $00000040;
    gestaltOpenTptIPXSPXLoadedMask = $00000080;
    gestaltOpenTptPresentBit    = 0;
    gestaltOpenTptLoadedBit     = 1;
    gestaltOpenTptAppleTalkPresentBit = 2;
    gestaltOpenTptAppleTalkLoadedBit = 3;
    gestaltOpenTptTCPPresentBit = 4;
    gestaltOpenTptTCPLoadedBit  = 5;
    gestaltOpenTptIPXSPXPresentBit = 6;
    gestaltOpenTptIPXSPXLoadedBit = 7;


    gestaltPCCard               = $70636364 (* 'pccd' *);                       {     PC Card attributes }
    gestaltCardServicesPresent  = 0;                            {     PC Card 2.0 (68K) API is present }
    gestaltPCCardFamilyPresent  = 1;                            {     PC Card 3.x (PowerPC) API is present }
    gestaltPCCardHasPowerControl = 2;                           {     PCCardSetPowerLevel is supported }
    gestaltPCCardSupportsCardBus = 3;                           {     CardBus is supported }

    gestaltProcClkSpeed         = $70636C6B (* 'pclk' *);                       {  processor clock speed in hertz  }

    gestaltPCXAttr              = $70637867 (* 'pcxg' *);                       {  PC Exchange attributes  }
    gestaltPCXHas8and16BitFAT   = 0;                            {  PC Exchange supports both 8 and 16 bit FATs  }
    gestaltPCXHasProDOS         = 1;                            {  PC Exchange supports ProDOS  }
    gestaltPCXNewUI             = 2;
    gestaltPCXUseICMapping      = 3;                            {  PC Exchange uses InternetConfig for file mappings  }

    gestaltLogicalPageSize      = $7067737A (* 'pgsz' *);                       {  logical page size  }

    {       System 7.6 and later.  If gestaltScreenCaptureMain is not implemented,
        PictWhap proceeds with screen capture in the usual way.

        The high word of gestaltScreenCaptureMain is reserved (use 0).

        To disable screen capture to disk, put zero in the low word.  To
        specify a folder for captured pictures, put the vRefNum in the
        low word of gestaltScreenCaptureMain, and put the directory ID in
        gestaltScreenCaptureDir.
        }
    gestaltScreenCaptureMain    = $70696331 (* 'pic1' *);                       {  Zero, or vRefNum of disk to hold picture  }
    gestaltScreenCaptureDir     = $70696332 (* 'pic2' *);                       {  Directory ID of folder to hold picture  }

    gestaltGXPrintingMgrVersion = $706D6772 (* 'pmgr' *);                       {  QuickDraw GX Printing Manager Version }

    gestaltPopupAttr            = $706F7021 (* 'pop!' *);                       {  popup cdef attributes  }
    gestaltPopupPresent         = 0;

    gestaltPowerMgrAttr         = $706F7772 (* 'powr' *);                       {  power manager attributes  }
    gestaltPMgrExists           = 0;
    gestaltPMgrCPUIdle          = 1;
    gestaltPMgrSCC              = 2;
    gestaltPMgrSound            = 3;
    gestaltPMgrDispatchExists   = 4;
    gestaltPMgrSupportsAVPowerStateAtSleepWake = 5;

    gestaltPowerMgrVers         = $70777276 (* 'pwrv' *);                       {  power manager version  }

    {
     * PPC will return the combination of following bit fields.
     * e.g. gestaltPPCSupportsRealTime +gestaltPPCSupportsIncoming + gestaltPPCSupportsOutGoing
     * indicates PPC is cuurently is only supports real time delivery
     * and both incoming and outgoing network sessions are allowed.
     * By default local real time delivery is supported as long as PPCInit has been called. }
    gestaltPPCToolboxAttr       = $70706320 (* 'ppc ' *);                       {  PPC toolbox attributes  }
    gestaltPPCToolboxPresent    = $0000;                        {  PPC Toolbox is present  Requires PPCInit to be called  }
    gestaltPPCSupportsRealTime  = $1000;                        {  PPC Supports real-time delivery  }
    gestaltPPCSupportsIncoming  = $0001;                        {  PPC will allow incoming network requests  }
    gestaltPPCSupportsOutGoing  = $0002;                        {  PPC will allow outgoing network requests  }
    gestaltPPCSupportsTCP_IP    = $0004;                        {  PPC supports TCP/IP transport   }
    gestaltPPCSupportsIncomingAppleTalk = $0010;
    gestaltPPCSupportsIncomingTCP_IP = $0020;
    gestaltPPCSupportsOutgoingAppleTalk = $0100;
    gestaltPPCSupportsOutgoingTCP_IP = $0200;

    gestaltPowerPCProcessorFeatures = $70706366 (* 'ppcf' *);                   {  Optional PowerPC processor features  }
    gestaltPowerPCHasGraphicsInstructions = 0;                  {  has fres, frsqrte, and fsel instructions  }
    gestaltPowerPCHasSTFIWXInstruction = 1;                     {  has stfiwx instruction  }
    gestaltPowerPCHasSquareRootInstructions = 2;                {  has fsqrt and fsqrts instructions  }
    gestaltPowerPCHasDCBAInstruction = 3;                       {  has dcba instruction  }
    gestaltPowerPCHasVectorInstructions = 4;                    {  has vector instructions  }
    gestaltPowerPCHasDataStreams = 5;                           {  has dst, dstt, dstst, dss, and dssall instructions  }

    gestaltProcessorType        = $70726F63 (* 'proc' *);                       {  processor type  }
    gestalt68000                = 1;
    gestalt68010                = 2;
    gestalt68020                = 3;
    gestalt68030                = 4;
    gestalt68040                = 5;

    gestaltSDPPromptVersion     = $70727076 (* 'prpv' *);                       {  OCE Standard Directory Panel }

    gestaltParityAttr           = $70727479 (* 'prty' *);                       {  parity attributes  }
    gestaltHasParityCapability  = 0;                            {  has ability to check parity  }
    gestaltParityEnabled        = 1;                            {  parity checking enabled  }

    gestaltQD3DVersion          = $71337620 (* 'q3v ' *);                       {  Quickdraw 3D version in pack BCD }

    gestaltQD3DViewer           = $71337663 (* 'q3vc' *);                       {  Quickdraw 3D viewer attributes }
    gestaltQD3DViewerPresent    = 0;                            {  bit 0 set if QD3D Viewer is available }


    gestaltQuickdrawVersion     = $71642020 (* 'qd  ' *);                       {  quickdraw version  }
    gestaltOriginalQD           = $0000;                        {  original 1-bit QD  }
    gestalt8BitQD               = $0100;                        {  8-bit color QD  }
    gestalt32BitQD              = $0200;                        {  32-bit color QD  }
    gestalt32BitQD11            = $0201;                        {  32-bit color QDv1.1  }
    gestalt32BitQD12            = $0220;                        {  32-bit color QDv1.2  }
    gestalt32BitQD13            = $0230;                        {  32-bit color QDv1.3  }
    gestaltAllegroQD            = $0250;                        {  Allegro QD OS 8.5  }
    gestaltMacOSXQD             = $0300;                        {  Mac OS X QD  }

    gestaltQD3D                 = $71643364 (* 'qd3d' *);                       {  Quickdraw 3D attributes }
    gestaltQD3DPresent          = 0;                            {  bit 0 set if QD3D available }


    gestaltGXVersion            = $71646778 (* 'qdgx' *);                       {  Overall QuickDraw GX Version }

    gestaltQuickdrawFeatures    = $71647277 (* 'qdrw' *);                       {  quickdraw features  }
    gestaltHasColor             = 0;                            {  color quickdraw present  }
    gestaltHasDeepGWorlds       = 1;                            {  GWorlds can be deeper than 1-bit  }
    gestaltHasDirectPixMaps     = 2;                            {  PixMaps can be direct (16 or 32 bit)  }
    gestaltHasGrayishTextOr     = 3;                            {  supports text mode grayishTextOr  }
    gestaltSupportsMirroring    = 4;                            {  Supports video mirroring via the Display Manager.  }
    gestaltQDHasLongRowBytes    = 5;                            {  Long rowBytes supported in GWorlds  }

    gestaltQDTextVersion        = $71647478 (* 'qdtx' *);                       {  QuickdrawText version  }
    gestaltOriginalQDText       = $0000;                        {  up to and including 8.1  }
    gestaltAllegroQDText        = $0100;                        {  starting with 8.5  }
    gestaltMacOSXQDText         = $0200;                        {  we are in Mac OS X  }

    gestaltQDTextFeatures       = $71647466 (* 'qdtf' *);                       {  QuickdrawText features  }
    gestaltWSIISupport          = 0;                            {  bit 0: WSII support included  }
    gestaltSbitFontSupport      = 1;                            {  sbit-only fonts supported  }
    gestaltAntiAliasedTextAvailable = 2;                        {  capable of antialiased text  }
    gestaltOFA2available        = 3;                            {  OFA2 available  }
    gestaltCreatesAliasFontRsrc = 4;                            {  "real" datafork font support  }
    gestaltNativeType1FontSupport = 5;                          {  we have scaler for Type1 fonts  }


    gestaltQuickTimeConferencingInfo = $71746369 (* 'qtci' *);                  {  returns pointer to QuickTime Conferencing information  }

    gestaltQuickTimeVersion     = $7174696D (* 'qtim' *);                       {  returns version of QuickTime  }
    gestaltQuickTime            = $7174696D (* 'qtim' *);                       {  gestaltQuickTime is old name for gestaltQuickTimeVersion  }

    gestaltQuickTimeFeatures    = $71747273 (* 'qtrs' *);
    gestaltPPCQuickTimeLibPresent = 0;                          {  PowerPC QuickTime glue library is present  }

    gestaltQuickTimeStreamingFeatures = $71747366 (* 'qtsf' *);

    gestaltQuickTimeStreamingVersion = $71747374 (* 'qtst' *);

    gestaltQTVRMgrAttr          = $71747672 (* 'qtvr' *);                       {  QuickTime VR attributes                                }
    gestaltQTVRMgrPresent       = 0;                            {  QTVR API is present                                    }
    gestaltQTVRObjMoviesPresent = 1;                            {  QTVR runtime knows about object movies                 }
    gestaltQTVRCylinderPanosPresent = 2;                        {  QTVR runtime knows about cylindrical panoramic movies  }
    gestaltQTVRCubicPanosPresent = 3;                           {  QTVR runtime knows about cubic panoramic movies        }

    gestaltQTVRMgrVers          = $71747676 (* 'qtvv' *);                       {  QuickTime VR version                                   }

    gestaltPhysicalRAMSize      = $72616D20 (* 'ram ' *);                       {  physical RAM size  }

    gestaltRBVAddr              = $72627620 (* 'rbv ' *);                       {  RBV base address   }

    gestaltROMSize              = $726F6D20 (* 'rom ' *);                       {  rom size  }

    gestaltROMVersion           = $726F6D76 (* 'romv' *);                       {  rom version  }

    gestaltResourceMgrAttr      = $72737263 (* 'rsrc' *);                       {  Resource Mgr attributes  }
    gestaltPartialRsrcs         = 0;                            {  True if partial resources exist  }
    gestaltHasResourceOverrides = 1;                            {  Appears in the ROM; so put it here.  }

    gestaltResourceMgrBugFixesAttrs = $726D6267 (* 'rmbg' *);                   {  Resource Mgr bug fixes  }
    gestaltRMForceSysHeapRolledIn = 0;
    gestaltRMFakeAppleMenuItemsRolledIn = 1;
    gestaltSanityCheckResourceFiles = 2;                        {  Resource manager does sanity checking on resource files before opening them  }
    gestaltSupportsFSpResourceFileAlreadyOpenBit = 3;           {  The resource manager supports GetResFileRefNum and FSpGetResFileRefNum and FSpResourceFileAlreadyOpen  }
    gestaltRMSupportsFSCalls    = 4;                            {  The resource manager supports OpenResFileFSRef, CreateResFileFSRef and  ResourceFileAlreadyOpenFSRef  }
    gestaltRMTypeIndexOrderingReverse = 8;                      {  GetIndType() calls return resource types in opposite order to original 68k resource manager  }


    gestaltRealtimeMgrAttr      = $72746D72 (* 'rtmr' *);                       {  Realtime manager attributes          }
    gestaltRealtimeMgrPresent   = 0;                            {  true if the Realtime manager is present     }


    gestaltSafeOFAttr           = $73616665 (* 'safe' *);
    gestaltVMZerosPagesBit      = 0;
    gestaltInitHeapZerosOutHeapsBit = 1;
    gestaltNewHandleReturnsZeroedMemoryBit = 2;
    gestaltNewPtrReturnsZeroedMemoryBit = 3;
    gestaltFileAllocationZeroedBlocksBit = 4;


    gestaltSCCReadAddr          = $73636372 (* 'sccr' *);                       {  scc read base address   }

    gestaltSCCWriteAddr         = $73636377 (* 'sccw' *);                       {  scc read base address   }

    gestaltScrapMgrAttr         = $73637261 (* 'scra' *);                       {  Scrap Manager attributes  }
    gestaltScrapMgrTranslationAware = 0;                        {  True if scrap manager is translation aware  }

    gestaltScriptMgrVersion     = $73637269 (* 'scri' *);                       {  Script Manager version number      }

    gestaltScriptCount          = $73637223 (* 'scr#' *);                       {  number of active script systems    }

    gestaltSCSI                 = $73637369 (* 'scsi' *);                       {  SCSI Manager attributes  }
    gestaltAsyncSCSI            = 0;                            {  Supports Asynchronous SCSI  }
    gestaltAsyncSCSIINROM       = 1;                            {  Async scsi is in ROM (available for booting)  }
    gestaltSCSISlotBoot         = 2;                            {  ROM supports Slot-style PRAM for SCSI boots (PDM and later)  }
    gestaltSCSIPollSIH          = 3;                            {  SCSI Manager will poll for interrupts if Secondary Interrupts are busy.  }

    gestaltControlStripAttr     = $73646576 (* 'sdev' *);                       {  Control Strip attributes  }
    gestaltControlStripExists   = 0;                            {  Control Strip is installed  }
    gestaltControlStripVersionFixed = 1;                        {  Control Strip version Gestalt selector was fixed  }
    gestaltControlStripUserFont = 2;                            {  supports user-selectable font/size  }
    gestaltControlStripUserHotKey = 3;                          {  support user-selectable hot key to show/hide the window  }

    gestaltSDPStandardDirectoryVersion = $73647672 (* 'sdvr' *);                {  OCE Standard Directory Panel }

    gestaltSerialAttr           = $73657220 (* 'ser ' *);                       {  Serial attributes  }
    gestaltHasGPIaToDCDa        = 0;                            {  GPIa connected to DCDa }
    gestaltHasGPIaToRTxCa       = 1;                            {  GPIa connected to RTxCa clock input }
    gestaltHasGPIbToDCDb        = 2;                            {  GPIb connected to DCDb  }
    gestaltHidePortA            = 3;                            {  Modem port (A) should be hidden from users  }
    gestaltHidePortB            = 4;                            {  Printer port (B) should be hidden from users  }
    gestaltPortADisabled        = 5;                            {  Modem port (A) disabled and should not be used by SW  }
    gestaltPortBDisabled        = 6;                            {  Printer port (B) disabled and should not be used by SW  }

    gestaltShutdownAttributes   = $73687574 (* 'shut' *);                       {  ShutDown Manager Attributes  }
    gestaltShutdownHassdOnBootVolUnmount = 0;                   {  True if ShutDown Manager unmounts boot & VM volume at shutdown time.  }

    gestaltNuBusConnectors      = $736C7463 (* 'sltc' *);                       {  bitmap of NuBus connectors }

    gestaltSlotAttr             = $736C6F74 (* 'slot' *);                       {  slot attributes   }
    gestaltSlotMgrExists        = 0;                            {  true is slot mgr exists   }
    gestaltNuBusPresent         = 1;                            {  NuBus slots are present   }
    gestaltSESlotPresent        = 2;                            {  SE PDS slot present   }
    gestaltSE30SlotPresent      = 3;                            {  SE/30 slot present   }
    gestaltPortableSlotPresent  = 4;                            {  PortableÕs slot present   }

    gestaltFirstSlotNumber      = $736C7431 (* 'slt1' *);                       {  returns first physical slot  }

    gestaltSoundAttr            = $736E6420 (* 'snd ' *);                       {  sound attributes  }
    gestaltStereoCapability     = 0;                            {  sound hardware has stereo capability  }
    gestaltStereoMixing         = 1;                            {  stereo mixing on external speaker  }
    gestaltSoundIOMgrPresent    = 3;                            {  The Sound I/O Manager is present  }
    gestaltBuiltInSoundInput    = 4;                            {  built-in Sound Input hardware is present  }
    gestaltHasSoundInputDevice  = 5;                            {  Sound Input device available  }
    gestaltPlayAndRecord        = 6;                            {  built-in hardware can play and record simultaneously  }
    gestalt16BitSoundIO         = 7;                            {  sound hardware can play and record 16-bit samples  }
    gestaltStereoInput          = 8;                            {  sound hardware can record stereo  }
    gestaltLineLevelInput       = 9;                            {  sound input port requires line level  }
                                                                {  the following bits are not defined prior to Sound Mgr 3.0  }
    gestaltSndPlayDoubleBuffer  = 10;                           {  SndPlayDoubleBuffer available, set by Sound Mgr 3.0 and later  }
    gestaltMultiChannels        = 11;                           {  multiple channel support, set by Sound Mgr 3.0 and later  }
    gestalt16BitAudioSupport    = 12;                           {  16 bit audio data supported, set by Sound Mgr 3.0 and later  }

    gestaltSplitOSAttr          = $73706F73 (* 'spos' *);
    gestaltSplitOSBootDriveIsNetworkVolume = 0;                 {  the boot disk is a network 'disk', from the .LANDisk drive.  }
    gestaltSplitOSAware         = 1;                            {  the system includes the code to deal with a split os situation.  }
    gestaltSplitOSEnablerVolumeIsDifferentFromBootVolume = 2;   {  the active enabler is on a different volume than the system file.  }
    gestaltSplitOSMachineNameSetToNetworkNameTemp = 3;          {  The machine name was set to the value given us from the BootP server  }
    gestaltSplitOSMachineNameStartupDiskIsNonPersistent = 5;    {  The startup disk ( vRefNum == -1 ) is non-persistent, meaning changes won't persist across a restart.  }

    gestaltSMPSPSendLetterVersion = $7370736C (* 'spsl' *);                     {  OCE StandardMail }

    gestaltSpeechRecognitionAttr = $73727461 (* 'srta' *);                      {  speech recognition attributes  }
    gestaltDesktopSpeechRecognition = 1;                        {  recognition thru the desktop microphone is available  }
    gestaltTelephoneSpeechRecognition = 2;                      {  recognition thru the telephone is available  }

    gestaltSpeechRecognitionVersion = $73727462 (* 'srtb' *);                   {  speech recognition version (0x0150 is the first version that fully supports the API)  }

    gestaltSoftwareVendorCode   = $73726164 (* 'srad' *);                       {  Returns system software vendor information  }
    gestaltSoftwareVendorApple  = $4170706C (* 'Appl' *);                       {  System software sold by Apple  }
    gestaltSoftwareVendorLicensee = $4C636E73 (* 'Lcns' *);                     {  System software sold by licensee  }

    gestaltStandardFileAttr     = $73746466 (* 'stdf' *);                       {  Standard File attributes  }
    gestaltStandardFile58       = 0;                            {  True if selectors 5-8 (StandardPutFile-CustomGetFile) are supported  }
    gestaltStandardFileTranslationAware = 1;                    {  True if standard file is translation manager aware  }
    gestaltStandardFileHasColorIcons = 2;                       {  True if standard file has 16x16 color icons  }
    gestaltStandardFileUseGenericIcons = 3;                     {  Standard file LDEF to use only the system generic icons if true  }
    gestaltStandardFileHasDynamicVolumeAllocation = 4;          {  True if standard file supports more than 20 volumes  }

    gestaltSysArchitecture      = $73797361 (* 'sysa' *);                       {  Native System Architecture  }
    gestalt68k                  = 1;                            {  Motorola MC68k architecture  }
    gestaltPowerPC              = 2;                            {  IBM PowerPC architecture  }

    gestaltSystemUpdateVersion  = $73797375 (* 'sysu' *);                       {  System Update version  }

    gestaltSystemVersion        = $73797376 (* 'sysv' *);                       {  system version }

    gestaltToolboxTable         = $74627474 (* 'tbtt' *);                       {   OS trap table base   }

    gestaltTextEditVersion      = $74652020 (* 'te  ' *);                       {  TextEdit version number  }
    gestaltTE1                  = 1;                            {  TextEdit in MacIIci ROM  }
    gestaltTE2                  = 2;                            {  TextEdit with 6.0.4 Script Systems on MacIIci (Script bug fixes for MacIIci)  }
    gestaltTE3                  = 3;                            {  TextEdit with 6.0.4 Script Systems all but MacIIci  }
    gestaltTE4                  = 4;                            {  TextEdit in System 7.0  }
    gestaltTE5                  = 5;                            {  TextWidthHook available in TextEdit  }

    gestaltTEAttr               = $74656174 (* 'teat' *);                       {  TextEdit attributes  }
    gestaltTEHasGetHiliteRgn    = 0;                            {  TextEdit has TEGetHiliteRgn  }
    gestaltTESupportsInlineInput = 1;                           {  TextEdit does Inline Input  }
    gestaltTESupportsTextObjects = 2;                           {  TextEdit does Text Objects  }
    gestaltTEHasWhiteBackground = 3;                            {  TextEdit supports overriding the TERec's background to white  }

    gestaltTeleMgrAttr          = $74656C65 (* 'tele' *);                       {  Telephone manager attributes  }
    gestaltTeleMgrPresent       = 0;
    gestaltTeleMgrPowerPCSupport = 1;
    gestaltTeleMgrSoundStreams  = 2;
    gestaltTeleMgrAutoAnswer    = 3;
    gestaltTeleMgrIndHandset    = 4;
    gestaltTeleMgrSilenceDetect = 5;
    gestaltTeleMgrNewTELNewSupport = 6;

    gestaltTermMgrAttr          = $7465726D (* 'term' *);                       {  terminal mgr attributes  }
    gestaltTermMgrPresent       = 0;
    gestaltTermMgrErrorString   = 2;

    gestaltThreadMgrAttr        = $74686473 (* 'thds' *);                       {  Thread Manager attributes  }
    gestaltThreadMgrPresent     = 0;                            {  bit true if Thread Mgr is present  }
    gestaltSpecificMatchSupport = 1;                            {  bit true if Thread Mgr supports exact match creation option  }
    gestaltThreadsLibraryPresent = 2;                           {  bit true if Thread Mgr shared library is present  }

    gestaltTimeMgrVersion       = $746D6772 (* 'tmgr' *);                       {  time mgr version  }
    gestaltStandardTimeMgr      = 1;                            {  standard time mgr is present  }
    gestaltRevisedTimeMgr       = 2;                            {  revised time mgr is present  }
    gestaltExtendedTimeMgr      = 3;                            {  extended time mgr is present  }
    gestaltNativeTimeMgr        = 4;                            {  PowerPC native TimeMgr is present  }

    gestaltTSMTEVersion         = $746D5456 (* 'tmTV' *);
    gestaltTSMTE1               = $0100;                        {  Original version of TSMTE  }
    gestaltTSMTE15              = $0150;                        {  System 8.0  }
    gestaltTSMTE152             = $0152;                        {  System 8.2  }

    gestaltTSMTEAttr            = $746D5445 (* 'tmTE' *);
    gestaltTSMTEPresent         = 0;
    gestaltTSMTE                = 0;                            {  gestaltTSMTE is old name for gestaltTSMTEPresent  }

    gestaltAVLTreeAttr          = $74726565 (* 'tree' *);                       {  AVLTree utility routines attributes.  }
    gestaltAVLTreePresentBit    = 0;                            {  if set, then the AVL Tree routines are available.  }
    gestaltAVLTreeSupportsHandleBasedTreeBit = 1;               {  if set, then the AVL Tree routines can store tree data in a single handle  }
    gestaltAVLTreeSupportsTreeLockingBit = 2;                   {  if set, the AVLLockTree() and AVLUnlockTree() routines are available.  }

    gestaltALMAttr              = $74726970 (* 'trip' *);                       {  Settings Manager attributes (see also gestaltALMVers)  }
    gestaltALMPresent           = 0;                            {  bit true if ALM is available  }
    gestaltALMHasSFGroup        = 1;                            {  bit true if Put/Get/Merge Group calls are implmented  }
    gestaltALMHasCFMSupport     = 2;                            {  bit true if CFM-based modules are supported  }
    gestaltALMHasRescanNotifiers = 3;                           {  bit true if Rescan notifications/events will be sent to clients  }

    gestaltALMHasSFLocation     = 1;

    gestaltTSMgrVersion         = $74736D76 (* 'tsmv' *);                       {  Text Services Mgr version, if present  }
    gestaltTSMgr15              = $0150;
    gestaltTSMgr20              = $0200;

    gestaltTSMgrAttr            = $74736D61 (* 'tsma' *);                       {  Text Services Mgr attributes, if present  }
    gestaltTSMDisplayMgrAwareBit = 0;                           {  TSM knows about display manager  }
    gestaltTSMdoesTSMTEBit      = 1;                            {  TSM has integrated TSMTE  }

    gestaltSpeechAttr           = $74747363 (* 'ttsc' *);                       {  Speech Manager attributes  }
    gestaltSpeechMgrPresent     = 0;                            {  bit set indicates that Speech Manager exists  }
    gestaltSpeechHasPPCGlue     = 1;                            {  bit set indicates that native PPC glue for Speech Manager API exists  }

    gestaltTVAttr               = $74762020 (* 'tv  ' *);                       {  TV version  }
    gestaltHasTVTuner           = 0;                            {  supports Philips FL1236F video tuner  }
    gestaltHasSoundFader        = 1;                            {  supports Philips TEA6330 Sound Fader chip  }
    gestaltHasHWClosedCaptioning = 2;                           {  supports Philips SAA5252 Closed Captioning  }
    gestaltHasIRRemote          = 3;                            {  supports CyclopsII Infra Red Remote control  }
    gestaltHasVidDecoderScaler  = 4;                            {  supports Philips SAA7194 Video Decoder/Scaler  }
    gestaltHasStereoDecoder     = 5;                            {  supports Sony SBX1637A-01 stereo decoder  }
    gestaltHasSerialFader       = 6;                            {  has fader audio in serial with system audio  }
    gestaltHasFMTuner           = 7;                            {  has FM Tuner from donnybrook card  }
    gestaltHasSystemIRFunction  = 8;                            {  Infra Red button function is set up by system and not by Video Startup  }
    gestaltIRDisabled           = 9;                            {  Infra Red remote is not disabled.  }
    gestaltINeedIRPowerOffConfirm = 10;                         {  Need IR power off confirm dialog.  }
    gestaltHasZoomedVideo       = 11;                           {  Has Zoomed Video PC Card video input.  }


    gestaltATSUVersion          = $75697376 (* 'uisv' *);
    gestaltOriginalATSUVersion  = $00010000;                    {  ATSUI version 1.0  }
    gestaltATSUUpdate1          = $00020000;                    {  ATSUI version 1.1  }
    gestaltATSUUpdate2          = $00030000;                    {  ATSUI version 1.2  }
    gestaltATSUUpdate3          = $00040000;                    {  ATSUI version 2.0  }
    gestaltATSUUpdate4          = $00050000;                    {  ATSUI version in Mac OS X - SoftwareUpdate 1-4 for Mac OS 10.0.1 - 10.0.4  }
    gestaltATSUUpdate5          = $00060000;                    {  ATSUI version 2.3 in MacOS 10.1  }

    gestaltATSUFeatures         = $75697366 (* 'uisf' *);
    gestaltATSUTrackingFeature  = $00000001;                    {  feature introduced in ATSUI version 1.1  }
    gestaltATSUMemoryFeature    = $00000001;                    {  feature introduced in ATSUI version 1.1  }
    gestaltATSUFallbacksFeature = $00000001;                    {  feature introduced in ATSUI version 1.1  }
    gestaltATSUGlyphBoundsFeature = $00000001;                  {  feature introduced in ATSUI version 1.1  }
    gestaltATSULineControlFeature = $00000001;                  {  feature introduced in ATSUI version 1.1  }
    gestaltATSULayoutCreateAndCopyFeature = $00000001;          {  feature introduced in ATSUI version 1.1  }
    gestaltATSULayoutCacheClearFeature = $00000001;             {  feature introduced in ATSUI version 1.1  }
    gestaltATSUTextLocatorUsageFeature = $00000002;             {  feature introduced in ATSUI version 1.2  }
    gestaltATSULowLevelOrigFeatures = $00000004;                {  first low-level features introduced in ATSUI version 2.0  }
    gestaltATSUFallbacksObjFeatures = $00000008;                {  feature introduced - ATSUFontFallbacks objects introduced in ATSUI version 2.3  }
    gestaltATSUIgnoreLeadingFeature = $00000008;                {  feature introduced - kATSLineIgnoreFontLeading LineLayoutOption introduced in ATSUI version 2.3  }

    gestaltUSBAttr              = $75736220 (* 'usb ' *);                       {  USB Attributes  }
    gestaltUSBPresent           = 0;                            {  USB Support available  }
    gestaltUSBHasIsoch          = 1;                            {  USB Isochronous features available  }

    gestaltUSBVersion           = $75736276 (* 'usbv' *);                       {  USB version  }

    gestaltVersion              = $76657273 (* 'vers' *);                       {  gestalt version  }
    gestaltValueImplementedVers = 5;                            {  version of gestalt where gestaltValue is implemented.  }

    gestaltVIA1Addr             = $76696131 (* 'via1' *);                       {  via 1 base address   }

    gestaltVIA2Addr             = $76696132 (* 'via2' *);                       {  via 2 base address   }

    gestaltVMAttr               = $766D2020 (* 'vm  ' *);                       {  virtual memory attributes  }
    gestaltVMPresent            = 0;                            {  true if virtual memory is present  }
    gestaltVMHasLockMemoryForOutput = 1;                        {  true if LockMemoryForOutput is available  }
    gestaltVMFilemappingOn      = 3;                            {  true if filemapping is available  }
    gestaltVMHasPagingControl   = 4;                            {  true if MakeMemoryResident, MakeMemoryNonResident, FlushMemory, and ReleaseMemoryData are available  }

    gestaltVMInfoType           = $766D696E (* 'vmin' *);                       {  Indicates how the Finder should display information about VM in  }
                                                                {  the Finder about box.  }
    gestaltVMInfoSizeStorageType = 0;                           {  Display VM on/off, backing store size and name  }
    gestaltVMInfoSizeType       = 1;                            {  Display whether VM is on or off and the size of the backing store  }
    gestaltVMInfoSimpleType     = 2;                            {  Display whether VM is on or off  }
    gestaltVMInfoNoneType       = 3;                            {  Display no VM information  }

    gestaltVMBackingStoreFileRefNum = $766D6273 (* 'vmbs' *);                   {  file refNum of virtual memory's main backing store file (returned in low word of result)  }



    gestaltALMVers              = $77616C6B (* 'walk' *);                       {  Settings Manager version (see also gestaltALMAttr)  }

    gestaltWindowMgrAttr        = $77696E64 (* 'wind' *);                       {  If this Gestalt exists, the Mac OS 8.5 Window Manager is installed }
    gestaltWindowMgrPresent     = $00000001;                    {  NOTE: this is a bit mask, whereas all other Gestalt constants of }
                                                                {  this type are bit index values.   Universal Interfaces 3.2 slipped }
                                                                {  out the door with this mistake. }
    gestaltWindowMgrPresentBit  = 0;                            {  bit number }
    gestaltExtendedWindowAttributes = 1;                        {  Has ChangeWindowAttributes; GetWindowAttributes works for all windows }
    gestaltExtendedWindowAttributesBit = 1;                     {  Has ChangeWindowAttributes; GetWindowAttributes works for all windows }
    gestaltHasFloatingWindows   = 2;                            {  Floating window APIs work }
    gestaltHasFloatingWindowsBit = 2;                           {  Floating window APIs work }
    gestaltHasWindowBuffering   = 3;                            {  This system has buffering available }
    gestaltHasWindowBufferingBit = 3;                           {  This system has buffering available }
    gestaltWindowLiveResizeBit  = 4;                            {  live resizing of windows is available }
    gestaltWindowMinimizeToDockBit = 5;                         {  windows minimize to the dock and do not windowshade (Mac OS X) }
    gestaltHasWindowShadowsBit  = 6;                            {  windows have shadows }
    gestaltSheetsAreWindowModalBit = 7;                         {  sheet windows are modal only to their parent window }
                                                                {  masks for the above bits }
    gestaltWindowMgrPresentMask = $00000001;
    gestaltExtendedWindowAttributesMask = $00000002;
    gestaltHasFloatingWindowsMask = $00000004;
    gestaltHasWindowBufferingMask = $00000008;
    gestaltWindowLiveResizeMask = $00000010;
    gestaltWindowMinimizeToDockMask = $00000020;
    gestaltHasWindowShadowsMask = $00000040;
    gestaltSheetsAreWindowModalMask = $00000080;



    gestaltTranslationAttr      = $786C6174 (* 'xlat' *);                       {  Translation Manager attributes  }
    gestaltTranslationMgrExists = 0;                            {  True if translation manager exists  }
    gestaltTranslationMgrHintOrder = 1;                         {  True if hint order reversal in effect  }
    gestaltTranslationPPCAvail  = 2;
    gestaltTranslationGetPathAPIAvail = 3;

    gestaltExtToolboxTable      = $78747474 (* 'xttt' *);                       {  Extended Toolbox trap table base  }

    gestaltUSBPrinterSharingVersion = $7A616B20 (* 'zak ' *);                   {  USB Printer Sharing Version }
    gestaltUSBPrinterSharingVersionMask = $0000FFFF;            {  mask for bits in version }
    gestaltUSBPrinterSharingAttr = $7A616B20 (* 'zak ' *);                      {  USB Printer Sharing Attributes }
    gestaltUSBPrinterSharingAttrMask = $FFFF0000;               {   mask for attribute bits }
    gestaltUSBPrinterSharingAttrRunning = $80000000;            {  printer sharing is running }
    gestaltUSBPrinterSharingAttrBooted = $40000000;             {  printer sharing was installed at boot time }

    { WorldScript settings; }
    gestaltWorldScriptIIVersion = $646F7562 (* 'doub' *);
    gestaltWorldScriptIIAttr    = $77736174 (* 'wsat' *);
    gestaltWSIICanPrintWithoutPrGeneralBit = 0;                 {  bit 0 is on if WS II knows about PrinterStatus callback  }




{$ALIGN MAC68K}
{#POP}
{unit HIObjectCore}
{$ALIGN MAC68K}






{
    This file contains the base HIObjectxxx type declarations which
    should normally be in HIObject.p[.pas].  The declarations have been
    moved to this "core" file to fix a cyclic dependency which occurs
    with the present monlithic CarbonEvents.p[.pas] and an unfixed
    HIObject.p[.pas].  If/when the monlithic CarbonEvents.p[.pas] is
    broken up into two files corresponding to the Mac OS X headers
    CarbonEvents.h and CarbonEventsCore.h this file will no longer be
    needed and the type declarations can be returned to the
    HIObject.p[.pas] unit.
}

type
    HIObjectClassRef            = ^SInt32; { an opaque 32-bit type }
    HIObjectClassRefPtr         = ^HIObjectClassRef; { when a var xx:HIObjectClassRef parameter can be nil, it is changed to xx: HIObjectClassRefPtr }
    HIObjectRef                 = ^SInt32; { an opaque 32-bit type }
{unit ICACamera}
{$ALIGN MAC68K}








{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}

{
   -------------------------------------------------------------------------
                                Selectors
   -------------------------------------------------------------------------
}

const
                                                                {  Camera properties }
                                                                {  Refer to section 13 of the PIMA 15740 (PTP) specification for }
                                                                {  descriptions and usage notes for these standard properties }
    kICAPropertyCameraBatteryLevel = $35303031 (* '5001' *);                    {  UInt8   enum/range }
    kICAPropertyCameraFunctionalMode = $35303032 (* '5002' *);                  {  UInt16     enum }
    kICAPropertyCameraImageSize = $35303033 (* '5003' *);                       {  CFString     enum/range }
    kICAPropertyCameraCompressionSetting = $35303034 (* '5004' *);              {  UInt8   enum/range }
    kICAPropertyCameraWhiteBalance = $35303035 (* '5005' *);                    {  UInt16     enum }
    kICAPropertyCameraRGBGain   = $35303036 (* '5006' *);                       {  null terminated string enum/range }
    kICAPropertyCameraFNumber   = $35303037 (* '5007' *);                       {  UInt16     enum }
    kICAPropertyCameraFocalLength = $35303038 (* '5008' *);                     {  UInt32     enum/range }
    kICAPropertyCameraFocusDistance = $35303039 (* '5009' *);                   {  UInt16     enum/range }
    kICAPropertyCameraFocusMode = $35303041 (* '500A' *);                       {  UInt16     enum }
    kICAPropertyCameraExposureMeteringMode = $35303042 (* '500B' *);            {  UInt16     enum }
    kICAPropertyCameraFlashMode = $35303043 (* '500C' *);                       {  UInt16     enum }
    kICAPropertyCameraExposureTime = $35303044 (* '500D' *);                    {  UInt32     enum/range }
    kICAPropertyCameraExposureProgramMode = $35303045 (* '500E' *);             {  UInt16     enum }
    kICAPropertyCameraExposureIndex = $35303046 (* '500F' *);                   {  UInt16     enum/range }
    kICAPropertyCameraExposureBiasCompensation = $35303130 (* '5010' *);        {  UInt16     enum/range }
    kICAPropertyCameraDateTime  = $35303131 (* '5011' *);                       {  null terminated string     none }
    kICAPropertyCameraCaptureDelay = $35303132 (* '5012' *);                    {  UInt32     enum/range }
    kICAPropertyCameraStillCaptureMode = $35303133 (* '5013' *);                {  UInt16     enum }
    kICAPropertyCameraContrast  = $35303134 (* '5014' *);                       {  UInt8   enum/range }
    kICAPropertyCameraSharpness = $35303135 (* '5015' *);                       {  UInt8   enum/range }
    kICAPropertyCameraDigitalZoom = $35303136 (* '5016' *);                     {  UInt8   enum/range }
    kICAPropertyCameraEffectMode = $35303137 (* '5017' *);                      {  UInt16     enum }
    kICAPropertyCameraBurstNumber = $35303138 (* '5018' *);                     {  UInt16     enum/range }
    kICAPropertyCameraBurstInterval = $35303139 (* '5019' *);                   {  UInt16     enum/range }
    kICAPropertyCameraTimelapseNumber = $35303141 (* '501A' *);                 {  UInt16     enum/range }
    kICAPropertyCameraTimelapseInterval = $35303142 (* '501B' *);               {  UInt32     enum/range }
    kICAPropertyCameraFocusMeteringMode = $35303143 (* '501C' *);               {  UInt16     enum }

                                                                {  Refer to section 5.5.3 of the PTP spec }
    kICAPropertyCameraStorageType = $73746F72 (* 'stor' *);                     {  UInt16 }
    kICAPropertyCameraFilesystemType = $66737973 (* 'fsys' *);                  {  UInt16 }
    kICAPropertyCameraAccessCapability = $61636170 (* 'acap' *);                {  UInt16 }
    kICAPropertyCameraMaxCapacity = $6D617863 (* 'maxc' *);                     {  UInt64 }
    kICAPropertyCameraFreeSpaceInBytes = $66726573 (* 'fres' *);                {  UInt64 }
    kICAPropertyCameraFreeSpaceInImages = $66726569 (* 'frei' *);               {  UInt32 }
    kICAPropertyCameraStorageDescription = $73746F64 (* 'stod' *);              {  null terminated string }
    kICAPropertyCameraVolumeLabel = $766F6C6C (* 'voll' *);                     {  null terminated string }

                                                                {  ICA specific }
    kICAPropertyCameraIcon      = $69636F6E (* 'icon' *);                       {  ICAThumbnail }
    kICAPropertyCameraSupportedMessages = $6D736773 (* 'msgs' *);               {  array of OSTypes }

                                                                {  Values for kICAPropertyCameraStorageType }
    kICAStorageFixedROM         = $0001;
    kICAStorageRemovableROM     = $0002;
    kICAStorageFixedRAM         = $0003;
    kICAStorageRemovableRAM     = $0004;

                                                                {  Values for kICAPropertyCameraFilesystemType }
    kICAFileystemGenericFlat    = $0001;
    kICAFileystemGenericHierarchical = $0002;
    kICAFileystemDCF            = $0003;

                                                                {  Values for kICAPropertyCameraAccessCapability }
    kICAAccessReadWrite         = $0000;
    kICAAccessReadOnly          = $0001;
    kICAAccessReadOnlyWithObjectDeletion = $0002;

                                                                {  Camera messages }
    kICAMessageCameraCaptureNewImage = $63636E69 (* 'ccni' *);
    kICAMessageCameraDeleteOne  = $64656C31 (* 'del1' *);
    kICAMessageCameraDeleteAll  = $64656C61 (* 'dela' *);
    kICAMessageCameraSyncClock  = $73636C6B (* 'sclk' *);
    kICAMessageCameraUploadData = $6C6F6164 (* 'load' *);

{$ALIGN MAC68K}
{#POP}
{unit IntlResources}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}


const
                                                                {  Bits in the itlcFlags byte  }
    itlcShowIcon                = 7;                            { Show icon even if only one script }
    itlcDualCaret               = 6;                            { Use dual caret for mixed direction text }
                                                                {  Bits in the itlcSysFlags word  }
    itlcSysDirection            = 15;                           { System direction - left to right/right to left }

                                                                {  One more flag in the itlcFlags byte  }
    itlcDisableKeyScriptSync    = 3;                            { Disable font and keyboard script synchrinozation }

                                                                {  We should define masks, too.  }
    itlcDisableKeyScriptSyncMask = $08;                         { Disable font and keyboard script synchrinozation mask }


    tokLeftQuote                = 1;                            {  NumberParts.data[] enumerators                              }
    tokRightQuote               = 2;                            {   In general, these are NOT to be considered indices into the data[] array  }
    tokLeadPlacer               = 3;
    tokLeader                   = 4;
    tokNonLeader                = 5;
    tokZeroLead                 = 6;
    tokPercent                  = 7;
    tokPlusSign                 = 8;
    tokMinusSign                = 9;
    tokThousands                = 10;
    tokReserved                 = 11;                           {  11 is reserved field  }
    tokSeparator                = 12;
    tokEscape                   = 13;
    tokDecPoint                 = 14;
    tokEPlus                    = 15;
    tokEMinus                   = 16;
    tokMaxSymbols               = 31;
    curNumberPartsVersion       = 1;                            { current version of NumberParts record }

    currSymLead                 = 16;
    currNegSym                  = 32;
    currTrailingZ               = 64;
    currLeadingZ                = 128;

    mdy                         = 0;
    dmy                         = 1;
    ymd                         = 2;
    myd                         = 3;
    dym                         = 4;
    ydm                         = 5;


type
    DateOrders                          = SInt8;

const
    timeCycle24                 = 0;                            { time sequence 0:00 - 23:59 }
    timeCycleZero               = 1;                            { time sequence 0:00-11:59, 0:00 - 11:59 }
    timeCycle12                 = 255;                          { time sequence 12:00 - 11:59, 12:00 - 11:59 }
    zeroCycle                   = 1;                            { old name for timeCycleZero }
    longDay                     = 0;                            { day of the month }
    longWeek                    = 1;                            { day of the week }
    longMonth                   = 2;                            { month of the year }
    longYear                    = 3;                            { year }
    supDay                      = 1;                            { suppress day of month }
    supWeek                     = 2;                            { suppress day of week }
    supMonth                    = 4;                            { suppress month }
    supYear                     = 8;                            { suppress year }
    dayLdingZ                   = 32;
    mntLdingZ                   = 64;
    century                     = 128;
    secLeadingZ                 = 32;
    minLeadingZ                 = 64;
    hrLeadingZ                  = 128;

    {    moved OffsetTable back here from QuickdrawText     }

type
    OffPairPtr = ^OffPair;
    OffPair = record
        offFirst:               SInt16;
        offSecond:              SInt16;
    end;

    OffsetTable                         = array [0..2] of OffPair;
    Intl0RecPtr = ^Intl0Rec;
    Intl0Rec = packed record
        decimalPt:              char;                                   { decimal point character }
        thousSep:               char;                                   { thousands separator character }
        listSep:                char;                                   { list separator character }
        currSym1:               char;                                   { currency symbol }
        currSym2:               char;
        currSym3:               char;
        currFmt:                UInt8;                                  { currency format flags }
        dateOrder:              UInt8;                                  { order of short date elements: mdy, dmy, etc. }
        shrtDateFmt:            UInt8;                                  { format flags for each short date element }
        dateSep:                char;                                   { date separator character }
        timeCycle:              UInt8;                                  { specifies time cycle: 0..23, 1..12, or 0..11 }
        timeFmt:                UInt8;                                  { format flags for each time element }
        mornStr:                packed array [1..4] of char;            { trailing string for AM if 12-hour cycle }
        eveStr:                 packed array [1..4] of char;            { trailing string for PM if 12-hour cycle }
        timeSep:                char;                                   { time separator character }
        time1Suff:              char;                                   { trailing string for AM if 24-hour cycle }
        time2Suff:              char;
        time3Suff:              char;
        time4Suff:              char;
        time5Suff:              char;                                   { trailing string for PM if 24-hour cycle }
        time6Suff:              char;
        time7Suff:              char;
        time8Suff:              char;
        metricSys:              UInt8;                                  { 255 if metric, 0 if inches etc. }
        intl0Vers:              SInt16;                             { region code (hi byte) and version (lo byte) }
    end;

    Intl0Ptr                            = ^Intl0Rec;
    Intl0Hndl                           = ^Intl0Ptr;
    Intl1RecPtr = ^Intl1Rec;
    Intl1Rec = packed record
        days:                   array [1..7] of Str15;                  { day names }
        months:                 array [1..12] of Str15;                 { month names }
        suppressDay:            UInt8;                                  { 255 for no day, or flags to suppress any element }
        lngDateFmt:             UInt8;                                  { order of long date elements }
        dayLeading0:            UInt8;                                  { 255 for leading 0 in day number }
        abbrLen:                UInt8;                                  { length for abbreviating names }
        st0:                    packed array [1..4] of char;            { separator strings for long date format }
        st1:                    packed array [1..4] of char;
        st2:                    packed array [1..4] of char;
        st3:                    packed array [1..4] of char;
        st4:                    packed array [1..4] of char;
        intl1Vers:              SInt16;                             { region code (hi byte) and version (lo byte) }
        localRtn:               array [0..0] of SInt16;             { now a flag for opt extension }
    end;

    Intl1Ptr                            = ^Intl1Rec;
    Intl1Hndl                           = ^Intl1Ptr;
    {   fields for optional itl1 extension  }
    Itl1ExtRecPtr = ^Itl1ExtRec;
    Itl1ExtRec = record
        base:                   Intl1Rec;                               { un-extended Intl1Rec }
        version:                SInt16;
        format:                 SInt16;
        calendarCode:           SInt16;                             { calendar code for this itl1 resource }
        extraDaysTableOffset:   SInt32;                             { offset in itl1 to extra days table }
        extraDaysTableLength:   SInt32;                             { length of extra days table }
        extraMonthsTableOffset: SInt32;                             { offset in itl1 to extra months table }
        extraMonthsTableLength: SInt32;                             { length of extra months table }
        abbrevDaysTableOffset:  SInt32;                             { offset in itl1 to abbrev days table }
        abbrevDaysTableLength:  SInt32;                             { length of abbrev days table }
        abbrevMonthsTableOffset: SInt32;                                { offset in itl1 to abbrev months table }
        abbrevMonthsTableLength: SInt32;                                { length of abbrev months table }
        extraSepsTableOffset:   SInt32;                             { offset in itl1 to extra seps table }
        extraSepsTableLength:   SInt32;                             { length of extra seps table }
        tables:                 array [0..0] of SInt16;             { now a flag for opt extension }
    end;

    UntokenTablePtr = ^UntokenTable;
    UntokenTable = record
        len:                    SInt16;
        lastToken:              SInt16;
        index:                  array [0..255] of SInt16;               { index table; last = lastToken }
    end;

    UntokenTableHandle                  = ^UntokenTablePtr;
    WideCharPtr = ^WideChar;
    WideChar = record
        case SInt16 of
        0: (
            a:                  packed array [0..1] of char;            { 0 is the high order character }
            );
        1: (
            b:                  SInt16;
            );
    end;

    WideCharArrPtr = ^WideCharArr;
    WideCharArr = record
        size:                   SInt16;
        data:                   array [0..9] of WideChar;
    end;

    NumberPartsPtr = ^NumberParts;
    NumberParts = record
        version:                SInt16;
        data:                   array [0..30] of WideChar;              { index by [tokLeftQuote..tokMaxSymbols] }
        pePlus:                 WideCharArr;
        peMinus:                WideCharArr;
        peMinusPlus:            WideCharArr;
        altNumTable:            WideCharArr;
        reserved:               packed array [0..19] of char;
    end;


    Itl4RecPtr = ^Itl4Rec;
    Itl4Rec = record
        flags:                  SInt16;                             { reserved }
        resourceType:           SInt32;                             { contains 'itl4' }
        resourceNum:            SInt16;                             { resource ID }
        version:                SInt16;                             { version number }
        resHeader1:             SInt32;                             { reserved }
        resHeader2:             SInt32;                             { reserved }
        numTables:              SInt16;                             { number of tables, one-based }
        mapOffset:              SInt32;                             { offset to table that maps byte to token }
        strOffset:              SInt32;                             { offset to routine that copies canonical string }
        fetchOffset:            SInt32;                             { offset to routine that gets next byte of character }
        unTokenOffset:          SInt32;                             { offset to table that maps token to canonical string }
        defPartsOffset:         SInt32;                             { offset to default number parts table }
        resOffset6:             SInt32;                             { reserved }
        resOffset7:             SInt32;                             { reserved }
        resOffset8:             SInt32;                             { reserved }
    end;

    Itl4Ptr                             = ^Itl4Rec;
    Itl4Handle                          = ^Itl4Ptr;
    {    New NItl4Rec for System 7.0:   }
    NItl4RecPtr = ^NItl4Rec;
    NItl4Rec = record
        flags:                  SInt16;                             { reserved }
        resourceType:           SInt32;                             { contains 'itl4' }
        resourceNum:            SInt16;                             { resource ID }
        version:                SInt16;                             { version number }
        format:                 SInt16;                             { format code }
        resHeader:              SInt16;                             { reserved }
        resHeader2:             SInt32;                             { reserved }
        numTables:              SInt16;                             { number of tables, one-based }
        mapOffset:              SInt32;                             { offset to table that maps byte to token }
        strOffset:              SInt32;                             { offset to routine that copies canonical string }
        fetchOffset:            SInt32;                             { offset to routine that gets next byte of character }
        unTokenOffset:          SInt32;                             { offset to table that maps token to canonical string }
        defPartsOffset:         SInt32;                             { offset to default number parts table }
        whtSpListOffset:        SInt32;                             { offset to white space code list }
        resOffset7:             SInt32;                             { reserved }
        resOffset8:             SInt32;                             { reserved }
        resLength1:             SInt16;                             { reserved }
        resLength2:             SInt16;                             { reserved }
        resLength3:             SInt16;                             { reserved }
        unTokenLength:          SInt16;                             { length of untoken table }
        defPartsLength:         SInt16;                             { length of default number parts table }
        whtSpListLength:        SInt16;                             { length of white space code list }
        resLength7:             SInt16;                             { reserved }
        resLength8:             SInt16;                             { reserved }
    end;

    NItl4Ptr                            = ^NItl4Rec;
    NItl4Handle                         = ^NItl4Ptr;

    TableDirectoryRecordPtr = ^TableDirectoryRecord;
    TableDirectoryRecord = record
        tableSignature:         OSType;                                 { 4 byte long table name  }
        reserved:               UInt32;                                 { Reserved for internal use  }
        tableStartOffset:       UInt32;                                 { Table start offset in byte }
        tableSize:              UInt32;                                 { Table size in byte }
    end;

    Itl5RecordPtr = ^Itl5Record;
    Itl5Record = record
        versionNumber:          Fixed;                                  { itl5 resource version number  }
        numberOfTables:         UInt16;                                 { Number of tables it contains  }
        reserved:               array [0..2] of UInt16;                 { Reserved for internal use  }
        tableDirectory:         array [0..0] of TableDirectoryRecord;   { Table directory records  }
    end;

    RuleBasedTrslRecordPtr = ^RuleBasedTrslRecord;
    RuleBasedTrslRecord = record
        sourceType:             SInt16;                             { Transliterate target type for the LHS of the rule  }
        targetType:             SInt16;                             { Transliterate target type for the RHS of the rule  }
        formatNumber:           SInt16;                             { Transliterate resource format number  }
        propertyFlag:           SInt16;                             { Transliterate property flags  }
        numberOfRules:          SInt16;                             { Number of rules following this field  }
    end;


    ItlcRecordPtr = ^ItlcRecord;
    ItlcRecord = record
        itlcSystem:             SInt16;                             { default system script }
        itlcReserved:           SInt16;                             { reserved }
        itlcFontForce:          SInt8;                                  { default font force flag }
        itlcIntlForce:          SInt8;                                  { default intl force flag }
        itlcOldKybd:            SInt8;                                  { MacPlus intl keybd flag }
        itlcFlags:              SInt8;                                  { general flags }
        itlcIconOffset:         SInt16;                             { keyboard icon offset; not used in 7.0 }
        itlcIconSide:           SInt8;                                  { keyboard icon side; not used in 7.0 }
        itlcIconRsvd:           SInt8;                                  { rsvd for other icon info }
        itlcRegionCode:         SInt16;                             { preferred verXxx code }
        itlcSysFlags:           SInt16;                             { flags for setting system globals }
        itlcReserved4:          array [0..31] of SInt8;                 { for future use }
    end;

    ItlbRecordPtr = ^ItlbRecord;
    ItlbRecord = record
        itlbNumber:             SInt16;                             { itl0 id number }
        itlbDate:               SInt16;                             { itl1 id number }
        itlbSort:               SInt16;                             { itl2 id number }
        itlbFlags:              SInt16;                             { Script flags }
        itlbToken:              SInt16;                             { itl4 id number }
        itlbEncoding:           SInt16;                             { itl5 ID # (optional; char encoding) }
        itlbLang:               SInt16;                             { current language for script  }
        itlbNumRep:             SInt8;                                  { number representation code }
        itlbDateRep:            SInt8;                                  { date representation code  }
        itlbKeys:               SInt16;                             { KCHR id number }
        itlbIcon:               SInt16;                             { ID # of SICN or kcs#/kcs4/kcs8 suite. }
    end;

    {    New ItlbExtRecord structure for System 7.0     }
    ItlbExtRecordPtr = ^ItlbExtRecord;
    ItlbExtRecord = packed record
        base:                   ItlbRecord;                             { un-extended ItlbRecord }
        itlbLocalSize:          SInt32;                             { size of script's local record }
        itlbMonoFond:           SInt16;                             { default monospace FOND ID }
        itlbMonoSize:           SInt16;                             { default monospace font size }
        itlbPrefFond:           SInt16;                             { preferred FOND ID }
        itlbPrefSize:           SInt16;                             { preferred font size }
        itlbSmallFond:          SInt16;                             { default small FOND ID }
        itlbSmallSize:          SInt16;                             { default small font size }
        itlbSysFond:            SInt16;                             { default system FOND ID }
        itlbSysSize:            SInt16;                             { default system font size }
        itlbAppFond:            SInt16;                             { default application FOND ID }
        itlbAppSize:            SInt16;                             { default application font size }
        itlbHelpFond:           SInt16;                             { default Help Mgr FOND ID }
        itlbHelpSize:           SInt16;                             { default Help Mgr font size }
        itlbValidStyles:        Style;                                  { set of valid styles for script }
        itlbAliasStyle:         Style;                                  { style (set) to mark aliases }
    end;



{$ALIGN MAC68K}
{#POP}
{unit Keyboards}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}

{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{ Keyboard API constants                                                           }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{ Keyboard API Trap Number. Should be moved to Traps.i }

const
    _KeyboardDispatch           = $AA7A;

    {    Gestalt selector and values for the Keyboard API   }
    gestaltKeyboardsAttr        = $6B626473 (* 'kbds' *);
    gestaltKBPS2Keyboards       = 1;
    gestaltKBPS2SetIDToAny      = 2;
    gestaltKBPS2SetTranslationTable = 4;

    {    Keyboard API Error Codes   }
    {
       I stole the range blow from the empty space in the Allocation project but should
       be updated to the officially registered range.
    }
    errKBPS2KeyboardNotAvailable = -30850;
    errKBIlligalParameters      = -30851;
    errKBFailSettingID          = -30852;
    errKBFailSettingTranslationTable = -30853;
    errKBFailWritePreference    = -30854;


    {    Keyboard HW Layout Types   }
    kKeyboardJIS                = $4A495320 (* 'JIS ' *);
    kKeyboardANSI               = $414E5349 (* 'ANSI' *);
    kKeyboardISO                = $49534F20 (* 'ISO ' *);
    kKeyboardUnknown            = $3F3F3F3F;                    {  '????' }


    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {    Keyboard API types                                                                 }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }



    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {    Keyboard API routines                                                              }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }


{
 *  KBGetLayoutType()
 *
 *  Availability:
 *    Non-Carbon CFM:   in KeyboardsLib 1.0 and later
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function KBGetLayoutType(keyboardType: SInt16): SInt32; external name '_KBGetLayoutType';
{$ALIGN MAC68K}
{#POP}
{unit MacErrors}
{$ALIGN MAC68K}








{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}


const
    paramErr                    = -50;                          { error in user parameter list }
    noHardwareErr               = -200;                         { Sound Manager Error Returns }
    notEnoughHardwareErr        = -201;                         { Sound Manager Error Returns }
    userCanceledErr             = -128;
    qErr                        = -1;                           { queue element not found during deletion }
    vTypErr                     = -2;                           { invalid queue element }
    corErr                      = -3;                           { core routine number out of range }
    unimpErr                    = -4;                           { unimplemented core routine }
    SlpTypeErr                  = -5;                           { invalid queue element }
    seNoDB                      = -8;                           { no debugger installed to handle debugger command }
    controlErr                  = -17;                          { I/O System Errors }
    statusErr                   = -18;                          { I/O System Errors }
    readErr                     = -19;                          { I/O System Errors }
    writErr                     = -20;                          { I/O System Errors }
    badUnitErr                  = -21;                          { I/O System Errors }
    unitEmptyErr                = -22;                          { I/O System Errors }
    openErr                     = -23;                          { I/O System Errors }
    closErr                     = -24;                          { I/O System Errors }
    dRemovErr                   = -25;                          { tried to remove an open driver }
    dInstErr                    = -26;                          { DrvrInstall couldn't find driver in resources }

    abortErr                    = -27;                          { IO call aborted by KillIO }
    iIOAbortErr                 = -27;                          { IO abort error (Printing Manager) }
    notOpenErr                  = -28;                          { Couldn't rd/wr/ctl/sts cause driver not opened }
    unitTblFullErr              = -29;                          { unit table has no more entries }
    dceExtErr                   = -30;                          { dce extension error }
    slotNumErr                  = -360;                         { invalid slot # error }
    gcrOnMFMErr                 = -400;                         { gcr format on high density media error }
    dirFulErr                   = -33;                          { Directory full }
    dskFulErr                   = -34;                          { disk full }
    nsvErr                      = -35;                          { no such volume }
    ioErr                       = -36;                          { I/O error (bummers) }
    bdNamErr                    = -37;                          { there may be no bad names in the final system! }
    fnOpnErr                    = -38;                          { File not open }
    eofErr                      = -39;                          { End of file }
    posErr                      = -40;                          { tried to position to before start of file (r/w) }
    mFulErr                     = -41;                          { memory full (open) or file won't fit (load) }
    tmfoErr                     = -42;                          { too many files open }
    fnfErr                      = -43;                          { File not found }
    wPrErr                      = -44;                          { diskette is write protected. }
    fLckdErr                    = -45;                          { file is locked }

    vLckdErr                    = -46;                          { volume is locked }
    fBsyErr                     = -47;                          { File is busy (delete) }
    dupFNErr                    = -48;                          { duplicate filename (rename) }
    opWrErr                     = -49;                          { file already open with with write permission }
    rfNumErr                    = -51;                          { refnum error }
    gfpErr                      = -52;                          { get file position error }
    volOffLinErr                = -53;                          { volume not on line error (was Ejected) }
    permErr                     = -54;                          { permissions error (on file open) }
    volOnLinErr                 = -55;                          { drive volume already on-line at MountVol }
    nsDrvErr                    = -56;                          { no such drive (tried to mount a bad drive num) }
    noMacDskErr                 = -57;                          { not a mac diskette (sig bytes are wrong) }
    extFSErr                    = -58;                          { volume in question belongs to an external fs }
    fsRnErr                     = -59;                          { file system internal error:during rename the old entry was deleted but could not be restored. }
    badMDBErr                   = -60;                          { bad master directory block }
    wrPermErr                   = -61;                          { write permissions error }
    dirNFErr                    = -120;                         { Directory not found }
    tmwdoErr                    = -121;                         { No free WDCB available }
    badMovErr                   = -122;                         { Move into offspring error }
    wrgVolTypErr                = -123;                         { Wrong volume type error [operation not supported for MFS] }
    volGoneErr                  = -124;                         { Server volume has been disconnected. }

    fidNotFound                 = -1300;                        { no file thread exists. }
    fidExists                   = -1301;                        { file id already exists }
    notAFileErr                 = -1302;                        { directory specified }
    diffVolErr                  = -1303;                        { files on different volumes }
    catChangedErr               = -1304;                        { the catalog has been modified }
    desktopDamagedErr           = -1305;                        { desktop database files are corrupted }
    sameFileErr                 = -1306;                        { can't exchange a file with itself }
    badFidErr                   = -1307;                        { file id is dangling or doesn't match with the file number }
    notARemountErr              = -1308;                        { when _Mount allows only remounts and doesn't get one }
    fileBoundsErr               = -1309;                        { file's EOF, offset, mark or size is too big }
    fsDataTooBigErr             = -1310;                        { file or volume is too big for system }
    volVMBusyErr                = -1311;                        { can't eject because volume is in use by VM }
    badFCBErr                   = -1327;                        { FCBRecPtr is not valid }
    errFSUnknownCall            = -1400;                        {  selector is not recognized by this filesystem  }
    errFSBadFSRef               = -1401;                        {  FSRef parameter is bad  }
    errFSBadForkName            = -1402;                        {  Fork name parameter is bad  }
    errFSBadBuffer              = -1403;                        {  A buffer parameter was bad  }
    errFSBadForkRef             = -1404;                        {  A ForkRefNum parameter was bad  }
    errFSBadInfoBitmap          = -1405;                        {  A CatalogInfoBitmap or VolumeInfoBitmap has reserved or invalid bits set  }
    errFSMissingCatInfo         = -1406;                        {  A CatalogInfo parameter was NULL  }
    errFSNotAFolder             = -1407;                        {  Expected a folder, got a file  }
    errFSForkNotFound           = -1409;                        {  Named fork does not exist  }
    errFSNameTooLong            = -1410;                        {  File/fork name is too long to create/rename  }
    errFSMissingName            = -1411;                        {  A Unicode name parameter was NULL or nameLength parameter was zero  }
    errFSBadPosMode             = -1412;                        {  Newline bits set in positionMode  }
    errFSBadAllocFlags          = -1413;                        {  Invalid bits set in allocationFlags  }
    errFSNoMoreItems            = -1417;                        {  Iteration ran out of items to return  }
    errFSBadItemCount           = -1418;                        {  maximumItems was zero  }
    errFSBadSearchParams        = -1419;                        {  Something wrong with CatalogSearch searchParams  }
    errFSRefsDifferent          = -1420;                        {  FSCompareFSRefs; refs are for different objects  }
    errFSForkExists             = -1421;                        {  Named fork already exists.  }
    errFSBadIteratorFlags       = -1422;                        {  Flags passed to FSOpenIterator are bad  }
    errFSIteratorNotFound       = -1423;                        {  Passed FSIterator is not an open iterator  }
    errFSIteratorNotSupported   = -1424;                        {  The iterator's flags or container are not supported by this call  }
    envNotPresent               = -5500;                        { returned by glue. }
    envBadVers                  = -5501;                        { Version non-positive }
    envVersTooBig               = -5502;                        { Version bigger than call can handle }
    fontDecError                = -64;                          { error during font declaration }
    fontNotDeclared             = -65;                          { font not declared }
    fontSubErr                  = -66;                          { font substitution occurred }
    fontNotOutlineErr           = -32615;                       { bitmap font passed to routine that does outlines only }
    firstDskErr                 = -84;                          { I/O System Errors }
    lastDskErr                  = -64;                          { I/O System Errors }
    noDriveErr                  = -64;                          { drive not installed }
    offLinErr                   = -65;                          { r/w requested for an off-line drive }
    noNybErr                    = -66;                          { couldn't find 5 nybbles in 200 tries }

    noAdrMkErr                  = -67;                          { couldn't find valid addr mark }
    dataVerErr                  = -68;                          { read verify compare failed }
    badCksmErr                  = -69;                          { addr mark checksum didn't check }
    badBtSlpErr                 = -70;                          { bad addr mark bit slip nibbles }
    noDtaMkErr                  = -71;                          { couldn't find a data mark header }
    badDCksum                   = -72;                          { bad data mark checksum }
    badDBtSlp                   = -73;                          { bad data mark bit slip nibbles }
    wrUnderrun                  = -74;                          { write underrun occurred }
    cantStepErr                 = -75;                          { step handshake failed }
    tk0BadErr                   = -76;                          { track 0 detect doesn't change }
    initIWMErr                  = -77;                          { unable to initialize IWM }
    twoSideErr                  = -78;                          { tried to read 2nd side on a 1-sided drive }
    spdAdjErr                   = -79;                          { unable to correctly adjust disk speed }
    seekErr                     = -80;                          { track number wrong on address mark }
    sectNFErr                   = -81;                          { sector number never found on a track }
    fmt1Err                     = -82;                          { can't find sector 0 after track format }
    fmt2Err                     = -83;                          { can't get enough sync }
    verErr                      = -84;                          { track failed to verify }
    clkRdErr                    = -85;                          { unable to read same clock value twice }
    clkWrErr                    = -86;                          { time written did not verify }
    prWrErr                     = -87;                          { parameter ram written didn't read-verify }
    prInitErr                   = -88;                          { InitUtil found the parameter ram uninitialized }
    rcvrErr                     = -89;                          { SCC receiver error (framing; parity; OR) }
    breakRecd                   = -90;                          { Break received (SCC) }

                                                                { Scrap Manager errors }
    noScrapErr                  = -100;                         { No scrap exists error }
    noTypeErr                   = -102;                         { No object of that type in scrap }

                                                                {  ENET error codes  }
    eLenErr                     = -92;                          { Length error ddpLenErr }
    eMultiErr                   = -91;                          { Multicast address error ddpSktErr }

    ddpSktErr                   = -91;                          { error in soket number }
    ddpLenErr                   = -92;                          { data length too big }
    noBridgeErr                 = -93;                          { no network bridge for non-local send }
    lapProtErr                  = -94;                          { error in attaching/detaching protocol }
    excessCollsns               = -95;                          { excessive collisions on write }
    portNotPwr                  = -96;                          { serial port not currently powered }
    portInUse                   = -97;                          { driver Open error code (port is in use) }
    portNotCf                   = -98;                          { driver Open error code (parameter RAM not configured for this connection) }

                                                                {  Memory Manager errors }
    memROZWarn                  = -99;                          { soft error in ROZ }
    memROZError                 = -99;                          { hard error in ROZ }
    memROZErr                   = -99;                          { hard error in ROZ }
    memFullErr                  = -108;                         { Not enough room in heap zone }
    nilHandleErr                = -109;                         { Master Pointer was NIL in HandleZone or other }
    memWZErr                    = -111;                         { WhichZone failed (applied to free block) }
    memPurErr                   = -112;                         { trying to purge a locked or non-purgeable block }
    memAdrErr                   = -110;                         { address was odd; or out of range }
    memAZErr                    = -113;                         { Address in zone check failed }
    memPCErr                    = -114;                         { Pointer Check failed }
    memBCErr                    = -115;                         { Block Check failed }
    memSCErr                    = -116;                         { Size Check failed }
    memLockedErr                = -117;                         { trying to move a locked block (MoveHHi) }

                                                                {  Printing Errors  }
    iMemFullErr                 = -108;
    iIOAbort                    = -27;


    resourceInMemory            = -188;                         { Resource already in memory }
    writingPastEnd              = -189;                         { Writing past end of file }
    inputOutOfBounds            = -190;                         { Offset of Count out of bounds }
    resNotFound                 = -192;                         { Resource not found }
    resFNotFound                = -193;                         { Resource file not found }
    addResFailed                = -194;                         { AddResource failed }
    addRefFailed                = -195;                         { AddReference failed }
    rmvResFailed                = -196;                         { RmveResource failed }
    rmvRefFailed                = -197;                         { RmveReference failed }
    resAttrErr                  = -198;                         { attribute inconsistent with operation }
    mapReadErr                  = -199;                         { map inconsistent with operation }
    CantDecompress              = -186;                         { resource bent ("the bends") - can't decompress a compressed resource }
    badExtResource              = -185;                         { extended resource has a bad format. }
    noMemForPictPlaybackErr     = -145;
    rgnOverflowErr              = -147;
    rgnTooBigError              = -147;
    pixMapTooDeepErr            = -148;
    insufficientStackErr        = -149;
    nsStackErr                  = -149;

    evtNotEnb                   = 1;                            { event not enabled at PostEvent }

    {    OffScreen QuickDraw Errors     }
    cMatchErr                   = -150;                         { Color2Index failed to find an index }
    cTempMemErr                 = -151;                         { failed to allocate memory for temporary structures }
    cNoMemErr                   = -152;                         { failed to allocate memory for structure }
    cRangeErr                   = -153;                         { range error on colorTable request }
    cProtectErr                 = -154;                         { colorTable entry protection violation }
    cDevErr                     = -155;                         { invalid type of graphics device }
    cResErr                     = -156;                         { invalid resolution for MakeITable }
    cDepthErr                   = -157;                         { invalid pixel depth  }
    rgnTooBigErr                = -500;
    updPixMemErr                = -125;                         { insufficient memory to update a pixmap }
    pictInfoVersionErr          = -11000;                       { wrong version of the PictInfo structure }
    pictInfoIDErr               = -11001;                       { the internal consistancy check for the PictInfoID is wrong }
    pictInfoVerbErr             = -11002;                       { the passed verb was invalid }
    cantLoadPickMethodErr       = -11003;                       { unable to load the custom pick proc }
    colorsRequestedErr          = -11004;                       { the number of colors requested was illegal }
    pictureDataErr              = -11005;                       { the picture data was invalid }

    {    ColorSync Result codes     }
                                                                {  General Errors  }
    cmProfileError              = -170;
    cmMethodError               = -171;
    cmMethodNotFound            = -175;                         {  CMM not present  }
    cmProfileNotFound           = -176;                         {  Responder error  }
    cmProfilesIdentical         = -177;                         {  Profiles the same  }
    cmCantConcatenateError      = -178;                         {  Profile can't be concatenated  }
    cmCantXYZ                   = -179;                         {  CMM cant handle XYZ space  }
    cmCantDeleteProfile         = -180;                         {  Responder error  }
    cmUnsupportedDataType       = -181;                         {  Responder error  }
    cmNoCurrentProfile          = -182;                         {  Responder error  }


                                                                { Sound Manager errors }
    noHardware                  = -200;                         { obsolete spelling }
    notEnoughHardware           = -201;                         { obsolete spelling }
    queueFull                   = -203;                         { Sound Manager Error Returns }
    resProblem                  = -204;                         { Sound Manager Error Returns }
    badChannel                  = -205;                         { Sound Manager Error Returns }
    badFormat                   = -206;                         { Sound Manager Error Returns }
    notEnoughBufferSpace        = -207;                         { could not allocate enough memory }
    badFileFormat               = -208;                         { was not type AIFF or was of bad format,corrupt }
    channelBusy                 = -209;                         { the Channel is being used for a PFD already }
    buffersTooSmall             = -210;                         { can not operate in the memory allowed }
    channelNotBusy              = -211;
    noMoreRealTime              = -212;                         { not enough CPU cycles left to add another task }
    siVBRCompressionNotSupported = -213;                        { vbr audio compression not supported for this operation }
    siNoSoundInHardware         = -220;                         { no Sound Input hardware }
    siBadSoundInDevice          = -221;                         { invalid index passed to SoundInGetIndexedDevice }
    siNoBufferSpecified         = -222;                         { returned by synchronous SPBRecord if nil buffer passed }
    siInvalidCompression        = -223;                         { invalid compression type }
    siHardDriveTooSlow          = -224;                         { hard drive too slow to record to disk }
    siInvalidSampleRate         = -225;                         { invalid sample rate }
    siInvalidSampleSize         = -226;                         { invalid sample size }
    siDeviceBusyErr             = -227;                         { input device already in use }
    siBadDeviceName             = -228;                         { input device could not be opened }
    siBadRefNum                 = -229;                         { invalid input device reference number }
    siInputDeviceErr            = -230;                         { input device hardware failure }
    siUnknownInfoType           = -231;                         { invalid info type selector (returned by driver) }
    siUnknownQuality            = -232;                         { invalid quality selector (returned by driver) }

    {   Speech Manager errors   }
    noSynthFound                = -240;
    synthOpenFailed             = -241;
    synthNotReady               = -242;
    bufTooSmall                 = -243;
    voiceNotFound               = -244;
    incompatibleVoice           = -245;
    badDictFormat               = -246;
    badInputText                = -247;

    {    Midi Manager Errors:   }
    midiNoClientErr             = -250;                         { no client with that ID found }
    midiNoPortErr               = -251;                         { no port with that ID found }
    midiTooManyPortsErr         = -252;                         { too many ports already installed in the system }
    midiTooManyConsErr          = -253;                         { too many connections made }
    midiVConnectErr             = -254;                         { pending virtual connection created }
    midiVConnectMade            = -255;                         { pending virtual connection resolved }
    midiVConnectRmvd            = -256;                         { pending virtual connection removed }
    midiNoConErr                = -257;                         { no connection exists between specified ports }
    midiWriteErr                = -258;                         { MIDIWritePacket couldn't write to all connected ports }
    midiNameLenErr              = -259;                         { name supplied is longer than 31 characters }
    midiDupIDErr                = -260;                         { duplicate client ID }
    midiInvalidCmdErr           = -261;                         { command not supported for port type }


    nmTypErr                    = -299;                         { Notification Manager:wrong queue type }


    siInitSDTblErr              = 1;                            { slot int dispatch table could not be initialized. }
    siInitVBLQsErr              = 2;                            { VBLqueues for all slots could not be initialized. }
    siInitSPTblErr              = 3;                            { slot priority table could not be initialized. }
    sdmJTInitErr                = 10;                           { SDM Jump Table could not be initialized. }
    sdmInitErr                  = 11;                           { SDM could not be initialized. }
    sdmSRTInitErr               = 12;                           { Slot Resource Table could not be initialized. }
    sdmPRAMInitErr              = 13;                           { Slot PRAM could not be initialized. }
    sdmPriInitErr               = 14;                           { Cards could not be initialized. }

    smSDMInitErr                = -290;                         { Error; SDM could not be initialized. }
    smSRTInitErr                = -291;                         { Error; Slot Resource Table could not be initialized. }
    smPRAMInitErr               = -292;                         { Error; Slot Resource Table could not be initialized. }
    smPriInitErr                = -293;                         { Error; Cards could not be initialized. }
    smEmptySlot                 = -300;                         { No card in slot }
    smCRCFail                   = -301;                         { CRC check failed for declaration data }
    smFormatErr                 = -302;                         { FHeader Format is not Apple's }
    smRevisionErr               = -303;                         { Wrong revison level }
    smNoDir                     = -304;                         { Directory offset is Nil }
    smDisabledSlot              = -305;                         { This slot is disabled (-305 use to be smLWTstBad) }
    smNosInfoArray              = -306;                         { No sInfoArray. Memory Mgr error. }


    smResrvErr                  = -307;                         { Fatal reserved error. Resreved field <> 0. }
    smUnExBusErr                = -308;                         { Unexpected BusError }
    smBLFieldBad                = -309;                         { ByteLanes field was bad. }
    smFHBlockRdErr              = -310;                         { Error occurred during _sGetFHeader. }
    smFHBlkDispErr              = -311;                         { Error occurred during _sDisposePtr (Dispose of FHeader block). }
    smDisposePErr               = -312;                         { _DisposePointer error }
    smNoBoardSRsrc              = -313;                         { No Board sResource. }
    smGetPRErr                  = -314;                         { Error occurred during _sGetPRAMRec (See SIMStatus). }
    smNoBoardId                 = -315;                         { No Board Id. }
    smInitStatVErr              = -316;                         { The InitStatusV field was negative after primary or secondary init. }
    smInitTblVErr               = -317;                         { An error occurred while trying to initialize the Slot Resource Table. }
    smNoJmpTbl                  = -318;                         { SDM jump table could not be created. }
    smReservedSlot              = -318;                         { slot is reserved, VM should not use this address space. }
    smBadBoardId                = -319;                         { BoardId was wrong; re-init the PRAM record. }
    smBusErrTO                  = -320;                         { BusError time out. }
                                                                {  These errors are logged in the  vendor status field of the sInfo record.  }
    svTempDisable               = -32768;                       { Temporarily disable card but run primary init. }
    svDisabled                  = -32640;                       { Reserve range -32640 to -32768 for Apple temp disables. }
    smBadRefId                  = -330;                         { Reference Id not found in List }
    smBadsList                  = -331;                         { Bad sList: Id1 < Id2 < Id3 ...format is not followed. }
    smReservedErr               = -332;                         { Reserved field not zero }
    smCodeRevErr                = -333;                         { Code revision is wrong }

    smCPUErr                    = -334;                         { Code revision is wrong }
    smsPointerNil               = -335;                         { LPointer is nil From sOffsetData. If this error occurs; check sInfo rec for more information. }
    smNilsBlockErr              = -336;                         { Nil sBlock error (Dont allocate and try to use a nil sBlock) }
    smSlotOOBErr                = -337;                         { Slot out of bounds error }
    smSelOOBErr                 = -338;                         { Selector out of bounds error }
    smNewPErr                   = -339;                         { _NewPtr error }
    smBlkMoveErr                = -340;                         { _BlockMove error }
    smCkStatusErr               = -341;                         { Status of slot = fail. }
    smGetDrvrNamErr             = -342;                         { Error occurred during _sGetDrvrName. }
    smDisDrvrNamErr             = -343;                         { Error occurred during _sDisDrvrName. }
    smNoMoresRsrcs              = -344;                         { No more sResources }
    smsGetDrvrErr               = -345;                         { Error occurred during _sGetDriver. }
    smBadsPtrErr                = -346;                         { Bad pointer was passed to sCalcsPointer }
    smByteLanesErr              = -347;                         { NumByteLanes was determined to be zero. }
    smOffsetErr                 = -348;                         { Offset was too big (temporary error }
    smNoGoodOpens               = -349;                         { No opens were successfull in the loop. }
    smSRTOvrFlErr               = -350;                         { SRT over flow. }
    smRecNotFnd                 = -351;                         { Record not found in the SRT. }


                                                                { Dictionary Manager errors }
    notBTree                    = -410;                         { The file is not a dictionary. }
    btNoSpace                   = -413;                         { Can't allocate disk space. }
    btDupRecErr                 = -414;                         { Record already exists. }
    btRecNotFnd                 = -415;                         { Record cannot be found. }
    btKeyLenErr                 = -416;                         { Maximum key length is too long or equal to zero. }
    btKeyAttrErr                = -417;                         { There is no such a key attribute. }
    unknownInsertModeErr        = -20000;                       { There is no such an insert mode. }
    recordDataTooBigErr         = -20001;                       { The record data is bigger than buffer size (1024 bytes). }
    invalidIndexErr             = -20002;                       { The recordIndex parameter is not valid. }


    {
     * Error codes from FSM functions
        }
    fsmFFSNotFoundErr           = -431;                         {  Foreign File system does not exist - new Pack2 could return this error too  }
    fsmBusyFFSErr               = -432;                         {  File system is busy, cannot be removed  }
    fsmBadFFSNameErr            = -433;                         {  Name length not 1 <= length <= 31  }
    fsmBadFSDLenErr             = -434;                         {  FSD size incompatible with current FSM vers  }
    fsmDuplicateFSIDErr         = -435;                         {  FSID already exists on InstallFS  }
    fsmBadFSDVersionErr         = -436;                         {  FSM version incompatible with FSD  }
    fsmNoAlternateStackErr      = -437;                         {  no alternate stack for HFS CI  }
    fsmUnknownFSMMessageErr     = -438;                         {  unknown message passed to FSM  }


                                                                {  Edition Mgr errors }
    editionMgrInitErr           = -450;                         { edition manager not inited by this app }
    badSectionErr               = -451;                         { not a valid SectionRecord }
    notRegisteredSectionErr     = -452;                         { not a registered SectionRecord }
    badEditionFileErr           = -453;                         { edition file is corrupt }
    badSubPartErr               = -454;                         { can not use sub parts in this release }
    multiplePublisherWrn        = -460;                         { A Publisher is already registered for that container }
    containerNotFoundWrn        = -461;                         { could not find editionContainer at this time }
    containerAlreadyOpenWrn     = -462;                         { container already opened by this section }
    notThePublisherWrn          = -463;                         { not the first registered publisher for that container }

    teScrapSizeErr              = -501;                         { scrap item too big for text edit record }
    hwParamErr                  = -502;                         { bad selector for _HWPriv }
    driverHardwareGoneErr       = -503;                         { disk driver's hardware was disconnected }

                                                                { Process Manager errors }
    procNotFound                = -600;                         { no eligible process with specified descriptor }
    memFragErr                  = -601;                         { not enough room to launch app w/special requirements }
    appModeErr                  = -602;                         { memory mode is 32-bit, but app not 32-bit clean }
    protocolErr                 = -603;                         { app made module calls in improper order }
    hardwareConfigErr           = -604;                         { hardware configuration not correct for call }
    appMemFullErr               = -605;                         { application SIZE not big enough for launch }
    appIsDaemon                 = -606;                         { app is BG-only, and launch flags disallow this }
    bufferIsSmall               = -607;                         { error returns from Post and Accept  }
    noOutstandingHLE            = -608;
    connectionInvalid           = -609;
    noUserInteractionAllowed    = -610;                         {  no user interaction allowed  }

                                                                {  More Process Manager errors  }
    wrongApplicationPlatform    = -875;                         {  The application could not launch because the required platform is not available     }
    appVersionTooOld            = -876;                         {  The application's creator and version are incompatible with the current version of Mac OS.  }
    notAppropriateForClassic    = -877;                         {  This application won't or shouldn't run on Classic (Problem 2481058).  }

    {    Thread Manager Error Codes     }
    threadTooManyReqsErr        = -617;
    threadNotFoundErr           = -618;
    threadProtocolErr           = -619;

    {   MemoryDispatch errors   }
    notEnoughMemoryErr          = -620;                         { insufficient physical memory }
    notHeldErr                  = -621;                         { specified range of memory is not held }
    cannotMakeContiguousErr     = -622;                         { cannot make specified range contiguous }
    notLockedErr                = -623;                         { specified range of memory is not locked }
    interruptsMaskedErr         = -624;                         { donÕt call with interrupts masked }
    cannotDeferErr              = -625;                         { unable to defer additional functions }
    noMMUErr                    = -626;                         { no MMU present }

    {    FileMapping errors     }
    vmInvalidBackingFileIDErr   = -640;                         {  invalid BackingFileID  }
    vmMappingPrivilegesErr      = -641;                         {  requested MappingPrivileges cannot be obtained  }
    vmBusyBackingFileErr        = -642;                         {  open views found on BackingFile  }
    vmNoMoreBackingFilesErr     = -643;                         {  no more BackingFiles were found  }
    vmInvalidFileViewIDErr      = -644;                         { invalid FileViewID  }
    vmFileViewAccessErr         = -645;                         {  requested FileViewAccess cannot be obtained  }
    vmNoMoreFileViewsErr        = -646;                         {  no more FileViews were found  }
    vmAddressNotInFileViewErr   = -647;                         {  address is not in a FileView  }
    vmInvalidOwningProcessErr   = -648;                         {  current process does not own the BackingFileID or FileViewID  }

    {    Database access error codes    }
    rcDBNull                    = -800;
    rcDBValue                   = -801;
    rcDBError                   = -802;
    rcDBBadType                 = -803;
    rcDBBreak                   = -804;
    rcDBExec                    = -805;
    rcDBBadSessID               = -806;
    rcDBBadSessNum              = -807;                         {  bad session number for DBGetConnInfo  }
    rcDBBadDDEV                 = -808;                         {  bad ddev specified on DBInit  }
    rcDBAsyncNotSupp            = -809;                         {  ddev does not support async calls  }
    rcDBBadAsyncPB              = -810;                         {  tried to kill a bad pb  }
    rcDBNoHandler               = -811;                         {  no app handler for specified data type  }
    rcDBWrongVersion            = -812;                         {  incompatible versions  }
    rcDBPackNotInited           = -813;                         {  attempt to call other routine before InitDBPack  }


    {   Help Mgr error range: -850 to -874  }
    hmHelpDisabled              = -850;                         {  Show Balloons mode was off, call to routine ignored  }
    hmBalloonAborted            = -853;                         {  Returned if mouse was moving or mouse wasn't in window port rect  }
    hmSameAsLastBalloon         = -854;                         {  Returned from HMShowMenuBalloon if menu & item is same as last time  }
    hmHelpManagerNotInited      = -855;                         {  Returned from HMGetHelpMenuHandle if help menu not setup  }
    hmSkippedBalloon            = -857;                         {  Returned from calls if helpmsg specified a skip balloon  }
    hmWrongVersion              = -858;                         {  Returned if help mgr resource was the wrong version  }
    hmUnknownHelpType           = -859;                         {  Returned if help msg record contained a bad type  }
    hmOperationUnsupported      = -861;                         {  Returned from HMShowBalloon call if bad method passed to routine  }
    hmNoBalloonUp               = -862;                         {  Returned from HMRemoveBalloon if no balloon was visible when call was made  }
    hmCloseViewActive           = -863;                         {  Returned from HMRemoveBalloon if CloseView was active  }



                                                                { PPC errors }
    notInitErr                  = -900;                         { PPCToolBox not initialized }
    nameTypeErr                 = -902;                         { Invalid or inappropriate locationKindSelector in locationName }
    noPortErr                   = -903;                         { Unable to open port or bad portRefNum.  If you're calling  }
                                                                {  AESend, this is because your application does not have  }
                                                                {  the isHighLevelEventAware bit set in your SIZE resource.  }
    noGlobalsErr                = -904;                         { The system is hosed, better re-boot }
    localOnlyErr                = -905;                         { Network activity is currently disabled }
    destPortErr                 = -906;                         { Port does not exist at destination }
    sessTableErr                = -907;                         { Out of session tables, try again later }
    noSessionErr                = -908;                         { Invalid session reference number }
    badReqErr                   = -909;                         { bad parameter or invalid state for operation }
    portNameExistsErr           = -910;                         { port is already open (perhaps in another app) }
    noUserNameErr               = -911;                         { user name unknown on destination machine }
    userRejectErr               = -912;                         { Destination rejected the session request }
    noMachineNameErr            = -913;                         { user hasn't named his Macintosh in the Network Setup Control Panel }
    noToolboxNameErr            = -914;                         { A system resource is missing, not too likely }
    noResponseErr               = -915;                         { unable to contact destination }
    portClosedErr               = -916;                         { port was closed }
    sessClosedErr               = -917;                         { session was closed }
    badPortNameErr              = -919;                         { PPCPortRec malformed }
    noDefaultUserErr            = -922;                         { user hasn't typed in owners name in Network Setup Control Pannel }
    notLoggedInErr              = -923;                         { The default userRefNum does not yet exist }
    noUserRefErr                = -924;                         { unable to create a new userRefNum }
    networkErr                  = -925;                         { An error has occurred in the network, not too likely }
    noInformErr                 = -926;                         { PPCStart failed because destination did not have inform pending }
    authFailErr                 = -927;                         { unable to authenticate user at destination }
    noUserRecErr                = -928;                         { Invalid user reference number }
    badServiceMethodErr         = -930;                         { illegal service type, or not supported }
    badLocNameErr               = -931;                         { location name malformed }
    guestNotAllowedErr          = -932;                         { destination port requires authentication }

    {  Font Mgr errors }
    kFMIterationCompleted       = -980;
    kFMInvalidFontFamilyErr     = -981;
    kFMInvalidFontErr           = -982;
    kFMIterationScopeModifiedErr = -983;
    kFMFontTableAccessErr       = -984;
    kFMFontContainerAccessErr   = -985;

    noMaskFoundErr              = -1000;                        { Icon Utilties Error }

    nbpBuffOvr                  = -1024;                        { Buffer overflow in LookupName }
    nbpNoConfirm                = -1025;
    nbpConfDiff                 = -1026;                        { Name confirmed at different socket }
    nbpDuplicate                = -1027;                        { Duplicate name exists already }
    nbpNotFound                 = -1028;                        { Name not found on remove }
    nbpNISErr                   = -1029;                        { Error trying to open the NIS }

    aspBadVersNum               = -1066;                        { Server cannot support this ASP version }
    aspBufTooSmall              = -1067;                        { Buffer too small }
    aspNoMoreSess               = -1068;                        { No more sessions on server }
    aspNoServers                = -1069;                        { No servers at that address }
    aspParamErr                 = -1070;                        { Parameter error }
    aspServerBusy               = -1071;                        { Server cannot open another session }
    aspSessClosed               = -1072;                        { Session closed }
    aspSizeErr                  = -1073;                        { Command block too big }
    aspTooMany                  = -1074;                        { Too many clients (server error) }
    aspNoAck                    = -1075;                        { No ack on attention request (server err) }

    reqFailed                   = -1096;
    tooManyReqs                 = -1097;
    tooManySkts                 = -1098;
    badATPSkt                   = -1099;
    badBuffNum                  = -1100;
    noRelErr                    = -1101;
    cbNotFound                  = -1102;
    noSendResp                  = -1103;
    noDataArea                  = -1104;
    reqAborted                  = -1105;

    {    ADSP Error Codes   }
                                                                {  driver control ioResults  }
    errRefNum                   = -1280;                        {  bad connection refNum  }
    errAborted                  = -1279;                        {  control call was aborted  }
    errState                    = -1278;                        {  bad connection state for this operation  }
    errOpening                  = -1277;                        {  open connection request failed  }
    errAttention                = -1276;                        {  attention message too long  }
    errFwdReset                 = -1275;                        {  read terminated by forward reset  }
    errDSPQueueSize             = -1274;                        {  DSP Read/Write Queue Too small  }
    errOpenDenied               = -1273;                        {  open connection request was denied  }


    {   --------------------------------------------------------------
            Apple event manager error messages
    --------------------------------------------------------------  }

    errAECoercionFail           = -1700;                        {  bad parameter data or unable to coerce the data supplied  }
    errAEDescNotFound           = -1701;
    errAECorruptData            = -1702;
    errAEWrongDataType          = -1703;
    errAENotAEDesc              = -1704;
    errAEBadListItem            = -1705;                        {  the specified list item does not exist  }
    errAENewerVersion           = -1706;                        {  need newer version of the AppleEvent manager  }
    errAENotAppleEvent          = -1707;                        {  the event is not in AppleEvent format  }
    errAEEventNotHandled        = -1708;                        {  the AppleEvent was not handled by any handler  }
    errAEReplyNotValid          = -1709;                        {  AEResetTimer was passed an invalid reply parameter  }
    errAEUnknownSendMode        = -1710;                        {  mode wasn't NoReply, WaitReply, or QueueReply or Interaction level is unknown  }
    errAEWaitCanceled           = -1711;                        {  in AESend, the user cancelled out of wait loop for reply or receipt  }
    errAETimeout                = -1712;                        {  the AppleEvent timed out  }
    errAENoUserInteraction      = -1713;                        {  no user interaction is allowed  }
    errAENotASpecialFunction    = -1714;                        {  there is no special function for/with this keyword  }
    errAEParamMissed            = -1715;                        {  a required parameter was not accessed  }
    errAEUnknownAddressType     = -1716;                        {  the target address type is not known  }
    errAEHandlerNotFound        = -1717;                        {  no handler in the dispatch tables fits the parameters to AEGetEventHandler or AEGetCoercionHandler  }
    errAEReplyNotArrived        = -1718;                        {  the contents of the reply you are accessing have not arrived yet  }
    errAEIllegalIndex           = -1719;                        {  index is out of range in a put operation  }
    errAEImpossibleRange        = -1720;                        {  A range like 3rd to 2nd, or 1st to all.  }
    errAEWrongNumberArgs        = -1721;                        {  Logical op kAENOT used with other than 1 term  }
    errAEAccessorNotFound       = -1723;                        {  Accessor proc matching wantClass and containerType or wildcards not found  }
    errAENoSuchLogical          = -1725;                        {  Something other than AND, OR, or NOT  }
    errAEBadTestKey             = -1726;                        {  Test is neither typeLogicalDescriptor nor typeCompDescriptor  }
    errAENotAnObjSpec           = -1727;                        {  Param to AEResolve not of type 'obj '  }
    errAENoSuchObject           = -1728;                        {  e.g.,: specifier asked for the 3rd, but there are only 2. Basically, this indicates a run-time resolution error.  }
    errAENegativeCount          = -1729;                        {  CountProc returned negative value  }
    errAEEmptyListContainer     = -1730;                        {  Attempt to pass empty list as container to accessor  }
    errAEUnknownObjectType      = -1731;                        {  available only in version 1.0.1 or greater  }
    errAERecordingIsAlreadyOn   = -1732;                        {  available only in version 1.0.1 or greater  }
    errAEReceiveTerminate       = -1733;                        {  break out of all levels of AEReceive to the topmost (1.1 or greater)  }
    errAEReceiveEscapeCurrent   = -1734;                        {  break out of only lowest level of AEReceive (1.1 or greater)  }
    errAEEventFiltered          = -1735;                        {  event has been filtered, and should not be propogated (1.1 or greater)  }
    errAEDuplicateHandler       = -1736;                        {  attempt to install handler in table for identical class and id (1.1 or greater)  }
    errAEStreamBadNesting       = -1737;                        {  nesting violation while streaming  }
    errAEStreamAlreadyConverted = -1738;                        {  attempt to convert a stream that has already been converted  }
    errAEDescIsNull             = -1739;                        {  attempting to perform an invalid operation on a null descriptor  }
    errAEBuildSyntaxError       = -1740;                        {  AEBuildDesc and friends detected a syntax error  }
    errAEBufferTooSmall         = -1741;                        {  buffer for AEFlattenDesc too small  }

    errOSASystemError           = -1750;
    errOSAInvalidID             = -1751;
    errOSABadStorageType        = -1752;
    errOSAScriptError           = -1753;
    errOSABadSelector           = -1754;
    errOSASourceNotAvailable    = -1756;
    errOSANoSuchDialect         = -1757;
    errOSADataFormatObsolete    = -1758;
    errOSADataFormatTooNew      = -1759;
    errOSACorruptData           = -1702;
    errOSARecordingIsAlreadyOn  = -1732;
    errOSAComponentMismatch     = -1761;                        {  Parameters are from 2 different components  }
    errOSACantOpenComponent     = -1762;                        {  Can't connect to scripting system with that ID  }



    {    AppleEvent error definitions   }
    errOffsetInvalid            = -1800;
    errOffsetIsOutsideOfView    = -1801;
    errTopOfDocument            = -1810;
    errTopOfBody                = -1811;
    errEndOfDocument            = -1812;
    errEndOfBody                = -1813;


                                                                {  Drag Manager error codes  }
    badDragRefErr               = -1850;                        {  unknown drag reference  }
    badDragItemErr              = -1851;                        {  unknown drag item reference  }
    badDragFlavorErr            = -1852;                        {  unknown flavor type  }
    duplicateFlavorErr          = -1853;                        {  flavor type already exists  }
    cantGetFlavorErr            = -1854;                        {  error while trying to get flavor data  }
    duplicateHandlerErr         = -1855;                        {  handler already exists  }
    handlerNotFoundErr          = -1856;                        {  handler not found  }
    dragNotAcceptedErr          = -1857;                        {  drag was not accepted by receiver  }
    unsupportedForPlatformErr   = -1858;                        {  call is for PowerPC only  }
    noSuitableDisplaysErr       = -1859;                        {  no displays support translucency  }
    badImageRgnErr              = -1860;                        {  bad translucent image region  }
    badImageErr                 = -1861;                        {  bad translucent image PixMap  }
    nonDragOriginatorErr        = -1862;                        {  illegal attempt at originator only data  }


    {   QuickTime errors    }
    couldNotResolveDataRef      = -2000;
    badImageDescription         = -2001;
    badPublicMovieAtom          = -2002;
    cantFindHandler             = -2003;
    cantOpenHandler             = -2004;
    badComponentType            = -2005;
    noMediaHandler              = -2006;
    noDataHandler               = -2007;
    invalidMedia                = -2008;
    invalidTrack                = -2009;
    invalidMovie                = -2010;
    invalidSampleTable          = -2011;
    invalidDataRef              = -2012;
    invalidHandler              = -2013;
    invalidDuration             = -2014;
    invalidTime                 = -2015;
    cantPutPublicMovieAtom      = -2016;
    badEditList                 = -2017;
    mediaTypesDontMatch         = -2018;
    progressProcAborted         = -2019;
    movieToolboxUninitialized   = -2020;
    noRecordOfApp               = -2020;                        {  replica  }
    wfFileNotFound              = -2021;
    cantCreateSingleForkFile    = -2022;                        {  happens when file already exists  }
    invalidEditState            = -2023;
    nonMatchingEditState        = -2024;
    staleEditState              = -2025;
    userDataItemNotFound        = -2026;
    maxSizeToGrowTooSmall       = -2027;
    badTrackIndex               = -2028;
    trackIDNotFound             = -2029;
    trackNotInMovie             = -2030;
    timeNotInTrack              = -2031;
    timeNotInMedia              = -2032;
    badEditIndex                = -2033;
    internalQuickTimeError      = -2034;
    cantEnableTrack             = -2035;
    invalidRect                 = -2036;
    invalidSampleNum            = -2037;
    invalidChunkNum             = -2038;
    invalidSampleDescIndex      = -2039;
    invalidChunkCache           = -2040;
    invalidSampleDescription    = -2041;
    dataNotOpenForRead          = -2042;
    dataNotOpenForWrite         = -2043;
    dataAlreadyOpenForWrite     = -2044;
    dataAlreadyClosed           = -2045;
    endOfDataReached            = -2046;
    dataNoDataRef               = -2047;
    noMovieFound                = -2048;
    invalidDataRefContainer     = -2049;
    badDataRefIndex             = -2050;
    noDefaultDataRef            = -2051;
    couldNotUseAnExistingSample = -2052;
    featureUnsupported          = -2053;
    noVideoTrackInMovieErr      = -2054;                        {  QT for Windows error  }
    noSoundTrackInMovieErr      = -2055;                        {  QT for Windows error  }
    soundSupportNotAvailableErr = -2056;                        {  QT for Windows error  }
    unsupportedAuxiliaryImportData = -2057;
    auxiliaryExportDataUnavailable = -2058;
    samplesAlreadyInMediaErr    = -2059;
    noSourceTreeFoundErr        = -2060;
    sourceNotFoundErr           = -2061;
    movieTextNotFoundErr        = -2062;
    missingRequiredParameterErr = -2063;
    invalidSpriteWorldPropertyErr = -2064;
    invalidSpritePropertyErr    = -2065;
    gWorldsNotSameDepthAndSizeErr = -2066;
    invalidSpriteIndexErr       = -2067;
    invalidImageIndexErr        = -2068;
    invalidSpriteIDErr          = -2069;

    internalComponentErr        = -2070;
    notImplementedMusicOSErr    = -2071;
    cantSendToSynthesizerOSErr  = -2072;
    cantReceiveFromSynthesizerOSErr = -2073;
    illegalVoiceAllocationOSErr = -2074;
    illegalPartOSErr            = -2075;
    illegalChannelOSErr         = -2076;
    illegalKnobOSErr            = -2077;
    illegalKnobValueOSErr       = -2078;
    illegalInstrumentOSErr      = -2079;
    illegalControllerOSErr      = -2080;
    midiManagerAbsentOSErr      = -2081;
    synthesizerNotRespondingOSErr = -2082;
    synthesizerOSErr            = -2083;
    illegalNoteChannelOSErr     = -2084;
    noteChannelNotAllocatedOSErr = -2085;
    tunePlayerFullOSErr         = -2086;
    tuneParseOSErr              = -2087;
    noExportProcAvailableErr    = -2089;
    videoOutputInUseErr         = -2090;

    componentDllLoadErr         = -2091;                        {  Windows specific errors (when component is loading) }
    componentDllEntryNotFoundErr = -2092;                       {  Windows specific errors (when component is loading) }
    qtmlDllLoadErr              = -2093;                        {  Windows specific errors (when qtml is loading) }
    qtmlDllEntryNotFoundErr     = -2094;                        {  Windows specific errors (when qtml is loading) }
    qtmlUninitialized           = -2095;
    unsupportedOSErr            = -2096;
    unsupportedProcessorErr     = -2097;

    cannotFindAtomErr           = -2101;
    notLeafAtomErr              = -2102;
    atomsNotOfSameTypeErr       = -2103;
    atomIndexInvalidErr         = -2104;
    duplicateAtomTypeAndIDErr   = -2105;
    invalidAtomErr              = -2106;
    invalidAtomContainerErr     = -2107;
    invalidAtomTypeErr          = -2108;
    cannotBeLeafAtomErr         = -2109;
    pathTooLongErr              = -2110;
    emptyPathErr                = -2111;
    noPathMappingErr            = -2112;
    pathNotVerifiedErr          = -2113;
    unknownFormatErr            = -2114;
    wackBadFileErr              = -2115;
    wackForkNotFoundErr         = -2116;
    wackBadMetaDataErr          = -2117;
    qfcbNotFoundErr             = -2118;
    qfcbNotCreatedErr           = -2119;
    AAPNotCreatedErr            = -2120;
    AAPNotFoundErr              = -2121;
    ASDBadHeaderErr             = -2122;
    ASDBadForkErr               = -2123;
    ASDEntryNotFoundErr         = -2124;
    fileOffsetTooBigErr         = -2125;
    notAllowedToSaveMovieErr    = -2126;
    qtNetworkAlreadyAllocatedErr = -2127;
    urlDataHHTTPProtocolErr     = -2129;
    urlDataHHTTPNoNetDriverErr  = -2130;
    urlDataHHTTPURLErr          = -2131;
    urlDataHHTTPRedirectErr     = -2132;
    urlDataHFTPProtocolErr      = -2133;
    urlDataHFTPShutdownErr      = -2134;
    urlDataHFTPBadUserErr       = -2135;
    urlDataHFTPBadPasswordErr   = -2136;
    urlDataHFTPServerErr        = -2137;
    urlDataHFTPDataConnectionErr = -2138;
    urlDataHFTPNoDirectoryErr   = -2139;
    urlDataHFTPQuotaErr         = -2140;
    urlDataHFTPPermissionsErr   = -2141;
    urlDataHFTPFilenameErr      = -2142;
    urlDataHFTPNoNetDriverErr   = -2143;
    urlDataHFTPBadNameListErr   = -2144;
    urlDataHFTPNeedPasswordErr  = -2145;
    urlDataHFTPNoPasswordErr    = -2146;
    urlDataHFTPServerDisconnectedErr = -2147;
    urlDataHFTPURLErr           = -2148;
    notEnoughDataErr            = -2149;
    qtActionNotHandledErr       = -2157;
    qtXMLParseErr               = -2158;
    qtXMLApplicationErr         = -2159;


    digiUnimpErr                = -2201;                        {  feature unimplemented  }
    qtParamErr                  = -2202;                        {  bad input parameter (out of range, etc)  }
    matrixErr                   = -2203;                        {  bad matrix, digitizer did nothing  }
    notExactMatrixErr           = -2204;                        {  warning of bad matrix, digitizer did its best  }
    noMoreKeyColorsErr          = -2205;                        {  all key indexes in use  }
    notExactSizeErr             = -2206;                        {  CanÕt do exact size requested  }
    badDepthErr                 = -2207;                        {  CanÕt digitize into this depth  }
    noDMAErr                    = -2208;                        {  CanÕt do DMA digitizing (i.e. can't go to requested dest  }
    badCallOrderErr             = -2209;                        {  Usually due to a status call being called prior to being setup first  }


    {     Kernel Error Codes    }
    kernelIncompleteErr         = -2401;
    kernelCanceledErr           = -2402;
    kernelOptionsErr            = -2403;
    kernelPrivilegeErr          = -2404;
    kernelUnsupportedErr        = -2405;
    kernelObjectExistsErr       = -2406;
    kernelWritePermissionErr    = -2407;
    kernelReadPermissionErr     = -2408;
    kernelExecutePermissionErr  = -2409;
    kernelDeletePermissionErr   = -2410;
    kernelExecutionLevelErr     = -2411;
    kernelAttributeErr          = -2412;
    kernelAsyncSendLimitErr     = -2413;
    kernelAsyncReceiveLimitErr  = -2414;
    kernelTimeoutErr            = -2415;
    kernelInUseErr              = -2416;
    kernelTerminatedErr         = -2417;
    kernelExceptionErr          = -2418;
    kernelIDErr                 = -2419;
    kernelAlreadyFreeErr        = -2421;
    kernelReturnValueErr        = -2422;
    kernelUnrecoverableErr      = -2499;



                                                                {  Text Services Mgr error codes  }
    tsmComponentNoErr           = 0;                            {  component result = no error  }
    tsmUnsupScriptLanguageErr   = -2500;
    tsmInputMethodNotFoundErr   = -2501;
    tsmNotAnAppErr              = -2502;                        {  not an application error  }
    tsmAlreadyRegisteredErr     = -2503;                        {  want to register again error  }
    tsmNeverRegisteredErr       = -2504;                        {  app never registered error (not TSM aware)  }
    tsmInvalidDocIDErr          = -2505;                        {  invalid TSM documentation id  }
    tsmTSMDocBusyErr            = -2506;                        {  document is still active  }
    tsmDocNotActiveErr          = -2507;                        {  document is NOT active  }
    tsmNoOpenTSErr              = -2508;                        {  no open text service  }
    tsmCantOpenComponentErr     = -2509;                        {  canÕt open the component  }
    tsmTextServiceNotFoundErr   = -2510;                        {  no text service found  }
    tsmDocumentOpenErr          = -2511;                        {  there are open documents  }
    tsmUseInputWindowErr        = -2512;                        {  not TSM aware because we are using input window  }
    tsmTSHasNoMenuErr           = -2513;                        {  the text service has no menu  }
    tsmTSNotOpenErr             = -2514;                        {  text service is not open  }
    tsmComponentAlreadyOpenErr  = -2515;                        {  text service already opened for the document  }
    tsmInputMethodIsOldErr      = -2516;                        {  returned by GetDefaultInputMethod  }
    tsmScriptHasNoIMErr         = -2517;                        {  script has no imput method or is using old IM  }
    tsmUnsupportedTypeErr       = -2518;                        {  unSupported interface type error  }
    tsmUnknownErr               = -2519;                        {  any other errors  }
    tsmInvalidContext           = -2520;                        {  Invalid TSMContext specified in call  }
    tsmNoHandler                = -2521;                        {  No Callback Handler exists for callback  }
    tsmNoMoreTokens             = -2522;                        {  No more tokens are available for the source text  }
    tsmNoStem                   = -2523;                        {  No stem exists for the token  }
    tsmDefaultIsNotInputMethodErr = -2524;                      {  Current Input source is KCHR or uchr, not Input Method  (GetDefaultInputMethod)  }


                                                                {  Mixed Mode error codes  }
    mmInternalError             = -2526;

    {    NameRegistry error codes   }
    nrLockedErr                 = -2536;
    nrNotEnoughMemoryErr        = -2537;
    nrInvalidNodeErr            = -2538;
    nrNotFoundErr               = -2539;
    nrNotCreatedErr             = -2540;
    nrNameErr                   = -2541;
    nrNotSlotDeviceErr          = -2542;
    nrDataTruncatedErr          = -2543;
    nrPowerErr                  = -2544;
    nrPowerSwitchAbortErr       = -2545;
    nrTypeMismatchErr           = -2546;
    nrNotModifiedErr            = -2547;
    nrOverrunErr                = -2548;
    nrResultCodeBase            = -2549;
    nrPathNotFound              = -2550;                        {  a path component lookup failed  }
    nrPathBufferTooSmall        = -2551;                        {  buffer for path is too small  }
    nrInvalidEntryIterationOp   = -2552;                        {  invalid entry iteration operation  }
    nrPropertyAlreadyExists     = -2553;                        {  property already exists  }
    nrIterationDone             = -2554;                        {  iteration operation is done  }
    nrExitedIteratorScope       = -2555;                        {  outer scope of iterator was exited  }
    nrTransactionAborted        = -2556;                        {  transaction was aborted  }
    nrCallNotSupported          = -2557;                        {  This call is not available or supported on this machine  }

    {    Icon Services error codes  }
    invalidIconRefErr           = -2580;                        {  The icon ref is not valid  }
    noSuchIconErr               = -2581;                        {  The requested icon could not be found  }
    noIconDataAvailableErr      = -2582;                        {  The necessary icon data is not available  }


    {
        Dynamic AppleScript errors:

        These errors result from data-dependent conditions and are typically
        signaled at runtime.
        }
    errOSACantCoerce            = -1700;                        {  Signaled when a value can't be coerced to the desired type.  }
    errOSACantAccess            = -1728;                        {  Signaled when an object is not found in a container }
    errOSACantAssign            = -10006;                       {  Signaled when an object cannot be set in a container. }
    errOSAGeneralError          = -2700;                        {  Signaled by user scripts or applications when no actual error code is to be returned. }
    errOSADivideByZero          = -2701;                        {  Signaled when there is an attempt to divide by zero }
    errOSANumericOverflow       = -2702;                        {  Signaled when SInt16 or real value is too large to be represented }
    errOSACantLaunch            = -2703;                        {  Signaled when application can't be launched or when it is remote and program linking is not enabled }
    errOSAAppNotHighLevelEventAware = -2704;                    {  Signaled when an application can't respond to AppleEvents }
    errOSACorruptTerminology    = -2705;                        {  Signaled when an application's terminology resource is not readable }
    errOSAStackOverflow         = -2706;                        {  Signaled when the runtime stack overflows }
    errOSAInternalTableOverflow = -2707;                        {  Signaled when a runtime internal data structure overflows }
    errOSADataBlockTooLarge     = -2708;                        {  Signaled when an intrinsic limitation is exceeded for the size of a value or data structure. }
    errOSACantGetTerminology    = -2709;
    errOSACantCreate            = -2710;

    {
        Component-specific dynamic script errors:

        The range -2720 thru -2739 is reserved for component-specific runtime errors.
        (Note that error codes from different scripting components in this range will
        overlap.)
        }
    {
        Static AppleScript errors:

        These errors comprise what are commonly thought of as parse and compile-
        time errors.  However, in a dynamic system (e.g. AppleScript) any or all
        of these may also occur at runtime.
        }
    errOSATypeError             = -1703;
    OSAMessageNotUnderstood     = -1708;                        {  Signaled when a message was sent to an object that didn't handle it }
    OSAUndefinedHandler         = -1717;                        {  Signaled when a function to be returned doesn't exist.  }
    OSAIllegalAccess            = -1723;                        {  Signaled when a container can never have the requested object }
    OSAIllegalIndex             = -1719;                        {  Signaled when index was out of range. Specialization of errOSACantAccess }
    OSAIllegalRange             = -1720;                        {  Signaled when a range is screwy. Specialization of errOSACantAccess }
    OSAIllegalAssign            = -10003;                       {  Signaled when an object can never be set in a container }
    OSASyntaxError              = -2740;                        {  Signaled when a syntax error occurs. (e.g. "Syntax error" or "<this> can't go after <that>") }
    OSASyntaxTypeError          = -2741;                        {  Signaled when another form of syntax was expected. (e.g. "expected a <type> but found <this>") }
    OSATokenTooLong             = -2742;                        {  Signaled when a name or number is too long to be parsed }
    OSAMissingParameter         = -1701;                        {  Signaled when a parameter is missing for a function invocation }
    OSAParameterMismatch        = -1721;                        {  Signaled when function is called with the wrong number of parameters, or a parameter pattern cannot be matched }
    OSADuplicateParameter       = -2750;                        {  Signaled when a formal parameter, local variable, or instance variable is specified more than once }
    OSADuplicateProperty        = -2751;                        {  Signaled when a formal parameter, local variable, or instance variable is specified more than once. }
    OSADuplicateHandler         = -2752;                        {  Signaled when more than one handler is defined with the same name in a scope where the language doesn't allow it }
    OSAUndefinedVariable        = -2753;                        {  Signaled when a variable is accessed that has no value }
    OSAInconsistentDeclarations = -2754;                        {  Signaled when a variable is declared inconsistently in the same scope, such as both local and global }
    OSAControlFlowError         = -2755;                        {  Signaled when illegal control flow occurs in an application (no catcher for throw, non-lexical loop exit, etc.) }

    {
        Component-specific AppleScript static errors:

        The range -2760 thru -2779 is reserved for component-specific parsing and
        compile-time errors. (Note that error codes from different scripting
        components in this range will overlap.)
        }
    {
        Dialect-specific AppleScript errors:

        The range -2780 thru -2799 is reserved for dialect specific error codes for
        scripting components that support dialects. (Note that error codes from
        different scripting components in this range will overlap, as well as error
        codes from different dialects in the same scripting component.)
        }

    {   *************************************************************************
        Apple Script Error Codes
    *************************************************************************   }
    {    Runtime errors:    }
    errASCantConsiderAndIgnore  = -2720;
    errASCantCompareMoreThan32k = -2721;                        {  Parser/Compiler errors:  }
    errASTerminologyNestingTooDeep = -2760;
    errASIllegalFormalParameter = -2761;
    errASParameterNotForEvent   = -2762;
    errASNoResultReturned       = -2763;                        {     The range -2780 thru -2799 is reserved for dialect specific error codes. (Error codes from different dialects may overlap.)  }
    errASInconsistentNames      = -2780;                        {     English errors:  }


    {  The preferred spelling for Code Fragment Manager errors: }
    cfragFirstErrCode           = -2800;                        {  The first value in the range of CFM errors. }
    cfragContextIDErr           = -2800;                        {  The context ID was not valid. }
    cfragConnectionIDErr        = -2801;                        {  The connection ID was not valid. }
    cfragNoSymbolErr            = -2802;                        {  The specified symbol was not found. }
    cfragNoSectionErr           = -2803;                        {  The specified section was not found. }
    cfragNoLibraryErr           = -2804;                        {  The named library was not found. }
    cfragDupRegistrationErr     = -2805;                        {  The registration name was already in use. }
    cfragFragmentFormatErr      = -2806;                        {  A fragment's container format is unknown. }
    cfragUnresolvedErr          = -2807;                        {  A fragment had "hard" unresolved imports. }
    cfragNoPositionErr          = -2808;                        {  The registration insertion point was not found. }
    cfragNoPrivateMemErr        = -2809;                        {  Out of memory for internal bookkeeping. }
    cfragNoClientMemErr         = -2810;                        {  Out of memory for fragment mapping or section instances. }
    cfragNoIDsErr               = -2811;                        {  No more CFM IDs for contexts, connections, etc. }
    cfragInitOrderErr           = -2812;                        {   }
    cfragImportTooOldErr        = -2813;                        {  An import library was too old for a client. }
    cfragImportTooNewErr        = -2814;                        {  An import library was too new for a client. }
    cfragInitLoopErr            = -2815;                        {  Circularity in required initialization order. }
    cfragInitAtBootErr          = -2816;                        {  A boot library has an initialization function.  (System 7 only) }
    cfragLibConnErr             = -2817;                        {   }
    cfragCFMStartupErr          = -2818;                        {  Internal error during CFM initialization. }
    cfragCFMInternalErr         = -2819;                        {  An internal inconstistancy has been detected. }
    cfragFragmentCorruptErr     = -2820;                        {  A fragment's container was corrupt (known format). }
    cfragInitFunctionErr        = -2821;                        {  A fragment's initialization routine returned an error. }
    cfragNoApplicationErr       = -2822;                        {  No application member found in the cfrg resource. }
    cfragArchitectureErr        = -2823;                        {  A fragment has an unacceptable architecture. }
    cfragFragmentUsageErr       = -2824;                        {  A semantic error in usage of the fragment. }
    cfragFileSizeErr            = -2825;                        {  A file was too large to be mapped. }
    cfragNotClosureErr          = -2826;                        {  The closure ID was actually a connection ID. }
    cfragNoRegistrationErr      = -2827;                        {  The registration name was not found. }
    cfragContainerIDErr         = -2828;                        {  The fragment container ID was not valid. }
    cfragClosureIDErr           = -2829;                        {  The closure ID was not valid. }
    cfragAbortClosureErr        = -2830;                        {  Used by notification handlers to abort a closure. }
    cfragOutputLengthErr        = -2831;                        {  An output parameter is too small to hold the value. }
    cfragLastErrCode            = -2899;                        {  The last value in the range of CFM errors. }


    {   Component Manager & component errors    }
    invalidComponentID          = -3000;
    validInstancesExist         = -3001;
    componentNotCaptured        = -3002;
    componentDontRegister       = -3003;
    unresolvedComponentDLLErr   = -3004;
    retryComponentRegistrationErr = -3005;

    {   Translation manager & Translation components    }
    invalidTranslationPathErr   = -3025;                        { Source type to destination type not a valid path }
    couldNotParseSourceFileErr  = -3026;                        { Source document does not contain source type }
    noTranslationPathErr        = -3030;
    badTranslationSpecErr       = -3031;
    noPrefAppErr                = -3032;

    buf2SmallErr                = -3101;
    noMPPErr                    = -3102;
    ckSumErr                    = -3103;
    extractErr                  = -3104;
    readQErr                    = -3105;
    atpLenErr                   = -3106;
    atpBadRsp                   = -3107;
    recNotFnd                   = -3108;
    sktClosedErr                = -3109;


    {  OpenTransport errors }
    kOTNoError                  = 0;                            {  No Error occurred                     }
    kOTOutOfMemoryErr           = -3211;                        {  OT ran out of memory, may be a temporary       }
    kOTNotFoundErr              = -3201;                        {  OT generic not found error                }
    kOTDuplicateFoundErr        = -3216;                        {  OT generic duplicate found error              }
    kOTBadAddressErr            = -3150;                        {  XTI2OSStatus(TBADADDR) A Bad address was specified           }
    kOTBadOptionErr             = -3151;                        {  XTI2OSStatus(TBADOPT) A Bad option was specified              }
    kOTAccessErr                = -3152;                        {  XTI2OSStatus(TACCES) Missing access permission            }
    kOTBadReferenceErr          = -3153;                        {  XTI2OSStatus(TBADF) Bad provider reference                }
    kOTNoAddressErr             = -3154;                        {  XTI2OSStatus(TNOADDR) No address was specified            }
    kOTOutStateErr              = -3155;                        {  XTI2OSStatus(TOUTSTATE) Call issued in wrong state            }
    kOTBadSequenceErr           = -3156;                        {  XTI2OSStatus(TBADSEQ) Sequence specified does not exist          }
    kOTSysErrorErr              = -3157;                        {  XTI2OSStatus(TSYSERR) A system error occurred             }
    kOTLookErr                  = -3158;                        {  XTI2OSStatus(TLOOK) An event occurred - call Look()          }
    kOTBadDataErr               = -3159;                        {  XTI2OSStatus(TBADDATA) An illegal amount of data was specified  }
    kOTBufferOverflowErr        = -3160;                        {  XTI2OSStatus(TBUFOVFLW) Passed buffer not big enough           }
    kOTFlowErr                  = -3161;                        {  XTI2OSStatus(TFLOW) Provider is flow-controlled           }
    kOTNoDataErr                = -3162;                        {  XTI2OSStatus(TNODATA) No data available for reading           }
    kOTNoDisconnectErr          = -3163;                        {  XTI2OSStatus(TNODIS) No disconnect indication available          }
    kOTNoUDErrErr               = -3164;                        {  XTI2OSStatus(TNOUDERR) No Unit Data Error indication available  }
    kOTBadFlagErr               = -3165;                        {  XTI2OSStatus(TBADFLAG) A Bad flag value was supplied           }
    kOTNoReleaseErr             = -3166;                        {  XTI2OSStatus(TNOREL) No orderly release indication available    }
    kOTNotSupportedErr          = -3167;                        {  XTI2OSStatus(TNOTSUPPORT) Command is not supported            }
    kOTStateChangeErr           = -3168;                        {  XTI2OSStatus(TSTATECHNG) State is changing - try again later      }
    kOTNoStructureTypeErr       = -3169;                        {  XTI2OSStatus(TNOSTRUCTYPE) Bad structure type requested for OTAlloc     }
    kOTBadNameErr               = -3170;                        {  XTI2OSStatus(TBADNAME) A bad endpoint name was supplied          }
    kOTBadQLenErr               = -3171;                        {  XTI2OSStatus(TBADQLEN) A Bind to an in-use addr with qlen > 0    }
    kOTAddressBusyErr           = -3172;                        {  XTI2OSStatus(TADDRBUSY) Address requested is already in use        }
    kOTIndOutErr                = -3173;                        {  XTI2OSStatus(TINDOUT) Accept failed because of pending listen   }
    kOTProviderMismatchErr      = -3174;                        {  XTI2OSStatus(TPROVMISMATCH) Tried to accept on incompatible endpoint    }
    kOTResQLenErr               = -3175;                        {  XTI2OSStatus(TRESQLEN)                             }
    kOTResAddressErr            = -3176;                        {  XTI2OSStatus(TRESADDR)                             }
    kOTQFullErr                 = -3177;                        {  XTI2OSStatus(TQFULL)                           }
    kOTProtocolErr              = -3178;                        {  XTI2OSStatus(TPROTO) An unspecified provider error occurred        }
    kOTBadSyncErr               = -3179;                        {  XTI2OSStatus(TBADSYNC) A synchronous call at interrupt time        }
    kOTCanceledErr              = -3180;                        {  XTI2OSStatus(TCANCELED) The command was cancelled             }
    kEPERMErr                   = -3200;                        {  Permission denied             }
    kENOENTErr                  = -3201;                        {  No such file or directory        }
    kENORSRCErr                 = -3202;                        {  No such resource                }
    kEINTRErr                   = -3203;                        {  Interrupted system service         }
    kEIOErr                     = -3204;                        {  I/O error                  }
    kENXIOErr                   = -3205;                        {  No such device or address        }
    kEBADFErr                   = -3208;                        {  Bad file number                  }
    kEAGAINErr                  = -3210;                        {  Try operation again later        }
    kENOMEMErr                  = -3211;                        {  Not enough space                }
    kEACCESErr                  = -3212;                        {  Permission denied             }
    kEFAULTErr                  = -3213;                        {  Bad address                    }
    kEBUSYErr                   = -3215;                        {  Device or resource busy           }
    kEEXISTErr                  = -3216;                        {  File exists                    }
    kENODEVErr                  = -3218;                        {  No such device                }
    kEINVALErr                  = -3221;                        {  Invalid argument                }
    kENOTTYErr                  = -3224;                        {  Not a character device           }
    kEPIPEErr                   = -3231;                        {  Broken pipe                    }
    kERANGEErr                  = -3233;                        {  Message size too large for STREAM   }
    kEWOULDBLOCKErr             = -3234;                        {  Call would block, so was aborted      }
    kEDEADLKErr                 = -3234;                        {  or a deadlock would occur        }
    kEALREADYErr                = -3236;                        {                            }
    kENOTSOCKErr                = -3237;                        {  Socket operation on non-socket      }
    kEDESTADDRREQErr            = -3238;                        {  Destination address required       }
    kEMSGSIZEErr                = -3239;                        {  Message too long                }
    kEPROTOTYPEErr              = -3240;                        {  Protocol wrong type for socket      }
    kENOPROTOOPTErr             = -3241;                        {  Protocol not available           }
    kEPROTONOSUPPORTErr         = -3242;                        {  Protocol not supported           }
    kESOCKTNOSUPPORTErr         = -3243;                        {  Socket type not supported        }
    kEOPNOTSUPPErr              = -3244;                        {  Operation not supported on socket   }
    kEADDRINUSEErr              = -3247;                        {  Address already in use           }
    kEADDRNOTAVAILErr           = -3248;                        {  Can't assign requested address      }
    kENETDOWNErr                = -3249;                        {  Network is down                  }
    kENETUNREACHErr             = -3250;                        {  Network is unreachable           }
    kENETRESETErr               = -3251;                        {  Network dropped connection on reset     }
    kECONNABORTEDErr            = -3252;                        {  Software caused connection abort      }
    kECONNRESETErr              = -3253;                        {  Connection reset by peer           }
    kENOBUFSErr                 = -3254;                        {  No buffer space available        }
    kEISCONNErr                 = -3255;                        {  Socket is already connected          }
    kENOTCONNErr                = -3256;                        {  Socket is not connected           }
    kESHUTDOWNErr               = -3257;                        {  Can't send after socket shutdown      }
    kETOOMANYREFSErr            = -3258;                        {  Too many references: can't splice   }
    kETIMEDOUTErr               = -3259;                        {  Connection timed out              }
    kECONNREFUSEDErr            = -3260;                        {  Connection refused            }
    kEHOSTDOWNErr               = -3263;                        {  Host is down                 }
    kEHOSTUNREACHErr            = -3264;                        {  No route to host                }
    kEPROTOErr                  = -3269;                        {  ¥¥¥ fill out missing codes ¥¥¥      }
    kETIMEErr                   = -3270;                        {                            }
    kENOSRErr                   = -3271;                        {                            }
    kEBADMSGErr                 = -3272;                        {                            }
    kECANCELErr                 = -3273;                        {                            }
    kENOSTRErr                  = -3274;                        {                            }
    kENODATAErr                 = -3275;                        {                            }
    kEINPROGRESSErr             = -3276;                        {                            }
    kESRCHErr                   = -3277;                        {                            }
    kENOMSGErr                  = -3278;                        {                            }
    kOTClientNotInittedErr      = -3279;                        {                            }
    kOTPortHasDiedErr           = -3280;                        {                            }
    kOTPortWasEjectedErr        = -3281;                        {                            }
    kOTBadConfigurationErr      = -3282;                        {                            }
    kOTConfigurationChangedErr  = -3283;                        {                            }
    kOTUserRequestedErr         = -3284;                        {                            }
    kOTPortLostConnection       = -3285;                        {                            }


    {  Color Picker errors }
    firstPickerError            = -4000;
    invalidPickerType           = -4000;
    requiredFlagsDontMatch      = -4001;
    pickerResourceError         = -4002;
    cantLoadPicker              = -4003;
    cantCreatePickerWindow      = -4004;
    cantLoadPackage             = -4005;
    pickerCantLive              = -4006;
    colorSyncNotInstalled       = -4007;
    badProfileError             = -4008;
    noHelpForItem               = -4009;



    {  NSL error codes }
    kNSL68kContextNotSupported  = -4170;                        {  no 68k allowed }
    kNSLSchedulerError          = -4171;                        {  A custom thread routine encountered an error }
    kNSLBadURLSyntax            = -4172;                        {  URL contains illegal characters }
    kNSLNoCarbonLib             = -4173;
    kNSLUILibraryNotAvailable   = -4174;                        {  The NSL UI Library needs to be in the Extensions Folder }
    kNSLNotImplementedYet       = -4175;
    kNSLErrNullPtrError         = -4176;
    kNSLSomePluginsFailedToLoad = -4177;                        {  (one or more plugins failed to load, but at least one did load; this error isn't fatal) }
    kNSLNullNeighborhoodPtr     = -4178;                        {  (client passed a null neighborhood ptr) }
    kNSLNoPluginsForSearch      = -4179;                        {  (no plugins will respond to search request; bad protocol(s)?) }
    kNSLSearchAlreadyInProgress = -4180;                        {  (you can only have one ongoing search per clientRef) }
    kNSLNoPluginsFound          = -4181;                        {  (manager didn't find any valid plugins to load) }
    kNSLPluginLoadFailed        = -4182;                        {  (manager unable to load one of the plugins) }
    kNSLBadProtocolTypeErr      = -4183;                        {  (client is trying to add a null protocol type) }
    kNSLNullListPtr             = -4184;                        {  (client is trying to add items to a nil list) }
    kNSLBadClientInfoPtr        = -4185;                        {  (nil ClientAsyncInfoPtr; no reference available) }
    kNSLCannotContinueLookup    = -4186;                        {  (Can't continue lookup; error or bad state) }
    kNSLBufferTooSmallForData   = -4187;                        {  (Client buffer too small for data from plugin) }
    kNSLNoContextAvailable      = -4188;                        {  (ContinueLookup function ptr invalid) }
    kNSLRequestBufferAlreadyInList = -4189;
    kNSLInvalidPluginSpec       = -4190;
    kNSLNoSupportForService     = -4191;
    kNSLBadNetConnection        = -4192;
    kNSLBadDataTypeErr          = -4193;
    kNSLBadServiceTypeErr       = -4194;
    kNSLBadReferenceErr         = -4195;
    kNSLNoElementsInList        = -4196;
    kNSLInsufficientOTVer       = -4197;
    kNSLInsufficientSysVer      = -4198;
    kNSLNotInitialized          = -4199;
    kNSLInitializationFailed    = -4200;                        {  UNABLE TO INITIALIZE THE MANAGER!!!!! DO NOT CONTINUE!!!! }



    {  desktop printing error codes }
    kDTPHoldJobErr              = -4200;
    kDTPStopQueueErr            = -4201;
    kDTPTryAgainErr             = -4202;
    kDTPAbortJobErr             = 128;


    {    ColorSync Result codes     }
                                                                {  Profile Access Errors  }
    cmElementTagNotFound        = -4200;
    cmIndexRangeErr             = -4201;                        {  Tag index out of range  }
    cmCantDeleteElement         = -4202;
    cmFatalProfileErr           = -4203;
    cmInvalidProfile            = -4204;                        {  A Profile must contain a 'cs1 ' tag to be valid  }
    cmInvalidProfileLocation    = -4205;                        {  Operation not supported for this profile location  }
    cmCantCopyModifiedV1Profile = -4215;                        {  Illegal to copy version 1 profiles that have been modified  }
                                                                {  Profile Search Errors  }
    cmInvalidSearch             = -4206;                        {  Bad Search Handle  }
    cmSearchError               = -4207;
    cmErrIncompatibleProfile    = -4208;                        {  Other ColorSync Errors  }
    cmInvalidColorSpace         = -4209;                        {  Profile colorspace does not match bitmap type  }
    cmInvalidSrcMap             = -4210;                        {  Source pix/bit map was invalid  }
    cmInvalidDstMap             = -4211;                        {  Destination pix/bit map was invalid  }
    cmNoGDevicesError           = -4212;                        {  Begin/End Matching -- no gdevices available  }
    cmInvalidProfileComment     = -4213;                        {  Bad Profile comment during drawpicture  }
    cmRangeOverFlow             = -4214;                        {  Color conversion warning that some output color values over/underflowed and were clipped  }
    cmNamedColorNotFound        = -4216;                        {  NamedColor not found  }
    cmCantGamutCheckError       = -4217;                        {  Gammut checking not supported by this ColorWorld  }

    {  new Folder Manager error codes  }
    badFolderDescErr            = -4270;
    duplicateFolderDescErr      = -4271;
    noMoreFolderDescErr         = -4272;
    invalidFolderTypeErr        = -4273;
    duplicateRoutingErr         = -4274;
    routingNotFoundErr          = -4275;
    badRoutingSizeErr           = -4276;


    {  Core Foundation errors }
    coreFoundationUnknownErr    = -4960;

    {  ScrapMgr error codes (CarbonLib 1.0 and later) }
    internalScrapErr            = -4988;
    duplicateScrapFlavorErr     = -4989;
    badScrapRefErr              = -4990;
    processStateIncorrectErr    = -4991;
    scrapPromiseNotKeptErr      = -4992;
    noScrapPromiseKeeperErr     = -4993;
    nilScrapFlavorDataErr       = -4994;
    scrapFlavorFlagsMismatchErr = -4995;
    scrapFlavorSizeMismatchErr  = -4996;
    illegalScrapFlavorFlagsErr  = -4997;
    illegalScrapFlavorTypeErr   = -4998;
    illegalScrapFlavorSizeErr   = -4999;
    scrapFlavorNotFoundErr      = -102;                         {  == noTypeErr }
    needClearScrapErr           = -100;                         {  == noScrapErr }


                                                                {   AFP Protocol Errors  }
    afpAccessDenied             = -5000;                        {  Insufficient access privileges for operation  }
    afpAuthContinue             = -5001;                        {  Further information required to complete AFPLogin call  }
    afpBadUAM                   = -5002;                        {  Unknown user authentication method specified  }
    afpBadVersNum               = -5003;                        {  Unknown AFP protocol version number specified  }
    afpBitmapErr                = -5004;                        {  Bitmap contained bits undefined for call  }
    afpCantMove                 = -5005;                        {  Move destination is offspring of source, or root was specified  }
    afpDenyConflict             = -5006;                        {  Specified open/deny modes conflict with current open modes  }
    afpDirNotEmpty              = -5007;                        {  Cannot delete non-empty directory  }
    afpDiskFull                 = -5008;                        {  Insufficient free space on volume for operation  }
    afpEofError                 = -5009;                        {  Read beyond logical end-of-file  }
    afpFileBusy                 = -5010;                        {  Cannot delete an open file  }
    afpFlatVol                  = -5011;                        {  Cannot create directory on specified volume  }
    afpItemNotFound             = -5012;                        {  Unknown UserName/UserID or missing comment/APPL entry  }
    afpLockErr                  = -5013;                        {  Some or all of requested range is locked by another user  }
    afpMiscErr                  = -5014;                        {  Unexpected error encountered during execution  }
    afpNoMoreLocks              = -5015;                        {  Maximum lock limit reached  }
    afpNoServer                 = -5016;                        {  Server not responding  }
    afpObjectExists             = -5017;                        {  Specified destination file or directory already exists  }
    afpObjectNotFound           = -5018;                        {  Specified file or directory does not exist  }
    afpParmErr                  = -5019;                        {  A specified parameter was out of allowable range  }
    afpRangeNotLocked           = -5020;                        {  Tried to unlock range that was not locked by user  }
    afpRangeOverlap             = -5021;                        {  Some or all of range already locked by same user  }
    afpSessClosed               = -5022;                        {  Session closed }
    afpUserNotAuth              = -5023;                        {  No AFPLogin call has successfully been made for this session  }
    afpCallNotSupported         = -5024;                        {  Unsupported AFP call was made  }
    afpObjectTypeErr            = -5025;                        {  File/Directory specified where Directory/File expected  }
    afpTooManyFilesOpen         = -5026;                        {  Maximum open file count reached  }
    afpServerGoingDown          = -5027;                        {  Server is shutting down  }
    afpCantRename               = -5028;                        {  AFPRename cannot rename volume  }
    afpDirNotFound              = -5029;                        {  Unknown directory specified  }
    afpIconTypeError            = -5030;                        {  Icon size specified different from existing icon size  }
    afpVolLocked                = -5031;                        {  Volume is Read-Only  }
    afpObjectLocked             = -5032;                        {  Object is M/R/D/W inhibited }
    afpContainsSharedErr        = -5033;                        {  the folder being shared contains a shared folder }
    afpIDNotFound               = -5034;
    afpIDExists                 = -5035;
    afpDiffVolErr               = -5036;
    afpCatalogChanged           = -5037;
    afpSameObjectErr            = -5038;
    afpBadIDErr                 = -5039;
    afpPwdSameErr               = -5040;                        {  Someone tried to change their password to the same password on a mantadory password change  }
    afpPwdTooShortErr           = -5041;                        {  The password being set is too short: there is a minimum length that must be met or exceeded  }
    afpPwdExpiredErr            = -5042;                        {  The password being used is too old: this requires the user to change the password before log-in can continue  }
    afpInsideSharedErr          = -5043;                        {  The folder being shared is inside a shared folder OR the folder contains a shared folder and is being moved into a shared folder  }
                                                                {  OR the folder contains a shared folder and is being moved into the descendent of a shared folder. }
    afpInsideTrashErr           = -5044;                        {  The folder being shared is inside the trash folder OR the shared folder is being moved into the trash folder  }
                                                                {  OR the folder is being moved to the trash and it contains a shared folder  }
    afpPwdNeedsChangeErr        = -5045;                        {  The password needs to be changed }
    afpPwdPolicyErr             = -5046;                        {  Password does not conform to servers password policy  }
    afpAlreadyLoggedInErr       = -5047;                        {  User has been authenticated but is already logged in from another machine (and that's not allowed on this server)  }
    afpCallNotAllowed           = -5048;                        {  The server knows what you wanted to do, but won't let you do it just now  }

                                                                {   AppleShare Client Errors  }
    afpBadDirIDType             = -5060;
    afpCantMountMoreSrvre       = -5061;                        {  The Maximum number of server connections has been reached  }
    afpAlreadyMounted           = -5062;                        {  The volume is already mounted  }
    afpSameNodeErr              = -5063;                        {  An Attempt was made to connect to a file server running on the same machine  }



    { Text Engines, TSystemTextEngines, HIEditText error coded }

    errUnknownAttributeTag      = -5240;
    errMarginWilllNotFit        = -5241;
    errNotInImagingMode         = -5242;
    errAlreadyInImagingMode     = -5243;
    errEngineNotFound           = -5244;
    errIteratorReachedEnd       = -5245;
    errInvalidRange             = -5246;
    errOffsetNotOnElementBounday = -5247;
    errNoHiliteText             = -5248;
    errEmptyScrap               = -5249;
    errReadOnlyText             = -5250;
    errUnknownElement           = -5251;
    errNonContiuousAttribute    = -5252;
    errCannotUndo               = -5253;


    {  HTMLRendering OSStaus codes }
    hrHTMLRenderingLibNotInstalledErr = -5360;
    hrMiscellaneousExceptionErr = -5361;
    hrUnableToResizeHandleErr   = -5362;
    hrURLNotHandledErr          = -5363;


    {    IAExtractor result codes   }
    errIANoErr                  = 0;
    errIAUnknownErr             = -5380;
    errIAAllocationErr          = -5381;
    errIAParamErr               = -5382;
    errIANoMoreItems            = -5383;
    errIABufferTooSmall         = -5384;
    errIACanceled               = -5385;
    errIAInvalidDocument        = -5386;
    errIATextExtractionErr      = -5387;
    errIAEndOfTextRun           = -5388;


    {    QuickTime Streaming Errors     }
    qtsBadSelectorErr           = -5400;
    qtsBadStateErr              = -5401;
    qtsBadDataErr               = -5402;                        {  something is wrong with the data  }
    qtsUnsupportedDataTypeErr   = -5403;
    qtsUnsupportedRateErr       = -5404;
    qtsUnsupportedFeatureErr    = -5405;
    qtsTooMuchDataErr           = -5406;
    qtsUnknownValueErr          = -5407;
    qtsTimeoutErr               = -5408;
    qtsConnectionFailedErr      = -5420;
    qtsAddressBusyErr           = -5421;


                                                                { Gestalt error codes }
    gestaltUnknownErr           = -5550;                        { value returned if Gestalt doesn't know the answer }
    gestaltUndefSelectorErr     = -5551;                        { undefined selector was passed to Gestalt }
    gestaltDupSelectorErr       = -5552;                        { tried to add an entry that already existed }
    gestaltLocationErr          = -5553;                        { gestalt function ptr wasn't in sysheap }


    {  Menu Manager error codes }
    menuPropertyInvalidErr      = -5603;                        {  invalid property creator  }
    menuPropertyInvalid         = -5603;                        {  "menuPropertyInvalid" is deprecated  }
    menuPropertyNotFoundErr     = -5604;                        {  specified property wasn't found  }
    menuNotFoundErr             = -5620;                        {  specified menu or menu ID wasn't found  }
    menuUsesSystemDefErr        = -5621;                        {  GetMenuDefinition failed because the menu uses the system MDEF  }
    menuItemNotFoundErr         = -5622;                        {  specified menu item wasn't found }
    menuInvalidErr              = -5623;                        {  menu is invalid }


    {  Window Manager error codes }
    errInvalidWindowPtr         = -5600;                        {  tried to pass a bad WindowRef argument }
    errInvalidWindowRef         = -5600;                        {  tried to pass a bad WindowRef argument }
    errUnsupportedWindowAttributesForClass = -5601;             {  tried to create a window with WindowAttributes not supported by the WindowClass }
    errWindowDoesNotHaveProxy   = -5602;                        {  tried to do something requiring a proxy to a window which doesnÕt have a proxy }
    errInvalidWindowProperty    = -5603;                        {  tried to access a property tag with private creator }
    errWindowPropertyNotFound   = -5604;                        {  tried to get a nonexistent property }
    errUnrecognizedWindowClass  = -5605;                        {  tried to create a window with a bad WindowClass }
    errCorruptWindowDescription = -5606;                        {  tried to load a corrupt window description (size or version fields incorrect) }
    errUserWantsToDragWindow    = -5607;                        {  if returned from TrackWindowProxyDrag, you should call DragWindow on the window }
    errWindowsAlreadyInitialized = -5608;                       {  tried to call InitFloatingWindows twice, or called InitWindows and then floating windows }
    errFloatingWindowsNotInitialized = -5609;                   {  called HideFloatingWindows or ShowFloatingWindows without calling InitFloatingWindows }
    errWindowNotFound           = -5610;                        {  returned from FindWindowOfClass }
    errWindowDoesNotFitOnscreen = -5611;                        {  ConstrainWindowToScreen could not make the window fit onscreen }
    windowAttributeImmutableErr = -5612;                        {  tried to change attributes which can't be changed }
    windowAttributesConflictErr = -5613;                        {  passed some attributes that are mutually exclusive }
    windowManagerInternalErr    = -5614;                        {  something really weird happened inside the window manager }
    windowWrongStateErr         = -5615;                        {  window is not in a state that is valid for the current action }
    windowGroupInvalidErr       = -5616;                        {  WindowGroup is invalid }
    windowAppModalStateAlreadyExistsErr = -5617;                {  we're already running this window modally }
    windowNoAppModalStateErr    = -5618;                        {  there's no app modal state for the window }
    errWindowDoesntSupportFocus = -30583;
    errWindowRegionCodeInvalid  = -30593;


    {  Dialog Mgr error codes }
    dialogNoTimeoutErr          = -5640;


    {  NavigationLib error codes }
    kNavWrongDialogStateErr     = -5694;
    kNavWrongDialogClassErr     = -5695;
    kNavInvalidSystemConfigErr  = -5696;
    kNavCustomControlMessageFailedErr = -5697;
    kNavInvalidCustomControlMessageErr = -5698;
    kNavMissingKindStringErr    = -5699;


    {    Collection Manager errors  }
    collectionItemLockedErr     = -5750;
    collectionItemNotFoundErr   = -5751;
    collectionIndexRangeErr     = -5752;
    collectionVersionErr        = -5753;


    {    QuickTime Streaming Server Errors  }
    kQTSSUnknownErr             = -6150;


                                                                {  Display Manager error codes (-6220...-6269) }
    kDMGenErr                   = -6220;                        { Unexpected Error }
                                                                {  Mirroring-Specific Errors  }
    kDMMirroringOnAlready       = -6221;                        { Returned by all calls that need mirroring to be off to do their thing. }
    kDMWrongNumberOfDisplays    = -6222;                        { Can only handle 2 displays for now. }
    kDMMirroringBlocked         = -6223;                        { DMBlockMirroring() has been called. }
    kDMCantBlock                = -6224;                        { Mirroring is already on, canÕt Block now (call DMUnMirror() first). }
    kDMMirroringNotOn           = -6225;                        { Returned by all calls that need mirroring to be on to do their thing. }
                                                                {  Other Display Manager Errors  }
    kSysSWTooOld                = -6226;                        { Missing critical pieces of System Software. }
    kDMSWNotInitializedErr      = -6227;                        { Required software not initialized (eg windowmanager or display mgr). }
    kDMDriverNotDisplayMgrAwareErr = -6228;                     { Video Driver does not support display manager. }
    kDMDisplayNotFoundErr       = -6229;                        { Could not find item (will someday remove). }
    kDMNotFoundErr              = -6229;                        { Could not find item. }
    kDMDisplayAlreadyInstalledErr = -6230;                      { Attempt to add an already installed display. }
    kDMMainDisplayCannotMoveErr = -6231;                        { Trying to move main display (or a display mirrored to it)  }
    kDMNoDeviceTableclothErr    = -6231;                        { obsolete }
    kDMFoundErr                 = -6232;                        { Did not proceed because we found an item }


    {
        Language Analysis error codes
        }
    laTooSmallBufferErr         = -6984;                        {  output buffer is too small to store any result  }
    laEnvironmentBusyErr        = -6985;                        {  specified environment is used  }
    laEnvironmentNotFoundErr    = -6986;                        {  can't fint the specified environment  }
    laEnvironmentExistErr       = -6987;                        {  same name environment is already exists  }
    laInvalidPathErr            = -6988;                        {  path is not correct  }
    laNoMoreMorphemeErr         = -6989;                        {  nothing to read }
    laFailAnalysisErr           = -6990;                        {  analysis failed }
    laTextOverFlowErr           = -6991;                        {  text is too long }
    laDictionaryNotOpenedErr    = -6992;                        {  the dictionary is not opened }
    laDictionaryUnknownErr      = -6993;                        {  can't use this dictionary with this environment }
    laDictionaryTooManyErr      = -6994;                        {  too many dictionaries }
    laPropertyValueErr          = -6995;                        {  Invalid property value }
    laPropertyUnknownErr        = -6996;                        {  the property is unknown to this environment }
    laPropertyIsReadOnlyErr     = -6997;                        {  the property is read only }
    laPropertyNotFoundErr       = -6998;                        {  can't find the property }
    laPropertyErr               = -6999;                        {  Error in properties }
    laEngineNotFoundErr         = -7000;                        {  can't find the engine }


    kUSBNoErr                   = 0;
    kUSBNoTran                  = 0;
    kUSBNoDelay                 = 0;
    kUSBPending                 = 1;

    {

       USB Hardware Errors
       Note pipe stalls are communication
       errors. The affected pipe can not
       be used until USBClearPipeStallByReference
       is used.
       kUSBEndpointStallErr is returned in
       response to a stall handshake
       from a device. The device has to be
       cleared before a USBClearPipeStallByReference
       can be used.
    }
    kUSBNotSent2Err             = -6901;                        {   Transaction not sent  }
    kUSBNotSent1Err             = -6902;                        {   Transaction not sent  }
    kUSBBufUnderRunErr          = -6903;                        {   Host hardware failure on data out, PCI busy?  }
    kUSBBufOvrRunErr            = -6904;                        {   Host hardware failure on data in, PCI busy?  }
    kUSBRes2Err                 = -6905;
    kUSBRes1Err                 = -6906;
    kUSBUnderRunErr             = -6907;                        {   Less data than buffer  }
    kUSBOverRunErr              = -6908;                        {   Packet too large or more data than buffer  }
    kUSBWrongPIDErr             = -6909;                        {   Pipe stall, Bad or wrong PID  }
    kUSBPIDCheckErr             = -6910;                        {   Pipe stall, PID CRC error  }
    kUSBNotRespondingErr        = -6911;                        {   Pipe stall, No device, device hung  }
    kUSBEndpointStallErr        = -6912;                        {   Device didn't understand  }
    kUSBDataToggleErr           = -6913;                        {   Pipe stall, Bad data toggle  }
    kUSBBitstufErr              = -6914;                        {   Pipe stall, bitstuffing  }
    kUSBCRCErr                  = -6915;                        {   Pipe stall, bad CRC  }
    kUSBLinkErr                 = -6916;


    {

       USB Manager Errors
    }
    kUSBQueueFull               = -6948;                        {  Internal queue maxxed   }
    kUSBNotHandled              = -6987;                        {  Notification was not handled   (same as NotFound) }
    kUSBUnknownNotification     = -6949;                        {  Notification type not defined   }
    kUSBBadDispatchTable        = -6950;                        {  Improper driver dispatch table      }


    {  USB Services Errors  }
    kUSBPortDisabled            = -6969;                        {  The port you are attached to is disabled, use USBDeviceReset. }
    kUSBQueueAborted            = -6970;                        {  Pipe zero stall cleared. }
    kUSBTimedOut                = -6971;                        {  Transaction timed out.  }
    kUSBDeviceDisconnected      = -6972;                        {  Disconnected during suspend or reset  }
    kUSBDeviceNotSuspended      = -6973;                        {  device is not suspended for resume  }
    kUSBDeviceSuspended         = -6974;                        {  Device is suspended  }
    kUSBInvalidBuffer           = -6975;                        {  bad buffer, usually nil  }
    kUSBDevicePowerProblem      = -6976;                        {   Device has a power problem  }
    kUSBDeviceBusy              = -6977;                        {   Device is already being configured  }
    kUSBUnknownInterfaceErr     = -6978;                        {   Interface ref not recognised  }
    kUSBPipeStalledError        = -6979;                        {   Pipe has stalled, error needs to be cleared  }
    kUSBPipeIdleError           = -6980;                        {   Pipe is Idle, it will not accept transactions  }
    kUSBNoBandwidthError        = -6981;                        {   Not enough bandwidth available  }
    kUSBAbortedError            = -6982;                        {   Pipe aborted  }
    kUSBFlagsError              = -6983;                        {   Unused flags not zeroed  }
    kUSBCompletionError         = -6984;                        {   no completion routine specified  }
    kUSBPBLengthError           = -6985;                        {   pbLength too small  }
    kUSBPBVersionError          = -6986;                        {   Wrong pbVersion  }
    kUSBNotFound                = -6987;                        {   Not found  }
    kUSBOutOfMemoryErr          = -6988;                        {   Out of memory  }
    kUSBDeviceErr               = -6989;                        {   Device error  }
    kUSBNoDeviceErr             = -6990;                        {   No device }
    kUSBAlreadyOpenErr          = -6991;                        {   Already open  }
    kUSBTooManyTransactionsErr  = -6992;                        {   Too many transactions  }
    kUSBUnknownRequestErr       = -6993;                        {   Unknown request  }
    kUSBRqErr                   = -6994;                        {   Request error  }
    kUSBIncorrectTypeErr        = -6995;                        {   Incorrect type  }
    kUSBTooManyPipesErr         = -6996;                        {   Too many pipes  }
    kUSBUnknownPipeErr          = -6997;                        {   Pipe ref not recognised  }
    kUSBUnknownDeviceErr        = -6998;                        {   device ref not recognised  }
    kUSBInternalErr             = -6999;                        {  Internal error  }


    {
        DictionaryMgr error codes
        }
    dcmParamErr                 = -7100;                        {  bad parameter }
    dcmNotDictionaryErr         = -7101;                        {  not dictionary }
    dcmBadDictionaryErr         = -7102;                        {  invalid dictionary }
    dcmPermissionErr            = -7103;                        {  invalid permission }
    dcmDictionaryNotOpenErr     = -7104;                        {  dictionary not opened }
    dcmDictionaryBusyErr        = -7105;                        {  dictionary is busy }
    dcmBlockFullErr             = -7107;                        {  dictionary block full }
    dcmNoRecordErr              = -7108;                        {  no such record }
    dcmDupRecordErr             = -7109;                        {  same record already exist }
    dcmNecessaryFieldErr        = -7110;                        {  lack required/identify field }
    dcmBadFieldInfoErr          = -7111;                        {  incomplete information }
    dcmBadFieldTypeErr          = -7112;                        {  no such field type supported }
    dcmNoFieldErr               = -7113;                        {  no such field exist }
    dcmBadKeyErr                = -7115;                        {  bad key information }
    dcmTooManyKeyErr            = -7116;                        {  too many key field }
    dcmBadDataSizeErr           = -7117;                        {  too big data size }
    dcmBadFindMethodErr         = -7118;                        {  no such find method supported }
    dcmBadPropertyErr           = -7119;                        {  no such property exist }
    dcmProtectedErr             = -7121;                        {  need keyword to use dictionary }
    dcmNoAccessMethodErr        = -7122;                        {  no such AccessMethod }
    dcmBadFeatureErr            = -7124;                        {  invalid AccessMethod feature }
    dcmIterationCompleteErr     = -7126;                        {  no more item in iterator }
    dcmBufferOverflowErr        = -7127;                        {  data is larger than buffer size }


    {  Apple Remote Access error codes }
    kRAInvalidParameter         = -7100;
    kRAInvalidPort              = -7101;
    kRAStartupFailed            = -7102;
    kRAPortSetupFailed          = -7103;
    kRAOutOfMemory              = -7104;
    kRANotSupported             = -7105;
    kRAMissingResources         = -7106;
    kRAIncompatiblePrefs        = -7107;
    kRANotConnected             = -7108;
    kRAConnectionCanceled       = -7109;
    kRAUnknownUser              = -7110;
    kRAInvalidPassword          = -7111;
    kRAInternalError            = -7112;
    kRAInstallationDamaged      = -7113;
    kRAPortBusy                 = -7114;
    kRAUnknownPortState         = -7115;
    kRAInvalidPortState         = -7116;
    kRAInvalidSerialProtocol    = -7117;
    kRAUserLoginDisabled        = -7118;
    kRAUserPwdChangeRequired    = -7119;
    kRAUserPwdEntryRequired     = -7120;
    kRAUserInteractionRequired  = -7121;
    kRAInitOpenTransportFailed  = -7122;
    kRARemoteAccessNotReady     = -7123;
    kRATCPIPInactive            = -7124;                        {  TCP/IP inactive, cannot be loaded }
    kRATCPIPNotConfigured       = -7125;                        {  TCP/IP not configured, could be loaded }
    kRANotPrimaryInterface      = -7126;                        {  when IPCP is not primary TCP/IP intf. }
    kRAConfigurationDBInitErr   = -7127;
    kRAPPPProtocolRejected      = -7128;
    kRAPPPAuthenticationFailed  = -7129;
    kRAPPPNegotiationFailed     = -7130;
    kRAPPPUserDisconnected      = -7131;
    kRAPPPPeerDisconnected      = -7132;
    kRAPeerNotResponding        = -7133;
    kRAATalkInactive            = -7134;
    kRAExtAuthenticationFailed  = -7135;
    kRANCPRejectedbyPeer        = -7136;
    kRADuplicateIPAddr          = -7137;
    kRACallBackFailed           = -7138;
    kRANotEnabled               = -7139;






    {  ATSUnicode error codes }
    kATSUInvalidTextLayoutErr   = -8790;                        {     An attempt was made to use a ATSUTextLayout  }
                                                                {     which hadn't been initialized or is otherwise  }
                                                                {     in an invalid state.  }
    kATSUInvalidStyleErr        = -8791;                        {     An attempt was made to use a ATSUStyle which   }
                                                                {     hadn't been properly allocated or is otherwise   }
                                                                {     in an invalid state.   }
    kATSUInvalidTextRangeErr    = -8792;                        {     An attempt was made to extract information    }
                                                                {     from or perform an operation on a ATSUTextLayout  }
                                                                {     for a range of text not covered by the ATSUTextLayout.   }
    kATSUFontsMatched           = -8793;                        {     This is not an error code but is returned by     }
                                                                {     ATSUMatchFontsToText() when changes need to     }
                                                                {     be made to the fonts associated with the text.   }
    kATSUFontsNotMatched        = -8794;                        {     This value is returned by ATSUMatchFontsToText()     }
                                                                {     when the text contains Unicode characters which     }
                                                                {     cannot be represented by any installed font.   }
    kATSUNoCorrespondingFontErr = -8795;                        {     This value is retrned by font ID conversion  }
                                                                {     routines ATSUFONDtoFontID() and ATSUFontIDtoFOND()  }
                                                                {     to indicate that the input font ID is valid but  }
                                                                {     there is no conversion possible.  For example,  }
                                                                {     data-fork fonts can only be used with ATSUI not  }
                                                                {     the FontManager, and so converting an ATSUIFontID  }
                                                                {     for such a font will fail.    }
    kATSUInvalidFontErr         = -8796;                        {     Used when an attempt was made to use an invalid font ID. }
    kATSUInvalidAttributeValueErr = -8797;                      {     Used when an attempt was made to use an attribute with  }
                                                                {     a bad or undefined value.   }
    kATSUInvalidAttributeSizeErr = -8798;                       {     Used when an attempt was made to use an attribute with a  }
                                                                {     bad size.   }
    kATSUInvalidAttributeTagErr = -8799;                        {     Used when an attempt was made to use a tag value that }
                                                                {     was not appropriate for the function call it was used.   }
    kATSUInvalidCacheErr        = -8800;                        {     Used when an attempt was made to read in style data  }
                                                                {     from an invalid cache.  Either the format of the  }
                                                                {     cached data doesn't match that used by Apple Type  }
                                                                {     Services for Unicodeª Imaging, or the cached data  }
                                                                {     is corrupt.   }
    kATSUNotSetErr              = -8801;                        {     Used when the client attempts to retrieve an attribute,  }
                                                                {     font feature, or font variation from a style when it  }
                                                                {     hadn't been set.  In such a case, the default value will }
                                                                {     be returned for the attribute's value. }
    kATSUNoStyleRunsAssignedErr = -8802;                        {     Used when an attempt was made to measure, highlight or draw }
                                                                {     a ATSUTextLayout object that has no styleRuns associated with it. }
    kATSUQuickDrawTextErr       = -8803;                        {     Used when QuickDraw Text encounters an error rendering or measuring }
                                                                {     a line of ATSUI text. }
    kATSULowLevelErr            = -8804;                        {     Used when an error was encountered within the low level ATS  }
                                                                {     mechanism performing an operation requested by ATSUI. }
    kATSUNoFontCmapAvailableErr = -8805;                        {     Used when no CMAP table can be accessed or synthesized for the  }
                                                                {     font passed into a SetAttributes Font call. }
    kATSUNoFontScalerAvailableErr = -8806;                      {     Used when no font scaler is available for the font passed }
                                                                {     into a SetAttributes Font call. }
    kATSUCoordinateOverflowErr  = -8807;                        {     Used to indicate the coordinates provided to an ATSUI routine caused }
                                                                {     a coordinate overflow (i.e. > 32K). }
    kATSULineBreakInWord        = -8808;                        {     This is not an error code but is returned by ATSUBreakLine to  }
                                                                {     indicate that the returned offset is within a word since there was }
                                                                {     only less than one word that could fit the requested width. }
    kATSUBusyObjectErr          = -8809;                        {     An ATSUI object is being used by another thread  }
    kATSUInvalidFontFallbacksErr = -8810;                       {     An attempt was made to use a ATSUFontFallbacks  }
                                                                {     which hadn't been initialized or is otherwise  }
                                                                {     in an invalid state.  }
    kATSULastErr                = -8811;                        {     The last ATSUI error code. }


    {  Error & status codes for general text and text encoding conversion }

                                                                {  general text errors }
    kTextUnsupportedEncodingErr = -8738;                        {  specified encoding not supported for this operation }
    kTextMalformedInputErr      = -8739;                        {  in DBCS, for example, high byte followed by invalid low byte }
    kTextUndefinedElementErr    = -8740;                        {  text conversion errors }
    kTECMissingTableErr         = -8745;
    kTECTableChecksumErr        = -8746;
    kTECTableFormatErr          = -8747;
    kTECCorruptConverterErr     = -8748;                        {  invalid converter object reference }
    kTECNoConversionPathErr     = -8749;
    kTECBufferBelowMinimumSizeErr = -8750;                      {  output buffer too small to allow processing of first input text element }
    kTECArrayFullErr            = -8751;                        {  supplied name buffer or TextRun, TextEncoding, or UnicodeMapping array is too small }
    kTECBadTextRunErr           = -8752;
    kTECPartialCharErr          = -8753;                        {  input buffer ends in the middle of a multibyte character, conversion stopped }
    kTECUnmappableElementErr    = -8754;
    kTECIncompleteElementErr    = -8755;                        {  text element may be incomplete or is too long for internal buffers }
    kTECDirectionErr            = -8756;                        {  direction stack overflow, etc. }
    kTECGlobalsUnavailableErr   = -8770;                        {  globals have already been deallocated (premature TERM) }
    kTECItemUnavailableErr      = -8771;                        {  item (e.g. name) not available for specified region (& encoding if relevant) }
                                                                {  text conversion status codes }
    kTECUsedFallbacksStatus     = -8783;
    kTECNeedFlushStatus         = -8784;
    kTECOutputBufferFullStatus  = -8785;                        {  output buffer has no room for conversion of next input text element (partial conversion) }
                                                                {  deprecated error & status codes for low-level converter }
    unicodeChecksumErr          = -8769;
    unicodeNoTableErr           = -8768;
    unicodeVariantErr           = -8767;
    unicodeFallbacksErr         = -8766;
    unicodePartConvertErr       = -8765;
    unicodeBufErr               = -8764;
    unicodeCharErr              = -8763;
    unicodeElementErr           = -8762;
    unicodeNotFoundErr          = -8761;
    unicodeTableFormatErr       = -8760;
    unicodeDirectionErr         = -8759;
    unicodeContextualErr        = -8758;
    unicodeTextEncodingDataErr  = -8757;


    {    UTCUtils Status Codes  }
    kUTCUnderflowErr            = -8850;
    kUTCOverflowErr             = -8851;
    kIllegalClockValueErr       = -8852;


    codecErr                    = -8960;
    noCodecErr                  = -8961;
    codecUnimpErr               = -8962;
    codecSizeErr                = -8963;
    codecScreenBufErr           = -8964;
    codecImageBufErr            = -8965;
    codecSpoolErr               = -8966;
    codecAbortErr               = -8967;
    codecWouldOffscreenErr      = -8968;
    codecBadDataErr             = -8969;
    codecDataVersErr            = -8970;
    codecExtensionNotFoundErr   = -8971;
    scTypeNotFoundErr           = -8971;
    codecConditionErr           = -8972;
    codecOpenErr                = -8973;
    codecCantWhenErr            = -8974;
    codecCantQueueErr           = -8975;
    codecNothingToBlitErr       = -8976;
    codecNoMemoryPleaseWaitErr  = -8977;
    codecDisabledErr            = -8978;                        {  codec disabled itself -- pass codecFlagReenable to reset }
    codecNeedToFlushChainErr    = -8979;
    lockPortBitsBadSurfaceErr   = -8980;
    lockPortBitsWindowMovedErr  = -8981;
    lockPortBitsWindowResizedErr = -8982;
    lockPortBitsWindowClippedErr = -8983;
    lockPortBitsBadPortErr      = -8984;
    lockPortBitsSurfaceLostErr  = -8985;
    codecParameterDialogConfirm = -8986;
    codecNeedAccessKeyErr       = -8987;                        {  codec needs password in order to decompress }
    codecOffscreenFailedErr     = -8988;
    codecDroppedFrameErr        = -8989;                        {  returned from ImageCodecDrawBand  }
    directXObjectAlreadyExists  = -8990;
    lockPortBitsWrongGDeviceErr = -8991;
    codecOffscreenFailedPleaseRetryErr = -8992;


    {    PCCard error codes     }
    kBadAdapterErr              = -9050;                        {  invalid adapter number }
    kBadAttributeErr            = -9051;                        {  specified attributes field value is invalid }
    kBadBaseErr                 = -9052;                        {  specified base system memory address is invalid }
    kBadEDCErr                  = -9053;                        {  specified EDC generator specified is invalid }
    kBadIRQErr                  = -9054;                        {  specified IRQ level is invalid }
    kBadOffsetErr               = -9055;                        {  specified PC card memory array offset is invalid }
    kBadPageErr                 = -9056;                        {  specified page is invalid }
    kBadSizeErr                 = -9057;                        {  specified size is invalid }
    kBadSocketErr               = -9058;                        {  specified logical or physical socket number is invalid }
    kBadTypeErr                 = -9059;                        {  specified window or interface type is invalid }
    kBadVccErr                  = -9060;                        {  specified Vcc power level index is invalid }
    kBadVppErr                  = -9061;                        {  specified Vpp1 or Vpp2 power level index is invalid }
    kBadWindowErr               = -9062;                        {  specified window is invalid }
    kBadArgLengthErr            = -9063;                        {  ArgLength argument is invalid }
    kBadArgsErr                 = -9064;                        {  values in argument packet are invalid }
    kBadHandleErr               = -9065;                        {  clientHandle is invalid }
    kBadCISErr                  = -9066;                        {  CIS on card is invalid }
    kBadSpeedErr                = -9067;                        {  specified speed is unavailable }
    kReadFailureErr             = -9068;                        {  unable to complete read request }
    kWriteFailureErr            = -9069;                        {  unable to complete write request }
    kGeneralFailureErr          = -9070;                        {  an undefined error has occurred }
    kNoCardErr                  = -9071;                        {  no PC card in the socket }
    kUnsupportedFunctionErr     = -9072;                        {  function is not supported by this implementation }
    kUnsupportedModeErr         = -9073;                        {  mode is not supported }
    kBusyErr                    = -9074;                        {  unable to process request at this time - try later }
    kWriteProtectedErr          = -9075;                        {  media is write-protected }
    kConfigurationLockedErr     = -9076;                        {  a configuration has already been locked }
    kInUseErr                   = -9077;                        {  requested resource is being used by a client }
    kNoMoreItemsErr             = -9078;                        {  there are no more of the requested item }
    kOutOfResourceErr           = -9079;                        {  Card Services has exhausted the resource }
    kNoCardSevicesSocketsErr    = -9080;
    kInvalidRegEntryErr         = -9081;
    kBadLinkErr                 = -9082;
    kBadDeviceErr               = -9083;
    k16BitCardErr               = -9084;
    kCardBusCardErr             = -9085;
    kPassCallToChainErr         = -9086;
    kCantConfigureCardErr       = -9087;
    kPostCardEventErr           = -9088;                        {  _PCCSLPostCardEvent failed and dropped an event  }
    kInvalidDeviceNumber        = -9089;
    kUnsupportedVsErr           = -9090;                        {  Unsupported Voltage Sense  }
    kInvalidCSClientErr         = -9091;                        {  Card Services ClientID is not registered  }
    kBadTupleDataErr            = -9092;                        {  Data in tuple is invalid  }
    kBadCustomIFIDErr           = -9093;                        {  Custom interface ID is invalid  }
    kNoIOWindowRequestedErr     = -9094;                        {  Request I/O window before calling configuration  }
    kNoMoreTimerClientsErr      = -9095;                        {  All timer callbacks are in use  }
    kNoMoreInterruptSlotsErr    = -9096;                        {  All internal Interrupt slots are in use  }
    kNoClientTableErr           = -9097;                        {  The client table has not be initialized yet  }
    kUnsupportedCardErr         = -9098;                        {  Card not supported by generic enabler }
    kNoCardEnablersFoundErr     = -9099;                        {  No Enablers were found }
    kNoEnablerForCardErr        = -9100;                        {  No Enablers were found that can support the card }
    kNoCompatibleNameErr        = -9101;                        {  There is no compatible driver name for this device }
    kClientRequestDenied        = -9102;                        {  CS Clients should return this code inorder to  }
                                                                {    deny a request-type CS Event                 }
    kNotReadyErr                = -9103;                        {  PC Card failed to go ready  }
    kTooManyIOWindowsErr        = -9104;                        {  device requested more than one I/O window  }
    kAlreadySavedStateErr       = -9105;                        {  The state has been saved on previous call  }
    kAttemptDupCardEntryErr     = -9106;                        {  The Enabler was asked to create a duplicate card entry  }
    kCardPowerOffErr            = -9107;                        {  Power to the card has been turned off  }
    kNotZVCapableErr            = -9108;                        {  This socket does not support Zoomed Video  }
    kNoCardBusCISErr            = -9109;                        {  No valid CIS exists for this CardBus card  }


    noDeviceForChannel          = -9400;
    grabTimeComplete            = -9401;
    cantDoThatInCurrentMode     = -9402;
    notEnoughMemoryToGrab       = -9403;
    notEnoughDiskSpaceToGrab    = -9404;
    couldntGetRequiredComponent = -9405;
    badSGChannel                = -9406;
    seqGrabInfoNotAvailable     = -9407;
    deviceCantMeetRequest       = -9408;
    badControllerHeight         = -9994;
    editingNotAllowed           = -9995;
    controllerBoundsNotExact    = -9996;
    cannotSetWidthOfAttachedController = -9997;
    controllerHasFixedHeight    = -9998;
    cannotMoveAttachedController = -9999;

    {    AERegistry Errors  }
    errAEBadKeyForm             = -10002;
    errAECantHandleClass        = -10010;
    errAECantSupplyType         = -10009;
    errAECantUndo               = -10015;
    errAEEventFailed            = -10000;
    errAEIndexTooLarge          = -10007;
    errAEInTransaction          = -10011;
    errAELocalOnly              = -10016;
    errAENoSuchTransaction      = -10012;
    errAENotAnElement           = -10008;
    errAENotASingleObject       = -10014;
    errAENotModifiable          = -10003;
    errAENoUserSelection        = -10013;
    errAEPrivilegeError         = -10004;
    errAEReadDenied             = -10005;
    errAETypeError              = -10001;
    errAEWriteDenied            = -10006;
    errAENotAnEnumMember        = -10023;                       {  enumerated value in SetData is not allowed for this property  }
    errAECantPutThatThere       = -10024;                       {  in make new, duplicate, etc. class can't be an element of container  }
    errAEPropertiesClash        = -10025;                       {  illegal combination of properties settings for Set Data, make new, or duplicate  }

    {    TELErr     }
    telGenericError             = -1;
    telNoErr                    = 0;
    telNoTools                  = 8;                            {  no telephone tools found in extension folder  }
    telBadTermErr               = -10001;                       {  invalid TELHandle or handle not found }
    telBadDNErr                 = -10002;                       {  TELDNHandle not found or invalid  }
    telBadCAErr                 = -10003;                       {  TELCAHandle not found or invalid  }
    telBadHandErr               = -10004;                       {  bad handle specified  }
    telBadProcErr               = -10005;                       {  bad msgProc specified  }
    telCAUnavail                = -10006;                       {  a CA is not available  }
    telNoMemErr                 = -10007;                       {  no memory to allocate handle  }
    telNoOpenErr                = -10008;                       {  unable to open terminal  }
    telBadHTypeErr              = -10010;                       {  bad hook type specified  }
    telHTypeNotSupp             = -10011;                       {  hook type not supported by this tool  }
    telBadLevelErr              = -10012;                       {  bad volume level setting  }
    telBadVTypeErr              = -10013;                       {  bad volume type error  }
    telVTypeNotSupp             = -10014;                       {  volume type not supported by this tool }
    telBadAPattErr              = -10015;                       {  bad alerting pattern specified  }
    telAPattNotSupp             = -10016;                       {  alerting pattern not supported by tool }
    telBadIndex                 = -10017;                       {  bad index specified  }
    telIndexNotSupp             = -10018;                       {  index not supported by this tool  }
    telBadStateErr              = -10019;                       {  bad device state specified  }
    telStateNotSupp             = -10020;                       {  device state not supported by tool  }
    telBadIntExt                = -10021;                       {  bad internal external error  }
    telIntExtNotSupp            = -10022;                       {  internal external type not supported by this tool  }
    telBadDNDType               = -10023;                       {  bad DND type specified  }
    telDNDTypeNotSupp           = -10024;                       {  DND type is not supported by this tool  }
    telFeatNotSub               = -10030;                       {  feature not subscribed  }
    telFeatNotAvail             = -10031;                       {  feature subscribed but not available  }
    telFeatActive               = -10032;                       {  feature already active  }
    telFeatNotSupp              = -10033;                       {  feature program call not supported by this tool  }
    telConfLimitErr             = -10040;                       {  limit specified is too high for this configuration  }
    telConfNoLimit              = -10041;                       {  no limit was specified but required }
    telConfErr                  = -10042;                       {  conference was not prepared  }
    telConfRej                  = -10043;                       {  conference request was rejected  }
    telTransferErr              = -10044;                       {  transfer not prepared  }
    telTransferRej              = -10045;                       {  transfer request rejected  }
    telCBErr                    = -10046;                       {  call back feature not set previously  }
    telConfLimitExceeded        = -10047;                       {  attempt to exceed switch conference limits  }
    telBadDNType                = -10050;                       {  DN type invalid  }
    telBadPageID                = -10051;                       {  bad page ID specified }
    telBadIntercomID            = -10052;                       {  bad intercom ID specified  }
    telBadFeatureID             = -10053;                       {  bad feature ID specified  }
    telBadFwdType               = -10054;                       {  bad fwdType specified  }
    telBadPickupGroupID         = -10055;                       {  bad pickup group ID specified  }
    telBadParkID                = -10056;                       {  bad park id specified  }
    telBadSelect                = -10057;                       {  unable to select or deselect DN  }
    telBadBearerType            = -10058;                       {  bad bearerType specified  }
    telBadRate                  = -10059;                       {  bad rate specified  }
    telDNTypeNotSupp            = -10060;                       {  DN type not supported by tool  }
    telFwdTypeNotSupp           = -10061;                       {  forward type not supported by tool  }
    telBadDisplayMode           = -10062;                       {  bad display mode specified  }
    telDisplayModeNotSupp       = -10063;                       {  display mode not supported by tool  }
    telNoCallbackRef            = -10064;                       {  no call back reference was specified, but is required  }
    telAlreadyOpen              = -10070;                       {  terminal already open  }
    telStillNeeded              = -10071;                       {  terminal driver still needed by someone else  }
    telTermNotOpen              = -10072;                       {  terminal not opened via TELOpenTerm  }
    telCANotAcceptable          = -10080;                       {  CA not "acceptable"  }
    telCANotRejectable          = -10081;                       {  CA not "rejectable"  }
    telCANotDeflectable         = -10082;                       {  CA not "deflectable"  }
    telPBErr                    = -10090;                       {  parameter block error, bad format  }
    telBadFunction              = -10091;                       {  bad msgCode specified  }
                                                                {     telNoTools        = -10101,        unable to find any telephone tools  }
    telNoSuchTool               = -10102;                       {  unable to find tool with name specified  }
    telUnknownErr               = -10103;                       {  unable to set config  }
    telNoCommFolder             = -10106;                       {  Communications/Extensions Ä not found  }
    telInitFailed               = -10107;                       {  initialization failed  }
    telBadCodeResource          = -10108;                       {  code resource not found  }
    telDeviceNotFound           = -10109;                       {  device not found  }
    telBadProcID                = -10110;                       {  invalid procID  }
    telValidateFailed           = -10111;                       {  telValidate failed  }
    telAutoAnsNotOn             = -10112;                       {  autoAnswer in not turned on  }
    telDetAlreadyOn             = -10113;                       {  detection is already turned on  }
    telBadSWErr                 = -10114;                       {  Software not installed properly  }
    telBadSampleRate            = -10115;                       {  incompatible sample rate  }
    telNotEnoughdspBW           = -10116;                       {  not enough real-time for allocation  }

    errTaskNotFound             = -10780;                       {  no task with that task id exists  }


    {    Video driver Errorrs -10930 to -10959  }
    {    Defined in video.h.    }

                                                                { Power Manager Errors }
    pmBusyErr                   = -13000;                       { Power Mgr never ready to start handshake }
    pmReplyTOErr                = -13001;                       { Timed out waiting for reply }
    pmSendStartErr              = -13002;                       { during send, pmgr did not start hs }
    pmSendEndErr                = -13003;                       { during send, pmgr did not finish hs }
    pmRecvStartErr              = -13004;                       { during receive, pmgr did not start hs }
    pmRecvEndErr                = -13005;                       { during receive, pmgr did not finish hs configured for this connection }

    {   Power Manager 2.0 Errors    }
    kPowerHandlerExistsForDeviceErr = -13006;
    kPowerHandlerNotFoundForDeviceErr = -13007;
    kPowerHandlerNotFoundForProcErr = -13008;
    kPowerMgtMessageNotHandled  = -13009;
    kPowerMgtRequestDenied      = -13010;
    kCantReportProcessorTemperatureErr = -13013;
    kProcessorTempRoutineRequiresMPLib2 = -13014;
    kNoSuchPowerSource          = -13020;
    kBridgeSoftwareRunningCantSleep = -13038;


    {    Debugging library errors   }
    debuggingExecutionContextErr = -13880;                      {  routine cannot be called at this time  }
    debuggingDuplicateSignatureErr = -13881;                    {  componentSignature already registered  }
    debuggingDuplicateOptionErr = -13882;                       {  optionSelectorNum already registered  }
    debuggingInvalidSignatureErr = -13883;                      {  componentSignature not registered  }
    debuggingInvalidOptionErr   = -13884;                       {  optionSelectorNum is not registered  }
    debuggingInvalidNameErr     = -13885;                       {  componentName or optionName is invalid (NULL)  }
    debuggingNoCallbackErr      = -13886;                       {  debugging component has no callback  }
    debuggingNoMatchErr         = -13887;                       {  debugging component or option not found at this index  }


    {    HID device driver error codes  }
    kHIDVersionIncompatibleErr  = -13909;
    kHIDDeviceNotReady          = -13910;                       {  The device is still initializing, try again later }


    {    HID error codes    }
    kHIDSuccess                 = 0;
    kHIDInvalidRangePageErr     = -13923;
    kHIDReportIDZeroErr         = -13924;
    kHIDReportCountZeroErr      = -13925;
    kHIDReportSizeZeroErr       = -13926;
    kHIDUnmatchedDesignatorRangeErr = -13927;
    kHIDUnmatchedStringRangeErr = -13928;
    kHIDInvertedUsageRangeErr   = -13929;
    kHIDUnmatchedUsageRangeErr  = -13930;
    kHIDInvertedPhysicalRangeErr = -13931;
    kHIDInvertedLogicalRangeErr = -13932;
    kHIDBadLogicalMaximumErr    = -13933;
    kHIDBadLogicalMinimumErr    = -13934;
    kHIDUsagePageZeroErr        = -13935;
    kHIDEndOfDescriptorErr      = -13936;
    kHIDNotEnoughMemoryErr      = -13937;
    kHIDBadParameterErr         = -13938;
    kHIDNullPointerErr          = -13939;
    kHIDInvalidReportLengthErr  = -13940;
    kHIDInvalidReportTypeErr    = -13941;
    kHIDBadLogPhysValuesErr     = -13942;
    kHIDIncompatibleReportErr   = -13943;
    kHIDInvalidPreparsedDataErr = -13944;
    kHIDNotValueArrayErr        = -13945;
    kHIDUsageNotFoundErr        = -13946;
    kHIDValueOutOfRangeErr      = -13947;
    kHIDBufferTooSmallErr       = -13948;
    kHIDNullStateErr            = -13949;
    kHIDBaseError               = -13950;


    {  the OT modem module may return the following error codes: }
    kModemOutOfMemory           = -14000;
    kModemPreferencesMissing    = -14001;
    kModemScriptMissing         = -14002;



    {  MacTextEditor error codes  }
    kTXNEndIterationErr         = -22000;
    kTXNCannotAddFrameErr       = -22001;
    kTXNInvalidFrameIDErr       = -22002;
    kTXNIllegalToCrossDataBoundariesErr = -22003;
    kTXNUserCanceledOperationErr = -22004;
    kTXNBadDefaultFileTypeWarning = -22005;
    kTXNCannotSetAutoIndentErr  = -22006;
    kTXNRunIndexOutofBoundsErr  = -22007;
    kTXNNoMatchErr              = -22008;
    kTXNAttributeTagInvalidForRunErr = -22009;                  { dataValue is set to this per invalid tag }
    kTXNSomeOrAllTagsInvalidForRunErr = -22010;
    kTXNInvalidRunIndex         = -22011;
    kTXNAlreadyInitializedErr   = -22012;
    kTXNCannotTurnTSMOffWhenUsingUnicodeErr = -22013;
    kTXNCopyNotAllowedInEchoModeErr = -22014;
    kTXNDataTypeNotAllowedErr   = -22015;
    kTXNATSUIIsNotInstalledErr  = -22016;
    kTXNOutsideOfLineErr        = -22017;
    kTXNOutsideOfFrameErr       = -22018;




    { Possible errors from the PrinterStatus bottleneck }
    printerStatusOpCodeNotSupportedErr = -25280;


    {    Keychain Manager error codes   }
    errKCNotAvailable           = -25291;
    errKCReadOnly               = -25292;
    errKCAuthFailed             = -25293;
    errKCNoSuchKeychain         = -25294;
    errKCInvalidKeychain        = -25295;
    errKCDuplicateKeychain      = -25296;
    errKCDuplicateCallback      = -25297;
    errKCInvalidCallback        = -25298;
    errKCDuplicateItem          = -25299;
    errKCItemNotFound           = -25300;
    errKCBufferTooSmall         = -25301;
    errKCDataTooLarge           = -25302;
    errKCNoSuchAttr             = -25303;
    errKCInvalidItemRef         = -25304;
    errKCInvalidSearchRef       = -25305;
    errKCNoSuchClass            = -25306;
    errKCNoDefaultKeychain      = -25307;
    errKCInteractionNotAllowed  = -25308;
    errKCReadOnlyAttr           = -25309;
    errKCWrongKCVersion         = -25310;
    errKCKeySizeNotAllowed      = -25311;
    errKCNoStorageModule        = -25312;
    errKCNoCertificateModule    = -25313;
    errKCNoPolicyModule         = -25314;
    errKCInteractionRequired    = -25315;
    errKCDataNotAvailable       = -25316;
    errKCDataNotModifiable      = -25317;
    errKCCreateChainFailed      = -25318;


    {  UnicodeUtilities error & status codes }
    kUCOutputBufferTooSmall     = -25340;                       {  Output buffer too small for Unicode string result }
    kUCTextBreakLocatorMissingType = -25341;                    {  Unicode text break error }

    {  Multiprocessing API error codes }
    kMPIterationEndErr          = -29275;
    kMPPrivilegedErr            = -29276;
    kMPProcessCreatedErr        = -29288;
    kMPProcessTerminatedErr     = -29289;
    kMPTaskCreatedErr           = -29290;
    kMPTaskBlockedErr           = -29291;
    kMPTaskStoppedErr           = -29292;                       {  A convention used with MPThrowException. }
    kMPBlueBlockingErr          = -29293;
    kMPDeletedErr               = -29295;
    kMPTimeoutErr               = -29296;
    kMPTaskAbortedErr           = -29297;
    kMPInsufficientResourcesErr = -29298;
    kMPInvalidIDErr             = -29299;

    {  StringCompare error codes (in TextUtils range) }
    kCollateAttributesNotFoundErr = -29500;
    kCollateInvalidOptions      = -29501;
    kCollateMissingUnicodeTableErr = -29502;
    kCollateUnicodeConvertFailedErr = -29503;
    kCollatePatternNotFoundErr  = -29504;
    kCollateInvalidChar         = -29505;
    kCollateBufferTooSmall      = -29506;
    kCollateInvalidCollationRef = -29507;


    {    FontSync OSStatus Codes    }
    kFNSInvalidReferenceErr     = -29580;                       {  ref. was NULL or otherwise bad  }
    kFNSBadReferenceVersionErr  = -29581;                       {  ref. version is out of known range  }
    kFNSInvalidProfileErr       = -29582;                       {  profile is NULL or otherwise bad  }
    kFNSBadProfileVersionErr    = -29583;                       {  profile version is out of known range  }
    kFNSDuplicateReferenceErr   = -29584;                       {  the ref. being added is already in the profile  }
    kFNSMismatchErr             = -29585;                       {  reference didn't match or wasn't found in profile  }
    kFNSInsufficientDataErr     = -29586;                       {  insufficient data for the operation  }
    kFNSBadFlattenedSizeErr     = -29587;                       {  flattened size didn't match input or was too small  }
    kFNSNameNotFoundErr         = -29589;                       {  The name with the requested paramters was not found  }



    {  MacLocales error codes }
    kLocalesBufferTooSmallErr   = -30001;
    kLocalesTableFormatErr      = -30002;
    kLocalesDefaultDisplayStatus = -30029;                      {  Requested display locale unavailable, used default }


    {    Settings Manager (formerly known as Location Manager) Errors   }
    kALMInternalErr             = -30049;
    kALMGroupNotFoundErr        = -30048;
    kALMNoSuchModuleErr         = -30047;
    kALMModuleCommunicationErr  = -30046;
    kALMDuplicateModuleErr      = -30045;
    kALMInstallationErr         = -30044;
    kALMDeferSwitchErr          = -30043;
    kALMRebootFlagsLevelErr     = -30042;

    kALMLocationNotFoundErr     = -30048;                       {  Old name  }


    {    SoundSprocket Error Codes  }
    kSSpInternalErr             = -30340;
    kSSpVersionErr              = -30341;
    kSSpCantInstallErr          = -30342;
    kSSpParallelUpVectorErr     = -30343;
    kSSpScaleToZeroErr          = -30344;


    {    NetSprocket Error Codes    }
    kNSpInitializationFailedErr = -30360;
    kNSpAlreadyInitializedErr   = -30361;
    kNSpTopologyNotSupportedErr = -30362;
    kNSpPipeFullErr             = -30364;
    kNSpHostFailedErr           = -30365;
    kNSpProtocolNotAvailableErr = -30366;
    kNSpInvalidGameRefErr       = -30367;
    kNSpInvalidParameterErr     = -30369;
    kNSpOTNotPresentErr         = -30370;
    kNSpOTVersionTooOldErr      = -30371;
    kNSpMemAllocationErr        = -30373;
    kNSpAlreadyAdvertisingErr   = -30374;
    kNSpNotAdvertisingErr       = -30376;
    kNSpInvalidAddressErr       = -30377;
    kNSpFreeQExhaustedErr       = -30378;
    kNSpRemovePlayerFailedErr   = -30379;
    kNSpAddressInUseErr         = -30380;
    kNSpFeatureNotImplementedErr = -30381;
    kNSpNameRequiredErr         = -30382;
    kNSpInvalidPlayerIDErr      = -30383;
    kNSpInvalidGroupIDErr       = -30384;
    kNSpNoPlayersErr            = -30385;
    kNSpNoGroupsErr             = -30386;
    kNSpNoHostVolunteersErr     = -30387;
    kNSpCreateGroupFailedErr    = -30388;
    kNSpAddPlayerFailedErr      = -30389;
    kNSpInvalidDefinitionErr    = -30390;
    kNSpInvalidProtocolRefErr   = -30391;
    kNSpInvalidProtocolListErr  = -30392;
    kNSpTimeoutErr              = -30393;
    kNSpGameTerminatedErr       = -30394;
    kNSpConnectFailedErr        = -30395;
    kNSpSendFailedErr           = -30396;
    kNSpMessageTooBigErr        = -30397;
    kNSpCantBlockErr            = -30398;
    kNSpJoinFailedErr           = -30399;


    {    InputSprockets error codes     }
    kISpInternalErr             = -30420;
    kISpSystemListErr           = -30421;
    kISpBufferToSmallErr        = -30422;
    kISpElementInListErr        = -30423;
    kISpElementNotInListErr     = -30424;
    kISpSystemInactiveErr       = -30425;
    kISpDeviceInactiveErr       = -30426;
    kISpSystemActiveErr         = -30427;
    kISpDeviceActiveErr         = -30428;
    kISpListBusyErr             = -30429;

    {    DrawSprockets error/warning codes  }
    kDSpNotInitializedErr       = -30440;
    kDSpSystemSWTooOldErr       = -30441;
    kDSpInvalidContextErr       = -30442;
    kDSpInvalidAttributesErr    = -30443;
    kDSpContextAlreadyReservedErr = -30444;
    kDSpContextNotReservedErr   = -30445;
    kDSpContextNotFoundErr      = -30446;
    kDSpFrameRateNotReadyErr    = -30447;
    kDSpConfirmSwitchWarning    = -30448;
    kDSpInternalErr             = -30449;
    kDSpStereoContextErr        = -30450;


    {
       ***************************************************************************
       Find By Content errors are assigned in the range -30500 to -30539, inclusive.
       ***************************************************************************
    }
    kFBCvTwinExceptionErr       = -30500;                       { no telling what it was }
    kFBCnoIndexesFound          = -30501;
    kFBCallocFailed             = -30502;                       { probably low memory }
    kFBCbadParam                = -30503;
    kFBCfileNotIndexed          = -30504;
    kFBCbadIndexFile            = -30505;                       { bad FSSpec, or bad data in file }
    kFBCcompactionFailed        = -30506;                       { V-Twin exception caught }
    kFBCvalidationFailed        = -30507;                       { V-Twin exception caught }
    kFBCindexingFailed          = -30508;                       { V-Twin exception caught }
    kFBCcommitFailed            = -30509;                       { V-Twin exception caught }
    kFBCdeletionFailed          = -30510;                       { V-Twin exception caught }
    kFBCmoveFailed              = -30511;                       { V-Twin exception caught }
    kFBCtokenizationFailed      = -30512;                       { couldn't read from document or query }
    kFBCmergingFailed           = -30513;                       { couldn't merge index files }
    kFBCindexCreationFailed     = -30514;                       { couldn't create index }
    kFBCaccessorStoreFailed     = -30515;
    kFBCaddDocFailed            = -30516;
    kFBCflushFailed             = -30517;
    kFBCindexNotFound           = -30518;
    kFBCnoSearchSession         = -30519;
    kFBCindexingCanceled        = -30520;
    kFBCaccessCanceled          = -30521;
    kFBCindexFileDestroyed      = -30522;
    kFBCindexNotAvailable       = -30523;
    kFBCsearchFailed            = -30524;
    kFBCsomeFilesNotIndexed     = -30525;
    kFBCillegalSessionChange    = -30526;                       { tried to add/remove vols to a session }
                                                                { that has hits }
    kFBCanalysisNotAvailable    = -30527;
    kFBCbadIndexFileVersion     = -30528;
    kFBCsummarizationCanceled   = -30529;
    kFBCindexDiskIOFailed       = -30530;
    kFBCbadSearchSession        = -30531;
    kFBCnoSuchHit               = -30532;


    {    QuickTime VR Errors    }
    notAQTVRMovieErr            = -30540;
    constraintReachedErr        = -30541;
    callNotSupportedByNodeErr   = -30542;
    selectorNotSupportedByNodeErr = -30543;
    invalidNodeIDErr            = -30544;
    invalidViewStateErr         = -30545;
    timeNotInViewErr            = -30546;
    propertyNotSupportedByNodeErr = -30547;
    settingNotSupportedByNodeErr = -30548;
    limitReachedErr             = -30549;
    invalidNodeFormatErr        = -30550;
    invalidHotSpotIDErr         = -30551;
    noMemoryNodeFailedInitialize = -30552;
    streamingNodeNotReadyErr    = -30553;
    qtvrLibraryLoadErr          = -30554;
    qtvrUninitialized           = -30555;


    {    Appearance Manager Error Codes     }
    themeInvalidBrushErr        = -30560;                       {  pattern index invalid  }
    themeProcessRegisteredErr   = -30561;
    themeProcessNotRegisteredErr = -30562;
    themeBadTextColorErr        = -30563;
    themeHasNoAccentsErr        = -30564;
    themeBadCursorIndexErr      = -30565;
    themeScriptFontNotFoundErr  = -30566;                       {  theme font requested for uninstalled script system  }
    themeMonitorDepthNotSupportedErr = -30567;                  {  theme not supported at monitor depth  }


    {    Control Manager Error Codes    }
    errMessageNotSupported      = -30580;
    errDataNotSupported         = -30581;
    errControlDoesntSupportFocus = -30582;
    errUnknownControl           = -30584;
    errCouldntSetFocus          = -30585;
    errNoRootControl            = -30586;
    errRootAlreadyExists        = -30587;
    errInvalidPartCode          = -30588;
    errControlsAlreadyExist     = -30589;
    errControlIsNotEmbedder     = -30590;
    errDataSizeMismatch         = -30591;
    errControlHiddenOrDisabled  = -30592;
    errCantEmbedIntoSelf        = -30594;
    errCantEmbedRoot            = -30595;
    errItemNotControl           = -30596;
    controlInvalidDataVersionErr = -30597;
    controlPropertyInvalid      = -5603;
    controlPropertyNotFoundErr  = -5604;
    controlHandleInvalidErr     = -30599;




    {    URLAccess Error Codes  }
    kURLInvalidURLReferenceError = -30770;
    kURLProgressAlreadyDisplayedError = -30771;
    kURLDestinationExistsError  = -30772;
    kURLInvalidURLError         = -30773;
    kURLUnsupportedSchemeError  = -30774;
    kURLServerBusyError         = -30775;
    kURLAuthenticationError     = -30776;
    kURLPropertyNotYetKnownError = -30777;
    kURLUnknownPropertyError    = -30778;
    kURLPropertyBufferTooSmallError = -30779;
    kURLUnsettablePropertyError = -30780;
    kURLInvalidCallError        = -30781;
    kURLFileEmptyError          = -30783;
    kURLExtensionFailureError   = -30785;
    kURLInvalidConfigurationError = -30786;
    kURLAccessNotAvailableError = -30787;
    kURL68kNotSupportedError    = -30788;


    {  ComponentError codes }
    badComponentInstance        = -$7FFF7FFE;                   {  when cast to an OSErr this is -32767 }
    badComponentSelector        = -$7FFF7FFD;                   {  when cast to an OSErr this is -32766 }



    dsBusError                  = 1;                            { bus error }
    dsAddressErr                = 2;                            { address error }
    dsIllInstErr                = 3;                            { illegal instruction error }
    dsZeroDivErr                = 4;                            { zero divide error }
    dsChkErr                    = 5;                            { check trap error }
    dsOvflowErr                 = 6;                            { overflow trap error }
    dsPrivErr                   = 7;                            { privilege violation error }
    dsTraceErr                  = 8;                            { trace mode error }
    dsLineAErr                  = 9;                            { line 1010 trap error }
    dsLineFErr                  = 10;                           { line 1111 trap error }
    dsMiscErr                   = 11;                           { miscellaneous hardware exception error }
    dsCoreErr                   = 12;                           { unimplemented core routine error }
    dsIrqErr                    = 13;                           { uninstalled interrupt error }
    dsIOCoreErr                 = 14;                           { IO Core Error }
    dsLoadErr                   = 15;                           { Segment Loader Error }
    dsFPErr                     = 16;                           { Floating point error }
    dsNoPackErr                 = 17;                           { package 0 not present }
    dsNoPk1                     = 18;                           { package 1 not present }
    dsNoPk2                     = 19;                           { package 2 not present }

    dsNoPk3                     = 20;                           { package 3 not present }
    dsNoPk4                     = 21;                           { package 4 not present }
    dsNoPk5                     = 22;                           { package 5 not present }
    dsNoPk6                     = 23;                           { package 6 not present }
    dsNoPk7                     = 24;                           { package 7 not present }
    dsMemFullErr                = 25;                           { out of memory! }
    dsBadLaunch                 = 26;                           { can't launch file }
    dsFSErr                     = 27;                           { file system map has been trashed }
    dsStknHeap                  = 28;                           { stack has moved into application heap }
    negZcbFreeErr               = 33;                           { ZcbFree has gone negative }
    dsFinderErr                 = 41;                           { can't load the Finder error }
    dsBadSlotInt                = 51;                           { unserviceable slot interrupt }
    dsBadSANEOpcode             = 81;                           { bad opcode given to SANE Pack4 }
    dsBadPatchHeader            = 83;                           { SetTrapAddress saw the Òcome-fromÓ header }
    menuPrgErr                  = 84;                           { happens when a menu is purged }
    dsMBarNFnd                  = 85;                           { Menu Manager Errors }
    dsHMenuFindErr              = 86;                           { Menu Manager Errors }
    dsWDEFNotFound              = 87;                           { could not load WDEF }
    dsCDEFNotFound              = 88;                           { could not load CDEF }
    dsMDEFNotFound              = 89;                           { could not load MDEF }

    dsNoFPU                     = 90;                           { an FPU instruction was executed and the machine doesnÕt have one }
    dsNoPatch                   = 98;                           { Can't patch for particular Model Mac }
    dsBadPatch                  = 99;                           { Can't load patch resource }
    dsParityErr                 = 101;                          { memory parity error }
    dsOldSystem                 = 102;                          { System is too old for this ROM }
    ds32BitMode                 = 103;                          { booting in 32-bit on a 24-bit sys }
    dsNeedToWriteBootBlocks     = 104;                          { need to write new boot blocks }
    dsNotEnoughRAMToBoot        = 105;                          { must have at least 1.5MB of RAM to boot 7.0 }
    dsBufPtrTooLow              = 106;                          { bufPtr moved too far during boot }
    dsVMDeferredFuncTableFull   = 112;                          { VM's DeferUserFn table is full }
    dsVMBadBackingStore         = 113;                          { Error occurred while reading or writing the VM backing-store file }
    dsCantHoldSystemHeap        = 114;                          { Unable to hold the system heap during boot }
    dsSystemRequiresPowerPC     = 116;                          { Startup disk requires PowerPC }
    dsGibblyMovedToDisabledFolder = 117;                        {  For debug builds only, signals that active gibbly was disabled during boot.  }
    dsUnBootableSystem          = 118;                          {  Active system file will not boot on this system because it was designed only to boot from a CD.  }
    dsMustUseFCBAccessors       = 119;                          {  FCBSPtr and FSFCBLen are invalid - must use FSM FCB accessor functions  }
    dsMacOSROMVersionTooOld     = 120;                          {  The version of the "Mac OS ROM" file is too old to be used with the installed version of system software  }
    dsLostConnectionToNetworkDisk = 121;                        {  Lost communication with Netboot server  }
    dsRAMDiskTooBig             = 122;                          {  The RAM disk is too big to boot safely; will be turned off  }
    dsWriteToSupervisorStackGuardPage = 128;                    { the supervisor stack overflowed into its guard page  }
    dsReinsert                  = 30;                           { request user to reinsert off-line volume }
    shutDownAlert               = 42;                           { handled like a shutdown error }
    dsShutDownOrRestart         = 20000;                        { user choice between ShutDown and Restart }
    dsSwitchOffOrRestart        = 20001;                        { user choice between switching off and Restart }
    dsForcedQuit                = 20002;                        { allow the user to ExitToShell, return if Cancel }
    dsRemoveDisk                = 20003;                        { request user to remove disk from manual eject drive }
    dsDirtyDisk                 = 20004;                        { request user to return a manually-ejected dirty disk }
    dsShutDownOrResume          = 20109;                        { allow user to return to Finder or ShutDown }
    dsSCSIWarn                  = 20010;                        { Portable SCSI adapter warning. }
    dsMBSysError                = 29200;                        { Media Bay replace warning. }
    dsMBFlpySysError            = 29201;                        { Media Bay, floppy replace warning. }
    dsMBATASysError             = 29202;                        { Media Bay, ATA replace warning. }
    dsMBATAPISysError           = 29203;                        { Media Bay, ATAPI replace warning... }
    dsMBExternFlpySysError      = 29204;                        { Media Bay, external floppy drive reconnect warning }
    dsPCCardATASysError         = 29205;                        { PCCard has been ejected while still in use.  }

    {
        System Errors that are used after MacsBug is loaded to put up dialogs since these should not
        cause MacsBug to stop, they must be in the range (30, 42, 16384-32767) negative numbers add
        to an existing dialog without putting up a whole new dialog
    }
    dsNoExtsMacsBug             = -1;                           { not a SysErr, just a placeholder  }
    dsNoExtsDisassembler        = -2;                           { not a SysErr, just a placeholder  }
    dsMacsBugInstalled          = -10;                          { say ÒMacsBug InstalledÓ }
    dsDisassemblerInstalled     = -11;                          { say ÒDisassembler InstalledÓ }
    dsExtensionsDisabled        = -13;                          { say ÒExtensions DisabledÓ }
    dsGreeting                  = 40;                           { welcome to Macintosh greeting }
    dsSysErr                    = 32767;                        { general system error }
                                                                { old names here for compatibilityÕs sake }
    WDEFNFnd                    = 87;

    CDEFNFnd                    = 88;
    dsNotThe1                   = 31;                           { not the disk I wanted }
    dsBadStartupDisk            = 42;                           { unable to mount boot volume (sad Mac only) }
    dsSystemFileErr             = 43;                           { canÕt find System file to open (sad Mac only) }
    dsHD20Installed             = -12;                          { say ÒHD20 StartupÓ }
    mBarNFnd                    = -126;                         { system error code for MBDF not found }
    fsDSIntErr                  = -127;                         { non-hardware Internal file system error }
    hMenuFindErr                = -127;                         { could not find HMenu's parent in MenuKey (wrong error code - obsolete) }
    userBreak                   = -490;                         { user debugger break }
    strUserBreak                = -491;                         { user debugger break; display string on stack }
    exUserBreak                 = -492;                         { user debugger break; execute debugger commands on stack }


                                                                {  DS Errors which are specific to the new runtime model introduced with PowerPC  }
    dsBadLibrary                = 1010;                         {  Bad shared library  }
    dsMixedModeFailure          = 1011;                         {  Internal Mixed Mode Failure  }


    {
     *  SysError()
     *
     *  Availability:
     *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
procedure SysError(errorCode: SInt16); external name '_SysError';
{$ALIGN MAC68K}
{#POP}
{unit MacLocales}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}


{
   -------------------------------------------------------------------------------------------------
   TYPES & CONSTANTS
   -------------------------------------------------------------------------------------------------
}


type
    LocaleRef    = ^SInt32; { an opaque 32-bit type }
    LocaleRefPtr = ^LocaleRef;  { when a var xx:LocaleRef parameter can be nil, it is changed to xx: LocaleRefPtr }
    LocalePartMask                      = UInt32;

const
                                                                {  bit set requests the following: }
    kLocaleLanguageMask         = $00000001;                    {  ISO 639-1 or -2 language code (2 or 3 letters) }
    kLocaleLanguageVariantMask  = $00000002;                    {  custom string for language variant }
    kLocaleScriptMask           = $00000004;                    {  ISO 15924 script code (2 letters) }
    kLocaleScriptVariantMask    = $00000008;                    {  custom string for script variant }
    kLocaleRegionMask           = $00000010;                    {  ISO 3166 country/region code (2 letters) }
    kLocaleRegionVariantMask    = $00000020;                    {  custom string for region variant }
    kLocaleAllPartsMask         = $0000003F;                    {  all of the above }


type
    LocaleOperationClass                = FourCharCode;
    {  constants for LocaleOperationClass are in UnicodeUtilities interfaces }
    LocaleOperationVariant              = FourCharCode;
    LocaleAndVariantPtr = ^LocaleAndVariant;
    LocaleAndVariant = record
        locale:                 LocaleRef;
        opVariant:              LocaleOperationVariant;
    end;

    LocaleNameMask                      = UInt32;

const
                                                                {  bit set requests the following: }
    kLocaleNameMask             = $00000001;                    {  name of locale }
    kLocaleOperationVariantNameMask = $00000002;                {  name of LocaleOperationVariant }
    kLocaleAndVariantNameMask   = $00000003;                    {  all of the above }

    {
       -------------------------------------------------------------------------------------------------
       function PROTOTYPES
       -------------------------------------------------------------------------------------------------
    }

    {  Convert to or from LocaleRefs (and related utilities) }

    {
     *  LocaleRefFromLangOrRegionCode()
     *
     *  Availability:
     *    Non-Carbon CFM:   in LocalesLib 8.6 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function LocaleRefFromLangOrRegionCode(lang: LangCode; region: RegionCode; var locale: LocaleRef): OSStatus; external name '_LocaleRefFromLangOrRegionCode';

{
 *  LocaleRefFromLocaleString()
 *
 *  Availability:
 *    Non-Carbon CFM:   in LocalesLib 8.6 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function LocaleRefFromLocaleString(localeString: ConstCStringPtr; var locale: LocaleRef): OSStatus; external name '_LocaleRefFromLocaleString';

{
 *  LocaleRefGetPartString()
 *
 *  Availability:
 *    Non-Carbon CFM:   in LocalesLib 8.6 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function LocaleRefGetPartString(locale: LocaleRef; partMask: LocalePartMask; maxStringLen: ByteCount; var partString: char): OSStatus; external name '_LocaleRefGetPartString';

{
 *  LocaleStringToLangAndRegionCodes()
 *
 *  Availability:
 *    Non-Carbon CFM:   in LocalesLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function LocaleStringToLangAndRegionCodes(localeString: ConstCStringPtr; var lang: LangCode; var region: RegionCode): OSStatus; external name '_LocaleStringToLangAndRegionCodes';

{  Enumerate locales for a LocaleOperationClass  }
{
 *  LocaleOperationCountLocales()
 *
 *  Availability:
 *    Non-Carbon CFM:   in LocalesLib 8.6 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function LocaleOperationCountLocales(opClass: LocaleOperationClass; var localeCount: ItemCount): OSStatus; external name '_LocaleOperationCountLocales';

{
 *  LocaleOperationGetLocales()
 *
 *  Availability:
 *    Non-Carbon CFM:   in LocalesLib 8.6 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function LocaleOperationGetLocales(opClass: LocaleOperationClass; maxLocaleCount: ItemCount; var actualLocaleCount: ItemCount; var localeVariantList: LocaleAndVariant): OSStatus; external name '_LocaleOperationGetLocales';

{  Get names for a locale (or a region's language) }

{
 *  LocaleGetName()
 *
 *  Availability:
 *    Non-Carbon CFM:   in LocalesLib 8.6 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function LocaleGetName(locale: LocaleRef; opVariant: LocaleOperationVariant; nameMask: LocaleNameMask; displayLocale: LocaleRef; maxNameLen: UniCharCount; var actualNameLen: UniCharCount; displayName: UniCharPtr): OSStatus; external name '_LocaleGetName';

{
 *  LocaleCountNames()
 *
 *  Availability:
 *    Non-Carbon CFM:   in LocalesLib 8.6 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function LocaleCountNames(locale: LocaleRef; opVariant: LocaleOperationVariant; nameMask: LocaleNameMask; var nameCount: ItemCount): OSStatus; external name '_LocaleCountNames';

{
 *  LocaleGetIndName()
 *
 *  Availability:
 *    Non-Carbon CFM:   in LocalesLib 8.6 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function LocaleGetIndName(locale: LocaleRef; opVariant: LocaleOperationVariant; nameMask: LocaleNameMask; nameIndex: ItemCount; maxNameLen: UniCharCount; var actualNameLen: UniCharCount; displayName: UniCharPtr; var displayLocale: LocaleRef): OSStatus; external name '_LocaleGetIndName';

{
 *  LocaleGetRegionLanguageName()
 *
 *  Availability:
 *    Non-Carbon CFM:   in LocalesLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function LocaleGetRegionLanguageName(region: RegionCode; var languageName: Str255): OSStatus; external name '_LocaleGetRegionLanguageName';

{  Get names for a LocaleOperationClass }
{
 *  LocaleOperationGetName()
 *
 *  Availability:
 *    Non-Carbon CFM:   in LocalesLib 8.6 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function LocaleOperationGetName(opClass: LocaleOperationClass; displayLocale: LocaleRef; maxNameLen: UniCharCount; var actualNameLen: UniCharCount; displayName: UniCharPtr): OSStatus; external name '_LocaleOperationGetName';

{
 *  LocaleOperationCountNames()
 *
 *  Availability:
 *    Non-Carbon CFM:   in LocalesLib 8.6 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function LocaleOperationCountNames(opClass: LocaleOperationClass; var nameCount: ItemCount): OSStatus; external name '_LocaleOperationCountNames';

{
 *  LocaleOperationGetIndName()
 *
 *  Availability:
 *    Non-Carbon CFM:   in LocalesLib 8.6 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function LocaleOperationGetIndName(opClass: LocaleOperationClass; nameIndex: ItemCount; maxNameLen: UniCharCount; var actualNameLen: UniCharCount; displayName: UniCharPtr; var displayLocale: LocaleRef): OSStatus; external name '_LocaleOperationGetIndName';

{$ALIGN MAC68K}
{#POP}
{unit MacMemory}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}


const
    maxSize                     = $7FFFFFF0;                    { the largest block possible }

    defaultPhysicalEntryCount   = 8;

                                                                {  values returned from the GetPageState function  }
    kPageInMemory               = 0;
    kPageOnDisk                 = 1;
    kNotPaged                   = 2;

                                                                {  masks for Zone->heapType field  }
    k32BitHeap                  = 1;                            {  valid in all Memory Managers  }
    kNewStyleHeap               = 2;                            {  true if new Heap Manager is present  }
    kNewDebugHeap               = 4;                            {  true if new Heap Manager is running in debug mode on this heap  }


    {  bits for use with HGetState/HSetState }
    kHandleIsResourceBit        = 5;
    kHandlePurgeableBit         = 6;
    kHandleLockedBit            = 7;

    {  masks for use with HGetState/HSetState }
    kHandleIsResourceMask       = $20;
    kHandlePurgeableMask        = $40;
    kHandleLockedMask           = $80;



type
    GrowZoneProcPtr = function(cbNeeded: Size): SInt32;

    PurgeProcPtr = procedure(blockToPurge: Handle);

    UserFnProcPtr = procedure(parameter: UnivPtr);

    GrowZoneUPP = ^SInt32; { an opaque UPP }
    PurgeUPP = ^SInt32; { an opaque UPP }
    UserFnUPP = ^SInt32; { an opaque UPP }
    ZonePtr = ^Zone;
    Zone = record
        bkLim:                  Ptr;
        purgePtr:               Ptr;
        hFstFree:               Ptr;
        zcbFree:                SInt32;
        gzProc:                 GrowZoneUPP;
        moreMast:               SInt16;
        flags:                  SInt16;
        cntRel:                 SInt16;
        maxRel:                 SInt16;
        cntNRel:                SInt16;
        heapType:               SInt8;                                  {  previously "maxNRel", now holds flags (e.g. k32BitHeap) }
        unused:                 SInt8;
        cntEmpty:               SInt16;
        cntHandles:             SInt16;
        minCBFree:              SInt32;
        purgeProc:              PurgeUPP;
        sparePtr:               Ptr;
        allocPtr:               Ptr;
        heapData:               SInt16;
    end;

    THz                                 = ^Zone;
    THzPtr                              = ^THz;
    MemoryBlockPtr = ^MemoryBlock;
    MemoryBlock = record
        address:                Ptr;
        count:                  UInt32;
    end;

    LogicalToPhysicalTablePtr = ^LogicalToPhysicalTable;
    LogicalToPhysicalTable = record
        logical:                MemoryBlock;
        physical:               array [0..7] of MemoryBlock;
    end;

    PageState                           = SInt16;
    StatusRegisterContents              = SInt16;

const
    kVolumeVirtualMemoryInfoVersion1 = 1;                       {  first version of VolumeVirtualMemoryInfo }


type
    VolumeVirtualMemoryInfoPtr = ^VolumeVirtualMemoryInfo;
    VolumeVirtualMemoryInfo = record
        version:                PBVersion;                              {  Input: Version of the VolumeVirtualMemoryInfo structure }
        volumeRefNum:           SInt16;                                 {  Input: volume reference number }
        inUse:                  boolean;                                {  output: true if volume is currently used for file mapping }
        _fill:                  SInt8;
        vmOptions:              UInt32;                                 {  output: tells what volume can support (same as DriverGestaltVMOptionsResponse vmOptions bits in DriverGestalt) }
                                                                        {  end of kVolumeVirtualMemoryInfoVersion1 structure }
    end;


const
    uppGrowZoneProcInfo = $000000F0;
    uppPurgeProcInfo = $000000C0;
    uppUserFnProcInfo = $00009802;
    {
     *  NewGrowZoneUPP()
     *
     *  Availability:
     *    Non-Carbon CFM:   available as macro/inline
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function NewGrowZoneUPP(userRoutine: GrowZoneProcPtr): GrowZoneUPP; external name '_NewGrowZoneUPP'; { old name was NewGrowZoneProc }
{
 *  NewPurgeUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewPurgeUPP(userRoutine: PurgeProcPtr): PurgeUPP; external name '_NewPurgeUPP'; { old name was NewPurgeProc }
{
 *  NewUserFnUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewUserFnUPP(userRoutine: UserFnProcPtr): UserFnUPP; external name '_NewUserFnUPP'; { old name was NewUserFnProc }
{
 *  DisposeGrowZoneUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeGrowZoneUPP(userUPP: GrowZoneUPP); external name '_DisposeGrowZoneUPP';
{
 *  DisposePurgeUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposePurgeUPP(userUPP: PurgeUPP); external name '_DisposePurgeUPP';
{
 *  DisposeUserFnUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeUserFnUPP(userUPP: UserFnUPP); external name '_DisposeUserFnUPP';
{
 *  InvokeGrowZoneUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeGrowZoneUPP(cbNeeded: Size; userRoutine: GrowZoneUPP): SInt32; external name '_InvokeGrowZoneUPP'; { old name was CallGrowZoneProc }
{
 *  InvokePurgeUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvokePurgeUPP(blockToPurge: Handle; userRoutine: PurgeUPP); external name '_InvokePurgeUPP'; { old name was CallPurgeProc }
{
 *  InvokeUserFnUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvokeUserFnUPP(parameter: UnivPtr; userRoutine: UserFnUPP); external name '_InvokeUserFnUPP'; { old name was CallUserFnProc }

{
 *  GZSaveHnd()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GZSaveHnd: Handle; external name '_GZSaveHnd';
{
 *  TopMem()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TopMem: Ptr; external name '_TopMem';
{
 *  MemError()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function MemError: OSErr; external name '_MemError';

{
 *  NewHandle()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewHandle(byteCount: Size): Handle; external name '_NewHandle';

{
 *  NewHandleClear()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewHandleClear(byteCount: Size): Handle; external name '_NewHandleClear';

{
 *  RecoverHandle()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function RecoverHandle(p: Ptr): Handle; external name '_RecoverHandle';

{
 *  NewPtr()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewPtr(byteCount: Size): Ptr; external name '_NewPtr';

{
 *  NewPtrClear()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewPtrClear(byteCount: Size): Ptr; external name '_NewPtrClear';

{
 *  MaxBlock()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function MaxBlock: SInt32; external name '_MaxBlock';

{
 *  StackSpace()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function StackSpace: SInt32; external name '_StackSpace';
{
 *  NewEmptyHandle()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewEmptyHandle: Handle; external name '_NewEmptyHandle';

{
 *  HLock()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure HLock(h: Handle); external name '_HLock';
{
 *  HUnlock()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure HUnlock(h: Handle); external name '_HUnlock';
{
 *  HPurge()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure HPurge(h: Handle); external name '_HPurge';
{
 *  HNoPurge()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure HNoPurge(h: Handle); external name '_HNoPurge';
{
 *  HLockHi()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure HLockHi(h: Handle); external name '_HLockHi';
{
 *  TempNewHandle()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TempNewHandle(logicalSize: Size; var resultCode: OSErr): Handle; external name '_TempNewHandle';
{
 *  TempMaxMem()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TempMaxMem(var grow: Size): Size; external name '_TempMaxMem';
{
 *  TempFreeMem()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TempFreeMem: SInt32; external name '_TempFreeMem';


{
 *  CompactMem()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CompactMem(cbNeeded: Size): Size; external name '_CompactMem';

{
 *  PurgeMem()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure PurgeMem(cbNeeded: Size); external name '_PurgeMem';

{
 *  FreeMem()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FreeMem: SInt32; external name '_FreeMem';

{
 *  ReserveMem()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure ReserveMem(cbNeeded: Size); external name '_ReserveMem';

{
 *  MaxMem()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function MaxMem(var grow: Size): Size; external name '_MaxMem';

{
 *  SetGrowZone()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetGrowZone(growZone: GrowZoneUPP); external name '_SetGrowZone';
{
 *  GetGrowZone()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetGrowZone: GrowZoneUPP; external name '_GetGrowZone';

{
 *  MoveHHi()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure MoveHHi(h: Handle); external name '_MoveHHi';
{
 *  DisposePtr()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposePtr(p: Ptr); external name '_DisposePtr';
{
 *  GetPtrSize()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetPtrSize(p: Ptr): Size; external name '_GetPtrSize';

{
 *  SetPtrSize()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetPtrSize(p: Ptr; newSize: Size); external name '_SetPtrSize';
{
 *  DisposeHandle()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeHandle(h: Handle); external name '_DisposeHandle';
{
 *  SetHandleSize()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetHandleSize(h: Handle; newSize: Size); external name '_SetHandleSize';
{
    NOTE

    GetHandleSize and GetPtrSize are documented in Inside Mac as returning 0
    in case of an error, but the traps actually return an error code in D0.
    The glue sets D0 to 0 if an error occurred.
}
{
 *  GetHandleSize()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetHandleSize(h: Handle): Size; external name '_GetHandleSize';


{
 *  ReallocateHandle()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure ReallocateHandle(h: Handle; byteCount: Size); external name '_ReallocateHandle';

{
 *  EmptyHandle()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure EmptyHandle(h: Handle); external name '_EmptyHandle';
{
 *  HSetRBit()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure HSetRBit(h: Handle); external name '_HSetRBit';
{
 *  HClrRBit()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure HClrRBit(h: Handle); external name '_HClrRBit';
{
 *  HGetState()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function HGetState(h: Handle): SInt8; external name '_HGetState';
{
 *  HSetState()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure HSetState(h: Handle; flags: SInt8); external name '_HSetState';
{
 *  PurgeSpace()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure PurgeSpace(var total: SInt32; var contig: SInt32); external name '_PurgeSpace';

{
    PurgeSpaceTotal and PurgeSpaceContiguous are currently only implement
    on classic 68K.  The are the same as PurgeSpace() but return just
    one value (either total space purgable or contiguous space purgable).
    Begining in Mac OS 8.5 they are available in InterfaceLib.
}
{
 *  PurgeSpaceTotal()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PurgeSpaceTotal: SInt32; external name '_PurgeSpaceTotal';
{
 *  PurgeSpaceContiguous()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PurgeSpaceContiguous: SInt32; external name '_PurgeSpaceContiguous';

{
 *  BlockMove()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DriverServicesLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure BlockMove(srcPtr: UnivPtr; destPtr: UnivPtr; byteCount: Size); external name '_BlockMove';
{
 *  BlockMoveData()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DriverServicesLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure BlockMoveData(srcPtr: UnivPtr; destPtr: UnivPtr; byteCount: Size); external name '_BlockMoveData';
{
 *  BlockMoveUncached()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure BlockMoveUncached(srcPtr: UnivPtr; destPtr: UnivPtr; byteCount: Size); external name '_BlockMoveUncached';

{
 *  BlockMoveDataUncached()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure BlockMoveDataUncached(srcPtr: UnivPtr; destPtr: UnivPtr; byteCount: Size); external name '_BlockMoveDataUncached';

{
 *  BlockZero()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure BlockZero(destPtr: UnivPtr; byteCount: Size); external name '_BlockZero';

{
 *  BlockZeroUncached()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure BlockZeroUncached(destPtr: UnivPtr; byteCount: Size); external name '_BlockZeroUncached';



{
 *  MoreMasters()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure MoreMasters; external name '_MoreMasters';
{
 *  MoreMasterPointers()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure MoreMasterPointers(inCount: UInt32); external name '_MoreMasterPointers';


{
 *  TempHLock()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure TempHLock(h: Handle; var resultCode: OSErr); external name '_TempHLock';
{
 *  TempHUnlock()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure TempHUnlock(h: Handle; var resultCode: OSErr); external name '_TempHUnlock';
{
 *  TempDisposeHandle()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure TempDisposeHandle(h: Handle; var resultCode: OSErr); external name '_TempDisposeHandle';
{
 *  TempTopMem()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TempTopMem: Ptr; external name '_TempTopMem';
{
 *  HoldMemory()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function HoldMemory(address: UnivPtr; count: UInt32): OSErr; external name '_HoldMemory';
{
 *  UnholdMemory()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function UnholdMemory(address: UnivPtr; count: UInt32): OSErr; external name '_UnholdMemory';

{
 *  MakeMemoryResident()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
function MakeMemoryResident(address: UnivPtr; count: UInt32): OSErr; external name '_MakeMemoryResident';
{
 *  ReleaseMemoryData()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ReleaseMemoryData(address: UnivPtr; count: UInt32): OSErr; external name '_ReleaseMemoryData';
{
 *  MakeMemoryNonResident()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
function MakeMemoryNonResident(address: UnivPtr; count: UInt32): OSErr; external name '_MakeMemoryNonResident';
{
 *  FlushMemory()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FlushMemory(address: UnivPtr; count: UInt32): OSErr; external name '_FlushMemory';


{
 *  HandToHand()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function HandToHand(var theHndl: Handle): OSErr; external name '_HandToHand';

{
 *  PtrToXHand()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PtrToXHand(srcPtr: UnivPtr; dstHndl: Handle; size: SInt32): OSErr; external name '_PtrToXHand';
{
 *  PtrToHand()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PtrToHand(srcPtr: UnivPtr; var dstHndl: Handle; size: SInt32): OSErr; external name '_PtrToHand';

{
 *  HandAndHand()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function HandAndHand(hand1: Handle; hand2: Handle): OSErr; external name '_HandAndHand';
{
 *  PtrAndHand()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PtrAndHand(ptr1: UnivPtr; hand2: Handle; size: SInt32): OSErr; external name '_PtrAndHand';
{ Carbon routines to aid in debugging. }
{ Checks all applicable heaps for validity }
{
 *  CheckAllHeaps()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CheckAllHeaps: boolean; external name '_CheckAllHeaps';

{ Checks the application heap for validity }
{
 *  IsHeapValid()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function IsHeapValid: boolean; external name '_IsHeapValid';

{ It is invalid to pass a NULL or an empty Handle to IsHandleValid }
{
 *  IsHandleValid()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function IsHandleValid(h: Handle): boolean; external name '_IsHandleValid';

{ It is invalid to pass a NULL Pointer to IsPointerValid }
{
 *  IsPointerValid()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function IsPointerValid(p: Ptr): boolean; external name '_IsPointerValid';



{$ALIGN MAC68K}
{#POP}
{unit MacOSXPosix}
{$ALIGN MAC68K}






type
    { sys/types }
    u_quad_t = UInt64;  { quads }
    quad_t = SInt64;
    qaddr_t = ^quad_t;

    caddr_t = Ptr;  { core address }
    daddr_t = SInt32;   { disk address }
    dev_t = SInt32;     { device number }
    fixpt_t = UInt32;   { fixed point number }
    gid_t = UInt32;     { group id }
    gid_t_ptr = ^gid_t;
    in_addr_t = UInt32; { base type for internet address }
    in_port_t = UInt16;
    ino_t = UInt32;     { inode number }
    key_t = SInt32;     { IPC key (for Sys V IPC) }
    mode_t = UInt16;        { permissions }
    nlink_t = UInt16;   { link count }
    off_t = quad_t;     { file offset }
    pid_t = SInt32;     { process id }
    rlim_t = quad_t;        { resource limit }
    segsz_t = SInt32;   { segment size }
    swblk_t = SInt32;   { swap offset }
    uid_t = UInt32;     { user id }
    uid_t_ptr = ^uid_t;
    useconds_t = UInt32;    { microseconds (unsigned) }
    mach_port_name_t = UInt32; { represents a name of a port right }
    mach_port_t = UInt32; { reference added or deleted to a port right }

    type
        sockaddr = packed record
            sin_len: UInt8;
            sin_family: UInt8;
            sa_data: packed array[0..13] of UInt8;
        end;
        sockaddr_ptr = ^sockaddr;
        sockaddr_in = packed record
            sin_len: UInt8;
            sin_family: UInt8;
            sin_port: UInt16;
            sin_addr: UInt32;
            sin_zero: packed array[0..7] of UInt8;
        end;
        sockaddr_in_ptr = ^sockaddr_in;
{unit MachineExceptions}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN POWER}
{#LibExport+}

{ Some basic declarations used throughout the kernel }

type
    AreaID    = ^SInt32; { an opaque 32-bit type }
    AreaIDPtr = ^AreaID;  { when a var xx:AreaID parameter can be nil, it is changed to xx: AreaIDPtr }
    {    Machine Dependent types for PowerPC:   }
    MachineInformationPowerPCPtr = ^MachineInformationPowerPC;
    MachineInformationPowerPC = record
        CTR:                    UnsignedWide;
        LR:                     UnsignedWide;
        PC:                     UnsignedWide;
        CR:                     UInt32;
        XER:                    UInt32;
        MSR:                    UInt32;
        MQ:                     UInt32;
        ExceptKind:             UInt32;
        DSISR:                  UInt32;
        DAR:                    UnsignedWide;
        Reserved:               UnsignedWide;
    end;

    RegisterInformationPowerPCPtr = ^RegisterInformationPowerPC;
    RegisterInformationPowerPC = record
        R0:                     UnsignedWide;
        R1:                     UnsignedWide;
        R2:                     UnsignedWide;
        R3:                     UnsignedWide;
        R4:                     UnsignedWide;
        R5:                     UnsignedWide;
        R6:                     UnsignedWide;
        R7:                     UnsignedWide;
        R8:                     UnsignedWide;
        R9:                     UnsignedWide;
        R10:                    UnsignedWide;
        R11:                    UnsignedWide;
        R12:                    UnsignedWide;
        R13:                    UnsignedWide;
        R14:                    UnsignedWide;
        R15:                    UnsignedWide;
        R16:                    UnsignedWide;
        R17:                    UnsignedWide;
        R18:                    UnsignedWide;
        R19:                    UnsignedWide;
        R20:                    UnsignedWide;
        R21:                    UnsignedWide;
        R22:                    UnsignedWide;
        R23:                    UnsignedWide;
        R24:                    UnsignedWide;
        R25:                    UnsignedWide;
        R26:                    UnsignedWide;
        R27:                    UnsignedWide;
        R28:                    UnsignedWide;
        R29:                    UnsignedWide;
        R30:                    UnsignedWide;
        R31:                    UnsignedWide;
    end;

    FPUInformationPowerPCPtr = ^FPUInformationPowerPC;
    FPUInformationPowerPC = record
        Registers:              array [0..31] of UnsignedWide;
        FPSCR:                  UInt32;
        Reserved:               UInt32;
    end;

    Vector128Ptr = ^Vector128;
    Vector128 = record
        case SInt16 of
        0: (
            l:                  array [0..3] of UInt32;
            );
        1: (
            s:                  array [0..7] of UInt16;
            );
        2: (
            c:                  packed array [0..15] of UInt8;
            );
    end;

    VectorInformationPowerPCPtr = ^VectorInformationPowerPC;
    VectorInformationPowerPC = record
        Registers:              array [0..31] of Vector128;
        VSCR:                   Vector128;
        VRsave:                 UInt32;
    end;

    {    Exception related declarations     }

const
    kWriteReference             = 0;
    kReadReference              = 1;
    kFetchReference             = 2;
    writeReference              = 0;                            {  Obsolete name }
    readReference               = 1;                            {  Obsolete name }
    fetchReference              = 2;                            {  Obsolete name }


type
    MemoryReferenceKind                 = UInt32;
    MemoryExceptionInformationPtr = ^MemoryExceptionInformation;
    MemoryExceptionInformation = record
        theArea:                AreaID;                                 {  The area related to the execption, same as MPAreaID. }
        theAddress:             LogicalAddress;                         {  The 32-bit address of the exception. }
        theError:               OSStatus;                               {  See enum below. }
        theReference:           MemoryReferenceKind;                    {  read, write, instruction fetch. }
    end;


const
    kUnknownException           = 0;
    kIllegalInstructionException = 1;
    kTrapException              = 2;
    kAccessException            = 3;
    kUnmappedMemoryException    = 4;
    kExcludedMemoryException    = 5;
    kReadOnlyMemoryException    = 6;
    kUnresolvablePageFaultException = 7;
    kPrivilegeViolationException = 8;
    kTraceException             = 9;
    kInstructionBreakpointException = 10;                       {  Optional }
    kDataBreakpointException    = 11;                           {  Optional }
    kIntegerException           = 12;
    kFloatingPointException     = 13;
    kStackOverflowException     = 14;                           {  Optional, may be implemented as kAccessException on some systems. }
    kTaskTerminationException   = 15;                           {  Obsolete }
    kTaskCreationException      = 16;                           {  Obsolete }
    kDataAlignmentException     = 17;                           {  May occur when a task is in little endian mode or created with kMPTaskTakesAllExceptions. }


type
    ExceptionKind                       = UInt32;
    ExceptionInfoPtr = ^ExceptionInfo;
    ExceptionInfo = record
        case SInt16 of
        0: (
            memoryInfo:         MemoryExceptionInformationPtr;
            );
    end;

    ExceptionInformationPowerPCPtr = ^ExceptionInformationPowerPC;
    ExceptionInformationPowerPC = record
        theKind:                ExceptionKind;
        machineState:           MachineInformationPowerPCPtr;
        registerImage:          RegisterInformationPowerPCPtr;
        FPUImage:               FPUInformationPowerPCPtr;
        info:                   ExceptionInfo;
        vectorImage:            VectorInformationPowerPCPtr;
    end;

    ExceptionInformation                = ExceptionInformationPowerPC;
    ExceptionInformationPtr             = ^ExceptionInformation;
    MachineInformation                  = MachineInformationPowerPC;
    MachineInformationPtr               = ^MachineInformation;
    RegisterInformation                 = RegisterInformationPowerPC;
    RegisterInformationPtr              = ^RegisterInformation;
    FPUInformation                      = FPUInformationPowerPC;
    FPUInformationPtr                   = ^FPUInformation;
    VectorInformation                   = VectorInformationPowerPC;
    VectorInformationPtr                = ^VectorInformation;
    {
        Note:   An ExceptionHandler is NOT a UniversalProcPtr, except in Carbon.
                It must be a PowerPC function pointer with NO routine descriptor,
                except on Carbon, where it must be a UniversalProcPtr (TPP actually)
                to allow the interface to work from both CFM and Mach-O.
        }
    ExceptionHandlerProcPtr = function(var theException: ExceptionInformation): OSStatus;

    ExceptionHandlerUPP = ^SInt32; { an opaque UPP }

const
    uppExceptionHandlerProcInfo = $000000F1;
    {
     *  NewExceptionHandlerUPP()
     *
     *  Availability:
     *    Non-Carbon CFM:   available as macro/inline
     *    CarbonLib:        in CarbonLib 1.1 and later
     *    Mac OS X:         in version 10.0 and later
        }
function NewExceptionHandlerUPP(userRoutine: ExceptionHandlerProcPtr): ExceptionHandlerUPP; external name '_NewExceptionHandlerUPP';
{
 *  DisposeExceptionHandlerUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeExceptionHandlerUPP(userUPP: ExceptionHandlerUPP); external name '_DisposeExceptionHandlerUPP';
{
 *  InvokeExceptionHandlerUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeExceptionHandlerUPP(var theException: ExceptionInformation; userRoutine: ExceptionHandlerUPP): OSStatus; external name '_InvokeExceptionHandlerUPP';
{
   ExceptionHandler function pointers (TPP):
   on classic PowerPC, use raw function pointers
   on classic PowerPC with OPAQUE_UPP_TYPES=1, use UPP's
   on Carbon, use UPP's
}
{  use UPP's }

type
    ExceptionHandlerTPP                 = ExceptionHandlerUPP;
    ExceptionHandler                    = ExceptionHandlerTPP;
    {    Routine for installing per-process exception handlers  }
    {
     *  InstallExceptionHandler()
     *
     *  Availability:
     *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
     *    CarbonLib:        in CarbonLib 1.1 and later
     *    Mac OS X:         in version 10.0 and later
        }
function InstallExceptionHandler(theHandler: ExceptionHandlerTPP): ExceptionHandlerTPP; external name '_InstallExceptionHandler';



{$ALIGN MAC68K}
{#POP}
{unit NumberFormatting}
{$ALIGN MAC68K}










{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}

{

    Here are the current System 7 routine names and the translations to the older forms.
    Please use the newer forms in all new code and migrate the older names out of existing
    code as maintainance permits.

    New Name                    Old Name(s)

    ExtendedToString            FormatX2Str
    FormatRecToString           Format2Str
    NumToString
    StringToExtended            FormatStr2X
    StringToFormatRec           Str2Format
    StringToNum

}

type
    NumFormatStringPtr = ^NumFormatString;
    NumFormatString = packed record
        fLength:                UInt8;
        fVersion:               UInt8;
        data:                   packed array [0..253] of char;          {  private data  }
    end;

    NumFormatStringRec                  = NumFormatString;
    NumFormatStringRecPtr               = ^NumFormatStringRec;
    FormatStatus                        = SInt16;

const
    fVNumber                    = 0;                            {  first version of NumFormatString  }


type
    FormatClass                         = SInt8;

const
    fPositive                   = 0;
    fNegative                   = 1;
    fZero                       = 2;


type
    FormatResultType                    = SInt8;

const
    fFormatOK                   = 0;
    fBestGuess                  = 1;
    fOutOfSynch                 = 2;
    fSpuriousChars              = 3;
    fMissingDelimiter           = 4;
    fExtraDecimal               = 5;
    fMissingLiteral             = 6;
    fExtraExp                   = 7;
    fFormatOverflow             = 8;
    fFormStrIsNAN               = 9;
    fBadPartsTable              = 10;
    fExtraPercent               = 11;
    fExtraSeparator             = 12;
    fEmptyFormatString          = 13;


type
    FVectorPtr = ^FVector;
    FVector = record
        start:                  SInt16;
        length:                 SInt16;
    end;

    {    index by [fPositive..fZero]    }
    TripleInt                           = array [0..2] of FVector;
    {
     *  StringToNum()
     *
     *  Availability:
     *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
procedure StringToNum(const (*var*) theString: Str255; var theNum: SInt32); external name '_StringToNum';

{
 *  NumToString()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure NumToString(theNum: SInt32; var theString: Str255); external name '_NumToString';

{
 *  ExtendedToString()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ExtendedToString(const (*var*) x: extended80; const (*var*) myCanonical: NumFormatString; const (*var*) partsTable: NumberParts; var outString: Str255): FormatStatus; external name '_ExtendedToString';
{
 *  StringToExtended()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function StringToExtended(const (*var*) source: Str255; const (*var*) myCanonical: NumFormatString; const (*var*) partsTable: NumberParts; var x: extended80): FormatStatus; external name '_StringToExtended';
{
 *  StringToFormatRec()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function StringToFormatRec(const (*var*) inString: Str255; const (*var*) partsTable: NumberParts; var outString: NumFormatString): FormatStatus; external name '_StringToFormatRec';
{
 *  FormatRecToString()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FormatRecToString(const (*var*) myCanonical: NumFormatString; const (*var*) partsTable: NumberParts; var outString: Str255; var positions: TripleInt): FormatStatus; external name '_FormatRecToString';

{$ALIGN MAC68K}
{#POP}
{unit OSAComp}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}

{*************************************************************************
    Types and Constants
*************************************************************************}
{*************************************************************************
    Routines for Associating a Storage Type with a Script Data Handle
*************************************************************************}
{
 *  OSAGetStorageType()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OSAGetStorageType(scriptData: AEDataStorage; var dscType: DescType): OSErr; external name '_OSAGetStorageType';

{
 *  OSAAddStorageType()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OSAAddStorageType(scriptData: AEDataStorage; dscType: DescType): OSErr; external name '_OSAAddStorageType';

{
 *  OSARemoveStorageType()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OSARemoveStorageType(scriptData: AEDataStorage): OSErr; external name '_OSARemoveStorageType';

{$ALIGN MAC68K}
{#POP}
{unit OpenTransport}
{$ALIGN MAC68K}










{
   The following table shows how to map from the old (pre-Universal
   Interfaces) header file name to the equivalent Universal Interfaces
   header file name.
    Old Header              New Header
    ----------              ----------
    cred.h                  OpenTransportProtocol.h
    dlpi.h                  OpenTransportProtocol.h
    miioccom.h              OpenTransportProtocol.h
    mistream.h              OpenTransportProtocol.h/OpenTransportKernel.h
    modnames.h              OpenTransportProtocol.h
    OpenTptAppleTalk.h      OpenTransportProviders.h
    OpenTptClient.h         OpenTransportProtocol.h
    OpenTptCommon.h         OpenTransportProtocol.h
    OpenTptConfig.h         OpenTransportProtocol.h
    OpenTptDevLinks.h       OpenTransportProviders.h
    OpenTptInternet.h       OpenTransportProviders.h
    OpenTptISDN.h           OpenTransportProviders.h
    OpenTptLinks.h          OpenTransportProviders.h
    OpenTptModule.h         OpenTransportKernel.h
    OpenTptPCISupport.h     OpenTransportKernel.h
    OpenTptSerial.h         OpenTransportProviders.h
    OpenTptXTI.h            OpenTransportUNIX.r
    OpenTransport.h         OpenTransport.h
    OpenTransport.r         OpenTransport.r
    OTConfig.r              OpenTransportProtocol.r
    OTDebug.h               OpenTransport.h
    OTSharedLibs.h          OpenTransportProviders.h
    strlog.h                OpenTransportProtocol.h/OpenTransportKernel.h
    stropts.h               OpenTransportProtocol.h/OpenTransportUNIX.h
    strstat.h               OpenTransportProtocol.h
    tihdr.h                 OpenTransportProtocol.h
}



{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}



{  ***** Setup Default Compiler Variables ***** }

{
   OTKERNEL is used to indicate whether the code is being built
   for the kernel environment.  It defaults to 0.  If you include
   "OpenTransportKernel.h" before including this file,
   it will be 1 and you will only be able to see stuff available
   to kernel code.
}


{
   OTUNIXERRORS determines whether this file defines a bunch of
   common UNIX error codes, like EPERM.  Typically, client code does
   not want to do this because of the possibility of a clash with
   other code modules, like the standard C libraries, that also
   defines these routines.  However, client code can turn it on to
   get these definitions.  This might be done by protocol stack
   infrastructure, or some other low-level code.
   "OpenTransportKernel.i" sets this flag before include
   "OpenTransport.h" because kernel modules typically need these
   error codes.  Note that kernel modules shouldn't be including
   standard C libraries, so this is rarely a problem.
   In general, the clash between OT and standard C definitions
   of these error codes is rarely a problem becasue both OT
   and the C libraries define them to have the same value.  But
   I'm sure this check is useful to some people.
}
{$setc OTUNIXERRORS := 0}

{
   OTDEBUG is used to control the behaviour of the OT debugging
   macros.  If you set it to non-zero, the macros will generate code
   that drops you into the debugger.  If you set it to 0, or leave it
   undefined, the macros are compiled out.
   Setting up this compiler variable is a little tricky because previous
   versions of the OT interfaces used a different variable, qDebug.
   We replaced qDebug with OTDEBUG because qDebug does not fit into
   the OT namespace.  But I didn't want to break a lot of currently
   building code.  The following tricky compiler variable footwork
   avoids this.
   There are four outcomes when this code is compiled, depending on
   whether qDebug and OTDEBUG are defined beforehand.  The following
   table shows the outcome in each case.
   qDebug     OTDEBUG    Outcome       Explanation
   ------     -------    -------       -----------
   defined    defined    OTDEBUG wins  Mixed legacy and new code, we believe the new code.
   defined    undefined  qDebug wins   Legacy code.
   undefined  defined    OTDEBUG wins  New code.
   undefined  undefined  no debugging  No debugging.
}

{$setc OTDEBUG := 0}

{  Carbon Applications have some restrictions on using OT }

{
   ***** Normalise 68K Calling C Conventions *****
   Define special types that handle the difference in parameter passing
   between different Mac OS C compilers when generating 68K code.  OT
   exports C calling conventions routines, and various C compilers use
   various different conventions.  Differences in the placement of the result
   are covered above, where we output pragma pointers_in_D0.  The other big
   difference is how the compilers pass SInt16 parameters less than 32 bits.
   The MPW compiler always extends these to 32 bits; other compilers simply
   push a value of the appropriate size.  We overcome this difference by
   defining special OTFooParam types, which are only used when passing
   sub 32 bit values to routines.  They are always defined to a 32 bit
   size, which makes all the compilers do the same thing.
   One weird consequence of this is that in more strict type checking
   languages (eg Pascal) OTBooleanParam is not compatible with Boolean.
   Sorry.
}




type
    OTUInt8Param                        = UInt8;
    OTUInt16Param                       = UInt16;
    OTSInt16Param                       = SInt16;
    OTSInt8Param                        = SInt8;
    OTBooleanParam                      = boolean;


    OTByteCount                         = ByteCount;
    OTItemCount                         = ItemCount;
    OTInt32                             = SInt32;
    OTUInt32                            = UInt32;

    {  ***** C++ Support ***** }

    {
       Setup _MDECL to be _cdecl when compiling C++ code with
       compilers that support it, or nothing otherwise.
    }


    {  ***** Shared Library Prefixes ***** }


const
    kOTCFMClass                 = $6F74616E (* 'otan' *);

    {  ***** Miscellaneous Type Definitions ***** }

    {  A millisecond timeout value }

type
    OTTimeout                           = UInt32;
    {    An ID number in connections/transactions       }
    OTSequence                          = SInt32;
    {    An ID number for registered names              }
    OTNameID                            = SInt32;
    {
       A protocol-specific reason code for failure.
       Usually a Unix-style positive error code.
    }
    OTReason                            = SInt32;
    {  Number of outstanding connection requests at a time. }
    OTQLen                              = UInt32;
    {  Will become internationalizeable shortly (yeah, right). }
    OTClientName                        = ^UInt8;
    {  The command code in STREAMS messages. }
    OTCommand                           = SInt32;
    {  value describing a client }
    OTClient    = ^SInt32; { an opaque 32-bit type }
    OTClientPtr = ^OTClient;  { when a var xx:OTClient parameter can be nil, it is changed to xx: OTClientPtr }
    {  ***** Debugging Macros ***** }

    {  Debugging macros are only available in the C header file.  Sorry. }
    {
       ***** Flags Used When Opening Providers *****
       Important
       OT does not currently support any of these flags.  You should
       always pass 0 to a parameter of type OTOpenFlags.  If you need
       to modify the mode of operation of a provider, use OTSetBlocking,
       OTSetSynchronous, etc.
    }
    OTOpenFlags                 = UInt32;
const
    kO_ASYNC                    = $01;
    kO_NDELAY                   = $04;
    kO_NONBLOCK                 = $04;



    {  ***** UNIX-Style Error Codes ***** }


type
    OTUnixErr                           = UInt16;
    {
       These definitions are only compiled if you're building kernel code
       or you explicit request them by setting OTUNIXERRORS.  See the
       description of these compiler variables, given above.
    }

{  ***** Open Transport/XTI Error codes ***** }

type
    OTXTIErr                            = UInt16;

const
    TSUCCESS                    = 0;                            {  No Error occurred              }
    TBADADDR                    = 1;                            {  A Bad address was specified           }
    TBADOPT                     = 2;                            {  A Bad option was specified           }
    TACCES                      = 3;                            {  Missing access permission           }
    TBADF                       = 4;                            {  Bad provider reference            }
    TNOADDR                     = 5;                            {  No address was specified              }
    TOUTSTATE                   = 6;                            {  Call issued in wrong state           }
    TBADSEQ                     = 7;                            {  Sequence specified does not exist    }
    TSYSERR                     = 8;                            {  A system error occurred               }
    TLOOK                       = 9;                            {  An event occurred - call Look()          }
    TBADDATA                    = 10;                           {  An illegal amount of data was specified     }
    TBUFOVFLW                   = 11;                           {  Passed buffer not big enough           }
    TFLOW                       = 12;                           {  Provider is flow-controlled           }
    TNODATA                     = 13;                           {  No data available for reading        }
    TNODIS                      = 14;                           {  No disconnect indication available      }
    TNOUDERR                    = 15;                           {  No Unit Data Error indication available     }
    TBADFLAG                    = 16;                           {  A Bad flag value was supplied        }
    TNOREL                      = 17;                           {  No orderly release indication available     }
    TNOTSUPPORT                 = 18;                           {  Command is not supported              }
    TSTATECHNG                  = 19;                           {  State is changing - try again later        }
    TNOSTRUCTYPE                = 20;                           {  Bad structure type requested for OTAlloc    }
    TBADNAME                    = 21;                           {  A bad endpoint name was supplied       }
    TBADQLEN                    = 22;                           {  A Bind to an in-use address with qlen > 0 }
    TADDRBUSY                   = 23;                           {  Address requested is already in use        }
    TINDOUT                     = 24;                           {  Accept failed because of pending listen     }
    TPROVMISMATCH               = 25;                           {  Tried to accept on incompatible endpoint    }
    TRESQLEN                    = 26;
    TRESADDR                    = 27;
    TQFULL                      = 28;
    TPROTO                      = 29;                           {  An unspecified provider error occurred  }
    TBADSYNC                    = 30;                           {  A synchronous call at interrupt time      }
    TCANCELED                   = 31;                           {  The command was cancelled           }
    TLASTXTIERROR               = 31;

    {
       ***** Mac OS Error Codes *****
       Most OT client routines return an OSStatus error code, a 32 bit type
       defined in "MacTypes.h".  The OT-unique error code values are
       defined below.  Many of these are generated by remapping XTI error
       codes (Txxxx) and UNIX error codes (Exxxx) to a reserved range
       in the OSStatus space.
       Some routines return an OTResult type, indicating
       that the routine might fail with a negative error, succeed with noErr,
       or possible return a positive value indicating some status.
    }


type
    OTResult                            = SInt32;
    {  ***** OTAddress ***** }

    {
       OTAddress type defines the standard header for all OT address formats.
       It consists of one 16 bit SInt16, which defines the address format
       used, followed by an arbitrary number of bytes which are protocol-specific.
       Conceptually, all OT address formats are subtypes of this type,
       extended with fields that are specific to the protocol.  For example,
       OTInetAddress starts with the OTAddressType field and then continues
       to include a host IP address and a port number.
    }


const
    kOTGenericName              = 0;                            {  Protocol specific data is just a string, interpreted in a protocol-specific fashion. }


type
    OTAddressType                       = UInt16;
    OTAddressPtr = ^OTAddress;
    OTAddress = record
        fAddressType:           OTAddressType;                          {  The address format of this address... }
        fAddress:               SInt8;                                  {  ... followed by protocol specific address information. }
    end;

    {
       ***** OTAlloc Constants *****
       Note:
       In general, Apple recommends that you avoid the OTAlloc call because
       using it extensively causes your program to allocate and deallocate
       many memory blocks, with each extra memory allocation costing time.
    }
    {
       OTStructType defines the structure type to be allocated using the OTAlloc
       call.
    }

const
    T_BIND                      = 1;
    T_OPTMGMT                   = 2;
    T_CALL                      = 3;
    T_DIS                       = 4;
    T_UNITDATA                  = 5;
    T_UDERROR                   = 6;
    T_INFO                      = 7;
    T_REPLYDATA                 = 8;
    T_REQUESTDATA               = 9;
    T_UNITREQUEST               = 10;
    T_UNITREPLY                 = 11;


type
    OTStructType                        = UInt32;
    {
       These values are used in the "fields" parameter of the OTAlloc call
       to define which fields of the structure should be allocated.
    }

const
    T_ADDR                      = $01;
    T_OPT                       = $02;
    T_UDATA                     = $04;
    T_ALL                       = $FFFF;


type
    OTFieldsType                        = UInt32;
    {  ***** OTFlags ***** }
    {
       This type is used to describe bitwise flags in OT data structures
       and parameters.  Think of it as the OT analogue to the OptionBits
       type in "MacTypes.h".
    }

    OTFlags                             = UInt32;
    {
       These flags are used when sending and receiving data.  The
       constants defined are masks.
    }

const
    T_MORE                      = $0001;                        {  More data to come in message      }
    T_EXPEDITED                 = $0002;                        {  Data is expedited, if possible  }
    T_ACKNOWLEDGED              = $0004;                        {  Acknowledge transaction          }
    T_PARTIALDATA               = $0008;                        {  Partial data - more coming      }
    T_NORECEIPT                 = $0010;                        {  No event on transaction done      }
    T_TIMEDOUT                  = $0020;                        {  Reply timed out               }

    {  These flags are used in the TOptMgmt structure to request services. }

    T_NEGOTIATE                 = $0004;
    T_CHECK                     = $0008;
    T_DEFAULT                   = $0010;
    T_CURRENT                   = $0080;

    {
       These flags are used in the TOptMgmt and TOption structures to
       return results.
    }

    T_SUCCESS                   = $0020;
    T_FAILURE                   = $0040;
    T_PARTSUCCESS               = $0100;
    T_READONLY                  = $0200;
    T_NOTSUPPORT                = $0400;

    {
       ***** OTBand *****
       A band is a STREAMS concepts which defines the priority of data
       on a stream.  Although this type is defined as a 32 bit number
       for efficiency's sake, bands actually only range from 0 to 255.
       Typically band 0 is used for normal data and band 1 for expedited data.
    }

type
    OTBand                              = UInt32;
    {  ***** Object References ***** }
    {
       The C header file has a special mechanism to define these
       types so that the object hierarchy is checked by the compiler,
       at least when you engage the C++ compiler.  This special
       case is not propagated to your language of choice.  All
       OT object references are completely opaque.
       See the C header file for more details.
    }
    ProviderRef    = ^SInt32; { an opaque 32-bit type }
    ProviderRefPtr = ^ProviderRef;  { when a var xx:ProviderRef parameter can be nil, it is changed to xx: ProviderRefPtr }
    EndpointRef    = ProviderRef; { an opaque 32-bit type }
    EndpointRefPtr = ^EndpointRef;  { when a var xx:EndpointRef parameter can be nil, it is changed to xx: EndpointRefPtr }
    MapperRef    = ProviderRef; { an opaque 32-bit type }
    MapperRefPtr = ^MapperRef;  { when a var xx:MapperRef parameter can be nil, it is changed to xx: MapperRefPtr }

const
    kOTInvalidRef               = 0;
    kOTInvalidProviderRef       = 0;
    kOTInvalidEndpointRef       = 0;
    kOTInvalidMapperRef         = 0;

    {  ***** Event Codes ***** }
    {
       OT event codes values for Open Transport.  These are the event codes that
       are sent to notification routine (notifiers).
    }


type
    OTEventCode                         = UInt32;
    {
       Events are divided into numerous categories:

       1. (0x0000xxxx) The core XTI events have identifiers of the form
          T_XXXX.  These signal that an XTI event has occured on a stream.
       2. (0x1000xxxx) Private events are reserved for protocol specific
          events.  Each protocol stack defines them as appropriate for
          its own usage.
       3. (0x2000xxxxx) Completion events have identifiers of the form
          T_XXXXCOMPLETE.  These signal the completion of some asynchronous
          API routine, and are only delivered if the endpoint is in asynchronous
          mode.
       4. (0x2100xxxx) Stream events are generally encountered when programming
          the raw streams API and indicate some event on a raw stream, or
          some other event of interest in the STREAMS kernel.
       5. (0x2200xxxx) Signal events indicate that a signal has arrived on
          a raw stream.  See "Signal Values" for details.
       6. (0x2300xxxx) General provider events that might be generated by any
          provider.
       7. (0x2400xxxx) System events sent to all providers.
       8. (0x2500xxxx) System events sent to registered clients.
       9. (0x2600xxxx) System events used by configurators.
      10. (0x2700xxxx) Events sent to registered OT clients.
    }
    {
       All event codes not described here are reserved by Apple.  If you receive
       an event code you do not understand, ignore it!
    }


const
    T_LISTEN                    = $0001;                        {  An connection request is available      }
    T_CONNECT                   = $0002;                        {  Confirmation of a connect request   }
    T_DATA                      = $0004;                        {  Standard data is available         }
    T_EXDATA                    = $0008;                        {  Expedited data is available          }
    T_DISCONNECT                = $0010;                        {  A disconnect is available        }
    T_ERROR                     = $0020;                        {  obsolete/unused in library         }
    T_UDERR                     = $0040;                        {  A Unit Data Error has occurred      }
    T_ORDREL                    = $0080;                        {  An orderly release is available        }
    T_GODATA                    = $0100;                        {  Flow control lifted on standard data    }
    T_GOEXDATA                  = $0200;                        {  Flow control lifted on expedited data }
    T_REQUEST                   = $0400;                        {  An Incoming request is available      }
    T_REPLY                     = $0800;                        {  An Incoming reply is available      }
    T_PASSCON                   = $1000;                        {  State is now T_DATAXFER           }
    T_RESET                     = $2000;                        {  Protocol has been reset           }
    kPRIVATEEVENT               = $10000000;                    {  Base of the private event range. }
    kCOMPLETEEVENT              = $20000000;                    {  Base of the completion event range. }
    T_BINDCOMPLETE              = $20000001;                    {  Bind call is complete           }
    T_UNBINDCOMPLETE            = $20000002;                    {  Unbind call is complete           }
    T_ACCEPTCOMPLETE            = $20000003;                    {  Accept call is complete           }
    T_REPLYCOMPLETE             = $20000004;                    {  SendReply call is complete         }
    T_DISCONNECTCOMPLETE        = $20000005;                    {  Disconnect call is complete          }
    T_OPTMGMTCOMPLETE           = $20000006;                    {  OptMgmt call is complete           }
    T_OPENCOMPLETE              = $20000007;                    {  An Open call is complete           }
    T_GETPROTADDRCOMPLETE       = $20000008;                    {  GetProtAddress call is complete        }
    T_RESOLVEADDRCOMPLETE       = $20000009;                    {  A ResolveAddress call is complet      }
    T_GETINFOCOMPLETE           = $2000000A;                    {  A GetInfo call is complete         }
    T_SYNCCOMPLETE              = $2000000B;                    {  A Sync call is complete           }
    T_MEMORYRELEASED            = $2000000C;                    {  No-copy memory was released          }
    T_REGNAMECOMPLETE           = $2000000D;                    {  A RegisterName call is complete        }
    T_DELNAMECOMPLETE           = $2000000E;                    {  A DeleteName call is complete    }
    T_LKUPNAMECOMPLETE          = $2000000F;                    {  A LookupName call is complete    }
    T_LKUPNAMERESULT            = $20000010;                    {  A LookupName is returning a name      }
    kOTSyncIdleEvent            = $20000011;                    {  Synchronous call Idle event          }
    kSTREAMEVENT                = $21000000;                    {  Base of the raw stream event range. }
    kOTReservedEvent1           = $21000001;                    {  reserved for internal use by OT        }
    kGetmsgEvent                = $21000002;                    {  A GetMessage call is complete    }
    kStreamReadEvent            = $21000003;                    {  A Read call is complete           }
    kStreamWriteEvent           = $21000004;                    {  A Write call is complete           }
    kStreamIoctlEvent           = $21000005;                    {  An Ioctl call is complete        }
    kOTReservedEvent2           = $21000006;                    {  reserved for internal use by OT        }
    kStreamOpenEvent            = $21000007;                    {  An OpenStream call is complete      }
    kPollEvent                  = $21000008;                    {  A Poll call is complete           }
    kOTReservedEvent3           = $21000009;                    {  reserved for internal use by OT        }
    kOTReservedEvent4           = $2100000A;                    {  reserved for internal use by OT        }
    kOTReservedEvent5           = $2100000B;                    {  reserved for internal use by OT        }
    kOTReservedEvent6           = $2100000C;                    {  reserved for internal use by OT        }
    kOTReservedEvent7           = $2100000D;                    {  reserved for internal use by OT        }
    kOTReservedEvent8           = $2100000E;                    {  reserved for internal use by OT        }
    kSIGNALEVENT                = $22000000;                    {  A signal has arrived on a raw stream, see "Signal Values" below. }
    kPROTOCOLEVENT              = $23000000;                    {  Some event from the protocols    }
    kOTProviderIsDisconnected   = $23000001;                    {  Provider is temporarily off-line      }
    kOTProviderIsReconnected    = $23000002;                    {  Provider is now back on-line       }
    kOTProviderWillClose        = $24000001;                    {  Provider will close immediately        }
    kOTProviderIsClosed         = $24000002;                    {  Provider was closed               }
    kOTPortDisabled             = $25000001;                    {  Port is now disabled, result is 0, cookie is port ref  }
    kOTPortEnabled              = $25000002;                    {  Port is now enabled, result is 0, cookie is port ref  }
    kOTPortOffline              = $25000003;                    {  Port is now offline, result is 0, cookie is port ref  }
    kOTPortOnline               = $25000004;                    {  Port is now online, result is 0, cookie is port ref  }
    kOTClosePortRequest         = $25000005;                    {  Request to close/yield, result is reason, cookie is OTPortCloseStruct*  }
    kOTYieldPortRequest         = $25000005;                    {  Request to close/yield, result is reason, cookie is OTPortCloseStruct*  }
    kOTNewPortRegistered        = $25000006;                    {  New port has been registered, cookie is port ref  }
    kOTPortNetworkChange        = $25000007;                    {  Port may have moved to a new network, result is 0, cookie is port ref  }
    kOTConfigurationChanged     = $26000001;                    {  Protocol configuration changed      }
    kOTSystemSleep              = $26000002;
    kOTSystemShutdown           = $26000003;
    kOTSystemAwaken             = $26000004;
    kOTSystemIdle               = $26000005;
    kOTSystemSleepPrep          = $26000006;
    kOTSystemShutdownPrep       = $26000007;
    kOTSystemAwakenPrep         = $26000008;
    kOTStackIsLoading           = $27000001;                    {  Sent before Open Transport attempts to load the TCP/IP protocol stack. }
    kOTStackWasLoaded           = $27000002;                    {  Sent after the TCP/IP stack has been successfully loaded. }
    kOTStackIsUnloading         = $27000003;                    {  Sent before Open Transport unloads the TCP/IP stack. }



    {
       ***** Signal Values *****
       Signals that are generated by a raw stream.  When writing a notifier
       for a raw stream, add these values to kSIGNALEVENT to determine what
       event you are receiving.
    }

    kSIGHUP                     = 1;
    kSIGURG                     = 16;
    kSIGPOLL                    = 30;

    SIGHUP                      = 1;
    SIGURG                      = 16;
    SIGPOLL                     = 30;


    {
       ***** Notifier Type Definition *****
       Open Transport notifiers must conform to the OTNotifyProcPtr prototype.
       Even though a OTNotifyUPP is a OTNotifyProcPtr on pre-Carbon system,
       use NewOTNotifyUPP() and friends to make your source code portable to OS X and Carbon.
    }

type
    OTNotifyProcPtr = procedure(contextPtr: UnivPtr; code: OTEventCode; result: OTResult; cookie: UnivPtr);

    OTNotifyUPP = ^SInt32; { an opaque UPP }

const
    uppOTNotifyProcInfo = $00003FC0;
    {
     *  NewOTNotifyUPP()
     *
     *  Availability:
     *    Non-Carbon CFM:   available as macro/inline
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function NewOTNotifyUPP(userRoutine: OTNotifyProcPtr): OTNotifyUPP; external name '_NewOTNotifyUPP';
{
 *  DisposeOTNotifyUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeOTNotifyUPP(userUPP: OTNotifyUPP); external name '_DisposeOTNotifyUPP';
{
 *  InvokeOTNotifyUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvokeOTNotifyUPP(contextPtr: UnivPtr; code: OTEventCode; result: OTResult; cookie: UnivPtr; userRoutine: OTNotifyUPP); external name '_InvokeOTNotifyUPP';
{  ***** Option Management Definitions ***** }
{  The XTI Level number of a protocol. }

const
    XTI_GENERIC                 = $FFFF;                        {  level for XTI options  }


type
    OTXTILevel                          = UInt32;
    {  The XTI name of a protocol option. }
    OTXTIName                           = UInt32;
    {  XTI names for options used with XTI_GENERIC above }

const
    XTI_DEBUG                   = $0001;
    XTI_LINGER                  = $0080;
    XTI_RCVBUF                  = $1002;
    XTI_RCVLOWAT                = $1004;
    XTI_SNDBUF                  = $1001;
    XTI_SNDLOWAT                = $1003;
    XTI_PROTOTYPE               = $1005;
    OPT_CHECKSUM                = $0600;                        {  Set checksumming = UInt32 - 0 or 1) }
    OPT_RETRYCNT                = $0601;                        {  Set a retry counter = UInt32 (0 = infinite) }
    OPT_INTERVAL                = $0602;                        {  Set a retry interval = UInt32 milliseconds }
    OPT_ENABLEEOM               = $0603;                        {  Enable the EOM indication = UInt8 (0 or 1) }
    OPT_SELFSEND                = $0604;                        {  Enable Self-sending on broadcasts = UInt32 (0 or 1) }
    OPT_SERVERSTATUS            = $0605;                        {  Set Server Status (format is proto dependent) }
    OPT_ALERTENABLE             = $0606;                        {  Enable/Disable protocol alerts }
    OPT_KEEPALIVE               = $0008;                        {  See t_keepalive structure }

    {  ***** Ioctl Definitions ***** }

    {
       All OT ioctl numbers are formed using the MIOC_CMD macro,
       which divides the ioctl space by protocol space (the
       first parameter) and ioctl number within that protocol
       space (the second parameter).  This macro is only available
       to C users but it's relatively easy to synthesise its
       results in other languages.
    }

    {  The following is a registry of the ioctls protocol spaces. }

    MIOC_STREAMIO               = 65;                           {  Basic Stream ioctl() cmds - I_PUSH, I_LOOK, etc.  }
    MIOC_TMOD                   = 97;                           {  ioctl's for tmod test module     }
    MIOC_STRLOG                 = 98;                           {  ioctl's for Mentat's log device       }
    MIOC_ND                     = 99;                           {  ioctl's for Mentat's nd device         }
    MIOC_ECHO                   = 100;                          {  ioctl's for Mentat's echo device    }
    MIOC_TLI                    = 101;                          {  ioctl's for Mentat's timod module   }
    MIOC_RESERVEDf              = 102;                          {  reserved, used by SVR4 FIOxxx    }
    MIOC_SAD                    = 103;                          {  ioctl's for Mentat's sad module       }
    MIOC_ARP                    = 104;                          {  ioctl's for Mentat's arp module       }
    MIOC_HAVOC                  = 72;                           {  Havoc module ioctls.            }
    MIOC_RESERVEDi              = 105;                          {  reserved, used by SVR4 SIOCxxx      }
    MIOC_SIOC                   = 106;                          {  sockio.h socket ioctl's            }
    MIOC_TCP                    = 107;                          {  tcp.h ioctl's                 }
    MIOC_DLPI                   = 108;                          {  dlpi.h additions              }
    MIOC_SOCKETS                = 109;                          {  Mentat sockmod ioctl's            }
    MIOC_IPX                    = 111;                          {  ioctls for IPX                }
    MIOC_OT                     = 79;                           {  ioctls for Open Transport        }
    MIOC_ATALK                  = 84;                           {  ioctl's for AppleTalk           }
    MIOC_SRL                    = 85;                           {  ioctl's for Serial            }
    MIOC_RESERVEDp              = 112;                          {  reserved, used by SVR4           }
    MIOC_RESERVEDr              = 114;                          {  reserved, used by SVR4           }
    MIOC_RESERVEDs              = 115;                          {  reserved, used by SVR4           }
    MIOC_CFIG                   = 122;                          {  ioctl's for private configuration  }

    {  OT specific ioctls. }

    I_OTGetMiscellaneousEvents  = $4F01;                        {  sign up for Misc Events               }
    I_OTSetFramingType          = $4F02;                        {  Set framing option for link           }
    kOTGetFramingValue          = $FFFFFFFF;                    {  Use this value to read framing         }
    I_OTSetRawMode              = $4F03;                        {  Set raw mode for link             }
    kOTSetRecvMode              = $01;
    kOTSendErrorPacket          = $02;
    I_OTConnect                 = $4F04;                        {  Generic connect request for links    }
    I_OTDisconnect              = $4F05;                        {  Generic disconnect request for links      }
    I_OTScript                  = $4F06;                        {  Send a script to a module           }

    {  Structure for the I_OTScript Ioctl. }


type
    OTScriptInfoPtr = ^OTScriptInfo;
    OTScriptInfo = record
        fScriptType:            UInt32;
        fTheScript:             Ptr;
        fScriptLength:          UInt32;
    end;

    {
       ***** XTI States *****
       These are the potential values returned by OTGetEndpointState and OTSync
       which represent the XTI state of an endpoint.
    }
    OTXTIStates                 = UInt32;
const
    T_UNINIT                    = 0;                            {  addition to standard xti.h  }
    T_UNBND                     = 1;                            {  unbound                  }
    T_IDLE                      = 2;                            {  idle                 }
    T_OUTCON                    = 3;                            {  outgoing connection pending     }
    T_INCON                     = 4;                            {  incoming connection pending     }
    T_DATAXFER                  = 5;                            {  data transfer           }
    T_OUTREL                    = 6;                            {  outgoing orderly release      }
    T_INREL                     = 7;                            {  incoming orderly release      }

    {
       ***** General XTI Definitions *****
       These definitions are typically used during option management.
    }

    T_YES                       = 1;
    T_NO                        = 0;
    T_UNUSED                    = -1;
    kT_NULL                     = 0;
    T_ABSREQ                    = $8000;

    kT_UNSPEC                   = $FFFFFFFD;
    T_ALLOPT                    = 0;

    T_NULL                      = 0;
    T_UNSPEC                    = $FFFFFFFD;

    {
       ***** OTConfiguration *****
       This is a "black box" structure used to define the configuration of a
       provider or endpoint.  This file defines a very limited set of operations
       on a configuration.  "OpenTransportClient.h" extends this with extra
       operations used by protocol stacks but not typically needed by clients.
    }



type
    OTConfigurationRef    = ^SInt32; { an opaque 32-bit type }
    OTConfigurationRefPtr = ^OTConfigurationRef;  { when a var xx:OTConfigurationRef parameter can be nil, it is changed to xx: OTConfigurationRefPtr }

const
    kOTNoMemoryConfigurationPtr = 0;
    kOTInvalidConfigurationPtr  = -1;

    {  ***** Option Management Structures ***** }

    {  This structure describes the contents of a single option in a buffer. }


type
    TOptionHeaderPtr = ^TOptionHeader;
    TOptionHeader = record
        len:                    ByteCount;                              {  total length of option           }
                                                                        {  = sizeof(TOptionHeader) + length      }
                                                                        {      of option value in bytes        }
        level:                  OTXTILevel;                             {  protocol affected             }
        name:                   OTXTIName;                              {  option name                    }
        status:                 UInt32;                                 {  status value                 }
    end;

    {
       This structure describes the contents of a single option in a buffer.
       It differs from TOptionHeader in that it includes the value field,
       which acts as an unbounded array representing the value of the option.
    }
    TOptionPtr = ^TOption;
    TOption = record
        len:                    ByteCount;                              {  total length of option           }
                                                                        {  = sizeof(TOption) + length  }
                                                                        {      of option value in bytes        }
        level:                  OTXTILevel;                             {  protocol affected             }
        name:                   OTXTIName;                              {  option name                    }
        status:                 UInt32;                                 {  status value                 }
        value:                  array [0..0] of UInt32;                 {  data goes here                }
    end;

    {  Some useful constants when manipulating option buffers. }

const
    kOTOptionHeaderSize         = 16;
    kOTBooleanOptionDataSize    = 4;
    kOTBooleanOptionSize        = 20;
    kOTOneByteOptionSize        = 17;
    kOTTwoByteOptionSize        = 18;
    kOTFourByteOptionSize       = 20;

    {  t_kpalive is used with OPT_KEEPALIVE option. }


type
    t_kpalivePtr = ^t_kpalive;
    t_kpalive = record
        kp_onoff:               SInt32;                                 {  option on/off    }
        kp_timeout:             SInt32;                                 {  timeout in minutes  }
    end;

    {  t_linger is used with XTI_LINGER option. }
    t_lingerPtr = ^t_linger;
    t_linger = record
        l_onoff:                SInt32;                                 {  option on/off  }
        l_linger:               SInt32;                                 {  linger time  }
    end;

    {
       ***** TEndpointInfo *****
       This structure is returned from the GetEndpointInfo call and contains
       information about an endpoint.  But first, some special flags and types.
    }
    {  Values returned in servtype field of TEndpointInfo. }

    OTServiceType               = UInt32;
const
    T_COTS                      = 1;                            {  Connection-mode service                     }
    T_COTS_ORD                  = 2;                            {  Connection service with orderly release           }
    T_CLTS                      = 3;                            {  Connectionless-mode service                    }
    T_TRANS                     = 5;                            {  Connection-mode transaction service               }
    T_TRANS_ORD                 = 6;                            {  Connection transaction service with orderly release     }
    T_TRANS_CLTS                = 7;                            {  Connectionless transaction service            }

    {  Masks for the flags field of TEndpointInfo. }

    T_SENDZERO                  = $0001;                        {  supports 0-length TSDU's           }
    T_XPG4_1                    = $0002;                        {  supports the GetProtAddress call      }
    T_CAN_SUPPORT_MDATA         = $10000000;                    {  support M_DATAs on packet protocols     }
    T_CAN_RESOLVE_ADDR          = $40000000;                    {  Supports ResolveAddress call       }
    T_CAN_SUPPLY_MIB            = $20000000;                    {  Supports SNMP MIB data           }

    {
       Special-case values for in the tsdu, etsdu, connect, and discon
       fields of TEndpointInfo.
    }

    T_INFINITE                  = -1;                           {  supports infinit amounts of data      }
    T_INVALID                   = -2;                           {  Does not support data transmission  }


type
    OTDataSize                          = SInt32;
    {  Now the TEndpointInfo structure proper. }
    TEndpointInfoPtr = ^TEndpointInfo;
    TEndpointInfo = record
        addr:                   OTDataSize;                             {  Maximum size of an address         }
        options:                OTDataSize;                             {  Maximum size of options           }
        tsdu:                   OTDataSize;                             {  Standard data transmit unit size      }
        etsdu:                  OTDataSize;                             {  Expedited data transmit unit size   }
        connect:                OTDataSize;                             {  Maximum data size on connect       }
        discon:                 OTDataSize;                             {  Maximum data size on disconnect        }
        servtype:               OTServiceType;                          {  service type                 }
        flags:                  UInt32;                                 {  Flags (see above for values)       }
    end;

    {
       "OpenTransport.h" no longer defines "struct t_info".  We recommend
       that you use TEndpointInfo instead.  If this is impossible, use
       the definition of "struct t_info" in "OpenTransportXTI.h".
    }
    {  ***** OTPortRecord ***** }

    {  Unique identifier for a port. }

    OTPortRef                           = UInt32;
    OTPortRefPtr                        = ^OTPortRef;

const
    kOTInvalidPortRef           = 0;

    {  Valid values for the bus type element of an OTPortRef. }


type
    OTBusType                   = UInt8;
const
    kOTUnknownBusPort           = 0;
    kOTMotherboardBus           = 1;
    kOTNuBus                    = 2;
    kOTPCIBus                   = 3;
    kOTGeoPort                  = 4;
    kOTPCCardBus                = 5;
    kOTFireWireBus              = 6;
    kOTLastBusIndex             = 15;

    {
       A couple of special values for the device type element of an
       OTPortRef.  See "OpenTransportDevices.h" for the standard values.
    }


type
    OTDeviceType                = UInt16;
const
    kOTNoDeviceType             = 0;
    kOTADEVDevice               = 1;                            {  An Atalk ADEV    }
    kOTMDEVDevice               = 2;                            {  A TCP/IP MDEV    }
    kOTLocalTalkDevice          = 3;                            {  LocalTalk        }
    kOTIRTalkDevice             = 4;                            {  IRTalk           }
    kOTTokenRingDevice          = 5;                            {  Token Ring         }
    kOTISDNDevice               = 6;                            {  ISDN              }
    kOTATMDevice                = 7;                            {  ATM               }
    kOTSMDSDevice               = 8;                            {  SMDS              }
    kOTSerialDevice             = 9;                            {  Serial            }
    kOTEthernetDevice           = 10;                           {  Ethernet           }
    kOTSLIPDevice               = 11;                           {  SLIP Pseudo-device  }
    kOTPPPDevice                = 12;                           {  PPP Pseudo-device   }
    kOTModemDevice              = 13;                           {  Modem Pseudo-Device     }
    kOTFastEthernetDevice       = 14;                           {  100 MB Ethernet        }
    kOTFDDIDevice               = 15;                           {  FDDI              }
    kOTIrDADevice               = 16;                           {  IrDA Infrared    }
    kOTATMSNAPDevice            = 17;                           {  ATM SNAP emulation  }
    kOTFibreChannelDevice       = 18;                           {  Fibre Channel    }
    kOTFireWireDevice           = 19;                           {  FireWire link Device    }
    kOTPseudoDevice             = 1023;                         {  used where no other defined device type will work }
    kOTLastDeviceIndex          = 1022;

    {  Special case values for the slot number element of an OTPortRef. }

    kOTLastSlotNumber           = 255;
    kOTLastOtherNumber          = 255;


type
    OTSlotNumber                        = UInt16;
    {  Accessor functions for the various elements of the OTPortRef. }
    {
     *  OTCreatePortRef()
     *
     *  Availability:
     *    Non-Carbon CFM:   in OTUtilityLib 1.0 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function OTCreatePortRef(busType: ByteParameter; devType: OTDeviceType; slot: OTSlotNumber; other: UInt16): OTPortRef; external name '_OTCreatePortRef';

{
 *  OTGetDeviceTypeFromPortRef()
 *
 *  Availability:
 *    Non-Carbon CFM:   in OTUtilityLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTGetDeviceTypeFromPortRef(ref: OTPortRef): OTDeviceType; external name '_OTGetDeviceTypeFromPortRef';

{
 *  OTGetBusTypeFromPortRef()
 *
 *  Availability:
 *    Non-Carbon CFM:   in OTUtilityLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTGetBusTypeFromPortRef(ref: OTPortRef): UInt16; external name '_OTGetBusTypeFromPortRef';

{
 *  OTGetSlotFromPortRef()
 *
 *  Availability:
 *    Non-Carbon CFM:   in OTUtilityLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTGetSlotFromPortRef(ref: OTPortRef; var other: UInt16): OTSlotNumber; external name '_OTGetSlotFromPortRef';

{
 *  OTSetDeviceTypeInPortRef()
 *
 *  Availability:
 *    Non-Carbon CFM:   in OTUtilityLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTSetDeviceTypeInPortRef(ref: OTPortRef; devType: OTDeviceType): OTPortRef; external name '_OTSetDeviceTypeInPortRef';

{
 *  OTSetBusTypeInPortRef()
 *
 *  Availability:
 *    Non-Carbon CFM:   in OTUtilityLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTSetBusTypeInPortRef(ref: OTPortRef; busType: ByteParameter): OTPortRef; external name '_OTSetBusTypeInPortRef';

{  Name length definitions for various fields in OTPortRecord. }


const
    kMaxModuleNameLength        = 31;                           {  max length of a STREAMS module name }
    kMaxModuleNameSize          = 32;
    kMaxProviderNameLength      = 35;                           {  providers allow 4 characters for minor number }
    kMaxProviderNameSize        = 36;
    kMaxSlotIDLength            = 7;                            {  PCI slot names tend to be short }
    kMaxSlotIDSize              = 8;
    kMaxResourceInfoLength      = 31;                           {  max length of a configuration helper name }
    kMaxResourceInfoSize        = 32;
    kMaxPortNameLength          = 35;                           {  max size allowed to define a port }
    kMaxPortNameSize            = 36;

    {
       Masks for the fPortFlags field of OTPortRecord
       If no bits are set, the port is currently inactive.
    }

    kOTPortIsActive             = $00000001;
    kOTPortIsDisabled           = $00000002;
    kOTPortIsUnavailable        = $00000004;
    kOTPortIsOffline            = $00000008;

    {  Masks for the fInfoFlags field of the OTPortRecord. }

    kOTPortIsDLPI               = $00000001;
    kOTPortIsTPI                = $00000002;
    kOTPortCanYield             = $00000004;                    {  will not be set until the port is used for the first time }
    kOTPortCanArbitrate         = $00000008;                    {  will not be set until the port is used for the first time }
    kOTPortIsTransitory         = $00000010;
    kOTPortAutoConnects         = $00000020;
    kOTPortIsSystemRegistered   = $00004000;
    kOTPortIsPrivate            = $00008000;
    kOTPortIsAlias              = $80000000;

    {
       One OTPortRecord is created for each instance of a port.
       For Instance 'enet' identifies an ethernet port.
       A OTPortRecord for each ethernet card it finds, with an
       OTPortRef that will uniquely allow the driver to determine which
       port it is supposed to open on.
    }


type
    OTPortRecordPtr = ^OTPortRecord;
    OTPortRecord = record
        fRef:                   OTPortRef;
        fPortFlags:             UInt32;
        fInfoFlags:             UInt32;
        fCapabilities:          UInt32;
        fNumChildPorts:         ItemCount;
        fChildPorts:            OTPortRefPtr;
        fPortName:              packed array [0..35] of char;
        fModuleName:            packed array [0..31] of char;
        fSlotID:                packed array [0..7] of char;
        fResourceInfo:          packed array [0..31] of char;
        fReserved:              packed array [0..163] of char;
    end;

    {
       Routines for finding, registering and unregistering ports.
       IMPORTANT:
       These routines have two versions, one for the client and one
       for the kernel.  Make sure you use and link with the right ones.
    }
    {
     *  OTGetIndexedPort()
     *
     *  Availability:
     *    Non-Carbon CFM:   in OTClientUtilLib 1.0 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function OTGetIndexedPort(var portRecord: OTPortRecord; index: OTItemCount): boolean; external name '_OTGetIndexedPort';

{  Index through the ports in the system }
{
 *  OTFindPort()
 *
 *  Availability:
 *    Non-Carbon CFM:   in OTClientUtilLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTFindPort(var portRecord: OTPortRecord; portName: ConstCStringPtr): boolean; external name '_OTFindPort';

{  Find an OTPortRecord for a port using it's name }
{
 *  OTFindPortByRef()
 *
 *  Availability:
 *    Non-Carbon CFM:   in OTClientUtilLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTFindPortByRef(var portRecord: OTPortRecord; ref: OTPortRef): boolean; external name '_OTFindPortByRef';

{  Find an OTPortRecord for a port using it's OTPortRef }

{  ***** Data Buffers ***** }
{
   TNetbuf is the basic structure used to pass data back and forth
   between the Open Transport protocols and their clients
}


type
    TNetbufPtr = ^TNetbuf;
    TNetbuf = record
        maxlen:                 ByteCount;
        len:                    ByteCount;
        buf:                    Ptr;
    end;

    {
       Some rarely used low-level routines in this file take a strbuf
       as a parameter.  This is the raw streams equivalent of a TNetbuf.
       The key difference is that the maxlen and len fields are signed,
       which allows you to specify extra operations by providing a
       negative value.
    }


    strbufPtr = ^strbuf;
    strbuf = record
        maxlen:                 SInt32;                                 {  max buffer length  }
        len:                    SInt32;                                 {  length of data  }
        buf:                    CStringPtr;                             {  pointer to buffer  }
    end;

    {
       OTData is used in a TNetbuf or netbuf to send
       non-contiguous data.  Set the 'len' field of the netbuf to the
       constant kNetbufDataIsOTData to signal that the 'buf' field of the
       netbuf actually points to one of these structures instead of a
       memory buffer.
    }
    OTDataPtr = ^OTData;
    OTData = record
        fNext:                  Ptr;
        fData:                  Ptr;
        fLen:                   ByteCount;
    end;


const
    kNetbufDataIsOTData         = $FFFFFFFE;


    {
       OTBuffer is used for no-copy receives.  When receiving, you can
       set the receive length to kOTNetbufDataIsOTBufferStar and then
       pass the address of an OTBuffer* as the receive buffer.  OT will
       fill it out to point to a chain of OTBuffers.
       When you are done with it, you must call the OTReleaseBuffer function.
       For best performance, you need to call OTReleaseBuffer quickly.
       Only data netbufs may use this - no netbufs for addresses or options, or the like.
       Any OTBuffer returned to you by OT is read only!
       The astute will notice that this has a high correlation with the
       STREAMS msgb data type.  The fields are commented with their
       corresponding msgb field name.
    }


type
    OTBufferPtr = ^OTBuffer;
    OTBuffer = record
        fLink:                  Ptr;                                    {  b_next }
        fLink2:                 Ptr;                                    {  b_prev }
        fNext:                  OTBufferPtr;                            {  b_cont }
        fData:                  Ptr;                                    {  b_rptr }
        fLen:                   ByteCount;                              {  b_wptr }
        fSave:                  Ptr;                                    {  b_datap }
        fBand:                  SInt8;                                  {  b_band }
        fType:                  SInt8;                                  {  b_pad1 }
        fPad1:                  SInt8;
        fFlags:                 SInt8;                                  {  b_flag }
    end;


const
    kOTNetbufDataIsOTBufferStar = $FFFFFFFD;

    {
       OTBufferInfo is used with OTReadBuffer to keep track of where you
       are in the buffer, since the OTBuffer is "read-only".
    }
    {
       To initialise this structure, copy the code from the OTInitBuffer macro in
       the C header file.
    }

type
    OTBufferInfoPtr = ^OTBufferInfo;
    OTBufferInfo = record
        fBuffer:                OTBufferPtr;
        fOffset:                ByteCount;
        fPad:                   SInt8;
    end;

    {
       If the endpoint supports "raw mode" (the T_CAN_SUPPORT_MDATA bit will
       be set in the TEndpointInfo::flags field), then you specify the
       raw mode packet by putting the kOTNetbufIsRawMode value in
       the udata.addr.len field when calling OTSndUData and also set the
       udata.opt.len, udata.opt.buf, and udata.addr.buf fields to 0.
    }


const
    kOTNetbufIsRawMode          = $FFFFFFFF;

    {
       ***** Standard XTI Parameter Types *****
       These structures are all used as parameters to the standard
       XTI routines.
    }

    {
       TBind holds binding information for calls to
       OTGetProtAddress, OTResolveAddress and OTBind.
    }


type
    TBindPtr = ^TBind;
    TBind = record
        addr:                   TNetbuf;
        qlen:                   OTQLen;
    end;

    {
       TDiscon is passed to RcvDisconnect to find out additional information
       about the disconnect.
    }
    TDisconPtr = ^TDiscon;
    TDiscon = record
        udata:                  TNetbuf;
        reason:                 OTReason;
        sequence:               OTSequence;
    end;

    {
       TCall holds information about a connection and is a parameter to
       OTConnect, OTRcvConnect, OTListen, OTAccept, and OTSndDisconnect.
    }
    TCallPtr = ^TCall;
    TCall = record
        addr:                   TNetbuf;
        opt:                    TNetbuf;
        udata:                  TNetbuf;
        sequence:               OTSequence;
    end;

    {  TUnitData describes a datagram in calls to OTSndUData and OTRcvUData. }
    TUnitDataPtr = ^TUnitData;
    TUnitData = record
        addr:                   TNetbuf;
        opt:                    TNetbuf;
        udata:                  TNetbuf;
    end;

    {
       TUDErr is used to get information about a datagram error using
       OTRcvUDErr.
    }
    TUDErrPtr = ^TUDErr;
    TUDErr = record
        addr:                   TNetbuf;
        opt:                    TNetbuf;
        error:                  SInt32;
    end;

    {  TOptMgmt is passed to the OTOptionManagement call to read or set protocol }
    TOptMgmtPtr = ^TOptMgmt;
    TOptMgmt = record
        opt:                    TNetbuf;
        flags:                  OTFlags;
    end;

    {
       ***** Transactional XTI Parameter Types *****
       These structures are all used as parameters to the OT's
       XTI-like routines for transaction protocols.
    }
    {
       TRequest is passed to OTSndRequest and OTRcvRequest that contains the information
       about the request.
    }

    TRequestPtr = ^TRequest;
    TRequest = record
        data:                   TNetbuf;
        opt:                    TNetbuf;
        sequence:               OTSequence;
    end;

    {  TReply is passed to OTSndReply to send a reply to an incoming request. }
    TReplyPtr = ^TReply;
    TReply = record
        data:                   TNetbuf;
        opt:                    TNetbuf;
        sequence:               OTSequence;
    end;

    {
       TUnitRequest is passed to OTSndURequest and OTRcvURequest that contains
       the information about the request.
    }
    TUnitRequestPtr = ^TUnitRequest;
    TUnitRequest = record
        addr:                   TNetbuf;
        opt:                    TNetbuf;
        udata:                  TNetbuf;
        sequence:               OTSequence;
    end;

    {  TUnitReply is passed to OTSndUReply to send a reply to an incoming request. }
    TUnitReplyPtr = ^TUnitReply;
    TUnitReply = record
        opt:                    TNetbuf;
        udata:                  TNetbuf;
        sequence:               OTSequence;
    end;

    {
       ***** Mapper Parameter Types *****
       These structures are all used as parameters to the OT's
       mapper routines.
    }
    {  TRegisterRequest holds the name to register in a call to OTRegisterName. }

    TRegisterRequestPtr = ^TRegisterRequest;
    TRegisterRequest = record
        name:                   TNetbuf;
        addr:                   TNetbuf;
        flags:                  OTFlags;
    end;

    {
       TRegisterReply returns information about the registered name in a call
       to OTRegisterName.
    }
    TRegisterReplyPtr = ^TRegisterReply;
    TRegisterReply = record
        addr:                   TNetbuf;
        nameid:                 OTNameID;
    end;

    {  TLookupRequest holds the name to look up in a call to OTLookupName. }
    TLookupRequestPtr = ^TLookupRequest;
    TLookupRequest = record
        name:                   TNetbuf;
        addr:                   TNetbuf;
        maxcnt:                 UInt32;
        timeout:                OTTimeout;
        flags:                  OTFlags;
    end;

    {
       TLookupReply returns information about the found names after a call
       to OTLookupName.
    }
    TLookupReplyPtr = ^TLookupReply;
    TLookupReply = record
        names:                  TNetbuf;
        rspcount:               UInt32;
    end;

    {
       TLookupBuffer describes the contents of the names buffer pointed
       to by the TLookupReply.
    }
    TLookupBufferPtr = ^TLookupBuffer;
    TLookupBuffer = record
        fAddressLength:         UInt16;
        fNameLength:            UInt16;
        fAddressBuffer:         SInt8;
    end;

    {  ***** Initializing and Shutting Down Open Transport ***** }

    OTClientContextPtr    = ^SInt32; { an opaque 32-bit type }
    OTClientContextPtrPtr = ^OTClientContextPtr;  { when a var xx:OTClientContextPtr parameter can be nil, it is changed to xx: OTClientContextPtrPtr }
    {
       For Carbon the InitOpenTransport interface has changed so it takes a flags parameter
       and returns a client context pointer.
       The flag passed to indicates whether OT should be initialized for application use or for some other target
       (for example, plugins that run in an application context but not the application itself.)
       Applications that are not interested in the value of the client context pointer may pass NULL
       as outClientContext -- they will pass NULL to other routines that take a OTClientContextPtr.
    }
    OTInitializationFlags       = UInt32;
const
    kInitOTForApplicationMask   = 1;
    kInitOTForExtensionMask     = 2;

    {
     *  InitOpenTransportInContext()
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function InitOpenTransportInContext(flags: OTInitializationFlags; outClientContext: OTClientContextPtrPtr): OSStatus; external name '_InitOpenTransportInContext';


{
   Under Carbon, CloseOpenTransport takes a client context pointer.  Applications may pass NULL
   after calling InitOpenTransport(kInitOTForApplicationMask, ...).  Non-applications must always pass a
   valid client context.
}
{
 *  CloseOpenTransportInContext()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CloseOpenTransportInContext(clientContext: OTClientContextPtr); external name '_CloseOpenTransportInContext';


{
 *  OTRegisterAsClientInContext()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTRegisterAsClientInContext(name: OTClientName; proc: OTNotifyUPP; clientContext: OTClientContextPtr): OSStatus; external name '_OTRegisterAsClientInContext';

{
 *  OTUnregisterAsClientInContext()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTUnregisterAsClientInContext(clientContext: OTClientContextPtr): OSStatus; external name '_OTUnregisterAsClientInContext';

{  The following macro may be used by applications only. }

{  ***** Tasking Model ***** }
{
   OTEnterInterrupt/OTLeaveInterrupt are normally used within the kernel to
   tell Open Transport we're at hardware interrupt time.  Clients can also
   them to do the same.
}



type
    OTProcessProcPtr = procedure(arg: UnivPtr);

    OTProcessUPP = ^SInt32; { an opaque UPP }

const
    uppOTProcessProcInfo = $000000C0;
    {
     *  NewOTProcessUPP()
     *
     *  Availability:
     *    Non-Carbon CFM:   available as macro/inline
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function NewOTProcessUPP(userRoutine: OTProcessProcPtr): OTProcessUPP; external name '_NewOTProcessUPP';
{
 *  DisposeOTProcessUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeOTProcessUPP(userUPP: OTProcessUPP); external name '_DisposeOTProcessUPP';
{
 *  InvokeOTProcessUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvokeOTProcessUPP(arg: UnivPtr; userRoutine: OTProcessUPP); external name '_InvokeOTProcessUPP';
{
   Under Carbon, OTCreateDeferredTask takes a client context pointer.  Applications may pass NULL
   after calling InitOpenTransport(kInitOTForApplicationMask, ...).  Non-applications must always pass a
   valid client context.
}
{
 *  OTCreateDeferredTaskInContext()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTCreateDeferredTaskInContext(upp: OTProcessUPP; arg: UnivPtr; clientContext: OTClientContextPtr): SInt32; external name '_OTCreateDeferredTaskInContext';


{
   OT deferred tasks are often more convenience that standard Mac OS
   although they have no significant advantages beyond convenience.
}


type
    OTDeferredTaskRef                   = SInt32;

{
 *  OTScheduleDeferredTask()
 *
 *  Availability:
 *    Non-Carbon CFM:   in OTUtilityLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTScheduleDeferredTask(dtCookie: OTDeferredTaskRef): boolean; external name '_OTScheduleDeferredTask';


{
 *  OTDestroyDeferredTask()
 *
 *  Availability:
 *    Non-Carbon CFM:   in OTUtilityLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTDestroyDeferredTask(dtCookie: OTDeferredTaskRef): OSStatus; external name '_OTDestroyDeferredTask';

{  The following macro may be used by applications only. }

{
   OT system tasks allow you to schedule a procedure to be called
   at system task time.  Potentially useful, but it relies on someone
   calling SystemTask (or WaitNextEvent, which calls SystemTask).
   Not available to kernel code because relying on system task time
   to make progress is likely to result in deadlocks.
}

type
    OTSystemTaskRef                     = SInt32;
{
 *  OTCanMakeSyncCall()
 *
 *  Availability:
 *    Non-Carbon CFM:   in OTUtilityLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTCanMakeSyncCall: boolean; external name '_OTCanMakeSyncCall';


{  ***** Interface to Providers ***** }
{
 *  OTCloseProvider()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTCloseProvider(ref: ProviderRef): OSStatus; external name '_OTCloseProvider';

{
 *  OTIoctl()
 *
 *  Availability:
 *    Non-Carbon CFM:   in OTClientLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTIoctl(ref: ProviderRef; cmd: UInt32; data: UnivPtr): SInt32; external name '_OTIoctl';

{
 *  OTSetAsynchronous()
 *
 *  Availability:
 *    Non-Carbon CFM:   in OTClientLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTSetAsynchronous(ref: ProviderRef): OSStatus; external name '_OTSetAsynchronous';

{
 *  OTSetSynchronous()
 *
 *  Availability:
 *    Non-Carbon CFM:   in OTClientLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTSetSynchronous(ref: ProviderRef): OSStatus; external name '_OTSetSynchronous';

{
 *  OTIsSynchronous()
 *
 *  Availability:
 *    Non-Carbon CFM:   in OTClientLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTIsSynchronous(ref: ProviderRef): boolean; external name '_OTIsSynchronous';

{
 *  OTSetBlocking()
 *
 *  Availability:
 *    Non-Carbon CFM:   in OTClientLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTSetBlocking(ref: ProviderRef): OSStatus; external name '_OTSetBlocking';

{
 *  OTSetNonBlocking()
 *
 *  Availability:
 *    Non-Carbon CFM:   in OTClientLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTSetNonBlocking(ref: ProviderRef): OSStatus; external name '_OTSetNonBlocking';

{
 *  OTIsBlocking()
 *
 *  Availability:
 *    Non-Carbon CFM:   in OTClientLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTIsBlocking(ref: ProviderRef): boolean; external name '_OTIsBlocking';

{
 *  OTInstallNotifier()
 *
 *  Availability:
 *    Non-Carbon CFM:   in OTClientLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTInstallNotifier(ref: ProviderRef; proc: OTNotifyUPP; contextPtr: UnivPtr): OSStatus; external name '_OTInstallNotifier';

{
 *  OTUseSyncIdleEvents()
 *
 *  Availability:
 *    Non-Carbon CFM:   in OTClientLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTUseSyncIdleEvents(ref: ProviderRef; useEvents: boolean): OSStatus; external name '_OTUseSyncIdleEvents';

{
 *  OTRemoveNotifier()
 *
 *  Availability:
 *    Non-Carbon CFM:   in OTClientLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure OTRemoveNotifier(ref: ProviderRef); external name '_OTRemoveNotifier';

{
 *  OTLeaveNotifier()
 *
 *  Availability:
 *    Non-Carbon CFM:   in OTClientLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure OTLeaveNotifier(ref: ProviderRef); external name '_OTLeaveNotifier';

{
 *  OTEnterNotifier()
 *
 *  Availability:
 *    Non-Carbon CFM:   in OTClientLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTEnterNotifier(ref: ProviderRef): boolean; external name '_OTEnterNotifier';

{
 *  OTAckSends()
 *
 *  Availability:
 *    Non-Carbon CFM:   in OTClientLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTAckSends(ref: ProviderRef): OSStatus; external name '_OTAckSends';

{
 *  OTDontAckSends()
 *
 *  Availability:
 *    Non-Carbon CFM:   in OTClientLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTDontAckSends(ref: ProviderRef): OSStatus; external name '_OTDontAckSends';

{
 *  OTIsAckingSends()
 *
 *  Availability:
 *    Non-Carbon CFM:   in OTClientLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTIsAckingSends(ref: ProviderRef): boolean; external name '_OTIsAckingSends';

{
 *  OTCancelSynchronousCalls()
 *
 *  Availability:
 *    Non-Carbon CFM:   in OTClientLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTCancelSynchronousCalls(ref: ProviderRef; err: OSStatus): OSStatus; external name '_OTCancelSynchronousCalls';


{  ***** Interface to Endpoints ***** }
{  Open/Close }
{
   Under Carbon, the OpenEndpoint routines take a client context pointer.  Applications may pass NULL after
   calling InitOpenTransport(kInitOTForApplicationMask, ...).  Non-applications must always pass a
   valid client context.
}
{
 *  OTOpenEndpointInContext()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTOpenEndpointInContext(config: OTConfigurationRef; oflag: OTOpenFlags; info: TEndpointInfoPtr; var err: OSStatus; clientContext: OTClientContextPtr): EndpointRef; external name '_OTOpenEndpointInContext';

{
 *  OTAsyncOpenEndpointInContext()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTAsyncOpenEndpointInContext(config: OTConfigurationRef; oflag: OTOpenFlags; info: TEndpointInfoPtr; upp: OTNotifyUPP; contextPtr: UnivPtr; clientContext: OTClientContextPtr): OSStatus; external name '_OTAsyncOpenEndpointInContext';



{  The following macros may be used by applications only. }
{  Misc Information }

{
 *  OTGetEndpointInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in OTClientLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTGetEndpointInfo(ref: EndpointRef; var info: TEndpointInfo): OSStatus; external name '_OTGetEndpointInfo';

{
 *  OTGetEndpointState()
 *
 *  Availability:
 *    Non-Carbon CFM:   in OTClientLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTGetEndpointState(ref: EndpointRef): OTResult; external name '_OTGetEndpointState';

{
 *  OTLook()
 *
 *  Availability:
 *    Non-Carbon CFM:   in OTClientLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTLook(ref: EndpointRef): OTResult; external name '_OTLook';

{
 *  OTCountDataBytes()
 *
 *  Availability:
 *    Non-Carbon CFM:   in OTClientLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTCountDataBytes(ref: EndpointRef; var countPtr: OTByteCount): OTResult; external name '_OTCountDataBytes';

{
 *  OTGetProtAddress()
 *
 *  Availability:
 *    Non-Carbon CFM:   in OTClientLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTGetProtAddress(ref: EndpointRef; boundAddr: TBindPtr; peerAddr: TBindPtr): OSStatus; external name '_OTGetProtAddress';

{
 *  OTResolveAddress()
 *
 *  Availability:
 *    Non-Carbon CFM:   in OTClientLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTResolveAddress(ref: EndpointRef; var reqAddr: TBind; var retAddr: TBind; timeOut: OTTimeout): OSStatus; external name '_OTResolveAddress';

{  Allocating structures }

{
   Note:
   In general, Apple recommends that you avoid the OTAlloc call because
   using it extensively causes your program to allocate and deallocate
   many memory blocks, with each extra memory allocation costing time.
}

{
   Under Carbon, OTAlloc takes a client context pointer.  Applications may pass NULL after
   calling InitOpenTransport(kInitOTForApplicationMask, ...).  Non-applications must always pass a
   valid client context.
}
{
 *  OTAllocInContext()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTAllocInContext(ref: EndpointRef; structType: OTStructType; fields: UInt32; var err: OSStatus; clientContext: OTClientContextPtr): Ptr; external name '_OTAllocInContext';

{  The following macro may be used by applications only. }
{
 *  OTFree()
 *
 *  Availability:
 *    Non-Carbon CFM:   in OTClientLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTFree(ptr: UnivPtr; structType: OTStructType): OTResult; external name '_OTFree';

{  Option management }

{  It looks simple enough... }

{
 *  OTOptionManagement()
 *
 *  Availability:
 *    Non-Carbon CFM:   in OTClientLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTOptionManagement(ref: EndpointRef; var req: TOptMgmt; var ret: TOptMgmt): OSStatus; external name '_OTOptionManagement';

{  ... but then the hidden complexity emerges. }

{
 *  OTNextOption()
 *
 *  Availability:
 *    Non-Carbon CFM:   in OTClientLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTNextOption(buffer: UInt8Ptr; buflen: UInt32; var prevOptPtr: TOptionPtr): OSStatus; external name '_OTNextOption';

{
 *  OTFindOption()
 *
 *  Availability:
 *    Non-Carbon CFM:   in OTClientLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTFindOption(buffer: UInt8Ptr; buflen: UInt32; level: OTXTILevel; name: OTXTIName): TOptionPtr; external name '_OTFindOption';

{  Bind/Unbind }

{
 *  OTBind()
 *
 *  Availability:
 *    Non-Carbon CFM:   in OTClientLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTBind(ref: EndpointRef; reqAddr: TBindPtr; retAddr: TBindPtr): OSStatus; external name '_OTBind';

{
 *  OTUnbind()
 *
 *  Availability:
 *    Non-Carbon CFM:   in OTClientLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTUnbind(ref: EndpointRef): OSStatus; external name '_OTUnbind';

{  Connection creation/tear-down }

{
 *  OTConnect()
 *
 *  Availability:
 *    Non-Carbon CFM:   in OTClientLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTConnect(ref: EndpointRef; var sndCall: TCall; rcvCall: TCallPtr): OSStatus; external name '_OTConnect';

{
 *  OTRcvConnect()
 *
 *  Availability:
 *    Non-Carbon CFM:   in OTClientLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTRcvConnect(ref: EndpointRef; call: TCallPtr): OSStatus; external name '_OTRcvConnect';

{
 *  OTListen()
 *
 *  Availability:
 *    Non-Carbon CFM:   in OTClientLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTListen(ref: EndpointRef; var call: TCall): OSStatus; external name '_OTListen';

{
 *  OTAccept()
 *
 *  Availability:
 *    Non-Carbon CFM:   in OTClientLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTAccept(listener: EndpointRef; worker: EndpointRef; var call: TCall): OSStatus; external name '_OTAccept';

{
 *  OTSndDisconnect()
 *
 *  Availability:
 *    Non-Carbon CFM:   in OTClientLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTSndDisconnect(ref: EndpointRef; call: TCallPtr): OSStatus; external name '_OTSndDisconnect';

{
 *  OTSndOrderlyDisconnect()
 *
 *  Availability:
 *    Non-Carbon CFM:   in OTClientLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTSndOrderlyDisconnect(ref: EndpointRef): OSStatus; external name '_OTSndOrderlyDisconnect';

{
 *  OTRcvDisconnect()
 *
 *  Availability:
 *    Non-Carbon CFM:   in OTClientLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTRcvDisconnect(ref: EndpointRef; discon: TDisconPtr): OSStatus; external name '_OTRcvDisconnect';

{
 *  OTRcvOrderlyDisconnect()
 *
 *  Availability:
 *    Non-Carbon CFM:   in OTClientLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTRcvOrderlyDisconnect(ref: EndpointRef): OSStatus; external name '_OTRcvOrderlyDisconnect';

{  Connection-oriented send/receive }

{
 *  OTRcv()
 *
 *  Availability:
 *    Non-Carbon CFM:   in OTClientLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTRcv(ref: EndpointRef; buf: UnivPtr; nbytes: OTByteCount; var flags: OTFlags): OTResult; external name '_OTRcv';

{
 *  OTSnd()
 *
 *  Availability:
 *    Non-Carbon CFM:   in OTClientLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTSnd(ref: EndpointRef; buf: UnivPtr; nbytes: OTByteCount; flags: OTFlags): OTResult; external name '_OTSnd';

{  Connectionless send/receive }

{
 *  OTSndUData()
 *
 *  Availability:
 *    Non-Carbon CFM:   in OTClientLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTSndUData(ref: EndpointRef; var udata: TUnitData): OSStatus; external name '_OTSndUData';

{
 *  OTRcvUData()
 *
 *  Availability:
 *    Non-Carbon CFM:   in OTClientLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTRcvUData(ref: EndpointRef; var udata: TUnitData; var flags: OTFlags): OSStatus; external name '_OTRcvUData';

{
 *  OTRcvUDErr()
 *
 *  Availability:
 *    Non-Carbon CFM:   in OTClientLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTRcvUDErr(ref: EndpointRef; uderr: TUDErrPtr): OSStatus; external name '_OTRcvUDErr';

{  Connection-oriented transactions }

{
 *  OTAsyncOpenMapperInContext()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTAsyncOpenMapperInContext(config: OTConfigurationRef; oflag: OTOpenFlags; upp: OTNotifyUPP; contextPtr: UnivPtr; clientContext: OTClientContextPtr): OSStatus; external name '_OTAsyncOpenMapperInContext';

{
 *  OTOpenMapperInContext()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTOpenMapperInContext(config: OTConfigurationRef; oflag: OTOpenFlags; var err: OSStatus; clientContext: OTClientContextPtr): MapperRef; external name '_OTOpenMapperInContext';


{  The following macros may be used by applications only. }
{
 *  OTRegisterName()
 *
 *  Availability:
 *    Non-Carbon CFM:   in OTClientLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTRegisterName(ref: MapperRef; var req: TRegisterRequest; var reply: TRegisterReply): OSStatus; external name '_OTRegisterName';

{
 *  OTDeleteName()
 *
 *  Availability:
 *    Non-Carbon CFM:   in OTClientLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTDeleteName(ref: MapperRef; var name: TNetbuf): OSStatus; external name '_OTDeleteName';

{
 *  OTDeleteNameByID()
 *
 *  Availability:
 *    Non-Carbon CFM:   in OTClientLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTDeleteNameByID(ref: MapperRef; nameID: OTNameID): OSStatus; external name '_OTDeleteNameByID';

{
 *  OTLookupName()
 *
 *  Availability:
 *    Non-Carbon CFM:   in OTClientLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTLookupName(ref: MapperRef; var req: TLookupRequest; var reply: TLookupReply): OSStatus; external name '_OTLookupName';

{  Basic configuration manipulation }

{
 *  OTCreateConfiguration()
 *
 *  Availability:
 *    Non-Carbon CFM:   in OTClientUtilLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTCreateConfiguration(path: ConstCStringPtr): OTConfigurationRef; external name '_OTCreateConfiguration';

{
 *  OTCloneConfiguration()
 *
 *  Availability:
 *    Non-Carbon CFM:   in OTClientUtilLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTCloneConfiguration(cfig: OTConfigurationRef): OTConfigurationRef; external name '_OTCloneConfiguration';

{
 *  OTDestroyConfiguration()
 *
 *  Availability:
 *    Non-Carbon CFM:   in OTClientUtilLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure OTDestroyConfiguration(cfig: OTConfigurationRef); external name '_OTDestroyConfiguration';

{
   This file defines a very limited set of operations
   on a configuration.  "OpenTransportClient.h" extends this with extra
   operations used by protocol stacks but not typically needed by clients.
}

{  Interrupt-safe memory allocators }

{
   Under Carbon, OTAllocMem takes a client context pointer.  Applications may pass NULL after
   calling InitOpenTransport(kInitOTForApplicationMask, ...).  Non-applications must always pass a
   valid client context.
}
{
 *  OTAllocMemInContext()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTAllocMemInContext(size: OTByteCount; clientContext: OTClientContextPtr): Ptr; external name '_OTAllocMemInContext';

{
 *  OTFreeMem()
 *
 *  Availability:
 *    Non-Carbon CFM:   in OTClientUtilLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure OTFreeMem(mem: UnivPtr); external name '_OTFreeMem';

{  The following macros may be used by applications only. }
{  Miscellaneous and Generic Routines }

{
   Neither of these routines should be necessary to the correct
   operation of an OT program.  If you're calling them, think again.
}

{
 *  OTDelay()
 *
 *  Availability:
 *    Non-Carbon CFM:   in OTClientLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure OTDelay(seconds: UInt32); external name '_OTDelay';

{
 *  OTIdle()
 *
 *  Availability:
 *    Non-Carbon CFM:   in OTClientLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure OTIdle; external name '_OTIdle';


{
   ***** Open Transport Utility Routines *****
   All of these routines are available to both client and kernel.
}
{  Memory and String Routines }

{
   These are preferable, especially in the kernel case, to the standard
   C equivalents because they don't require you to link with StdCLib.
}

{
 *  OTMemcpy()
 *
 *  Availability:
 *    Non-Carbon CFM:   in OTUtilityLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure OTMemcpy(dest: UnivPtr; src: UnivPtr; nBytes: OTByteCount); external name '_OTMemcpy';

{
 *  OTMemcmp()
 *
 *  Availability:
 *    Non-Carbon CFM:   in OTUtilityLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTMemcmp(mem1: UnivPtr; mem2: UnivPtr; nBytes: OTByteCount): boolean; external name '_OTMemcmp';

{
 *  OTMemmove()
 *
 *  Availability:
 *    Non-Carbon CFM:   in OTUtilityLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure OTMemmove(dest: UnivPtr; src: UnivPtr; nBytes: OTByteCount); external name '_OTMemmove';

{
 *  OTMemzero()
 *
 *  Availability:
 *    Non-Carbon CFM:   in OTUtilityLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure OTMemzero(dest: UnivPtr; nBytes: OTByteCount); external name '_OTMemzero';

{
 *  OTMemset()
 *
 *  Availability:
 *    Non-Carbon CFM:   in OTUtilityLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure OTMemset(dest: UnivPtr; toSet: OTUInt8Param; nBytes: OTByteCount); external name '_OTMemset';

{
 *  OTStrLength()
 *
 *  Availability:
 *    Non-Carbon CFM:   in OTUtilityLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTStrLength(str: ConstCStringPtr): OTByteCount; external name '_OTStrLength';

{
 *  OTStrCopy()
 *
 *  Availability:
 *    Non-Carbon CFM:   in OTUtilityLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure OTStrCopy(dest: CStringPtr; src: ConstCStringPtr); external name '_OTStrCopy';

{
 *  OTStrCat()
 *
 *  Availability:
 *    Non-Carbon CFM:   in OTUtilityLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure OTStrCat(dest: CStringPtr; src: ConstCStringPtr); external name '_OTStrCat';

{
 *  OTStrEqual()
 *
 *  Availability:
 *    Non-Carbon CFM:   in OTUtilityLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTStrEqual(src1: ConstCStringPtr; src2: ConstCStringPtr): boolean; external name '_OTStrEqual';

{  Timer Utilities }

{
   OTGetTimeStamp returns time in "tick" numbers, stored in 64 bits.
   This timestamp can be used as a base number for calculating elapsed
   time.
   OTSubtractTimeStamps returns a pointer to the "result" parameter.

   OTGetClockTimeInSecs returns time since Open Transport was initialized
   in seconds.
}


type
    OTTimeStamp                         = UnsignedWide;
    OTTimeStampPtr                      = ^OTTimeStamp;
    {
     *  OTGetTimeStamp()
     *
     *  Availability:
     *    Non-Carbon CFM:   in OTUtilityLib 1.0 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
procedure OTGetTimeStamp(var currentTime: OTTimeStamp); external name '_OTGetTimeStamp';

{
 *  OTSubtractTimeStamps()
 *
 *  Availability:
 *    Non-Carbon CFM:   in OTUtilityLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTSubtractTimeStamps(var result: OTTimeStamp; var startTime: OTTimeStamp; var endEnd: OTTimeStamp): OTTimeStampPtr; external name '_OTSubtractTimeStamps';

{
 *  OTTimeStampInMilliseconds()
 *
 *  Availability:
 *    Non-Carbon CFM:   in OTUtilityLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTTimeStampInMilliseconds(var delta: OTTimeStamp): UInt32; external name '_OTTimeStampInMilliseconds';

{
 *  OTTimeStampInMicroseconds()
 *
 *  Availability:
 *    Non-Carbon CFM:   in OTUtilityLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTTimeStampInMicroseconds(var delta: OTTimeStamp): UInt32; external name '_OTTimeStampInMicroseconds';

{
 *  OTElapsedMilliseconds()
 *
 *  Availability:
 *    Non-Carbon CFM:   in OTUtilityLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTElapsedMilliseconds(var startTime: OTTimeStamp): UInt32; external name '_OTElapsedMilliseconds';

{
 *  OTElapsedMicroseconds()
 *
 *  Availability:
 *    Non-Carbon CFM:   in OTUtilityLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTElapsedMicroseconds(var startTime: OTTimeStamp): UInt32; external name '_OTElapsedMicroseconds';

{
 *  OTGetClockTimeInSecs()
 *
 *  Availability:
 *    Non-Carbon CFM:   in OTUtilityLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTGetClockTimeInSecs: UInt32; external name '_OTGetClockTimeInSecs';

{  ***** OT Link Element ***** }

{
   When using OT linked lists, all pointers to other elements are
   represented by the OTLink structure.  When operating on link
   lists, you always pass in the address of the OTLink on which
   list elements are chained.
}


type
    OTLinkPtr = ^OTLink;
    OTLink = record
        fNext:                  OTLinkPtr;
    end;

    {  OTLIFO }

    {
       These are functions to implement a LIFO list that is interrupt-safe.
       The only function which is not is OTReverseList.  Normally, you create
       a LIFO list, populate it at interrupt time, and then use OTLIFOStealList
       to atomically remove the list, and OTReverseList to flip the list so that
       it is a FIFO list, which tends to be more useful.
    }

    OTLIFOPtr = ^OTLIFO;
    OTLIFO = record
        fHead:                  OTLinkPtr;
    end;

    {
       This function atomically enqueues the link onto the
       front of the list.
    }
    {
     *  OTLIFOEnqueue()
     *
     *  Availability:
     *    Non-Carbon CFM:   in OTUtilityLib 1.0 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
procedure OTLIFOEnqueue(var list: OTLIFO; var link: OTLink); external name '_OTLIFOEnqueue';

{
   This function atomically dequeues the first element
   on the list.
}
{
 *  OTLIFODequeue()
 *
 *  Availability:
 *    Non-Carbon CFM:   in OTUtilityLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTLIFODequeue(var list: OTLIFO): OTLinkPtr; external name '_OTLIFODequeue';

{
   This function atomically empties the list and returns a
   pointer to the first element on the list.
}
{
 *  OTLIFOStealList()
 *
 *  Availability:
 *    Non-Carbon CFM:   in OTUtilityLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTLIFOStealList(var list: OTLIFO): OTLinkPtr; external name '_OTLIFOStealList';

{
   This function reverses a list that was stolen by
   OTLIFOStealList.  It is NOT atomic.  It returns the
   new starting list.
}
{
 *  OTReverseList()
 *
 *  Availability:
 *    Non-Carbon CFM:   in OTUtilityLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTReverseList(var list: OTLink): OTLinkPtr; external name '_OTReverseList';

{  OTList }

{
   An OTList is a non-interrupt-safe list, but has more features than the
   OTLIFO list. It is a standard singly-linked list.
}

{
   The following is the prototype for a list element comparison function,
   which returns true if the element described by linkToCheck matches
   the client criteria (typically held in ref).
   This is only a UPP for CFM-68K clients.
}


type
    OTListSearchProcPtr = function(ref: UnivPtr; var linkToCheck: OTLink): boolean;

    OTListSearchUPP = ^SInt32; { an opaque UPP }

const
    uppOTListSearchProcInfo = $000003D1;
    {
     *  NewOTListSearchUPP()
     *
     *  Availability:
     *    Non-Carbon CFM:   available as macro/inline
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function NewOTListSearchUPP(userRoutine: OTListSearchProcPtr): OTListSearchUPP; external name '_NewOTListSearchUPP';
{
 *  DisposeOTListSearchUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeOTListSearchUPP(userUPP: OTListSearchUPP); external name '_DisposeOTListSearchUPP';
{
 *  InvokeOTListSearchUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeOTListSearchUPP(ref: UnivPtr; var linkToCheck: OTLink; userRoutine: OTListSearchUPP): boolean; external name '_InvokeOTListSearchUPP';

type
    OTListPtr = ^OTList;
    OTList = record
        fHead:                  OTLinkPtr;
    end;

    {  Add the link to the list at the front }
    {
     *  OTAddFirst()
     *
     *  Availability:
     *    Non-Carbon CFM:   in OTUtilityLib 1.0 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
procedure OTAddFirst(var list: OTList; var link: OTLink); external name '_OTAddFirst';

{  Add the link to the list at the end }
{
 *  OTAddLast()
 *
 *  Availability:
 *    Non-Carbon CFM:   in OTUtilityLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure OTAddLast(var list: OTList; var link: OTLink); external name '_OTAddLast';

{  Remove the first link from the list }
{
 *  OTRemoveFirst()
 *
 *  Availability:
 *    Non-Carbon CFM:   in OTUtilityLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTRemoveFirst(var list: OTList): OTLinkPtr; external name '_OTRemoveFirst';

{  Remove the last link from the list }
{
 *  OTRemoveLast()
 *
 *  Availability:
 *    Non-Carbon CFM:   in OTUtilityLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTRemoveLast(var list: OTList): OTLinkPtr; external name '_OTRemoveLast';

{  Return the first link from the list }
{
 *  OTGetFirst()
 *
 *  Availability:
 *    Non-Carbon CFM:   in OTUtilityLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTGetFirst(var list: OTList): OTLinkPtr; external name '_OTGetFirst';

{  Return the last link from the list }
{
 *  OTGetLast()
 *
 *  Availability:
 *    Non-Carbon CFM:   in OTUtilityLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTGetLast(var list: OTList): OTLinkPtr; external name '_OTGetLast';

{  Return true if the link is present in the list }
{
 *  OTIsInList()
 *
 *  Availability:
 *    Non-Carbon CFM:   in OTUtilityLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTIsInList(var list: OTList; var link: OTLink): boolean; external name '_OTIsInList';

{
   Find a link in the list which matches the search criteria
   established by the search proc and the refPtr.  This is done
   by calling the search proc, passing it the refPtr and each
   link in the list, until the search proc returns true.
   NULL is returned if the search proc never returned true.
}
{
 *  OTFindLink()
 *
 *  Availability:
 *    Non-Carbon CFM:   in OTUtilityLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTFindLink(var list: OTList; proc: OTListSearchUPP; ref: UnivPtr): OTLinkPtr; external name '_OTFindLink';

{  Remove the specified link from the list, returning true if it was found }
{
 *  OTRemoveLink()
 *
 *  Availability:
 *    Non-Carbon CFM:   in OTUtilityLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTRemoveLink(var list: OTList; var link: OTLink): boolean; external name '_OTRemoveLink';

{  Similar to OTFindLink, but it also removes it from the list. }
{
 *  OTFindAndRemoveLink()
 *
 *  Availability:
 *    Non-Carbon CFM:   in OTUtilityLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTFindAndRemoveLink(var list: OTList; proc: OTListSearchUPP; ref: UnivPtr): OTLinkPtr; external name '_OTFindAndRemoveLink';

{  Return the "index"th link in the list }
{
 *  OTGetIndexedLink()
 *
 *  Availability:
 *    Non-Carbon CFM:   in OTUtilityLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTGetIndexedLink(var list: OTList; index: OTItemCount): OTLinkPtr; external name '_OTGetIndexedLink';

{  OTEnqueue/OTDequeue }

{
   These routines are atomic, mighty weird, and generally not
   worth the complexity.  If you need atomic list operations,
   use OTLIFO instead.
}

{
   This function puts "object" on the listHead, and places the
   previous value at listHead into the pointer at "object" plus
   linkOffset.
}
{
 *  OTEnqueue()
 *
 *  Availability:
 *    Non-Carbon CFM:   in OTUtilityLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure OTEnqueue(var listHead: UnivPtr; objct: UnivPtr; linkOffset: OTByteCount); external name '_OTEnqueue';

{
   This function returns the head object of the list, and places
   the pointer at "object" + linkOffset into the listHead
}
{
 *  OTDequeue()
 *
 *  Availability:
 *    Non-Carbon CFM:   in OTUtilityLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTDequeue(var listHead: UnivPtr; linkOffset: OTByteCount): Ptr; external name '_OTDequeue';

{  Atomic Operations }

{
   Note:
   The Bit operations return the previous value of the bit (0 or non-zero).
   The memory pointed to must be a single byte and only bits 0 through 7 are
   valid.  Bit 0 corresponds to a mask of 0x01, and Bit 7 to a mask of 0x80.
}

{
   WARNING!
   void* and UInt32 locations MUST be on 4-byte boundaries.
   UInt16 locations must not cross a 4-byte boundary.
}

{
 *  OTAtomicSetBit()
 *
 *  Availability:
 *    Non-Carbon CFM:   in OTUtilityLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTAtomicSetBit(bytePtr: UInt8Ptr; bitNumber: OTByteCount): boolean; external name '_OTAtomicSetBit';
{
   bset.b d0,(a0)
   sne d0
   moveq #1,d1
   and.l d1,d0
}
{
 *  OTAtomicClearBit()
 *
 *  Availability:
 *    Non-Carbon CFM:   in OTUtilityLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTAtomicClearBit(bytePtr: UInt8Ptr; bitNumber: OTByteCount): boolean; external name '_OTAtomicClearBit';
{
   bclr.b d0,(a0)
   sne d0
   moveq #1,d1
   and.l d1,d0
}
{
 *  OTAtomicTestBit()
 *
 *  Availability:
 *    Non-Carbon CFM:   in OTUtilityLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTAtomicTestBit(bytePtr: UInt8Ptr; bitNumber: OTByteCount): boolean; external name '_OTAtomicTestBit';
{
   btst.b d0,(a0)
   sne d0 */
   moveq #1,d1
   and.l d1,d0 */
}
{
 *  OTCompareAndSwapPtr()
 *
 *  Availability:
 *    Non-Carbon CFM:   in OTUtilityLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTCompareAndSwapPtr(oldValue: UnivPtr; newValue: UnivPtr; var dest: UnivPtr): boolean; external name '_OTCompareAndSwapPtr';
{
   cas.l    d0,d1,(a0)  */
   seq      d0          */
   moveq #1,d1; and.l d1,d0 */
}
{
 *  OTCompareAndSwap32()
 *
 *  Availability:
 *    Non-Carbon CFM:   in OTUtilityLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTCompareAndSwap32(oldValue: UInt32; newValue: UInt32; var dest: UInt32): boolean; external name '_OTCompareAndSwap32';
{
   cas.l    d0,d1,(a0)  */
   seq      d0          */
   moveq #1,d1; and.l d1,d0 */
}
{
 *  OTCompareAndSwap16()
 *
 *  Availability:
 *    Non-Carbon CFM:   in OTUtilityLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTCompareAndSwap16(oldValue: UInt32; newValue: UInt32; var dest: UInt16): boolean; external name '_OTCompareAndSwap16';
{
   cas.w    d0,d1,(a0)  */
   seq      d0          */
   moveq #1,d1; and.l d1,d0 */
}
{
 *  OTCompareAndSwap8()
 *
 *  Availability:
 *    Non-Carbon CFM:   in OTUtilityLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTCompareAndSwap8(oldValue: UInt32; newValue: UInt32; var dest: UInt8): boolean; external name '_OTCompareAndSwap8';
{
   cas.b    d0,d1,(a0)  */
   seq      d0          */
   moveq #1,d1; and.l d1,d0 */
}
{
 *  OTAtomicAdd32()
 *
 *  Availability:
 *    Non-Carbon CFM:   in OTUtilityLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTAtomicAdd32(toAdd: SInt32; var dest: SInt32): SInt32; external name '_OTAtomicAdd32';
{
   move.l   d0,a1       */
   move.l   (a0),d1     */
   move.l   d1,d0       */
   add.l    a1,d0       */
   cas.l    d1,d0,(a0)  */
   bne.s    @1          */
}
{
 *  OTAtomicAdd16()
 *
 *  Availability:
 *    Non-Carbon CFM:   in OTUtilityLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTAtomicAdd16(toAdd: SInt32; var dest: SInt16): SInt16; external name '_OTAtomicAdd16';

{  Not used frequently enough to justify inlining. }
{
 *  OTAtomicAdd8()
 *
 *  Availability:
 *    Non-Carbon CFM:   in OTUtilityLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTAtomicAdd8(toAdd: SInt32; var dest: SInt8): SInt8; external name '_OTAtomicAdd8';

{  Not used frequently enough to justify inlining. }
{  OTLock is just a convenience type with some convenient macros. }


type
    OTLock                              = UInt8;



{$ALIGN MAC68K}
{#POP}
{unit OpenTransportProviders}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}



{  ***** TCP/IP ***** }

{  Basic types }


type
    InetPort                            = UInt16;
    InetHost                            = UInt32;
    {   Enums used as address type designations. }

const
    AF_INET                     = 2;                            {  Traditonal }

    AF_DNS                      = 42;


    {
        Enum which can be used to bind to all IP interfaces
        rather than a specific one.
    }

    kOTAnyInetAddress           = 0;                            {  Wildcard }

    {
       Define the InetSvcRef type.  This type needs special
       processing because in C++ it's a subclass of TProvider.
       See the definition of TEndpointRef in "OpenTransport.h"
       for the logic behind this definition.
    }


type
    InetSvcRef    = ProviderRef; { an opaque 32-bit type }
    InetSvcRefPtr = ^InetSvcRef;  { when a var xx:InetSvcRef parameter can be nil, it is changed to xx: InetSvcRefPtr }

const
    kDefaultInternetServicesPath = -3;

    {  Shared library prefixes }

    {  Module Names }

    {  XTI Options }

    {  Protocol levels }

    INET_IP                     = $00;
    INET_TCP                    = $06;
    INET_UDP                    = $11;

    {  TCP Level Options }

    TCP_NODELAY                 = $01;
    TCP_MAXSEG                  = $02;
    TCP_NOTIFY_THRESHOLD        = $10;                          { * not a real XTI option  }
    TCP_ABORT_THRESHOLD         = $11;                          { * not a real XTI option  }
    TCP_CONN_NOTIFY_THRESHOLD   = $12;                          { * not a real XTI option  }
    TCP_CONN_ABORT_THRESHOLD    = $13;                          { * not a real XTI option  }
    TCP_OOBINLINE               = $14;                          { * not a real XTI option  }
    TCP_URGENT_PTR_TYPE         = $15;                          { * not a real XTI option  }
    TCP_KEEPALIVE               = $0008;                        {  keepalive defined in OpenTransport.h  }

    T_GARBAGE                   = 2;

    {  UDP Level Options }

    UDP_CHECKSUM                = $0600;
    UDP_RX_ICMP                 = $02;

    {  IP Level Options }
    kIP_OPTIONS                 = $01;
    kIP_TOS                     = $02;
    kIP_TTL                     = $03;
    kIP_REUSEADDR               = $04;
    kIP_DONTROUTE               = $10;
    kIP_BROADCAST               = $20;
    kIP_REUSEPORT               = $0200;
    kIP_HDRINCL                 = $1002;
    kIP_RCVOPTS                 = $1005;
    kIP_RCVDSTADDR              = $1007;
    kIP_MULTICAST_IF            = $1010;                        {  set/get IP multicast interface  }
    kIP_MULTICAST_TTL           = $1011;                        {  set/get IP multicast timetolive     }
    kIP_MULTICAST_LOOP          = $1012;                        {  set/get IP multicast loopback   }
    kIP_ADD_MEMBERSHIP          = $1013;                        {  add an IP group membership      }
    kIP_DROP_MEMBERSHIP         = $1014;                        {  drop an IP group membership        }
    kIP_BROADCAST_IFNAME        = $1015;                        {  Set interface for broadcasts    }
    kIP_RCVIFADDR               = $1016;                        {  Set interface for broadcasts    }

    IP_OPTIONS                  = $01;
    IP_TOS                      = $02;
    IP_TTL                      = $03;
    IP_REUSEADDR                = $04;
    IP_DONTROUTE                = $10;
    IP_BROADCAST                = $20;
    IP_REUSEPORT                = $0200;
    IP_HDRINCL                  = $1002;
    IP_RCVOPTS                  = $1005;
    IP_RCVDSTADDR               = $1007;
    IP_MULTICAST_IF             = $1010;                        {  set/get IP multicast interface  }
    IP_MULTICAST_TTL            = $1011;                        {  set/get IP multicast timetolive     }
    IP_MULTICAST_LOOP           = $1012;                        {  set/get IP multicast loopback   }
    IP_ADD_MEMBERSHIP           = $1013;                        {  add an IP group membership      }
    IP_DROP_MEMBERSHIP          = $1014;                        {  drop an IP group membership        }
    IP_BROADCAST_IFNAME         = $1015;                        {  Set interface for broadcasts    }
    IP_RCVIFADDR                = $1016;                        {  Set interface for broadcasts    }

    DVMRP_INIT                  = 100;                          {  DVMRP-specific setsockopt commands, from ip_mroute.h }
    DVMRP_DONE                  = 101;
    DVMRP_ADD_VIF               = 102;
    DVMRP_DEL_VIF               = 103;
    DVMRP_ADD_LGRP              = 104;
    DVMRP_DEL_LGRP              = 105;
    DVMRP_ADD_MRT               = 106;
    DVMRP_DEL_MRT               = 107;


    {  IP_TOS precdence levels }

    T_ROUTINE                   = 0;
    T_PRIORITY                  = 1;
    T_IMMEDIATE                 = 2;
    T_FLASH                     = 3;
    T_OVERRIDEFLASH             = 4;
    T_CRITIC_ECP                = 5;
    T_INETCONTROL               = 6;
    T_NETCONTROL                = 7;

    {   IP_TOS type of service }

    T_NOTOS                     = $00;
    T_LDELAY                    = $10;
    T_HITHRPT                   = $08;
    T_HIREL                     = $04;

    {  IP Multicast option structures }


type
    TIPAddMulticastPtr = ^TIPAddMulticast;
    TIPAddMulticast = record
        multicastGroupAddress:  InetHost;
        interfaceAddress:       InetHost;
    end;

    {  Protocol-specific events }

const
    T_DNRSTRINGTOADDRCOMPLETE   = $10000001;
    T_DNRADDRTONAMECOMPLETE     = $10000002;
    T_DNRSYSINFOCOMPLETE        = $10000003;
    T_DNRMAILEXCHANGECOMPLETE   = $10000004;
    T_DNRQUERYCOMPLETE          = $10000005;

    {  InetAddress }


type
    InetAddressPtr = ^InetAddress;
    InetAddress = record
        fAddressType:           OTAddressType;                          {  always AF_INET }
        fPort:                  InetPort;                               {  Port number  }
        fHost:                  InetHost;                               {  Host address in net byte order }
        fUnused:                packed array [0..7] of UInt8;           {  Traditional unused bytes }
    end;

    {  Domain Name Resolver (DNR)  }

const
    kMaxHostAddrs               = 10;
    kMaxSysStringLen            = 32;
    kMaxHostNameLen             = 255;


type
    InetDomainName                      = packed array [0..255] of char;
    InetHostInfoPtr = ^InetHostInfo;
    InetHostInfo = record
        name:                   InetDomainName;
        addrs:                  array [0..9] of InetHost;
    end;

    InetSysInfoPtr = ^InetSysInfo;
    InetSysInfo = record
        cpuType:                packed array [0..31] of char;
        osType:                 packed array [0..31] of char;
    end;

    InetMailExchangePtr = ^InetMailExchange;
    InetMailExchange = record
        preference:             UInt16;
        exchange:               InetDomainName;
    end;

    DNSQueryInfoPtr = ^DNSQueryInfo;
    DNSQueryInfo = record
        qType:                  UInt16;
        qClass:                 UInt16;
        ttl:                    UInt32;
        name:                   InetDomainName;
        responseType:           UInt16;                                 {  answer, authority, or additional }
        resourceLen:            UInt16;                                 {  actual length of array which follows }
        resourceData:           packed array [0..3] of char;            {  size varies }
    end;

    {  DNSAddress }
    {
       The DNSAddress format is optional and may be used in connects,
       datagram sends, and resolve address calls.   The name takes the
       format "somewhere.com" or "somewhere.com:portnumber" where
       the ":portnumber" is optional.   The length of this structure
       is arbitrarily limited to the overall max length of a domain
       name (255 chars), although a longer one can be use successfully
       if you use this as a template for doing so.   However, the domain name
       is still limited to 255 characters.
    }

    DNSAddressPtr = ^DNSAddress;
    DNSAddress = record
        fAddressType:           OTAddressType;                          {  always AF_DNS }
        fName:                  InetDomainName;
    end;

    {  InetInterfaceInfo }

const
    kDefaultInetInterface       = -1;

    kInetInterfaceInfoVersion   = 3;


type
    InetInterfaceInfoPtr = ^InetInterfaceInfo;
    InetInterfaceInfo = record
        fAddress:               InetHost;
        fNetmask:               InetHost;
        fBroadcastAddr:         InetHost;
        fDefaultGatewayAddr:    InetHost;
        fDNSAddr:               InetHost;
        fVersion:               UInt16;
        fHWAddrLen:             UInt16;
        fHWAddr:                Ptr;
        fIfMTU:                 UInt32;
        fReservedPtrs:          array [0..1] of Ptr;
        fDomainName:            InetDomainName;
        fIPSecondaryCount:      UInt32;
        fReserved:              packed array [0..251] of UInt8;
    end;

    {  InetDHCPOption }

const
    kAllDHCPOptions             = -1;
    kDHCPLongOption             = 126;
    kDHCPLongOptionReq          = 127;


type
    InetDHCPOptionPtr = ^InetDHCPOption;
    InetDHCPOption = record
        fOptionTag:             SInt8;
        fOptionLen:             SInt8;
        fOptionValue:           SInt8;
    end;

    {  TCP/IP Utility Routines }

    {
     *  OTInitInetAddress()
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
procedure OTInitInetAddress(var addr: InetAddress; port: InetPort; host: InetHost); external name '_OTInitInetAddress';

{
 *  OTInitDNSAddress()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTInitDNSAddress(var addr: DNSAddress; str: CStringPtr): OTByteCount; external name '_OTInitDNSAddress';

{
 *  OTInetStringToHost()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTInetStringToHost(str: ConstCStringPtr; var host: InetHost): OSStatus; external name '_OTInetStringToHost';

{
 *  OTInetHostToString()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure OTInetHostToString(host: InetHost; str: CStringPtr); external name '_OTInetHostToString';

{
 *  OTInetGetInterfaceInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTInetGetInterfaceInfo(var info: InetInterfaceInfo; val: SInt32): OSStatus; external name '_OTInetGetInterfaceInfo';

{
 *  OTInetGetSecondaryAddresses()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTInetGetSecondaryAddresses(var addr: InetHost; var count: UInt32; val: SInt32): OSStatus; external name '_OTInetGetSecondaryAddresses';


{
   Under Carbon, OTOpenInternetServices routines take a client context pointer.  Applications may pass NULL
   after calling InitOpenTransport(kInitOTForApplicationMask, ...).  Non-applications must always pass a
   valid client context.
}
{
 *  OTOpenInternetServicesInContext()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTOpenInternetServicesInContext(cfig: OTConfigurationRef; oflag: OTOpenFlags; var err: OSStatus; clientContext: OTClientContextPtr): InetSvcRef; external name '_OTOpenInternetServicesInContext';

{
 *  OTAsyncOpenInternetServicesInContext()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTAsyncOpenInternetServicesInContext(cfig: OTConfigurationRef; oflag: OTOpenFlags; upp: OTNotifyUPP; contextPtr: UnivPtr; clientContext: OTClientContextPtr): OSStatus; external name '_OTAsyncOpenInternetServicesInContext';

{  The following macro may be used by applications only. }
{
 *  OTInetStringToAddress()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTInetStringToAddress(ref: InetSvcRef; name: CStringPtr; var hinfo: InetHostInfo): OSStatus; external name '_OTInetStringToAddress';

{
 *  OTInetAddressToName()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTInetAddressToName(ref: InetSvcRef; addr: InetHost; var name: InetDomainName): OSStatus; external name '_OTInetAddressToName';

{
 *  OTInetSysInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTInetSysInfo(ref: InetSvcRef; name: CStringPtr; var sysinfo: InetSysInfo): OSStatus; external name '_OTInetSysInfo';

{
 *  OTInetMailExchange()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTInetMailExchange(ref: InetSvcRef; name: CStringPtr; var num: UInt16; mx: InetMailExchangePtr): OSStatus; external name '_OTInetMailExchange';

{
 *  OTInetQuery()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTInetQuery(ref: InetSvcRef; name: CStringPtr; qClass: UInt16; qType: UInt16; buf: CStringPtr; buflen: OTByteCount; var argv: UnivPtr; argvlen: OTByteCount; flags: OTFlags): OSStatus; external name '_OTInetQuery';


{  ***** AppleTalk ***** }
{  Shared library prefixes }

{******************************************************************************
** Module definitions
*******************************************************************************}
{  XTI Levels }


const
    ATK_DDP                     = $44445020 (* 'DDP ' *);
    ATK_AARP                    = $41415250 (* 'AARP' *);
    ATK_ATP                     = $41545020 (* 'ATP ' *);
    ATK_ADSP                    = $41445350 (* 'ADSP' *);
    ATK_ASP                     = $41535020 (* 'ASP ' *);
    ATK_PAP                     = $50415020 (* 'PAP ' *);
    ATK_NBP                     = $4E425020 (* 'NBP ' *);
    ATK_ZIP                     = $5A495020 (* 'ZIP ' *);

    {  Module Names }

    {
       Protocol-specific Options
       NOTE:
       All Protocols support OPT_CHECKSUM (Value is (unsigned long)T_YES/T_NO)
       ATP supports OPT_RETRYCNT (# Retries, 0 = try once) and
                    OPT_INTERVAL (# Milliseconds to wait)
    }

    DDP_OPT_CHECKSUM            = $0600;
    DDP_OPT_SRCADDR             = $2101;                        {  DDP UnitDataReq Only - set src address, Value is DDPAddress  }
    ATP_OPT_REPLYCNT            = $2110;                        {  AppleTalk - ATP Resp Pkt Ct Type, Value is (unsigned long)  pkt count  }
    ATP_OPT_DATALEN             = $2111;                        {  AppleTalk - ATP Pkt Data Len Type, Value is (unsigned long) length  }
    ATP_OPT_RELTIMER            = $2112;                        {  AppleTalk - ATP Release Timer Type, Value is (unsigned long) timer, (See Inside AppleTalk, second edition  }
    ATP_OPT_TRANID              = $2113;                        {  Value is (unsigned long) Boolean, Used to request Transaction ID, Returned with Transaction ID on requests  }
    PAP_OPT_OPENRETRY           = $2120;                        {  AppleTalk - PAP OpenConn Retry count, Value is (unsigned long) T_YES/T_NO  }

    {  Protocol-Specific Events }

    {
       If you send the IOCTL: OTIoctl(I_OTGetMiscellaneousEvents, 1),
       you will receive the T_ATALKxxx events on your endpoint.
       NOTE: The endpoint does not need to be bound.
    }

    kAppleTalkEvent             = $23010000;
    T_GETMYZONECOMPLETE         = $23010001;
    T_GETLOCALZONESCOMPLETE     = $23010002;
    T_GETZONELISTCOMPLETE       = $23010003;
    T_GETATALKINFOCOMPLETE      = $23010004;
    T_ATALKROUTERDOWNEVENT      = $23010033;                    {  No routers have been seen for a while.  If the cookie is NULL, all routers are gone.  Otherwise, there is still an ARA router hanging around being used, and only the local cable has been  timed out. }
    T_ATALKROUTERUPEVENT        = $23010034;                    {  We didn't have a router, but now one has come up. Cookie is NULL for a normal router coming up, non-NULL for an ARA router coming on-line }
    T_ATALKZONENAMECHANGEDEVENT = $23010035;                    {  A Zone name change was issued from the router, so our AppleTalk Zone has changed. }
    T_ATALKCONNECTIVITYCHANGEDEVENT = $23010036;                {  An ARA connection was established (cookie != NULL), or was disconnected (cookie == NULL) }
    T_ATALKINTERNETAVAILABLEEVENT = $23010037;                  {  A router has appeared, and our address is in the startup range.  Cookie is hi/lo of new cable range. }
    T_ATALKCABLERANGECHANGEDEVENT = $23010038;                  {  A router has appeared, and it's incompatible with our current address.  Cookie is hi/lo of new cable range. }

    kAllATalkRoutersDown        = 0;                            {  This indicates that all routers are offline }
    kLocalATalkRoutersDown      = -1;                           {  This indicates that all local routers went offline, but an ARA router is still active }
    kARARouterDisconnected      = -2;                           {  This indicates that ARA was disconnected, do it's router went offline, and we have no local routers to fall back onto. }

    kARARouterOnline            = -1;                           {  We had no local routers, but an ARA router is now online. }
    kATalkRouterOnline          = 0;                            {  We had no routers, but a local router is now online }
    kLocalATalkRouterOnline     = -2;                           {  We have an ARA router, but now we've seen a local router as well }

    {  Protocol-specific IOCTLs }

    ATALK_IOC_FULLSELFSEND      = $542F;                        {  Turn on/off full self-send (it's automatic for non-backward-compatible links) }
    ADSP_IOC_FORWARDRESET       = $543C;                        {  ADSP Forward Reset }

    {  Protocol-specific constants }

    {  ECHO }

    kECHO_TSDU                  = 585;                          {  Max. # of data bytes. }

    {  NBP }

    kNBPMaxNameLength           = 32;
    kNBPMaxTypeLength           = 32;
    kNBPMaxZoneLength           = 32;
    kNBPSlushLength             = 9;                            {  Extra space for @, : and a few escape chars }
    kNBPMaxEntityLength         = 99;
    kNBPEntityBufferSize        = 105;
    kNBPWildCard                = $3D;                          {  NBP name and type match anything '=' }
    kNBPImbeddedWildCard        = $C5;                          {  NBP name and type match some 'Å' }
    kNBPDefaultZone             = $2A;                          {  NBP default zone '*' }

    {  ZIP }

    kZIPMaxZoneLength           = 32;

    kDDPAddressLength           = 8;                            {  value to use in netbuf.len field, Maximum length of AppleTalk address }
    kNBPAddressLength           = 105;
    kAppleTalkAddressLength     = 113;

    {   ******************************************************************************
    ** CLASS TAppleTalkServices
    ******************************************************************************* }
    {
       Define the ATSvcRef type.  This type needs special
       processing because in C++ it's a subclass of TProvider.
       See the definition of TEndpointRef in "OpenTransport.h"
       for the logic behind this definition.
    }

type
    ATSvcRef    = ^SInt32; { an opaque 32-bit type }
    ATSvcRefPtr = ^ATSvcRef;  { when a var xx:ATSvcRef parameter can be nil, it is changed to xx: ATSvcRefPtr }

const
    kDefaultAppleTalkServicesPath = -3;

    {
       Under Carbon, OpenAppleTalkServices routines take a client context pointer.  Applications may pass NULL
       after calling InitOpenTransport(kInitOTForApplicationMask, ...).  Non-applications must always pass a
       valid client context.
    }
    {
     *  OTAsyncOpenAppleTalkServicesInContext()
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function OTAsyncOpenAppleTalkServicesInContext(cfig: OTConfigurationRef; flags: OTOpenFlags; proc: OTNotifyUPP; contextPtr: UnivPtr; clientContext: OTClientContextPtr): OSStatus; external name '_OTAsyncOpenAppleTalkServicesInContext';

{
 *  OTOpenAppleTalkServicesInContext()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTOpenAppleTalkServicesInContext(cfig: OTConfigurationRef; flags: OTOpenFlags; var err: OSStatus; clientContext: OTClientContextPtr): ATSvcRef; external name '_OTOpenAppleTalkServicesInContext';

{  The following macro may be used by applications only. }
{  Get the zone associated with the ATSvcRef }
{
 *  OTATalkGetMyZone()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTATalkGetMyZone(ref: ATSvcRef; var zone: TNetbuf): OSStatus; external name '_OTATalkGetMyZone';

{
   Get the list of available zones associated with the local cable
   of the ATSvcRef
}
{
 *  OTATalkGetLocalZones()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTATalkGetLocalZones(ref: ATSvcRef; var zones: TNetbuf): OSStatus; external name '_OTATalkGetLocalZones';

{  Get the list of all zones on the internet specified by the ATSvcRef }
{
 *  OTATalkGetZoneList()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTATalkGetZoneList(ref: ATSvcRef; var zones: TNetbuf): OSStatus; external name '_OTATalkGetZoneList';

{  Stores an AppleTalkInfo structure into the TNetbuf (see later in this file) }
{
 *  OTATalkGetInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTATalkGetInfo(ref: ATSvcRef; var info: TNetbuf): OSStatus; external name '_OTATalkGetInfo';


{  AppleTalk Addressing }
{
   The NBPEntity structure is used to manipulate NBP names without regard
   to issues of what kind of "special" characters are in the name.

   When stored as an address in an NBPAddress or DDPNBPAddress, they are
   stored as a character string, which is currently just ASCII, but in the
   future may be UniChar, or some other internationalizable scripting set.
   The string following an NBPAddress or DDPNBPAddress is intended to be
   suitable for showing to users, whereas NBPEntity is not.
   WARNING: NBPAddress and DDPNBPAddress structures do not "know" the length
   of the address.  That must have been obtained as part of a Lookup or
   ResolveAddress call.
}


const
    AF_ATALK_FAMILY             = $0100;
    AF_ATALK_DDP                = $0100;
    AF_ATALK_DDPNBP             = $0101;
    AF_ATALK_NBP                = $0102;
    AF_ATALK_MNODE              = $0103;


type
    NBPEntityPtr = ^NBPEntity;
    NBPEntity = record
        fEntity:                packed array [0..98] of UInt8;
    end;

    DDPAddressPtr = ^DDPAddress;
    DDPAddress = record
        fAddressType:           OTAddressType;                          {  One of the enums above }
        fNetwork:               UInt16;
        fNodeID:                SInt8;
        fSocket:                SInt8;
        fDDPType:               SInt8;
        fPad:                   SInt8;
    end;

    NBPAddressPtr = ^NBPAddress;
    NBPAddress = record
        fAddressType:           OTAddressType;                          {  One of the enums above }
        fNBPNameBuffer:         packed array [0..104] of UInt8;
    end;

    DDPNBPAddressPtr = ^DDPNBPAddress;
    DDPNBPAddress = record
        fAddressType:           OTAddressType;                          {  One of the enums above }
        fNetwork:               UInt16;
        fNodeID:                SInt8;
        fSocket:                SInt8;
        fDDPType:               SInt8;
        fPad:                   SInt8;
        fNBPNameBuffer:         packed array [0..104] of UInt8;
    end;

    {  These are some utility routines for dealing with NBP and DDP addresses.  }

    {  Functions to initialize the various AppleTalk Address types }
    {
     *  OTInitDDPAddress()
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
procedure OTInitDDPAddress(var addr: DDPAddress; net: UInt16; node: ByteParameter; socket: ByteParameter; ddpType: ByteParameter); external name '_OTInitDDPAddress';

{
 *  OTInitNBPAddress()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTInitNBPAddress(var addr: NBPAddress; name: ConstCStringPtr): OTByteCount; external name '_OTInitNBPAddress';

{
 *  OTInitDDPNBPAddress()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTInitDDPNBPAddress(var addr: DDPNBPAddress; name: ConstCStringPtr; net: UInt16; node: ByteParameter; socket: ByteParameter; ddpType: ByteParameter): OTByteCount; external name '_OTInitDDPNBPAddress';

{  Compare 2 DDP addresses for equality }
{
 *  OTCompareDDPAddresses()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTCompareDDPAddresses(const (*var*) addr1: DDPAddress; const (*var*) addr2: DDPAddress): boolean; external name '_OTCompareDDPAddresses';

{  Init an NBPEntity to a NULL name }
{
 *  OTInitNBPEntity()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure OTInitNBPEntity(var entity: NBPEntity); external name '_OTInitNBPEntity';

{  Get the length an NBPEntity would have when stored as an address }
{
 *  OTGetNBPEntityLengthAsAddress()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTGetNBPEntityLengthAsAddress(const (*var*) entity: NBPEntity): OTByteCount; external name '_OTGetNBPEntityLengthAsAddress';

{  Store an NBPEntity into an address buffer }
{
 *  OTSetAddressFromNBPEntity()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTSetAddressFromNBPEntity(nameBuf: UInt8Ptr; const (*var*) entity: NBPEntity): OTByteCount; external name '_OTSetAddressFromNBPEntity';

{  Create an address buffer from a string (use -1 for len to use strlen) }
{
 *  OTSetAddressFromNBPString()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTSetAddressFromNBPString(addrBuf: UInt8Ptr; name: ConstCStringPtr; len: SInt32): OTByteCount; external name '_OTSetAddressFromNBPString';

{
   Create an NBPEntity from an address buffer. False is returned if
     the address was truncated.
}
{
 *  OTSetNBPEntityFromAddress()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTSetNBPEntityFromAddress(var entity: NBPEntity; addrBuf: UInt8Ptr; len: OTByteCount): boolean; external name '_OTSetNBPEntityFromAddress';

{  Routines to set a piece of an NBP entity from a character string }
{
 *  OTSetNBPName()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTSetNBPName(var entity: NBPEntity; name: ConstCStringPtr): boolean; external name '_OTSetNBPName';

{
 *  OTSetNBPType()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTSetNBPType(var entity: NBPEntity; typeVal: ConstCStringPtr): boolean; external name '_OTSetNBPType';

{
 *  OTSetNBPZone()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTSetNBPZone(var entity: NBPEntity; zone: ConstCStringPtr): boolean; external name '_OTSetNBPZone';

{  Routines to extract pieces of an NBP entity }
{
 *  OTExtractNBPName()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure OTExtractNBPName(const (*var*) entity: NBPEntity; name: CStringPtr); external name '_OTExtractNBPName';

{
 *  OTExtractNBPType()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure OTExtractNBPType(const (*var*) entity: NBPEntity; typeVal: CStringPtr); external name '_OTExtractNBPType';

{
 *  OTExtractNBPZone()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure OTExtractNBPZone(const (*var*) entity: NBPEntity; zone: CStringPtr); external name '_OTExtractNBPZone';

{  AppleTalkInfo as used by the OTGetATalkInfo function }


type
    AppleTalkInfoPtr = ^AppleTalkInfo;
    AppleTalkInfo = record
        fOurAddress:            DDPAddress;                             {  Our DDP address (network # & node) }
        fRouterAddress:         DDPAddress;                             {  The address of a router on our cable }
        fCableRange:            array [0..1] of UInt16;                 {  The current cable range }
        fFlags:                 UInt16;                                 {  See below }
    end;

    {  For the fFlags field in AppleTalkInfo }

const
    kATalkInfoIsExtended        = $0001;                        {  This is an extended (phase 2) network }
    kATalkInfoHasRouter         = $0002;                        {  This cable has a router }
    kATalkInfoOneZone           = $0004;                        {  This cable has only one zone }

    {  ***** Ethernet ***** }

    {  Interface option flags }

    {  Ethernet framing options }

    kOTFramingEthernet          = $01;
    kOTFramingEthernetIPX       = $02;
    kOTFraming8023              = $04;
    kOTFraming8022              = $08;

    {
       These are obsolete and will be going away in OT 1.5.
       Hmmm, OT 1.5 got cancelled.  The status of these options
       is uncertain.
    }

    {  RawMode options }

    kOTRawRcvOn                 = 0;
    kOTRawRcvOff                = 1;
    kOTRawRcvOnWithTimeStamp    = 2;

    DL_PROMISC_OFF              = 0;                            {  OPT_SETPROMISCUOUS value }

    {  Module definitions }

    {  Module IDs }

    kT8022ModuleID              = 7100;
    kEnetModuleID               = 7101;
    kTokenRingModuleID          = 7102;
    kFDDIModuleID               = 7103;

    {  Module Names }

    {  Address Family }

    AF_8022                     = 8200;                         {  Our 802.2 generic address family }

    {  XTI Levels }

    LNK_ENET                    = $454E4554 (* 'ENET' *);
    LNK_TOKN                    = $544F4B4E (* 'TOKN' *);
    LNK_FDDI                    = $46444449 (* 'FDDI' *);
    LNK_TPI                     = $4C545049 (* 'LTPI' *);

    {  Options }

    OPT_ADDMCAST                = $1000;
    OPT_DELMCAST                = $1001;
    OPT_RCVPACKETTYPE           = $1002;
    OPT_RCVDESTADDR             = $1003;
    OPT_SETRAWMODE              = $1004;
    OPT_SETPROMISCUOUS          = $1005;


type
    OTPacketType                = UInt32;
const
    kETypeStandard              = 0;
    kETypeMulticast             = 1;
    kETypeBroadcast             = 2;
    kETRawPacketBit             = $80000000;
    kETTimeStampBit             = $40000000;

    {  Link related constants }

    kMulticastLength            = 6;                            {  length of an ENET hardware addressaddress }
    k48BitAddrLength            = 6;
    k8022DLSAPLength            = 2;                            {  The protocol type is our DLSAP }
    k8022SNAPLength             = 5;
    kEnetAddressLength          = 8;                            {  length of an address field used by the ENET enpoint }
                                                                {     = k48BitAddrLength + sizeof(protocol type) }
    kSNAPSAP                    = $00AA;                        {  Special DLSAPS for ENET }
    kIPXSAP                     = $00FF;
    kMax8022SAP                 = $00FE;
    k8022GlobalSAP              = $00FF;
    kMinDIXSAP                  = 1501;
    kMaxDIXSAP                  = $FFFF;

    {  Generic Address Structure }


type
    T8022AddressPtr = ^T8022Address;
    T8022Address = record
        fAddrFamily:            OTAddressType;
        fHWAddr:                packed array [0..5] of UInt8;
        fSAP:                   UInt16;
        fSNAP:                  packed array [0..4] of UInt8;
    end;


const
    k8022BasicAddressLength     = 10;
    k8022SNAPAddressLength      = 15;

    {  Some helpful stuff for dealing with 48 bit addresses }

    {  Link related constants }

    kEnetPacketHeaderLength     = 14;
    kEnetTSDU                   = 1514;                         {  The TSDU for ethernet. }
    kTokenRingTSDU              = 4458;                         {  The TSDU for TokenRing. }
    kFDDITSDU                   = 4458;                         {  The TSDU for FDDI.  }
    k8022SAPLength              = 1;
    k8022BasicHeaderLength      = 3;                            {  define the length of the header portion of an 802.2 packet. }
                                                                {  = SSAP+DSAP+ControlByte }
    k8022SNAPHeaderLength       = 8;

    {   ******************************************************************************
    ** Address Types recognized by the Enet DLPI
    ******************************************************************************* }

type
    EAddrType                   = UInt32;
const
    keaStandardAddress          = 0;
    keaMulticast                = 1;
    keaBroadcast                = 2;
    keaBadAddress               = 3;
    keaRawPacketBit             = $80000000;
    keaTimeStampBit             = $40000000;

    {  Packet Header Structures }


type
    EnetPacketHeaderPtr = ^EnetPacketHeader;
    EnetPacketHeader = record
        fDestAddr:              packed array [0..5] of UInt8;
        fSourceAddr:            packed array [0..5] of UInt8;
        fProto:                 UInt16;
    end;

    T8022HeaderPtr = ^T8022Header;
    T8022Header = record
        fDSAP:                  SInt8;
        fSSAP:                  SInt8;
        fCtrl:                  SInt8;
    end;

    T8022SNAPHeaderPtr = ^T8022SNAPHeader;
    T8022SNAPHeader = record
        fDSAP:                  SInt8;
        fSSAP:                  SInt8;
        fCtrl:                  SInt8;
        fSNAP:                  packed array [0..4] of UInt8;
    end;

    T8022FullPacketHeaderPtr = ^T8022FullPacketHeader;
    T8022FullPacketHeader = record
        fEnetPart:              EnetPacketHeader;
        f8022Part:              T8022SNAPHeader;
    end;

    {  Define the lengths of the structures above }

const
    kT8022HeaderLength          = 3;
    kT8022SNAPHeaderLength      = 8;
    kT8022FullPacketHeaderLength = 22;

    {  ***** Serial ***** }

    {  Module Definitions }

    {  XTI Level }

    COM_SERIAL                  = $5345524C (* 'SERL' *);

    {  Version Number }

    {  Module Names }

    kSerialABModuleID           = 7200;

    kOTSerialFramingAsync       = $01;                          {  Support Async serial mode          }
    kOTSerialFramingHDLC        = $02;                          {  Support HDLC synchronous serial mode    }
    kOTSerialFramingSDLC        = $04;                          {  Support SDLC synchronous serial mode    }
    kOTSerialFramingAsyncPackets = $08;                         {  Support Async "packet" serial mode  }
    kOTSerialFramingPPP         = $10;                          {  Port does its own PPP framing - wants unframed packets from PPP  }

    {  IOCTL Calls for Serial Drivers }

    I_SetSerialDTR              = $5500;                        {  Set DTR (0 = off, 1 = on) }
    kOTSerialSetDTROff          = 0;
    kOTSerialSetDTROn           = 1;
    I_SetSerialBreak            = $5501;                        {  Send a break on the line - kOTSerialSetBreakOff = off, kOTSerialSetBreakOn = on, }
                                                                {  Any other number is the number of milliseconds to leave break on, then }
                                                                {  auto shutoff }
    kOTSerialSetBreakOn         = $FFFFFFFF;
    kOTSerialSetBreakOff        = 0;
    I_SetSerialXOffState        = $5502;                        {  Force XOFF state - 0 = Unconditionally clear XOFF state, 1 = unconditionally set it }
    kOTSerialForceXOffTrue      = 1;
    kOTSerialForceXOffFalse     = 0;
    I_SetSerialXOn              = $5503;                        {  Send an XON character, 0 = send only if in XOFF state, 1 = send always }
    kOTSerialSendXOnAlways      = 1;
    kOTSerialSendXOnIfXOffTrue  = 0;
    I_SetSerialXOff             = $5504;                        {  Send an XOFF character, 0 = send only if in XON state, 1 = send always }
    kOTSerialSendXOffAlways     = 1;
    kOTSerialSendXOffIfXOnTrue  = 0;

    {  Option Management for Serial Drivers }

    {
       These options are all 4-byte values.
       BaudRate is the baud rate.
       DataBits is the number of data bits.
       StopBits is the number of stop bits times 10.
       Parity is an enum
    }

    SERIAL_OPT_BAUDRATE         = $0100;                        {  UInt32  }
    SERIAL_OPT_DATABITS         = $0101;                        {  UInt32  }
    SERIAL_OPT_STOPBITS         = $0102;                        {  UInt32 10, 15 or 20 for 1, 1.5 or 2     }
    SERIAL_OPT_PARITY           = $0103;                        {  UInt32  }
    SERIAL_OPT_STATUS           = $0104;                        {  UInt32  }
                                                                {  The "Status" option is a 4-byte value option that is ReadOnly }
                                                                {  It returns a bitmap of the current serial status }
    SERIAL_OPT_HANDSHAKE        = $0105;                        {  UInt32  }
                                                                {  The "Handshake" option defines what kind of handshaking the serial port }
                                                                {  will do for line flow control.  The value is a 32-bit value defined by }
                                                                {  the function or macro SerialHandshakeData below. }
                                                                {  For no handshake, or CTS handshake, the onChar and offChar parameters }
                                                                {  are ignored. }
    SERIAL_OPT_RCVTIMEOUT       = $0106;                        {  The "RcvTimeout" option defines how long the receiver should wait before delivering }
                                                                {  less than the RcvLoWat number of characters.  If RcvLoWat is 0, then the RcvTimeout }
                                                                {  is how long a gap to wait for before delivering characters.  This parameter is advisory, }
                                                                {  and serial drivers are free to deliver data whenever they deem it convenient.  For instance, }
                                                                {  many serial drivers will deliver data whenever 64 bytes have been received, since 64 bytes }
                                                                {  is the smallest STREAMS buffer size. Keep in mind that timeouts are quantized, so be sure to }
                                                                {  look at the return value of the option to determine what it was negotiated to. }
    SERIAL_OPT_ERRORCHARACTER   = $0107;                        {  This option defines how characters with parity errors are handled. }
                                                                {  A 0 value will disable all replacement.  A single character value in the low }
                                                                {  byte designates the replacement character.  When characters are received with a  }
                                                                {  parity error, they are replaced by this specified character.  If a valid incoming }
                                                                {  character matches the replacement character, then the received character's msb is }
                                                                {  cleared. For this situation, the alternate character is used, if specified in bits }
                                                                {  8 through 15 of the option long, with 0xff being place in bits 16 through 23. }
                                                                {  Whenever a valid character is received that matches the first replacement character, }
                                                                {  it is replaced with this alternate character. }
    SERIAL_OPT_EXTCLOCK         = $0108;                        {  The "ExtClock" requests an external clock.  A 0-value turns off external clocking. }
                                                                {  Any other value is a requested divisor for the external clock.  Be aware that }
                                                                {  not all serial implementations support an external clock, and that not all }
                                                                {  requested divisors will be supported if it does support an external clock. }
    SERIAL_OPT_BURSTMODE        = $0109;                        {  The "BurstMode" option informs the serial driver that it should continue looping, }
                                                                {  reading incoming characters, rather than waiting for an interrupt for each character. }
                                                                {  This option may not be supported by all Serial driver }
    SERIAL_OPT_DUMMY            = $010A;                        {  placeholder }


type
    ParityOptionValues          = UInt32;
const
    kOTSerialNoParity           = 0;
    kOTSerialOddParity          = 1;
    kOTSerialEvenParity         = 2;

    kOTSerialSwOverRunErr       = $01;
    kOTSerialBreakOn            = $08;
    kOTSerialParityErr          = $10;
    kOTSerialOverrunErr         = $20;
    kOTSerialFramingErr         = $40;
    kOTSerialXOffSent           = $00010000;
    kOTSerialDTRNegated         = $00020000;
    kOTSerialCTLHold            = $00040000;
    kOTSerialXOffHold           = $00080000;
    kOTSerialOutputBreakOn      = $01000000;

    kOTSerialXOnOffInputHandshake = 1;                          {  Want XOn/XOff handshake for incoming characters     }
    kOTSerialXOnOffOutputHandshake = 2;                         {  Want XOn/XOff handshake for outgoing characters     }
    kOTSerialCTSInputHandshake  = 4;                            {  Want CTS handshake for incoming characters      }
    kOTSerialDTROutputHandshake = 8;                            {  Want DTR handshake for outoing characters    }

    {  Default attributes for the serial ports }

    kOTSerialDefaultBaudRate    = 19200;
    kOTSerialDefaultDataBits    = 8;
    kOTSerialDefaultStopBits    = 10;
    kOTSerialDefaultParity      = 0;
    kOTSerialDefaultHandshake   = 0;
    kOTSerialDefaultOnChar      = 17;
    kOTSerialDefaultOffChar     = 19;
    kOTSerialDefaultSndBufSize  = 1024;
    kOTSerialDefaultRcvBufSize  = 1024;
    kOTSerialDefaultSndLoWat    = 96;
    kOTSerialDefaultRcvLoWat    = 1;
    kOTSerialDefaultRcvTimeout  = 10;

    {  ***** ISDN ***** }

    {  Module Definitions }

    {  XTI Level }

    COM_ISDN                    = $4953444E (* 'ISDN' *);

    {  Module Names }

    kISDNModuleID               = 7300;


    {  ISDN framing methods, set using the I_OTSetFramingType IOCTL }

    kOTISDNFramingTransparentSupported = $0010;                 {  Support Transparent mode     }
    kOTISDNFramingHDLCSupported = $0020;                        {  Support HDLC Synchronous mode   }
    kOTISDNFramingV110Supported = $0040;                        {  Support V.110 Asynchronous mode     }
    kOTISDNFramingV14ESupported = $0080;                        {  Support V.14 Asynchronous mode      }

    {  Miscellaneous equates }

    {  Disconnect reason codes (from Q.931) }

    kOTISDNUnallocatedNumber    = 1;
    kOTISDNNoRouteToSpecifiedTransitNetwork = 2;
    kOTISDNNoRouteToDestination = 3;
    kOTISDNChannelUnacceptable  = 6;
    kOTISDNNormal               = 16;
    kOTISDNUserBusy             = 17;
    kOTISDNNoUserResponding     = 18;
    kOTISDNNoAnswerFromUser     = 19;
    kOTISDNCallRejected         = 21;
    kOTISDNNumberChanged        = 22;
    kOTISDNNonSelectedUserClearing = 26;
    kOTISDNDestinationOutOfOrder = 27;
    kOTISDNInvalidNumberFormat  = 28;
    kOTISDNFacilityRejected     = 29;
    kOTISDNNormalUnspecified    = 31;
    kOTISDNNoCircuitChannelAvailable = 34;
    kOTISDNNetworkOutOfOrder    = 41;
    kOTISDNSwitchingEquipmentCongestion = 42;
    kOTISDNAccessInformationDiscarded = 43;
    kOTISDNRequestedCircuitChannelNotAvailable = 44;
    kOTISDNResourceUnavailableUnspecified = 45;
    kOTISDNQualityOfServiceUnvailable = 49;
    kOTISDNRequestedFacilityNotSubscribed = 50;
    kOTISDNBearerCapabilityNotAuthorized = 57;
    kOTISDNBearerCapabilityNotPresentlyAvailable = 58;
    kOTISDNCallRestricted       = 59;
    kOTISDNServiceOrOptionNotAvilableUnspecified = 63;
    kOTISDNBearerCapabilityNotImplemented = 65;
    kOTISDNRequestedFacilityNotImplemented = 69;
    kOTISDNOnlyRestrictedDigitalBearer = 70;
    kOTISDNServiceOrOptionNotImplementedUnspecified = 79;
    kOTISDNCallIdentityNotUsed  = 83;
    kOTISDNCallIdentityInUse    = 84;
    kOTISDNNoCallSuspended      = 85;
    kOTISDNCallIdentityCleared  = 86;
    kOTISDNIncompatibleDestination = 88;
    kOTISDNInvalidTransitNetworkSelection = 91;
    kOTISDNInvalidMessageUnspecified = 95;
    kOTISDNMandatoryInformationElementIsMissing = 96;
    kOTISDNMessageTypeNonExistentOrNotImplemented = 97;
    kOTISDNInterworkingUnspecified = 127;

    {  OTISDNAddress }

    {
       The OTISDNAddress has the following format:
       "xxxxxx*yy"
       where 'x' is the phone number and 'y' is the sub address (if available
       in the network. The characters are coded in ASCII (IA5), and valid
       characters are: '0'-'9','#','*'.
       The max length of the each phone number is 21 characters (?) and the max
       subaddress length is network dependent.
       When using bonded channels the phone numbers are separated by '&'.
       The X.25 user data is preceded by '@'.
    }

    kAF_ISDN                    = $2000;

    AF_ISDN                     = $2000;

    kOTISDNMaxPhoneSize         = 32;
    kOTISDNMaxSubSize           = 4;


type
    OTISDNAddressPtr = ^OTISDNAddress;
    OTISDNAddress = record
        fAddressType:           OTAddressType;
        fPhoneLength:           UInt16;
        fPhoneNumber:           packed array [0..36] of char;
    end;

    {  IOCTL Calls for ISDN }
    {  ISDN shares the same ioctl space as serial. }


const
    MIOC_ISDN                   = 85;                           {  ISDN ioctl() cmds  }

    I_OTISDNAlerting            = $5564;                        {  Send or receive an ALERTING message }
    I_OTISDNSuspend             = $5565;                        {  Send a SUSPEND message }
                                                                {  The parameter is the Call Identity (Maximum 8 octets) }
    I_OTISDNSuspendAcknowledge  = $5566;                        {  Receive a SUSPEND ACKNOWLEDGE message }
    I_OTISDNSuspendReject       = $5567;                        {  Receive a SUSPEND REJECT message }
    I_OTISDNResume              = $5568;                        {  Send a RESUME message }
                                                                {  The parameter is the Call Identity (Maximum 8 octets) }
    I_OTISDNResumeAcknowledge   = $5569;                        {  Receive a RESUME ACKNOWLEDGE message }
    I_OTISDNResumeReject        = $556A;                        {  Receive a RESUME REJECT message }
    I_OTISDNFaciltity           = $556B;                        {  Send or receive a FACILITY message }

    {  Connect user data size }

    kOTISDNMaxUserDataSize      = 32;

    {  Option management calls for ISDN }

    ISDN_OPT_COMMTYPE           = $0200;
    ISDN_OPT_FRAMINGTYPE        = $0201;
    ISDN_OPT_56KADAPTATION      = $0202;

    {  For ISDN_OPT_COMMTYPE... }

    kOTISDNTelephoneALaw        = 1;                            {  G.711 A-law                 }
    kOTISDNTelephoneMuLaw       = 26;                           {  G.711 µ-law                 }
    kOTISDNDigital64k           = 13;                           {  unrestricted digital (default)      }
    kOTISDNDigital56k           = 37;                           {  user rate 56Kb/s            }
    kOTISDNVideo64k             = 41;                           {  video terminal at 64Kb/s     }
    kOTISDNVideo56k             = 42;                           {  video terminal at 56Kb/s     }

    {  For ISDN_OPT_FRAMINGTYPE... }

    kOTISDNFramingTransparent   = $0010;                        {  Transparent mode            }
    kOTISDNFramingHDLC          = $0020;                        {  HDLC synchronous mode (default)     }
    kOTISDNFramingV110          = $0040;                        {  V.110 asynchronous mode        }
    kOTISDNFramingV14E          = $0080;                        {  V.14E asynchronous mode          }

    {  For ISDN_OPT_56KADAPTATION... }

    kOTISDNNot56KAdaptation     = false;                        {  not 56K Adaptation (default)      }
    kOTISDN56KAdaptation        = true;                         {  56K Adaptation            }

    {  Default options, you do not need to set these }

    kOTISDNDefaultCommType      = 13;
    kOTISDNDefaultFramingType   = $0020;
    kOTISDNDefault56KAdaptation = 0;


    {   ******************************************************************************
    *   Constants for Open Transport-based Remote Access/PPP API
    ******************************************************************************* }

    {  OTCreateConfiguration name for PPP control endpoint }


    {  XTI Level }

    COM_PPP                     = $50505043 (* 'PPPC' *);

    {  Options limits }

    kPPPMaxIDLength             = 255;
    kPPPMaxPasswordLength       = 255;
    kPPPMaxDTEAddressLength     = 127;
    kPPPMaxCallInfoLength       = 255;


    {  Various XTI option value constants }

    kPPPStateInitial            = 1;
    kPPPStateClosed             = 2;
    kPPPStateClosing            = 3;
    kPPPStateOpening            = 4;
    kPPPStateOpened             = 5;

    kPPPConnectionStatusIdle    = 1;
    kPPPConnectionStatusConnecting = 2;
    kPPPConnectionStatusConnected = 3;
    kPPPConnectionStatusDisconnecting = 4;

    kPPPMinMRU                  = 0;
    kPPPMaxMRU                  = 4500;

    kIPCPTCPHdrCompressionDisabled = 0;
    kIPCPTCPHdrCompressionEnabled = 1;

    kPPPCompressionDisabled     = $00000000;
    kPPPProtoCompression        = $00000001;
    kPPPAddrCompression         = $00000002;

    kPPPNoOutAuthentication     = 0;
    kPPPCHAPOrPAPOutAuthentication = 1;

    kCCReminderTimerDisabled    = 0;
    kCCIPIdleTimerDisabled      = 0;

    kPPPScriptTypeModem         = 1;
    kPPPScriptTypeConnect       = 2;
    kPPPMaxScriptSize           = 32000;

    kE164Address                = 1;
    kPhoneAddress               = 1;
    kCompoundPhoneAddress       = 2;
    kX121Address                = 3;

    kPPPConnectionStatusDialogsFlag = $00000001;
    kPPPConnectionRemindersFlag = $00000002;
    kPPPConnectionFlashingIconFlag = $00000004;
    kPPPOutPasswordDialogsFlag  = $00000008;
    kPPPAllAlertsDisabledFlag   = $00000000;
    kPPPAllAlertsEnabledFlag    = $0000000F;

    kPPPAsyncMapCharsNone       = $00000000;
    kPPPAsyncMapCharsXOnXOff    = $000A0000;
    kPPPAsyncMapCharsAll        = $FFFFFFFF;


    {  Option names }

    IPCP_OPT_GETREMOTEPROTOADDR = $00007000;
    IPCP_OPT_GETLOCALPROTOADDR  = $00007001;
    IPCP_OPT_TCPHDRCOMPRESSION  = $00007002;
    LCP_OPT_PPPCOMPRESSION      = $00007003;
    LCP_OPT_MRU                 = $00007004;
    LCP_OPT_RCACCMAP            = $00007005;
    LCP_OPT_TXACCMAP            = $00007006;
    SEC_OPT_OUTAUTHENTICATION   = $00007007;
    SEC_OPT_ID                  = $00007008;
    SEC_OPT_PASSWORD            = $00007009;
    CC_OPT_REMINDERTIMER        = $00007010;
    CC_OPT_IPIDLETIMER          = $00007011;
    CC_OPT_DTEADDRESSTYPE       = $00007012;
    CC_OPT_DTEADDRESS           = $00007013;
    CC_OPT_CALLINFO             = $00007014;
    CC_OPT_GETMISCINFO          = $00007015;
    PPP_OPT_GETCURRENTSTATE     = $00007016;
    LCP_OPT_ECHO                = $00007017;                    {  Available on Mac OS X only  }
    CC_OPT_SERIALPORTNAME       = $00007200;

    {  Endpoint events }

    kPPPEvent                   = $230F0000;
    kPPPConnectCompleteEvent    = $230F0001;
    kPPPSetScriptCompleteEvent  = $230F0002;
    kPPPDisconnectCompleteEvent = $230F0003;
    kPPPDisconnectEvent         = $230F0004;
    kPPPIPCPUpEvent             = $230F0005;
    kPPPIPCPDownEvent           = $230F0006;
    kPPPLCPUpEvent              = $230F0007;
    kPPPLCPDownEvent            = $230F0008;
    kPPPLowerLayerUpEvent       = $230F0009;
    kPPPLowerLayerDownEvent     = $230F000A;
    kPPPAuthenticationStartedEvent = $230F000B;
    kPPPAuthenticationFinishedEvent = $230F000C;
    kPPPDCEInitStartedEvent     = $230F000D;
    kPPPDCEInitFinishedEvent    = $230F000E;
    kPPPDCECallStartedEvent     = $230F000F;
    kPPPDCECallFinishedEvent    = $230F0010;



    {   ******************************************************************************
    *   IOCTL constants for I_OTConnect, I_OTDisconnect and I_OTScript
    *   are defined in OpenTransport.h
    ******************************************************************************* }

    {   ******************************************************************************
    *   PPPMRULimits
    ******************************************************************************* }

type
    PPPMRULimitsPtr = ^PPPMRULimits;
    PPPMRULimits = record
        mruSize:                UInt32;                                 {  proposed or actual }
        upperMRULimit:          UInt32;
        lowerMRULimit:          UInt32;
    end;


    {   ******************************************************************************
    *   CCMiscInfo
    ******************************************************************************* }
    CCMiscInfoPtr = ^CCMiscInfo;
    CCMiscInfo = record
        connectionStatus:       UInt32;
        connectionTimeElapsed:  UInt32;
        connectionTimeRemaining: UInt32;
        bytesTransmitted:       UInt32;
        bytesReceived:          UInt32;
        reserved:               UInt32;
    end;


    {   ******************************************************************************
    *   LCPEcho
    ******************************************************************************* }
    {  Set both fields to zero to disable sending of LCP echo requests }

    LCPEchoPtr = ^LCPEcho;
    LCPEcho = record
        retryCount:             UInt32;
        retryPeriod:            UInt32;                                 {  in milliseconds }
    end;


    {   ******************************************************************************
    *   Bits used to tell kind of product
    ******************************************************************************* }

const
    kRAProductClientOnly        = 2;
    kRAProductOnePortServer     = 3;
    kRAProductManyPortServer    = 4;



{$ALIGN MAC68K}
{#POP}
{unit Power}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}


const
                                                                {  Bit positions for ModemByte  }
    modemOnBit                  = 0;
    ringWakeUpBit               = 2;
    modemInstalledBit           = 3;
    ringDetectBit               = 4;
    modemOnHookBit              = 5;

                                                                {  masks for ModemByte  }
    modemOnMask                 = $01;
    ringWakeUpMask              = $04;
    modemInstalledMask          = $08;
    ringDetectMask              = $10;
    modemOnHookMask             = $20;

                                                                {  bit positions for BatteryByte  }
    chargerConnBit              = 0;
    hiChargeBit                 = 1;
    chargeOverFlowBit           = 2;
    batteryDeadBit              = 3;
    batteryLowBit               = 4;
    connChangedBit              = 5;

                                                                {  masks for BatteryByte  }
    chargerConnMask             = $01;
    hiChargeMask                = $02;
    chargeOverFlowMask          = $04;
    batteryDeadMask             = $08;
    batteryLowMask              = $10;
    connChangedMask             = $20;

                                                                {  bit positions for SoundMixerByte  }
    MediaBaySndEnBit            = 0;
    PCISndEnBit                 = 1;
    ZVSndEnBit                  = 2;
    PCCardSndEnBit              = 3;

                                                                {  masks for SoundMixerByte  }
    MediaBaySndEnMask           = $01;
    PCISndEnMask                = $02;
    ZVSndEnMask                 = $04;
    PCCardSndEnMask             = $08;

                                                                {  commands to SleepQRec sleepQProc  }
    kSleepRequest               = 1;
    kSleepDemand                = 2;
    kSleepWakeUp                = 3;
    kSleepRevoke                = 4;
    kSleepUnlock                = 4;
    kSleepDeny                  = 5;                            {  A non-zero value clients can use to deny requests }
    kSleepNow                   = 6;
    kDozeDemand                 = 7;
    kDozeWakeUp                 = 8;
    kDozeRequest                = 9;                            {  additional messages for Power Mgr 2.0 }
    kEnterStandby               = 10;                           {  Idle Queue Only }
    kEnterRun                   = 11;                           {  Idle Queue Only }
    kSuspendRequest             = 12;
    kSuspendDemand              = 13;
    kSuspendRevoke              = 14;
    kSuspendWakeUp              = 15;
    kGetPowerLevel              = 16;
    kSetPowerLevel              = 17;
    kDeviceInitiatedWake        = 18;
    kWakeToDoze                 = 19;
    kDozeToFullWakeUp           = 20;
    kGetPowerInfo               = 21;
    kGetWakeOnNetInfo           = 22;
    kSuspendWakeToDoze          = 23;
    kEnterIdle                  = 24;                           {  Idle Queue Only }
    kStillIdle                  = 25;                           {  Idle Queue Only }
    kExitIdle                   = 26;                           {  Idle Queue Only }

                                                                {  depreciated commands to SleepQRec sleepQProc  }
    sleepRequest                = 1;
    sleepDemand                 = 2;
    sleepWakeUp                 = 3;
    sleepRevoke                 = 4;
    sleepUnlock                 = 4;
    sleepDeny                   = 5;
    sleepNow                    = 6;
    dozeDemand                  = 7;
    dozeWakeUp                  = 8;
    dozeRequest                 = 9;
    enterStandby                = 10;
    enterRun                    = 11;
    suspendRequestMsg           = 12;
    suspendDemandMsg            = 13;
    suspendRevokeMsg            = 14;
    suspendWakeUpMsg            = 15;
    getPowerLevel               = 16;
    setPowerLevel               = 17;

    {    Power Handler func messages    }

type
    PowerLevel                          = UInt32;
    {    Power levels corresponding to PCI Bus Power Management Interface Spec (PMIS)   }

const
    kPMDevicePowerLevel_On      = 0;                            {  fully-powered 'On' state (D0 state)     }
    kPMDevicePowerLevel_D1      = 1;                            {  not used by Apple system SW          }
    kPMDevicePowerLevel_D2      = 2;                            {  not used by Apple system SW          }
    kPMDevicePowerLevel_Off     = 3;                            {  main PCI bus power 'Off', but PCI standby power available (D3cold state)  }

    {    PowerHandlerProc definition    }

type
    PowerHandlerProcPtr = function(message: UInt32; param: UnivPtr; refCon: UInt32; var regEntryID: RegEntryID): OSStatus;

    PowerHandlerUPP = ^SInt32; { an opaque UPP }

const
    uppPowerHandlerProcInfo = $00003FF0;

{
   Use kIdleQueueDeviceType as the deviceType argument to AddDevicePowerHandler() to get the
   handler into the idle queue instead of the device sleep queue.
}
{  PCI power management support }


const
    kUseDefaultMinimumWakeTime  = 0;                            {  Defaults to 5 minutes }
    kPowerSummaryVersion        = 1;                            {  Version of PowerSummary structure. }
    kDevicePowerInfoVersion     = 1;                            {  Version of DevicePowerInfo structure. }

                                                                {  PowerSummary flags }
    kPCIPowerOffAllowed         = $00000001;                    {  PCI power off is allowed. }

                                                                {  DevicePowerInfo flags }
    kDevicePCIPowerOffAllowed   = $00000001;                    {  PCI power off is allowed for device. }
    kDeviceSupportsPMIS         = $00000002;                    {  Device supports Power Mgt Interface Spec. }
    kDeviceCanAssertPMEDuringSleep = $00000004;                 {  Device can assert PME# during sleep. }
    kDeviceUsesCommonLogicPower = $00000008;                    {  Device uses common-logic power }
    kDeviceDriverPresent        = $00000010;                    {  Driver present for device. }
    kDeviceDriverSupportsPowerMgt = $00000020;                  {  Driver installed a power handler. }


type
    DevicePowerInfoPtr = ^DevicePowerInfo;
    DevicePowerInfo = record
        version:                UInt32;                                 {  Version of this structure. }
        regID:                  RegEntryID;                             {  RegEntryID for device. }
        flags:                  OptionBits;                             {  Flags }
        minimumWakeTime:        UInt32;                                 {  Minimum seconds before sleeping again. }
        sleepPowerNeeded:       UInt32;                                 {  Milliwatts needed in the sleep state. }
    end;

    PowerSummaryPtr = ^PowerSummary;
    PowerSummary = record
        version:                UInt32;                                 {  Version of this structure. }
        flags:                  OptionBits;                             {  Flags }
        sleepPowerAvailable:    UInt32;                                 {  Milliwatts available during sleep. }
        sleepPowerNeeded:       UInt32;                                 {  Milliwatts needed during sleep. }
        minimumWakeTime:        UInt32;                                 {  Minimum seconds before sleeping again. }
        deviceCount:            ItemCount;                              {  Number of device power info records. }
        devices:                array [0..0] of DevicePowerInfo;        {  Array of device power info records. }
    end;


const
                                                                {  SleepQRec.sleepQFlags  }
    noCalls                     = 1;
    noRequest                   = 2;
    slpQType                    = 16;
    sleepQType                  = 16;

    {    Power Mgt Apple Event types and errors     }
                                                                {  power mgt class }
    kAEMacPowerMgtEvt           = $706D6774 (* 'pmgt' *);                       {  event ids }
    kAEMacToWake                = $77616B65 (* 'wake' *);
    kAEMacLowPowerSaveData      = $706D7364 (* 'pmsd' *);
    kAEMacEmergencySleep        = $656D736C (* 'emsl' *);
    kAEMacEmergencyShutdown     = $656D7364 (* 'emsd' *);


    {
       These are result values returned by a Power Handler when queries
       by the Power Mgr if the device which that Power Handler represents
       woke the machine.
    }
    kDeviceDidNotWakeMachine    = 0;                            {  device did NOT wake machine }
    kDeviceRequestsFullWake     = 1;                            {  device did wake machine and requests full wakeup }
    kDeviceRequestsWakeToDoze   = 2;                            {  device did wake machine and requests partial wakeup }

    {    bits in bitfield returned by PMFeatures    }
    hasWakeupTimer              = 0;                            {  1=wakeup timer is supported                     }
    hasSharedModemPort          = 1;                            {  1=modem port shared by SCC and internal modem        }
    hasProcessorCycling         = 2;                            {  1=processor cycling is supported                 }
    mustProcessorCycle          = 3;                            {  1=processor cycling should not be turned off           }
    hasReducedSpeed             = 4;                            {  1=processor can be started up at reduced speed         }
    dynamicSpeedChange          = 5;                            {  1=processor speed can be switched dynamically        }
    hasSCSIDiskMode             = 6;                            {  1=SCSI Disk Mode is supported                  }
    canGetBatteryTime           = 7;                            {  1=battery time can be calculated                 }
    canWakeupOnRing             = 8;                            {  1=can wakeup when the modem detects a ring           }
    hasDimmingSupport           = 9;                            {  1=has dimming support built in (DPMS standby by default)    }
    hasStartupTimer             = 10;                           {  1=startup timer is supported                     }
    hasChargeNotification       = 11;                           {  1=client can determine of charge connect status change notifications available  }
    hasDimSuspendSupport        = 12;                           {  1=supports dimming LCD and CRT to DPMS suspend state      }
    hasWakeOnNetActivity        = 13;                           {  1=hardware supports wake on network activity           }
    hasWakeOnLid                = 14;                           {  1=hardware can wake when opened                    }
    canPowerOffPCIBus           = 15;                           {  1=hardware can power off PCI bus during sleep if cards allow  }
    hasDeepSleep                = 16;                           {  1=hardware supports deep sleep (hibernation) mode    }
    hasSleep                    = 17;                           {  1=hardware supports normal (PowerBook-like) sleep    }
    supportsServerModeAPIs      = 18;                           {  1=hardware supports server mode API routines           }
    supportsUPSIntegration      = 19;                           {  1=hardware support UPS integration and reporting       }
    hasAggressiveIdling         = 20;                           {  1=Power Manager only resets OverallAct on UsrActvity      }
    supportsIdleQueue           = 21;                           {  1=Power Manager supports the idle queue               }

    {    bits in bitfield returned by GetIntModemInfo and set by SetIntModemState   }
    hasInternalModem            = 0;                            {  1=internal modem installed                }
    intModemRingDetect          = 1;                            {  1=internal modem has detected a ring           }
    intModemOffHook             = 2;                            {  1=internal modem is off hook                }
    intModemRingWakeEnb         = 3;                            {  1=wakeup on ring is enabled                  }
    extModemSelected            = 4;                            {  1=external modem selected              }
    modemSetBit                 = 15;                           {  1=set bit, 0=clear bit (SetIntModemState)    }

    {    bits in BatteryInfo.flags                                      }
    {    ("chargerConnected" doesn't mean the charger is plugged in)    }
    batteryInstalled            = 7;                            {  1=battery is currently connected              }
    batteryCharging             = 6;                            {  1=battery is being charged                }
    chargerConnected            = 5;                            {  1=charger is connected to the PowerBook          }
    upsConnected                = 4;                            {  1=there is a UPS connected                }
    upsIsPowerSource            = 3;                            {  1=UPS is source of power                 }

    HDPwrQType                  = $4844;                        {  'HD' hard disk spindown queue element type      }
    PMgrStateQType              = $504D;                        {  'PM' Power Manager state queue element type        }

    {    client notification bits in PMgrQueueElement.pmNotifyBits  }
    pmSleepTimeoutChanged       = 0;
    pmSleepEnableChanged        = 1;
    pmHardDiskTimeoutChanged    = 2;
    pmHardDiskSpindownChanged   = 3;
    pmDimmingTimeoutChanged     = 4;
    pmDimmingEnableChanged      = 5;
    pmDiskModeAddressChanged    = 6;
    pmProcessorCyclingChanged   = 7;
    pmProcessorSpeedChanged     = 8;
    pmWakeupTimerChanged        = 9;
    pmStartupTimerChanged       = 10;
    pmHardDiskPowerRemovedbyUser = 11;
    pmChargeStatusChanged       = 12;
    pmPowerLevelChanged         = 13;
    pmWakeOnNetActivityChanged  = 14;

    pmSleepTimeoutChangedMask   = $01;
    pmSleepEnableChangedMask    = $02;
    pmHardDiskTimeoutChangedMask = $04;
    pmHardDiskSpindownChangedMask = $08;
    pmDimmingTimeoutChangedMask = $10;
    pmDimmingEnableChangedMask  = $20;
    pmDiskModeAddressChangedMask = $40;
    pmProcessorCyclingChangedMask = $80;
    pmProcessorSpeedChangedMask = $0100;
    pmWakeupTimerChangedMask    = $0200;
    pmStartupTimerChangedMask   = $0400;
    pmHardDiskPowerRemovedbyUserMask = $0800;
    pmChargeStatusChangedMask   = $1000;
    pmPowerLevelChangedMask     = $2000;
    pmWakeOnNetActivityChangedMask = $4000;

    {    System Activity Selectors  }
    {    Notes:  The IdleActivity selector is not available unless the hasAggressiveIdling PMFeatures bit is set.   }
    {            Use IdleActivity where you used to use OverallAct if necessary.  OverallAct will only              }
    {            delay power cycling if it's enabled, and will delay sleep by a small amount when                   }
    {            hasAggressiveIdling is set.  Don't use IdleActivity unless hasAggressiveIdling is set; when        }
    {            hasAggressiveIdling is not set, the use of IdleActivity is undefined, and well do different        }
    {            things depending on which Power Manager is currently running.                                      }
    OverallAct                  = 0;                            {  Delays idle sleep by small amount                  }
    UsrActivity                 = 1;                            {  Delays idle sleep and dimming by timeout time           }
    NetActivity                 = 2;                            {  Delays idle sleep and power cycling by small amount          }
    HDActivity                  = 3;                            {  Delays hard drive spindown and idle sleep by small amount   }
    IdleActivity                = 4;                            {  Delays idle sleep by timeout time                  }

    {    Storage Media sleep mode defines   }
    kMediaModeOn                = 0;                            {  Media active (Drive spinning and at full power)     }
    kMediaModeStandBy           = 1;                            {  Media standby (not implemented)     }
    kMediaModeSuspend           = 2;                            {  Media Idle (not implemented)    }
    kMediaModeOff               = 3;                            {  Media Sleep (Drive not spinning and at min power, max recovery time)    }

    kMediaPowerCSCode           = 70;


    {    definitions for HDQueueElement.hdFlags     }
    kHDQueuePostBit             = 0;                            {  1 = call this routine on the second pass      }
    kHDQueuePostMask            = $01;


type
    ActivityInfoPtr = ^ActivityInfo;
    ActivityInfo = record
        ActivityType:           SInt16;                             {  Type of activity to be fetched.  Same as UpdateSystemActivity Selectors  }
        ActivityTime:           UInt32;                                 {  Time of last activity (in ticks) of specified type.  }
    end;

    {    information returned by GetScaledBatteryInfo   }
    BatteryInfoPtr = ^BatteryInfo;
    BatteryInfo = packed record
        flags:                  UInt8;                                  {  misc flags (see below)                   }
        warningLevel:           UInt8;                                  {  scaled warning level (0-255)                }
        reserved:               UInt8;                                  {  reserved for internal use              }
        batteryLevel:           UInt8;                                  {  scaled battery level (0-255)                }
    end;

    ModemByte                           = SInt8;
    BatteryByte                         = SInt8;
    SoundMixerByte                      = SInt8;
    PMResultCode                        = SInt32;
    SleepQRecPtr = ^SleepQRec;
    HDQueueElementPtr = ^HDQueueElement;
    PMgrQueueElementPtr = ^PMgrQueueElement;
    SleepQProcPtr = function(message: SInt32; qRecPtr: SleepQRecPtr): SInt32;

    HDSpindownProcPtr = procedure(theElement: HDQueueElementPtr);

    PMgrStateChangeProcPtr = procedure(theElement: PMgrQueueElementPtr; stateBits: SInt32);

    SleepQUPP = ^SInt32; { an opaque UPP }
    HDSpindownUPP = ^SInt32; { an opaque UPP }
    PMgrStateChangeUPP = ^SInt32; { an opaque UPP }
    SleepQRec = record
        sleepQLink:             SleepQRecPtr;                           {  pointer to next queue element           }
        sleepQType:             SInt16;                             {  queue element type (must be SleepQType)        }
        sleepQProc:             SleepQUPP;                              {  pointer to sleep universal proc ptr          }
        sleepQFlags:            SInt16;                             {  flags                        }
    end;

    HDQueueElement = record
        hdQLink:                HDQueueElementPtr;                      {  pointer to next queue element           }
        hdQType:                SInt16;                             {  queue element type (must be HDPwrQType)        }
        hdFlags:                SInt16;                             {  miscellaneous flags                    }
        hdProc:                 HDSpindownUPP;                          {  pointer to routine to call            }
        hdUser:                 SInt32;                             {  user-defined (variable storage, etc.)    }
    end;

    PMgrQueueElement = record
        pmQLink:                PMgrQueueElementPtr;                    {  pointer to next queue element           }
        pmQType:                SInt16;                             {  queue element type (must be PMgrStateQType)     }
        pmFlags:                SInt16;                             {  miscellaneous flags                    }
        pmNotifyBits:           SInt32;                             {  bitmap of which changes to be notified for  }
        pmProc:                 PMgrStateChangeUPP;                     {  pointer to routine to call            }
        pmUser:                 SInt32;                             {  user-defined (variable storage, etc.)    }
    end;


    BatteryTimeRecPtr = ^BatteryTimeRec;
    BatteryTimeRec = record
        expectedBatteryTime:    UInt32;                                 {  estimated battery time remaining (seconds)  }
        minimumBatteryTime:     UInt32;                                 {  minimum battery time remaining (seconds)      }
        maximumBatteryTime:     UInt32;                                 {  maximum battery time remaining (seconds)      }
        timeUntilCharged:       UInt32;                                 {  time until battery is fully charged (seconds) }
    end;


    WakeupTimePtr = ^WakeupTime;
    WakeupTime = record
        wakeTime:               UInt32;                                 {  wakeup time (same format as current time)    }
        wakeEnabled:            boolean;                                {  1=enable wakeup timer, 0=disable wakeup timer   }
        filler:                 SInt8;
    end;


    StartupTimePtr = ^StartupTime;
    StartupTime = record
        startTime:              UInt32;                                 {  startup time (same format as current time)      }
        startEnabled:           boolean;                                {  1=enable startup timer, 0=disable startup timer     }
        filler:                 SInt8;
    end;

    {  PowerSource version }

const
    kVersionOnePowerSource      = 1;
    kVersionTwoPowerSource      = 2;
    kCurrentPowerSourceVersion  = 2;

    {  PowerSourceAttrs bits }

    bSourceIsBattery            = 0;                            {  power source is battery }
    bSourceIsAC                 = 1;                            {  power source is AC }
    bSourceCanBeCharged         = 2;                            {  power source can be charged }
    bSourceIsUPS                = 3;                            {  power source is UPS. NOTE: software should set bSourceIsBattery and bSourceIsAC also, as appropriate }
    bSourceProvidesWarnLevels   = 4;                            {  power source provides low power and dead battery warning levels }
    kSourceIsBatteryMask        = $01;
    kSourceIsACMask             = $02;
    kSourceCanBeChargedMask     = $04;
    kSourceIsUPSMask            = $08;
    kSourceProvidesWarnLevelsMask = $10;

    {  PowerSourceFlags bits }

    bSourceIsAvailable          = 0;                            {  power source is installed }
    bSourceIsCharging           = 1;                            {  power source being charged }
    bChargerIsAttached          = 2;                            {  a charger is connected }
    kSourceIsAvailableMask      = $01;
    kSourceIsChargingMask       = $02;
    kChargerIsAttachedMask      = $04;

    {  Power Capacity Types }

    kCapacityIsActual           = 0;                            {  current capacity is expessed as actual capacity in same units as max }
    kCapacityIsPercentOfMax     = 1;                            {  current capacity is expressed as a percentage of maximumCapacity }

    {  Net Activity Wake Options }
    kConfigSupportsWakeOnNetBit = 0;
    kWakeOnNetAdminAccessesBit  = 1;
    kWakeOnAllNetAccessesBit    = 2;
    kUnmountServersBeforeSleepingBit = 3;
    kConfigSupportsWakeOnNetMask = $01;
    kWakeOnNetAdminAccessesMask = $02;
    kWakeOnAllNetAccessesMask   = $04;
    kUnmountServersBeforeSleepingMask = $08;

    {  Power Source capacity usage types }
    kCurrentCapacityIsActualValue = 0;                          {  currentCapacity is a real value in same units as maxCapacity }
    kCurrentCapacityIsPercentOfMax = 1;                         {  currentCapacity is expressed as a percentage of maxCapacity. }


type
    PowerSourceID                       = SInt16;
    PowerSourceParamBlockPtr = ^PowerSourceParamBlock;
    PowerSourceParamBlock = record
        sourceID:               PowerSourceID;                          {  unique id assigned by Power Mgr }
        sourceCapacityUsage:    UInt16;                                 {  how currentCapacity is used }
        sourceVersion:          UInt32;                                 {  version of this record }
        sourceAttr:             OptionBits;                             {  attribute flags (see below) }
        sourceState:            OptionBits;                             {  state flags (see below) }
        currentCapacity:        UInt32;                                 {  current capacity, in }
                                                                        {    milliwatts or % }
        maxCapacity:            UInt32;                                 {  full capacity, in milliwatts }
        timeRemaining:          UInt32;                                 {  time left to deplete,  }
                                                                        {    in milliwatt-hours }
        timeToFullCharge:       UInt32;                                 {  time to charge,  }
                                                                        {    in milliwatt-hours }
        voltage:                UInt32;                                 {  voltage in millivolts }
        current:                SInt32;                                 {  current in milliamperes  }
                                                                        {   (negative if consuming,  }
                                                                        {    positive if charging) }
        lowWarnLevel:           UInt32;                                 {  low warning level in milliwatts (or % if sourceCapacityUsage is %) }
        deadWarnLevel:          UInt32;                                 {  dead warning level in milliwatts (or % if sourceCapacityUsage is %) }
        reserved:               array [0..15] of UInt32;                {  for future expansion }
    end;

    {
     *  DisableWUTime()
     *
     *  Availability:
     *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function DisableWUTime: OSErr; external name '_DisableWUTime';

{
 *  SetWUTime()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetWUTime(wuTime: SInt32): OSErr; external name '_SetWUTime';


{
 *  IdleUpdate()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function IdleUpdate: SInt32; external name '_IdleUpdate';
{
 *  GetCPUSpeed()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetCPUSpeed: SInt32; external name '_GetCPUSpeed';
{
 *  EnableIdle()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure EnableIdle; external name '_EnableIdle';
{
 *  DisableIdle()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisableIdle; external name '_DisableIdle';
{
 *  SleepQInstall()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SleepQInstall(qRecPtr: SleepQRecPtr); external name '_SleepQInstall';
{
 *  SleepQRemove()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SleepQRemove(qRecPtr: SleepQRecPtr); external name '_SleepQRemove';
{
 *  AOn()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure AOn; external name '_AOn';
{
 *  AOnIgnoreModem()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure AOnIgnoreModem; external name '_AOnIgnoreModem';
{
 *  BOn()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure BOn; external name '_BOn';
{
 *  AOff()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure AOff; external name '_AOff';
{
 *  BOff()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure BOff; external name '_BOff';
{ Public Power Management API  }
{
 *  PMSelectorCount()
 *
 *  Availability:
 *    Non-Carbon CFM:   in PowerMgrLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PMSelectorCount: SInt16; external name '_PMSelectorCount';
{
 *  PMFeatures()
 *
 *  Availability:
 *    Non-Carbon CFM:   in PowerMgrLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PMFeatures: UInt32; external name '_PMFeatures';
{
 *  GetSleepTimeout()
 *
 *  Availability:
 *    Non-Carbon CFM:   in PowerMgrLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetSleepTimeout: ByteParameter; external name '_GetSleepTimeout';
{
 *  SetSleepTimeout()
 *
 *  Availability:
 *    Non-Carbon CFM:   in PowerMgrLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetSleepTimeout(timeout: ByteParameter); external name '_SetSleepTimeout';
{
 *  GetHardDiskTimeout()
 *
 *  Availability:
 *    Non-Carbon CFM:   in PowerMgrLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetHardDiskTimeout: ByteParameter; external name '_GetHardDiskTimeout';
{
 *  SetHardDiskTimeout()
 *
 *  Availability:
 *    Non-Carbon CFM:   in PowerMgrLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetHardDiskTimeout(timeout: ByteParameter); external name '_SetHardDiskTimeout';
{
 *  HardDiskPowered()
 *
 *  Availability:
 *    Non-Carbon CFM:   in PowerMgrLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function HardDiskPowered: boolean; external name '_HardDiskPowered';
{
 *  SpinDownHardDisk()
 *
 *  Availability:
 *    Non-Carbon CFM:   in PowerMgrLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SpinDownHardDisk; external name '_SpinDownHardDisk';
{
 *  IsSpindownDisabled()
 *
 *  Availability:
 *    Non-Carbon CFM:   in PowerMgrLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function IsSpindownDisabled: boolean; external name '_IsSpindownDisabled';
{
 *  SetSpindownDisable()
 *
 *  Availability:
 *    Non-Carbon CFM:   in PowerMgrLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetSpindownDisable(setDisable: boolean); external name '_SetSpindownDisable';
{
 *  HardDiskQInstall()
 *
 *  Availability:
 *    Non-Carbon CFM:   in PowerMgrLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function HardDiskQInstall(var theElement: HDQueueElement): OSErr; external name '_HardDiskQInstall';
{
 *  HardDiskQRemove()
 *
 *  Availability:
 *    Non-Carbon CFM:   in PowerMgrLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function HardDiskQRemove(var theElement: HDQueueElement): OSErr; external name '_HardDiskQRemove';
{
 *  GetScaledBatteryInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in PowerMgrLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure GetScaledBatteryInfo(whichBattery: SInt16; var theInfo: BatteryInfo); external name '_GetScaledBatteryInfo';
{
 *  AutoSleepControl()
 *
 *  Availability:
 *    Non-Carbon CFM:   in PowerMgrLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure AutoSleepControl(enableSleep: boolean); external name '_AutoSleepControl';
{
 *  GetIntModemInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in PowerMgrLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetIntModemInfo: UInt32; external name '_GetIntModemInfo';
{
 *  SetIntModemState()
 *
 *  Availability:
 *    Non-Carbon CFM:   in PowerMgrLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetIntModemState(theState: SInt16); external name '_SetIntModemState';
{
 *  MaximumProcessorSpeed()
 *
 *  Availability:
 *    Non-Carbon CFM:   in PowerMgrLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function MaximumProcessorSpeed: SInt16; external name '_MaximumProcessorSpeed';
{
 *  MinimumProcessorSpeed()
 *
 *  Availability:
 *    Non-Carbon CFM:   in PowerMgrLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function MinimumProcessorSpeed: SInt16; external name '_MinimumProcessorSpeed';
{
 *  CurrentProcessorSpeed()
 *
 *  Availability:
 *    Non-Carbon CFM:   in PowerMgrLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CurrentProcessorSpeed: SInt16; external name '_CurrentProcessorSpeed';
{
 *  FullProcessorSpeed()
 *
 *  Availability:
 *    Non-Carbon CFM:   in PowerMgrLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FullProcessorSpeed: boolean; external name '_FullProcessorSpeed';
{
 *  SetProcessorSpeed()
 *
 *  Availability:
 *    Non-Carbon CFM:   in PowerMgrLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetProcessorSpeed(fullSpeed: boolean): boolean; external name '_SetProcessorSpeed';
{
 *  GetSCSIDiskModeAddress()
 *
 *  Availability:
 *    Non-Carbon CFM:   in PowerMgrLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetSCSIDiskModeAddress: SInt16; external name '_GetSCSIDiskModeAddress';
{
 *  SetSCSIDiskModeAddress()
 *
 *  Availability:
 *    Non-Carbon CFM:   in PowerMgrLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetSCSIDiskModeAddress(scsiAddress: SInt16); external name '_SetSCSIDiskModeAddress';
{
 *  GetWakeupTimer()
 *
 *  Availability:
 *    Non-Carbon CFM:   in PowerMgrLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure GetWakeupTimer(var theTime: WakeupTime); external name '_GetWakeupTimer';
{
 *  SetWakeupTimer()
 *
 *  Availability:
 *    Non-Carbon CFM:   in PowerMgrLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetWakeupTimer(var theTime: WakeupTime); external name '_SetWakeupTimer';
{
 *  IsProcessorCyclingEnabled()
 *
 *  Availability:
 *    Non-Carbon CFM:   in PowerMgrLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function IsProcessorCyclingEnabled: boolean; external name '_IsProcessorCyclingEnabled';
{
 *  EnableProcessorCycling()
 *
 *  Availability:
 *    Non-Carbon CFM:   in PowerMgrLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure EnableProcessorCycling(enable: boolean); external name '_EnableProcessorCycling';
{
 *  BatteryCount()
 *
 *  Availability:
 *    Non-Carbon CFM:   in PowerMgrLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function BatteryCount: SInt16; external name '_BatteryCount';
{
 *  GetBatteryVoltage()
 *
 *  Availability:
 *    Non-Carbon CFM:   in PowerMgrLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetBatteryVoltage(whichBattery: SInt16): Fixed; external name '_GetBatteryVoltage';
{
 *  GetBatteryTimes()
 *
 *  Availability:
 *    Non-Carbon CFM:   in PowerMgrLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure GetBatteryTimes(whichBattery: SInt16; var theTimes: BatteryTimeRec); external name '_GetBatteryTimes';
{
 *  GetDimmingTimeout()
 *
 *  Availability:
 *    Non-Carbon CFM:   in PowerMgrLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetDimmingTimeout: ByteParameter; external name '_GetDimmingTimeout';
{
 *  SetDimmingTimeout()
 *
 *  Availability:
 *    Non-Carbon CFM:   in PowerMgrLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetDimmingTimeout(timeout: ByteParameter); external name '_SetDimmingTimeout';
{
 *  DimmingControl()
 *
 *  Availability:
 *    Non-Carbon CFM:   in PowerMgrLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DimmingControl(enableSleep: boolean); external name '_DimmingControl';
{
 *  IsDimmingControlDisabled()
 *
 *  Availability:
 *    Non-Carbon CFM:   in PowerMgrLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function IsDimmingControlDisabled: boolean; external name '_IsDimmingControlDisabled';
{
 *  IsAutoSlpControlDisabled()
 *
 *  Availability:
 *    Non-Carbon CFM:   in PowerMgrLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function IsAutoSlpControlDisabled: boolean; external name '_IsAutoSlpControlDisabled';
{
 *  PMgrStateQInstall()
 *
 *  Availability:
 *    Non-Carbon CFM:   in PowerMgrLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PMgrStateQInstall(var theElement: PMgrQueueElement): OSErr; external name '_PMgrStateQInstall';
{
 *  PMgrStateQRemove()
 *
 *  Availability:
 *    Non-Carbon CFM:   in PowerMgrLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PMgrStateQRemove(var theElement: PMgrQueueElement): OSErr; external name '_PMgrStateQRemove';
{
 *  UpdateSystemActivity()
 *
 *  Availability:
 *    Non-Carbon CFM:   in PowerMgrLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function UpdateSystemActivity(activity: ByteParameter): OSErr; external name '_UpdateSystemActivity';
{
 *  DelaySystemIdle()
 *
 *  Availability:
 *    Non-Carbon CFM:   in PowerMgrLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DelaySystemIdle: OSErr; external name '_DelaySystemIdle';
{
 *  GetStartupTimer()
 *
 *  Availability:
 *    Non-Carbon CFM:   in PowerMgrLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetStartupTimer(var theTime: StartupTime): OSErr; external name '_GetStartupTimer';
{
 *  SetStartupTimer()
 *
 *  Availability:
 *    Non-Carbon CFM:   in PowerMgrLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetStartupTimer(var theTime: StartupTime): OSErr; external name '_SetStartupTimer';
{
 *  GetLastActivity()
 *
 *  Availability:
 *    Non-Carbon CFM:   in PowerMgrLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetLastActivity(var theActivity: ActivityInfo): OSErr; external name '_GetLastActivity';
{
 *  GetSoundMixerState()
 *
 *  Availability:
 *    Non-Carbon CFM:   in PowerMgrLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetSoundMixerState(var theSoundMixerByte: SoundMixerByte): OSErr; external name '_GetSoundMixerState';
{
 *  SetSoundMixerState()
 *
 *  Availability:
 *    Non-Carbon CFM:   in PowerMgrLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetSoundMixerState(var theSoundMixerByte: SoundMixerByte): OSErr; external name '_SetSoundMixerState';
{
 *  GetDimSuspendState()
 *
 *  Availability:
 *    Non-Carbon CFM:   in PowerMgrLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetDimSuspendState: boolean; external name '_GetDimSuspendState';
{
 *  SetDimSuspendState()
 *
 *  Availability:
 *    Non-Carbon CFM:   in PowerMgrLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetDimSuspendState(dimSuspendState: boolean); external name '_SetDimSuspendState';


const
    uppSleepQProcInfo = $00131832;
    uppHDSpindownProcInfo = $000000C0;
    uppPMgrStateChangeProcInfo = $000003C0;
    {
     *  NewSleepQUPP()
     *
     *  Availability:
     *    Non-Carbon CFM:   available as macro/inline
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function NewSleepQUPP(userRoutine: SleepQProcPtr): SleepQUPP; external name '_NewSleepQUPP'; { old name was NewSleepQProc }
{
 *  NewHDSpindownUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewHDSpindownUPP(userRoutine: HDSpindownProcPtr): HDSpindownUPP; external name '_NewHDSpindownUPP'; { old name was NewHDSpindownProc }
{
 *  NewPMgrStateChangeUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewPMgrStateChangeUPP(userRoutine: PMgrStateChangeProcPtr): PMgrStateChangeUPP; external name '_NewPMgrStateChangeUPP'; { old name was NewPMgrStateChangeProc }
{
 *  DisposeSleepQUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeSleepQUPP(userUPP: SleepQUPP); external name '_DisposeSleepQUPP';
{
 *  DisposeHDSpindownUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeHDSpindownUPP(userUPP: HDSpindownUPP); external name '_DisposeHDSpindownUPP';
{
 *  DisposePMgrStateChangeUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposePMgrStateChangeUPP(userUPP: PMgrStateChangeUPP); external name '_DisposePMgrStateChangeUPP';
{
 *  InvokeSleepQUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeSleepQUPP(message: SInt32; qRecPtr: SleepQRecPtr; userRoutine: SleepQUPP): SInt32; external name '_InvokeSleepQUPP'; { old name was CallSleepQProc }
{
 *  InvokeHDSpindownUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvokeHDSpindownUPP(theElement: HDQueueElementPtr; userRoutine: HDSpindownUPP); external name '_InvokeHDSpindownUPP'; { old name was CallHDSpindownProc }
{
 *  InvokePMgrStateChangeUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvokePMgrStateChangeUPP(theElement: PMgrQueueElementPtr; stateBits: SInt32; userRoutine: PMgrStateChangeUPP); external name '_InvokePMgrStateChangeUPP'; { old name was CallPMgrStateChangeProc }
{$ALIGN MAC68K}
{#POP}
{unit QuickdrawText}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}

{ new CGrafPort bottleneck ("newProc2") function, used in Unicode Text drawing }
{
 *  StandardGlyphs()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickDrawText 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function StandardGlyphs(dataStream: UnivPtr; size: ByteCount): OSStatus; external name '_StandardGlyphs';



const
                                                                {  CharToPixel directions  }
    leftCaret                   = 0;                            { Place caret for left block }
    rightCaret                  = -1;                           { Place caret for right block }
    kHilite                     = 1;                            { Direction is SysDirection }

    smLeftCaret                 = 0;                            { Place caret for left block - obsolete  }
    smRightCaret                = -1;                           { Place caret for right block - obsolete  }
    smHilite                    = 1;                            { Direction is TESysJust - obsolete  }

                                                                { Constants for styleRunPosition argument in PortionLine, DrawJustified, MeasureJustified, CharToPixel, and PixelToChar. }
    onlyStyleRun                = 0;                            {  This is the only style run on the line  }
    leftStyleRun                = 1;                            {  This is leftmost of multiple style runs on the line  }
    rightStyleRun               = 2;                            {  This is rightmost of multiple style runs on the line  }
    middleStyleRun              = 3;                            {  There are multiple style runs on the line and this is neither the leftmost nor the rightmost.  }
    smOnlyStyleRun              = 0;                            {  obsolete  }
    smLeftStyleRun              = 1;                            {  obsolete  }
    smRightStyleRun             = 2;                            {  obsolete  }
    smMiddleStyleRun            = 3;                            {  obsolete  }

    {    type for styleRunPosition parameter in PixelToChar etc.    }

type
    JustStyleCode                       = SInt16;
    {    Type for truncWhere parameter in TruncString, TruncText    }
    TruncCode                           = SInt16;

const
                                                                {  Constants for truncWhere argument in TruncString and TruncText  }
    truncEnd                    = 0;                            {  Truncate at end  }
    truncMiddle                 = $4000;                        {  Truncate in middle  }
    smTruncEnd                  = 0;                            {  Truncate at end - obsolete  }
    smTruncMiddle               = $4000;                        {  Truncate in middle - obsolete  }

                                                                {  Constants for TruncString and TruncText results  }
    notTruncated                = 0;                            {  No truncation was necessary  }
    truncated                   = 1;                            {  Truncation performed  }
    truncErr                    = -1;                           {  General error  }
    smNotTruncated              = 0;                            {  No truncation was necessary - obsolete  }
    smTruncated                 = 1;                            {  Truncation performed   - obsolete  }
    smTruncErr                  = -1;                           {  General error - obsolete  }


type
    StyledLineBreakCode                 = SInt8;

const
    smBreakWord                 = 0;
    smBreakChar                 = 1;
    smBreakOverflow             = 2;

    {   QuickTime3.0    }
                                                                {  Constants for txFlags (which used to be the pad field after txFace)  }
    tfAntiAlias                 = $01;
    tfUnicode                   = $02;



type
    FontInfoPtr = ^FontInfo;
    FontInfo = record
        ascent:                 SInt16;
        descent:                SInt16;
        widMax:                 SInt16;
        leading:                SInt16;
    end;

    FormatOrder                         = array [0..0] of SInt16;
    FormatOrderPtr                      = ^FormatOrder;
    {    FormatStatus was moved to TextUtils.i  }
    {    OffsetTable moved to IntlResources.i   }

    StyleRunDirectionProcPtr = function(styleRunIndex: SInt16; dirParam: UnivPtr): boolean;

    StyleRunDirectionUPP = ^SInt32; { an opaque UPP }

const
    uppStyleRunDirectionProcInfo = $00000390;
    {
     *  NewStyleRunDirectionUPP()
     *
     *  Availability:
     *    Non-Carbon CFM:   available as macro/inline
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function NewStyleRunDirectionUPP(userRoutine: StyleRunDirectionProcPtr): StyleRunDirectionUPP; external name '_NewStyleRunDirectionUPP'; { old name was NewStyleRunDirectionProc }
{
 *  DisposeStyleRunDirectionUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeStyleRunDirectionUPP(userUPP: StyleRunDirectionUPP); external name '_DisposeStyleRunDirectionUPP';
{
 *  InvokeStyleRunDirectionUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeStyleRunDirectionUPP(styleRunIndex: SInt16; dirParam: UnivPtr; userRoutine: StyleRunDirectionUPP): boolean; external name '_InvokeStyleRunDirectionUPP'; { old name was CallStyleRunDirectionProc }

{
 *  PixelToChar()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PixelToChar(textBuf: Ptr; textLength: SInt32; slop: Fixed; pixelWidth: Fixed; var leadingEdge: boolean; var widthRemaining: Fixed; styleRunPosition: JustStyleCode; numer: Point; denom: Point): SInt16; external name '_PixelToChar';
{
 *  CharToPixel()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CharToPixel(textBuf: Ptr; textLength: SInt32; slop: Fixed; offset: SInt32; direction: SInt16; styleRunPosition: JustStyleCode; numer: Point; denom: Point): SInt16; external name '_CharToPixel';
{
 *  DrawJustified()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DrawJustified(textPtr: Ptr; textLength: SInt32; slop: Fixed; styleRunPosition: JustStyleCode; numer: Point; denom: Point); external name '_DrawJustified';
{
 *  MeasureJustified()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure MeasureJustified(textPtr: Ptr; textLength: SInt32; slop: Fixed; charLocs: Ptr; styleRunPosition: JustStyleCode; numer: Point; denom: Point); external name '_MeasureJustified';
{
 *  PortionLine()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PortionLine(textPtr: Ptr; textLen: SInt32; styleRunPosition: JustStyleCode; numer: Point; denom: Point): Fixed; external name '_PortionLine';
{
 *  HiliteText()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure HiliteText(textPtr: Ptr; textLength: SInt16; firstOffset: SInt16; secondOffset: SInt16; var offsets: OffsetTable); external name '_HiliteText';

{
 *  VisibleLength()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function VisibleLength(textPtr: Ptr; textLength: SInt32): SInt32; external name '_VisibleLength';
{
 *  GetFormatOrder()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure GetFormatOrder(ordering: FormatOrderPtr; firstFormat: SInt16; lastFormat: SInt16; lineRight: boolean; rlDirProc: StyleRunDirectionUPP; dirParam: Ptr); external name '_GetFormatOrder';
{
 *  TextFont()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure TextFont(font: SInt16); external name '_TextFont';
{
 *  TextFace()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure TextFace(face: StyleParameter); external name '_TextFace';
{
 *  TextMode()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure TextMode(mode: SInt16); external name '_TextMode';
{
 *  TextSize()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure TextSize(size: SInt16); external name '_TextSize';
{
 *  SpaceExtra()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SpaceExtra(extra: Fixed); external name '_SpaceExtra';
{
 *  DrawChar()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DrawChar(ch: CharParameter); external name '_DrawChar';
{
 *  DrawString()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DrawString(const (*var*) s: Str255); external name '_DrawString';
{
 *  [Mac]DrawText()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DrawText(textBuf: UnivPtr; firstByte: SInt16; byteCount: SInt16); external name '_DrawText';
{
 *  CharWidth()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CharWidth(ch: CharParameter): SInt16; external name '_CharWidth';
{
 *  StringWidth()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function StringWidth(const (*var*) s: Str255): SInt16; external name '_StringWidth';
{
 *  TextWidth()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TextWidth(textBuf: UnivPtr; firstByte: SInt16; byteCount: SInt16): SInt16; external name '_TextWidth';
{
 *  MeasureText()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure MeasureText(count: SInt16; textAddr: UnivPtr; charLocs: UnivPtr); external name '_MeasureText';
{
 *  GetFontInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure GetFontInfo(var info: FontInfo); external name '_GetFontInfo';
{
 *  CharExtra()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CharExtra(extra: Fixed); external name '_CharExtra';
{
 *  StdText()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure StdText(count: SInt16; textAddr: UnivPtr; numer: Point; denom: Point); external name '_StdText';
{
 *  StdTxMeas()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function StdTxMeas(byteCount: SInt16; textAddr: UnivPtr; var numer: Point; var denom: Point; var info: FontInfo): SInt16; external name '_StdTxMeas';
{
 *  StyledLineBreak()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function StyledLineBreak(textPtr: Ptr; textLen: SInt32; textStart: SInt32; textEnd: SInt32; flags: SInt32; var textWidth: Fixed; var textOffset: SInt32): StyledLineBreakCode; external name '_StyledLineBreak';
{
 *  TruncString()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TruncString(width: SInt16; var theString: Str255; truncWhere: TruncCode): SInt16; external name '_TruncString';
{
 *  TruncText()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TruncText(width: SInt16; textPtr: Ptr; var length: SInt16; truncWhere: TruncCode): SInt16; external name '_TruncText';

{$ALIGN MAC68K}
{#POP}
{unit SCDynamicStoreKey}
{$ALIGN MAC68K}






{!
    @header SCDynamicStoreKey
 }

{
 * SCDynamicStoreKeyCreate*
 * - convenience routines that create a CFString key for an item in the store
 }

{!
    @function SCDynamicStoreKeyCreate
    @discussion Creates a store key using the given format.
 }
// function SCDynamicStoreKeyCreate( allocator: CFAllocatorRef; fmt: CFStringRef; ... ): CFStringRef; external name '_SCDynamicStoreKeyCreate';

{!
    @function SCDynamicStoreKeyCreateNetworkGlobalEntity
 }
function SCDynamicStoreKeyCreateNetworkGlobalEntity( allocator: CFAllocatorRef; domain: CFStringRef; entity: CFStringRef ): CFStringRef; external name '_SCDynamicStoreKeyCreateNetworkGlobalEntity';

{!
    @function SCDynamicStoreKeyCreateNetworkInterface
 }
function SCDynamicStoreKeyCreateNetworkInterface( allocator: CFAllocatorRef; domain: CFStringRef ): CFStringRef; external name '_SCDynamicStoreKeyCreateNetworkInterface';

{!
    @function SCDynamicStoreKeyCreateNetworkInterfaceEntity
 }
function SCDynamicStoreKeyCreateNetworkInterfaceEntity( allocator: CFAllocatorRef; domain: CFStringRef; ifname: CFStringRef; entity: CFStringRef ): CFStringRef; external name '_SCDynamicStoreKeyCreateNetworkInterfaceEntity';

{!
    @function SCDynamicStoreKeyCreateNetworkServiceEntity
 }
function SCDynamicStoreKeyCreateNetworkServiceEntity( allocator: CFAllocatorRef; domain: CFStringRef; serviceID: CFStringRef; entity: CFStringRef ): CFStringRef; external name '_SCDynamicStoreKeyCreateNetworkServiceEntity';

{!
    @function SCDynamicStoreKeyCreateComputerName
    @discussion Creates a key that can be used by the SCDynamicStoreSetNotificationKeys()
        function to receive notifications when the current
        computer/host name changes.
    @result A notification string for the current computer/host name.
}
function SCDynamicStoreKeyCreateComputerName( allocator: CFAllocatorRef ): CFStringRef; external name '_SCDynamicStoreKeyCreateComputerName';

{!
    @function SCDynamicStoreKeyCreateConsoleUser
    @discussion Creates a key that can be used by the SCDynamicStoreSetNotificationKeys()
        function to receive notifications when the current "Console"
        user changes.
    @result A notification string for the current "Console" user.
}
function SCDynamicStoreKeyCreateConsoleUser( allocator: CFAllocatorRef ): CFStringRef; external name '_SCDynamicStoreKeyCreateConsoleUser';

{!
    @function SCDynamicStoreKeyCreateHostNames
    @discussion Creates a key that can be used in conjunction with
        SCDynamicStoreSetNotificationKeys() to receive
        notifications when the HostNames entity changes.  The
        HostNames entity contains the LocalHostName.
    @result A notification string for the HostNames entity.
}
function SCDynamicStoreKeyCreateHostNames( allocator: CFAllocatorRef ): CFStringRef; external name '_SCDynamicStoreKeyCreateHostNames';

{!
    @function SCDynamicStoreKeyCreateLocation
    @discussion Creates a key that can be used in conjunction with
        SCDynamicStoreSetNotificationKeys() to receive
        notifications when the "location" identifier changes.
    @result A notification string for the current "location" identifier.
}
function SCDynamicStoreKeyCreateLocation( allocator: CFAllocatorRef ): CFStringRef; external name '_SCDynamicStoreKeyCreateLocation';

{!
    @function SCDynamicStoreKeyCreateProxies
    @discussion Creates a key that can be used by the SCDynamicStoreSetNotificationKeys()
        function to receive notifications when the current network proxy
        settings (HTTP, FTP, ...) are changed.
    @result A notification string for the current proxy settings.
}
function SCDynamicStoreKeyCreateProxies( allocator: CFAllocatorRef ): CFStringRef; external name '_SCDynamicStoreKeyCreateProxies';
{unit SCNetwork}
{$ALIGN MAC68K}






{!
    @header SCNetwork

    SCNetworkCheckReachabilityXXX()

    The SCNetworkCheckReachabilityXXX() APIs allow an application to
    determine the status of the system's current network configuration
    and the accessibility of a target host/address.

    The term "reachable" reflects whether a data packet, sent by
    an application into the network stack, can be sent to the
    the target host/address.  Please note that their is no
    guarantee that the data packet will actually be received by
    the host.


    SCNetworkInterfaceRefreshConfiguration()

    This API sends a notification to interested network configuration
    agents to retry their configuraton immediately. For example, calling
    this API will cause the DHCP client to contact the DHCP server
    immediately rather than waiting until its timeout has expired.
    The utility of this API is to allow the caller to give a hint to
    the system that the network infrastructure/configuration has changed.
 }

{!
    @enum SCNetworkConnectionFlags
    @discussion Flags that indicate whether the specified network
        nodename/address is reachable, requires a connection,
        requires some user intervention in establishing the
        connection, and whether the calling application must
        initiate the connection using the (TBD???) API.

    @constant kSCNetworkFlagsTransientConnection
        This flag indicates that the specified nodename/address can
        be reached via a transient (e.g. PPP) connection.

    @constant kSCNetworkFlagsReachable
        This flag indicates that the specified nodename/address can
        be reached using the current network configuration.

    @constant kSCNetworkFlagsConnectionRequired
        This flag indicates that the specified nodename/address can
        be reached using the current network configuration but a
        connection must first be established.

        As an example, this status would be returned for a dialup
        connection that was not currently active but could handle
        network traffic for the target system.

    @constant kSCNetworkFlagsConnectionAutomatic
        This flag indicates that the specified nodename/address can
        be reached using the current network configuration but a
        connection must first be established.  Any traffic directed
        to the specified name/address will initiate the connection.

    @constant kSCNetworkFlagsInterventionRequired
        This flag indicates that the specified nodename/address can
        be reached using the current network configuration but a
        connection must first be established.  In addition, some
        form of user intervention will be required to establish
        this connection (e.g. providing a password, authentication
        token, etc.).

    @constant kSCNetworkFlagsIsLocalAddress
        This flag indicates that the specified nodename/address
        is one associated with a network interface on the current
        system.

    @constant kSCNetworkFlagsIsDirect
        This flag indicates that network traffic to the specified
        nodename/address will not go through a gateway but is routed
        directly to one of the interfaces in the system.
 }
type
    SCNetworkConnectionFlags = UInt32;
const
    kSCNetworkFlagsTransientConnection  = 1 shl 0;
    kSCNetworkFlagsReachable        = 1 shl 1;
    kSCNetworkFlagsConnectionRequired   = 1 shl 2;
    kSCNetworkFlagsConnectionAutomatic  = 1 shl 3;
    kSCNetworkFlagsInterventionRequired = 1 shl 4;
    kSCNetworkFlagsIsLocalAddress       = 1 shl 16;
    kSCNetworkFlagsIsDirect         = 1 shl 17;

{!
    @function SCNetworkCheckReachabilityByAddress
    @discussion Determines if the given network address is
        reachable using the current network configuration.
    @param address The network address of the desired host.
    @param addrlen The length, in bytes, of the address.
    @param flags A pointer to memory that will be filled with a
        set of SCNetworkConnectionFlags detailing the reachability
        of the specified address.
    @result TRUE if the network connection flags are valid; FALSE if the
        status could not be determined.
 }
function SCNetworkCheckReachabilityByAddress( address: sockaddr_ptr; addrlen: SInt32; var flags: SCNetworkConnectionFlags ): Boolean; external name '_SCNetworkCheckReachabilityByAddress';

{!
    @function SCNetworkCheckReachabilityByName
    @discussion Determines if the given network host/node name is
        reachable using the current network configuration.
    @param nodename The node name of the desired host. This name would
        be the same as that passed to gethostbyname() or getaddrinfo().
    @param flags A pointer to memory that will be filled with a
        set of SCNetworkConnectionFlags detailing the reachability
        of the specified node name.
    @result TRUE if the network connection flags are valid; FALSE if the
        status could not be determined.
 }
function SCNetworkCheckReachabilityByName( nodename: CStringPtr; var flags: SCNetworkConnectionFlags ): Boolean; external name '_SCNetworkCheckReachabilityByName';
{!
    @function SCNetworkInterfaceRefreshConfiguration
    @discussion Sends a notification to interested configuration agents
        to have them immediately retry their configuration over a
        particular network interface.
        Note: This API must be invoked by root (uid == 0).

    @param ifName The BSD name of the network interface e.g. CFSTR("en0").
    @result TRUE if the notification was sent; FALSE otherwise.
 }
function SCNetworkInterfaceRefreshConfiguration( ifName: CFStringRef ): Boolean; external name '_SCNetworkInterfaceRefreshConfiguration';
{unit SCSI}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}

{ SCSI Manager errors. These are generated by Inside Mac IV calls only. }

const
    scCommErr                   = 2;                            {  communications error, operation timeout  }
    scArbNBErr                  = 3;                            {  arbitration timeout waiting for not BSY  }
    scBadParmsErr               = 4;                            {  bad parameter or TIB opcode  }
    scPhaseErr                  = 5;                            {  SCSI bus not in correct phase for attempted operation  }
    scCompareErr                = 6;                            {  data compare error  }
    scMgrBusyErr                = 7;                            {  SCSI Manager busy   }
    scSequenceErr               = 8;                            {  attempted operation is out of sequence  }
    scBusTOErr                  = 9;                            {  CPU bus timeout  }
    scComplPhaseErr             = 10;                           {  SCSI bus wasn't in Status phase  }

    {    TIB opcodes    }
    scInc                       = 1;
    scNoInc                     = 2;
    scAdd                       = 3;
    scMove                      = 4;
    scLoop                      = 5;
    scNop                       = 6;
    scStop                      = 7;
    scComp                      = 8;

    {
     * All disk partition structures and definitions are now in the
     * AppleDiskPartitions.h/p/a files.
        }
    {    TIB instruction    }

type
    SCSIInstrPtr = ^SCSIInstr;
    SCSIInstr = record
        scOpcode:               UInt16;
        scParam1:               SInt32;
        scParam2:               SInt32;
    end;

    {    SCSI Phases (used by SIMs to support the Original SCSI Manager     }

const
    kDataOutPhase               = 0;                            {  Encoded MSG, C/D, I/O bits  }
    kDataInPhase                = 1;
    kCommandPhase               = 2;
    kStatusPhase                = 3;
    kPhaseIllegal0              = 4;
    kPhaseIllegal1              = 5;
    kMessageOutPhase            = 6;
    kMessageInPhase             = 7;
    kBusFreePhase               = 8;                            {  Additional Phases  }
    kArbitratePhase             = 9;
    kSelectPhase                = 10;
    kMessageInPhaseNACK         = 11;                           {  Message In Phase with ACK hanging on the bus  }



const
    scsiVERSION                 = 43;


    {
     * SCSI Callback Procedure Prototypes. Several of these are only callable
     * from SCSI Manager 4.3 SIM and XPT contexts.
        }

type
    AENCallbackProcPtr = procedure;

    SIMInitProcPtr = function(SIMinfoPtr: Ptr): OSErr;

    SIMActionProcPtr = procedure(scsiPB: UnivPtr; SIMGlobals: Ptr);

    SCSIProcPtr = procedure;

    SCSIMakeCallbackProcPtr = procedure(scsiPB: UnivPtr);

    {    SCSIInterruptPollProcPtr is obsolete (use SCSIInterruptProcPtr) but still here for compatibility   }
    SCSIInterruptPollProcPtr = function(SIMGlobals: Ptr): SInt32;

    SCSIInterruptProcPtr = function(SIMGlobals: Ptr): SInt32;

    AENCallbackUPP = ^SInt32; { an opaque UPP }
    SIMInitUPP = ^SInt32; { an opaque UPP }
    SIMActionUPP = ^SInt32; { an opaque UPP }
    SCSIUPP = ^SInt32; { an opaque UPP }
    SCSIMakeCallbackUPP = ^SInt32; { an opaque UPP }
    SCSIInterruptPollUPP = ^SInt32; { an opaque UPP }
    SCSIInterruptUPP = ^SInt32; { an opaque UPP }

const
    uppAENCallbackProcInfo = $00000001;
    uppSIMInitProcInfo = $000000E1;
    uppSIMActionProcInfo = $000003C1;
    uppSCSIProcInfo = $00000001;
    uppSCSIMakeCallbackProcInfo = $000000C1;
    uppSCSIInterruptPollProcInfo = $000000F1;
    uppSCSIInterruptProcInfo = $000000F1;

{
 * SCSI Completion routine callback for SCSIAction.
 }

type
    SCSICallbackProcPtr = procedure(scsiPB: UnivPtr);

    SCSICallbackUPP = ^SInt32; { an opaque UPP }

const
    uppSCSICallbackProcInfo = $000000C0;
    {
     *  NewSCSICallbackUPP()
     *
     *  Availability:
     *    Non-Carbon CFM:   available as macro/inline
     *    CarbonLib:        in CarbonLib 1.3 and later
     *    Mac OS X:         in version 10.0 and later
        }
function NewSCSICallbackUPP(userRoutine: SCSICallbackProcPtr): SCSICallbackUPP; external name '_NewSCSICallbackUPP'; { old name was NewSCSICallbackProc }
{
 *  DisposeSCSICallbackUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeSCSICallbackUPP(userUPP: SCSICallbackUPP); external name '_DisposeSCSICallbackUPP';
{
 *  InvokeSCSICallbackUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvokeSCSICallbackUPP(scsiPB: UnivPtr; userRoutine: SCSICallbackUPP); external name '_InvokeSCSICallbackUPP'; { old name was CallSCSICallbackProc }
{
   SCSI Manager 4.3 function codes
 }

const
    SCSINop                     = $00;                          {  Execute nothing                           }
    SCSIExecIO                  = $01;                          {  Execute the specified IO                   }
    SCSIBusInquiry              = $03;                          {  Get parameters for entire path of HBAs            }
    SCSIReleaseQ                = $04;                          {  Release the frozen SIM queue for particular LUN       }
    SCSIAbortCommand            = $10;                          {  Abort the selected Control Block              }
    SCSIResetBus                = $11;                          {  Reset the SCSI bus                          }
    SCSIResetDevice             = $12;                          {  Reset the SCSI device                       }
    SCSITerminateIO             = $13;                          {  Terminate any pending IO                     }

    {    Not available in Carbon on X   }
    SCSIGetVirtualIDInfo        = $80;                          {  Find out which bus old ID is on                 }
    SCSILoadDriver              = $82;                          {  Load a driver for a device ident              }
    SCSIOldCall                 = $84;                          {  XPT->SIM private call for old-API             }
    SCSICreateRefNumXref        = $85;                          {  Register a DeviceIdent to drvr RefNum xref           }
    SCSILookupRefNumXref        = $86;                          {  Get DeviceIdent to drvr RefNum xref               }
    SCSIRemoveRefNumXref        = $87;                          {  Remove a DeviceIdent to drvr RefNum xref         }
    SCSIRegisterWithNewXPT      = $88;                          {  XPT has changed - SIM needs to re-register itself   }

    vendorUnique                = $C0;                          {  0xC0 thru 0xFF  }


    {    Allocation length defines for some of the fields   }
    handshakeDataLength         = 8;                            {  Handshake data length  }
    maxCDBLength                = 16;                           {  Space for the CDB bytes/pointer  }
    vendorIDLength              = 16;                           {  ASCII string len for Vendor ID   }

    {    Define DeviceIdent structure   }

type
    DeviceIdentPtr = ^DeviceIdent;
    DeviceIdent = packed record
        diReserved:             UInt8;                                  {  reserved            }
        bus:                    UInt8;                                  {  SCSI - Bus Number    }
        targetID:               UInt8;                                  {  SCSI - Target SCSI ID   }
        LUN:                    UInt8;                                  {  SCSI - LUN             }
    end;

    {    Constants for the diReserved field of DeviceIdent  }
    {    used to distinguish whether the DeviceIdent holds  }
    {    information about a SCSI device (kBusTypeSCSI)     }
    {    or an ATA device (kBusTypeATA).  The other         }
    {    constants are pretty much deprecated.  Let me      }
    {    know if you see any.                               }

const
    kBusTypeSCSI                = 0;
    kBusTypeATA                 = 1;
    kBusTypePCMCIA              = 2;
    kBusTypeMediaBay            = 3;

    {    If diReserved indicates that a DeviceIdent is      }
    {    really for ATA, you can cast it to DeviceIdentATA  }
    {    to get at the important fields.                    }

type
    DeviceIdentATAPtr = ^DeviceIdentATA;
    DeviceIdentATA = record
        diReserved:             SInt8;
        busNum:                 SInt8;
        devNum:                 SInt8;
        diReserved2:            SInt8;
    end;

    {  for use with Apple Patch Driver used during booting }
    PatchDescriptorPtr = ^PatchDescriptor;
    PatchDescriptor = record
        patchSig:               OSType;                                 {  The patches signature                 }
        majorVers:              UInt16;                                 {  The major version number of the       }
                                                                        {  patch                                 }
        minorVers:              UInt16;                                 {  The minor version number of the       }
                                                                        {  patch                                 }
        flags:                  UInt32;                                 {  Reqired/Optional, etc.                }
        patchOffset:            UInt32;                                 {  Block offset to the beginning of      }
                                                                        {  the patch                             }
        patchSize:              UInt32;                                 {  Actual size of the patch in bytes     }
        patchCRC:               UInt32;                                 {  As calculated by the SCSI drivers     }
                                                                        {  CRC code                              }
        patchDescriptorLen:     UInt32;                                 {  Total length of the descriptor        }
                                                                        {  (must be >= 61 bytes)                 }
        patchName:              Str32;                                  {  Pascal string with a short            }
                                                                        {  description of the patch              }
        patchVendor:            SInt8;                                  {  The first byte of a pascal string     }
                                                                        {  for the patch Vendor. Any amount      }
                                                                        {  of data may follow the string.        }
    end;

    {    Constants for the flags field of PatchDescriptor.  }

const
    kRequiredPatch              = $00000001;                    {  Patch must succeed to continue booting.  }



type
    PatchListPtr = ^PatchList;
    PatchList = record
        numPatchBlocks:         UInt16;                                 {  The number of disk blocks         }
                                                                        {  to hold patch descriptions        }
        numPatches:             UInt16;                                 {  The number of patches             }
        thePatch:               array [0..0] of PatchDescriptor;        {  An array with one patch           }
                                                                        {  per element                       }
    end;

    {  signature of a Patch entry point }
    PatchEntryPoint = function(var myPatch: PatchDescriptor; myDevID: DeviceIdent): OSErr;



    {    Command Descriptor Block structure     }
    CDBPtr = ^CDB;
    CDB = record
        case SInt16 of
        0: (
            cdbPtr:             BytePtr;                                {  pointer to the CDB, or  }
            );
        1: (
            cdbBytes:           packed array [0..15] of UInt8;          {  the actual CDB to send  }
            );
    end;

    {    Scatter/gather list element (Deprecated for MacOS8)    }
    SGRecordPtr = ^SGRecord;
    SGRecord = record
        SGAddr:                 Ptr;
        SGCount:                UInt32;
    end;

    SCSIHdrPtr = ^SCSIHdr;
    SCSIHdr = record
        qLink:                  SCSIHdrPtr;                             {  (internal use, must be nil on entry)    }
        scsiReserved1:          SInt16;                             {  ->     reserved for input           }
        scsiPBLength:           UInt16;                                 {  -> Length of the entire PB         }
        scsiFunctionCode:       SInt8;                                  {  -> function selector            }
        scsiReserved2:          SInt8;                                  {  <-     reserved for output           }
        scsiResult:             OSErr;                                  {  <- Returned result                }
        scsiDevice:             DeviceIdent;                            {  -> Device Identifier (bus+target+lun) }
        scsiCompletion:         SCSICallbackUPP;                        {  -> Callback on completion function      }
        scsiFlags:              UInt32;                                 {  -> assorted flags             }
        scsiDriverStorage:      BytePtr;                                {  <> Ptr for driver private use    }
        scsiXPTprivate:         Ptr;                                    {  private field for use in XPT       }
        scsiReserved3:          SInt32;                             {  reserved                     }
    end;

    SCSI_PBPtr = ^SCSI_PB;
    SCSI_PB = record
        qLink:                  SCSIHdrPtr;                             {  (internal use, must be nil on entry)    }
        scsiReserved1:          SInt16;                             {  ->     reserved for input           }
        scsiPBLength:           UInt16;                                 {  -> Length of the entire PB         }
        scsiFunctionCode:       SInt8;                                  {  -> function selector            }
        scsiReserved2:          SInt8;                                  {  <-     reserved for output           }
        scsiResult:             OSErr;                                  {  <- Returned result                }
        scsiDevice:             DeviceIdent;                            {  -> Device Identifier (bus+target+lun) }
        scsiCompletion:         SCSICallbackUPP;                        {  -> Callback on completion function      }
        scsiFlags:              UInt32;                                 {  -> assorted flags             }
        scsiDriverStorage:      BytePtr;                                {  <> Ptr for driver private use    }
        scsiXPTprivate:         Ptr;                                    {  private field for use in XPT       }
        scsiReserved3:          SInt32;                             {  reserved                     }
    end;

    SCSI_IOPtr = ^SCSI_IO;
    SCSI_IO = record
        qLink:                  SCSIHdrPtr;                             {  (internal use, must be nil on entry)    }
        scsiReserved1:          SInt16;                             {  ->     reserved for input           }
        scsiPBLength:           UInt16;                                 {  -> Length of the entire PB         }
        scsiFunctionCode:       SInt8;                                  {  -> function selector            }
        scsiReserved2:          SInt8;                                  {  <-     reserved for output           }
        scsiResult:             OSErr;                                  {  <- Returned result                }
        scsiDevice:             DeviceIdent;                            {  -> Device Identifier (bus+target+lun) }
        scsiCompletion:         SCSICallbackUPP;                        {  -> Callback on completion function      }
        scsiFlags:              UInt32;                                 {  -> assorted flags             }
        scsiDriverStorage:      BytePtr;                                {  <> Ptr for driver private use    }
        scsiXPTprivate:         Ptr;                                    {  private field for use in XPT       }
        scsiReserved3:          SInt32;                             {  reserved                     }
        scsiResultFlags:        UInt16;                                 {  <- Flags which modify the scsiResult field      }
        scsiReserved3pt5:       UInt16;                                 {  -> Reserved                            }
        scsiDataPtr:            BytePtr;                                {  -> Pointer to the data buffer or the S/G list       }
        scsiDataLength:         UInt32;                                 {  -> Data transfer length                    }
        scsiSensePtr:           BytePtr;                                {  -> Ptr to autosense data buffer             }
        scsiSenseLength:        SInt8;                                  {  -> size of the autosense buffer               }
        scsiCDBLength:          SInt8;                                  {  -> Number of bytes for the CDB                }
        scsiSGListCount:        UInt16;                                 {  -> num of scatter gather list entries            }
        scsiReserved4:          UInt32;                                 {  <-     reserved for output                    }
        scsiSCSIstatus:         SInt8;                                  {  <- Returned scsi device status                }
        scsiSenseResidual:      SInt8;                                  {  <- Autosense residual length              }
        scsiReserved5:          UInt16;                                 {  <-     reserved for output                  }
        scsiDataResidual:       SInt32;                             {  <- Returned Transfer residual length           }
        scsiCDB:                CDB;                                    {  -> Actual CDB or pointer to CDB             }
        scsiTimeout:            SInt32;                             {  -> Timeout value (Time Mgr format) (CAM timeout)  }
        scsiReserved5pt5:       BytePtr;                                {  -> Reserved                            }
        scsiReserved5pt6:       UInt16;                                 {  -> Reserved                            }
        scsiIOFlags:            UInt16;                                 {  -> additional I/O flags                       }
        scsiTagAction:          SInt8;                                  {  -> What to do for tag queuing                 }
        scsiReserved6:          SInt8;                                  {  ->     reserved for input                    }
        scsiReserved7:          UInt16;                                 {  ->     reserved for input                    }
        scsiSelectTimeout:      UInt16;                                 {  -> Select timeout value                  }
        scsiDataType:           SInt8;                                  {  -> Data description type (i.e. buffer, TIB, S/G)    }
        scsiTransferType:       SInt8;                                  {  -> Transfer type (i.e. Blind vs Polled)        }
        scsiReserved8:          UInt32;                                 {  ->     reserved for input                   }
        scsiReserved9:          UInt32;                                 {  ->     reserved for input                   }
        scsiHandshake:          array [0..7] of UInt16;                 {  -> handshaking points (null term'd)     }
        scsiReserved10:         UInt32;                                 {  ->     reserved for input                   }
        scsiReserved11:         UInt32;                                 {  ->   reserved for input                    }
        scsiCommandLink:        SCSI_IOPtr;                             {  -> Ptr to the next PB in linked cmd chain       }
        scsiSIMpublics:         packed array [0..7] of UInt8;           {  ->     reserved for input to 3rd-party SIMs      }
        scsiAppleReserved6:     packed array [0..7] of UInt8;           {  -> reserved for input                      }
                                                                        {  XPT layer privates (for old-API emulation)  }
        scsiCurrentPhase:       UInt16;                                 {  <- phase upon completing old call             }
        scsiSelector:           SInt16;                             {  -> selector specified in old calls             }
        scsiOldCallResult:      OSErr;                                  {  <- result of old call                      }
        scsiSCSImessage:        SInt8;                                  {  <- Returned scsi device message (for SCSIComplete) }
        XPTprivateFlags:        SInt8;                                  {  <> various flags                        }
        XPTextras:              packed array [0..11] of UInt8;          {                                }
    end;

    SCSIExecIOPB                        = SCSI_IO;
    SCSIExecIOPBPtr                     = ^SCSIExecIOPB;
    {    Bus inquiry PB     }
    SCSIBusInquiryPBPtr = ^SCSIBusInquiryPB;
    SCSIBusInquiryPB = record
        qLink:                  SCSIHdrPtr;                             {  (internal use, must be nil on entry)    }
        scsiReserved1:          SInt16;                             {  ->     reserved for input           }
        scsiPBLength:           UInt16;                                 {  -> Length of the entire PB         }
        scsiFunctionCode:       SInt8;                                  {  -> function selector            }
        scsiReserved2:          SInt8;                                  {  <-     reserved for output           }
        scsiResult:             OSErr;                                  {  <- Returned result                }
        scsiDevice:             DeviceIdent;                            {  -> Device Identifier (bus+target+lun) }
        scsiCompletion:         SCSICallbackUPP;                        {  -> Callback on completion function      }
        scsiFlags:              UInt32;                                 {  -> assorted flags             }
        scsiDriverStorage:      BytePtr;                                {  <> Ptr for driver private use    }
        scsiXPTprivate:         Ptr;                                    {  private field for use in XPT       }
        scsiReserved3:          SInt32;                             {  reserved                     }
        scsiEngineCount:        UInt16;                                 {  <- Number of engines on HBA                 }
        scsiMaxTransferType:    UInt16;                                 {  <- Number of transfer types for this HBA       }
        scsiDataTypes:          UInt32;                                 {  <- which data types are supported by this SIM   }
        scsiIOpbSize:           UInt16;                                 {  <- Size of SCSI_IO PB for this SIM/HBA           }
        scsiMaxIOpbSize:        UInt16;                                 {  <- Size of max SCSI_IO PB for all SIM/HBAs         }
        scsiFeatureFlags:       UInt32;                                 {  <- Supported features flags field            }
        scsiVersionNumber:      SInt8;                                  {  <- Version number for the SIM/HBA            }
        scsiHBAInquiry:         SInt8;                                  {  <- Mimic of INQ byte 7 for the HBA            }
        scsiTargetModeFlags:    SInt8;                                  {  <- Flags for target mode support            }
        scsiScanFlags:          SInt8;                                  {  <- Scan related feature flags             }
        scsiSIMPrivatesPtr:     UInt32;                                 {  <- Ptr to SIM private data area               }
        scsiSIMPrivatesSize:    UInt32;                                 {  <- Size of SIM private data area            }
        scsiAsyncFlags:         UInt32;                                 {  <- Event cap. for Async Callback            }
        scsiHiBusID:            SInt8;                                  {  <- Highest path ID in the subsystem          }
        scsiInitiatorID:        SInt8;                                  {  <- ID of the HBA on the SCSI bus            }
        scsiBIReserved0:        UInt16;                                 {                                    }
        scsiBIReserved1:        UInt32;                                 {  <-                                 }
        scsiFlagsSupported:     UInt32;                                 {  <- which scsiFlags are supported            }
        scsiIOFlagsSupported:   UInt16;                                 {  <- which scsiIOFlags are supported            }
        scsiWeirdStuff:         UInt16;                                 {  <-                                }
        scsiMaxTarget:          UInt16;                                 {  <- maximum Target number supported            }
        scsiMaxLUN:             UInt16;                                 {  <- maximum Logical Unit number supported     }
        scsiSIMVendor:          packed array [0..15] of char;           {  <- Vendor ID of SIM (or XPT if bus<FF)         }
        scsiHBAVendor:          packed array [0..15] of char;           {  <- Vendor ID of the HBA                 }
        scsiControllerFamily:   packed array [0..15] of char;           {  <- Family of SCSI Controller            }
        scsiControllerType:     packed array [0..15] of char;           {  <- Specific Model of SCSI Controller used   }
        scsiXPTversion:         packed array [0..3] of char;            {  <- version number of XPT               }
        scsiSIMversion:         packed array [0..3] of char;            {  <- version number of SIM               }
        scsiHBAversion:         packed array [0..3] of char;            {  <- version number of HBA               }
        scsiHBAslotType:        SInt8;                                  {  <- type of "slot" that this HBA is in        }
        scsiHBAslotNumber:      SInt8;                                  {  <- slot number of this HBA                   }
        scsiSIMsRsrcID:         UInt16;                                 {  <- resource ID of this SIM                   }
        scsiBIReserved3:        UInt16;                                 {  <-                                }
        scsiAdditionalLength:   UInt16;                                 {  <- additional BusInquiry PB len               }
    end;

    {    Abort SIM Request PB   }
    SCSIAbortCommandPBPtr = ^SCSIAbortCommandPB;
    SCSIAbortCommandPB = record
        qLink:                  SCSIHdrPtr;                             {  (internal use, must be nil on entry)    }
        scsiReserved1:          SInt16;                             {  ->     reserved for input           }
        scsiPBLength:           UInt16;                                 {  -> Length of the entire PB         }
        scsiFunctionCode:       SInt8;                                  {  -> function selector            }
        scsiReserved2:          SInt8;                                  {  <-     reserved for output           }
        scsiResult:             OSErr;                                  {  <- Returned result                }
        scsiDevice:             DeviceIdent;                            {  -> Device Identifier (bus+target+lun) }
        scsiCompletion:         SCSICallbackUPP;                        {  -> Callback on completion function      }
        scsiFlags:              UInt32;                                 {  -> assorted flags             }
        scsiDriverStorage:      BytePtr;                                {  <> Ptr for driver private use    }
        scsiXPTprivate:         Ptr;                                    {  private field for use in XPT       }
        scsiReserved3:          SInt32;                             {  reserved                     }
        scsiIOptr:              SCSI_IOPtr;                             {  Pointer to the PB to abort         }
    end;

    {    Terminate I/O Process Request PB   }
    SCSITerminateIOPBPtr = ^SCSITerminateIOPB;
    SCSITerminateIOPB = record
        qLink:                  SCSIHdrPtr;                             {  (internal use, must be nil on entry)    }
        scsiReserved1:          SInt16;                             {  ->     reserved for input           }
        scsiPBLength:           UInt16;                                 {  -> Length of the entire PB         }
        scsiFunctionCode:       SInt8;                                  {  -> function selector            }
        scsiReserved2:          SInt8;                                  {  <-     reserved for output           }
        scsiResult:             OSErr;                                  {  <- Returned result                }
        scsiDevice:             DeviceIdent;                            {  -> Device Identifier (bus+target+lun) }
        scsiCompletion:         SCSICallbackUPP;                        {  -> Callback on completion function      }
        scsiFlags:              UInt32;                                 {  -> assorted flags             }
        scsiDriverStorage:      BytePtr;                                {  <> Ptr for driver private use    }
        scsiXPTprivate:         Ptr;                                    {  private field for use in XPT       }
        scsiReserved3:          SInt32;                             {  reserved                     }
        scsiIOptr:              SCSI_IOPtr;                             {  Pointer to the PB to terminate         }
    end;

    {    Reset SCSI Bus PB  }
    SCSIResetBusPBPtr = ^SCSIResetBusPB;
    SCSIResetBusPB = record
        qLink:                  SCSIHdrPtr;                             {  (internal use, must be nil on entry)    }
        scsiReserved1:          SInt16;                             {  ->     reserved for input           }
        scsiPBLength:           UInt16;                                 {  -> Length of the entire PB         }
        scsiFunctionCode:       SInt8;                                  {  -> function selector            }
        scsiReserved2:          SInt8;                                  {  <-     reserved for output           }
        scsiResult:             OSErr;                                  {  <- Returned result                }
        scsiDevice:             DeviceIdent;                            {  -> Device Identifier (bus+target+lun) }
        scsiCompletion:         SCSICallbackUPP;                        {  -> Callback on completion function      }
        scsiFlags:              UInt32;                                 {  -> assorted flags             }
        scsiDriverStorage:      BytePtr;                                {  <> Ptr for driver private use    }
        scsiXPTprivate:         Ptr;                                    {  private field for use in XPT       }
        scsiReserved3:          SInt32;                             {  reserved                     }
    end;

    {    Reset SCSI Device PB   }
    SCSIResetDevicePBPtr = ^SCSIResetDevicePB;
    SCSIResetDevicePB = record
        qLink:                  SCSIHdrPtr;                             {  (internal use, must be nil on entry)    }
        scsiReserved1:          SInt16;                             {  ->     reserved for input           }
        scsiPBLength:           UInt16;                                 {  -> Length of the entire PB         }
        scsiFunctionCode:       SInt8;                                  {  -> function selector            }
        scsiReserved2:          SInt8;                                  {  <-     reserved for output           }
        scsiResult:             OSErr;                                  {  <- Returned result                }
        scsiDevice:             DeviceIdent;                            {  -> Device Identifier (bus+target+lun) }
        scsiCompletion:         SCSICallbackUPP;                        {  -> Callback on completion function      }
        scsiFlags:              UInt32;                                 {  -> assorted flags             }
        scsiDriverStorage:      BytePtr;                                {  <> Ptr for driver private use    }
        scsiXPTprivate:         Ptr;                                    {  private field for use in XPT       }
        scsiReserved3:          SInt32;                             {  reserved                     }
    end;

    {    Release SIM Queue PB   }
    SCSIReleaseQPBPtr = ^SCSIReleaseQPB;
    SCSIReleaseQPB = record
        qLink:                  SCSIHdrPtr;                             {  (internal use, must be nil on entry)    }
        scsiReserved1:          SInt16;                             {  ->     reserved for input           }
        scsiPBLength:           UInt16;                                 {  -> Length of the entire PB         }
        scsiFunctionCode:       SInt8;                                  {  -> function selector            }
        scsiReserved2:          SInt8;                                  {  <-     reserved for output           }
        scsiResult:             OSErr;                                  {  <- Returned result                }
        scsiDevice:             DeviceIdent;                            {  -> Device Identifier (bus+target+lun) }
        scsiCompletion:         SCSICallbackUPP;                        {  -> Callback on completion function      }
        scsiFlags:              UInt32;                                 {  -> assorted flags             }
        scsiDriverStorage:      BytePtr;                                {  <> Ptr for driver private use    }
        scsiXPTprivate:         Ptr;                                    {  private field for use in XPT       }
        scsiReserved3:          SInt32;                             {  reserved                     }
    end;

    {    SCSI Get Virtual ID Info PB    }
    SCSIGetVirtualIDInfoPBPtr = ^SCSIGetVirtualIDInfoPB;
    SCSIGetVirtualIDInfoPB = record
        qLink:                  SCSIHdrPtr;                             {  (internal use, must be nil on entry)    }
        scsiReserved1:          SInt16;                             {  ->     reserved for input           }
        scsiPBLength:           UInt16;                                 {  -> Length of the entire PB         }
        scsiFunctionCode:       SInt8;                                  {  -> function selector            }
        scsiReserved2:          SInt8;                                  {  <-     reserved for output           }
        scsiResult:             OSErr;                                  {  <- Returned result                }
        scsiDevice:             DeviceIdent;                            {  -> Device Identifier (bus+target+lun) }
        scsiCompletion:         SCSICallbackUPP;                        {  -> Callback on completion function      }
        scsiFlags:              UInt32;                                 {  -> assorted flags             }
        scsiDriverStorage:      Ptr;                                    {  <> Ptr for driver private use    }
        scsiXPTprivate:         Ptr;                                    {  private field for use in XPT       }
        scsiReserved3:          SInt32;                             {  reserved                     }
        scsiOldCallID:          UInt16;                                 {  -> SCSI ID of device in question    }
        scsiExists:             boolean;                                {  <- true if device exists         }
        filler:                 SInt8;
    end;

    {    Create/Lookup/Remove RefNum for Device PB  }
    SCSIDriverPBPtr = ^SCSIDriverPB;
    SCSIDriverPB = record
        qLink:                  SCSIHdrPtr;                             {  (internal use, must be nil on entry)    }
        scsiReserved1:          SInt16;                             {  ->     reserved for input           }
        scsiPBLength:           UInt16;                                 {  -> Length of the entire PB         }
        scsiFunctionCode:       SInt8;                                  {  -> function selector            }
        scsiReserved2:          SInt8;                                  {  <-     reserved for output           }
        scsiResult:             OSErr;                                  {  <- Returned result                }
        scsiDevice:             DeviceIdent;                            {  -> Device Identifier (bus+target+lun) }
        scsiCompletion:         SCSICallbackUPP;                        {  -> Callback on completion function      }
        scsiFlags:              UInt32;                                 {  -> assorted flags             }
        scsiDriverStorage:      Ptr;                                    {  <> Ptr for driver private use    }
        scsiXPTprivate:         Ptr;                                    {  private field for use in XPT       }
        scsiReserved3:          SInt32;                             {  reserved                     }
        scsiDriver:             SInt16;                             {  -> DriverRefNum, For SetDriver, <- For GetNextDriver  }
        scsiDriverFlags:        UInt16;                                 {  <> Details of driver/device        }
        scsiNextDevice:         DeviceIdent;                            {  <- DeviceIdent of the NEXT Item in the list   }
    end;

    {    Load Driver PB     }
    SCSILoadDriverPBPtr = ^SCSILoadDriverPB;
    SCSILoadDriverPB = record
        qLink:                  SCSIHdrPtr;                             {  (internal use, must be nil on entry)    }
        scsiReserved1:          SInt16;                             {  ->     reserved for input           }
        scsiPBLength:           UInt16;                                 {  -> Length of the entire PB         }
        scsiFunctionCode:       SInt8;                                  {  -> function selector            }
        scsiReserved2:          SInt8;                                  {  <-     reserved for output           }
        scsiResult:             OSErr;                                  {  <- Returned result                }
        scsiDevice:             DeviceIdent;                            {  -> Device Identifier (bus+target+lun) }
        scsiCompletion:         SCSICallbackUPP;                        {  -> Callback on completion function      }
        scsiFlags:              UInt32;                                 {  -> assorted flags             }
        scsiDriverStorage:      Ptr;                                    {  <> Ptr for driver private use    }
        scsiXPTprivate:         Ptr;                                    {  private field for use in XPT       }
        scsiReserved3:          SInt32;                             {  reserved                     }
        scsiLoadedRefNum:       SInt16;                             {  <- SIM returns refnum of driver       }
        scsiDiskLoadFailed:     boolean;                                {  -> if true, indicates call after failure to load  }
        filler:                 SInt8;
    end;


    {    Defines for the scsiTransferType field     }

const
    scsiTransferBlind           = 0;
    scsiTransferPolled          = 1;

    scsiErrorBase               = -7936;

    scsiRequestInProgress       = 1;                            {  1   = PB request is in progress           }
                                                                {  Execution failed  00-2F  }
    scsiRequestAborted          = -7934;                        {  -7934 = PB request aborted by the host         }
    scsiUnableToAbort           = -7933;                        {  -7933 = Unable to Abort PB request           }
    scsiNonZeroStatus           = -7932;                        {  -7932 = PB request completed with an err    }
    scsiUnused05                = -7931;                        {  -7931 =                         }
    scsiUnused06                = -7930;                        {  -7930 =                         }
    scsiUnused07                = -7929;                        {  -7929 =                         }
    scsiUnused08                = -7928;                        {  -7928 =                         }
    scsiUnableToTerminate       = -7927;                        {  -7927 = Unable to Terminate I/O PB req         }
    scsiSelectTimeout           = -7926;                        {  -7926 = Target selection timeout         }
    scsiCommandTimeout          = -7925;                        {  -7925 = Command timeout               }
    scsiIdentifyMessageRejected = -7924;                        {  -7924 =                         }
    scsiMessageRejectReceived   = -7923;                        {  -7923 = Message reject received            }
    scsiSCSIBusReset            = -7922;                        {  -7922 = SCSI bus reset sent/received     }
    scsiParityError             = -7921;                        {  -7921 = Uncorrectable parity error occured      }
    scsiAutosenseFailed         = -7920;                        {  -7920 = Autosense: Request sense cmd fail   }
    scsiUnused11                = -7919;                        {  -7919 =                         }
    scsiDataRunError            = -7918;                        {  -7918 = Data overrun/underrun error      }
    scsiUnexpectedBusFree       = -7917;                        {  -7917 = Unexpected BUS free               }
    scsiSequenceFailed          = -7916;                        {  -7916 = Target bus phase sequence failure   }
    scsiWrongDirection          = -7915;                        {  -7915 = Data phase was in wrong direction   }
    scsiUnused16                = -7914;                        {  -7914 =                         }
    scsiBDRsent                 = -7913;                        {  -7913 = A SCSI BDR msg was sent to target   }
    scsiTerminated              = -7912;                        {  -7912 = PB request terminated by the host   }
    scsiNoNexus                 = -7911;                        {  -7911 = Nexus is not established         }
    scsiCDBReceived             = -7910;                        {  -7910 = The SCSI CDB has been received         }
                                                                {  Couldn't begin execution  30-3F  }
    scsiTooManyBuses            = -7888;                        {  -7888 = Register failed because we're full  }
    scsiBusy                    = -7887;                        {  -7887 = SCSI subsystem is busy            }
    scsiProvideFail             = -7886;                        {  -7886 = Unable to provide requ. capability  }
    scsiDeviceNotThere          = -7885;                        {  -7885 = SCSI device not installed/there     }
    scsiNoHBA                   = -7884;                        {  -7884 = No HBA detected Error            }
    scsiDeviceConflict          = -7883;                        {  -7883 = sorry, max 1 refNum per DeviceIdent     }
    scsiNoSuchXref              = -7882;                        {  -7882 = no such RefNum xref               }
    scsiQLinkInvalid            = -7881;                        {  -7881 = pre-linked PBs not supported       }
                                                                {    (The QLink field was nonzero)           }
                                                                {  Parameter errors  40-7F  }
    scsiPBLengthError           = -7872;                        {  -7872 = (scsiPBLength is insuf'ct/invalid   }
    scsiFunctionNotAvailable    = -7871;                        {  -7871 = The requ. func is not available     }
    scsiRequestInvalid          = -7870;                        {  -7870 = PB request is invalid            }
    scsiBusInvalid              = -7869;                        {  -7869 = Bus ID supplied is invalid         }
    scsiTIDInvalid              = -7868;                        {  -7868 = Target ID supplied is invalid       }
    scsiLUNInvalid              = -7867;                        {  -7867 = LUN supplied is invalid          }
    scsiIDInvalid               = -7866;                        {  -7866 = The initiator ID is invalid      }
    scsiDataTypeInvalid         = -7865;                        {  -7865 = scsiDataType requested not supported  }
    scsiTransferTypeInvalid     = -7864;                        {  -7864 = scsiTransferType field is too high      }
    scsiCDBLengthInvalid        = -7863;                        {  -7863 = scsiCDBLength field is too big         }

    {    New errors for SCSI Family             }
    scsiUnused74                = -7862;                        {  -7862 =                           }
    scsiUnused75                = -7861;                        {  -7861 =                           }
    scsiBadDataLength           = -7860;                        {  -7860 = a zero data length in PB         }
    scsiPartialPrepared         = -7859;                        {  -7859 = could not do full prepare mem for I/O }
    scsiInvalidMsgType          = -7858;                        {  -7858 = Invalid message type (internal)        }
    scsiUnused79                = -7857;                        {  -7857 =                               }
    scsiBadConnID               = -7856;                        {  -7856 = Bad Connection ID                 }
    scsiUnused81                = -7855;                        {  -7855 =                           }
    scsiIOInProgress            = -7854;                        {  -7854 = Can't close conn, IO in prog       }
    scsiTargetReserved          = -7853;                        {  -7853 = Target already reserved           }
    scsiUnused84                = -7852;                        {  -7852 =                           }
    scsiUnused85                = -7851;                        {  -7851 =                           }
    scsiBadConnType             = -7850;                        {  -7850 = Bad connection type               }
    scsiCannotLoadPlugin        = -7849;                        {  -7849 = No matching service category       }

    {    +++    }
    {
     * scsiFamilyInternalError and scsiPluginInternalError are intended to handle consistency check failures.
     * For example, if the family stores a record on a lookaside queue, but does not find that record
     * it can use this error to report this failure. SCSI Manager 4.3 uses dsIOCoreErr in a few places,
     * but this is probably not the best error. In general, internal errors should be reported as bugs.
     *
     * The following range of errors is provided for third-party (non-Apple) SCSI SIM and device driver vendors.
     * In general, they would be used for error conditions that are not covered by the standardized errors.
     * They should not normally be conveyed to normal applications, but might be used for communication between
     * a plug-in and a vendor-provided device driver (for example, to manage RAID hot-swapping).
     *
     * Note: I don't know how many SCSI errors are reserved in the error code architecture. Don't assume that
     * we'll actually get sixteen, but we should reserve at least one.
        }
    scsiFamilyInternalError     = -7849;                        {  -7849 = Internal consistency check failed   }
    scsiPluginInternalError     = -7848;                        {  -7848 = Internal consistency check failed   }
    scsiVendorSpecificErrorBase = -7808;                        {  ??    = Start of third-party error range      }
    scsiVendorSpecificErrorCount = 16;                          {  Number of third-party errors              }

    {    ---    }
    scsiExecutionErrors         = -7936;
    scsiNotExecutedErrors       = -7888;
    scsiParameterErrors         = -7872;

    {    Defines for the scsiResultFlags field  }
    scsiSIMQFrozen              = $0001;                        {  The SIM queue is frozen w/this err         }
    scsiAutosenseValid          = $0002;                        {  Autosense data valid for target          }
    scsiBusNotFree              = $0004;                        {  At time of callback, SCSI bus is not free   }

    {    Defines for the bit numbers of the scsiFlags field in the PB header for the SCSIExecIO function    }
    kbSCSIDisableAutosense      = 29;                           {  Disable auto sense feature                }
    kbSCSIFlagReservedA         = 28;                           {                               }
    kbSCSIFlagReserved0         = 27;                           {                               }
    kbSCSICDBLinked             = 26;                           {  The PB contains a linked CDB              }
    kbSCSIQEnable               = 25;                           {  Target queue actions are enabled           }
    kbSCSICDBIsPointer          = 24;                           {  The CDB field contains a pointer           }
    kbSCSIFlagReserved1         = 23;                           {                                 }
    kbSCSIInitiateSyncData      = 22;                           {  Attempt Sync data xfer and SDTR           }
    kbSCSIDisableSyncData       = 21;                           {  Disable sync, go to async             }
    kbSCSISIMQHead              = 20;                           {  Place PB at the head of SIM Q           }
    kbSCSISIMQFreeze            = 19;                           {  Return the SIM Q to frozen state           }
    kbSCSISIMQNoFreeze          = 18;                           {  Disallow SIM Q freezing                  }
    kbSCSIDoDisconnect          = 17;                           {  Definitely do disconnect                }
    kbSCSIDontDisconnect        = 16;                           {  Definitely don't disconnect               }
    kbSCSIDataReadyForDMA       = 15;                           {  Data buffer(s) are ready for DMA           }
    kbSCSIFlagReserved3         = 14;                           {                                 }
    kbSCSIDataPhysical          = 13;                           {  SG/Buffer data ptrs are physical           }
    kbSCSISensePhysical         = 12;                           {  Autosense buffer ptr is physical           }
    kbSCSIFlagReserved5         = 11;                           {                                 }
    kbSCSIFlagReserved6         = 10;                           {                                 }
    kbSCSIFlagReserved7         = 9;                            {                                 }
    kbSCSIFlagReserved8         = 8;                            {                                 }
    kbSCSIDataBufferValid       = 7;                            {  Data buffer valid                  }
    kbSCSIStatusBufferValid     = 6;                            {  Status buffer valid                  }
    kbSCSIMessageBufferValid    = 5;                            {  Message buffer valid                 }
    kbSCSIFlagReserved9         = 4;                            {                               }

    {    Defines for the bit masks of the scsiFlags field   }
    scsiDirectionMask           = $C0000000;                    {  Data direction mask                  }
    scsiDirectionNone           = $C0000000;                    {  Data direction (11: no data)           }
    scsiDirectionReserved       = $00000000;                    {  Data direction (00: reserved)        }
    scsiDirectionOut            = $80000000;                    {  Data direction (10: DATA OUT)        }
    scsiDirectionIn             = $40000000;                    {  Data direction (01: DATA IN)           }
    scsiDisableAutosense        = $20000000;                    {  Disable auto sense feature           }
    scsiFlagReservedA           = $10000000;                    {                             }
    scsiFlagReserved0           = $08000000;                    {                             }
    scsiCDBLinked               = $04000000;                    {  The PB contains a linked CDB           }
    scsiQEnable                 = $02000000;                    {  Target queue actions are enabled       }
    scsiCDBIsPointer            = $01000000;                    {  The CDB field contains a pointer       }
    scsiFlagReserved1           = $00800000;                    {                             }
    scsiInitiateSyncData        = $00400000;                    {  Attempt Sync data xfer and SDTR          }
    scsiDisableSyncData         = $00200000;                    {  Disable sync, go to async           }
    scsiSIMQHead                = $00100000;                    {  Place PB at the head of SIM Q        }
    scsiSIMQFreeze              = $00080000;                    {  Return the SIM Q to frozen state       }
    scsiSIMQNoFreeze            = $00040000;                    {  Disallow SIM Q freezing               }
    scsiDoDisconnect            = $00020000;                    {  Definitely do disconnect              }
    scsiDontDisconnect          = $00010000;                    {  Definitely don't disconnect           }
    scsiDataReadyForDMA         = $00008000;                    {  Data buffer(s) are ready for DMA       }
    scsiFlagReserved3           = $00004000;                    {    }
    scsiDataPhysical            = $00002000;                    {  SG/Buffer data ptrs are physical       }
    scsiSensePhysical           = $00001000;                    {  Autosense buffer ptr is physical       }
    scsiFlagReserved5           = $00000800;                    {                           }
    scsiFlagReserved6           = $00000400;                    {                             }
    scsiFlagReserved7           = $00000200;                    {                             }
    scsiFlagReserved8           = $00000100;                    {                             }

    {    bit masks for the scsiIOFlags field in SCSIExecIOPB    }
    scsiNoParityCheck           = $0002;                        {  disable parity checking                  }
    scsiDisableSelectWAtn       = $0004;                        {  disable select w/Atn                     }
    scsiSavePtrOnDisconnect     = $0008;                        {  do SaveDataPointer upon Disconnect msg           }
    scsiNoBucketIn              = $0010;                        {  donÕt bit bucket in during this I/O            }
    scsiNoBucketOut             = $0020;                        {  donÕt bit bucket out during this I/O         }
    scsiDisableWide             = $0040;                        {  disable wide transfer negotiation            }
    scsiInitiateWide            = $0080;                        {  initiate wide transfer negotiation            }
    scsiRenegotiateSense        = $0100;                        {  renegotiate sync/wide before issuing autosense      }
    scsiDisableDiscipline       = $0200;                        {  disable parameter checking on SCSIExecIO calls  }
    scsiIOFlagReserved0080      = $0080;                        {                                  }
    scsiIOFlagReserved8000      = $8000;                        {                                    }

    {    Defines for the Bus Inquiry PB fields.     }
    {    scsiHBAInquiry field bits  }
    scsiBusMDP                  = $80;                          {  Supports Modify Data Pointer message                }
    scsiBusWide32               = $40;                          {  Supports 32 bit wide SCSI                     }
    scsiBusWide16               = $20;                          {  Supports 16 bit wide SCSI                     }
    scsiBusSDTR                 = $10;                          {  Supports Sync Data Transfer Req message               }
    scsiBusLinkedCDB            = $08;                          {  Supports linked CDBs                          }
    scsiBusTagQ                 = $02;                          {  Supports tag queue message                     }
    scsiBusSoftReset            = $01;                          {  Supports soft reset                            }

    {    Defines for the scsiDataType field     }
    scsiDataBuffer              = 0;                            {  single contiguous buffer supplied             }
    scsiDataTIB                 = 1;                            {  TIB supplied (ptr in scsiDataPtr)            }
    scsiDataSG                  = 2;                            {  scatter/gather list supplied              }
    scsiDataIOTable             = 3;                            { #(7/11/95) Prepared by Block Storage          }

    {    scsiDataTypes field bits   }
    {     bits 0->15 Apple-defined, 16->30 3rd-party unique, 31 = reserved  }
    scsiBusDataTIB              = $02;                          {  TIB supplied (ptr in scsiDataPtr)    }
    scsiBusDataBuffer           = $01;                          {  single contiguous buffer supplied       }
    scsiBusDataSG               = $04;                          {  scatter/gather list supplied         }
    scsiBusDataIOTable          = $08;                          {  (2/6/95) Prepare Memory for IO }
    scsiBusDataReserved         = $80000000;                    {                              }

    {    scsiScanFlags field bits   }
    scsiBusScansDevices         = $80;                          {  Bus scans for and maintains device list          }
    scsiBusScansOnInit          = $40;                          {  Bus scans performed at power-up/reboot         }
    scsiBusLoadsROMDrivers      = $20;                          {  may load ROM drivers to support targets        }

    {    scsiFeatureFlags field bits    }
    scsiBusUltra4SCSI           = $00000800;                    {  HBA supports Ultra4(Ultra320) SCSI         }
    scsiBusLVD                  = $00000400;                    {  HBA is Low Voltage Differential Bus          }
    scsiBusUltra3SCSI           = $00000200;                    {  HBA supports Ultra3 SCSI                }
    scsiBusUltra2SCSI           = $00000100;                    {  HBA supports Ultra2 SCSI                }
    scsiBusInternalExternalMask = $000000C0;                    {  bus internal/external mask            }
    scsiBusInternalExternalUnknown = $00000000;                 {  not known whether bus is inside or outside      }
    scsiBusInternalExternal     = $000000C0;                    {  bus goes inside and outside the box        }
    scsiBusInternal             = $00000080;                    {  bus goes inside the box                 }
    scsiBusExternal             = $00000040;                    {  bus goes outside the box              }
    scsiBusCacheCoherentDMA     = $00000020;                    {  DMA is cache coherent                 }
    scsiBusOldCallCapable       = $00000010;                    {  SIM is old call capable                 }
    scsiBusUltraSCSI            = $00000008;                    {  HBA supports Ultra SCSI                  }
    scsiBusDifferential         = $00000004;                    {  Single Ended (0) or Differential (1)     }
    scsiBusFastSCSI             = $00000002;                    {  HBA supports fast SCSI                   }
    scsiBusDMAavailable         = $00000001;                    {  DMA is available                   }

    {    scsiWeirdStuff field bits  }
    scsiOddDisconnectUnsafeRead1 = $0001;                       {  Disconnects on odd byte boundries are unsafe with DMA and/or blind reads  }
    scsiOddDisconnectUnsafeWrite1 = $0002;                      {  Disconnects on odd byte boundries are unsafe with DMA and/or blind writes  }
    scsiBusErrorsUnsafe         = $0004;                        {  Non-handshaked delays or disconnects during blind transfers may cause a crash  }
    scsiRequiresHandshake       = $0008;                        {  Non-handshaked delays or disconnects during blind transfers may cause data corruption  }
    scsiTargetDrivenSDTRSafe    = $0010;                        {  Targets which initiate synchronous negotiations are supported  }
    scsiOddCountForPhysicalUnsafe = $0020;                      {  If using physical addrs all counts must be even, and disconnects must be on even boundries  }
    scsiAbortCmdFixed           = $0040;                        {  Set if abort command is fixed to properly make callbacks  }
    scsiMeshACKTimingFixed      = $0080;                        {  Set if bug allowing Mesh to release ACK prematurely is fixed  }

    {    scsiHBAslotType values     }
    scsiMotherboardBus          = $00;                          {  A built in Apple supplied bus             }
    scsiNuBus                   = $01;                          {  A SIM on a NuBus card                    }
    scsiPDSBus                  = $03;                          {     "  on a PDS card                     }
    scsiPCIBus                  = $04;                          {     "  on a PCI bus card                    }
    scsiPCMCIABus               = $05;                          {     "  on a PCMCIA card                   }
    scsiFireWireBridgeBus       = $06;                          {     "  connected through a FireWire bridge    }
    scsiUSBBus                  = $07;                          {     "  connected on a USB bus                }

    {    Defines for the scsiDriverFlags field (in SCSIDriverPB)    }
    scsiDeviceSensitive         = $0001;                        {  Only driver should access this device           }
    scsiDeviceNoOldCallAccess   = $0002;                        {  no old call access to this device             }

    {     SIMInitInfo PB    }
    {    directions are for SCSIRegisterBus call ( -> parm, <- result)              }

type
    SIMInitInfoPtr = ^SIMInitInfo;
    SIMInitInfo = record
        SIMstaticPtr:           Ptr;                                    {  <- alloc. ptr to the SIM's static vars            }
        staticSize:             SInt32;                             {  -> num bytes SIM needs for static vars            }
        SIMInit:                SIMInitUPP;                             {  -> pointer to the SIM init routine                }
        SIMAction:              SIMActionUPP;                           {  -> pointer to the SIM action routine            }
        SIM_ISR:                SCSIInterruptUPP;                       {       reserved                            }
        SIMInterruptPoll:       SCSIInterruptUPP;                       {  -> pointer to the SIM interrupt poll routine       }
        NewOldCall:             SIMActionUPP;                           {  -> pointer to the SIM NewOldCall routine           }
        ioPBSize:               UInt16;                                 {  -> size of SCSI_IO_PBs required for this SIM       }
        oldCallCapable:         boolean;                                {  -> true if this SIM can handle old-API calls       }
        simInfoUnused1:         SInt8;                                  {       reserved                              }
        simInternalUse:         SInt32;                             {  xx not affected or viewed by XPT                }
        XPT_ISR:                SCSIUPP;                                {     reserved                              }
        EnteringSIM:            SCSIUPP;                                {  <- ptr to the EnteringSIM routine             }
        ExitingSIM:             SCSIUPP;                                {  <- ptr to the ExitingSIM routine                }
        MakeCallback:           SCSIMakeCallbackUPP;                    {  <- the XPT layerÕs SCSIMakeCallback routine             }
        busID:                  UInt16;                                 {  <- bus number for the registered bus              }
        simSlotNumber:          SInt8;                                  {  <- Magic cookie to place in scsiHBASlotNumber (PCI)     }
        simSRsrcID:             SInt8;                                  {  <- Magic cookie to place in scsiSIMsRsrcID  (PCI)   }
        simRegEntry:            Ptr;                                    {  -> The SIM's RegEntryIDPtr            (PCI)   }
    end;

    {    Glue between SCSI calls and SCSITrap format    }

const
    xptSCSIAction               = $0001;
    xptSCSIRegisterBus          = $0002;
    xptSCSIDeregisterBus        = $0003;
    xptSCSIReregisterBus        = $0004;
    xptSCSIKillXPT              = $0005;                        {  kills Mini-XPT after transition  }
    xptSCSIInitialize           = $000A;                        {  Initialize the SCSI manager  }

    {
     * SCSI bus status. These values are returned by the SCSI target in the status phase.
     * They are not related to Macintosh status values (except that values other than
     * scsiStatusGood will result in scsiResult set to scsiNonZeroStatus).
        }
    scsiStatGood                = $00;                          {  Good Status }
    scsiStatCheckCondition      = $02;                          {  Check Condition }
    scsiStatConditionMet        = $04;                          {  Condition Met }
    scsiStatBusy                = $08;                          {  Busy }
    scsiStatIntermediate        = $10;                          {  Intermediate }
    scsiStatIntermedMet         = $14;                          {  Intermediate - Condition Met }
    scsiStatResvConflict        = $18;                          {  Reservation conflict }
    scsiStatTerminated          = $22;                          {  Command terminated }
    scsiStatQFull               = $28;                          {  Queue full }

    {  SCSI messages }
    kCmdCompleteMsg             = 0;
    kExtendedMsg                = 1;                            {  0x01 }
    kSaveDataPointerMsg         = 2;                            {  0x02 }
    kRestorePointersMsg         = 3;                            {  0x03 }
    kDisconnectMsg              = 4;                            {  0x04 }
    kInitiatorDetectedErrorMsg  = 5;                            {  0x05 }
    kAbortMsg                   = 6;                            {  0x06 }
    kMsgRejectMsg               = 7;                            {  0x07 }
    kNoOperationMsg             = 8;                            {  0x08 }
    kMsgParityErrorMsg          = 9;                            {  0x09 }
    kLinkedCmdCompleteMsg       = 10;                           {  0x0a }
    kLinkedCmdCompleteWithFlagMsg = 11;                         {  0x0b }
    kBusDeviceResetMsg          = 12;                           {  0x0c }
    kAbortTagMsg                = 13;                           {  0x0d }
    kClearQueueMsg              = 14;                           {  0x0e }
    kInitiateRecoveryMsg        = 15;                           {  0x0f }
    kReleaseRecoveryMsg         = 16;                           {  0x10 }
    kTerminateIOProcessMsg      = 17;                           {  0x11 }
    kSimpleQueueTag             = $20;                          {  0x20 }
    kHeadOfQueueTagMsg          = $21;                          {  0x21 }
    kOrderedQueueTagMsg         = $22;                          {  0x22 }
    kIgnoreWideResidueMsg       = $23;                          {  0x23 }


    {    moveq #kSCSIx, D0;  _SCSIAtomic    }
    {
     *  SCSIAction()
     *
     *  Availability:
     *    Non-Carbon CFM:   in InterfaceLib 7.5 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function SCSIAction(var parameterBlock: SCSI_PB): OSErr; external name '_SCSIAction';

{$ALIGN MAC68K}
{#POP}
{unit SCSchemaDefinitions}
{$ALIGN MAC68K}






{
 * Reserved Keys
 }
var kSCResvLink: CFStringRef; external name '_kSCResvLink'; (* attribute const *)                             { CFString          "__LINK__"                     }
var kSCResvInactive: CFStringRef; external name '_kSCResvInactive'; (* attribute const *)                         {                   "__INACTIVE__"                 }

{
 * Generic Keys
 }
var kSCPropInterfaceName: CFStringRef; external name '_kSCPropInterfaceName'; (* attribute const *)                    { CFString          "InterfaceName"                }
var kSCPropMACAddress: CFStringRef; external name '_kSCPropMACAddress'; (* attribute const *)                       { CFString          "MACAddress"                   }
var kSCPropUserDefinedName: CFStringRef; external name '_kSCPropUserDefinedName'; (* attribute const *)                  { CFString          "UserDefinedName"              }
var kSCPropVersion: CFStringRef; external name '_kSCPropVersion'; (* attribute const *)                          { CFString          "Version"                      }

{
 * Preference Keys
 }
var kSCPrefCurrentSet: CFStringRef; external name '_kSCPrefCurrentSet'; (* attribute const *)                       { CFString          "CurrentSet"                   }
var kSCPrefNetworkServices: CFStringRef; external name '_kSCPrefNetworkServices'; (* attribute const *)                  { CFDictionary      "NetworkServices"              }
var kSCPrefSets: CFStringRef; external name '_kSCPrefSets'; (* attribute const *)                             { CFDictionary      "Sets"                         }
var kSCPrefSystem: CFStringRef; external name '_kSCPrefSystem'; (* attribute const *)                           { CFDictionary      "System"                       }

{
 * Component Keys
 }
var kSCCompNetwork: CFStringRef; external name '_kSCCompNetwork'; (* attribute const *)                          {                   "Network"                      }
var kSCCompService: CFStringRef; external name '_kSCCompService'; (* attribute const *)                          {                   "Service"                      }
var kSCCompGlobal: CFStringRef; external name '_kSCCompGlobal'; (* attribute const *)                           {                   "Global"                       }
var kSCCompHostNames: CFStringRef; external name '_kSCCompHostNames'; (* attribute const *)                        {                   "HostNames"                    }
var kSCCompInterface: CFStringRef; external name '_kSCCompInterface'; (* attribute const *)                        {                   "Interface"                    }
var kSCCompSystem: CFStringRef; external name '_kSCCompSystem'; (* attribute const *)                           {                   "System"                       }
var kSCCompUsers: CFStringRef; external name '_kSCCompUsers'; (* attribute const *)                            {                   "Users"                        }

{
 * Regex key which matches any component
 }
var kSCCompAnyRegex: CFStringRef; external name '_kSCCompAnyRegex'; (* attribute const *)                         {                   "[^/]+"                        }

{
 * Network Entity Keys
 }
var kSCEntNetAirPort: CFStringRef; external name '_kSCEntNetAirPort'; (* attribute const *)                        { CFDictionary      "AirPort"                      }
var kSCEntNetAppleTalk: CFStringRef; external name '_kSCEntNetAppleTalk'; (* attribute const *)                      { CFDictionary      "AppleTalk"                    }
var kSCEntNetDHCP: CFStringRef; external name '_kSCEntNetDHCP'; (* attribute const *)                           { CFDictionary      "DHCP"                         }
var kSCEntNetDNS: CFStringRef; external name '_kSCEntNetDNS'; (* attribute const *)                            { CFDictionary      "DNS"                          }
var kSCEntNetEthernet: CFStringRef; external name '_kSCEntNetEthernet'; (* attribute const *)                       { CFDictionary      "Ethernet"                     }
var kSCEntNetFireWire: CFStringRef; external name '_kSCEntNetFireWire'; (* attribute const *)                       { CFDictionary      "FireWire"                     }
var kSCEntNetInterface: CFStringRef; external name '_kSCEntNetInterface'; (* attribute const *)                      { CFDictionary      "Interface"                    }
var kSCEntNetIPv4: CFStringRef; external name '_kSCEntNetIPv4'; (* attribute const *)                           { CFDictionary      "IPv4"                         }
var kSCEntNetIPv6: CFStringRef; external name '_kSCEntNetIPv6'; (* attribute const *)                           { CFDictionary      "IPv6"                         }
var kSCEntNetL2TP: CFStringRef; external name '_kSCEntNetL2TP'; (* attribute const *)                           { CFDictionary      "L2TP"                         }
var kSCEntNetLink: CFStringRef; external name '_kSCEntNetLink'; (* attribute const *)                           { CFDictionary      "Link"                         }
var kSCEntNetModem: CFStringRef; external name '_kSCEntNetModem'; (* attribute const *)                          { CFDictionary      "Modem"                        }
var kSCEntNetNetInfo: CFStringRef; external name '_kSCEntNetNetInfo'; (* attribute const *)                        { CFDictionary      "NetInfo"                      }
// extern const CFStringRef kSCEntNetNIS;                         { RESERVED FOR FUTURE USE }
var kSCEntNetPPP: CFStringRef; external name '_kSCEntNetPPP'; (* attribute const *)                            { CFDictionary      "PPP"                          }
var kSCEntNetPPPoE: CFStringRef; external name '_kSCEntNetPPPoE'; (* attribute const *)                          { CFDictionary      "PPPoE"                        }
var kSCEntNetPPPSerial: CFStringRef; external name '_kSCEntNetPPPSerial'; (* attribute const *)                      { CFDictionary      "PPPSerial"                    }
var kSCEntNetPPTP: CFStringRef; external name '_kSCEntNetPPTP'; (* attribute const *)                           { CFDictionary      "PPTP"                         }
var kSCEntNetProxies: CFStringRef; external name '_kSCEntNetProxies'; (* attribute const *)                        { CFDictionary      "Proxies"                      }
var kSCEntNet6to4: CFStringRef; external name '_kSCEntNet6to4'; (* attribute const *)                           { CFDictionary      "6to4"                         }

{
 * kSCCompNetwork Properties
 }
var kSCPropNetOverridePrimary: CFStringRef; external name '_kSCPropNetOverridePrimary'; (* attribute const *)               { CFNumber (0 or 1) "OverridePrimary"              }
var kSCPropNetServiceOrder: CFStringRef; external name '_kSCPropNetServiceOrder'; (* attribute const *)                  { CFArray[CFString] "ServiceOrder"                 }
var kSCPropNetPPPOverridePrimary: CFStringRef; external name '_kSCPropNetPPPOverridePrimary'; (* attribute const *)            { CFNumber (0 or 1) "PPPOverridePrimary"           }

{
 * kSCCompNetworkInterface Properties
 }
var kSCPropNetInterfaces: CFStringRef; external name '_kSCPropNetInterfaces'; (* attribute const *)                    { CFArray[CFString] "Interfaces"                   }

{
 * kSCCompNetworkHostNames Properties
 }
var kSCPropNetLocalHostName: CFStringRef; external name '_kSCPropNetLocalHostName'; (* attribute const *)                 { CFString          "LocalHostName"                }

{
 * kSCEntNetAirPort (Hardware) Entity Keys
 }
var kSCPropNetAirPortAllowNetCreation: CFStringRef; external name '_kSCPropNetAirPortAllowNetCreation'; (* attribute const *)       { CFNumber (0 or 1) "AllowNetCreation"             }
var kSCPropNetAirPortAuthPassword: CFStringRef; external name '_kSCPropNetAirPortAuthPassword'; (* attribute const *)           { CFData            "AuthPassword"                 }
var kSCPropNetAirPortAuthPasswordEncryption: CFStringRef; external name '_kSCPropNetAirPortAuthPasswordEncryption'; (* attribute const *) { CFString          "AuthPasswordEncryption"       }
var kSCPropNetAirPortJoinMode: CFStringRef; external name '_kSCPropNetAirPortJoinMode'; (* attribute const *)               { CFString          "JoinMode"                     }
var kSCPropNetAirPortPowerEnabled: CFStringRef; external name '_kSCPropNetAirPortPowerEnabled'; (* attribute const *)           { CFNumber (0 or 1) "PowerEnabled"                 }
var kSCPropNetAirPortPreferredNetwork: CFStringRef; external name '_kSCPropNetAirPortPreferredNetwork'; (* attribute const *)       { CFString          "PreferredNetwork"             }
var kSCPropNetAirPortSavePasswords: CFStringRef; external name '_kSCPropNetAirPortSavePasswords'; (* attribute const *)          { CFNumber (0 or 1) "SavePasswords"                }

{ kSCPropNetAirPortJoinMode values }
var kSCValNetAirPortJoinModeAutomatic: CFStringRef; external name '_kSCValNetAirPortJoinModeAutomatic'; (* attribute const *)       {                   "Automatic"                    }
var kSCValNetAirPortJoinModePreferred: CFStringRef; external name '_kSCValNetAirPortJoinModePreferred'; (* attribute const *)       {                   "Preferred"                    }
var kSCValNetAirPortJoinModeRecent: CFStringRef; external name '_kSCValNetAirPortJoinModeRecent'; (* attribute const *)          {                   "Recent"                       }
var kSCValNetAirPortJoinModeStrongest: CFStringRef; external name '_kSCValNetAirPortJoinModeStrongest'; (* attribute const *)       {                   "Strongest"                    }

{ kSCPropNetAirPortPasswordEncryption values }
var kSCValNetAirPortAuthPasswordEncryptionKeychain: CFStringRef; external name '_kSCValNetAirPortAuthPasswordEncryptionKeychain'; (* attribute const *) {                   "Keychain"                     }

{
 * kSCEntNetAppleTalk Entity Keys
 }
var kSCPropNetAppleTalkComputerName: CFStringRef; external name '_kSCPropNetAppleTalkComputerName'; (* attribute const *)         { CFString          "ComputerName"                 }
var kSCPropNetAppleTalkComputerNameEncoding: CFStringRef; external name '_kSCPropNetAppleTalkComputerNameEncoding'; (* attribute const *) { CFNumber          "ComputerNameEncoding"         }
var kSCPropNetAppleTalkConfigMethod: CFStringRef; external name '_kSCPropNetAppleTalkConfigMethod'; (* attribute const *)         { CFString          "ConfigMethod"                 }
var kSCPropNetAppleTalkDefaultZone: CFStringRef; external name '_kSCPropNetAppleTalkDefaultZone'; (* attribute const *)          { CFString          "DefaultZone"                  }
var kSCPropNetAppleTalkNetworkID: CFStringRef; external name '_kSCPropNetAppleTalkNetworkID'; (* attribute const *)            { CFNumber          "NetworkID"                    }
var kSCPropNetAppleTalkNetworkRange: CFStringRef; external name '_kSCPropNetAppleTalkNetworkRange'; (* attribute const *)         { CFArray[CFNumber] "NetworkRange"                 }
var kSCPropNetAppleTalkNodeID: CFStringRef; external name '_kSCPropNetAppleTalkNodeID'; (* attribute const *)               { CFNumber          "NodeID"                       }
var kSCPropNetAppleTalkSeedNetworkRange: CFStringRef; external name '_kSCPropNetAppleTalkSeedNetworkRange'; (* attribute const *)     { CFArray[CFNumber] "SeedNetworkRange"             }
var kSCPropNetAppleTalkSeedZones: CFStringRef; external name '_kSCPropNetAppleTalkSeedZones'; (* attribute const *)            { CFArray[CFString] "SeedZones"                    }

{ kSCPropNetAppleTalkConfigMethod values }
var kSCValNetAppleTalkConfigMethodNode: CFStringRef; external name '_kSCValNetAppleTalkConfigMethodNode'; (* attribute const *)      {                   "Node"                         }
var kSCValNetAppleTalkConfigMethodRouter: CFStringRef; external name '_kSCValNetAppleTalkConfigMethodRouter'; (* attribute const *)    {                   "Router"                       }
var kSCValNetAppleTalkConfigMethodSeedRouter: CFStringRef; external name '_kSCValNetAppleTalkConfigMethodSeedRouter'; (* attribute const *) {                   "SeedRouter"                   }

{
 * kSCEntNetDNS Entity Keys
 }
var kSCPropNetDNSDomainName: CFStringRef; external name '_kSCPropNetDNSDomainName'; (* attribute const *)                 { CFString          "DomainName"                   }
var kSCPropNetDNSSearchDomains: CFStringRef; external name '_kSCPropNetDNSSearchDomains'; (* attribute const *)              { CFArray[CFString] "SearchDomains"                }
var kSCPropNetDNSServerAddresses: CFStringRef; external name '_kSCPropNetDNSServerAddresses'; (* attribute const *)            { CFArray[CFString] "ServerAddresses"              }
var kSCPropNetDNSSortList: CFStringRef; external name '_kSCPropNetDNSSortList'; (* attribute const *)                   { CFArray[CFString] "SortList"                     }

{
 * kSCEntNetEthernet (Hardware) Entity Keys
 }
var kSCPropNetEthernetMediaSubType: CFStringRef; external name '_kSCPropNetEthernetMediaSubType'; (* attribute const *)          { CFString          "MediaSubType"                 }
var kSCPropNetEthernetMediaOptions: CFStringRef; external name '_kSCPropNetEthernetMediaOptions'; (* attribute const *)          { CFArray[CFString] "MediaOptions"                 }
var kSCPropNetEthernetMTU: CFStringRef; external name '_kSCPropNetEthernetMTU'; (* attribute const *)                   { CFNumber          "MTU"                          }

{
 * kSCEntNetFireWire (Hardware) Entity Keys
 }
{ RESERVED FOR FUTURE USE }

{
 * kSCEntNetInterface Entity Keys
 }
var kSCPropNetInterfaceDeviceName: CFStringRef; external name '_kSCPropNetInterfaceDeviceName'; (* attribute const *)           { CFString          "DeviceName"                   }
var kSCPropNetInterfaceHardware: CFStringRef; external name '_kSCPropNetInterfaceHardware'; (* attribute const *)             { CFString          "Hardware"                     }
var kSCPropNetInterfaceType: CFStringRef; external name '_kSCPropNetInterfaceType'; (* attribute const *)                 { CFString          "Type"                         }
var kSCPropNetInterfaceSubType: CFStringRef; external name '_kSCPropNetInterfaceSubType'; (* attribute const *)              { CFString          "SubType"                      }
var kSCPropNetInterfaceSupportsModemOnHold: CFStringRef; external name '_kSCPropNetInterfaceSupportsModemOnHold'; (* attribute const *)  { CFNumber (0 or 1) "SupportsModemOnHold"          }

{ kSCPropNetInterfaceType values }
var kSCValNetInterfaceTypeEthernet: CFStringRef; external name '_kSCValNetInterfaceTypeEthernet'; (* attribute const *)          {                   "Ethernet"                     }
var kSCValNetInterfaceTypeFireWire: CFStringRef; external name '_kSCValNetInterfaceTypeFireWire'; (* attribute const *)          {                   "FireWire"                     }
var kSCValNetInterfaceTypePPP: CFStringRef; external name '_kSCValNetInterfaceTypePPP'; (* attribute const *)               {                   "PPP"                          }
var kSCValNetInterfaceType6to4: CFStringRef; external name '_kSCValNetInterfaceType6to4'; (* attribute const *)              {                   "6to4"                         }

{ kSCPropNetServiceSubType values (for PPP) }
var kSCValNetInterfaceSubTypePPPoE: CFStringRef; external name '_kSCValNetInterfaceSubTypePPPoE'; (* attribute const *)          {                   "PPPoE"                        }
var kSCValNetInterfaceSubTypePPPSerial: CFStringRef; external name '_kSCValNetInterfaceSubTypePPPSerial'; (* attribute const *)      {                   "PPPSerial"                    }
var kSCValNetInterfaceSubTypePPTP: CFStringRef; external name '_kSCValNetInterfaceSubTypePPTP'; (* attribute const *)           {                   "PPTP"                         }
var kSCValNetInterfaceSubTypeL2TP: CFStringRef; external name '_kSCValNetInterfaceSubTypeL2TP'; (* attribute const *)           {                   "L2TP"                         }

{
 * kSCEntNetIPv4 Entity Keys
 }
var kSCPropNetIPv4Addresses: CFStringRef; external name '_kSCPropNetIPv4Addresses'; (* attribute const *)                 { CFArray[CFString] "Addresses"                    }
var kSCPropNetIPv4ConfigMethod: CFStringRef; external name '_kSCPropNetIPv4ConfigMethod'; (* attribute const *)              { CFString          "ConfigMethod"                 }
var kSCPropNetIPv4DHCPClientID: CFStringRef; external name '_kSCPropNetIPv4DHCPClientID'; (* attribute const *)              { CFString          "DHCPClientID"                 }
var kSCPropNetIPv4Router: CFStringRef; external name '_kSCPropNetIPv4Router'; (* attribute const *)                    { CFString          "Router"                       }
var kSCPropNetIPv4SubnetMasks: CFStringRef; external name '_kSCPropNetIPv4SubnetMasks'; (* attribute const *)               { CFArray[CFString] "SubnetMasks"                  }
var kSCPropNetIPv4DestAddresses: CFStringRef; external name '_kSCPropNetIPv4DestAddresses'; (* attribute const *)             { CFArray[CFString] "DestAddresses"                }
var kSCPropNetIPv4BroadcastAddresses: CFStringRef; external name '_kSCPropNetIPv4BroadcastAddresses'; (* attribute const *)        { CFArray[CFString] "BroadcastAddresses"           }

{ kSCPropNetIPv4ConfigMethod values }
var kSCValNetIPv4ConfigMethodBOOTP: CFStringRef; external name '_kSCValNetIPv4ConfigMethodBOOTP'; (* attribute const *)          {                   "BOOTP"                        }
var kSCValNetIPv4ConfigMethodDHCP: CFStringRef; external name '_kSCValNetIPv4ConfigMethodDHCP'; (* attribute const *)           {                   "DHCP"                         }
var kSCValNetIPv4ConfigMethodINFORM: CFStringRef; external name '_kSCValNetIPv4ConfigMethodINFORM'; (* attribute const *)         {                   "INFORM"                       }
var kSCValNetIPv4ConfigMethodLinkLocal: CFStringRef; external name '_kSCValNetIPv4ConfigMethodLinkLocal'; (* attribute const *)      {                   "LinkLocal"                    }
var kSCValNetIPv4ConfigMethodManual: CFStringRef; external name '_kSCValNetIPv4ConfigMethodManual'; (* attribute const *)         {                   "Manual"                       }
var kSCValNetIPv4ConfigMethodPPP: CFStringRef; external name '_kSCValNetIPv4ConfigMethodPPP'; (* attribute const *)            {                   "PPP"                          }

{
 * kSCEntNetIPv6 Entity Keys
 }
var kSCPropNetIPv6Addresses: CFStringRef; external name '_kSCPropNetIPv6Addresses'; (* attribute const *)                 { CFArray[CFString] "Addresses"                    }
var kSCPropNetIPv6ConfigMethod: CFStringRef; external name '_kSCPropNetIPv6ConfigMethod'; (* attribute const *)              { CFString          "ConfigMethod"                 }
var kSCPropNetIPv6DestAddresses: CFStringRef; external name '_kSCPropNetIPv6DestAddresses'; (* attribute const *)             { CFArray[CFString] "DestAddresses"                }
var kSCPropNetIPv6Flags: CFStringRef; external name '_kSCPropNetIPv6Flags'; (* attribute const *)                     { CFNumber          "Flags"                        }
var kSCPropNetIPv6PrefixLength: CFStringRef; external name '_kSCPropNetIPv6PrefixLength'; (* attribute const *)              { CFArray[CFNumber] "PrefixLength"                 }
var kSCPropNetIPv6Router: CFStringRef; external name '_kSCPropNetIPv6Router'; (* attribute const *)                    { CFString          "Router"                       }

{ kSCPropNetIPv6ConfigMethod values }
var kSCValNetIPv6ConfigMethodAutomatic: CFStringRef; external name '_kSCValNetIPv6ConfigMethodAutomatic'; (* attribute const *)      {                   "Automatic"                    }
var kSCValNetIPv6ConfigMethodManual: CFStringRef; external name '_kSCValNetIPv6ConfigMethodManual'; (* attribute const *)         {                   "Manual"                       }
var kSCValNetIPv6ConfigMethodRouterAdvertisement: CFStringRef; external name '_kSCValNetIPv6ConfigMethodRouterAdvertisement'; (* attribute const *) {                   "RouterAdvertisement"          }
var kSCValNetIPv6ConfigMethod6to4: CFStringRef; external name '_kSCValNetIPv6ConfigMethod6to4'; (* attribute const *)           {                   "6to4"                         }

{
 * kSCEntNet6to4 Entity Keys
 }
var kSCPropNet6to4Relay: CFStringRef; external name '_kSCPropNet6to4Relay'; (* attribute const *)                     { CFString          "Relay"                        }

{
 * kSCEntNetLink Entity Keys
 }
var kSCPropNetLinkActive: CFStringRef; external name '_kSCPropNetLinkActive'; (* attribute const *)                    { CFBoolean         "Active"                       }
var kSCPropNetLinkDetaching: CFStringRef; external name '_kSCPropNetLinkDetaching'; (* attribute const *)                 { CFBoolean         "Detaching"                    }

{
 * kSCEntNetModem (Hardware) Entity Keys
 }
var kSCPropNetModemConnectionScript: CFStringRef; external name '_kSCPropNetModemConnectionScript'; (* attribute const *)         { CFString          "ConnectionScript"             }
var kSCPropNetModemConnectSpeed: CFStringRef; external name '_kSCPropNetModemConnectSpeed'; (* attribute const *)             { CFNumber          "ConnectSpeed"                 }
var kSCPropNetModemDataCompression: CFStringRef; external name '_kSCPropNetModemDataCompression'; (* attribute const *)          { CFNumber (0 or 1) "DataCompression"              }
var kSCPropNetModemDialMode: CFStringRef; external name '_kSCPropNetModemDialMode'; (* attribute const *)                 { CFString          "DialMode"                     }
var kSCPropNetModemErrorCorrection: CFStringRef; external name '_kSCPropNetModemErrorCorrection'; (* attribute const *)          { CFNumber (0 or 1) "ErrorCorrection"              }
var kSCPropNetModemHoldCallWaitingAudibleAlert: CFStringRef; external name '_kSCPropNetModemHoldCallWaitingAudibleAlert'; (* attribute const *) { CFNumber (0 or 1) "HoldCallWaitingAudibleAlert"  }
var kSCPropNetModemHoldDisconnectOnAnswer: CFStringRef; external name '_kSCPropNetModemHoldDisconnectOnAnswer'; (* attribute const *)   { CFNumber (0 or 1) "HoldDisconnectOnAnswer"       }
var kSCPropNetModemHoldEnabled: CFStringRef; external name '_kSCPropNetModemHoldEnabled'; (* attribute const *)              { CFNumber (0 or 1) "HoldEnabled"                  }
var kSCPropNetModemHoldReminder: CFStringRef; external name '_kSCPropNetModemHoldReminder'; (* attribute const *)             { CFNumber (0 or 1) "HoldReminder"                 }
var kSCPropNetModemHoldReminderTime: CFStringRef; external name '_kSCPropNetModemHoldReminderTime'; (* attribute const *)         { CFNumber          "HoldReminderTime"             }
var kSCPropNetModemNote: CFStringRef; external name '_kSCPropNetModemNote'; (* attribute const *)                     { CFString          "Note"                         }
var kSCPropNetModemPulseDial: CFStringRef; external name '_kSCPropNetModemPulseDial'; (* attribute const *)                { CFNumber (0 or 1) "PulseDial"                    }
var kSCPropNetModemSpeaker: CFStringRef; external name '_kSCPropNetModemSpeaker'; (* attribute const *)                  { CFNumber (0 or 1) "Speaker"                      }
var kSCPropNetModemSpeed: CFStringRef; external name '_kSCPropNetModemSpeed'; (* attribute const *)                    { CFNumber          "Speed"                        }

{ kSCPropNetModemDialMode values }
var kSCValNetModemDialModeIgnoreDialTone: CFStringRef; external name '_kSCValNetModemDialModeIgnoreDialTone'; (* attribute const *)    {                   "IgnoreDialTone"               }
var kSCValNetModemDialModeManual: CFStringRef; external name '_kSCValNetModemDialModeManual'; (* attribute const *)            {                   "Manual"                       }
var kSCValNetModemDialModeWaitForDialTone: CFStringRef; external name '_kSCValNetModemDialModeWaitForDialTone'; (* attribute const *)   {                   "WaitForDialTone"              }

{
 * kSCEntNetNetInfo Entity Keys
 }
var kSCPropNetNetInfoBindingMethods: CFStringRef; external name '_kSCPropNetNetInfoBindingMethods'; (* attribute const *)         { CFString          "BindingMethods"               }
var kSCPropNetNetInfoServerAddresses: CFStringRef; external name '_kSCPropNetNetInfoServerAddresses'; (* attribute const *)        { CFArray[CFString] "ServerAddresses"              }
var kSCPropNetNetInfoServerTags: CFStringRef; external name '_kSCPropNetNetInfoServerTags'; (* attribute const *)             { CFArray[CFString] "ServerTags"                   }
var kSCPropNetNetInfoBroadcastServerTag: CFStringRef; external name '_kSCPropNetNetInfoBroadcastServerTag'; (* attribute const *)     { CFString          "BroadcastServerTag"           }

{ kSCPropNetNetInfoBindingMethods values }
var kSCValNetNetInfoBindingMethodsBroadcast: CFStringRef; external name '_kSCValNetNetInfoBindingMethodsBroadcast'; (* attribute const *) {                   "Broadcast"                    }
var kSCValNetNetInfoBindingMethodsDHCP: CFStringRef; external name '_kSCValNetNetInfoBindingMethodsDHCP'; (* attribute const *)      {                   "DHCP"                         }
var kSCValNetNetInfoBindingMethodsManual: CFStringRef; external name '_kSCValNetNetInfoBindingMethodsManual'; (* attribute const *)    {                   "Manual"                       }

{ kSCPropNetNetInfoBroadcastServerTag default value }
var kSCValNetNetInfoDefaultServerTag: CFStringRef; external name '_kSCValNetNetInfoDefaultServerTag'; (* attribute const *)        {                   "network"                      }

{
 * kSCEntNetNIS Entity Keys
 }
{ RESERVED FOR FUTURE USE }

{
 * kSCEntNetPPP Entity Keys
 }
var kSCPropNetPPPACSPEnabled: CFStringRef; external name '_kSCPropNetPPPACSPEnabled'; (* attribute const *)                { CFNumber (0 or 1) "ACSPEnabled"                  }
var kSCPropNetPPPConnectTime: CFStringRef; external name '_kSCPropNetPPPConnectTime'; (* attribute const *)                { CFNumber          "ConnectTime"                  }
var kSCPropNetPPPDeviceLastCause: CFStringRef; external name '_kSCPropNetPPPDeviceLastCause'; (* attribute const *)            { CFNumber          "DeviceLastCause"              }
var kSCPropNetPPPDialOnDemand: CFStringRef; external name '_kSCPropNetPPPDialOnDemand'; (* attribute const *)               { CFNumber (0 or 1) "DialOnDemand"                 }
var kSCPropNetPPPDisconnectOnIdle: CFStringRef; external name '_kSCPropNetPPPDisconnectOnIdle'; (* attribute const *)           { CFNumber (0 or 1) "DisconnectOnIdle"             }
var kSCPropNetPPPDisconnectOnIdleTimer: CFStringRef; external name '_kSCPropNetPPPDisconnectOnIdleTimer'; (* attribute const *)      { CFNumber          "DisconnectOnIdleTimer"        }
var kSCPropNetPPPDisconnectOnLogout: CFStringRef; external name '_kSCPropNetPPPDisconnectOnLogout'; (* attribute const *)         { CFNumber (0 or 1) "DisconnectOnLogout"           }
var kSCPropNetPPPDisconnectOnSleep: CFStringRef; external name '_kSCPropNetPPPDisconnectOnSleep'; (* attribute const *)          { CFNumber (0 or 1) "DisconnectOnSleep"            }
var kSCPropNetPPPDisconnectTime: CFStringRef; external name '_kSCPropNetPPPDisconnectTime'; (* attribute const *)             { CFNumber          "DisconnectTime"               }
var kSCPropNetPPPIdleReminderTimer: CFStringRef; external name '_kSCPropNetPPPIdleReminderTimer'; (* attribute const *)          { CFNumber          "IdleReminderTimer"            }
var kSCPropNetPPPIdleReminder: CFStringRef; external name '_kSCPropNetPPPIdleReminder'; (* attribute const *)               { CFNumber (0 or 1) "IdleReminder"                 }
var kSCPropNetPPPLastCause: CFStringRef; external name '_kSCPropNetPPPLastCause'; (* attribute const *)                  { CFNumber          "LastCause"                    }
var kSCPropNetPPPLogfile: CFStringRef; external name '_kSCPropNetPPPLogfile'; (* attribute const *)                    { CFString          "Logfile"                      }
var kSCPropNetPPPPlugins: CFStringRef; external name '_kSCPropNetPPPPlugins'; (* attribute const *)                    { CFArray[CFString] "Plugins"                      }
var kSCPropNetPPPRetryConnectTime: CFStringRef; external name '_kSCPropNetPPPRetryConnectTime'; (* attribute const *)           { CFNumber          "RetryConnectTime"             }
var kSCPropNetPPPSessionTimer: CFStringRef; external name '_kSCPropNetPPPSessionTimer'; (* attribute const *)               { CFNumber          "SessionTimer"                 }
var kSCPropNetPPPStatus: CFStringRef; external name '_kSCPropNetPPPStatus'; (* attribute const *)                     { CFNumber          "Status"                       }
var kSCPropNetPPPUseSessionTimer: CFStringRef; external name '_kSCPropNetPPPUseSessionTimer'; (* attribute const *)            { CFNumber (0 or 1) "UseSessionTimer"              }
var kSCPropNetPPPVerboseLogging: CFStringRef; external name '_kSCPropNetPPPVerboseLogging'; (* attribute const *)             { CFNumber (0 or 1) "VerboseLogging"               }

{ Auth: }
var kSCPropNetPPPAuthEAPPlugins: CFStringRef; external name '_kSCPropNetPPPAuthEAPPlugins'; (* attribute const *)             { CFArray[CFString] "AuthEAPPlugins"               }
var kSCPropNetPPPAuthName: CFStringRef; external name '_kSCPropNetPPPAuthName'; (* attribute const *)                   { CFString          "AuthName"                     }
var kSCPropNetPPPAuthPassword: CFStringRef; external name '_kSCPropNetPPPAuthPassword'; (* attribute const *)               { CFString          "AuthPassword"                 }
var kSCPropNetPPPAuthPasswordEncryption: CFStringRef; external name '_kSCPropNetPPPAuthPasswordEncryption'; (* attribute const *)     { CFString          "AuthPasswordEncryption"       }
var kSCPropNetPPPAuthPrompt: CFStringRef; external name '_kSCPropNetPPPAuthPrompt'; (* attribute const *)                 { CFString          "AuthPrompt"                   }
var kSCPropNetPPPAuthProtocol: CFStringRef; external name '_kSCPropNetPPPAuthProtocol'; (* attribute const *)               { CFArray[CFString] "AuthProtocol"                 }

{ kSCPropNetPPPAuthPasswordEncryption values }
var kSCValNetPPPAuthPasswordEncryptionKeychain: CFStringRef; external name '_kSCValNetPPPAuthPasswordEncryptionKeychain'; (* attribute const *) {                   "Keychain"                     }

{ kSCPropNetPPPAuthPrompt values }
var kSCValNetPPPAuthPromptBefore: CFStringRef; external name '_kSCValNetPPPAuthPromptBefore'; (* attribute const *)            { CFString          "Before"                       }
var kSCValNetPPPAuthPromptAfter: CFStringRef; external name '_kSCValNetPPPAuthPromptAfter'; (* attribute const *)             { CFString          "After"                        }

{ kSCPropNetPPPAuthProtocol values }
var kSCValNetPPPAuthProtocolCHAP: CFStringRef; external name '_kSCValNetPPPAuthProtocolCHAP'; (* attribute const *)            { CFString          "CHAP"                         }
var kSCValNetPPPAuthProtocolEAP: CFStringRef; external name '_kSCValNetPPPAuthProtocolEAP'; (* attribute const *)             { CFString          "EAP"                          }
var kSCValNetPPPAuthProtocolMSCHAP1: CFStringRef; external name '_kSCValNetPPPAuthProtocolMSCHAP1'; (* attribute const *)         { CFString          "MSCHAP1"                      }
var kSCValNetPPPAuthProtocolMSCHAP2: CFStringRef; external name '_kSCValNetPPPAuthProtocolMSCHAP2'; (* attribute const *)         { CFString          "MSCHAP2"                      }
var kSCValNetPPPAuthProtocolPAP: CFStringRef; external name '_kSCValNetPPPAuthProtocolPAP'; (* attribute const *)             { CFString          "PAP"                          }

{ Comm: }
var kSCPropNetPPPCommAlternateRemoteAddress: CFStringRef; external name '_kSCPropNetPPPCommAlternateRemoteAddress'; (* attribute const *) { CFString          "CommAlternateRemoteAddress"   }
var kSCPropNetPPPCommConnectDelay: CFStringRef; external name '_kSCPropNetPPPCommConnectDelay'; (* attribute const *)           { CFNumber          "CommConnectDelay"             }
var kSCPropNetPPPCommDisplayTerminalWindow: CFStringRef; external name '_kSCPropNetPPPCommDisplayTerminalWindow'; (* attribute const *)  { CFNumber (0 or 1) "CommDisplayTerminalWindow"    }
var kSCPropNetPPPCommRedialCount: CFStringRef; external name '_kSCPropNetPPPCommRedialCount'; (* attribute const *)            { CFNumber          "CommRedialCount"              }
var kSCPropNetPPPCommRedialEnabled: CFStringRef; external name '_kSCPropNetPPPCommRedialEnabled'; (* attribute const *)          { CFNumber (0 or 1) "CommRedialEnabled"            }
var kSCPropNetPPPCommRedialInterval: CFStringRef; external name '_kSCPropNetPPPCommRedialInterval'; (* attribute const *)         { CFNumber          "CommRedialInterval"           }
var kSCPropNetPPPCommRemoteAddress: CFStringRef; external name '_kSCPropNetPPPCommRemoteAddress'; (* attribute const *)          { CFString          "CommRemoteAddress"            }
var kSCPropNetPPPCommTerminalScript: CFStringRef; external name '_kSCPropNetPPPCommTerminalScript'; (* attribute const *)         { CFString          "CommTerminalScript"           }
var kSCPropNetPPPCommUseTerminalScript: CFStringRef; external name '_kSCPropNetPPPCommUseTerminalScript'; (* attribute const *)      { CFNumber (0 or 1) "CommUseTerminalScript"        }

{ CCP: }
var kSCPropNetPPPCCPEnabled: CFStringRef; external name '_kSCPropNetPPPCCPEnabled'; (* attribute const *)                 { CFNumber (0 or 1) "CCPEnabled"                   }

{ IPCP: }
var kSCPropNetPPPIPCPCompressionVJ: CFStringRef; external name '_kSCPropNetPPPIPCPCompressionVJ'; (* attribute const *)          { CFNumber (0 or 1) "IPCPCompressionVJ"            }

{ LCP: }
var kSCPropNetPPPLCPEchoEnabled: CFStringRef; external name '_kSCPropNetPPPLCPEchoEnabled'; (* attribute const *)             { CFNumber (0 or 1) "LCPEchoEnabled"               }
var kSCPropNetPPPLCPEchoFailure: CFStringRef; external name '_kSCPropNetPPPLCPEchoFailure'; (* attribute const *)             { CFNumber          "LCPEchoFailure"               }
var kSCPropNetPPPLCPEchoInterval: CFStringRef; external name '_kSCPropNetPPPLCPEchoInterval'; (* attribute const *)            { CFNumber          "LCPEchoInterval"              }
var kSCPropNetPPPLCPCompressionACField: CFStringRef; external name '_kSCPropNetPPPLCPCompressionACField'; (* attribute const *)      { CFNumber (0 or 1) "LCPCompressionACField"        }
var kSCPropNetPPPLCPCompressionPField: CFStringRef; external name '_kSCPropNetPPPLCPCompressionPField'; (* attribute const *)       { CFNumber (0 or 1) "LCPCompressionPField"         }
var kSCPropNetPPPLCPMRU: CFStringRef; external name '_kSCPropNetPPPLCPMRU'; (* attribute const *)                     { CFNumber          "LCPMRU"                       }
var kSCPropNetPPPLCPMTU: CFStringRef; external name '_kSCPropNetPPPLCPMTU'; (* attribute const *)                     { CFNumber          "LCPMTU"                       }
var kSCPropNetPPPLCPReceiveACCM: CFStringRef; external name '_kSCPropNetPPPLCPReceiveACCM'; (* attribute const *)             { CFNumber          "LCPReceiveACCM"               }
var kSCPropNetPPPLCPTransmitACCM: CFStringRef; external name '_kSCPropNetPPPLCPTransmitACCM'; (* attribute const *)            { CFNumber          "LCPTransmitACCM"              }

{
 * kSCEntNetPPPoE Entity Keys
 }
{ RESERVED FOR FUTURE USE }

{
 * kSCEntNetPPPSerial Entity Keys
 }
{ RESERVED FOR FUTURE USE }

{
 * kSCEntNetPPTP Entity Keys
 }
{ RESERVED FOR FUTURE USE }

{
 * kSCEntNetL2TP Entity Keys
 }
var kSCPropNetL2TPIPSecSharedSecret: CFStringRef; external name '_kSCPropNetL2TPIPSecSharedSecret'; (* attribute const *)         { CFString          "IPSecSharedSecret"            }
var kSCPropNetL2TPIPSecSharedSecretEncryption: CFStringRef; external name '_kSCPropNetL2TPIPSecSharedSecretEncryption'; (* attribute const *) { CFString          "IPSecSharedSecretEncryption"  }
var kSCPropNetL2TPTransport: CFStringRef; external name '_kSCPropNetL2TPTransport'; (* attribute const *)                 { CFString          "Transport"                    }

{ kSCPropNetL2TPIPSecSharedSecretEncryption values }
var kSCValNetL2TPIPSecSharedSecretEncryptionKeychain: CFStringRef; external name '_kSCValNetL2TPIPSecSharedSecretEncryptionKeychain'; (* attribute const *) {                   "Keychain"                     }

{ kSCPropNetL2TPTransport values }
var kSCValNetL2TPTransportIP: CFStringRef; external name '_kSCValNetL2TPTransportIP'; (* attribute const *)                {                   "IP"                           }
var kSCValNetL2TPTransportIPSec: CFStringRef; external name '_kSCValNetL2TPTransportIPSec'; (* attribute const *)             {                   "IPSec"                        }

{
 * kSCEntNetProxies Entity Keys
 }
var kSCPropNetProxiesExceptionsList: CFStringRef; external name '_kSCPropNetProxiesExceptionsList'; (* attribute const *)         { CFArray[CFString] "ExceptionsList"               }
var kSCPropNetProxiesFTPEnable: CFStringRef; external name '_kSCPropNetProxiesFTPEnable'; (* attribute const *)              { CFNumber (0 or 1) "FTPEnable"                    }
var kSCPropNetProxiesFTPPassive: CFStringRef; external name '_kSCPropNetProxiesFTPPassive'; (* attribute const *)             { CFNumber (0 or 1) "FTPPassive"                   }
var kSCPropNetProxiesFTPPort: CFStringRef; external name '_kSCPropNetProxiesFTPPort'; (* attribute const *)                { CFNumber          "FTPPort"                      }
var kSCPropNetProxiesFTPProxy: CFStringRef; external name '_kSCPropNetProxiesFTPProxy'; (* attribute const *)               { CFString          "FTPProxy"                     }
var kSCPropNetProxiesGopherEnable: CFStringRef; external name '_kSCPropNetProxiesGopherEnable'; (* attribute const *)           { CFNumber (0 or 1) "GopherEnable"                 }
var kSCPropNetProxiesGopherPort: CFStringRef; external name '_kSCPropNetProxiesGopherPort'; (* attribute const *)             { CFNumber          "GopherPort"                   }
var kSCPropNetProxiesGopherProxy: CFStringRef; external name '_kSCPropNetProxiesGopherProxy'; (* attribute const *)            { CFString          "GopherProxy"                  }
var kSCPropNetProxiesHTTPEnable: CFStringRef; external name '_kSCPropNetProxiesHTTPEnable'; (* attribute const *)             { CFNumber (0 or 1) "HTTPEnable"                   }
var kSCPropNetProxiesHTTPPort: CFStringRef; external name '_kSCPropNetProxiesHTTPPort'; (* attribute const *)               { CFNumber          "HTTPPort"                     }
var kSCPropNetProxiesHTTPProxy: CFStringRef; external name '_kSCPropNetProxiesHTTPProxy'; (* attribute const *)              { CFString          "HTTPProxy"                    }
var kSCPropNetProxiesHTTPSEnable: CFStringRef; external name '_kSCPropNetProxiesHTTPSEnable'; (* attribute const *)            { CFNumber (0 or 1) "HTTPSEnable"                  }
var kSCPropNetProxiesHTTPSPort: CFStringRef; external name '_kSCPropNetProxiesHTTPSPort'; (* attribute const *)              { CFNumber          "HTTPSPort"                    }
var kSCPropNetProxiesHTTPSProxy: CFStringRef; external name '_kSCPropNetProxiesHTTPSProxy'; (* attribute const *)             { CFString          "HTTPSProxy"                   }
var kSCPropNetProxiesRTSPEnable: CFStringRef; external name '_kSCPropNetProxiesRTSPEnable'; (* attribute const *)             { CFNumber (0 or 1) "RTSPEnable"                   }
var kSCPropNetProxiesRTSPPort: CFStringRef; external name '_kSCPropNetProxiesRTSPPort'; (* attribute const *)               { CFNumber          "RTSPPort"                     }
var kSCPropNetProxiesRTSPProxy: CFStringRef; external name '_kSCPropNetProxiesRTSPProxy'; (* attribute const *)              { CFString          "RTSPProxy"                    }
var kSCPropNetProxiesSOCKSEnable: CFStringRef; external name '_kSCPropNetProxiesSOCKSEnable'; (* attribute const *)            { CFNumber (0 or 1) "SOCKSEnable"                  }
var kSCPropNetProxiesSOCKSPort: CFStringRef; external name '_kSCPropNetProxiesSOCKSPort'; (* attribute const *)              { CFNumber          "SOCKSPort"                    }
var kSCPropNetProxiesSOCKSProxy: CFStringRef; external name '_kSCPropNetProxiesSOCKSProxy'; (* attribute const *)             { CFString          "SOCKSProxy"                   }

{
 kSCCompUsers Entity Keys
 }
var kSCEntUsersConsoleUser: CFStringRef; external name '_kSCEntUsersConsoleUser'; (* attribute const *)                  {                   "ConsoleUser"                  }

{
 * kSCCompSystem Properties
 }
var kSCPropSystemComputerName: CFStringRef; external name '_kSCPropSystemComputerName'; (* attribute const *)               { CFString          "ComputerName"                 }
var kSCPropSystemComputerNameEncoding: CFStringRef; external name '_kSCPropSystemComputerNameEncoding'; (* attribute const *)       { CFNumber          "ComputerNameEncoding"         }

{
 * Configuration Store Definitions
 }
{ domain prefixes }
var kSCDynamicStoreDomainFile: CFStringRef; external name '_kSCDynamicStoreDomainFile'; (* attribute const *)               {                   "File:"                        }
var kSCDynamicStoreDomainPlugin: CFStringRef; external name '_kSCDynamicStoreDomainPlugin'; (* attribute const *)             {                   "Plugin:"                      }
var kSCDynamicStoreDomainSetup: CFStringRef; external name '_kSCDynamicStoreDomainSetup'; (* attribute const *)              {                   "Setup:"                       }
var kSCDynamicStoreDomainState: CFStringRef; external name '_kSCDynamicStoreDomainState'; (* attribute const *)              {                   "State:"                       }
var kSCDynamicStoreDomainPrefs: CFStringRef; external name '_kSCDynamicStoreDomainPrefs'; (* attribute const *)              {                   "Prefs:"                       }

{ kSCDynamicStoreDomainSetup Properties }
var kSCDynamicStorePropSetupCurrentSet: CFStringRef; external name '_kSCDynamicStorePropSetupCurrentSet'; (* attribute const *)      { CFString          "CurrentSet"                   }
var kSCDynamicStorePropSetupLastUpdated: CFStringRef; external name '_kSCDynamicStorePropSetupLastUpdated'; (* attribute const *)     {                   "LastUpdated"                  }

{ Properties }
var kSCDynamicStorePropNetInterfaces: CFStringRef; external name '_kSCDynamicStorePropNetInterfaces'; (* attribute const *)        { CFArray[CFString] "Interfaces"                   }
var kSCDynamicStorePropNetPrimaryInterface: CFStringRef; external name '_kSCDynamicStorePropNetPrimaryInterface'; (* attribute const *)  { CFString          "PrimaryInterface"             }
var kSCDynamicStorePropNetPrimaryService: CFStringRef; external name '_kSCDynamicStorePropNetPrimaryService'; (* attribute const *)    { CFString          "PrimaryService"               }
var kSCDynamicStorePropNetServiceIDs: CFStringRef; external name '_kSCDynamicStorePropNetServiceIDs'; (* attribute const *)        { CFArray[CFString] "ServiceIDs"                   }

{
 * Obsolete schema definitions which will be removed "soon".
 }
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kSCPropUsersConsoleUserName CFSTRP('Name')}
{$endc}                            { CFString }
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kSCPropUsersConsoleUserUID CFSTRP('UID')}
{$endc}                             { CFNumber }
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kSCPropUsersConsoleUserGID CFSTRP('GID')}
{$endc}                             { CFNumber }
{unit Script}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}

{  Meta script codes: }

const
    smSystemScript              = -1;                           {  designates system script. }
    smCurrentScript             = -2;                           {  designates current font script. }
    smAllScripts                = -3;                           {  designates any script }

    {
       Script codes:
       These specify a Mac OS encoding that is related to a FOND ID range.
       Some of the encodings have several variants (e.g. for different localized systems)
        which all share the same script code.
       Not all of these script codes are currently supported by Apple software.
       Notes:
       - Script code 0 (smRoman) is also used (instead of smGreek) for the Greek encoding
         in the Greek localized system.
       - Script code 28 (smEthiopic) is also used for the Inuit encoding in the Inuktitut
         system.
    }
    smRoman                     = 0;
    smJapanese                  = 1;
    smTradChinese               = 2;                            {  Traditional Chinese }
    smKorean                    = 3;
    smArabic                    = 4;
    smHebrew                    = 5;
    smGreek                     = 6;
    smCyrillic                  = 7;
    smRSymbol                   = 8;                            {  Right-left symbol }
    smDevanagari                = 9;
    smGurmukhi                  = 10;
    smGujarati                  = 11;
    smOriya                     = 12;
    smBengali                   = 13;
    smTamil                     = 14;
    smTelugu                    = 15;
    smKannada                   = 16;                           {  Kannada/Kanarese }
    smMalayalam                 = 17;
    smSinhalese                 = 18;
    smBurmese                   = 19;
    smKhmer                     = 20;                           {  Khmer/Cambodian }
    smThai                      = 21;
    smLao                       = 22;
    smGeorgian                  = 23;
    smArmenian                  = 24;
    smSimpChinese               = 25;                           {  Simplified Chinese }
    smTibetan                   = 26;
    smMongolian                 = 27;
    smEthiopic                  = 28;
    smGeez                      = 28;                           {  Synonym for smEthiopic }
    smCentralEuroRoman          = 29;                           {  For Czech, Slovak, Polish, Hungarian, Baltic langs }
    smVietnamese                = 30;
    smExtArabic                 = 31;                           {  extended Arabic }
    smUninterp                  = 32;                           {  uninterpreted symbols, e.g. palette symbols }

    {  Extended script code for full Unicode input }
    smUnicodeScript             = $7E;

    {  Obsolete script code names (kept for backward compatibility): }
    smChinese                   = 2;                            {  (Use smTradChinese or smSimpChinese) }
    smRussian                   = 7;                            {  Use smCyrillic }
                                                                {  smMaldivian = 25: deleted, no code for Maldivian }
    smLaotian                   = 22;                           {  Use smLao                                      }
    smAmharic                   = 28;                           {  Use smEthiopic or smGeez }
    smSlavic                    = 29;                           {  Use smCentralEuroRoman }
    smEastEurRoman              = 29;                           {  Use smCentralEuroRoman }
    smSindhi                    = 31;                           {  Use smExtArabic }
    smKlingon                   = 32;

    {
       Language codes:
       These specify a language implemented using a particular Mac OS encoding.
       Not all of these language codes are currently supported by Apple software.
    }
    langEnglish                 = 0;                            {  smRoman script }
    langFrench                  = 1;                            {  smRoman script }
    langGerman                  = 2;                            {  smRoman script }
    langItalian                 = 3;                            {  smRoman script }
    langDutch                   = 4;                            {  smRoman script }
    langSwedish                 = 5;                            {  smRoman script }
    langSpanish                 = 6;                            {  smRoman script }
    langDanish                  = 7;                            {  smRoman script }
    langPortuguese              = 8;                            {  smRoman script }
    langNorwegian               = 9;                            {  smRoman script }
    langHebrew                  = 10;                           {  smHebrew script }
    langJapanese                = 11;                           {  smJapanese script }
    langArabic                  = 12;                           {  smArabic script }
    langFinnish                 = 13;                           {  smRoman script }
    langGreek                   = 14;                           {  Greek script using smRoman script code }
    langIcelandic               = 15;                           {  modified smRoman/Icelandic script }
    langMaltese                 = 16;                           {  Roman script }
    langTurkish                 = 17;                           {  modified smRoman/Turkish script }
    langCroatian                = 18;                           {  modified smRoman/Croatian script }
    langTradChinese             = 19;                           {  Chinese (Mandarin) in traditional characters }
    langUrdu                    = 20;                           {  smArabic script }
    langHindi                   = 21;                           {  smDevanagari script }
    langThai                    = 22;                           {  smThai script }
    langKorean                  = 23;                           {  smKorean script }

    langLithuanian              = 24;                           {  smCentralEuroRoman script }
    langPolish                  = 25;                           {  smCentralEuroRoman script }
    langHungarian               = 26;                           {  smCentralEuroRoman script }
    langEstonian                = 27;                           {  smCentralEuroRoman script }
    langLatvian                 = 28;                           {  smCentralEuroRoman script }
    langSami                    = 29;                           {  language of the Sami people of N. Scandinavia              }
    langFaroese                 = 30;                           {  modified smRoman/Icelandic script                       }
    langFarsi                   = 31;                           {  modified smArabic/Farsi script }
    langPersian                 = 31;                           {  Synonym for langFarsi }
    langRussian                 = 32;                           {  smCyrillic script }
    langSimpChinese             = 33;                           {  Chinese (Mandarin) in simplified characters }
    langFlemish                 = 34;                           {  smRoman script }
    langIrishGaelic             = 35;                           {  smRoman or modified smRoman/Celtic script (without dot above)    }
    langAlbanian                = 36;                           {  smRoman script }
    langRomanian                = 37;                           {  modified smRoman/Romanian script }
    langCzech                   = 38;                           {  smCentralEuroRoman script }
    langSlovak                  = 39;                           {  smCentralEuroRoman script }
    langSlovenian               = 40;                           {  modified smRoman/Croatian script }
    langYiddish                 = 41;                           {  smHebrew script }
    langSerbian                 = 42;                           {  smCyrillic script }
    langMacedonian              = 43;                           {  smCyrillic script }
    langBulgarian               = 44;                           {  smCyrillic script }
    langUkrainian               = 45;                           {  modified smCyrillic/Ukrainian script }
    langByelorussian            = 46;                           {  smCyrillic script }
    langBelorussian             = 46;                           {  Synonym for langByelorussian                           }

    langUzbek                   = 47;                           {  Cyrillic script }
    langKazakh                  = 48;                           {  Cyrillic script }
    langAzerbaijani             = 49;                           {  Azerbaijani in Cyrillic script }
    langAzerbaijanAr            = 50;                           {  Azerbaijani in Arabic script }
    langArmenian                = 51;                           {  smArmenian script }
    langGeorgian                = 52;                           {  smGeorgian script }
    langMoldavian               = 53;                           {  smCyrillic script }
    langKirghiz                 = 54;                           {  Cyrillic script }
    langTajiki                  = 55;                           {  Cyrillic script }
    langTurkmen                 = 56;                           {  Cyrillic script }
    langMongolian               = 57;                           {  Mongolian in smMongolian script }
    langMongolianCyr            = 58;                           {  Mongolian in Cyrillic script }
    langPashto                  = 59;                           {  Arabic script }
    langKurdish                 = 60;                           {  smArabic script }
    langKashmiri                = 61;                           {  Arabic script }
    langSindhi                  = 62;                           {  Arabic script }
    langTibetan                 = 63;                           {  smTibetan script }
    langNepali                  = 64;                           {  smDevanagari script }
    langSanskrit                = 65;                           {  smDevanagari script }
    langMarathi                 = 66;                           {  smDevanagari script }
    langBengali                 = 67;                           {  smBengali script }
    langAssamese                = 68;                           {  smBengali script }
    langGujarati                = 69;                           {  smGujarati script }
    langPunjabi                 = 70;                           {  smGurmukhi script }

    langOriya                   = 71;                           {  smOriya script }
    langMalayalam               = 72;                           {  smMalayalam script }
    langKannada                 = 73;                           {  smKannada script }
    langTamil                   = 74;                           {  smTamil script }
    langTelugu                  = 75;                           {  smTelugu script }
    langSinhalese               = 76;                           {  smSinhalese script }
    langBurmese                 = 77;                           {  smBurmese script }
    langKhmer                   = 78;                           {  smKhmer script }
    langLao                     = 79;                           {  smLao script }
    langVietnamese              = 80;                           {  smVietnamese script }
    langIndonesian              = 81;                           {  smRoman script }
    langTagalog                 = 82;                           {  Roman script }
    langMalayRoman              = 83;                           {  Malay in smRoman script }
    langMalayArabic             = 84;                           {  Malay in Arabic script }
    langAmharic                 = 85;                           {  smEthiopic script }
    langTigrinya                = 86;                           {  smEthiopic script }
    langOromo                   = 87;                           {  smEthiopic script }
    langSomali                  = 88;                           {  smRoman script }
    langSwahili                 = 89;                           {  smRoman script }
    langKinyarwanda             = 90;                           {  smRoman script }
    langRuanda                  = 90;                           {  synonym for langKinyarwanda }
    langRundi                   = 91;                           {  smRoman script }
    langNyanja                  = 92;                           {  smRoman script }
    langChewa                   = 92;                           {  synonym for langNyanja }
    langMalagasy                = 93;                           {  smRoman script }
    langEsperanto               = 94;                           {  Roman script }

    langWelsh                   = 128;                          {  modified smRoman/Celtic script }
    langBasque                  = 129;                          {  smRoman script }
    langCatalan                 = 130;                          {  smRoman script }
    langLatin                   = 131;                          {  smRoman script }
    langQuechua                 = 132;                          {  smRoman script }
    langGuarani                 = 133;                          {  smRoman script }
    langAymara                  = 134;                          {  smRoman script }
    langTatar                   = 135;                          {  Cyrillic script }
    langUighur                  = 136;                          {  Arabic script }
    langDzongkha                = 137;                          {  (lang of Bhutan) smTibetan script }
    langJavaneseRom             = 138;                          {  Javanese in smRoman script }
    langSundaneseRom            = 139;                          {  Sundanese in smRoman script }
    langGalician                = 140;                          {  smRoman script }
    langAfrikaans               = 141;                          {  smRoman script                                    }

    langBreton                  = 142;                          {  smRoman or modified smRoman/Celtic script                  }
    langInuktitut               = 143;                          {  Inuit script using smEthiopic script code                  }
    langScottishGaelic          = 144;                          {  smRoman or modified smRoman/Celtic script                  }
    langManxGaelic              = 145;                          {  smRoman or modified smRoman/Celtic script                  }
    langIrishGaelicScript       = 146;                          {  modified smRoman/Gaelic script (using dot above)                }
    langTongan                  = 147;                          {  smRoman script                                    }
    langGreekPoly               = 148;                          {  smGreek script                                    }
    langGreenlandic             = 149;                          {  smRoman script                                    }
    langAzerbaijanRoman         = 150;                          {  Azerbaijani in Roman script                              }

    langUnspecified             = 32767;                        {  Special code for use in resources (such as 'itlm')            }

    {
       Obsolete language code names (kept for backward compatibility):
       Misspelled, ambiguous, misleading, considered pejorative, archaic, etc.
    }
    langPortugese               = 8;                            {  Use langPortuguese }
    langMalta                   = 16;                           {  Use langMaltese }
    langYugoslavian             = 18;                           {  (use langCroatian, langSerbian, etc.) }
    langChinese                 = 19;                           {  (use langTradChinese or langSimpChinese) }
    langLettish                 = 28;                           {  Use langLatvian                                      }
    langLapponian               = 29;                           {  Use langSami }
    langLappish                 = 29;                           {  Use langSami }
    langSaamisk                 = 29;                           {  Use langSami                                     }
    langFaeroese                = 30;                           {  Use langFaroese                                      }
    langIrish                   = 35;                           {  Use langIrishGaelic                                   }
    langGalla                   = 87;                           {  Use langOromo                                  }
    langAfricaans               = 141;                          {  Use langAfrikaans                                 }

    {
       Region codes:
       These typically specify a combination of a language code and a particular region.
       Some of these numeric values are reserved just for extra resource IDs associated
       with certain regions; these are not actual region codes, and are noted in the comments.
       Not all of the region codes are currently supported by Apple software.
       When relevant, the following list also provides:
       - The Apple part number (P/N) code for software localized for the specified region.
       - The two-letter ISO language and country codes (from ISO 639 and ISO 3166). The
         language code (lowercase) is first, then '_', then the country code (uppercase).
    }

                                                                {  P/N    ISO    codes  comments }
    verUS                       = 0;                            {        en_US }
    verFrance                   = 1;                            {  F  fr_FR }
    verBritain                  = 2;                            {  B  en_GB }
    verGermany                  = 3;                            {  D  de_DE }
    verItaly                    = 4;                            {  T  it_IT }
    verNetherlands              = 5;                            {  N  nl_NL }
    verFlemish                  = 6;                            {  FN nl_BE     Flemish (Dutch) for Belgium                  }
    verSweden                   = 7;                            {  S  sv_SE }
    verSpain                    = 8;                            {  E  es_ES       Spanish for Spain }
    verDenmark                  = 9;                            {  DK da_DK }
    verPortugal                 = 10;                           {  PO pt_PT     Portuguese for Portugal }
    verFrCanada                 = 11;                           {  C  fr_CA       French for Canada }
    verNorway                   = 12;                           {  H  no_NO,nb_NO  BokmŒl }
    verIsrael                   = 13;                           {  HB he_IL,iw_IL Hebrew }
    verJapan                    = 14;                           {  J  ja_JP }
    verAustralia                = 15;                           {  X  en_AU       English for Australia }
    verArabic                   = 16;                           {  AB ar       Arabic for N Africa, Arabian peninsula, Levant }
    verFinland                  = 17;                           {  K  fi_FI }
    verFrSwiss                  = 18;                           {  SF fr_CH     French Swiss }
    verGrSwiss                  = 19;                           {  SD de_CH     German Swiss }
    verGreece                   = 20;                           {  GR el_GR     Monotonic Greek (modern) }
    verIceland                  = 21;                           {  IS is_IS }
    verMalta                    = 22;                           {  MA mt_MT }
    verCyprus                   = 23;                           {  CY   _CY     Greek or Turkish language? Checking... }
    verTurkey                   = 24;                           {  TU tr_TR }
    verYugoCroatian             = 25;                           {  YU          Croatian for Yugoslavia; now use verCroatia (68) }

    verNetherlandsComma         = 26;                           {               ID for KCHR resource - Dutch }
    verBelgiumLuxPoint          = 27;                           {               ID for KCHR resource - Belgium }
    verCanadaComma              = 28;                           {               ID for KCHR resource - Canadian ISO }
    verCanadaPoint              = 29;                           {               ID for KCHR resource - Canadian; now unused }
    vervariantPortugal          = 30;                           {               ID for resource; now unused }
    vervariantNorway            = 31;                           {               ID for resource; now unused }
    vervariantDenmark           = 32;                           {               ID for KCHR resource - Danish Mac Plus }

    verIndiaHindi               = 33;                           {        hi_IN     Hindi for India }
    verPakistanUrdu             = 34;                           {  UR ur_PK     Urdu for Pakistan                         }
    verTurkishModified          = 35;
    verItalianSwiss             = 36;                           {  ST it_CH     Italian Swiss }
    verInternational            = 37;                           {  Z  en      English for international use                }
                                                                {               38 is unassigned }
    verRomania                  = 39;                           {  RO ro_RO }
    verGreecePoly               = 40;                           {        grc      Polytonic Greek (classical)                   }
    verLithuania                = 41;                           {  LT lt_LT }
    verPoland                   = 42;                           {  PL pl_PL }
    verHungary                  = 43;                           {  MG hu_HU }
    verEstonia                  = 44;                           {  EE et_EE }
    verLatvia                   = 45;                           {  LV lv_LV }
    verSami                     = 46;                           {        se                                         }
    verFaroeIsl                 = 47;                           {  FA fo_FO                                     }
    verIran                     = 48;                           {  PS fa_IR     Persian/Farsi }
    verRussia                   = 49;                           {  RS ru_RU     Russian }
    verIreland                  = 50;                           {  GA ga_IE     Irish Gaelic for Ireland (without dot above)      }
    verKorea                    = 51;                           {  KH ko_KR }
    verChina                    = 52;                           {  CH zh_CN     Simplified Chinese }
    verTaiwan                   = 53;                           {  TA zh_TW     Traditional Chinese }
    verThailand                 = 54;                           {  TH th_TH }
    verScriptGeneric            = 55;                           {  SS          Generic script system (no language or script)        }
    verCzech                    = 56;                           {  CZ cs_CZ }
    verSlovak                   = 57;                           {  SL sk_SK }
    verFarEastGeneric           = 58;                           {  FE          Generic Far East system (no language or script)    }
    verMagyar                   = 59;                           {               Unused; see verHungary }
    verBengali                  = 60;                           {        bn         Bangladesh or India }
    verByeloRussian             = 61;                           {  BY be_BY }

    verUkraine                  = 62;                           {  UA uk_UA }
                                                                {               63 is unassigned }
    verGreeceAlt                = 64;                           {               unused                               }
    verSerbian                  = 65;                           {  SR sr_YU,sh_YU                                    }
    verSlovenian                = 66;                           {  SV sl_SI                                     }
    verMacedonian               = 67;                           {  MD mk_MK                                     }
    verCroatia                  = 68;                           {  CR hr_HR,sh_HR }
                                                                {               69 is unassigned }
    verGermanReformed           = 70;                           {        de_DE     Reformed orthography (used formerly unassigned 70)  }
    verBrazil                   = 71;                           {  BR pt_BR     Portuguese for Brazil }
    verBulgaria                 = 72;                           {  BG bg_BG }
    verCatalonia                = 73;                           {  CA ca_ES     Catalan for Spain }
    verMultilingual             = 74;                           {  ZM mul        (no language or script) }
    verScottishGaelic           = 75;                           {  GD gd }
    verManxGaelic               = 76;                           {  GV gv       Isle of Man }
    verBreton                   = 77;                           {  BZ br }
    verNunavut                  = 78;                           {  IU iu_CA     Inuktitut for Canada }
    verWelsh                    = 79;                           {  CU cy }
                                                                {               80 is ID for KCHR resource - Canadian CSA }
    verIrishGaelicScript        = 81;                           {  GS ga_IE     Irish Gaelic for Ireland (using dot above) }
    verEngCanada                = 82;                           {  V  en_CA       English for Canada }
    verBhutan                   = 83;                           {  BH dz_BT     Dzongkha for Bhutan }
    verArmenian                 = 84;                           {  HY hy_AM }
    verGeorgian                 = 85;                           {  KR ka_GE }
    verSpLatinAmerica           = 86;                           {  LA es       Spanish for Latin America }
                                                                {               87 is ID for KCHR resource - Spanish ISO }
    verTonga                    = 88;                           {  TS to_TO }
                                                                {               89 is ID for KCHR resource - Polish Modified }
                                                                {               90 is ID for KCHR resource - Catalan ISO }
    verFrenchUniversal          = 91;                           {        fr         French generic }
    verAustria                  = 92;                           {  AU de_AT     German for Austria }
                                                                {  Y          93 is unused alternate for verSpLatinAmerica }
    verGujarati                 = 94;                           {        gu_IN }
    verPunjabi                  = 95;                           {        pa         Pakistan or India }
    verIndiaUrdu                = 96;                           {        ur_IN     Urdu for India }
    verVietnam                  = 97;                           {        vi_VN }

    verFrBelgium                = 98;                           {  BF fr_BE     French for Belgium                        }
    verUzbek                    = 99;                           {  BD uz_UZ                                     }
    verSingapore                = 100;                          {  SG                                          }
    verNynorsk                  = 101;                          {  NY nn_NO     Norwegian Nynorsk                         }
    verAfrikaans                = 102;                          {  AK af_ZA                                     }
    verEsperanto                = 103;                          {        eo                                         }
    verMarathi                  = 104;                          {        mr_IN                                       }
    verTibetan                  = 105;                          {        bo                                         }
    verNepal                    = 106;                          {        ne_NP                                       }
    verGreenland                = 107;                          {        kl                                         }
    verIrelandEnglish           = 108;                          {        en_IE     English for Ireland, with Euro for currency }

    {
       Other extra resource IDs assigned in the same number space:
        179 is ID for KCHR & itl_ resources - Cornish
        581 is ID for KCHR resource - Irish Gaelic script alternate
        582 is ID for KCHR resource - Ogham
        779 is ID for KCHR resource - Welsh alternate
       1111 is ID for KCHR resource - French numeric
    }

    {
       Obsolete region code names (kept for backward compatibility):
       Misspelled or alternate form, ambiguous, misleading, considered pejorative, archaic, etc.
    }
    verFrBelgiumLux             = 6;                            {  Incorrect; 6 is Flemish, not French, for Belgium; use verFlemish      }
    verBelgiumLux               = 6;                            {  Use verFlemish }
    verArabia                   = 16;                           {  Use verArabic }
    verYugoslavia               = 25;                           {  Use verYugoCroatian (same number, now unused), or newer verCroatia }
    verIndia                    = 33;                           {  Use verIndiaHindi }
    verPakistan                 = 34;                           {  Use verPakistanUrdu                                   }
    verRumania                  = 39;                           {  Alternate for verRomania                               }
    verGreekAncient             = 40;                           {  Use verGreecePoly                                 }
    verLapland                  = 46;                           {  Use verSami                                        }
    verFaeroeIsl                = 47;                           {  Use verFaroeIsl                                      }
    verGenericFE                = 58;                           {  Use verFarEastGeneric                               }
    verBelarus                  = 61;                           {  Alternate for verByelorussian                        }
    verUkrania                  = 62;                           {  Use verUkraine }
    verAlternateGr              = 64;                           {  Use verGreeceAlt                                    }
    verSerbia                   = 65;                           {  Alternate for verSerbian                               }
    verSlovenia                 = 66;                           {  Alternate for verSlovenian                             }
    verMacedonia                = 67;                           {  Alternate for verMacedonian                              }
    verBrittany                 = 77;                           {  Alternate for verBreton                               }
    verWales                    = 79;                           {  Alternate for verWelsh                               }
    verArmenia                  = 84;                           {  Alternate for verArmenian                            }
    verGeorgia                  = 85;                           {  Alternate for verGeorgian                            }
    verAustriaGerman            = 92;                           {  Use verAustria                                    }
    verTibet                    = 105;                          {  Use verTibetan                                    }

    minCountry                  = 0;
    maxCountry                  = 107;

                                                                {  Calendar Codes  }
    calGregorian                = 0;
    calArabicCivil              = 1;
    calArabicLunar              = 2;
    calJapanese                 = 3;
    calJewish                   = 4;
    calCoptic                   = 5;
    calPersian                  = 6;

                                                                {  SInt16 Format Codes  }
    intWestern                  = 0;
    intArabic                   = 1;
    intRoman                    = 2;
    intJapanese                 = 3;
    intEuropean                 = 4;
    intOutputMask               = $8000;

                                                                {  CharByte byte types  }
    smSingleByte                = 0;
    smFirstByte                 = -1;
    smLastByte                  = 1;
    smMiddleByte                = 2;

                                                                {  CharType field masks  }
    smcTypeMask                 = $000F;
    smcReserved                 = $00F0;
    smcClassMask                = $0F00;
    smcOrientationMask          = $1000;                        { two-byte script glyph orientation }
    smcRightMask                = $2000;
    smcUpperMask                = $4000;
    smcDoubleMask               = $8000;

                                                                {  Basic CharType character types  }
    smCharPunct                 = $0000;
    smCharAscii                 = $0001;
    smCharEuro                  = $0007;
    smCharExtAscii              = $0007;                        {  More correct synonym for smCharEuro  }
                                                                {  Additional CharType character types for script systems  }
    smCharKatakana              = $0002;                        { Japanese Katakana }
    smCharHiragana              = $0003;                        { Japanese Hiragana }
    smCharIdeographic           = $0004;                        { Hanzi, Kanji, Hanja }
    smCharTwoByteGreek          = $0005;                        { 2-byte Greek in Far East systems }
    smCharTwoByteRussian        = $0006;                        { 2-byte Cyrillic in Far East systems }
    smCharBidirect              = $0008;                        { Arabic/Hebrew }
    smCharContextualLR          = $0009;                        { Contextual left-right: Thai, Indic scripts }
    smCharNonContextualLR       = $000A;                        { Non-contextual left-right: Cyrillic, Greek }
    smCharHangul                = $000C;                        { Korean Hangul }
    smCharJamo                  = $000D;                        { Korean Jamo }
    smCharBopomofo              = $000E;                        { Chinese Bopomofo }
    smCharGanaKana              = $000F;                        { Shared for Japanese Hiragana & Katakana }
                                                                {  old names for some of above, for backward compatibility  }
    smCharFISKana               = $0002;                        { Katakana }
    smCharFISGana               = $0003;                        { Hiragana }
    smCharFISIdeo               = $0004;                        { Hanzi, Kanji, Hanja }

    smCharFISGreek              = $0005;                        { 2-byte Greek in Far East systems }
    smCharFISRussian            = $0006;                        { 2-byte Cyrillic in Far East systems }
                                                                {  CharType classes for punctuation (smCharPunct)  }
    smPunctNormal               = $0000;
    smPunctNumber               = $0100;
    smPunctSymbol               = $0200;
    smPunctBlank                = $0300;                        {  Additional CharType classes for punctuation in two-byte systems  }
    smPunctRepeat               = $0400;                        {  repeat marker  }
    smPunctGraphic              = $0500;                        {  line graphics  }
                                                                {  CharType Katakana and Hiragana classes for two-byte systems  }
    smKanaSmall                 = $0100;                        { small kana character }
    smKanaHardOK                = $0200;                        { can have dakuten }
    smKanaSoftOK                = $0300;                        { can have dakuten or han-dakuten }
                                                                {  CharType Ideographic classes for two-byte systems  }
    smIdeographicLevel1         = $0000;                        { level 1 char }
    smIdeographicLevel2         = $0100;                        { level 2 char }
    smIdeographicUser           = $0200;                        { user char }
                                                                {  old names for above, for backward compatibility  }
    smFISClassLvl1              = $0000;                        { level 1 char }
    smFISClassLvl2              = $0100;                        { level 2 char }
    smFISClassUser              = $0200;                        { user char }
                                                                {  CharType Jamo classes for Korean systems  }
    smJamoJaeum                 = $0000;                        { simple consonant char }
    smJamoBogJaeum              = $0100;                        { complex consonant char }
    smJamoMoeum                 = $0200;                        { simple vowel char }
    smJamoBogMoeum              = $0300;                        { complex vowel char }

                                                                {  CharType glyph orientation for two-byte systems  }
    smCharHorizontal            = $0000;                        {  horizontal character form, or for both  }
    smCharVertical              = $1000;                        {  vertical character form  }
                                                                {  CharType directions  }
    smCharLeft                  = $0000;
    smCharRight                 = $2000;                        {  CharType case modifers  }
    smCharLower                 = $0000;
    smCharUpper                 = $4000;                        {  CharType character size modifiers (1 or multiple bytes).  }
    smChar1byte                 = $0000;
    smChar2byte                 = $8000;

                                                                {  TransliterateText target types for Roman  }
    smTransAscii                = 0;                            { convert to ASCII }
    smTransNative               = 1;                            { convert to font script }
    smTransCase                 = $FE;                          { convert case for all text }
    smTransSystem               = $FF;                          { convert to system script }
                                                                {  TransliterateText target types for two-byte scripts  }
    smTransAscii1               = 2;                            { 1-byte Roman }
    smTransAscii2               = 3;                            { 2-byte Roman }
    smTransKana1                = 4;                            { 1-byte Japanese Katakana }
    smTransKana2                = 5;                            { 2-byte Japanese Katakana }

    smTransGana2                = 7;                            { 2-byte Japanese Hiragana (no 1-byte Hiragana) }
    smTransHangul2              = 8;                            { 2-byte Korean Hangul }
    smTransJamo2                = 9;                            { 2-byte Korean Jamo }
    smTransBopomofo2            = 10;                           { 2-byte Chinese Bopomofo }
                                                                {  TransliterateText target modifiers  }
    smTransLower                = $4000;                        { target becomes lowercase }
    smTransUpper                = $8000;                        { target becomes uppercase }
                                                                {  TransliterateText resource format numbers  }
    smTransRuleBaseFormat       = 1;                            { Rule based trsl resource format  }
    smTransHangulFormat         = 2;                            { Table based Hangul trsl resource format }
                                                                {  TransliterateText property flags  }
    smTransPreDoubleByting      = 1;                            { Convert all text to double byte before transliteration }
    smTransPreLowerCasing       = 2;                            { Convert all text to lower case before transliteration }

                                                                {  TransliterateText source mask - general  }
    smMaskAll                   = $FFFFFFFF;                    { Convert all text }
                                                                {  TransliterateText source masks  }
    smMaskAscii                 = $00000001;                    { 2^smTransAscii }
    smMaskNative                = $00000002;                    { 2^smTransNative }
                                                                {  TransliterateText source masks for two-byte scripts  }
    smMaskAscii1                = $00000004;                    { 2^smTransAscii1 }
    smMaskAscii2                = $00000008;                    { 2^smTransAscii2 }
    smMaskKana1                 = $00000010;                    { 2^smTransKana1 }
    smMaskKana2                 = $00000020;                    { 2^smTransKana2 }
    smMaskGana2                 = $00000080;                    { 2^smTransGana2 }
    smMaskHangul2               = $00000100;                    { 2^smTransHangul2 }
    smMaskJamo2                 = $00000200;                    { 2^smTransJamo2 }
    smMaskBopomofo2             = $00000400;                    { 2^smTransBopomofo2 }

                                                                {  Result values from GetScriptManagerVariable and SetScriptManagerVariable calls.  }
    smNotInstalled              = 0;                            { routine not available in script }
    smBadVerb                   = -1;                           { Bad verb passed to a routine }
    smBadScript                 = -2;                           { Bad script code passed to a routine }

                                                                {  Values for script redraw flag.  }
    smRedrawChar                = 0;                            { Redraw character only }
    smRedrawWord                = 1;                            { Redraw entire word (2-byte systems) }
    smRedrawLine                = -1;                           { Redraw entire line (bidirectional systems) }

                                                                {  GetScriptManagerVariable and SetScriptManagerVariable verbs  }
    smVersion                   = 0;                            { Script Manager version number }
    smMunged                    = 2;                            { Globals change count }
    smEnabled                   = 4;                            { Count of enabled scripts, incl Roman }
    smBidirect                  = 6;                            { At least one bidirectional script }
    smFontForce                 = 8;                            { Force font flag }
    smIntlForce                 = 10;                           { Force intl flag }
    smForced                    = 12;                           { Script was forced to system script }
    smDefault                   = 14;                           { Script was defaulted to Roman script }
    smPrint                     = 16;                           { Printer action routine }
    smSysScript                 = 18;                           { System script }
    smLastScript                = 20;                           { Last keyboard script }
    smKeyScript                 = 22;                           { Keyboard script }
    smSysRef                    = 24;                           { System folder refNum }
    smKeyCache                  = 26;                           { obsolete }
    smKeySwap                   = 28;                           { Swapping table handle }
    smGenFlags                  = 30;                           { General flags long }
    smOverride                  = 32;                           { Script override flags }
    smCharPortion               = 34;                           { Ch vs SpExtra proportion }
                                                                {  New for System 7.0:  }
    smDoubleByte                = 36;                           { Flag for double-byte script installed }
    smKCHRCache                 = 38;                           { Returns pointer to KCHR cache }
    smRegionCode                = 40;                           { Returns current region code (verXxx) }
    smKeyDisableState           = 42;                           { Returns current keyboard disable state }

                                                                {  GetScriptVariable and SetScriptVariable verbs.  }
                                                                {  Note: Verbs private to script systems are negative, while  }
                                                                {  those general across script systems are non-negative.  }
    smScriptVersion             = 0;                            { Script software version }
    smScriptMunged              = 2;                            { Script entry changed count }
    smScriptEnabled             = 4;                            { Script enabled flag }
    smScriptRight               = 6;                            { Right to left flag }
    smScriptJust                = 8;                            { Justification flag }
    smScriptRedraw              = 10;                           { Word redraw flag }
    smScriptSysFond             = 12;                           { Preferred system font }
    smScriptAppFond             = 14;                           { Preferred Application font }
    smScriptBundle              = 16;                           { Beginning of itlb verbs }
    smScriptNumber              = 16;                           { Script itl0 id }
    smScriptDate                = 18;                           { Script itl1 id }
    smScriptSort                = 20;                           { Script itl2 id }
    smScriptFlags               = 22;                           { flags word }
    smScriptToken               = 24;                           { Script itl4 id }
    smScriptEncoding            = 26;                           { id of optional itl5, if present }
    smScriptLang                = 28;                           { Current language for script }

    smScriptNumDate             = 30;                           { Script Number/Date formats. }
    smScriptKeys                = 32;                           { Script KCHR id }
    smScriptIcon                = 34;                           { ID # of SICN or kcs#/kcs4/kcs8 suite }
    smScriptPrint               = 36;                           { Script printer action routine }
    smScriptTrap                = 38;                           { Trap entry pointer }
    smScriptCreator             = 40;                           { Script file creator }
    smScriptFile                = 42;                           { Script file name }
    smScriptName                = 44;                           { Script name }
                                                                {  There is a hole here for old Kanji private verbs 46-76  }
                                                                {  New for System 7.0:  }
    smScriptMonoFondSize        = 78;                           { default monospace FOND (hi) & size (lo) }
    smScriptPrefFondSize        = 80;                           { preferred FOND (hi) & size (lo) }
    smScriptSmallFondSize       = 82;                           { default small FOND (hi) & size (lo) }
    smScriptSysFondSize         = 84;                           { default system FOND (hi) & size (lo) }
    smScriptAppFondSize         = 86;                           { default app FOND (hi) & size (lo) }
    smScriptHelpFondSize        = 88;                           { default Help Mgr FOND (hi) & size (lo) }
    smScriptValidStyles         = 90;                           { mask of valid styles for script }
    smScriptAliasStyle          = 92;                           { style (set) to use for aliases }

    {    special negative verbs for Get/SetScriptVariable that were associated with WorldScriptI    }
    {    move them here to be public    }
                                                                {  WorldScript private verbs  }
    smLayoutCache               = -309;                         {  HiWrd(param) is # entries, LoWrd is max input length }
    smOldVerbSupport            = -311;                         {  param is added to old verbs to map to WSI verb }
    smSetKashidas               = -291;                         {  param is ON or OFF, old verb = -36 }
    smSetKashProp               = -287;                         {  param is kashida proportion, old verb = -32 }
    smScriptSysBase             = -281;                         {  param is associated font to use w/ system font (old verb = -26) }
    smScriptAppBase             = -283;                         {  param is associated font to use w/ app font (old verb = -28) }
    smScriptFntBase             = -285;                         {  param is associated font to use w/ all other fonts (old verb = -30) }
    smScriptLigatures           = -263;                         {  old verb = -8 }
    smScriptNumbers             = -267;                         {  old verb = -12 }

                                                                {  Special script code values for International Utilities  }
    iuSystemScript              = -1;                           {  <obsolete>  system script  }
    iuCurrentScript             = -2;                           {  <obsolete>  current script (for font of grafPort)  }

                                                                {  Negative verbs for KeyScript  }
    smKeyNextScript             = -1;                           {  Switch to next available script  }
    smKeySysScript              = -2;                           {  Switch to the system script  }
    smKeySwapScript             = -3;                           {  Switch to previously-used script  }
                                                                {  New for System 7.0:  }
    smKeyNextKybd               = -4;                           {  Switch to next keyboard in current keyscript  }
    smKeySwapKybd               = -5;                           {  Switch to previously-used keyboard in current keyscript  }
    smKeyDisableKybds           = -6;                           {  Disable keyboards not in system or Roman script  }
    smKeyEnableKybds            = -7;                           {  Re-enable keyboards for all enabled scripts  }
    smKeyToggleInline           = -8;                           {  Toggle inline input for current keyscript  }
    smKeyToggleDirection        = -9;                           {  Toggle default line direction (TESysJust)  }
    smKeyNextInputMethod        = -10;                          {  Switch to next input method in current keyscript  }
    smKeySwapInputMethod        = -11;                          {  Switch to last-used input method in current keyscript  }
    smKeyDisableKybdSwitch      = -12;                          {  Disable switching from the current keyboard  }
    smKeySetDirLeftRight        = -15;                          {  Set default line dir to left-right, align left  }
    smKeySetDirRightLeft        = -16;                          {  Set default line dir to right-left, align right  }
    smKeyRoman                  = -17;                          {  Set keyscript to Roman. Does nothing if Roman-only system, unlike KeyScript(smRoman) which forces an update to current default Roman keyboard  }

    {    Optional font and keyboard script synchronization  }
                                                                {  One more flag in the smGenFlags long.  }
    smfDisableKeyScriptSync     = 27;                           { Disable font and keyboard script synchronization }

                                                                {  We should define masks, too.  }
    smfDisableKeyScriptSyncMask = $08000000;                    { Disable font and keyboard script synchronization mask }

                                                                {  Force keyboard script switching flag and mask for zero and positive KeyScript verbs  }
    smKeyForceKeyScriptBit      = 7;                            {  Force keyboard script switching flag  }
    smKeyForceKeyScriptMask     = $80;                          {  its mask  }

                                                                {  Bits in the smScriptFlags word  }
                                                                {   (bits above 8 are non-static)  }
    smsfIntellCP                = 0;                            { Script has intelligent cut & paste }
    smsfSingByte                = 1;                            { Script has only single bytes }
    smsfNatCase                 = 2;                            { Native chars have upper & lower case }
    smsfContext                 = 3;                            { Script is contextual }
    smsfNoForceFont             = 4;                            { Script will not force characters }
    smsfB0Digits                = 5;                            { Script has alternate digits at B0-B9 }
    smsfAutoInit                = 6;                            { Auto initialize the script }
    smsfUnivExt                 = 7;                            { Script is handled by universal extension }
    smsfSynchUnstyledTE         = 8;                            { Script synchronizes for unstyled TE }
    smsfForms                   = 13;                           { Uses contextual forms for letters }
    smsfLigatures               = 14;                           { Uses contextual ligatures }
    smsfReverse                 = 15;                           { Reverses native text, right-left }
                                                                {  Bits in the smGenFlags long.  }
                                                                {  First (high-order) byte is set from itlc flags byte.  }
    smfShowIcon                 = 31;                           { Show icon even if only one script }
    smfDualCaret                = 30;                           { Use dual caret for mixed direction text }
    smfNameTagEnab              = 29;                           { Reserved for internal use }
    smfUseAssocFontInfo         = 28;                           { Use the associated font info for FontMetrics calls <48> }

                                                                {  Roman script constants  }
                                                                {  The following are here for backward compatibility, but should not be used.  }
                                                                {  This information should be obtained using GetScript.  }
    romanSysFond                = $3FFF;                        { system font id number }
    romanAppFond                = 3;                            { application font id number }
    romanFlags                  = $0007;                        { roman settings }
                                                                {  Script Manager font equates.  }
    smFondStart                 = $4000;                        { start from 16K }
    smFondEnd                   = $C000;                        { past end of range at 48K }
                                                                {  Miscellaneous font equates.  }
    smUprHalfCharSet            = $80;                          { first char code in top half of std char set }

                                                                {  Character Set Extensions  }
    diaeresisUprY               = $D9;
    fraction                    = $DA;
    intlCurrency                = $DB;
    leftSingGuillemet           = $DC;
    rightSingGuillemet          = $DD;
    fiLigature                  = $DE;
    flLigature                  = $DF;
    dblDagger                   = $E0;
    centeredDot                 = $E1;
    baseSingQuote               = $E2;
    baseDblQuote                = $E3;
    perThousand                 = $E4;
    circumflexUprA              = $E5;
    circumflexUprE              = $E6;
    acuteUprA                   = $E7;
    diaeresisUprE               = $E8;
    graveUprE                   = $E9;
    acuteUprI                   = $EA;
    circumflexUprI              = $EB;
    diaeresisUprI               = $EC;
    graveUprI                   = $ED;
    acuteUprO                   = $EE;
    circumflexUprO              = $EF;
    appleLogo                   = $F0;
    graveUprO                   = $F1;
    acuteUprU                   = $F2;
    circumflexUprU              = $F3;
    graveUprU                   = $F4;
    dotlessLwrI                 = $F5;
    circumflex                  = $F6;
    tilde                       = $F7;
    macron                      = $F8;
    breveMark                   = $F9;
    overDot                     = $FA;
    ringMark                    = $FB;
    cedilla                     = $FC;
    doubleAcute                 = $FD;
    ogonek                      = $FE;
    hachek                      = $FF;

                                                                {  ScriptTokenType values  }
    tokenIntl                   = 4;                            { the itl resource number of the tokenizer }
    tokenEmpty                  = -1;                           { used internally as an empty flag }

    tokenUnknown                = 0;                            { chars that do not match a defined token type }
    tokenWhite                  = 1;                            { white space }
    tokenLeftLit                = 2;                            { literal begin }
    tokenRightLit               = 3;                            { literal end }
    tokenAlpha                  = 4;                            { alphabetic }
    tokenNumeric                = 5;                            { numeric }
    tokenNewLine                = 6;                            { new line }
    tokenLeftComment            = 7;                            { open comment }
    tokenRightComment           = 8;                            { close comment }
    tokenLiteral                = 9;                            { literal }
    tokenEscape                 = 10;                           { character escape (e.g. '\' in "\n", "\t") }
    tokenAltNum                 = 11;                           { alternate number (e.g. $B0-B9 in Arabic,Hebrew) }
    tokenRealNum                = 12;                           { real number }
    tokenAltReal                = 13;                           { alternate real number }
    tokenReserve1               = 14;                           { reserved }
    tokenReserve2               = 15;                           { reserved }
    tokenLeftParen              = 16;                           { open parenthesis }
    tokenRightParen             = 17;                           { close parenthesis }
    tokenLeftBracket            = 18;                           { open square bracket }
    tokenRightBracket           = 19;                           { close square bracket }

    tokenLeftCurly              = 20;                           { open curly bracket }
    tokenRightCurly             = 21;                           { close curly bracket }
    tokenLeftEnclose            = 22;                           { open guillemet }
    tokenRightEnclose           = 23;                           { close guillemet }
    tokenPlus                   = 24;
    tokenMinus                  = 25;
    tokenAsterisk               = 26;                           { times/multiply }
    tokenDivide                 = 27;
    tokenPlusMinus              = 28;                           { plus or minus symbol }
    tokenSlash                  = 29;
    tokenBackSlash              = 30;
    tokenLess                   = 31;                           { less than symbol }
    tokenGreat                  = 32;                           { greater than symbol }
    tokenEqual                  = 33;
    tokenLessEqual2             = 34;                           { less than or equal, 2 characters (e.g. <=) }
    tokenLessEqual1             = 35;                           { less than or equal, 1 character }
    tokenGreatEqual2            = 36;                           { greater than or equal, 2 characters (e.g. >=) }
    tokenGreatEqual1            = 37;                           { greater than or equal, 1 character }
    token2Equal                 = 38;                           { double equal (e.g. ==) }
    tokenColonEqual             = 39;                           { colon equal }

    tokenNotEqual               = 40;                           { not equal, 1 character }
    tokenLessGreat              = 41;                           { less/greater, Pascal not equal (e.g. <>) }
    tokenExclamEqual            = 42;                           { exclamation equal, C not equal (e.g. !=) }
    tokenExclam                 = 43;                           { exclamation point }
    tokenTilde                  = 44;                           { centered tilde }
    tokenComma                  = 45;
    tokenPeriod                 = 46;
    tokenLeft2Quote             = 47;                           { open double quote }
    tokenRight2Quote            = 48;                           { close double quote }
    tokenLeft1Quote             = 49;                           { open single quote }
    tokenRight1Quote            = 50;                           { close single quote }
    token2Quote                 = 51;                           { double quote }
    token1Quote                 = 52;                           { single quote }
    tokenSemicolon              = 53;
    tokenPercent                = 54;
    tokenCaret                  = 55;
    tokenUnderline              = 56;
    tokenAmpersand              = 57;
    tokenAtSign                 = 58;
    tokenBar                    = 59;                           { vertical bar }

    tokenQuestion               = 60;
    tokenPi                     = 61;                           { lower-case pi }
    tokenRoot                   = 62;                           { square root symbol }
    tokenSigma                  = 63;                           { capital sigma }
    tokenIntegral               = 64;                           { integral sign }
    tokenMicro                  = 65;
    tokenCapPi                  = 66;                           { capital pi }
    tokenInfinity               = 67;
    tokenColon                  = 68;
    tokenHash                   = 69;                           { e.g. # }
    tokenDollar                 = 70;
    tokenNoBreakSpace           = 71;                           { non-breaking space }
    tokenFraction               = 72;
    tokenIntlCurrency           = 73;
    tokenLeftSingGuillemet      = 74;
    tokenRightSingGuillemet     = 75;
    tokenPerThousand            = 76;
    tokenEllipsis               = 77;
    tokenCenterDot              = 78;
    tokenNil                    = 127;

    delimPad                    = -2;                           {  obsolete, misspelled token names kept for backward compatibility  }
    tokenTilda                  = 44;
    tokenCarat                  = 55;

                                                                {  Table selectors for GetItlTable  }
    smWordSelectTable           = 0;                            {  get word select break table from 'itl2'  }
    smWordWrapTable             = 1;                            {  get word wrap break table from 'itl2'  }
    smNumberPartsTable          = 2;                            {  get default number parts table from 'itl4'  }
    smUnTokenTable              = 3;                            {  get unToken table from 'itl4'  }
    smWhiteSpaceList            = 4;                            {  get white space list from 'itl4'  }
    iuWordSelectTable           = 0;                            {  <obsolete>  get word select break table from 'itl2'  }
    iuWordWrapTable             = 1;                            {  <obsolete>  get word wrap break table from 'itl2'  }
    iuNumberPartsTable          = 2;                            {  <obsolete>  get default number parts table from 'itl4'  }
    iuUnTokenTable              = 3;                            {  <obsolete>  get unToken table from 'itl4'  }
    iuWhiteSpaceList            = 4;                            {  <obsolete>  get white space list from 'itl4'  }

    {    end of stuff moved from Packages.h     }
    tokenOK                     = 0;                            {  TokenResults  }
    tokenOverflow               = 1;                            {  TokenResults  }
    stringOverflow              = 2;                            {  TokenResults  }
    badDelim                    = 3;                            {  TokenResults  }
    badEnding                   = 4;                            {  TokenResults  }
    crash                       = 5;                            {  TokenResults  }


type
    TokenResults                        = SInt8;
    CharByteTable                       = packed array [0..255] of char;
    {  "TokenType" was renamed to "ScriptTokenType" because of a name collisions }
    ScriptTokenType                     = SInt16;
    TokenType                           = ScriptTokenType;

    DelimType                           = array [0..1] of ScriptTokenType;
    CommentType                         = array [0..3] of ScriptTokenType;
    TokenRecPtr = ^TokenRec;
    TokenRec = record
        theToken:               ScriptTokenType;
        position:               Ptr;                                    { pointer into original source }
        length:                 SInt32;                             { length of text in original source }
        stringPosition:         StringPtr;                              { Pascal/C string copy of identifier }
    end;

    TokenBlockPtr = ^TokenBlock;
    TokenBlock = record
        source:                 Ptr;                                    { pointer to stream of characters }
        sourceLength:           SInt32;                             { length of source stream }
        tokenList:              Ptr;                                    { pointer to array of tokens }
        tokenLength:            SInt32;                             { maximum length of TokenList }
        tokenCount:             SInt32;                             { number tokens generated by tokenizer }
        stringList:             Ptr;                                    { pointer to stream of identifiers }
        stringLength:           SInt32;                             { length of string list }
        stringCount:            SInt32;                             { number of bytes currently used }
        doString:               boolean;                                { make strings & put into StringList }
        doAppend:               boolean;                                { append to TokenList rather than replace }
        doAlphanumeric:         boolean;                                { identifiers may include numeric }
        doNest:                 boolean;                                { do comments nest? }
        leftDelims:             array [0..1] of ScriptTokenType;
        rightDelims:            array [0..1] of ScriptTokenType;
        leftComment:            array [0..3] of ScriptTokenType;
        rightComment:           array [0..3] of ScriptTokenType;
        escapeCode:             ScriptTokenType;                        { escape symbol code }
        decimalCode:            ScriptTokenType;
        itlResource:            Handle;                                 { handle to itl4 resource of current script }
        reserved:               array [0..7] of SInt32;             { must be zero! }
    end;

    {
     *  GetSysDirection()
     *
     *  Availability:
     *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function GetSysDirection: SInt16; external name '_GetSysDirection';
{
 *  SetSysDirection()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetSysDirection(value: SInt16); external name '_SetSysDirection';
{
 *  FontScript()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FontScript: SInt16; external name '_FontScript';
{
 *  IntlScript()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function IntlScript: SInt16; external name '_IntlScript';
{
 *  FontToScript()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FontToScript(fontNumber: SInt16): SInt16; external name '_FontToScript';
{
 *  GetScriptManagerVariable()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetScriptManagerVariable(selector: SInt16): SInt32; external name '_GetScriptManagerVariable';
{
 *  SetScriptManagerVariable()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetScriptManagerVariable(selector: SInt16; param: SInt32): OSErr; external name '_SetScriptManagerVariable';
{
 *  GetScriptVariable()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetScriptVariable(script: SInt16; selector: SInt16): SInt32; external name '_GetScriptVariable';
{
 *  SetScriptVariable()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetScriptVariable(script: SInt16; selector: SInt16; param: SInt32): OSErr; external name '_SetScriptVariable';
{
 *  CharacterByteType()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CharacterByteType(textBuf: Ptr; textOffset: SInt16; script: ScriptCode): SInt16; external name '_CharacterByteType';
{
 *  CharacterType()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CharacterType(textBuf: Ptr; textOffset: SInt16; script: ScriptCode): SInt16; external name '_CharacterType';
{
 *  TransliterateText()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TransliterateText(srcHandle: Handle; dstHandle: Handle; target: SInt16; srcMask: SInt32; script: ScriptCode): OSErr; external name '_TransliterateText';
{
 *  FillParseTable()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FillParseTable(var table: CharByteTable; script: ScriptCode): boolean; external name '_FillParseTable';
{
 *  GetIntlResource()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetIntlResource(theID: SInt16): Handle; external name '_GetIntlResource';
{
 *  ClearIntlResourceCache()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure ClearIntlResourceCache; external name '_ClearIntlResourceCache';
{
 *  GetIntlResourceTable()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure GetIntlResourceTable(script: ScriptCode; tableCode: SInt16; var itlHandle: Handle; var offset: SInt32; var length: SInt32); external name '_GetIntlResourceTable';

{
 *  IntlTokenize()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function IntlTokenize(tokenParam: TokenBlockPtr): TokenResults; external name '_IntlTokenize';


{$ALIGN MAC68K}
{#POP}
{unit SystemConfiguration}
{$ALIGN MAC68K}






{!
    @header SystemConfiguration.h
    The SystemConfiguration framework provides access to the
    data used to configure a running system.  The APIs provided
    by this framework communicate with the "configd" daemon.

    The "configd" daemon manages a "dynamic store" reflecting the
    desired configuration settings as well as the current state
    of the system.  The daemon provides a notification mechanism
    for user-level processes which need to be aware of changes
    made to the data.  Lastly, the daemon loads a number of
    bundles (or plug-ins) that monitor low-level kernel events
    and, via a set of policy modules, keep the state data up
    to date.
 }

{!
    @enum
    @discussion Returned status codes.

    @constant kSCStatusOK           Success
    @constant kSCStatusFailed       Non-specific Failure
    @constant kSCStatusInvalidArgument  Invalid argument
    @constant kSCStatusAccessError      Permission denied
    @constant kSCStatusNoKey        No such key
    @constant kSCStatusKeyExists        Data associated with key already defined
    @constant kSCStatusLocked       Lock already held
    @constant kSCStatusNeedLock     Lock required for this operation

    @constant kSCStatusNoStoreSession   Configuration daemon session not active
    @constant kSCStatusNoStoreServer    Configuration daemon not (no longer) available
    @constant kSCStatusNotifierActive   Notifier is currently active

    @constant kSCStatusNoPrefsSession   Preference session not active
    @constant kSCStatusPrefsBusy        Preferences update currently in progress
    @constant kSCStatusNoConfigFile     Configuration file not found
    @constant kSCStatusNoLink       No such link
    @constant kSCStatusStale        Write attempted on stale version of object
    @constant kSCStatusMaxLink      Maximum link count exceeded

    @constant kSCStatusReachabilityUnknown
        A determination could not be made regarding the reachability
        of the specified nodename/address.
}
const
    {
     * Generic status codes
     }
    kSCStatusOK             = 0;    { Success }
    kSCStatusFailed             = 1001; { Non-specific failure }
    kSCStatusInvalidArgument        = 1002; { Invalid argument }
    kSCStatusAccessError            = 1003; { Permission denied
                               - must be root to obtain lock
                               - could not create access/create preferences
                             }
    kSCStatusNoKey              = 1004; { No such key }
    kSCStatusKeyExists          = 1005; { Key already defined }
    kSCStatusLocked             = 1006; { Lock already held }
    kSCStatusNeedLock           = 1007; { Lock required for this operation }
    {
     * SCDynamicStore status codes
     }
    kSCStatusNoStoreSession         = 2001; { Configuration daemon session not active }
    kSCStatusNoStoreServer          = 2002; { Configuration daemon not (no longer) available }
    kSCStatusNotifierActive         = 2003; { Notifier is currently active }
    {
     * SCPreferences status codes
     }
    kSCStatusNoPrefsSession         = 3001; { Preference session not active }
    kSCStatusPrefsBusy          = 3002; { Preferences update currently in progress }
    kSCStatusNoConfigFile           = 3003; { Configuration file not found }
    kSCStatusNoLink             = 3004; { No such link }
    kSCStatusStale              = 3005; { Write attempted on stale version of object }
    kSCStatusMaxLink            = 3006; { Maximum link count exceeded }
    {
     * SCNetwork status codes
     }
    kSCStatusReachabilityUnknown        = 4001; { Network reachability cannot be determined }


{!
    @function SCError
    @discussion Returns a last SystemConfiguration.framework API error code.
    @result The last error encountered.
 }
function SCError: SInt32; external name '_SCError';

{!
    @function SCErrorString
    @discussion Returns a pointer to the error message string associated
        with the specified status.
    @param status The SCDynamicStoreStatus to be returned.
    @result The error message string.
 }
function SCErrorString( status: SInt32 ): ConstCStringPtr; external name '_SCErrorString';
{unit TextCommon}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}

{ TextEncodingBase type & values }
{ (values 0-32 correspond to the Script Codes defined in Inside Macintosh: Text pages 6-52 and 6-53 }

type
    TextEncodingBase                    = UInt32;

const
                                                                {  Mac OS encodings }
    kTextEncodingMacRoman       = 0;
    kTextEncodingMacJapanese    = 1;
    kTextEncodingMacChineseTrad = 2;
    kTextEncodingMacKorean      = 3;
    kTextEncodingMacArabic      = 4;
    kTextEncodingMacHebrew      = 5;
    kTextEncodingMacGreek       = 6;
    kTextEncodingMacCyrillic    = 7;
    kTextEncodingMacDevanagari  = 9;
    kTextEncodingMacGurmukhi    = 10;
    kTextEncodingMacGujarati    = 11;
    kTextEncodingMacOriya       = 12;
    kTextEncodingMacBengali     = 13;
    kTextEncodingMacTamil       = 14;
    kTextEncodingMacTelugu      = 15;
    kTextEncodingMacKannada     = 16;
    kTextEncodingMacMalayalam   = 17;
    kTextEncodingMacSinhalese   = 18;
    kTextEncodingMacBurmese     = 19;
    kTextEncodingMacKhmer       = 20;
    kTextEncodingMacThai        = 21;
    kTextEncodingMacLaotian     = 22;
    kTextEncodingMacGeorgian    = 23;
    kTextEncodingMacArmenian    = 24;
    kTextEncodingMacChineseSimp = 25;
    kTextEncodingMacTibetan     = 26;
    kTextEncodingMacMongolian   = 27;
    kTextEncodingMacEthiopic    = 28;
    kTextEncodingMacCentralEurRoman = 29;
    kTextEncodingMacVietnamese  = 30;
    kTextEncodingMacExtArabic   = 31;                           {  The following use script code 0, smRoman }
    kTextEncodingMacSymbol      = 33;
    kTextEncodingMacDingbats    = 34;
    kTextEncodingMacTurkish     = 35;
    kTextEncodingMacCroatian    = 36;
    kTextEncodingMacIcelandic   = 37;
    kTextEncodingMacRomanian    = 38;
    kTextEncodingMacCeltic      = 39;
    kTextEncodingMacGaelic      = 40;
    kTextEncodingMacKeyboardGlyphs = 41;

    {  The following are older names for backward compatibility }
    kTextEncodingMacTradChinese = 2;
    kTextEncodingMacRSymbol     = 8;
    kTextEncodingMacSimpChinese = 25;
    kTextEncodingMacGeez        = 28;
    kTextEncodingMacEastEurRoman = 29;
    kTextEncodingMacUninterp    = 32;


    {
       Beginning in Mac OS 8.5, the following meta-value is used to indicate Unicode in some parts
       of the Mac OS which previously only expected a Mac OS script code. In some of these places,
       only 7 bits are available to indicate encoding (script code), so kTextEncodingUnicodeDefault
       cannot be used. For example, kTextEncodingMacUnicode can be used to indicate Unicode in the
       7-bit script code field of a Unicode input method's ComponentDescription.componentFlags field;
       it can also be used to indicate Unicode in the 16-bit script code field of an AppleEvent's
       typeIntlWritingCode text tag.
    }
    kTextEncodingMacUnicode     = $7E;                          {  Meta-value, Unicode as a Mac encoding }

    {  Variant Mac OS encodings that use script codes other than 0 }
                                                                {  The following use script code 4, smArabic }
    kTextEncodingMacFarsi       = $8C;                          {  Like MacArabic but uses Farsi digits }
                                                                {  The following use script code 7, smCyrillic }
    kTextEncodingMacUkrainian   = $98;                          {  Meta-value in TEC 1.5 & later; maps to kTextEncodingMacCyrillic variant     }
                                                                {  The following use script code 28, smEthiopic }
    kTextEncodingMacInuit       = $EC;                          {  The following use script code 32, smUnimplemented }
    kTextEncodingMacVT100       = $FC;                          {  VT100/102 font from Comm Toolbox: Latin-1 repertoire + box drawing etc }

    {  Special Mac OS encodings }
    kTextEncodingMacHFS         = $FF;                          {  Meta-value, should never appear in a table. }

    {  Unicode & ISO UCS encodings begin at 0x100 }
    kTextEncodingUnicodeDefault = $0100;                        {  Meta-value, should never appear in a table. }
    kTextEncodingUnicodeV1_1    = $0101;
    kTextEncodingISO10646_1993  = $0101;                        {  Code points identical to Unicode 1.1 }
    kTextEncodingUnicodeV2_0    = $0103;                        {  New location for Korean Hangul }
    kTextEncodingUnicodeV2_1    = $0103;                        {  We treat both Unicode 2.0 and Unicode 2.1 as 2.1 }
    kTextEncodingUnicodeV3_0    = $0104;
    kTextEncodingUnicodeV3_1    = $0105;                        {  Adds characters requiring surrogate pairs in UTF-16 }
    kTextEncodingUnicodeV3_2    = $0106;

    {  ISO 8-bit and 7-bit encodings begin at 0x200 }
    kTextEncodingISOLatin1      = $0201;                        {  ISO 8859-1 }
    kTextEncodingISOLatin2      = $0202;                        {  ISO 8859-2 }
    kTextEncodingISOLatin3      = $0203;                        {  ISO 8859-3 }
    kTextEncodingISOLatin4      = $0204;                        {  ISO 8859-4 }
    kTextEncodingISOLatinCyrillic = $0205;                      {  ISO 8859-5 }
    kTextEncodingISOLatinArabic = $0206;                        {  ISO 8859-6, = ASMO 708, =DOS CP 708 }
    kTextEncodingISOLatinGreek  = $0207;                        {  ISO 8859-7 }
    kTextEncodingISOLatinHebrew = $0208;                        {  ISO 8859-8 }
    kTextEncodingISOLatin5      = $0209;                        {  ISO 8859-9 }
    kTextEncodingISOLatin6      = $020A;                        {  ISO 8859-10                            }
    kTextEncodingISOLatin7      = $020D;                        {  ISO 8859-13, Baltic Rim                    }
    kTextEncodingISOLatin8      = $020E;                        {  ISO 8859-14, Celtic                     }
    kTextEncodingISOLatin9      = $020F;                        {  ISO 8859-15, 8859-1 changed for EURO & CP1252 letters   }

    {  MS-DOS & Windows encodings begin at 0x400 }
    kTextEncodingDOSLatinUS     = $0400;                        {  code page 437 }
    kTextEncodingDOSGreek       = $0405;                        {  code page 737 (formerly code page 437G) }
    kTextEncodingDOSBalticRim   = $0406;                        {  code page 775 }
    kTextEncodingDOSLatin1      = $0410;                        {  code page 850, "Multilingual" }
    kTextEncodingDOSGreek1      = $0411;                        {  code page 851 }
    kTextEncodingDOSLatin2      = $0412;                        {  code page 852, Slavic }
    kTextEncodingDOSCyrillic    = $0413;                        {  code page 855, IBM Cyrillic }
    kTextEncodingDOSTurkish     = $0414;                        {  code page 857, IBM Turkish }
    kTextEncodingDOSPortuguese  = $0415;                        {  code page 860 }
    kTextEncodingDOSIcelandic   = $0416;                        {  code page 861 }
    kTextEncodingDOSHebrew      = $0417;                        {  code page 862 }
    kTextEncodingDOSCanadianFrench = $0418;                     {  code page 863 }
    kTextEncodingDOSArabic      = $0419;                        {  code page 864 }
    kTextEncodingDOSNordic      = $041A;                        {  code page 865 }
    kTextEncodingDOSRussian     = $041B;                        {  code page 866 }
    kTextEncodingDOSGreek2      = $041C;                        {  code page 869, IBM Modern Greek }
    kTextEncodingDOSThai        = $041D;                        {  code page 874, also for Windows }
    kTextEncodingDOSJapanese    = $0420;                        {  code page 932, also for Windows; Shift-JIS with additions }
    kTextEncodingDOSChineseSimplif = $0421;                     {  code page 936, also for Windows; was EUC-CN, now GBK (EUC-CN extended) }
    kTextEncodingDOSKorean      = $0422;                        {  code page 949, also for Windows; Unified Hangul Code (EUC-KR extended) }
    kTextEncodingDOSChineseTrad = $0423;                        {  code page 950, also for Windows; Big-5 }
    kTextEncodingWindowsLatin1  = $0500;                        {  code page 1252 }
    kTextEncodingWindowsANSI    = $0500;                        {  code page 1252 (alternate name) }
    kTextEncodingWindowsLatin2  = $0501;                        {  code page 1250, Central Europe }
    kTextEncodingWindowsCyrillic = $0502;                       {  code page 1251, Slavic Cyrillic }
    kTextEncodingWindowsGreek   = $0503;                        {  code page 1253 }
    kTextEncodingWindowsLatin5  = $0504;                        {  code page 1254, Turkish }
    kTextEncodingWindowsHebrew  = $0505;                        {  code page 1255 }
    kTextEncodingWindowsArabic  = $0506;                        {  code page 1256 }
    kTextEncodingWindowsBalticRim = $0507;                      {  code page 1257 }
    kTextEncodingWindowsVietnamese = $0508;                     {  code page 1258 }
    kTextEncodingWindowsKoreanJohab = $0510;                    {  code page 1361, for Windows NT }

    {  Various national standards begin at 0x600 }
    kTextEncodingUS_ASCII       = $0600;
    kTextEncodingJIS_X0201_76   = $0620;                        {  JIS Roman and 1-byte katakana (halfwidth) }
    kTextEncodingJIS_X0208_83   = $0621;
    kTextEncodingJIS_X0208_90   = $0622;
    kTextEncodingJIS_X0212_90   = $0623;
    kTextEncodingJIS_C6226_78   = $0624;
    kTextEncodingShiftJIS_X0213_00 = $0628;                     {  Shift-JIS format encoding of JIS X0213 planes 1 and 2 }
    kTextEncodingGB_2312_80     = $0630;
    kTextEncodingGBK_95         = $0631;                        {  annex to GB 13000-93; for Windows 95; EUC-CN extended }
    kTextEncodingGB_18030_2000  = $0632;
    kTextEncodingKSC_5601_87    = $0640;                        {  same as KSC 5601-92 without Johab annex }
    kTextEncodingKSC_5601_92_Johab = $0641;                     {  KSC 5601-92 Johab annex }
    kTextEncodingCNS_11643_92_P1 = $0651;                       {  CNS 11643-1992 plane 1 }
    kTextEncodingCNS_11643_92_P2 = $0652;                       {  CNS 11643-1992 plane 2 }
    kTextEncodingCNS_11643_92_P3 = $0653;                       {  CNS 11643-1992 plane 3 (was plane 14 in 1986 version) }

    {  ISO 2022 collections begin at 0x800 }
    kTextEncodingISO_2022_JP    = $0820;                        {  RFC 1468 }
    kTextEncodingISO_2022_JP_2  = $0821;                        {  RFC 1554 }
    kTextEncodingISO_2022_JP_1  = $0822;                        {  RFC 2237 }
    kTextEncodingISO_2022_JP_3  = $0823;                        {  JIS X0213 }
    kTextEncodingISO_2022_CN    = $0830;
    kTextEncodingISO_2022_CN_EXT = $0831;
    kTextEncodingISO_2022_KR    = $0840;

    {  EUC collections begin at 0x900 }
    kTextEncodingEUC_JP         = $0920;                        {  ISO 646, 1-byte katakana, JIS 208, JIS 212 }
    kTextEncodingEUC_CN         = $0930;                        {  ISO 646, GB 2312-80 }
    kTextEncodingEUC_TW         = $0931;                        {  ISO 646, CNS 11643-1992 Planes 1-16 }
    kTextEncodingEUC_KR         = $0940;                        {  ISO 646, KS C 5601-1987 }

    {  Misc standards begin at 0xA00 }
    kTextEncodingShiftJIS       = $0A01;                        {  plain Shift-JIS }
    kTextEncodingKOI8_R         = $0A02;                        {  Russian internet standard }
    kTextEncodingBig5           = $0A03;                        {  Big-5 (has variants) }
    kTextEncodingMacRomanLatin1 = $0A04;                        {  Mac OS Roman permuted to align with ISO Latin-1 }
    kTextEncodingHZ_GB_2312     = $0A05;                        {  HZ (RFC 1842, for Chinese mail & news) }
    kTextEncodingBig5_HKSCS_1999 = $0A06;                       {  Big-5 with Hong Kong special char set supplement }

    {  Other platform encodings }
    kTextEncodingNextStepLatin  = $0B01;                        {  NextStep encoding }

    {  EBCDIC & IBM host encodings begin at 0xC00 }
    kTextEncodingEBCDIC_US      = $0C01;                        {  basic EBCDIC-US }
    kTextEncodingEBCDIC_CP037   = $0C02;                        {  code page 037, extended EBCDIC (Latin-1 set) for US,Canada... }

    {  Special values }
    kTextEncodingMultiRun       = $0FFF;                        {  Multi-encoding text with external run info }
    kTextEncodingUnknown        = $FFFF;                        {  Unknown or unspecified                   }


    {    TextEncodingVariant type & values  }

type
    TextEncodingVariant                 = UInt32;
    {  Default TextEncodingVariant, for any TextEncodingBase }

const
    kTextEncodingDefaultVariant = 0;

    {  Variants of kTextEncodingMacRoman                                                         }
    kMacRomanDefaultVariant     = 0;                            {  meta value, maps to 1 or 2 depending on System  }
    kMacRomanCurrencySignVariant = 1;                           {  Mac OS version < 8.5, 0xDB is CURRENCY SIGN }
    kMacRomanEuroSignVariant    = 2;                            {  Mac OS version >= 8.5, 0xDB is EURO SIGN       }

    {  Variants of kTextEncodingMacCyrillic (for TEC 1.5 and later)                              }
    kMacCyrillicDefaultVariant  = 0;                            {  meta value, maps to 1, 2, or 3 depending on System }
    kMacCyrillicCurrSignStdVariant = 1;                         {  Mac OS < 9.0 (RU,BG), 0xFF = CURRENCY SIGN, 0xA2/0xB6 = CENT / PARTIAL DIFF. }
    kMacCyrillicCurrSignUkrVariant = 2;                         {  Mac OS < 9.0 (UA,LangKit), 0xFF = CURRENCY SIGN, 0xA2/0xB6 = GHE WITH UPTURN }
    kMacCyrillicEuroSignVariant = 3;                            {  Mac OS >= 9.0, 0xFF is EURO SIGN, 0xA2/0xB6 = GHE WITH UPTURN }

    {  Variants of kTextEncodingMacIcelandic                                                     }
    kMacIcelandicStdDefaultVariant = 0;                         {  meta value, maps to 2 or 4 depending on System  }
    kMacIcelandicTTDefaultVariant = 1;                          {  meta value, maps to 3 or 5 depending on System  }
                                                                {  The following are for Mac OS version < 8.5, 0xDB is CURRENCY SIGN              }
    kMacIcelandicStdCurrSignVariant = 2;                        {  0xBB/0xBC are fem./masc. ordinal indicators }
    kMacIcelandicTTCurrSignVariant = 3;                         {  0xBB/0xBC are fi/fl ligatures }
                                                                {  The following are for Mac OS version >= 8.5, 0xDB is EURO SIGN                   }
    kMacIcelandicStdEuroSignVariant = 4;                        {  0xBB/0xBC are fem./masc. ordinal indicators }
    kMacIcelandicTTEuroSignVariant = 5;                         {  0xBB/0xBC are fi/fl ligatures }

    {  Variants of kTextEncodingMacCroatian                                                      }
    kMacCroatianDefaultVariant  = 0;                            {  meta value, maps to 1 or 2 depending on System  }
    kMacCroatianCurrencySignVariant = 1;                        {  Mac OS version < 8.5, 0xDB is CURRENCY SIGN        }
    kMacCroatianEuroSignVariant = 2;                            {  Mac OS version >= 8.5, 0xDB is EURO SIGN       }


    {  Variants of kTextEncodingMacRomanian                                                      }
    kMacRomanianDefaultVariant  = 0;                            {  meta value, maps to 1 or 2 depending on System  }
    kMacRomanianCurrencySignVariant = 1;                        {  Mac OS version < 8.5, 0xDB is CURRENCY SIGN        }
    kMacRomanianEuroSignVariant = 2;                            {  Mac OS version >= 8.5, 0xDB is EURO SIGN       }


    {  Variants of kTextEncodingMacJapanese }
    kMacJapaneseStandardVariant = 0;
    kMacJapaneseStdNoVerticalsVariant = 1;
    kMacJapaneseBasicVariant    = 2;
    kMacJapanesePostScriptScrnVariant = 3;
    kMacJapanesePostScriptPrintVariant = 4;
    kMacJapaneseVertAtKuPlusTenVariant = 5;

    {  Variants of kTextEncodingMacArabic }
    kMacArabicStandardVariant   = 0;                            {  0xC0 is 8-spoke asterisk, 0x2A & 0xAA are asterisk (e.g. Cairo) }
    kMacArabicTrueTypeVariant   = 1;                            {  0xC0 is asterisk, 0x2A & 0xAA are multiply signs (e.g. Baghdad) }
    kMacArabicThuluthVariant    = 2;                            {  0xC0 is Arabic five-point star, 0x2A & 0xAA are multiply signs }
    kMacArabicAlBayanVariant    = 3;                            {  8-spoke asterisk, multiply sign, Koranic ligatures & parens }

    {  Variants of kTextEncodingMacFarsi }
    kMacFarsiStandardVariant    = 0;                            {  0xC0 is 8-spoke asterisk, 0x2A & 0xAA are asterisk (e.g. Tehran) }
    kMacFarsiTrueTypeVariant    = 1;                            {  asterisk, multiply signs, Koranic ligatures, geometric shapes }

    {  Variants of kTextEncodingMacHebrew }
    kMacHebrewStandardVariant   = 0;
    kMacHebrewFigureSpaceVariant = 1;

    {  Variants of kTextEncodingMacVT100                                                         }
    kMacVT100DefaultVariant     = 0;                            {  meta value, maps to 1 or 2 depending on System  }
    kMacVT100CurrencySignVariant = 1;                           {  Mac OS version < 8.5, 0xDB is CURRENCY SIGN        }
    kMacVT100EuroSignVariant    = 2;                            {  Mac OS version >= 8.5, 0xDB is EURO SIGN       }

    {  Variants of Unicode & ISO 10646 encodings }
    kUnicodeNoSubset            = 0;
    kUnicodeCanonicalDecompVariant = 2;                         {  canonical decomposition (NFD); excludes composed characters }
    kUnicodeCanonicalCompVariant = 3;                           {  canonical composition (NFC); uses the composed chars as of Unicode 3.1 }

    {  Variants of Big-5 encoding }
    kBig5_BasicVariant          = 0;
    kBig5_StandardVariant       = 1;                            {  0xC6A1-0xC7FC: kana, Cyrillic, enclosed numerics }
    kBig5_ETenVariant           = 2;                            {  adds kana, Cyrillic, radicals, etc with hi bytes C6-C8,F9 }

    {  Variants of MacRomanLatin1                                                                }
    kMacRomanLatin1DefaultVariant = 0;                          {  meta value, maps to others depending on System }
    kMacRomanLatin1StandardVariant = 2;                         {  permuted MacRoman, EuroSignVariant }
    kMacRomanLatin1TurkishVariant = 6;                          {  permuted MacTurkish }
    kMacRomanLatin1CroatianVariant = 8;                         {  permuted MacCroatian, EuroSignVariant }
    kMacRomanLatin1IcelandicVariant = 11;                       {  permuted MacIcelandic, StdEuroSignVariant }
    kMacRomanLatin1RomanianVariant = 14;                        {  permuted MacRomanian, EuroSignVariant }

    {  Unicode variants not yet supported (and not fully defined) }
    kUnicodeNoCompatibilityVariant = 1;
    kUnicodeNoCorporateVariant  = 4;

    {  The following are older names for backward compatibility }
    kMacRomanStandardVariant    = 0;
    kMacIcelandicStandardVariant = 0;
    kMacIcelandicTrueTypeVariant = 1;
    kJapaneseStandardVariant    = 0;
    kJapaneseStdNoVerticalsVariant = 1;
    kJapaneseBasicVariant       = 2;
    kJapanesePostScriptScrnVariant = 3;
    kJapanesePostScriptPrintVariant = 4;
    kJapaneseVertAtKuPlusTenVariant = 5;                        {  kJapaneseStdNoOneByteKanaVariant = 6,  // replaced by kJapaneseNoOneByteKanaOption }
                                                                {  kJapaneseBasicNoOneByteKanaVariant = 7,    // replaced by kJapaneseNoOneByteKanaOption     }
    kHebrewStandardVariant      = 0;
    kHebrewFigureSpaceVariant   = 1;
    kUnicodeMaxDecomposedVariant = 2;                           {  replaced by kUnicodeCanonicalDecompVariant }
    kUnicodeNoComposedVariant   = 3;                            {  this really meant NoComposing; replaced by kUnicodeCanonicalCompVariant }
                                                                {  The following Japanese variant options were never supported and are now deprecated. }
                                                                {  In TEC 1.4 and later their functionality is replaced by the Unicode Converter options listed. }
    kJapaneseNoOneByteKanaOption = $20;                         {  replaced by UnicodeConverter option kUnicodeNoHalfwidthCharsBit }
    kJapaneseUseAsciiBackslashOption = $40;                     {  replaced by UnicodeConverter option kUnicodeForceASCIIRangeBit }

    {    TextEncodingFormat type & values   }

type
    TextEncodingFormat                  = UInt32;

const
                                                                {  Default TextEncodingFormat for any TextEncodingBase }
    kTextEncodingDefaultFormat  = 0;                            {  Formats for Unicode & ISO 10646 }
    kUnicode16BitFormat         = 0;
    kUnicodeUTF7Format          = 1;
    kUnicodeUTF8Format          = 2;
    kUnicode32BitFormat         = 3;

    {    TextEncoding type  }

type
    TextEncoding                        = UInt32;
    TextEncodingPtr                     = ^TextEncoding; { when a VAR xx: TextEncoding parameter can be nil, it is changed to xx: TextEncodingPtr }
    {  name part selector for GetTextEncodingName }
    TextEncodingNameSelector            = UInt32;

const
    kTextEncodingFullName       = 0;
    kTextEncodingBaseName       = 1;
    kTextEncodingVariantName    = 2;
    kTextEncodingFormatName     = 3;

    {    Types used in conversion   }

type
    TextEncodingRunPtr = ^TextEncodingRun;
    TextEncodingRun = record
        offset:                 ByteOffset;
        textEncoding:           TextEncoding;
    end;

    ConstTextEncodingRunPtr             = ^TextEncodingRun;
    ScriptCodeRunPtr = ^ScriptCodeRun;
    ScriptCodeRun = record
        offset:                 ByteOffset;
        script:                 ScriptCode;
    end;

    ConstScriptCodeRunPtr               = ^ScriptCodeRun;
    TextPtr                             = ^UInt8;
    ConstTextPtr                        = ^UInt8;
    {  Basic types for Unicode characters and strings: }
    UniCharArrayPtr                     = ^UniChar;
    ConstUniCharArrayPtr                = ^UniChar;
    {
       UniCharArrayHandle is a handle type to correspond to UniCharArrayPtr,
       i.e. a handle to an array of UniChars (UInt16s).
    }
    UniCharArrayHandle                  = ^UniCharArrayPtr;
    {
       UniCharArrayOffset is used to indicate an edge offset in an array
       of UniChars (UInt16s).
    }
    UniCharArrayOffset                  = UInt32;
    UniCharArrayOffsetPtr                   = ^UniCharArrayOffset;
    {  enums for TextEncoding Conversion routines }

const
    kTextScriptDontCare         = -128;
    kTextLanguageDontCare       = -128;
    kTextRegionDontCare         = -128;

    {  struct for TECGetInfo }


type
    TECInfoPtr = ^TECInfo;
    TECInfo = record
        format:                 UInt16;                                 {  format code for this struct }
        tecVersion:             UInt16;                                 {  TEC version in BCD, e.g. 0x0121 for 1.2.1 }
        tecTextConverterFeatures: UInt32;                               {  bitmask indicating TEC features/fixes }
        tecUnicodeConverterFeatures: UInt32;                            {  bitmask indicating UnicodeConverter features/fixes }
        tecTextCommonFeatures:  UInt32;                                 {  bitmask indicating TextCommon features/fixes }
        tecTextEncodingsFolderName: Str31;                              {  localized name of Text Encodings folder (pascal string) }
        tecExtensionFileName:   Str31;                                  {  localized name of TEC extension (pascal string) }
        tecLowestTEFileVersion: UInt16;                                 {  Lowest version (BCD) of all files in Text Encodings folder }
        tecHighestTEFileVersion: UInt16;                                {  Highest version (BCD) of all files in Text Encodings folder }
    end;

    TECInfoHandle                       = ^TECInfoPtr;
    {  Value for TECInfo format code }

const
    kTECInfoCurrentFormat       = 2;                            {  any future formats will just add fields at the end }

    {
       Defined feature/fix bits for tecUnicodeConverterFeatures field
       Bit:                             Meaning if set:
       ----                             ---------------
       kTECKeepInfoFixBit               Unicode Converter no longer ignores other control flags if
                                        kUnicodeKeepInfoBit is set. Bug fix in TEC Manager 1.2.1.
       kTECFallbackTextLengthFixBit     Unicode Converter honors the *srcConvLen and *destConvLen
                                        returned by caller-supplied fallback handler for any status it
                                        returns except for kTECUnmappableElementErr (previously it only
                                        honored these values if noErr was returned). Bug fix in TEC
                                        Manager 1.2.1.
       kTECTextRunBitClearFixBit        ConvertFromUnicodeToTextRun & ConvertFromUnicodeToScriptCodeRun
                                        function correctly if the kUnicodeTextRunBit is set (previously
                                        their determination of best target encoding was incorrect). Bug
                                        fix in TEC Manager 1.3.
       kTECTextToUnicodeScanFixBit      ConvertFromTextToUnicode uses an improved scanner and maintains
                                        some resulting state information, which it uses for mapping.
                                        This has several effects:
                                        - Improved mapping of 0x30-0x39 digits in Mac OS Arabic, fewer
                                          direction overrides when mapping Mac OS Arabic & Hebrew, and
                                          improved mapping of certain characters in Indic encodings.
                                        - Malformed input produces kTextMalformedInputErr.
                                        - ConvertFromTextToUnicode accepts and uses the control flags
                                          kUnicodeKeepInfoMask and kUnicodeStringUnterminatedMask.
                                        Bug fix and enhancement in TEC Manager 1.3.
       kTECAddForceASCIIChangesBit      Define new control flag bits kUnicodeForceASCIIRangeBit and
                                        kUnicodeNoHalfwidthCharsBit for use with
                                        ConvertFromTextToUnicode, ConvertFromUnicodeToText, etc.
                                        Enhancement in TEC Manager 1.4.
       kTECPreferredEncodingFixBit      CreateUnicodeToTextRunInfo and related functions fix a problem
                                        that occurred when a preferred encoding was specified that did
                                        not match the System script; the preferred script was not
                                        actually placed first in the ordered list of encodings to use.
                                        Bug fix in TEC Manager 1.4.
       kTECAddTextRunHeuristicsBit      Define new control flag bit kUnicodeTextRunHeuristicsBit for
                                        use with ConvertFromUnicodeToTextRun.
       kTECAddFallbackInterruptBit      Define new option kUnicodeFallbackInterruptSafeMask for use
                                        with SetFallbackUnicodeToText. If a client fallback handler is
                                        installed without specifying this bit, ConvertFromUnicodeToText
                                        will HLock the tables it uses (in case the fallback handler
                                        moves memory); otherwise, it won't.
    }

    kTECKeepInfoFixBit          = 0;
    kTECFallbackTextLengthFixBit = 1;
    kTECTextRunBitClearFixBit   = 2;
    kTECTextToUnicodeScanFixBit = 3;
    kTECAddForceASCIIChangesBit = 4;
    kTECPreferredEncodingFixBit = 5;
    kTECAddTextRunHeuristicsBit = 6;
    kTECAddFallbackInterruptBit = 7;

    kTECKeepInfoFixMask         = $00000001;
    kTECFallbackTextLengthFixMask = $00000002;
    kTECTextRunBitClearFixMask  = $00000004;
    kTECTextToUnicodeScanFixMask = $00000008;
    kTECAddForceASCIIChangesMask = $00000010;
    kTECPreferredEncodingFixMask = $00000020;
    kTECAddTextRunHeuristicsMask = $00000040;
    kTECAddFallbackInterruptMask = $00000080;

    {
       -------------------------------------------------------------------------------------------------
       CONSTANTS for common and special Unicode code values
       -------------------------------------------------------------------------------------------------
    }

    kUnicodeByteOrderMark       = $FEFF;
    kUnicodeObjectReplacement   = $FFFC;                        {  placeholder for non-text object }
    kUnicodeReplacementChar     = $FFFD;                        {  Unicode replacement for unconvertable input char }
    kUnicodeSwappedByteOrderMark = $FFFE;                       {  not a Unicode char; byte-swapped version of FEFF }
    kUnicodeNotAChar            = $FFFF;                        {  not a Unicode char; may be used as a terminator }

    {
       -------------------------------------------------------------------------------------------------
       CONSTANTS & DATA STRUCTURES for Unicode Properties
       -------------------------------------------------------------------------------------------------
    }

type
    UCCharPropertyType                  = SInt32;

const
    kUCCharPropTypeGenlCategory = 1;                            {  requests enumeration value }
    kUCCharPropTypeCombiningClass = 2;                          {  requests numeric value 0..255 }
    kUCCharPropTypeBidiCategory = 3;                            {  requests enumeration value }


type
    UCCharPropertyValue                 = UInt32;
    {  General Category enumeration values (requested by kUCCharPropTypeGenlCategory) }

const
                                                                {  Normative categories: }
    kUCGenlCatOtherNotAssigned  = 0;                            {  Cn Other, Not Assigned }
    kUCGenlCatOtherControl      = 1;                            {  Cc Other, Control }
    kUCGenlCatOtherFormat       = 2;                            {  Cf Other, Format }
    kUCGenlCatOtherSurrogate    = 3;                            {  Cs Other, Surrogate }
    kUCGenlCatOtherPrivateUse   = 4;                            {  Co Other, Private Use }
    kUCGenlCatMarkNonSpacing    = 5;                            {  Mn Mark, Non-Spacing }
    kUCGenlCatMarkSpacingCombining = 6;                         {  Mc Mark, Spacing Combining }
    kUCGenlCatMarkEnclosing     = 7;                            {  Me Mark, Enclosing }
    kUCGenlCatNumberDecimalDigit = 8;                           {  Nd Number, Decimal Digit }
    kUCGenlCatNumberLetter      = 9;                            {  Nl Number, Letter }
    kUCGenlCatNumberOther       = 10;                           {  No Number, Other }
    kUCGenlCatSeparatorSpace    = 11;                           {  Zs Separator, Space }
    kUCGenlCatSeparatorLine     = 12;                           {  Zl Separator, Line }
    kUCGenlCatSeparatorParagraph = 13;                          {  Zp Separator, Paragraph }
    kUCGenlCatLetterUppercase   = 14;                           {  Lu Letter, Uppercase }
    kUCGenlCatLetterLowercase   = 15;                           {  Ll Letter, Lowercase }
    kUCGenlCatLetterTitlecase   = 16;                           {  Lt Letter, Titlecase }
                                                                {  Informative categories: }
    kUCGenlCatLetterModifier    = 17;                           {  Lm Letter, Modifier }
    kUCGenlCatLetterOther       = 18;                           {  Lo Letter, Other }
    kUCGenlCatPunctConnector    = 20;                           {  Pc Punctuation, Connector }
    kUCGenlCatPunctDash         = 21;                           {  Pd Punctuation, Dash }
    kUCGenlCatPunctOpen         = 22;                           {  Ps Punctuation, Open }
    kUCGenlCatPunctClose        = 23;                           {  Pe Punctuation, Close }
    kUCGenlCatPunctInitialQuote = 24;                           {  Pi Punctuation, Initial quote }
    kUCGenlCatPunctFinalQuote   = 25;                           {  Pf Punctuation, Final quote }
    kUCGenlCatPunctOther        = 26;                           {  Po Punctuation, Other }
    kUCGenlCatSymbolMath        = 28;                           {  Sm Symbol, Math }
    kUCGenlCatSymbolCurrency    = 29;                           {  Sc Symbol, Currency }
    kUCGenlCatSymbolModifier    = 30;                           {  Sk Symbol, Modifier }
    kUCGenlCatSymbolOther       = 31;                           {  So Symbol, Other }

    {  Bidirectional Category enumeration values (requested by kUCCharPropTypeBidiCategory) }
    kUCBidiCatNotApplicable     = 0;                            {  for now use this for unassigned }
                                                                {  Strong types: }
    kUCBidiCatLeftRight         = 1;                            {  L  Left-to-Right }
    kUCBidiCatRightLeft         = 2;                            {  R  Right-to-Left }
                                                                {  Weak types: }
    kUCBidiCatEuroNumber        = 3;                            {  EN European Number }
    kUCBidiCatEuroNumberSeparator = 4;                          {  ES European Number Separator }
    kUCBidiCatEuroNumberTerminator = 5;                         {  ET European Number Terminator }
    kUCBidiCatArabicNumber      = 6;                            {  AN Arabic Number }
    kUCBidiCatCommonNumberSeparator = 7;                        {  CS Common Number Separator }
                                                                {  Separators: }
    kUCBidiCatBlockSeparator    = 8;                            {  B  Paragraph Separator (was Block Separator) }
    kUCBidiCatSegmentSeparator  = 9;                            {  S  Segment Separator }
                                                                {  Neutrals: }
    kUCBidiCatWhitespace        = 10;                           {  WS Whitespace }
    kUCBidiCatOtherNeutral      = 11;                           {  ON Other Neutrals (unassigned codes could use this) }
                                                                {  New categories for Unicode 3.0 }
    kUCBidiCatRightLeftArabic   = 12;                           {  AL Right-to-Left Arabic (was Arabic Letter) }
    kUCBidiCatLeftRightEmbedding = 13;                          {  LRE    Left-to-Right Embedding }
    kUCBidiCatRightLeftEmbedding = 14;                          {  RLE    Right-to-Left Embedding }
    kUCBidiCatLeftRightOverride = 15;                           {  LRO    Left-to-Right Override }
    kUCBidiCatRightLeftOverride = 16;                           {  RLO    Right-to-Left Override }
    kUCBidiCatPopDirectionalFormat = 17;                        {  PDF    Pop Directional Format }
    kUCBidiCatNonSpacingMark    = 18;                           {  NSM    Non-Spacing Mark }
    kUCBidiCatBoundaryNeutral   = 19;                           {  BN Boundary Neutral }

    {
       -------------------------------------------------------------------------------------------------
       Prototypes for TextEncoding functions
       -------------------------------------------------------------------------------------------------
    }


    {
     *  CreateTextEncoding()
     *
     *  Availability:
     *    Non-Carbon CFM:   in TextCommon 1.1 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function CreateTextEncoding(encodingBase: TextEncodingBase; encodingVariant: TextEncodingVariant; encodingFormat: TextEncodingFormat): TextEncoding; external name '_CreateTextEncoding';

{
 *  GetTextEncodingBase()
 *
 *  Availability:
 *    Non-Carbon CFM:   in TextCommon 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetTextEncodingBase(encoding: TextEncoding): TextEncodingBase; external name '_GetTextEncodingBase';

{
 *  GetTextEncodingVariant()
 *
 *  Availability:
 *    Non-Carbon CFM:   in TextCommon 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetTextEncodingVariant(encoding: TextEncoding): TextEncodingVariant; external name '_GetTextEncodingVariant';

{
 *  GetTextEncodingFormat()
 *
 *  Availability:
 *    Non-Carbon CFM:   in TextCommon 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetTextEncodingFormat(encoding: TextEncoding): TextEncodingFormat; external name '_GetTextEncodingFormat';

{
 *  ResolveDefaultTextEncoding()
 *
 *  Availability:
 *    Non-Carbon CFM:   in TextCommon 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ResolveDefaultTextEncoding(encoding: TextEncoding): TextEncoding; external name '_ResolveDefaultTextEncoding';

{
 *  GetTextEncodingName()
 *
 *  Availability:
 *    Non-Carbon CFM:   in TextCommon 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetTextEncodingName(iEncoding: TextEncoding; iNamePartSelector: TextEncodingNameSelector; iPreferredRegion: RegionCode; iPreferredEncoding: TextEncoding; iOutputBufLen: ByteCount; var oNameLength: ByteCount; oActualRegion: RegionCodePtr; oActualEncoding: TextEncodingPtr; oEncodingName: TextPtr): OSStatus; external name '_GetTextEncodingName';

{
 *  TECGetInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in TextCommon 1.2.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TECGetInfo(var tecInfo: TECInfoHandle): OSStatus; external name '_TECGetInfo';


{
 *  UpgradeScriptInfoToTextEncoding()
 *
 *  Availability:
 *    Non-Carbon CFM:   in TextCommon 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function UpgradeScriptInfoToTextEncoding(iTextScriptID: ScriptCode; iTextLanguageID: LangCode; iRegionID: RegionCode; iTextFontname: StringPtr; var oEncoding: TextEncoding): OSStatus; external name '_UpgradeScriptInfoToTextEncoding';

{
 *  RevertTextEncodingToScriptInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in TextCommon 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function RevertTextEncodingToScriptInfo(iEncoding: TextEncoding; var oTextScriptID: ScriptCode; oTextLanguageID: LangCodePtr; oTextFontname: StringPtr): OSStatus; external name '_RevertTextEncodingToScriptInfo';

{
 *  NearestMacTextEncodings()
 *
 *  Availability:
 *    Non-Carbon CFM:   in TextCommon 1.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NearestMacTextEncodings(generalEncoding: TextEncoding; var bestMacEncoding: TextEncoding; var alternateMacEncoding: TextEncoding): OSStatus; external name '_NearestMacTextEncodings';

{
 *  UCGetCharProperty()
 *
 *  Availability:
 *    Non-Carbon CFM:   in TextCommon 1.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function UCGetCharProperty(charPtr: ConstUniCharPtr; textLength: UniCharCount; propType: UCCharPropertyType; var propValue: UCCharPropertyValue): OSStatus; external name '_UCGetCharProperty';

{$ALIGN MAC68K}
{#POP}
{unit TextEncodingConverter}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}


type
    TECPluginSignature                  = OSType;
    TECPluginVersion                    = UInt32;
    {    plugin signatures  }

const
    kTECSignature               = $656E6376 (* 'encv' *);
    kTECUnicodePluginSignature  = $70756E69 (* 'puni' *);
    kTECJapanesePluginSignature = $706A706E (* 'pjpn' *);
    kTECChinesePluginSignature  = $707A686F (* 'pzho' *);
    kTECKoreanPluginSignature   = $706B6F72 (* 'pkor' *);


    {    converter object reference     }

type
    TECObjectRef    = ^SInt32; { an opaque 32-bit type }
    TECObjectRefPtr = ^TECObjectRef;  { when a var xx:TECObjectRef parameter can be nil, it is changed to xx: TECObjectRefPtr }
    TECSnifferObjectRef    = ^SInt32; { an opaque 32-bit type }
    TECSnifferObjectRefPtr = ^TECSnifferObjectRef;  { when a var xx:TECSnifferObjectRef parameter can be nil, it is changed to xx: TECSnifferObjectRefPtr }
    TECPluginSig                        = OSType;
    TECConversionInfoPtr = ^TECConversionInfo;
    TECConversionInfo = record
        sourceEncoding:         TextEncoding;
        destinationEncoding:    TextEncoding;
        reserved1:              UInt16;
        reserved2:              UInt16;
    end;

    {    return number of encodings types supported by user's configuraton of the encoding converter    }
    {
     *  TECCountAvailableTextEncodings()
     *
     *  Availability:
     *    Non-Carbon CFM:   in TextEncodingConverter 1.1 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function TECCountAvailableTextEncodings(var numberEncodings: ItemCount): OSStatus; external name '_TECCountAvailableTextEncodings';

{ fill in an array of type TextEncoding passed in by the user with types of encodings the current configuration of the encoder can handle. }
{
 *  TECGetAvailableTextEncodings()
 *
 *  Availability:
 *    Non-Carbon CFM:   in TextEncodingConverter 1.2 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TECGetAvailableTextEncodings(availableEncodings: TextEncodingPtr; maxAvailableEncodings: ItemCount; var actualAvailableEncodings: ItemCount): OSStatus; external name '_TECGetAvailableTextEncodings';

{ return number of from-to encoding conversion pairs supported  }
{
 *  TECCountDirectTextEncodingConversions()
 *
 *  Availability:
 *    Non-Carbon CFM:   in TextEncodingConverter 1.2 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TECCountDirectTextEncodingConversions(var numberOfEncodings: ItemCount): OSStatus; external name '_TECCountDirectTextEncodingConversions';

{ fill in an array of type TextEncodingPair passed in by the user with types of encoding pairs the current configuration of the encoder can handle. }
{
 *  TECGetDirectTextEncodingConversions()
 *
 *  Availability:
 *    Non-Carbon CFM:   in TextEncodingConverter 1.2 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TECGetDirectTextEncodingConversions(availableConversions: TECConversionInfoPtr; maxAvailableConversions: ItemCount; var actualAvailableConversions: ItemCount): OSStatus; external name '_TECGetDirectTextEncodingConversions';

{ return number of encodings a given encoding can be converter into }
{
 *  TECCountDestinationTextEncodings()
 *
 *  Availability:
 *    Non-Carbon CFM:   in TextEncodingConverter 1.2 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TECCountDestinationTextEncodings(inputEncoding: TextEncoding; var numberOfEncodings: ItemCount): OSStatus; external name '_TECCountDestinationTextEncodings';

{ fill in an array of type TextEncodingPair passed in by the user with types of encodings pairs the current configuration of the encoder can handle. }
{
 *  TECGetDestinationTextEncodings()
 *
 *  Availability:
 *    Non-Carbon CFM:   in TextEncodingConverter 1.2 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TECGetDestinationTextEncodings(inputEncoding: TextEncoding; destinationEncodings: TextEncodingPtr; maxDestinationEncodings: ItemCount; var actualDestinationEncodings: ItemCount): OSStatus; external name '_TECGetDestinationTextEncodings';

{ get info about a text encoding }
{
 *  TECGetTextEncodingInternetName()
 *
 *  Availability:
 *    Non-Carbon CFM:   in TextEncodingConverter 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TECGetTextEncodingInternetName(textEncoding: TextEncoding; var encodingName: Str255): OSStatus; external name '_TECGetTextEncodingInternetName';

{
 *  TECGetTextEncodingFromInternetName()
 *
 *  Availability:
 *    Non-Carbon CFM:   in TextEncodingConverter 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TECGetTextEncodingFromInternetName(var textEncoding: TextEncoding; const (*var*) encodingName: Str255): OSStatus; external name '_TECGetTextEncodingFromInternetName';

{ create/dispose converters }
{
 *  TECCreateConverter()
 *
 *  Availability:
 *    Non-Carbon CFM:   in TextEncodingConverter 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TECCreateConverter(var newEncodingConverter: TECObjectRef; inputEncoding: TextEncoding; outputEncoding: TextEncoding): OSStatus; external name '_TECCreateConverter';

{
 *  TECCreateConverterFromPath()
 *
 *  Availability:
 *    Non-Carbon CFM:   in TextEncodingConverter 1.2 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TECCreateConverterFromPath(var newEncodingConverter: TECObjectRef; inPath: TextEncodingPtr; inEncodings: ItemCount): OSStatus; external name '_TECCreateConverterFromPath';

{
 *  TECDisposeConverter()
 *
 *  Availability:
 *    Non-Carbon CFM:   in TextEncodingConverter 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TECDisposeConverter(newEncodingConverter: TECObjectRef): OSStatus; external name '_TECDisposeConverter';

{ convert text encodings }
{
 *  TECClearConverterContextInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in TextEncodingConverter 1.2 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TECClearConverterContextInfo(encodingConverter: TECObjectRef): OSStatus; external name '_TECClearConverterContextInfo';

{
 *  TECConvertText()
 *
 *  Availability:
 *    Non-Carbon CFM:   in TextEncodingConverter 1.2 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TECConvertText(encodingConverter: TECObjectRef; inputBuffer: ConstTextPtr; inputBufferLength: ByteCount; var actualInputLength: ByteCount; outputBuffer: TextPtr; outputBufferLength: ByteCount; var actualOutputLength: ByteCount): OSStatus; external name '_TECConvertText';

{
 *  TECFlushText()
 *
 *  Availability:
 *    Non-Carbon CFM:   in TextEncodingConverter 1.2 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TECFlushText(encodingConverter: TECObjectRef; outputBuffer: TextPtr; outputBufferLength: ByteCount; var actualOutputLength: ByteCount): OSStatus; external name '_TECFlushText';

{ one-to-many routines }
{
 *  TECCountSubTextEncodings()
 *
 *  Availability:
 *    Non-Carbon CFM:   in TextEncodingConverter 1.2 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TECCountSubTextEncodings(inputEncoding: TextEncoding; var numberOfEncodings: ItemCount): OSStatus; external name '_TECCountSubTextEncodings';

{
 *  TECGetSubTextEncodings()
 *
 *  Availability:
 *    Non-Carbon CFM:   in TextEncodingConverter 1.2 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TECGetSubTextEncodings(inputEncoding: TextEncoding; subEncodings: TextEncodingPtr; maxSubEncodings: ItemCount; var actualSubEncodings: ItemCount): OSStatus; external name '_TECGetSubTextEncodings';

{
 *  TECGetEncodingList()
 *
 *  Availability:
 *    Non-Carbon CFM:   in TextEncodingConverter 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TECGetEncodingList(encodingConverter: TECObjectRef; var numEncodings: ItemCount; var encodingList: Handle): OSStatus; external name '_TECGetEncodingList';

{
 *  TECCreateOneToManyConverter()
 *
 *  Availability:
 *    Non-Carbon CFM:   in TextEncodingConverter 1.2 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TECCreateOneToManyConverter(var newEncodingConverter: TECObjectRef; inputEncoding: TextEncoding; numOutputEncodings: ItemCount; outputEncodings: TextEncodingPtr): OSStatus; external name '_TECCreateOneToManyConverter';

{
 *  TECConvertTextToMultipleEncodings()
 *
 *  Availability:
 *    Non-Carbon CFM:   in TextEncodingConverter 1.2 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TECConvertTextToMultipleEncodings(encodingConverter: TECObjectRef; inputBuffer: ConstTextPtr; inputBufferLength: ByteCount; var actualInputLength: ByteCount; outputBuffer: TextPtr; outputBufferLength: ByteCount; var actualOutputLength: ByteCount; var outEncodingsBuffer: TextEncodingRun; maxOutEncodingRuns: ItemCount; var actualOutEncodingRuns: ItemCount): OSStatus; external name '_TECConvertTextToMultipleEncodings';

{
 *  TECFlushMultipleEncodings()
 *
 *  Availability:
 *    Non-Carbon CFM:   in TextEncodingConverter 1.2 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TECFlushMultipleEncodings(encodingConverter: TECObjectRef; outputBuffer: TextPtr; outputBufferLength: ByteCount; var actualOutputLength: ByteCount; var outEncodingsBuffer: TextEncodingRun; maxOutEncodingRuns: ItemCount; var actualOutEncodingRuns: ItemCount): OSStatus; external name '_TECFlushMultipleEncodings';

{ international internet info }
{
 *  TECCountWebTextEncodings()
 *
 *  Availability:
 *    Non-Carbon CFM:   in TextEncodingConverter 1.2 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TECCountWebTextEncodings(locale: RegionCode; var numberEncodings: ItemCount): OSStatus; external name '_TECCountWebTextEncodings';

{
 *  TECGetWebTextEncodings()
 *
 *  Availability:
 *    Non-Carbon CFM:   in TextEncodingConverter 1.2 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TECGetWebTextEncodings(locale: RegionCode; availableEncodings: TextEncodingPtr; maxAvailableEncodings: ItemCount; var actualAvailableEncodings: ItemCount): OSStatus; external name '_TECGetWebTextEncodings';

{
 *  TECCountMailTextEncodings()
 *
 *  Availability:
 *    Non-Carbon CFM:   in TextEncodingConverter 1.2 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TECCountMailTextEncodings(locale: RegionCode; var numberEncodings: ItemCount): OSStatus; external name '_TECCountMailTextEncodings';

{
 *  TECGetMailTextEncodings()
 *
 *  Availability:
 *    Non-Carbon CFM:   in TextEncodingConverter 1.2 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TECGetMailTextEncodings(locale: RegionCode; availableEncodings: TextEncodingPtr; maxAvailableEncodings: ItemCount; var actualAvailableEncodings: ItemCount): OSStatus; external name '_TECGetMailTextEncodings';

{ examine text encodings }
{
 *  TECCountAvailableSniffers()
 *
 *  Availability:
 *    Non-Carbon CFM:   in TextEncodingConverter 1.2 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TECCountAvailableSniffers(var numberOfEncodings: ItemCount): OSStatus; external name '_TECCountAvailableSniffers';

{
 *  TECGetAvailableSniffers()
 *
 *  Availability:
 *    Non-Carbon CFM:   in TextEncodingConverter 1.2 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TECGetAvailableSniffers(availableSniffers: TextEncodingPtr; maxAvailableSniffers: ItemCount; var actualAvailableSniffers: ItemCount): OSStatus; external name '_TECGetAvailableSniffers';

{
 *  TECCreateSniffer()
 *
 *  Availability:
 *    Non-Carbon CFM:   in TextEncodingConverter 1.2 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TECCreateSniffer(var encodingSniffer: TECSnifferObjectRef; testEncodings: TextEncodingPtr; numTextEncodings: ItemCount): OSStatus; external name '_TECCreateSniffer';

{
 *  TECSniffTextEncoding()
 *
 *  Availability:
 *    Non-Carbon CFM:   in TextEncodingConverter 1.2 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TECSniffTextEncoding(encodingSniffer: TECSnifferObjectRef; inputBuffer: TextPtr; inputBufferLength: ByteCount; testEncodings: TextEncodingPtr; numTextEncodings: ItemCount; var numErrsArray: ItemCount; maxErrs: ItemCount; var numFeaturesArray: ItemCount; maxFeatures: ItemCount): OSStatus; external name '_TECSniffTextEncoding';

{
 *  TECDisposeSniffer()
 *
 *  Availability:
 *    Non-Carbon CFM:   in TextEncodingConverter 1.2 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TECDisposeSniffer(encodingSniffer: TECSnifferObjectRef): OSStatus; external name '_TECDisposeSniffer';

{
 *  TECClearSnifferContextInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in TextEncodingConverter 1.2 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TECClearSnifferContextInfo(encodingSniffer: TECSnifferObjectRef): OSStatus; external name '_TECClearSnifferContextInfo';



{$ALIGN MAC68K}
{#POP}
{unit TextEncodingPlugin}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}

{
  ####################################################################################
        Constants
  ####################################################################################
}
{
  ####################################################################################
        Structs
  ####################################################################################
}

type
    TECBufferContextRecPtr = ^TECBufferContextRec;
    TECBufferContextRec = record
        textInputBuffer:        TextPtr;
        textInputBufferEnd:     TextPtr;
        textOutputBuffer:       TextPtr;
        textOutputBufferEnd:    TextPtr;
        encodingInputBuffer:    TextEncodingRunPtr;
        encodingInputBufferEnd: TextEncodingRunPtr;
        encodingOutputBuffer:   TextEncodingRunPtr;
        encodingOutputBufferEnd: TextEncodingRunPtr;
    end;

    TECPluginStateRecPtr = ^TECPluginStateRec;
    TECPluginStateRec = record
        state1:                 SInt8;
        state2:                 SInt8;
        state3:                 SInt8;
        state4:                 SInt8;
        longState1:             UInt32;
        longState2:             UInt32;
        longState3:             UInt32;
        longState4:             UInt32;
    end;

    TECConverterContextRecPtr = ^TECConverterContextRec;
    TECConverterContextRec = record
                                                                        {  public - manipulated externally and by plugin }
        pluginRec:              Ptr;
        sourceEncoding:         TextEncoding;
        destEncoding:           TextEncoding;
        reserved1:              UInt32;
        reserved2:              UInt32;
        bufferContext:          TECBufferContextRec;
                                                                        {  private - manipulated only within Plugin }
        contextRefCon:          UInt32;
        conversionProc:         ProcPtr;
        flushProc:              ProcPtr;
        clearContextInfoProc:   ProcPtr;
        options1:               UInt32;
        options2:               UInt32;
        pluginState:            TECPluginStateRec;
    end;

    TECSnifferContextRecPtr = ^TECSnifferContextRec;
    TECSnifferContextRec = record
                                                                        {  public - manipulated externally }
        pluginRec:              Ptr;
        encoding:               TextEncoding;
        maxErrors:              ItemCount;
        maxFeatures:            ItemCount;
        textInputBuffer:        TextPtr;
        textInputBufferEnd:     TextPtr;
        numFeatures:            ItemCount;
        numErrors:              ItemCount;
                                                                        {  private - manipulated only within Plugin }
        contextRefCon:          UInt32;
        sniffProc:              ProcPtr;
        clearContextInfoProc:   ProcPtr;
        pluginState:            TECPluginStateRec;
    end;

    {
      ####################################################################################
            Functional Messages
      ####################################################################################
    }

    TECPluginNewEncodingConverterPtr = function(var newEncodingConverter: TECObjectRef; var plugContext: TECConverterContextRec; inputEncoding: TextEncoding; outputEncoding: TextEncoding): OSStatus;

    TECPluginClearContextInfoPtr = function(encodingConverter: TECObjectRef; var plugContext: TECConverterContextRec): OSStatus;

    TECPluginConvertTextEncodingPtr = function(encodingConverter: TECObjectRef; var plugContext: TECConverterContextRec): OSStatus;

    TECPluginFlushConversionPtr = function(encodingConverter: TECObjectRef; var plugContext: TECConverterContextRec): OSStatus;

    TECPluginDisposeEncodingConverterPtr = function(newEncodingConverter: TECObjectRef; var plugContext: TECConverterContextRec): OSStatus;

    TECPluginNewEncodingSnifferPtr = function(var encodingSniffer: TECSnifferObjectRef; var snifContext: TECSnifferContextRec; inputEncoding: TextEncoding): OSStatus;

    TECPluginClearSnifferContextInfoPtr = function(encodingSniffer: TECSnifferObjectRef; var snifContext: TECSnifferContextRec): OSStatus;

    TECPluginSniffTextEncodingPtr = function(encodingSniffer: TECSnifferObjectRef; var snifContext: TECSnifferContextRec): OSStatus;

    TECPluginDisposeEncodingSnifferPtr = function(encodingSniffer: TECSnifferObjectRef; var snifContext: TECSnifferContextRec): OSStatus;

    TECPluginGetCountAvailableTextEncodingsPtr = function(availableEncodings: TextEncodingPtr; maxAvailableEncodings: ItemCount; var actualAvailableEncodings: ItemCount): OSStatus;

    TECPluginGetCountAvailableTextEncodingPairsPtr = function(availableEncodings: TECConversionInfoPtr; maxAvailableEncodings: ItemCount; var actualAvailableEncodings: ItemCount): OSStatus;

    TECPluginGetCountDestinationTextEncodingsPtr = function(inputEncoding: TextEncoding; destinationEncodings: TextEncodingPtr; maxDestinationEncodings: ItemCount; var actualDestinationEncodings: ItemCount): OSStatus;

    TECPluginGetCountSubTextEncodingsPtr = function(inputEncoding: TextEncoding; subEncodings: TextEncodingPtr; maxSubEncodings: ItemCount; var actualSubEncodings: ItemCount): OSStatus;

    TECPluginGetCountAvailableSniffersPtr = function(availableEncodings: TextEncodingPtr; maxAvailableEncodings: ItemCount; var actualAvailableEncodings: ItemCount): OSStatus;

    TECPluginGetTextEncodingInternetNamePtr = function(textEncoding: TextEncoding; var encodingName: Str255): OSStatus;

    TECPluginGetTextEncodingFromInternetNamePtr = function(var textEncoding: TextEncoding; encodingName: Str255): OSStatus;

    TECPluginGetCountWebEncodingsPtr = function(availableEncodings: TextEncodingPtr; maxAvailableEncodings: ItemCount; var actualAvailableEncodings: ItemCount): OSStatus;

    TECPluginGetCountMailEncodingsPtr = function(availableEncodings: TextEncodingPtr; maxAvailableEncodings: ItemCount; var actualAvailableEncodings: ItemCount): OSStatus;

    {
      ####################################################################################
            Dispatch Table Definition
      ####################################################################################
    }


const
    kTECPluginDispatchTableVersion1 = $00010000;                {  1.0 through 1.0.3 releases }
    kTECPluginDispatchTableVersion1_1 = $00010001;              {  1.1 releases }
    kTECPluginDispatchTableVersion1_2 = $00010002;              {  1.2 releases }
    kTECPluginDispatchTableCurrentVersion = $00010002;


type
    TECPluginDispatchTablePtr = ^TECPluginDispatchTable;
    TECPluginDispatchTable = record
        version:                TECPluginVersion;
        compatibleVersion:      TECPluginVersion;
        PluginID:               TECPluginSignature;
        PluginNewEncodingConverter: TECPluginNewEncodingConverterPtr;
        PluginClearContextInfo: TECPluginClearContextInfoPtr;
        PluginConvertTextEncoding: TECPluginConvertTextEncodingPtr;
        PluginFlushConversion:  TECPluginFlushConversionPtr;
        PluginDisposeEncodingConverter: TECPluginDisposeEncodingConverterPtr;
        PluginNewEncodingSniffer: TECPluginNewEncodingSnifferPtr;
        PluginClearSnifferContextInfo: TECPluginClearSnifferContextInfoPtr;
        PluginSniffTextEncoding: TECPluginSniffTextEncodingPtr;
        PluginDisposeEncodingSniffer: TECPluginDisposeEncodingSnifferPtr;
        PluginGetCountAvailableTextEncodings: TECPluginGetCountAvailableTextEncodingsPtr;
        PluginGetCountAvailableTextEncodingPairs: TECPluginGetCountAvailableTextEncodingPairsPtr;
        PluginGetCountDestinationTextEncodings: TECPluginGetCountDestinationTextEncodingsPtr;
        PluginGetCountSubTextEncodings: TECPluginGetCountSubTextEncodingsPtr;
        PluginGetCountAvailableSniffers: TECPluginGetCountAvailableSniffersPtr;
        PluginGetCountWebTextEncodings: TECPluginGetCountWebEncodingsPtr;
        PluginGetCountMailTextEncodings: TECPluginGetCountMailEncodingsPtr;
        PluginGetTextEncodingInternetName: TECPluginGetTextEncodingInternetNamePtr;
        PluginGetTextEncodingFromInternetName: TECPluginGetTextEncodingFromInternetNamePtr;
    end;






{$ALIGN MAC68K}
{#POP}
{unit Threads}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}

{  Thread states }

type
    ThreadState                 = UInt16;
const
    kReadyThreadState           = 0;
    kStoppedThreadState         = 1;
    kRunningThreadState         = 2;

    {  Error codes have been moved to Errors.(pah) }

    {  Thread environment characteristics }

type
    ThreadTaskRef                       = Ptr;
    {  Thread characteristics }
    ThreadStyle                 = UInt32;
const
    kCooperativeThread          = $00000001;
    kPreemptiveThread           = $00000002;

    {  Thread identifiers }

type
    ThreadID                    = UInt32;
const
    kNoThreadID                 = 0;
    kCurrentThreadID            = 1;
    kApplicationThreadID        = 2;

    {  Options when creating a thread }

type
    ThreadOptions               = UInt32;
const
    kNewSuspend                 = $01;
    kUsePremadeThread           = $02;
    kCreateIfNeeded             = $04;
    kFPUNotNeeded               = $08;
    kExactMatchThread           = $10;

    {  Information supplied to the custom scheduler }

type
    SchedulerInfoRecPtr = ^SchedulerInfoRec;
    SchedulerInfoRec = record
        InfoRecSize:            UInt32;
        CurrentThreadID:        ThreadID;
        SuggestedThreadID:      ThreadID;
        InterruptedCoopThreadID: ThreadID;
    end;


    {
        The following ProcPtrs cannot be interchanged with UniversalProcPtrs because
        of differences between 680x0 and PowerPC runtime architectures with regard to
        the implementation of the Thread Manager.
        }
    voidPtr                             = Ptr;
    {  Prototype for thread's entry (main) routine }
    ThreadEntryProcPtr = function(threadParam: UnivPtr): voidPtr;

    {  Prototype for custom thread scheduler routine }
    ThreadSchedulerProcPtr = function(schedulerInfo: SchedulerInfoRecPtr): ThreadID;

    {  Prototype for custom thread switcher routine }
    ThreadSwitchProcPtr = procedure(threadBeingSwitched: ThreadID; switchProcParam: UnivPtr);

    {  Prototype for thread termination notification routine }
    ThreadTerminationProcPtr = procedure(threadTerminated: ThreadID; terminationProcParam: UnivPtr);

    {  Prototype for debugger NewThread notification }
    DebuggerNewThreadProcPtr = procedure(threadCreated: ThreadID);

    {  Prototype for debugger DisposeThread notification }
    DebuggerDisposeThreadProcPtr = procedure(threadDeleted: ThreadID);

    {  Prototype for debugger schedule notification }
    DebuggerThreadSchedulerProcPtr = function(schedulerInfo: SchedulerInfoRecPtr): ThreadID;

    ThreadEntryUPP = ^SInt32; { an opaque UPP }
    ThreadSchedulerUPP = ^SInt32; { an opaque UPP }
    ThreadSwitchUPP = ^SInt32; { an opaque UPP }
    ThreadTerminationUPP = ^SInt32; { an opaque UPP }
    DebuggerNewThreadUPP = ^SInt32; { an opaque UPP }
    DebuggerDisposeThreadUPP = ^SInt32; { an opaque UPP }
    DebuggerThreadSchedulerUPP = ^SInt32; { an opaque UPP }

const
    uppThreadEntryProcInfo = $000000F0;
    uppThreadSchedulerProcInfo = $000000F0;
    uppThreadSwitchProcInfo = $000003C0;
    uppThreadTerminationProcInfo = $000003C0;
    uppDebuggerNewThreadProcInfo = $000000C0;
    uppDebuggerDisposeThreadProcInfo = $000000C0;
    uppDebuggerThreadSchedulerProcInfo = $000000F0;
    {
     *  NewThreadEntryUPP()
     *
     *  Availability:
     *    Non-Carbon CFM:   available as macro/inline
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function NewThreadEntryUPP(userRoutine: ThreadEntryProcPtr): ThreadEntryUPP; external name '_NewThreadEntryUPP';
{
 *  NewThreadSchedulerUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewThreadSchedulerUPP(userRoutine: ThreadSchedulerProcPtr): ThreadSchedulerUPP; external name '_NewThreadSchedulerUPP';
{
 *  NewThreadSwitchUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewThreadSwitchUPP(userRoutine: ThreadSwitchProcPtr): ThreadSwitchUPP; external name '_NewThreadSwitchUPP';
{
 *  NewThreadTerminationUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewThreadTerminationUPP(userRoutine: ThreadTerminationProcPtr): ThreadTerminationUPP; external name '_NewThreadTerminationUPP';
{
 *  NewDebuggerNewThreadUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewDebuggerNewThreadUPP(userRoutine: DebuggerNewThreadProcPtr): DebuggerNewThreadUPP; external name '_NewDebuggerNewThreadUPP';
{
 *  NewDebuggerDisposeThreadUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewDebuggerDisposeThreadUPP(userRoutine: DebuggerDisposeThreadProcPtr): DebuggerDisposeThreadUPP; external name '_NewDebuggerDisposeThreadUPP';
{
 *  NewDebuggerThreadSchedulerUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewDebuggerThreadSchedulerUPP(userRoutine: DebuggerThreadSchedulerProcPtr): DebuggerThreadSchedulerUPP; external name '_NewDebuggerThreadSchedulerUPP';
{
 *  DisposeThreadEntryUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeThreadEntryUPP(userUPP: ThreadEntryUPP); external name '_DisposeThreadEntryUPP';
{
 *  DisposeThreadSchedulerUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeThreadSchedulerUPP(userUPP: ThreadSchedulerUPP); external name '_DisposeThreadSchedulerUPP';
{
 *  DisposeThreadSwitchUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeThreadSwitchUPP(userUPP: ThreadSwitchUPP); external name '_DisposeThreadSwitchUPP';
{
 *  DisposeThreadTerminationUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeThreadTerminationUPP(userUPP: ThreadTerminationUPP); external name '_DisposeThreadTerminationUPP';
{
 *  DisposeDebuggerNewThreadUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeDebuggerNewThreadUPP(userUPP: DebuggerNewThreadUPP); external name '_DisposeDebuggerNewThreadUPP';
{
 *  DisposeDebuggerDisposeThreadUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeDebuggerDisposeThreadUPP(userUPP: DebuggerDisposeThreadUPP); external name '_DisposeDebuggerDisposeThreadUPP';
{
 *  DisposeDebuggerThreadSchedulerUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeDebuggerThreadSchedulerUPP(userUPP: DebuggerThreadSchedulerUPP); external name '_DisposeDebuggerThreadSchedulerUPP';
{
 *  InvokeThreadEntryUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeThreadEntryUPP(threadParam: UnivPtr; userRoutine: ThreadEntryUPP): voidPtr; external name '_InvokeThreadEntryUPP';
{
 *  InvokeThreadSchedulerUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeThreadSchedulerUPP(schedulerInfo: SchedulerInfoRecPtr; userRoutine: ThreadSchedulerUPP): ThreadID; external name '_InvokeThreadSchedulerUPP';
{
 *  InvokeThreadSwitchUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvokeThreadSwitchUPP(threadBeingSwitched: ThreadID; switchProcParam: UnivPtr; userRoutine: ThreadSwitchUPP); external name '_InvokeThreadSwitchUPP';
{
 *  InvokeThreadTerminationUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvokeThreadTerminationUPP(threadTerminated: ThreadID; terminationProcParam: UnivPtr; userRoutine: ThreadTerminationUPP); external name '_InvokeThreadTerminationUPP';
{
 *  InvokeDebuggerNewThreadUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvokeDebuggerNewThreadUPP(threadCreated: ThreadID; userRoutine: DebuggerNewThreadUPP); external name '_InvokeDebuggerNewThreadUPP';
{
 *  InvokeDebuggerDisposeThreadUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvokeDebuggerDisposeThreadUPP(threadDeleted: ThreadID; userRoutine: DebuggerDisposeThreadUPP); external name '_InvokeDebuggerDisposeThreadUPP';
{
 *  InvokeDebuggerThreadSchedulerUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeDebuggerThreadSchedulerUPP(schedulerInfo: SchedulerInfoRecPtr; userRoutine: DebuggerThreadSchedulerUPP): ThreadID; external name '_InvokeDebuggerThreadSchedulerUPP';
{
   Thread Manager function pointers (TPP):
   on classic 68k use raw function pointers (same as UPP's)
   on classic PowerPC, use raw function pointers
   on classic PowerPC with OPAQUE_UPP_TYPES=1, use UPP's
   on CFM-68K, use UPP's
   on Carbon, use UPP's
}

{  use UPP's }

type
    ThreadEntryTPP                      = ThreadEntryUPP;
    ThreadSchedulerTPP                  = ThreadSchedulerUPP;
    ThreadSwitchTPP                     = ThreadSwitchUPP;
    ThreadTerminationTPP                = ThreadTerminationUPP;
    DebuggerNewThreadTPP                = DebuggerNewThreadUPP;
    DebuggerDisposeThreadTPP            = DebuggerDisposeThreadUPP;
    DebuggerThreadSchedulerTPP          = DebuggerThreadSchedulerUPP;

    {
     *  NewThread()
     *
     *  Availability:
     *    Non-Carbon CFM:   in ThreadsLib 1.0 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function NewThread(threadStyle: ThreadStyle; threadEntry: ThreadEntryTPP; threadParam: UnivPtr; stackSize: Size; options: ThreadOptions; threadResult: UnivPtr; var threadMade: ThreadID): OSErr; external name '_NewThread';
{
 *  SetThreadScheduler()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ThreadsLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetThreadScheduler(threadScheduler: ThreadSchedulerTPP): OSErr; external name '_SetThreadScheduler';
{
 *  SetThreadSwitcher()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ThreadsLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetThreadSwitcher(thread: ThreadID; threadSwitcher: ThreadSwitchTPP; switchProcParam: UnivPtr; inOrOut: boolean): OSErr; external name '_SetThreadSwitcher';
{
 *  SetThreadTerminator()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ThreadsLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetThreadTerminator(thread: ThreadID; threadTerminator: ThreadTerminationTPP; terminationProcParam: UnivPtr): OSErr; external name '_SetThreadTerminator';
{
 *  SetDebuggerNotificationProcs()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ThreadsLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetDebuggerNotificationProcs(notifyNewThread: DebuggerNewThreadTPP; notifyDisposeThread: DebuggerDisposeThreadTPP; notifyThreadScheduler: DebuggerThreadSchedulerTPP): OSErr; external name '_SetDebuggerNotificationProcs';
{
 *  CreateThreadPool()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ThreadsLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CreateThreadPool(threadStyle: ThreadStyle; numToCreate: SInt16; stackSize: Size): OSErr; external name '_CreateThreadPool';
{
 *  GetFreeThreadCount()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ThreadsLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetFreeThreadCount(threadStyle: ThreadStyle; var freeCount: SInt16): OSErr; external name '_GetFreeThreadCount';
{
 *  GetSpecificFreeThreadCount()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ThreadsLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetSpecificFreeThreadCount(threadStyle: ThreadStyle; stackSize: Size; var freeCount: SInt16): OSErr; external name '_GetSpecificFreeThreadCount';
{
 *  GetDefaultThreadStackSize()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ThreadsLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetDefaultThreadStackSize(threadStyle: ThreadStyle; var stackSize: Size): OSErr; external name '_GetDefaultThreadStackSize';
{
 *  ThreadCurrentStackSpace()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ThreadsLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ThreadCurrentStackSpace(thread: ThreadID; var freeStack: UInt32): OSErr; external name '_ThreadCurrentStackSpace';
{
 *  DisposeThread()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ThreadsLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DisposeThread(threadToDump: ThreadID; threadResult: UnivPtr; recycleThread: boolean): OSErr; external name '_DisposeThread';
{
 *  YieldToThread()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ThreadsLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function YieldToThread(suggestedThread: ThreadID): OSErr; external name '_YieldToThread';
{
 *  YieldToAnyThread()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ThreadsLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function YieldToAnyThread: OSErr; external name '_YieldToAnyThread';
{
 *  [Mac]GetCurrentThread()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ThreadsLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetCurrentThread(var currentThreadID: ThreadID): OSErr; external name '_GetCurrentThread';
{
 *  GetThreadState()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ThreadsLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetThreadState(threadToGet: ThreadID; var threadState: ThreadState): OSErr; external name '_GetThreadState';
{
 *  SetThreadState()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ThreadsLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetThreadState(threadToSet: ThreadID; newState: ThreadState; suggestedThread: ThreadID): OSErr; external name '_SetThreadState';
{
 *  SetThreadStateEndCritical()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ThreadsLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetThreadStateEndCritical(threadToSet: ThreadID; newState: ThreadState; suggestedThread: ThreadID): OSErr; external name '_SetThreadStateEndCritical';
{
 *  ThreadBeginCritical()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ThreadsLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ThreadBeginCritical: OSErr; external name '_ThreadBeginCritical';
{
 *  ThreadEndCritical()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ThreadsLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ThreadEndCritical: OSErr; external name '_ThreadEndCritical';
{
 *  GetThreadCurrentTaskRef()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ThreadsLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetThreadCurrentTaskRef(var threadTRef: ThreadTaskRef): OSErr; external name '_GetThreadCurrentTaskRef';
{
 *  GetThreadStateGivenTaskRef()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ThreadsLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetThreadStateGivenTaskRef(threadTRef: ThreadTaskRef; threadToGet: ThreadID; var threadState: ThreadState): OSErr; external name '_GetThreadStateGivenTaskRef';
{
 *  SetThreadReadyGivenTaskRef()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ThreadsLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetThreadReadyGivenTaskRef(threadTRef: ThreadTaskRef; threadToSet: ThreadID): OSErr; external name '_SetThreadReadyGivenTaskRef';
{$ALIGN MAC68K}
{#POP}
{unit UTCUtils}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}

{ Options for Set & Get DateTime Routines }

const
    kUTCDefaultOptions          = 0;

    {    64 Bit Clock Typedefs  }

type
    UTCDateTimePtr = ^UTCDateTime;
    UTCDateTime = record
        highSeconds:            UInt16;
        lowSeconds:             UInt32;
        fraction:               UInt16;
    end;

    UTCDateTimeHandle                   = ^UTCDateTimePtr;
    LocalDateTimePtr = ^LocalDateTime;
    LocalDateTime = record
        highSeconds:            UInt16;
        lowSeconds:             UInt32;
        fraction:               UInt16;
    end;

    LocalDateTimeHandle                 = ^LocalDateTimePtr;
    {    Classic 32 bit clock conversion routines   }
    {
     *  ConvertLocalTimeToUTC()
     *
     *  Availability:
     *    Non-Carbon CFM:   in UTCUtils 1.0 and later
     *    CarbonLib:        in CarbonLib 1.0.2 and later
     *    Mac OS X:         in version 10.0 and later
        }
function ConvertLocalTimeToUTC(localSeconds: UInt32; var utcSeconds: UInt32): OSStatus; external name '_ConvertLocalTimeToUTC';

{
 *  ConvertUTCToLocalTime()
 *
 *  Availability:
 *    Non-Carbon CFM:   in UTCUtils 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ConvertUTCToLocalTime(utcSeconds: UInt32; var localSeconds: UInt32): OSStatus; external name '_ConvertUTCToLocalTime';

{ 64 bit clock conversion routines }
{
 *  ConvertUTCToLocalDateTime()
 *
 *  Availability:
 *    Non-Carbon CFM:   in UTCUtils 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ConvertUTCToLocalDateTime(const (*var*) utcDateTime: UTCDateTime; var localDateTime: LocalDateTime): OSStatus; external name '_ConvertUTCToLocalDateTime';

{
 *  ConvertLocalToUTCDateTime()
 *
 *  Availability:
 *    Non-Carbon CFM:   in UTCUtils 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ConvertLocalToUTCDateTime(const (*var*) localDateTime: LocalDateTime; var utcDateTime: UTCDateTime): OSStatus; external name '_ConvertLocalToUTCDateTime';

{ Getter and Setter Clock routines using 64 Bit values }
{
 *  GetUTCDateTime()
 *
 *  Availability:
 *    Non-Carbon CFM:   in UTCUtils 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetUTCDateTime(var utcDateTime: UTCDateTime; options: OptionBits): OSStatus; external name '_GetUTCDateTime';

{
 *  SetUTCDateTime()
 *
 *  Availability:
 *    Non-Carbon CFM:   in UTCUtils 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetUTCDateTime(const (*var*) utcDateTime: UTCDateTime; options: OptionBits): OSStatus; external name '_SetUTCDateTime';

{
 *  GetLocalDateTime()
 *
 *  Availability:
 *    Non-Carbon CFM:   in UTCUtils 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetLocalDateTime(var localDateTime: LocalDateTime; options: OptionBits): OSStatus; external name '_GetLocalDateTime';

{
 *  SetLocalDateTime()
 *
 *  Availability:
 *    Non-Carbon CFM:   in UTCUtils 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetLocalDateTime(const (*var*) localDateTime: LocalDateTime; options: OptionBits): OSStatus; external name '_SetLocalDateTime';

{$ALIGN MAC68K}
{#POP}
{unit UnicodeConverter}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}

{ Unicode conversion contexts: }

type
    TextToUnicodeInfo    = ^SInt32; { an opaque 32-bit type }
    TextToUnicodeInfoPtr = ^TextToUnicodeInfo;  { when a var xx:TextToUnicodeInfo parameter can be nil, it is changed to xx: TextToUnicodeInfoPtr }
    UnicodeToTextInfo    = ^SInt32; { an opaque 32-bit type }
    UnicodeToTextInfoPtr = ^UnicodeToTextInfo;  { when a var xx:UnicodeToTextInfo parameter can be nil, it is changed to xx: UnicodeToTextInfoPtr }
    UnicodeToTextRunInfo    = ^SInt32; { an opaque 32-bit type }
    UnicodeToTextRunInfoPtr = ^UnicodeToTextRunInfo;  { when a var xx:UnicodeToTextRunInfo parameter can be nil, it is changed to xx: UnicodeToTextRunInfoPtr }
    ConstTextToUnicodeInfo              = TextToUnicodeInfo;
    ConstUnicodeToTextInfo              = UnicodeToTextInfo;
    {    UnicodeMapVersion type & values    }
    UnicodeMapVersion                   = SInt32;

const
    kUnicodeUseLatestMapping    = -1;
    kUnicodeUseHFSPlusMapping   = 4;

    {    Types used in conversion   }

type
    UnicodeMappingPtr = ^UnicodeMapping;
    UnicodeMapping = record
        unicodeEncoding:        TextEncoding;
        otherEncoding:          TextEncoding;
        mappingVersion:         UnicodeMapVersion;
    end;

    ConstUnicodeMappingPtr              = ^UnicodeMapping;
    {    Control flags for ConvertFromUnicodeToText and ConvertFromTextToUnicode    }

const
    kUnicodeUseFallbacksBit     = 0;
    kUnicodeKeepInfoBit         = 1;
    kUnicodeDirectionalityBits  = 2;
    kUnicodeVerticalFormBit     = 4;
    kUnicodeLooseMappingsBit    = 5;
    kUnicodeStringUnterminatedBit = 6;
    kUnicodeTextRunBit          = 7;
    kUnicodeKeepSameEncodingBit = 8;
    kUnicodeForceASCIIRangeBit  = 9;
    kUnicodeNoHalfwidthCharsBit = 10;
    kUnicodeTextRunHeuristicsBit = 11;

    kUnicodeUseFallbacksMask    = $00000001;
    kUnicodeKeepInfoMask        = $00000002;
    kUnicodeDirectionalityMask  = $0000000C;
    kUnicodeVerticalFormMask    = $00000010;
    kUnicodeLooseMappingsMask   = $00000020;
    kUnicodeStringUnterminatedMask = $00000040;
    kUnicodeTextRunMask         = $00000080;
    kUnicodeKeepSameEncodingMask = $00000100;
    kUnicodeForceASCIIRangeMask = $00000200;
    kUnicodeNoHalfwidthCharsMask = $00000400;
    kUnicodeTextRunHeuristicsMask = $00000800;

    {    Values for kUnicodeDirectionality field    }
    kUnicodeDefaultDirection    = 0;
    kUnicodeLeftToRight         = 1;
    kUnicodeRightToLeft         = 2;

    {    Directionality masks for control flags     }
    kUnicodeDefaultDirectionMask = $00;
    kUnicodeLeftToRightMask     = $04;
    kUnicodeRightToLeftMask     = $08;


    {    Control flags for TruncateForUnicodeToText:    }
    {
       Now TruncateForUnicodeToText uses control flags from the same set as used by
       ConvertFromTextToUnicode, ConvertFromUnicodeToText, etc., but only
       kUnicodeStringUnterminatedMask is meaningful for TruncateForUnicodeToText.

       Previously two special control flags were defined for TruncateForUnicodeToText:
            kUnicodeTextElementSafeBit = 0
            kUnicodeRestartSafeBit = 1
       However, neither of these was implemented.
       Instead of implementing kUnicodeTextElementSafeBit, we now use
       kUnicodeStringUnterminatedMask since it accomplishes the same thing and avoids
       having special flags just for TruncateForUnicodeToText
       Also, kUnicodeRestartSafeBit is unnecessary, since restart-safeness is handled by
       setting kUnicodeKeepInfoBit with ConvertFromUnicodeToText.
       If TruncateForUnicodeToText is called with one or both of the old special control
       flags set (bits 0 or 1), it will not generate a paramErr, but the old bits have no
       effect on its operation.
    }

    {    Filter bits for filter field in QueryUnicodeMappings and CountUnicodeMappings:     }
    kUnicodeMatchUnicodeBaseBit = 0;
    kUnicodeMatchUnicodeVariantBit = 1;
    kUnicodeMatchUnicodeFormatBit = 2;
    kUnicodeMatchOtherBaseBit   = 3;
    kUnicodeMatchOtherVariantBit = 4;
    kUnicodeMatchOtherFormatBit = 5;

    kUnicodeMatchUnicodeBaseMask = $00000001;
    kUnicodeMatchUnicodeVariantMask = $00000002;
    kUnicodeMatchUnicodeFormatMask = $00000004;
    kUnicodeMatchOtherBaseMask  = $00000008;
    kUnicodeMatchOtherVariantMask = $00000010;
    kUnicodeMatchOtherFormatMask = $00000020;

    {    Control flags for SetFallbackUnicodeToText     }
    kUnicodeFallbackSequencingBits = 0;

    kUnicodeFallbackSequencingMask = $00000003;
    kUnicodeFallbackInterruptSafeMask = $00000004;              {  To indicate that caller fallback routine doesnÕt move memory }

    {    values for kUnicodeFallbackSequencing field    }
    kUnicodeFallbackDefaultOnly = 0;
    kUnicodeFallbackCustomOnly  = 1;
    kUnicodeFallbackDefaultFirst = 2;
    kUnicodeFallbackCustomFirst = 3;


    {    Caller-supplied entry point to a fallback handler  }

type
    UnicodeToTextFallbackProcPtr = function(iSrcUniStr: UniCharPtr; iSrcUniStrLen: ByteCount; var oSrcConvLen: ByteCount; oDestStr: TextPtr; iDestStrLen: ByteCount; var oDestConvLen: ByteCount; iInfoPtr: LogicalAddress; iUnicodeMappingPtr: ConstUnicodeMappingPtr): OSStatus;

    UnicodeToTextFallbackUPP = ^SInt32; { an opaque UPP }

const
    uppUnicodeToTextFallbackProcInfo = $003FFFF0;
    {
     *  NewUnicodeToTextFallbackUPP()
     *
     *  Availability:
     *    Non-Carbon CFM:   available as macro/inline
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function NewUnicodeToTextFallbackUPP(userRoutine: UnicodeToTextFallbackProcPtr): UnicodeToTextFallbackUPP; external name '_NewUnicodeToTextFallbackUPP'; { old name was NewUnicodeToTextFallbackProc }
{
 *  DisposeUnicodeToTextFallbackUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeUnicodeToTextFallbackUPP(userUPP: UnicodeToTextFallbackUPP); external name '_DisposeUnicodeToTextFallbackUPP';
{
 *  InvokeUnicodeToTextFallbackUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeUnicodeToTextFallbackUPP(iSrcUniStr: UniCharPtr; iSrcUniStrLen: ByteCount; var oSrcConvLen: ByteCount; oDestStr: TextPtr; iDestStrLen: ByteCount; var oDestConvLen: ByteCount; iInfoPtr: LogicalAddress; iUnicodeMappingPtr: ConstUnicodeMappingPtr; userRoutine: UnicodeToTextFallbackUPP): OSStatus; external name '_InvokeUnicodeToTextFallbackUPP'; { old name was CallUnicodeToTextFallbackProc }
{ Function prototypes }

{
 *  CreateTextToUnicodeInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in UnicodeConverter 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CreateTextToUnicodeInfo(iUnicodeMapping: ConstUnicodeMappingPtr; var oTextToUnicodeInfo: TextToUnicodeInfo): OSStatus; external name '_CreateTextToUnicodeInfo';

{
 *  CreateTextToUnicodeInfoByEncoding()
 *
 *  Availability:
 *    Non-Carbon CFM:   in UnicodeConverter 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CreateTextToUnicodeInfoByEncoding(iEncoding: TextEncoding; var oTextToUnicodeInfo: TextToUnicodeInfo): OSStatus; external name '_CreateTextToUnicodeInfoByEncoding';

{
 *  CreateUnicodeToTextInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in UnicodeConverter 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CreateUnicodeToTextInfo(iUnicodeMapping: ConstUnicodeMappingPtr; var oUnicodeToTextInfo: UnicodeToTextInfo): OSStatus; external name '_CreateUnicodeToTextInfo';

{
 *  CreateUnicodeToTextInfoByEncoding()
 *
 *  Availability:
 *    Non-Carbon CFM:   in UnicodeConverter 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CreateUnicodeToTextInfoByEncoding(iEncoding: TextEncoding; var oUnicodeToTextInfo: UnicodeToTextInfo): OSStatus; external name '_CreateUnicodeToTextInfoByEncoding';

{
 *  CreateUnicodeToTextRunInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in UnicodeConverter 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CreateUnicodeToTextRunInfo(iNumberOfMappings: ItemCount; const (*var*) iUnicodeMappings: UnicodeMapping; var oUnicodeToTextInfo: UnicodeToTextRunInfo): OSStatus; external name '_CreateUnicodeToTextRunInfo';

{
 *  CreateUnicodeToTextRunInfoByEncoding()
 *
 *  Availability:
 *    Non-Carbon CFM:   in UnicodeConverter 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CreateUnicodeToTextRunInfoByEncoding(iNumberOfEncodings: ItemCount; iEncodings: TextEncodingPtr; var oUnicodeToTextInfo: UnicodeToTextRunInfo): OSStatus; external name '_CreateUnicodeToTextRunInfoByEncoding';

{
 *  CreateUnicodeToTextRunInfoByScriptCode()
 *
 *  Availability:
 *    Non-Carbon CFM:   in UnicodeConverter 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CreateUnicodeToTextRunInfoByScriptCode(iNumberOfScriptCodes: ItemCount; iScripts: ScriptCodePtr; var oUnicodeToTextInfo: UnicodeToTextRunInfo): OSStatus; external name '_CreateUnicodeToTextRunInfoByScriptCode';

{ Change the TextToUnicodeInfo to another mapping. }
{
 *  ChangeTextToUnicodeInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in UnicodeConverter 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ChangeTextToUnicodeInfo(ioTextToUnicodeInfo: TextToUnicodeInfo; iUnicodeMapping: ConstUnicodeMappingPtr): OSStatus; external name '_ChangeTextToUnicodeInfo';

{ Change the UnicodeToTextInfo to another mapping. }
{
 *  ChangeUnicodeToTextInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in UnicodeConverter 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ChangeUnicodeToTextInfo(ioUnicodeToTextInfo: UnicodeToTextInfo; iUnicodeMapping: ConstUnicodeMappingPtr): OSStatus; external name '_ChangeUnicodeToTextInfo';


{
 *  DisposeTextToUnicodeInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in UnicodeConverter 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DisposeTextToUnicodeInfo(var ioTextToUnicodeInfo: TextToUnicodeInfo): OSStatus; external name '_DisposeTextToUnicodeInfo';

{
 *  DisposeUnicodeToTextInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in UnicodeConverter 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DisposeUnicodeToTextInfo(var ioUnicodeToTextInfo: UnicodeToTextInfo): OSStatus; external name '_DisposeUnicodeToTextInfo';

{
 *  DisposeUnicodeToTextRunInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in UnicodeConverter 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DisposeUnicodeToTextRunInfo(var ioUnicodeToTextRunInfo: UnicodeToTextRunInfo): OSStatus; external name '_DisposeUnicodeToTextRunInfo';

{
 *  ConvertFromTextToUnicode()
 *
 *  Availability:
 *    Non-Carbon CFM:   in UnicodeConverter 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ConvertFromTextToUnicode(iTextToUnicodeInfo: TextToUnicodeInfo; iSourceLen: ByteCount; iSourceStr: ConstLogicalAddress; iControlFlags: OptionBits; iOffsetCount: ItemCount; iOffsetArray: ByteOffsetPtr; oOffsetCount: ItemCountPtr; oOffsetArray: ByteOffsetPtr; iOutputBufLen: ByteCount; var oSourceRead: ByteCount; var oUnicodeLen: ByteCount; oUnicodeStr: UniCharPtr): OSStatus; external name '_ConvertFromTextToUnicode';

{
 *  ConvertFromUnicodeToText()
 *
 *  Availability:
 *    Non-Carbon CFM:   in UnicodeConverter 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ConvertFromUnicodeToText(iUnicodeToTextInfo: UnicodeToTextInfo; iUnicodeLen: ByteCount; iUnicodeStr: UniCharPtr; iControlFlags: OptionBits; iOffsetCount: ItemCount; iOffsetArray: ByteOffsetPtr; oOffsetCount: ItemCountPtr; oOffsetArray: ByteOffsetPtr; iOutputBufLen: ByteCount; var oInputRead: ByteCount; var oOutputLen: ByteCount; oOutputStr: LogicalAddress): OSStatus; external name '_ConvertFromUnicodeToText';

{
 *  ConvertFromUnicodeToTextRun()
 *
 *  Availability:
 *    Non-Carbon CFM:   in UnicodeConverter 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ConvertFromUnicodeToTextRun(iUnicodeToTextInfo: UnicodeToTextRunInfo; iUnicodeLen: ByteCount; iUnicodeStr: UniCharPtr; iControlFlags: OptionBits; iOffsetCount: ItemCount; iOffsetArray: ByteOffsetPtr; oOffsetCount: ItemCountPtr; oOffsetArray: ByteOffsetPtr; iOutputBufLen: ByteCount; var oInputRead: ByteCount; var oOutputLen: ByteCount; oOutputStr: LogicalAddress; iEncodingRunBufLen: ItemCount; var oEncodingRunOutLen: ItemCount; var oEncodingRuns: TextEncodingRun): OSStatus; external name '_ConvertFromUnicodeToTextRun';

{
 *  ConvertFromUnicodeToScriptCodeRun()
 *
 *  Availability:
 *    Non-Carbon CFM:   in UnicodeConverter 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ConvertFromUnicodeToScriptCodeRun(iUnicodeToTextInfo: UnicodeToTextRunInfo; iUnicodeLen: ByteCount; iUnicodeStr: UniCharPtr; iControlFlags: OptionBits; iOffsetCount: ItemCount; iOffsetArray: ByteOffsetPtr; oOffsetCount: ItemCountPtr; oOffsetArray: ByteOffsetPtr; iOutputBufLen: ByteCount; var oInputRead: ByteCount; var oOutputLen: ByteCount; oOutputStr: LogicalAddress; iScriptRunBufLen: ItemCount; var oScriptRunOutLen: ItemCount; var oScriptCodeRuns: ScriptCodeRun): OSStatus; external name '_ConvertFromUnicodeToScriptCodeRun';

{ Truncate a multibyte string at a safe place. }
{
 *  TruncateForTextToUnicode()
 *
 *  Availability:
 *    Non-Carbon CFM:   in UnicodeConverter 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TruncateForTextToUnicode(iTextToUnicodeInfo: ConstTextToUnicodeInfo; iSourceLen: ByteCount; iSourceStr: ConstLogicalAddress; iMaxLen: ByteCount; var oTruncatedLen: ByteCount): OSStatus; external name '_TruncateForTextToUnicode';

{ Truncate a Unicode string at a safe place. }
{
 *  TruncateForUnicodeToText()
 *
 *  Availability:
 *    Non-Carbon CFM:   in UnicodeConverter 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TruncateForUnicodeToText(iUnicodeToTextInfo: ConstUnicodeToTextInfo; iSourceLen: ByteCount; iSourceStr: ConstUniCharPtr; iControlFlags: OptionBits; iMaxLen: ByteCount; var oTruncatedLen: ByteCount): OSStatus; external name '_TruncateForUnicodeToText';

{ Convert a Pascal string to Unicode string. }
{
 *  ConvertFromPStringToUnicode()
 *
 *  Availability:
 *    Non-Carbon CFM:   in UnicodeConverter 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ConvertFromPStringToUnicode(iTextToUnicodeInfo: TextToUnicodeInfo; const (*var*) iPascalStr: Str255; iOutputBufLen: ByteCount; var oUnicodeLen: ByteCount; oUnicodeStr: UniCharPtr): OSStatus; external name '_ConvertFromPStringToUnicode';

{ Convert a Unicode string to Pascal string. }
{
 *  ConvertFromUnicodeToPString()
 *
 *  Availability:
 *    Non-Carbon CFM:   in UnicodeConverter 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ConvertFromUnicodeToPString(iUnicodeToTextInfo: UnicodeToTextInfo; iUnicodeLen: ByteCount; iUnicodeStr: UniCharPtr; var oPascalStr: Str255): OSStatus; external name '_ConvertFromUnicodeToPString';

{ Count the available conversion mappings. }
{
 *  CountUnicodeMappings()
 *
 *  Availability:
 *    Non-Carbon CFM:   in UnicodeConverter 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CountUnicodeMappings(iFilter: OptionBits; iFindMapping: ConstUnicodeMappingPtr; var oActualCount: ItemCount): OSStatus; external name '_CountUnicodeMappings';

{ Get a list of the available conversion mappings. }
{
 *  QueryUnicodeMappings()
 *
 *  Availability:
 *    Non-Carbon CFM:   in UnicodeConverter 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function QueryUnicodeMappings(iFilter: OptionBits; iFindMapping: ConstUnicodeMappingPtr; iMaxCount: ItemCount; var oActualCount: ItemCount; var oReturnedMappings: UnicodeMapping): OSStatus; external name '_QueryUnicodeMappings';

{ Setup the fallback handler for converting Unicode To Text. }
{
 *  SetFallbackUnicodeToText()
 *
 *  Availability:
 *    Non-Carbon CFM:   in UnicodeConverter 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetFallbackUnicodeToText(iUnicodeToTextInfo: UnicodeToTextInfo; iFallback: UnicodeToTextFallbackUPP; iControlFlags: OptionBits; iInfoPtr: LogicalAddress): OSStatus; external name '_SetFallbackUnicodeToText';

{ Setup the fallback handler for converting Unicode To TextRuns. }
{
 *  SetFallbackUnicodeToTextRun()
 *
 *  Availability:
 *    Non-Carbon CFM:   in UnicodeConverter 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetFallbackUnicodeToTextRun(iUnicodeToTextRunInfo: UnicodeToTextRunInfo; iFallback: UnicodeToTextFallbackUPP; iControlFlags: OptionBits; iInfoPtr: LogicalAddress): OSStatus; external name '_SetFallbackUnicodeToTextRun';

{ Re-initialize all state information kept by the context objects. }
{
 *  ResetTextToUnicodeInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in UnicodeConverter 1.3 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ResetTextToUnicodeInfo(ioTextToUnicodeInfo: TextToUnicodeInfo): OSStatus; external name '_ResetTextToUnicodeInfo';

{ Re-initialize all state information kept by the context objects. }
{
 *  ResetUnicodeToTextInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in UnicodeConverter 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ResetUnicodeToTextInfo(ioUnicodeToTextInfo: UnicodeToTextInfo): OSStatus; external name '_ResetUnicodeToTextInfo';

{ Re-initialize all state information kept by the context objects in TextRun conversions. }
{
 *  ResetUnicodeToTextRunInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in UnicodeConverter 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ResetUnicodeToTextRunInfo(ioUnicodeToTextRunInfo: UnicodeToTextRunInfo): OSStatus; external name '_ResetUnicodeToTextRunInfo';


{$ALIGN MAC68K}
{#POP}
{unit UnicodeUtilities}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}

{
   -------------------------------------------------------------------------------------------------
   CONSTANTS & DATA STRUCTURES for UCKeyTranslate & UCKeyboardLayout ('uchr' resource)
   -------------------------------------------------------------------------------------------------
}

{
   -------------------------------------------------------------------------------------------------
   UCKeyOutput & related stuff
   The interpretation of UCKeyOutput depends on bits 15-14.
   If they are 01, then bits 0-13 are an index in UCKeyStateRecordsIndex (resource-wide list).
   If they are 10, then bits 0-13 are an index in UCKeySequenceDataIndex (resource-wide list),
     or if UCKeySequenceDataIndex is not present or the index is beyond the end of the list,
     then bits 0-15 are a single Unicode character.
   Otherwise, bits 0-15 are a single Unicode character; a value of 0xFFFE-0xFFFF means no character
     output.
   UCKeyCharSeq is similar, but does not support indices in UCKeyStateRecordsIndex. For bits 15-14:
   If they are 10, then bits 0-13 are an index in UCKeySequenceDataIndex (resource-wide list),
     or if UCKeySequenceDataIndex is not present or the index is beyond the end of the list,
     then bits 0-15 are a single Unicode character.
   Otherwise, bits 0-15 are a single Unicode character; a value of 0xFFFE-0xFFFF means no character
     output.
   -------------------------------------------------------------------------------------------------
}


type
    UCKeyOutput                         = UInt16;
    UCKeyCharSeq                        = UInt16;

const
    kUCKeyOutputStateIndexMask  = $4000;
    kUCKeyOutputSequenceIndexMask = $8000;
    kUCKeyOutputTestForIndexMask = $C000;                       {  test bits 14-15 }
    kUCKeyOutputGetIndexMask    = $3FFF;                        {  get bits 0-13 }

    {
       -------------------------------------------------------------------------------------------------
       UCKeyStateRecord & related stuff
       The UCKeyStateRecord information is used as follows. If the current state is zero,
       output stateZeroCharData and set the state to stateZeroNextState. If the current state
       is non-zero and there is an entry for it in stateEntryData, then output the corresponding
       charData and set the state to nextState. Otherwise, output the state terminator from
       UCKeyStateTerminators for the current state (or nothing if there is no UCKeyStateTerminators
       table or it has no entry for the current state), then output stateZeroCharData and set the
       state to stateZeroNextState.
       -------------------------------------------------------------------------------------------------
    }


type
    UCKeyStateRecordPtr = ^UCKeyStateRecord;
    UCKeyStateRecord = record
        stateZeroCharData:      UCKeyCharSeq;
        stateZeroNextState:     UInt16;
        stateEntryCount:        UInt16;
        stateEntryFormat:       UInt16;
                                                                        {  This is followed by an array of stateEntryCount elements }
                                                                        {  in the specified format. Here we just show a dummy array. }
        stateEntryData:         array [0..0] of UInt32;
    end;

    {
       Here are the codes for entry formats currently defined.
       Each entry maps from curState to charData and nextState.
    }

const
    kUCKeyStateEntryTerminalFormat = $0001;
    kUCKeyStateEntryRangeFormat = $0002;

    {
       For UCKeyStateEntryTerminal -
       nextState is always 0, so we don't have a field for it
    }


type
    UCKeyStateEntryTerminalPtr = ^UCKeyStateEntryTerminal;
    UCKeyStateEntryTerminal = record
        curState:               UInt16;
        charData:               UCKeyCharSeq;
    end;

    {
       For UCKeyStateEntryRange -
       If curState >= curStateStart and curState <= curStateStart+curStateRange,
       then it matches the entry, and we transform charData and nextState as follows:
       If charData < 0xFFFE, then charData += (curState-curStateStart)*deltaMultiplier
       If nextState != 0, then nextState += (curState-curStateStart)*deltaMultiplier
    }
    UCKeyStateEntryRangePtr = ^UCKeyStateEntryRange;
    UCKeyStateEntryRange = record
        curStateStart:          UInt16;
        curStateRange:          SInt8;
        deltaMultiplier:        SInt8;
        charData:               UCKeyCharSeq;
        nextState:              UInt16;
    end;

    {
       -------------------------------------------------------------------------------------------------
       UCKeyboardLayout & related stuff
       The UCKeyboardLayout struct given here is only for the resource header. It specifies
       offsets to the various subtables which each have their own structs, given below.
       The keyboardTypeHeadList array selects table offsets that depend on keyboardType. The
       first entry in keyboardTypeHeadList is the default entry, which will be used if the
       keyboardType passed to UCKeyTranslate does not match any other entry - i.e. does not fall
       within the range keyboardTypeFirst..keyboardTypeLast for some entry. The first entry
       should have keyboardTypeFirst = keyboardTypeLast = 0.
       -------------------------------------------------------------------------------------------------
    }
    UCKeyboardTypeHeaderPtr = ^UCKeyboardTypeHeader;
    UCKeyboardTypeHeader = record
        keyboardTypeFirst:      UInt32;                                 {  first keyboardType in this entry }
        keyboardTypeLast:       UInt32;                                 {  last keyboardType in this entry }
        keyModifiersToTableNumOffset: ByteOffset;                       {  required }
        keyToCharTableIndexOffset: ByteOffset;                          {  required }
        keyStateRecordsIndexOffset: ByteOffset;                         {  0 => no table }
        keyStateTerminatorsOffset: ByteOffset;                          {  0 => no table }
        keySequenceDataIndexOffset: ByteOffset;                         {  0 => no table }
    end;

    UCKeyboardLayoutPtr = ^UCKeyboardLayout;
    UCKeyboardLayout = record
                                                                        {  header only; other tables accessed via offsets }
        keyLayoutHeaderFormat:  UInt16;                                 {  =kUCKeyLayoutHeaderFormat }
        keyLayoutDataVersion:   UInt16;                                 {  0x0100 = 1.0, 0x0110 = 1.1, etc. }
        keyLayoutFeatureInfoOffset: ByteOffset;                         {  may be 0                        }
        keyboardTypeCount:      ItemCount;                              {  Dimension for keyboardTypeHeadList[]      }
        keyboardTypeList:       array [0..0] of UCKeyboardTypeHeader;
    end;

    {  ------------------------------------------------------------------------------------------------- }
    UCKeyLayoutFeatureInfoPtr = ^UCKeyLayoutFeatureInfo;
    UCKeyLayoutFeatureInfo = record
        keyLayoutFeatureInfoFormat: UInt16;                             {  =kUCKeyLayoutFeatureInfoFormat }
        reserved:               UInt16;
        maxOutputStringLength:  UniCharCount;                           {  longest possible output string }
    end;

    {  ------------------------------------------------------------------------------------------------- }
    UCKeyModifiersToTableNumPtr = ^UCKeyModifiersToTableNum;
    UCKeyModifiersToTableNum = record
        keyModifiersToTableNumFormat: UInt16;                           {  =kUCKeyModifiersToTableNumFormat }
        defaultTableNum:        UInt16;                                 {  For modifier combos not in tableNum[] }
        modifiersCount:         ItemCount;                              {  Dimension for tableNum[] }
        tableNum:               SInt8;
                                                                        {  Then there is padding to a 4-byte boundary with bytes containing 0, if necessary. }
    end;

    {  ------------------------------------------------------------------------------------------------- }
    UCKeyToCharTableIndexPtr = ^UCKeyToCharTableIndex;
    UCKeyToCharTableIndex = record
        keyToCharTableIndexFormat: UInt16;                              {  =kUCKeyToCharTableIndexFormat }
        keyToCharTableSize:     UInt16;                                 {  Max keyCode (128 for ADB keyboards) }
        keyToCharTableCount:    ItemCount;                              {  Dimension for keyToCharTableOffsets[] (usually 6 to 12 tables) }
        keyToCharTableOffsets:  array [0..0] of ByteOffset;
                                                                        {  Each offset in keyToCharTableOffsets is from the beginning of the resource to a }
                                                                        {  table as follows: }
                                                                        {     UCKeyOutput       keyToCharData[keyToCharTableSize]; }
                                                                        {  These tables follow the UCKeyToCharTableIndex. }
                                                                        {  Then there is padding to a 4-byte boundary with bytes containing 0, if necessary. }
    end;

    {  ------------------------------------------------------------------------------------------------- }
    UCKeyStateRecordsIndexPtr = ^UCKeyStateRecordsIndex;
    UCKeyStateRecordsIndex = record
        keyStateRecordsIndexFormat: UInt16;                             {  =kUCKeyStateRecordsIndexFormat }
        keyStateRecordCount:    UInt16;                                 {  Dimension for keyStateRecordOffsets[] }
        keyStateRecordOffsets:  array [0..0] of ByteOffset;
                                                                        {  Each offset in keyStateRecordOffsets is from the beginning of the resource to a }
                                                                        {  UCKeyStateRecord. These UCKeyStateRecords follow the keyStateRecordOffsets[] array. }
                                                                        {  Then there is padding to a 4-byte boundary with bytes containing 0, if necessary. }
    end;

    {  ------------------------------------------------------------------------------------------------- }
    UCKeyStateTerminatorsPtr = ^UCKeyStateTerminators;
    UCKeyStateTerminators = record
        keyStateTerminatorsFormat: UInt16;                              {  =kUCKeyStateTerminatorsFormat }
        keyStateTerminatorCount: UInt16;                                {  Dimension for keyStateTerminators[] (# of nonzero states) }
        keyStateTerminators:    array [0..0] of UCKeyCharSeq;
                                                                        {  Note: keyStateTerminators[0] is terminator for state 1, etc. }
                                                                        {  Then there is padding to a 4-byte boundary with bytes containing 0, if necessary. }
    end;

    {  ------------------------------------------------------------------------------------------------- }
    UCKeySequenceDataIndexPtr = ^UCKeySequenceDataIndex;
    UCKeySequenceDataIndex = record
        keySequenceDataIndexFormat: UInt16;                             {  =kUCKeySequenceDataIndexFormat }
        charSequenceCount:      UInt16;                                 {  Dimension of charSequenceOffsets[] is charSequenceCount+1 }
        charSequenceOffsets:    array [0..0] of UInt16;
                                                                        {  Each offset in charSequenceOffsets is in bytes, from the beginning of }
                                                                        {  UCKeySequenceDataIndex to a sequence of UniChars; the next offset indicates the }
                                                                        {  end of the sequence. The UniChar sequences follow the UCKeySequenceDataIndex. }
                                                                        {  Then there is padding to a 4-byte boundary with bytes containing 0, if necessary. }
    end;

    {  ------------------------------------------------------------------------------------------------- }
    {  Current format codes for the various tables (bits 12-15 indicate which table) }


const
    kUCKeyLayoutHeaderFormat    = $1002;
    kUCKeyLayoutFeatureInfoFormat = $2001;
    kUCKeyModifiersToTableNumFormat = $3001;
    kUCKeyToCharTableIndexFormat = $4001;
    kUCKeyStateRecordsIndexFormat = $5001;
    kUCKeyStateTerminatorsFormat = $6001;
    kUCKeySequenceDataIndexFormat = $7001;


    {
       -------------------------------------------------------------------------------------------------
       Constants for keyAction parameter in UCKeyTranslate()
       -------------------------------------------------------------------------------------------------
    }

    kUCKeyActionDown            = 0;                            {  key is going down }
    kUCKeyActionUp              = 1;                            {  key is going up }
    kUCKeyActionAutoKey         = 2;                            {  auto-key down }
    kUCKeyActionDisplay         = 3;                            {  get information for key display (as in Key Caps)       }

    {
       -------------------------------------------------------------------------------------------------
       Bit assignments & masks for keyTranslateOptions parameter in UCKeyTranslate()
       -------------------------------------------------------------------------------------------------
    }

    kUCKeyTranslateNoDeadKeysBit = 0;                           {  Prevents setting any new dead-key states }

    kUCKeyTranslateNoDeadKeysMask = $00000001;

    {
       -------------------------------------------------------------------------------------------------
       CONSTANTS & DATA STRUCTURES for Unicode Collation
       -------------------------------------------------------------------------------------------------
    }
    {  constant for LocaleOperationClass }
    kUnicodeCollationClass      = $75636F6C (* 'ucol' *);


type
    CollatorRef    = ^SInt32; { an opaque 32-bit type }
    CollatorRefPtr = ^CollatorRef;  { when a var xx:CollatorRef parameter can be nil, it is changed to xx: CollatorRefPtr }
    UCCollateOptions            = UInt32;
const
                                                                {  Sensitivity options }
    kUCCollateComposeInsensitiveMask = $00000002;
    kUCCollateWidthInsensitiveMask = $00000004;
    kUCCollateCaseInsensitiveMask = $00000008;
    kUCCollateDiacritInsensitiveMask = $00000010;               {  Other general options  }
    kUCCollatePunctuationSignificantMask = $00008000;           {  Number-handling options  }
    kUCCollateDigitsOverrideMask = $00010000;
    kUCCollateDigitsAsNumberMask = $00020000;

    kUCCollateStandardOptions   = $00000006;

    {
       Special values to specify various invariant orders for UCCompareTextNoLocale.
       These values use the high 8 bits of UCCollateOptions.
    }
    kUCCollateTypeHFSExtended   = 1;

    {  These constants are used for masking and shifting the invariant order type. }
    kUCCollateTypeSourceMask    = $000000FF;
    kUCCollateTypeShiftBits     = 24;

    kUCCollateTypeMask          = $FF000000;


type
    UCCollationValue                    = UInt32;
    UCCollationValuePtr             = ^UCCollationValue;
    {
       -------------------------------------------------------------------------------------------------
       CONSTANTS & DATA STRUCTURES for Unicode TextBreak
       -------------------------------------------------------------------------------------------------
    }
    {  constant for LocaleOperationClass }

const
    kUnicodeTextBreakClass      = $7562726B (* 'ubrk' *);


type
    TextBreakLocatorRef    = ^SInt32; { an opaque 32-bit type }
    TextBreakLocatorRefPtr = ^TextBreakLocatorRef;  { when a var xx:TextBreakLocatorRef parameter can be nil, it is changed to xx: TextBreakLocatorRefPtr }
    UCTextBreakType             = UInt32;
const
    kUCTextBreakCharMask        = $00000001;
    kUCTextBreakClusterMask     = $00000004;
    kUCTextBreakWordMask        = $00000010;
    kUCTextBreakLineMask        = $00000040;


type
    UCTextBreakOptions          = UInt32;
const
    kUCTextBreakLeadingEdgeMask = $00000001;
    kUCTextBreakGoBackwardsMask = $00000002;
    kUCTextBreakIterateMask     = $00000004;

    {
       -------------------------------------------------------------------------------------------------
       function PROTOTYPES
       -------------------------------------------------------------------------------------------------
    }

    {
     *  UCKeyTranslate()
     *
     *  Availability:
     *    Non-Carbon CFM:   in UnicodeUtilitiesCoreLib 8.5 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function UCKeyTranslate(const (*var*) keyLayoutPtr: UCKeyboardLayout; virtualKeyCode: UInt16; keyAction: UInt16; modifierKeyState: UInt32; keyboardType: UInt32; keyTranslateOptions: OptionBits; var deadKeyState: UInt32; maxStringLength: UniCharCount; var actualStringLength: UniCharCount; unicodeString: UniCharPtr): OSStatus; external name '_UCKeyTranslate';

{  Standard collation functions }
{
 *  UCCreateCollator()
 *
 *  Availability:
 *    Non-Carbon CFM:   in UnicodeUtilitiesLib 8.6 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function UCCreateCollator(locale: LocaleRef; opVariant: LocaleOperationVariant; options: UCCollateOptions; var collatorRef: CollatorRef): OSStatus; external name '_UCCreateCollator';

{
 *  UCGetCollationKey()
 *
 *  Availability:
 *    Non-Carbon CFM:   in UnicodeUtilitiesLib 8.6 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function UCGetCollationKey(collatorRef: CollatorRef; textPtr: ConstUniCharPtr; textLength: UniCharCount; maxKeySize: ItemCount; var actualKeySize: ItemCount; collationKey: UCCollationValuePtr): OSStatus; external name '_UCGetCollationKey';

{
 *  UCCompareCollationKeys()
 *
 *  Availability:
 *    Non-Carbon CFM:   in UnicodeUtilitiesCoreLib 8.6 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function UCCompareCollationKeys(key1Ptr: UCCollationValuePtr; key1Length: ItemCount; key2Ptr: UCCollationValuePtr; key2Length: ItemCount; var equivalent: boolean; var order: SInt32): OSStatus; external name '_UCCompareCollationKeys';

{
 *  UCCompareText()
 *
 *  Availability:
 *    Non-Carbon CFM:   in UnicodeUtilitiesLib 8.6 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function UCCompareText(collatorRef: CollatorRef; text1Ptr: ConstUniCharPtr; text1Length: UniCharCount; text2Ptr: ConstUniCharPtr; text2Length: UniCharCount; var equivalent: boolean; var order: SInt32): OSStatus; external name '_UCCompareText';

{
 *  UCDisposeCollator()
 *
 *  Availability:
 *    Non-Carbon CFM:   in UnicodeUtilitiesLib 8.6 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function UCDisposeCollator(var collatorRef: CollatorRef): OSStatus; external name '_UCDisposeCollator';

{  Simple collation using default locale }

{
 *  UCCompareTextDefault()
 *
 *  Availability:
 *    Non-Carbon CFM:   in UnicodeUtilitiesLib 8.6 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function UCCompareTextDefault(options: UCCollateOptions; text1Ptr: ConstUniCharPtr; text1Length: UniCharCount; text2Ptr: ConstUniCharPtr; text2Length: UniCharCount; var equivalent: boolean; var order: SInt32): OSStatus; external name '_UCCompareTextDefault';


{  Simple locale-independent collation }

{
 *  UCCompareTextNoLocale()
 *
 *  Availability:
 *    Non-Carbon CFM:   in UnicodeUtilitiesCoreLib 8.6 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function UCCompareTextNoLocale(options: UCCollateOptions; text1Ptr: ConstUniCharPtr; text1Length: UniCharCount; text2Ptr: ConstUniCharPtr; text2Length: UniCharCount; var equivalent: boolean; var order: SInt32): OSStatus; external name '_UCCompareTextNoLocale';

{  Standard text break (text boundary) functions }
{
 *  UCCreateTextBreakLocator()
 *
 *  Availability:
 *    Non-Carbon CFM:   in UnicodeUtilitiesLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function UCCreateTextBreakLocator(locale: LocaleRef; opVariant: LocaleOperationVariant; breakTypes: UCTextBreakType; var breakRef: TextBreakLocatorRef): OSStatus; external name '_UCCreateTextBreakLocator';

{
 *  UCFindTextBreak()
 *
 *  Availability:
 *    Non-Carbon CFM:   in UnicodeUtilitiesLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function UCFindTextBreak(breakRef: TextBreakLocatorRef; breakType: UCTextBreakType; options: UCTextBreakOptions; textPtr: ConstUniCharPtr; textLength: UniCharCount; startOffset: UniCharArrayOffset; var breakOffset: UniCharArrayOffset): OSStatus; external name '_UCFindTextBreak';

{
 *  UCDisposeTextBreakLocator()
 *
 *  Availability:
 *    Non-Carbon CFM:   in UnicodeUtilitiesLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function UCDisposeTextBreakLocator(var breakRef: TextBreakLocatorRef): OSStatus; external name '_UCDisposeTextBreakLocator';

{$ALIGN MAC68K}
{#POP}
{unit WorldScript}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}


type
    WSIOffset                           = UInt16;
    WSIByteCount                        = UInt8;
    WSIByteIndex                        = UInt8;
    {    offset from start of sub-table to row in state table   }
    WSIStateOffset                      = UInt16;
    WSITableOffset                      = UInt32;
    WSISubtableOffset                   = UInt16;
    WSIGlyphcode                        = UInt16;
    WSITableIdentifiers                 = UInt32;

const
    kScriptSettingsTag          = $696E666F (* 'info' *);
    kMetamorphosisTag           = $6D6F7274 (* 'mort' *);
    kGlyphExpansionTag          = $67326723 (* 'g2g#' *);
    kPropertiesTag              = $70726F70 (* 'prop' *);
    kJustificationTag           = $6B617368 (* 'kash' *);
    kCharToGlyphTag             = $636D6170 (* 'cmap' *);
    kGlyphToCharTag             = $70616D63 (* 'pamc' *);
    kFindScriptRunTag           = $66737462 (* 'fstb' *);



    {   ***           L O O K U P    T A B L E    T Y P E S       ***   }
    WSILookupSimpleArray        = 0;                            {  a simple array indexed by glyph code  }
    WSILookupSegmentSingle      = 2;                            {  segment mapping to single value  }
    WSILookupSegmentArray       = 4;                            {  segment mapping to lookup array  }
    WSILookupSingleTable        = 6;                            {  sorted list of glyph, value pairs  }
    WSILookupTrimmedArray       = 8;                            {  a simple trimmed array indexed by glyph code  }


type
    WSILookupTableFormat                = UInt16;
    WSILookupValue                      = UInt16;
    {    An offset from the beginning of the lookup table   }
    WSILookupOffset                     = UInt16;
    {     FORMAT SPECIFIC DEFINITIONS   }
    {
            lookupSimpleArray:

            This is a simple array which maps all glyphs in the font
            to lookup values.
            }
    WSILookupArrayHeaderPtr = ^WSILookupArrayHeader;
    WSILookupArrayHeader = record
        lookupValues:           array [0..0] of WSILookupValue;         {  The array of values indexed by glyph code  }
    end;

    {
            lookupTrimmedArray:

            This is a single trimmed array which maps a single range
            of glyhs in the font to lookup values.
            }
    WSILookupTrimmedArrayHeaderPtr = ^WSILookupTrimmedArrayHeader;
    WSILookupTrimmedArrayHeader = record
        firstGlyph:             WSIGlyphcode;
        limitGlyph:             WSIGlyphcode;
        valueArray:             array [0..0] of WSILookupValue;
    end;

    {    The format specific part of the subtable header    }
    WSILookupFormatSpecificHeaderPtr = ^WSILookupFormatSpecificHeader;
    WSILookupFormatSpecificHeader = record
        case SInt16 of
        0: (
            simpleArray:        WSILookupArrayHeader;                   {  rename lookupArray as simpleArray <9>  }
            );
        1: (
            trimmedArray:       WSILookupTrimmedArrayHeader;
            );
    end;

    {    The overall subtable header    }
    WSILookupTableHeaderPtr = ^WSILookupTableHeader;
    WSILookupTableHeader = record
        format:                 WSILookupTableFormat;                   {  table format  }
        fsHeader:               WSILookupFormatSpecificHeader;          {  format specific header  }
    end;


    {   ***       G L Y P H    E X P A N S I O N    *** }

const
                                                                {  fixed 1.0  }
    kCurrentGlyphExpansionVersion = $00010000;


type
    GlyphExpansionFormats               = UInt16;

const
    GlyphExpansionLookupFormat  = 1;
    GlyphExpansionContextualFormat = 2;


type
    ExpandedGlyphClusterPtr = ^ExpandedGlyphCluster;
    ExpandedGlyphCluster = packed record
        numGlyphs:              WSIByteCount;
        bestGlyph:              WSIByteIndex;
        glyphs:                 array [0..0] of WSIGlyphcode;
    end;

    ExpandedGlyphOffsetPtr = ^ExpandedGlyphOffset;
    ExpandedGlyphOffset = record
        glyph:                  WSIGlyphcode;
        offset:                 WSIOffset;                              {  offset to ExpandedGlyphCluster  }
    end;

    GlyphExpansionStateTablePtr = ^GlyphExpansionStateTable;
    GlyphExpansionStateTable = record
        stateTableOffset:       WSISubtableOffset;
        classTableOffset:       WSISubtableOffset;
        actionTableOffset:      WSISubtableOffset;                      {  state, class and actions tables follow here...  }
    end;

    GlyphExpansionTablePtr = ^GlyphExpansionTable;
    GlyphExpansionTable = record
        version:                Fixed;
        format:                 SInt16;
        expansionNumer:         SInt16;
        expansionDenom:         SInt16;                             {  num/denom ratio for expansion <2>  }
        case SInt16 of
        0: (
            stateTable:         GlyphExpansionStateTable;
            );
        1: (
            lookup:             WSILookupTableHeader;                   {  expanded glyph clusters follow here...  }
            );
    end;


    {    Glyph-to-Character constants and types     }

const
    kCurrentGlyphToCharVersion  = $00010100;


type
    GlyphToCharLookupFormats            = UInt16;

const
    kGlyphToCharLookup8Format   = 1;
    kGlyphToCharLookup16Format  = 2;
    kGlyphToCharLookup32Format  = 3;


type
    GlyphToCharFontIndex                = UInt8;
    QDGlyphcode                         = UInt8;
    GlyphToCharActionTablePtr = ^GlyphToCharActionTable;
    GlyphToCharActionTable = record
        fontNameOffset:         WSISubtableOffset;                      {  offset relative to this table  }
        actions:                WSILookupTableHeader;                   {  only support lookupSimpleArray format for now  }
    end;

    GlyphToCharActionHeaderPtr = ^GlyphToCharActionHeader;
    GlyphToCharActionHeader = record
        numTables:              SInt16;                             {  0..n  }
        offsets:                array [0..0] of WSISubtableOffset;      {  offsets from start of action table header  }
    end;

    GlyphToCharHeaderPtr = ^GlyphToCharHeader;
    GlyphToCharHeader = record
        version:                Fixed;
        actionOffset:           WSISubtableOffset;                      {  offset to GlyphToCharActionHeader  }
        format:                 SInt16;                             {  size of font mask  }
        mappingTable:           WSILookupTableHeader;
    end;


    {    JUSTIFICATION TYPES
        WorldScript supports justification of text using insertion. The justification
        table specifies a insertion string to insert between 2 specified glyphs.
        Each combination of inter-glyph boundary can be assigned a justification priority,
        the higher the priority the more justification strings inserted at that position.

        The priorities for each inter-glyph boundary are specified by the justification table's
        state table.

        Special handling is done for scripts which use spaces to justify, because the width of
        a space varies depending on the setting of SpaceExtra. This is why the number of spaces
        per inserting string is specified in the justification table.

        }

const
                                                                {  1.0 not supported  }
    kCurrentJustificationVersion = $0200;

    kJustificationStateTableFormat = 1;

                                                                {  WSI's internal limitation <12>  }
    kMaxJustificationStringLength = 13;


type
    WSIJustificationPriority            = UInt8;

const
    WSIJustificationSetMarkMask = $80;


type
    WSIJustificationStateEntryPtr = ^WSIJustificationStateEntry;
    WSIJustificationStateEntry = packed record
        markPriority:           WSIJustificationPriority;               {  non-zero priorities means insertion  }
        priority:               WSIJustificationPriority;
        newState:               WSIStateOffset;
    end;

    WSIJustificationClasses             = UInt16;

const
    wsiJustEndOfLineClass       = 0;
    wsiJustEndOfRunClass        = 1;
    wsiJustDeletedGlyphClass    = 2;
    wsiJustUserDefinedClass     = 3;


type
    WSIJustificationStates              = UInt16;

const
    wsiStartOfLineState         = 0;                            {  pre-defined states  }
    wsiStartOfRunState          = 1;
    wsiUserDefinedState         = 2;

    {    pre-multiplied: class# * sizeof(WSIJustificationStateEntry)    }

type
    WSIJustificationClassOffset         = UInt8;
    WSIJustificationStateTablePtr = ^WSIJustificationStateTable;
    WSIJustificationStateTable = record
        maxPriorities:          SInt16;
        rowWidth:               UInt16;                                 {  width of a state table row in bytes  }
        classTableOffset:       SInt16;
        stateTableOffset:       SInt16;
    end;

    {
                Last two fields of above structure - someday?
                WSIJustificationClassOffset classes[up to 64 classes supported];
                WSIJustificationStateEntry  states[up to your heart's desire];
                }
    WSIJustificationHeaderPtr = ^WSIJustificationHeader;
    WSIJustificationHeader = record
        version:                SInt16;
        format:                 SInt16;
        scaling:                Point;                                  {  numer/denom scaling of priority weights <7>  }
        spacesPerInsertion:     UInt16;                                 {  # of $20 chars in justification insertion string <12>  }
        justStringOffset:       UInt16;                                 {  offset to justification string  }
        stateTable:             WSIJustificationStateTable;             {  long-aligned boundary aligned w/ spacesPerInsertion field - justification string follows  }
    end;


    {    Line Layout's Property table version <11>  }

const
                                                                {  v1.0  }
    currentPropsTableVersion    = $00010000;

                                                                {  version is octal 0100 or hex 0x40 (#64)  }
    kCharToGlyphCurrentVersion  = $40;

    {    pass as priorityWeight to JustifyWSILayout to use script's current just setting    }
    kScriptsDefaultJustWeight   = -1;


    {    feature selectors used in FindScriptRun and itl5 configuration tables <9>  }

type
    WSIFeatureType                      = UInt16;
    WSIFeatureSelector                  = UInt16;
    WSIFeaturePtr = ^WSIFeature;
    WSIFeature = record
        featureType:            WSIFeatureType;
        featureSelector:        WSIFeatureSelector;
    end;

{$ALIGN MAC68K}
{#POP}
{unit ABGlobals}
{$ALIGN MAC68K}






// NOTE: This header is for C programmers. For Objective-C use ABGlobals.h

// ================================================================
//      Global Table properties
// ================================================================

// ----- Properties common to all Records

var kABUIDProperty: CFStringRef; external name '_kABUIDProperty'; (* attribute const *)                   // The UID property - kABStringProperty
var kABCreationDateProperty: CFStringRef; external name '_kABCreationDateProperty'; (* attribute const *)          // Creation Date (when first saved) - kABDateProperty
var kABModificationDateProperty: CFStringRef; external name '_kABModificationDateProperty'; (* attribute const *)      // Last saved date - kABDateProperty

// ----- Person specific properties

var kABFirstNameProperty: CFStringRef; external name '_kABFirstNameProperty'; (* attribute const *)             // First name - kABStringProperty
var kABLastNameProperty: CFStringRef; external name '_kABLastNameProperty'; (* attribute const *)              // Last name - kABStringProperty

var kABFirstNamePhoneticProperty: CFStringRef; external name '_kABFirstNamePhoneticProperty'; (* attribute const *)     // First name Phonetic - kABStringProperty
var kABLastNamePhoneticProperty: CFStringRef; external name '_kABLastNamePhoneticProperty'; (* attribute const *)      // Last name Phonetic - kABStringProperty

var kABNicknameProperty: CFStringRef; external name '_kABNicknameProperty'; (* attribute const *)                // kABStringProperty
var kABMaidenNameProperty: CFStringRef; external name '_kABMaidenNameProperty'; (* attribute const *)              // kABStringProperty

var kABBirthdayProperty: CFStringRef; external name '_kABBirthdayProperty'; (* attribute const *)              // Birth date - kABDateProperty

var kABOrganizationProperty: CFStringRef; external name '_kABOrganizationProperty'; (* attribute const *)          // Company name - kABStringProperty

var kABJobTitleProperty: CFStringRef; external name '_kABJobTitleProperty'; (* attribute const *)              // Job Title - kABStringProperty

var kABHomePageProperty: CFStringRef; external name '_kABHomePageProperty'; (* attribute const *)              // Home Web pag - kABStringProperty

var kABEmailProperty: CFStringRef; external name '_kABEmailProperty'; (* attribute const *)                 // Email(s) - kABMultiStringProperty
        var kABEmailWorkLabel: CFStringRef; external name '_kABEmailWorkLabel'; (* attribute const *)        // Work email
        var kABEmailHomeLabel: CFStringRef; external name '_kABEmailHomeLabel'; (* attribute const *)        // Home email

var kABAddressProperty: CFStringRef; external name '_kABAddressProperty'; (* attribute const *)                // Street Addresses - kABMultiDictionaryProperty
    var kABAddressStreetKey: CFStringRef; external name '_kABAddressStreetKey'; (* attribute const *)           // Street
    var kABAddressCityKey: CFStringRef; external name '_kABAddressCityKey'; (* attribute const *)             // City
    var kABAddressStateKey: CFStringRef; external name '_kABAddressStateKey'; (* attribute const *)            // State
    var kABAddressZIPKey: CFStringRef; external name '_kABAddressZIPKey'; (* attribute const *)              // Zip
    var kABAddressCountryKey: CFStringRef; external name '_kABAddressCountryKey'; (* attribute const *)          // Country
    var kABAddressCountryCodeKey: CFStringRef; external name '_kABAddressCountryCodeKey'; (* attribute const *)      // Country Code
        var kABAddressHomeLabel: CFStringRef; external name '_kABAddressHomeLabel'; (* attribute const *)       // Home Address
        var kABAddressWorkLabel: CFStringRef; external name '_kABAddressWorkLabel'; (* attribute const *)       // Work Address

{
 * kABAddressCountryCodeKey code must be one of the following:
 * iso country codes
 *
 *    ar = Argentina
 *    at = Austria
 *    au = Australia
 *    ba = Bosnia and Herzegovina
 *    be = Belgium
 *    bg = Bulgaria
 *    bh = Bahrain
 *    br = Brazil
 *    ca = Canada
 *    ch = Switzerland
 *    cn = China
 *    cs = Czech
 *    de = Germany
 *    dk = Denmark
 *    eg = Egypt
 *    es = Spain
 *    fi = Finland
 *    fr = France
 *    gr = Greece
 *    gl = Greenland
 *    hk = Hong Kong
 *    hr = Croatia
 *    hu = Hungary
 *    ie = Ireland
 *    il = Israel
 *    id = Indonesia
 *    in = India
 *    is = Iceland
 *    it = Italy
 *    ja = Japan
 *    jo = Jordan
 *    kr = South Korea
 *    kw = Kuwait
 *    lb = Lebanon
 *    lu = Luxembourg
 *    mk = Macedonia
 *    mx = Mexico
 *    nl = Netherlands
 *    no = Norway
 *    nz = New Zealand
 *    om = Oman
 *    pl = Poland
 *    pt = Portugal
 *    qa = Qatar
 *    ro = Romania
 *    ru = Russian Federation
 *    sa = Saudi Arabia
 *    se = Sweden
 *    sg = Singapore
 *    si = Slovenia
 *    sk = Slovakia
 *    sy = Syrian Arab Republic
 *    tw = Taiwan
 *    tr = Turkey
 *    ua = Ukraine
 *    uk = United Kingdom
 *    us = United States
 *    ye = Yemen
 *    za = South Africa
 *
 }

// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
var kABOtherDatesProperty: CFStringRef; external name '_kABOtherDatesProperty'; (* attribute const *)         // Dates associated with this person - kABMultiDateProperty - (Person)
    // AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
    var kABAnniversaryLabel: CFStringRef; external name '_kABAnniversaryLabel'; (* attribute const *)

// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
var kABRelatedNamesProperty: CFStringRef; external name '_kABRelatedNamesProperty'; (* attribute const *)         // names - kABMultiStringProperty
    // AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
    var kABFatherLabel: CFStringRef; external name '_kABFatherLabel'; (* attribute const *)
    // AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
    var kABMotherLabel: CFStringRef; external name '_kABMotherLabel'; (* attribute const *)
    // AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
    var kABParentLabel: CFStringRef; external name '_kABParentLabel'; (* attribute const *)
    // AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
    var kABBrotherLabel: CFStringRef; external name '_kABBrotherLabel'; (* attribute const *)
    // AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
    var kABSisterLabel: CFStringRef; external name '_kABSisterLabel'; (* attribute const *)
    // AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
    var kABChildLabel: CFStringRef; external name '_kABChildLabel'; (* attribute const *)
    // AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
    var kABFriendLabel: CFStringRef; external name '_kABFriendLabel'; (* attribute const *)
    // AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
    var kABSpouseLabel: CFStringRef; external name '_kABSpouseLabel'; (* attribute const *)
    // AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
    var kABPartnerLabel: CFStringRef; external name '_kABPartnerLabel'; (* attribute const *)
    // AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
    var kABAssistantLabel: CFStringRef; external name '_kABAssistantLabel'; (* attribute const *)
    // AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
    var kABManagerLabel: CFStringRef; external name '_kABManagerLabel'; (* attribute const *)

// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
var kABDepartmentProperty: CFStringRef; external name '_kABDepartmentProperty'; (* attribute const *)         // Department name - kABStringProperty - (Person)

// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
var kABPersonFlags: CFStringRef; external name '_kABPersonFlags'; (* attribute const *)         // Various flags - kABIntegerProperty - (Person)

const
    kABShowAsMask = $00000007;
    kABShowAsPerson = $00000000;
    kABShowAsCompany = $00000001;

    kABNameOrderingMask = $00000038;
    kABDefaultNameOrdering = $00000000;
    kABFirstNameFirst = $00000020;
    kABLastNameFirst = $00000010;

var kABPhoneProperty: CFStringRef; external name '_kABPhoneProperty'; (* attribute const *)                   // Generic phone number - kABMultiStringProperty
        var kABPhoneWorkLabel: CFStringRef; external name '_kABPhoneWorkLabel'; (* attribute const *)          // Work phone
        var kABPhoneHomeLabel: CFStringRef; external name '_kABPhoneHomeLabel'; (* attribute const *)          // Home phone
        var kABPhoneMobileLabel: CFStringRef; external name '_kABPhoneMobileLabel'; (* attribute const *)        // Cell phone
        var kABPhoneMainLabel: CFStringRef; external name '_kABPhoneMainLabel'; (* attribute const *)          // Main phone
        var kABPhoneHomeFAXLabel: CFStringRef; external name '_kABPhoneHomeFAXLabel'; (* attribute const *)       // FAX number
        var kABPhoneWorkFAXLabel: CFStringRef; external name '_kABPhoneWorkFAXLabel'; (* attribute const *)       // FAX number
        var kABPhonePagerLabel: CFStringRef; external name '_kABPhonePagerLabel'; (* attribute const *)         // Pager number

var kABAIMInstantProperty: CFStringRef; external name '_kABAIMInstantProperty'; (* attribute const *)              // AIM Instant Messaging - kABMultiStringProperty
        var kABAIMWorkLabel: CFStringRef; external name '_kABAIMWorkLabel'; (* attribute const *)
        var kABAIMHomeLabel: CFStringRef; external name '_kABAIMHomeLabel'; (* attribute const *)

var kABJabberInstantProperty: CFStringRef; external name '_kABJabberInstantProperty'; (* attribute const *)           // Jabber Instant Messaging - kABMultiStringProperty
        var kABJabberWorkLabel: CFStringRef; external name '_kABJabberWorkLabel'; (* attribute const *)
        var kABJabberHomeLabel: CFStringRef; external name '_kABJabberHomeLabel'; (* attribute const *)

var kABMSNInstantProperty: CFStringRef; external name '_kABMSNInstantProperty'; (* attribute const *)              // MSN Instant Messaging - kABMultiStringProperty
        var kABMSNWorkLabel: CFStringRef; external name '_kABMSNWorkLabel'; (* attribute const *)
        var kABMSNHomeLabel: CFStringRef; external name '_kABMSNHomeLabel'; (* attribute const *)

var kABYahooInstantProperty: CFStringRef; external name '_kABYahooInstantProperty'; (* attribute const *)            // Yahoo Instant Messaging - kABMultiStringProperty
        var kABYahooWorkLabel: CFStringRef; external name '_kABYahooWorkLabel'; (* attribute const *)
        var kABYahooHomeLabel: CFStringRef; external name '_kABYahooHomeLabel'; (* attribute const *)

var kABICQInstantProperty: CFStringRef; external name '_kABICQInstantProperty'; (* attribute const *)              // ICQ Instant Messaging - kABMultiStringProperty
        var kABICQWorkLabel: CFStringRef; external name '_kABICQWorkLabel'; (* attribute const *)
        var kABICQHomeLabel: CFStringRef; external name '_kABICQHomeLabel'; (* attribute const *)

var kABNoteProperty: CFStringRef; external name '_kABNoteProperty'; (* attribute const *)                    // Note (string)

// ----- Person Properties not Currently supported in the AddressBook UI
var kABMiddleNameProperty: CFStringRef; external name '_kABMiddleNameProperty'; (* attribute const *)              // kABStringProperty
var kABMiddleNamePhoneticProperty: CFStringRef; external name '_kABMiddleNamePhoneticProperty'; (* attribute const *)      // kABStringProperty
var kABTitleProperty: CFStringRef; external name '_kABTitleProperty'; (* attribute const *)                   // kABStringProperty "Sir" "Duke" "General" "Lord"
var kABSuffixProperty: CFStringRef; external name '_kABSuffixProperty'; (* attribute const *)                  // kABStringProperty "Sr." "Jr." "III"

// ----- Group Specific Properties

var kABGroupNameProperty: CFStringRef; external name '_kABGroupNameProperty'; (* attribute const *)               // Name of the group - kABStringProperty

// ================================================================
//      Generic Labels
// ================================================================

    // All kABXXXXWorkLabel are equivalent to this label
var kABWorkLabel: CFStringRef; external name '_kABWorkLabel'; (* attribute const *)

    // All kABXXXXHomeLabel are equivalent to this label
var kABHomeLabel: CFStringRef; external name '_kABHomeLabel'; (* attribute const *)

    // Can be use with any Mutli-value property
var kABOtherLabel: CFStringRef; external name '_kABOtherLabel'; (* attribute const *)

// ================================================================
//      RecordTypes
// ================================================================

    // Type of a ABPersonRef
var kABPersonRecordType: CFStringRef; external name '_kABPersonRecordType'; (* attribute const *)

    // Type of a ABGroupRef
var kABGroupRecordType: CFStringRef; external name '_kABGroupRecordType'; (* attribute const *)

// ================================================================
//      Notifications published when something changes
// ================================================================
// These notifications are not sent until ABGetSharedAddressBook()
// has been called somewhere

    // This process has changed the DB
var kABDatabaseChangedNotification: CFStringRef; external name '_kABDatabaseChangedNotification'; (* attribute const *)

    // Another process has changed the DB
var kABDatabaseChangedExternallyNotification: CFStringRef; external name '_kABDatabaseChangedExternallyNotification'; (* attribute const *)

    // The user info in the above notifications will contain
    // the following 3 keys, the values of the keys in the dictionary
    // will be the uniqueIds of the Inserted/Updated/Deleted Records
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
var kABInsertedRecords: CFStringRef; external name '_kABInsertedRecords'; (* attribute const *)
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
var kABUpdatedRecords: CFStringRef; external name '_kABUpdatedRecords'; (* attribute const *)
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
var kABDeletedRecords: CFStringRef; external name '_kABDeletedRecords'; (* attribute const *)
{unit AXValue}
{$ALIGN MAC68K}





type AXValueType = UInt32;
const
    { Types from CoreGraphics.h }
    kAXValueCGPointType = 1;
    kAXValueCGSizeType = 2;
    kAXValueCGRectType = 3;

    { Types from CFBase.h }
    kAXValueCFRangeType = 4;

    { Other }
    kAXValueIllegalType = 0;

type AXValueRef = ^UInt32;

// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function AXValueGetTypeID: CFTypeID; external name '_AXValueGetTypeID';


function AXValueCreate( theType: AXValueType;  valuePtr: UnivPtr ): AXValueRef; external name '_AXValueCreate';
function AXValueGetType( value: AXValueRef ): AXValueType; external name '_AXValueGetType';

function AXValueGetValue( value: AXValueRef; theType: AXValueType;  valuePtr: UnivPtr ): Boolean; external name '_AXValueGetValue';
{unit AuthSession}
{$ALIGN MAC68K}






{!
    @header AuthSession

    The Session API provides specialized applications access to Session management and inquiry
    functions. This is a specialized API that should not be of interest to most people.

    The Security subsystem separates all processes into Security "sessions". Each process is in
    exactly one session, and session membership inherits across fork/exec. Sessions form boundaries
    for security-related state such as authorizations, keychain lock status, and the like.
    Typically, each successful login (whether graphical or through ssh & friends) creates
    a separate session. System daemons (started at system startup) belong to the "root session"
    which has no user nor graphics access.

    Sessions are identified with SecuritySessionIds. A session has a set of attributes
    that are set on creation and can be retrieved with SessionGetInfo().

    There are similar session concepts in the system, related but not necessarily
    completely congruous. In particular, graphics sessions track security sessions
    (but only for graphic logins).
}


{!
    @typedef SecuritySessionId
    These are externally visible identifiers for authorization sessions.
        Different sessions have different identifiers; beyond that, you can't
        tell anything from these values.
    SessionIds can be compared for equality as you'd expect, but you should be careful
        to use attribute bits wherever appropriate.
}
type
    SecuritySessionId = UInt32;
    SecuritySessionIdPtr = ^SecuritySessionId;


{!
    @enum SecuritySessionId
    Here are some special values for SecuritySessionId. You may specify those
        on input to SessionAPI functions. They will never be returned from such
        functions.
}
const
    noSecuritySession                      = 0;     { definitely not a valid SecuritySessionId }
    callerSecuritySession = -1;     { the Session I (the caller) am in }


{!
    @enum SessionAttributeBits
    Each Session has a set of attribute bits. You can get those from the
        SessionGetInfo API function.
 }
type
    SessionAttributeBits = UInt32;
    SessionAttributeBitsPtr = ^SessionAttributeBits;

const
    sessionIsRoot                          = $0001; { is the root session (startup/system programs) }
    sessionHasGraphicAccess                = $0010; { graphic subsystem (CoreGraphics et al) available }
    sessionHasTTY                          = $0020; { /dev/tty is available }
    sessionIsRemote                        = $1000; { session was established over the network }

    // the following bits are used internally; do not try to set them
    sessionWasInitialized                  = $8000;  { session has been set up by its leader }


{!
    @enum SessionCreationFlags
    These flags control how a new session is created by SessionCreate.
        They have no permanent meaning beyond that.
 }
type
    SessionCreationFlags = UInt32;
    SessionCreationFlagsPtr = ^SessionCreationFlags;

const
    sessionKeepCurrentBootstrap             = $8000; { caller has allocated sub-bootstrap (expert use only) }


{!
    @enum SessionStatus
    Error codes returned by AuthSession API.
    Note that the AuthSession APIs can also return Authorization API error codes.
}
const
    errSessionSuccess                       = 0;      { all is well }
    errSessionInvalidId                     = -60500; { invalid session id specified }
    errSessionInvalidAttributes             = -60501; { invalid set of requested attribute bits }
    errSessionAuthorizationDenied           = -60502; { you are not allowed to do this }

    errSessionInternal                      = errAuthorizationInternal; { internal error }
    errSessionInvalidFlags                  = errAuthorizationInvalidFlags; { invalid flags/options }


{!
    @function SessionGetInfo
    Obtain information about a session. You can ask about any session whose
    identifier you know. Use the callerSecuritySession constant to ask about
    your own session (the one your process is in).

    @param session (input) The Session you are asking about. Can be one of the
        special constants defined above.

    @param sessionId (output/optional) The actual SecuritySessionId for the session you asked about.
        Will never be one of those constants.

    @param attributes (output/optional) Receives the attribute bits for the session.

    @result An OSStatus indicating success (noErr) or an error cause.

    errSessionInvalidId -60500 Invalid session id specified

}
function SessionGetInfo( session: SecuritySessionId; sessionId: SecuritySessionIdPtr; attributes: SessionAttributeBitsPtr ): OSStatus; external name '_SessionGetInfo';


{!
    @function SessionCreate
    This (very specialized) function creates a security session.
    Upon completion, the new session contains the calling process (and none other).
    You cannot create a session for someone else, and cannot avoid being placed
    into the new session. This is (currently) the only call that changes a process's
    session membership.
    By default, a new bootstrap subset port is created for the calling process. The process
    acquires this new port as its bootstrap port, which all its children will inherit.
    If you happen to have created the subset port on your own, you can pass the
    sessionKeepCurrentBootstrap flag, and SessionCreate will use it. Note however that
    you cannot supersede a prior SessionCreate call that way; only a single SessionCreate
    call is allowed for each Session (however made).
    This call will discard any security information established for the calling process.
    In particular, any authorization handles acquired will become invalid, and so will any
    keychain related information. We recommend that you call SessionCreate before
    making any other security-related calls that establish rights of any kind, to the
    extent this is practical. Also, we strongly recommend that you do not perform
    security-related calls in any other threads while calling SessionCreate.

    @param flags Flags controlling how the session is created.

    @param attributes The set of attribute bits to set for the new session.
        Not all bits can be set this way.

    @result An OSStatus indicating success (noErr) or an error cause.

    errSessionInvalidAttributes -60501 Attempt to set invalid attribute bits
    errSessionAuthorizationDenied -60502 Attempt to re-initialize a session
    errSessionInvalidFlags -60011 Attempt to specify unsupported flag bits

}
function SessionCreate( flags: SessionCreationFlags; attributes: SessionAttributeBits ): OSStatus; external name '_SessionCreate';
{unit CFArray}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}


{
 *  CFArray
 *
 *  Discussion:
 *    CFArray implements an ordered, compact container of pointer-sized
 *    values. Values are accessed via SInt16 keys (indices), from the
 *    range 0 to N-1, where N is the number of values in the array when
 *    an operation is performed. The array is said to be "compact"
 *    because deleted or inserted values do not leave a gap in the key
 *    space -- the values with higher-numbered indices have their
 *    indices renumbered lower (or higher, in the case of insertion) so
 *    that the set of valid indices is always in the SInt16 range [0,
 *    N-1]. Thus, the index to access a particular value in the array
 *    may change over time as other values are inserted into or deleted
 *    from the array.
 *
 *    Arrays come in two flavors, immutable, which cannot have values
 *    added to them or removed from them after the array is created,
 *    and mutable, to which you can add values or from which remove
 *    values. Mutable arrays have two subflavors, fixed-capacity, for
 *    which there is a maximum number set at creation time of values
 *    which can be put into the array, and variable capacity, which can
 *    have an unlimited number of values (or rather, limited only by
 *    constraints external to CFArray, like the amount of available
 *    memory). Fixed-capacity arrays can be somewhat higher performing,
 *    if you can put a definate upper limit on the number of values
 *    that might be put into the array.
 *
 *    As with all CoreFoundation collection types, arrays maintain hard
 *    references on the values you put in them, but the retaining and
 *    releasing functions are user-defined callbacks that can actually
 *    do whatever the user wants (for example, nothing).
 *
 *    Computational Complexity The access time for a value in the array
 *    is guaranteed to be at worst O(lg N) for any implementation,
 *    current and future, but will often be O(1) (constant time).
 *    Linear search operations similarly have a worst case complexity
 *    of O(N*lg N), though typically the bounds will be tighter, and so
 *    on. Insertion or deletion operations will typically be linear in
 *    the number of values in the array, but may be O(N*lg N) clearly
 *    in the worst case in some implementations. There are no favored
 *    positions within the array for performance; that is, it is not
 *    necessarily faster access values with low indices, or to insert
 *    or delete values with high indices, or whatever.
 }

type
    CFArrayRetainCallBack = function(allocator: CFAllocatorRef; value: UnivPtr): Ptr;

    CFArrayReleaseCallBack = procedure(allocator: CFAllocatorRef; value: UnivPtr);

    CFArrayCopyDescriptionCallBack = function(value: UnivPtr): CFStringRef;

    CFArrayEqualCallBack = function(value1: UnivPtr; value2: UnivPtr): boolean;


    {
     *  CFArrayCallBacks
     *
     *  Discussion:
     *    Structure containing the callbacks of a CFArray.
        }
    CFArrayCallBacksPtr = ^CFArrayCallBacks;
    CFArrayCallBacks = record
        version:                CFIndex;
        retain:                 CFArrayRetainCallBack;
        release:                CFArrayReleaseCallBack;
        copyDescription:        CFArrayCopyDescriptionCallBack;
        equal:                  CFArrayEqualCallBack;
    end;

var kCFTypeArrayCallBacks: CFArrayCallBacks; external name '_kCFTypeArrayCallBacks'; (* attribute const *)
    {
     *  kCFTypeArrayCallBacks
     *
     *  Discussion:
     *    Predefined CFArrayCallBacks structure containing a set of
     *    callbacks appropriate for use when the values in a CFArray are
     *    all CFTypes.
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }

    {
     *  CFArrayApplierFunction
     *
     *  Discussion:
     *    Type of the callback function used by the apply functions of
     *    CFArrays.
     *
     *  Parameters:
     *
     *    value:
     *      The current value from the array.
     *
     *    context:
     *      The user-defined context parameter given to the apply function.
        }
type
    CFArrayApplierFunction = procedure(value: UnivPtr; context: UnivPtr);


    {
     *  CFArrayRef
     *
     *  Discussion:
     *    This is the type of a reference to immutable CFArrays.
        }
    CFArrayRef    = ^SInt32; { an opaque 32-bit type }
    CFArrayRefPtr = ^CFArrayRef;  { when a var xx:CFArrayRef parameter can be nil, it is changed to xx: CFArrayRefPtr }

    {
     *  CFMutableArrayRef
     *
     *  Discussion:
     *    This is the type of a reference to mutable CFArrays.
        }
    CFMutableArrayRef    = CFArrayRef;
    CFMutableArrayRefPtr = ^CFMutableArrayRef;  { when a var xx:CFMutableArrayRef parameter can be nil, it is changed to xx: CFMutableArrayRefPtr }
    {
     *  CFArrayGetTypeID()
     *
     *  Discussion:
     *    Returns the type identifier of all CFArray instances.
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function CFArrayGetTypeID: CFTypeID; external name '_CFArrayGetTypeID';

{
 *  CFArrayCreate()
 *
 *  Discussion:
 *    Creates a new immutable array with the given values.
 *
 *  Parameters:
 *
 *    allocator:
 *      The CFAllocator which should be used to allocate memory for the
 *      array and its storage for values. This parameter may be NULL in
 *      which case the current default CFAllocator is used. If this
 *      reference is not a valid CFAllocator, the behavior is undefined.
 *
 *    values:
 *      A C array of the pointer-sized values to be in the array. The
 *      values in the array are ordered in the same order in which they
 *      appear in this C array. This parameter may be NULL if the
 *      numValues parameter is 0. This C array is not changed or freed
 *      by this function. If this parameter is not a valid pointer to a
 *      C array of at least numValues pointers, the behavior is
 *      undefined.
 *
 *    numValues:
 *      The number of values to copy from the values C array into the
 *      CFArray. This number will be the count of the array. If this
 *      parameter is negative, or greater than the number of values
 *      actually in the values C array, the behavior is undefined.
 *
 *    callBacks:
 *      A pointer to a CFArrayCallBacks structure initialized with the
 *      callbacks for the array to use on each value in the array. The
 *      retain callback will be used within this function, for example,
 *      to retain all of the new values from the values C array. A copy
 *      of the contents of the callbacks structure is made, so that a
 *      pointer to a structure on the stack can be passed in, or can be
 *      reused for multiple array creations. If the version field of
 *      this callbacks structure is not one of the defined ones for
 *      CFArray, the behavior is undefined. The retain field may be
 *      NULL, in which case the CFArray will do nothing to add a retain
 *      to the contained values for the array. The release field may be
 *      NULL, in which case the CFArray will do nothing to remove the
 *      array's retain (if any) on the values when the array is
 *      destroyed. If the copyDescription field is NULL, the array will
 *      create a simple description for the value. If the equal field
 *      is NULL, the array will use pointer equality to test for
 *      equality of values. This callbacks parameter itself may be
 *      NULL, which is treated as if a valid structure of version 0
 *      with all fields NULL had been passed in. Otherwise, if any of
 *      the fields are not valid pointers to functions of the correct
 *      type, or this parameter is not a valid pointer to a
 *      CFArrayCallBacks callbacks structure, the behavior is
 *      undefined. If any of the values put into the array is not one
 *      understood by one of the callback functions the behavior when
 *      that callback function is used is undefined.
 *
 *  Result:
 *    A reference to the new immutable CFArray.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFArrayCreate(allocator: CFAllocatorRef; values: Ptr; numValues: CFIndex; const (*var*) callBacks: CFArrayCallBacks): CFArrayRef; external name '_CFArrayCreate';

{
 *  CFArrayCreateCopy()
 *
 *  Discussion:
 *    Creates a new immutable array with the values from the given
 *    array.
 *
 *  Parameters:
 *
 *    allocator:
 *      The CFAllocator which should be used to allocate memory for the
 *      array and its storage for values. This parameter may be NULL in
 *      which case the current default CFAllocator is used. If this
 *      reference is not a valid CFAllocator, the behavior is undefined.
 *
 *    theArray:
 *      The array which is to be copied. The values from the array are
 *      copied as pointers into the new array (that is, the values
 *      themselves are copied, not that which the values point to, if
 *      anything). However, the values are also retained by the new
 *      array. The count of the new array will be the same as the given
 *      array. The new array uses the same callbacks as the array to be
 *      copied. If this parameter is not a valid CFArray, the behavior
 *      is undefined.
 *
 *  Result:
 *    A reference to the new immutable CFArray.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFArrayCreateCopy(allocator: CFAllocatorRef; theArray: CFArrayRef): CFArrayRef; external name '_CFArrayCreateCopy';

{
 *  CFArrayCreateMutable()
 *
 *  Discussion:
 *    Creates a new empty mutable array.
 *
 *  Parameters:
 *
 *    allocator:
 *      The CFAllocator which should be used to allocate memory for the
 *      array and its storage for values. This parameter may be NULL in
 *      which case the current default CFAllocator is used. If this
 *      reference is not a valid CFAllocator, the behavior is undefined.
 *
 *    capacity:
 *      The maximum number of values that can be contained by the
 *      CFArray. The array starts empty, and can grow to this number of
 *      values (and it can have less). If this parameter is 0, the
 *      array's maximum capacity is unlimited (or rather, only limited
 *      by address space and available memory constraints). If this
 *      parameter is negative, the behavior is undefined.
 *
 *    callBacks:
 *      A pointer to a CFArrayCallBacks structure initialized with the
 *      callbacks for the array to use on each value in the array. A
 *      copy of the contents of the callbacks structure is made, so
 *      that a pointer to a structure on the stack can be passed in, or
 *      can be reused for multiple array creations. If the version
 *      field of this callbacks structure is not one of the defined
 *      ones for CFArray, the behavior is undefined. The retain field
 *      may be NULL, in which case the CFArray will do nothing to add a
 *      retain to the contained values for the array. The release field
 *      may be NULL, in which case the CFArray will do nothing to
 *      remove the arrays retain (if any) on the values when the array
 *      is destroyed. If the copyDescription field is NULL, the array
 *      will create a simple description for the value. If the equal
 *      field is NULL, the array will use pointer equality to test for
 *      equality of values. This callbacks parameter itself may be
 *      NULL, which is treated as if a valid structure of version 0
 *      with all fields NULL had been passed in. Otherwise, if any of
 *      the fields are not valid pointers to functions of the correct
 *      type, or this parameter is not a valid pointer to a
 *      CFArrayCallBacks callbacks structure, the behavior is
 *      undefined. If any of the values put into the array is not one
 *      understood by one of the callback functions the behavior when
 *      that callback function is used is undefined.
 *
 *  Result:
 *    A reference to the new mutable CFArray.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFArrayCreateMutable(allocator: CFAllocatorRef; capacity: CFIndex; const (*var*) callBacks: CFArrayCallBacks): CFMutableArrayRef; external name '_CFArrayCreateMutable';

{
 *  CFArrayCreateMutableCopy()
 *
 *  Discussion:
 *    Creates a new mutable array with the values from the given array.
 *
 *  Parameters:
 *
 *    allocator:
 *      The CFAllocator which should be used to allocate memory for the
 *      array and its storage for values. This parameter may be NULL in
 *      which case the current default CFAllocator is used. If this
 *      reference is not a valid CFAllocator, the behavior is undefined.
 *
 *    capacity:
 *      The maximum number of values that can be contained by the
 *      CFArray. The array starts empty, and can grow to this number of
 *      values (and it can have less). If this parameter is 0, the
 *      array's maximum capacity is unlimited (or rather, only limited
 *      by address space and available memory constraints). This
 *      parameter must be greater than or equal to the count of the
 *      array which is to be copied, or the behavior is undefined. If
 *      this parameter is negative, the behavior is undefined.
 *
 *    theArray:
 *      The array which is to be copied. The values from the array are
 *      copied as pointers into the new array (that is, the values
 *      themselves are copied, not that which the values point to, if
 *      anything). However, the values are also retained by the new
 *      array. The count of the new array will be the same as the given
 *      array. The new array uses the same callbacks as the array to be
 *      copied. If this parameter is not a valid CFArray, the behavior
 *      is undefined.
 *
 *  Result:
 *    A reference to the new mutable CFArray.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFArrayCreateMutableCopy(allocator: CFAllocatorRef; capacity: CFIndex; theArray: CFArrayRef): CFMutableArrayRef; external name '_CFArrayCreateMutableCopy';

{
 *  CFArrayGetCount()
 *
 *  Discussion:
 *    Returns the number of values currently in the array.
 *
 *  Parameters:
 *
 *    theArray:
 *      The array to be queried. If this parameter is not a valid
 *      CFArray, the behavior is undefined.
 *
 *  Result:
 *    The number of values in the array.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFArrayGetCount(theArray: CFArrayRef): CFIndex; external name '_CFArrayGetCount';

{
 *  CFArrayGetCountOfValue()
 *
 *  Discussion:
 *    Counts the number of times the given value occurs in the array.
 *
 *  Parameters:
 *
 *    theArray:
 *      The array to be searched. If this parameter is not a valid
 *      CFArray, the behavior is undefined.
 *
 *    range:
 *      The range within the array to search. If the range location or
 *      end point (defined by the location plus length minus 1) are
 *      outside the index space of the array (0 to N-1 inclusive, where
 *      N is the count of the array), the behavior is undefined. If the
 *      range length is negative, the behavior is undefined. The range
 *      may be empty (length 0).
 *
 *    value:
 *      The value for which to find matches in the array. The equal()
 *      callback provided when the array was created is used to
 *      compare. If the equal() callback was NULL, pointer equality (in
 *      C, ==) is used. If value, or any of the values in the array,
 *      are not understood by the equal() callback, the behavior is
 *      undefined.
 *
 *  Result:
 *    The number of times the given value occurs in the array, within
 *    the specified range.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFArrayGetCountOfValue(theArray: CFArrayRef; range: CFRange; value: UnivPtr): CFIndex; external name '_CFArrayGetCountOfValue';

{
 *  CFArrayContainsValue()
 *
 *  Discussion:
 *    Reports whether or not the value is in the array.
 *
 *  Parameters:
 *
 *    theArray:
 *      The array to be searched. If this parameter is not a valid
 *      CFArray, the behavior is undefined.
 *
 *    range:
 *      The range within the array to search. If the range location or
 *      end point (defined by the location plus length minus 1) are
 *      outside the index space of the array (0 to N-1 inclusive, where
 *      N is the count of the array), the behavior is undefined. If the
 *      range length is negative, the behavior is undefined. The range
 *      may be empty (length 0).
 *
 *    value:
 *      The value for which to find matches in the array. The equal()
 *      callback provided when the array was created is used to
 *      compare. If the equal() callback was NULL, pointer equality (in
 *      C, ==) is used. If value, or any of the values in the array,
 *      are not understood by the equal() callback, the behavior is
 *      undefined.
 *
 *  Result:
 *    TRUE, if the value is in the specified range of the array,
 *    otherwise FALSE.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFArrayContainsValue(theArray: CFArrayRef; range: CFRange; value: UnivPtr): boolean; external name '_CFArrayContainsValue';

{
 *  CFArrayGetValueAtIndex()
 *
 *  Discussion:
 *    Retrieves the value at the given index.
 *
 *  Parameters:
 *
 *    theArray:
 *      The array to be queried. If this parameter is not a valid
 *      CFArray, the behavior is undefined.
 *
 *    idx:
 *      The index of the value to retrieve. If the index is outside the
 *      index space of the array (0 to N-1 inclusive, where N is the
 *      count of the array), the behavior is undefined.
 *
 *  Result:
 *    The value with the given index in the array.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFArrayGetValueAtIndex(theArray: CFArrayRef; idx: CFIndex): Ptr; external name '_CFArrayGetValueAtIndex';

{
 *  CFArrayGetValues()
 *
 *  Discussion:
 *    Fills the buffer with values from the array.
 *
 *  Parameters:
 *
 *    theArray:
 *      The array to be queried. If this parameter is not a valid
 *      CFArray, the behavior is undefined.
 *
 *    range:
 *      The range of values within the array to retrieve. If the range
 *      location or end point (defined by the location plus length
 *      minus 1) are outside the index space of the array (0 to N-1
 *      inclusive, where N is the count of the array), the behavior is
 *      undefined. If the range length is negative, the behavior is
 *      undefined. The range may be empty (length 0), in which case no
 *      values are put into the buffer.
 *
 *    values:
 *      A C array of pointer-sized values to be filled with values from
 *      the array. The values in the C array are ordered in the same
 *      order in which they appear in the array. If this parameter is
 *      not a valid pointer to a C array of at least range.length
 *      pointers, the behavior is undefined.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CFArrayGetValues(theArray: CFArrayRef; range: CFRange; var values: UnivPtr); external name '_CFArrayGetValues';

{
 *  CFArrayApplyFunction()
 *
 *  Discussion:
 *    Calls a function once for each value in the array.
 *
 *  Parameters:
 *
 *    theArray:
 *      The array to be operated upon. If this parameter is not a valid
 *      CFArray, the behavior is undefined.
 *
 *    range:
 *      The range of values within the array to which to apply the
 *      function. If the range location or end point (defined by the
 *      location plus length minus 1) are outside the index space of
 *      the array (0 to N-1 inclusive, where N is the count of the
 *      array), the behavior is undefined. If the range length is
 *      negative, the behavior is undefined. The range may be empty
 *      (length 0).
 *
 *    applier:
 *      The callback function to call once for each value in the given
 *      range in the array. If this parameter is not a pointer to a
 *      function of the correct prototype, the behavior is undefined.
 *      If there are values in the range which the applier function
 *      does not expect or cannot properly apply to, the behavior is
 *      undefined.
 *
 *    context:
 *      A pointer-sized user-defined value, which is passed as the
 *      second parameter to the applier function, but is otherwise
 *      unused by this function. If the context is not what is expected
 *      by the applier function, the behavior is undefined.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CFArrayApplyFunction(theArray: CFArrayRef; range: CFRange; applier: CFArrayApplierFunction; context: UnivPtr); external name '_CFArrayApplyFunction';

{
 *  CFArrayGetFirstIndexOfValue()
 *
 *  Discussion:
 *    Searches the array for the value.
 *
 *  Parameters:
 *
 *    theArray:
 *      The array to be searched. If this parameter is not a valid
 *      CFArray, the behavior is undefined.
 *
 *    range:
 *      The range within the array to search. If the range location or
 *      end point (defined by the location plus length minus 1) are
 *      outside the index space of the array (0 to N-1 inclusive, where
 *      N is the count of the array), the behavior is undefined. If the
 *      range length is negative, the behavior is undefined. The range
 *      may be empty (length 0). The search progresses from the
 *      smallest index defined by the range to the largest.
 *
 *    value:
 *      The value for which to find a match in the array. The equal()
 *      callback provided when the array was created is used to
 *      compare. If the equal() callback was NULL, pointer equality (in
 *      C, ==) is used. If value, or any of the values in the array,
 *      are not understood by the equal() callback, the behavior is
 *      undefined.
 *
 *  Result:
 *    The lowest index of the matching values in the range, or -1 if no
 *    value in the range matched.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFArrayGetFirstIndexOfValue(theArray: CFArrayRef; range: CFRange; value: UnivPtr): CFIndex; external name '_CFArrayGetFirstIndexOfValue';

{
 *  CFArrayGetLastIndexOfValue()
 *
 *  Discussion:
 *    Searches the array for the value.
 *
 *  Parameters:
 *
 *    theArray:
 *      The array to be searched. If this parameter is not a valid
 *      CFArray, the behavior is undefined.
 *
 *    range:
 *      The range within the array to search. If the range location or
 *      end point (defined by the location plus length minus 1) are
 *      outside the index space of the array (0 to N-1 inclusive, where
 *      N is the count of the array), the behavior is undefined. If the
 *      range length is negative, the behavior is undefined. The range
 *      may be empty (length 0). The search progresses from the largest
 *      index defined by the range to the smallest.
 *
 *    value:
 *      The value for which to find a match in the array. The equal()
 *      callback provided when the array was created is used to
 *      compare. If the equal() callback was NULL, pointer equality (in
 *      C, ==) is used. If value, or any of the values in the array,
 *      are not understood by the equal() callback, the behavior is
 *      undefined.
 *
 *  Result:
 *    The highest index of the matching values in the range, or -1 if
 *    no value in the range matched.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFArrayGetLastIndexOfValue(theArray: CFArrayRef; range: CFRange; value: UnivPtr): CFIndex; external name '_CFArrayGetLastIndexOfValue';

{
 *  CFArrayBSearchValues()
 *
 *  Discussion:
 *    Searches the array for the value using a binary search algorithm.
 *
 *  Parameters:
 *
 *    theArray:
 *      The array to be searched. If this parameter is not a valid
 *      CFArray, the behavior is undefined. If the array is not sorted
 *      from least to greatest according to the comparator function,
 *      the behavior is undefined.
 *
 *    range:
 *      The range within the array to search. If the range location or
 *      end point (defined by the location plus length minus 1) are
 *      outside the index space of the array (0 to N-1 inclusive, where
 *      N is the count of the array), the behavior is undefined. If the
 *      range length is negative, the behavior is undefined. The range
 *      may be empty (length 0).
 *
 *    value:
 *      The value for which to find a match in the array. If value, or
 *      any of the values in the array, are not understood by the
 *      comparator callback, the behavior is undefined.
 *
 *    comparator:
 *      The function with the comparator function type signature which
 *      is used in the binary search operation to compare values in the
 *      array with the given value. If this parameter is not a pointer
 *      to a function of the correct prototype, the behavior is
 *      undefined. If there are values in the range which the
 *      comparator function does not expect or cannot properly compare,
 *      the behavior is undefined.
 *
 *    context:
 *      A pointer-sized user-defined value, which is passed as the
 *      third parameter to the comparator function, but is otherwise
 *      unused by this function. If the context is not what is expected
 *      by the comparator function, the behavior is undefined.
 *
 *  Result:
 *    The return value is either 1) the index of a value that matched,
 *    if the target value matches one or more in the range, 2) greater
 *    than or equal to the end point of the range, if the value is
 *    greater than all the values in the range, or 3) the index of the
 *    value greater than the target value, if the value lies between
 *    two of (or less than all of) the values in the range.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFArrayBSearchValues(theArray: CFArrayRef; range: CFRange; value: UnivPtr; comparator: CFComparatorFunction; context: UnivPtr): CFIndex; external name '_CFArrayBSearchValues';

{
 *  CFArrayAppendValue()
 *
 *  Discussion:
 *    Adds the value to the array giving it the new largest index.
 *
 *  Parameters:
 *
 *    theArray:
 *      The array to which the value is to be added. If this parameter
 *      is not a valid mutable CFArray, the behavior is undefined. If
 *      the array is a fixed-capacity array and it is full before this
 *      operation, the behavior is undefined.
 *
 *    value:
 *      The value to add to the array. The value is retained by the
 *      array using the retain callback provided when the array was
 *      created. If the value is not of the sort expected by the retain
 *      callback, the behavior is undefined. The value is assigned to
 *      the index one larger than the previous largest index, and the
 *      count of the array is increased by one.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CFArrayAppendValue(theArray: CFMutableArrayRef; value: UnivPtr); external name '_CFArrayAppendValue';

{
 *  CFArrayInsertValueAtIndex()
 *
 *  Discussion:
 *    Adds the value to the array giving it the given index.
 *
 *  Parameters:
 *
 *    theArray:
 *      The array to which the value is to be added. If this parameter
 *      is not a valid mutable CFArray, the behavior is undefined. If
 *      the array is a fixed-capacity array and it is full before this
 *      operation, the behavior is undefined.
 *
 *    idx:
 *      The index to which to add the new value. If the index is
 *      outside the index space of the array (0 to N inclusive, where N
 *      is the count of the array before the operation), the behavior
 *      is undefined. If the index is the same as N, this function has
 *      the same effect as CFArrayAppendValue().
 *
 *    value:
 *      The value to add to the array. The value is retained by the
 *      array using the retain callback provided when the array was
 *      created. If the value is not of the sort expected by the retain
 *      callback, the behavior is undefined. The value is assigned to
 *      the given index, and all values with equal and larger indices
 *      have their indexes increased by one.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CFArrayInsertValueAtIndex(theArray: CFMutableArrayRef; idx: CFIndex; value: UnivPtr); external name '_CFArrayInsertValueAtIndex';

{
 *  CFArraySetValueAtIndex()
 *
 *  Discussion:
 *    Changes the value with the given index in the array.
 *
 *  Parameters:
 *
 *    theArray:
 *      The array in which the value is to be changed. If this
 *      parameter is not a valid mutable CFArray, the behavior is
 *      undefined. If the array is a fixed-capacity array and it is
 *      full before this operation and the index is the same as N, the
 *      behavior is undefined.
 *
 *    idx:
 *      The index to which to set the new value. If the index is
 *      outside the index space of the array (0 to N inclusive, where N
 *      is the count of the array before the operation), the behavior
 *      is undefined. If the index is the same as N, this function has
 *      the same effect as CFArrayAppendValue().
 *
 *    value:
 *      The value to set in the array. The value is retained by the
 *      array using the retain callback provided when the array was
 *      created, and the previous value with that index is released. If
 *      the value is not of the sort expected by the retain callback,
 *      the behavior is undefined. The indices of other values is not
 *      affected.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CFArraySetValueAtIndex(theArray: CFMutableArrayRef; idx: CFIndex; value: UnivPtr); external name '_CFArraySetValueAtIndex';

{
 *  CFArrayRemoveValueAtIndex()
 *
 *  Discussion:
 *    Removes the value with the given index from the array.
 *
 *  Parameters:
 *
 *    theArray:
 *      The array from which the value is to be removed. If this
 *      parameter is not a valid mutable CFArray, the behavior is
 *      undefined.
 *
 *    idx:
 *      The index from which to remove the value. If the index is
 *      outside the index space of the array (0 to N-1 inclusive, where
 *      N is the count of the array before the operation), the behavior
 *      is undefined.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CFArrayRemoveValueAtIndex(theArray: CFMutableArrayRef; idx: CFIndex); external name '_CFArrayRemoveValueAtIndex';

{
 *  CFArrayRemoveAllValues()
 *
 *  Discussion:
 *    Removes all the values from the array, making it empty.
 *
 *  Parameters:
 *
 *    theArray:
 *      The array from which all of the values are to be removed. If
 *      this parameter is not a valid mutable CFArray, the behavior is
 *      undefined.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CFArrayRemoveAllValues(theArray: CFMutableArrayRef); external name '_CFArrayRemoveAllValues';

{
 *  CFArrayReplaceValues()
 *
 *  Discussion:
 *    Replaces a range of values in the array.
 *
 *  Parameters:
 *
 *    theArray:
 *      The array from which all of the values are to be removed. If
 *      this parameter is not a valid mutable CFArray, the behavior is
 *      undefined.
 *
 *    range:
 *      The range of values within the array to replace. If the range
 *      location or end point (defined by the location plus length
 *      minus 1) are outside the index space of the array (0 to N
 *      inclusive, where N is the count of the array), the behavior is
 *      undefined. If the range length is negative, the behavior is
 *      undefined. The range may be empty (length 0), in which case the
 *      new values are merely inserted at the range location.
 *
 *    newValues:
 *      A C array of the pointer-sized values to be placed into the
 *      array. The new values in the array are ordered in the same
 *      order in which they appear in this C array. This parameter may
 *      be NULL if the newCount parameter is 0. This C array is not
 *      changed or freed by this function. If this parameter is not a
 *      valid pointer to a C array of at least newCount pointers, the
 *      behavior is undefined.
 *
 *    newCount:
 *      The number of values to copy from the values C array into the
 *      CFArray. If this parameter is different than the range length,
 *      the excess newCount values will be inserted after the range, or
 *      the excess range values will be deleted. This parameter may be
 *      0, in which case no new values are replaced into the array and
 *      the values in the range are simply removed. If this parameter
 *      is negative, or greater than the number of values actually in
 *      the newValues C array, the behavior is undefined.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CFArrayReplaceValues(theArray: CFMutableArrayRef; range: CFRange; var newValues: UnivPtr; newCount: CFIndex); external name '_CFArrayReplaceValues';

{
 *  CFArrayExchangeValuesAtIndices()
 *
 *  Discussion:
 *    Exchanges the values at two indices of the array.
 *
 *  Parameters:
 *
 *    theArray:
 *      The array of which the values are to be swapped. If this
 *      parameter is not a valid mutable CFArray, the behavior is
 *      undefined.
 *
 *    idx1:
 *      The first index whose values should be swapped. If the index is
 *      outside the index space of the array (0 to N-1 inclusive, where
 *      N is the count of the array before the operation), the behavior
 *      is undefined.
 *
 *    idx2:
 *      The second index whose values should be swapped. If the index
 *      is outside the index space of the array (0 to N-1 inclusive,
 *      where N is the count of the array before the operation), the
 *      behavior is undefined.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CFArrayExchangeValuesAtIndices(theArray: CFMutableArrayRef; idx1: CFIndex; idx2: CFIndex); external name '_CFArrayExchangeValuesAtIndices';

{
 *  CFArraySortValues()
 *
 *  Discussion:
 *    Sorts the values in the array using the given comparison function.
 *
 *  Parameters:
 *
 *    theArray:
 *      The array whose values are to be sorted. If this parameter is
 *      not a valid mutable CFArray, the behavior is undefined.
 *
 *    range:
 *      The range of values within the array to sort. If the range
 *      location or end point (defined by the location plus length
 *      minus 1) are outside the index space of the array (0 to N-1
 *      inclusive, where N is the count of the array), the behavior is
 *      undefined. If the range length is negative, the behavior is
 *      undefined. The range may be empty (length 0).
 *
 *    comparator:
 *      The function with the comparator function type signature which
 *      is used in the sort operation to compare values in the array
 *      with the given value. If this parameter is not a pointer to a
 *      function of the correct prototype, the the behavior is
 *      undefined. If there are values in the array which the
 *      comparator function does not expect or cannot properly compare,
 *      the behavior is undefined. The values in the range are sorted
 *      from least to greatest according to this function.
 *
 *    context:
 *      A pointer-sized user-defined value, which is passed as the
 *      third parameter to the comparator function, but is otherwise
 *      unused by this function. If the context is not what is expected
 *      by the comparator function, the behavior is undefined.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CFArraySortValues(theArray: CFMutableArrayRef; range: CFRange; comparator: CFComparatorFunction; context: UnivPtr); external name '_CFArraySortValues';

{
 *  CFArrayAppendArray()
 *
 *  Discussion:
 *    Adds the values from an array to another array.
 *
 *  Parameters:
 *
 *    theArray:
 *      The array to which values from the otherArray are to be added.
 *      If this parameter is not a valid mutable CFArray, the behavior
 *      is undefined. If the array is a fixed-capacity array and adding
 *      range.length values from the otherArray exceeds the capacity of
 *      the array, the behavior is undefined.
 *
 *    otherArray:
 *      The array providing the values to be added to the array. If
 *      this parameter is not a valid CFArray, the behavior is
 *      undefined.
 *
 *    otherRange:
 *      The range within the otherArray from which to add the values to
 *      the array. If the range location or end point (defined by the
 *      location plus length minus 1) are outside the index space of
 *      the otherArray (0 to N-1 inclusive, where N is the count of the
 *      otherArray), the behavior is undefined. The new values are
 *      retained by the array using the retain callback provided when
 *      the array was created. If the values are not of the sort
 *      expected by the retain callback, the behavior is undefined. The
 *      values are assigned to the indices one larger than the previous
 *      largest index in the array, and beyond, and the count of the
 *      array is increased by range.length. The values are assigned new
 *      indices in the array from smallest to largest index in the
 *      order in which they appear in the otherArray.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CFArrayAppendArray(theArray: CFMutableArrayRef; otherArray: CFArrayRef; otherRange: CFRange); external name '_CFArrayAppendArray';

{$ALIGN MAC68K}
{#POP}
{unit CFBag}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}


type
    CFBagRetainCallBack = function(allocator: CFAllocatorRef; value: UnivPtr): Ptr;

    CFBagReleaseCallBack = procedure(allocator: CFAllocatorRef; value: UnivPtr);

    CFBagCopyDescriptionCallBack = function(value: UnivPtr): CFStringRef;

    CFBagEqualCallBack = function(value1: UnivPtr; value2: UnivPtr): boolean;

    CFBagHashCallBack = function(value: UnivPtr): CFHashCode;

    CFBagCallBacksPtr = ^CFBagCallBacks;
    CFBagCallBacks = record
        version:                CFIndex;
        retain:                 CFBagRetainCallBack;
        release:                CFBagReleaseCallBack;
        copyDescription:        CFBagCopyDescriptionCallBack;
        equal:                  CFBagEqualCallBack;
        hash:                   CFBagHashCallBack;
    end;

var kCFTypeBagCallBacks: CFBagCallBacks; external name '_kCFTypeBagCallBacks'; (* attribute const *)
    {
     *  kCFTypeBagCallBacks
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
var kCFCopyStringBagCallBacks: CFBagCallBacks; external name '_kCFCopyStringBagCallBacks'; (* attribute const *)
    {
     *  kCFCopyStringBagCallBacks
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
type
    CFBagApplierFunction = procedure(value: UnivPtr; context: UnivPtr);

    CFBagRef    = ^SInt32; { an opaque 32-bit type }
    CFBagRefPtr = ^CFBagRef;  { when a var xx:CFBagRef parameter can be nil, it is changed to xx: CFBagRefPtr }
    CFMutableBagRef    = CFBagRef;
    CFMutableBagRefPtr = ^CFMutableBagRef;  { when a var xx:CFMutableBagRef parameter can be nil, it is changed to xx: CFMutableBagRefPtr }
    {
     *  CFBagGetTypeID()
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function CFBagGetTypeID: CFTypeID; external name '_CFBagGetTypeID';

{
 *  CFBagCreate()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFBagCreate(allocator: CFAllocatorRef; var values: UnivPtr; numValues: CFIndex; const (*var*) callBacks: CFBagCallBacks): CFBagRef; external name '_CFBagCreate';

{
 *  CFBagCreateCopy()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFBagCreateCopy(allocator: CFAllocatorRef; theBag: CFBagRef): CFBagRef; external name '_CFBagCreateCopy';

{
 *  CFBagCreateMutable()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFBagCreateMutable(allocator: CFAllocatorRef; capacity: CFIndex; const (*var*) callBacks: CFBagCallBacks): CFMutableBagRef; external name '_CFBagCreateMutable';

{
 *  CFBagCreateMutableCopy()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFBagCreateMutableCopy(allocator: CFAllocatorRef; capacity: CFIndex; theBag: CFBagRef): CFMutableBagRef; external name '_CFBagCreateMutableCopy';

{
 *  CFBagGetCount()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFBagGetCount(theBag: CFBagRef): CFIndex; external name '_CFBagGetCount';

{
 *  CFBagGetCountOfValue()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFBagGetCountOfValue(theBag: CFBagRef; value: UnivPtr): CFIndex; external name '_CFBagGetCountOfValue';

{
 *  CFBagContainsValue()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFBagContainsValue(theBag: CFBagRef; value: UnivPtr): boolean; external name '_CFBagContainsValue';

{
 *  CFBagGetValue()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFBagGetValue(theBag: CFBagRef; value: UnivPtr): Ptr; external name '_CFBagGetValue';

{
 *  CFBagGetValueIfPresent()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFBagGetValueIfPresent(theBag: CFBagRef; candidate: UnivPtr; var value: UnivPtr): boolean; external name '_CFBagGetValueIfPresent';

{
 *  CFBagGetValues()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CFBagGetValues(theBag: CFBagRef; var values: UnivPtr); external name '_CFBagGetValues';

{
 *  CFBagApplyFunction()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CFBagApplyFunction(theBag: CFBagRef; applier: CFBagApplierFunction; context: UnivPtr); external name '_CFBagApplyFunction';

{
 *  CFBagAddValue()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CFBagAddValue(theBag: CFMutableBagRef; value: UnivPtr); external name '_CFBagAddValue';

{
 *  CFBagReplaceValue()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CFBagReplaceValue(theBag: CFMutableBagRef; value: UnivPtr); external name '_CFBagReplaceValue';

{
 *  CFBagSetValue()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CFBagSetValue(theBag: CFMutableBagRef; value: UnivPtr); external name '_CFBagSetValue';

{
 *  CFBagRemoveValue()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CFBagRemoveValue(theBag: CFMutableBagRef; value: UnivPtr); external name '_CFBagRemoveValue';

{
 *  CFBagRemoveAllValues()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CFBagRemoveAllValues(theBag: CFMutableBagRef); external name '_CFBagRemoveAllValues';

{$ALIGN MAC68K}
{#POP}
{unit CFDateFormatter}
{$ALIGN MAC68K}






// #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3

type
    CFDateFormatterRef    = ^SInt32; { an opaque 32-bit type }

// CFDateFormatters are not thread-safe.  Do not use one from multiple threads!

// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function CFDateFormatterGetTypeID: CFTypeID; external name '_CFDateFormatterGetTypeID';

// date and time format styles
type
    CFDateFormatterStyle = SInt32;
const
    kCFDateFormatterNoStyle = 0;
    kCFDateFormatterShortStyle = 1;
    kCFDateFormatterMediumStyle = 2;
    kCFDateFormatterLongStyle = 3;
    kCFDateFormatterFullStyle = 4;

// The exact formatted result for these date and time styles depends on the
// locale, but generally:
//     Short is completely numeric, such as "12/13/52" or "3:30pm"
//     Medium is longer, such as "Jan 12, 1952"
//     Long is longer, such as "January 12, 1952" or "3:30:32pm"
//     Full is pretty complete; e.g. "Tuesday, April 12, 1952 AD" or "3:30:42pm PST"
// The specifications though are left fuzzy, in part simply because a user's
// preference choices may affect the output, and also the results may change
// from one OS release to another.  To produce an exactly formatted date you
// should not rely on styles and localization, but set the format string and
// use nothing but numbers.

// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function CFDateFormatterCreate( allocator: CFAllocatorRef; locale: CFLocaleRef; dateStyle: CFDateFormatterStyle; timeStyle: CFDateFormatterStyle ): CFDateFormatterRef; external name '_CFDateFormatterCreate';
    // Returns a CFDateFormatter, localized to the given locale, which
    // will format dates to the given date and time styles.

// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function CFDateFormatterGetLocale( formatter: CFDateFormatterRef ): CFLocaleRef; external name '_CFDateFormatterGetLocale';

// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function CFDateFormatterGetDateStyle( formatter: CFDateFormatterRef ): CFDateFormatterStyle; external name '_CFDateFormatterGetDateStyle';

// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function CFDateFormatterGetTimeStyle( formatter: CFDateFormatterRef ): CFDateFormatterStyle; external name '_CFDateFormatterGetTimeStyle';
    // Get the properties with which the date formatter was created.

// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function CFDateFormatterGetFormat( formatter: CFDateFormatterRef ): CFStringRef; external name '_CFDateFormatterGetFormat';

// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
procedure CFDateFormatterSetFormat( formatter: CFDateFormatterRef; formatString: CFStringRef ); external name '_CFDateFormatterSetFormat';
    // Set the format description string of the date formatter.  This
    // overrides the style settings.  The format of the format string
    // is as defined by the ICU library, and is similar to that found
    // in C# (and Java I believe).  The date formatter starts with a
    // default format string defined by the style arguments with
    // which it was created.


// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function CFDateFormatterCreateStringWithDate( allocator: CFAllocatorRef; formatter: CFDateFormatterRef; date: CFDateRef ): CFStringRef; external name '_CFDateFormatterCreateStringWithDate';

// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function CFDateFormatterCreateStringWithAbsoluteTime( allocator: CFAllocatorRef; formatter: CFDateFormatterRef; at: CFAbsoluteTime ): CFStringRef; external name '_CFDateFormatterCreateStringWithAbsoluteTime';
    // Create a string representation of the given date or CFAbsoluteTime
    // using the current state of the date formatter.


// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function CFDateFormatterCreateDateFromString( allocator: CFAllocatorRef; formatter: CFDateFormatterRef; str: CFStringRef; rangep: CFRangePtr ): CFDateRef; external name '_CFDateFormatterCreateDateFromString';

// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function CFDateFormatterGetAbsoluteTimeFromString( formatter: CFDateFormatterRef; str: CFStringRef; rangep: CFRangePtr; atp: CFAbsoluteTimePtr ): Boolean; external name '_CFDateFormatterGetAbsoluteTimeFromString';
    // Parse a string representation of a date using the current state
    // of the date formatter.  The range parameter specifies the range
    // of the string in which the parsing should occur in input, and on
    // output indicates the extent that was used; this parameter can
    // be NULL, in which case the whole string may be used.  The
    // return value indicates whether some date was computed and
    // (if atp is not NULL) stored at the location specified by atp.


// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
procedure CFDateFormatterSetProperty( formatter: CFDateFormatterRef; key: CFStringRef; value: CFTypeRef ); external name '_CFDateFormatterSetProperty';

// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function CFDateFormatterCopyProperty( formatter: CFDateFormatterRef; key: CFStringRef ): CFTypeRef; external name '_CFDateFormatterCopyProperty';
    // Set and get various properties of the date formatter, the set of
    // which may be expanded in the future.

// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
var kCFDateFormatterIsLenient: CFStringRef; external name '_kCFDateFormatterIsLenient'; (* attribute const *)   // CFBoolean
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
var kCFDateFormatterTimeZone: CFStringRef; external name '_kCFDateFormatterTimeZone'; (* attribute const *)     // CFTimeZone
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
var kCFDateFormatterCalendarName: CFStringRef; external name '_kCFDateFormatterCalendarName'; (* attribute const *) // CFString
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
var kCFDateFormatterDefaultFormat: CFStringRef; external name '_kCFDateFormatterDefaultFormat'; (* attribute const *)   // CFString

// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
var kCFGregorianCalendar: CFStringRef; external name '_kCFGregorianCalendar'; (* attribute const *)
{unit CFString}
{$ALIGN MAC68K}










{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}

{
Please note: CFStrings are conceptually an array of Unicode characters.
However, in general, how a CFString stores this array is an implementation
detail. For instance, CFString might choose to use an array of 8-bit characters;
to store its contents; or it might use multiple blocks of memory; or whatever.
Furthermore, the implementation might change depending on the default
system encoding, the user's language, the OS, or even a given release.

What this means is that you should use the following advanced functions with care:

  CFStringGetPascalStringPtr()
  CFStringGetCStringPtr()
  CFStringGetCharactersPtr()

These functions either return the desired pointer quickly, in constant time, or they
return NULL, which indicates you should use some of the other function, as shown
in this example:

    Str255 buffer;
    StringPtr ptr = CFStringGetPascalStringPtr(str, encoding);
    if (ptr == NULL) (
        if (CFStringGetPascalString(str, buffer, 256, encoding)) ptr = buffer;
    )

Note that CFStringGetPascalString call might still return NULL --- but that will happen
in two circumstances only: The conversion from the UniChar contents of CFString
to the specified encoding fails, or the buffer is too small.

If you need a copy of the buffer in the above example, you might consider simply
calling CFStringGetPascalString() in all cases --- CFStringGetPascalStringPtr()
is simply an optimization.

In addition, the following functions, which create immutable CFStrings from developer
supplied buffers without copying the buffers, might have to actually copy
under certain circumstances (If they do copy, the buffer will be dealt with by the
"contentsDeallocator" argument.):

  CFStringCreateWithPascalStringNoCopy()
  CFStringCreateWithCStringNoCopy()
  CFStringCreateWithCharactersNoCopy()

You should of course never depend on the backing store of these CFStrings being
what you provided, and in other no circumstance should you change the contents
of that buffer (given that would break the invariant about the CFString being immutable).

Having said all this, there are actually ways to create a CFString where the backing store
is external, and can be manipulated by the developer or CFString itself:

  CFStringCreateMutableWithExternalCharactersNoCopy()
  CFStringSetExternalCharactersNoCopy()

A "contentsAllocator" is used to realloc or free the backing store by CFString.
kCFAllocatorNull can be provided to assure CFString will never realloc or free the buffer.
Developer can call CFStringSetExternalCharactersNoCopy() to update
CFString's idea of what's going on, if the buffer is changed externally. In these
strings, CFStringGetCharactersPtr() is guaranteed to return the external buffer.

These functions are here to allow wrapping a buffer of UniChar characters in a CFString,
allowing the buffer to passed into CFString functions and also manipulated via CFString
mutation functions. In general, developers should not use this technique for all strings,
as it prevents CFString from using certain optimizations.
}
{ Identifier for character encoding; the values are the same as Text Encoding Converter TextEncoding.
}

type
    CFStringEncoding                    = UInt32;
    CFStringEncodingPtr                 = ^CFStringEncoding;
    {    Platform-independent built-in encodings; always available on all platforms.
       Call CFStringGetSystemEncoding() to get the default system encoding.
        }
    CFStringBuiltInEncodings    = SInt32;
const
    kCFStringEncodingInvalidId  = $FFFFFFFF;
    kCFStringEncodingMacRoman   = 0;
    kCFStringEncodingWindowsLatin1 = $0500;                     {  ANSI codepage 1252  }
    kCFStringEncodingISOLatin1  = $0201;                        {  ISO 8859-1  }
    kCFStringEncodingNextStepLatin = $0B01;                     {  NextStep encoding }
    kCFStringEncodingASCII      = $0600;                        {  0..127 (in creating CFString, values greater than 0x7F are treated as corresponding Unicode value)  }
    kCFStringEncodingUnicode    = $0100;                        {  kTextEncodingUnicodeDefault  + kTextEncodingDefaultFormat (aka kUnicode16BitFormat)  }
    kCFStringEncodingUTF8       = $08000100;                    {  kTextEncodingUnicodeDefault + kUnicodeUTF8Format  }
    kCFStringEncodingNonLossyASCII = $0BFF;                     {  7bit Unicode variants used by YellowBox & Java  }

    {    CFString type ID   }
    {
     *  CFStringGetTypeID()
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function CFStringGetTypeID: CFTypeID; external name '_CFStringGetTypeID';

{ Macro to allow creation of compile-time constant strings; the argument should be a constant string.

CFSTR(), not being a "Copy" or "Create" function, does not return a new
reference for you. So, you should not release the return value. This is
much like constant C or Pascal strings --- when you use "hello world"
in a program, you do not free it.

However, strings returned from CFSTR() can be retained and released in a
properly nested fashion, just like any other CF type. That is, if you pass
a CFSTR() return value to a function such as SetMenuItemWithCFString(), the
function can retain it, then later, when it's done with it, it can release it.
}
(*
    *** Pascal Usage of CFSTR et al ***

    For Pascal:

        To define your own constant CFStrings, call call CFSTRP with a
        constant Pascal single-quoted string only, for example
        CFSTRP('a constant string').

    For MetroWerks Pascal:

        Include the CFStringGlue file in your project (it defines the private function,
        CFSTRP0, which you should never call directly.

        In your uses clause, use CFString and CFStringGlue and whichever PInterface files
        defining the constant CFStrings (or define your own using CFSTRP('pascal string')).

    For GNU Pascal:

        Include the GPCMacros.inc file (for example {$I GPCMacros.inc*}).

        In your uses clause, use CFString (and, optionally, CFStringGlue and the
        PInterface files defining the constant CFStrings).

        You can optionally use CFSTR with a constant double-quoted C String (for example,
        CFSTR("a constant C string")) although it will make no difference, but will
        result in closer  C source code similarity.

    For maximum compatibility in both GPC and MetroWerks Pascal

        Include the GPCMacros.inc file in GPC as part of your GPC prefix.

        Include the CFStringGlue file in your MW project.

        Only ever use CFSTRP with a constant Pascal string.

        In your uses clause for a unit, use the CFString, CFStringGlue and any
        PInterface files defining any constant CFStrings you need.
*)

{
    CFSTR Must only be called with a constant CString
}
function CFSTR( c: PChar ): CFStringRef; external name '___CFStringMakeConstantString';

{
    CFSTRP Must only be called with a constant Pascal String
}
function CFSTRP( c: PChar ): CFStringRef; external name '___CFStringMakeConstantString';

{
    CFSTRP0 Must only be called with a constant Pascal String terminated with a chr(0)
}
function CFSTRP0( c: PChar ): CFStringRef; external name '___CFStringMakeConstantString';

{** Immutable string creation functions **}
{ Functions to create basic immutable strings. The provided allocator is used for all memory activity in these functions.
}
{ These functions copy the provided buffer into CFString's internal storage. }
{
 *  CFStringCreateWithPascalString()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFStringCreateWithPascalString(alloc: CFAllocatorRef; const (*var*) pStr: Str255; encoding: CFStringEncoding): CFStringRef; external name '_CFStringCreateWithPascalString';

{
 *  CFStringCreateWithCString()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFStringCreateWithCString(alloc: CFAllocatorRef; cStr: ConstCStringPtr; encoding: CFStringEncoding): CFStringRef; external name '_CFStringCreateWithCString';

{
 *  CFStringCreateWithCharacters()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFStringCreateWithCharacters(alloc: CFAllocatorRef; chars: UniCharPtr; numChars: CFIndex): CFStringRef; external name '_CFStringCreateWithCharacters';

{ These functions try not to copy the provided buffer. The buffer will be deallocated
with the provided contentsDeallocator when it's no longer needed; to not free
the buffer, specify kCFAllocatorNull here. As usual, NULL means default allocator.
NOTE: Do not count on these buffers as being used by the string;
in some cases the CFString might free the buffer and use something else
(for instance if it decides to always use Unicode encoding internally).
In addition, some encodings are not used internally; in
those cases CFString might also dump the provided buffer and use its own.
}
{
 *  CFStringCreateWithPascalStringNoCopy()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFStringCreateWithPascalStringNoCopy(alloc: CFAllocatorRef; const (*var*) pStr: Str255; encoding: CFStringEncoding; contentsDeallocator: CFAllocatorRef): CFStringRef; external name '_CFStringCreateWithPascalStringNoCopy';

{
 *  CFStringCreateWithCStringNoCopy()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFStringCreateWithCStringNoCopy(alloc: CFAllocatorRef; cStr: ConstCStringPtr; encoding: CFStringEncoding; contentsDeallocator: CFAllocatorRef): CFStringRef; external name '_CFStringCreateWithCStringNoCopy';

{
 *  CFStringCreateWithCharactersNoCopy()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFStringCreateWithCharactersNoCopy(alloc: CFAllocatorRef; chars: UniCharPtr; numChars: CFIndex; contentsDeallocator: CFAllocatorRef): CFStringRef; external name '_CFStringCreateWithCharactersNoCopy';

{ Create copies of part or all of the string.
}
{
 *  CFStringCreateWithSubstring()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFStringCreateWithSubstring(alloc: CFAllocatorRef; str: CFStringRef; range: CFRange): CFStringRef; external name '_CFStringCreateWithSubstring';

{
 *  CFStringCreateCopy()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFStringCreateCopy(alloc: CFAllocatorRef; theString: CFStringRef): CFStringRef; external name '_CFStringCreateCopy';

{ These functions create a CFString from the provided printf-like format string and arguments.
}
function CFStringCreateWithFormat( alloc: CFAllocatorRef; formatOptions: CFDictionaryRef; format: CFStringRef;  ... ): CFStringRef; external name '_CFStringCreateWithFormat';

function CFStringCreateWithFormatAndArguments( alloc: CFAllocatorRef; formatOptions: CFDictionaryRef; format: CFStringRef; arguments: UnivPtr ): CFStringRef; external name '_CFStringCreateWithFormatAndArguments';

{ Functions to create mutable strings. "maxLength", if not 0, is a hard bound on the length of the string. If 0, there is no limit on the length.
}
{
 *  CFStringCreateMutable()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFStringCreateMutable(alloc: CFAllocatorRef; maxLength: CFIndex): CFMutableStringRef; external name '_CFStringCreateMutable';

{
 *  CFStringCreateMutableCopy()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFStringCreateMutableCopy(alloc: CFAllocatorRef; maxLength: CFIndex; theString: CFStringRef): CFMutableStringRef; external name '_CFStringCreateMutableCopy';

{ This function creates a mutable string that has a developer supplied and directly editable backing store.
The string will be manipulated within the provided buffer (if any) until it outgrows capacity; then the
externalCharactersAllocator will be consulted for more memory. When the CFString is deallocated, the
buffer will be freed with the externalCharactersAllocator. Provide kCFAllocatorNull here to prevent the buffer
from ever being reallocated or deallocated by CFString. See comments at top of this file for more info.
}
{
 *  CFStringCreateMutableWithExternalCharactersNoCopy()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFStringCreateMutableWithExternalCharactersNoCopy(alloc: CFAllocatorRef; chars: UniCharPtr; numChars: CFIndex; capacity: CFIndex; externalCharactersAllocator: CFAllocatorRef): CFMutableStringRef; external name '_CFStringCreateMutableWithExternalCharactersNoCopy';

{** Basic accessors for the contents **}
{ Number of 16-bit Unicode characters in the string.
}
{
 *  CFStringGetLength()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFStringGetLength(theString: CFStringRef): CFIndex; external name '_CFStringGetLength';

{ Extracting the contents of the string. For obtaining multiple characters, calling
CFStringGetCharacters() is more efficient than multiple calls to CFStringGetCharacterAtIndex().
If the length of the string is not known (so you can't use a fixed size buffer for CFStringGetCharacters()),
another method is to use is CFStringGetCharacterFromInlineBuffer() (see further below).
}
{
 *  CFStringGetCharacterAtIndex()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFStringGetCharacterAtIndex(theString: CFStringRef; idx: CFIndex): UniChar; external name '_CFStringGetCharacterAtIndex';

{
 *  CFStringGetCharacters()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CFStringGetCharacters(theString: CFStringRef; range: CFRange; buffer: UniCharPtr); external name '_CFStringGetCharacters';

{** Conversion to other encodings **}
{ These two convert into the provided buffer; they return FALSE if conversion isn't possible
(due to conversion error, or not enough space in the provided buffer).
These functions do zero-terminate or put the length byte; the provided bufferSize should include
space for this (so pass 256 for Str255). More sophisticated usages can go through CFStringGetBytes().
These functions are equivalent to calling CFStringGetBytes() with
the range of the string; lossByte = 0; and isExternalRepresentation = FALSE;
if successful, they then insert the leading length of terminating zero, as desired.
}
{
 *  CFStringGetPascalString()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFStringGetPascalString(theString: CFStringRef; buffer: StringPtr; bufferSize: CFIndex; encoding: CFStringEncoding): boolean; external name '_CFStringGetPascalString';

{
 *  CFStringGetCString()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFStringGetCString(theString: CFStringRef; buffer: CStringPtr; bufferSize: CFIndex; encoding: CFStringEncoding): boolean; external name '_CFStringGetCString';

{ These functions attempt to return in O(1) time the desired format for the string.
Note that although this means a pointer to the internal structure is being returned,
this can't always be counted on. Please see note at the top of the file for more
details.
}
{
 *  CFStringGetPascalStringPtr()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFStringGetPascalStringPtr(theString: CFStringRef; encoding: CFStringEncoding): ConstStringPtr; external name '_CFStringGetPascalStringPtr';

{ Be prepared for NULL }
{
 *  CFStringGetCStringPtr()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFStringGetCStringPtr(theString: CFStringRef; encoding: CFStringEncoding): ConstCStringPtr; external name '_CFStringGetCStringPtr';

{ Be prepared for NULL }
{
 *  CFStringGetCharactersPtr()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFStringGetCharactersPtr(theString: CFStringRef): UniCharPtr; external name '_CFStringGetCharactersPtr';

{ Be prepared for NULL }
{ The primitive conversion routine; allows you to convert a string piece at a time
   into a fixed size buffer. Returns number of characters converted.
   Characters that cannot be converted to the specified encoding are represented
   with the byte specified by lossByte; if lossByte is 0, then lossy conversion
   is not allowed and conversion stops, returning partial results.
   Pass buffer==NULL if you don't care about the converted string (but just the convertability,
   or number of bytes required).
   maxBufLength indicates the maximum number of bytes to generate. It is ignored when buffer==NULL.
   Does not zero-terminate. If you want to create Pascal or C string, allow one extra byte at start or end.
   Setting isExternalRepresentation causes any extra bytes that would allow
   the data to be made persistent to be included; for instance, the Unicode BOM.
}
{
 *  CFStringGetBytes()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFStringGetBytes(theString: CFStringRef; range: CFRange; encoding: CFStringEncoding; lossByte: ByteParameter; isExternalRepresentation: boolean; buffer: UInt8Ptr; maxBufLen: CFIndex; var usedBufLen: CFIndex): CFIndex; external name '_CFStringGetBytes';

{ This one goes the other way by creating a CFString from a bag of bytes.
This is much like CFStringCreateWithPascalString or CFStringCreateWithCString,
except the length is supplied explicitly. In addition, you can specify whether
the data is an external format --- that is, whether to pay attention to the
BOM character (if any) and do byte swapping if necessary
}
{
 *  CFStringCreateWithBytes()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFStringCreateWithBytes(alloc: CFAllocatorRef; bytes: UnivPtr; numBytes: CFIndex; encoding: CFStringEncoding; isExternalRepresentation: boolean): CFStringRef; external name '_CFStringCreateWithBytes';

{ Convenience functions String <-> Data. These generate "external" formats, that is, formats that
   can be written out to disk. For instance, if the encoding is Unicode, CFStringCreateFromExternalRepresentation()
   pays attention to the BOM character (if any) and does byte swapping if necessary.
   Similarly CFStringCreateExternalRepresentation() will always include a BOM character if the encoding is
   Unicode. See above for description of lossByte.
}
{
 *  CFStringCreateFromExternalRepresentation()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFStringCreateFromExternalRepresentation(alloc: CFAllocatorRef; data: CFDataRef; encoding: CFStringEncoding): CFStringRef; external name '_CFStringCreateFromExternalRepresentation';

{ May return NULL on conversion error }
{
 *  CFStringCreateExternalRepresentation()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFStringCreateExternalRepresentation(alloc: CFAllocatorRef; theString: CFStringRef; encoding: CFStringEncoding; lossByte: ByteParameter): CFDataRef; external name '_CFStringCreateExternalRepresentation';

{ May return NULL on conversion error }
{ Hints about the contents of a string
}
{
 *  CFStringGetSmallestEncoding()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFStringGetSmallestEncoding(theString: CFStringRef): CFStringEncoding; external name '_CFStringGetSmallestEncoding';

{ Result in O(n) time max }
{
 *  CFStringGetFastestEncoding()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFStringGetFastestEncoding(theString: CFStringRef): CFStringEncoding; external name '_CFStringGetFastestEncoding';

{ Result in O(1) time max }
{ General encoding info
}
{
 *  CFStringGetSystemEncoding()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFStringGetSystemEncoding: CFStringEncoding; external name '_CFStringGetSystemEncoding';

{ The default encoding for the system; untagged 8-bit characters are usually in this encoding }
{
 *  CFStringGetMaximumSizeForEncoding()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFStringGetMaximumSizeForEncoding(length: CFIndex; encoding: CFStringEncoding): CFIndex; external name '_CFStringGetMaximumSizeForEncoding';

{ Max bytes a string of specified length (in UniChars) will take up if encoded }
{** Comparison functions. **}

type
    CFStringCompareFlags        = SInt32;
const
                                                                {  Flags used in all find and compare operations  }
    kCFCompareCaseInsensitive   = 1;
    kCFCompareBackwards         = 4;                            {  Starting from the end of the string  }
    kCFCompareAnchored          = 8;                            {  Only at the specified starting point  }
    kCFCompareNonliteral        = 16;                           {  If specified, loose equivalence is performed (o-umlaut == o, umlaut)  }
    kCFCompareLocalized         = 32;                           {  User's default locale is used for the comparisons  }
    kCFCompareNumerically       = 64;                           {  Numeric comparison is used; that is, Foo2.txt < Foo7.txt < Foo25.txt  }

    {    The main comparison routine; compares specified range of the string to another.
       locale == NULL indicates canonical locale
       kCFCompareNumerically is currently unimplemented.
        }
    {
     *  CFStringCompareWithOptions()
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function CFStringCompareWithOptions(theString1: CFStringRef; theString2: CFStringRef; rangeToCompare: CFRange; compareOptions: CFOptionFlags): CFComparisonResult; external name '_CFStringCompareWithOptions';

{ Comparison convenience suitable for passing as sorting functions.
   kCFCompareNumerically is currently unimplemented.
}
{
 *  CFStringCompare()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFStringCompare(theString1: CFStringRef; theString2: CFStringRef; compareOptions: CFOptionFlags): CFComparisonResult; external name '_CFStringCompare';

{ Find routines; CFStringFindWithOptions() returns the found range in the CFRange * argument;  You can pass NULL for simple discovery check.
   CFStringCreateArrayWithFindResults() returns an array of CFRange pointers, or NULL if there are no matches.
   kCFCompareNumerically is currently unimplemented.
}
{
 *  CFStringFindWithOptions()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFStringFindWithOptions(theString: CFStringRef; stringToFind: CFStringRef; rangeToSearch: CFRange; searchOptions: CFOptionFlags; var result: CFRange): boolean; external name '_CFStringFindWithOptions';

{
 *  CFStringCreateArrayWithFindResults()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFStringCreateArrayWithFindResults(alloc: CFAllocatorRef; theString: CFStringRef; stringToFind: CFStringRef; rangeToSearch: CFRange; compareOptions: CFOptionFlags): CFArrayRef; external name '_CFStringCreateArrayWithFindResults';

{ Find conveniences
}
{
 *  CFStringFind()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFStringFind(theString: CFStringRef; stringToFind: CFStringRef; compareOptions: CFOptionFlags): CFRange; external name '_CFStringFind';

{
 *  CFStringHasPrefix()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFStringHasPrefix(theString: CFStringRef; prefix: CFStringRef): boolean; external name '_CFStringHasPrefix';

{
 *  CFStringHasSuffix()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFStringHasSuffix(theString: CFStringRef; suffix: CFStringRef): boolean; external name '_CFStringHasSuffix';

{ Find range of bounds of the line(s) that span the indicated range (startIndex, numChars),
   taking into account various possible line separator sequences (CR, CRLF, LF, and Unicode LS, PS).
   All return values are "optional" (provide NULL if you don't want them)
     lineStartIndex: index of first character in line
     lineEndIndex: index of first character of the next line (including terminating line separator characters)
     contentsEndIndex: index of the first line separator character
   Thus, lineEndIndex - lineStartIndex is the number of chars in the line, including the line separators
         contentsEndIndex - lineStartIndex is the number of chars in the line w/out the line separators
}

{!
    @function CFStringGetRangeOfComposedCharactersAtIndex
    Returns the range of the composed character sequence at the specified index.
    @param theString The CFString which is to be searched.  If this
                        parameter is not a valid CFString, the behavior is
                    undefined.
    @param theIndex The index of the character contained in the
            composed character sequence.  If the index is
            outside the index space of the string (0 to N-1 inclusive,
            where N is the length of the string), the behavior is
            undefined.
    @result The range of the composed character sequence.
}
function CFStringGetRangeOfComposedCharactersAtIndex( theString: CFStringRef; theIndex: CFIndex ): CFRange; external name '_CFStringGetRangeOfComposedCharactersAtIndex';

{!
    @function CFStringFindCharacterFromSet
    Query the range of the first character contained in the specified character set.
    @param theString The CFString which is to be searched.  If this
                        parameter is not a valid CFString, the behavior is
                    undefined.
    @param theSet The CFCharacterSet against which the membership
            of characters is checked.  If this parameter is not a valid
            CFCharacterSet, the behavior is undefined.
    @param range The range of characters within the string to search. If
            the range location or end point (defined by the location
            plus length minus 1) are outside the index space of the
            string (0 to N-1 inclusive, where N is the length of the
            string), the behavior is undefined. If the range length is
            negative, the behavior is undefined. The range may be empty
            (length 0), in which case no search is performed.
    @param searchOptions The bitwise-or'ed option flags to control
            the search behavior.  The supported options are
            kCFCompareBackwards andkCFCompareAnchored.
            If other option flags are specified, the behavior
                        is undefined.
    @param result The pointer to a CFRange supplied by the caller in
            which the search result is stored.  Note that the length
                        of this range could be more than If a pointer to an invalid
            memory is specified, the behavior is undefined.
    @result true, if at least a character which is a member of the character
            set is found and result is filled, otherwise, false.
}
// Disabled until we add CFCharacterSetRef.pas
// function CFStringFindCharacterFromSet( theString: CFStringRef; theSet: CFCharacterSetRef; rangeToSearch: CFRange; searchOptions: CFOptionFlags; var result: CFRange ): Boolean; external name '_CFStringFindCharacterFromSet';

{
 *  CFStringGetLineBounds()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CFStringGetLineBounds(theString: CFStringRef; range: CFRange; var lineBeginIndex: CFIndex; var lineEndIndex: CFIndex; var contentsEndIndex: CFIndex); external name '_CFStringGetLineBounds';

{** Exploding and joining strings with a separator string **}
{
 *  CFStringCreateByCombiningStrings()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFStringCreateByCombiningStrings(alloc: CFAllocatorRef; theArray: CFArrayRef; separatorString: CFStringRef): CFStringRef; external name '_CFStringCreateByCombiningStrings';

{ Empty array returns empty string; one element array returns the element }
{
 *  CFStringCreateArrayBySeparatingStrings()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFStringCreateArrayBySeparatingStrings(alloc: CFAllocatorRef; theString: CFStringRef; separatorString: CFStringRef): CFArrayRef; external name '_CFStringCreateArrayBySeparatingStrings';

{ No separators in the string returns array with that string; string == sep returns two empty strings }
{** Parsing non-localized numbers from strings **}
{
 *  CFStringGetIntValue()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFStringGetIntValue(str: CFStringRef): SInt32; external name '_CFStringGetIntValue';

{ Skips whitespace; returns 0 on error, MAX or -MAX on overflow }
{
 *  CFStringGetDoubleValue()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFStringGetDoubleValue(str: CFStringRef): Double; external name '_CFStringGetDoubleValue';

{ Skips whitespace; returns 0.0 on error }
{** MutableString functions **}
{ CFStringAppend("abcdef", "xxxxx") -> "abcdefxxxxx"
   CFStringDelete("abcdef", CFRangeMake(2, 3)) -> "abf"
   CFStringReplace("abcdef", CFRangeMake(2, 3), "xxxxx") -> "abxxxxxf"
   CFStringReplaceAll("abcdef", "xxxxx") -> "xxxxx"
}
{
 *  CFStringAppend()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CFStringAppend(theString: CFMutableStringRef; appendedString: CFStringRef); external name '_CFStringAppend';

{
 *  CFStringAppendCharacters()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CFStringAppendCharacters(theString: CFMutableStringRef; chars: UniCharPtr; numChars: CFIndex); external name '_CFStringAppendCharacters';

{
 *  CFStringAppendPascalString()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CFStringAppendPascalString(theString: CFMutableStringRef; const (*var*) pStr: Str255; encoding: CFStringEncoding); external name '_CFStringAppendPascalString';

{
 *  CFStringAppendCString()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CFStringAppendCString(theString: CFMutableStringRef; cStr: ConstCStringPtr; encoding: CFStringEncoding); external name '_CFStringAppendCString';

{
 *  CFStringAppendFormat()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CFStringAppendFormat(theString: CFMutableStringRef; formatOptions: CFDictionaryRef; format: CFStringRef; ...); external name '_CFStringAppendFormat';

procedure CFStringAppendFormatAndArguments( theString: CFMutableStringRef; formatOptions: CFDictionaryRef; format: CFStringRef; arguments: UnivPtr ); external name '_CFStringAppendFormatAndArguments';

{
 *  CFStringInsert()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CFStringInsert(str: CFMutableStringRef; idx: CFIndex; insertedStr: CFStringRef); external name '_CFStringInsert';

{
 *  CFStringDelete()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CFStringDelete(theString: CFMutableStringRef; range: CFRange); external name '_CFStringDelete';

{
 *  CFStringReplace()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CFStringReplace(theString: CFMutableStringRef; range: CFRange; replacement: CFStringRef); external name '_CFStringReplace';

{
 *  CFStringReplaceAll()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CFStringReplaceAll(theString: CFMutableStringRef; replacement: CFStringRef); external name '_CFStringReplaceAll';

{ Replace all occurrences of target in rangeToSearch of theString with replacement.
   Pays attention to kCFCompareCaseInsensitive, kCFCompareBackwards, kCFCompareNonliteral, and kCFCompareAnchored.
   kCFCompareBackwards can be used to do the replacement starting from the end, which could give a different result.
     ex. AAAAA, replace AA with B -> BBA or ABB; latter if kCFCompareBackwards
   kCFCompareAnchored assures only anchored but multiple instances are found (the instances must be consecutive at start or end)
     ex. AAXAA, replace A with B -> BBXBB or BBXAA; latter if kCFCompareAnchored
   Returns number of replacements performed.
}
function CFStringFindAndReplace( theString: CFMutableStringRef; stringToFind: CFStringRef; replacementString: CFStringRef; rangeToSearch: CFRange; compareOptions: CFOptionFlags ): CFIndex; external name '_CFStringFindAndReplace';

{ This function will make the contents of a mutable CFString point directly at the specified UniChar array.
it works only with CFStrings created with CFStringCreateMutableWithExternalCharactersNoCopy().
This function does not free the previous buffer.
The string will be manipulated within the provided buffer (if any) until it outgrows capacity; then the
externalCharactersAllocator will be consulted for more memory.
See comments at the top of this file for more info.
}
{
 *  CFStringSetExternalCharactersNoCopy()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CFStringSetExternalCharactersNoCopy(theString: CFMutableStringRef; chars: UniCharPtr; length: CFIndex; capacity: CFIndex); external name '_CFStringSetExternalCharactersNoCopy';

{ Works only on specially created mutable strings! }
{ CFStringPad() will pad or cut down a string to the specified size.
   The pad string is used as the fill string; indexIntoPad specifies which character to start with.
     CFStringPad("abc", " ", 9, 0) ->  "abc      "
     CFStringPad("abc", ". ", 9, 1) -> "abc . . ."
     CFStringPad("abcdef", ?, 3, ?) -> "abc"

     CFStringTrim() will trim the specified string from both ends of the string.
     CFStringTrimWhitespace() will do the same with white space characters (tab, newline, etc)
     CFStringTrim("  abc ", " ") -> "abc"
     CFStringTrim("* * * *abc * ", "* ") -> "*abc "
}
{
 *  CFStringPad()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CFStringPad(theString: CFMutableStringRef; padString: CFStringRef; length: CFIndex; indexIntoPad: CFIndex); external name '_CFStringPad';

{
 *  CFStringTrim()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CFStringTrim(theString: CFMutableStringRef; trimString: CFStringRef); external name '_CFStringTrim';

{
 *  CFStringTrimWhitespace()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CFStringTrimWhitespace(theString: CFMutableStringRef); external name '_CFStringTrimWhitespace';

{
 *  CFStringLowercase()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CFStringLowercase(theString: CFMutableStringRef; localeTBD: UnivPtr); external name '_CFStringLowercase';

{
 *  CFStringUppercase()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CFStringUppercase(theString: CFMutableStringRef; localeTBD: UnivPtr); external name '_CFStringUppercase';

{
 *  CFStringCapitalize()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CFStringCapitalize(theString: CFMutableStringRef; localeTBD: UnivPtr); external name '_CFStringCapitalize';

{!
    @typedef CFStringNormalizationForm
    This is the type of Unicode normalization forms as described in
    Unicode Technical Report #15.
}
type
    CFStringNormalizationForm = SInt32;
const
    kCFStringNormalizationFormD  = 0; // Canonical Decomposition
    kCFStringNormalizationFormKD = 1; // Compatibility Decomposition
    kCFStringNormalizationFormC  = 2; // Canonical Decomposition followed by Canonical Composition
    kCFStringNormalizationFormKC = 3; // Compatibility Decomposition followed by Canonical Composition

{!
    @function CFStringNormalize
    Normalizes the string into the specified form as described in
    Unicode Technical Report #15.
    @param theString  The string which is to be normalized.  If this
        parameter is not a valid mutable CFString, the behavior is
        undefined.
    @param theForm  The form into which the string is to be normalized.
        If this parameter is not a valid CFStringNormalizationForm value,
        the behavior is undefined.
}
procedure CFStringNormalize( theString: CFMutableStringRef; theForm: CFStringNormalizationForm ); external name '_CFStringNormalize';

{ This returns availability of the encoding on the system
}
{
 *  CFStringIsEncodingAvailable()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFStringIsEncodingAvailable(encoding: CFStringEncoding): boolean; external name '_CFStringIsEncodingAvailable';

{ This function returns list of available encodings.  The returned list is terminated with kCFStringEncodingInvalidId and owned by the system.
}
{
 *  CFStringGetListOfAvailableEncodings()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFStringGetListOfAvailableEncodings: CFStringEncodingPtr; external name '_CFStringGetListOfAvailableEncodings';

{ Returns name of the encoding
}
{
 *  CFStringGetNameOfEncoding()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFStringGetNameOfEncoding(encoding: CFStringEncoding): CFStringRef; external name '_CFStringGetNameOfEncoding';

{ ID mapping functions from/to YellowBox NSStringEncoding.  Returns kCFStringEncodingInvalidId if no mapping exists.
}
{
 *  CFStringConvertEncodingToNSStringEncoding()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFStringConvertEncodingToNSStringEncoding(encoding: CFStringEncoding): UInt32; external name '_CFStringConvertEncodingToNSStringEncoding';

{
 *  CFStringConvertNSStringEncodingToEncoding()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFStringConvertNSStringEncodingToEncoding(encoding: UInt32): CFStringEncoding; external name '_CFStringConvertNSStringEncodingToEncoding';

{ ID mapping functions from/to Microsoft Windows codepage (covers both OEM & ANSI).  Returns kCFStringEncodingInvalidId if no mapping exists.
}
{
 *  CFStringConvertEncodingToWindowsCodepage()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFStringConvertEncodingToWindowsCodepage(encoding: CFStringEncoding): UInt32; external name '_CFStringConvertEncodingToWindowsCodepage';

{
 *  CFStringConvertWindowsCodepageToEncoding()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFStringConvertWindowsCodepageToEncoding(codepage: UInt32): CFStringEncoding; external name '_CFStringConvertWindowsCodepageToEncoding';

{ ID mapping functions from/to IANA registery charset names.  Returns kCFStringEncodingInvalidId if no mapping exists.
}
{
 *  CFStringConvertIANACharSetNameToEncoding()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFStringConvertIANACharSetNameToEncoding(theString: CFStringRef): CFStringEncoding; external name '_CFStringConvertIANACharSetNameToEncoding';

{
 *  CFStringConvertEncodingToIANACharSetName()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFStringConvertEncodingToIANACharSetName(encoding: CFStringEncoding): CFStringRef; external name '_CFStringConvertEncodingToIANACharSetName';

{ Returns the most compatible MacOS script value for the input encoding }
{ i.e. kCFStringEncodingMacRoman -> kCFStringEncodingMacRoman }
{     kCFStringEncodingWindowsLatin1 -> kCFStringEncodingMacRoman }
{     kCFStringEncodingISO_2022_JP -> kCFStringEncodingMacJapanese }
{
 *  CFStringGetMostCompatibleMacStringEncoding()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFStringGetMostCompatibleMacStringEncoding(encoding: CFStringEncoding): CFStringEncoding; external name '_CFStringGetMostCompatibleMacStringEncoding';


{ Rest of the stuff in this file is private and should not be used directly
}
{ For debugging only
   Use CFShow() to printf the description of any CFType;
   Use CFShowStr() to printf detailed info about a CFString
}
{
 *  CFShow()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CFShow(obj: CFTypeRef); external name '_CFShow';

{
 *  CFShowStr()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CFShowStr(str: CFStringRef); external name '_CFShowStr';

{ This function is private and should not be used directly }
{$ALIGN MAC68K}
{#POP}
{unit CFTimeZone}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}

{
        ### Warning ###

    The CFTimeZone functions are not usable on when running on CarbonLib under
    Mac OS 8/9.  CFTimeZoneCreate will return NULL and most functions are no-ops.

    The CFTimeZone functions do work properly when running on Mac OS X.

}
{
 *  CFTimeZoneGetTypeID()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFTimeZoneGetTypeID: CFTypeID; external name '_CFTimeZoneGetTypeID';

{
 *  CFTimeZoneCopySystem()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFTimeZoneCopySystem: CFTimeZoneRef; external name '_CFTimeZoneCopySystem';

{
 *  CFTimeZoneResetSystem()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CFTimeZoneResetSystem; external name '_CFTimeZoneResetSystem';

{
 *  CFTimeZoneCopyDefault()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFTimeZoneCopyDefault: CFTimeZoneRef; external name '_CFTimeZoneCopyDefault';

{
 *  CFTimeZoneSetDefault()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CFTimeZoneSetDefault(tz: CFTimeZoneRef); external name '_CFTimeZoneSetDefault';

{
 *  CFTimeZoneCopyKnownNames()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFTimeZoneCopyKnownNames: CFArrayRef; external name '_CFTimeZoneCopyKnownNames';

{
 *  CFTimeZoneCopyAbbreviationDictionary()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFTimeZoneCopyAbbreviationDictionary: CFDictionaryRef; external name '_CFTimeZoneCopyAbbreviationDictionary';

{
 *  CFTimeZoneSetAbbreviationDictionary()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CFTimeZoneSetAbbreviationDictionary(dict: CFDictionaryRef); external name '_CFTimeZoneSetAbbreviationDictionary';

{
 *  CFTimeZoneCreate()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFTimeZoneCreate(allocator: CFAllocatorRef; name: CFStringRef; data: CFDataRef): CFTimeZoneRef; external name '_CFTimeZoneCreate';

{
 *  CFTimeZoneCreateWithTimeIntervalFromGMT()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFTimeZoneCreateWithTimeIntervalFromGMT(allocator: CFAllocatorRef; ti: CFTimeInterval): CFTimeZoneRef; external name '_CFTimeZoneCreateWithTimeIntervalFromGMT';

{
 *  CFTimeZoneCreateWithName()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFTimeZoneCreateWithName(allocator: CFAllocatorRef; name: CFStringRef; tryAbbrev: boolean): CFTimeZoneRef; external name '_CFTimeZoneCreateWithName';

{
 *  CFTimeZoneGetName()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFTimeZoneGetName(tz: CFTimeZoneRef): CFStringRef; external name '_CFTimeZoneGetName';

{
 *  CFTimeZoneGetData()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFTimeZoneGetData(tz: CFTimeZoneRef): CFDataRef; external name '_CFTimeZoneGetData';

{
 *  CFTimeZoneGetSecondsFromGMT()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFTimeZoneGetSecondsFromGMT(tz: CFTimeZoneRef; at: CFAbsoluteTime): CFTimeInterval; external name '_CFTimeZoneGetSecondsFromGMT';

{
 *  CFTimeZoneCopyAbbreviation()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFTimeZoneCopyAbbreviation(tz: CFTimeZoneRef; at: CFAbsoluteTime): CFStringRef; external name '_CFTimeZoneCopyAbbreviation';

{
 *  CFTimeZoneIsDaylightSavingTime()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFTimeZoneIsDaylightSavingTime(tz: CFTimeZoneRef; at: CFAbsoluteTime): boolean; external name '_CFTimeZoneIsDaylightSavingTime';

{$ALIGN MAC68K}
{#POP}
{unit CFUUID}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}


type
    CFUUIDRef    = ^SInt32; { an opaque 32-bit type }
    CFUUIDRefPtr = ^CFUUIDRef;  { when a var xx:CFUUIDRef parameter can be nil, it is changed to xx: CFUUIDRefPtr }
    CFUUIDBytesPtr = ^CFUUIDBytes;
    CFUUIDBytes = record
        byte0:                  SInt8;
        byte1:                  SInt8;
        byte2:                  SInt8;
        byte3:                  SInt8;
        byte4:                  SInt8;
        byte5:                  SInt8;
        byte6:                  SInt8;
        byte7:                  SInt8;
        byte8:                  SInt8;
        byte9:                  SInt8;
        byte10:                 SInt8;
        byte11:                 SInt8;
        byte12:                 SInt8;
        byte13:                 SInt8;
        byte14:                 SInt8;
        byte15:                 SInt8;
    end;

    {    The CFUUIDBytes struct is a 128-bit struct that contains the
    raw UUID.  A CFUUIDRef can provide such a struct from the
    CFUUIDGetUUIDBytes() function.  This struct is suitable for
    passing to APIs that expect a raw UUID.
        }
    {
     *  CFUUIDGetTypeID()
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.1 and later
     *    Mac OS X:         in version 10.0 and later
        }
function CFUUIDGetTypeID: CFTypeID; external name '_CFUUIDGetTypeID';

{
 *  CFUUIDCreate()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFUUIDCreate(alloc: CFAllocatorRef): CFUUIDRef; external name '_CFUUIDCreate';

{ Create and return a brand new unique identifier }
{
 *  CFUUIDCreateWithBytes()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFUUIDCreateWithBytes(alloc: CFAllocatorRef; byte0: ByteParameter; byte1: ByteParameter; byte2: ByteParameter; byte3: ByteParameter; byte4: ByteParameter; byte5: ByteParameter; byte6: ByteParameter; byte7: ByteParameter; byte8: ByteParameter; byte9: ByteParameter; byte10: ByteParameter; byte11: ByteParameter; byte12: ByteParameter; byte13: ByteParameter; byte14: ByteParameter; byte15: ByteParameter): CFUUIDRef; external name '_CFUUIDCreateWithBytes';

{ Create and return an identifier with the given contents.  This may return an existing instance with its ref count bumped because of uniquing. }
{
 *  CFUUIDCreateFromString()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFUUIDCreateFromString(alloc: CFAllocatorRef; uuidStr: CFStringRef): CFUUIDRef; external name '_CFUUIDCreateFromString';

{ Converts from a string representation to the UUID.  This may return an existing instance with its ref count bumped because of uniquing. }
{
 *  CFUUIDCreateString()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFUUIDCreateString(alloc: CFAllocatorRef; uuid: CFUUIDRef): CFStringRef; external name '_CFUUIDCreateString';

{ Converts from a UUID to its string representation. }
{
 *  CFUUIDGetConstantUUIDWithBytes()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFUUIDGetConstantUUIDWithBytes(alloc: CFAllocatorRef; byte0: ByteParameter; byte1: ByteParameter; byte2: ByteParameter; byte3: ByteParameter; byte4: ByteParameter; byte5: ByteParameter; byte6: ByteParameter; byte7: ByteParameter; byte8: ByteParameter; byte9: ByteParameter; byte10: ByteParameter; byte11: ByteParameter; byte12: ByteParameter; byte13: ByteParameter; byte14: ByteParameter; byte15: ByteParameter): CFUUIDRef; external name '_CFUUIDGetConstantUUIDWithBytes';

{ This returns an immortal CFUUIDRef that should not be released.  It can be used in headers to declare UUID constants with #define. }
{
 *  CFUUIDGetUUIDBytes()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFUUIDGetUUIDBytes(uuid: CFUUIDRef): CFUUIDBytes; external name '_CFUUIDGetUUIDBytes';

{
 *  CFUUIDCreateFromUUIDBytes()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFUUIDCreateFromUUIDBytes(alloc: CFAllocatorRef; bytes: CFUUIDBytes): CFUUIDRef; external name '_CFUUIDCreateFromUUIDBytes';

{$ALIGN MAC68K}
{#POP}
{unit CGAffineTransforms}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}


type
    CGAffineTransformPtr = ^CGAffineTransform;
    CGAffineTransform = record
        a:                      Single;
        b:                      Single;
        c:                      Single;
        d:                      Single;
        tx:                     Single;
        ty:                     Single;
    end;

    {    The identity transform: [ 1 0 0 1 0 0 ].   }
var CGAffineTransformIdentity: CGAffineTransform; external name '_CGAffineTransformIdentity'; (* attribute const *)
    {
     *  CGAffineTransformIdentity
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        not available
     *    Mac OS X:         in version 10.0 and later
        }
    {    Return the transform [ a b c d tx ty ].    }
    {
     *  CGAffineTransformMake()
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        not available
     *    Mac OS X:         in version 10.0 and later
        }
function CGAffineTransformMake(a: Single; b: Single; c: Single; d: Single; tx: Single; ty: Single): CGAffineTransform; external name '_CGAffineTransformMake';

{ Return a transform which translates by `(tx, ty)':
 *   t' = [ 1 0 0 1 tx ty ] }
{
 *  CGAffineTransformMakeTranslation()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGAffineTransformMakeTranslation(tx: Single; ty: Single): CGAffineTransform; external name '_CGAffineTransformMakeTranslation';

{ Return a transform which scales by `(sx, sy)':
 *   t' = [ sx 0 0 sy 0 0 ] }
{
 *  CGAffineTransformMakeScale()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGAffineTransformMakeScale(sx: Single; sy: Single): CGAffineTransform; external name '_CGAffineTransformMakeScale';

{ Return a transform which rotates by `angle' radians:
 *   t' = [ cos(angle) sin(angle) -sin(angle) cos(angle) 0 0 ] }
{
 *  CGAffineTransformMakeRotation()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGAffineTransformMakeRotation(angle: Single): CGAffineTransform; external name '_CGAffineTransformMakeRotation';

{ Translate `t' by `(tx, ty)' and return the result:
 *   t' = [ 1 0 0 1 tx ty ] * t }
{
 *  CGAffineTransformTranslate()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGAffineTransformTranslate(t: CGAffineTransform; tx: Single; ty: Single): CGAffineTransform; external name '_CGAffineTransformTranslate';

{ Scale `t' by `(sx, sy)' and return the result:
 *   t' = [ sx 0 0 sy 0 0 ] * t }
{
 *  CGAffineTransformScale()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGAffineTransformScale(t: CGAffineTransform; sx: Single; sy: Single): CGAffineTransform; external name '_CGAffineTransformScale';

{ Rotate `t' by `angle' radians and return the result:
 *   t' =  [ cos(angle) sin(angle) -sin(angle) cos(angle) 0 0 ] * t }
{
 *  CGAffineTransformRotate()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGAffineTransformRotate(t: CGAffineTransform; angle: Single): CGAffineTransform; external name '_CGAffineTransformRotate';

{ Invert `t' and return the result.  If `t' has zero determinant, then `t'
 * is returned unchanged. }
{
 *  CGAffineTransformInvert()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGAffineTransformInvert(t: CGAffineTransform): CGAffineTransform; external name '_CGAffineTransformInvert';

{ Concatenate `t2' to `t1' and returne the result:
 *   t' = t1 * t2 }
{
 *  CGAffineTransformConcat()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGAffineTransformConcat(t1: CGAffineTransform; t2: CGAffineTransform): CGAffineTransform; external name '_CGAffineTransformConcat';

{ Transform `point' by `t' and return the result:
 *   p' = p * t
 * where p = [ x y 1 ]. }
{
 *  CGPointApplyAffineTransform()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGPointApplyAffineTransform(point: CGPoint; t: CGAffineTransform): CGPoint; external name '_CGPointApplyAffineTransform';

{ Transform `size' by `t' and return the result:
 *   s' = s * t
 * where s = [ width height 0 ]. }
{
 *  CGSizeApplyAffineTransform()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGSizeApplyAffineTransform(size: CGSize; t: CGAffineTransform): CGSize; external name '_CGSizeApplyAffineTransform';



{$ALIGN MAC68K}
{#POP}
{unit CGDirectDisplay}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}


type
    CGDirectDisplayID    = ^SInt32; { an opaque 32-bit type }
    CGDirectDisplayIDPtr = ^CGDirectDisplayID;  { when a var xx:CGDirectDisplayID parameter can be nil, it is changed to xx: CGDirectDisplayIDPtr }
    CGDirectPaletteRef    = ^SInt32; { an opaque 32-bit type }
    CGDirectPaletteRefPtr = ^CGDirectPaletteRef;  { when a var xx:CGDirectPaletteRef parameter can be nil, it is changed to xx: CGDirectPaletteRefPtr }
    CGDisplayCount                      = u_int32_t;
    CGTableCount                        = u_int32_t;
    CGDisplayCoord                      = int32_t;
    CGByteValue                         = u_int8_t;
    CGByteValuePtr                  = ^CGByteValue;
    CGOpenGLDisplayMask                 = u_int32_t;
    CGBeamPosition                      = u_int32_t;
    CGMouseDelta                        = int32_t;
    CGRefreshRate                       = Double;
    CGDisplayErr                        = CGError;

const
    CGDisplayNoErr              = 0;

    {    A NULL value points to the main display device as a programming convention     }
    kCGDirectMainDisplay        = nil;

    {
     * Mechanisms used to find screen IDs
     * An array length (maxDisplays) and array of CGDirectDisplayIDs are passed in.
     * Up to maxDisplays of the array are filled in with the displays meeting the
     * specified criteria.  The actual number of displays filled in is returned in
     * dspyCnt.
     *
     * If the dspys array is NULL, maxDisplays is ignored, and *dspyCnt is filled
     * in with the number of displays meeting the function's requirements.
        }
    {
     *  CGGetDisplaysWithPoint()
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        not available
     *    Mac OS X:         in version 10.0 and later
        }
function CGGetDisplaysWithPoint(point: CGPoint; maxDisplays: CGDisplayCount; dspys: CGDirectDisplayIDPtr; var dspyCnt: CGDisplayCount): CGDisplayErr; external name '_CGGetDisplaysWithPoint';

{
 *  CGGetDisplaysWithRect()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGGetDisplaysWithRect(rect: CGRect; maxDisplays: CGDisplayCount; dspys: CGDirectDisplayIDPtr; var dspyCnt: CGDisplayCount): CGDisplayErr; external name '_CGGetDisplaysWithRect';

{
 *  CGGetDisplaysWithOpenGLDisplayMask()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGGetDisplaysWithOpenGLDisplayMask(mask: CGOpenGLDisplayMask; maxDisplays: CGDisplayCount; dspys: CGDirectDisplayIDPtr; var dspyCnt: CGDisplayCount): CGDisplayErr; external name '_CGGetDisplaysWithOpenGLDisplayMask';

{
 * Get lists of displays.  Use this to determine display IDs
 *
 * If the activeDspys array is NULL, maxDisplays is ignored, and *dspyCnt is filled
 * in with the number of displays meeting the function's requirements.
 *
 * The first display returned in the list is the main display,
 * the one with the menu bar.
 * When mirroring, this will be the largest display,
 * or if all are the same size, the one with the deepest pixel depth.
 }
{
 *  CGGetActiveDisplayList()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGGetActiveDisplayList(maxDisplays: CGDisplayCount; dspys: CGDirectDisplayIDPtr; var dspyCnt: CGDisplayCount): CGDisplayErr; external name '_CGGetActiveDisplayList';

{ Map a display to an OpenGL display mask; returns 0 on invalid display }
{
 *  CGDisplayIDToOpenGLDisplayMask()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGDisplayIDToOpenGLDisplayMask(display: CGDirectDisplayID): CGOpenGLDisplayMask; external name '_CGDisplayIDToOpenGLDisplayMask';

{ Return screen size and origin in global coords; Empty rect if display is invalid }
{
 *  CGDisplayBounds()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGDisplayBounds(display: CGDirectDisplayID): CGRect; external name '_CGDisplayBounds';

{
 *  CGDisplayPixelsWide()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGDisplayPixelsWide(display: CGDirectDisplayID): size_t; external name '_CGDisplayPixelsWide';

{
 *  CGDisplayPixelsHigh()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGDisplayPixelsHigh(display: CGDirectDisplayID): size_t; external name '_CGDisplayPixelsHigh';

{
 * Display mode selection
 * Display modes are represented as CFDictionaries
 * All dictionaries and arrays returned via these mechanisms are
 * owned by the framework and should not be released.  The framework
 * will not release them out from under your application.
 *
 * Values associated with the following keys are CFNumber types.
 * With CFNumberGetValue(), use kCFNumberLongType for best results.
 }
{
 * Keys used in mode dictionaries.  Source C strings shown won't change.
 * Some CFM environments cannot import data variables, and so
 * duplicate these CFStringRefs locally.
 }
{
 *  kCGDisplayWidth
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
{
 *  kCGDisplayHeight
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
{
 *  kCGDisplayMode
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
{
 *  kCGDisplayBitsPerPixel
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
{
 *  kCGDisplayBitsPerSample
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
{
 *  kCGDisplaySamplesPerPixel
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
{
 *  kCGDisplayRefreshRate
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
{
 *  kCGDisplayModeUsableForDesktopGUI
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
{
 *  kCGDisplayIOFlags
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
{
 * Return a CFArray of CFDictionaries describing all display modes.
 * Returns NULL if the display is invalid.
 }
{
 *  CGDisplayAvailableModes()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGDisplayAvailableModes(display: CGDirectDisplayID): CFArrayRef; external name '_CGDisplayAvailableModes';

{
 * Try to find a display mode of specified depth with dimensions equal or greater than
 * specified.
 * If no depth match is found, try for the next larger depth with dimensions equal or greater
 * than specified.  If no luck, then just return the current mode.
 *
 * exactmatch, if not NULL, is set to 'true' if an exact match in width, height, and depth is found,
 * and 'false' otherwise.
 * Returns NULL if display is invalid.
 }
{
 *  CGDisplayBestModeForParameters()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGDisplayBestModeForParameters(display: CGDirectDisplayID; bitsPerPixel: size_t; width: size_t; height: size_t; var exactMatch: boolean_t): CFDictionaryRef; external name '_CGDisplayBestModeForParameters';

{
 *  CGDisplayBestModeForParametersAndRefreshRate()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGDisplayBestModeForParametersAndRefreshRate(display: CGDirectDisplayID; bitsPerPixel: size_t; width: size_t; height: size_t; refresh: CGRefreshRate; var exactMatch: boolean_t): CFDictionaryRef; external name '_CGDisplayBestModeForParametersAndRefreshRate';

{
 * Return a CFDictionary describing the current display mode.
 * Returns NULL if display is invalid.
 }
{
 *  CGDisplayCurrentMode()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGDisplayCurrentMode(display: CGDirectDisplayID): CFDictionaryRef; external name '_CGDisplayCurrentMode';

{
 * Switch display mode.  Note that after switching,
 * display parameters and addresses may change.
 * The selected display mode persists for the life of the program, and automatically
 * reverts to the permanent setting made by Preferences when the program terminates.
 * The mode dictionary passed in must be a dictionary vended by other CGDirectDisplay
 * APIs such as CGDisplayBestModeForParameters() and CGDisplayAvailableModes().
 }
{
 *  CGDisplaySwitchToMode()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGDisplaySwitchToMode(display: CGDirectDisplayID; mode: CFDictionaryRef): CGDisplayErr; external name '_CGDisplaySwitchToMode';

{ Query parameters for current mode }
{
 *  CGDisplayBitsPerPixel()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGDisplayBitsPerPixel(display: CGDirectDisplayID): size_t; external name '_CGDisplayBitsPerPixel';

{
 *  CGDisplayBitsPerSample()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGDisplayBitsPerSample(display: CGDirectDisplayID): size_t; external name '_CGDisplayBitsPerSample';

{
 *  CGDisplaySamplesPerPixel()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGDisplaySamplesPerPixel(display: CGDirectDisplayID): size_t; external name '_CGDisplaySamplesPerPixel';

{
 *  CGDisplayBytesPerRow()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGDisplayBytesPerRow(display: CGDirectDisplayID): size_t; external name '_CGDisplayBytesPerRow';

{
 * Set a display gamma/transfer function from a formula specifying
 * min and max values and a gamma for each channel.
 * Gamma values must be greater than 0.0.
 * To get an antigamma of 1.6, one would specify a value of (1.0 / 1.6)
 * Min values must be greater than or equal to 0.0 and less than 1.0.
 * Max values must be greater than 0.0 and less than or equal to 1.0.
 * Out of range values, or Max greater than or equal to Min result
 * in a kCGSRangeCheck error.
 *
 * Values are computed by sampling a function for a range of indices from 0 through 1:
 *  value = Min + ((Max - Min) * pow(index, Gamma))
 * The resulting values are converted to a machine specific format
 * and loaded into hardware.
 }

type
    CGGammaValue                        = Single;
    CGGammaValuePtr                 = ^CGGammaValue;
    {
     *  CGSetDisplayTransferByFormula()
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        not available
     *    Mac OS X:         in version 10.0 and later
        }
function CGSetDisplayTransferByFormula(display: CGDirectDisplayID; redMin: CGGammaValue; redMax: CGGammaValue; redGamma: CGGammaValue; greenMin: CGGammaValue; greenMax: CGGammaValue; greenGamma: CGGammaValue; blueMin: CGGammaValue; blueMax: CGGammaValue; blueGamma: CGGammaValue): CGDisplayErr; external name '_CGSetDisplayTransferByFormula';

{
 *  CGGetDisplayTransferByFormula()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGGetDisplayTransferByFormula(display: CGDirectDisplayID; var redMin: CGGammaValue; var redMax: CGGammaValue; var redGamma: CGGammaValue; var greenMin: CGGammaValue; var greenMax: CGGammaValue; var greenGamma: CGGammaValue; var blueMin: CGGammaValue; var blueMax: CGGammaValue; var blueGamma: CGGammaValue): CGDisplayErr; external name '_CGGetDisplayTransferByFormula';

{
 * Set a display gamma/transfer function using tables of data for each channel.
 * Values within each table should have values in the range of 0.0 through 1.0.
 * The same table may be passed in for red, green, and blue channels. 'tableSize'
 * indicates the number of entries in each table.
 * The tables are interpolated as needed to generate the number of samples needed
 * by hardware.
 }
{
 *  CGSetDisplayTransferByTable()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGSetDisplayTransferByTable(display: CGDirectDisplayID; tableSize: CGTableCount; redTable: CGGammaValuePtr; greenTable: CGGammaValuePtr; blueTable: CGGammaValuePtr): CGDisplayErr; external name '_CGSetDisplayTransferByTable';

{
 * Get transfer tables.  Capacity should contain the number of samples each
 * array can hold, and *sampleCount is filled in with the number of samples
 * actually copied in.
 }
{
 *  CGGetDisplayTransferByTable()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGGetDisplayTransferByTable(display: CGDirectDisplayID; capacity: CGTableCount; redTable: CGGammaValuePtr; greenTable: CGGammaValuePtr; blueTable: CGGammaValuePtr; var sampleCount: CGTableCount): CGDisplayErr; external name '_CGGetDisplayTransferByTable';

{ As a convenience, allow setting of the gamma table by byte values }
{
 *  CGSetDisplayTransferByByteTable()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGSetDisplayTransferByByteTable(display: CGDirectDisplayID; tableSize: CGTableCount; redTable: CGByteValuePtr; greenTable: CGByteValuePtr; blueTable: CGByteValuePtr): CGDisplayErr; external name '_CGSetDisplayTransferByByteTable';

{ Restore gamma tables of system displays to the user's ColorSync specified values }
{
 *  CGDisplayRestoreColorSyncSettings()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
procedure CGDisplayRestoreColorSyncSettings; external name '_CGDisplayRestoreColorSyncSettings';

{ Display capture and release }
{
 *  CGDisplayIsCaptured()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGDisplayIsCaptured(display: CGDirectDisplayID): boolean_t; external name '_CGDisplayIsCaptured';

{
 *  CGDisplayCapture()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGDisplayCapture(display: CGDirectDisplayID): CGDisplayErr; external name '_CGDisplayCapture';

{
 *  CGDisplayRelease()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGDisplayRelease(display: CGDirectDisplayID): CGDisplayErr; external name '_CGDisplayRelease';


{
 * Capture all displays; this has the nice effect of providing an immersive
 * environment, and preventing other apps from trying to adjust themselves
 * to display changes only needed by your app.
 }
{
 *  CGCaptureAllDisplays()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGCaptureAllDisplays: CGDisplayErr; external name '_CGCaptureAllDisplays';

{
 * Release all captured displays, and restore the display modes to the
 * user's preferences.  May be used in conjunction with CGDisplayCapture()
 * or CGCaptureAllDisplays().
 }
{
 *  CGReleaseAllDisplays()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGReleaseAllDisplays: CGDisplayErr; external name '_CGReleaseAllDisplays';


{
 * Returns CoreGraphics raw shield window ID or NULL if not shielded
 * This value may be used with drawing surface APIs.
 }
{
 *  CGShieldingWindowID()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGShieldingWindowID(display: CGDirectDisplayID): Ptr; external name '_CGShieldingWindowID';

{
 * Returns the window level used for the shield window.
 * This value may be used with Cocoa windows to position the
 * Cocoa window in the same window level as the shield window.
 }
{
 *  CGShieldingWindowLevel()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGShieldingWindowLevel: int32_t; external name '_CGShieldingWindowLevel';

{
 * Returns base address of display or NULL for an invalid display.
 * If the display has not been captured, the returned address may refer
 * to read-only memory.
 }
{
 *  CGDisplayBaseAddress()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGDisplayBaseAddress(display: CGDirectDisplayID): Ptr; external name '_CGDisplayBaseAddress';

{
 * return address for X,Y in screen coordinates;
 *  (0,0) represents the upper left corner of the display.
 * returns NULL for an invalid display or out of bounds coordinates
 * If the display has not been captured, the returned address may refer
 * to read-only memory.
 }
{
 *  CGDisplayAddressForPosition()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGDisplayAddressForPosition(display: CGDirectDisplayID; x: CGDisplayCoord; y: CGDisplayCoord): Ptr; external name '_CGDisplayAddressForPosition';


{ Mouse Cursor controls }
{
 *  CGDisplayHideCursor()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGDisplayHideCursor(display: CGDirectDisplayID): CGDisplayErr; external name '_CGDisplayHideCursor';

{ increments hide cursor count }
{
 *  CGDisplayShowCursor()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGDisplayShowCursor(display: CGDirectDisplayID): CGDisplayErr; external name '_CGDisplayShowCursor';

{ decrements hide cursor count  }
{
 * Move the cursor to the specified point relative to the display origin
 * (the upper left corner of the display).  Returns CGDisplayNoErr on success.
 * No events are generated as a result of this move.
 * Points that would lie outside the desktop are clipped to the desktop.
 }
{
 *  CGDisplayMoveCursorToPoint()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGDisplayMoveCursorToPoint(display: CGDirectDisplayID; point: CGPoint): CGDisplayErr; external name '_CGDisplayMoveCursorToPoint';

{
 * Report the mouse position change associated with the last mouse move event
 * recieved by this application.
 }
{
 *  CGGetLastMouseDelta()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
procedure CGGetLastMouseDelta(var deltaX: CGMouseDelta; var deltaY: CGMouseDelta); external name '_CGGetLastMouseDelta';


{ Palette controls (8 bit pseudocolor only) }
{
 * Returns TRUE if the current display mode supports palettes
 }
{
 *  CGDisplayCanSetPalette()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGDisplayCanSetPalette(display: CGDirectDisplayID): boolean_t; external name '_CGDisplayCanSetPalette';

{
 * Set a palette.  The current gamma function is applied to the palette
 * elements before being loaded into hardware.
 }
{
 *  CGDisplaySetPalette()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGDisplaySetPalette(display: CGDirectDisplayID; palette: CGDirectPaletteRef): CGDisplayErr; external name '_CGDisplaySetPalette';

{
 * Wait until the beam position is outside the range specified by upperScanLine and lowerScanLine.
 * Note that if upperScanLine and lowerScanLine encompass the entire display height,
 * the function returns an error.
 * lowerScanLine must be greater than or equal to upperScanLine.
 *
 * Some display systems may not conventional video vertical and horizontal sweep in painting.
 * These displays report a kCGDisplayRefreshRate of 0 in the CFDictionaryRef returned by
 * CGDisplayCurrentMode().  On such displays, this function returns at once.
 *
 * Some drivers may not implement support for this mechanism.
 * On such displays, this function returns at once.
 *
 * Returns CGDisplayNoErr on success, and an error if display or upperScanLine and
 * lowerScanLine are invalid.
 *
 * The app should set the values of upperScanLine and lowerScanLine to allow enough lead time
 * for the drawing operation to complete.  A common strategy is to wait for the beam to pass
 * the bottom of the drawing area, allowing almost a full vertical sweep period to perform drawing.
 * To do this, set upperScanLine to 0, and set lowerScanLine to the bottom of the bounding box:
 *  lowerScanLine = (CGBeamPosition)(cgrect.origin.y + cgrect.size.height);
 *
 * IOKit may implement this as a spin-loop on the beam position call used for CGDisplayBeamPosition().
 * On such system the function is CPU bound, and subject to all the usual scheduling pre-emption.
 * In particular, attempting to wait for the beam to hit a specific scanline may be an exercise in frustration.
 *
 * These functions are advisary in nature, and depend on IOKit and hardware specific drivers to implement
 * support. If you need extremely precise timing, or access to vertical blanking interrupts,
 * you should consider writing a device driver to tie into hardware-specific capabilities.
 }
{
 *  CGDisplayWaitForBeamPositionOutsideLines()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGDisplayWaitForBeamPositionOutsideLines(display: CGDirectDisplayID; upperScanLine: CGBeamPosition; lowerScanLine: CGBeamPosition): CGDisplayErr; external name '_CGDisplayWaitForBeamPositionOutsideLines';

{
 * Returns the current beam position on the display.  If display is invalid,
 * or the display does not implement conventional video vertical and horizontal
 * sweep in painting, or the driver does not implement this functionality, 0 is returned.
 }
{
 *  CGDisplayBeamPosition()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGDisplayBeamPosition(display: CGDirectDisplayID): CGBeamPosition; external name '_CGDisplayBeamPosition';

{$ALIGN MAC68K}
{#POP}
{unit CGDirectPalette}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}


type
    CGPaletteBlendFraction              = Single;
    {
     * Convenient device color representation
     *
     * Values should be in the range from 0.0 to 1.0, where 0.0 is black, and 1.0
     * is full on for each channel.
        }
    CGDeviceColorPtr = ^CGDeviceColor;
    CGDeviceColor = record
        red:                    Single;
        green:                  Single;
        blue:                   Single;
    end;

    CGDeviceByteColorPtr = ^CGDeviceByteColor;
    CGDeviceByteColor = record
        red:                    SInt8;
        green:                  SInt8;
        blue:                   SInt8;
    end;

    {
     * Create a new palette object representing the default 8 bit color palette.
     * Release the palette using CGPaletteRelease().
        }
    {
     *  CGPaletteCreateDefaultColorPalette()
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        not available
     *    Mac OS X:         in version 10.0 and later
        }
function CGPaletteCreateDefaultColorPalette: CGDirectPaletteRef; external name '_CGPaletteCreateDefaultColorPalette';

{
 * Create a copy of the display's current palette, if any.
 * Returns NULL if the current display mode does not support a palette.
 * Release the palette using CGPaletteRelease().
 }
{
 *  CGPaletteCreateWithDisplay()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGPaletteCreateWithDisplay(display: CGDirectDisplayID): CGDirectPaletteRef; external name '_CGPaletteCreateWithDisplay';

{
 * Create a new palette with a capacity as specified.  Entries are initialized from
 * the default color palette.  Release the palette using CGPaletteRelease().
 }
{
 *  CGPaletteCreateWithCapacity()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGPaletteCreateWithCapacity(capacity: CGTableCount): CGDirectPaletteRef; external name '_CGPaletteCreateWithCapacity';

{
 * Create a new palette with a capacity and contents as specified.
 * Release the palette using CGPaletteRelease().
 }
{
 *  CGPaletteCreateWithSamples()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGPaletteCreateWithSamples(var sampleTable: CGDeviceColor; sampleCount: CGTableCount): CGDirectPaletteRef; external name '_CGPaletteCreateWithSamples';

{
 * Convenience function:
 * Create a new palette with a capacity and contents as specified.
 * Release the palette using CGPaletteRelease().
 }
{
 *  CGPaletteCreateWithByteSamples()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGPaletteCreateWithByteSamples(var sampleTable: CGDeviceByteColor; sampleCount: CGTableCount): CGDirectPaletteRef; external name '_CGPaletteCreateWithByteSamples';

{
 * Release a palette
 }
{
 *  CGPaletteRelease()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
procedure CGPaletteRelease(palette: CGDirectPaletteRef); external name '_CGPaletteRelease';

{
 * Get the color value at the specified index
 }
{
 *  CGPaletteGetColorAtIndex()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGPaletteGetColorAtIndex(palette: CGDirectPaletteRef; index: CGTableCount): CGDeviceColor; external name '_CGPaletteGetColorAtIndex';

{
 * Get the index for the specified color value
 * The index returned is for a palette color with the
 * lowest RMS error to the specified color.
 }
{
 *  CGPaletteGetIndexForColor()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGPaletteGetIndexForColor(palette: CGDirectPaletteRef; color: CGDeviceColor): CGTableCount; external name '_CGPaletteGetIndexForColor';

{
 * Get the number of samples in the palette
 }
{
 *  CGPaletteGetNumberOfSamples()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGPaletteGetNumberOfSamples(palette: CGDirectPaletteRef): CGTableCount; external name '_CGPaletteGetNumberOfSamples';


{
 * Set the color value at the specified index
 }
{
 *  CGPaletteSetColorAtIndex()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
procedure CGPaletteSetColorAtIndex(palette: CGDirectPaletteRef; color: CGDeviceColor; index: CGTableCount); external name '_CGPaletteSetColorAtIndex';

{
 * Copy a palette
 }
{
 *  CGPaletteCreateCopy()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGPaletteCreateCopy(palette: CGDirectPaletteRef): CGDirectPaletteRef; external name '_CGPaletteCreateCopy';

{
 * Compare two palettes
 }
{
 *  CGPaletteIsEqualToPalette()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGPaletteIsEqualToPalette(palette1: CGDirectPaletteRef; palette2: CGDirectPaletteRef): boolean; external name '_CGPaletteIsEqualToPalette';

{
 * Create a new palette blended with a fraction of a device color.
 * Free the resulting palette with CGPaletteRelease()
 }
{
 *  CGPaletteCreateFromPaletteBlendedWithColor()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGPaletteCreateFromPaletteBlendedWithColor(palette: CGDirectPaletteRef; fraction: CGPaletteBlendFraction; color: CGDeviceColor): CGDirectPaletteRef; external name '_CGPaletteCreateFromPaletteBlendedWithColor';

{$ALIGN MAC68K}
{#POP}
{unit OSUtils}
{$ALIGN MAC68K}







{  HandToHand and other memory utilties were moved to MacMemory.h }
{  GetTrapAddress and other trap table utilties were moved to Patches.h }
{  Date and Time utilties were moved to DateTimeUtils.h }


{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}


const
    useFree                     = 0;
    useATalk                    = 1;
    useAsync                    = 2;
    useExtClk                   = 3;                            { Externally clocked }
    useMIDI                     = 4;

    false32b                    = 0;                            { 24 bit addressing error }
    true32b                     = 1;                            { 32 bit addressing error }

                                                                {  result types for RelString Call  }
    sortsBefore                 = -1;                           { first string < second string }
    sortsEqual                  = 0;                            { first string = second string }
    sortsAfter                  = 1;                            { first string > second string }

    dummyType                   = 0;
    vType                       = 1;
    ioQType                     = 2;
    drvQType                    = 3;
    evType                      = 4;
    fsQType                     = 5;
    sIQType                     = 6;
    dtQType                     = 7;
    nmType                      = 8;


type
    QTypes                              = SignedByte;
    SysParmTypePtr = ^SysParmType;
    SysParmType = packed record
        valid:                  UInt8;
        aTalkA:                 UInt8;
        aTalkB:                 UInt8;
        config:                 UInt8;
        portA:                  SInt16;
        portB:                  SInt16;
        alarm:                  SInt32;
        font:                   SInt16;
        kbdPrint:               SInt16;
        volClik:                SInt16;
        misc:                   SInt16;
    end;

    SysPPtr                             = ^SysParmType;
    QElemPtr = ^QElem;
    QElem = record
        qLink:                  QElemPtr;
        qType:                  SInt16;
        qData:                  array [0..0] of SInt16;
    end;

    QHdrPtr = ^QHdr;
    QHdr = record
        qFlags:                 SInt16;
        qHead:                  QElemPtr;
        qTail:                  QElemPtr;
    end;


    DeferredTaskProcPtr = procedure(dtParam: SInt32);

    DeferredTaskUPP = ^SInt32; { an opaque UPP }

const
    uppDeferredTaskProcInfo = $0000B802;
    {
     *  NewDeferredTaskUPP()
     *
     *  Availability:
     *    Non-Carbon CFM:   available as macro/inline
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function NewDeferredTaskUPP(userRoutine: DeferredTaskProcPtr): DeferredTaskUPP; external name '_NewDeferredTaskUPP'; { old name was NewDeferredTaskProc }
{
 *  DisposeDeferredTaskUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeDeferredTaskUPP(userUPP: DeferredTaskUPP); external name '_DisposeDeferredTaskUPP';
{
 *  InvokeDeferredTaskUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvokeDeferredTaskUPP(dtParam: SInt32; userRoutine: DeferredTaskUPP); external name '_InvokeDeferredTaskUPP'; { old name was CallDeferredTaskProc }

type
    DeferredTaskPtr = ^DeferredTask;
    DeferredTask = record
        qLink:                  QElemPtr;
        qType:                  SInt16;
        dtFlags:                SInt16;
        dtAddr:                 DeferredTaskUPP;
        dtParam:                SInt32;
        dtReserved:             SInt32;
    end;

    MachineLocationPtr = ^MachineLocation;
    MachineLocation = record
        latitude:               Fract;
        longitude:              Fract;
        case SInt16 of
        0: (
            dlsDelta:           SInt8;                                  {  signed byte; daylight savings delta  }
            );
        1: (
            gmtDelta:           SInt32;                             {  use low 24-bits only  }
            );
    end;


    {
     *  IsMetric()
     *
     *  Availability:
     *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function IsMetric: boolean; external name '_IsMetric';
{
 *  GetSysPPtr()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetSysPPtr: SysPPtr; external name '_GetSysPPtr';
{
    NOTE: SysBeep() has been moved to Sound.h.
          We could not automatically #include Sound.h in this file
          because Sound.h indirectly #include's OSUtils.h which
          would make a circular include.
}
{
 *  DTInstall()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DTInstall(dtTaskPtr: DeferredTaskPtr): OSErr; external name '_DTInstall';


{
 *  Delay()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure Delay(numTicks: UInt32; var finalTicks: UInt32); external name '_Delay';
{
 *  WriteParam()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function WriteParam: OSErr; external name '_WriteParam';

{
 *  Enqueue()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure Enqueue(qElement: QElemPtr; qHeader: QHdrPtr); external name '_Enqueue';
{
 *  Dequeue()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function Dequeue(qElement: QElemPtr; qHeader: QHdrPtr): OSErr; external name '_Dequeue';

{
 *  InitUtil()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InitUtil: OSErr; external name '_InitUtil';
{
 *  MakeDataExecutable()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure MakeDataExecutable(baseAddress: UnivPtr; length: UInt32); external name '_MakeDataExecutable';





{
 *  ReadLocation()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure ReadLocation(var loc: MachineLocation); external name '_ReadLocation';
{
 *  WriteLocation()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure WriteLocation(const (*var*) loc: MachineLocation); external name '_WriteLocation';
{
 *  TickCount()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TickCount: UInt32; external name '_TickCount';
{
 *  CSCopyUserName()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.5 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CSCopyUserName(useShortName: boolean): CFStringRef; external name '_CSCopyUserName';

{
 *  CSCopyMachineName()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.5 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CSCopyMachineName: CFStringRef; external name '_CSCopyMachineName';



{
    NOTE: SysEnvirons is obsolete.  You should be using Gestalt.
}
{ Environs Equates }

const
    curSysEnvVers               = 2;                            { Updated to equal latest SysEnvirons version }


type
    SysEnvRecPtr = ^SysEnvRec;
    SysEnvRec = record
        environsVersion:        SInt16;
        machineType:            SInt16;
        systemVersion:          SInt16;
        processor:              SInt16;
        hasFPU:                 boolean;
        hasColorQD:             boolean;
        keyBoardType:           SInt16;
        atDrvrVersNum:          SInt16;
        sysVRefNum:             SInt16;
    end;


const
                                                                {  Machine Types  }
    envMac                      = -1;
    envXL                       = -2;
    envMachUnknown              = 0;
    env512KE                    = 1;
    envMacPlus                  = 2;
    envSE                       = 3;
    envMacII                    = 4;
    envMacIIx                   = 5;
    envMacIIcx                  = 6;
    envSE30                     = 7;
    envPortable                 = 8;
    envMacIIci                  = 9;
    envMacIIfx                  = 11;

                                                                {  CPU types  }
    envCPUUnknown               = 0;
    env68000                    = 1;
    env68010                    = 2;
    env68020                    = 3;
    env68030                    = 4;
    env68040                    = 5;

                                                                {  Keyboard types  }
    envUnknownKbd               = 0;
    envMacKbd                   = 1;
    envMacAndPad                = 2;
    envMacPlusKbd               = 3;
    envAExtendKbd               = 4;
    envStandADBKbd              = 5;
    envPrtblADBKbd              = 6;
    envPrtblISOKbd              = 7;
    envStdISOADBKbd             = 8;
    envExtISOADBKbd             = 9;




{$ALIGN MAC68K}
{#POP}
{unit PMDefinitions}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}

{ Printing objects }

type
    PMObject                            = Ptr;
    PMDialog    = ^SInt32; { an opaque 32-bit type }
    PMDialogPtr = ^PMDialog;  { when a var xx:PMDialog parameter can be nil, it is changed to xx: PMDialogPtr }
    PMPrintSettings    = ^SInt32; { an opaque 32-bit type }
    PMPrintSettingsPtr = ^PMPrintSettings;  { when a var xx:PMPrintSettings parameter can be nil, it is changed to xx: PMPrintSettingsPtr }
    PMPageFormat    = ^SInt32; { an opaque 32-bit type }
    PMPageFormatPtr = ^PMPageFormat;  { when a var xx:PMPageFormat parameter can be nil, it is changed to xx: PMPageFormatPtr }
    PMPrintContext    = ^SInt32; { an opaque 32-bit type }
    PMPrintContextPtr = ^PMPrintContext;  { when a var xx:PMPrintContext parameter can be nil, it is changed to xx: PMPrintContextPtr }
    PMPrintSession    = ^SInt32; { an opaque 32-bit type }
    PMPrintSessionPtr = ^PMPrintSession;  { when a var xx:PMPrintSession parameter can be nil, it is changed to xx: PMPrintSessionPtr }
    PMPrinter    = ^SInt32; { an opaque 32-bit type }
    PMPrinterPtr = ^PMPrinter;  { when a var xx:PMPrinter parameter can be nil, it is changed to xx: PMPrinterPtr }

const
    kPMCancel                   = $0080;                        {  user hit cancel button in dialog  }

    kPMNoData                   = nil; { for general use }
    kPMDontWantSize             = nil; { for parameters which return size information }
    kPMDontWantData             = nil; { for parameters which return data }
    kPMDontWantBoolean          = nil; { for parameters which take a boolean reference }
    kPMNoReference              = nil; { for parameters which take an address pointer }

    {    for parameters which take a PrintSettings reference    }
    kPMNoPrintSettings          = nil;

    {    for parameters which take a PageFormat reference   }
    kPMNoPageFormat             = nil;

    { for parameters which take a Server reference }
    kPMServerLocal              = nil;

type
    PMDestinationType           = UInt16;
const
    kPMDestinationInvalid       = 0;
    kPMDestinationPrinter       = 1;
    kPMDestinationFile          = 2;
    kPMDestinationFax           = 3;
    kPMDestinationPreview       = 4;

    kPMDestinationTypeDefault   = kPMDestinationPrinter;

type
    PMTag                       = UInt32;
const
                                                                {  common tags  }
    kPMCurrentValue             = $63757272 (* 'curr' *);                       {  current setting or value  }
    kPMDefaultValue             = $64666C74 (* 'dflt' *);                       {  default setting or value  }
    kPMMinimumValue             = $6D696E76 (* 'minv' *);                       {  the minimum setting or value  }
    kPMMaximumValue             = $6D617876 (* 'maxv' *);                       {  the maximum setting or value  }
                                                                {  profile tags  }
    kPMSourceProfile            = $73726370 (* 'srcp' *);                       {  source profile  }
                                                                {  resolution tags  }
    kPMMinRange                 = $6D6E7267 (* 'mnrg' *);                       {  Min range supported by a printer  }
    kPMMaxRange                 = $6D787267 (* 'mxrg' *);                       {  Max range supported by a printer  }
    kPMMinSquareResolution      = $6D696E73 (* 'mins' *);                       {  Min with X and Y resolution equal  }
    kPMMaxSquareResolution      = $6D617873 (* 'maxs' *);                       {  Max with X and Y resolution equal  }
    kPMDefaultResolution        = $64667472 (* 'dftr' *);                       {  printer default resolution  }



type
    PMOrientation               = UInt16;
const
    kPMPortrait                 = 1;
    kPMLandscape                = 2;
    kPMReversePortrait          = 3;                            {  will revert to kPortrait for current drivers  }
    kPMReverseLandscape         = 4;                            {  will revert to kLandscape for current drivers  }

{ Printer states }
type
    PMPrinterState              = UInt16;
const
    kPMPrinterIdle              = 3;
    kPMPrinterProcessing        = 4;
    kPMPrinterStopped           = 5;

    kSizeOfTPrint               = 120;                          {  size of old TPrint record  }


type
    PMColorMode                 = UInt16;
const
    kPMBlackAndWhite            = 1;
    kPMGray                     = 2;
    kPMColor                    = 3;
    kPMColorModeDuotone         = 4;                            {  2 channels  }
    kPMColorModeSpecialColor    = 5;                            {  to allow for special colors such as metalic, light cyan, etc.  }


type
    PMColorSpaceModel           = UInt32;
const
    kPMUnknownColorSpaceModel   = 0;
    kPMGrayColorSpaceModel      = 1;
    kPMRGBColorSpaceModel       = 2;
    kPMCMYKColorSpaceModel      = 3;
    kPMDevNColorSpaceModel      = 4;

    kPMColorSpaceModelCount     = 4; { total number of color space models supported }

    {    Constants to define the ColorSync Intents. These intents may be used   }
    {    to set an intent part way through a page or for an entire document.    }

type
    PMColorSyncIntent           = UInt32;
const
    kPMColorIntentUndefined     = $0000;                        {  User or application have not declared an intent, use the printer's default.  }
    kPMColorIntentAutomatic     = $0001;                        {  Automatically match for photos and graphics anywhere on the page.  }
    kPMColorIntentPhoto         = $0002;                        {  Use Photographic (cmPerceptual) intent for all contents.  }
    kPMColorIntentBusiness      = $0004;                        {  Use Business Graphics (cmSaturation) intent for all contents.  }
    kPMColorIntentRelColor      = $0008;                        {  Use Relative Colormetrics (Logo Colors) for the page.  }
    kPMColorIntentAbsColor      = $0010;                        {  Use absolute colormetric for the page.  }
    kPMColorIntentUnused        = $FFE0;                        {  Remaining bits unused at this time.  }

    {    Print quality modes "standard options"     }

type
    PMQualityMode               = UInt32;
const
    kPMQualityLowest            = $0000;                        {  Absolute lowest print quality  }
    kPMQualityInkSaver          = $0001;                        {  Saves ink but may be slower  }
    kPMQualityDraft             = $0004;                        {  Print at highest speed, ink used is secondary consideration  }
    kPMQualityNormal            = $0008;                        {  Print in printers "general usage" mode for good balance between quality and speed  }
    kPMQualityPhoto             = $000B;                        {  Optimize quality of photos on the page. Speed is not a concern  }
    kPMQualityBest              = $000D;                        {  Get best quality output for all objects and photos.  }
    kPMQualityHighest           = $000F;                        {  Absolute highest quality attained from a printers  }


    {    Constants for our "standard" paper types   }

type
    PMPaperType                 = UInt32;
const
    kPMPaperTypeUnknown         = $0000;                        {  Not sure yet what paper type we have.  }
    kPMPaperTypePlain           = $0001;                        {  Plain paper  }
    kPMPaperTypeCoated          = $0002;                        {  Has a special coating for sharper images and text  }
    kPMPaperTypePremium         = $0003;                        {  Special premium coated paper  }
    kPMPaperTypeGlossy          = $0004;                        {  High gloss special coating  }
    kPMPaperTypeTransparency    = $0005;                        {  Used for overheads  }
    kPMPaperTypeTShirt          = $0006;                        {  Used to iron on t-shirts  }

    {    Scaling alignment:     }

type
    PMScalingAlignment          = UInt16;
const
    kPMScalingPinTopLeft        = 1;
    kPMScalingPinTopRight       = 2;
    kPMScalingPinBottomLeft     = 3;
    kPMScalingPinBottomRight    = 4;
    kPMScalingCenterOnPaper     = 5;
    kPMScalingCenterOnImgArea   = 6;

    {    Duplex binding directions:     }

type
    PMDuplexBinding             = UInt16;
const
    kPMDuplexBindingLeftRight   = 1;
    kPMDuplexBindingTopDown     = 2;

    {    Layout directions:     }

type
    PMLayoutDirection           = UInt16;
const
                                                                {  Horizontal-major directions:  }
    kPMLayoutLeftRightTopBottom = 1;                            {  English reading direction.  }
    kPMLayoutLeftRightBottomTop = 2;
    kPMLayoutRightLeftTopBottom = 3;
    kPMLayoutRightLeftBottomTop = 4;                            {  Vertical-major directions:  }
    kPMLayoutTopBottomLeftRight = 5;
    kPMLayoutTopBottomRightLeft = 6;
    kPMLayoutBottomTopLeftRight = 7;
    kPMLayoutBottomTopRightLeft = 8;

    {    Page borders:  }

type
    PMBorderType                = UInt16;
const
    kPMBorderSingleHairline     = 1;
    kPMBorderDoubleHairline     = 2;
    kPMBorderSingleThickline    = 3;
    kPMBorderDoubleThickline    = 4;

    {    Useful Constants for PostScript Injection  }
    kPSPageInjectAllPages       = -1;                           {  specifies to inject on all pages  }
    kPSInjectionMaxDictSize     = 5;                            {  maximum size of a dictionary used for PSInjection  }

    {    PostScript Injection values for kPSInjectionPlacementKey   }

type
    PSInjectionPlacement        = UInt16;
const
    kPSInjectionBeforeSubsection = 1;
    kPSInjectionAfterSubsection = 2;
    kPSInjectionReplaceSubsection = 3;

    {    PostScript Injection values for kPSInjectionSectionKey     }

type
    PSInjectionSection          = SInt32;
const
                                                                {  Job  }
    kInjectionSectJob           = 1;                            {  CoverPage  }
    kInjectionSectCoverPage     = 2;

    {    PostScript Injection values for kPSInjectionSubSectionKey  }

type
    PSInjectionSubsection       = SInt32;
const
    kInjectionSubPSAdobe        = 1;                            {  %!PS-Adobe            }
    kInjectionSubPSAdobeEPS     = 2;                            {  %!PS-Adobe-3.0 EPSF-3.0     }
    kInjectionSubBoundingBox    = 3;                            {  BoundingBox           }
    kInjectionSubEndComments    = 4;                            {  EndComments           }
    kInjectionSubOrientation    = 5;                            {  Orientation           }
    kInjectionSubPages          = 6;                            {  Pages             }
    kInjectionSubPageOrder      = 7;                            {  PageOrder           }
    kInjectionSubBeginProlog    = 8;                            {  BeginProlog           }
    kInjectionSubEndProlog      = 9;                            {  EndProlog           }
    kInjectionSubBeginSetup     = 10;                           {  BeginSetup           }
    kInjectionSubEndSetup       = 11;                           {  EndSetup              }
    kInjectionSubBeginDefaults  = 12;                           {  BeginDefaults        }
    kInjectionSubEndDefaults    = 13;                           {  EndDefaults           }
    kInjectionSubDocFonts       = 14;                           {  DocumentFonts        }
    kInjectionSubDocNeededFonts = 15;                           {  DocumentNeededFonts        }
    kInjectionSubDocSuppliedFonts = 16;                         {  DocumentSuppliedFonts   }
    kInjectionSubDocNeededRes   = 17;                           {  DocumentNeededResources     }
    kInjectionSubDocSuppliedRes = 18;                           {  DocumentSuppliedResources }
    kInjectionSubDocCustomColors = 19;                          {  DocumentCustomColors      }
    kInjectionSubDocProcessColors = 20;                         {  DocumentProcessColors   }
    kInjectionSubPlateColor     = 21;                           {  PlateColor           }
    kInjectionSubPageTrailer    = 22;                           {  PageTrailer            }
    kInjectionSubTrailer        = 23;                           {  Trailer               }
    kInjectionSubEOF            = 24;                           {  EOF                  }
    kInjectionSubBeginFont      = 25;                           {  BeginFont           }
    kInjectionSubEndFont        = 26;                           {  EndFont               }
    kInjectionSubBeginResource  = 27;                           {  BeginResource        }
    kInjectionSubEndResource    = 28;                           {  EndResource           }
    kInjectionSubPage           = 29;                           {  Page                }
    kInjectionSubBeginPageSetup = 30;                           {  BeginPageSetup         }
    kInjectionSubEndPageSetup   = 31;                           {  EndPageSetup           }

type
    PMPPDDomain                 = UInt16;
const
    kAllPPDDomains              = 1;
    kSystemPPDDomain            = 2;
    kLocalPPDDomain             = 3;
    kNetworkPPDDomain           = 4;
    kUserPPDDomain              = 5;
    kCUPSPPDDomain              = 6;

    {    Description types  }
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kPMPPDDescriptionType CFSTRP('PMPPDDescriptionType')}
{$endc}
    {    Document format strings    }
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kPMDocumentFormatDefault CFSTRP('com.apple.documentformat.default')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kPMDocumentFormatPDF CFSTRP('application/pdf')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kPMDocumentFormatPICT CFSTRP('application/vnd.apple.printing-pict')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kPMDocumentFormatPICTPS CFSTRP('application/vnd.apple.printing-pict-ps')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kPMDocumentFormatPICTPSwPSNormalizer CFSTRP('application/vnd.apple.printing-pict-ps-viapsnormalizer')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kPMDocumentFormatPostScript CFSTRP('application/postscript')}
{$endc}
    {    Graphic context strings    }
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kPMGraphicsContextDefault CFSTRP('com.apple.graphicscontext.default')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kPMGraphicsContextQuickdraw CFSTRP('com.apple.graphicscontext.quickdraw')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kPMGraphicsContextCoreGraphics CFSTRP('com.apple.graphicscontext.coregraphics')}
{$endc}
    {    Data format strings    }
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kPMDataFormatPS CFSTRP('application/postscript')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kPMDataFormatPDF CFSTRP('application/pdf')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kPMDataFormatPICT CFSTRP('application/vnd.apple.printing-pict-ps')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kPMDataFormatPICTwPS CFSTRP('application/vnd.apple.printing-pict-ps')}
{$endc}
    {    PostScript Injection Dictionary Keys   }
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kPSInjectionSectionKey CFSTRP('section')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kPSInjectionSubSectionKey CFSTRP('subsection')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kPSInjectionPageKey CFSTRP('page')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kPSInjectionPlacementKey CFSTRP('place')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kPSInjectionPostScriptKey CFSTRP('psdata')}
{$endc}
    {    PDF Workflow Keys  }
{ kPDFWorkFlowItemURLKey          CFSTR("itemURL"); defined in GPCMacros.inc }
{ kPDFWorkflowForlderURLKey       CFSTR("folderURL"); defined in GPCMacros.inc }
{ kPDFWorkflowDisplayNameKey      CFSTR("displayName"); defined in GPCMacros.inc }
{ kPDFWorkflowItemsKey            CFSTR("items"); defined in GPCMacros.inc }
    {    OSStatus return codes  }
    kPMNoError                  = 0;
    kPMGeneralError             = -30870;
    kPMOutOfScope               = -30871;                       {  an API call is out of scope  }
    kPMInvalidParameter         = -50;                          {  a required parameter is missing or invalid  }
    kPMNoDefaultPrinter         = -30872;                       {  no default printer selected  }
    kPMNotImplemented           = -30873;                       {  this API call is not supported  }
    kPMNoSuchEntry              = -30874;                       {  no such entry  }
    kPMInvalidPrintSettings     = -30875;                       {  the printsettings reference is invalid  }
    kPMInvalidPageFormat        = -30876;                       {  the pageformat reference is invalid  }
    kPMValueOutOfRange          = -30877;                       {  a value passed in is out of range  }
    kPMLockIgnored              = -30878;                       {  the lock value was ignored  }

    kPMInvalidPrintSession      = -30879;                       {  the print session is invalid  }
    kPMInvalidPrinter           = -30880;                       {  the printer reference is invalid  }
    kPMObjectInUse              = -30881;                       {  the object is in use  }
    kPMInvalidPreset            = -30882;                       {  the preset is invalid }


    kPMPrintAllPages            = -1;

    kPMUnlocked                 = false;
    kPMLocked                   = true;


type
    PMRectPtr = ^PMRect;
    PMRect = record
        top:                    Double;
        left:                   Double;
        bottom:                 Double;
        right:                  Double;
    end;

    PMResolutionPtr = ^PMResolution;
    PMResolution = record
        hRes:                   Double;
        vRes:                   Double;
    end;

    PMLanguageInfoPtr = ^PMLanguageInfo;
    PMLanguageInfo = record
        level:                  Str32;
        version:                Str32;
        release:                Str32;
    end;

    PMPaperMargins = PMRect;

{$ALIGN MAC68K}
{#POP}
{unit Scrap}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}

{
    ________________________________________________________________
    UNIVERSAL SCRAP MANAGER INTERFACES
    ________________________________________________________________
    The following interfaces are available when compiling for BOTH
    Carbon AND Mac OS 8.
    ________________________________________________________________
}
{
    While we're in here mucking about, we defined a new type to
    to put some confusion to rest. The old calls, as well as the
    new calls, use the new type. Existing clients should be
    blissfully ignorant.
}


type
    ScrapFlavorType                     = FourCharCode;
    {
        Newsflash! After 15 years of arduous toil, it's finally possible
        for specially trained typists wielding advanced text editing
        technology to define symbolic names for commonly used scrap
        flavor type constants! Apple triumphs again!
    }

const
    kScrapFlavorTypePicture     = $50494354 (* 'PICT' *);                       {  contents of a PicHandle }
    kScrapFlavorTypeText        = $54455854 (* 'TEXT' *);                       {  stream of characters }
    kScrapFlavorTypeTextStyle   = $7374796C (* 'styl' *);                       {  see TEGetStyleScrapHandle }
    kScrapFlavorTypeMovie       = $6D6F6F76 (* 'moov' *);                       {  reference to a movie }
    kScrapFlavorTypeSound       = $736E6420 (* 'snd ' *);                       {  see SndRecord and SndPlay }
    kScrapFlavorTypeUnicode     = $75747874 (* 'utxt' *);                       {  stream of UTF16 characters }
    kScrapFlavorTypeUnicodeStyle = $7573746C (* 'ustl' *);                      {  ATSUI defines; Textension uses }

    {
        If you are a Carbon client and you need to run on Mac OS 8,
        you may still need to load and unload the scrap. Under Mac OS
        X, the scrap is held by the pasteboard server instead of in a
        handle in your app's heap, so LoadScrap and UnloadScrap do
        nothing when called under Mac OS X.
    }

    {
     *  LoadScrap()
     *
     *  Availability:
     *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function LoadScrap: OSStatus; external name '_LoadScrap';
{
 *  UnloadScrap()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function UnloadScrap: OSStatus; external name '_UnloadScrap';



const
    kScrapFlavorSizeUnknown     = -1;

    {
        kScrapReservedFlavorType is a flavor type which is reserved
        for use by Scrap Manager. If you pass it to Scrap Manager,
        it will be rejected.
    }

    kScrapReservedFlavorType    = $73726674 (* 'srft' *);

    {
        We've added scrap flavor flags ala Drag Manager.

        kScrapFlavorMaskNone means you want none of the flags.

        kScrapFlavorSenderOnlyMask means only the process which
        put the flavor on the scrap can see it. If some other
        process put a flavor with this flag on the scrap,
        your process will never see the flavor, so there's
        no point in testing for this flag.

        kScrapFlavorTranslated means the flavor was translated
        from some other flavor in the scrap by Translation Manager.
        Most callers should not care about this bit.
        }
    kScrapFlavorMaskNone        = $00000000;
    kScrapFlavorMaskSenderOnly  = $00000001;
    kScrapFlavorMaskTranslated  = $00000002;


type
    ScrapFlavorFlags                    = UInt32;
    {
        ScrapFlavorInfo describes a single flavor within
        a scrap.
    }
    ScrapFlavorInfoPtr = ^ScrapFlavorInfo;
    ScrapFlavorInfo = record
        flavorType:             ScrapFlavorType;
        flavorFlags:            ScrapFlavorFlags;
    end;

    ScrapRef    = ^SInt32; { an opaque 32-bit type }
    ScrapRefPtr = ^ScrapRef;  { when a var xx:ScrapRef parameter can be nil, it is changed to xx: ScrapRefPtr }
    {
        Defined Apple scrap names for GetScrapByName
        kScrapClipboardScrap    traditional clipboard scrap
        kScrapFindScrap         compatible with Cocoa's global find scrap
    }
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kScrapClipboardScrap CFSTRP('com.apple.scrap.clipboard')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kScrapFindScrap CFSTRP('com.apple.scrap.find')}
{$endc}

    {   Enumerated options to be passed to GetScrapByName }


const
    kScrapGetNamedScrap         = 0;                            {  get current named scrap without bumping }
    kScrapClearNamedScrap       = $00000001;                    {  acquire the named scrap, bumping and clearing }

    {
        GetScrapByName allows access to an indefinite number of public or private
        scraps.  The constant kScrapClipboardScrap refers to the "current" scrap
        we've all come to know and love.  kScrapFindScrap allows Carbon apps to
        interact seamlessly with Cocoa's global find scrap.  Note that calling:

            GetScrapByName( kScrapClipboardScrap, kScrapGetNamedScrap, &scrap );

        is an exact match to the call:

            GetCurrentScrap( &scrap );

        Additionally, a call to:

            GetScrapByName( kScrapClipboardScrap, kScrapClearNamedScrap, &scrap );

        is a replacement for the sequence:

            ClearCurrentScrap();
            GetCurrentScrap( &scrap );

        You can use this API to generate your own private scraps to use as a high
        level interprocess communication between your main and helper apps.  The Java
        naming convention is suggested for your scraps ( ie. com.joeco.scrap.secret ).

        CarbonLib does not support arbitrary named scraps; when calling this API on
        CarbonLib, kScrapClipboardScrap is the only supported value for the name parameter.
        }
    {
     *  GetScrapByName()
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.5 and later
     *    Mac OS X:         in version 10.1 and later
        }
function GetScrapByName(name: CFStringRef; options: OptionBits; var scrap: ScrapRef): OSStatus; external name '_GetScrapByName';

{
    GetCurrentScrap obtains a reference to the current scrap.
    The ScrapRef obtained via GetCurrentScrap will become
    invalid and unusable after the scrap is cleared.
}

{
 *  GetCurrentScrap()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetCurrentScrap(var scrap: ScrapRef): OSStatus; external name '_GetCurrentScrap';

{
    GetScrapFlavorFlags tells you [a] whether the scrap contains
    data for a particular flavor and [b] some things about that
    flavor if it exists. This call never blocks, and is useful
    for deciding whether to enable the Paste item in your Edit
    menu, among other things.
}

{
 *  GetScrapFlavorFlags()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetScrapFlavorFlags(scrap: ScrapRef; flavorType: ScrapFlavorType; var flavorFlags: ScrapFlavorFlags): OSStatus; external name '_GetScrapFlavorFlags';

{
    GetScrapFlavorSize gets the size of the data of the specified
    flavor. This function blocks until the specified flavor
    data is available. GetScrapFlavorSize is intended as a prelude
    to allocating memory and calling GetScrapFlavorData.
}

{
 *  GetScrapFlavorSize()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetScrapFlavorSize(scrap: ScrapRef; flavorType: ScrapFlavorType; var byteCount: Size): OSStatus; external name '_GetScrapFlavorSize';

{
    GetScrapFlavorData gets the data from the specified flavor in the
    specified scrap. This function blocks until the specified flavor
    data is available. Specify the maximum size your buffer can contain;
    on output, this function produces the number of bytes that were
    available (even if this is more than you requested).
}

{
 *  GetScrapFlavorData()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetScrapFlavorData(scrap: ScrapRef; flavorType: ScrapFlavorType; var byteCount: Size; destination: UnivPtr): OSStatus; external name '_GetScrapFlavorData';

{
    ClearCurrentScrap clears the current scrap. Call this
    first when the user requests a Copy or Cut operation --
    even if you maintain a private scrap! You should not wait
    until receiving a suspend event to call ClearCurrentScrap. Call
    it immediately after the user requests a Copy or Cut operation.
    You don't need to put any data on the scrap immediately (although
    it's perfectly fine to do so). You DO need to call GetCurrentScrap
    after ClearCurrentScrap so you'll have a valid ScrapRef to pass
    to other functions.
}

{
 *  ClearCurrentScrap()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ClearCurrentScrap: OSStatus; external name '_ClearCurrentScrap';

{
        ClearScrap will clear the scrap passed in and return the bumped
        ScrapRef value. ClearScrap behaves similarly to GetScrapByName
        when called with the kScrapClearNamedScrap option with the
        benefit of not requiring a name in the event one is not available.

        CarbonLib does not support arbitrary named scraps; when calling this
        API on CarbonLib, only clearing the current scrap is supported.
}
{
 *  ClearScrap()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.5 and later
 *    Mac OS X:         in version 10.1 and later
 }
function ClearScrap(var inOutScrap: ScrapRef): OSStatus; external name '_ClearScrap';


{
        PutScrapFlavor is a lot like PutScrap, with two differences:
        we added a ScrapRef parameter at the beginning and you can
        "promise" various aspects of a flavor. If you pass a NIL
        data pointer, this is a promise that in the future you
        will provide data for this flavor. Provide the data
        through a subsequent call to PutScrapFlavor, either later
        in the same code flow or during a scrap promise keeper proc.
        If you know how big the data is, you can pass the size as
        well, and this may allow subsequent callers of GetScrapFlavorInfo
        to avoid blocking. If you don't know the size, pass -1.
        If you pass a 0 size, you are telling Scrap Manager not to
        expect any data for this flavor. In this case, the flavor
        data pointer is ignored. NOTE: the last time you can provide
        scrap flavor data is when your scrap promise keeper gets
        called. It is NOT possible to call PutScrapFlavor while
        handling a suspend event; suspend events under Carbon
        simply don't work the way they do under Mac OS 8.

        The method for setting Scrap Manager promises differs from that for Drag Manger promises.
        This chart describes the method for setting scrap promises via PutScrapFlavor().

        dataPtr         dataSize                                result
     pointer value  actual data size    The data of size dataSize pointed to by dataPtr is added to the scrap.
           0        actual data size    A promise for data of size dataSize is placed on the scrap.
           0               -1           A promise for data of an undetermined size is placed on the scrap.
        ignored             0           A flavor with no data expected is placed on the scrap.  This is not a promise.
}
{
 *  PutScrapFlavor()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PutScrapFlavor(scrap: ScrapRef; flavorType: ScrapFlavorType; flavorFlags: ScrapFlavorFlags; flavorSize: Size; flavorData: UnivPtr): OSStatus; external name '_PutScrapFlavor';

{
    ScrapPromiseKeeper is a function you write which is called by
    Scrap Manager as needed to keep your earlier promise of a
    particular scrap flavor. When your function is called, deliver
    the requested data by calling PutScrapFlavor.
}


type
    ScrapPromiseKeeperProcPtr = function(scrap: ScrapRef; flavorType: ScrapFlavorType; userData: UnivPtr): OSStatus;

    ScrapPromiseKeeperUPP = ^SInt32; { an opaque UPP }

const
    uppScrapPromiseKeeperProcInfo = $00000FF0;
    {
     *  NewScrapPromiseKeeperUPP()
     *
     *  Availability:
     *    Non-Carbon CFM:   available as macro/inline
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function NewScrapPromiseKeeperUPP(userRoutine: ScrapPromiseKeeperProcPtr): ScrapPromiseKeeperUPP; external name '_NewScrapPromiseKeeperUPP'; { old name was NewScrapPromiseKeeperProc }
{
 *  DisposeScrapPromiseKeeperUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeScrapPromiseKeeperUPP(userUPP: ScrapPromiseKeeperUPP); external name '_DisposeScrapPromiseKeeperUPP';
{
 *  InvokeScrapPromiseKeeperUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeScrapPromiseKeeperUPP(scrap: ScrapRef; flavorType: ScrapFlavorType; userData: UnivPtr; userRoutine: ScrapPromiseKeeperUPP): OSStatus; external name '_InvokeScrapPromiseKeeperUPP'; { old name was CallScrapPromiseKeeperProc }
{
    SetScrapPromiseKeeper associates a ScrapPromiseKeeper with a
    scrap. You can remove a ScrapPromiseKeeper from a scrap by
    passing a NIL ScrapPromiseKeeper to SetScrapPromiseKeeper.
    Pass whatever you like in the last parameter; its value will
    be passed to your ScrapPromiseKeeper, which can do whatever
    it likes with the value. You might choose to pass a pointer
    or handle to some private scrap data which the
    ScrapPromiseKeeper could use in fabricating one or more
    promised flavors.
}
{
 *  SetScrapPromiseKeeper()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetScrapPromiseKeeper(scrap: ScrapRef; upp: ScrapPromiseKeeperUPP; userData: UnivPtr): OSStatus; external name '_SetScrapPromiseKeeper';

{
    GetScrapFlavorCount produces the number of
    items which can be obtained by GetScrapFlavorInfoList.
}

{
 *  GetScrapFlavorCount()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetScrapFlavorCount(scrap: ScrapRef; var infoCount: UInt32): OSStatus; external name '_GetScrapFlavorCount';

{
    GetScrapFlavorInfoList fills a list (array)
    of items which each describe the corresponding
    flavor in the scrap. It fills no more array
    elements as are specified. On exit, it produces
    the count of elements it filled (which may be
    smaller than the count requested). Yes, YOU
    must provide the memory for the array.
}

{
 *  GetScrapFlavorInfoList()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetScrapFlavorInfoList(scrap: ScrapRef; var infoCount: UInt32; info: ScrapFlavorInfoPtr): OSStatus; external name '_GetScrapFlavorInfoList';


{
    CallInScrapPromises forces all promises to be kept.
    If your application promises at least one flavor
    AND it does NOT adopt the new event model, you
    should call this function when your application
    is about to quit. If your app promises no flavors,
    there is no need to call this function, and if
    your app adopts the new event model, this function
    will be called automagically for you. It doesn't
    hurt to call this function more than once, though
    promise keepers may be asked to keep promises
    they already tried and failed.
}

{
 *  CallInScrapPromises()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CallInScrapPromises: OSStatus; external name '_CallInScrapPromises';

{$ALIGN MAC68K}
{#POP}
{unit Timer}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}


const
                                                                {  high bit of qType is set if task is active  }
    kTMTaskActive               = $00008000;


type
    TMTaskPtr = ^TMTask;
    TimerProcPtr = procedure(tmTaskPtr: TMTaskPtr);

    TimerUPP = ^SInt32; { an opaque UPP }
    TMTask = record
        qLink:                  QElemPtr;
        qType:                  SInt16;
        tmAddr:                 TimerUPP;
        tmCount:                SInt32;
        tmWakeUp:               SInt32;
        tmReserved:             SInt32;
    end;

    {
     *  InsTime()
     *
     *  Availability:
     *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
procedure InsTime(tmTaskPtr: QElemPtr); external name '_InsTime';
{
 *  InsXTime()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InsXTime(tmTaskPtr: QElemPtr); external name '_InsXTime';
{
 *  PrimeTime()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure PrimeTime(tmTaskPtr: QElemPtr; count: SInt32); external name '_PrimeTime';
{
 *  RmvTime()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure RmvTime(tmTaskPtr: QElemPtr); external name '_RmvTime';
{ InstallTimeTask, InstallXTimeTask, PrimeTimeTask and RemoveTimeTask work }
{ just like InsTime, InsXTime, PrimeTime, and RmvTime except that they }
{ return an OSErr result. }
{
 *  InstallTimeTask()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.1 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InstallTimeTask(tmTaskPtr: QElemPtr): OSErr; external name '_InstallTimeTask';
{
 *  InstallXTimeTask()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.1 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InstallXTimeTask(tmTaskPtr: QElemPtr): OSErr; external name '_InstallXTimeTask';
{
 *  PrimeTimeTask()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.1 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PrimeTimeTask(tmTaskPtr: QElemPtr; count: SInt32): OSErr; external name '_PrimeTimeTask';
{
 *  RemoveTimeTask()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.1 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
function RemoveTimeTask(tmTaskPtr: QElemPtr): OSErr; external name '_RemoveTimeTask';
{
 *  Microseconds()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure Microseconds(var microTickCount: UnsignedWide); external name '_Microseconds';
const
    uppTimerProcInfo = $0000B802;
    {
     *  NewTimerUPP()
     *
     *  Availability:
     *    Non-Carbon CFM:   available as macro/inline
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function NewTimerUPP(userRoutine: TimerProcPtr): TimerUPP; external name '_NewTimerUPP'; { old name was NewTimerProc }
{
 *  DisposeTimerUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeTimerUPP(userUPP: TimerUPP); external name '_DisposeTimerUPP';
{
 *  InvokeTimerUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvokeTimerUPP(tmTaskPtr: TMTaskPtr; userRoutine: TimerUPP); external name '_InvokeTimerUPP'; { old name was CallTimerProc }


{$ALIGN MAC68K}
{#POP}
{unit ABAddressBook}
{$ALIGN MAC68K}






type
    ABRecordRef    = ^SInt32; { an opaque 32-bit type }
    ABPersonRef    = ^SInt32; { an opaque 32-bit type }
    ABGroupRef    = ^SInt32; { an opaque 32-bit type }
    ABSearchElementRef    = ^SInt32; { an opaque 32-bit type }
    ABAddressBookRef    = ^SInt32; { an opaque 32-bit type }
    ABMultiValueRef    = ^SInt32; { an opaque 32-bit type }
    ABMutableMultiValueRef    = ^SInt32; { an opaque 32-bit type }

// --------------------------------------------------------------------------------
//  LSOpenCFURLRef support
// --------------------------------------------------------------------------------
// An application can open the AddressBook app and select (and edit) a specific
// person by using the LSOpenCFURLRef API.
//
// To launch (or bring to front) the Address Book app and select a given person
//
// CFStringRef uniqueId = ABRecordCopyUniqueId(aPerson);
// CFStringRef urlString = CFStringCreateWithFormat(NULL, CFSTR(addressbook://%@), uniqueId);
// CFURLRef urlRef = CFURLCreateWithString(NULL, urlString, NULL);
// LSOpenCFURLRef(urlRef, NULL);
// CFRelease(uniqueId);
// CFRelease(urlRef);
// CFRelease(urlString);
//
// To launch (or bring to front) the Address Book app and edit a given person
//
// CFStringRef uniqueId = ABRecordCopyUniqueId(aPerson);
// CFStringRef urlString = CFStringCreateWithFormat(NULL, CFSTR(addressbook://%@?edit), uniqueId);
// CFURLRef urlRef = CFURLCreateWithString(NULL, urlString, NULL);
// LSOpenCFURLRef(urlRef, NULL);
// CFRelease(uniqueId);
// CFRelease(urlRef);
// CFRelease(urlString);

// --------------------------------------------------------------------------------
//      AddressBook
// --------------------------------------------------------------------------------

    // --- There is only one Address Book
function ABGetSharedAddressBook: ABAddressBookRef; external name '_ABGetSharedAddressBook';

    // --- Searching
function ABCopyArrayOfMatchingRecords( addressBook: ABAddressBookRef; search: ABSearchElementRef ): CFArrayRef; external name '_ABCopyArrayOfMatchingRecords';

    // --- Saving
function ABSave( addressBook: ABAddressBookRef ): Boolean; external name '_ABSave';
function ABHasUnsavedChanges( addressBook: ABAddressBookRef ): Boolean; external name '_ABHasUnsavedChanges';

    // --- Me
function ABGetMe( addressBook: ABAddressBookRef ): ABPersonRef; external name '_ABGetMe'; // Not retain???
procedure ABSetMe( addressBook: ABAddressBookRef; moi: ABPersonRef ); external name '_ABSetMe';

    // Returns the record class Name for a particular uniqueId
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function ABCopyRecordTypeFromUniqueId( addressBook: ABAddressBookRef; uniqueId: CFStringRef ): CFStringRef; external name '_ABCopyRecordTypeFromUniqueId';

    // --- Properties
    // Property names must be unique for a record type
function ABAddPropertiesAndTypes( addressBook: ABAddressBookRef; recordType: CFStringRef; propertiesAnTypes: CFDictionaryRef ): SInt32; external name '_ABAddPropertiesAndTypes';
function ABRemoveProperties( addressBook: ABAddressBookRef; recordType: CFStringRef; properties: CFArrayRef ): SInt32; external name '_ABRemoveProperties';
function ABCopyArrayOfPropertiesForRecordType( addressBook: ABAddressBookRef; recordType: CFStringRef ): CFArrayRef; external name '_ABCopyArrayOfPropertiesForRecordType';
function ABTypeOfProperty( addressBook: ABAddressBookRef; recordType: CFStringRef; proprty: CFStringRef ): ABPropertyType; external name '_ABTypeOfProperty';

    // --- Records (Person, Group)
function ABCopyRecordForUniqueId( addressBook: ABAddressBookRef; uniqueId: CFStringRef ): ABRecordRef; external name '_ABCopyRecordForUniqueId';
function ABAddRecord( addressBook: ABAddressBookRef; recrd: ABRecordRef ): Boolean; external name '_ABAddRecord';
function ABRemoveRecord( addressBook: ABAddressBookRef; recrd: ABRecordRef ): Boolean; external name '_ABRemoveRecord';

    // --- People
function ABCopyArrayOfAllPeople( addressBook: ABAddressBookRef ): CFArrayRef; external name '_ABCopyArrayOfAllPeople';                  // Array of ABPerson

    // --- Groups
function ABCopyArrayOfAllGroups( addressBook: ABAddressBookRef ): CFArrayRef; external name '_ABCopyArrayOfAllGroups';                  // Array of ABGroup

// --------------------------------------------------------------------------------
//      ABRecord
// --------------------------------------------------------------------------------

function ABRecordCopyRecordType( recrd: ABRecordRef ): CFStringRef; external name '_ABRecordCopyRecordType';

    // --- Property value
function ABRecordCopyValue( recrd: ABRecordRef; proprty: CFStringRef ): CFTypeRef; external name '_ABRecordCopyValue';
    // returns a CFDictionary for multi-value properties
function ABRecordSetValue( recrd: ABRecordRef; proprty: CFStringRef; value: CFTypeRef ): Boolean; external name '_ABRecordSetValue';
    // takes a CFDictionary for multi-value properties
function ABRecordRemoveValue( recrd: ABRecordRef; proprty: CFStringRef ): Boolean; external name '_ABRecordRemoveValue';

    // ---- Unique ID access convenience
function ABRecordCopyUniqueId( recrd: ABRecordRef ): CFStringRef; external name '_ABRecordCopyUniqueId';

// --------------------------------------------------------------------------------
//      ABPerson
// --------------------------------------------------------------------------------

function ABPersonCreate: ABPersonRef; external name '_ABPersonCreate';

function ABPersonCreateWithVCardRepresentation( vCard: CFDataRef ): ABPersonRef; external name '_ABPersonCreateWithVCardRepresentation';
function ABPersonCopyVCardRepresentation( person: ABPersonRef ): CFDataRef; external name '_ABPersonCopyVCardRepresentation';

function ABPersonCopyParentGroups( person: ABPersonRef ): CFArrayRef; external name '_ABPersonCopyParentGroups'; // Groups this person belongs to

    // --- Search elements
function ABPersonCreateSearchElement( proprty: CFStringRef; labl: CFStringRef; key: CFStringRef; value: CFTypeRef; comparison: ABSearchComparison ): ABSearchElementRef; external name '_ABPersonCreateSearchElement';

// --------------------------------------------------------------------------------
//      ABGroups
// --------------------------------------------------------------------------------

function ABGroupCreate: ABGroupRef; external name '_ABGroupCreate';

    // --- Dealing with Persons
function ABGroupCopyArrayOfAllMembers( group: ABGroupRef ): CFArrayRef; external name '_ABGroupCopyArrayOfAllMembers';
function ABGroupAddMember( group: ABGroupRef; personToAdd: ABPersonRef ): Boolean; external name '_ABGroupAddMember';
function ABGroupRemoveMember( group: ABGroupRef; personToRemove: ABPersonRef ): Boolean; external name '_ABGroupRemoveMember';

    // --- Dealing with Groups
function ABGroupCopyArrayOfAllSubgroups( group: ABGroupRef ): CFArrayRef; external name '_ABGroupCopyArrayOfAllSubgroups';
function ABGroupAddGroup( group: ABGroupRef; groupToAdd: ABGroupRef ): Boolean; external name '_ABGroupAddGroup';
function ABGroupRemoveGroup( group: ABGroupRef; groupToRemove: ABGroupRef ): Boolean; external name '_ABGroupRemoveGroup';

    // --- Dealong with Parents
function ABGroupCopyParentGroups( group: ABGroupRef ): CFArrayRef; external name '_ABGroupCopyParentGroups';

    // --- Distribution list
function ABGroupSetDistributionIdentifier( group: ABGroupRef; person: ABPersonRef; proprty: CFStringRef; identifier: CFStringRef ): Boolean; external name '_ABGroupSetDistributionIdentifier';
function ABGroupCopyDistributionIdentifier( group: ABGroupRef; person: ABPersonRef; proprty: CFStringRef ): CFStringRef; external name '_ABGroupCopyDistributionIdentifier';

    // --- Search elements
function ABGroupCreateSearchElement( proprty: CFStringRef; labl: CFStringRef; key: CFStringRef; value: CFTypeRef; comparison: ABSearchComparison ): ABSearchElementRef; external name '_ABGroupCreateSearchElement';

// --------------------------------------------------------------------------------
//      ABSearchElement
// --------------------------------------------------------------------------------

function ABSearchElementCreateWithConjunction( conjunction: ABSearchConjunction; childrenSearchElement: CFArrayRef ): ABSearchElementRef; external name '_ABSearchElementCreateWithConjunction';

function ABSearchElementMatchesRecord( searchElement: ABSearchElementRef; recrd: ABRecordRef ): Boolean; external name '_ABSearchElementMatchesRecord';

// --------------------------------------------------------------------------------
//      ABMultiValue
// --------------------------------------------------------------------------------

function ABMultiValueCreate: ABMultiValueRef; external name '_ABMultiValueCreate';
function ABMultiValueCount( multiValue: ABMultiValueRef ): UInt32; external name '_ABMultiValueCount';
function ABMultiValueCopyValueAtIndex( multiValue: ABMultiValueRef; index: SInt32 ): CFTypeRef; external name '_ABMultiValueCopyValueAtIndex';
function ABMultiValueCopyLabelAtIndex( multiValue: ABMultiValueRef; index: SInt32 ): CFStringRef; external name '_ABMultiValueCopyLabelAtIndex';
function ABMultiValueCopyPrimaryIdentifier( multiValue: ABMultiValueRef ): CFStringRef; external name '_ABMultiValueCopyPrimaryIdentifier';
function ABMultiValueIndexForIdentifier( multiValue: ABMultiValueRef; identifier: CFStringRef ): SInt32; external name '_ABMultiValueIndexForIdentifier';
function ABMultiValueCopyIdentifierAtIndex( multiValue: ABMultiValueRef; index: SInt32 ): CFStringRef; external name '_ABMultiValueCopyIdentifierAtIndex';
function ABMultiValuePropertyType( multiValue: ABMultiValueRef ): ABPropertyType; external name '_ABMultiValuePropertyType';
function ABMultiValueCreateCopy( multiValue: ABMultiValueRef ): ABMultiValueRef; external name '_ABMultiValueCreateCopy';

// --------------------------------------------------------------------------------
//      ABMutableMultiValue
// --------------------------------------------------------------------------------

function ABMultiValueCreateMutable: ABMutableMultiValueRef; external name '_ABMultiValueCreateMutable';
function ABMultiValueAdd( multiValue: ABMutableMultiValueRef; value: CFTypeRef; labl: CFStringRef; var outIdentifier: CFStringRef ): Boolean; external name '_ABMultiValueAdd';
function ABMultiValueInsert( multiValue: ABMutableMultiValueRef; value: CFTypeRef; labl: CFStringRef; index: SInt32; var outIdentifier: CFStringRef ): Boolean; external name '_ABMultiValueInsert';
function ABMultiValueRemove( multiValue: ABMutableMultiValueRef; index: SInt32 ): Boolean; external name '_ABMultiValueRemove';
function ABMultiValueReplaceValue( multiValue: ABMutableMultiValueRef; value: CFTypeRef; index: SInt32 ): Boolean; external name '_ABMultiValueReplaceValue';
function ABMultiValueReplaceLabel( multiValue: ABMutableMultiValueRef; labl: CFStringRef; index: SInt32 ): Boolean; external name '_ABMultiValueReplaceLabel';
function ABMultiValueSetPrimaryIdentifier( multiValue: ABMutableMultiValueRef; identifier: CFStringRef ): Boolean; external name '_ABMultiValueSetPrimaryIdentifier';
function ABMultiValueCreateMutableCopy( multiValue: ABMultiValueRef ): ABMutableMultiValueRef; external name '_ABMultiValueCreateMutableCopy';

// --------------------------------------------------------------------------------
//      Localization of properties or labels
// --------------------------------------------------------------------------------

function ABCopyLocalizedPropertyOrLabel( labelOrProperty: CFStringRef ): CFStringRef; external name '_ABCopyLocalizedPropertyOrLabel';

// --- Address formatting
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function ABCreateFormattedAddressFromDictionary( addressBook: ABAddressBookRef; address: CFDictionaryRef ): CFStringRef; external name '_ABCreateFormattedAddressFromDictionary';
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function ABCopyDefaultCountryCode( addressBook: ABAddressBookRef ): CFStringRef; external name '_ABCopyDefaultCountryCode';

// --------------------------------------------------------------------------------
//      Person Image Loading
// --------------------------------------------------------------------------------

function ABPersonSetImageData( person: ABPersonRef; imageData: CFDataRef ): Boolean; external name '_ABPersonSetImageData';
function ABPersonCopyImageData( person: ABPersonRef ): CFDataRef; external name '_ABPersonCopyImageData';

type ABImageClientCallback = procedure ( imageData: CFDataRef; tag: SInt32; refcon: UnivPtr );

function ABBeginLoadingImageDataForClient( person: ABPersonRef; callback: ABImageClientCallback; refcon: UnivPtr ): SInt32; external name '_ABBeginLoadingImageDataForClient';
procedure ABCancelLoadingImageDataForTag( tag: SInt32 ); external name '_ABCancelLoadingImageDataForTag';
{unit CFCharacterSet}
{$ALIGN MAC68K}










{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}


type
    CFCharacterSetRef    = ^SInt32; { an opaque 32-bit type }
    CFCharacterSetRefPtr = ^CFCharacterSetRef;  { when a var xx:CFCharacterSetRef parameter can be nil, it is changed to xx: CFCharacterSetRefPtr }
    CFMutableCharacterSetRef    = CFCharacterSetRef;
    CFMutableCharacterSetRefPtr = ^CFMutableCharacterSetRef;  { when a var xx:CFMutableCharacterSetRef parameter can be nil, it is changed to xx: CFMutableCharacterSetRefPtr }
    CFCharacterSetPredefinedSet  = SInt32;
const
    kCFCharacterSetControl      = 1;
    kCFCharacterSetWhitespace   = 2;
    kCFCharacterSetWhitespaceAndNewline = 3;
    kCFCharacterSetDecimalDigit = 4;
    kCFCharacterSetLetter       = 5;
    kCFCharacterSetLowercaseLetter = 6;
    kCFCharacterSetUppercaseLetter = 7;
    kCFCharacterSetNonBase      = 8;
    kCFCharacterSetDecomposable = 9;
    kCFCharacterSetAlphaNumeric = 10;
    kCFCharacterSetPunctuation  = 11;
    kCFCharacterSetIllegal      = 12;

    {
     *  CFCharacterSetGetTypeID()
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function CFCharacterSetGetTypeID: CFTypeID; external name '_CFCharacterSetGetTypeID';

{
 *  CFCharacterSetGetPredefined()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFCharacterSetGetPredefined(theSetIdentifier: CFCharacterSetPredefinedSet): CFCharacterSetRef; external name '_CFCharacterSetGetPredefined';

{
 *  CFCharacterSetCreateWithCharactersInRange()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFCharacterSetCreateWithCharactersInRange(alloc: CFAllocatorRef; theRange: CFRange): CFCharacterSetRef; external name '_CFCharacterSetCreateWithCharactersInRange';

{
 *  CFCharacterSetCreateWithCharactersInString()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFCharacterSetCreateWithCharactersInString(alloc: CFAllocatorRef; theString: CFStringRef): CFCharacterSetRef; external name '_CFCharacterSetCreateWithCharactersInString';

{
 *  CFCharacterSetCreateWithBitmapRepresentation()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFCharacterSetCreateWithBitmapRepresentation(alloc: CFAllocatorRef; theData: CFDataRef): CFCharacterSetRef; external name '_CFCharacterSetCreateWithBitmapRepresentation';

{
 *  CFCharacterSetCreateMutable()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFCharacterSetCreateMutable(alloc: CFAllocatorRef): CFMutableCharacterSetRef; external name '_CFCharacterSetCreateMutable';

{
 *  CFCharacterSetCreateMutableCopy()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFCharacterSetCreateMutableCopy(alloc: CFAllocatorRef; theSet: CFCharacterSetRef): CFMutableCharacterSetRef; external name '_CFCharacterSetCreateMutableCopy';

{
 *  CFCharacterSetIsCharacterMember()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFCharacterSetIsCharacterMember(theSet: CFCharacterSetRef; theChar: UniChar): boolean; external name '_CFCharacterSetIsCharacterMember';

{
 *  CFCharacterSetCreateBitmapRepresentation()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFCharacterSetCreateBitmapRepresentation(alloc: CFAllocatorRef; theSet: CFCharacterSetRef): CFDataRef; external name '_CFCharacterSetCreateBitmapRepresentation';

{
 *  CFCharacterSetAddCharactersInRange()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CFCharacterSetAddCharactersInRange(theSet: CFMutableCharacterSetRef; theRange: CFRange); external name '_CFCharacterSetAddCharactersInRange';

{
 *  CFCharacterSetRemoveCharactersInRange()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CFCharacterSetRemoveCharactersInRange(theSet: CFMutableCharacterSetRef; theRange: CFRange); external name '_CFCharacterSetRemoveCharactersInRange';

{
 *  CFCharacterSetAddCharactersInString()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CFCharacterSetAddCharactersInString(theSet: CFMutableCharacterSetRef; theString: CFStringRef); external name '_CFCharacterSetAddCharactersInString';

{
 *  CFCharacterSetRemoveCharactersInString()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CFCharacterSetRemoveCharactersInString(theSet: CFMutableCharacterSetRef; theString: CFStringRef); external name '_CFCharacterSetRemoveCharactersInString';

{
 *  CFCharacterSetUnion()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CFCharacterSetUnion(theSet: CFMutableCharacterSetRef; theOtherSet: CFCharacterSetRef); external name '_CFCharacterSetUnion';

{
 *  CFCharacterSetIntersect()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CFCharacterSetIntersect(theSet: CFMutableCharacterSetRef; theOtherSet: CFCharacterSetRef); external name '_CFCharacterSetIntersect';

{
 *  CFCharacterSetInvert()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CFCharacterSetInvert(theSet: CFMutableCharacterSetRef); external name '_CFCharacterSetInvert';

{$ALIGN MAC68K}
{#POP}
{unit CFPropertyList}
{$ALIGN MAC68K}










{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}

{
    Type to mean any instance of a property list type;
    currently, CFString, CFData, CFNumber, CFBoolean, CFDate,
    CFArray, and CFDictionary.
}

type
    CFPropertyListRef                   = CFTypeRef;
    CFPropertyListMutabilityOptions  = SInt32;
const
    kCFPropertyListImmutable    = 0;
    kCFPropertyListMutableContainers = 1;
    kCFPropertyListMutableContainersAndLeaves = 2;

    {
        Creates a property list object from its XML description; xmlData should
        be the raw bytes of that description, possibly the contents of an XML
        file. Returns NULL if the data cannot be parsed; if the parse fails
        and errorString is non-NULL, a human-readable description of the failure
        is returned in errorString. It is the caller's responsibility to release
        either the returned object or the error string, whichever is applicable.
        }
    {
     *  CFPropertyListCreateFromXMLData()
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function CFPropertyListCreateFromXMLData(allocator: CFAllocatorRef; xmlData: CFDataRef; mutabilityOption: CFOptionFlags; errorString: CFStringRefPtr): CFPropertyListRef; external name '_CFPropertyListCreateFromXMLData';

{
    Returns the XML description of the given object; propertyList must
    be one of the supported property list types, and (for composite types
    like CFArray and CFDictionary) must not contain any elements that
    are not themselves of a property list type. If a non-property list
    type is encountered, NULL is returned. The returned data is
    appropriate for writing out to an XML file. Note that a data, not a
    string, is returned because the bytes contain in them a description
    of the string encoding used.
}
{
 *  CFPropertyListCreateXMLData()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFPropertyListCreateXMLData(allocator: CFAllocatorRef; propertyList: CFPropertyListRef): CFDataRef; external name '_CFPropertyListCreateXMLData';

{
    Recursively creates a copy of the given property list (so nested arrays
    and dictionaries are copied as well as the top-most container). The
    resulting property list has the mutability characteristics determined
    by mutabilityOption.
}
{
 *  CFPropertyListCreateDeepCopy()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFPropertyListCreateDeepCopy(allocator: CFAllocatorRef; propertyList: CFPropertyListRef; mutabilityOption: CFOptionFlags): CFPropertyListRef; external name '_CFPropertyListCreateDeepCopy';

{$ALIGN MAC68K}
{#POP}
{unit CFRunLoop}
{$ALIGN MAC68K}





{!
    @typedef CFRunLoopRef
    This is the type of a reference to a run loop.
}
type
    CFRunLoopRef    = ^SInt32; { an opaque 32-bit type }

{!
    @typedef CFRunLoopSourceRef
    This is the type of a reference to general run loop input sources.
}
type
    CFRunLoopSourceRef    = ^SInt32; { an opaque 32-bit type }

{!
    @typedef CFRunLoopObserverRef
    This is the type of a reference to a run loop observer.
}
type
    CFRunLoopObserverRef    = ^SInt32; { an opaque 32-bit type }

{!
    @typedef CFRunLoopTimerRef
    This is the type of a reference to a run loop timer.
}
type
    CFRunLoopTimerRef    = ^SInt32; { an opaque 32-bit type }

{ Reasons for CFRunLoopRunInMode() to Return }
const
    kCFRunLoopRunFinished = 1;
    kCFRunLoopRunStopped = 2;
    kCFRunLoopRunTimedOut = 3;
    kCFRunLoopRunHandledSource = 4;

{ Run Loop Observer Activities }
type CFRunLoopActivity = UInt32;
const
kCFRunLoopEntry = (1 shl 0);
    kCFRunLoopBeforeTimers = (1 shl 1);
    kCFRunLoopBeforeSources = (1 shl 2);
    kCFRunLoopBeforeWaiting = (1 shl 5);
    kCFRunLoopAfterWaiting = (1 shl 6);
    kCFRunLoopExit = (1 shl 7);
    kCFRunLoopAllActivities = $0FFFFFFF;

var kCFRunLoopDefaultMode: CFStringRef; external name '_kCFRunLoopDefaultMode'; (* attribute const *)
var kCFRunLoopCommonModes: CFStringRef; external name '_kCFRunLoopCommonModes'; (* attribute const *)

{!
    @function CFRunLoopGetTypeID
    Returns the type identifier of all CFRunLoop instances.
}
function CFRunLoopGetTypeID: CFTypeID; external name '_CFRunLoopGetTypeID';

{!
    @function CFRunLoopGetCurrent
    Returns the run loop for the current thread. There is exactly
    one run loop per thread.
}
function CFRunLoopGetCurrent: CFRunLoopRef; external name '_CFRunLoopGetCurrent';

{!
    @function CFRunLoopCopyCurrentMode
    Returns the name of the mode in which the run loop is running.
    NULL is returned if the run loop is not running.
    @param rl The run loop for which the current mode should be
        reported.
}
function CFRunLoopCopyCurrentMode( rl: CFRunLoopRef ): CFStringRef; external name '_CFRunLoopCopyCurrentMode';

{!
    @function CFRunLoopCopyAllModes
    Returns an array of all the names of the modes known to the run
    loop.
    @param rl The run loop for which the mode list should be returned.
}
function CFRunLoopCopyAllModes( rl: CFRunLoopRef ): CFArrayRef; external name '_CFRunLoopCopyAllModes';

{!
    @function CFRunLoopAddCommonMode
    Makes the named mode a "common mode" for the run loop. The set of
    common modes are collectively accessed with the global constant
    kCFRunLoopCommonModes. Input sources previously added to the
    common modes are added to the new common mode.
    @param rl The run loop for which the mode should be made common.
    @param mode The name of the mode to mark as a common mode.
}
procedure CFRunLoopAddCommonMode( rl: CFRunLoopRef; mode: CFStringRef ); external name '_CFRunLoopAddCommonMode';

{!
    @function CFRunLoopGetNextTimerFireDate
    Returns the time at which the next timer will fire.
    @param rl The run loop for which the next timer fire date should
        be reported.
    @param mode The name of the mode to query.
}
function CFRunLoopGetNextTimerFireDate( rl: CFRunLoopRef; mode: CFStringRef ): CFAbsoluteTime; external name '_CFRunLoopGetNextTimerFireDate';





procedure CFRunLoopRun; external name '_CFRunLoopRun';
function CFRunLoopRunInMode( mode: CFStringRef; seconds: CFTimeInterval; returnAfterSourceHandled: Boolean ): SInt32; external name '_CFRunLoopRunInMode';
function CFRunLoopIsWaiting( rl: CFRunLoopRef ): Boolean; external name '_CFRunLoopIsWaiting';
procedure CFRunLoopWakeUp( rl: CFRunLoopRef ); external name '_CFRunLoopWakeUp';
procedure CFRunLoopStop( rl: CFRunLoopRef ); external name '_CFRunLoopStop';

function CFRunLoopContainsSource( rl: CFRunLoopRef; source: CFRunLoopSourceRef; mode: CFStringRef ): Boolean; external name '_CFRunLoopContainsSource';
procedure CFRunLoopAddSource( rl: CFRunLoopRef; source: CFRunLoopSourceRef; mode: CFStringRef ); external name '_CFRunLoopAddSource';
procedure CFRunLoopRemoveSource( rl: CFRunLoopRef; source: CFRunLoopSourceRef; mode: CFStringRef ); external name '_CFRunLoopRemoveSource';

function CFRunLoopContainsObserver( rl: CFRunLoopRef; observer: CFRunLoopObserverRef; mode: CFStringRef ): Boolean; external name '_CFRunLoopContainsObserver';
procedure CFRunLoopAddObserver( rl: CFRunLoopRef; observer: CFRunLoopObserverRef; mode: CFStringRef ); external name '_CFRunLoopAddObserver';
procedure CFRunLoopRemoveObserver( rl: CFRunLoopRef; observer: CFRunLoopObserverRef; mode: CFStringRef ); external name '_CFRunLoopRemoveObserver';

function CFRunLoopContainsTimer( rl: CFRunLoopRef; timer: CFRunLoopTimerRef; mode: CFStringRef ): Boolean; external name '_CFRunLoopContainsTimer';
procedure CFRunLoopAddTimer( rl: CFRunLoopRef; timer: CFRunLoopTimerRef; mode: CFStringRef ); external name '_CFRunLoopAddTimer';
procedure CFRunLoopRemoveTimer( rl: CFRunLoopRef; timer: CFRunLoopTimerRef; mode: CFStringRef ); external name '_CFRunLoopRemoveTimer';

{!
    @typedef CFRunLoopSourceContext
    Structure containing the callbacks of a CFRunLoopSource.
    @field version The version number of the structure type being
        passed in as a parameter to the CFArray creation
        functions. Valid version numbers are currently 0 and 1.
        Version 0 sources are fairly generic, but may require a
        bit more implementation, or may require a separate
        thread as part of the implementation, for a complex
        source. Version 1 sources are available on Mach, and
        have performance advantages when the source type can
        be described with this style.
    @field info An arbitrary pointer to client-defined data, which
        can be associated with the source at creation time, and
        is passed to the callbacks.
    @field retain The callback used to add a retain for the source on
        the info pointer for the life of the source, and may be
        used for temporary references the source needs to take.
        This callback returns the actual info pointer to store in
        the source, almost always just the pointer passed as the
        parameter.
    @field release The callback used to remove a retain previously
        added for the source on the info pointer.
    @field copyDescription The callback used to create a descriptive
        string representation of the info pointer (or the data
        pointed to by the info pointer) for debugging purposes.
        This is used by the CFCopyDescription() function.
    @field equal The callback used to compare the info pointers of
        two sources, to determine equality of sources.
    @field hash The callback used to compute a hash code for the info
        pointer for the source. The source uses this hash code
        information to produce its own hash code.
    @field schedule For a version 0 source, this callback is called
        whenever the source is added to a run loop mode. This
        information is often needed to implement complex sources.
    @field cancel For a version 0 source, this callback is called
        whenever the source is removed from a run loop mode. This
        information is often needed to implement complex sources.
    @field getPort Defined in version 1 sources, this function returns
        the Mach port to represent the source to the run loop.
        This function must return the same Mach port every time it
        is called, for the lifetime of the source, and should be
        quick.
    @field perform This callback is the workhorse of a run loop source.
        It is called when the source needs to be "handled" or
        processing is needed for input or conditions relating to
        the source. For version 0 sources, this function is called
        when the source has been marked "signaled" with the
        CFRunLoopSourceSignal() function, and should do whatever
        handling is required for the source. For a version 1
        source, this function is called when a Mach message arrives
        on the source's Mach port, with the Mach message, its
        length, an allocator, and the source's info pointer. A
        version 1 source performs whatever processing is required
        on the Mach message, then can return a pointer to a Mach
        message (or NULL if none) to be sent (usually this is a
        "reply" message), which should be allocated with the
        allocator (and will be deallocated by the run loop after
        sending).
}
type CFRunLoopSourceContext = record
        version: CFIndex;
        info: Ptr;
        retain: function( info: Ptr ): Ptr;
        release: procedure( info: Ptr );
        copyDescription: function( info: Ptr ): CFStringRef;
        equal: function( info1, info2: Ptr ): CFStringRef;
        hash: function( info: Ptr ): CFHashCode;
        schedule: function( info: Ptr; rl: CFRunLoopRef; mode: CFStringRef ): CFHashCode;
        cancel: function( info: Ptr; rl: CFRunLoopRef; mode: CFStringRef ): CFHashCode;
        perform: procedure( info: Ptr );
    end;

{!
    @function CFRunLoopSourceGetTypeID
    Returns the type identifier of all CFRunLoopSource instances.
}
function CFRunLoopSourceGetTypeID: CFTypeID; external name '_CFRunLoopSourceGetTypeID';

{!
    @function CFRunLoopSourceCreate
    Creates a new run loop source with the given context.
    @param allocator The CFAllocator which should be used to allocate
        memory for the array and its storage for values. If this
        reference is not a valid CFAllocator, the behavior is
        undefined.
    @param order On platforms which support it, for source versions
        which support it, this parameter determines the order in
        which the sources which are ready to be processed are
        handled. A lower order number causes processing before
        higher order number sources. It is inadvisable to depend
        on the order number for any architectural or design aspect
        of code. In the absence of any reason to do otherwise,
        zero should be used.
    @param context A pointer to the context structure for the source.
}
function CFRunLoopSourceCreate( allocator: CFAllocatorRef; order: CFIndex; var context: CFRunLoopSourceContext ): CFRunLoopSourceRef; external name '_CFRunLoopSourceCreate';

{!
    @function CFRunLoopSourceGetOrder
    Returns the ordering parameter of the run loop source.
    @param source The run loop source for which the order number
        should be returned.
}
function CFRunLoopSourceGetOrder( source: CFRunLoopSourceRef ): CFIndex; external name '_CFRunLoopSourceGetOrder';

{!
    @function CFRunLoopSourceInvalidate
    Invalidates the run loop source. The run loop source is never
    performed again after it becomes invalid, and will automatically
    be removed from any run loops and modes which contain it. The
    source is not destroyed by this operation, however -- the memory
    is still valid; only the release of all references on the source
    through the reference counting system can do that. But note, that
    if the only retains on the source were held by run loops, those
    retains may all be released by the time this function returns,
    and the source may actually be destroyed through that process.
    @param source The run loop source which should be invalidated.
}
procedure CFRunLoopSourceInvalidate( source: CFRunLoopSourceRef ); external name '_CFRunLoopSourceInvalidate';

{!
    @function CFRunLoopSourceIsValid
    Reports whether or not the source is valid.
    @param source The run loop source for which the validity should
        be returned.
}
function CFRunLoopSourceIsValid( source: CFRunLoopSourceRef ): Boolean; external name '_CFRunLoopSourceIsValid';

{!
    @function CFRunLoopSourceGetContext
    Fills the memory pointed to by the context parameter with the
    context structure of the source.
    @param source The run loop source for which the context structure
        should be returned.
    @param context A pointer to a context structure to be filled.
}
procedure CFRunLoopSourceGetContext( source: CFRunLoopSourceRef; var context: CFRunLoopSourceContext ); external name '_CFRunLoopSourceGetContext';

{!
    @function CFRunLoopSourceSignal
    Marks the source as signalled, ready for handling by the run loop.
    Has no effect on version 1 sources, which are automatically
    handled when Mach messages for them come in.
    @param source The run loop source which should be signalled.
}
procedure CFRunLoopSourceSignal( source: CFRunLoopSourceRef ); external name '_CFRunLoopSourceSignal';

type
    CFRunLoopObserverContext = record
        version: CFIndex;
        info: Ptr;
        retain: function( info: Ptr ): Ptr;
        release: procedure( info: Ptr );
        copyDescription: function( info: Ptr ): CFStringRef;
    end;

type CFRunLoopObserverCallBack = procedure( observer: CFRunLoopObserverRef; activity: CFRunLoopActivity; info: Ptr );

{!
    @function CFRunLoopObserverGetTypeID
    Returns the type identifier of all CFRunLoopObserver instances.
}
function CFRunLoopObserverGetTypeID: CFTypeID; external name '_CFRunLoopObserverGetTypeID';

function CFRunLoopObserverCreate( allocator: CFAllocatorRef; activities: CFOptionFlags; repeats: Boolean; order: CFIndex; callout: CFRunLoopObserverCallBack; var context: CFRunLoopObserverContext ): CFRunLoopObserverRef; external name '_CFRunLoopObserverCreate';

function CFRunLoopObserverGetActivities( observer: CFRunLoopObserverRef ): CFOptionFlags; external name '_CFRunLoopObserverGetActivities';
function CFRunLoopObserverDoesRepeat( observer: CFRunLoopObserverRef ): Boolean; external name '_CFRunLoopObserverDoesRepeat';
function CFRunLoopObserverGetOrder( observer: CFRunLoopObserverRef ): CFIndex; external name '_CFRunLoopObserverGetOrder';
procedure CFRunLoopObserverInvalidate( observer: CFRunLoopObserverRef ); external name '_CFRunLoopObserverInvalidate';
function CFRunLoopObserverIsValid( observer: CFRunLoopObserverRef ): Boolean; external name '_CFRunLoopObserverIsValid';
procedure CFRunLoopObserverGetContext( observer: CFRunLoopObserverRef; var context: CFRunLoopObserverContext ); external name '_CFRunLoopObserverGetContext';

type
    CFRunLoopTimerContext = record
        version: CFIndex;
        info: Ptr;
        retain: function( info: Ptr ): Ptr;
        release: procedure( info: Ptr );
        copyDescription: function( info: Ptr ): CFStringRef;
    end;

type CFRunLoopTimerCallBack = procedure( timer: CFRunLoopTimerRef; info: Ptr );

{!
    @function CFRunLoopTimerGetTypeID
    Returns the type identifier of all CFRunLoopTimer instances.
}
function CFRunLoopTimerGetTypeID: CFTypeID; external name '_CFRunLoopTimerGetTypeID';

function CFRunLoopTimerCreate( allocator: CFAllocatorRef; fireDate: CFAbsoluteTime; interval: CFTimeInterval; flags: CFOptionFlags; order: CFIndex; callout: CFRunLoopTimerCallBack; var context: CFRunLoopTimerContext ): CFRunLoopTimerRef; external name '_CFRunLoopTimerCreate';
function CFRunLoopTimerGetNextFireDate( timer: CFRunLoopTimerRef ): CFAbsoluteTime; external name '_CFRunLoopTimerGetNextFireDate';
procedure CFRunLoopTimerSetNextFireDate( timer: CFRunLoopTimerRef; fireDate: CFAbsoluteTime ); external name '_CFRunLoopTimerSetNextFireDate';
function CFRunLoopTimerGetInterval( timer: CFRunLoopTimerRef ): CFTimeInterval; external name '_CFRunLoopTimerGetInterval';
function CFRunLoopTimerDoesRepeat( timer: CFRunLoopTimerRef ): Boolean; external name '_CFRunLoopTimerDoesRepeat';
function CFRunLoopTimerGetOrder( timer: CFRunLoopTimerRef ): CFIndex; external name '_CFRunLoopTimerGetOrder';
procedure CFRunLoopTimerInvalidate( timer: CFRunLoopTimerRef ); external name '_CFRunLoopTimerInvalidate';
function CFRunLoopTimerIsValid( timer: CFRunLoopTimerRef ): Boolean; external name '_CFRunLoopTimerIsValid';
procedure CFRunLoopTimerGetContext( timer: CFRunLoopTimerRef; var context: CFRunLoopTimerContext ); external name '_CFRunLoopTimerGetContext';
{unit CFSocket}
{$ALIGN MAC68K}





type CFSocketNativeHandle = SInt32;

type
    CFSocketRef    = ^SInt32; { an opaque 32-bit type }

{ A CFSocket contains a native socket within a structure that can
be used to read from the socket in the background and make the data
thus read available using a runloop source.  The callback used for
this may be of three types, as specified by the callBackTypes
argument when creating the CFSocket.

If kCFSocketReadCallBack is used, then data will not be
automatically read, but the callback will be called when data
is available to be read, or a new child socket is waiting to be
accepted.

If kCFSocketAcceptCallBack is used, then new child sockets will be
accepted and passed to the callback, with the data argument being
a pointer to a CFSocketNativeHandle.  This is usable only with
connection rendezvous sockets.

If kCFSocketDataCallBack is used, then data will be read in chunks
in the background and passed to the callback, with the data argument
being a CFDataRef.

These three types are mutually exclusive, but any one of them may
have kCFSocketConnectCallBack added to it, if the socket will be
used to connect in the background.  Connect in the background occurs
if CFSocketConnectToAddress is called with a negative timeout
value, in which case the call returns immediately, and a
kCFSocketConnectCallBack is generated when the connect finishes.
In this case the data argument is either NULL, or a pointer to
an SInt32 error code if the connect failed.  kCFSocketConnectCallBack
will never be sent more than once for a given socket.

The callback types may also have kCFSocketWriteCallBack added to
them, if large amounts of data are to be sent rapidly over the
socket and notification is desired when there is space in the
kernel buffers so that the socket is writable again.

With a connection-oriented socket, if the connection is broken from the
other end, then one final kCFSocketReadCallBack or kCFSocketDataCallBack
will occur.  In the case of kCFSocketReadCallBack, the underlying socket
will have 0 bytes available to read.  In the case of kCFSocketDataCallBack,
the data argument will be a CFDataRef of length 0.

There are socket flags that may be set to control whether callbacks of
a given type are automatically reenabled after they are triggered, and
whether the underlying native socket will be closed when the CFSocket
is invalidated.  By default read, accept, and data callbacks are
automatically reenabled; write callbacks are not, and connect callbacks
may not be, since they are sent once only.  Be careful about automatically
reenabling read and write callbacks, since this implies that the
callbacks will be sent repeatedly if the socket remains readable or
writable respectively.  Be sure to set these flags only for callbacks
that your CFSocket actually possesses; the result of setting them for
other callback types is undefined.

Individual callbacks may also be enabled and disabled manually, whether
they are automatically reenabled or not.  If they are not automatically
reenabled, then they will need to be manually reenabled when the callback
is ready to be received again (and not sooner).  Even if they are
automatically reenabled, there may be occasions when it will be useful
to be able to manually disable them temporarily and then reenable them.
Be sure to enable and disable only callbacks that your CFSocket actually
possesses; the result of enabling and disabling other callback types is
undefined.

By default the underlying native socket will be closed when the CFSocket
is invalidated, but it will not be if kCFSocketCloseOnInvalidate is
turned off.  This can be useful in order to destroy a CFSocket but
continue to use the underlying native socket.  The CFSocket must
still be invalidated when it will no longer be used.  Do not in
either case close the underlying native socket without invalidating
the CFSocket.

Addresses are stored as CFDatas containing a struct sockaddr
appropriate for the protocol family; make sure that all fields are
filled in properly when passing in an address.

}

type CFSocketError = SInt32;
const
    kCFSocketSuccess = 0;
    kCFSocketError = -1;
    kCFSocketTimeout = -2;

type CFSocketSignature = record
    protocolFamily: SInt32;
    socketType: SInt32;
    protocol: SInt32;
    address: CFDataRef;
end;

type CFSocketCallBackType = SInt32;
const
    kCFSocketNoCallBack = 0;
    kCFSocketReadCallBack = 1;
    kCFSocketAcceptCallBack = 2;
    kCFSocketDataCallBack = 3;
    kCFSocketConnectCallBack = 4;
    kCFSocketWriteCallBack = 8;

{ Socket flags }
const
    kCFSocketAutomaticallyReenableReadCallBack = 1;
    kCFSocketAutomaticallyReenableAcceptCallBack = 2;
    kCFSocketAutomaticallyReenableDataCallBack = 3;
    kCFSocketAutomaticallyReenableWriteCallBack = 8;
    kCFSocketCloseOnInvalidate = 128;

type CFSocketCallBack = procedure( s: CFSocketRef; typ: CFSocketCallBackType; address: CFDataRef; data: Ptr; info: Ptr );
{ If the callback wishes to keep hold of address or data after the point that it returns, then it must copy them. }

type CFSocketContext = record
        version: CFIndex;
        info: Ptr;
        retain: function( info: Ptr ): Ptr;
        release: procedure( info: Ptr );
        copyDescription: function( info: Ptr ): CFStringRef;
end;

function CFSocketGetTypeID: CFTypeID; external name '_CFSocketGetTypeID';

function CFSocketCreate( allocator: CFAllocatorRef; protocolFamily: SInt32; socketType: SInt32; protocol: SInt32; callBackTypes: CFOptionFlags; callout: CFSocketCallBack; const (*var*) context: CFSocketContext ): CFSocketRef; external name '_CFSocketCreate';
function CFSocketCreateWithNative( allocator: CFAllocatorRef; sock: CFSocketNativeHandle; callBackTypes: CFOptionFlags; callout: CFSocketCallBack; const (*var*) context: CFSocketContext ): CFSocketRef; external name '_CFSocketCreateWithNative';
function CFSocketCreateWithSocketSignature( allocator: CFAllocatorRef; const (*var*) signature: CFSocketSignature; callBackTypes: CFOptionFlags; callout: CFSocketCallBack; const (*var*) context: CFSocketContext ): CFSocketRef; external name '_CFSocketCreateWithSocketSignature';
function CFSocketCreateConnectedToSocketSignature( allocator: CFAllocatorRef; const (*var*) signature: CFSocketSignature; callBackTypes: CFOptionFlags; callout: CFSocketCallBack; const (*var*) context: CFSocketContext; timeout: CFTimeInterval ): CFSocketRef; external name '_CFSocketCreateConnectedToSocketSignature';
{ CFSocketCreateWithSignature creates a socket of the requested type and binds its address (using CFSocketSetAddress) to the requested address.  If this fails, it returns NULL.  CFSocketCreateConnectedToSignature creates a socket suitable for connecting to the requested type and address, and connects it (using CFSocketConnectToAddress).  If this fails, it returns NULL. }

function CFSocketSetAddress( s: CFSocketRef; address: CFDataRef ): CFSocketError; external name '_CFSocketSetAddress';
function CFSocketConnectToAddress( s: CFSocketRef; address: CFDataRef; timeout: CFTimeInterval ): CFSocketError; external name '_CFSocketConnectToAddress';
procedure CFSocketInvalidate( s: CFSocketRef ); external name '_CFSocketInvalidate';

function CFSocketIsValid( s: CFSocketRef ): Boolean; external name '_CFSocketIsValid';
function CFSocketCopyAddress( s: CFSocketRef ): CFDataRef; external name '_CFSocketCopyAddress';
function CFSocketCopyPeerAddress( s: CFSocketRef ): CFDataRef; external name '_CFSocketCopyPeerAddress';
procedure CFSocketGetContext( s: CFSocketRef; var context: CFSocketContext ); external name '_CFSocketGetContext';
function CFSocketGetNative( s: CFSocketRef ): CFSocketNativeHandle; external name '_CFSocketGetNative';

function CFSocketCreateRunLoopSource( allocator: CFAllocatorRef; s: CFSocketRef; order: CFIndex ): CFRunLoopSourceRef; external name '_CFSocketCreateRunLoopSource';

function CFSocketGetSocketFlags( s: CFSocketRef ): CFOptionFlags; external name '_CFSocketGetSocketFlags';
procedure CFSocketSetSocketFlags( s: CFSocketRef; flags: CFOptionFlags ); external name '_CFSocketSetSocketFlags';
procedure CFSocketDisableCallBacks( s: CFSocketRef; callBackTypes: CFOptionFlags ); external name '_CFSocketDisableCallBacks';
procedure CFSocketEnableCallBacks( s: CFSocketRef; callBackTypes: CFOptionFlags ); external name '_CFSocketEnableCallBacks';

{ For convenience, a function is provided to send data using the socket with a timeout.  The timeout will be used only if the specified value is positive.  The address should be left NULL if the socket is already connected. }
function CFSocketSendData( s: CFSocketRef; address: CFDataRef; data: CFDataRef; timeout: CFTimeInterval ): CFSocketError; external name '_CFSocketSendData';

{ Generic name registry functionality (CFSocketRegisterValue,
CFSocketCopyRegisteredValue) allows the registration of any property
list type.  Functions specific to CFSockets (CFSocketRegisterSocketData,
CFSocketCopyRegisteredSocketData) register a CFData containing the
components of a socket signature (protocol family, socket type,
protocol, and address).  In each function the nameServerSignature
may be NULL, or any component of it may be 0, to use default values
(TCP, INADDR_LOOPBACK, port as set).  Name registration servers might
not allow registration with other than TCP and INADDR_LOOPBACK.
The actual address of the server responding to a query may be obtained
by using the nameServerAddress argument.  This address, the address
returned by CFSocketCopyRegisteredSocketSignature, and the value
returned by CFSocketCopyRegisteredValue must (if non-null) be released
by the caller.  CFSocketUnregister removes any registration associated
with the specified name.
}

function CFSocketRegisterValue( const (*var*) nameServerSignature: CFSocketSignature; timeout: CFTimeInterval; name: CFStringRef; value: CFPropertyListRef ): CFSocketError; external name '_CFSocketRegisterValue';
function CFSocketCopyRegisteredValue( const (*var*) nameServerSignature: CFSocketSignature; timeout: CFTimeInterval; name: CFStringRef; var value: CFPropertyListRef; var nameServerAddress: CFDataRef ): CFSocketError; external name '_CFSocketCopyRegisteredValue';

function CFSocketRegisterSocketSignature( const (*var*) nameServerSignature: CFSocketSignature; timeout: CFTimeInterval; name: CFStringRef; const (*var*) signature: CFSocketSignature ): CFSocketError; external name '_CFSocketRegisterSocketSignature';
function CFSocketCopyRegisteredSocketSignature( const (*var*) nameServerSignature: CFSocketSignature; timeout: CFTimeInterval; name: CFStringRef; var signature: CFSocketSignature; var nameServerAddress: CFDataRef ): CFSocketError; external name '_CFSocketCopyRegisteredSocketSignature';

function CFSocketUnregister( const (*var*) nameServerSignature: CFSocketSignature; timeout: CFTimeInterval; name: CFStringRef ): CFSocketError; external name '_CFSocketUnregister';

procedure CFSocketSetDefaultNameRegistryPortNumber( port: UInt16 ); external name '_CFSocketSetDefaultNameRegistryPortNumber';
function CFSocketGetDefaultNameRegistryPortNumber: UInt16; external name '_CFSocketGetDefaultNameRegistryPortNumber';

{ Constants used in name registry server communications }
var kCFSocketCommandKey: CFStringRef; external name '_kCFSocketCommandKey'; (* attribute const *)
var kCFSocketNameKey: CFStringRef; external name '_kCFSocketNameKey'; (* attribute const *)
var kCFSocketValueKey: CFStringRef; external name '_kCFSocketValueKey'; (* attribute const *)
var kCFSocketResultKey: CFStringRef; external name '_kCFSocketResultKey'; (* attribute const *)
var kCFSocketErrorKey: CFStringRef; external name '_kCFSocketErrorKey'; (* attribute const *)
var kCFSocketRegisterCommand: CFStringRef; external name '_kCFSocketRegisterCommand'; (* attribute const *)
var kCFSocketRetrieveCommand: CFStringRef; external name '_kCFSocketRetrieveCommand'; (* attribute const *)
{unit Files}
{$ALIGN MAC68K}








{ Finder constants were moved to Finder.Å }


{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}

{ HFSUniStr255 is the Unicode equivalent of Str255 }

type
    HFSUniStr255Ptr = ^HFSUniStr255;
    HFSUniStr255 = record
        length:                 UInt16;                                 {  number of unicode characters  }
        unicode:                array [0..254] of UniChar;              {  unicode characters  }
    end;

    ConstHFSUniStr255Param              = ^HFSUniStr255;

const
    fsCurPerm                   = $00;                          {  open access permissions in ioPermssn  }
    fsRdPerm                    = $01;
    fsWrPerm                    = $02;
    fsRdWrPerm                  = $03;
    fsRdWrShPerm                = $04;
    fsRdDenyPerm                = $10;                          {  for use with OpenDeny and OpenRFDeny  }
    fsWrDenyPerm                = $20;                          {  for use with OpenDeny and OpenRFDeny  }

    fsRtParID                   = 1;
    fsRtDirID                   = 2;

    fsAtMark                    = 0;                            {  positioning modes in ioPosMode  }
    fsFromStart                 = 1;
    fsFromLEOF                  = 2;
    fsFromMark                  = 3;

                                                                {  ioPosMode flags  }
    pleaseCacheBit              = 4;                            {  please cache this request  }
    pleaseCacheMask             = $0010;
    noCacheBit                  = 5;                            {  please don't cache this request  }
    noCacheMask                 = $0020;
    rdVerifyBit                 = 6;                            {  read verify mode  }
    rdVerifyMask                = $0040;
    rdVerify                    = 64;                           {  old name of rdVerifyMask  }
    forceReadBit                = 6;
    forceReadMask               = $0040;
    newLineBit                  = 7;                            {  newline mode  }
    newLineMask                 = $0080;
    newLineCharMask             = $FF00;                        {  newline character  }


                                                                {  CatSearch Search bitmask Constants  }
    fsSBPartialName             = 1;
    fsSBFullName                = 2;
    fsSBFlAttrib                = 4;
    fsSBFlFndrInfo              = 8;
    fsSBFlLgLen                 = 32;
    fsSBFlPyLen                 = 64;
    fsSBFlRLgLen                = 128;
    fsSBFlRPyLen                = 256;
    fsSBFlCrDat                 = 512;
    fsSBFlMdDat                 = 1024;
    fsSBFlBkDat                 = 2048;
    fsSBFlXFndrInfo             = 4096;
    fsSBFlParID                 = 8192;
    fsSBNegate                  = 16384;
    fsSBDrUsrWds                = 8;
    fsSBDrNmFls                 = 16;
    fsSBDrCrDat                 = 512;
    fsSBDrMdDat                 = 1024;
    fsSBDrBkDat                 = 2048;
    fsSBDrFndrInfo              = 4096;
    fsSBDrParID                 = 8192;

                                                                {  CatSearch Search bit value Constants  }
    fsSBPartialNameBit          = 0;                            { ioFileName points to a substring }
    fsSBFullNameBit             = 1;                            { ioFileName points to a match string }
    fsSBFlAttribBit             = 2;                            { search includes file attributes }
    fsSBFlFndrInfoBit           = 3;                            { search includes finder info }
    fsSBFlLgLenBit              = 5;                            { search includes data logical length }
    fsSBFlPyLenBit              = 6;                            { search includes data physical length }
    fsSBFlRLgLenBit             = 7;                            { search includes resource logical length }
    fsSBFlRPyLenBit             = 8;                            { search includes resource physical length }
    fsSBFlCrDatBit              = 9;                            { search includes create date }
    fsSBFlMdDatBit              = 10;                           { search includes modification date }
    fsSBFlBkDatBit              = 11;                           { search includes backup date }
    fsSBFlXFndrInfoBit          = 12;                           { search includes extended finder info }
    fsSBFlParIDBit              = 13;                           { search includes file's parent ID }
    fsSBNegateBit               = 14;                           { return all non-matches }
    fsSBDrUsrWdsBit             = 3;                            { search includes directory finder info }
    fsSBDrNmFlsBit              = 4;                            { search includes directory valence }
    fsSBDrCrDatBit              = 9;                            { directory-named version of fsSBFlCrDatBit }
    fsSBDrMdDatBit              = 10;                           { directory-named version of fsSBFlMdDatBit }
    fsSBDrBkDatBit              = 11;                           { directory-named version of fsSBFlBkDatBit }
    fsSBDrFndrInfoBit           = 12;                           { directory-named version of fsSBFlXFndrInfoBit }
    fsSBDrParIDBit              = 13;                           { directory-named version of fsSBFlParIDBit }

                                                                {  vMAttrib (GetVolParms) bit position constants  }
    bLimitFCBs                  = 31;
    bLocalWList                 = 30;
    bNoMiniFndr                 = 29;
    bNoVNEdit                   = 28;
    bNoLclSync                  = 27;
    bTrshOffLine                = 26;
    bNoSwitchTo                 = 25;
    bDontShareIt                = 21;                           {  this volume should not be shared by Macintosh File Sharing (see Technical Note NW 29)  }
    bNoDeskItems                = 20;
    bNoBootBlks                 = 19;
    bAccessCntl                 = 18;
    bNoSysDir                   = 17;
    bHasExtFSVol                = 16;
    bHasOpenDeny                = 15;
    bHasCopyFile                = 14;
    bHasMoveRename              = 13;
    bHasDesktopMgr              = 12;
    bHasShortName               = 11;
    bHasFolderLock              = 10;
    bHasPersonalAccessPrivileges = 9;
    bHasUserGroupList           = 8;
    bHasCatSearch               = 7;
    bHasFileIDs                 = 6;
    bHasBTreeMgr                = 5;
    bHasBlankAccessPrivileges   = 4;
    bSupportsAsyncRequests      = 3;                            {  asynchronous requests to this volume are handled correctly at any time }
    bSupportsTrashVolumeCache   = 2;

                                                                {  vMExtendedAttributes (GetVolParms) bit position constants  }
    bIsEjectable                = 0;                            {  volume is in an ejectable disk drive  }
    bSupportsHFSPlusAPIs        = 1;                            {  volume supports HFS Plus APIs directly (not through compatibility layer)  }
    bSupportsFSCatalogSearch    = 2;                            {  volume supports FSCatalogSearch  }
    bSupportsFSExchangeObjects  = 3;                            {  volume supports FSExchangeObjects  }
    bSupports2TBFiles           = 4;                            {  volume supports supports 2 terabyte files  }
    bSupportsLongNames          = 5;                            {  volume supports file/directory/volume names longer than 31 characters  }
    bSupportsMultiScriptNames   = 6;                            {  volume supports file/directory/volume names with characters from multiple script systems  }
    bSupportsNamedForks         = 7;                            {  volume supports forks beyond the data and resource forks  }
    bSupportsSubtreeIterators   = 8;                            {  volume supports recursive iterators not at the volume root  }
    bL2PCanMapFileBlocks        = 9;                            {  volume supports Lg2Phys SPI correctly  }

                                                                {  vMExtendedAttributes (GetVolParms) bit position constants  }
    bParentModDateChanges       = 10;                           {  Changing a file or folder causes its parent's mod date to change  }
    bAncestorModDateChanges     = 11;                           {  Changing a file or folder causes all ancestor mod dates to change  }

                                                                {  vMExtendedAttributes (GetVolParms) bit position constants  }
    bSupportsSymbolicLinks      = 13;                           {  volume supports the creation and use of symbolic links (Mac OS X only)  }
    bIsAutoMounted              = 14;                           {  volume was mounted automatically (Mac OS X only)  }
    bAllowCDiDataHandler        = 17;                           {  allow QuickTime's CDi data handler to examine this volume  }

                                                                {  Desktop Database, ffsGetIconMessage and fsmGetFSIconMessage icon type and size Constants  }
    kLargeIcon                  = 1;
    kLarge4BitIcon              = 2;
    kLarge8BitIcon              = 3;
    kSmallIcon                  = 4;
    kSmall4BitIcon              = 5;
    kSmall8BitIcon              = 6;
    kicnsIconFamily             = 239;                          {  Note: The 'icns' icon family record is variable sized.  }

    kLargeIconSize              = 256;
    kLarge4BitIconSize          = 512;
    kLarge8BitIconSize          = 1024;
    kSmallIconSize              = 64;
    kSmall4BitIconSize          = 128;
    kSmall8BitIconSize          = 256;

                                                                {  Large Volume Constants  }
    kWidePosOffsetBit           = 8;
    kUseWidePositioning         = $0100;
    kMaximumBlocksIn4GB         = $007FFFFF;

                                                                {  Foreign Privilege Model Identifiers  }
    fsUnixPriv                  = 1;

                                                                {  Authentication Constants  }
    kNoUserAuthentication       = 1;
    kPassword                   = 2;
    kEncryptPassword            = 3;
    kTwoWayEncryptPassword      = 6;


    {    mapping codes (ioObjType) for MapName & MapID  }
    kOwnerID2Name               = 1;
    kGroupID2Name               = 2;
    kOwnerName2ID               = 3;
    kGroupName2ID               = 4;                            {  types of oj object to be returned (ioObjType) for _GetUGEntry  }
    kReturnNextUser             = 1;
    kReturnNextGroup            = 2;
    kReturnNextUG               = 3;

    {    vcbFlags bits  }
    kVCBFlagsIdleFlushBit       = 3;                            {  Set if volume should be flushed at idle time  }
    kVCBFlagsIdleFlushMask      = $0008;
    kVCBFlagsHFSPlusAPIsBit     = 4;                            {  Set if volume implements HFS Plus APIs itself (not via emulation)  }
    kVCBFlagsHFSPlusAPIsMask    = $0010;
    kVCBFlagsHardwareGoneBit    = 5;                            {  Set if disk driver returned a hardwareGoneErr to Read or Write  }
    kVCBFlagsHardwareGoneMask   = $0020;
    kVCBFlagsVolumeDirtyBit     = 15;                           {  Set if volume information has changed since the last FlushVol  }
    kVCBFlagsVolumeDirtyMask    = $8000;

    {    ioVAtrb bits returned by PBHGetVInfo and PBXGetVolInfo     }
    kioVAtrbDefaultVolumeBit    = 5;                            {  Set if the volume is the default volume  }
    kioVAtrbDefaultVolumeMask   = $0020;
    kioVAtrbFilesOpenBit        = 6;                            {  Set if there are open files or iterators  }
    kioVAtrbFilesOpenMask       = $0040;
    kioVAtrbHardwareLockedBit   = 7;                            {  Set if volume is locked by a hardware setting  }
    kioVAtrbHardwareLockedMask  = $0080;
    kioVAtrbSoftwareLockedBit   = 15;                           {  Set if volume is locked by software  }
    kioVAtrbSoftwareLockedMask  = $8000;

    {    ioFlAttrib bits returned by PBGetCatInfo   }
                                                                {  file and directory attributes in ioFlAttrib  }
    kioFlAttribLockedBit        = 0;                            {  Set if file or directory is locked  }
    kioFlAttribLockedMask       = $01;
    kioFlAttribResOpenBit       = 2;                            {  Set if resource fork is open  }
    kioFlAttribResOpenMask      = $04;
    kioFlAttribDataOpenBit      = 3;                            {  Set if data fork is open  }
    kioFlAttribDataOpenMask     = $08;
    kioFlAttribDirBit           = 4;                            {  Set if this is a directory  }
    kioFlAttribDirMask          = $10;
    ioDirFlg                    = 4;                            {  Set if this is a directory (old name)  }
    ioDirMask                   = $10;
    kioFlAttribCopyProtBit      = 6;                            {  Set if AppleShare server "copy-protects" the file  }
    kioFlAttribCopyProtMask     = $40;
    kioFlAttribFileOpenBit      = 7;                            {  Set if file (either fork) is open  }
    kioFlAttribFileOpenMask     = $80;                          {  ioFlAttrib for directories only  }
    kioFlAttribInSharedBit      = 2;                            {  Set if the directory is within a shared area of the directory hierarchy  }
    kioFlAttribInSharedMask     = $04;
    kioFlAttribMountedBit       = 3;                            {  Set if the directory is a share point that is mounted by some user  }
    kioFlAttribMountedMask      = $08;
    kioFlAttribSharePointBit    = 5;                            {  Set if the directory is a share point  }
    kioFlAttribSharePointMask   = $20;

    {    ioFCBFlags bits returned by PBGetFCBInfo   }
    kioFCBWriteBit              = 8;                            {  Data can be written to this file  }
    kioFCBWriteMask             = $0100;
    kioFCBResourceBit           = 9;                            {  This file is a resource fork  }
    kioFCBResourceMask          = $0200;
    kioFCBWriteLockedBit        = 10;                           {  File has a locked byte range  }
    kioFCBWriteLockedMask       = $0400;
    kioFCBLargeFileBit          = 11;                           {  File may grow beyond 2GB; cache uses file blocks, not bytes  }
    kioFCBLargeFileMask         = $0800;
    kioFCBSharedWriteBit        = 12;                           {  File is open for shared write access  }
    kioFCBSharedWriteMask       = $1000;
    kioFCBFileLockedBit         = 13;                           {  File is locked (write-protected)  }
    kioFCBFileLockedMask        = $2000;
    kioFCBOwnClumpBit           = 14;                           {  File has clump size specified in FCB  }
    kioFCBOwnClumpMask          = $4000;
    kioFCBModifiedBit           = 15;                           {  File has changed since it was last flushed  }
    kioFCBModifiedMask          = $8000;

    {    ioACUser bits returned by PBGetCatInfo     }
    {    Note: you must clear ioACUser before calling PBGetCatInfo because some file systems do not use this field  }
    kioACUserNoSeeFolderBit     = 0;                            {  Set if user does not have See Folder privileges  }
    kioACUserNoSeeFolderMask    = $01;
    kioACUserNoSeeFilesBit      = 1;                            {  Set if user does not have See Files privileges  }
    kioACUserNoSeeFilesMask     = $02;
    kioACUserNoMakeChangesBit   = 2;                            {  Set if user does not have Make Changes privileges  }
    kioACUserNoMakeChangesMask  = $04;
    kioACUserNotOwnerBit        = 7;                            {  Set if user is not owner of the directory  }
    kioACUserNotOwnerMask       = $80;

    {    Folder and File values of access privileges in ioACAccess  }
    kioACAccessOwnerBit         = 31;                           {  User is owner of directory  }
    kioACAccessOwnerMask        = $80000000;
    kioACAccessBlankAccessBit   = 28;                           {  Directory has blank access privileges  }
    kioACAccessBlankAccessMask  = $10000000;
    kioACAccessUserWriteBit     = 26;                           {  User has write privileges  }
    kioACAccessUserWriteMask    = $04000000;
    kioACAccessUserReadBit      = 25;                           {  User has read privileges  }
    kioACAccessUserReadMask     = $02000000;
    kioACAccessUserSearchBit    = 24;                           {  User has search privileges  }
    kioACAccessUserSearchMask   = $01000000;
    kioACAccessEveryoneWriteBit = 18;                           {  Everyone has write privileges  }
    kioACAccessEveryoneWriteMask = $00040000;
    kioACAccessEveryoneReadBit  = 17;                           {  Everyone has read privileges  }
    kioACAccessEveryoneReadMask = $00020000;
    kioACAccessEveryoneSearchBit = 16;                          {  Everyone has search privileges  }
    kioACAccessEveryoneSearchMask = $00010000;
    kioACAccessGroupWriteBit    = 10;                           {  Group has write privileges  }
    kioACAccessGroupWriteMask   = $00000400;
    kioACAccessGroupReadBit     = 9;                            {  Group has read privileges  }
    kioACAccessGroupReadMask    = $00000200;
    kioACAccessGroupSearchBit   = 8;                            {  Group has search privileges  }
    kioACAccessGroupSearchMask  = $00000100;
    kioACAccessOwnerWriteBit    = 2;                            {  Owner has write privileges  }
    kioACAccessOwnerWriteMask   = $00000004;
    kioACAccessOwnerReadBit     = 1;                            {  Owner has read privileges  }
    kioACAccessOwnerReadMask    = $00000002;
    kioACAccessOwnerSearchBit   = 0;                            {  Owner has search privileges  }
    kioACAccessOwnerSearchMask  = $00000001;
    kfullPrivileges             = $00070007;                    {  all privileges for everybody and owner }
    kownerPrivileges            = $00000007;                    {  all privileges for owner only }

    {    values of user IDs and group IDs   }
    knoUser                     = 0;
    kadministratorUser          = 1;

    knoGroup                    = 0;



type
    GetVolParmsInfoBufferPtr = ^GetVolParmsInfoBuffer;
    GetVolParmsInfoBuffer = record
        vMVersion:              SInt16;                             { version number }
        vMAttrib:               SInt32;                             { bit vector of attributes (see vMAttrib constants) }
        vMLocalHand:            Handle;                                 { handle to private data }
        vMServerAdr:            SInt32;                             { AppleTalk server address or zero }
                                                                        {        vMVersion 1 GetVolParmsInfoBuffer ends here  }
        vMVolumeGrade:          SInt32;                             { approx. speed rating or zero if unrated }
        vMForeignPrivID:        SInt16;                             { foreign privilege model supported or zero if none }
                                                                        {        vMVersion 2 GetVolParmsInfoBuffer ends here  }
        vMExtendedAttributes:   SInt32;                             { extended attribute bits (see vMExtendedAttributes constants) }
                                                                        {        vMVersion 3 GetVolParmsInfoBuffer ends here  }
        vMDeviceID:             Ptr;                                    {  device id name for interoperability with IOKit  }
                                                                        {        vMVersion 4 GetVolParmsInfoBuffer ends here  }
    end;

    ParmBlkPtr                          = ^ParamBlockRec;
    IOCompletionProcPtr = procedure(paramBlock: ParmBlkPtr);

    IOCompletionUPP = ^SInt32; { an opaque UPP }
    IOParamPtr = ^IOParam;
    IOParam = record
        qLink:                  QElemPtr;                               { queue link in header }
        qType:                  SInt16;                             { type byte for safety check }
        ioTrap:                 SInt16;                             { FS: the Trap }
        ioCmdAddr:              Ptr;                                    { FS: address to dispatch to }
        ioCompletion:           IOCompletionUPP;                        { completion routine addr (0 for synch calls) }
        ioResult:               OSErr;                                  { result code }
        ioNamePtr:              StringPtr;                              { ptr to Vol:FileName string }
        ioVRefNum:              SInt16;                             { volume refnum (DrvNum for Eject and MountVol) }
        ioRefNum:               SInt16;                             { refNum for I/O operation }
        ioVersNum:              SInt8;                                  { version number }
        ioPermssn:              SInt8;                                  { Open: permissions (byte) }
        ioMisc:                 Ptr;                                    { Rename: new name (GetEOF,SetEOF: logical end of file) (Open: optional ptr to buffer) (SetFileType: new type) }
        ioBuffer:               Ptr;                                    { data buffer Ptr }
        ioReqCount:             SInt32;                             { requested byte count; also = ioNewDirID }
        ioActCount:             SInt32;                             { actual byte count completed }
        ioPosMode:              SInt16;                             { initial file positioning }
        ioPosOffset:            SInt32;                             { file position offset }
    end;

    FileParamPtr = ^FileParam;
    FileParam = record
        qLink:                  QElemPtr;                               { queue link in header }
        qType:                  SInt16;                             { type byte for safety check }
        ioTrap:                 SInt16;                             { FS: the Trap }
        ioCmdAddr:              Ptr;                                    { FS: address to dispatch to }
        ioCompletion:           IOCompletionUPP;                        { completion routine addr (0 for synch calls) }
        ioResult:               OSErr;                                  { result code }
        ioNamePtr:              StringPtr;                              { ptr to Vol:FileName string }
        ioVRefNum:              SInt16;                             { volume refnum (DrvNum for Eject and MountVol) }
        ioFRefNum:              SInt16;                             { reference number }
        ioFVersNum:             SInt8;                                  { version number }
        filler1:                SInt8;
        ioFDirIndex:            SInt16;                             { GetFInfo directory index }
        ioFlAttrib:             SInt8;                                  { GetFInfo: in-use bit=7, lock bit=0 }
        ioFlVersNum:            SInt8;                                  { file version number }
        ioFlFndrInfo:           FInfo;                                  { user info }
        ioFlNum:                UInt32;                                 { GetFInfo: file number; TF- ioDirID }
        ioFlStBlk:              UInt16;                                 { start file block (0 if none) }
        ioFlLgLen:              SInt32;                             { logical length (EOF) }
        ioFlPyLen:              SInt32;                             { physical length }
        ioFlRStBlk:             UInt16;                                 { start block rsrc fork }
        ioFlRLgLen:             SInt32;                             { file logical length rsrc fork }
        ioFlRPyLen:             SInt32;                             { file physical length rsrc fork }
        ioFlCrDat:              UInt32;                                 { file creation date& time (32 bits in secs) }
        ioFlMdDat:              UInt32;                                 { last modified date and time }
    end;

    VolumeParamPtr = ^VolumeParam;
    VolumeParam = record
        qLink:                  QElemPtr;                               { queue link in header }
        qType:                  SInt16;                             { type byte for safety check }
        ioTrap:                 SInt16;                             { FS: the Trap }
        ioCmdAddr:              Ptr;                                    { FS: address to dispatch to }
        ioCompletion:           IOCompletionUPP;                        { completion routine addr (0 for synch calls) }
        ioResult:               OSErr;                                  { result code }
        ioNamePtr:              StringPtr;                              { ptr to Vol:FileName string }
        ioVRefNum:              SInt16;                             { volume refnum (DrvNum for Eject and MountVol) }
        filler2:                SInt32;
        ioVolIndex:             SInt16;                             { volume index number }
        ioVCrDate:              UInt32;                                 { creation date and time }
        ioVLsBkUp:              UInt32;                                 { last backup date and time }
        ioVAtrb:                UInt16;                                 { volume attrib }
        ioVNmFls:               UInt16;                                 { number of files in directory }
        ioVDirSt:               UInt16;                                 { start block of file directory }
        ioVBlLn:                SInt16;                             { GetVolInfo: length of dir in blocks }
        ioVNmAlBlks:            UInt16;                                 { for compatibilty ioVNmAlBlks * ioVAlBlkSiz <= 2 GB }
        ioVAlBlkSiz:            UInt32;                                 { for compatibilty ioVAlBlkSiz is <= $0000FE00 (65,024) }
        ioVClpSiz:              UInt32;                                 { GetVolInfo: bytes to allocate at a time }
        ioAlBlSt:               UInt16;                                 { starting disk(512-byte) block in block map }
        ioVNxtFNum:             UInt32;                                 { GetVolInfo: next free file number }
        ioVFrBlk:               UInt16;                                 { GetVolInfo: # free alloc blks for this vol }
    end;

    CntrlParamPtr = ^CntrlParam;
    CntrlParam = record
        qLink:                  QElemPtr;                               { queue link in header }
        qType:                  SInt16;                             { type byte for safety check }
        ioTrap:                 SInt16;                             { FS: the Trap }
        ioCmdAddr:              Ptr;                                    { FS: address to dispatch to }
        ioCompletion:           IOCompletionUPP;                        { completion routine addr (0 for synch calls) }
        ioResult:               OSErr;                                  { result code }
        ioNamePtr:              StringPtr;                              { ptr to Vol:FileName string }
        ioVRefNum:              SInt16;                             { volume refnum (DrvNum for Eject and MountVol) }
        ioCRefNum:              SInt16;                             { refNum for I/O operation }
        csCode:                 SInt16;                             { word for control status code }
        csParam:                array [0..10] of SInt16;                { operation-defined parameters }
    end;

    SlotDevParamPtr = ^SlotDevParam;
    SlotDevParam = record
        qLink:                  QElemPtr;                               { queue link in header }
        qType:                  SInt16;                             { type byte for safety check }
        ioTrap:                 SInt16;                             { FS: the Trap }
        ioCmdAddr:              Ptr;                                    { FS: address to dispatch to }
        ioCompletion:           IOCompletionUPP;                        { completion routine addr (0 for synch calls) }
        ioResult:               OSErr;                                  { result code }
        ioNamePtr:              StringPtr;                              { ptr to Vol:FileName string }
        ioVRefNum:              SInt16;                             { volume refnum (DrvNum for Eject and MountVol) }
        ioSRefNum:              SInt16;
        ioSVersNum:             SInt8;
        ioSPermssn:             SInt8;
        ioSMix:                 Ptr;
        ioSFlags:               SInt16;
        ioSlot:                 SInt8;
        ioID:                   SInt8;
    end;

    MultiDevParamPtr = ^MultiDevParam;
    MultiDevParam = record
        qLink:                  QElemPtr;                               { queue link in header }
        qType:                  SInt16;                             { type byte for safety check }
        ioTrap:                 SInt16;                             { FS: the Trap }
        ioCmdAddr:              Ptr;                                    { FS: address to dispatch to }
        ioCompletion:           IOCompletionUPP;                        { completion routine addr (0 for synch calls) }
        ioResult:               OSErr;                                  { result code }
        ioNamePtr:              StringPtr;                              { ptr to Vol:FileName string }
        ioVRefNum:              SInt16;                             { volume refnum (DrvNum for Eject and MountVol) }
        ioMRefNum:              SInt16;
        ioMVersNum:             SInt8;
        ioMPermssn:             SInt8;
        ioMMix:                 Ptr;
        ioMFlags:               SInt16;
        ioSEBlkPtr:             Ptr;
    end;

    ParamBlockRecPtr = ^ParamBlockRec;
    ParamBlockRec = record
        qLink:                  QElemPtr;                               { queue link in header }
        qType:                  SInt16;                             { type byte for safety check }
        ioTrap:                 SInt16;                             { FS: the Trap }
        ioCmdAddr:              Ptr;                                    { FS: address to dispatch to }
        ioCompletion:           IOCompletionUPP;                        { completion routine addr (0 for synch calls) }
        ioResult:               OSErr;                                  { result code }
        ioNamePtr:              StringPtr;                              { ptr to Vol:FileName string }
        ioVRefNum:              SInt16;                             { volume refnum (DrvNum for Eject and MountVol) }
        case SInt16 of
        0: (
            ioRefNum:           SInt16;                             { refNum for I/O operation }
            ioVersNum:          SInt8;                                  { version number }
            ioPermssn:          SInt8;                                  { Open: permissions (byte) }
            ioMisc:             Ptr;                                    { Rename: new name (GetEOF,SetEOF: logical end of file) (Open: optional ptr to buffer) (SetFileType: new type) }
            ioBuffer:           Ptr;                                    { data buffer Ptr }
            ioReqCount:         SInt32;                             { requested byte count; also = ioNewDirID }
            ioActCount:         SInt32;                             { actual byte count completed }
            ioPosMode:          SInt16;                             { initial file positioning }
            ioPosOffset:        SInt32;                             { file position offset }
           );
        1: (
            ioFRefNum:          SInt16;                             { reference number }
            ioFVersNum:         SInt8;                                  { version number }
            filler1:            SInt8;
            ioFDirIndex:        SInt16;                             { GetFInfo directory index }
            ioFlAttrib:         SInt8;                                  { GetFInfo: in-use bit=7, lock bit=0 }
            ioFlVersNum:        SInt8;                                  { file version number }
            ioFlFndrInfo:       FInfo;                                  { user info }
            ioFlNum:            UInt32;                                 { GetFInfo: file number; TF- ioDirID }
            ioFlStBlk:          UInt16;                                 { start file block (0 if none) }
            ioFlLgLen:          SInt32;                             { logical length (EOF) }
            ioFlPyLen:          SInt32;                             { physical length }
            ioFlRStBlk:         UInt16;                                 { start block rsrc fork }
            ioFlRLgLen:         SInt32;                             { file logical length rsrc fork }
            ioFlRPyLen:         SInt32;                             { file physical length rsrc fork }
            ioFlCrDat:          UInt32;                                 { file creation date& time (32 bits in secs) }
            ioFlMdDat:          UInt32;                                 { last modified date and time }
           );
        2: (
            filler2:            SInt32;
            ioVolIndex:         SInt16;                             { volume index number }
            ioVCrDate:          UInt32;                                 { creation date and time }
            ioVLsBkUp:          UInt32;                                 { last backup date and time }
            ioVAtrb:            UInt16;                                 { volume attrib }
            ioVNmFls:           UInt16;                                 { number of files in directory }
            ioVDirSt:           UInt16;                                 { start block of file directory }
            ioVBlLn:            SInt16;                             { GetVolInfo: length of dir in blocks }
            ioVNmAlBlks:        UInt16;                                 { for compatibilty ioVNmAlBlks * ioVAlBlkSiz <= 2 GB }
            ioVAlBlkSiz:        UInt32;                                 { for compatibilty ioVAlBlkSiz is <= $0000FE00 (65,024) }
            ioVClpSiz:          UInt32;                                 { GetVolInfo: bytes to allocate at a time }
            ioAlBlSt:           UInt16;                                 { starting disk(512-byte) block in block map }
            ioVNxtFNum:         UInt32;                                 { GetVolInfo: next free file number }
            ioVFrBlk:           UInt16;                                 { GetVolInfo: # free alloc blks for this vol }
           );
        3: (
            ioCRefNum:          SInt16;                             { refNum for I/O operation }
            csCode:             SInt16;                             { word for control status code }
            csParam:            array [0..10] of SInt16;                { operation-defined parameters }
           );
        4: (
            ioSRefNum:          SInt16;
            ioSVersNum:         SInt8;
            ioSPermssn:         SInt8;
            ioSMix:             Ptr;
            ioSFlags:           SInt16;
            ioSlot:             SInt8;
            ioID:               SInt8;
           );
        5: (
            ioMRefNum:          SInt16;
            ioMVersNum:         SInt8;
            ioMPermssn:         SInt8;
            ioMMix:             Ptr;
            ioMFlags:           SInt16;
            ioSEBlkPtr:         Ptr;
           );
    end;

    CInfoPBRecPtr = ^CInfoPBRec;
    CInfoPBRec = record
        qLink:                  QElemPtr;                               { queue link in header }
        qType:                  SInt16;                             { type byte for safety check }
        ioTrap:                 SInt16;                             { FS: the Trap }
        ioCmdAddr:              Ptr;                                    { FS: address to dispatch to }
        ioCompletion:           IOCompletionUPP;                        { completion routine addr (0 for synch calls) }
        ioResult:               OSErr;                                  { result code }
        ioNamePtr:              StringPtr;                              { ptr to Vol:FileName string }
        ioVRefNum:              SInt16;                             { volume refnum (DrvNum for Eject and MountVol) }
        ioFRefNum:              SInt16;
        ioFVersNum:             SInt8;
        filler1:                SInt8;
        ioFDirIndex:            SInt16;
        ioFlAttrib:             SInt8;
        ioACUser:               SInt8;
        case SInt16 of
        0: (
            ioFlFndrInfo:       FInfo;
            ioDirID:            UInt32;
            ioFlStBlk:          UInt16;
            ioFlLgLen:          SInt32;
            ioFlPyLen:          SInt32;
            ioFlRStBlk:         UInt16;
            ioFlRLgLen:         SInt32;
            ioFlRPyLen:         SInt32;
            ioFlCrDat:          UInt32;
            ioFlMdDat:          UInt32;
            ioFlBkDat:          UInt32;
            ioFlXFndrInfo:      FXInfo;
            ioFlParID:          SInt32;
            ioFlClpSiz:         SInt32;
           );
        1: (
            ioDrUsrWds:         DInfo;
            ioDrDirID:          UInt32;
            ioDrNmFls:          UInt16;
            filler3:            array [1..9] of SInt16;
            ioDrCrDat:          UInt32;
            ioDrMdDat:          UInt32;
            ioDrBkDat:          UInt32;
            ioDrFndrInfo:       DXInfo;
            ioDrParID:          SInt32;
           );
    end;

    CInfoPBPtr                          = ^CInfoPBRec;
    XCInfoPBRecPtr = ^XCInfoPBRec;
    XCInfoPBRec = record
        qLink:                  QElemPtr;
        qType:                  SInt16;
        ioTrap:                 SInt16;
        ioCmdAddr:              Ptr;
        ioCompletion:           ProcPtr;                                {  --> A pointer to a completion routine  }
        ioResult:               OSErr;                                  {  --> The result code of the function  }
        ioNamePtr:              StringPtr;                              {  --> Pointer to pathname to object  }
        ioVRefNum:              SInt16;                             {  --> A volume specification  }
        filler1:                SInt32;
        ioShortNamePtr:         StringPtr;                              {  <-> A pointer to the short name string buffer - required!  }
        filler2:                SInt16;
        ioPDType:               SInt16;                             {  <-- The ProDOS file type  }
        ioPDAuxType:            SInt32;                             {  <-- The ProDOS aux type  }
        filler3:                array [0..1] of SInt32;
        ioDirID:                UInt32;                             {  --> A directory ID  }
    end;

    XCInfoPBPtr                         = ^XCInfoPBRec;
    {    Catalog position record    }
    CatPositionRecPtr = ^CatPositionRec;
    CatPositionRec = record
        initialize:             SInt32;
        priv:                   array [1..6] of SInt16;
    end;

    FSSpecPtr = ^FSSpec;
    FSSpec = record
        vRefNum:                SInt16;
        parID:                  UInt32;
        name:                   StrFileName;                            {  a Str63 on MacOS }
    end;

    FSSpecHandle                        = ^FSSpecPtr;
    {    pointer to array of FSSpecs    }
    FSSpecArray                         = array [0..0] of FSSpec;
    FSSpecArrayPtr                      = ^FSSpecArray;
    {
        The only difference between "const FSSpec*" and "ConstFSSpecPtr" is
        that as a parameter, ConstFSSpecPtr is allowed to be NULL
        }
    ConstFSSpecPtr                      = FSSpecPtr;
    {
        The following are structures to be filled out with the _PBGetVolMountInfo call
        and passed back into the _PBVolumeMount call for external file system mounts.
        }
    {    the "signature" of the file system     }
    VolumeType                          = OSType;

const
                                                                {  the signature for AppleShare  }
    AppleShareMediaType         = $6166706D (* 'afpm' *);

    {
        VolMount stuff was once in FSM.Å
        }

type
    VolMountInfoHeaderPtr = ^VolMountInfoHeader;
    VolMountInfoHeader = record
        length:                 SInt16;                             {  length of location data (including self)  }
        media:                  VolumeType;                             {  type of media.  Variable length data follows  }
    end;

    VolMountInfoPtr                     = ^VolMountInfoHeader;
    {    The new volume mount info record.  The old one is included for compatibility.
        the new record allows access by foriegn filesystems writers to the flags
        portion of the record. This portion is now public.
        }
    VolumeMountInfoHeaderPtr = ^VolumeMountInfoHeader;
    VolumeMountInfoHeader = record
        length:                 SInt16;                             {  length of location data (including self)  }
        media:                  VolumeType;                             {  type of media (must be registered with Apple)  }
        flags:                  SInt16;                             {  volume mount flags. Variable length data follows  }
    end;

    {    volume mount flags     }

const
    volMountNoLoginMsgFlagBit   = 0;                            {  Input to VolumeMount: If set, the file system  }
    volMountNoLoginMsgFlagMask  = $0001;                        {   should suppresss any log-in message/greeting dialog  }
    volMountExtendedFlagsBit    = 7;                            {  Input to VolumeMount: If set, the mount info is a  }
    volMountExtendedFlagsMask   = $0080;                        {   AFPXVolMountInfo record for 3.7 AppleShare Client  }
    volMountInteractBit         = 15;                           {  Input to VolumeMount: If set, it's OK for the file system  }
    volMountInteractMask        = $8000;                        {   to perform user interaction to mount the volume  }
    volMountChangedBit          = 14;                           {  Output from VoumeMount: If set, the volume was mounted, but  }
    volMountChangedMask         = $4000;                        {   the volume mounting information record needs to be updated.  }
    volMountFSReservedMask      = $00FF;                        {  bits 0-7 are defined by each file system for its own use  }
    volMountSysReservedMask     = $FF00;                        {  bits 8-15 are reserved for Apple system use  }




type
    AFPVolMountInfoPtr = ^AFPVolMountInfo;
    AFPVolMountInfo = record
        length:                 SInt16;                             {  length of location data (including self)  }
        media:                  VolumeType;                             {  type of media  }
        flags:                  SInt16;                             {  bits for no messages, no reconnect  }
        nbpInterval:            SInt8;                                  {  NBP Interval parameter (IM2, p.322)  }
        nbpCount:               SInt8;                                  {  NBP Interval parameter (IM2, p.322)  }
        uamType:                SInt16;                             {  User Authentication Method  }
        zoneNameOffset:         SInt16;                             {  short positive offset from start of struct to Zone Name  }
        serverNameOffset:       SInt16;                             {  offset to pascal Server Name string  }
        volNameOffset:          SInt16;                             {  offset to pascal Volume Name string  }
        userNameOffset:         SInt16;                             {  offset to pascal User Name string  }
        userPasswordOffset:     SInt16;                             {  offset to pascal User Password string  }
        volPasswordOffset:      SInt16;                             {  offset to pascal Volume Password string  }
        AFPData:                packed array [1..144] of char;          {  variable length data may follow  }
    end;



    {    AFPXVolMountInfo is the new AFP volume mount info record, requires the 3.7 AppleShare Client   }
    AFPXVolMountInfoPtr = ^AFPXVolMountInfo;
    AFPXVolMountInfo = record
        length:                 SInt16;                             {  length of location data (including self)  }
        media:                  VolumeType;                             {  type of media  }
        flags:                  SInt16;                             {  bits for no messages, no reconnect  }
        nbpInterval:            SInt8;                                  {  NBP Interval parameter (IM2, p.322)  }
        nbpCount:               SInt8;                                  {  NBP Interval parameter (IM2, p.322)  }
        uamType:                SInt16;                             {  User Authentication Method type  }
        zoneNameOffset:         SInt16;                             {  short positive offset from start of struct to Zone Name  }
        serverNameOffset:       SInt16;                             {  offset to pascal Server Name string  }
        volNameOffset:          SInt16;                             {  offset to pascal Volume Name string  }
        userNameOffset:         SInt16;                             {  offset to pascal User Name string  }
        userPasswordOffset:     SInt16;                             {  offset to pascal User Password string  }
        volPasswordOffset:      SInt16;                             {  offset to pascal Volume Password string  }
        extendedFlags:          SInt16;                             {  extended flags word  }
        uamNameOffset:          SInt16;                             {  offset to a pascal UAM name string  }
        alternateAddressOffset: SInt16;                             {  offset to Alternate Addresses in tagged format  }
        AFPData:                packed array [1..176] of char;          {  variable length data may follow  }
    end;


const
    kAFPExtendedFlagsAlternateAddressMask = 1;                  {   bit in AFPXVolMountInfo.extendedFlags that means alternateAddressOffset is used }


                                                                {  constants for use in AFPTagData.fType field }
    kAFPTagTypeIP               = $01;                          {  4 byte IP address (MSB first)             }
    kAFPTagTypeIPPort           = $02;                          {  4 byte IP address, 2 byte port (MSB first)      }
    kAFPTagTypeDDP              = $03;                          {  Net,Node,Socket Sent by the server, currently unused by the client  }
    kAFPTagTypeDNS              = $04;                          {  DNS name in  address:port format   (total length variable up to 254 chars of dns name)           }


                                                                {  constants for use in AFPTagData.fLength field }
    kAFPTagLengthIP             = $06;
    kAFPTagLengthIPPort         = $08;
    kAFPTagLengthDDP            = $06;


type
    AFPTagDataPtr = ^AFPTagData;
    AFPTagData = packed record
        fLength:                UInt8;                                  {  length of this data tag including the fLength field  }
        fType:                  UInt8;
        fData:                  packed array [0..0] of UInt8;           {  variable length data  }
    end;

    AFPAlternateAddressPtr = ^AFPAlternateAddress;
    AFPAlternateAddress = packed record
                                                                        {  ¥¥¥ÊNOTE: fVersion was missing in 3.2 Universal Interfaces }
        fVersion:               UInt8;                                  {  version of the structure (currently 0x00) }
        fAddressCount:          UInt8;
        fAddressList:           packed array [0..0] of UInt8;           {  actually variable length packed set of AFPTagData  }
    end;

    DTPBRecPtr = ^DTPBRec;
    DTPBRec = record
        qLink:                  QElemPtr;                               { queue link in header }
        qType:                  SInt16;                             { type byte for safety check }
        ioTrap:                 SInt16;                             { FS: the Trap }
        ioCmdAddr:              Ptr;                                    { FS: address to dispatch to }
        ioCompletion:           IOCompletionUPP;                        { completion routine addr (0 for synch calls) }
        ioResult:               OSErr;                                  { result code }
        ioNamePtr:              StringPtr;                              { ptr to Vol:FileName string }
        ioVRefNum:              SInt16;                             { volume refnum (DrvNum for Eject and MountVol) }
        ioDTRefNum:             SInt16;                             {  desktop refnum  }
        ioIndex:                SInt16;
        ioTagInfo:              SInt32;
        ioDTBuffer:             Ptr;
        ioDTReqCount:           SInt32;
        ioDTActCount:           SInt32;
        ioFiller1:              SInt8;
        ioIconType:             SInt8;
        ioFiller2:              SInt16;
        ioDirID:                UInt32;
        ioFileCreator:          OSType;
        ioFileType:             OSType;
        ioFiller3:              SInt32;
        ioDTLgLen:              SInt32;
        ioDTPyLen:              SInt32;
        ioFiller4:              array [1..14] of SInt16;
        ioAPPLParID:            SInt32;
    end;

    DTPBPtr                             = ^DTPBRec;

    HIOParamPtr = ^HIOParam;
    HIOParam = record
        qLink:                  QElemPtr;                               { queue link in header }
        qType:                  SInt16;                             { type byte for safety check }
        ioTrap:                 SInt16;                             { FS: the Trap }
        ioCmdAddr:              Ptr;                                    { FS: address to dispatch to }
        ioCompletion:           IOCompletionUPP;                        { completion routine addr (0 for synch calls) }
        ioResult:               OSErr;                                  { result code }
        ioNamePtr:              StringPtr;                              { ptr to Vol:FileName string }
        ioVRefNum:              SInt16;                             { volume refnum (DrvNum for Eject and MountVol) }
        ioRefNum:               SInt16;
        ioVersNum:              SInt8;
        ioPermssn:              SInt8;
        ioMisc:                 Ptr;
        ioBuffer:               Ptr;
        ioReqCount:             SInt32;
        ioActCount:             SInt32;
        ioPosMode:              SInt16;
        ioPosOffset:            SInt32;
    end;

    HFileParamPtr = ^HFileParam;
    HFileParam = record
        qLink:                  QElemPtr;                               { queue link in header }
        qType:                  SInt16;                             { type byte for safety check }
        ioTrap:                 SInt16;                             { FS: the Trap }
        ioCmdAddr:              Ptr;                                    { FS: address to dispatch to }
        ioCompletion:           IOCompletionUPP;                        { completion routine addr (0 for synch calls) }
        ioResult:               OSErr;                                  { result code }
        ioNamePtr:              StringPtr;                              { ptr to Vol:FileName string }
        ioVRefNum:              SInt16;                             { volume refnum (DrvNum for Eject and MountVol) }
        ioFRefNum:              SInt16;
        ioFVersNum:             SInt8;
        filler1:                SInt8;
        ioFDirIndex:            SInt16;
        ioFlAttrib:             SInt8;
        ioFlVersNum:            SInt8;
        ioFlFndrInfo:           FInfo;
        ioDirID:                UInt32;
        ioFlStBlk:              UInt16;
        ioFlLgLen:              SInt32;
        ioFlPyLen:              SInt32;
        ioFlRStBlk:             UInt16;
        ioFlRLgLen:             SInt32;
        ioFlRPyLen:             SInt32;
        ioFlCrDat:              UInt32;
        ioFlMdDat:              UInt32;
    end;

    HVolumeParamPtr = ^HVolumeParam;
    HVolumeParam = record
        qLink:                  QElemPtr;                               { queue link in header }
        qType:                  SInt16;                             { type byte for safety check }
        ioTrap:                 SInt16;                             { FS: the Trap }
        ioCmdAddr:              Ptr;                                    { FS: address to dispatch to }
        ioCompletion:           IOCompletionUPP;                        { completion routine addr (0 for synch calls) }
        ioResult:               OSErr;                                  { result code }
        ioNamePtr:              StringPtr;                              { ptr to Vol:FileName string }
        ioVRefNum:              SInt16;                             { volume refnum (DrvNum for Eject and MountVol) }
        filler2:                SInt32;
        ioVolIndex:             SInt16;
        ioVCrDate:              UInt32;
        ioVLsMod:               UInt32;
        ioVAtrb:                SInt16;
        ioVNmFls:               UInt16;
        ioVBitMap:              UInt16;
        ioAllocPtr:             UInt16;
        ioVNmAlBlks:            UInt16;
        ioVAlBlkSiz:            UInt32;
        ioVClpSiz:              UInt32;
        ioAlBlSt:               UInt16;
        ioVNxtCNID:             UInt32;
        ioVFrBlk:               UInt16;
        ioVSigWord:             UInt16;
        ioVDrvInfo:             SInt16;
        ioVDRefNum:             SInt16;
        ioVFSID:                SInt16;
        ioVBkUp:                UInt32;
        ioVSeqNum:              SInt16;
        ioVWrCnt:               UInt32;
        ioVFilCnt:              UInt32;
        ioVDirCnt:              UInt32;
        ioVFndrInfo:            array [1..8] of SInt32;
    end;

    XIOParamPtr = ^XIOParam;
    XIOParam = record
        qLink:                  QElemPtr;
        qType:                  SInt16;
        ioTrap:                 SInt16;
        ioCmdAddr:              Ptr;
        ioCompletion:           IOCompletionUPP;
        ioResult:               OSErr;
        ioNamePtr:              StringPtr;
        ioVRefNum:              SInt16;
        ioRefNum:               SInt16;
        ioVersNum:              SInt8;
        ioPermssn:              SInt8;
        ioMisc:                 Ptr;
        ioBuffer:               Ptr;
        ioReqCount:             SInt32;
        ioActCount:             SInt32;
        ioPosMode:              SInt16;                             {  must have kUseWidePositioning bit set  }
        ioWPosOffset:           wide;                                   {  wide positioning offset  }
    end;

    XVolumeParamPtr = ^XVolumeParam;
    XVolumeParam = record
        qLink:                  QElemPtr;
        qType:                  SInt16;
        ioTrap:                 SInt16;
        ioCmdAddr:              Ptr;
        ioCompletion:           IOCompletionUPP;
        ioResult:               OSErr;
        ioNamePtr:              StringPtr;
        ioVRefNum:              SInt16;
        ioXVersion:             UInt32;                                 {  this XVolumeParam version (0)  }
        ioVolIndex:             SInt16;
        ioVCrDate:              UInt32;
        ioVLsMod:               UInt32;
        ioVAtrb:                SInt16;
        ioVNmFls:               UInt16;
        ioVBitMap:              UInt16;
        ioAllocPtr:             UInt16;
        ioVNmAlBlks:            UInt16;
        ioVAlBlkSiz:            UInt32;
        ioVClpSiz:              UInt32;
        ioAlBlSt:               UInt16;
        ioVNxtCNID:             UInt32;
        ioVFrBlk:               UInt16;
        ioVSigWord:             UInt16;
        ioVDrvInfo:             SInt16;
        ioVDRefNum:             SInt16;
        ioVFSID:                SInt16;
        ioVBkUp:                UInt32;
        ioVSeqNum:              SInt16;
        ioVWrCnt:               UInt32;
        ioVFilCnt:              UInt32;
        ioVDirCnt:              UInt32;
        ioVFndrInfo:            array [1..8] of SInt32;
        ioVTotalBytes:          UInt64;                                 {  total number of bytes on volume  }
        ioVFreeBytes:           UInt64;                                 {  number of free bytes on volume  }
    end;

    AccessParamPtr = ^AccessParam;
    AccessParam = record
        qLink:                  QElemPtr;                               { queue link in header }
        qType:                  SInt16;                             { type byte for safety check }
        ioTrap:                 SInt16;                             { FS: the Trap }
        ioCmdAddr:              Ptr;                                    { FS: address to dispatch to }
        ioCompletion:           IOCompletionUPP;                        { completion routine addr (0 for synch calls) }
        ioResult:               OSErr;                                  { result code }
        ioNamePtr:              StringPtr;                              { ptr to Vol:FileName string }
        ioVRefNum:              SInt16;                             { volume refnum (DrvNum for Eject and MountVol) }
        filler3:                SInt16;
        ioDenyModes:            SInt16;                             { access rights data }
        filler4:                SInt16;
        filler5:                SInt8;
        ioACUser:               SInt8;                                  { access rights for directory only }
        filler6:                SInt32;
        ioACOwnerID:            SInt32;                             { owner ID }
        ioACGroupID:            SInt32;                             { group ID }
        ioACAccess:             SInt32;                             { access rights }
        ioDirID:                UInt32;
    end;

    ObjParamPtr = ^ObjParam;
    ObjParam = record
        qLink:                  QElemPtr;                               { queue link in header }
        qType:                  SInt16;                             { type byte for safety check }
        ioTrap:                 SInt16;                             { FS: the Trap }
        ioCmdAddr:              Ptr;                                    { FS: address to dispatch to }
        ioCompletion:           IOCompletionUPP;                        { completion routine addr (0 for synch calls) }
        ioResult:               OSErr;                                  { result code }
        ioNamePtr:              StringPtr;                              { ptr to Vol:FileName string }
        ioVRefNum:              SInt16;                             { volume refnum (DrvNum for Eject and MountVol) }
        filler7:                SInt16;
        ioObjType:              SInt16;                             { function code }
        ioObjNamePtr:           StringPtr;                              { ptr to returned creator/group name }
        ioObjID:                SInt32;                             { creator/group ID }
    end;

    CopyParamPtr = ^CopyParam;
    CopyParam = record
        qLink:                  QElemPtr;                               { queue link in header }
        qType:                  SInt16;                             { type byte for safety check }
        ioTrap:                 SInt16;                             { FS: the Trap }
        ioCmdAddr:              Ptr;                                    { FS: address to dispatch to }
        ioCompletion:           IOCompletionUPP;                        { completion routine addr (0 for synch calls) }
        ioResult:               OSErr;                                  { result code }
        ioNamePtr:              StringPtr;                              { ptr to Vol:FileName string }
        ioVRefNum:              SInt16;                             { volume refnum (DrvNum for Eject and MountVol) }
        ioDstVRefNum:           SInt16;                             { destination vol identifier }
        filler8:                SInt16;
        ioNewName:              StringPtr;                              { ptr to destination pathname }
        ioCopyName:             StringPtr;                              { ptr to optional name }
        ioNewDirID:             UInt32;                             { destination directory ID }
        filler14:               SInt32;
        filler15:               SInt32;
        ioDirID:                UInt32;
    end;

    WDParamPtr = ^WDParam;
    WDParam = record
        qLink:                  QElemPtr;                               { queue link in header }
        qType:                  SInt16;                             { type byte for safety check }
        ioTrap:                 SInt16;                             { FS: the Trap }
        ioCmdAddr:              Ptr;                                    { FS: address to dispatch to }
        ioCompletion:           IOCompletionUPP;                        { completion routine addr (0 for synch calls) }
        ioResult:               OSErr;                                  { result code }
        ioNamePtr:              StringPtr;                              { ptr to Vol:FileName string }
        ioVRefNum:              SInt16;                             { volume refnum (DrvNum for Eject and MountVol) }
        ioWDCreated:            SInt16;
        ioWDIndex:              SInt16;
        ioWDProcID:             SInt32;
        ioWDVRefNum:            SInt16;
        filler10:               SInt16;
        filler11:               SInt32;
        filler12:               SInt32;
        filler13:               SInt32;
        ioWDDirID:              UInt32;
    end;

    FIDParamPtr = ^FIDParam;
    FIDParam = record
        qLink:                  QElemPtr;                               { queue link in header }
        qType:                  SInt16;                             { type byte for safety check }
        ioTrap:                 SInt16;                             { FS: the Trap }
        ioCmdAddr:              Ptr;                                    { FS: address to dispatch to }
        ioCompletion:           IOCompletionUPP;                        { completion routine addr (0 for synch calls) }
        ioResult:               OSErr;                                  { result code }
        ioNamePtr:              StringPtr;                              { ptr to Vol:FileName string }
        ioVRefNum:              SInt16;                             { volume refnum (DrvNum for Eject and MountVol) }
        filler14:               SInt32;
        ioDestNamePtr:          StringPtr;                              {  dest file name  }
        filler15:               SInt32;
        ioDestDirID:            UInt32;                             {  dest file's directory id  }
        filler16:               SInt32;
        filler17:               SInt32;
        ioSrcDirID:             UInt32;                             {  source file's directory id  }
        filler18:               SInt16;
        ioFileID:               SInt32;                             {  file ID  }
    end;

    ForeignPrivParamPtr = ^ForeignPrivParam;
    ForeignPrivParam = record
        qLink:                  QElemPtr;                               { queue link in header }
        qType:                  SInt16;                             { type byte for safety check }
        ioTrap:                 SInt16;                             { FS: the Trap }
        ioCmdAddr:              Ptr;                                    { FS: address to dispatch to }
        ioCompletion:           IOCompletionUPP;                        { completion routine addr (0 for synch calls) }
        ioResult:               OSErr;                                  { result code }
        ioNamePtr:              StringPtr;                              { ptr to Vol:FileName string }
        ioVRefNum:              SInt16;                             { volume refnum (DrvNum for Eject and MountVol) }
        ioFiller21:             SInt32;
        ioFiller22:             SInt32;
        ioForeignPrivBuffer:    Ptr;
        ioForeignPrivActCount:  SInt32;
        ioForeignPrivReqCount:  SInt32;
        ioFiller23:             SInt32;
        ioForeignPrivDirID:     UInt32;
        ioForeignPrivInfo1:     SInt32;
        ioForeignPrivInfo2:     SInt32;
        ioForeignPrivInfo3:     SInt32;
        ioForeignPrivInfo4:     SInt32;
    end;

    CSParamPtr = ^CSParam;
    CSParam = record
        qLink:                  QElemPtr;                               { queue link in header }
        qType:                  SInt16;                             { type byte for safety check }
        ioTrap:                 SInt16;                             { FS: the Trap }
        ioCmdAddr:              Ptr;                                    { FS: address to dispatch to }
        ioCompletion:           IOCompletionUPP;                        { completion routine addr (0 for synch calls) }
        ioResult:               OSErr;                                  { result code }
        ioNamePtr:              StringPtr;                              { ptr to Vol:FileName string }
        ioVRefNum:              SInt16;                             { volume refnum (DrvNum for Eject and MountVol) }
        ioMatchPtr:             FSSpecPtr;                              {  match array  }
        ioReqMatchCount:        SInt32;                             {  maximum allowable matches  }
        ioActMatchCount:        SInt32;                             {  actual match count  }
        ioSearchBits:           SInt32;                             {  search criteria selector  }
        ioSearchInfo1:          CInfoPBPtr;                             {  search values and range lower bounds  }
        ioSearchInfo2:          CInfoPBPtr;                             {  search values and range upper bounds  }
        ioSearchTime:           SInt32;                             {  length of time to run search  }
        ioCatPosition:          CatPositionRec;                         {  current position in the catalog  }
        ioOptBuffer:            Ptr;                                    {  optional performance enhancement buffer  }
        ioOptBufSize:           SInt32;                             {  size of buffer pointed to by ioOptBuffer  }
    end;



    HParamBlockRecPtr = ^HParamBlockRec;
    HParamBlockRec = record
        qLink:                  QElemPtr;                               { queue link in header }
        qType:                  SInt16;                             { type byte for safety check }
        ioTrap:                 SInt16;                             { FS: the Trap }
        ioCmdAddr:              Ptr;                                    { FS: address to dispatch to }
        ioCompletion:           IOCompletionUPP;                        { completion routine addr (0 for synch calls) }
        ioResult:               OSErr;                                  { result code }
        ioNamePtr:              StringPtr;                              { ptr to Vol:FileName string }
        ioVRefNum:              SInt16;                             { volume refnum (DrvNum for Eject and MountVol) }
        case SInt16 of
        0: (
            ioRefNum:           SInt16;
            ioVersNum:          SInt8;
            ioPermssn:          SInt8;
            ioMisc:             Ptr;
            ioBuffer:           Ptr;
            ioReqCount:         SInt32;
            ioActCount:         SInt32;
            ioPosMode:          SInt16;
            ioPosOffset:        SInt32;
           );
        1: (
            ioFRefNum:          SInt16;
            ioFVersNum:         SInt8;
            filler1:            SInt8;
            ioFDirIndex:        SInt16;
            ioFlAttrib:         SInt8;
            ioFlVersNum:        SInt8;
            ioFlFndrInfo:       FInfo;
            ioDirID:            UInt32;
            ioFlStBlk:          UInt16;
            ioFlLgLen:          SInt32;
            ioFlPyLen:          SInt32;
            ioFlRStBlk:         UInt16;
            ioFlRLgLen:         SInt32;
            ioFlRPyLen:         SInt32;
            ioFlCrDat:          UInt32;
            ioFlMdDat:          UInt32;
           );
        2: (
            filler2:            SInt32;
            ioVolIndex:         SInt16;
            ioVCrDate:          UInt32;
            ioVLsMod:           UInt32;
            ioVAtrb:            SInt16;
            ioVNmFls:           UInt16;
            ioVBitMap:          UInt16;
            ioAllocPtr:         UInt16;
            ioVNmAlBlks:        UInt16;
            ioVAlBlkSiz:        UInt32;
            ioVClpSiz:          UInt32;
            ioAlBlSt:           UInt16;
            ioVNxtCNID:         UInt32;
            ioVFrBlk:           UInt16;
            ioVSigWord:         UInt16;
            ioVDrvInfo:         SInt16;
            ioVDRefNum:         SInt16;
            ioVFSID:            SInt16;
            ioVBkUp:            UInt32;
            ioVSeqNum:          UInt16;
            ioVWrCnt:           UInt32;
            ioVFilCnt:          UInt32;
            ioVDirCnt:          UInt32;
            ioVFndrInfo:        array [1..8] of SInt32;
           );
        3: (
            filler3:            SInt16;
            ioDenyModes:        SInt16;                             { access rights data }
            filler4:            SInt16;
            filler5:            SInt8;
            ioACUser:           SInt8;                                  { access rights for directory only }
            filler6:            SInt32;
            ioACOwnerID:        SInt32;                             { owner ID }
            ioACGroupID:        SInt32;                             { group ID }
            ioACAccess:         SInt32;                             { access rights }
           );
        4: (
            filler7:            SInt16;
            ioObjType:          SInt16;                             { function code }
            ioObjNamePtr:       StringPtr;                              { ptr to returned creator/group name }
            ioObjID:            SInt32;                             { creator/group ID }
           );
        5: (
            ioDstVRefNum:       SInt16;                             { destination vol identifier }
            filler8:            SInt16;
            ioNewName:          StringPtr;                              { ptr to destination pathname }
            ioCopyName:         StringPtr;                              { ptr to optional name }
            ioNewDirID:         UInt32;                             { destination directory ID }
           );
        6: (
            ioWDCreated:        SInt16;
            ioWDIndex:          SInt16;
            ioWDProcID:         SInt32;
            ioWDVRefNum:        SInt16;
            filler10:           SInt16;
            filler11:           SInt32;
            filler12:           SInt32;
            filler13:           SInt32;
            ioWDDirID:          UInt32;
           );
        7: (
            filler14:           SInt32;
            ioDestNamePtr:      StringPtr;                              {  dest file name  }
            filler15:           SInt32;
            ioDestDirID:        UInt32;                             {  dest file's directory id  }
            filler16:           SInt32;
            filler17:           SInt32;
            ioSrcDirID:         UInt32;                             {  source file's directory id  }
            filler18:           SInt16;
            ioFileID:           SInt32;                             {  file ID  }
           );
        8: (
            ioMatchPtr:         FSSpecPtr;                              {  match array  }
            ioReqMatchCount:    SInt32;                             {  maximum allowable matches  }
            ioActMatchCount:    SInt32;                             {  actual match count  }
            ioSearchBits:       SInt32;                             {  search criteria selector  }
            ioSearchInfo1:      CInfoPBPtr;                             {  search values and range lower bounds  }
            ioSearchInfo2:      CInfoPBPtr;                             {  search values and range upper bounds  }
            ioSearchTime:       SInt32;                             {  length of time to run search  }
            ioCatPosition:      CatPositionRec;                         {  current position in the catalog  }
            ioOptBuffer:        Ptr;                                    {  optional performance enhancement buffer  }
            ioOptBufSize:       SInt32;                             {  size of buffer pointed to by ioOptBuffer  }
           );
        9: (
            ioFiller21:         SInt32;
            ioFiller22:         SInt32;
            ioForeignPrivBuffer: Ptr;
            ioForeignPrivActCount: SInt32;
            ioForeignPrivReqCount: SInt32;
            ioFiller23:         SInt32;
            ioForeignPrivDirID: UInt32;
            ioForeignPrivInfo1: SInt32;
            ioForeignPrivInfo2: SInt32;
            ioForeignPrivInfo3: SInt32;
            ioForeignPrivInfo4: SInt32;
           );
    end;

    HParmBlkPtr                         = ^HParamBlockRec;

    CMovePBRecPtr = ^CMovePBRec;
    CMovePBRec = record
        qLink:                  QElemPtr;
        qType:                  SInt16;
        ioTrap:                 SInt16;
        ioCmdAddr:              Ptr;
        ioCompletion:           IOCompletionUPP;
        ioResult:               OSErr;
        ioNamePtr:              StringPtr;
        ioVRefNum:              SInt16;
        filler1:                SInt32;
        ioNewName:              StringPtr;
        filler2:                SInt32;
        ioNewDirID:             UInt32;
        filler3:                array [1..2] of SInt32;
        ioDirID:                UInt32;
    end;

    CMovePBPtr                          = ^CMovePBRec;
    WDPBRecPtr = ^WDPBRec;
    WDPBRec = record
        qLink:                  QElemPtr;
        qType:                  SInt16;
        ioTrap:                 SInt16;
        ioCmdAddr:              Ptr;
        ioCompletion:           IOCompletionUPP;
        ioResult:               OSErr;
        ioNamePtr:              StringPtr;
        ioVRefNum:              SInt16;
        filler1:                SInt16;
        ioWDIndex:              SInt16;
        ioWDProcID:             SInt32;
        ioWDVRefNum:            SInt16;
        filler2:                array [1..7] of SInt16;
        ioWDDirID:              UInt32;
    end;

    WDPBPtr                             = ^WDPBRec;
    FCBPBRecPtr = ^FCBPBRec;
    FCBPBRec = record
        qLink:                  QElemPtr;
        qType:                  SInt16;
        ioTrap:                 SInt16;
        ioCmdAddr:              Ptr;
        ioCompletion:           IOCompletionUPP;
        ioResult:               OSErr;
        ioNamePtr:              StringPtr;
        ioVRefNum:              SInt16;
        ioRefNum:               SInt16;
        filler:                 SInt16;
        ioFCBIndx:              SInt16;
        filler1:                SInt16;
        ioFCBFlNm:              SInt32;
        ioFCBFlags:             SInt16;
        ioFCBStBlk:             UInt16;
        ioFCBEOF:               SInt32;
        ioFCBPLen:              SInt32;
        ioFCBCrPs:              SInt32;
        ioFCBVRefNum:           SInt16;
        ioFCBClpSiz:            SInt32;
        ioFCBParID:             SInt32;
    end;

    FCBPBPtr                            = ^FCBPBRec;
    VCBPtr = ^VCB;
    VCB = record
        qLink:                  QElemPtr;
        qType:                  SInt16;
        vcbFlags:               SInt16;
        vcbSigWord:             UInt16;
        vcbCrDate:              UInt32;
        vcbLsMod:               UInt32;
        vcbAtrb:                SInt16;
        vcbNmFls:               UInt16;
        vcbVBMSt:               SInt16;
        vcbAllocPtr:            SInt16;
        vcbNmAlBlks:            UInt16;
        vcbAlBlkSiz:            SInt32;
        vcbClpSiz:              SInt32;
        vcbAlBlSt:              SInt16;
        vcbNxtCNID:             SInt32;
        vcbFreeBks:             UInt16;
        vcbVN:                  Str27;
        vcbDrvNum:              SInt16;
        vcbDRefNum:             SInt16;
        vcbFSID:                SInt16;
        vcbVRefNum:             SInt16;
        vcbMAdr:                Ptr;
        vcbBufAdr:              Ptr;
        vcbMLen:                SInt16;
        vcbDirIndex:            SInt16;
        vcbDirBlk:              SInt16;
        vcbVolBkUp:             UInt32;
        vcbVSeqNum:             UInt16;
        vcbWrCnt:               SInt32;
        vcbXTClpSiz:            SInt32;
        vcbCTClpSiz:            SInt32;
        vcbNmRtDirs:            UInt16;
        vcbFilCnt:              SInt32;
        vcbDirCnt:              SInt32;
        vcbFndrInfo:            array [1..8] of SInt32;
        vcbVCSize:              UInt16;
        vcbVBMCSiz:             UInt16;
        vcbCtlCSiz:             UInt16;
        vcbXTAlBlks:            UInt16;
        vcbCTAlBlks:            UInt16;
        vcbXTRef:               SInt16;
        vcbCTRef:               SInt16;
        vcbCtlBuf:              Ptr;
        vcbDirIDM:              SInt32;
        vcbOffsM:               SInt16;
    end;

    DrvQElPtr = ^DrvQEl;
    DrvQEl = record
        qLink:                  QElemPtr;
        qType:                  SInt16;
        dQDrive:                SInt16;
        dQRefNum:               SInt16;
        dQFSID:                 SInt16;
        dQDrvSz:                UInt16;
        dQDrvSz2:               UInt16;
    end;


const
    uppIOCompletionProcInfo = $00009802;
    {
     *  NewIOCompletionUPP()
     *
     *  Availability:
     *    Non-Carbon CFM:   available as macro/inline
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function NewIOCompletionUPP(userRoutine: IOCompletionProcPtr): IOCompletionUPP; external name '_NewIOCompletionUPP'; { old name was NewIOCompletionProc }
{
 *  DisposeIOCompletionUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeIOCompletionUPP(userUPP: IOCompletionUPP); external name '_DisposeIOCompletionUPP';
{
 *  InvokeIOCompletionUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvokeIOCompletionUPP(paramBlock: ParmBlkPtr; userRoutine: IOCompletionUPP); external name '_InvokeIOCompletionUPP'; { old name was CallIOCompletionProc }

{
   PBOpenSync(), PBOpenAsync(), PBOpenImmed() were moved to Devices.h
   PBCloseSync(), PBCloseAsync(), PBCloseImmed() were moved to Devices.h
   PBReadSync(), PBReadAsync(), PBReadImmed() were moved to Devices.h
   PBWriteSync(), PBWriteAsync(), PBWriteImmed() were moved to Devices.h
}



{
 *  PBXGetVolInfoSync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBXGetVolInfoSync(paramBlock: XVolumeParamPtr): OSErr; external name '_PBXGetVolInfoSync';
{
 *  PBXGetVolInfoAsync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBXGetVolInfoAsync(paramBlock: XVolumeParamPtr): OSErr; external name '_PBXGetVolInfoAsync';

{
 *  PBFlushVolSync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBFlushVolSync(paramBlock: ParmBlkPtr): OSErr; external name '_PBFlushVolSync';
{
 *  PBFlushVolAsync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBFlushVolAsync(paramBlock: ParmBlkPtr): OSErr; external name '_PBFlushVolAsync';

{
 *  PBAllocateSync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBAllocateSync(paramBlock: ParmBlkPtr): OSErr; external name '_PBAllocateSync';
{
 *  PBAllocateAsync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBAllocateAsync(paramBlock: ParmBlkPtr): OSErr; external name '_PBAllocateAsync';
{
 *  PBGetEOFSync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBGetEOFSync(paramBlock: ParmBlkPtr): OSErr; external name '_PBGetEOFSync';
{
 *  PBGetEOFAsync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBGetEOFAsync(paramBlock: ParmBlkPtr): OSErr; external name '_PBGetEOFAsync';
{
 *  PBSetEOFSync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBSetEOFSync(paramBlock: ParmBlkPtr): OSErr; external name '_PBSetEOFSync';
{
 *  PBSetEOFAsync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBSetEOFAsync(paramBlock: ParmBlkPtr): OSErr; external name '_PBSetEOFAsync';
{
 *  PBGetFPosSync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBGetFPosSync(paramBlock: ParmBlkPtr): OSErr; external name '_PBGetFPosSync';
{
 *  PBGetFPosAsync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBGetFPosAsync(paramBlock: ParmBlkPtr): OSErr; external name '_PBGetFPosAsync';
{
 *  PBSetFPosSync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBSetFPosSync(paramBlock: ParmBlkPtr): OSErr; external name '_PBSetFPosSync';
{
 *  PBSetFPosAsync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBSetFPosAsync(paramBlock: ParmBlkPtr): OSErr; external name '_PBSetFPosAsync';
{
 *  PBFlushFileSync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBFlushFileSync(paramBlock: ParmBlkPtr): OSErr; external name '_PBFlushFileSync';
{
 *  PBFlushFileAsync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBFlushFileAsync(paramBlock: ParmBlkPtr): OSErr; external name '_PBFlushFileAsync';

{
 *  PBUnmountVol()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBUnmountVol(paramBlock: ParmBlkPtr): OSErr; external name '_PBUnmountVol';

{
 *  PBCatSearchSync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBCatSearchSync(paramBlock: CSParamPtr): OSErr; external name '_PBCatSearchSync';
{
 *  PBCatSearchAsync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBCatSearchAsync(paramBlock: CSParamPtr): OSErr; external name '_PBCatSearchAsync';

{
 *  UnmountVol()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function UnmountVol(volName: ConstStringPtr; vRefNum: SInt16): OSErr; external name '_UnmountVol';


{
 *  FlushVol()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FlushVol(volName: ConstStringPtr; vRefNum: SInt16): OSErr; external name '_FlushVol';

{
 *  HSetVol()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function HSetVol(volName: ConstStringPtr; vRefNum: SInt16; dirID: UInt32): OSErr; external name '_HSetVol';

{  AddDrive() was moved to Devices.h }


{
 *  FSClose()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FSClose(refNum: SInt16): OSErr; external name '_FSClose';

{
 *  FSRead()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FSRead(refNum: SInt16; var count: SInt32; buffPtr: UnivPtr): OSErr; external name '_FSRead';

{
 *  FSWrite()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FSWrite(refNum: SInt16; var count: SInt32; buffPtr: UnivPtr): OSErr; external name '_FSWrite';


{
 *  Allocate()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function Allocate(refNum: SInt16; var count: SInt32): OSErr; external name '_Allocate';

{
 *  GetEOF()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetEOF(refNum: SInt16; var logEOF: SInt32): OSErr; external name '_GetEOF';

{
 *  SetEOF()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetEOF(refNum: SInt16; logEOF: SInt32): OSErr; external name '_SetEOF';

{
 *  GetFPos()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetFPos(refNum: SInt16; var filePos: SInt32): OSErr; external name '_GetFPos';

{
 *  SetFPos()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetFPos(refNum: SInt16; posMode: SInt16; posOff: SInt32): OSErr; external name '_SetFPos';

{
 *  GetVRefNum()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetVRefNum(fileRefNum: SInt16; var vRefNum: SInt16): OSErr; external name '_GetVRefNum';


{
 *  PBHSetVolSync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBHSetVolSync(paramBlock: WDPBPtr): OSErr; external name '_PBHSetVolSync';
{
 *  PBHSetVolAsync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBHSetVolAsync(paramBlock: WDPBPtr): OSErr; external name '_PBHSetVolAsync';
{
 *  PBHGetVolSync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBHGetVolSync(paramBlock: WDPBPtr): OSErr; external name '_PBHGetVolSync';
{
 *  PBHGetVolAsync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBHGetVolAsync(paramBlock: WDPBPtr): OSErr; external name '_PBHGetVolAsync';
{
 *  PBCatMoveSync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBCatMoveSync(paramBlock: CMovePBPtr): OSErr; external name '_PBCatMoveSync';
{
 *  PBCatMoveAsync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBCatMoveAsync(paramBlock: CMovePBPtr): OSErr; external name '_PBCatMoveAsync';
{
 *  PBDirCreateSync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBDirCreateSync(paramBlock: HParmBlkPtr): OSErr; external name '_PBDirCreateSync';
{
 *  PBDirCreateAsync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBDirCreateAsync(paramBlock: HParmBlkPtr): OSErr; external name '_PBDirCreateAsync';

{
 *  PBGetFCBInfoSync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBGetFCBInfoSync(paramBlock: FCBPBPtr): OSErr; external name '_PBGetFCBInfoSync';
{
 *  PBGetFCBInfoAsync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBGetFCBInfoAsync(paramBlock: FCBPBPtr): OSErr; external name '_PBGetFCBInfoAsync';
{
 *  PBGetCatInfoSync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBGetCatInfoSync(paramBlock: CInfoPBPtr): OSErr; external name '_PBGetCatInfoSync';
{
 *  PBGetCatInfoAsync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBGetCatInfoAsync(paramBlock: CInfoPBPtr): OSErr; external name '_PBGetCatInfoAsync';
{
 *  PBSetCatInfoSync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBSetCatInfoSync(paramBlock: CInfoPBPtr): OSErr; external name '_PBSetCatInfoSync';
{
 *  PBSetCatInfoAsync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBSetCatInfoAsync(paramBlock: CInfoPBPtr): OSErr; external name '_PBSetCatInfoAsync';
{
 *  PBAllocContigSync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBAllocContigSync(paramBlock: ParmBlkPtr): OSErr; external name '_PBAllocContigSync';
{
 *  PBAllocContigAsync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBAllocContigAsync(paramBlock: ParmBlkPtr): OSErr; external name '_PBAllocContigAsync';
{
 *  PBLockRangeSync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBLockRangeSync(paramBlock: ParmBlkPtr): OSErr; external name '_PBLockRangeSync';
{
 *  PBLockRangeAsync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBLockRangeAsync(paramBlock: ParmBlkPtr): OSErr; external name '_PBLockRangeAsync';
{
 *  PBUnlockRangeSync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBUnlockRangeSync(paramBlock: ParmBlkPtr): OSErr; external name '_PBUnlockRangeSync';
{
 *  PBUnlockRangeAsync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBUnlockRangeAsync(paramBlock: ParmBlkPtr): OSErr; external name '_PBUnlockRangeAsync';
{
 *  PBSetVInfoSync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBSetVInfoSync(paramBlock: HParmBlkPtr): OSErr; external name '_PBSetVInfoSync';
{
 *  PBSetVInfoAsync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBSetVInfoAsync(paramBlock: HParmBlkPtr): OSErr; external name '_PBSetVInfoAsync';
{
 *  PBHGetVInfoSync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBHGetVInfoSync(paramBlock: HParmBlkPtr): OSErr; external name '_PBHGetVInfoSync';
{
 *  PBHGetVInfoAsync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBHGetVInfoAsync(paramBlock: HParmBlkPtr): OSErr; external name '_PBHGetVInfoAsync';
{
 *  PBHOpenSync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBHOpenSync(paramBlock: HParmBlkPtr): OSErr; external name '_PBHOpenSync';
{
 *  PBHOpenAsync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBHOpenAsync(paramBlock: HParmBlkPtr): OSErr; external name '_PBHOpenAsync';
{
 *  PBHOpenRFSync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBHOpenRFSync(paramBlock: HParmBlkPtr): OSErr; external name '_PBHOpenRFSync';
{
 *  PBHOpenRFAsync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBHOpenRFAsync(paramBlock: HParmBlkPtr): OSErr; external name '_PBHOpenRFAsync';
{
 *  PBHOpenDFSync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBHOpenDFSync(paramBlock: HParmBlkPtr): OSErr; external name '_PBHOpenDFSync';
{
 *  PBHOpenDFAsync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBHOpenDFAsync(paramBlock: HParmBlkPtr): OSErr; external name '_PBHOpenDFAsync';
{
 *  PBHCreateSync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBHCreateSync(paramBlock: HParmBlkPtr): OSErr; external name '_PBHCreateSync';
{
 *  PBHCreateAsync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBHCreateAsync(paramBlock: HParmBlkPtr): OSErr; external name '_PBHCreateAsync';
{
 *  PBHDeleteSync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBHDeleteSync(paramBlock: HParmBlkPtr): OSErr; external name '_PBHDeleteSync';
{
 *  PBHDeleteAsync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBHDeleteAsync(paramBlock: HParmBlkPtr): OSErr; external name '_PBHDeleteAsync';
{
 *  PBHRenameSync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBHRenameSync(paramBlock: HParmBlkPtr): OSErr; external name '_PBHRenameSync';
{
 *  PBHRenameAsync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBHRenameAsync(paramBlock: HParmBlkPtr): OSErr; external name '_PBHRenameAsync';
{
 *  PBHRstFLockSync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBHRstFLockSync(paramBlock: HParmBlkPtr): OSErr; external name '_PBHRstFLockSync';
{
 *  PBHRstFLockAsync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBHRstFLockAsync(paramBlock: HParmBlkPtr): OSErr; external name '_PBHRstFLockAsync';
{
 *  PBHSetFLockSync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBHSetFLockSync(paramBlock: HParmBlkPtr): OSErr; external name '_PBHSetFLockSync';
{
 *  PBHSetFLockAsync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBHSetFLockAsync(paramBlock: HParmBlkPtr): OSErr; external name '_PBHSetFLockAsync';
{
 *  PBHGetFInfoSync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBHGetFInfoSync(paramBlock: HParmBlkPtr): OSErr; external name '_PBHGetFInfoSync';
{
 *  PBHGetFInfoAsync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBHGetFInfoAsync(paramBlock: HParmBlkPtr): OSErr; external name '_PBHGetFInfoAsync';
{
 *  PBHSetFInfoSync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBHSetFInfoSync(paramBlock: HParmBlkPtr): OSErr; external name '_PBHSetFInfoSync';
{
 *  PBHSetFInfoAsync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBHSetFInfoAsync(paramBlock: HParmBlkPtr): OSErr; external name '_PBHSetFInfoAsync';
{
 *  PBMakeFSSpecSync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBMakeFSSpecSync(paramBlock: HParmBlkPtr): OSErr; external name '_PBMakeFSSpecSync';
{
 *  PBMakeFSSpecAsync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBMakeFSSpecAsync(paramBlock: HParmBlkPtr): OSErr; external name '_PBMakeFSSpecAsync';


{
 *  HGetVol()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function HGetVol(volName: StringPtr; var vRefNum: SInt16; var dirID: UInt32): OSErr; external name '_HGetVol';

{
 *  HOpen()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function HOpen(vRefNum: SInt16; dirID: UInt32; const (*var*) fileName: Str255; permission: SInt8; var refNum: SInt16): OSErr; external name '_HOpen';

{
 *  HOpenDF()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function HOpenDF(vRefNum: SInt16; dirID: UInt32; const (*var*) fileName: Str255; permission: SInt8; var refNum: SInt16): OSErr; external name '_HOpenDF';

{
 *  HOpenRF()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function HOpenRF(vRefNum: SInt16; dirID: UInt32; const (*var*) fileName: Str255; permission: SInt8; var refNum: SInt16): OSErr; external name '_HOpenRF';

{
 *  AllocContig()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function AllocContig(refNum: SInt16; var count: SInt32): OSErr; external name '_AllocContig';

{
 *  HCreate()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function HCreate(vRefNum: SInt16; dirID: UInt32; const (*var*) fileName: Str255; creator: OSType; fileType: OSType): OSErr; external name '_HCreate';

{
 *  DirCreate()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DirCreate(vRefNum: SInt16; parentDirID: UInt32; const (*var*) directoryName: Str255; var createdDirID: UInt32): OSErr; external name '_DirCreate';

{
 *  HDelete()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function HDelete(vRefNum: SInt16; dirID: UInt32; const (*var*) fileName: Str255): OSErr; external name '_HDelete';

{
 *  HGetFInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function HGetFInfo(vRefNum: SInt16; dirID: UInt32; const (*var*) fileName: Str255; var fndrInfo: FInfo): OSErr; external name '_HGetFInfo';

{
 *  HSetFInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function HSetFInfo(vRefNum: SInt16; dirID: UInt32; const (*var*) fileName: Str255; const (*var*) fndrInfo: FInfo): OSErr; external name '_HSetFInfo';

{
 *  HSetFLock()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function HSetFLock(vRefNum: SInt16; dirID: UInt32; const (*var*) fileName: Str255): OSErr; external name '_HSetFLock';

{
 *  HRstFLock()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function HRstFLock(vRefNum: SInt16; dirID: UInt32; const (*var*) fileName: Str255): OSErr; external name '_HRstFLock';

{
 *  HRename()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function HRename(vRefNum: SInt16; dirID: UInt32; const (*var*) oldName: Str255; const (*var*) newName: Str255): OSErr; external name '_HRename';

{
 *  CatMove()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CatMove(vRefNum: SInt16; dirID: UInt32; const (*var*) oldName: Str255; newDirID: UInt32; const (*var*) newName: Str255): OSErr; external name '_CatMove';


{
 *  PBHGetVolParmsSync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBHGetVolParmsSync(paramBlock: HParmBlkPtr): OSErr; external name '_PBHGetVolParmsSync';
{
 *  PBHGetVolParmsAsync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBHGetVolParmsAsync(paramBlock: HParmBlkPtr): OSErr; external name '_PBHGetVolParmsAsync';
{
 *  PBHGetLogInInfoSync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBHGetLogInInfoSync(paramBlock: HParmBlkPtr): OSErr; external name '_PBHGetLogInInfoSync';
{
 *  PBHGetLogInInfoAsync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBHGetLogInInfoAsync(paramBlock: HParmBlkPtr): OSErr; external name '_PBHGetLogInInfoAsync';
{
 *  PBHGetDirAccessSync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBHGetDirAccessSync(paramBlock: HParmBlkPtr): OSErr; external name '_PBHGetDirAccessSync';
{
 *  PBHGetDirAccessAsync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBHGetDirAccessAsync(paramBlock: HParmBlkPtr): OSErr; external name '_PBHGetDirAccessAsync';
{
 *  PBHSetDirAccessSync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBHSetDirAccessSync(paramBlock: HParmBlkPtr): OSErr; external name '_PBHSetDirAccessSync';
{
 *  PBHSetDirAccessAsync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBHSetDirAccessAsync(paramBlock: HParmBlkPtr): OSErr; external name '_PBHSetDirAccessAsync';
{
 *  PBHMapIDSync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBHMapIDSync(paramBlock: HParmBlkPtr): OSErr; external name '_PBHMapIDSync';
{
 *  PBHMapIDAsync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBHMapIDAsync(paramBlock: HParmBlkPtr): OSErr; external name '_PBHMapIDAsync';
{
 *  PBHMapNameSync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBHMapNameSync(paramBlock: HParmBlkPtr): OSErr; external name '_PBHMapNameSync';
{
 *  PBHMapNameAsync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBHMapNameAsync(paramBlock: HParmBlkPtr): OSErr; external name '_PBHMapNameAsync';
{
 *  PBHCopyFileSync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBHCopyFileSync(paramBlock: HParmBlkPtr): OSErr; external name '_PBHCopyFileSync';
{
 *  PBHCopyFileAsync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBHCopyFileAsync(paramBlock: HParmBlkPtr): OSErr; external name '_PBHCopyFileAsync';
{
 *  PBHMoveRenameSync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBHMoveRenameSync(paramBlock: HParmBlkPtr): OSErr; external name '_PBHMoveRenameSync';
{
 *  PBHMoveRenameAsync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBHMoveRenameAsync(paramBlock: HParmBlkPtr): OSErr; external name '_PBHMoveRenameAsync';
{
 *  PBHOpenDenySync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBHOpenDenySync(paramBlock: HParmBlkPtr): OSErr; external name '_PBHOpenDenySync';
{
 *  PBHOpenDenyAsync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBHOpenDenyAsync(paramBlock: HParmBlkPtr): OSErr; external name '_PBHOpenDenyAsync';
{
 *  PBHOpenRFDenySync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBHOpenRFDenySync(paramBlock: HParmBlkPtr): OSErr; external name '_PBHOpenRFDenySync';
{
 *  PBHOpenRFDenyAsync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBHOpenRFDenyAsync(paramBlock: HParmBlkPtr): OSErr; external name '_PBHOpenRFDenyAsync';
{
 *  PBGetXCatInfoSync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBGetXCatInfoSync(paramBlock: XCInfoPBPtr): OSErr; external name '_PBGetXCatInfoSync';
{
 *  PBGetXCatInfoAsync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBGetXCatInfoAsync(paramBlock: XCInfoPBPtr): OSErr; external name '_PBGetXCatInfoAsync';
{
 *  PBExchangeFilesSync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBExchangeFilesSync(paramBlock: HParmBlkPtr): OSErr; external name '_PBExchangeFilesSync';
{
 *  PBExchangeFilesAsync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBExchangeFilesAsync(paramBlock: HParmBlkPtr): OSErr; external name '_PBExchangeFilesAsync';
{
 *  PBCreateFileIDRefSync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBCreateFileIDRefSync(paramBlock: HParmBlkPtr): OSErr; external name '_PBCreateFileIDRefSync';
{
 *  PBCreateFileIDRefAsync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBCreateFileIDRefAsync(paramBlock: HParmBlkPtr): OSErr; external name '_PBCreateFileIDRefAsync';
{
 *  PBResolveFileIDRefSync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBResolveFileIDRefSync(paramBlock: HParmBlkPtr): OSErr; external name '_PBResolveFileIDRefSync';
{
 *  PBResolveFileIDRefAsync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBResolveFileIDRefAsync(paramBlock: HParmBlkPtr): OSErr; external name '_PBResolveFileIDRefAsync';
{
 *  PBDeleteFileIDRefSync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBDeleteFileIDRefSync(paramBlock: HParmBlkPtr): OSErr; external name '_PBDeleteFileIDRefSync';
{
 *  PBDeleteFileIDRefAsync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBDeleteFileIDRefAsync(paramBlock: HParmBlkPtr): OSErr; external name '_PBDeleteFileIDRefAsync';
{
 *  PBGetForeignPrivsSync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBGetForeignPrivsSync(paramBlock: HParmBlkPtr): OSErr; external name '_PBGetForeignPrivsSync';
{
 *  PBGetForeignPrivsAsync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBGetForeignPrivsAsync(paramBlock: HParmBlkPtr): OSErr; external name '_PBGetForeignPrivsAsync';
{
 *  PBSetForeignPrivsSync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBSetForeignPrivsSync(paramBlock: HParmBlkPtr): OSErr; external name '_PBSetForeignPrivsSync';
{
 *  PBSetForeignPrivsAsync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBSetForeignPrivsAsync(paramBlock: HParmBlkPtr): OSErr; external name '_PBSetForeignPrivsAsync';
{  Desktop Manager  }
{
 *  PBDTGetPath()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBDTGetPath(paramBlock: DTPBPtr): OSErr; external name '_PBDTGetPath';
{
 *  PBDTCloseDown()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBDTCloseDown(paramBlock: DTPBPtr): OSErr; external name '_PBDTCloseDown';
{
 *  PBDTAddIconSync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBDTAddIconSync(paramBlock: DTPBPtr): OSErr; external name '_PBDTAddIconSync';
{
 *  PBDTAddIconAsync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBDTAddIconAsync(paramBlock: DTPBPtr): OSErr; external name '_PBDTAddIconAsync';
{
 *  PBDTGetIconSync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBDTGetIconSync(paramBlock: DTPBPtr): OSErr; external name '_PBDTGetIconSync';
{
 *  PBDTGetIconAsync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBDTGetIconAsync(paramBlock: DTPBPtr): OSErr; external name '_PBDTGetIconAsync';
{
 *  PBDTGetIconInfoSync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBDTGetIconInfoSync(paramBlock: DTPBPtr): OSErr; external name '_PBDTGetIconInfoSync';
{
 *  PBDTGetIconInfoAsync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBDTGetIconInfoAsync(paramBlock: DTPBPtr): OSErr; external name '_PBDTGetIconInfoAsync';
{
 *  PBDTAddAPPLSync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBDTAddAPPLSync(paramBlock: DTPBPtr): OSErr; external name '_PBDTAddAPPLSync';
{
 *  PBDTAddAPPLAsync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBDTAddAPPLAsync(paramBlock: DTPBPtr): OSErr; external name '_PBDTAddAPPLAsync';
{
 *  PBDTRemoveAPPLSync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBDTRemoveAPPLSync(paramBlock: DTPBPtr): OSErr; external name '_PBDTRemoveAPPLSync';
{
 *  PBDTRemoveAPPLAsync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBDTRemoveAPPLAsync(paramBlock: DTPBPtr): OSErr; external name '_PBDTRemoveAPPLAsync';
{
 *  PBDTGetAPPLSync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBDTGetAPPLSync(paramBlock: DTPBPtr): OSErr; external name '_PBDTGetAPPLSync';
{
 *  PBDTGetAPPLAsync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBDTGetAPPLAsync(paramBlock: DTPBPtr): OSErr; external name '_PBDTGetAPPLAsync';
{
 *  PBDTSetCommentSync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBDTSetCommentSync(paramBlock: DTPBPtr): OSErr; external name '_PBDTSetCommentSync';
{
 *  PBDTSetCommentAsync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBDTSetCommentAsync(paramBlock: DTPBPtr): OSErr; external name '_PBDTSetCommentAsync';
{
 *  PBDTRemoveCommentSync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBDTRemoveCommentSync(paramBlock: DTPBPtr): OSErr; external name '_PBDTRemoveCommentSync';
{
 *  PBDTRemoveCommentAsync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBDTRemoveCommentAsync(paramBlock: DTPBPtr): OSErr; external name '_PBDTRemoveCommentAsync';
{
 *  PBDTGetCommentSync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBDTGetCommentSync(paramBlock: DTPBPtr): OSErr; external name '_PBDTGetCommentSync';
{
 *  PBDTGetCommentAsync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBDTGetCommentAsync(paramBlock: DTPBPtr): OSErr; external name '_PBDTGetCommentAsync';
{
 *  PBDTFlushSync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBDTFlushSync(paramBlock: DTPBPtr): OSErr; external name '_PBDTFlushSync';
{
 *  PBDTFlushAsync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBDTFlushAsync(paramBlock: DTPBPtr): OSErr; external name '_PBDTFlushAsync';
{
 *  PBDTResetSync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBDTResetSync(paramBlock: DTPBPtr): OSErr; external name '_PBDTResetSync';
{
 *  PBDTResetAsync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBDTResetAsync(paramBlock: DTPBPtr): OSErr; external name '_PBDTResetAsync';
{
 *  PBDTGetInfoSync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBDTGetInfoSync(paramBlock: DTPBPtr): OSErr; external name '_PBDTGetInfoSync';
{
 *  PBDTGetInfoAsync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBDTGetInfoAsync(paramBlock: DTPBPtr): OSErr; external name '_PBDTGetInfoAsync';
{
 *  PBDTOpenInform()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBDTOpenInform(paramBlock: DTPBPtr): OSErr; external name '_PBDTOpenInform';
{
 *  PBDTDeleteSync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBDTDeleteSync(paramBlock: DTPBPtr): OSErr; external name '_PBDTDeleteSync';
{
 *  PBDTDeleteAsync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBDTDeleteAsync(paramBlock: DTPBPtr): OSErr; external name '_PBDTDeleteAsync';
{  VolumeMount traps  }
{
 *  PBGetVolMountInfoSize()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBGetVolMountInfoSize(paramBlock: ParmBlkPtr): OSErr; external name '_PBGetVolMountInfoSize';
{
 *  PBGetVolMountInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBGetVolMountInfo(paramBlock: ParmBlkPtr): OSErr; external name '_PBGetVolMountInfo';
{
 *  PBVolumeMount()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBVolumeMount(paramBlock: ParmBlkPtr): OSErr; external name '_PBVolumeMount';
{  FSp traps  }
{
 *  FSMakeFSSpec()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FSMakeFSSpec(vRefNum: SInt16; dirID: UInt32; const (*var*) fileName: Str255; var spec: FSSpec): OSErr; external name '_FSMakeFSSpec';
{
 *  FSpOpenDF()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FSpOpenDF(const (*var*) spec: FSSpec; permission: SInt8; var refNum: SInt16): OSErr; external name '_FSpOpenDF';
{
 *  FSpOpenRF()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FSpOpenRF(const (*var*) spec: FSSpec; permission: SInt8; var refNum: SInt16): OSErr; external name '_FSpOpenRF';
{
 *  FSpCreate()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FSpCreate(const (*var*) spec: FSSpec; creator: OSType; fileType: OSType; scriptTag: ScriptCode): OSErr; external name '_FSpCreate';
{
 *  FSpDirCreate()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FSpDirCreate(const (*var*) spec: FSSpec; scriptTag: ScriptCode; var createdDirID: UInt32): OSErr; external name '_FSpDirCreate';
{
 *  FSpDelete()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FSpDelete(const (*var*) spec: FSSpec): OSErr; external name '_FSpDelete';
{
 *  FSpGetFInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FSpGetFInfo(const (*var*) spec: FSSpec; var fndrInfo: FInfo): OSErr; external name '_FSpGetFInfo';
{
 *  FSpSetFInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FSpSetFInfo(const (*var*) spec: FSSpec; const (*var*) fndrInfo: FInfo): OSErr; external name '_FSpSetFInfo';
{
 *  FSpSetFLock()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FSpSetFLock(const (*var*) spec: FSSpec): OSErr; external name '_FSpSetFLock';
{
 *  FSpRstFLock()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FSpRstFLock(const (*var*) spec: FSSpec): OSErr; external name '_FSpRstFLock';
{
 *  FSpRename()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FSpRename(const (*var*) spec: FSSpec; const (*var*) newName: Str255): OSErr; external name '_FSpRename';
{
 *  FSpCatMove()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FSpCatMove(const (*var*) source: FSSpec; const (*var*) dest: FSSpec): OSErr; external name '_FSpCatMove';
{
 *  FSpExchangeFiles()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FSpExchangeFiles(const (*var*) source: FSSpec; const (*var*) dest: FSSpec): OSErr; external name '_FSpExchangeFiles';
{
 *  PBShareSync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBShareSync(paramBlock: HParmBlkPtr): OSErr; external name '_PBShareSync';
{
 *  PBShareAsync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBShareAsync(paramBlock: HParmBlkPtr): OSErr; external name '_PBShareAsync';
{
 *  PBUnshareSync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBUnshareSync(paramBlock: HParmBlkPtr): OSErr; external name '_PBUnshareSync';
{
 *  PBUnshareAsync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBUnshareAsync(paramBlock: HParmBlkPtr): OSErr; external name '_PBUnshareAsync';
{
 *  PBGetUGEntrySync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBGetUGEntrySync(paramBlock: HParmBlkPtr): OSErr; external name '_PBGetUGEntrySync';
{
 *  PBGetUGEntryAsync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBGetUGEntryAsync(paramBlock: HParmBlkPtr): OSErr; external name '_PBGetUGEntryAsync';


{
    The PBxxx() routines are obsolete.

    Use the PBxxxSync() or PBxxxAsync() version instead.
}



type
    FSVolumeRefNum                      = SInt16;
    FSVolumeRefNumPtr                   = ^FSVolumeRefNum; { when a VAR xx: FSVolumeRefNum parameter can be nil, it is changed to xx: FSVolumeRefNumPtr }

const
    kFSInvalidVolumeRefNum      = 0;


type
    FSRefPtr = ^FSRef;
    FSRef = record
        hidden:                 packed array [0..79] of UInt8;          {  private to File Manager; ¥¥ need symbolic constant  }
    end;


    {
     *  FSPermissionInfo
     *
     *  Discussion:
     *    This structure is used when kFSCatInfoPermissions is passed to
     *    the HFSPlus API. On return from GetCatalogInfo and
     *    GetCatalogInfoBulk, the userID, groupID, and mode fields are
     *    returned.  When passed to SetCatalogInfo, only the mode field is
     *    set.  See chmod(2) for details about the mode field. This is
     *    supported on Mac OS X only.
        }
    FSPermissionInfoPtr = ^FSPermissionInfo;
    FSPermissionInfo = record
        userID:                 UInt32;
        groupID:                UInt32;
        reserved1:              SInt8;
        userAccess:             SInt8;
        mode:                   UInt16;
        reserved2:              UInt32;
    end;

    {   CatalogInfoBitmap describes which fields of the CatalogInfo you wish to get or set. }
    FSCatalogInfoBitmap                 = UInt32;

const
    kFSCatInfoNone              = $00000000;
    kFSCatInfoTextEncoding      = $00000001;
    kFSCatInfoNodeFlags         = $00000002;                    {  Locked (bit 0) and directory (bit 4) only  }
    kFSCatInfoVolume            = $00000004;
    kFSCatInfoParentDirID       = $00000008;
    kFSCatInfoNodeID            = $00000010;
    kFSCatInfoCreateDate        = $00000020;
    kFSCatInfoContentMod        = $00000040;
    kFSCatInfoAttrMod           = $00000080;
    kFSCatInfoAccessDate        = $00000100;
    kFSCatInfoBackupDate        = $00000200;
    kFSCatInfoPermissions       = $00000400;                    {  Should this be finer granularity?  }
    kFSCatInfoFinderInfo        = $00000800;
    kFSCatInfoFinderXInfo       = $00001000;
    kFSCatInfoValence           = $00002000;                    {  Folders only, zero for files  }
    kFSCatInfoDataSizes         = $00004000;                    {  Data fork logical and physical size  }
    kFSCatInfoRsrcSizes         = $00008000;                    {  Resource fork logical and physical size  }
    kFSCatInfoSharingFlags      = $00010000;                    {  sharingFlags: kioFlAttribMountedBit, kioFlAttribSharePointBit  }
    kFSCatInfoUserPrivs         = $00020000;                    {  userPrivileges  }
    kFSCatInfoUserAccess        = $00080000;                    {  (OS X only)  }
    kFSCatInfoAllDates          = $000003E0;
    kFSCatInfoGettableInfo      = $0003FFFF;
    kFSCatInfoSettableInfo      = $00001FE3;                    {  flags, dates, permissions, Finder info, text encoding  }
    kFSCatInfoReserved          = $FFFC0000;                    {  bits that are currently reserved  }

    {     Constants for nodeFlags field of FSCatalogInfo    }
    kFSNodeLockedBit            = 0;                            {  Set if file or directory is locked  }
    kFSNodeLockedMask           = $0001;
    kFSNodeResOpenBit           = 2;                            {  Set if the resource fork is open  }
    kFSNodeResOpenMask          = $0004;
    kFSNodeDataOpenBit          = 3;                            {  Set if the data fork is open  }
    kFSNodeDataOpenMask         = $0008;
    kFSNodeIsDirectoryBit       = 4;                            {  Set if the object is a directory  }
    kFSNodeIsDirectoryMask      = $0010;
    kFSNodeCopyProtectBit       = 6;
    kFSNodeCopyProtectMask      = $0040;
    kFSNodeForkOpenBit          = 7;                            {  Set if the file or directory has any open fork  }
    kFSNodeForkOpenMask         = $0080;

    {     Constants for sharingFlags field of FSCatalogInfo     }
    kFSNodeInSharedBit          = 2;                            {  Set if a directory is within a share point  }
    kFSNodeInSharedMask         = $0004;
    kFSNodeIsMountedBit         = 3;                            {  Set if a directory is a share point currently mounted by some user  }
    kFSNodeIsMountedMask        = $0008;
    kFSNodeIsSharePointBit      = 5;                            {  Set if a directory is a share point (exported volume)  }
    kFSNodeIsSharePointMask     = $0020;



type
    FSCatalogInfoPtr = ^FSCatalogInfo;
    FSCatalogInfo = record
        nodeFlags:              UInt16;                                 {  node flags  }
        volume:                 FSVolumeRefNum;                         {  object's volume ref  }
        parentDirID:            UInt32;                                 {  parent directory's ID  }
        nodeID:                 UInt32;                                 {  file/directory ID  }
        sharingFlags:           SInt8;                                  {  kioFlAttribMountedBit and kioFlAttribSharePointBit  }
        userPrivileges:         SInt8;                                  {  user's effective AFP privileges (same as ioACUser)  }
        reserved1:              SInt8;
        reserved2:              SInt8;
        createDate:             UTCDateTime;                            {  date and time of creation  }
        contentModDate:         UTCDateTime;                            {  date and time of last fork modification  }
        attributeModDate:       UTCDateTime;                            {  date and time of last attribute modification  }
        accessDate:             UTCDateTime;                            {  date and time of last access (for Mac OS X)  }
        backupDate:             UTCDateTime;                            {  date and time of last backup  }
        permissions:            array [0..3] of UInt32;                 {  permissions (for Mac OS X)  }
        finderInfo:             packed array [0..15] of UInt8;          {  Finder information part 1  }
        extFinderInfo:          packed array [0..15] of UInt8;          {  Finder information part 2  }
        dataLogicalSize:        UInt64;                                 {  files only  }
        dataPhysicalSize:       UInt64;                                 {  files only  }
        rsrcLogicalSize:        UInt64;                                 {  files only  }
        rsrcPhysicalSize:       UInt64;                                 {  files only  }
        valence:                UInt32;                                 {  folders only  }
        textEncodingHint:       TextEncoding;
    end;

    FSRefParamPtr = ^FSRefParam;
    FSRefParam = record
        qLink:                  QElemPtr;                               { queue link in header }
        qType:                  SInt16;                             { type byte for safety check }
        ioTrap:                 SInt16;                             { FS: the Trap }
        ioCmdAddr:              Ptr;                                    { FS: address to dispatch to }
        ioCompletion:           IOCompletionUPP;                        { completion routine addr (0 for synch calls) }
        ioResult:               OSErr;                                  { result code }
        ioNamePtr:              ConstStringPtr;                         { ptr to Vol:FileName string }
        ioVRefNum:              SInt16;                             { volume refnum (DrvNum for Eject and MountVol) }
        reserved1:              SInt16;                                 {  was ioRefNum  }
        reserved2:              SInt8;                                  {  was ioVersNum  }
        reserved3:              SInt8;                                  {  was ioPermssn  }
        ref:                    FSRefPtr;                               {  Input ref; the target of the call  }
        whichInfo:              FSCatalogInfoBitmap;
        catInfo:                FSCatalogInfoPtr;
        nameLength:             UniCharCount;                           {  input name length for create/rename  }
        name:                   UniCharPtr;                             {  input name for create/rename  }
        ioDirID:                UInt32;
        spec:                   FSSpecPtr;
        parentRef:              FSRefPtr;                               {  ref of directory to move another ref to  }
        newRef:                 FSRefPtr;                               {  Output ref  }
        textEncodingHint:       TextEncoding;                           {  for Rename, MakeFSRefUnicode  }
        outName:                HFSUniStr255Ptr;                        {  Output name for GetCatalogInfo  }
    end;

    FSIterator    = ^SInt32; { an opaque 32-bit type }
    FSIteratorPtr = ^FSIterator;  { when a var xx:FSIterator parameter can be nil, it is changed to xx: FSIteratorPtr }

const
    kFSIterateFlat              = 0;                            {  Immediate children of container only  }
    kFSIterateSubtree           = 1;                            {  Entire subtree rooted at container  }
    kFSIterateDelete            = 2;
    kFSIterateReserved          = $FFFFFFFC;


type
    FSIteratorFlags                     = OptionBits;

const
                                                                {  CatalogSearch constants  }
    fsSBNodeID                  = $00008000;                    {  search by range of nodeID  }
    fsSBAttributeModDate        = $00010000;                    {  search by range of attributeModDate  }
    fsSBAccessDate              = $00020000;                    {  search by range of accessDate  }
    fsSBPermissions             = $00040000;                    {  search by value/mask of permissions  }
    fsSBNodeIDBit               = 15;
    fsSBAttributeModDateBit     = 16;
    fsSBAccessDateBit           = 17;
    fsSBPermissionsBit          = 18;


type
    FSSearchParamsPtr = ^FSSearchParams;
    FSSearchParams = record
        searchTime:             Duration;                               {  a Time Manager duration  }
        searchBits:             OptionBits;                             {  which fields to search on  }
        searchNameLength:       UniCharCount;
        searchName:             UniCharPtr;
        searchInfo1:            FSCatalogInfoPtr;                       {  values and lower bounds  }
        searchInfo2:            FSCatalogInfoPtr;                       {  masks and upper bounds  }
    end;

    FSCatalogBulkParamPtr = ^FSCatalogBulkParam;
    FSCatalogBulkParam = record
        qLink:                  QElemPtr;                               { queue link in header }
        qType:                  SInt16;                             { type byte for safety check }
        ioTrap:                 SInt16;                             { FS: the Trap }
        ioCmdAddr:              Ptr;                                    { FS: address to dispatch to }
        ioCompletion:           IOCompletionUPP;                        { completion routine addr (0 for synch calls) }
        ioResult:               OSErr;                                  { result code }
        containerChanged:       boolean;                                {  true if container changed since last iteration  }
        reserved:               SInt8;                                  {  make following fields 4-byte aligned  }
        iteratorFlags:          FSIteratorFlags;
        iterator:               FSIterator;
        container:              FSRefPtr;                               {  directory/volume to iterate  }
        maximumItems:           ItemCount;
        actualItems:            ItemCount;
        whichInfo:              FSCatalogInfoBitmap;
        catalogInfo:            FSCatalogInfoPtr;                       {  returns an array  }
        refs:                   FSRefPtr;                               {  returns an array  }
        specs:                  FSSpecPtr;                              {  returns an array  }
        names:                  HFSUniStr255Ptr;                        {  returns an array  }
        searchParams:           FSSearchParamsPtr;
    end;

    FSAllocationFlags                   = UInt16;

const
    kFSAllocDefaultFlags        = $0000;                        {  as much as possible, not contiguous  }
    kFSAllocAllOrNothingMask    = $0001;                        {  allocate all of the space, or nothing  }
    kFSAllocContiguousMask      = $0002;                        {  new space must be one contiguous piece  }
    kFSAllocNoRoundUpMask       = $0004;                        {  don't round up allocation to clump size  }
    kFSAllocReservedMask        = $FFF8;                        {  these bits are reserved and must not be set  }


type
    FSForkIOParamPtr = ^FSForkIOParam;
    FSForkIOParam = record
        qLink:                  QElemPtr;                               { queue link in header }
        qType:                  SInt16;                             { type byte for safety check }
        ioTrap:                 SInt16;                             { FS: the Trap }
        ioCmdAddr:              Ptr;                                    { FS: address to dispatch to }
        ioCompletion:           IOCompletionUPP;                        { completion routine addr (0 for synch calls) }
        ioResult:               OSErr;                                  { result code }
        reserved1:              Ptr;                                    {  was ioNamePtr  }
        reserved2:              SInt16;                                 {  was ioVRefNum  }
        forkRefNum:             SInt16;                                 {  same as ioRefNum  }
        reserved3:              SInt8;                                  {  was ioVersNum  }
        permissions:            SInt8;                                  {  desired access to the fork  }
        ref:                    FSRefPtr;                               {  which object to open  }
        buffer:                 Ptr;                                    { data buffer Ptr }
        requestCount:           UInt32;                                 { requested byte count }
        actualCount:            UInt32;                                 { actual byte count completed }
        positionMode:           UInt16;                                 { initial file positioning }
        positionOffset:         SInt64;                                 { file position offset }
        allocationFlags:        FSAllocationFlags;
        allocationAmount:       UInt64;
        forkNameLength:         UniCharCount;                           {  input; length of fork name  }
        forkName:               UniCharPtr;                             {  input; name of fork  }
        forkIterator:           CatPositionRec;
        outForkName:            HFSUniStr255Ptr;                        {  output; name of fork  }
    end;

    FSForkInfoPtr = ^FSForkInfo;
    FSForkInfo = record
        flags:                  SInt8;                                  {  copy of FCB flags  }
        permissions:            SInt8;
        volume:                 FSVolumeRefNum;
        reserved2:              UInt32;
        nodeID:                 UInt32;                                 {  file or directory ID  }
        forkID:                 UInt32;                                 {  fork ID  }
        currentPosition:        UInt64;
        logicalEOF:             UInt64;
        physicalEOF:            UInt64;
        process:                UInt64;                                 {  should be ProcessSerialNumber  }
    end;

    FSForkCBInfoParamPtr = ^FSForkCBInfoParam;
    FSForkCBInfoParam = record
        qLink:                  QElemPtr;                               { queue link in header }
        qType:                  SInt16;                             { type byte for safety check }
        ioTrap:                 SInt16;                             { FS: the Trap }
        ioCmdAddr:              Ptr;                                    { FS: address to dispatch to }
        ioCompletion:           IOCompletionUPP;                        { completion routine addr (0 for synch calls) }
        ioResult:               OSErr;                                  { result code }
        desiredRefNum:          SInt16;                                 {  0 to iterate, non-0 for specific refnum  }
        volumeRefNum:           SInt16;                                 {  volume to match, or 0 for all volumes  }
        iterator:               SInt16;                                 {  0 to start iteration  }
        actualRefNum:           SInt16;                                 {  actual refnum found  }
        ref:                    FSRefPtr;
        forkInfo:               FSForkInfoPtr;
        forkName:               HFSUniStr255Ptr;
    end;

    FSVolumeInfoBitmap                  = UInt32;

const
    kFSVolInfoNone              = $0000;
    kFSVolInfoCreateDate        = $0001;
    kFSVolInfoModDate           = $0002;
    kFSVolInfoBackupDate        = $0004;
    kFSVolInfoCheckedDate       = $0008;
    kFSVolInfoFileCount         = $0010;
    kFSVolInfoDirCount          = $0020;
    kFSVolInfoSizes             = $0040;                        {  totalBytes and freeBytes  }
    kFSVolInfoBlocks            = $0080;                        {  blockSize, totalBlocks, freeBlocks  }
    kFSVolInfoNextAlloc         = $0100;
    kFSVolInfoRsrcClump         = $0200;
    kFSVolInfoDataClump         = $0400;
    kFSVolInfoNextID            = $0800;
    kFSVolInfoFinderInfo        = $1000;
    kFSVolInfoFlags             = $2000;
    kFSVolInfoFSInfo            = $4000;                        {  filesystemID, signature  }
    kFSVolInfoDriveInfo         = $8000;                        {  driveNumber, driverRefNum  }
    kFSVolInfoGettableInfo      = $FFFF;                        {  This seems like it is here just for completeness  }
    kFSVolInfoSettableInfo      = $3004;                        {  backup date, Finder info, flags  }

    {    FSVolumeInfo.flags bits.  These are the same as for ioVAtrb, but with nicer names.     }
    kFSVolFlagDefaultVolumeBit  = 5;                            {  Set if the volume is the default volume  }
    kFSVolFlagDefaultVolumeMask = $0020;
    kFSVolFlagFilesOpenBit      = 6;                            {  Set if there are open files or iterators  }
    kFSVolFlagFilesOpenMask     = $0040;
    kFSVolFlagHardwareLockedBit = 7;                            {  Set if volume is locked by a hardware setting  }
    kFSVolFlagHardwareLockedMask = $0080;
    kFSVolFlagSoftwareLockedBit = 15;                           {  Set if volume is locked by software  }
    kFSVolFlagSoftwareLockedMask = $8000;



type
    FSVolumeInfoPtr = ^FSVolumeInfo;
    FSVolumeInfo = record
                                                                        {  Dates -- zero means "never" or "unknown"  }
        createDate:             UTCDateTime;
        modifyDate:             UTCDateTime;
        backupDate:             UTCDateTime;
        checkedDate:            UTCDateTime;
                                                                        {  File/Folder counts -- return zero if unknown  }
        fileCount:              UInt32;                                 {  total files on volume  }
        folderCount:            UInt32;                                 {  total folders on volume  }
                                                                        {  Note: no root directory counts  }
        totalBytes:             UInt64;                                 {  total number of bytes on volume  }
        freeBytes:              UInt64;                                 {  number of free bytes on volume  }
                                                                        {  HFS and HFS Plus specific.  Set fields to zero if not appropriate  }
        blockSize:              UInt32;                                 {  size (in bytes) of allocation blocks  }
        totalBlocks:            UInt32;                                 {  number of allocation blocks in volume  }
        freeBlocks:             UInt32;                                 {  number of unused allocation blocks  }
        nextAllocation:         UInt32;                                 {  start of next allocation search  }
        rsrcClumpSize:          UInt32;                                 {  default resource fork clump size  }
        dataClumpSize:          UInt32;                                 {  default data fork clump size  }
        nextCatalogID:          UInt32;                                 {  next unused catalog node ID ¥¥¥ OYG ¥¥¥ need to make HFSVolumes.h work Should be HFSCatalogNodeID }
        finderInfo:             packed array [0..31] of UInt8;          {  information used by Finder  }
                                                                        {  Identifying information  }
        flags:                  UInt16;                                 {  ioVAtrb  }
        filesystemID:           UInt16;                                 {  ioVFSID  }
        signature:              UInt16;                                 {  ioVSigWord, unique within an FSID  }
        driveNumber:            UInt16;                                 {  ioVDrvInfo  }
        driverRefNum:           SInt16;                             {  ioVDRefNum  }
    end;

    FSVolumeInfoParamPtr = ^FSVolumeInfoParam;
    FSVolumeInfoParam = record
        qLink:                  QElemPtr;                               { queue link in header }
        qType:                  SInt16;                             { type byte for safety check }
        ioTrap:                 SInt16;                             { FS: the Trap }
        ioCmdAddr:              Ptr;                                    { FS: address to dispatch to }
        ioCompletion:           IOCompletionUPP;                        { completion routine addr (0 for synch calls) }
        ioResult:               OSErr;                                  { result code }
        ioNamePtr:              StringPtr;                              {  unused  }
        ioVRefNum:              FSVolumeRefNum;                         {  volume refnum  }
        volumeIndex:            UInt32;                                 {  index, or 0 to use ioVRefNum  }
        whichInfo:              FSVolumeInfoBitmap;                     {  which volumeInfo fields to get/set  }
        volumeInfo:             FSVolumeInfoPtr;                        {  information about the volume  }
        volumeName:             HFSUniStr255Ptr;                        {  output; pointer to volume name  }
        ref:                    FSRefPtr;                               {  volume's FSRef  }
    end;

    {
        MakeFSRef
        Create an FSRef for an existing object specified by a combination
        of volume refnum, parent directory, and pathname.
        ->  ioCompletion    A pointer to a completion routine
        <-  ioResult        The result code of the function
        ->  ioNamePtr       A pointer to a pathname
        ->  ioVRefNum       A volume specification
        ->  ioDirID         A directory ID
        <-  newRef          A pointer to an FSRef
    }
    {
     *  FSpMakeFSRef()
     *
     *  Availability:
     *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function FSpMakeFSRef(const (*var*) source: FSSpec; var newRef: FSRef): OSErr; external name '_FSpMakeFSRef';
{
 *  PBMakeFSRefSync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBMakeFSRefSync(var paramBlock: FSRefParam): OSErr; external name '_PBMakeFSRefSync';
{
 *  PBMakeFSRefAsync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure PBMakeFSRefAsync(var paramBlock: FSRefParam); external name '_PBMakeFSRefAsync';
{
    MakeFSRefUnicode
    Create an FSRef for an existing object specified by
    Parent FSRef and Unicode name.
    ->  ioCompletion    A pointer to a completion routine
    <-  ioResult        The result code of the function
    ->  ref             A pointer to the parent directory FSRef
    ->  name            A pointer to Unicde name
    ->  nameLength      The length of the Unicode Name
    ->  textEncodingHint A suggested text encoding to use for the name
    <-  newRef          A pointer to an FSRef
}
{
 *  FSMakeFSRefUnicode()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FSMakeFSRefUnicode(const (*var*) parentRef: FSRef; nameLength: UniCharCount; name: UniCharPtr; textEncodingHint: TextEncoding; var newRef: FSRef): OSErr; external name '_FSMakeFSRefUnicode';
{
 *  PBMakeFSRefUnicodeSync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBMakeFSRefUnicodeSync(var paramBlock: FSRefParam): OSErr; external name '_PBMakeFSRefUnicodeSync';
{
 *  PBMakeFSRefUnicodeAsync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure PBMakeFSRefUnicodeAsync(var paramBlock: FSRefParam); external name '_PBMakeFSRefUnicodeAsync';
{
    CompareFSRefs
    Test whether two FSRefs refer to the same file or directory.
    If they do, noErr is returned.  Otherwise, an appropriate error
    (such as errFSRefsDifferent) is returned.
    ->  ioCompletion    A pointer to a completion routine
    <-  ioResult        The result code of the function
    ->  ref             A pointer to the first FSRef
    ->  parentRef       A pointer to the second FSRef
}
{
 *  FSCompareFSRefs()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FSCompareFSRefs(const (*var*) ref1: FSRef; const (*var*) ref2: FSRef): OSErr; external name '_FSCompareFSRefs';
{
 *  PBCompareFSRefsSync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBCompareFSRefsSync(var paramBlock: FSRefParam): OSErr; external name '_PBCompareFSRefsSync';
{
 *  PBCompareFSRefsAsync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure PBCompareFSRefsAsync(var paramBlock: FSRefParam); external name '_PBCompareFSRefsAsync';
{
    CreateFileUnicode
    Creates a new file.  The input filename is in Unicode.
    You can optionally set catalog info for the file.
    ->  ioCompletion    A pointer to a completion routine
    <-  ioResult        The result code of the function
    ->  ref             The directory where the file is to be created
    ->  whichInfo       Which catalog info fields to set
    ->  catInfo         The values for catalog info fields to set; may be NULL
    ->  nameLength      Number of Unicode characters in the file's name
    ->  name            A pointer to the Unicode name
    <-  spec            A pointer to the FSSpec for the new directory; may be NULL
    <-  newRef          A pointer to the FSRef for the new file; may be NULL
}
{
 *  FSCreateFileUnicode()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FSCreateFileUnicode(const (*var*) parentRef: FSRef; nameLength: UniCharCount; name: UniCharPtr; whichInfo: FSCatalogInfoBitmap; catalogInfo: {Const}FSCatalogInfoPtr; newRef: FSRefPtr; newSpec: FSSpecPtr): OSErr; external name '_FSCreateFileUnicode';
{
 *  PBCreateFileUnicodeSync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBCreateFileUnicodeSync(var paramBlock: FSRefParam): OSErr; external name '_PBCreateFileUnicodeSync';
{
 *  PBCreateFileUnicodeAsync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure PBCreateFileUnicodeAsync(var paramBlock: FSRefParam); external name '_PBCreateFileUnicodeAsync';
{
    CreateDirectoryUnicode
    Creates a new directory.  The input directory name is in Unicode.
    You can optionally set catalog info for the directory.
    ->  ioCompletion    A pointer to a completion routine
    <-  ioResult        The result code of the function
    ->  ref             The parent directory where the directory is to be created
    ->  whichInfo       Which catalog info fields to set
    ->  catInfo         The values for catalog info fields to set; may be NULL
    ->  nameLength      Number of Unicode characters in the directory's name
    ->  name            A pointer to the Unicode name
    <-  ioDirID         The DirID of the new directory
    <-  spec            A pointer to the FSSpec for the new directory; may be NULL
    <-  newRef          A pointer to the FSRef for the new directory; may be NULL
}
{
 *  FSCreateDirectoryUnicode()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FSCreateDirectoryUnicode(const (*var*) parentRef: FSRef; nameLength: UniCharCount; name: UniCharPtr; whichInfo: FSCatalogInfoBitmap; catalogInfo: {Const}FSCatalogInfoPtr; newRef: FSRefPtr; newSpec: FSSpecPtr; newDirID: UInt32Ptr): OSErr; external name '_FSCreateDirectoryUnicode';
{
 *  PBCreateDirectoryUnicodeSync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBCreateDirectoryUnicodeSync(var paramBlock: FSRefParam): OSErr; external name '_PBCreateDirectoryUnicodeSync';
{
 *  PBCreateDirectoryUnicodeAsync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure PBCreateDirectoryUnicodeAsync(var paramBlock: FSRefParam); external name '_PBCreateDirectoryUnicodeAsync';
{
    DeleteObject
    Deletes an existing file or directory.
    ->  ioCompletion    A pointer to a completion routine
    <-  ioResult        The result code of the function
    ->  ref             The file or directory to be deleted
}
{
 *  FSDeleteObject()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FSDeleteObject(const (*var*) ref: FSRef): OSErr; external name '_FSDeleteObject';
{
 *  PBDeleteObjectSync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBDeleteObjectSync(var paramBlock: FSRefParam): OSErr; external name '_PBDeleteObjectSync';
{
 *  PBDeleteObjectAsync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure PBDeleteObjectAsync(var paramBlock: FSRefParam); external name '_PBDeleteObjectAsync';
{
    MoveObject
    Move an existing file or directory into a different directory.
    ->  ioCompletion    A pointer to a completion routine
    <-  ioResult        The result code of the function
    ->  ref             The file or directory to be moved
    ->  parentRef       The file or directory will be moved into this directory
    <-  newRef          A new FSRef for the file or directory in its new location;
                        optional, may be NULL
    NOTE: Moving an object may change its FSRef.  If you want to continue to
    refer to the object, you should pass a non-NULL pointer in newRef and use
    that returned FSRef to access the object after the move.  The FSRef passed
    in "ref" may or may not be usable to access the object after it is moved.
    "newRef" may point to the same storage as "parentRef" or "ref".
}
{
 *  FSMoveObject()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FSMoveObject(const (*var*) ref: FSRef; const (*var*) destDirectory: FSRef; newRef: FSRefPtr): OSErr; external name '_FSMoveObject';
{
 *  PBMoveObjectSync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBMoveObjectSync(var paramBlock: FSRefParam): OSErr; external name '_PBMoveObjectSync';
{
 *  PBMoveObjectAsync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure PBMoveObjectAsync(var paramBlock: FSRefParam); external name '_PBMoveObjectAsync';
{
    ExchangeObjects
    swap the contents of two files.
    ->  ioCompletion    A pointer to a completion routine
    <-  ioResult        The result code of the function
    ->  ref             The first file
    ->  parentRef       The second file
}
{
 *  FSExchangeObjects()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FSExchangeObjects(const (*var*) ref: FSRef; const (*var*) destRef: FSRef): OSErr; external name '_FSExchangeObjects';
{
 *  PBExchangeObjectsSync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBExchangeObjectsSync(var paramBlock: FSRefParam): OSErr; external name '_PBExchangeObjectsSync';
{
 *  PBExchangeObjectsAsync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure PBExchangeObjectsAsync(var paramBlock: FSRefParam); external name '_PBExchangeObjectsAsync';
{
    RenameUnicode
    Change the name of an existing file or directory.  The new name is in
    Unicode.
    ->  ioCompletion    A pointer to a completion routine
    <-  ioResult        The result code of the function
    ->  ref             The file or directory to be moved
    ->  nameLength      Number of Unicode characters in the new name
    ->  name            A pointer to the new Unicode name
    ->  textEncodingHint A suggested text encoding to use for the name
    <-  newRef          A new FSRef for the file or directory; may be NULL
    NOTE: Renaming an object may change its FSRef.  If you want to continue to
    refer to the object, you should pass a non-NULL pointer in newRef and use
    that returned FSRef to access the object after the rename.  The FSRef passed
    in "ref" may or may not be usable to access the object after it is renamed.
    "newRef" may point to the same storage as "ref".
}
{
 *  FSRenameUnicode()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FSRenameUnicode(const (*var*) ref: FSRef; nameLength: UniCharCount; name: UniCharPtr; textEncodingHint: TextEncoding; newRef: FSRefPtr): OSErr; external name '_FSRenameUnicode';
{
 *  PBRenameUnicodeSync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBRenameUnicodeSync(var paramBlock: FSRefParam): OSErr; external name '_PBRenameUnicodeSync';
{
 *  PBRenameUnicodeAsync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure PBRenameUnicodeAsync(var paramBlock: FSRefParam); external name '_PBRenameUnicodeAsync';
{
    GetCatalogInfo
    Returns various information about a given file or directory.
    ->  ioCompletion    A pointer to a completion routine
    <-  ioResult        The result code of the function
    ->  ref             The file or directory whose information is to be returned
    ->  whichInfo       Which catalog info fields to get
    <-  catInfo         The returned values of catalog info fields; may be NULL
    <-  spec            A pointer to the FSSpec for the object; may be NULL
    <-  parentRef       A pointer to the FSRef for the object's parent directory; may be NULL
    <-  outName         The Unicode name is returned here.  This pointer may be NULL.
    Note: All of the outputs are optional; if you don't want that particular output, just
    set its pointer to NULL.  This is the call to use to map from an FSRef to an FSSpec.
}
{
 *  FSGetCatalogInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FSGetCatalogInfo(const (*var*) ref: FSRef; whichInfo: FSCatalogInfoBitmap; catalogInfo: FSCatalogInfoPtr; outName: HFSUniStr255Ptr; fsSpec: FSSpecPtr; parentRef: FSRefPtr): OSErr; external name '_FSGetCatalogInfo';
{
 *  PBGetCatalogInfoSync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBGetCatalogInfoSync(var paramBlock: FSRefParam): OSErr; external name '_PBGetCatalogInfoSync';
{
 *  PBGetCatalogInfoAsync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure PBGetCatalogInfoAsync(var paramBlock: FSRefParam); external name '_PBGetCatalogInfoAsync';
{
    SetCatalogInfo
    Set catalog information about a given file or directory.
    ->  ioCompletion    A pointer to a completion routine
    <-  ioResult        The result code of the function
    ->  ref             The file or directory whose information is to be changed
    ->  whichInfo       Which catalog info fields to set
    ->  catInfo         The new values of catalog info fields
    Note: Only some of the catalog info fields may be set.  The settable fields
    are given by the constant kFSCatInfoSettableInfo; no other bits may be set in
    whichInfo.
}
{
 *  FSSetCatalogInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FSSetCatalogInfo(const (*var*) ref: FSRef; whichInfo: FSCatalogInfoBitmap; const (*var*) catalogInfo: FSCatalogInfo): OSErr; external name '_FSSetCatalogInfo';
{
 *  PBSetCatalogInfoSync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBSetCatalogInfoSync(var paramBlock: FSRefParam): OSErr; external name '_PBSetCatalogInfoSync';
{
 *  PBSetCatalogInfoAsync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure PBSetCatalogInfoAsync(var paramBlock: FSRefParam); external name '_PBSetCatalogInfoAsync';
{
    OpenIterator
    Creates an FSIterator to iterate over a directory or subtree.  The
    iterator can then be passed to GetCatalogInfoBulk or CatalogSearch.
    ->  ioCompletion    A pointer to a completion routine
    <-  ioResult        The result code of the function
    <-  iterator        The returned FSIterator
    ->  iteratorFlags   Controls whether the iterator iterates over subtrees
                        or just the immediate children of the container.
    ->  container       An FSRef for the directory to iterate (or root of
                        the subtree to iterate).
}
{
 *  FSOpenIterator()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FSOpenIterator(const (*var*) container: FSRef; iteratorFlags: FSIteratorFlags; var iterator: FSIterator): OSErr; external name '_FSOpenIterator';
{
 *  PBOpenIteratorSync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBOpenIteratorSync(var paramBlock: FSCatalogBulkParam): OSErr; external name '_PBOpenIteratorSync';
{
 *  PBOpenIteratorAsync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure PBOpenIteratorAsync(var paramBlock: FSCatalogBulkParam); external name '_PBOpenIteratorAsync';
{
    CloseIterator
    Invalidates and disposes an FSIterator.
    ->  ioCompletion    A pointer to a completion routine
    <-  ioResult        The result code of the function
    ->  iterator        The returned FSIterator
}
{
 *  FSCloseIterator()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FSCloseIterator(iterator: FSIterator): OSErr; external name '_FSCloseIterator';
{
 *  PBCloseIteratorSync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBCloseIteratorSync(var paramBlock: FSCatalogBulkParam): OSErr; external name '_PBCloseIteratorSync';
{
 *  PBCloseIteratorAsync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure PBCloseIteratorAsync(var paramBlock: FSCatalogBulkParam); external name '_PBCloseIteratorAsync';
{
    GetCatalogInfoBulk
    Iterates over catalog objects and returns information about them.
    For now, iterator must have been created with kFSIterateFlat option.
    ->  ioCompletion    A pointer to a completion routine
    <-  ioResult        The result code of the function
    ->  iterator        The iterator
    ->  maximumItems    The maximum number of items to return
    <-  actualItems     The actual number of items returned
    <-  containerChanged Set to true if the container's contents changed
    ->  whichInfo       The catalog information fields to return for each item
    <-  catalogInfo     An array of catalog information; one for each returned item
    <-  refs            An array of FSRefs; one for each returned item
    <-  specs           An array of FSSpecs; one for each returned item
    <-  names           An array of filenames; one for each returned item
    Note: The catalogInfo, refs, specs, names, and containerChanged are all optional outputs;
    if you don't want that particular output, set its pointer to NULL.
}
{
 *  FSGetCatalogInfoBulk()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FSGetCatalogInfoBulk(iterator: FSIterator; maximumObjects: ItemCount; var actualObjects: ItemCount; containerChanged: BooleanPtr; whichInfo: FSCatalogInfoBitmap; catalogInfos: FSCatalogInfoPtr; refs: FSRefPtr; specs: FSSpecPtr; names: HFSUniStr255Ptr): OSErr; external name '_FSGetCatalogInfoBulk';
{
 *  PBGetCatalogInfoBulkSync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBGetCatalogInfoBulkSync(var paramBlock: FSCatalogBulkParam): OSErr; external name '_PBGetCatalogInfoBulkSync';
{
 *  PBGetCatalogInfoBulkAsync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure PBGetCatalogInfoBulkAsync(var paramBlock: FSCatalogBulkParam); external name '_PBGetCatalogInfoBulkAsync';
{
    CatalogSearch
    Iterates over catalog objects, searching for objects that match given
    search criteria.  Returns various information about matching objects.
    For now, iterator must have been created with kFSIterateSubtree option
    and the container must have been the root directory of a volume.
    ->  ioCompletion    A pointer to a completion routine
    <-  ioResult        The result code of the function
    ->  iterator        The iterator
    ->  maximumItems    The maximum number of items to return
    <-  actualItems     The actual number of items returned
    <-  containerChanged Set to true if the container's contents changed
    ->  whichInfo       The catalog information fields to return for each item
    <-  catalogInfo     An array of catalog information; one for each returned item
    <-  refs            An array of FSRefs; one for each returned item
    <-  specs           An array of FSSpecs; one for each returned item
    <-  names           An array of filenames; one for each returned item
    ->  searchParams    The criteria that controls the matching, including timeout, a bitmap
                        controlling the fields to compare, and the (Unicode) name to compare.
    Note: The catalogInfo, refs, specs, and names are all optional outputs; if you don't want
    that particular output, set its pointer to NULL.
}
{
 *  FSCatalogSearch()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FSCatalogSearch(iterator: FSIterator; const (*var*) searchCriteria: FSSearchParams; maximumObjects: ItemCount; var actualObjects: ItemCount; containerChanged: BooleanPtr; whichInfo: FSCatalogInfoBitmap; catalogInfos: FSCatalogInfoPtr; refs: FSRefPtr; specs: FSSpecPtr; names: HFSUniStr255Ptr): OSErr; external name '_FSCatalogSearch';
{
 *  PBCatalogSearchSync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBCatalogSearchSync(var paramBlock: FSCatalogBulkParam): OSErr; external name '_PBCatalogSearchSync';
{
 *  PBCatalogSearchAsync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure PBCatalogSearchAsync(var paramBlock: FSCatalogBulkParam); external name '_PBCatalogSearchAsync';
{
    CreateFork
    Create a named fork for a file or directory.
    ->  ioCompletion    A pointer to a completion routine
    <-  ioResult        The result code of the function
    ->  ref             The file or directory
    ->  forkNameLength  The length of the fork name (in Unicode characters)
    ->  forkName        The name of the fork to open (in Unicode)
}
{
 *  FSCreateFork()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FSCreateFork(const (*var*) ref: FSRef; forkNameLength: UniCharCount; forkName: UniCharPtr): OSErr; external name '_FSCreateFork';
{
 *  PBCreateForkSync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBCreateForkSync(var paramBlock: FSForkIOParam): OSErr; external name '_PBCreateForkSync';
{
 *  PBCreateForkAsync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure PBCreateForkAsync(var paramBlock: FSForkIOParam); external name '_PBCreateForkAsync';
{
    DeleteFork
    Delete a named fork of a file or directory.
    ->  ioCompletion    A pointer to a completion routine
    <-  ioResult        The result code of the function
    ->  ref             The file or directory
    ->  forkNameLength  The length of the fork name (in Unicode characters)
    ->  forkName        The name of the fork to open (in Unicode)
}
{
 *  FSDeleteFork()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FSDeleteFork(const (*var*) ref: FSRef; forkNameLength: UniCharCount; forkName: UniCharPtr): OSErr; external name '_FSDeleteFork';
{
 *  PBDeleteForkSync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBDeleteForkSync(var paramBlock: FSForkIOParam): OSErr; external name '_PBDeleteForkSync';
{
 *  PBDeleteForkAsync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure PBDeleteForkAsync(var paramBlock: FSForkIOParam); external name '_PBDeleteForkAsync';
{
    IterateForks
    Return the names and sizes of the forks of a file or directory.
    One fork is returned per call.
    ->  ioCompletion    A pointer to a completion routine.
    <-  ioResult        The result code of the function.
    ->  ref             The file or directory containing the forks.
    <-  positionOffset  The length of the fork, in bytes.
    <-  allocationAmount The space allocated to the fork (physical length).
    <-  outForkName     The name of the fork in Unicode.
    <>  forkIterator    Maintains state between calls for a given FSRef.
                        Before the first call, set the initialize field to zero.
}
{
 *  FSIterateForks()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FSIterateForks(const (*var*) ref: FSRef; var forkIterator: CatPositionRec; forkName: HFSUniStr255Ptr; forkSize: SInt64Ptr; forkPhysicalSize: UInt64Ptr): OSErr; external name '_FSIterateForks';
{
 *  PBIterateForksSync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBIterateForksSync(var paramBlock: FSForkIOParam): OSErr; external name '_PBIterateForksSync';
{
 *  PBIterateForksAsync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure PBIterateForksAsync(var paramBlock: FSForkIOParam); external name '_PBIterateForksAsync';
{
    OpenFork
    Open a fork for reading and/or writing.  Allows the opened fork
    to grow beyond 2GB in size.  All volumes should support data and
    resource forks.  Other named forks may be supported by some
    volumes.
    ->  ioCompletion    A pointer to a completion routine
    <-  ioResult        The result code of the function
    ->  ref             The file or directory containing the fork to open
    ->  forkNameLength  The length of the fork name (in Unicode characters)
    ->  forkName        The name of the fork to open (in Unicode)
    ->  permissions     The access (read and/or write) you want
    <-  forkRefNum      The reference number for accessing the open fork
}
{
 *  FSOpenFork()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FSOpenFork(const (*var*) ref: FSRef; forkNameLength: UniCharCount; forkName: UniCharPtr; permissions: SInt8; var forkRefNum: SInt16): OSErr; external name '_FSOpenFork';
{
 *  PBOpenForkSync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBOpenForkSync(var paramBlock: FSForkIOParam): OSErr; external name '_PBOpenForkSync';
{
 *  PBOpenForkAsync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure PBOpenForkAsync(var paramBlock: FSForkIOParam); external name '_PBOpenForkAsync';
{
    ReadFork
    Read data from a fork opened via OpenFork.  The first byte to read is
    indicated by a combination of positionMode and positionOffset.
    ->  ioCompletion    A pointer to a completion routine
    <-  ioResult        The result code of the function
    ->  forkRefNum      The reference number of the fork to read from
    <-  buffer          Pointer to buffer where data will be returned
    ->  requestCount    The number of bytes to read
    <-  actualCount     The number of bytes actually read
    ->  positionMode    The base location for start of read
    ->  positionOffset  The offset from base location for start of read
}
{
 *  FSReadFork()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FSReadFork(forkRefNum: SInt16; positionMode: UInt16; positionOffset: SInt64; requestCount: ByteCount; buffer: UnivPtr; actualCount: ByteCountPtr): OSErr; external name '_FSReadFork';
{
 *  PBReadForkSync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBReadForkSync(var paramBlock: FSForkIOParam): OSErr; external name '_PBReadForkSync';
{
 *  PBReadForkAsync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure PBReadForkAsync(var paramBlock: FSForkIOParam); external name '_PBReadForkAsync';
{
    WriteFork
    Write data to a fork opened via OpenFork.  The first byte to write is
    indicated by a combination of positionMode and positionOffset.
    ->  ioCompletion    A pointer to a completion routine
    <-  ioResult        The result code of the function
    ->  forkRefNum      The reference number of the fork to write to
    ->  buffer          Pointer to data to write
    ->  requestCount    The number of bytes to write
    <-  actualCount     The number of bytes actually written
    ->  positionMode    The base location for start of write
    ->  positionOffset  The offset from base location for start of write
}
{
 *  FSWriteFork()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FSWriteFork(forkRefNum: SInt16; positionMode: UInt16; positionOffset: SInt64; requestCount: ByteCount; buffer: UnivPtr; actualCount: ByteCountPtr): OSErr; external name '_FSWriteFork';
{
 *  PBWriteForkSync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBWriteForkSync(var paramBlock: FSForkIOParam): OSErr; external name '_PBWriteForkSync';
{
 *  PBWriteForkAsync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure PBWriteForkAsync(var paramBlock: FSForkIOParam); external name '_PBWriteForkAsync';
{
    GetForkPosition
    Get the current (default) position of a fork that was
    opened via OpenFork.
    ->  ioCompletion    A pointer to a completion routine
    <-  ioResult        The result code of the function
    ->  forkRefNum      The reference number of the fork
    <-  positionOffset  The current position of the fork
}
{
 *  FSGetForkPosition()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FSGetForkPosition(forkRefNum: SInt16; var position: SInt64): OSErr; external name '_FSGetForkPosition';
{
 *  PBGetForkPositionSync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBGetForkPositionSync(var paramBlock: FSForkIOParam): OSErr; external name '_PBGetForkPositionSync';
{
 *  PBGetForkPositionAsync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure PBGetForkPositionAsync(var paramBlock: FSForkIOParam); external name '_PBGetForkPositionAsync';
{
    SetForkPosition
    Set the current (default) position of a fork that was
    opened via OpenFork.
    ->  ioCompletion    A pointer to a completion routine
    <-  ioResult        The result code of the function
    ->  forkRefNum      The reference number of the fork
    ->  positionMode    The base location for the new position
    ->  positionOffset  The offset of the new position from the base
}
{
 *  FSSetForkPosition()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FSSetForkPosition(forkRefNum: SInt16; positionMode: UInt16; positionOffset: SInt64): OSErr; external name '_FSSetForkPosition';
{
 *  PBSetForkPositionSync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBSetForkPositionSync(var paramBlock: FSForkIOParam): OSErr; external name '_PBSetForkPositionSync';
{
 *  PBSetForkPositionAsync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure PBSetForkPositionAsync(var paramBlock: FSForkIOParam); external name '_PBSetForkPositionAsync';
{
    GetForkSize
    Get the current logical size (end-of-file) of an open fork.
    ->  ioCompletion    A pointer to a completion routine
    <-  ioResult        The result code of the function
    ->  forkRefNum      The reference number of the fork
    <-  positionOffset  The logical size of the fork, in bytes
}
{
 *  FSGetForkSize()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FSGetForkSize(forkRefNum: SInt16; var forkSize: SInt64): OSErr; external name '_FSGetForkSize';
{
 *  PBGetForkSizeSync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBGetForkSizeSync(var paramBlock: FSForkIOParam): OSErr; external name '_PBGetForkSizeSync';
{
 *  PBGetForkSizeAsync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure PBGetForkSizeAsync(var paramBlock: FSForkIOParam); external name '_PBGetForkSizeAsync';
{
    SetForkSize
    Set the logical size (end-of-file) of an open fork.  This
    may cause space to be allocated or deallocated.
    ->  ioCompletion    A pointer to a completion routine
    <-  ioResult        The result code of the function
    ->  forkRefNum      The reference number of the fork
    ->  positionMode    The base location for the new size
    ->  positionOffset  The offset of the new size from the base
}
{
 *  FSSetForkSize()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FSSetForkSize(forkRefNum: SInt16; positionMode: UInt16; positionOffset: SInt64): OSErr; external name '_FSSetForkSize';
{
 *  PBSetForkSizeSync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBSetForkSizeSync(var paramBlock: FSForkIOParam): OSErr; external name '_PBSetForkSizeSync';
{
 *  PBSetForkSizeAsync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure PBSetForkSizeAsync(var paramBlock: FSForkIOParam); external name '_PBSetForkSizeAsync';
{
    AllocateFork
    Allocate space to an open fork.  Typically, the space to be
    allocated is beyond the current size of the fork, to reserve
    space so the file will be able to grow later.  Some volume
    formats are unable to allocate space beyond the logical size
    of the fork.
    ->  ioCompletion    A pointer to a completion routine
    <-  ioResult        The result code of the function
    ->  forkRefNum      The reference number of the fork
    ->  positionMode    The base location for start of allocation
    ->  positionOffset  The offset of the start of allocation
    ->  allocationFlags Zero or more of the following flags:
        kFSAllocContiguousMask
                Any newly allocated space must be one contiguous piece.
        kFSAllocAllOrNothingMask
                All of the request space must be available, or the call
                will fail.  (If not set, the call may succeed even though
                some of the requested space wasn't allocated.)
        kFSAllocNoRoundUpMask
                Do not allocate additional space.  (If not set, a volume
                may allocate additional space in order to reduce fragmentation.)
    <>  allocationAmount    The number of bytes to allocate
                            On output, the number of bytes actually added
}
{
 *  FSAllocateFork()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FSAllocateFork(forkRefNum: SInt16; flags: FSAllocationFlags; positionMode: UInt16; positionOffset: SInt64; requestCount: UInt64; actualCount: UInt64Ptr): OSErr; external name '_FSAllocateFork';
{
 *  PBAllocateForkSync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBAllocateForkSync(var paramBlock: FSForkIOParam): OSErr; external name '_PBAllocateForkSync';
{
 *  PBAllocateForkAsync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure PBAllocateForkAsync(var paramBlock: FSForkIOParam); external name '_PBAllocateForkAsync';
{
    FlushFork
    Flush a fork.  Any data written to this fork refnum is flushed to the device.
    The volume's control structures are also flushed to the device.
    ->  ioCompletion    A pointer to a completion routine
    <-  ioResult        The result code of the function
    ->  forkRefNum      The reference number of the fork to flush
}
{
 *  FSFlushFork()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FSFlushFork(forkRefNum: SInt16): OSErr; external name '_FSFlushFork';
{
 *  PBFlushForkSync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBFlushForkSync(var paramBlock: FSForkIOParam): OSErr; external name '_PBFlushForkSync';
{
 *  PBFlushForkAsync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure PBFlushForkAsync(var paramBlock: FSForkIOParam); external name '_PBFlushForkAsync';
{
    CloseFork
    Flush and close a fork.  Any data written to this fork refnum is flushed
    to the device.  The volume's control structures are also flushed to the device.
    ->  ioCompletion    A pointer to a completion routine
    <-  ioResult        The result code of the function
    ->  forkRefNum      The reference number of the fork to close
}
{
 *  FSCloseFork()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FSCloseFork(forkRefNum: SInt16): OSErr; external name '_FSCloseFork';
{
 *  PBCloseForkSync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBCloseForkSync(var paramBlock: FSForkIOParam): OSErr; external name '_PBCloseForkSync';
{
 *  PBCloseForkAsync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure PBCloseForkAsync(var paramBlock: FSForkIOParam); external name '_PBCloseForkAsync';
{
    GetForkCBInfo
    Return information about an open fork.
    ->  ioCompletion    A pointer to a completion routine
    <-  ioResult        The result code of the function
    <>  desiredRefNum   If non-zero on input, then get information for this refnum;
                        unchanged on output.  If zero on input, iterate over all open
                        forks (possibly limited to a single volume); on output, contains
                        the fork's refnum.
    ->  volumeRefNum    Used when desiredRefNum is zero on input.  Set to 0 to iterate over all
                        volumes, or set to a FSVolumeRefNum to limit iteration to that volume.
    <>  iterator        Used when desiredRefNum is zero on input.  Set to 0 before iterating.
                        Pass the iterator returned by the previous call to continue iterating.
    <-  actualRefNum    The refnum of the open fork.
    <-  ref             The FSRef for the file or directory that contains the fork.
    <-  forkInfo        Various information about the open fork.
    <-  outForkName     The name of the fork
    Note: the foundRefNum, ref, forkInfo, and fork name outputs are all optional; if you don't want
    a particular output, then set its pointer to NULL.  If forkName is NULL, then forkNameLength
    will be undefined.
    Note: Returning the forkInfo generally does not require a disk access.  Returning the
    ref or forkName may cause disk access for some volume formats.
}
{
 *  FSGetForkCBInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FSGetForkCBInfo(desiredRefNum: SInt16; volume: FSVolumeRefNum; iterator: SInt16Ptr; actualRefNum: SInt16Ptr; forkInfo: FSForkInfoPtr; ref: FSRefPtr; outForkName: HFSUniStr255Ptr): OSErr; external name '_FSGetForkCBInfo';
{
 *  PBGetForkCBInfoSync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBGetForkCBInfoSync(var paramBlock: FSForkCBInfoParam): OSErr; external name '_PBGetForkCBInfoSync';
{
 *  PBGetForkCBInfoAsync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure PBGetForkCBInfoAsync(var paramBlock: FSForkCBInfoParam); external name '_PBGetForkCBInfoAsync';
{
    GetVolumeInfo
    Returns various information about a given volume, or indexing over all volumes.
    ->  ioCompletion    A pointer to a completion routine
    <-  ioResult        The result code of the function
    <>  ioVRefNum       On input, the volume reference number or drive number whose
                        information is to be returned (if volumeIndex is 0); same
                        as "volume" input to FSGetVolumeInfo.
                        On output, the actual volume reference number; same as
                        "actualVolume" output of FSGetVolumeInfo.
    ->  volumeIndex     The index of the desired volume, or 0 to use ioVRefNum
    ->  whichInfo       Which volInfo info fields to get
    <-  volumeInfo      The returned values of Volume info fields; may be NULL
    <-  name            The Unicode name is returned here.  This pointer may be NULL.
    Note: All of the outputs are optional; if you don't want that particular output, just
    set its pointer to NULL.
}
{
 *  FSGetVolumeInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FSGetVolumeInfo(volume: FSVolumeRefNum; volumeIndex: ItemCount; actualVolume: FSVolumeRefNumPtr; whichInfo: FSVolumeInfoBitmap; info: FSVolumeInfoPtr; volumeName: HFSUniStr255Ptr; rootDirectory: FSRefPtr): OSErr; external name '_FSGetVolumeInfo';
{
 *  PBGetVolumeInfoSync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBGetVolumeInfoSync(var paramBlock: FSVolumeInfoParam): OSErr; external name '_PBGetVolumeInfoSync';
{
 *  PBGetVolumeInfoAsync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure PBGetVolumeInfoAsync(var paramBlock: FSVolumeInfoParam); external name '_PBGetVolumeInfoAsync';
{
    SetVolumeInfo
    Set information about a given volume.
    ->  ioCompletion    A pointer to a completion routine
    <-  ioResult        The result code of the function
    ->  ioVRefNum       The volume whose information is to be changed
    ->  whichInfo       Which catalog info fields to set
    ->  volumeInfo      The new values of volume info fields
    Note: Only some of the volume info fields may be set.  The settable fields
    are given by the constant kFSVolInfoSettableInfo; no other bits may be set in
    whichInfo.
}
{
 *  FSSetVolumeInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FSSetVolumeInfo(volume: FSVolumeRefNum; whichInfo: FSVolumeInfoBitmap; const (*var*) info: FSVolumeInfo): OSErr; external name '_FSSetVolumeInfo';
{
 *  PBSetVolumeInfoSync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBSetVolumeInfoSync(var paramBlock: FSVolumeInfoParam): OSErr; external name '_PBSetVolumeInfoSync';
{
 *  PBSetVolumeInfoAsync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure PBSetVolumeInfoAsync(var paramBlock: FSVolumeInfoParam); external name '_PBSetVolumeInfoAsync';
{
    FSGetDataForkName
    Returns the constant for the name of the data fork (the empty string)
}
{
 *  FSGetDataForkName()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FSGetDataForkName(var dataForkName: HFSUniStr255): OSErr; external name '_FSGetDataForkName';
{
    FSGetResourceForkName
    Returns the constant for the name of the resource fork
    (currently "RESOURCE_FORK").
}
{
 *  FSGetResourceForkName()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FSGetResourceForkName(var resourceForkName: HFSUniStr255): OSErr; external name '_FSGetResourceForkName';
{
 *  FSRefMakePath()
 *
 *  Summary:
 *    Converts an FSRef to a pathname.
 *
 *  Parameters:
 *
 *    ref:
 *      An FSRef to the file or directory to get the pathname for.
 *
 *    path:
 *      A pointer to a buffer which FSRefMakePath will fill with a C
 *      string representing the pathname to the file or directory
 *      specified by the ref parameter. The format of the pathname
 *      returned can be determined with the Gestalt selector
 *      gestaltFSAttr's gestaltFSUsesPOSIXPathsForConversion bit.
 *       If the gestaltFSUsesPOSIXPathsForConversion bit is clear, the
 *      pathname is a Mac OS File Manager full pathname in a C string,
 *      and file or directory names in the pathname may be mangled as
 *      returned by the File Manager.
 *      If the gestaltFSUsesPOSIXPathsForConversion bit is set, the
 *      pathname is a UTF8 encoded POSIX absolute pathname in a C
 *      string.
 *      In either case, the pathname returned can be passed back to
 *      FSRefMakePath to create an FSRef to the file or directory.
 *
 *    maxPathSize:
 *      The size of the path buffer in bytes. If the path buffer is too
 *      small for the pathname string, FSRefMakePath returns
 *      pathTooLongErr or buffersTooSmall.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FSRefMakePath(const (*var*) ref: FSRef; path: CStringPtr; maxPathSize: UInt32): OSStatus; external name '_FSRefMakePath';

{
 *  FSPathMakeRef()
 *
 *  Summary:
 *    Converts a pathname to an FSRef.
 *
 *  Parameters:
 *
 *    path:
 *      A pointer to a C String that is the pathname. The format of the
 *      pathname you must supply can be determined with the Gestalt
 *      selector gestaltFSAttr's gestaltFSUsesPOSIXPathsForConversion
 *      bit.
 *      If the gestaltFSUsesPOSIXPathsForConversion bit is clear, the
 *      pathname must be a Mac OS File Manager full pathname in a C
 *      string.
 *      If the gestaltFSUsesPOSIXPathsForConversion bit is set, the
 *      pathname must be a UTF8 encoded POSIX absolute pathname in a C
 *      string.
 *      In either case, the pathname returned by FSRefMakePath can be
 *      passed to FSPathMakeRef.
 *
 *    ref:
 *      A pointer to an FSRef to fill in.
 *
 *    isDirectory:
 *      An optional pointer to a Boolean that will be filled in to
 *      indicate if the specified path is a directory (vs. a file).
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FSPathMakeRef(path: CStringPtr; var ref: FSRef; isDirectory: BooleanPtr): OSStatus; external name '_FSPathMakeRef';



{
 *  FNMessage
 *
 *  Discussion:
 *    Messages broadcast about a directory.  If system clients (such as
 *    the Finder) are interested in changes to a directory, they will
 *    receive notifications when application code broadcasts change
 *    messages about that directory.
 }

type
    FNMessage                   = UInt32;
const
    kFNDirectoryModifiedMessage = 1;

    {
     *  FNNotify()
     *
     *  Summary:
     *    Broadcasts notification of changes to the specified directory.
     *
     *  Parameters:
     *
     *    ref:
     *      The directory for which to broadcast the notification
     *
     *    message:
     *      An indication of what happened to the target directory
     *
     *    flags:
     *      Options about delivery of the notification (specify kNilOptions
     *      for default behaviour)
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.5 and later
     *    Mac OS X:         in version 10.0 and later
        }
function FNNotify(const (*var*) ref: FSRef; message: FNMessage; flags: OptionBits): OSStatus; external name '_FNNotify';

{
 *  FNNotifyByPath()
 *
 *  Summary:
 *    Broadcasts notification of changes to the specified directory.
 *
 *  Parameters:
 *
 *    path:
 *      Path to the directory for which to broadcast the notification
 *
 *    message:
 *      An indication of what happened to the target directory
 *
 *    flags:
 *      Options about delivery of the notification (specify kNilOptions
 *      for default behaviour)
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.5 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FNNotifyByPath(path: CStringPtr; message: FNMessage; flags: OptionBits): OSStatus; external name '_FNNotifyByPath';

{
 *  FNNotifyAll()
 *
 *  Discussion:
 *    Broadcasts notification of changes to the filesystem (should only
 *    be used by installers or programs which make lots of changes and
 *    only send one broadcast).
 *
 *  Parameters:
 *
 *    message:
 *      An indication of what happened
 *
 *    flags:
 *      Options about delivery of the notification (specify kNilOptions
 *      for default behaviour)
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.5 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FNNotifyAll(message: FNMessage; flags: OptionBits): OSStatus; external name '_FNNotifyAll';



{
 *  FNSubscriptionRef
 *
 *  Discussion:
 *    A token associated with a notification subscription.  The
 *    subscriber gets one back when they subscribe to notifications for
 *    a particular directory, and they supply it when the unsubscribe.
 *    It is also delivered along with the notifications for that
 *    subscription.
 }

type
    FNSubscriptionRef    = ^SInt32; { an opaque 32-bit type }
    FNSubscriptionRefPtr = ^FNSubscriptionRef;  { when a var xx:FNSubscriptionRef parameter can be nil, it is changed to xx: FNSubscriptionRefPtr }

    {
     *  Discussion:
     *    Options that can be specified at subscription time.
        }

const
    kFNNoImplicitAllSubscription = $01;


    {
     *  FNSubscriptionProcPtr
     *
     *  Discussion:
     *    Callback delivered for directory notifications.
     *
     *  Parameters:
     *
     *    message:
     *      An indication of what happened
     *
     *    flags:
     *      Options about delivery of the notification (typically
     *      kNilOptions)
     *
     *    refcon:
     *      User reference supplied with subscription
     *
     *    subscription:
     *      Subscription corresponding to this notification
        }

type
    FNSubscriptionProcPtr = procedure(message: FNMessage; flags: OptionBits; refcon: UnivPtr; subscription: FNSubscriptionRef);

    FNSubscriptionUPP = ^SInt32; { an opaque UPP }

const
    uppFNSubscriptionProcInfo = $00003FC1;
    {
     *  NewFNSubscriptionUPP()
     *
     *  Availability:
     *    Non-Carbon CFM:   available as macro/inline
     *    CarbonLib:        in CarbonLib on Mac OS X
     *    Mac OS X:         in version 10.0 and later
        }
function NewFNSubscriptionUPP(userRoutine: FNSubscriptionProcPtr): FNSubscriptionUPP; external name '_NewFNSubscriptionUPP';
{
 *  DisposeFNSubscriptionUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib on Mac OS X
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeFNSubscriptionUPP(userUPP: FNSubscriptionUPP); external name '_DisposeFNSubscriptionUPP';
{
 *  InvokeFNSubscriptionUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib on Mac OS X
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvokeFNSubscriptionUPP(message: FNMessage; flags: OptionBits; refcon: UnivPtr; subscription: FNSubscriptionRef; userRoutine: FNSubscriptionUPP); external name '_InvokeFNSubscriptionUPP';
{
 *  FNSubscribe()
 *
 *  Summary:
 *    Subscribe to change notifications for the specified directory.
 *
 *  Parameters:
 *
 *    directoryRef:
 *      Directory for which the caller wants notifications
 *
 *    callback:
 *      Function to call back when a notification arrives
 *
 *    refcon:
 *      User state carried with the subscription
 *
 *    flags:
 *      Options for future use (specify kNilOptions, or one of the
 *      FNSubscriptionOptions)
 *
 *    subscription:
 *      Subscription token for subsequent query or unsubscription
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.1 and later
 *    Mac OS X:         in version 10.1 and later
 }
function FNSubscribe(const (*var*) directoryRef: FSRef; callback: FNSubscriptionUPP; refcon: UnivPtr; flags: OptionBits; var subscription: FNSubscriptionRef): OSStatus; external name '_FNSubscribe';

{
 *  FNSubscribeByPath()
 *
 *  Summary:
 *    Subscribe to change notifications for the specified directory.
 *
 *  Parameters:
 *
 *    directoryPath:
 *      Directory for which the caller wants notifications
 *
 *    callback:
 *      Function to call back when a notification arrives
 *
 *    refcon:
 *      User state carried with the subscription
 *
 *    flags:
 *      Options for future use (specify kNilOptions, or one of the
 *      FNSubscriptionOptions)
 *
 *    subscription:
 *      Subscription token for subsequent query or unsubscription
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.1 and later
 *    Mac OS X:         in version 10.1 and later
 }
function FNSubscribeByPath(directoryPath: CStringPtr; callback: FNSubscriptionUPP; refcon: UnivPtr; flags: OptionBits; var subscription: FNSubscriptionRef): OSStatus; external name '_FNSubscribeByPath';

{
 *  FNUnsubscribe()
 *
 *  Summary:
 *    Release a subscription which is no longer needed.
 *
 *  Parameters:
 *
 *    subscription:
 *      Subscription previously returned from FNSubscribe or
 *      FNSubscribeForPath
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.1 and later
 *    Mac OS X:         in version 10.1 and later
 }
function FNUnsubscribe(subscription: FNSubscriptionRef): OSStatus; external name '_FNUnsubscribe';

{
 *  FNGetDirectoryForSubscription()
 *
 *  Summary:
 *    Fetch the directory for which this subscription was originally
 *    entered. There is no path variant because paths are fragile, and
 *    the path may have changed.  If the caller does not care about
 *    this subtlety, she can call FSRefMakePath to get a path from the
 *    returned ref.
 *
 *  Parameters:
 *
 *    subscription:
 *      Subscription previously returned from FNSubscribe or
 *      FNSubscribeForPath
 *
 *    ref:
 *      Directory for which this subscription was created
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.1 and later
 *    Mac OS X:         in version 10.1 and later
 }
function FNGetDirectoryForSubscription(subscription: FNSubscriptionRef; var ref: FSRef): OSStatus; external name '_FNGetDirectoryForSubscription';

{$ALIGN MAC68K}
{#POP}
{unit FindByContent}
{$ALIGN MAC68K}








{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}


{
   ***************************************************************************
   Language constants used with FBCIndexItemsInLanguages: these numbers are bits
   in a 64-bit array that consists of two UInt32 words.  In the current implementation
   the low word is always 0, so values for the high word are given.  If both UInt32
   words are 0, the default value of kDefaultLanguagesHighWord is used.
   ***************************************************************************
}

const
                                                                {  languages that use the Roman character mapping }
    englishHighWord             = $80000000;
    dutchHighWord               = $40000000;                    {  also Afrikaans }
    germanHighWord              = $20000000;
    swedishHighWord             = $10000000;                    {  also Norwegian }
    danishHighWord              = $08000000;
    spanishHighWord             = $04000000;                    {  also Catalan }
    portugueseHighWord          = $02000000;
    italianHighWord             = $01000000;
    frenchHighWord              = $00800000;
    romanHighWord               = $00400000;                    {  other languages using Roman alphabet }
                                                                {  Languages that use other mappings }
    icelandicHighWord           = $00200000;                    {  also Faroese }
    hebrewHighWord              = $00100000;                    {  also Yiddish }
    arabicHighWord              = $00080000;                    {  also Farsi, Urdu }
    centeuroHighWord            = $00040000;                    {  Central European languages not using Cyrillic }
    croatianHighWord            = $00020000;
    turkishHighWord             = $00010000;
    romanianHighWord            = $00008000;
    greekHighWord               = $00004000;
    cyrillicHighWord            = $00002000;                    {  all languages using Cyrillic }
    devanagariHighWord          = $00001000;
    gujuratiHighWord            = $00000800;
    gurmukhiHighWord            = $00000400;
    japaneseHighWord            = $00000200;
    koreanHighWord              = $00000100;
    kDefaultLanguagesHighWord   = $FF800000;                    {  sum of first 9 }


    {
       ***************************************************************************
       Phase values
       These values are passed to the client's callback function to indicate what
       the FBC code is doing.
       ***************************************************************************
    }
                                                                {  indexing phases }
    kFBCphIndexing              = 0;
    kFBCphFlushing              = 1;
    kFBCphMerging               = 2;
    kFBCphMakingIndexAccessor   = 3;
    kFBCphCompacting            = 4;
    kFBCphIndexWaiting          = 5;                            {  access phases }
    kFBCphSearching             = 6;
    kFBCphMakingAccessAccessor  = 7;
    kFBCphAccessWaiting         = 8;                            {  summarization }
    kFBCphSummarizing           = 9;                            {  indexing or access }
    kFBCphIdle                  = 10;
    kFBCphCanceling             = 11;



    {
       ***************************************************************************
       Pointer types
       These point to memory allocated by the FBC shared library, and must be deallocated
       by calls that are defined below.
       ***************************************************************************
    }

    {  A collection of state information for searching }

type
    FBCSearchSession    = ^SInt32; { an opaque 32-bit type }
    FBCSearchSessionPtr = ^FBCSearchSession;  { when a var xx:FBCSearchSession parameter can be nil, it is changed to xx: FBCSearchSessionPtr }
    {  a FBCWordList is a pointer to an array of pointers to c-strings }
    FBCWordListRecPtr = ^FBCWordListRec;
    FBCWordListRec = record
        words:                  array [0..0] of ConstCStringPtr;        {  array of pointers to c-strings }
    end;

    FBCWordList                         = ^FBCWordListRec;
    {
       ***************************************************************************
       Callback function type for progress reporting and cancelation during
       searching and indexing.  The client's callback function should call
       WaitNextEvent; a "sleep" value of 1 is suggested.  If the callback function
       wants to cancel the current operation (indexing, search, or doc-terms
       retrieval) it should return true.
       ***************************************************************************
    }

    FBCCallbackProcPtr = function(phase: UInt16; percentDone: Single; data: UnivPtr): boolean;

    FBCCallbackUPP = ^SInt32; { an opaque UPP }

const
    uppFBCCallbackProcInfo = $00000F91;
    {
     *  NewFBCCallbackUPP()
     *
     *  Availability:
     *    Non-Carbon CFM:   available as macro/inline
     *    CarbonLib:        in CarbonLib 1.0.2 and later
     *    Mac OS X:         in version 10.0 and later
        }
function NewFBCCallbackUPP(userRoutine: FBCCallbackProcPtr): FBCCallbackUPP; external name '_NewFBCCallbackUPP';
{
 *  DisposeFBCCallbackUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeFBCCallbackUPP(userUPP: FBCCallbackUPP); external name '_DisposeFBCCallbackUPP';
{
 *  InvokeFBCCallbackUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeFBCCallbackUPP(phase: UInt16; percentDone: Single; data: UnivPtr; userRoutine: FBCCallbackUPP): boolean; external name '_InvokeFBCCallbackUPP';
{
   ***************************************************************************
   Set the callback function for progress reporting and cancelation during
   searching and indexing, and set the amount of heap space to reserve for
   the client's use when FBC allocates memory.
   ***************************************************************************
}
{
 *  FBCSetCallback()
 *
 *  Availability:
 *    Non-Carbon CFM:   in FindByContent 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure FBCSetCallback(fn: FBCCallbackUPP; data: UnivPtr); external name '_FBCSetCallback';

{
 *  FBCSetHeapReservation()
 *
 *  Availability:
 *    Non-Carbon CFM:   in FindByContent 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure FBCSetHeapReservation(bytes: UInt32); external name '_FBCSetHeapReservation';

{
   ***************************************************************************
   Find out whether a volume is indexed, the date & time of its last
   completed  update, and its physical size.
   ***************************************************************************
}

{
 *  FBCVolumeIsIndexed()
 *
 *  Availability:
 *    Non-Carbon CFM:   in FindByContent 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FBCVolumeIsIndexed(theVRefNum: SInt16): boolean; external name '_FBCVolumeIsIndexed';

{
 *  FBCVolumeIsRemote()
 *
 *  Availability:
 *    Non-Carbon CFM:   in FindByContent 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FBCVolumeIsRemote(theVRefNum: SInt16): boolean; external name '_FBCVolumeIsRemote';

{
 *  FBCVolumeIndexTimeStamp()
 *
 *  Availability:
 *    Non-Carbon CFM:   in FindByContent 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FBCVolumeIndexTimeStamp(theVRefNum: SInt16; var timeStamp: UInt32): OSErr; external name '_FBCVolumeIndexTimeStamp';

{
 *  FBCVolumeIndexPhysicalSize()
 *
 *  Availability:
 *    Non-Carbon CFM:   in FindByContent 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FBCVolumeIndexPhysicalSize(theVRefNum: SInt16; var size: UInt32): OSErr; external name '_FBCVolumeIndexPhysicalSize';

{
   ***************************************************************************
   Create & configure a search session
   ***************************************************************************
}

{
 *  FBCCreateSearchSession()
 *
 *  Availability:
 *    Non-Carbon CFM:   in FindByContent 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FBCCreateSearchSession(var searchSession: FBCSearchSession): OSErr; external name '_FBCCreateSearchSession';

{
 *  FBCAddAllVolumesToSession()
 *
 *  Availability:
 *    Non-Carbon CFM:   in FindByContent 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FBCAddAllVolumesToSession(theSession: FBCSearchSession; includeRemote: boolean): OSErr; external name '_FBCAddAllVolumesToSession';

{
 *  FBCSetSessionVolumes()
 *
 *  Availability:
 *    Non-Carbon CFM:   in FindByContent 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FBCSetSessionVolumes(theSession: FBCSearchSession; vRefNums: SInt16Ptr; numVolumes: UInt16): OSErr; external name '_FBCSetSessionVolumes';

{
 *  FBCAddVolumeToSession()
 *
 *  Availability:
 *    Non-Carbon CFM:   in FindByContent 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FBCAddVolumeToSession(theSession: FBCSearchSession; vRefNum: SInt16): OSErr; external name '_FBCAddVolumeToSession';

{
 *  FBCRemoveVolumeFromSession()
 *
 *  Availability:
 *    Non-Carbon CFM:   in FindByContent 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FBCRemoveVolumeFromSession(theSession: FBCSearchSession; vRefNum: SInt16): OSErr; external name '_FBCRemoveVolumeFromSession';

{
 *  FBCGetSessionVolumeCount()
 *
 *  Availability:
 *    Non-Carbon CFM:   in FindByContent 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FBCGetSessionVolumeCount(theSession: FBCSearchSession; var count: UInt16): OSErr; external name '_FBCGetSessionVolumeCount';

{
 *  FBCGetSessionVolumes()
 *
 *  Availability:
 *    Non-Carbon CFM:   in FindByContent 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FBCGetSessionVolumes(theSession: FBCSearchSession; var vRefNums: SInt16; var numVolumes: UInt16): OSErr; external name '_FBCGetSessionVolumes';

{
 *  FBCCloneSearchSession()
 *
 *  Availability:
 *    Non-Carbon CFM:   in FindByContent 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FBCCloneSearchSession(original: FBCSearchSession; var clone: FBCSearchSession): OSErr; external name '_FBCCloneSearchSession';

{
   ***************************************************************************
   Execute a search
   ***************************************************************************
}

{
 *  FBCDoQuerySearch()
 *
 *  Availability:
 *    Non-Carbon CFM:   in FindByContent 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FBCDoQuerySearch(theSession: FBCSearchSession; queryText: CStringPtr; const (*var*) targetDirs: FSSpec; numTargets: UInt32; maxHits: UInt32; maxHitWords: UInt32): OSErr; external name '_FBCDoQuerySearch';

{
 *  FBCDoCFStringSearch()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x
 *    Mac OS X:         in version 10.0 and later
 }
function FBCDoCFStringSearch(theSession: FBCSearchSession; queryString: CFStringRef; const (*var*) targetDirs: FSSpec; numTargets: UInt32; maxHits: UInt32; maxHitWords: UInt32): OSErr; external name '_FBCDoCFStringSearch';

{
 *  FBCDoExampleSearch()
 *
 *  Availability:
 *    Non-Carbon CFM:   in FindByContent 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FBCDoExampleSearch(theSession: FBCSearchSession; exampleHitNums: UInt32Ptr; numExamples: UInt32; const (*var*) targetDirs: FSSpec; numTargets: UInt32; maxHits: UInt32; maxHitWords: UInt32): OSErr; external name '_FBCDoExampleSearch';

{
 *  FBCBlindExampleSearch()
 *
 *  Availability:
 *    Non-Carbon CFM:   in FindByContent 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FBCBlindExampleSearch(var examples: FSSpec; numExamples: UInt32; const (*var*) targetDirs: FSSpec; numTargets: UInt32; maxHits: UInt32; maxHitWords: UInt32; allIndexes: boolean; includeRemote: boolean; var theSession: FBCSearchSession): OSErr; external name '_FBCBlindExampleSearch';


{
   ***************************************************************************
   Get information about hits [wrapper for THitItem C++ API]
   ***************************************************************************
}

{
 *  FBCGetHitCount()
 *
 *  Availability:
 *    Non-Carbon CFM:   in FindByContent 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FBCGetHitCount(theSession: FBCSearchSession; var count: UInt32): OSErr; external name '_FBCGetHitCount';

{
 *  FBCGetHitDocument()
 *
 *  Availability:
 *    Non-Carbon CFM:   in FindByContent 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FBCGetHitDocument(theSession: FBCSearchSession; hitNumber: UInt32; var theDocument: FSSpec): OSErr; external name '_FBCGetHitDocument';

{
 *  FBCGetHitDocumentRef()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x
 *    Mac OS X:         in version 10.0 and later
 }
function FBCGetHitDocumentRef(theSession: FBCSearchSession; hitNumber: UInt32; var theDocument: FSRef): OSErr; external name '_FBCGetHitDocumentRef';

{
 *  FBCGetHitScore()
 *
 *  Availability:
 *    Non-Carbon CFM:   in FindByContent 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FBCGetHitScore(theSession: FBCSearchSession; hitNumber: UInt32; var score: Single): OSErr; external name '_FBCGetHitScore';

{
 *  FBCGetMatchedWords()
 *
 *  Availability:
 *    Non-Carbon CFM:   in FindByContent 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FBCGetMatchedWords(theSession: FBCSearchSession; hitNumber: UInt32; var wordCount: UInt32; var list: FBCWordList): OSErr; external name '_FBCGetMatchedWords';

{
 *  FBCGetTopicWords()
 *
 *  Availability:
 *    Non-Carbon CFM:   in FindByContent 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FBCGetTopicWords(theSession: FBCSearchSession; hitNumber: UInt32; var wordCount: UInt32; var list: FBCWordList): OSErr; external name '_FBCGetTopicWords';


{
   ***************************************************************************
   Summarize a buffer of text
   ***************************************************************************
}

{
 *  FBCSummarize()
 *
 *  Availability:
 *    Non-Carbon CFM:   in FindByContent 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FBCSummarize(inBuf: UnivPtr; inLength: UInt32; outBuf: UnivPtr; var outLength: UInt32; var numSentences: UInt32): OSErr; external name '_FBCSummarize';

{
   ***************************************************************************
   Deallocate hit lists, word arrays, and search sessions
   ***************************************************************************
}

{
 *  FBCReleaseSessionHits()
 *
 *  Availability:
 *    Non-Carbon CFM:   in FindByContent 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FBCReleaseSessionHits(theSession: FBCSearchSession): OSErr; external name '_FBCReleaseSessionHits';

{
 *  FBCDestroyWordList()
 *
 *  Availability:
 *    Non-Carbon CFM:   in FindByContent 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FBCDestroyWordList(theList: FBCWordList; wordCount: UInt32): OSErr; external name '_FBCDestroyWordList';

{
 *  FBCDestroySearchSession()
 *
 *  Availability:
 *    Non-Carbon CFM:   in FindByContent 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FBCDestroySearchSession(theSession: FBCSearchSession): OSErr; external name '_FBCDestroySearchSession';

{
   ***************************************************************************
   Index one or more files and/or folders
   ***************************************************************************
}

{
 *  FBCIndexItems()
 *
 *  Availability:
 *    Non-Carbon CFM:   in FindByContent 9.0 and later
 *    CarbonLib:        not available in CarbonLib 1.x
 *    Mac OS X:         in version 10.0 and later
 }
function FBCIndexItems(theItems: FSSpecArrayPtr; itemCount: UInt32): OSErr; external name '_FBCIndexItems';

{
 *  FBCIndexItemsInLanguages()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x
 *    Mac OS X:         in version 10.0 and later
 }
function FBCIndexItemsInLanguages(theItems: FSSpecArrayPtr; itemCount: UInt32; languageHighBits: UInt32; languageLowBits: UInt32): OSErr; external name '_FBCIndexItemsInLanguages';

{
   ***************************************************************************
   (OS X only) Given a folder, find the folder that contains the index file
   of the given index
   ***************************************************************************
}

{
 *  FBCFindIndexFileFolderForFolder()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x
 *    Mac OS X:         in version 10.0 and later
 }
function FBCFindIndexFileFolderForFolder(var inFolder: FSRef; var outFolder: FSRef): OSErr; external name '_FBCFindIndexFileFolderForFolder';

{
   ***************************************************************************
   (OS X only) Given a folder, delete the index file that indexes it
   ***************************************************************************
}

{
 *  FBCDeleteIndexFileForFolder()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x
 *    Mac OS X:         in version 10.0 and later
 }
function FBCDeleteIndexFileForFolder(const (*var*) folder: FSRef): OSErr; external name '_FBCDeleteIndexFileForFolder';

{$ALIGN MAC68K}
{#POP}
{unit Folders}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}


const
    kOnSystemDisk               = -32768;                       {  previously was 0x8000 but that is an unsigned value whereas vRefNum is signed }
    kOnAppropriateDisk          = -32767;                       {  Generally, the same as kOnSystemDisk, but it's clearer that this isn't always the 'boot' disk. }
                                                                {  Folder Domains - Carbon only.  The constants above can continue to be used, but the folder/volume returned will }
                                                                {  be from one of the domains below. }
    kSystemDomain               = -32766;                       {  Read-only system hierarchy. }
    kLocalDomain                = -32765;                       {  All users of a single machine have access to these resources. }
    kNetworkDomain              = -32764;                       {  All users configured to use a common network server has access to these resources. }
    kUserDomain                 = -32763;                       {  Read/write. Resources that are private to the user. }
    kClassicDomain              = -32762;                       {  Domain referring to the currently configured Classic System Folder }

    kCreateFolder               = true;
    kDontCreateFolder           = false;

    kSystemFolderType           = $6D616373 (* 'macs' *);                       {  the system folder  }
    kDesktopFolderType          = $6465736B (* 'desk' *);                       {  the desktop folder; objects in this folder show on the desk top.  }
    kSystemDesktopFolderType    = $7364736B (* 'sdsk' *);                       {  the desktop folder at the root of the hard drive, never the redirected user desktop folder  }
    kTrashFolderType            = $74727368 (* 'trsh' *);                       {  the trash folder; objects in this folder show up in the trash  }
    kSystemTrashFolderType      = $73747273 (* 'strs' *);                       {  the trash folder at the root of the drive, never the redirected user trash folder  }
    kWhereToEmptyTrashFolderType = $656D7074 (* 'empt' *);                      {  the "empty trash" folder; Finder starts empty from here down  }
    kPrintMonitorDocsFolderType = $70726E74 (* 'prnt' *);                       {  Print Monitor documents  }
    kStartupFolderType          = $73747274 (* 'strt' *);                       {  Finder objects (applications, documents, DAs, aliases, to...) to open at startup go here  }
    kShutdownFolderType         = $73686466 (* 'shdf' *);                       {  Finder objects (applications, documents, DAs, aliases, to...) to open at shutdown go here  }
    kAppleMenuFolderType        = $616D6E75 (* 'amnu' *);                       {  Finder objects to put into the Apple menu go here  }
    kControlPanelFolderType     = $6374726C (* 'ctrl' *);                       {  Control Panels go here (may contain INITs)  }
    kSystemControlPanelFolderType = $7363746C (* 'sctl' *);                     {  System control panels folder - never the redirected one, always "Control Panels" inside the System Folder  }
    kExtensionFolderType        = $6578746E (* 'extn' *);                       {  System extensions go here  }
    kFontsFolderType            = $666F6E74 (* 'font' *);                       {  Fonts go here  }
    kPreferencesFolderType      = $70726566 (* 'pref' *);                       {  preferences for applications go here  }
    kSystemPreferencesFolderType = $73707266 (* 'sprf' *);                      {  System-type Preferences go here - this is always the system's preferences folder, never a logged in user's  }
    kTemporaryFolderType        = $74656D70 (* 'temp' *);                       {  temporary files go here (deleted periodically, but don't rely on it.)  }

    {
     *  FindFolder()
     *
     *  Availability:
     *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function FindFolder(vRefNum: SInt16; folderType: OSType; createFolder: boolean; var foundVRefNum: SInt16; var foundDirID: UInt32): OSErr; external name '_FindFolder';
{
 *  FindFolderExtended()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FindFolderExtended(vol: SInt16; foldType: OSType; createFolder: boolean; flags: UInt32; data: UnivPtr; var vRefNum: SInt16; var dirID: UInt32): OSErr; external name '_FindFolderExtended';
{
 *  ReleaseFolder()
 *
 *  Availability:
 *    Non-Carbon CFM:   in FoldersLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ReleaseFolder(vRefNum: SInt16; folderType: OSType): OSErr; external name '_ReleaseFolder';

{
 *  FSFindFolder()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.1 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FSFindFolder(vRefNum: SInt16; folderType: OSType; createFolder: boolean; var foundRef: FSRef): OSErr; external name '_FSFindFolder';
{
 *  FSFindFolderExtended()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.1 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FSFindFolderExtended(vol: SInt16; foldType: OSType; createFolder: boolean; flags: UInt32; data: UnivPtr; var foundRef: FSRef): OSErr; external name '_FSFindFolderExtended';
{****************************************}
{ Extensible Folder Manager declarations }
{****************************************}

{**************************}
{ Folder Manager constants }
{**************************}


const
    kExtensionDisabledFolderType = $65787444 (* 'extD' *);
    kControlPanelDisabledFolderType = $63747244 (* 'ctrD' *);
    kSystemExtensionDisabledFolderType = $6D616344 (* 'macD' *);
    kStartupItemsDisabledFolderType = $73747244 (* 'strD' *);
    kShutdownItemsDisabledFolderType = $73686444 (* 'shdD' *);
    kApplicationsFolderType     = $61707073 (* 'apps' *);
    kDocumentsFolderType        = $646F6373 (* 'docs' *);

                                                                {  new constants  }
    kVolumeRootFolderType       = $726F6F74 (* 'root' *);                       {  root folder of a volume  }
    kChewableItemsFolderType    = $666C6E74 (* 'flnt' *);                       {  items deleted at boot  }
    kApplicationSupportFolderType = $61737570 (* 'asup' *);                     {  third-party items and folders  }
    kTextEncodingsFolderType    = $C4746578 (* 'Ätex' *);                       {  encoding tables  }
    kStationeryFolderType       = $6F647374 (* 'odst' *);                       {  stationery  }
    kOpenDocFolderType          = $6F646F64 (* 'odod' *);                       {  OpenDoc root  }
    kOpenDocShellPlugInsFolderType = $6F647370 (* 'odsp' *);                    {  OpenDoc Shell Plug-Ins in OpenDoc folder  }
    kEditorsFolderType          = $6F646564 (* 'oded' *);                       {  OpenDoc editors in MacOS Folder  }
    kOpenDocEditorsFolderType   = $C46F6466 (* 'Äodf' *);                       {  OpenDoc subfolder of Editors folder  }
    kOpenDocLibrariesFolderType = $6F646C62 (* 'odlb' *);                       {  OpenDoc libraries folder  }
    kGenEditorsFolderType       = $C4656469 (* 'Äedi' *);                       {  CKH general editors folder at root level of Sys folder  }
    kHelpFolderType             = $C4686C70 (* 'Ählp' *);                       {  CKH help folder currently at root of system folder  }
    kInternetPlugInFolderType   = $C46E6574 (* 'Änet' *);                       {  CKH internet plug ins for browsers and stuff  }
    kModemScriptsFolderType     = $C46D6F64 (* 'Ämod' *);                       {  CKH modem scripts, get 'em OUT of the Extensions folder  }
    kPrinterDescriptionFolderType = $70706466 (* 'ppdf' *);                     {  CKH new folder at root of System folder for printer descs.  }
    kPrinterDriverFolderType    = $C4707264 (* 'Äprd' *);                       {  CKH new folder at root of System folder for printer drivers  }
    kScriptingAdditionsFolderType = $C4736372 (* 'Äscr' *);                     {  CKH at root of system folder  }
    kSharedLibrariesFolderType  = $C46C6962 (* 'Älib' *);                       {  CKH for general shared libs.  }
    kVoicesFolderType           = $66766F63 (* 'fvoc' *);                       {  CKH macintalk can live here  }
    kControlStripModulesFolderType = $73646576 (* 'sdev' *);                    {  CKH for control strip modules  }
    kAssistantsFolderType       = $617374C4 (* 'astÄ' *);                       {  SJF for Assistants (MacOS Setup Assistant, etc)  }
    kUtilitiesFolderType        = $757469C4 (* 'utiÄ' *);                       {  SJF for Utilities folder  }
    kAppleExtrasFolderType      = $616578C4 (* 'aexÄ' *);                       {  SJF for Apple Extras folder  }
    kContextualMenuItemsFolderType = $636D6E75 (* 'cmnu' *);                    {  SJF for Contextual Menu items  }
    kMacOSReadMesFolderType     = $6D6F72C4 (* 'morÄ' *);                       {  SJF for MacOS ReadMes folder  }
    kALMModulesFolderType       = $77616C6B (* 'walk' *);                       {  EAS for Location Manager Module files except type 'thng' (within kExtensionFolderType)  }
    kALMPreferencesFolderType   = $74726970 (* 'trip' *);                       {  EAS for Location Manager Preferences (within kPreferencesFolderType; contains kALMLocationsFolderType)  }
    kALMLocationsFolderType     = $66616C6C (* 'fall' *);                       {  EAS for Location Manager Locations (within kALMPreferencesFolderType)  }
    kColorSyncProfilesFolderType = $70726F66 (* 'prof' *);                      {  for ColorSyncª Profiles  }
    kThemesFolderType           = $74686D65 (* 'thme' *);                       {  for Theme data files  }
    kFavoritesFolderType        = $66617673 (* 'favs' *);                       {  Favorties folder for Navigation Services  }
    kInternetFolderType         = $696E74C4 (* 'intÄ' *);                       {  Internet folder (root level of startup volume)  }
    kAppearanceFolderType       = $61707072 (* 'appr' *);                       {  Appearance folder (root of system folder)  }
    kSoundSetsFolderType        = $736E6473 (* 'snds' *);                       {  Sound Sets folder (in Appearance folder)  }
    kDesktopPicturesFolderType  = $647470C4 (* 'dtpÄ' *);                       {  Desktop Pictures folder (in Appearance folder)  }
    kInternetSearchSitesFolderType = $69737366 (* 'issf' *);                    {  Internet Search Sites folder  }
    kFindSupportFolderType      = $666E6473 (* 'fnds' *);                       {  Find support folder  }
    kFindByContentFolderType    = $66626366 (* 'fbcf' *);                       {  Find by content folder  }
    kInstallerLogsFolderType    = $696C6766 (* 'ilgf' *);                       {  Installer Logs folder  }
    kScriptsFolderType          = $736372C4 (* 'scrÄ' *);                       {  Scripts folder  }
    kFolderActionsFolderType    = $66617366 (* 'fasf' *);                       {  Folder Actions Scripts folder  }
    kLauncherItemsFolderType    = $6C61756E (* 'laun' *);                       {  Launcher Items folder  }
    kRecentApplicationsFolderType = $72617070 (* 'rapp' *);                     {  Recent Applications folder  }
    kRecentDocumentsFolderType  = $72646F63 (* 'rdoc' *);                       {  Recent Documents folder  }
    kRecentServersFolderType    = $72737672 (* 'rsvr' *);                       {  Recent Servers folder  }
    kSpeakableItemsFolderType   = $73706B69 (* 'spki' *);                       {  Speakable Items folder  }
    kKeychainFolderType         = $6B63686E (* 'kchn' *);                       {  Keychain folder  }
    kQuickTimeExtensionsFolderType = $71746578 (* 'qtex' *);                    {  QuickTime Extensions Folder (in Extensions folder)  }
    kDisplayExtensionsFolderType = $6473706C (* 'dspl' *);                      {  Display Extensions Folder (in Extensions folder)  }
    kMultiprocessingFolderType  = $6D707866 (* 'mpxf' *);                       {  Multiprocessing Folder (in Extensions folder)  }
    kPrintingPlugInsFolderType  = $70706C67 (* 'pplg' *);                       {  Printing Plug-Ins Folder (in Extensions folder)  }


    {    New Folder Types to accommodate the Mac OS X Folder Manager    }
    {    These folder types are not applicable on Mac OS 9.             }
    kDomainTopLevelFolderType   = $64746F70 (* 'dtop' *);                       {  The top-level of a Folder domain, e.g. "/System" }
    kDomainLibraryFolderType    = $646C6962 (* 'dlib' *);                       {  the Library subfolder of a particular domain }
    kColorSyncFolderType        = $73796E63 (* 'sync' *);                       {  Contains ColorSync-related folders }
    kColorSyncCMMFolderType     = $63636D6D (* 'ccmm' *);                       {  ColorSync CMMs }
    kColorSyncScriptingFolderType = $63736372 (* 'cscr' *);                     {  ColorSync Scripting support }
    kPrintersFolderType         = $696D7072 (* 'impr' *);                       {  Contains Printing-related folders }
    kSpeechFolderType           = $73706368 (* 'spch' *);                       {  Contains Speech-related folders }
    kCarbonLibraryFolderType    = $63617262 (* 'carb' *);                       {  Contains Carbon-specific file }
    kDocumentationFolderType    = $696E666F (* 'info' *);                       {  Contains Documentation files (not user documents) }
    kDeveloperDocsFolderType    = $64646F63 (* 'ddoc' *);                       {  Contains Developer Documentation files and folders }
    kDeveloperHelpFolderType    = $64657668 (* 'devh' *);                       {  Contains Developer Help related files }
    kISSDownloadsFolderType     = $69737364 (* 'issd' *);                       {  Contains Internet Search Sites downloaded from the Internet }
    kUserSpecificTmpFolderType  = $75746D70 (* 'utmp' *);                       {  Contains temporary items created on behalf of the current user }
    kCachedDataFolderType       = $63616368 (* 'cach' *);                       {  Contains various cache files for different clients }
    kFrameworksFolderType       = $6672616D (* 'fram' *);                       {  Contains MacOS X Framework folders      }
    kPrivateFrameworksFolderType = $7066726D (* 'pfrm' *);                      {  Contains MacOS X Private Framework folders      }
    kClassicDesktopFolderType   = $7364736B (* 'sdsk' *);                       {  MacOS 9 compatible desktop folder - same as  }
                                                                {  kSystemDesktopFolderType but with a more appropriate }
                                                                {  name for Mac OS X code. }
    kDeveloperFolderType        = $64657666 (* 'devf' *);                       {  Contains MacOS X Developer Resources }
    kSystemSoundsFolderType     = $73736E64 (* 'ssnd' *);                       {  Contains Mac OS X System Sound Files }
    kComponentsFolderType       = $636D7064 (* 'cmpd' *);                       {  Contains Mac OS X components }
    kQuickTimeComponentsFolderType = $77636D70 (* 'wcmp' *);                    {  Contains QuickTime components for Mac OS X }
    kCoreServicesFolderType     = $63737276 (* 'csrv' *);                       {  Refers to the "CoreServices" folder on Mac OS X }
    kPictureDocumentsFolderType = $70646F63 (* 'pdoc' *);                       {  Refers to the "Pictures" folder in a users home directory }
    kMovieDocumentsFolderType   = $6D646F63 (* 'mdoc' *);                       {  Refers to the "Movies" folder in a users home directory }
    kMusicDocumentsFolderType   = $B5646F63 (* 'µdoc' *);                       {  Refers to the "Music" folder in a users home directory }
    kInternetSitesFolderType    = $73697465 (* 'site' *);                       {  Refers to the "Sites" folder in a users home directory }
    kPublicFolderType           = $70756262 (* 'pubb' *);                       {  Refers to the "Public" folder in a users home directory }
    kAudioSupportFolderType     = $6164696F (* 'adio' *);                       {  Refers to the Audio support folder for Mac OS X }
    kAudioSoundsFolderType      = $61736E64 (* 'asnd' *);                       {  Refers to the Sounds subfolder of Audio Support }
    kAudioSoundBanksFolderType  = $62616E6B (* 'bank' *);                       {  Refers to the Banks subfolder of the Sounds Folder }
    kAudioAlertSoundsFolderType = $616C7274 (* 'alrt' *);                       {  Refers to the Alert Sounds subfolder of the Sound Folder }
    kAudioPlugInsFolderType     = $61706C67 (* 'aplg' *);                       {  Refers to the Plug-ins subfolder of the Audio Folder    }
    kAudioComponentsFolderType  = $61636D70 (* 'acmp' *);                       {  Refers to the Components subfolder of the Audio Plug-ins Folder     }
    kKernelExtensionsFolderType = $6B657874 (* 'kext' *);                       {  Refers to the Kernel Extensions Folder on Mac OS X }
    kDirectoryServicesFolderType = $64737276 (* 'dsrv' *);                      {  Refers to the Directory Services folder on Mac OS X }
    kDirectoryServicesPlugInsFolderType = $64706C67 (* 'dplg' *);               {  Refers to the Directory Services Plug-Ins folder on Mac OS X  }
    kInstallerReceiptsFolderType = $72637074 (* 'rcpt' *);                      {  Refers to the "Receipts" folder in Mac OS X }
    kFileSystemSupportFolderType = $66737973 (* 'fsys' *);                      {  Refers to the [domain]/Library/Filesystems folder in Mac OS X }
    kAppleShareSupportFolderType = $73686172 (* 'shar' *);                      {  Refers to the [domain]/Library/Filesystems/AppleShare folder in Mac OS X }
    kAppleShareAuthenticationFolderType = $61757468 (* 'auth' *);               {  Refers to the [domain]/Library/Filesystems/AppleShare/Authentication folder in Mac OS X }
    kMIDIDriversFolderType      = $6D696469 (* 'midi' *);                       {  Refers to the MIDI Drivers folder on Mac OS X }

    kLocalesFolderType          = $C46C6F63 (* 'Äloc' *);                       {  PKE for Locales folder  }
    kFindByContentPluginsFolderType = $66626370 (* 'fbcp' *);                   {  Find By Content Plug-ins  }

    kUsersFolderType            = $75737273 (* 'usrs' *);                       {  "Users" folder, contains one folder for each user.  }
    kCurrentUserFolderType      = $63757372 (* 'cusr' *);                       {  The folder for the currently logged on user.  }
    kCurrentUserRemoteFolderLocation = $72757366 (* 'rusf' *);                  {  The remote folder for the currently logged on user  }
    kCurrentUserRemoteFolderType = $72757372 (* 'rusr' *);                      {  The remote folder location for the currently logged on user  }
    kSharedUserDataFolderType   = $73646174 (* 'sdat' *);                       {  A Shared "Documents" folder, readable & writeable by all users  }
    kVolumeSettingsFolderType   = $76736664 (* 'vsfd' *);                       {  Volume specific user information goes here  }

    kAppleshareAutomountServerAliasesFolderType = $737276C4 (* 'srvÄ' *);       {  Appleshare puts volumes to automount inside this folder.  }
    kPreMacOS91ApplicationsFolderType = $8C707073 (* 'Œpps' *);                 {  The "Applications" folder, pre Mac OS 9.1  }
    kPreMacOS91InstallerLogsFolderType = $946C6766 (* '”lgf' *);                {  The "Installer Logs" folder, pre Mac OS 9.1  }
    kPreMacOS91AssistantsFolderType = $8C7374C4 (* 'ŒstÄ' *);                   {  The "Assistants" folder, pre Mac OS 9.1  }
    kPreMacOS91UtilitiesFolderType = $9F7469C4 (* 'ŸtiÄ' *);                    {  The "Utilities" folder, pre Mac OS 9.1  }
    kPreMacOS91AppleExtrasFolderType = $8C6578C4 (* 'ŒexÄ' *);                  {  The "Apple Extras" folder, pre Mac OS 9.1  }
    kPreMacOS91MacOSReadMesFolderType = $B56F72C4 (* 'µorÄ' *);                 {  The "Mac OS ReadMes" folder, pre Mac OS 9.1  }
    kPreMacOS91InternetFolderType = $946E74C4 (* '”ntÄ' *);                     {  The "Internet" folder, pre Mac OS 9.1  }
    kPreMacOS91AutomountedServersFolderType = $A77276C4 (* '§rvÄ' *);           {  The "Servers" folder, pre Mac OS 9.1  }
    kPreMacOS91StationeryFolderType = $BF647374 (* '¿dst' *);                   {  The "Stationery" folder, pre Mac OS 9.1  }

    {    FolderDescFlags values     }
    kCreateFolderAtBoot         = $00000002;
    kCreateFolderAtBootBit      = 1;
    kFolderCreatedInvisible     = $00000004;
    kFolderCreatedInvisibleBit  = 2;
    kFolderCreatedNameLocked    = $00000008;
    kFolderCreatedNameLockedBit = 3;
    kFolderCreatedAdminPrivs    = $00000010;
    kFolderCreatedAdminPrivsBit = 4;

    kFolderInUserFolder         = $00000020;
    kFolderInUserFolderBit      = 5;
    kFolderTrackedByAlias       = $00000040;
    kFolderTrackedByAliasBit    = 6;
    kFolderInRemoteUserFolderIfAvailable = $00000080;
    kFolderInRemoteUserFolderIfAvailableBit = 7;
    kFolderNeverMatchedInIdentifyFolder = $00000100;
    kFolderNeverMatchedInIdentifyFolderBit = 8;
    kFolderMustStayOnSameVolume = $00000200;
    kFolderMustStayOnSameVolumeBit = 9;
    kFolderManagerFolderInMacOS9FolderIfMacOSXIsInstalledMask = $00000400;
    kFolderManagerFolderInMacOS9FolderIfMacOSXIsInstalledBit = 10;
    kFolderInLocalOrRemoteUserFolder = $000000A0;


type
    FolderDescFlags                     = UInt32;
    {    FolderClass values     }

const
    kRelativeFolder             = $72656C66 (* 'relf' *);
    kSpecialFolder              = $73706366 (* 'spcf' *);


type
    FolderClass                         = OSType;
    {    special folder locations   }

const
    kBlessedFolder              = $626C7366 (* 'blsf' *);
    kRootFolder                 = $726F7466 (* 'rotf' *);

    kCurrentUserFolderLocation  = $63757366 (* 'cusf' *);                       {     the magic 'Current User' folder location }


type
    FolderType                          = OSType;
    FolderLocation                      = OSType;

    FolderDescPtr = ^FolderDesc;
    FolderDesc = record
        descSize:               Size;
        foldType:               FolderType;
        flags:                  FolderDescFlags;
        foldClass:              FolderClass;
        foldLocation:           FolderType;
        badgeSignature:         OSType;
        badgeType:              OSType;
        reserved:               UInt32;
        name:                   StrFileName;                            {  Str63 on MacOS }
    end;


    RoutingFlags                        = UInt32;
    FolderRoutingPtr = ^FolderRouting;
    FolderRouting = record
        descSize:               Size;
        fileType:               OSType;
        routeFromFolder:        FolderType;
        routeToFolder:          FolderType;
        flags:                  RoutingFlags;
    end;

    {    routing constants  }
    {   These are bits in the .flags field of the FindFolderUserRedirectionGlobals struct }

const
                                                                {     Set this bit to 1 in the .flags field of a FindFolderUserRedirectionGlobals }
                                                                {     structure if the userName in the struct should be used as the current }
                                                                {     "User" name }
    kFindFolderRedirectionFlagUseDistinctUserFoldersBit = 0;    {     Set this bit to 1 and the currentUserFolderVRefNum and currentUserFolderDirID }
                                                                {     fields of the user record will get used instead of finding the user folder }
                                                                {     with the userName field. }
    kFindFolderRedirectionFlagUseGivenVRefAndDirIDAsUserFolderBit = 1; {     Set this bit to 1 and the remoteUserFolderVRefNum and remoteUserFolderDirID }
                                                                {     fields of the user record will get used instead of finding the user folder }
                                                                {     with the userName field. }
    kFindFolderRedirectionFlagsUseGivenVRefNumAndDirIDAsRemoteUserFolderBit = 2;


type
    FindFolderUserRedirectionGlobalsPtr = ^FindFolderUserRedirectionGlobals;
    FindFolderUserRedirectionGlobals = record
        version:                UInt32;
        flags:                  UInt32;
        userName:               Str31;
        userNameScript:         SInt16;
        currentUserFolderVRefNum: SInt16;
        currentUserFolderDirID: UInt32;
        remoteUserFolderVRefNum: SInt16;
        remoteUserFolderDirID:  UInt32;
    end;


const
    kFolderManagerUserRedirectionGlobalsCurrentVersion = 1;

    {
        These are passed into FindFolderExtended(), FindFolderInternalExtended(), and
        FindFolderNewInstallerEntryExtended() in the flags field.
    }
    kFindFolderExtendedFlagsDoNotFollowAliasesBit = 0;
    kFindFolderExtendedFlagsDoNotUseUserFolderBit = 1;
    kFindFolderExtendedFlagsUseOtherUserRecord = $01000000;


type
    FolderManagerNotificationProcPtr = function(message: OSType; arg: UnivPtr; userRefCon: UnivPtr): OSStatus;

    FolderManagerNotificationUPP = ^SInt32; { an opaque UPP }

const
    uppFolderManagerNotificationProcInfo = $00000FF0;
    {
     *  NewFolderManagerNotificationUPP()
     *
     *  Availability:
     *    Non-Carbon CFM:   available as macro/inline
     *    CarbonLib:        in CarbonLib 1.0.2 and later
     *    Mac OS X:         in version 10.0 and later
        }
function NewFolderManagerNotificationUPP(userRoutine: FolderManagerNotificationProcPtr): FolderManagerNotificationUPP; external name '_NewFolderManagerNotificationUPP'; { old name was NewFolderManagerNotificationProc }
{
 *  DisposeFolderManagerNotificationUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeFolderManagerNotificationUPP(userUPP: FolderManagerNotificationUPP); external name '_DisposeFolderManagerNotificationUPP';
{
 *  InvokeFolderManagerNotificationUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeFolderManagerNotificationUPP(message: OSType; arg: UnivPtr; userRefCon: UnivPtr; userRoutine: FolderManagerNotificationUPP): OSStatus; external name '_InvokeFolderManagerNotificationUPP'; { old name was CallFolderManagerNotificationProc }
const
    kFolderManagerNotificationMessageUserLogIn = $6C6F672B (* 'log+' *);        {     Sent by system & third party software after a user logs in.  arg should point to a valid FindFolderUserRedirectionGlobals structure or nil for the owner }
    kFolderManagerNotificationMessagePreUserLogIn = $6C6F676A (* 'logj' *);     {     Sent by system & third party software before a user logs in.  arg should point to a valid FindFolderUserRedirectionGlobals structure or nil for the owner }
    kFolderManagerNotificationMessageUserLogOut = $6C6F672D (* 'log-' *);       {     Sent by system & third party software before a user logs out.  arg should point to a valid FindFolderUserRedirectionGlobals structure or nil for the owner }
    kFolderManagerNotificationMessagePostUserLogOut = $6C6F6770 (* 'logp' *);   {     Sent by system & third party software after a user logs out.  arg should point to a valid FindFolderUserRedirectionGlobals structure or nil for the owner }
    kFolderManagerNotificationDiscardCachedData = $64636865 (* 'dche' *);       {     Sent by system & third party software when the entire Folder Manager cache should be flushed }
    kFolderManagerNotificationMessageLoginStartup = $73747570 (* 'stup' *);     {     Sent by 'Login' application the first time it starts up after each boot }


    {   These get used in the options parameter of FolderManagerRegisterNotificationProc() }
    kDoNotRemoveWhenCurrentApplicationQuitsBit = 0;
    kDoNotRemoveWheCurrentApplicationQuitsBit = 0;              {     Going away soon, use kDoNotRemoveWheCurrentApplicationQuitsBit }

    {   These get used in the options parameter of FolderManagerCallNotificationProcs() }
    kStopIfAnyNotificationProcReturnsErrorBit = 31;

    {   *************************   }
    {    Folder Manager routines    }
    {   *************************   }
    {    Folder Manager administration routines     }
    {
     *  AddFolderDescriptor()
     *
     *  Availability:
     *    Non-Carbon CFM:   in FoldersLib 1.0 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function AddFolderDescriptor(foldType: FolderType; flags: FolderDescFlags; foldClass: FolderClass; foldLocation: FolderLocation; badgeSignature: OSType; badgeType: OSType; const (*var*) name: StrFileName; replaceFlag: boolean): OSErr; external name '_AddFolderDescriptor';
{
 *  GetFolderDescriptor()
 *
 *  Availability:
 *    Non-Carbon CFM:   in FoldersLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetFolderDescriptor(foldType: FolderType; descSize: Size; var foldDesc: FolderDesc): OSErr; external name '_GetFolderDescriptor';
{
 *  GetFolderTypes()
 *
 *  Availability:
 *    Non-Carbon CFM:   in FoldersLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetFolderTypes(requestedTypeCount: UInt32; var totalTypeCount: UInt32; var theTypes: FolderType): OSErr; external name '_GetFolderTypes';
{
 *  RemoveFolderDescriptor()
 *
 *  Availability:
 *    Non-Carbon CFM:   in FoldersLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function RemoveFolderDescriptor(foldType: FolderType): OSErr; external name '_RemoveFolderDescriptor';
{ legacy routines }
{
 *  GetFolderName()
 *
 *  Availability:
 *    Non-Carbon CFM:   in FoldersLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetFolderName(vRefNum: SInt16; foldType: OSType; var foundVRefNum: SInt16; var name: StrFileName): OSErr; external name '_GetFolderName';
{ routing routines }
{
 *  AddFolderRouting()
 *
 *  Availability:
 *    Non-Carbon CFM:   in FoldersLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function AddFolderRouting(fileType: OSType; routeFromFolder: FolderType; routeToFolder: FolderType; flags: RoutingFlags; replaceFlag: boolean): OSErr; external name '_AddFolderRouting';
{
 *  RemoveFolderRouting()
 *
 *  Availability:
 *    Non-Carbon CFM:   in FoldersLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function RemoveFolderRouting(fileType: OSType; routeFromFolder: FolderType): OSErr; external name '_RemoveFolderRouting';
{
 *  FindFolderRouting()
 *
 *  Availability:
 *    Non-Carbon CFM:   in FoldersLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FindFolderRouting(fileType: OSType; routeFromFolder: FolderType; var routeToFolder: FolderType; var flags: RoutingFlags): OSErr; external name '_FindFolderRouting';
{
 *  GetFolderRoutings()
 *
 *  Availability:
 *    Non-Carbon CFM:   in FoldersLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetFolderRoutings(requestedRoutingCount: UInt32; var totalRoutingCount: UInt32; routingSize: Size; var theRoutings: FolderRouting): OSErr; external name '_GetFolderRoutings';
{
 *  InvalidateFolderDescriptorCache()
 *
 *  Availability:
 *    Non-Carbon CFM:   in FoldersLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvalidateFolderDescriptorCache(vRefNum: SInt16; dirID: UInt32): OSErr; external name '_InvalidateFolderDescriptorCache';
{
 *  IdentifyFolder()
 *
 *  Availability:
 *    Non-Carbon CFM:   in FoldersLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function IdentifyFolder(vRefNum: SInt16; dirID: UInt32; var foldType: FolderType): OSErr; external name '_IdentifyFolder';
{
 *  FolderManagerRegisterNotificationProc()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FolderManagerRegisterNotificationProc(notificationProc: FolderManagerNotificationUPP; refCon: UnivPtr; options: UInt32): OSErr; external name '_FolderManagerRegisterNotificationProc';
{
 *  FolderManagerUnregisterNotificationProc()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FolderManagerUnregisterNotificationProc(notificationProc: FolderManagerNotificationUPP; refCon: UnivPtr): OSErr; external name '_FolderManagerUnregisterNotificationProc';
{
 *  FolderManagerRegisterCallNotificationProcs()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FolderManagerRegisterCallNotificationProcs(message: OSType; arg: UnivPtr; options: UInt32): OSStatus; external name '_FolderManagerRegisterCallNotificationProcs';
{*****************************}
{ MultiUser (At Ease) globals }
{*****************************}
{
   This structure has been through some evolution since the early days of At Ease 1.0.  The structure
   has been expanded (and developers should assume that it will continue this way into the future).  Older
   fields have been obsoleted as the features have changed in newer versions of the code.
}

{  Some fields in here are really only valid for the network version of Macintosh Manager }


type
    MultiUserGestaltPtr = ^MultiUserGestalt;
    MultiUserGestalt = record
                                                                        {     Version 1 fields. }
        giVersion:              SInt16;                             {  structure version: 0 = invalid, 6 = OS 9 }
        giReserved0:            SInt16;                             {  [OBSOLETE with v3] giIsActive: if true then At Ease is currently running }
        giReserved1:            SInt16;                             {  [OBSOLETE] if true then auto create alias }
        giReserved2:            SInt16;                             {  [OBSOLETE with v6]  if true then request floppy on new saves }
        giReserved3:            SInt16;                             {  [OBSOLETE] if true then hypercard stacks are shown on Applications panel }
        giReserved4:            FSSpec;                                 {  [OBSOLETE with v6] location of At Ease Items folder }
                                                                        {     Version 2 fields. }
        giDocsVRefNum:          SInt16;                             {  vrefnum of user's documents location (only valid if not on floppy) }
        giDocsDirID:            UInt32;                             {  directory id of user's documents folder (only valid if not on floppy) }
        giForceSaves:           SInt16;                             {  true if user is forced to save to their documents folder }
        giForceOpens:           SInt16;                             {  true if user is forced to open from their documents folder }
        giSetupName:            Str31;                                  {  name of current setup }
        giUserName:             Str31;                                  {  name of current user }
        giFrontAppName:         Str31;                                  {  name of the frontmost application }
        giReserved5:            SInt16;                             {  [OBSOLETE with v6] true if user has Go To Finder menu item }
        giIsOn:                 SInt16;                             {  true if Multiple Users/Macintosh Manager is on right now }
                                                                        {     Version 3 fields. }
                                                                        {   There were no additional fields for version 3.x }
                                                                        {     Version 4 fields. }
        giUserLoggedInType:     SInt16;                             {  0 = normal user, 1 = workgroup admin, 2 = global admin }
        giUserEncryptPwd:       packed array [0..15] of char;           {  encrypted user password (our digest form) }
        giUserEnvironment:      SInt16;                             {  0 = panels, 1 = normal Finder, 2 = limited/restricted Finder }
        giReserved6:            SInt32;                             {  [OBSOLETE] }
        giReserved7:            SInt32;                             {  [OBSOLETE] }
        giDisableScrnShots:     boolean;                                {  true if screen shots are not allowed }
                                                                        {     Version 5 fields. }
        giSupportsAsyncFSCalls: boolean;                                {  Finder uses this to tell if our patches support async trap patches }
        giPrefsVRefNum:         SInt16;                             {  vrefnum of preferences }
        giPrefsDirID:           UInt32;                             {  dirID of the At Ease Items folder on preferences volume }
        giUserLogInTime:        UInt32;                                 {  time in seconds we've been logged in (0 or 1 mean not logged in) }
        giUsingPrintQuotas:     boolean;                                {  true if logged in user is using printer quotas }
        giUsingDiskQuotas:      boolean;                                {  true if logged in user has disk quotas active }
                                                                        {  Version 6 fields - As of Mac OS 9's "Multiple Users 1.0" }
        giInSystemAccess:       boolean;                                {  true if system is in System Access (i.e., owner logged in) }
        giUserFolderEnabled:    boolean;                                {  true if FindFolder is redirecting folders (uses giUserName for user) }
        giReserved8:            SInt16;
        giReserved9:            SInt32;
        giInLoginScreen:        boolean;                                {  true if no user has logged in (including owner) }
                                                                        {  May have more fields added in future, so never check for sizeof(GestaltRec) }
    end;

    MultiUserGestaltHandle              = ^MultiUserGestaltPtr;


{$ALIGN MAC68K}
{#POP}
{unit HFSVolumes}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}

{ Signatures used to differentiate between HFS and HFS Plus volumes }

const
    kHFSSigWord                 = $4244;                        {  'BD' in ASCII  }
    kHFSPlusSigWord             = $482B;                        {  'H+' in ASCII  }
    kHFSPlusVersion             = $0004;                        {  will change as format changes (version 4 shipped with Mac OS 8.1)  }
    kHFSPlusMountVersion        = $382E3130 (* '8.10' *);                       {  will change as implementations change ('8.10' in Mac OS 8.1)  }


    {    CatalogNodeID is used to track catalog objects     }

type
    HFSCatalogNodeID                    = UInt32;

const
    kHFSMaxVolumeNameChars      = 27;
    kHFSMaxFileNameChars        = 31;
    kHFSPlusMaxFileNameChars    = 255;


    {    Extent overflow file data structures   }
    {    HFS Extent key     }

type
    HFSExtentKeyPtr = ^HFSExtentKey;
    HFSExtentKey = record
        keyLength:              SInt8;                                  {  length of key, excluding this field  }
        forkType:               SInt8;                                  {  0 = data fork, FF = resource fork  }
        fileID:                 HFSCatalogNodeID;                       {  file ID  }
        startBlock:             UInt16;                                 {  first file allocation block number in this extent  }
    end;

    {    HFS Plus Extent key    }
    HFSPlusExtentKeyPtr = ^HFSPlusExtentKey;
    HFSPlusExtentKey = record
        keyLength:              UInt16;                                 {  length of key, excluding this field  }
        forkType:               SInt8;                                  {  0 = data fork, FF = resource fork  }
        pad:                    SInt8;                                  {  make the other fields align on 32-bit boundary  }
        fileID:                 HFSCatalogNodeID;                       {  file ID  }
        startBlock:             UInt32;                                 {  first file allocation block number in this extent  }
    end;

    {    Number of extent descriptors per extent record     }

const
    kHFSExtentDensity           = 3;
    kHFSPlusExtentDensity       = 8;

    {    HFS extent descriptor  }

type
    HFSExtentDescriptorPtr = ^HFSExtentDescriptor;
    HFSExtentDescriptor = record
        startBlock:             UInt16;                                 {  first allocation block  }
        blockCount:             UInt16;                                 {  number of allocation blocks  }
    end;

    {    HFS Plus extent descriptor     }
    HFSPlusExtentDescriptorPtr = ^HFSPlusExtentDescriptor;
    HFSPlusExtentDescriptor = record
        startBlock:             UInt32;                                 {  first allocation block  }
        blockCount:             UInt32;                                 {  number of allocation blocks  }
    end;

    {    HFS extent record  }
    HFSExtentRecord                     = array [0..2] of HFSExtentDescriptor;
    {    HFS Plus extent record     }
    HFSPlusExtentRecord                 = array [0..7] of HFSPlusExtentDescriptor;

    {    Fork data info (HFS Plus only) - 80 bytes  }
    HFSPlusForkDataPtr = ^HFSPlusForkData;
    HFSPlusForkData = record
        logicalSize:            UInt64;                                 {  fork's logical size in bytes  }
        clumpSize:              UInt32;                                 {  fork's clump size in bytes  }
        totalBlocks:            UInt32;                                 {  total blocks used by this fork  }
        extents:                HFSPlusExtentRecord;                    {  initial set of extents  }
    end;

    {    Permissions info (HFS Plus only) - 16 bytes    }
    HFSPlusPermissionsPtr = ^HFSPlusPermissions;
    HFSPlusPermissions = record
        ownerID:                UInt32;                                 {  user or group ID of file/folder owner  }
        groupID:                UInt32;                                 {  additional user of group ID  }
        permissions:            UInt32;                                 {  permissions (bytes: unused, owner, group, everyone)  }
        specialDevice:          UInt32;                                 {  UNIX: device for character or block special file  }
    end;

    {    Catalog file data structures   }

const
    kHFSRootParentID            = 1;                            {  Parent ID of the root folder  }
    kHFSRootFolderID            = 2;                            {  Folder ID of the root folder  }
    kHFSExtentsFileID           = 3;                            {  File ID of the extents file  }
    kHFSCatalogFileID           = 4;                            {  File ID of the catalog file  }
    kHFSBadBlockFileID          = 5;                            {  File ID of the bad allocation block file  }
    kHFSAllocationFileID        = 6;                            {  File ID of the allocation file (HFS Plus only)  }
    kHFSStartupFileID           = 7;                            {  File ID of the startup file (HFS Plus only)  }
    kHFSAttributesFileID        = 8;                            {  File ID of the attribute file (HFS Plus only)  }
    kHFSBogusExtentFileID       = 15;                           {  Used for exchanging extents in extents file  }
    kHFSFirstUserCatalogNodeID  = 16;


    {    HFS catalog key    }

type
    HFSCatalogKeyPtr = ^HFSCatalogKey;
    HFSCatalogKey = record
        keyLength:              SInt8;                                  {  key length (in bytes)  }
        reserved:               SInt8;                                  {  reserved (set to zero)  }
        parentID:               HFSCatalogNodeID;                       {  parent folder ID  }
        nodeName:               Str31;                                  {  catalog node name  }
    end;

    {    HFS Plus catalog key   }
    HFSPlusCatalogKeyPtr = ^HFSPlusCatalogKey;
    HFSPlusCatalogKey = record
        keyLength:              UInt16;                                 {  key length (in bytes)  }
        parentID:               HFSCatalogNodeID;                       {  parent folder ID  }
        nodeName:               HFSUniStr255;                           {  catalog node name  }
    end;


    {    Catalog record types   }

const
                                                                {  HFS Catalog Records  }
    kHFSFolderRecord            = $0100;                        {  Folder record  }
    kHFSFileRecord              = $0200;                        {  File record  }
    kHFSFolderThreadRecord      = $0300;                        {  Folder thread record  }
    kHFSFileThreadRecord        = $0400;                        {  File thread record  }
                                                                {  HFS Plus Catalog Records  }
    kHFSPlusFolderRecord        = 1;                            {  Folder record  }
    kHFSPlusFileRecord          = 2;                            {  File record  }
    kHFSPlusFolderThreadRecord  = 3;                            {  Folder thread record  }
    kHFSPlusFileThreadRecord    = 4;                            {  File thread record  }


    {    Catalog file record flags  }
    kHFSFileLockedBit           = $0000;                        {  file is locked and cannot be written to  }
    kHFSFileLockedMask          = $0001;
    kHFSThreadExistsBit         = $0001;                        {  a file thread record exists for this file  }
    kHFSThreadExistsMask        = $0002;


    {    HFS catalog folder record - 70 bytes   }

type
    HFSCatalogFolderPtr = ^HFSCatalogFolder;
    HFSCatalogFolder = record
        recordType:             SInt16;                                 {  record type  }
        flags:                  UInt16;                                 {  folder flags  }
        valence:                UInt16;                                 {  folder valence  }
        folderID:               HFSCatalogNodeID;                       {  folder ID  }
        createDate:             UInt32;                                 {  date and time of creation  }
        modifyDate:             UInt32;                                 {  date and time of last modification  }
        backupDate:             UInt32;                                 {  date and time of last backup  }
        userInfo:               DInfo;                                  {  Finder information  }
        finderInfo:             DXInfo;                                 {  additional Finder information  }
        reserved:               array [0..3] of UInt32;                 {  reserved - set to zero  }
    end;

    {    HFS Plus catalog folder record - 88 bytes  }
    HFSPlusCatalogFolderPtr = ^HFSPlusCatalogFolder;
    HFSPlusCatalogFolder = record
        recordType:             SInt16;                                 {  record type = HFS Plus folder record  }
        flags:                  UInt16;                                 {  file flags  }
        valence:                UInt32;                                 {  folder's valence (limited to 2^16 in Mac OS)  }
        folderID:               HFSCatalogNodeID;                       {  folder ID  }
        createDate:             UInt32;                                 {  date and time of creation  }
        contentModDate:         UInt32;                                 {  date and time of last content modification  }
        attributeModDate:       UInt32;                                 {  date and time of last attribute modification  }
        accessDate:             UInt32;                                 {  date and time of last access (Rhapsody only)  }
        backupDate:             UInt32;                                 {  date and time of last backup  }
        permissions:            HFSPlusPermissions;                     {  permissions (for Rhapsody)  }
        userInfo:               DInfo;                                  {  Finder information  }
        finderInfo:             DXInfo;                                 {  additional Finder information  }
        textEncoding:           UInt32;                                 {  hint for name conversions  }
        reserved:               UInt32;                                 {  reserved - set to zero  }
    end;

    {    HFS catalog file record - 102 bytes    }
    HFSCatalogFilePtr = ^HFSCatalogFile;
    HFSCatalogFile = record
        recordType:             SInt16;                                 {  record type  }
        flags:                  SInt8;                                  {  file flags  }
        fileType:               SInt8;                                  {  file type (unused ?)  }
        userInfo:               FInfo;                                  {  Finder information  }
        fileID:                 HFSCatalogNodeID;                       {  file ID  }
        dataStartBlock:         UInt16;                                 {  not used - set to zero  }
        dataLogicalSize:        SInt32;                                 {  logical EOF of data fork  }
        dataPhysicalSize:       SInt32;                                 {  physical EOF of data fork  }
        rsrcStartBlock:         UInt16;                                 {  not used - set to zero  }
        rsrcLogicalSize:        SInt32;                                 {  logical EOF of resource fork  }
        rsrcPhysicalSize:       SInt32;                                 {  physical EOF of resource fork  }
        createDate:             UInt32;                                 {  date and time of creation  }
        modifyDate:             UInt32;                                 {  date and time of last modification  }
        backupDate:             UInt32;                                 {  date and time of last backup  }
        finderInfo:             FXInfo;                                 {  additional Finder information  }
        clumpSize:              UInt16;                                 {  file clump size (not used)  }
        dataExtents:            HFSExtentRecord;                        {  first data fork extent record  }
        rsrcExtents:            HFSExtentRecord;                        {  first resource fork extent record  }
        reserved:               UInt32;                                 {  reserved - set to zero  }
    end;

    {    HFS Plus catalog file record - 248 bytes   }
    HFSPlusCatalogFilePtr = ^HFSPlusCatalogFile;
    HFSPlusCatalogFile = record
        recordType:             SInt16;                                 {  record type = HFS Plus file record  }
        flags:                  UInt16;                                 {  file flags  }
        reserved1:              UInt32;                                 {  reserved - set to zero  }
        fileID:                 HFSCatalogNodeID;                       {  file ID  }
        createDate:             UInt32;                                 {  date and time of creation  }
        contentModDate:         UInt32;                                 {  date and time of last content modification  }
        attributeModDate:       UInt32;                                 {  date and time of last attribute modification  }
        accessDate:             UInt32;                                 {  date and time of last access (Rhapsody only)  }
        backupDate:             UInt32;                                 {  date and time of last backup  }
        permissions:            HFSPlusPermissions;                     {  permissions (for Rhapsody)  }
        userInfo:               FInfo;                                  {  Finder information  }
        finderInfo:             FXInfo;                                 {  additional Finder information  }
        textEncoding:           UInt32;                                 {  hint for name conversions  }
        reserved2:              UInt32;                                 {  reserved - set to zero  }
                                                                        {  start on double long (64 bit) boundry  }
        dataFork:               HFSPlusForkData;                        {  size and block data for data fork  }
        resourceFork:           HFSPlusForkData;                        {  size and block data for resource fork  }
    end;

    {    HFS catalog thread record - 46 bytes   }
    HFSCatalogThreadPtr = ^HFSCatalogThread;
    HFSCatalogThread = record
        recordType:             SInt16;                                 {  record type  }
        reserved:               array [0..1] of SInt32;                 {  reserved - set to zero  }
        parentID:               HFSCatalogNodeID;                       {  parent ID for this catalog node  }
        nodeName:               Str31;                                  {  name of this catalog node  }
    end;

    {    HFS Plus catalog thread record -- maximum 520 bytes    }
    HFSPlusCatalogThreadPtr = ^HFSPlusCatalogThread;
    HFSPlusCatalogThread = record
        recordType:             SInt16;                                 {  record type  }
        reserved:               SInt16;                                 {  reserved - set to zero  }
        parentID:               HFSCatalogNodeID;                       {  parent ID for this catalog node  }
        nodeName:               HFSUniStr255;                           {  name of this catalog node (variable length)  }
    end;


    {
        These are the types of records in the attribute B-tree.  The values were chosen
        so that they wouldn't conflict with the catalog record types.
    }

const
    kHFSPlusAttrInlineData      = $10;                          {  if size <  kAttrOverflowSize  }
    kHFSPlusAttrForkData        = $20;                          {  if size >= kAttrOverflowSize  }
    kHFSPlusAttrExtents         = $30;                          {  overflow extents for large attributes  }


    {
        HFSPlusAttrInlineData
        For small attributes, whose entire value is stored within this one
        B-tree record.
        There would not be any other records for this attribute.
    }

type
    HFSPlusAttrInlineDataPtr = ^HFSPlusAttrInlineData;
    HFSPlusAttrInlineData = record
        recordType:             UInt32;                                 {     = kHFSPlusAttrInlineData }
        reserved:               UInt32;
        logicalSize:            UInt32;                                 {     size in bytes of userData }
        userData:               packed array [0..1] of UInt8;           {     variable length; space allocated is a multiple of 2 bytes }
    end;

    {
        HFSPlusAttrForkData
        For larger attributes, whose value is stored in allocation blocks.
        If the attribute has more than 8 extents, there will be additonal
        records (of type HFSPlusAttrExtents) for this attribute.
    }
    HFSPlusAttrForkDataPtr = ^HFSPlusAttrForkData;
    HFSPlusAttrForkData = record
        recordType:             UInt32;                                 {     = kHFSPlusAttrForkData }
        reserved:               UInt32;
        theFork:                HFSPlusForkData;                        {     size and first extents of value }
    end;

    {
        HFSPlusAttrExtents
        This record contains information about overflow extents for large,
        fragmented attributes.
    }
    HFSPlusAttrExtentsPtr = ^HFSPlusAttrExtents;
    HFSPlusAttrExtents = record
        recordType:             UInt32;                                 {     = kHFSPlusAttrExtents }
        reserved:               UInt32;
        extents:                HFSPlusExtentRecord;                    {     additional extents }
    end;

    {   A generic Attribute Record }
    HFSPlusAttrRecordPtr = ^HFSPlusAttrRecord;
    HFSPlusAttrRecord = record
        case SInt16 of
        0: (
            recordType:         UInt32;
            );
        1: (
            inlineData:         HFSPlusAttrInlineData;
            );
        2: (
            forkData:           HFSPlusAttrForkData;
            );
        3: (
            overflowExtents:    HFSPlusAttrExtents;
            );
    end;

    {    Key and node lengths   }

const
    kHFSPlusExtentKeyMaximumLength = 10;
    kHFSExtentKeyMaximumLength  = 7;
    kHFSPlusCatalogKeyMaximumLength = 516;
    kHFSPlusCatalogKeyMinimumLength = 6;
    kHFSCatalogKeyMaximumLength = 37;
    kHFSCatalogKeyMinimumLength = 6;
    kHFSPlusCatalogMinNodeSize  = 4096;
    kHFSPlusExtentMinNodeSize   = 512;
    kHFSPlusAttrMinNodeSize     = 4096;


    {    HFS and HFS Plus volume attribute bits     }
                                                                {  Bits 0-6 are reserved (always cleared by MountVol call)  }
    kHFSVolumeHardwareLockBit   = 7;                            {  volume is locked by hardware  }
    kHFSVolumeUnmountedBit      = 8;                            {  volume was successfully unmounted  }
    kHFSVolumeSparedBlocksBit   = 9;                            {  volume has bad blocks spared  }
    kHFSVolumeNoCacheRequiredBit = 10;                          {  don't cache volume blocks (i.e. RAM or ROM disk)  }
    kHFSBootVolumeInconsistentBit = 11;                         {  boot volume is inconsistent (System 7.6 and later)  }
                                                                {  Bits 12-14 are reserved for future use  }
    kHFSVolumeSoftwareLockBit   = 15;                           {  volume is locked by software  }
    kHFSVolumeHardwareLockMask  = $80;
    kHFSVolumeUnmountedMask     = $0100;
    kHFSVolumeSparedBlocksMask  = $0200;
    kHFSVolumeNoCacheRequiredMask = $0400;
    kHFSBootVolumeInconsistentMask = $0800;
    kHFSVolumeSoftwareLockMask  = $8000;
    kHFSMDBAttributesMask       = $8380;

    kHFSCatalogNodeIDsReusedBit = 12;                           {  nextCatalogID wrapped around  }
    kHFSCatalogNodeIDsReusedMask = $1000;

    {    Master Directory Block (HFS only) - 162 bytes  }
    {    Stored at sector #2 (3rd sector)   }

type
    HFSMasterDirectoryBlockPtr = ^HFSMasterDirectoryBlock;
    HFSMasterDirectoryBlock = record
                                                                        {  These first fields are also used by MFS  }
        drSigWord:              UInt16;                                 {  volume signature  }
        drCrDate:               UInt32;                                 {  date and time of volume creation  }
        drLsMod:                UInt32;                                 {  date and time of last modification  }
        drAtrb:                 UInt16;                                 {  volume attributes  }
        drNmFls:                UInt16;                                 {  number of files in root folder  }
        drVBMSt:                UInt16;                                 {  first block of volume bitmap  }
        drAllocPtr:             UInt16;                                 {  start of next allocation search  }
        drNmAlBlks:             UInt16;                                 {  number of allocation blocks in volume  }
        drAlBlkSiz:             UInt32;                                 {  size (in bytes) of allocation blocks  }
        drClpSiz:               UInt32;                                 {  default clump size  }
        drAlBlSt:               UInt16;                                 {  first allocation block in volume  }
        drNxtCNID:              UInt32;                                 {  next unused catalog node ID  }
        drFreeBks:              UInt16;                                 {  number of unused allocation blocks  }
        drVN:                   Str27;                                  {  volume name  }
                                                                        {  Master Directory Block extensions for HFS  }
        drVolBkUp:              UInt32;                                 {  date and time of last backup  }
        drVSeqNum:              UInt16;                                 {  volume backup sequence number  }
        drWrCnt:                UInt32;                                 {  volume write count  }
        drXTClpSiz:             UInt32;                                 {  clump size for extents overflow file  }
        drCTClpSiz:             UInt32;                                 {  clump size for catalog file  }
        drNmRtDirs:             UInt16;                                 {  number of directories in root folder  }
        drFilCnt:               UInt32;                                 {  number of files in volume  }
        drDirCnt:               UInt32;                                 {  number of directories in volume  }
        drFndrInfo:             array [0..7] of SInt32;                 {  information used by the Finder  }
        drEmbedSigWord:         UInt16;                                 {  embedded volume signature (formerly drVCSize)  }
        drEmbedExtent:          HFSExtentDescriptor;                    {  embedded volume location and size (formerly drVBMCSize and drCtlCSize)  }
        drXTFlSize:             UInt32;                                 {  size of extents overflow file  }
        drXTExtRec:             HFSExtentRecord;                        {  extent record for extents overflow file  }
        drCTFlSize:             UInt32;                                 {  size of catalog file  }
        drCTExtRec:             HFSExtentRecord;                        {  extent record for catalog file  }
    end;

    {    HFSPlusVolumeHeader (HFS Plus only) - 512 bytes    }
    {    Stored at sector #2 (3rd sector) and second-to-last sector.    }
    HFSPlusVolumeHeaderPtr = ^HFSPlusVolumeHeader;
    HFSPlusVolumeHeader = record
        signature:              UInt16;                                 {  volume signature == 'H+'  }
        version:                UInt16;                                 {  current version is kHFSPlusVersion  }
        attributes:             UInt32;                                 {  volume attributes  }
        lastMountedVersion:     UInt32;                                 {  implementation version which last mounted volume  }
        reserved:               UInt32;                                 {  reserved - set to zero  }
        createDate:             UInt32;                                 {  date and time of volume creation  }
        modifyDate:             UInt32;                                 {  date and time of last modification  }
        backupDate:             UInt32;                                 {  date and time of last backup  }
        checkedDate:            UInt32;                                 {  date and time of last disk check  }
        fileCount:              UInt32;                                 {  number of files in volume  }
        folderCount:            UInt32;                                 {  number of directories in volume  }
        blockSize:              UInt32;                                 {  size (in bytes) of allocation blocks  }
        totalBlocks:            UInt32;                                 {  number of allocation blocks in volume (includes this header and VBM }
        freeBlocks:             UInt32;                                 {  number of unused allocation blocks  }
        nextAllocation:         UInt32;                                 {  start of next allocation search  }
        rsrcClumpSize:          UInt32;                                 {  default resource fork clump size  }
        dataClumpSize:          UInt32;                                 {  default data fork clump size  }
        nextCatalogID:          HFSCatalogNodeID;                       {  next unused catalog node ID  }
        writeCount:             UInt32;                                 {  volume write count  }
        encodingsBitmap:        UInt64;                                 {  which encodings have been use  on this volume  }
        finderInfo:             packed array [0..31] of UInt8;          {  information used by the Finder  }
        allocationFile:         HFSPlusForkData;                        {  allocation bitmap file  }
        extentsFile:            HFSPlusForkData;                        {  extents B-tree file  }
        catalogFile:            HFSPlusForkData;                        {  catalog B-tree file  }
        attributesFile:         HFSPlusForkData;                        {  extended attributes B-tree file  }
        startupFile:            HFSPlusForkData;                        {  boot file  }
    end;

    {    ---------- HFS and HFS Plus B-tree structures ----------   }
    {    BTNodeDescriptor -- Every B-tree node starts with these fields.    }
    BTNodeDescriptorPtr = ^BTNodeDescriptor;
    BTNodeDescriptor = record
        fLink:                  UInt32;                                 {     next node at this level }
        bLink:                  UInt32;                                 {     previous node at this level }
        kind:                   SInt8;                                  {     kind of node (leaf, index, header, map) }
        height:                 SInt8;                                  {     zero for header, map; child is one more than parent }
        numRecords:             UInt16;                                 {     number of records in this node }
        reserved:               UInt16;                                 {     reserved; set to zero }
    end;

    {    Constants for BTNodeDescriptor kind    }

const
    kBTLeafNode                 = -1;
    kBTIndexNode                = 0;
    kBTHeaderNode               = 1;
    kBTMapNode                  = 2;

    {    BTHeaderRec -- The first record of a B-tree header node    }

type
    BTHeaderRecPtr = ^BTHeaderRec;
    BTHeaderRec = record
        treeDepth:              UInt16;                                 {     maximum height (usually leaf nodes) }
        rootNode:               UInt32;                                 {     node number of root node }
        leafRecords:            UInt32;                                 {     number of leaf records in all leaf nodes }
        firstLeafNode:          UInt32;                                 {     node number of first leaf node }
        lastLeafNode:           UInt32;                                 {     node number of last leaf node }
        nodeSize:               UInt16;                                 {     size of a node, in bytes }
        maxKeyLength:           UInt16;                                 {     reserved }
        totalNodes:             UInt32;                                 {     total number of nodes in tree }
        freeNodes:              UInt32;                                 {     number of unused (free) nodes in tree }
        reserved1:              UInt16;                                 {     unused }
        clumpSize:              UInt32;                                 {     reserved }
        btreeType:              SInt8;                                  {     reserved }
        reserved2:              SInt8;                                  {     reserved }
        attributes:             UInt32;                                 {     persistent attributes about the tree }
        reserved3:              array [0..15] of UInt32;                {     reserved }
    end;

    {    Constants for BTHeaderRec attributes   }

const
    kBTBadCloseMask             = $00000001;                    {     reserved }
    kBTBigKeysMask              = $00000002;                    {     key length field is 16 bits }
    kBTVariableIndexKeysMask    = $00000004;                    {     keys in index nodes are variable length }

{$ALIGN MAC68K}
{#POP}
{unit ICAApplication}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}


type
    ICAObject    = ^SInt32; { an opaque 32-bit type }
    ICAObjectPtr = ^ICAObject;  { when a var xx:ICAObject parameter can be nil, it is changed to xx: ICAObjectPtr }
    ICAProperty    = ^SInt32; { an opaque 32-bit type }
    ICAPropertyPtr = ^ICAProperty;  { when a var xx:ICAProperty parameter can be nil, it is changed to xx: ICAPropertyPtr }
    ICAConnectionID    = ^SInt32; { an opaque 32-bit type }
    ICAConnectionIDPtr = ^ICAConnectionID;  { when a var xx:ICAConnectionID parameter can be nil, it is changed to xx: ICAConnectionIDPtr }
    {
    --------------- Defines ---------------
        }
    {  Error codes (Image Capture range = -9900...-9949) }

const
    kICACommunicationErr        = -9900;
    kICADeviceNotFoundErr       = -9901;
    kICADeviceNotOpenErr        = -9902;
    kICAFileCorruptedErr        = -9903;
    kICAIOPendingErr            = -9904;
    kICAInvalidObjectErr        = -9905;
    kICAInvalidPropertyErr      = -9906;
    kICAIndexOutOfRangeErr      = -9907;
    kICAPropertyTypeNotFoundErr = -9908;

    {
    NOTE: vendor specific constants are UPPERCASE  (exception: 'TEXT')
        }
    {  ICAObject types and subtypes  }
    kICADevice                  = $69636476 (* 'icdv' *);                       {  Also creator of device library files  }
    kICADeviceCamera            = $636D7261 (* 'cmra' *);                       {  Also file type of device library files  }
    kICADeviceScanner           = $7363616E (* 'scan' *);                       {  Also file type of device library files  }
    kICADeviceMFP               = $6D667020 (* 'mfp ' *);                       {  Also file type of device library files  }
    kICAList                    = $6F626A6C (* 'objl' *);
    kICADirectory               = $64697265 (* 'dire' *);
    kICAFile                    = $66696C65 (* 'file' *);
    kICAFileImage               = $696D6167 (* 'imag' *);
    kICAFileMovie               = $6D6F6F76 (* 'moov' *);
    kICAFileAudio               = $6175646F (* 'audo' *);
    kICAFileFirmware            = $6669726D (* 'firm' *);
    kICAFileOther               = $6F746865 (* 'othe' *);

    {  ICAProperties  }
    kICAProperty                = $70726F70 (* 'prop' *);                       {   }
                                                                {     file properties  }
                                                                {   }
                                                                {  for images, refer to 'Digital Still Camera Image File Format Standard' Exif Version 2.1 section 2.6.4. and 2.6.5. }
    kICAPropertyImageWidth      = $30313030 (* '0100' *);                       {  UInt32  }
    kICAPropertyImageHeight     = $30313031 (* '0101' *);                       {  UInt32  }
    kICAPropertyImageBitDepth   = $30313032 (* '0102' *);                       {  UInt32  }
    kICAPropertyImageDPI        = $30313141 (* '011A' *);                       {  UInt32  }
    kICAPropertyImageExposureTime = $38323941 (* '829A' *);
    kICAPropertyImageFNumber    = $38323944 (* '829D' *);
    kICAPropertyImageDateOriginal = $39303033 (* '9003' *);                     {  null terminated string (YYYYMMDDThhmmss.s)  }
    kICAPropertyImageDateDigitized = $39303034 (* '9004' *);                    {  null terminated string (YYYYMMDDThhmmss.s)  }
    kICAPropertyImageShutterSpeed = $39323031 (* '9201' *);                     {   }
    kICAPropertyImageAperture   = $39323032 (* '9202' *);                       {   }
    kICAPropertyImageFlash      = $39323039 (* '9209' *);                       {  UInt16 }
    kICAPropertyColorSpace      = $41303031 (* 'A001' *);                       {  UInt16 }
    kICAPropertyImageFilename   = $6966696C (* 'ifil' *);                       {  null terminated string  }
    kICAPropertyImageSize       = $6973697A (* 'isiz' *);                       {  UInt32  }
    kICAPropertyImageData       = $69646174 (* 'idat' *);                       {  void *  }
    kICAPropertyImageThumbnail  = $7468756D (* 'thum' *);                       {  void *  }
    kICAPropertyColorSyncProfile = $70726F66 (* 'prof' *);

    {  Messages  }
    kICAMessageConnect          = $6F70656E (* 'open' *);
    kICAMessageDisconnect       = $636C6F73 (* 'clos' *);
    kICAMessageReset            = $72657365 (* 'rese' *);
    kICAMessageCheckDevice      = $63686B64 (* 'chkd' *);


    {  Data type definitions, mapped to AppleEvent types  }
    kICATypeUInt16              = $75693136 (* 'ui16' *);                       {  UInt16  }
    kICATypeUInt32              = $75693332 (* 'ui32' *);                       {  UInt32  }
    kICATypeUInt64              = $75693634 (* 'ui64' *);                       {  UInt64  }
    kICATypeSInt16              = $73693136 (* 'si16' *);                       {  SInt16  }
    kICATypeSInt32              = $73693332 (* 'si32' *);                       {  SInt32  }
    kICATypeSInt64              = $73693634 (* 'si64' *);                       {  SInt64  }
    kICATypeFixed               = $73696E67 (* 'sing' *);                       {  typeIEEE32BitFloatingPoint  }
    kICATypeBoolean             = $626F6F6C (* 'bool' *);                       {  typeBoolean  }
    kICATypeString              = $54455854 (* 'TEXT' *);                       {  typeChar  }
    kICATypeData                = $64617461 (* 'data' *);                       {  void *  }
    kICATypeThumbnail           = $7468756D (* 'thum' *);                       {  ICAThumbnail }


    {  Flags for PropertyInfo flag element  }
    kICAFlagReadWriteAccess     = $00000001;
    kICAFlagReadAccess          = $00000002;



    {  Notification types (Refer to section 12.4 of PTP spec)  }
    kICAEventCancelTransaction  = $65636E74 (* 'ecnt' *);
    kICAEventObjectAdded        = $656F6261 (* 'eoba' *);
    kICAEventObjectRemoved      = $656F6272 (* 'eobr' *);
    kICAEventStoreAdded         = $65737461 (* 'esta' *);
    kICAEventStoreRemoved       = $65737472 (* 'estr' *);
    kICAEventDeviceAdded        = $65646561 (* 'edea' *);
    kICAEventDeviceRemoved      = $65646572 (* 'eder' *);
    kICAEventDevicePropChanged  = $65647063 (* 'edpc' *);
    kICAEventObjectInfoChanged  = $656F6963 (* 'eoic' *);
    kICAEventDeviceInfoChanged  = $65646963 (* 'edic' *);
    kICAEventRequestObjectTransfer = $65726F74 (* 'erot' *);
    kICAEventStoreFull          = $65737466 (* 'estf' *);
    kICAEventDeviceReset        = $65647672 (* 'edvr' *);
    kICAEventStorageInfoChanged = $65736963 (* 'esic' *);
    kICAEventCaptureComplete    = $65637063 (* 'ecpc' *);
    kICAEventUnreportedStatus   = $65757273 (* 'eurs' *);


    {  Used for partial reads via ICAGetPropertyData  }
    kICAStartAtBeginning        = 0;
    kICAEntireLength            = -1;

    {  ICADownloadFile flags  }
    kDeleteAfterDownload        = $00000001;
    kCreateCustomIcon           = $00000002;
    kAddMetaDataToFinderComment = $00000004;
    kAdjustCreationDate         = $00000008;
    kSetFileTypeAndCreator      = $00000010;
    kEmbedColorSyncProfile      = $00000020;
    kRotateImage                = $00000040;


    {
    --------------- Structures ---------------
        }

type
    ICAObjectInfoPtr = ^ICAObjectInfo;
    ICAObjectInfo = record
        objectType:             OSType;                                 {  i.e. kICAFile }
        objectSubtype:          OSType;                                 {  i.e. kICAFileImage   }
    end;

    ICAPropertyInfoPtr = ^ICAPropertyInfo;
    ICAPropertyInfo = record
        propertyType:           OSType;
        dataType:               OSType;
        dataSize:               UInt32;
        dataFlags:              UInt32;
    end;

    ICAMessagePtr = ^ICAMessage;
    ICAMessage = record
        messageType:            OSType;                                 {  <--  i.e. kICAMessageCameraCaptureNewImage  }
        startByte:              UInt32;                                 {  <--  }
        dataPtr:                Ptr;                                    {  <--  }
        dataSize:               UInt32;                                 {  <--  }
        dataType:               OSType;                                 {  <--  }
    end;

    ICAThumbnailPtr = ^ICAThumbnail;
    ICAThumbnail = record
        width:                  UInt32;
        height:                 UInt32;
        dataSize:               UInt32;
        data:                   SInt8;                                  {  8-bit RGB data (RGBRGBRGB...) }
    end;


const
    kICAPBVersion               = $00010000;

    {
    --------------- Completion Procs ---------------
        }
    {

       NOTE: the parameter for the completion proc (ICAHeader*) has to be casted to the appropriate type
       e.g. (ICAGetChildCountPB*), ...

    }


type
    ICAHeaderPtr = ^ICAHeader;
    ICACompletion = procedure(pb: ICAHeaderPtr);

    {
    --------------- ICAHeader ---------------
        }
    ICAHeader = record
        err:                    OSErr;                                  {  -->  }
        refcon:                 UInt32;                                 {  <--  }
    end;

    {
    --------------- Object parameter blocks ---------------
        }
    ICAGetChildCountPBPtr = ^ICAGetChildCountPB;
    ICAGetChildCountPB = record
        header:                 ICAHeader;
        objct:                  ICAObject;                              {  <--  }
        count:                  UInt32;                                 {  -->  }
    end;

    ICAGetNthChildPBPtr = ^ICAGetNthChildPB;
    ICAGetNthChildPB = record
        header:                 ICAHeader;
        parentObject:           ICAObject;                              {  <--  }
        index:                  UInt32;                                 {  <-- zero based  }
        childObject:            ICAObject;                              {  -->  }
        childInfo:              ICAObjectInfo;                          {  -->  }
    end;

    ICAGetObjectInfoPBPtr = ^ICAGetObjectInfoPB;
    ICAGetObjectInfoPB = record
        header:                 ICAHeader;
        objct:                  ICAObject;                              {  <--  }
        objectInfo:             ICAObjectInfo;                          {  -->  }
    end;

    ICAGetParentOfObjectPBPtr = ^ICAGetParentOfObjectPB;
    ICAGetParentOfObjectPB = record
        header:                 ICAHeader;
        objct:                  ICAObject;                              {  <--  }
        parentObject:           ICAObject;                              {  -->  }
        parentInfo:             ICAObjectInfo;                          {  -->  }
    end;

    ICAGetRootOfObjectPBPtr = ^ICAGetRootOfObjectPB;
    ICAGetRootOfObjectPB = record
        header:                 ICAHeader;
        objct:                  ICAObject;                              {  <--  }
        rootObject:             ICAObject;                              {  -->  }
        rootInfo:               ICAObjectInfo;                          {  -->  }
    end;

    ICAGetObjectRefConPBPtr = ^ICAGetObjectRefConPB;
    ICAGetObjectRefConPB = record
        header:                 ICAHeader;
        objct:                  ICAObject;                              {  <--  }
        objectRefCon:           UInt32;                                 {  -->  }
    end;

    ICASetObjectRefConPBPtr = ^ICASetObjectRefConPB;
    ICASetObjectRefConPB = record
        header:                 ICAHeader;
        objct:                  ICAObject;                              {  <--  }
        objectRefCon:           UInt32;                                 {  <--  }
    end;

    {
    --------------- Property parameter blocks ---------------
        }
    ICAGetPropertyCountPBPtr = ^ICAGetPropertyCountPB;
    ICAGetPropertyCountPB = record
        header:                 ICAHeader;
        objct:                  ICAObject;                              {  <--  }
        count:                  UInt32;                                 {  -->  }
    end;

    ICAGetNthPropertyPBPtr = ^ICAGetNthPropertyPB;
    ICAGetNthPropertyPB = record
        header:                 ICAHeader;
        objct:                  ICAObject;                              {  <--  }
        index:                  UInt32;                                 {  <-- zero based  }
        proprty:                ICAProperty;                            {  -->  }
        propertyInfo:           ICAPropertyInfo;                        {  -->  }
    end;

    ICAGetPropertyByTypePBPtr = ^ICAGetPropertyByTypePB;
    ICAGetPropertyByTypePB = record
        header:                 ICAHeader;
        objct:                  ICAObject;                              {  <--  }
        propertyType:           OSType;                                 {  <--  }
        proprty:                ICAProperty;                            {  -->  }
        propertyInfo:           ICAPropertyInfo;                        {  -->  }
    end;

    ICAGetPropertyInfoPBPtr = ^ICAGetPropertyInfoPB;
    ICAGetPropertyInfoPB = record
        header:                 ICAHeader;
        proprty:                ICAProperty;                            {  <--  }
        propertyInfo:           ICAPropertyInfo;                        {  -->  }
    end;

    ICAGetPropertyDataPBPtr = ^ICAGetPropertyDataPB;
    ICAGetPropertyDataPB = record
        header:                 ICAHeader;
        proprty:                ICAProperty;                            {  <--  }
        startByte:              UInt32;                                 {  <--  }
        requestedSize:          UInt32;                                 {  <--  }
        dataPtr:                Ptr;                                    {  <->  }
        actualSize:             UInt32;                                 {  -->  }
        dataType:               OSType;                                 {  -->  }
    end;

    ICASetPropertyDataPBPtr = ^ICASetPropertyDataPB;
    ICASetPropertyDataPB = record
        header:                 ICAHeader;
        proprty:                ICAProperty;                            {  <--  }
        startByte:              UInt32;                                 {  <--  }
        dataPtr:                Ptr;                                    {  <--  }
        dataSize:               UInt32;                                 {  <--  }
        dataType:               OSType;                                 {  <--  }
    end;

    ICAGetParentOfPropertyPBPtr = ^ICAGetParentOfPropertyPB;
    ICAGetParentOfPropertyPB = record
        header:                 ICAHeader;
        proprty:                ICAProperty;                            {  <--  }
        parentObject:           ICAObject;                              {  -->  }
        parentInfo:             ICAObjectInfo;                          {  -->  }
    end;

    ICAGetRootOfPropertyPBPtr = ^ICAGetRootOfPropertyPB;
    ICAGetRootOfPropertyPB = record
        header:                 ICAHeader;
        proprty:                ICAProperty;                            {  <--  }
        rootObject:             ICAObject;                              {  -->  }
        rootInfo:               ICAObjectInfo;                          {  -->  }
    end;

    ICAGetPropertyRefConPBPtr = ^ICAGetPropertyRefConPB;
    ICAGetPropertyRefConPB = record
        header:                 ICAHeader;
        proprty:                ICAProperty;                            {  <--  }
        propertyRefCon:         UInt32;                                 {  -->  }
    end;

    ICASetPropertyRefConPBPtr = ^ICASetPropertyRefConPB;
    ICASetPropertyRefConPB = record
        header:                 ICAHeader;
        proprty:                ICAProperty;                            {  <--  }
        propertyRefCon:         UInt32;                                 {  <--  }
    end;

    {
    --------------- Device parameter blocks ---------------
        }
    ICAGetDeviceListPBPtr = ^ICAGetDeviceListPB;
    ICAGetDeviceListPB = record
        header:                 ICAHeader;
        objct:                  ICAObject;                              {  -->  }
    end;

    ICAObjectSendMessagePBPtr = ^ICAObjectSendMessagePB;
    ICAObjectSendMessagePB = record
        header:                 ICAHeader;
        objct:                  ICAObject;                              {  <--  }
        message:                ICAMessage;                             {  <--  }
        result:                 UInt32;                                 {  --> message specific result }
    end;

    ICARegisterEventNotificationPBPtr = ^ICARegisterEventNotificationPB;
    ICARegisterEventNotificationPB = record
        header:                 ICAHeader;
        objct:                  ICAObject;                              {  <--  }
        notifyType:             OSType;                                 {  <--  }
        notifyProc:             ICACompletion;                          {  <--  }
    end;

    ICADownloadFilePBPtr = ^ICADownloadFilePB;
    ICADownloadFilePB = record
        header:                 ICAHeader;
        objct:                  ICAObject;                              {  <--  }
        dirFSRef:               FSRefPtr;                               {  <--  }
        flags:                  UInt32;                                 {  <--  }
        fileType:               OSType;                                 {  <--  }
        fileCreator:            OSType;                                 {  <--  }
        rotationAngle:          Fixed;                                  {  <--  }
        fileFSRef:              FSRefPtr;                               {  --> can be NULL }
    end;

    ICACopyObjectPropertyDictionaryPBPtr = ^ICACopyObjectPropertyDictionaryPB;
    ICACopyObjectPropertyDictionaryPB = record
        header:                 ICAHeader;
        objct:                  ICAObject;                              {  <--  }
        theDict:                ^CFDictionaryRef;                       {  -->  }
    end;

    {

       NOTE: for all APIs - pass NULL as completion parameter to make a synchronous call

    }
    {
    --------------- Object functions ---------------
        }

    {
     *  ICAGetChildCount()
     *
     *  Availability:
     *    Non-Carbon CFM:   in ImageCaptureLib 1.0 and later
     *    CarbonLib:        in CarbonLib 1.1 and later
     *    Mac OS X:         in version 10.0 and later
        }
function ICAGetChildCount(var pb: ICAGetChildCountPB; completion: ICACompletion): OSErr; external name '_ICAGetChildCount';

{
 *  ICAGetNthChild()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ImageCaptureLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ICAGetNthChild(var pb: ICAGetNthChildPB; completion: ICACompletion): OSErr; external name '_ICAGetNthChild';

{
 *  ICAGetObjectInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ImageCaptureLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ICAGetObjectInfo(var pb: ICAGetObjectInfoPB; completion: ICACompletion): OSErr; external name '_ICAGetObjectInfo';

{
 *  ICAGetParentOfObject()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ImageCaptureLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ICAGetParentOfObject(var pb: ICAGetParentOfObjectPB; completion: ICACompletion): OSErr; external name '_ICAGetParentOfObject';

{
 *  ICAGetRootOfObject()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ImageCaptureLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ICAGetRootOfObject(var pb: ICAGetRootOfObjectPB; completion: ICACompletion): OSErr; external name '_ICAGetRootOfObject';

{
 *  ICAGetObjectRefCon()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ImageCaptureLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ICAGetObjectRefCon(var pb: ICAGetObjectRefConPB; completion: ICACompletion): OSErr; external name '_ICAGetObjectRefCon';

{
 *  ICASetObjectRefCon()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ImageCaptureLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ICASetObjectRefCon(var pb: ICASetObjectRefConPB; completion: ICACompletion): OSErr; external name '_ICASetObjectRefCon';


{
--------------- Property functions ---------------
}
{
 *  ICAGetPropertyCount()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ImageCaptureLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ICAGetPropertyCount(var pb: ICAGetPropertyCountPB; completion: ICACompletion): OSErr; external name '_ICAGetPropertyCount';

{
 *  ICAGetNthProperty()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ImageCaptureLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ICAGetNthProperty(var pb: ICAGetNthPropertyPB; completion: ICACompletion): OSErr; external name '_ICAGetNthProperty';

{
 *  ICAGetPropertyByType()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ImageCaptureLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ICAGetPropertyByType(var pb: ICAGetPropertyByTypePB; completion: ICACompletion): OSErr; external name '_ICAGetPropertyByType';

{
 *  ICAGetPropertyInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ImageCaptureLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ICAGetPropertyInfo(var pb: ICAGetPropertyInfoPB; completion: ICACompletion): OSErr; external name '_ICAGetPropertyInfo';

{
 *  ICAGetPropertyData()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ImageCaptureLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ICAGetPropertyData(var pb: ICAGetPropertyDataPB; completion: ICACompletion): OSErr; external name '_ICAGetPropertyData';

{
 *  ICASetPropertyData()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ImageCaptureLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ICASetPropertyData(var pb: ICASetPropertyDataPB; completion: ICACompletion): OSErr; external name '_ICASetPropertyData';

{
 *  ICAGetParentOfProperty()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ImageCaptureLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ICAGetParentOfProperty(var pb: ICAGetParentOfPropertyPB; completion: ICACompletion): OSErr; external name '_ICAGetParentOfProperty';

{
 *  ICAGetRootOfProperty()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ImageCaptureLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ICAGetRootOfProperty(var pb: ICAGetRootOfPropertyPB; completion: ICACompletion): OSErr; external name '_ICAGetRootOfProperty';

{
 *  ICAGetPropertyRefCon()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ImageCaptureLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ICAGetPropertyRefCon(var pb: ICAGetPropertyRefConPB; completion: ICACompletion): OSErr; external name '_ICAGetPropertyRefCon';

{
 *  ICASetPropertyRefCon()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ImageCaptureLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ICASetPropertyRefCon(var pb: ICASetPropertyRefConPB; completion: ICACompletion): OSErr; external name '_ICASetPropertyRefCon';


{
--------------- Device functions ---------------
}
{
 *  ICAGetDeviceList()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ImageCaptureLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ICAGetDeviceList(var pb: ICAGetDeviceListPB; completion: ICACompletion): OSErr; external name '_ICAGetDeviceList';

{
 *  ICAObjectSendMessage()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ImageCaptureLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ICAObjectSendMessage(var pb: ICAObjectSendMessagePB; completion: ICACompletion): OSErr; external name '_ICAObjectSendMessage';

{
 *  ICARegisterEventNotification()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ImageCaptureLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ICARegisterEventNotification(var pb: ICARegisterEventNotificationPB; completion: ICACompletion): OSErr; external name '_ICARegisterEventNotification';



{
------------------------------------------------
}
{
 *  ICADownloadFile()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ImageCaptureLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.4 and later
 *    Mac OS X:         in version 10.1 and later
 }
function ICADownloadFile(var pb: ICADownloadFilePB; completion: ICACompletion): OSErr; external name '_ICADownloadFile';


{
 *  ICACopyObjectPropertyDictionary()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ImageCaptureLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.4 and later
 *    Mac OS X:         in version 10.1 and later
 }
function ICACopyObjectPropertyDictionary(var pb: ICACopyObjectPropertyDictionaryPB; completion: ICACompletion): OSErr; external name '_ICACopyObjectPropertyDictionary';

{$ALIGN MAC68K}
{#POP}
{unit ICADevice}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}

{
--------------- Completion Procs ---------------
}
{

   NOTE: the parameter for the completion proc (ICDHeader*) has to be casted to the appropriate type
   e.g. (ICD_BuildObjectChildrenPB*), ...

}

type
    ICDHeaderPtr = ^ICDHeader;
    ICDCompletion = procedure(pb: ICDHeaderPtr);

    {
    --------------- ICDHeader ---------------
        }
    ICDHeader = record
        err:                    OSErr;                                  {  -->  }
        refcon:                 UInt32;                                 {  <--  }
    end;

    {
    --------------- Object parameter blocks ---------------
        }
    ICD_NewObjectPBPtr = ^ICD_NewObjectPB;
    ICD_NewObjectPB = record
        header:                 ICDHeader;
        parentObject:           ICAObject;                              {  <--  }
        objectInfo:             ICAObjectInfo;                          {  <--  }
        objct:                  ICAObject;                              {  -->  }
    end;

    ICD_DisposeObjectPBPtr = ^ICD_DisposeObjectPB;
    ICD_DisposeObjectPB = record
        header:                 ICDHeader;
        objct:                  ICAObject;                              {  <--  }
    end;

    {
    --------------- Property parameter blocks ---------------
        }
    ICD_NewPropertyPBPtr = ^ICD_NewPropertyPB;
    ICD_NewPropertyPB = record
        header:                 ICDHeader;
        objct:                  ICAObject;                              {  <--  }
        propertyInfo:           ICAPropertyInfo;                        {  <--  }
        proprty:                ICAProperty;                            {  -->  }
    end;

    ICD_DisposePropertyPBPtr = ^ICD_DisposePropertyPB;
    ICD_DisposePropertyPB = record
        header:                 ICDHeader;
        proprty:                ICAProperty;                            {  <--  }
    end;

    {

       NOTE: for all APIs - pass NULL as completion parameter to make a synchronous call

    }

    {
    --------------- Object utilities for device libraries ---------------
        }
    {
     *  ICDNewObject()
     *
     *  Availability:
     *    Non-Carbon CFM:   in ImageCaptureLib 1.0 and later
     *    CarbonLib:        in CarbonLib 1.1 and later
     *    Mac OS X:         in version 10.0 and later
        }
function ICDNewObject(var pb: ICD_NewObjectPB; completion: ICDCompletion): OSErr; external name '_ICDNewObject';

{
 *  ICDDisposeObject()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ImageCaptureLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ICDDisposeObject(var pb: ICD_DisposeObjectPB; completion: ICDCompletion): OSErr; external name '_ICDDisposeObject';

{
 *  ICDNewProperty()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ImageCaptureLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ICDNewProperty(var pb: ICD_NewPropertyPB; completion: ICDCompletion): OSErr; external name '_ICDNewProperty';

{
 *  ICDDisposeProperty()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ImageCaptureLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ICDDisposeProperty(var pb: ICD_DisposePropertyPB; completion: ICDCompletion): OSErr; external name '_ICDDisposeProperty';





{$ALIGN MAC68K}
{#POP}
{unit Notification}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}


type
    NMRecPtr = ^NMRec;
    NMProcPtr = procedure(nmReqPtr: NMRecPtr);

    NMUPP = ^SInt32; { an opaque UPP }
    NMRec = record
        qLink:                  QElemPtr;                               {  next queue entry }
        qType:                  SInt16;                             {  queue type -- ORD(nmType) = 8 }
        nmFlags:                SInt16;                             {  reserved }
        nmPrivate:              SInt32;                             {  reserved }
        nmReserved:             SInt16;                             {  reserved }
        nmMark:                 SInt16;                             {  item to mark in Apple menu }
        nmIcon:                 Handle;                                 {  handle to small icon }
        nmSound:                Handle;                                 {  handle to sound record }
        nmStr:                  StringPtr;                              {  string to appear in alert }
        nmResp:                 NMUPP;                                  {  pointer to response routine }
        nmRefCon:               SInt32;                             {  for application use }
    end;


const
    uppNMProcInfo = $000000C0;
    {
     *  NewNMUPP()
     *
     *  Availability:
     *    Non-Carbon CFM:   available as macro/inline
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function NewNMUPP(userRoutine: NMProcPtr): NMUPP; external name '_NewNMUPP'; { old name was NewNMProc }
{
 *  DisposeNMUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeNMUPP(userUPP: NMUPP); external name '_DisposeNMUPP';
{
 *  InvokeNMUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvokeNMUPP(nmReqPtr: NMRecPtr; userRoutine: NMUPP); external name '_InvokeNMUPP'; { old name was CallNMProc }
{
 *  NMInstall()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NMInstall(nmReqPtr: NMRecPtr): OSErr; external name '_NMInstall';
{
 *  NMRemove()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NMRemove(nmReqPtr: NMRecPtr): OSErr; external name '_NMRemove';
{$ALIGN MAC68K}
{#POP}
{unit Resources}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}



const
    resSysHeap                  = 64;                           { System or application heap? }
    resPurgeable                = 32;                           { Purgeable resource? }
    resLocked                   = 16;                           { Load it in locked? }
    resProtected                = 8;                            { Protected? }
    resPreload                  = 4;                            { Load in on OpenResFile? }
    resChanged                  = 2;                            { Resource changed? }
    mapReadOnly                 = 128;                          { Resource file read-only }
    mapCompact                  = 64;                           { Compact resource file }
    mapChanged                  = 32;                           { Write map out at update }

    resSysRefBit                = 7;                            { reference to system/local reference }
    resSysHeapBit               = 6;                            { In system/in application heap }
    resPurgeableBit             = 5;                            { Purgeable/not purgeable }
    resLockedBit                = 4;                            { Locked/not locked }
    resProtectedBit             = 3;                            { Protected/not protected }
    resPreloadBit               = 2;                            { Read in at OpenResource? }
    resChangedBit               = 1;                            { Existing resource changed since last update }
    mapReadOnlyBit              = 7;                            { is this file read-only? }
    mapCompactBit               = 6;                            { Is a compact necessary? }
    mapChangedBit               = 5;                            { Is it necessary to write map? }

    kResFileNotOpened           = -1;                           { ref num return as error when opening a resource file }
    kSystemResFile              = 0;                            { this is the default ref num to the system file }



type
    ResErrProcPtr = procedure(thErr: OSErr);

    ResErrUPP = ^SInt32; { an opaque UPP }

const
    uppResErrProcInfo = $00001002;
    {
     *  NewResErrUPP()
     *
     *  Availability:
     *    Non-Carbon CFM:   available as macro/inline
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function NewResErrUPP(userRoutine: ResErrProcPtr): ResErrUPP; external name '_NewResErrUPP'; { old name was NewResErrProc }
{
 *  DisposeResErrUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeResErrUPP(userUPP: ResErrUPP); external name '_DisposeResErrUPP';
{
 *  InvokeResErrUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvokeResErrUPP(thErr: OSErr; userRoutine: ResErrUPP); external name '_InvokeResErrUPP'; { old name was CallResErrProc }
{  QuickTime 3.0 }

type
    ResourceEndianFilterPtr = function(theResource: Handle; currentlyNativeEndian: boolean): OSErr;


{
 *  CloseResFile()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CloseResFile(refNum: SInt16); external name '_CloseResFile';
{
 *  ResError()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ResError: OSErr; external name '_ResError';
{
 *  CurResFile()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CurResFile: SInt16; external name '_CurResFile';
{
 *  HomeResFile()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function HomeResFile(theResource: Handle): SInt16; external name '_HomeResFile';

{
 *  UseResFile()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure UseResFile(refNum: SInt16); external name '_UseResFile';
{
 *  CountTypes()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CountTypes: SInt16; external name '_CountTypes';
{
 *  Count1Types()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function Count1Types: SInt16; external name '_Count1Types';
{
 *  GetIndType()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure GetIndType(var theType: ResType; index: SInt16); external name '_GetIndType';
{
 *  Get1IndType()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure Get1IndType(var theType: ResType; index: SInt16); external name '_Get1IndType';
{
 *  SetResLoad()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetResLoad(load: boolean); external name '_SetResLoad';
{
 *  CountResources()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CountResources(theType: ResType): SInt16; external name '_CountResources';
{
 *  Count1Resources()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function Count1Resources(theType: ResType): SInt16; external name '_Count1Resources';
{
 *  GetIndResource()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetIndResource(theType: ResType; index: SInt16): Handle; external name '_GetIndResource';
{
 *  Get1IndResource()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function Get1IndResource(theType: ResType; index: SInt16): Handle; external name '_Get1IndResource';
{
 *  GetResource()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetResource(theType: ResType; theID: SInt16): Handle; external name '_GetResource';
{
 *  Get1Resource()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function Get1Resource(theType: ResType; theID: SInt16): Handle; external name '_Get1Resource';
{
 *  GetNamedResource()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetNamedResource(theType: ResType; const (*var*) name: Str255): Handle; external name '_GetNamedResource';
{
 *  Get1NamedResource()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function Get1NamedResource(theType: ResType; const (*var*) name: Str255): Handle; external name '_Get1NamedResource';
{
 *  [Mac]LoadResource()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure LoadResource(theResource: Handle); external name '_LoadResource';
{
 *  ReleaseResource()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure ReleaseResource(theResource: Handle); external name '_ReleaseResource';
{
 *  DetachResource()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DetachResource(theResource: Handle); external name '_DetachResource';
{
 *  UniqueID()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function UniqueID(theType: ResType): SInt16; external name '_UniqueID';
{
 *  Unique1ID()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function Unique1ID(theType: ResType): SInt16; external name '_Unique1ID';
{
 *  GetResAttrs()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetResAttrs(theResource: Handle): SInt16; external name '_GetResAttrs';
{
 *  GetResInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure GetResInfo(theResource: Handle; var theID: SInt16; var theType: ResType; var name: Str255); external name '_GetResInfo';
{
 *  SetResInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetResInfo(theResource: Handle; theID: SInt16; const (*var*) name: Str255); external name '_SetResInfo';
{
 *  AddResource()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure AddResource(theData: Handle; theType: ResType; theID: SInt16; const (*var*) name: Str255); external name '_AddResource';
{
 *  GetResourceSizeOnDisk()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetResourceSizeOnDisk(theResource: Handle): SInt32; external name '_GetResourceSizeOnDisk';
{
 *  GetMaxResourceSize()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetMaxResourceSize(theResource: Handle): SInt32; external name '_GetMaxResourceSize';

{
 *  SetResAttrs()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetResAttrs(theResource: Handle; attrs: SInt16); external name '_SetResAttrs';
{
 *  ChangedResource()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure ChangedResource(theResource: Handle); external name '_ChangedResource';
{
 *  RemoveResource()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure RemoveResource(theResource: Handle); external name '_RemoveResource';
{
 *  UpdateResFile()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure UpdateResFile(refNum: SInt16); external name '_UpdateResFile';
{
 *  WriteResource()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure WriteResource(theResource: Handle); external name '_WriteResource';
{
 *  SetResPurge()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetResPurge(install: boolean); external name '_SetResPurge';
{
 *  GetResFileAttrs()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetResFileAttrs(refNum: SInt16): SInt16; external name '_GetResFileAttrs';
{
 *  SetResFileAttrs()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetResFileAttrs(refNum: SInt16; attrs: SInt16); external name '_SetResFileAttrs';
{
 *  OpenRFPerm()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OpenRFPerm(const (*var*) fileName: Str255; vRefNum: SInt16; permission: SInt8): SInt16; external name '_OpenRFPerm';

{
 *  HOpenResFile()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function HOpenResFile(vRefNum: SInt16; dirID: SInt32; const (*var*) fileName: Str255; permission: SInt8): SInt16; external name '_HOpenResFile';
{
 *  HCreateResFile()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure HCreateResFile(vRefNum: SInt16; dirID: SInt32; const (*var*) fileName: Str255); external name '_HCreateResFile';
{
 *  FSpOpenResFile()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FSpOpenResFile(const (*var*) spec: FSSpec; permission: SignedByte): SInt16; external name '_FSpOpenResFile';
{
 *  FSpCreateResFile()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure FSpCreateResFile(const (*var*) spec: FSSpec; creator: OSType; fileType: OSType; scriptTag: ScriptCode); external name '_FSpCreateResFile';
{
 *  ReadPartialResource()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure ReadPartialResource(theResource: Handle; offset: SInt32; buffer: UnivPtr; count: SInt32); external name '_ReadPartialResource';
{
 *  WritePartialResource()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure WritePartialResource(theResource: Handle; offset: SInt32; buffer: UnivPtr; count: SInt32); external name '_WritePartialResource';
{
 *  SetResourceSize()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetResourceSize(theResource: Handle; newSize: SInt32); external name '_SetResourceSize';
{
 *  GetNextFOND()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetNextFOND(fondHandle: Handle): Handle; external name '_GetNextFOND';
{  QuickTime 3.0 }


type
    RsrcChainLocation                   = SInt16;

const
    kRsrcChainBelowSystemMap    = 0;                            {  Below the system's resource map }
    kRsrcChainBelowApplicationMap = 1;                          {  Below the application's resource map }
    kRsrcChainAboveApplicationMap = 2;                          {  Above the application's resource map }
    kRsrcChainAboveAllMaps      = 4;                            {  Above all resource maps }

    {
       If the file is already in the resource chain, it is removed and re-inserted at the specified location
       If the file has been detached, it is added to the resource chain at the specified location
       Returns resFNotFound if it's not currently open.
    }
    {
     *  InsertResourceFile()
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function InsertResourceFile(refNum: SInt16; where: RsrcChainLocation): OSErr; external name '_InsertResourceFile';

{
   If the file is not currently in the resource chain, this returns resNotFound
   Otherwise, the resource file is removed from the resource chain.
}
{
 *  DetachResourceFile()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DetachResourceFile(refNum: SInt16): OSErr; external name '_DetachResourceFile';

{
   Returns true if the resource file is already open and known by the Resource Manager (i.e., it is
   either in the current resource chain or it's a detached resource file.)  If it's in the resource
   chain, the inChain Boolean is set to true on exit and true is returned.  If it's an open file, but
   the file is currently detached, inChain is set to false and true is returned.  If the file is open,
   the refNum to the file is returned.
}
{
 *  FSpResourceFileAlreadyOpen()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FSpResourceFileAlreadyOpen(const (*var*) resourceFile: FSSpec; var inChain: boolean; var refNum: SInt16): boolean; external name '_FSpResourceFileAlreadyOpen';
{
   FSpOpenOrphanResFile should be used to open a resource file that is persistent across all contexts,
   because using OpenResFile normally loads a map and all preloaded resources into the application
   context.  FSpOpenOrphanResFile loads everything into the system context and detaches the file
   from the context in which it was opened.  If the file is already in the resource chain and a new
   instance is not opened, FSpOpenOrphanResFile will return a paramErr.
   Use with care, as can and will fail if the map is very large or a lot of preload
   resources exist.
}
{
 *  FSpOpenOrphanResFile()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FSpOpenOrphanResFile(const (*var*) spec: FSSpec; permission: SignedByte; var refNum: SInt16): OSErr; external name '_FSpOpenOrphanResFile';

{
   GetTopResourceFile returns the refNum of the top most resource map in the current resource chain. If
   the resource chain is empty it returns resFNotFound.
}
{
 *  GetTopResourceFile()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetTopResourceFile(var refNum: SInt16): OSErr; external name '_GetTopResourceFile';

{
   GetNextResourceFile can be used to iterate over resource files in the resource chain. By passing a
   valid refNum in curRefNum it will return in nextRefNum the refNum of the next file in
   the chain. If curRefNum is not found in the resource chain, GetNextResourceFile returns resFNotFound.
   When the end of the chain is reached GetNextResourceFile will return noErr and nextRefNum will be NIL.
}
{
 *  GetNextResourceFile()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetNextResourceFile(curRefNum: SInt16; var nextRefNum: SInt16): OSErr; external name '_GetNextResourceFile';



{
 *  FSOpenResFile()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.1 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FSOpenResFile(const (*var*) ref: FSRef; permission: SInt8): SInt16; external name '_FSOpenResFile';
{
 *  FSCreateResFile()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.1 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure FSCreateResFile(const (*var*) parentRef: FSRef; nameLength: UniCharCount; name: UniCharPtr; whichInfo: FSCatalogInfoBitmap; const (*var*) catalogInfo: FSCatalogInfo; newRef: FSRefPtr; newSpec: FSSpecPtr); external name '_FSCreateResFile';
{
 *  FSResourceFileAlreadyOpen()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.1 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FSResourceFileAlreadyOpen(const (*var*) resourceFileRef: FSRef; var inChain: boolean; var refNum: SInt16): boolean; external name '_FSResourceFileAlreadyOpen';
{
 *  FSCreateResourceFile()
 *
 *  Summary:
 *    Creates a new resource file.
 *
 *  Discussion:
 *    This function creates a new file and initializes the specified
 *    named fork as an empty resource fork.  This function allows for
 *    the creation of data fork only files which can be used for
 *    storing resources.  Passing in a null name defaults to using the
 *    data fork.
 *
 *  Parameters:
 *
 *    parentRef:
 *      The directory where the file is to be created
 *
 *    nameLength:
 *      Number of Unicode characters in the file's name
 *
 *    name:
 *      A pointer to the Unicode name
 *
 *    whichInfo:
 *      Which catalog info fields to set
 *
 *    catalogInfo:
 *      The values for catalog info fields to set; may be NULL
 *
 *    forkNameLength:
 *      The length of the fork name (in Unicode characters)
 *
 *    forkName:
 *      The name of the fork to initialize (in Unicode); may be NULL
 *
 *    newRef:
 *      A pointer to the FSRef for the new file; may be NULL
 *
 *    newSpec:
 *      A pointer to the FSSpec for the new directory; may be NULL
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FSCreateResourceFile(const (*var*) parentRef: FSRef; nameLength: UniCharCount; name: UniCharPtr; whichInfo: FSCatalogInfoBitmap; catalogInfo: {Const}FSCatalogInfoPtr; forkNameLength: UniCharCount; forkName: UniCharPtr; newRef: FSRefPtr; newSpec: FSSpecPtr): OSErr; external name '_FSCreateResourceFile';

{
 *  FSOpenResourceFile()
 *
 *  Summary:
 *    Opens the specified named fork as a resource fork.
 *
 *  Discussion:
 *    This function allows any named fork of a file to be used for
 *    storing resources.  Passing in a null forkname will result in the
 *    data fork being used.
 *
 *  Parameters:
 *
 *    ref:
 *      The file containing the fork to open
 *
 *    forkNameLength:
 *      The length of the fork name (in Unicode characters)
 *
 *    forkName:
 *      The name of the fork to open (in Unicode); may be NULL
 *
 *    permissions:
 *      The access (read and/or write) you want
 *
 *    refNum:
 *      On exit the reference number for accessing the open fork
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FSOpenResourceFile(const (*var*) ref: FSRef; forkNameLength: UniCharCount; forkName: UniCharPtr; permissions: SInt8; var refNum: SInt16): OSErr; external name '_FSOpenResourceFile';

{
    These typedefs were originally created for the Copland Resource Mangager
}

type
    ResFileRefNum                       = SInt16;
    ResID                               = SInt16;
    ResAttributes                       = SInt16;
    ResFileAttributes                   = SInt16;


{$ALIGN MAC68K}
{#POP}
{unit SCDynamicStore}
{$ALIGN MAC68K}






{!
    @header SCDynamicStore
    The SystemConfiguration framework provides access to the
    data used to configure a running system.  The APIs provided
    by this framework communicate with the "configd" daemon.

    The "configd" daemon manages a "dynamic store" reflecting the
    desired configuration settings as well as the current state
    of the system.  The daemon provides a notification mechanism
    for user-level processes that need to be aware of changes
    made to the data.  Lastly, the daemon loads a number of
    bundles (or plug-ins) that monitor low-level kernel events
    and, via a set of policy modules, keep the state data up
    to date.
 }


{!
    @typedef SCDynamicStoreRef
    @discussion This is the handle to an open "dynamic store" session
        with the system configuration daemon.
 }
type
    SCDynamicStoreRef            = ^SInt32; { an opaque 32-bit type }

{!
    @typedef SCDynamicStoreContext
 }
type
    SCDynamicStoreContext = record
        version: CFIndex;
        info: Ptr;
        retain: function( info: Ptr ): Ptr;
        release: procedure( info: Ptr );
        copyDescription: function( info: Ptr ): CFStringRef;
    end;
    SCDynamicStoreContextPtr = ^SCDynamicStoreContext;

{!
    @typedef SCDynamicStoreCallBack
    @discussion Type of the callback function used when a
        dynamic store change is delivered.
    @param store The "dynamic store" session.
    @param changedKeys The list of changed keys.
    @param info ....
 }
type SCDynamicStoreCallBack = procedure( store: SCDynamicStoreRef; changedKeys: CFArrayRef; info: Ptr );

{!
    @function SCDynamicStoreGetTypeID
    Returns the type identifier of all SCDynamicStore instances.
 }
function SCDynamicStoreGetTypeID: CFTypeID; external name '_SCDynamicStoreGetTypeID';


{!
    @function SCDynamicStoreCreate
    @discussion Creates a new session used to interact with the dynamic
        store maintained by the SystemConfiguration server.
    @param allocator The CFAllocator which should be used to allocate
        memory for the local "dynamic store" and its storage for
        values.
        This parameter may be NULL in which case the current
        default CFAllocator is used. If this reference is not
        a valid CFAllocator, the behavior is undefined.
    @param name A string that describes the name of the calling
        process or plug-in of the caller.
    @param callout The function to be called when a watched value
        in the "dynamic store" is changed.
        A NULL value can be specified if no callouts are
        desired.
    @param context The SCDynamicStoreContext associated with the callout.
    @result A reference to the new SCDynamicStore.
 }
function SCDynamicStoreCreate( allocator: CFAllocatorRef; name: CFStringRef; callout: SCDynamicStoreCallBack; var context: SCDynamicStoreContext ): SCDynamicStoreRef; external name '_SCDynamicStoreCreate';

{!
    @function SCDynamicStoreCreateRunLoopSource
    @discussion Creates a new session used to interact with the dynamic
        store maintained by the SystemConfiguration server.
    @param allocator The CFAllocator which should be used to allocate
        memory for the local "dynamic store" and its storage for
        values.
        This parameter may be NULL in which case the current
        default CFAllocator is used. If this reference is not
        a valid CFAllocator, the behavior is undefined.
    @param store The "dynamic store" session.
    @param order On platforms which support it, this parameter
        determines the order in which the sources which are
        ready to be processed are handled.  A lower order
        number causes processing before higher order number
        sources. It is inadvisable to depend on the order
        number for any architectural or design aspect of
        code. In the absence of any reason to do otherwise,
        zero should be used.
    @result A reference to the new CFRunLoopSource.
        You must release the returned value.

 }
function SCDynamicStoreCreateRunLoopSource( allocator: CFAllocatorRef; store: SCDynamicStoreRef; order: CFIndex ): CFRunLoopSourceRef; external name '_SCDynamicStoreCreateRunLoopSource';

{!
    @function SCDynamicStoreCopyKeyList
    @discussion Returns an array of CFString keys representing the
        configuration "dynamic store" entries that match a
        specified pattern.
    @param store The "dynamic store" session.
    @param pattern A regex(3) regular expression pattern that
        will be used to match the "dynamic store" keys.
    @result The list of matching keys.
        You must release the returned value.
        A NULL value will be returned if the list could not be obtained.
 }
function SCDynamicStoreCopyKeyList( store: SCDynamicStoreRef; pattern: CFStringRef ): CFArrayRef; external name '_SCDynamicStoreCopyKeyList';

{!
    @function SCDynamicStoreAddValue
    @discussion Adds the key-value pair to the "dynamic store" if no
        such key already exists.
    @param store The "dynamic store" session.
    @param key The key of the value to add to the "dynamic store".
    @param value The value to add to the "dynamic store".
    @result TRUE if the key was added; FALSE if the key was already
        present in the "dynamic store" or if an error was encountered.
 }
function SCDynamicStoreAddValue( store: SCDynamicStoreRef; key: CFStringRef; value: CFPropertyListRef ): Boolean; external name '_SCDynamicStoreAddValue';

{!
    @function SCDynamicStoreAddTemporaryValue
    @discussion Adds the key-value pair on a temporary basis to the
        "dynamic store" if no such key already exists.  This entry
        will, unless updated by another session, automatically be
        removed when the session is closed.
    @param store The "dynamic store" session.
    @param key The key of the value to add to the "dynamic store".
    @param value The value to add to the "dynamic store".
    @result TRUE if the key was added; FALSE if the key was already
        present in the "dynamic store" or if an error was encountered.
 }
function SCDynamicStoreAddTemporaryValue( store: SCDynamicStoreRef; key: CFStringRef; value: CFPropertyListRef ): Boolean; external name '_SCDynamicStoreAddTemporaryValue';

{!
    @function SCDynamicStoreCopyValue
    @discussion Obtains a value from the "dynamic store" for the
        specified key.
    @param store The "dynamic store" session.
    @param key The key you wish to obtain.
    @result The value from the store that is associated with the
        given key.  The value is returned as a Core Foundation
        Property List data type.
        You must release the returned value.
        If no value was located, NULL is returned.
 }
function SCDynamicStoreCopyValue( store: SCDynamicStoreRef; key: CFStringRef ): CFPropertyListRef; external name '_SCDynamicStoreCopyValue';

{!
    @function SCDynamicStoreCopyMultiple
    @discussion Fetches multiple values in the "dynamic store".
    @param store The "dynamic store" session.
    @param keys The keys to be fetched; NULL if no specific keys
        are requested.
    @param patterns The regex(3) pattern strings to be fetched; NULL
        if no key patterns are requested.
    @result A dictionary containing the specific keys which were found
        in the "dynamic store" and any keys which matched the specified
        patterns; NULL is returned if an error was encountered.
        You must release the returned value.
 }
function SCDynamicStoreCopyMultiple( store: SCDynamicStoreRef; keys: CFArrayRef; patterns: CFArrayRef ): CFDictionaryRef; external name '_SCDynamicStoreCopyMultiple';

{!
    @function SCDynamicStoreSetValue
    @discussion Adds or replaces a value in the "dynamic store" for
        the specified key.
    @param store The "dynamic store" session.
    @param key The key you wish to set.
    @param value The value to add to or replace in the "dynamic store".
    @result TRUE if the key was updated; FALSE if an error was encountered.
 }
function SCDynamicStoreSetValue( store: SCDynamicStoreRef; key: CFStringRef; value: CFPropertyListRef ): Boolean; external name '_SCDynamicStoreSetValue';

{!
    @function SCDynamicStoreSetMultiple
    @discussion Updates multiple values in the "dynamic store".
    @param store The "dynamic store" session.
    @param keysToSet Key/value pairs you wish to set into the "dynamic store".
    @param keysToRemove A list of keys you wish to remove from the "dynamic store".
    @param keysToNotify A list of keys to flag as changed (without actually changing the data).
    @result TRUE if the dynamic store updates were successful; FALSE if an error was encountered.
 }
function SCDynamicStoreSetMultiple( store: SCDynamicStoreRef; keysToSet: CFDictionaryRef; keysToRemove: CFArrayRef; keysToNotify: CFArrayRef ): Boolean; external name '_SCDynamicStoreSetMultiple';

{!
    @function SCDynamicStoreRemoveValue
    @discussion Removes the value of the specified key from the
        "dynamic store".
    @param store The "dynamic store" session.
    @param key The key of the value you wish to remove.
    @result TRUE if the key was removed; FALSE if no value was
        located or an error was encountered.
 }
function SCDynamicStoreRemoveValue( store: SCDynamicStoreRef; key: CFStringRef ): Boolean; external name '_SCDynamicStoreRemoveValue';

{!
    @function SCDynamicStoreNotifyValue
    @discussion Triggers a notification to be delivered for the
        specified key in the dynamic store.
    @param store The "dynamic store" session.
    @param key The key which should be flagged as changed (without actually changing the data).
    @result TRUE if the value was updated; FALSE if an error was encountered.
 }
function SCDynamicStoreNotifyValue( store: SCDynamicStoreRef; key: CFStringRef ): Boolean; external name '_SCDynamicStoreNotifyValue';

{!
    @function SCDynamicStoreSetNotificationKeys
    @discussion Specifies a set of specific keys and key patterns
        which should be monitored for changes.
    @param store The "dynamic store" session being watched.
    @param keys The keys to be monitored; NULL if no specific keys
        are to be monitored.
    @param patterns The regex(3) pattern strings to be monitored; NULL
        if no key patterns are to be monitored.
    @result TRUE if the monitored keys were set; FALSE if an error
        was encountered.
 }
function SCDynamicStoreSetNotificationKeys( store: SCDynamicStoreRef; keys: CFArrayRef; patterns: CFArrayRef ): Boolean; external name '_SCDynamicStoreSetNotificationKeys';

{!
    @function SCDynamicStoreCopyNotifiedKeys
    @discussion Returns an array of CFString keys representing the
        "dynamic store" entries that have changed since this
        function was last called.
    @param store The "dynamic store" session.
    @result The list of changed keys.
        You must release the returned value.
        A NULL value will be returned if the list could not be obtained.
 }
function SCDynamicStoreCopyNotifiedKeys( store: SCDynamicStoreRef ): CFArrayRef; external name '_SCDynamicStoreCopyNotifiedKeys';
{unit SCDynamicStoreCopyDHCPInfos}
{$ALIGN MAC68K}






{!
    @header SCDynamicStoreCopyDHCPInfo.h
    The following APIs allow an application to retrieve DHCP/BOOTP
    information, in particular DHCP/BOOTP options.
 }

{!
    @function SCDynamicStoreCopyDHCPInfo
    @discussion Copies the DHCP/BOOTP information dictionary for the
        requested serviceID, or the primary service if
        serviceID == NULL.
    @param store An SCDynamicStoreRef that should be used for communication
        with the server.
        If NULL, a temporary session will be used.
    @param serviceID A CFStringRef containing the requested service.
        If NULL, returns information for the primary service.
    @result A dictionary containing DHCP/BOOTP information if successful,
        NULL otherwise.
        Use the DHCPInfoGetOption() to retrieve
        individual options from the returned dictionary.

        A non-NULL return value must be released using CFRelease().
 }
function SCDynamicStoreCopyDHCPInfo( store: SCDynamicStoreRef; serviceID: CFStringRef ): CFDictionaryRef; external name '_SCDynamicStoreCopyDHCPInfo';

{!
    @function DHCPInfoGetOptionData
    @discussion Returns a non-NULL CFDataRef containing the BOOTP/DHCP
        option data if present, NULL otherwise.
    @param info The non-NULL DHCP information dictionary returned by
        calling SCDynamicStoreCopyDHCPInfo.
    @param code The DHCP/BOOTP option code (see RFC 2132) to return
        data for.
    @result A non-NULL CFDataRef containing the option data,
        NULL otherwise.

        The return value must NOT be released.
 }
function DHCPInfoGetOptionData( info: CFDictionaryRef; code: UInt8 ): CFDataRef; external name '_DHCPInfoGetOptionData';

{!
    @function DHCPInfoGetLeaseStartTime
    @discussion Returns a CFDateRef corresponding to the lease start time,
        if present, NULL otherwise.  A NULL return value is returned
        if the configuration method is BOOTP.
    @param info The non-NULL DHCP information dictionary returned by
        calling SCDynamicStoreCopyDHCPInfo.
    @result A non-NULL CFDateRef if present, NULL otherwise.

        The return value must NOT be released.
 }
function DHCPInfoGetLeaseStartTime( info: CFDictionaryRef ): CFDateRef; external name '_DHCPInfoGetLeaseStartTime';
{unit SCDynamicStoreCopySpecific}
{$ALIGN MAC68K}






{!
    @header SCDynamicStoreCopySpecific
    The following APIs allow an application to determine specific
    configuration information about the current system (e.g. the
    computer/sharing name, the currently logged in user, etc).
 }

{!
    @function SCDynamicStoreCopyComputerName
    @discussion Gets the current computer/host name.
    @param store An SCDynamicStoreRef that should be used for communication
        with the server.
        If NULL, a temporary session will be used.
    @param nameEncoding A pointer to memory that, if non-NULL, will be
        filled with the encoding associated with the computer/host name.
    @result The current computer/host name;
        NULL if the name has not been set or if an error was encountered.
        You must release the returned value.
 }
function SCDynamicStoreCopyComputerName( store: SCDynamicStoreRef; nameEncoding: CFStringEncodingPtr ): CFStringRef; external name '_SCDynamicStoreCopyComputerName';

{!
    @function SCDynamicStoreCopyConsoleUser
    @discussion Gets the name, user ID, and group ID of the currently
        logged in user.
    @param store An SCDynamicStoreRef that should be used for communication
        with the server.
        If NULL, a temporary session will be used.
    @param uid A pointer to memory that will be filled with the user ID
        of the current "Console" user. If NULL, this value will not
        be returned.
    @param gid A pointer to memory that will be filled with the group ID
        of the current "Console" user. If NULL, this value will not be
        returned.
    @result The current user logged into the system;
        NULL if no user is logged in or if an error was encountered.
        You must release the returned value.
 }
function SCDynamicStoreCopyConsoleUser( store: SCDynamicStoreRef; uid: uid_t_ptr; gid: gid_t_ptr ): CFStringRef; external name '_SCDynamicStoreCopyConsoleUser';

{!
    @function SCDynamicStoreCopyLocalHostName
    @discussion Gets the current local host name.

        See SCDynamicStoreKeyCreateHostNames() for notification
        key information.
    @param store An SCDynamicStoreRef that should be used for communication
        with the server.
        If NULL, a temporary session will be used.
    @result The current local host name;
        NULL if the name has not been set or if an error was encountered.
        You must release the returned value.
 }
function SCDynamicStoreCopyLocalHostName( store: SCDynamicStoreRef ): CFStringRef; external name '_SCDynamicStoreCopyLocalHostName';

{!
    @function SCDynamicStoreCopyLocation
    @discussion Gets the current "location" identifier.
    @param store An SCDynamicStoreRef that should be used for communication
        with the server.
        If NULL, a temporary session will be used.
    @result A string representing the current "location" identifier;
        NULL if no "location" identifier has been defined or if an error
        was encountered.
        You must release the returned value.
 }
function SCDynamicStoreCopyLocation( store: SCDynamicStoreRef ): CFStringRef; external name '_SCDynamicStoreCopyLocation';

{!
    @function SCDynamicStoreCopyProxies
    @discussion Gets the current internet proxy settings.
    @param store An SCDynamicStoreRef that should be used for communication
        with the server.
        If NULL, a temporary session will be used.
    @result A dictionary with key/value pairs representing the current
        internet proxy settings (HTTP, FTP, etc);
        NULL if no proxy settings have been defined or if an error was encountered.
        You must release the returned value.
 }
function SCDynamicStoreCopyProxies( store: SCDynamicStoreRef ): CFDictionaryRef; external name '_SCDynamicStoreCopyProxies';
{unit SCNetworkConnection}
{$ALIGN MAC68K}







{!
    @header SCNetworkConnection
    The SCNetworkConnectionXXX() APIs allow an application to
    control connection oriented services defined in the system.

    This is a set of control APIs only. Using these APIs, an
    application will be able to control existing services.
    To create, change, or remove services, SCPreferences APIs
    must be used.

    Note: Currently only PPP services can be controlled.
 }


{!
    @typedef SCNetworkConnectionRef
    @discussion This is the handle to manage a connection oriented service.
 }
type
    SCNetworkConnectionRef                          = ^SInt32;


{!
    @typedef SCNetworkConnectionContext
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
type SCNetworkConnectionContext = record
        version: CFIndex;
        info: Ptr;
        retain: function( info: Ptr ): Ptr;
        release: procedure( info: Ptr );
        copyDescription: function( info: Ptr ): CFStringRef;
    end;
    SCNetworkConnectionContextPtr = ^SCNetworkConnectionContext;



{!
    @enum SCNetworkConnectionStatus
    @discussion Status of the network connection.
        This status is intended to be generic and high level.
        An extended status, specific to the type of network
        connection is also available for applications that
        need additonal information.

    @constant kSCNetworkConnectionInvalid
        The network connection refers to an invalid service.

    @constant kSCNetworkConnectionDisconnected
        The network connection is disconnected.

    @constant kSCNetworkConnectionConnecting
        The network connection is connecting.

    @constant kSCNetworkConnectionConnected
        The network connection is connected.

    @constant kSCNetworkConnectionDisconnecting
        The network connection is disconnecting.
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
type
    SCNetworkConnectionStatus = SInt32;
const
    kSCNetworkConnectionInvalid     =  -1;
    kSCNetworkConnectionDisconnected    =  0;
    kSCNetworkConnectionConnecting      =  1;
    kSCNetworkConnectionConnected       =  2;
    kSCNetworkConnectionDisconnecting   =  3;


{!
    @enum SCNetworkConnectionPPPStatus
    @discussion PPP specific status of the network connection.
        This status is PPP specific and returned as part of the extended information
        for a PPP service.
        Note: additional status might be returned in the future, and the application should
        be prepared to receive an unknown value.

    @constant kSCNetworkConnectionPPPDisconnected
        PPP is disconnected.

    @constant kSCNetworkConnectionPPPInitializing
        PPP is initializing.

    @constant kSCNetworkConnectionPPPConnectingLink
        PPP is connecting the lower connection layer (for example, the modem is dialing out).

    @constant kSCNetworkConnectionPPPDialOnTraffic
        PPP is waiting for networking traffic to automatically establish the connection.

    @constant kSCNetworkConnectionPPPNegotiatingLink
        PPP lower layer is connected and PPP is negotiating the link layer (LCP protocol).

    @constant kSCNetworkConnectionPPPAuthenticating
        PPP is authenticating to the server (PAP, CHAP, MS-CHAP or EAP protocols).

    @constant kSCNetworkConnectionPPPWaitingForCallBack
        PPP is waiting for server to call back.

    @constant kSCNetworkConnectionPPPNegotiatingNetwork
        PPP is now authenticated and negotiating the networking layer (IPCP or IPv6CP protocols)

    @constant kSCNetworkConnectionPPPConnected
        PPP is now fully connected for at least one of the networking layer.
        Additional networking protocol might still be negotiating.

    @constant kSCNetworkConnectionPPPTerminating
        PPP networking and link protocols are terminating.

    @constant kSCNetworkConnectionPPPDisconnectingLink
        PPP is disconnecting the lower level (for example, the modem is hanging up).

    @constant kSCNetworkConnectionPPPHoldingLinkOff
        PPP is disconnected and maintaining the link temporarily off.

    @constant kSCNetworkConnectionPPPSuspended
        PPP is suspended as a result of the suspend command (for example, when a V92 Modem is On Hold).

    @constant kSCNetworkConnectionPPPWaitingForRedial
        PPP has found a busy server and is waiting for redial.
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
type
    SCNetworkConnectionPPPStatus = SInt32;
const
    kSCNetworkConnectionPPPDisconnected     =  0;
    kSCNetworkConnectionPPPInitializing     =  1;
    kSCNetworkConnectionPPPConnectingLink       =  2;
    kSCNetworkConnectionPPPDialOnTraffic        =  3;
    kSCNetworkConnectionPPPNegotiatingLink      =  4;
    kSCNetworkConnectionPPPAuthenticating       =  5;
    kSCNetworkConnectionPPPWaitingForCallBack   =  6;
    kSCNetworkConnectionPPPNegotiatingNetwork   =  7;
    kSCNetworkConnectionPPPConnected        =  8;
    kSCNetworkConnectionPPPTerminating      =  9;
    kSCNetworkConnectionPPPDisconnectingLink    =  10;
    kSCNetworkConnectionPPPHoldingLinkOff       =  11;
    kSCNetworkConnectionPPPSuspended        =  12;
    kSCNetworkConnectionPPPWaitingForRedial     =  13;


{!
    @typedef SCNetworkConnectionCallBack
    @discussion Type of the callback function used when a
        status event is delivered.
    @param status The connection status.
    @param connection The connection reference.
    @param info ....
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
type SCNetworkConnectionCallBack = procedure( connection: SCNetworkConnectionRef; status: SCNetworkConnectionStatus; info: Ptr );



{
    Keys for the statistics dictionary
}

{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kSCNetworkConnectionBytesIn CFSTRP('BytesIn')}
{$endc}     { CFNumber }
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kSCNetworkConnectionBytesOut CFSTRP('BytesOut')}
{$endc}     { CFNumber }
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kSCNetworkConnectionPacketsIn CFSTRP('PacketsIn')}
{$endc}     { CFNumber }
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kSCNetworkConnectionPacketsOut CFSTRP('PacketsOut')}
{$endc}     { CFNumber }
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kSCNetworkConnectionErrorsIn CFSTRP('ErrorsIn')}
{$endc}     { CFNumber }
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kSCNetworkConnectionErrorsOut CFSTRP('ErrorsOut')}
{$endc}     { CFNumber }


{!
    @function SCDynamicStoreGetTypeID
    Returns the type identifier of all SCNetworkConnection instances.
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function SCNetworkConnectionGetTypeID: CFTypeID; external name '_SCNetworkConnectionGetTypeID';


{!
    @function SCNetworkConnectionCopyUserPreferences
    @discussion Provides the default serviceID and a userOptions dictionary for the connection.
        Applications can use the serviceID and userOptions returned to open a connection on the fly.
    @param selectionOptions Currently unimplemented. Pass NULL for this version.
    @param serviceID Reference to the default serviceID for starting connections,
        this value will be returned by the function.
    @param userOptions Reference to default userOptions for starting connections,
        this will be returned by the function.
    @result TRUE if there is a valid service to dial.
        FALSE if function was unable to retrieve a service to dial.
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function SCNetworkConnectionCopyUserPreferences( selectionOptions: CFDictionaryRef; var serviceID: CFStringRef; var userOptions: CFDictionaryRef ): Boolean; external name '_SCNetworkConnectionCopyUserPreferences';


{!
    @function SCNetworkConnectionCreateWithServiceID
    @discussion Creates a new connection reference to use for getting the status,
        for connecting or for disconnecting the associated service.
    @param allocator The CFAllocator which should be used to allocate
        memory for the connection structure.
        This parameter may be NULL in which case the current
        default CFAllocator is used. If this reference is not
        a valid CFAllocator, the behavior is undefined.
    @param serviceID A string that defines the service identifier
        of the connection. Service identifiers uniquely identify
        services in the system configuration database.
    @param callout The function to be called when the status
        of the connection changes.
        If this parameter is NULL, the application will not receive
        change of status notifications and will need to poll for updates.
    @param context The SCNetworkConnectionContext associated with the callout.
    @result A reference to the new SCNetworkConnection.
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function SCNetworkConnectionCreateWithServiceID( allocator: CFAllocatorRef; serviceID: CFStringRef; callout: SCNetworkConnectionCallBack; var context: SCNetworkConnectionContext ): SCNetworkConnectionRef; external name '_SCNetworkConnectionCreateWithServiceID';


{!
    @function SCNetworkConnectionCopyService
    @discussion Returns the service ID associated with the SCNetworkConnection.
    @param connection The SCNetworkConnection to obtained status from.
    Returns the service ID associated with the SCNetworkConnection.
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function SCNetworkConnectionCopyServiceID( connection: SCNetworkConnectionRef ): CFStringRef; external name '_SCNetworkConnectionCopyServiceID';


{!
    @function SCNetworkConnectionGetStatus
    @discussion Returns the status of the SCNetworkConnection.
        A status is one of the following values :
            kSCNetworkConnectionInvalid
            kSCNetworkConnectionDisconnected
            kSCNetworkConnectionConnecting
            kSCNetworkConnectionDisconnecting
            kSCNetworkConnectionConnected

    @param connection The SCNetworkConnection to obtain status from.
    @result The status value.
}
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function SCNetworkConnectionGetStatus( connection: SCNetworkConnectionRef ): SCNetworkConnectionStatus; external name '_SCNetworkConnectionGetStatus';


{!
    @function SCNetworkConnectionCopyExtendedStatus
    @discussion Returns the extended status of the connection.
        An extended status dictionary contains specific dictionaries
        describing the status for each subcomponent of the service.

        For example, a status dictionary will contain the following dictionaries:

        IPv4:
            IPaddress: IP address used.

        PPP:
            Status: PPP specific status of type SCNetworkConnectionPPPStatus.
            LastCause: Available when status is Disconnected.
                Contains the last error of disconnection.
            ConnectTime: time when the connection happened
            MaxTime: maximum time for this connection

        Modem:
            ConnectionSpeed:   Speed of the modem connection in bits/s

        Other dictionaries could be present for PPPoE, PPTP and L2TP.

        The status dictionary can be extended as needed in the future
        to contain additional information.

    @param connection The SCNetworkConnection to obtain status from.
    @result The status dictionary.
        If NULL is returned, the error can be retrieved with SCError().
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function SCNetworkConnectionCopyExtendedStatus( connection: SCNetworkConnectionRef ): CFDictionaryRef; external name '_SCNetworkConnectionCopyExtendedStatus';


{!
    @function SCNetworkConnectionCopyStatistics
    @discussion Returns the statistics of the SCNetworkConnection.
        A statistic dictionary contains specific dictionaries
        with statistics for each subcomponents of the service.

        For example, a statistic dictionary will contain the following dictionaries:

        PPP: (Bytes,Packets,Errors()In,Out):
            Statistics at the Network level.
            Contains the number of bytes, packets, and errors on the PPP interface.
            For example, BytesIn contains the number of bytes going up
            into the network stack, for any networking protocol,
            without the PPP headers and trailers.

        The statistic dictionary can be extended as needed in the future
        to contain additional information.

    @param connection The SCNetworkConnection to obtained statistics from.
    @result The statistics dictionary.
        If NULL is returned, the error can be retrieved with SCError().
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function SCNetworkConnectionCopyStatistics( connection: SCNetworkConnectionRef ): CFDictionaryRef; external name '_SCNetworkConnectionCopyStatistics';


{!
    @function SCNetworkConnectionStart
    @discussion Start the connection for the SCNetworkConnection.
        The connection process is asynchronous and the function will
        return immediately. The connection status can be obtain by polling or
        by callback.
        The connection is done with the default settings from the administrator.
        Some of the settings can be overridden for the duration of
        the connection. They are given in an option dictionary.
        The options dictionary is in the format of a Network Service
        as described in SystemConfiguration.

        Note: Starting and stopping of connections is implicitely arbitrated.
        Calling Start on a connection already started will indicate
        that the application has interest in the connection and it shouldn't
        be stopped by anyone else.

    @param connection The SCNetworkConnection to start.
    @param userOptions The options dictionary to start the connection with.
        If userOptions is NULL, the default settings will be used.
        If userOptions are specified, they must be in the SystemConfiguration format.
        The options will override the default settings defined for the service.

        For security reasons, not all the options can be overridden, the appropriate merging
        of all the settings will be done before the connection is established,
        and inappropriate options will be ignored.

    @param linger This parameter indicates whether or not the connection can stay around
        when the application no longer has interest in it.
        Typical application should pass FALSE, and the Stop function will
        automatically be called when the reference is released or if the application quits.
        If the application passes TRUE, the application can release the reference
        or exit and the Stop function will not be called.

    @result TRUE if the connection was correctly started. The actual connection is not established yet,
        and the connection status needs to be periodically checked.
        FALSE if the connection request didn't start. Error must be taken
        from SCError().
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function SCNetworkConnectionStart( connection: SCNetworkConnectionRef; userOptions: CFDictionaryRef; linger: Boolean ): Boolean; external name '_SCNetworkConnectionStart';


{!
    @function SCNetworkConnectionStop
    @discussion Stop the connection for the SCNetworkConnection.
        The disconnection process is asynchronous and the function will
        return immediately. The connection status can be obtain by polling or
        by callback.
        This function performs an arbitrated stop of the connection.
        If several applications have marked their interest in the connection,
        by calling SCNetworkConnectionStart, the call will succeed but the the actual
        connection will be maintained until the last interested application calls stop.

        In certain cases, you might want to stop the connection anyway, and
        SCNetworkConnectionStop with forceDisconnect argument can be used.

    @param connection The SCNetworkConnection to stop.
    @result TRUE if the disconnection request succeeded.
        FALSE if the disconnection request failed. Error must be taken from SCError().
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function SCNetworkConnectionStop( connection: SCNetworkConnectionRef; forceDisconnect: Boolean ): Boolean; external name '_SCNetworkConnectionStop';


{!
    @function SCNetworkConnectionCopyCurrentOptions
    @discussion Copy the user options used to start the connection.
        This is a mechanism for a client to retrieve the user options
        previously passed to the SCNetworkConnectionStart function.
    @param connection The SCNetworkConnection to obtain options from.
    @result The service dictionary containing the connection options.
        The dictionary can be empty if no user options were used.
        If NULL is returned, the error can be retrieved with SCError().
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function SCNetworkConnectionCopyUserOptions( connection: SCNetworkConnectionRef ): CFDictionaryRef; external name '_SCNetworkConnectionCopyUserOptions';


{!
    @function SCNetworkConnectionScheduleWithRunLoop
    @discussion Schedule a connection with the Run Loop.
    @param connection The SCNetworkConnection to schedule.
    @param runLoop The runloop to schedule with.
    @param runLoopMode The runloop mode.
    @result TRUE if success.
        FALSE if failed. The error can be retrieved with SCError().
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function SCNetworkConnectionScheduleWithRunLoop( connection: SCNetworkConnectionRef; runLoop: CFRunLoopRef; runLoopMode: CFStringRef ): Boolean; external name '_SCNetworkConnectionScheduleWithRunLoop';


{!
    @function SCNetworkConnectionUnscheduleFromRunLoop
    @discussion Unschedule a connection from the Run Loop.
    @param connection The SCNetworkConnection to unschedule.
    @param runLoop The runloop to unschedule from.
    @param runLoopMode The runloop mode.
    @result TRUE if success.
        FALSE if failed. The error can be retrieved with SCError().
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function SCNetworkConnectionUnscheduleFromRunLoop( connection: SCNetworkConnectionRef; runLoop: CFRunLoopRef; runLoopMode: CFStringRef ): Boolean; external name '_SCNetworkConnectionUnscheduleFromRunLoop';
{unit SCNetworkReachability}
{$ALIGN MAC68K}






{!
    @header SCNetworkReachability
    The SCNetworkReachabilityXXX() APIs allow an application to determine the status
    of a system's current network configuration and the reachability
    of a target host.  In addition, the reachability can be monitored
    with a notification being provided when/if the status has changed.

    The term "reachable" reflects whether a data packet, sent by
    an application into the network stack, can be sent to the
    the target host/address.  Please note that there is no
    guarantee that the data packet will actually be received by
    the host.
 }

{!
    @typedef SCNetworkReachabilityRef
    @discussion This is the handle to a network address/name.
 }
type
    SCNetworkReachabilityRef    = ^SInt32; { an opaque 32-bit type }


{!
    @typedef SCNetworkReachabilityContext
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
type
    SCNetworkReachabilityContext = record
    version: CFIndex;
    info: Ptr;
        retain: function( info: Ptr ): Ptr;
        release: procedure( info: Ptr );
        copyDescription: function( info: Ptr ): CFStringRef;
    end;
    SCNetworkReachabilityContextPtr = ^SCNetworkReachabilityContext;

{!
    @typedef SCNetworkReachabilityCallBack
    @discussion Type of the callback function used when the
        reachability of a network address/name changes.
    @param target The SCNetworkReachability reference being monitored for changes.
    @param flags The new SCNetworkConnectionFlags representing the
        reachability status of the network address/name.
    @param info ....
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
type SCNetworkReachabilityCallBack = procedure( target: SCNetworkReachabilityRef; flags: SCNetworkConnectionFlags; info: UnivPtr );

{!
    @function SCNetworkReachabilityCreateWithAddress
    @discussion Creates a reference to the specified network
        address.  This reference can later be used to monitor
        the reachability of the target host.
    @param address The address of the desired host.
    @result A reference to the new immutable SCNetworkReachabilityRef.

         You must release the returned value.
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function SCNetworkReachabilityCreateWithAddress( allocator: CFAllocatorRef; address: sockaddr_ptr ): SCNetworkReachabilityRef; external name '_SCNetworkReachabilityCreateWithAddress';

{!
    @function SCNetworkReachabilityCreateWithAddressPair
    @discussion Creates a reference to the specified network
        address.  This reference can later be used to monitor
        the reachability of the target host.
    @param localAddress The local address associated with a network
        connection.  If NULL, only the remote address is of interest.
    @param remoteAddress The remote address associated with a network
        connection.  If NULL, only the local address is of interest.
    @result A reference to the new immutable SCNetworkReachabilityRef.

         You must release the returned value.
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function SCNetworkReachabilityCreateWithAddressPair( allocator: CFAllocatorRef; localAddress: sockaddr_ptr; remoteAddress: sockaddr_ptr ): SCNetworkReachabilityRef; external name '_SCNetworkReachabilityCreateWithAddressPair';

{!
    @function SCNetworkReachabilityCreateWithName
    @discussion Creates a reference to the specified network host/node
        name.  This reference can later be used to monitor the
        reachability of the target host.
    @param nodename The node name of the desired host. This name would
        be the same as that passed to gethostbyname() or getaddrinfo().
    @result A reference to the new immutable SCNetworkReachabilityRef.

        You must release the returned value.
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function SCNetworkReachabilityCreateWithName( allocator: CFAllocatorRef; nodename: CStringPtr ): SCNetworkReachabilityRef; external name '_SCNetworkReachabilityCreateWithName';

{!
    @function SCNetworkReachabilityGetTypeID
    Returns the type identifier of all SCNetworkReachability instances.
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function SCNetworkReachabilityGetTypeID: CFTypeID; external name '_SCNetworkReachabilityGetTypeID';


{!
    @function SCNetworkReachabilityGetFlags
    @discussion Determines if the given target is reachable using the
        current network configuration.
    @param target The network reference associated with the address/name
        to be checked for reachability.
    @param flags A pointer to memory that will be filled with the
        SCNetworkConnectionFlags detailing the reachability
        of the specified target.
    @result TRUE if the network connection flags are valid; FALSE if the
        status could not be determined.
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function SCNetworkReachabilityGetFlags( target: SCNetworkReachabilityRef; var flags: SCNetworkConnectionFlags ): Boolean; external name '_SCNetworkReachabilityGetFlags';

{!
    @function SCNetworkReachabilitySetCallback
    @discussion Assigns a client to a target, which receives callbacks
        when the reachability of the target changes.
    @param target The network reference associated with the address/name
        to be checked for reachability.
    @param callout The function to be called when the reachability of
        target changes.  If NULL, the current client for the target
        is removed.
    @param context The SCNetworkReachabilityContext associated with
        the callout.
    @result TRUE if the notification client was successfully set.
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function SCNetworkReachabilitySetCallback( target: SCNetworkReachabilityRef; callout: SCNetworkReachabilityCallBack; var context: SCNetworkReachabilityContext ): Boolean; external name '_SCNetworkReachabilitySetCallback';

{!
    @function SCNetworkReachabilityScheduleWithRunLoop
    @discussion Schedule the given target from the given run loop and mode.
    @param target The address/name which is set up for asynchronous mode.  Must be non-NULL.
    @param runLoop A reference to a runloop on which the target should be scheduled.  Must be non-NULL.
    @param runLoopMode The mode on which to schedule the target.  Must be non-NULL.
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function SCNetworkReachabilityScheduleWithRunLoop( target: SCNetworkReachabilityRef; runLoop: CFRunLoopRef; runLoopMode: CFStringRef ): Boolean; external name '_SCNetworkReachabilityScheduleWithRunLoop';

{!
    @function SCNetworkReachabilityUnscheduleFromRunLoop
    @discussion Unschedule the given target from the given run loop and mode.
    @param target The address/name which is set up for asynchronous mode.  Must be non-NULL.
    @param runLoop A reference to a runloop on which the target should be scheduled.  Must be non-NULL.
    @param runLoopMode The mode on which to schedule the target.  Must be non-NULL.
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function SCNetworkReachabilityUnscheduleFromRunLoop( target: SCNetworkReachabilityRef; runLoop: CFRunLoopRef; runLoopMode: CFStringRef ): Boolean; external name '_SCNetworkReachabilityUnscheduleFromRunLoop';
{unit SCPreferences}
{$ALIGN MAC68K}






{!
    @header SCPreferences
    The SCPreferencesXXX() APIs allow an application to load and
    store XML configuration data in a controlled manner and provide
    the necessary notifications to other applications that need to
    be aware of configuration changes.

    The stored XML configuration data is accessed using a prefsID. A
    NULL value indicates that the default system preferences are to
    be accessed.
    A string which starts with a leading "/" character specifies the
    path to the file containing te preferences to be accessed.
    A string which does not start with a leading "/" character
    specifies a file relative to the default system preferences
    directory.
 }


{!
    @typedef SCPreferencesRef
    @discussion This is the handle to an open "session" for
        accessing system configuration preferences.
 }
type
    SCPreferencesRef    = ^SInt32; { an opaque 32-bit type }

{!
    @function SCPreferencesGetTypeID
    Returns the type identifier of all SCPreferences instances.
 }
function SCPreferencesGetTypeID: CFTypeID; external name '_SCPreferencesGetTypeID';


{!
    @function SCPreferencesCreate
    @discussion Initiates access to the per-system set of configuration
        preferences.
    @param allocator ...
    @param name A string that describes the name of the calling
        process.
    @param prefsID A string that identifies the name of the
        group of preferences to be accessed/updated.
    @result prefs A pointer to memory that will be filled with an
        SCPreferencesRef handle to be used for all subsequent requests.
        If a session cannot be established, the contents of
        memory pointed to by this parameter are undefined.
 }
function SCPreferencesCreate( allocator: CFAllocatorRef; name: CFStringRef; prefsID: CFStringRef ): SCPreferencesRef; external name '_SCPreferencesCreate';

{!
    @function SCPreferencesLock
    @discussion Locks access to the configuration preferences.

    This function obtains exclusive access to the configuration
    preferences associated with this prefsID. Clients attempting
    to obtain exclusive access to the preferences will either receive
    an kSCStatusPrefsBusy error or block waiting for the lock to be
    released.
    @param session An SCPreferencesRef handle that should be used for
        all API calls.
    @param wait A boolean flag indicating whether the calling process
        should block waiting for another process to complete its update
        operation and release its lock.
    @result TRUE if the lock was obtained; FALSE if an error occurred.
 }
function SCPreferencesLock( session: SCPreferencesRef; wait: Boolean ): Boolean; external name '_SCPreferencesLock';

{!
    @function SCPreferencesCommitChanges
    @discussion Commits changes made to the configuration preferences to
        persitent storage.

        This function commits any changes to permanent storage. An
        implicit call to SCPreferencesLock/SCPreferencesUnlock will
        be made if exclusive access has not already been established.

        Note:  This routine commits changes to persistent storage.
        Call SCPreferencesApplyChanges() to apply the changes
        to the running system.
    @param session An SCPreferencesRef handle that should be used for
        all API calls.
    @result TRUE if the lock was obtained; FALSE if an error occurred.
 }
function SCPreferencesCommitChanges( session: SCPreferencesRef ): Boolean; external name '_SCPreferencesCommitChanges';

{!
    @function SCPreferencesApplyChanges
    @discussion Requests that the currently stored configuration
        preferences be applied to the active configuration.
    @param session An SCPreferencesRef handle that should be used for
        all API calls.
    @result TRUE if the lock was obtained; FALSE if an error occurred.
 }
function SCPreferencesApplyChanges( session: SCPreferencesRef ): Boolean; external name '_SCPreferencesApplyChanges';

{!
    @function SCPreferencesUnlock
    @discussion Releases exclusive access to the configuration preferences.

        This function releases the exclusive access "lock" for this prefsID.
        Other clients will be now be able to establish exclusive access to
        the preferences.
    @param session An SCPreferencesRef handle that should be used for
        all API calls.
    @result TRUE if the lock was obtained; FALSE if an error occurred.
 }
function SCPreferencesUnlock( session: SCPreferencesRef ): Boolean; external name '_SCPreferencesUnlock';

{!
    @function SCPreferencesGetSignature
    @discussion Returns a sequence of bytes that can be used to determine
        if the saved configuration preferences have changed.
    @param session An SCPreferencesRef handle that should be used for
        all API calls.
    @param signature A pointer to a CFDataRef that will reflect
        the signature of the configuration preferences at the time
        of the call to SCPreferencesCreate().
    @result A CFDataRef that reflects the signature of the configuration
        preferences at the time of the call to SCPreferencesCreate().
 }
function SCPreferencesGetSignature( session: SCPreferencesRef ): CFDataRef; external name '_SCPreferencesGetSignature';

{!
    @function SCPreferencesCopyKeyList
    @discussion Returns an array of currently defined preference keys.
    @param session An SCPreferencesRef handle that should be used for
        all API calls.
    @result The list of keys.  You must release the returned value.
 }
function SCPreferencesCopyKeyList( session: SCPreferencesRef ): CFArrayRef; external name '_SCPreferencesCopyKeyList';

{!
    @function SCPreferencesGetValue
    @discussion Returns the data associated with a preference key.

        This function retrieves data associated with a key for the prefsID.

        Note:  You could read stale data and not know it, unless you
        first call SCPreferencesLock().
    @param session An SCPreferencesRef handle that should be used for
        all API calls.
    @param key The preference key to be returned.
    @result The value associated with the specified preference key; If no
        value was located, NULL is returned.
 }
function SCPreferencesGetValue( session: SCPreferencesRef; key: CFStringRef ): CFPropertyListRef; external name '_SCPreferencesGetValue';

{!
    @function SCPreferencesAddValue
    @discussion Adds data for a preference key.

    This function associates new data with the specified key. In order
    to commit these changes to permanent storage a call must be made to
    SCPreferencesCommitChanges().
    @param session The SCPreferencesRef handle that should be used to
        communicate with the APIs.
    @param key The preference key to be updated.
    @param value The CFPropertyListRef object containing the
        value to be associated with the specified preference key.
    @result TRUE if the value was added; FALSE if the key already exists or
        if an error occurred.
 }
function SCPreferencesAddValue( session: SCPreferencesRef; key: CFStringRef; value: CFPropertyListRef ): Boolean; external name '_SCPreferencesAddValue';

{!
    @function SCPreferencesSetValue
    @discussion Updates the data associated with a preference key.

    This function adds or replaces the value associated with the
    specified key. In order to commit these changes to permanent
    storage a call must be made to SCPreferencesCommitChanges().
    @param session The SCPreferencesRef handle that should be used to
        communicate with the APIs.
    @param key The preference key to be updated.
    @param value The CFPropertyListRef object containing the
        data to be associated with the specified preference key.
    @result TRUE if the value was set; FALSE if an error occurred.
 }
function SCPreferencesSetValue( session: SCPreferencesRef; key: CFStringRef; value: CFPropertyListRef ): Boolean; external name '_SCPreferencesSetValue';

{!
    @function SCPreferencesRemoveValue
    @discussion Removes the data associated with a preference key.

    This function removes the data associated with the specified
    key. In order to commit these changes to permanent storage a
    call must be made to SCPreferencesCommitChanges().
    @param session The SCPreferencesRef handle that should be used to
        communicate with the APIs.
    @param key The preference key to be removed.
    @result TRUE if the value was removed; FALSE if the key did not exist or
        if an error occurred.
 }
function SCPreferencesRemoveValue( session: SCPreferencesRef; key: CFStringRef ): Boolean; external name '_SCPreferencesRemoveValue';
{unit SCPreferencesPath}
{$ALIGN MAC68K}






{!
    @header SCPreferencesPath
    The SCPreferencesPathXXX() APIs allow an application to
    load and store XML configuration data in a controlled
    manner and provide the necessary notifications to other
    applications that need to be aware of configuration
    changes.

    The SCPreferencesPathXXX() APIs make certain assumptions
    about the layout of the preferences data.  These APIs view
    the data as a collection of dictionaries of key/value pairs
    and an associated path name.  The root path ("/") identifies
    the top-level dictionary.  Additional path components
    specify the keys for sub-dictionaries.

    For example, the following dictionary can be accessed via
    two paths.  The root ("/") path would return a dictionary
    with all keys and values.  The path "/path1" would only
    return the dictionary with the "key3" and "key4" properties.

    <PRE>
    <BR>    &lt;dict&gt;
    <BR>        &lt;key&gt;key1&lt;/key&gt;
    <BR>        &lt;string&gt;val1&lt;/string&gt;
    <BR>        &lt;key&gt;key2&lt;/key&gt;
    <BR>        &lt;string&gt;val2&lt;/string&gt;
    <BR>        &lt;key&gt;path1&lt;/key&gt;
    <BR>        &lt;dict&gt;
    <BR>            &lt;key&gt;key3&lt;/key&gt;
    <BR>            &lt;string&gt;val3&lt;/string&gt;
    <BR>        &lt;key&gt;key4&lt;/key&gt;
    <BR>        &lt;string&gt;val4&lt;/string&gt;
    <BR>        &lt;/dict&gt;
    <BR>    &lt;/dict&gt;
    </PRE>

    Each dictionary can also include the kSCResvLink key.  The
    value associated with this key is interpreted as a "link" to
    another path.  If this key is present, a call to the
    SCPreferencesPathGetValue() API will return the dictionary
    specified by the link.
 }

{!
    @function SCPreferencesPathCreateUniqueChild
    @discussion Creates a new path component within the dictionary
        hierarchy.
    @param session The SCPreferencesRef handle that should be used to
     communicate with the APIs.
    @param prefix A string that represents the parent path.
    @result A string representing the new (unique) child path; NULL
        if the specified path does not exist.
 }
function SCPreferencesPathCreateUniqueChild( session: SCPreferencesRef; prefix: CFStringRef ): CFStringRef; external name '_SCPreferencesPathCreateUniqueChild';

{!
    @function SCPreferencesPathGetValue
    @discussion Returns the dictionary associated with the specified
        path.
    @param session The SCPreferencesRef handle that should be used to
        communicate with the APIs.
    @param path A string that represents the path to be returned.
    @result The dictionary associated with the specified path; NULL
        if the path does not exist.
 }
function SCPreferencesPathGetValue( session: SCPreferencesRef; path: CFStringRef ): CFDictionaryRef; external name '_SCPreferencesPathGetValue';

{!
    @function SCPreferencesPathGetLink
    @discussion Returns the link (if one exists) associated with the
        specified path.
    @param session The SCPreferencesRef handle that should be used to
     communicate with the APIs.
    @param path A string that represents the path to be returned.
    @result The dictionary associated with the specified path; NULL
        if the path is not a link or does not exist.
 }
function SCPreferencesPathGetLink( session: SCPreferencesRef; path: CFStringRef ): CFStringRef; external name '_SCPreferencesPathGetLink';

{!
    @function SCPreferencesPathSetValue
    @discussion Associates a dictionary with the specified path.
    @param session The SCPreferencesRef handle that should be used to
     communicate with the APIs.
    @param path A string that represents the path to be updated.
    @param value A dictionary that represents the data to be
        stored at the specified path.
    @result A boolean indicating the success (or failure) of the call.
 }
function SCPreferencesPathSetValue( session: SCPreferencesRef; path: CFStringRef; value: CFDictionaryRef ): Boolean; external name '_SCPreferencesPathSetValue';

{!
    @function SCPreferencesPathSetLink
    @discussion Associates a link to a second dictionary at the
        specified path.
    @param session The SCPreferencesRef handle that should be used to
        communicate with the APIs.
    @param path A string that represents the path to be updated.
    @param link A string that represents the link to be stored
        at the specified path.
    @result A boolean indicating the success (or failure) of the call.
 }
function SCPreferencesPathSetLink( session: SCPreferencesRef; path: CFStringRef; link: CFStringRef ): Boolean; external name '_SCPreferencesPathSetLink';

{!
    @function SCPreferencesPathRemoveValue
    @discussion Removes the data associated with the specified path.
    @param session The SCPreferencesRef handle that should be used to
     communicate with the APIs.
    @param path A string that represents the path to be returned.
    @result A boolean indicating the success (or failure) of the call.
 }
function SCPreferencesPathRemoveValue( session: SCPreferencesRef; path: CFStringRef ): Boolean; external name '_SCPreferencesPathRemoveValue';
{unit SCPreferencesSetSpecific}
{$ALIGN MAC68K}






{!
    @header SCPreferencesSetSpecific
    The following APIs allow an application to set specific
    configuration information about the current system (e.g. the
    computer/sharing name).
 }

{!
    @function SCPreferencesSetComputerName
    @discussion Updates the computer/host name in the system preferences.

    Note: In order to commit these changes to permanent storage a call
    must be made to SCPreferencesCommitChanges().
    A call to SCPreferencesApplyChanges() is also required for the new
    name to become active.
    @param prefs An SCPreferencesRef that should be used for all API calls.
    @param name The computer/host name to be set.
    @param nameEncoding The encoding associated with the computer/host name.
    @result A boolean indicating the success (or failure) of the call.
 }
function SCPreferencesSetComputerName( prefs: SCPreferencesRef; name: CFStringRef; nameEncoding: CFStringEncoding ): Boolean; external name '_SCPreferencesSetComputerName';

{!
    @function SCPreferencesSetLocalHostName
    @discussion Updates the local host name in the system preferences.

    Note: In order to commit these changes to permanent storage a call
    must be made to SCPreferencesCommitChanges().
    A call to SCPreferencesApplyChanges() is also required for the new
    name to become active.
    @param prefs An SCPreferencesRef that should be used for all API calls.
    @param name The local host name to be set.

    Note: the string must conform to the naming conventions of a DNS host
        name as specified in RFC 1034 (section 3.5).
    @result A boolean indicating the success (or failure) of the call.
 }
function SCPreferencesSetLocalHostName( prefs: SCPreferencesRef; name: CFStringRef ): Boolean; external name '_SCPreferencesSetLocalHostName';
{unit SpeechRecognition}
{$ALIGN MAC68K}








{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}

{ Error Codes [Speech recognition gets -5100 through -5199] }

const
    kSRNotAvailable             = -5100;                        {  the service requested is not avail or applicable  }
    kSRInternalError            = -5101;                        {  a system internal or hardware error condition  }
    kSRComponentNotFound        = -5102;                        {  a needed system resource was not located  }
    kSROutOfMemory              = -5103;                        {  an out of memory error occurred in the toolbox memory space  }
    kSRNotASpeechObject         = -5104;                        {  the object specified is no longer or never was valid  }
    kSRBadParameter             = -5105;                        {  an invalid parameter was specified  }
    kSRParamOutOfRange          = -5106;                        {  when we say 0-100, don't pass in 101.  }
    kSRBadSelector              = -5107;                        {  an unrecognized selector was specified  }
    kSRBufferTooSmall           = -5108;                        {  returned from attribute access functions  }
    kSRNotARecSystem            = -5109;                        {  the object used was not a SRRecognitionSystem  }
    kSRFeedbackNotAvail         = -5110;                        {  there is no feedback window associated with SRRecognizer  }
    kSRCantSetProperty          = -5111;                        {  a non-settable property was specified  }
    kSRCantGetProperty          = -5112;                        {  a non-gettable property was specified  }
    kSRCantSetDuringRecognition = -5113;                        {  the property can't be set while recognition is in progress -- do before or between utterances.  }
    kSRAlreadyListening         = -5114;                        {  in response to SRStartListening  }
    kSRNotListeningState        = -5115;                        {  in response to SRStopListening  }
    kSRModelMismatch            = -5116;                        {  no acoustical models are avail to match request  }
    kSRNoClientLanguageModel    = -5117;                        {  trying to access a non-specified SRLanguageModel  }
    kSRNoPendingUtterances      = -5118;                        {  nothing to continue search on  }
    kSRRecognitionCanceled      = -5119;                        {  an abort error occurred during search  }
    kSRRecognitionDone          = -5120;                        {  search has finished, but nothing was recognized  }
    kSROtherRecAlreadyModal     = -5121;                        {  another recognizer is modal at the moment, so can't set this recognizer's kSRBlockModally property right now  }
    kSRHasNoSubItems            = -5122;                        {  SRCountItems or related routine was called on an object without subelements -- e.g. a word -- rather than phrase, path, or LM.  }
    kSRSubItemNotFound          = -5123;                        {  returned when accessing a non-existent sub item of a container  }
    kSRLanguageModelTooBig      = -5124;                        {  Cant build language models so big  }
    kSRAlreadyReleased          = -5125;                        {  this object has already been released before  }
    kSRAlreadyFinished          = -5126;                        {  the language model can't be finished twice  }
    kSRWordNotFound             = -5127;                        {  the spelling couldn't be found in lookup(s)  }
    kSRNotFinishedWithRejection = -5128;                        {  property not found because the LMObj is not finished with rejection  }
    kSRExpansionTooDeep         = -5129;                        {  Language model is left recursive or is embedded too many levels  }
    kSRTooManyElements          = -5130;                        {  Too many elements added to phrase or path or other langauge model object  }
    kSRCantAdd                  = -5131;                        {  Can't add given type of object to the base SRLanguageObject (e.g.in SRAddLanguageObject)    }
    kSRSndInSourceDisconnected  = -5132;                        {  Sound input source is disconnected  }
    kSRCantReadLanguageObject   = -5133;                        {  An error while trying to create new Language object from file or pointer -- possibly bad format  }
                                                                {  non-release debugging error codes are included here  }
    kSRNotImplementedYet        = -5199;                        {  you'd better wait for this feature in a future release  }


    {    Type Definitions   }

type
    SRSpeechObject    = ^SInt32; { an opaque 32-bit type }
    SRSpeechObjectPtr = ^SRSpeechObject;  { when a var xx:SRSpeechObject parameter can be nil, it is changed to xx: SRSpeechObjectPtr }
    SRRecognitionSystem                 = SRSpeechObject;
    SRRecognizer                        = SRSpeechObject;
    SRSpeechSource                      = SRSpeechObject;
    SRRecognitionResult                 = SRSpeechSource;
    SRLanguageObject                    = SRSpeechObject;
    SRLanguageModel                     = SRLanguageObject;
    SRPath                              = SRLanguageObject;
    SRPhrase                            = SRLanguageObject;
    SRWord                              = SRLanguageObject;
    {    between 0 and 100  }
    SRSpeedSetting                      = UInt16;
    {    between 0 and 100  }
    SRRejectionLevel                    = UInt16;
    {    When an event occurs, the user supplied proc will be called with a pointer     }
    {     to the param passed in and a flag to indicate conditions such                 }
    {     as interrupt time or system background time.                                  }
    SRCallBackStructPtr = ^SRCallBackStruct;
    SRCallBackStruct = record
        what:                   SInt32;                             {  one of notification flags  }
        message:                SInt32;                             {  contains SRRecognitionResult id  }
        instance:               SRRecognizer;                           {  ID of recognizer being notified  }
        status:                 OSErr;                                  {  result status of last search  }
        flags:                  SInt16;                             {  non-zero if occurs during interrupt  }
        refCon:                 SInt32;                             {  user defined - set from SRCallBackParam  }
    end;

    {    Call back procedure definition     }
    SRCallBackProcPtr = procedure(var param: SRCallBackStruct);

    SRCallBackUPP = ^SInt32; { an opaque UPP }

const
    uppSRCallBackProcInfo = $000000C0;
    {
     *  NewSRCallBackUPP()
     *
     *  Availability:
     *    Non-Carbon CFM:   available as macro/inline
     *    CarbonLib:        in CarbonLib 1.0.2 and later
     *    Mac OS X:         in version 10.0 and later
        }
function NewSRCallBackUPP(userRoutine: SRCallBackProcPtr): SRCallBackUPP; external name '_NewSRCallBackUPP'; { old name was NewSRCallBackProc }
{
 *  DisposeSRCallBackUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeSRCallBackUPP(userUPP: SRCallBackUPP); external name '_DisposeSRCallBackUPP';
{
 *  InvokeSRCallBackUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvokeSRCallBackUPP(var param: SRCallBackStruct; userRoutine: SRCallBackUPP); external name '_InvokeSRCallBackUPP'; { old name was CallSRCallBackProc }
type
    SRCallBackParamPtr = ^SRCallBackParam;
    SRCallBackParam = record
        callBack:               SRCallBackUPP;
        refCon:                 SInt32;
    end;

    {    Recognition System Types   }

const
    kSRDefaultRecognitionSystemID = 0;

    {    Recognition System Properties  }
    kSRFeedbackAndListeningModes = $6662776E (* 'fbwn' *);                      {  short: one of kSRNoFeedbackHasListenModes, kSRHasFeedbackHasListenModes, kSRNoFeedbackNoListenModes  }
    kSRRejectedWord             = $72656A71 (* 'rejq' *);                       {  the SRWord used to represent a rejection  }
    kSRCleanupOnClientExit      = $636C7570 (* 'clup' *);                       {  Boolean: Default is true. The rec system and everything it owns is disposed when the client application quits  }

    kSRNoFeedbackNoListenModes  = 0;                            {  next allocated recognizer has no feedback window and doesn't use listening modes    }
    kSRHasFeedbackHasListenModes = 1;                           {  next allocated recognizer has feedback window and uses listening modes           }
    kSRNoFeedbackHasListenModes = 2;                            {  next allocated recognizer has no feedback window but does use listening modes   }

    {    Speech Source Types    }
    kSRDefaultSpeechSource      = 0;
    kSRLiveDesktopSpeechSource  = $646B6C76 (* 'dklv' *);                       {  live desktop sound input  }
    kSRCanned22kHzSpeechSource  = $63613232 (* 'ca22' *);                       {  AIFF file based 16 bit, 22.050 KHz sound input  }

    {    Notification via Apple Event or Callback   }
    {    Notification Flags     }
    kSRNotifyRecognitionBeginning = $00000001;                  {  recognition can begin. client must now call SRContinueRecognition or SRCancelRecognition  }
    kSRNotifyRecognitionDone    = $00000002;                    {  recognition has terminated. result (if any) is available.  }

    {    Apple Event selectors  }
    {    AppleEvent message class   }
    kAESpeechSuite              = $73707263 (* 'sprc' *);

    {    AppleEvent message event ids   }
    kAESpeechDone               = $73727364 (* 'srsd' *);
    kAESpeechDetected           = $73726264 (* 'srbd' *);

    {    AppleEvent Parameter ids   }
    keySRRecognizer             = $6B726563 (* 'krec' *);
    keySRSpeechResult           = $6B737072 (* 'kspr' *);
    keySRSpeechStatus           = $6B737374 (* 'ksst' *);

    {    AppleEvent Parameter types     }
    typeSRRecognizer            = $74726563 (* 'trec' *);
    typeSRSpeechResult          = $74737072 (* 'tspr' *);


    {    SRRecognizer Properties    }
    kSRNotificationParam        = $6E6F7469 (* 'noti' *);                       {  see notification flags below  }
    kSRCallBackParam            = $63616C6C (* 'call' *);                       {  type SRCallBackParam  }
    kSRSearchStatusParam        = $73746174 (* 'stat' *);                       {  see status flags below  }
    kSRAutoFinishingParam       = $6166696E (* 'afin' *);                       {  automatic finishing applied on LM for search  }
    kSRForegroundOnly           = $66676F6E (* 'fgon' *);                       {  Boolean. Default is true. If true, client recognizer only active when in foreground.    }
    kSRBlockBackground          = $626C6267 (* 'blbg' *);                       {  Boolean. Default is false. If true, when client recognizer in foreground, rest of LMs are inactive.     }
    kSRBlockModally             = $626C6D64 (* 'blmd' *);                       {  Boolean. Default is false. When true, this client's LM is only active LM; all other LMs are inactive. Be nice, don't be modal for long periods!  }
    kSRWantsResultTextDrawn     = $74786662 (* 'txfb' *);                       {  Boolean. Default is true. If true, search results are posted to Feedback window  }
    kSRWantsAutoFBGestures      = $64666272 (* 'dfbr' *);                       {  Boolean. Default is true. If true, client needn't call SRProcessBegin/End to get default feedback behavior  }
    kSRSoundInVolume            = $766F6C75 (* 'volu' *);                       {  short in [0..100] log scaled sound input power. Can't set this property  }
    kSRReadAudioFSSpec          = $61757264 (* 'aurd' *);                       {  *FSSpec. Specify FSSpec where raw audio is to be read (AIFF format) using kSRCanned22kHzSpeechSource. Reads until EOF  }
    kSRCancelOnSoundOut         = $6361736F (* 'caso' *);                       {  Boolean: Default is true.  If any sound is played out during utterance, recognition is aborted.  }
    kSRSpeedVsAccuracyParam     = $73706564 (* 'sped' *);                       {  SRSpeedSetting between 0 and 100  }

    {    0 means more accurate but slower.  }
    {    100 means (much) less accurate but faster.     }
    kSRUseToggleListen          = 0;                            {  listen key modes  }
    kSRUsePushToTalk            = 1;

    kSRListenKeyMode            = $6C6B6D64 (* 'lkmd' *);                       {  short: either kSRUseToggleListen or kSRUsePushToTalk  }
    kSRListenKeyCombo           = $6C6B6579 (* 'lkey' *);                       {  short: Push-To-Talk key combination; high byte is high byte of event->modifiers, the low byte is the keycode from event->message  }
    kSRListenKeyName            = $6C6E616D (* 'lnam' *);                       {  Str63: string representing ListenKeyCombo  }
    kSRKeyWord                  = $6B777264 (* 'kwrd' *);                       {  Str255: keyword preceding spoken commands in kSRUseToggleListen mode  }
    kSRKeyExpected              = $6B657870 (* 'kexp' *);                       {  Boolean: Must the PTT key be depressed or the key word spoken before recognition can occur?  }

    {    Operational Status Flags   }
    kSRIdleRecognizer           = $00000001;                    {  engine is not active  }
    kSRSearchInProgress         = $00000002;                    {  search is in progress  }
    kSRSearchWaitForAllClients  = $00000004;                    {  search is suspended waiting on all clients' input  }
    kSRMustCancelSearch         = $00000008;                    {  something has occurred (sound played, non-speech detected) requiring the search to abort  }
    kSRPendingSearch            = $00000010;                    {  we're about to start searching  }

    {    Recognition Result Properties  }
    kSRTEXTFormat               = $54455854 (* 'TEXT' *);                       {  raw text in user supplied memory  }
    kSRPhraseFormat             = $6C6D7068 (* 'lmph' *);                       {  SRPhrase containing result words  }
    kSRPathFormat               = $6C6D7074 (* 'lmpt' *);                       {  SRPath containing result phrases or words  }
    kSRLanguageModelFormat      = $6C6D666D (* 'lmfm' *);                       {  top level SRLanguageModel for post parse  }

    {    SRLanguageObject Family Properties     }
    kSRSpelling                 = $7370656C (* 'spel' *);                       {  spelling of a SRWord or SRPhrase or SRPath, or name of a SRLanguageModel  }
    kSRLMObjType                = $6C6D7470 (* 'lmtp' *);                       {  Returns one of SRLanguageObject Types listed below  }
    kSRRefCon                   = $72656663 (* 'refc' *);                       {  4 bytes of user storage  }
    kSROptional                 = $6F70746C (* 'optl' *);                       {  Boolean -- true if SRLanguageObject is optional     }
    kSREnabled                  = $656E626C (* 'enbl' *);                       {  Boolean -- true if SRLanguageObject enabled  }
    kSRRepeatable               = $72707462 (* 'rptb' *);                       {  Boolean -- true if SRLanguageObject is repeatable  }
    kSRRejectable               = $726A626C (* 'rjbl' *);                       {  Boolean -- true if SRLanguageObject is rejectable (Recognition System's kSRRejectedWord  }
                                                                {        object can be returned in place of SRLanguageObject with this property)    }
    kSRRejectionLevel           = $726A6374 (* 'rjct' *);                       {  SRRejectionLevel between 0 and 100  }

    {    LM Object Types -- returned as kSRLMObjType property of language model objects     }
    kSRLanguageModelType        = $6C6D6F62 (* 'lmob' *);                       {  SRLanguageModel  }
    kSRPathType                 = $70617468 (* 'path' *);                       {  SRPath  }
    kSRPhraseType               = $70687261 (* 'phra' *);                       {  SRPhrase  }
    kSRWordType                 = $776F7264 (* 'word' *);                       {  SRWord  }

    {    a normal and reasonable rejection level    }
    kSRDefaultRejectionLevel    = 50;

    {   ******************************************************************************  }
    {                         NOTES ON USING THE API                                    }
    {                                                                                   }
    {         All operations (with the exception of SRGetRecognitionSystem) are         }
    {         directed toward an object allocated or begot from New, Get and Read       }
    {         type calls.                                                               }
    {                                                                                   }
    {         There is a simple rule in dealing with allocation and disposal:           }
    {                                                                                   }
    {         *   all toolbox allocations are obtained from a SRRecognitionSystem       }
    {                                                                                   }
    {         *   if you obtain an object via New or Get, then you own a reference      }
    {             to that object and it must be released via SRReleaseObject when       }
    {             you no longer need it                                                 }
    {                                                                                   }
    {         *   when you receive a SRRecognitionResult object via AppleEvent or       }
    {             callback, it has essentially been created on your behalf and so       }
    {             you are responsible for releasing it as above                         }
    {                                                                                   }
    {         *   when you close a SRRecognitionSystem, all remaining objects which         }
    {             were allocated with it will be forcefully released and any            }
    {             remaining references to those objects will be invalid.                }
    {                                                                                   }
    {         This translates into a very simple guideline:                             }
    {             If you allocate it or have it allocated for you, you must release     }
    {             it.  If you are only peeking at it, then don't release it.            }
    {                                                                                   }
    {   ******************************************************************************  }
    {    Opening and Closing of the SRRecognitionSystem     }
    {
     *  SROpenRecognitionSystem()
     *
     *  Availability:
     *    Non-Carbon CFM:   in SpeechRecognitionLib 1.0 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function SROpenRecognitionSystem(var system: SRRecognitionSystem; systemID: OSType): OSErr; external name '_SROpenRecognitionSystem';
{
 *  SRCloseRecognitionSystem()
 *
 *  Availability:
 *    Non-Carbon CFM:   in SpeechRecognitionLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SRCloseRecognitionSystem(system: SRRecognitionSystem): OSErr; external name '_SRCloseRecognitionSystem';
{ Accessing Properties of any Speech Object }
{
 *  SRSetProperty()
 *
 *  Availability:
 *    Non-Carbon CFM:   in SpeechRecognitionLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SRSetProperty(srObject: SRSpeechObject; selector: OSType; proprty: UnivPtr; propertyLen: Size): OSErr; external name '_SRSetProperty';
{
 *  SRGetProperty()
 *
 *  Availability:
 *    Non-Carbon CFM:   in SpeechRecognitionLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SRGetProperty(srObject: SRSpeechObject; selector: OSType; proprty: UnivPtr; var propertyLen: Size): OSErr; external name '_SRGetProperty';
{ Any object obtained via New or Get type calls must be released }
{
 *  SRReleaseObject()
 *
 *  Availability:
 *    Non-Carbon CFM:   in SpeechRecognitionLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SRReleaseObject(srObject: SRSpeechObject): OSErr; external name '_SRReleaseObject';
{
 *  SRGetReference()
 *
 *  Availability:
 *    Non-Carbon CFM:   in SpeechRecognitionLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SRGetReference(srObject: SRSpeechObject; var newObjectRef: SRSpeechObject): OSErr; external name '_SRGetReference';
{ SRRecognizer Instance Functions }
{
 *  SRNewRecognizer()
 *
 *  Availability:
 *    Non-Carbon CFM:   in SpeechRecognitionLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SRNewRecognizer(system: SRRecognitionSystem; var recognizer: SRRecognizer; sourceID: OSType): OSErr; external name '_SRNewRecognizer';
{
 *  SRStartListening()
 *
 *  Availability:
 *    Non-Carbon CFM:   in SpeechRecognitionLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SRStartListening(recognizer: SRRecognizer): OSErr; external name '_SRStartListening';
{
 *  SRStopListening()
 *
 *  Availability:
 *    Non-Carbon CFM:   in SpeechRecognitionLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SRStopListening(recognizer: SRRecognizer): OSErr; external name '_SRStopListening';
{
 *  SRSetLanguageModel()
 *
 *  Availability:
 *    Non-Carbon CFM:   in SpeechRecognitionLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SRSetLanguageModel(recognizer: SRRecognizer; languageModel: SRLanguageModel): OSErr; external name '_SRSetLanguageModel';
{
 *  SRGetLanguageModel()
 *
 *  Availability:
 *    Non-Carbon CFM:   in SpeechRecognitionLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SRGetLanguageModel(recognizer: SRRecognizer; var languageModel: SRLanguageModel): OSErr; external name '_SRGetLanguageModel';
{
 *  SRContinueRecognition()
 *
 *  Availability:
 *    Non-Carbon CFM:   in SpeechRecognitionLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SRContinueRecognition(recognizer: SRRecognizer): OSErr; external name '_SRContinueRecognition';
{
 *  SRCancelRecognition()
 *
 *  Availability:
 *    Non-Carbon CFM:   in SpeechRecognitionLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SRCancelRecognition(recognizer: SRRecognizer): OSErr; external name '_SRCancelRecognition';
{
 *  SRIdle()
 *
 *  Availability:
 *    Non-Carbon CFM:   in SpeechRecognitionLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SRIdle: OSErr; external name '_SRIdle';
{ Language Model Building and Manipulation Functions }
{
 *  SRNewLanguageModel()
 *
 *  Availability:
 *    Non-Carbon CFM:   in SpeechRecognitionLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SRNewLanguageModel(system: SRRecognitionSystem; var model: SRLanguageModel; name: UnivPtr; nameLength: Size): OSErr; external name '_SRNewLanguageModel';
{
 *  SRNewPath()
 *
 *  Availability:
 *    Non-Carbon CFM:   in SpeechRecognitionLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SRNewPath(system: SRRecognitionSystem; var path: SRPath): OSErr; external name '_SRNewPath';
{
 *  SRNewPhrase()
 *
 *  Availability:
 *    Non-Carbon CFM:   in SpeechRecognitionLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SRNewPhrase(system: SRRecognitionSystem; var phrase: SRPhrase; text: UnivPtr; textLength: Size): OSErr; external name '_SRNewPhrase';
{
 *  SRNewWord()
 *
 *  Availability:
 *    Non-Carbon CFM:   in SpeechRecognitionLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SRNewWord(system: SRRecognitionSystem; var word: SRWord; text: UnivPtr; textLength: Size): OSErr; external name '_SRNewWord';
{ Operations on any object of the SRLanguageObject family }
{
 *  SRPutLanguageObjectIntoHandle()
 *
 *  Availability:
 *    Non-Carbon CFM:   in SpeechRecognitionLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SRPutLanguageObjectIntoHandle(languageObject: SRLanguageObject; lobjHandle: Handle): OSErr; external name '_SRPutLanguageObjectIntoHandle';
{
 *  SRPutLanguageObjectIntoDataFile()
 *
 *  Availability:
 *    Non-Carbon CFM:   in SpeechRecognitionLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SRPutLanguageObjectIntoDataFile(languageObject: SRLanguageObject; fRefNum: SInt16): OSErr; external name '_SRPutLanguageObjectIntoDataFile';
{
 *  SRNewLanguageObjectFromHandle()
 *
 *  Availability:
 *    Non-Carbon CFM:   in SpeechRecognitionLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SRNewLanguageObjectFromHandle(system: SRRecognitionSystem; var languageObject: SRLanguageObject; lObjHandle: Handle): OSErr; external name '_SRNewLanguageObjectFromHandle';
{
 *  SRNewLanguageObjectFromDataFile()
 *
 *  Availability:
 *    Non-Carbon CFM:   in SpeechRecognitionLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SRNewLanguageObjectFromDataFile(system: SRRecognitionSystem; var languageObject: SRLanguageObject; fRefNum: SInt16): OSErr; external name '_SRNewLanguageObjectFromDataFile';
{
 *  SREmptyLanguageObject()
 *
 *  Availability:
 *    Non-Carbon CFM:   in SpeechRecognitionLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SREmptyLanguageObject(languageObject: SRLanguageObject): OSErr; external name '_SREmptyLanguageObject';
{
 *  SRChangeLanguageObject()
 *
 *  Availability:
 *    Non-Carbon CFM:   in SpeechRecognitionLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SRChangeLanguageObject(languageObject: SRLanguageObject; text: UnivPtr; textLength: Size): OSErr; external name '_SRChangeLanguageObject';
{
 *  SRAddLanguageObject()
 *
 *  Availability:
 *    Non-Carbon CFM:   in SpeechRecognitionLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SRAddLanguageObject(base: SRLanguageObject; addon: SRLanguageObject): OSErr; external name '_SRAddLanguageObject';
{
 *  SRAddText()
 *
 *  Availability:
 *    Non-Carbon CFM:   in SpeechRecognitionLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SRAddText(base: SRLanguageObject; text: UnivPtr; textLength: Size; refCon: SInt32): OSErr; external name '_SRAddText';
{
 *  SRRemoveLanguageObject()
 *
 *  Availability:
 *    Non-Carbon CFM:   in SpeechRecognitionLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SRRemoveLanguageObject(base: SRLanguageObject; toRemove: SRLanguageObject): OSErr; external name '_SRRemoveLanguageObject';
{ Traversing SRRecognitionResults or SRLanguageObjects }
{
 *  SRCountItems()
 *
 *  Availability:
 *    Non-Carbon CFM:   in SpeechRecognitionLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SRCountItems(container: SRSpeechObject; var count: SInt32): OSErr; external name '_SRCountItems';
{
 *  SRGetIndexedItem()
 *
 *  Availability:
 *    Non-Carbon CFM:   in SpeechRecognitionLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SRGetIndexedItem(container: SRSpeechObject; var item: SRSpeechObject; index: SInt32): OSErr; external name '_SRGetIndexedItem';
{
 *  SRSetIndexedItem()
 *
 *  Availability:
 *    Non-Carbon CFM:   in SpeechRecognitionLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SRSetIndexedItem(container: SRSpeechObject; item: SRSpeechObject; index: SInt32): OSErr; external name '_SRSetIndexedItem';
{
 *  SRRemoveIndexedItem()
 *
 *  Availability:
 *    Non-Carbon CFM:   in SpeechRecognitionLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SRRemoveIndexedItem(container: SRSpeechObject; index: SInt32): OSErr; external name '_SRRemoveIndexedItem';
{ Utilizing the System Feedback Window }
{
 *  SRDrawText()
 *
 *  Availability:
 *    Non-Carbon CFM:   in SpeechRecognitionLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SRDrawText(recognizer: SRRecognizer; dispText: UnivPtr; dispLength: Size): OSErr; external name '_SRDrawText';
{
 *  SRDrawRecognizedText()
 *
 *  Availability:
 *    Non-Carbon CFM:   in SpeechRecognitionLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SRDrawRecognizedText(recognizer: SRRecognizer; dispText: UnivPtr; dispLength: Size): OSErr; external name '_SRDrawRecognizedText';
{
 *  SRSpeakText()
 *
 *  Availability:
 *    Non-Carbon CFM:   in SpeechRecognitionLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SRSpeakText(recognizer: SRRecognizer; speakText: UnivPtr; speakLength: Size): OSErr; external name '_SRSpeakText';
{
 *  SRSpeakAndDrawText()
 *
 *  Availability:
 *    Non-Carbon CFM:   in SpeechRecognitionLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SRSpeakAndDrawText(recognizer: SRRecognizer; text: UnivPtr; textLength: Size): OSErr; external name '_SRSpeakAndDrawText';
{
 *  SRStopSpeech()
 *
 *  Availability:
 *    Non-Carbon CFM:   in SpeechRecognitionLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SRStopSpeech(recognizer: SRRecognizer): OSErr; external name '_SRStopSpeech';
{
 *  SRSpeechBusy()
 *
 *  Availability:
 *    Non-Carbon CFM:   in SpeechRecognitionLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SRSpeechBusy(recognizer: SRRecognizer): boolean; external name '_SRSpeechBusy';
{
 *  SRProcessBegin()
 *
 *  Availability:
 *    Non-Carbon CFM:   in SpeechRecognitionLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SRProcessBegin(recognizer: SRRecognizer; failed: boolean): OSErr; external name '_SRProcessBegin';
{
 *  SRProcessEnd()
 *
 *  Availability:
 *    Non-Carbon CFM:   in SpeechRecognitionLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SRProcessEnd(recognizer: SRRecognizer; failed: boolean): OSErr; external name '_SRProcessEnd';
{$ALIGN MAC68K}
{#POP}
{unit SpeechSynthesis}
{$ALIGN MAC68K}








{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}


const
    kTextToSpeechSynthType      = $74747363 (* 'ttsc' *);
    kTextToSpeechVoiceType      = $74747664 (* 'ttvd' *);
    kTextToSpeechVoiceFileType  = $74747666 (* 'ttvf' *);
    kTextToSpeechVoiceBundleType = $74747662 (* 'ttvb' *);

    kNoEndingProsody            = 1;
    kNoSpeechInterrupt          = 2;
    kPreflightThenPause         = 4;

    kImmediate                  = 0;
    kEndOfWord                  = 1;
    kEndOfSentence              = 2;


    {   ------------------------------------------  }
    {    GetSpeechInfo & SetSpeechInfo selectors    }
    {   ------------------------------------------  }
    soStatus                    = $73746174 (* 'stat' *);
    soErrors                    = $6572726F (* 'erro' *);
    soInputMode                 = $696E7074 (* 'inpt' *);
    soCharacterMode             = $63686172 (* 'char' *);
    soNumberMode                = $6E6D6272 (* 'nmbr' *);
    soRate                      = $72617465 (* 'rate' *);
    soPitchBase                 = $70626173 (* 'pbas' *);
    soPitchMod                  = $706D6F64 (* 'pmod' *);
    soVolume                    = $766F6C6D (* 'volm' *);
    soSynthType                 = $76657273 (* 'vers' *);
    soRecentSync                = $73796E63 (* 'sync' *);
    soPhonemeSymbols            = $70687379 (* 'phsy' *);
    soCurrentVoice              = $63766F78 (* 'cvox' *);
    soCommandDelimiter          = $646C696D (* 'dlim' *);
    soReset                     = $72736574 (* 'rset' *);
    soCurrentA5                 = $6D794135 (* 'myA5' *);
    soRefCon                    = $72656663 (* 'refc' *);
    soTextDoneCallBack          = $74646362 (* 'tdcb' *);                       {  use with SpeechTextDoneProcPtr }
    soSpeechDoneCallBack        = $73646362 (* 'sdcb' *);                       {  use with SpeechDoneProcPtr }
    soSyncCallBack              = $73796362 (* 'sycb' *);                       {  use with SpeechSyncProcPtr }
    soErrorCallBack             = $65726362 (* 'ercb' *);                       {  use with SpeechErrorProcPtr }
    soPhonemeCallBack           = $70686362 (* 'phcb' *);                       {  use with SpeechPhonemeProcPtr }
    soWordCallBack              = $77646362 (* 'wdcb' *);
    soSynthExtension            = $78746E64 (* 'xtnd' *);
    soSoundOutput               = $736E646F (* 'sndo' *);


    {   ------------------------------------------  }
    {    Speaking Mode Constants                    }
    {   ------------------------------------------  }
    modeText                    = $54455854 (* 'TEXT' *);                       {  input mode constants              }
    modePhonemes                = $50484F4E (* 'PHON' *);
    modeNormal                  = $4E4F524D (* 'NORM' *);                       {  character mode and number mode constants  }
    modeLiteral                 = $4C54524C (* 'LTRL' *);


    soVoiceDescription          = $696E666F (* 'info' *);
    soVoiceFile                 = $66726566 (* 'fref' *);



type
    SpeechChannel    = ^SInt32; { an opaque 32-bit type }
    SpeechChannelPtr = ^SpeechChannel;  { when a var xx:SpeechChannel parameter can be nil, it is changed to xx: SpeechChannelPtr }

    VoiceSpecPtr = ^VoiceSpec;
    VoiceSpec = record
        creator:                OSType;
        id:                     OSType;
    end;



const
    kNeuter                     = 0;
    kMale                       = 1;
    kFemale                     = 2;





type
    VoiceDescriptionPtr = ^VoiceDescription;
    VoiceDescription = record
        length:                 SInt32;
        voice:                  VoiceSpec;
        version:                SInt32;
        name:                   Str63;
        comment:                Str255;
        gender:                 SInt16;
        age:                    SInt16;
        script:                 SInt16;
        language:               SInt16;
        region:                 SInt16;
        reserved:               array [0..3] of SInt32;
    end;



    VoiceFileInfoPtr = ^VoiceFileInfo;
    VoiceFileInfo = record
        fileSpec:               FSSpec;
        resID:                  SInt16;
    end;

    SpeechStatusInfoPtr = ^SpeechStatusInfo;
    SpeechStatusInfo = record
        outputBusy:             boolean;
        outputPaused:           boolean;
        inputBytesLeft:         SInt32;
        phonemeCode:            SInt16;
    end;



    SpeechErrorInfoPtr = ^SpeechErrorInfo;
    SpeechErrorInfo = record
        count:                  SInt16;
        oldest:                 OSErr;
        oldPos:                 SInt32;
        newest:                 OSErr;
        newPos:                 SInt32;
    end;



    SpeechVersionInfoPtr = ^SpeechVersionInfo;
    SpeechVersionInfo = record
        synthType:              OSType;
        synthSubType:           OSType;
        synthManufacturer:      OSType;
        synthFlags:             SInt32;
        synthVersion:           NumVersion;
    end;



    PhonemeInfoPtr = ^PhonemeInfo;
    PhonemeInfo = record
        opcode:                 SInt16;
        phStr:                  Str15;
        exampleStr:             Str31;
        hiliteStart:            SInt16;
        hiliteEnd:              SInt16;
    end;


    PhonemeDescriptorPtr = ^PhonemeDescriptor;
    PhonemeDescriptor = record
        phonemeCount:           SInt16;
        thePhonemes:            array [0..0] of PhonemeInfo;
    end;

    SpeechXtndDataPtr = ^SpeechXtndData;
    SpeechXtndData = packed record
        synthCreator:           OSType;
        synthData:              packed array [0..1] of Byte;
    end;


    DelimiterInfoPtr = ^DelimiterInfo;
    DelimiterInfo = packed record
        startDelimiter:         packed array [0..1] of Byte;
        endDelimiter:           packed array [0..1] of Byte;
    end;


    SpeechTextDoneProcPtr = procedure(chan: SpeechChannel; refCon: SInt32; var nextBuf: UnivPtr; var byteLen: UInt32; var controlFlags: SInt32);

    SpeechDoneProcPtr = procedure(chan: SpeechChannel; refCon: SInt32);

    SpeechSyncProcPtr = procedure(chan: SpeechChannel; refCon: SInt32; syncMessage: OSType);

    SpeechErrorProcPtr = procedure(chan: SpeechChannel; refCon: SInt32; theError: OSErr; bytePos: SInt32);

    SpeechPhonemeProcPtr = procedure(chan: SpeechChannel; refCon: SInt32; phonemeOpcode: SInt16);

    SpeechWordProcPtr = procedure(chan: SpeechChannel; refCon: SInt32; wordPos: UInt32; wordLen: UInt16);

    SpeechTextDoneUPP = ^SInt32; { an opaque UPP }
    SpeechDoneUPP = ^SInt32; { an opaque UPP }
    SpeechSyncUPP = ^SInt32; { an opaque UPP }
    SpeechErrorUPP = ^SInt32; { an opaque UPP }
    SpeechPhonemeUPP = ^SInt32; { an opaque UPP }
    SpeechWordUPP = ^SInt32; { an opaque UPP }

const
    uppSpeechTextDoneProcInfo = $0000FFC0;
    uppSpeechDoneProcInfo = $000003C0;
    uppSpeechSyncProcInfo = $00000FC0;
    uppSpeechErrorProcInfo = $00003BC0;
    uppSpeechPhonemeProcInfo = $00000BC0;
    uppSpeechWordProcInfo = $00002FC0;
    {
     *  NewSpeechTextDoneUPP()
     *
     *  Availability:
     *    Non-Carbon CFM:   available as macro/inline
     *    CarbonLib:        in CarbonLib 1.0.2 and later
     *    Mac OS X:         in version 10.0 and later
        }
function NewSpeechTextDoneUPP(userRoutine: SpeechTextDoneProcPtr): SpeechTextDoneUPP; external name '_NewSpeechTextDoneUPP'; { old name was NewSpeechTextDoneProc }
{
 *  NewSpeechDoneUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewSpeechDoneUPP(userRoutine: SpeechDoneProcPtr): SpeechDoneUPP; external name '_NewSpeechDoneUPP'; { old name was NewSpeechDoneProc }
{
 *  NewSpeechSyncUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewSpeechSyncUPP(userRoutine: SpeechSyncProcPtr): SpeechSyncUPP; external name '_NewSpeechSyncUPP'; { old name was NewSpeechSyncProc }
{
 *  NewSpeechErrorUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewSpeechErrorUPP(userRoutine: SpeechErrorProcPtr): SpeechErrorUPP; external name '_NewSpeechErrorUPP'; { old name was NewSpeechErrorProc }
{
 *  NewSpeechPhonemeUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewSpeechPhonemeUPP(userRoutine: SpeechPhonemeProcPtr): SpeechPhonemeUPP; external name '_NewSpeechPhonemeUPP'; { old name was NewSpeechPhonemeProc }
{
 *  NewSpeechWordUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewSpeechWordUPP(userRoutine: SpeechWordProcPtr): SpeechWordUPP; external name '_NewSpeechWordUPP'; { old name was NewSpeechWordProc }
{
 *  DisposeSpeechTextDoneUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeSpeechTextDoneUPP(userUPP: SpeechTextDoneUPP); external name '_DisposeSpeechTextDoneUPP';
{
 *  DisposeSpeechDoneUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeSpeechDoneUPP(userUPP: SpeechDoneUPP); external name '_DisposeSpeechDoneUPP';
{
 *  DisposeSpeechSyncUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeSpeechSyncUPP(userUPP: SpeechSyncUPP); external name '_DisposeSpeechSyncUPP';
{
 *  DisposeSpeechErrorUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeSpeechErrorUPP(userUPP: SpeechErrorUPP); external name '_DisposeSpeechErrorUPP';
{
 *  DisposeSpeechPhonemeUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeSpeechPhonemeUPP(userUPP: SpeechPhonemeUPP); external name '_DisposeSpeechPhonemeUPP';
{
 *  DisposeSpeechWordUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeSpeechWordUPP(userUPP: SpeechWordUPP); external name '_DisposeSpeechWordUPP';
{
 *  InvokeSpeechTextDoneUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvokeSpeechTextDoneUPP(chan: SpeechChannel; refCon: SInt32; var nextBuf: UnivPtr; var byteLen: UInt32; var controlFlags: SInt32; userRoutine: SpeechTextDoneUPP); external name '_InvokeSpeechTextDoneUPP'; { old name was CallSpeechTextDoneProc }
{
 *  InvokeSpeechDoneUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvokeSpeechDoneUPP(chan: SpeechChannel; refCon: SInt32; userRoutine: SpeechDoneUPP); external name '_InvokeSpeechDoneUPP'; { old name was CallSpeechDoneProc }
{
 *  InvokeSpeechSyncUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvokeSpeechSyncUPP(chan: SpeechChannel; refCon: SInt32; syncMessage: OSType; userRoutine: SpeechSyncUPP); external name '_InvokeSpeechSyncUPP'; { old name was CallSpeechSyncProc }
{
 *  InvokeSpeechErrorUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvokeSpeechErrorUPP(chan: SpeechChannel; refCon: SInt32; theError: OSErr; bytePos: SInt32; userRoutine: SpeechErrorUPP); external name '_InvokeSpeechErrorUPP'; { old name was CallSpeechErrorProc }
{
 *  InvokeSpeechPhonemeUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvokeSpeechPhonemeUPP(chan: SpeechChannel; refCon: SInt32; phonemeOpcode: SInt16; userRoutine: SpeechPhonemeUPP); external name '_InvokeSpeechPhonemeUPP'; { old name was CallSpeechPhonemeProc }
{
 *  InvokeSpeechWordUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvokeSpeechWordUPP(chan: SpeechChannel; refCon: SInt32; wordPos: UInt32; wordLen: UInt16; userRoutine: SpeechWordUPP); external name '_InvokeSpeechWordUPP'; { old name was CallSpeechWordProc }
{
 *  SpeechManagerVersion()
 *
 *  Availability:
 *    Non-Carbon CFM:   in SpeechLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SpeechManagerVersion: NumVersion; external name '_SpeechManagerVersion';
{
 *  MakeVoiceSpec()
 *
 *  Availability:
 *    Non-Carbon CFM:   in SpeechLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function MakeVoiceSpec(creator: OSType; id: OSType; var voice: VoiceSpec): OSErr; external name '_MakeVoiceSpec';
{
 *  CountVoices()
 *
 *  Availability:
 *    Non-Carbon CFM:   in SpeechLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CountVoices(var numVoices: SInt16): OSErr; external name '_CountVoices';
{
 *  GetIndVoice()
 *
 *  Availability:
 *    Non-Carbon CFM:   in SpeechLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetIndVoice(index: SInt16; var voice: VoiceSpec): OSErr; external name '_GetIndVoice';
{
 *  GetVoiceDescription()
 *
 *  Availability:
 *    Non-Carbon CFM:   in SpeechLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetVoiceDescription(const (*var*) voice: VoiceSpec; var info: VoiceDescription; infoLength: SInt32): OSErr; external name '_GetVoiceDescription';
{
 *  GetVoiceInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in SpeechLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetVoiceInfo(const (*var*) voice: VoiceSpec; selector: OSType; voiceInfo: UnivPtr): OSErr; external name '_GetVoiceInfo';
{
 *  NewSpeechChannel()
 *
 *  Availability:
 *    Non-Carbon CFM:   in SpeechLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewSpeechChannel(voice: VoiceSpecPtr; var chan: SpeechChannel): OSErr; external name '_NewSpeechChannel';
{
 *  DisposeSpeechChannel()
 *
 *  Availability:
 *    Non-Carbon CFM:   in SpeechLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DisposeSpeechChannel(chan: SpeechChannel): OSErr; external name '_DisposeSpeechChannel';
{
 *  SpeakString()
 *
 *  Availability:
 *    Non-Carbon CFM:   in SpeechLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SpeakString(const (*var*) textToBeSpoken: Str255): OSErr; external name '_SpeakString';
{
 *  SpeakText()
 *
 *  Availability:
 *    Non-Carbon CFM:   in SpeechLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SpeakText(chan: SpeechChannel; textBuf: UnivPtr; textBytes: UInt32): OSErr; external name '_SpeakText';
{
 *  SpeakBuffer()
 *
 *  Availability:
 *    Non-Carbon CFM:   in SpeechLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SpeakBuffer(chan: SpeechChannel; textBuf: UnivPtr; textBytes: UInt32; controlFlags: SInt32): OSErr; external name '_SpeakBuffer';
{
 *  StopSpeech()
 *
 *  Availability:
 *    Non-Carbon CFM:   in SpeechLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function StopSpeech(chan: SpeechChannel): OSErr; external name '_StopSpeech';
{
 *  StopSpeechAt()
 *
 *  Availability:
 *    Non-Carbon CFM:   in SpeechLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function StopSpeechAt(chan: SpeechChannel; whereToStop: SInt32): OSErr; external name '_StopSpeechAt';
{
 *  PauseSpeechAt()
 *
 *  Availability:
 *    Non-Carbon CFM:   in SpeechLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PauseSpeechAt(chan: SpeechChannel; whereToPause: SInt32): OSErr; external name '_PauseSpeechAt';
{
 *  ContinueSpeech()
 *
 *  Availability:
 *    Non-Carbon CFM:   in SpeechLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ContinueSpeech(chan: SpeechChannel): OSErr; external name '_ContinueSpeech';
{
 *  SpeechBusy()
 *
 *  Availability:
 *    Non-Carbon CFM:   in SpeechLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SpeechBusy: SInt16; external name '_SpeechBusy';
{
 *  SpeechBusySystemWide()
 *
 *  Availability:
 *    Non-Carbon CFM:   in SpeechLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SpeechBusySystemWide: SInt16; external name '_SpeechBusySystemWide';
{
 *  SetSpeechRate()
 *
 *  Availability:
 *    Non-Carbon CFM:   in SpeechLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetSpeechRate(chan: SpeechChannel; rate: Fixed): OSErr; external name '_SetSpeechRate';
{
 *  GetSpeechRate()
 *
 *  Availability:
 *    Non-Carbon CFM:   in SpeechLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetSpeechRate(chan: SpeechChannel; var rate: Fixed): OSErr; external name '_GetSpeechRate';
{
 *  SetSpeechPitch()
 *
 *  Availability:
 *    Non-Carbon CFM:   in SpeechLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetSpeechPitch(chan: SpeechChannel; pitch: Fixed): OSErr; external name '_SetSpeechPitch';
{
 *  GetSpeechPitch()
 *
 *  Availability:
 *    Non-Carbon CFM:   in SpeechLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetSpeechPitch(chan: SpeechChannel; var pitch: Fixed): OSErr; external name '_GetSpeechPitch';
{
 *  SetSpeechInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in SpeechLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetSpeechInfo(chan: SpeechChannel; selector: OSType; speechInfo: UnivPtr): OSErr; external name '_SetSpeechInfo';
{
 *  GetSpeechInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in SpeechLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetSpeechInfo(chan: SpeechChannel; selector: OSType; speechInfo: UnivPtr): OSErr; external name '_GetSpeechInfo';
{
 *  TextToPhonemes()
 *
 *  Availability:
 *    Non-Carbon CFM:   in SpeechLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TextToPhonemes(chan: SpeechChannel; textBuf: UnivPtr; textBytes: UInt32; phonemeBuf: Handle; var phonemeBytes: SInt32): OSErr; external name '_TextToPhonemes';
{
 *  UseDictionary()
 *
 *  Availability:
 *    Non-Carbon CFM:   in SpeechLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function UseDictionary(chan: SpeechChannel; dictionary: Handle): OSErr; external name '_UseDictionary';
{$ALIGN MAC68K}
{#POP}
{unit ABActions}
{$ALIGN MAC68K}






// --------------------------------------------------------------------------------
//      Action Support
// --------------------------------------------------------------------------------
// This API allows developers to populate AddressBook.app's roll-over menus with custom
// entries. Your CFBundle must implement a function named ABActionRegisterCallbacks which
// will return a pointer to an ABActionCallbacks struct. This struct should be filled out
// as follows:
//
// version: The version of this structure is 0.
//
// proprty: A pointer to a function that returns the AddressBook property this action applies
// to. Only items with labels may have actions at this time. (emails, phones, birthdays, etc)
//
// title: A pointer to a function which returns a copy of the title to be displayed. This function
// takes two parameters, the selected person and item identifier. The item identifier will be NULL
// for single value properties. AddressBook will release this string when it's done with it.
//
// enabled: A pointer to a function which returns YES if the action should be enabled for the
// passed ABPersonRef and item identifier. The item identifier will be NULL for single value
// properties. This field may be NULL. Actions with NULL enabled callbacks will always be enabled.
//
// selected. A pointer to a function which will be called when the user selects this action.
// It's passed an ABPersonRef and item identifier. The item identifier will be NULL for single
// value properties.
//
// Action plugins are stored in ~/Library/Address Book Plug-Ins or /Library/Address Book Plug-Ins
//
// There can be only 1 Action plug in per bundle.

type ABActionGetPropertyCallback = function: CFStringRef;
type ABActionCopyTitleCallback = function( person: ABPersonRef; identifier: CFStringRef ): CFStringRef;
type ABActionEnabledCallback = function( person: ABPersonRef; identifier: CFStringRef ): Boolean;
type ABActionSelectedCallback = procedure( person: ABPersonRef; identifier: CFStringRef );

type ABActionCallbacks = record
    version: CFIndex;
    proprty: ABActionGetPropertyCallback;
    title: ABActionCopyTitleCallback;
    enabled: ABActionEnabledCallback;
    selected: ABActionSelectedCallback;
end;

// Your CFBundle MUST include a function named ABActionRegisterCallbacks which returns a pointer
// to a filled out ABActionCallbacks struct:
//
// ABActionCallbacks* ABActionRegisterCallbacks(void);
{unit ATSTypes}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}


type
    FMGeneration                        = UInt32;
    {    The FMFontFamily reference represents a collection of fonts with the same design
       characteristics. It replaces the standard QuickDraw font identifer and may be used
       with all QuickDraw functions including GetFontName and TextFont. It cannot be used
       with the Resource Manager to access information from a FOND resource handle. A font
       reference does not imply a particular script system, nor is the character encoding
       of a font family determined by an arithmetic mapping of its value.
        }
    FMFontFamily                        = SInt16;
    FMFontStyle                         = SInt16;
    FMFontStylePtr                      = ^FMFontStyle; { when a VAR xx: FMFontStyle parameter can be nil, it is changed to xx: FMFontStylePtr }
    FMFontSize                          = SInt16;
    FMFontSizePtr                       = ^FMFontSize; { when a VAR xx: FMFontSize parameter can be nil, it is changed to xx: FMFontSizePtr }
    {
       The font family is a collection of fonts, each of which is identified
       by an FMFont reference that maps to a single object registered with
       the font database. The font references associated with the font
       family consist of individual outline and bitmapped fonts that may be
       used with the font access routines of the Font Manager and ATS.
        }
    FMFont                              = UInt32;
    FMFontPtr                           = ^FMFont; { when a VAR xx: FMFont parameter can be nil, it is changed to xx: FMFontPtr }
    FMFontFamilyInstancePtr = ^FMFontFamilyInstance;
    FMFontFamilyInstance = record
        fontFamily:             FMFontFamily;
        fontStyle:              FMFontStyle;
    end;

    FMFontFamilyIteratorPtr = ^FMFontFamilyIterator;
    FMFontFamilyIterator = record
        reserved:               array [0..15] of UInt32;
    end;

    FMFontIteratorPtr = ^FMFontIterator;
    FMFontIterator = record
        reserved:               array [0..15] of UInt32;
    end;

    FMFontFamilyInstanceIteratorPtr = ^FMFontFamilyInstanceIterator;
    FMFontFamilyInstanceIterator = record
        reserved:               array [0..15] of UInt32;
    end;


const
    kInvalidGeneration          = 0;
    kInvalidFontFamily          = -1;
    kInvalidFont                = 0;

    kFMCurrentFilterFormat      = 0;

    {    kFMDefaultOptions & kFMUseGlobalScopeOption moved to Fonts.h   }

type
    FMFilterSelector            = UInt32;
const
    kFMFontTechnologyFilterSelector = 1;
    kFMFontContainerFilterSelector = 2;
    kFMGenerationFilterSelector = 3;
    kFMFontFamilyCallbackFilterSelector = 4;
    kFMFontCallbackFilterSelector = 5;
    kFMFontDirectoryFilterSelector = 6;

    kFMTrueTypeFontTechnology   = $74727565 (* 'true' *);
    kFMPostScriptFontTechnology = $74797031 (* 'typ1' *);


type
    FMFontFamilyCallbackFilterProcPtr = function(iFontFamily: FMFontFamily; iRefCon: UnivPtr): OSStatus;

    FMFontCallbackFilterProcPtr = function(iFont: FMFont; iRefCon: UnivPtr): OSStatus;

    FMFontFamilyCallbackFilterUPP = ^SInt32; { an opaque UPP }
    FMFontCallbackFilterUPP = ^SInt32; { an opaque UPP }

const
    uppFMFontFamilyCallbackFilterProcInfo = $000003B0;
    uppFMFontCallbackFilterProcInfo = $000003F0;
    {
     *  NewFMFontFamilyCallbackFilterUPP()
     *
     *  Availability:
     *    Non-Carbon CFM:   available as macro/inline
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function NewFMFontFamilyCallbackFilterUPP(userRoutine: FMFontFamilyCallbackFilterProcPtr): FMFontFamilyCallbackFilterUPP; external name '_NewFMFontFamilyCallbackFilterUPP'; { old name was NewFMFontFamilyCallbackFilterProc }
{
 *  NewFMFontCallbackFilterUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewFMFontCallbackFilterUPP(userRoutine: FMFontCallbackFilterProcPtr): FMFontCallbackFilterUPP; external name '_NewFMFontCallbackFilterUPP'; { old name was NewFMFontCallbackFilterProc }
{
 *  DisposeFMFontFamilyCallbackFilterUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeFMFontFamilyCallbackFilterUPP(userUPP: FMFontFamilyCallbackFilterUPP); external name '_DisposeFMFontFamilyCallbackFilterUPP';
{
 *  DisposeFMFontCallbackFilterUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeFMFontCallbackFilterUPP(userUPP: FMFontCallbackFilterUPP); external name '_DisposeFMFontCallbackFilterUPP';
{
 *  InvokeFMFontFamilyCallbackFilterUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeFMFontFamilyCallbackFilterUPP(iFontFamily: FMFontFamily; iRefCon: UnivPtr; userRoutine: FMFontFamilyCallbackFilterUPP): OSStatus; external name '_InvokeFMFontFamilyCallbackFilterUPP'; { old name was CallFMFontFamilyCallbackFilterProc }
{
 *  InvokeFMFontCallbackFilterUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeFMFontCallbackFilterUPP(iFont: FMFont; iRefCon: UnivPtr; userRoutine: FMFontCallbackFilterUPP): OSStatus; external name '_InvokeFMFontCallbackFilterUPP'; { old name was CallFMFontCallbackFilterProc }
type
    FMFontDirectoryFilterPtr = ^FMFontDirectoryFilter;
    FMFontDirectoryFilter = record
        fontFolderDomain:       SInt16;
        reserved:               array [0..1] of UInt32;
    end;

    FMFilterPtr = ^FMFilter;
    FMFilter = record
        format:                 UInt32;
        selector:               FMFilterSelector;
        case SInt16 of
        0: (
            fontTechnologyFilter: FourCharCode;
            );
        1: (
            fontContainerFilter: FSSpec;
            );
        2: (
            generationFilter:   FMGeneration;
            );
        3: (
            fontFamilyCallbackFilter: FMFontFamilyCallbackFilterUPP;
            );
        4: (
            fontCallbackFilter: FMFontCallbackFilterUPP;
            );
        5: (
            fontDirectoryFilter: FMFontDirectoryFilter;
            );
    end;

    ATSOptionFlags                      = OptionBits;
    ATSGeneration                       = UInt32;
    ATSFontContainerRef                 = UInt32;
    ATSFontFamilyRef                    = UInt32;
    ATSFontRef                          = UInt32;
    ATSGlyphRef                         = UInt16;
    ATSFontSize                         = Float32;

const
    kATSGenerationUnspecified   = 0;
    kATSFontContainerRefUnspecified = 0;
    kATSFontFamilyRefUnspecified = 0;
    kATSFontRefUnspecified      = 0;


type
    ATSFontMetricsPtr = ^ATSFontMetrics;
    ATSFontMetrics = record
        version:                UInt32;
        ascent:                 Float32;                                {  Maximum height above baseline reached by the glyphs in the font  }
                                                                        {  or maximum distance to the right of the centerline reached by the glyphs in the font  }
        descent:                Float32;                                {  Maximum depth below baseline reached by the glyphs in the font  }
                                                                        {  or maximum distance to the left of the centerline reached by the glyphs in the font  }
        leading:                Float32;                                {  Desired spacing between lines of text  }
        avgAdvanceWidth:        Float32;
        maxAdvanceWidth:        Float32;                                {  Maximum advance width or height of the glyphs in the font  }
        minLeftSideBearing:     Float32;                                {  Minimum left or top side bearing  }
        minRightSideBearing:    Float32;                                {  Minimum right or bottom side bearing  }
        stemWidth:              Float32;                                {  Width of the dominant vertical stems of the glyphs in the font  }
        stemHeight:             Float32;                                {  Vertical width of the dominant horizontal stems of glyphs in the font  }
        capHeight:              Float32;                                {  Height of a capital letter from the baseline to the top of the letter  }
        xHeight:                Float32;                                {  Height of lowercase characters in a font, specifically the letter x, excluding ascenders and descenders  }
        italicAngle:            Float32;                                {  Angle in degrees counterclockwise from the vertical of the dominant vertical strokes of the glyphs in the font  }
        underlinePosition:      Float32;                                {  Distance from the baseline for positioning underlining strokes  }
        underlineThickness:     Float32;                                {  Stroke width for underlining  }
    end;


const
    kATSItalicQDSkew            = $00004000;                    {  fixed value of 0.25  }
    kATSBoldQDStretch           = $00018000;                    {  fixed value of 1.50  }
    kATSRadiansFactor           = 1144;                         {  fixed value of approx. pi/180 (0.0174560546875)  }

    {    Glyph outline path constants used in ATSFontGetNativeCurveType.    }

type
    ATSCurveType                = UInt16;
const
    kATSCubicCurveType          = $0001;
    kATSQuadCurveType           = $0002;
    kATSOtherCurveType          = $0003;

{
    This is what the ATSGlyphRef is set to when the glyph is deleted -
    that is, when the glyph is set to no longer appear when the layout
    is actually drawn
}
const
  kATSDeletedGlyphcode          = $FFFF;


type
    ATSUCurvePathPtr = ^ATSUCurvePath;
    ATSUCurvePath = record
        vectors:                UInt32;
        controlBits:            array [0..0] of UInt32;
        vector:                 array [0..0] of Float32Point;
    end;

    ATSUCurvePathsPtr = ^ATSUCurvePaths;
    ATSUCurvePaths = record
        contours:               UInt32;
        contour:                array [0..0] of ATSUCurvePath;
    end;

    {    Glyph ideal metrics    }
    ATSGlyphIdealMetricsPtr = ^ATSGlyphIdealMetrics;
    ATSGlyphIdealMetrics = record
        advance:                Float32Point;
        sideBearing:            Float32Point;
        otherSideBearing:       Float32Point;
    end;

    {    Glyph screen metrics   }
    ATSGlyphScreenMetricsPtr = ^ATSGlyphScreenMetrics;
    ATSGlyphScreenMetrics = record
        deviceAdvance:          Float32Point;
        topLeft:                Float32Point;
        height:                 UInt32;
        width:                  UInt32;
        sideBearing:            Float32Point;
        otherSideBearing:       Float32Point;
    end;

    GlyphID                             = ATSGlyphRef;
    GlyphIDPtr = ^GlyphID;
{$ALIGN MAC68K}
{#POP}
{unit AXUIElement}
{$ALIGN MAC68K}






function AXAPIEnabled: Boolean; external name '_AXAPIEnabled';

type
    AXUIElementRef    = ^SInt32; { an opaque 32-bit type }

function AXUIElementGetTypeID: CFTypeID; external name '_AXUIElementGetTypeID';

function AXUIElementCopyAttributeNames( element: AXUIElementRef; var names: CFArrayRef ): AXError; external name '_AXUIElementCopyAttributeNames';
function AXUIElementCopyAttributeValue( element: AXUIElementRef; attribute: CFStringRef; var value: CFTypeRef ): AXError; external name '_AXUIElementCopyAttributeValue';
function AXUIElementGetAttributeValueCount( element: AXUIElementRef; attribute: CFStringRef; var count: CFIndex ): AXError; external name '_AXUIElementGetAttributeValueCount';
function AXUIElementCopyAttributeValues( element: AXUIElementRef; attribute: CFStringRef; index: CFIndex; maxValues: CFIndex; var values: CFArrayRef ): AXError; external name '_AXUIElementCopyAttributeValues';
function AXUIElementIsAttributeSettable( element: AXUIElementRef; attribute: CFStringRef; var settable: Boolean ): AXError; external name '_AXUIElementIsAttributeSettable';
function AXUIElementSetAttributeValue( element: AXUIElementRef; attribute: CFStringRef; value: CFTypeRef ): AXError; external name '_AXUIElementSetAttributeValue';

function AXUIElementCopyParameterizedAttributeNames( element: AXUIElementRef; var names: CFArrayRef ): AXError; external name '_AXUIElementCopyParameterizedAttributeNames';
function AXUIElementCopyParameterizedAttributeValue( element: AXUIElementRef; parameterizedAttribute: CFStringRef; parameter: CFTypeRef; var result: CFTypeRef ): AXError; external name '_AXUIElementCopyParameterizedAttributeValue';

function AXUIElementCopyActionNames( element: AXUIElementRef; var names: CFArrayRef ): AXError; external name '_AXUIElementCopyActionNames';
function AXUIElementCopyActionDescription( element: AXUIElementRef; action: CFStringRef; var description: CFStringRef ): AXError; external name '_AXUIElementCopyActionDescription';
function AXUIElementPerformAction( element: AXUIElementRef; action: CFStringRef ): AXError; external name '_AXUIElementPerformAction';

function AXUIElementCopyElementAtPosition( application: AXUIElementRef; x: Float32; y: Float32; var element: AXUIElementRef ): AXError; external name '_AXUIElementCopyElementAtPosition';

function AXUIElementCreateApplication( pid: pid_t ): AXUIElementRef; external name '_AXUIElementCreateApplication';
function AXUIElementCreateSystemWide: AXUIElementRef; external name '_AXUIElementCreateSystemWide';

function AXUIElementGetPid( element: AXUIElementRef; var pid: pid_t ): AXError; external name '_AXUIElementGetPid';

// see CGRemoteOperation.h for documentation of parameters
// you can only pass the root or application uielement
function AXUIElementPostKeyboardEvent( application: AXUIElementRef; keyChar: CGCharCode; virtualKey: CGKeyCode; keyDown: Boolean ): AXError; external name '_AXUIElementPostKeyboardEvent';


// Notification APIs
type
    AXObserverRef    = ^SInt32; { an opaque 32-bit type }

type AXObserverCallback = procedure( observer: AXObserverRef; element: AXUIElementRef; notification: CFStringRef; refcon: UnivPtr );

function AXObserverGetTypeID: CFTypeID; external name '_AXObserverGetTypeID';

function AXObserverCreate( application: pid_t; callback: AXObserverCallback; var outObserver: AXObserverRef ): AXError; external name '_AXObserverCreate';

function AXObserverAddNotification( observer: AXObserverRef; element: AXUIElementRef; notification: CFStringRef; refcon: UnivPtr ): AXError; external name '_AXObserverAddNotification';
function AXObserverRemoveNotification( observer: AXObserverRef; element: AXUIElementRef; notification: CFStringRef ): AXError; external name '_AXObserverRemoveNotification';

function AXObserverGetRunLoopSource( observer: AXObserverRef ): CFRunLoopSourceRef; external name '_AXObserverGetRunLoopSource';
{unit Aliases}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}


const
    rAliasType                  = $616C6973 (* 'alis' *);                       {  Aliases are stored as resources of this type  }

                                                                {  define alias resolution action rules mask  }
    kARMMountVol                = $00000001;                    {  mount the volume automatically  }
    kARMNoUI                    = $00000002;                    {  no user interface allowed during resolution  }
    kARMMultVols                = $00000008;                    {  search on multiple volumes  }
    kARMSearch                  = $00000100;                    {  search quickly  }
    kARMSearchMore              = $00000200;                    {  search further  }
    kARMSearchRelFirst          = $00000400;                    {  search target on a relative path first  }

                                                                {  define alias record information types  }
    asiZoneName                 = -3;                           {  get zone name  }
    asiServerName               = -2;                           {  get server name  }
    asiVolumeName               = -1;                           {  get volume name  }
    asiAliasName                = 0;                            {  get aliased file/folder/volume name  }
    asiParentName               = 1;                            {  get parent folder name  }

    {    ResolveAliasFileWithMountFlags options     }
    kResolveAliasFileNoUI       = $00000001;                    {  no user interaction during resolution  }

    {    define the alias record that will be the blackbox for the caller   }

type
    AliasRecordPtr = ^AliasRecord;
    AliasRecord = record
        userType:               OSType;                                 {  appl stored type like creator type  }
        aliasSize:              UInt16;                                 {  alias record size in bytes, for appl usage  }
    end;

    AliasPtr                            = ^AliasRecord;
    AliasHandle                         = ^AliasPtr;
    {    alias record information type  }
    AliasInfoType                       = SInt16;
    {
     *  NewAlias()
     *
     *  Summary:
     *    create a new alias between fromFile and target, returns alias
     *    record handle
     *
     *  Availability:
     *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function NewAlias(fromFile: {Const}FSSpecPtr; const (*var*) target: FSSpec; var alias: AliasHandle): OSErr; external name '_NewAlias';
{
 *  NewAliasMinimal()
 *
 *  Summary:
 *    create a minimal new alias for a target and return alias record
 *    handle
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewAliasMinimal(const (*var*) target: FSSpec; var alias: AliasHandle): OSErr; external name '_NewAliasMinimal';
{
 *  NewAliasMinimalFromFullPath()
 *
 *  Summary:
 *    create a minimal new alias from a target fullpath (optional zone
 *    and server name) and return alias record handle
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewAliasMinimalFromFullPath(fullPathLength: SInt16; fullPath: UnivPtr; const (*var*) zoneName: Str32; const (*var*) serverName: Str31; var alias: AliasHandle): OSErr; external name '_NewAliasMinimalFromFullPath';
{
 *  ResolveAlias()
 *
 *  Summary:
 *    given an alias handle and fromFile, resolve the alias, update the
 *    alias record and return aliased filename and wasChanged flag.
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ResolveAlias(fromFile: {Const}FSSpecPtr; alias: AliasHandle; var target: FSSpec; var wasChanged: boolean): OSErr; external name '_ResolveAlias';
{
 *  GetAliasInfo()
 *
 *  Summary:
 *    given an alias handle and an index specifying requested alias
 *    information type, return the information from alias record as a
 *    string.
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetAliasInfo(alias: AliasHandle; index: AliasInfoType; var theString: Str63): OSErr; external name '_GetAliasInfo';
{
 *  IsAliasFile()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function IsAliasFile(const (*var*) fileFSSpec: FSSpec; var aliasFileFlag: boolean; var folderFlag: boolean): OSErr; external name '_IsAliasFile';
{
 *  ResolveAliasWithMountFlags()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ResolveAliasWithMountFlags(fromFile: {Const}FSSpecPtr; alias: AliasHandle; var target: FSSpec; var wasChanged: boolean; mountFlags: UInt32): OSErr; external name '_ResolveAliasWithMountFlags';
{
 *  ResolveAliasFile()
 *
 *  Summary:
 *    Given a file spec, return target file spec if input file spec is
 *    an alias. It resolves the entire alias chain or one step of the
 *    chain.  It returns info about whether the target is a folder or
 *    file; and whether the input file spec was an alias or not.
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ResolveAliasFile(var theSpec: FSSpec; resolveAliasChains: boolean; var targetIsFolder: boolean; var wasAliased: boolean): OSErr; external name '_ResolveAliasFile';
{
 *  ResolveAliasFileWithMountFlags()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ResolveAliasFileWithMountFlags(var theSpec: FSSpec; resolveAliasChains: boolean; var targetIsFolder: boolean; var wasAliased: boolean; mountFlags: UInt32): OSErr; external name '_ResolveAliasFileWithMountFlags';
{
 *  FollowFinderAlias()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FollowFinderAlias(fromFile: {Const}FSSpecPtr; alias: AliasHandle; logon: boolean; var target: FSSpec; var wasChanged: boolean): OSErr; external name '_FollowFinderAlias';
{
   Low Level Routines
}
{
 *  UpdateAlias()
 *
 *  Summary:
 *    given a fromFile-target pair and an alias handle, update the
 *    alias record pointed to by alias handle to represent target as
 *    the new alias.
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function UpdateAlias(fromFile: {Const}FSSpecPtr; const (*var*) target: FSSpec; alias: AliasHandle; var wasChanged: boolean): OSErr; external name '_UpdateAlias';
type
    AliasFilterProcPtr = function(cpbPtr: CInfoPBPtr; var quitFlag: boolean; myDataPtr: Ptr): boolean;

    AliasFilterUPP = ^SInt32; { an opaque UPP }

const
    uppAliasFilterProcInfo = $00000FD0;
    {
     *  NewAliasFilterUPP()
     *
     *  Availability:
     *    Non-Carbon CFM:   available as macro/inline
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function NewAliasFilterUPP(userRoutine: AliasFilterProcPtr): AliasFilterUPP; external name '_NewAliasFilterUPP'; { old name was NewAliasFilterProc }
{
 *  DisposeAliasFilterUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeAliasFilterUPP(userUPP: AliasFilterUPP); external name '_DisposeAliasFilterUPP';
{
 *  InvokeAliasFilterUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeAliasFilterUPP(cpbPtr: CInfoPBPtr; var quitFlag: boolean; myDataPtr: Ptr; userRoutine: AliasFilterUPP): boolean; external name '_InvokeAliasFilterUPP'; { old name was CallAliasFilterProc }
{
 *  MatchAlias()
 *
 *  Summary:
 *    Given an alias handle and fromFile, match the alias and return
 *    aliased filename(s) and needsUpdate flag
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function MatchAlias(fromFile: {Const}FSSpecPtr; rulesMask: UInt32; alias: AliasHandle; var aliasCount: SInt16; aliasList: FSSpecArrayPtr; var needsUpdate: boolean; aliasFilter: AliasFilterUPP; yourDataPtr: UnivPtr): OSErr; external name '_MatchAlias';
{
 *  ResolveAliasFileWithMountFlagsNoUI()
 *
 *  Summary:
 *    variation on ResolveAliasFile that does not prompt user with a
 *    dialog
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ResolveAliasFileWithMountFlagsNoUI(var theSpec: FSSpec; resolveAliasChains: boolean; var targetIsFolder: boolean; var wasAliased: boolean; mountFlags: UInt32): OSErr; external name '_ResolveAliasFileWithMountFlagsNoUI';

{
 *  MatchAliasNoUI()
 *
 *  Summary:
 *    variation on MatchAlias that does not prompt user with a dialog
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function MatchAliasNoUI(fromFile: {Const}FSSpecPtr; rulesMask: UInt32; alias: AliasHandle; var aliasCount: SInt16; aliasList: FSSpecArrayPtr; var needsUpdate: boolean; aliasFilter: AliasFilterUPP; yourDataPtr: UnivPtr): OSErr; external name '_MatchAliasNoUI';

{
 *  FSNewAlias()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.1 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FSNewAlias(fromFile: {Const}FSRefPtr; const (*var*) target: FSRef; var inAlias: AliasHandle): OSErr; external name '_FSNewAlias';
{
 *  FSNewAliasMinimal()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.1 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FSNewAliasMinimal(const (*var*) target: FSRef; var inAlias: AliasHandle): OSErr; external name '_FSNewAliasMinimal';
{
 *  FSIsAliasFile()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.1 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FSIsAliasFile(const (*var*) fileRef: FSRef; var aliasFileFlag: boolean; var folderFlag: boolean): OSErr; external name '_FSIsAliasFile';
{
 *  FSResolveAliasWithMountFlags()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.1 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FSResolveAliasWithMountFlags(fromFile: {Const}FSRefPtr; inAlias: AliasHandle; var target: FSRef; var wasChanged: boolean; mountFlags: UInt32): OSErr; external name '_FSResolveAliasWithMountFlags';
{
 *  FSResolveAlias()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.1 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FSResolveAlias(fromFile: {Const}FSRefPtr; alias: AliasHandle; var target: FSRef; var wasChanged: boolean): OSErr; external name '_FSResolveAlias';
{
 *  FSResolveAliasFileWithMountFlags()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.1 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FSResolveAliasFileWithMountFlags(var theRef: FSRef; resolveAliasChains: boolean; var targetIsFolder: boolean; var wasAliased: boolean; mountFlags: UInt32): OSErr; external name '_FSResolveAliasFileWithMountFlags';
{
 *  FSResolveAliasFile()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.1 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FSResolveAliasFile(var theRef: FSRef; resolveAliasChains: boolean; var targetIsFolder: boolean; var wasAliased: boolean): OSErr; external name '_FSResolveAliasFile';
{
 *  FSFollowFinderAlias()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.1 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FSFollowFinderAlias(fromFile: FSRefPtr; alias: AliasHandle; logon: boolean; var target: FSRef; var wasChanged: boolean): OSErr; external name '_FSFollowFinderAlias';
{
 *  FSUpdateAlias()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.1 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FSUpdateAlias(fromFile: {Const}FSRefPtr; const (*var*) target: FSRef; alias: AliasHandle; var wasChanged: boolean): OSErr; external name '_FSUpdateAlias';
{$ALIGN MAC68K}
{#POP}
{unit AppleHelp}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}

{ AppleHelp Error Codes }

const
    kAHInternalErr              = -10790;
    kAHInternetConfigPrefErr    = -10791;



type
    AHTOCType                   = SInt16;
const
    kAHTOCTypeUser              = 0;
    kAHTOCTypeDeveloper         = 1;

    {
     *  AHSearch()
     *
     *  Discussion:
     *    Delivers a request to perform the specified search to the Help
     *    Viewer application.
     *
     *  Parameters:
     *
     *    bookname:
     *      Optionally, the AppleTitle of the Help book to be searched. If
     *      NULL, all installed Help books are searched.
     *
     *    query:
     *      The query to be made. This string can, if desired, have boolean
     *      operators or be a natural language phrase.
     *
     *  Result:
     *    An operating system result code that indicates whether the
     *    request was successfully sent to the Help Viewer application.
     *    Possible values: noErr, paramErr, kAHInternalErr,
     *    kAHInternetConfigPrefErr.
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.1 and later
     *    Mac OS X:         in version 10.0 and later
        }
function AHSearch(bookname: CFStringRef; query: CFStringRef): OSStatus; external name '_AHSearch';

{
 *  AHGotoMainTOC()
 *
 *  Discussion:
 *    Delivers a request to load the main table of contents of
 *    installed help books to the Help Viewer application.
 *
 *  Parameters:
 *
 *    toctype:
 *      The type of table of contents to be loaded: user or developer.
 *
 *  Result:
 *    An operating system result code that indicates whether the
 *    request was successfully sent to the Help Viewer application.
 *    Possible values: noErr, paramErr, kAHInternalErr,
 *    kAHInternetConfigPrefErr.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function AHGotoMainTOC(toctype: AHTOCType): OSStatus; external name '_AHGotoMainTOC';

{
 *  AHGotoPage()
 *
 *  Discussion:
 *    Delivers a request to load a specific text/html file to the Help
 *    Viewer application.
 *
 *  Parameters:
 *
 *    bookname:
 *      Optionally, the AppleTitle of an installed Help book. If NULL,
 *      the path parameter must be a full file: URL to the file to be
 *      opened.
 *
 *    path:
 *      Optionally, one of two types of paths: 1) a URL-style path to a
 *      file that is relative to the main folder of the book supplied
 *      in the bookname parameter, or 2) if bookname is NULL, a full
 *      file: URL to the file to be opened. If this parameter is NULL,
 *      then bookname must not be NULL, and is used to open the Help
 *      Viewer to the main page of Help content for the specified book.
 *
 *    anchor:
 *      Optionally, the name of anchor tag to scroll to in the newly
 *      opened file. Can be NULL.
 *
 *  Result:
 *    An operating system result code that indicates whether the
 *    request was successfully sent to the Help Viewer application.
 *    Possible values: noErr, paramErr, kAHInternalErr,
 *    kAHInternetConfigPrefErr.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function AHGotoPage(bookname: CFStringRef; path: CFStringRef; anchor: CFStringRef): OSStatus; external name '_AHGotoPage';

{
 *  AHLookupAnchor()
 *
 *  Discussion:
 *    Delivers a request to perform an anchor lookup to the Help Viewer
 *    application. Note: anchor lookups will fail unless you have
 *    indexed your help content with anchor indexing turned on in the
 *    indexing tool's preferences panel.
 *
 *  Parameters:
 *
 *    bookname:
 *      Optionally, the AppleTitle of the Help book to searched. If
 *      NULL, the anchor lookup is performed using all installed Help
 *      books.
 *
 *    anchor:
 *      The name of the anchor tag to look up.
 *
 *  Result:
 *    An operating system result code that indicates whether the
 *    request was successfully sent to the Help Viewer application.
 *    Possible values: noErr, paramErr, kAHInternalErr,
 *    kAHInternetConfigPrefErr.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function AHLookupAnchor(bookname: CFStringRef; anchor: CFStringRef): OSStatus; external name '_AHLookupAnchor';


{
 *  AHRegisterHelpBook()
 *
 *  Discussion:
 *    Registers a book of Help content such that the book will appear
 *    in the current user's main table of contents (Help Center) in the
 *    Help Viewer application. To be used when help books reside
 *    outside of the known help folders (i.e. help books that are kept
 *    inside of application bundles).
 *
 *  Parameters:
 *
 *    appBundleRef:
 *      An FSRef pointer to the bundle within which one or more Help
 *      books is stored. This is likely an FSRef to your application's
 *      main bundle.
 *
 *  Result:
 *    An operating system result code that indicates whether all help
 *    books contained within the specified bundle were registered.
 *    Possible values: noErr, paramErr, kAHInternalErr, dirNFErr.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function AHRegisterHelpBook(const (*var*) appBundleRef: FSRef): OSStatus; external name '_AHRegisterHelpBook';

{$ALIGN MAC68K}
{#POP}
{unit CFMachPort}
{$ALIGN MAC68K}






type
    CFMachPortRef    = ^SInt32; { an opaque 32-bit type }

type
    CFMachPortContext = record
    version: CFIndex;
    info: Ptr;
        retain: function( info: Ptr ): Ptr;
        release: procedure( info: Ptr );
        copyDescription: function( info: Ptr ): CFStringRef;
    end;
    CFMachPortContextPtr = ^CFMachPortContext;

type CFMachPortCallBack = procedure( port: CFMachPortRef; msg: UnivPtr; size: CFIndex; info: UnivPtr );
type CFMachPortInvalidationCallBack = procedure( port: CFMachPortRef; info: UnivPtr );

function CFMachPortGetTypeID: CFTypeID; external name '_CFMachPortGetTypeID';

function CFMachPortCreate( allocator: CFAllocatorRef; callout: CFMachPortCallBack; var context: CFMachPortContext; var shouldFreeInfo: Boolean ): CFMachPortRef; external name '_CFMachPortCreate';
function CFMachPortCreateWithPort( allocator: CFAllocatorRef; portNum: mach_port_t; callout: CFMachPortCallBack; var context: CFMachPortContext; var shouldFreeInfo: Boolean ): CFMachPortRef; external name '_CFMachPortCreateWithPort';

function CFMachPortGetPort( port: CFMachPortRef ): mach_port_t; external name '_CFMachPortGetPort';
procedure CFMachPortGetContext( port: CFMachPortRef; var context: CFMachPortContext ); external name '_CFMachPortGetContext';
procedure CFMachPortInvalidate( port: CFMachPortRef ); external name '_CFMachPortInvalidate';
function CFMachPortIsValid( port: CFMachPortRef ): Boolean; external name '_CFMachPortIsValid';
// GPC error: function result must not be a procedural type
// function CFMachPortGetInvalidationCallBack( port: CFMachPortRef ): CFMachPortInvalidationCallBack; external name '_CFMachPortGetInvalidationCallBack';
procedure CFMachPortSetInvalidationCallBack( port: CFMachPortRef; callout: CFMachPortInvalidationCallBack ); external name '_CFMachPortSetInvalidationCallBack';

function CFMachPortCreateRunLoopSource( allocator: CFAllocatorRef; port: CFMachPortRef; order: CFIndex ): CFRunLoopSourceRef; external name '_CFMachPortCreateRunLoopSource';
{unit CFMessagePort}
{$ALIGN MAC68K}






type
    CFMessagePortRef    = ^SInt32; { an opaque 32-bit type }

const
    kCFMessagePortSuccess = 0;
    kCFMessagePortSendTimeout = -1;
    kCFMessagePortReceiveTimeout = -2;
    kCFMessagePortIsInvalid = -3;
    kCFMessagePortTransportError = -4;

type
    CFMessagePortContext = record
    version: CFIndex;
    info: Ptr;
        retain: function( info: Ptr ): Ptr;
        release: procedure( info: Ptr );
        copyDescription: function( info: Ptr ): CFStringRef;
    end;
    CFMessagePortContextPtr = ^CFMessagePortContext;

type CFMessagePortCallBack = function( local: CFMessagePortRef; msgid: SInt32; data: CFDataRef; info: UnivPtr ): CFDataRef;
{ If callout wants to keep a hold of the data past the return of the callout, it must COPY the data. This includes the case where the data is given to some routine which _might_ keep a hold of it; System will release returned CFData. }
type CFMessagePortInvalidationCallBack = procedure( ms: CFMessagePortRef; info: UnivPtr );

function CFMessagePortGetTypeID: CFTypeID; external name '_CFMessagePortGetTypeID';

function CFMessagePortCreateLocal( allocator: CFAllocatorRef; name: CFStringRef; callout: CFMessagePortCallBack; var context: CFMessagePortContext; var shouldFreeInfo: Boolean ): CFMessagePortRef; external name '_CFMessagePortCreateLocal';
function CFMessagePortCreateRemote( allocator: CFAllocatorRef; name: CFStringRef ): CFMessagePortRef; external name '_CFMessagePortCreateRemote';

function CFMessagePortIsRemote( ms: CFMessagePortRef ): Boolean; external name '_CFMessagePortIsRemote';
function CFMessagePortGetName( ms: CFMessagePortRef ): CFStringRef; external name '_CFMessagePortGetName';
function CFMessagePortSetName( ms: CFMessagePortRef; newName: CFStringRef ): Boolean; external name '_CFMessagePortSetName';
procedure CFMessagePortGetContext( ms: CFMessagePortRef; var context: CFMessagePortContext ); external name '_CFMessagePortGetContext';
procedure CFMessagePortInvalidate( ms: CFMessagePortRef ); external name '_CFMessagePortInvalidate';
function CFMessagePortIsValid( ms: CFMessagePortRef ): Boolean; external name '_CFMessagePortIsValid';
// GPC error: function result must not be a procedural type
// function CFMessagePortGetInvalidationCallBack( ms: CFMessagePortRef ): CFMessagePortInvalidationCallBack; external name '_CFMessagePortGetInvalidationCallBack';
procedure CFMessagePortSetInvalidationCallBack( ms: CFMessagePortRef; callout: CFMessagePortInvalidationCallBack ); external name '_CFMessagePortSetInvalidationCallBack';

{ NULL replyMode argument means no return value expected, dont wait for it }
function CFMessagePortSendRequest( remote: CFMessagePortRef; msgid: SInt32; data: CFDataRef; sendTimeout: CFTimeInterval; rcvTimeout: CFTimeInterval; replyMode: CFStringRef; returnData: CFDataRefPtr ): SInt32; external name '_CFMessagePortSendRequest';

function CFMessagePortCreateRunLoopSource( allocator: CFAllocatorRef; local: CFMessagePortRef; order: CFIndex ): CFRunLoopSourceRef; external name '_CFMessagePortCreateRunLoopSource';
{unit CFPreferences}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}

var kCFPreferencesAnyApplication: CFStringRef; external name '_kCFPreferencesAnyApplication'; (* attribute const *)
{
 *  kCFPreferencesAnyApplication
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
var kCFPreferencesCurrentApplication: CFStringRef; external name '_kCFPreferencesCurrentApplication'; (* attribute const *)
{
 *  kCFPreferencesCurrentApplication
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
var kCFPreferencesAnyHost: CFStringRef; external name '_kCFPreferencesAnyHost'; (* attribute const *)
{
 *  kCFPreferencesAnyHost
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
var kCFPreferencesCurrentHost: CFStringRef; external name '_kCFPreferencesCurrentHost'; (* attribute const *)
{
 *  kCFPreferencesCurrentHost
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
var kCFPreferencesAnyUser: CFStringRef; external name '_kCFPreferencesAnyUser'; (* attribute const *)
{
 *  kCFPreferencesAnyUser
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
var kCFPreferencesCurrentUser: CFStringRef; external name '_kCFPreferencesCurrentUser'; (* attribute const *)
{
 *  kCFPreferencesCurrentUser
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
{    The "App" functions search the various sources of defaults that
    apply to the given application, and should never be called with
    kCFPreferencesAnyApplication - only kCFPreferencesCurrentApplication
    or an application's ID (its bundle identifier).
}
{ Searches the various sources of application defaults to find the
value for the given key. key must not be NULL.  If a value is found,
it returns it; otherwise returns NULL.  Caller must release the
returned value }
{
 *  CFPreferencesCopyAppValue()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFPreferencesCopyAppValue(key: CFStringRef; applicationID: CFStringRef): CFPropertyListRef; external name '_CFPreferencesCopyAppValue';

{ Convenience to interpret a preferences value as a boolean directly.
Returns FALSE if the key doesn't exist, or has an improper format; under
those conditions, keyExistsAndHasValidFormat (if non-NULL) is set to FALSE }
{
 *  CFPreferencesGetAppBooleanValue()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFPreferencesGetAppBooleanValue(key: CFStringRef; applicationID: CFStringRef; var keyExistsAndHasValidFormat: boolean): boolean; external name '_CFPreferencesGetAppBooleanValue';

{ Convenience to interpret a preferences value as an SInt16 directly.
Returns 0 if the key doesn't exist, or has an improper format; under
those conditions, keyExistsAndHasValidFormat (if non-NULL) is set to FALSE }
{
 *  CFPreferencesGetAppIntegerValue()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFPreferencesGetAppIntegerValue(key: CFStringRef; applicationID: CFStringRef; var keyExistsAndHasValidFormat: boolean): CFIndex; external name '_CFPreferencesGetAppIntegerValue';

{ Sets the given value for the given key in the "normal" place for
application preferences.  key must not be NULL.  If value is NULL,
key is removed instead. }
{
 *  CFPreferencesSetAppValue()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CFPreferencesSetAppValue(key: CFStringRef; value: CFPropertyListRef; applicationID: CFStringRef); external name '_CFPreferencesSetAppValue';

{ Adds the preferences for the given suite to the app preferences for
the specified application.  To write to the suite domain, use
CFPreferencesSetValue(), below, using the suiteName in place
of the appName }
{
 *  CFPreferencesAddSuitePreferencesToApp()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CFPreferencesAddSuitePreferencesToApp(applicationID: CFStringRef; suiteID: CFStringRef); external name '_CFPreferencesAddSuitePreferencesToApp';

{
 *  CFPreferencesRemoveSuitePreferencesFromApp()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CFPreferencesRemoveSuitePreferencesFromApp(applicationID: CFStringRef; suiteID: CFStringRef); external name '_CFPreferencesRemoveSuitePreferencesFromApp';

{ Writes all changes in all sources of application defaults.
Returns success or failure. }
{
 *  CFPreferencesAppSynchronize()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFPreferencesAppSynchronize(applicationID: CFStringRef): boolean; external name '_CFPreferencesAppSynchronize';

{ The primitive get mechanism; all arguments must be non-NULL
(use the constants above for common values).  Only the exact
location specified by app-user-host is searched.  The returned
CFType must be released by the caller when it is finished with it. }
{
 *  CFPreferencesCopyValue()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFPreferencesCopyValue(key: CFStringRef; applicationID: CFStringRef; userName: CFStringRef; hostName: CFStringRef): CFPropertyListRef; external name '_CFPreferencesCopyValue';

{ Convenience to fetch multiple keys at once.  Keys in
keysToFetch that are not present in the returned dictionary
are not present in the domain.  If keysToFetch is NULL, all
keys are fetched. }
{
 *  CFPreferencesCopyMultiple()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFPreferencesCopyMultiple(keysToFetch: CFArrayRef; applicationID: CFStringRef; userName: CFStringRef; hostName: CFStringRef): CFDictionaryRef; external name '_CFPreferencesCopyMultiple';

{ The primitive set function; all arguments except value must be
non-NULL.  If value is NULL, the given key is removed }
{
 *  CFPreferencesSetValue()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CFPreferencesSetValue(key: CFStringRef; value: CFPropertyListRef; applicationID: CFStringRef; userName: CFStringRef; hostName: CFStringRef); external name '_CFPreferencesSetValue';

{ Convenience to set multiple values at once.  Behavior is undefined
if a key is in both keysToSet and keysToRemove }
{
 *  CFPreferencesSetMultiple()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CFPreferencesSetMultiple(keysToSet: CFDictionaryRef; keysToRemove: CFArrayRef; applicationID: CFStringRef; userName: CFStringRef; hostName: CFStringRef); external name '_CFPreferencesSetMultiple';

{
 *  CFPreferencesSynchronize()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFPreferencesSynchronize(applicationID: CFStringRef; userName: CFStringRef; hostName: CFStringRef): boolean; external name '_CFPreferencesSynchronize';

{ Constructs and returns the list of the name of all applications
which have preferences in the scope of the given user and host.
The returned value must be released by the caller; neither argument
may be NULL. }
{
 *  CFPreferencesCopyApplicationList()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFPreferencesCopyApplicationList(userName: CFStringRef; hostName: CFStringRef): CFArrayRef; external name '_CFPreferencesCopyApplicationList';

{ Constructs and returns the list of all keys set in the given
location.  The returned value must be released by the caller;
all arguments must be non-NULL }
{
 *  CFPreferencesCopyKeyList()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFPreferencesCopyKeyList(applicationID: CFStringRef; userName: CFStringRef; hostName: CFStringRef): CFArrayRef; external name '_CFPreferencesCopyKeyList';

{$ALIGN MAC68K}
{#POP}
{unit CFURL}
{$ALIGN MAC68K}










{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}


type
    CFURLPathStyle              = SInt32;
const
    kCFURLPOSIXPathStyle        = 0;
    kCFURLHFSPathStyle          = 1;
    kCFURLWindowsPathStyle      = 2;


type
    CFURLRef    = ^SInt32; { an opaque 32-bit type }
    CFURLRefPtr = ^CFURLRef;  { when a var xx:CFURLRef parameter can be nil, it is changed to xx: CFURLRefPtr }
    {    CFURLs are composed of two fundamental pieces - their string, and a    }
    {    (possibly NULL) base URL.  A relative URL is one in which the string   }
    {    by itself does not fully specify the URL (for instance "myDir/image.tiff");    }
    {    an absolute URL is one in which the string does fully specify the URL  }
    {    ("file://localhost/myDir/image.tiff").  Absolute URLs always have NULL     }
    {    base URLs; however, it is possible for a URL to have a NULL base, and still    }
    {    not be absolute.  Such a URL has only a relative string, and cannot be     }
    {    resolved.  Two CFURLs are considered equal if and only if their strings    }
    {    are equal and their bases are equal.  In other words,  }
    {    "file://localhost/myDir/image.tiff" is NOT equal to the URL with relative  }
    {    string "myDir/image.tiff" and base URL "file://localhost/".  Clients that  }
    {    need these less strict form of equality should convert all URLs to their   }
    {    absolute form via CFURLCopyAbsoluteURL(), then compare the absolute forms.     }
    {
     *  CFURLGetTypeID()
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function CFURLGetTypeID: CFTypeID; external name '_CFURLGetTypeID';

{ encoding will be used both to interpret the bytes of URLBytes, and to }
{ interpret any percent-escapes within the bytes. }
{
 *  CFURLCreateWithBytes()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFURLCreateWithBytes(allocator: CFAllocatorRef; URLBytes: UInt8Ptr; length: CFIndex; encoding: CFStringEncoding; baseURL: CFURLRef): CFURLRef; external name '_CFURLCreateWithBytes';

{ Escapes any character that is not 7-bit ASCII with the byte-code }
{ for the given encoding.  If escapeWhitespace is true, whitespace }
{ characters (' ', '\t', '\r', '\n') will be escaped also (desirable }
{ if embedding the URL into a larger text stream like HTML) }
{
 *  CFURLCreateData()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFURLCreateData(allocator: CFAllocatorRef; url: CFURLRef; encoding: CFStringEncoding; escapeWhitespace: boolean): CFDataRef; external name '_CFURLCreateData';

{ Any escape sequences in URLString will be interpreted via UTF-8. }
{
 *  CFURLCreateWithString()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFURLCreateWithString(allocator: CFAllocatorRef; URLString: CFStringRef; baseURL: CFURLRef): CFURLRef; external name '_CFURLCreateWithString';

{ filePath should be the URL's path expressed as a path of the type }
{ fsType.  If filePath is not absolute, the resulting URL will be }
{ considered relative to the current working directory (evaluated }
{ at creation time).  isDirectory determines whether filePath is }
{ treated as a directory path when resolving against relative path }
{ components }
{
 *  CFURLCreateWithFileSystemPath()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFURLCreateWithFileSystemPath(allocator: CFAllocatorRef; filePath: CFStringRef; pathStyle: CFURLPathStyle; isDirectory: boolean): CFURLRef; external name '_CFURLCreateWithFileSystemPath';

{
 *  CFURLCreateFromFileSystemRepresentation()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFURLCreateFromFileSystemRepresentation(allocator: CFAllocatorRef; buffer: UInt8Ptr; bufLen: CFIndex; isDirectory: boolean): CFURLRef; external name '_CFURLCreateFromFileSystemRepresentation';

{
 *  CFURLCreateWithFileSystemPathRelativeToBase()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFURLCreateWithFileSystemPathRelativeToBase(allocator: CFAllocatorRef; filePath: CFStringRef; pathStyle: CFURLPathStyle; isDirectory: boolean; baseURL: CFURLRef): CFURLRef; external name '_CFURLCreateWithFileSystemPathRelativeToBase';

{
 *  CFURLCreateFromFileSystemRepresentationRelativeToBase()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFURLCreateFromFileSystemRepresentationRelativeToBase(allocator: CFAllocatorRef; buffer: UInt8Ptr; bufLen: CFIndex; isDirectory: boolean; baseURL: CFURLRef): CFURLRef; external name '_CFURLCreateFromFileSystemRepresentationRelativeToBase';

{ Fills buffer with the file system's native representation of }
{ url's path. No more than maxBufLen bytes are written to buffer. }
{ The buffer should be at least the maximum path length for }
{ the file system in question to avoid failures for insufficiently }
{ large buffers.  If resolveAgainstBase is true, the url's relative }
{ portion is resolved against its base before the path is computed. }
{ Returns success or failure. }
{
 *  CFURLGetFileSystemRepresentation()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFURLGetFileSystemRepresentation(url: CFURLRef; resolveAgainstBase: boolean; buffer: CStringPtr; maxBufLen: CFIndex): boolean; external name '_CFURLGetFileSystemRepresentation';

{ Creates a new URL by resolving the relative portion of relativeURL against its base. }
{
 *  CFURLCopyAbsoluteURL()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFURLCopyAbsoluteURL(relativeURL: CFURLRef): CFURLRef; external name '_CFURLCopyAbsoluteURL';

{ Returns the URL's string. }
{
 *  CFURLGetString()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFURLGetString(anURL: CFURLRef): CFStringRef; external name '_CFURLGetString';

{ Returns the base URL if it exists }
{
 *  CFURLGetBaseURL()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFURLGetBaseURL(anURL: CFURLRef): CFURLRef; external name '_CFURLGetBaseURL';

{
All URLs can be broken into two pieces - the scheme (preceding the
first colon) and the resource specifier (following the first colon).
Most URLs are also "standard" URLs conforming to RFC 1808 (available
from www.w3c.org).  This category includes URLs of the file, http,
https, and ftp schemes, to name a few.  Standard URLs start the
resource specifier with two slashes ("//"), and can be broken into
four distinct pieces - the scheme, the net location, the path, and
further resource specifiers (typically an optional parameter, query,
and/or fragment).  The net location appears immediately following
the two slashes and goes up to the next slash; it's format is
scheme-specific, but is usually composed of some or all of a username,
password, host name, and port.  The path is a series of path components
separated by slashes; if the net location is present, the path always
begins with a slash.  Standard URLs can be relative to another URL,
in which case at least the scheme and possibly other pieces as well
come from the base URL (see RFC 1808 for precise details when resolving
a relative URL against its base).  The full URL is therefore

<scheme> "://" <net location> <path, always starting with slash> <add'l resource specifiers>

If a given CFURL can be decomposed (that is, conforms to RFC 1808), you
can ask for each of the four basic pieces (scheme, net location, path,
and resource specifer) separately, as well as for its base URL.  The
basic pieces are returned with any percent escape sequences still in
place (although note that the scheme may not legally include any
percent escapes); this is to allow the caller to distinguish between
percent sequences that may have syntactic meaning if replaced by the
character being escaped (for instance, a '/' in a path component).
Since only the individual schemes know which characters are
syntactically significant, CFURL cannot safely replace any percent
escape sequences.  However, you can use
CFURLCreateStringByReplacingPercentEscapes() to create a new string with
the percent escapes removed; see below.

If a given CFURL can not be decomposed, you can ask for its scheme and its
resource specifier; asking it for its net location or path will return NULL.

To get more refined information about the components of a decomposable
CFURL, you may ask for more specific pieces of the URL, expressed with
the percent escapes removed.  The available functions are CFURLCopyHostName(),
CFURLGetPortNumber() (returns an Int32), CFURLCopyUserName(),
CFURLCopyPassword(), CFURLCopyQuery(), CFURLCopyParameters(), and
CFURLCopyFragment().  Because the parameters, query, and fragment of an
URL may contain scheme-specific syntaxes, these methods take a second
argument, giving a list of characters which should NOT be replaced if
percent escaped.  For instance, the ftp parameter syntax gives simple
key-value pairs as "<key>=<value>;"  Clearly if a key or value includes
either '=' or ';', it must be escaped to avoid corrupting the meaning of
the parameters, so the caller may request the parameter string as

CFStringRef myParams = CFURLCopyParameters(ftpURL, CFSTR("=;%"));

requesting that all percent escape sequences be replaced by the represented
characters, except for escaped '=', '%' or ';' characters.  Pass the empty
string (CFSTR("")) to request that all percent escapes be replaced, or NULL
to request that none be.
}
{ Returns TRUE if anURL conforms to RFC 1808 }
{
 *  CFURLCanBeDecomposed()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFURLCanBeDecomposed(anURL: CFURLRef): boolean; external name '_CFURLCanBeDecomposed';

{ The next several methods leave any percent escape sequences intact }
{
 *  CFURLCopyScheme()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFURLCopyScheme(anURL: CFURLRef): CFStringRef; external name '_CFURLCopyScheme';

{ NULL if CFURLCanBeDecomposed(anURL) is FALSE }
{
 *  CFURLCopyNetLocation()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFURLCopyNetLocation(anURL: CFURLRef): CFStringRef; external name '_CFURLCopyNetLocation';

{ NULL if CFURLCanBeDecomposed(anURL) is FALSE; also does not resolve the URL }
{ against its base.  See also CFURLCopyAbsoluteURL().  Note that, strictly }
{ speaking, any leading '/' is not considered part of the URL's path, although }
{ its presence or absence determines whether the path is absolute. }
{ CFURLCopyPath()'s return value includes any leading slash (giving the path }
{ the normal POSIX appearance); CFURLCopyStrictPath()'s return value omits any }
{ leading slash, and uses isAbsolute to report whether the URL's path is absolute. }
{ CFURLCopyFileSystemPath() returns the URL's path as a file system path for the }
{ given path style.  All percent escape sequences are replaced.  The URL is not }
{ resolved against its base before computing the path. }
{
 *  CFURLCopyPath()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFURLCopyPath(anURL: CFURLRef): CFStringRef; external name '_CFURLCopyPath';

{
 *  CFURLCopyStrictPath()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFURLCopyStrictPath(anURL: CFURLRef; var isAbsolute: boolean): CFStringRef; external name '_CFURLCopyStrictPath';

{
 *  CFURLCopyFileSystemPath()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFURLCopyFileSystemPath(anURL: CFURLRef; pathStyle: CFURLPathStyle): CFStringRef; external name '_CFURLCopyFileSystemPath';

{ Returns whether anURL's path represents a directory }
{ (TRUE returned) or a simple file (FALSE returned) }
{
 *  CFURLHasDirectoryPath()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFURLHasDirectoryPath(anURL: CFURLRef): boolean; external name '_CFURLHasDirectoryPath';

{ Any additional resource specifiers after the path.  For URLs }
{ that cannot be decomposed, this is everything except the scheme itself. }
{
 *  CFURLCopyResourceSpecifier()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFURLCopyResourceSpecifier(anURL: CFURLRef): CFStringRef; external name '_CFURLCopyResourceSpecifier';

{
 *  CFURLCopyHostName()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFURLCopyHostName(anURL: CFURLRef): CFStringRef; external name '_CFURLCopyHostName';

{
 *  CFURLGetPortNumber()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFURLGetPortNumber(anURL: CFURLRef): SInt32; external name '_CFURLGetPortNumber';

{ Returns -1 if no port number is specified }
{
 *  CFURLCopyUserName()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFURLCopyUserName(anURL: CFURLRef): CFStringRef; external name '_CFURLCopyUserName';

{
 *  CFURLCopyPassword()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFURLCopyPassword(anURL: CFURLRef): CFStringRef; external name '_CFURLCopyPassword';

{ These remove all percent escape sequences except those for }
{ characters in charactersToLeaveEscaped.  If charactersToLeaveEscaped }
{ is empty (""), all percent escape sequences are replaced by their }
{ corresponding characters.  If charactersToLeaveEscaped is NULL, }
{ then no escape sequences are removed at all }
{
 *  CFURLCopyParameterString()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFURLCopyParameterString(anURL: CFURLRef; charactersToLeaveEscaped: CFStringRef): CFStringRef; external name '_CFURLCopyParameterString';

{
 *  CFURLCopyQueryString()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFURLCopyQueryString(anURL: CFURLRef; charactersToLeaveEscaped: CFStringRef): CFStringRef; external name '_CFURLCopyQueryString';

{
 *  CFURLCopyFragment()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFURLCopyFragment(anURL: CFURLRef; charactersToLeaveEscaped: CFStringRef): CFStringRef; external name '_CFURLCopyFragment';

{
 *  CFURLCopyLastPathComponent()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFURLCopyLastPathComponent(url: CFURLRef): CFStringRef; external name '_CFURLCopyLastPathComponent';

{
 *  CFURLCopyPathExtension()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFURLCopyPathExtension(url: CFURLRef): CFStringRef; external name '_CFURLCopyPathExtension';

{ These functions all treat the base URL of the supplied url as }
{ invariant.  In other words, the URL returned will always have }
{ the same base as the URL supplied as an argument. }
{
 *  CFURLCreateCopyAppendingPathComponent()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFURLCreateCopyAppendingPathComponent(allocator: CFAllocatorRef; url: CFURLRef; pathComponent: CFStringRef; isDirectory: boolean): CFURLRef; external name '_CFURLCreateCopyAppendingPathComponent';

{
 *  CFURLCreateCopyDeletingLastPathComponent()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFURLCreateCopyDeletingLastPathComponent(allocator: CFAllocatorRef; url: CFURLRef): CFURLRef; external name '_CFURLCreateCopyDeletingLastPathComponent';

{
 *  CFURLCreateCopyAppendingPathExtension()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFURLCreateCopyAppendingPathExtension(allocator: CFAllocatorRef; url: CFURLRef; extension: CFStringRef): CFURLRef; external name '_CFURLCreateCopyAppendingPathExtension';

{
 *  CFURLCreateCopyDeletingPathExtension()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFURLCreateCopyDeletingPathExtension(allocator: CFAllocatorRef; url: CFURLRef): CFURLRef; external name '_CFURLCreateCopyDeletingPathExtension';

{ Returns a string with any percent escape sequences that do NOT }
{ correspond to characters in charactersToLeaveEscaped with their }
{ equivalent.  Returns NULL on failure (if an invalid percent sequence }
{ is encountered), or the original string (retained) if no characters }
{ need to be replaced. Pass NULL to request that no percent escapes be }
{ replaced, or the empty string (CFSTR("")) to request that all percent }
{ escapes be replaced. Uses UTF8 to interpret percent escapes. }
{
 *  CFURLCreateStringByReplacingPercentEscapes()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFURLCreateStringByReplacingPercentEscapes(allocator: CFAllocatorRef; originalString: CFStringRef; charactersToLeaveEscaped: CFStringRef): CFStringRef; external name '_CFURLCreateStringByReplacingPercentEscapes';

{
 *  CFURLCreateStringByAddingPercentEscapes()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFURLCreateStringByAddingPercentEscapes(allocator: CFAllocatorRef; originalString: CFStringRef; charactersToLeaveUnescaped: CFStringRef; legalURLCharactersToBeEscaped: CFStringRef; encoding: CFStringEncoding): CFStringRef; external name '_CFURLCreateStringByAddingPercentEscapes';

{
 *  CFURLCreateFromFSRef()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFURLCreateFromFSRef(allocator: CFAllocatorRef; const (*var*) fsRef: FSRef): CFURLRef; external name '_CFURLCreateFromFSRef';

{
 *  CFURLGetFSRef()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFURLGetFSRef(url: CFURLRef; var fsRef: FSRef): boolean; external name '_CFURLGetFSRef';

{$ALIGN MAC68K}
{#POP}
{unit CFURLAccess}
{$ALIGN MAC68K}










{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}

{ Attempts to read the data and properties for the given URL.  If
only interested in one of the resourceData and properties, pass NULL
for the other.  If properties is non-NULL and desiredProperties is
NULL, then all properties are fetched.  Returns success or failure;
note that as much work as possible is done even if FALSE is returned.
So for instance if one property is not available, the others are
fetched anyway. errorCode is set to 0 on success, and some other
value on failure.  If non-NULL, it is the caller 's responsibility
to release resourceData and properties.

    Apple reserves for its use all negative error code values; these
values represent errors common to any scheme.  Scheme-specific error
codes should be positive, non-zero, and should be used only if one of
the predefined Apple error codes does not apply.  Error codes should
be publicized and documented with the scheme-specific properties.
}
{
 *  CFURLCreateDataAndPropertiesFromResource()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFURLCreateDataAndPropertiesFromResource(alloc: CFAllocatorRef; url: CFURLRef; resourceData: CFDataRefPtr; properties: CFDictionaryRefPtr; desiredProperties: CFArrayRef; var errorCode: SInt32): boolean; external name '_CFURLCreateDataAndPropertiesFromResource';

{ Attempts to write the given data and properties to the given URL.
If dataToWrite is NULL, only properties are written out (use
CFURLDestroyResource() to delete a resource).  Properties not present
in propertiesToWrite are left unchanged, hence if propertiesToWrite
is NULL or empty, the URL's properties are not changed at all.
Returns success or failure; errorCode is set as for
CFURLCreateDataAndPropertiesFromResource(), above.
}
{
 *  CFURLWriteDataAndPropertiesToResource()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFURLWriteDataAndPropertiesToResource(url: CFURLRef; dataToWrite: CFDataRef; propertiesToWrite: CFDictionaryRef; var errorCode: SInt32): boolean; external name '_CFURLWriteDataAndPropertiesToResource';

{ Destroys the resource indicated by url. }
{ Returns success or failure; errorCode set as above. }
{
 *  CFURLDestroyResource()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFURLDestroyResource(url: CFURLRef; var errorCode: SInt32): boolean; external name '_CFURLDestroyResource';

{ Convenience method which calls through to CFURLCreateDataAndPropertiesFromResource(). }
{ Returns NULL on error and sets errorCode accordingly. }
{
 *  CFURLCreatePropertyFromResource()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFURLCreatePropertyFromResource(alloc: CFAllocatorRef; url: CFURLRef; proprty: CFStringRef; var errorCode: SInt32): CFTypeRef; external name '_CFURLCreatePropertyFromResource';

{ Common error codes; this list is expected to grow }

type
    CFURLError                  = SInt32;
const
    kCFURLUnknownError          = -10;
    kCFURLUnknownSchemeError    = -11;
    kCFURLResourceNotFoundError = -12;
    kCFURLResourceAccessViolationError = -13;
    kCFURLRemoteHostUnavailableError = -14;
    kCFURLImproperArgumentsError = -15;
    kCFURLUnknownPropertyKeyError = -16;
    kCFURLPropertyKeyUnavailableError = -17;
    kCFURLTimeoutError          = -18;

    {    Property keys  }
var kCFURLFileExists: CFStringRef; external name '_kCFURLFileExists'; (* attribute const *)
    {
     *  kCFURLFileExists
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.1 and later
     *    Mac OS X:         in version 10.0 and later
        }
var kCFURLFileDirectoryContents: CFStringRef; external name '_kCFURLFileDirectoryContents'; (* attribute const *)
    {
     *  kCFURLFileDirectoryContents
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.1 and later
     *    Mac OS X:         in version 10.0 and later
        }
var kCFURLFileLength: CFStringRef; external name '_kCFURLFileLength'; (* attribute const *)
    {
     *  kCFURLFileLength
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.1 and later
     *    Mac OS X:         in version 10.0 and later
        }
var kCFURLFileLastModificationTime: CFStringRef; external name '_kCFURLFileLastModificationTime'; (* attribute const *)
    {
     *  kCFURLFileLastModificationTime
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.1 and later
     *    Mac OS X:         in version 10.0 and later
        }
var kCFURLFilePOSIXMode: CFStringRef; external name '_kCFURLFilePOSIXMode'; (* attribute const *)
    {
     *  kCFURLFilePOSIXMode
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.1 and later
     *    Mac OS X:         in version 10.0 and later
        }
var kCFURLFileOwnerID: CFStringRef; external name '_kCFURLFileOwnerID'; (* attribute const *)
    {
     *  kCFURLFileOwnerID
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.1 and later
     *    Mac OS X:         in version 10.0 and later
        }
var kCFURLHTTPStatusCode: CFStringRef; external name '_kCFURLHTTPStatusCode'; (* attribute const *)
    {
     *  kCFURLHTTPStatusCode
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.1 and later
     *    Mac OS X:         in version 10.0 and later
        }
var kCFURLHTTPStatusLine: CFStringRef; external name '_kCFURLHTTPStatusLine'; (* attribute const *)
    {
     *  kCFURLHTTPStatusLine
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.1 and later
     *    Mac OS X:         in version 10.0 and later
        }
    {    The value of kCFURLFileExists is a CFBoolean   }
    {    The value of kCFURLFileDirectoryContents is a CFArray containing CFURLs.  An empty array means the directory exists, but is empty  }
    {    The value of kCFURLFileLength is a CFNumber giving the file's length in bytes  }
    {    The value of kCFURLFileLastModificationTime is a CFDate    }
    {    The value of kCFURLFilePOSIXMode is a CFNumber as given in stat.h  }
    {    The value of kCFURLFileOwnerID is a CFNumber representing the owner's uid  }
    {    Properties for the http: scheme.  Except for the common error codes, above, errorCode will be set to the HTTP response status code upon failure.  Any HTTP header name can also be used as a property  }
    {    The value of kCFURLHTTPStatusCode is a CFNumber    }
    {    The value of kCFURLHTTPStatusLine is a CFString    }
{$ALIGN MAC68K}
{#POP}
{unit CFUserNotification}
{$ALIGN MAC68K}






type
    CFUserNotificationRef    = ^SInt32; { an opaque 32-bit type }

{ A CFUserNotification is a notification intended to be presented to a
user at the console (if one is present).  This is for the use of processes
that do not otherwise have user interfaces, but may need occasional
interaction with a user.  There is a parallel API for this functionality
at the System framework level, described in UNCUserNotification.h.

The contents of the notification can include a header, a message, textfields,
a popup button, radio buttons or checkboxes, a progress indicator, and up to
three ordinary buttons.  All of these items are optional, but a default
button will be supplied even if not specified unless the
kCFUserNotificationNoDefaultButtonFlag is set.

The contents of the notification are specified in the dictionary used to
create the notification, whose keys should be taken from the list of constants
below, and whose values should be either strings or arrays of strings
(except for kCFUserNotificationProgressIndicatorValueKey, in which case the
value should be a number between 0 and 1, for a "definite" progress indicator,
or a boolean, for an "indefinite" progress indicator).  Additionally, URLs can
optionally be supplied for an icon, a sound, and a bundle whose Localizable.strings
files will be used to localize strings.

Certain request flags are specified when a notification is created.
These specify an alert level for the notification, determine whether
radio buttons or check boxes are to be used, specify which if any of these
are checked by default, specify whether any of the textfields are to
be secure textfields, and determine which popup item should be selected
by default.  A timeout is also specified, which determines how long the
notification should be supplied to the user (if zero, it will not timeout).

A CFUserNotification is dispatched for presentation when it is created.
If any reply is required, it may be awaited in one of two ways:  either
synchronously, using CFUserNotificationReceiveResponse, or asynchronously,
using a run loop source.  CFUserNotificationReceiveResponse has a timeout
parameter that determines how long it will block (zero meaning indefinitely)
and it may be called as many times as necessary until a response arrives.
If a notification has not yet received a response, it may be updated with
new information, or it may be cancelled.  Notifications may not be reused.

When a response arrives, it carries with it response flags that describe
which button was used to dismiss the notification, which checkboxes or
radio buttons were checked, and what the selection of the popup was.
It also carries a response dictionary, which describes the contents
of the textfields.  }

type CFUserNotificationCallBack = procedure( userNotification: CFUserNotificationRef; responseFlags: CFOptionFlags );

function CFUserNotificationGetTypeID: CFTypeID; external name '_CFUserNotificationGetTypeID';

function CFUserNotificationCreate( allocator: CFAllocatorRef; timeout: CFTimeInterval; flags: CFOptionFlags; var error: SInt32; dictionary: CFDictionaryRef ): CFUserNotificationRef; external name '_CFUserNotificationCreate';

function CFUserNotificationReceiveResponse( userNotification: CFUserNotificationRef; timeout: CFTimeInterval; var responseFlags: CFOptionFlags ): SInt32; external name '_CFUserNotificationReceiveResponse';

function CFUserNotificationGetResponseValue( userNotification: CFUserNotificationRef; key: CFStringRef; idx: CFIndex ): CFStringRef; external name '_CFUserNotificationGetResponseValue';

function CFUserNotificationGetResponseDictionary( userNotification: CFUserNotificationRef ): CFDictionaryRef; external name '_CFUserNotificationGetResponseDictionary';

function CFUserNotificationUpdate( userNotification: CFUserNotificationRef; timeout: CFTimeInterval; flags: CFOptionFlags; dictionary: CFDictionaryRef ): SInt32; external name '_CFUserNotificationUpdate';

function CFUserNotificationCancel( userNotification: CFUserNotificationRef ): SInt32; external name '_CFUserNotificationCancel';

function CFUserNotificationCreateRunLoopSource( allocator: CFAllocatorRef; userNotification: CFUserNotificationRef; callout: CFUserNotificationCallBack; order: CFIndex ): CFRunLoopSourceRef; external name '_CFUserNotificationCreateRunLoopSource';

{ Convenience functions for handling the simplest and most common cases:
a one-way notification, and a notification with up to three buttons. }

function CFUserNotificationDisplayNotice( timeout: CFTimeInterval; flags: CFOptionFlags; iconURL: CFURLRef; soundURL: CFURLRef; localizationURL: CFURLRef; alertHeader: CFStringRef; alertMessage: CFStringRef; defaultButtonTitle: CFStringRef ): SInt32; external name '_CFUserNotificationDisplayNotice';

function CFUserNotificationDisplayAlert( timeout: CFTimeInterval; flags: CFOptionFlags; iconURL: CFURLRef; soundURL: CFURLRef; localizationURL: CFURLRef; alertHeader: CFStringRef; alertMessage: CFStringRef; defaultButtonTitle: CFStringRef; alternateButtonTitle: CFStringRef; otherButtonTitle: CFStringRef; var responseFlags: CFOptionFlags ): SInt32; external name '_CFUserNotificationDisplayAlert';


{ Flags }

const
    kCFUserNotificationStopAlertLevel       = 0;
    kCFUserNotificationNoteAlertLevel       = 1;
    kCFUserNotificationCautionAlertLevel    = 2;
    kCFUserNotificationPlainAlertLevel      = 3;

const
    kCFUserNotificationDefaultResponse      = 0;
    kCFUserNotificationAlternateResponse    = 1;
    kCFUserNotificationOtherResponse        = 2;
    kCFUserNotificationCancelResponse       = 3;

const
    kCFUserNotificationNoDefaultButtonFlag  = (1 shl 5);
    kCFUserNotificationUseRadioButtonsFlag  = (1 shl 6);

// CF_INLINE CFOptionFlags CFUserNotificationCheckBoxChecked(CFIndex i) {return ((CFOptionFlags)(1 << (8 + i)));}
// CF_INLINE CFOptionFlags CFUserNotificationSecureTextField(CFIndex i) {return ((CFOptionFlags)(1 << (16 + i)));}
// CF_INLINE CFOptionFlags CFUserNotificationPopUpSelection(CFIndex n) {return ((CFOptionFlags)(n << 24));}


{ Keys }

var kCFUserNotificationIconURLKey: CFStringRef; external name '_kCFUserNotificationIconURLKey'; (* attribute const *)

var kCFUserNotificationSoundURLKey: CFStringRef; external name '_kCFUserNotificationSoundURLKey'; (* attribute const *)

var kCFUserNotificationLocalizationURLKey: CFStringRef; external name '_kCFUserNotificationLocalizationURLKey'; (* attribute const *)

var kCFUserNotificationAlertHeaderKey: CFStringRef; external name '_kCFUserNotificationAlertHeaderKey'; (* attribute const *)

var kCFUserNotificationAlertMessageKey: CFStringRef; external name '_kCFUserNotificationAlertMessageKey'; (* attribute const *)

var kCFUserNotificationDefaultButtonTitleKey: CFStringRef; external name '_kCFUserNotificationDefaultButtonTitleKey'; (* attribute const *)

var kCFUserNotificationAlternateButtonTitleKey: CFStringRef; external name '_kCFUserNotificationAlternateButtonTitleKey'; (* attribute const *)

var kCFUserNotificationOtherButtonTitleKey: CFStringRef; external name '_kCFUserNotificationOtherButtonTitleKey'; (* attribute const *)

var kCFUserNotificationProgressIndicatorValueKey: CFStringRef; external name '_kCFUserNotificationProgressIndicatorValueKey'; (* attribute const *)

var kCFUserNotificationPopUpTitlesKey: CFStringRef; external name '_kCFUserNotificationPopUpTitlesKey'; (* attribute const *)

var kCFUserNotificationTextFieldTitlesKey: CFStringRef; external name '_kCFUserNotificationTextFieldTitlesKey'; (* attribute const *)

var kCFUserNotificationCheckBoxTitlesKey: CFStringRef; external name '_kCFUserNotificationCheckBoxTitlesKey'; (* attribute const *)

var kCFUserNotificationTextFieldValuesKey: CFStringRef; external name '_kCFUserNotificationTextFieldValuesKey'; (* attribute const *)

// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
var kCFUserNotificationPopUpSelectionKey: CFStringRef; external name '_kCFUserNotificationPopUpSelectionKey'; (* attribute const *)
{unit CFXMLNode}
{$ALIGN MAC68K}










{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}


type
    CFXMLNodeRef    = ^SInt32; { an opaque 32-bit type }
    CFXMLNodeRefPtr = ^CFXMLNodeRef;  { when a var xx:CFXMLNodeRef parameter can be nil, it is changed to xx: CFXMLNodeRefPtr }
    CFXMLTreeRef                        = CFTreeRef;
    {     An CFXMLNode describes an individual XML construct - like a tag, or a comment, or a string
        of character data.  Each CFXMLNode contains 3 main pieces of information - the node's type,
        the data string, and a pointer to an additional data structure.  The node's type ID is an enum
        value of type CFXMLNodeTypeID.  The data string is always a CFStringRef; the meaning of the
        string is dependent on the node's type ID. The format of the additional data is also dependent
        on the node's type; in general, there is a custom structure for each type that requires
        additional data.  See below for the mapping from type ID to meaning of the data string and
        structure of the additional data.  Note that these structures are versioned, and may change
        as the parser changes.  The current version can always be identified by kCFXMLNodeCurrentVersion;
        earlier versions can be identified and used by passing earlier values for the version number
        (although the older structures would have been removed from the header).

        An CFXMLTree is simply a CFTree whose context data is known to be an CFXMLNodeRef.  As
        such, an CFXMLTree can be used to represent an entire XML document; the CFTree
        provides the tree structure of the document, while the CFXMLNodes identify and describe
        the nodes of the tree.  An XML document can be parsed to a CFXMLTree, and a CFXMLTree
        can generate the data for the equivalent XML document - see CFXMLParser.h for more
        information on parsing XML.
            }

const
    kCFXMLNodeCurrentVersion    = 1;

    {    Type codes for the different possible XML nodes; this list may grow.   }

type
    CFXMLNodeTypeCode           = SInt32;
const
    kCFXMLNodeTypeDocument      = 1;
    kCFXMLNodeTypeElement       = 2;
    kCFXMLNodeTypeAttribute     = 3;
    kCFXMLNodeTypeProcessingInstruction = 4;
    kCFXMLNodeTypeComment       = 5;
    kCFXMLNodeTypeText          = 6;
    kCFXMLNodeTypeCDATASection  = 7;
    kCFXMLNodeTypeDocumentFragment = 8;
    kCFXMLNodeTypeEntity        = 9;
    kCFXMLNodeTypeEntityReference = 10;
    kCFXMLNodeTypeDocumentType  = 11;
    kCFXMLNodeTypeWhitespace    = 12;
    kCFXMLNodeTypeNotation      = 13;
    kCFXMLNodeTypeElementTypeDeclaration = 14;
    kCFXMLNodeTypeAttributeListDeclaration = 15;


type
    CFXMLElementInfoPtr = ^CFXMLElementInfo;
    CFXMLElementInfo = record
        attributes:             CFDictionaryRef;
        attributeOrder:         CFArrayRef;
        isEmpty:                boolean;
    end;

    CFXMLProcessingInstructionInfoPtr = ^CFXMLProcessingInstructionInfo;
    CFXMLProcessingInstructionInfo = record
        dataString:             CFStringRef;
    end;

    CFXMLDocumentInfoPtr = ^CFXMLDocumentInfo;
    CFXMLDocumentInfo = record
        sourceURL:              CFURLRef;
        encoding:               CFStringEncoding;
    end;

    CFXMLExternalIDPtr = ^CFXMLExternalID;
    CFXMLExternalID = record
        systemID:               CFURLRef;
        publicID:               CFStringRef;
    end;

    CFXMLDocumentTypeInfoPtr = ^CFXMLDocumentTypeInfo;
    CFXMLDocumentTypeInfo = record
        externalID:             CFXMLExternalID;
    end;

    CFXMLNotationInfoPtr = ^CFXMLNotationInfo;
    CFXMLNotationInfo = record
        externalID:             CFXMLExternalID;
    end;

    CFXMLElementTypeDeclarationInfoPtr = ^CFXMLElementTypeDeclarationInfo;
    CFXMLElementTypeDeclarationInfo = record
                                                                        {  This is expected to change in future versions  }
        contentDescription:     CFStringRef;
    end;

    CFXMLAttributeDeclarationInfoPtr = ^CFXMLAttributeDeclarationInfo;
    CFXMLAttributeDeclarationInfo = record
                                                                        {  This is expected to change in future versions  }
        attributeName:          CFStringRef;
        typeString:             CFStringRef;
        defaultString:          CFStringRef;
    end;

    CFXMLAttributeListDeclarationInfoPtr = ^CFXMLAttributeListDeclarationInfo;
    CFXMLAttributeListDeclarationInfo = record
        numberOfAttributes:     CFIndex;
        attributes:             CFXMLAttributeDeclarationInfoPtr;
    end;

    CFXMLEntityTypeCode         = SInt32;
const
    kCFXMLEntityTypeParameter   = 0;                            {  Implies parsed, internal  }
    kCFXMLEntityTypeParsedInternal = 1;
    kCFXMLEntityTypeParsedExternal = 2;
    kCFXMLEntityTypeUnparsed    = 3;
    kCFXMLEntityTypeCharacter   = 4;


type
    CFXMLEntityInfoPtr = ^CFXMLEntityInfo;
    CFXMLEntityInfo = record
        entityType:             CFXMLEntityTypeCode;
        replacementText:        CFStringRef;                            {  NULL if entityType is external or unparsed  }
        entityID:               CFXMLExternalID;                        {  entityID.systemID will be NULL if entityType is internal  }
        notationName:           CFStringRef;                            {  NULL if entityType is parsed  }
    end;

    CFXMLEntityReferenceInfoPtr = ^CFXMLEntityReferenceInfo;
    CFXMLEntityReferenceInfo = record
        entityType:             CFXMLEntityTypeCode;
    end;

    {
     dataTypeCode                       meaning of dataString                format of infoPtr
     ===========                        =====================                =================
     kCFXMLNodeTypeDocument             <currently unused>                   CFXMLDocumentInfo *
     kCFXMLNodeTypeElement              tag name                             CFXMLElementInfo *
     kCFXMLNodeTypeAttribute            <currently unused>                   <currently unused>
     kCFXMLNodeTypeProcessInstruction   name of the target                   CFXMLProcessingInstructionInfo *
     kCFXMLNodeTypeComment              text of the comment                  NULL
     kCFXMLNodeTypeText                 the text's contents                  NULL
     kCFXMLNodeTypeCDATASection         text of the CDATA                    NULL
     kCFXMLNodeTypeDocumentFragment     <currently unused>                   <currently unused>
     kCFXMLNodeTypeEntity               name of the entity                   CFXMLEntityInfo *
     kCFXMLNodeTypeEntityReference      name of the referenced entity        CFXMLEntityReferenceInfo *
     kCFXMLNodeTypeDocumentType         name given as top-level element      CFXMLDocumentTypeInfo *
     kCFXMLNodeTypeWhitespace           text of the whitespace               NULL
     kCFXMLNodeTypeNotation             notation name                        CFXMLNotationInfo *
     kCFXMLNodeTypeElementTypeDeclaration     tag name                       CFXMLElementTypeDeclarationInfo *
     kCFXMLNodeTypeAttributeListDeclaration   tag name                       CFXMLAttributeListDeclarationInfo *
        }
    {
     *  CFXMLNodeGetTypeID()
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.1 and later
     *    Mac OS X:         in version 10.0 and later
        }
function CFXMLNodeGetTypeID: CFTypeID; external name '_CFXMLNodeGetTypeID';

{ Creates a new node based on xmlType, dataString, and additionalInfoPtr.  version (together with xmlType) determines the expected structure of additionalInfoPtr }
{
 *  CFXMLNodeCreate()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFXMLNodeCreate(alloc: CFAllocatorRef; xmlType: CFXMLNodeTypeCode; dataString: CFStringRef; additionalInfoPtr: UnivPtr; version: CFIndex): CFXMLNodeRef; external name '_CFXMLNodeCreate';

{ Creates a copy of origNode (which may not be NULL). }
{
 *  CFXMLNodeCreateCopy()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFXMLNodeCreateCopy(alloc: CFAllocatorRef; origNode: CFXMLNodeRef): CFXMLNodeRef; external name '_CFXMLNodeCreateCopy';

{
 *  CFXMLNodeGetTypeCode()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFXMLNodeGetTypeCode(node: CFXMLNodeRef): CFXMLNodeTypeCode; external name '_CFXMLNodeGetTypeCode';

{
 *  CFXMLNodeGetString()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFXMLNodeGetString(node: CFXMLNodeRef): CFStringRef; external name '_CFXMLNodeGetString';

{
 *  CFXMLNodeGetInfoPtr()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFXMLNodeGetInfoPtr(node: CFXMLNodeRef): Ptr; external name '_CFXMLNodeGetInfoPtr';

{
 *  CFXMLNodeGetVersion()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFXMLNodeGetVersion(node: CFXMLNodeRef): CFIndex; external name '_CFXMLNodeGetVersion';

{ CFXMLTreeRef }
{ Creates a childless, parentless tree from node }
{
 *  CFXMLTreeCreateWithNode()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFXMLTreeCreateWithNode(allocator: CFAllocatorRef; node: CFXMLNodeRef): CFXMLTreeRef; external name '_CFXMLTreeCreateWithNode';

{ Extracts and returns the node stored in xmlTree }
{
 *  CFXMLTreeGetNode()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFXMLTreeGetNode(xmlTree: CFXMLTreeRef): CFXMLNodeRef; external name '_CFXMLTreeGetNode';

{$ALIGN MAC68K}
{#POP}
{unit CFXMLParser}
{$ALIGN MAC68K}










{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}


type
    CFXMLParserRef    = ^SInt32; { an opaque 32-bit type }
    CFXMLParserRefPtr = ^CFXMLParserRef;  { when a var xx:CFXMLParserRef parameter can be nil, it is changed to xx: CFXMLParserRefPtr }
    {    These are the various options you can configure the parser with.  These are
       chosen such that an option flag of 0 (kCFXMLParserNoOptions) leaves the XML
       as "intact" as possible (reports all structures; performs no replacements).
       Hence, to make the parser do the most work, returning only the pure element
       tree, set the option flag to kCFXMLParserAllOptions.

    kCFXMLParserValidateDocument -
       validate the document against its grammar from the DTD, reporting any errors.
       Currently not supported.

    kCFXMLParserSkipMetaData -
       silently skip over metadata constructs (the DTD and comments)

    kCFXMLParserReplacePhysicalEntities -
       replace declared entities like &lt;.  Note that other than the 5 predefined
       entities (lt, gt, quot, amp, apos), these must be defined in the DTD.
       Currently not supported.

    kCFXMLParserSkipWhitespace -
       skip over all whitespace that does not abut non-whitespace character data.
       In other words, given <foo>  <bar> blah </bar></foo>, the whitespace between
       foo's open tag and bar's open tag would be suppressed, but the whitespace
       around blah would be preserved.

    kCFXMLParserAddImpliedAttributes -
       where the DTD specifies implied attribute-value pairs for a particular element,
       add those pairs to any occurances of the element in the element tree.
       Currently not supported.
        }
    CFXMLParserOptions          = SInt32;
const
    kCFXMLParserValidateDocument = $01;
    kCFXMLParserSkipMetaData    = $02;
    kCFXMLParserReplacePhysicalEntities = $04;
    kCFXMLParserSkipWhitespace  = $08;
    kCFXMLParserResolveExternalEntities = $10;
    kCFXMLParserAddImpliedAttributes = $20;
    kCFXMLParserAllOptions      = $00FFFFFF;
    kCFXMLParserNoOptions       = 0;

    {    This list is expected to grow  }

type
    CFXMLParserStatusCode       = SInt32;
const
    kCFXMLStatusParseNotBegun   = -2;
    kCFXMLStatusParseInProgress = -1;
    kCFXMLStatusParseSuccessful = 0;
    kCFXMLErrorUnexpectedEOF    = 1;
    kCFXMLErrorUnknownEncoding  = 2;
    kCFXMLErrorEncodingConversionFailure = 3;
    kCFXMLErrorMalformedProcessingInstruction = 4;
    kCFXMLErrorMalformedDTD     = 5;
    kCFXMLErrorMalformedName    = 6;
    kCFXMLErrorMalformedCDSect  = 7;
    kCFXMLErrorMalformedCloseTag = 8;
    kCFXMLErrorMalformedStartTag = 9;
    kCFXMLErrorMalformedDocument = 10;
    kCFXMLErrorElementlessDocument = 11;
    kCFXMLErrorMalformedComment = 12;
    kCFXMLErrorMalformedCharacterReference = 13;
    kCFXMLErrorMalformedParsedCharacterData = 14;
    kCFXMLErrorNoData           = 15;

    {     These functions are called as a parse progresses.

    createXMLStructure -
      called as new XML structures are encountered by the parser.  May return NULL to indicate
      that the given structure should be skipped; if NULL is returned for a given structure,
      only minimal parsing is done for that structure (enough to correctly determine its end,
      and to extract any data necessary for the remainder of the parse, such as Entity definitions).
      createXMLStructure (or indeed, any of the tree-creation callbacks) will not be called for any
      children of the skipped structure.  The only exception is that the top-most element will always
      be reported even if NULL was returned for the document as a whole.  NOTE: for performance reasons,
      the node passed to createXMLStructure cannot be safely retained by the client; the node as
      a whole must be copied (via CFXMLNodeCreateCopy), or its contents must be extracted and copied.

    addChild -
      called as children are parsed and are ready to be added to the tree.  If createXMLStructure
      returns NULL for a given structure, that structure is omitted entirely, and addChild will
      NOT be called for either a NULL child or parent.

    endXMLStructure -
      called once a structure (and all its children) are completely parsed.  As elements are encountered,
      createXMLStructure is called for them first, then addChild to add the new structure to its parent,
      then addChild (potentially several times) to add the new structure's children to it, then finally
      endXMLStructure to show that the structure has been fully parsed.

    createXMLStructure, addChild, and endXMLStructure are all REQUIRED TO BE NON-NULL.

    resolveExternalEntity -
      called when external entities are referenced (NOT when they are simply defined).  If the function
      pointer is NULL, the parser uses its internal routines to try and resolve the entity.  If the
      function pointer is set, and the function returns NULL, a place holder for the external entity
      is inserted into the tree.  In this manner, the parser's client can prevent any external network
      or file accesses.

    handleError - called as errors/warnings are encountered in the data stream.  At some point, we will
      have an enum of the expected errors, some of which will be fatal, others of which will not.  If
      the function pointer is NULL, the parser will silently attempt to recover.  The
      handleError function may always return FALSE to force the parser to stop; if handleError returns
      TRUE, the parser will attempt to recover (fatal errors will still cause the parse to abort
      immediately).
        }

type
    CFXMLParserCreateXMLStructureCallBack = function(parser: CFXMLParserRef; nodeDesc: CFXMLNodeRef; info: UnivPtr): Ptr;

    CFXMLParserAddChildCallBack = procedure(parser: CFXMLParserRef; parent: UnivPtr; child: UnivPtr; info: UnivPtr);

    CFXMLParserEndXMLStructureCallBack = procedure(parser: CFXMLParserRef; xmlType: UnivPtr; info: UnivPtr);

    CFXMLParserResolveExternalEntityCallBack = function(parser: CFXMLParserRef; var extID: CFXMLExternalID; info: UnivPtr): CFDataRef;

    CFXMLParserHandleErrorCallBack = function(parser: CFXMLParserRef; error: CFXMLParserStatusCode; info: UnivPtr): boolean;

    CFXMLParserCallBacksPtr = ^CFXMLParserCallBacks;
    CFXMLParserCallBacks = record
        version:                CFIndex;
        createXMLStructure:     CFXMLParserCreateXMLStructureCallBack;
        addChild:               CFXMLParserAddChildCallBack;
        endXMLStructure:        CFXMLParserEndXMLStructureCallBack;
        resolveExternalEntity:  CFXMLParserResolveExternalEntityCallBack;
        handleError:            CFXMLParserHandleErrorCallBack;
    end;

    CFXMLParserRetainCallBack = function(info: UnivPtr): Ptr;

    CFXMLParserReleaseCallBack = procedure(info: UnivPtr);

    CFXMLParserCopyDescriptionCallBack = function(info: UnivPtr): CFStringRef;

    CFXMLParserContextPtr = ^CFXMLParserContext;
    CFXMLParserContext = record
        version:                CFIndex;
        info:                   Ptr;
        retain:                 CFXMLParserRetainCallBack;
        release:                CFXMLParserReleaseCallBack;
        copyDescription:        CFXMLParserCopyDescriptionCallBack;
    end;

    {
     *  CFXMLParserGetTypeID()
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.3 and later
     *    Mac OS X:         in version 10.0 and later
        }
function CFXMLParserGetTypeID: CFTypeID; external name '_CFXMLParserGetTypeID';

{ Creates a parser which will parse the given data with the given options.  xmlData may not be NULL.
   dataSource should be the URL from which the data came, and may be NULL; it is used to resolve any
   relative references found in xmlData. versionOfNodes determines which version CFXMLNodes are produced
   by the parser; see CFXMLNode.h for more details.  callBacks are the callbacks called by the parser as
   the parse progresses; callBacks, callBacks->createXMLStructure, callBacks->addChild, and
   callBacks->endXMLStructure must all be non-NULL.  context determines what if any info pointer is
   passed to the callbacks as the parse progresses; context may be NULL.  }
{
 *  CFXMLParserCreate()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFXMLParserCreate(allocator: CFAllocatorRef; xmlData: CFDataRef; dataSource: CFURLRef; parseOptions: CFOptionFlags; versionOfNodes: CFIndex; var callBacks: CFXMLParserCallBacks; var context: CFXMLParserContext): CFXMLParserRef; external name '_CFXMLParserCreate';

{ Arguments as above, except that the data to be parsed is loaded directly
   from dataSource.  dataSource may not be NULL.  }
{
 *  CFXMLParserCreateWithDataFromURL()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFXMLParserCreateWithDataFromURL(allocator: CFAllocatorRef; dataSource: CFURLRef; parseOptions: CFOptionFlags; versionOfNodes: CFIndex; var callBacks: CFXMLParserCallBacks; var context: CFXMLParserContext): CFXMLParserRef; external name '_CFXMLParserCreateWithDataFromURL';

{
 *  CFXMLParserGetContext()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CFXMLParserGetContext(parser: CFXMLParserRef; var context: CFXMLParserContext); external name '_CFXMLParserGetContext';

{
 *  CFXMLParserGetCallBacks()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CFXMLParserGetCallBacks(parser: CFXMLParserRef; var callBacks: CFXMLParserCallBacks); external name '_CFXMLParserGetCallBacks';

{
 *  CFXMLParserGetSourceURL()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFXMLParserGetSourceURL(parser: CFXMLParserRef): CFURLRef; external name '_CFXMLParserGetSourceURL';

{ Returns the character index of the current parse location }
{
 *  CFXMLParserGetLocation()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFXMLParserGetLocation(parser: CFXMLParserRef): CFIndex; external name '_CFXMLParserGetLocation';

{ Returns the line number of the current parse location }
{
 *  CFXMLParserGetLineNumber()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFXMLParserGetLineNumber(parser: CFXMLParserRef): CFIndex; external name '_CFXMLParserGetLineNumber';

{ Returns the top-most object returned by the createXMLStructure callback }
{
 *  CFXMLParserGetDocument()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFXMLParserGetDocument(parser: CFXMLParserRef): Ptr; external name '_CFXMLParserGetDocument';

{ Get the status code or a user-readable description of the last error that occurred in a parse.
   If no error has occurred, a null description string is returned.  See the enum above for
   possible status returns }
{
 *  CFXMLParserGetStatusCode()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFXMLParserGetStatusCode(parser: CFXMLParserRef): CFXMLParserStatusCode; external name '_CFXMLParserGetStatusCode';

{
 *  CFXMLParserCopyErrorDescription()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFXMLParserCopyErrorDescription(parser: CFXMLParserRef): CFStringRef; external name '_CFXMLParserCopyErrorDescription';

{ Cause any in-progress parse to abort with the given error code and description.  errorCode
   must be positive, and errorDescription may not be NULL.  Cannot be called asynchronously
   (i.e. must be called from within a parser callback) }
{
 *  CFXMLParserAbort()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CFXMLParserAbort(parser: CFXMLParserRef; errorCode: CFXMLParserStatusCode; errorDescription: CFStringRef); external name '_CFXMLParserAbort';

{ Starts a parse of the data the parser was created with; returns success or failure.
   Upon success, use CFXMLParserGetDocument() to get the product of the parse.  Upon
   failure, use CFXMLParserGetErrorCode() or CFXMLParserCopyErrorDescription() to get
   information about the error.  It is an error to call CFXMLParserParse() while a
   parse is already underway. }
{
 *  CFXMLParserParse()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFXMLParserParse(parser: CFXMLParserRef): boolean; external name '_CFXMLParserParse';

{ These functions provide a higher-level interface.  The XML data is parsed to a
   special CFTree (an CFXMLTree) with known contexts and callbacks.  See CFXMLNode.h
   for full details on using an CFXMLTree and the CFXMLNodes contained therein.
}
{ Parse to an CFXMLTreeRef.  parseOptions are as above. versionOfNodes determines
   what version CFXMLNodes are used to populate the tree.  }
{
 *  CFXMLTreeCreateFromData()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFXMLTreeCreateFromData(allocator: CFAllocatorRef; xmlData: CFDataRef; dataSource: CFURLRef; parseOptions: CFOptionFlags; versionOfNodes: CFIndex): CFXMLTreeRef; external name '_CFXMLTreeCreateFromData';

{ Loads the data to be parsed directly from dataSource.  Arguments as above. }
{
 *  CFXMLTreeCreateWithDataFromURL()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFXMLTreeCreateWithDataFromURL(allocator: CFAllocatorRef; dataSource: CFURLRef; parseOptions: CFOptionFlags; versionOfNodes: CFIndex): CFXMLTreeRef; external name '_CFXMLTreeCreateWithDataFromURL';

{ Generate the XMLData (ready to be written to whatever permanent storage is to be
   used) from an CFXMLTree.  Will NOT regenerate entity references (except those
   required for syntactic correctness) if they were replaced at the parse time;
   clients that wish this should walk the tree and re-insert any entity references
   that should appear in the final output file. }
{
 *  CFXMLTreeCreateXMLData()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFXMLTreeCreateXMLData(allocator: CFAllocatorRef; xmlTree: CFXMLTreeRef): CFDataRef; external name '_CFXMLTreeCreateXMLData';

{$ALIGN MAC68K}
{#POP}
{unit CGDataConsumer}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}


type
    CGDataConsumerRef    = ^SInt32; { an opaque 32-bit type }
    CGDataConsumerRefPtr = ^CGDataConsumerRef;  { when a var xx:CGDataConsumerRef parameter can be nil, it is changed to xx: CGDataConsumerRefPtr }
    CGPutBytesProcPtr = function(info: UnivPtr; buffer: UnivPtr; count: size_t): size_t;

    CGReleaseConsumerProcPtr = procedure(info: UnivPtr);

    {    Callbacks for accessing data.
     * `putBytes' copies `count' bytes from `buffer' to the consumer, and
     * returns the number of bytes copied.  It should return 0 if no more data
     * can be written to the consumer.
     * `releaseConsumer', if non-NULL, is called when the consumer is freed.    }
    CGDataConsumerCallbacksPtr = ^CGDataConsumerCallbacks;
    CGDataConsumerCallbacks = record
        putBytes:               CGPutBytesProcPtr;
        releaseConsumer:        CGReleaseConsumerProcPtr;
    end;

    {    Create a data consumer using `callbacks' to handle the data.  `info' is
     * passed to each of the callback functions.    }
    {
     *  CGDataConsumerCreate()
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        not available
     *    Mac OS X:         in version 10.0 and later
        }
function CGDataConsumerCreate(info: UnivPtr; const (*var*) callbacks: CGDataConsumerCallbacks): CGDataConsumerRef; external name '_CGDataConsumerCreate';

{ Create a data consumer which writes data to `url'. }
{
 *  CGDataConsumerCreateWithURL()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGDataConsumerCreateWithURL(url: CFURLRef): CGDataConsumerRef; external name '_CGDataConsumerCreateWithURL';

{ Increment the retain count of `consumer' and return it.  All data
 * consumers are created with an initial retain count of 1. }
{
 *  CGDataConsumerRetain()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGDataConsumerRetain(consumer: CGDataConsumerRef): CGDataConsumerRef; external name '_CGDataConsumerRetain';

{ Decrement the retain count of `consumer'.  If the retain count reaches
 * 0, then release it and any associated resources. }
{
 *  CGDataConsumerRelease()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
procedure CGDataConsumerRelease(consumer: CGDataConsumerRef); external name '_CGDataConsumerRelease';

{$ALIGN MAC68K}
{#POP}
{unit CGDataProvider}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}


type
    CGDataProviderRef    = ^SInt32; { an opaque 32-bit type }
    CGDataProviderRefPtr = ^CGDataProviderRef;  { when a var xx:CGDataProviderRef parameter can be nil, it is changed to xx: CGDataProviderRefPtr }
    CGGetBytesProcPtr = function(info: UnivPtr; buffer: UnivPtr; count: size_t): size_t;

    CGSkipBytesProcPtr = procedure(info: UnivPtr; count: size_t);

    CGRewindProcPtr = procedure(info: UnivPtr);

    CGReleaseProviderProcPtr = procedure(info: UnivPtr);

    {    Callbacks for sequentially accessing data.
     * `getBytes' is called to copy `count' bytes from the provider's data to
     * `buffer'.  It should return the number of bytes copied, or 0 if there's
     * no more data.
     * `skipBytes' is called to skip ahead in the provider's data by `count' bytes.
     * `rewind' is called to rewind the provider to the beginning of the data.
     * `releaseProvider', if non-NULL, is called when the provider is freed.    }
    CGDataProviderCallbacksPtr = ^CGDataProviderCallbacks;
    CGDataProviderCallbacks = record
        getBytes:               CGGetBytesProcPtr;
        skipBytes:              CGSkipBytesProcPtr;
        rewind:                 CGRewindProcPtr;
        releaseProvider:        CGReleaseProviderProcPtr;
    end;

    CGGetBytePointerProcPtr = function(info: UnivPtr): Ptr;

    CGReleaseByteProcPtr = procedure(info: UnivPtr; pointer: UnivPtr);

    CGGetBytesDirectProcPtr = function(info: UnivPtr; buffer: UnivPtr; offset: size_t; count: size_t): size_t;

    {    Callbacks for directly accessing data.
     * `getBytePointer', if non-NULL, is called to return a pointer to the
     * provider's entire block of data.
     * `releaseBytePointer', if non-NULL, is called to release a pointer to
     * the provider's entire block of data.
     * `getBytes', if non-NULL, is called to copy `count' bytes at offset
     * `offset' from the provider's data to `buffer'.  It should return the
     * number of bytes copied, or 0 if there's no more data.
     * `releaseProvider', if non-NULL, is called when the provider is freed.
     * At least one of `getBytePointer' or `getBytes' must be non-NULL.     }
    CGDataProviderDirectAccessCallbacksPtr = ^CGDataProviderDirectAccessCallbacks;
    CGDataProviderDirectAccessCallbacks = record
        getBytePointer:         CGGetBytePointerProcPtr;
        releaseBytePointer:     CGReleaseByteProcPtr;
        getBytes:               CGGetBytesDirectProcPtr;
        releaseProvider:        CGReleaseProviderProcPtr;
    end;

    CGReleaseDataProcPtr = procedure(info: UnivPtr; data: UnivPtr; size: size_t);

    {    Create a sequential-access data provider using `callbacks' to provide
     * the data.  `info' is passed to each of the callback functions.   }
    {
     *  CGDataProviderCreate()
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        not available
     *    Mac OS X:         in version 10.0 and later
        }
function CGDataProviderCreate(info: UnivPtr; const (*var*) callbacks: CGDataProviderCallbacks): CGDataProviderRef; external name '_CGDataProviderCreate';

{ Create a direct-access data provider using `callbacks' to supply `size'
 * bytes of data. `info' is passed to each of the callback functions. }
{
 *  CGDataProviderCreateDirectAccess()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGDataProviderCreateDirectAccess(info: UnivPtr; size: size_t; const (*var*) callbacks: CGDataProviderDirectAccessCallbacks): CGDataProviderRef; external name '_CGDataProviderCreateDirectAccess';

{ Create a direct-access data provider using `data', an array of `size'
 * bytes.  `releaseData' is called when the data provider is freed, and is
 * passed `info' as its first argument. }
{
 *  CGDataProviderCreateWithData()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGDataProviderCreateWithData(info: UnivPtr; data: UnivPtr; size: size_t; releaseData: CGReleaseDataProcPtr): CGDataProviderRef; external name '_CGDataProviderCreateWithData';

{ Create a data provider using `url'. }
{
 *  CGDataProviderCreateWithURL()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGDataProviderCreateWithURL(url: CFURLRef): CGDataProviderRef; external name '_CGDataProviderCreateWithURL';

{ Increment the retain count of `provider' and return it.  All data
 * providers are created with an initial retain count of 1. }
{
 *  CGDataProviderRetain()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGDataProviderRetain(provider: CGDataProviderRef): CGDataProviderRef; external name '_CGDataProviderRetain';

{ Decrement the retain count of `provider'.  If the retain count reaches
 * 0, then free `provider' and any associated resources. }
{
 *  CGDataProviderRelease()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
procedure CGDataProviderRelease(provider: CGDataProviderRef); external name '_CGDataProviderRelease';

{$ALIGN MAC68K}
{#POP}
{unit CGPDFDocument}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}


type
    CGPDFDocumentRef    = ^SInt32; { an opaque 32-bit type }
    CGPDFDocumentRefPtr = ^CGPDFDocumentRef;  { when a var xx:CGPDFDocumentRef parameter can be nil, it is changed to xx: CGPDFDocumentRefPtr }
    {    Create a PDF document, using `provider' to obtain the document's
     * data.    }
    {
     *  CGPDFDocumentCreateWithProvider()
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        not available
     *    Mac OS X:         in version 10.0 and later
        }
function CGPDFDocumentCreateWithProvider(provider: CGDataProviderRef): CGPDFDocumentRef; external name '_CGPDFDocumentCreateWithProvider';

{ Create a PDF document from `url'. }
{
 *  CGPDFDocumentCreateWithURL()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGPDFDocumentCreateWithURL(url: CFURLRef): CGPDFDocumentRef; external name '_CGPDFDocumentCreateWithURL';

{ Increment the retain count of `document' and return it.  All PDF
 * documents are created with an initial retain count of 1. }
{
 *  CGPDFDocumentRetain()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGPDFDocumentRetain(document: CGPDFDocumentRef): CGPDFDocumentRef; external name '_CGPDFDocumentRetain';

{ Decrement the retain count of `document'.  If the retain count reaches 0,
 * then free it and any associated resources. }
{
 *  CGPDFDocumentRelease()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
procedure CGPDFDocumentRelease(document: CGPDFDocumentRef); external name '_CGPDFDocumentRelease';

{ Return the number of pages in `document'. }
{
 *  CGPDFDocumentGetNumberOfPages()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGPDFDocumentGetNumberOfPages(document: CGPDFDocumentRef): SInt32; external name '_CGPDFDocumentGetNumberOfPages';

{ Return the media box of page number `page' in `document'. }
{
 *  CGPDFDocumentGetMediaBox()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGPDFDocumentGetMediaBox(document: CGPDFDocumentRef; page: SInt32): CGRect; external name '_CGPDFDocumentGetMediaBox';

{ Return the crop box of page number `page' in `document'. }
{
 *  CGPDFDocumentGetCropBox()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGPDFDocumentGetCropBox(document: CGPDFDocumentRef; page: SInt32): CGRect; external name '_CGPDFDocumentGetCropBox';

{ Return the bleed box of page number `page' in `document'. }
{
 *  CGPDFDocumentGetBleedBox()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGPDFDocumentGetBleedBox(document: CGPDFDocumentRef; page: SInt32): CGRect; external name '_CGPDFDocumentGetBleedBox';

{ Return the trim box of page number `page' in `document'. }
{
 *  CGPDFDocumentGetTrimBox()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGPDFDocumentGetTrimBox(document: CGPDFDocumentRef; page: SInt32): CGRect; external name '_CGPDFDocumentGetTrimBox';

{ Return the art box of page number `page' in `document'. }
{
 *  CGPDFDocumentGetArtBox()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGPDFDocumentGetArtBox(document: CGPDFDocumentRef; page: SInt32): CGRect; external name '_CGPDFDocumentGetArtBox';

{ Return the rotation angle (in degrees) of page number `page' in
 * `document'. }
{
 *  CGPDFDocumentGetRotationAngle()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGPDFDocumentGetRotationAngle(document: CGPDFDocumentRef; page: SInt32): SInt32; external name '_CGPDFDocumentGetRotationAngle';

{$ALIGN MAC68K}
{#POP}
{unit Components}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}


const
    kAppleManufacturer          = $6170706C (* 'appl' *);                       {  Apple supplied components  }
    kComponentResourceType      = $74686E67 (* 'thng' *);                       {  a components resource type  }
    kComponentAliasResourceType = $74686761 (* 'thga' *);                       {  component alias resource type  }

    kAnyComponentType           = 0;
    kAnyComponentSubType        = 0;
    kAnyComponentManufacturer   = 0;
    kAnyComponentFlagsMask      = 0;

    cmpIsMissing                = $20000000;
    cmpWantsRegisterMessage     = $80000000;

    kComponentOpenSelect        = -1;                           {  ComponentInstance for this open  }
    kComponentCloseSelect       = -2;                           {  ComponentInstance for this close  }
    kComponentCanDoSelect       = -3;                           {  selector # being queried  }
    kComponentVersionSelect     = -4;                           {  no params  }
    kComponentRegisterSelect    = -5;                           {  no params  }
    kComponentTargetSelect      = -6;                           {  ComponentInstance for top of call chain  }
    kComponentUnregisterSelect  = -7;                           {  no params  }
    kComponentGetMPWorkFunctionSelect = -8;                     {  some params  }
    kComponentExecuteWiredActionSelect = -9;                    {  QTAtomContainer actionContainer, QTAtom actionAtom, QTCustomActionTargetPtr target, QTEventRecordPtr event  }
    kComponentGetPublicResourceSelect = -10;                    {  OSType resourceType, short resourceId, Handle *resource  }

    {    Component Resource Extension flags     }
    componentDoAutoVersion      = $01;
    componentWantsUnregister    = $02;
    componentAutoVersionIncludeFlags = $04;
    componentHasMultiplePlatforms = $08;
    componentLoadResident       = $10;



    {    Set Default Component flags    }
    defaultComponentIdentical   = 0;
    defaultComponentAnyFlags    = 1;
    defaultComponentAnyManufacturer = 2;
    defaultComponentAnySubType  = 4;
    defaultComponentAnyFlagsAnyManufacturer = 3;
    defaultComponentAnyFlagsAnyManufacturerAnySubType = 7;

    {    RegisterComponentResource flags    }
    registerComponentGlobal     = 1;
    registerComponentNoDuplicates = 2;
    registerComponentAfterExisting = 4;
    registerComponentAliasesOnly = 8;



type
    ComponentDescriptionPtr = ^ComponentDescription;
    ComponentDescription = record
        componentType:          OSType;                                 {  A unique 4-byte code indentifying the command set  }
        componentSubType:       OSType;                                 {  Particular flavor of this instance  }
        componentManufacturer:  OSType;                                 {  Vendor indentification  }
        componentFlags:         UInt32;                                 {  8 each for Component,Type,SubType,Manuf/revision  }
        componentFlagsMask:     UInt32;                                 {  Mask for specifying which flags to consider in search, zero during registration  }
    end;


    ResourceSpecPtr = ^ResourceSpec;
    ResourceSpec = record
        resType:                OSType;                                 {  4-byte code     }
        resID:                  SInt16;                             {           }
    end;

    ComponentResourcePtr = ^ComponentResource;
    ComponentResource = record
        cd:                     ComponentDescription;                   {  Registration parameters  }
        component:              ResourceSpec;                           {  resource where Component code is found  }
        componentName:          ResourceSpec;                           {  name string resource  }
        componentInfo:          ResourceSpec;                           {  info string resource  }
        componentIcon:          ResourceSpec;                           {  icon resource  }
    end;

    ComponentResourceHandle             = ^ComponentResourcePtr;
    ComponentPlatformInfoPtr = ^ComponentPlatformInfo;
    ComponentPlatformInfo = record
        componentFlags:         SInt32;                             {  flags of Component  }
        component:              ResourceSpec;                           {  resource where Component code is found  }
        platformType:           SInt16;                             {  gestaltSysArchitecture result  }
    end;

    ComponentResourceExtensionPtr = ^ComponentResourceExtension;
    ComponentResourceExtension = record
        componentVersion:       SInt32;                             {  version of Component  }
        componentRegisterFlags: SInt32;                             {  flags for registration  }
        componentIconFamily:    SInt16;                             {  resource id of Icon Family  }
    end;

    ComponentPlatformInfoArrayPtr = ^ComponentPlatformInfoArray;
    ComponentPlatformInfoArray = record
        count:                  SInt32;
        platformArray:          array [0..0] of ComponentPlatformInfo;
    end;

    ExtComponentResourcePtr = ^ExtComponentResource;
    ExtComponentResource = record
        cd:                     ComponentDescription;                   {  registration parameters  }
        component:              ResourceSpec;                           {  resource where Component code is found  }
        componentName:          ResourceSpec;                           {  name string resource  }
        componentInfo:          ResourceSpec;                           {  info string resource  }
        componentIcon:          ResourceSpec;                           {  icon resource  }
        componentVersion:       SInt32;                             {  version of Component  }
        componentRegisterFlags: SInt32;                             {  flags for registration  }
        componentIconFamily:    SInt16;                             {  resource id of Icon Family  }
        count:                  SInt32;                             {  elements in platformArray  }
        platformArray:          array [0..0] of ComponentPlatformInfo;
    end;

    ExtComponentResourceHandle          = ^ExtComponentResourcePtr;
    ComponentAliasResourcePtr = ^ComponentAliasResource;
    ComponentAliasResource = record
        cr:                     ComponentResource;                      {  Registration parameters  }
        aliasCD:                ComponentDescription;                   {  component alias description  }
    end;

    {     Structure received by Component:          }
    ComponentParametersPtr = ^ComponentParameters;
    ComponentParameters = packed record
        flags:                  UInt8;                                  {  call modifiers: sync/async, deferred, immed, etc  }
        paramSize:              UInt8;                                  {  size in bytes of actual parameters passed to this call  }
        what:                   SInt16;                             {  routine selector, negative for Component management calls  }
        params:                 array [0..0] of SInt32;             {  actual parameters for the indicated routine  }
    end;

    ComponentRecordPtr = ^ComponentRecord;
    ComponentRecord = record
        data:                   array [0..0] of SInt32;
    end;

    Component                           = ^ComponentRecord;
    ComponentInstanceRecordPtr = ^ComponentInstanceRecord;
    ComponentInstanceRecord = record
        data:                   array [0..0] of SInt32;
    end;

    ComponentInstance                   = ^ComponentInstanceRecord;
    RegisteredComponentRecordPtr = ^RegisteredComponentRecord;
    RegisteredComponentRecord = record
        data:                   array [0..0] of SInt32;
    end;

    RegisteredComponentInstanceRecordPtr = ^RegisteredComponentInstanceRecord;
    RegisteredComponentInstanceRecord = record
        data:                   array [0..0] of SInt32;
    end;

    ComponentResult                     = SInt32;

const
    platform68k                 = 1;                            {  platform type (response from gestaltComponentPlatform)  }
    platformPowerPC             = 2;                            {  (when gestaltComponentPlatform is not implemented, use  }
    platformInterpreted         = 3;                            {  gestaltSysArchitecture)  }
    platformWin32               = 4;
    platformPowerPCNativeEntryPoint = 5;

    mpWorkFlagDoWork            = $01;
    mpWorkFlagDoCompletion      = $02;
    mpWorkFlagCopyWorkBlock     = $04;
    mpWorkFlagDontBlock         = $08;
    mpWorkFlagGetProcessorCount = $10;
    mpWorkFlagGetIsRunning      = $40;

    cmpAliasNoFlags             = 0;
    cmpAliasOnlyThisFile        = 1;


type
    ComponentMPWorkFunctionHeaderRecordPtr = ^ComponentMPWorkFunctionHeaderRecord;
    ComponentMPWorkFunctionHeaderRecord = record
        headerSize:             UInt32;
        recordSize:             UInt32;
        workFlags:              UInt32;
        processorCount:         UInt16;
        unused:                 SInt8;
        isRunning:              SInt8;
    end;

    ComponentMPWorkFunctionProcPtr = function(globalRefCon: UnivPtr; header: ComponentMPWorkFunctionHeaderRecordPtr): ComponentResult;

    ComponentRoutineProcPtr = function(var cp: ComponentParameters; componentStorage: Handle): ComponentResult;

    GetMissingComponentResourceProcPtr = function(c: Component; resType: OSType; resID: SInt16; refCon: UnivPtr; var resource: Handle): OSErr;

    ComponentMPWorkFunctionUPP = ^SInt32; { an opaque UPP }
    ComponentRoutineUPP = ^SInt32; { an opaque UPP }
    GetMissingComponentResourceUPP = ^SInt32; { an opaque UPP }
    {
        The parameter list for each ComponentFunction is unique. It is
        therefore up to users to create the appropriate procInfo for their
        own ComponentFunctions where necessary.
        }
    ComponentFunctionUPP                = UniversalProcPtr;
    {
     *  NewComponentFunctionUPP()
     *
     *  Discussion:
     *    For use in writing a Carbon compliant Component.  It is used to
     *    create a ComponentFunctionUPP needed to call
     *    CallComponentFunction in the Components dispatch routine.
     *
     *  Availability:
     *    Non-Carbon CFM:   available as macro/inline
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function NewComponentFunctionUPP(userRoutine: ProcPtr; procInfo: ProcInfoType): ComponentFunctionUPP; external name '_NewComponentFunctionUPP';

{
 *  DisposeComponentFunctionUPP()
 *
 *  Discussion:
 *    For use in writing a Carbon compliant Component.  It is used to
 *    dispose of a ComponentFunctionUPP created by
 *    NewComponentFunctionUPP.
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeComponentFunctionUPP(userUPP: ComponentFunctionUPP); external name '_DisposeComponentFunctionUPP';


{
 *  CallComponentUPP
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        not available
 *    Mac OS X:         not available
 }


{*******************************************************
*                                                       *
*               APPLICATION LEVEL CALLS                 *
*                                                       *
*******************************************************}
{*******************************************************
* Component Database Add, Delete, and Query Routines
*******************************************************}
{
 *  RegisterComponent()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function RegisterComponent(var cd: ComponentDescription; componentEntryPoint: ComponentRoutineUPP; global: SInt16; componentName: Handle; componentInfo: Handle; componentIcon: Handle): Component; external name '_RegisterComponent';
{
 *  RegisterComponentResource()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function RegisterComponentResource(cr: ComponentResourceHandle; global: SInt16): Component; external name '_RegisterComponentResource';
{
 *  UnregisterComponent()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function UnregisterComponent(aComponent: Component): OSErr; external name '_UnregisterComponent';
{
 *  FindNextComponent()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function FindNextComponent(aComponent: Component; var looking: ComponentDescription): Component; external name '_FindNextComponent';
{
 *  CountComponents()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function CountComponents(var looking: ComponentDescription): SInt32; external name '_CountComponents';
{
 *  GetComponentInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetComponentInfo(aComponent: Component; var cd: ComponentDescription; componentName: Handle; componentInfo: Handle; componentIcon: Handle): OSErr; external name '_GetComponentInfo';
{
 *  GetComponentListModSeed()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetComponentListModSeed: SInt32; external name '_GetComponentListModSeed';
{
 *  GetComponentTypeModSeed()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib via QuickTime 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetComponentTypeModSeed(componentType: OSType): SInt32; external name '_GetComponentTypeModSeed';
{*******************************************************
* Component Instance Allocation and dispatch routines
*******************************************************}
{
 *  OpenAComponent()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib via QuickTime 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function OpenAComponent(aComponent: Component; var ci: ComponentInstance): OSErr; external name '_OpenAComponent';
{
 *  OpenComponent()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function OpenComponent(aComponent: Component): ComponentInstance; external name '_OpenComponent';
{
 *  CloseComponent()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function CloseComponent(aComponentInstance: ComponentInstance): OSErr; external name '_CloseComponent';
{
 *  GetComponentInstanceError()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetComponentInstanceError(aComponentInstance: ComponentInstance): OSErr; external name '_GetComponentInstanceError';
{*******************************************************
* Component aliases
*******************************************************}
{
 *  ResolveComponentAlias()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib via QuickTime 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function ResolveComponentAlias(aComponent: Component): Component; external name '_ResolveComponentAlias';
{*******************************************************
* Component public resources and public string lists
*******************************************************}
{ Note: GetComponentPublicResource returns a Handle, not a resource.  The caller must dispose it with DisposeHandle. }
{
 *  GetComponentPublicResource()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib via QuickTime 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetComponentPublicResource(aComponent: Component; resourceType: OSType; resourceID: SInt16; var theResource: Handle): OSErr; external name '_GetComponentPublicResource';
{
 *  GetComponentPublicResourceList()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib via QuickTime 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetComponentPublicResourceList(resourceType: OSType; resourceID: SInt16; flags: SInt32; var cd: ComponentDescription; missingProc: GetMissingComponentResourceUPP; refCon: UnivPtr; atomContainerPtr: UnivPtr): OSErr; external name '_GetComponentPublicResourceList';
{
 *  GetComponentPublicIndString()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib via QuickTime 4.0 and later
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetComponentPublicIndString(aComponent: Component; var theString: Str255; strListID: SInt16; index: SInt16): OSErr; external name '_GetComponentPublicIndString';
{*******************************************************
*                                                       *
*                   CALLS MADE BY COMPONENTS            *
*                                                       *
*******************************************************}
{*******************************************************
* Component Management routines
*******************************************************}
{
 *  SetComponentInstanceError()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure SetComponentInstanceError(aComponentInstance: ComponentInstance; theError: OSErr); external name '_SetComponentInstanceError';
{
 *  GetComponentRefcon()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetComponentRefcon(aComponent: Component): SInt32; external name '_GetComponentRefcon';
{
 *  SetComponentRefcon()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure SetComponentRefcon(aComponent: Component; theRefcon: SInt32); external name '_SetComponentRefcon';
{
 *  OpenComponentResFile()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function OpenComponentResFile(aComponent: Component): SInt16; external name '_OpenComponentResFile';
{
 *  OpenAComponentResFile()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib via QuickTime 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function OpenAComponentResFile(aComponent: Component; var resRef: SInt16): OSErr; external name '_OpenAComponentResFile';
{
 *  CloseComponentResFile()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function CloseComponentResFile(refnum: SInt16): OSErr; external name '_CloseComponentResFile';
{ Note: GetComponentResource returns a Handle, not a resource.  The caller must dispose it with DisposeHandle. }
{
 *  GetComponentResource()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib via QuickTime 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetComponentResource(aComponent: Component; resType: OSType; resID: SInt16; var theResource: Handle): OSErr; external name '_GetComponentResource';
{
 *  GetComponentIndString()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib via QuickTime 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetComponentIndString(aComponent: Component; var theString: Str255; strListID: SInt16; index: SInt16): OSErr; external name '_GetComponentIndString';
{*******************************************************
* Component Instance Management routines
*******************************************************}
{
 *  GetComponentInstanceStorage()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetComponentInstanceStorage(aComponentInstance: ComponentInstance): Handle; external name '_GetComponentInstanceStorage';
{
 *  SetComponentInstanceStorage()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure SetComponentInstanceStorage(aComponentInstance: ComponentInstance; theStorage: Handle); external name '_SetComponentInstanceStorage';

{
 *  CountComponentInstances()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function CountComponentInstances(aComponent: Component): SInt32; external name '_CountComponentInstances';
{ useful helper routines for convenient method dispatching }
{
 *  CallComponentFunction()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CallComponentFunction(var params: ComponentParameters; func: ComponentFunctionUPP): SInt32; external name '_CallComponentFunction';
{
 *  CallComponentFunctionWithStorage()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function CallComponentFunctionWithStorage(storage: Handle; var params: ComponentParameters; func: ComponentFunctionUPP): SInt32; external name '_CallComponentFunctionWithStorage';
{
 *  CallComponentFunctionWithStorageProcInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib via QuickTime 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CallComponentFunctionWithStorageProcInfo(storage: Handle; var params: ComponentParameters; func: ProcPtr; funcProcInfo: ProcInfoType): SInt32; external name '_CallComponentFunctionWithStorageProcInfo';


{
 *  DelegateComponentCall()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function DelegateComponentCall(var originalParams: ComponentParameters; ci: ComponentInstance): SInt32; external name '_DelegateComponentCall';
{
 *  SetDefaultComponent()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SetDefaultComponent(aComponent: Component; flags: SInt16): OSErr; external name '_SetDefaultComponent';
{
 *  OpenDefaultComponent()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function OpenDefaultComponent(componentType: OSType; componentSubType: OSType): ComponentInstance; external name '_OpenDefaultComponent';
{
 *  OpenADefaultComponent()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib via QuickTime 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function OpenADefaultComponent(componentType: OSType; componentSubType: OSType; var ci: ComponentInstance): OSErr; external name '_OpenADefaultComponent';
{
 *  CaptureComponent()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function CaptureComponent(capturedComponent: Component; capturingComponent: Component): Component; external name '_CaptureComponent';
{
 *  UncaptureComponent()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function UncaptureComponent(aComponent: Component): OSErr; external name '_UncaptureComponent';
{
 *  RegisterComponentResourceFile()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function RegisterComponentResourceFile(resRefNum: SInt16; global: SInt16): SInt32; external name '_RegisterComponentResourceFile';
{
 *  GetComponentIconSuite()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetComponentIconSuite(aComponent: Component; var iconSuite: Handle): OSErr; external name '_GetComponentIconSuite';
{*******************************************************
*                                                       *
*           Direct calls to the Components              *
*                                                       *
*******************************************************}
{  Old style names }

{
 *  ComponentFunctionImplemented()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function ComponentFunctionImplemented(ci: ComponentInstance; ftnNumber: SInt16): SInt32; external name '_ComponentFunctionImplemented';
{
 *  GetComponentVersion()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetComponentVersion(ci: ComponentInstance): SInt32; external name '_GetComponentVersion';
{
 *  ComponentSetTarget()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function ComponentSetTarget(ci: ComponentInstance; target: ComponentInstance): SInt32; external name '_ComponentSetTarget';
{  New style names }

{
 *  CallComponentOpen()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib via QuickTime 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function CallComponentOpen(ci: ComponentInstance; self: ComponentInstance): ComponentResult; external name '_CallComponentOpen';
{
 *  CallComponentClose()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib via QuickTime 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function CallComponentClose(ci: ComponentInstance; self: ComponentInstance): ComponentResult; external name '_CallComponentClose';
{
 *  CallComponentCanDo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib via QuickTime 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function CallComponentCanDo(ci: ComponentInstance; ftnNumber: SInt16): ComponentResult; external name '_CallComponentCanDo';
{
 *  CallComponentVersion()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib via QuickTime 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function CallComponentVersion(ci: ComponentInstance): ComponentResult; external name '_CallComponentVersion';
{
 *  CallComponentRegister()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib via QuickTime 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function CallComponentRegister(ci: ComponentInstance): ComponentResult; external name '_CallComponentRegister';
{
 *  CallComponentTarget()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib via QuickTime 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function CallComponentTarget(ci: ComponentInstance; target: ComponentInstance): ComponentResult; external name '_CallComponentTarget';
{
 *  CallComponentUnregister()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib via QuickTime 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function CallComponentUnregister(ci: ComponentInstance): ComponentResult; external name '_CallComponentUnregister';
{
 *  CallComponentGetMPWorkFunction()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib via QuickTime 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function CallComponentGetMPWorkFunction(ci: ComponentInstance; var workFunction: ComponentMPWorkFunctionUPP; var refCon: UnivPtr): ComponentResult; external name '_CallComponentGetMPWorkFunction';
{
 *  CallComponentGetPublicResource()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib via QuickTime 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CallComponentGetPublicResource(ci: ComponentInstance; resourceType: OSType; resourceID: SInt16; var resource: Handle): ComponentResult; external name '_CallComponentGetPublicResource';

{
    CallComponentDispatch is a CarbonLib routine that replaces CallComponent inline glue
    to call a component function.
 }
{
 *  CallComponentDispatch()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CallComponentDispatch(var cp: ComponentParameters): ComponentResult; external name '_CallComponentDispatch';


{ UPP call backs }

const
    uppComponentMPWorkFunctionProcInfo = $000003F0;
    uppComponentRoutineProcInfo = $000003F0;
    uppGetMissingComponentResourceProcInfo = $0000FBE0;
    {
     *  NewComponentMPWorkFunctionUPP()
     *
     *  Availability:
     *    Non-Carbon CFM:   available as macro/inline
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function NewComponentMPWorkFunctionUPP(userRoutine: ComponentMPWorkFunctionProcPtr): ComponentMPWorkFunctionUPP; external name '_NewComponentMPWorkFunctionUPP'; { old name was NewComponentMPWorkFunctionProc }
{
 *  NewComponentRoutineUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewComponentRoutineUPP(userRoutine: ComponentRoutineProcPtr): ComponentRoutineUPP; external name '_NewComponentRoutineUPP'; { old name was NewComponentRoutineProc }
{
 *  NewGetMissingComponentResourceUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewGetMissingComponentResourceUPP(userRoutine: GetMissingComponentResourceProcPtr): GetMissingComponentResourceUPP; external name '_NewGetMissingComponentResourceUPP'; { old name was NewGetMissingComponentResourceProc }
{
 *  DisposeComponentMPWorkFunctionUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeComponentMPWorkFunctionUPP(userUPP: ComponentMPWorkFunctionUPP); external name '_DisposeComponentMPWorkFunctionUPP';
{
 *  DisposeComponentRoutineUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeComponentRoutineUPP(userUPP: ComponentRoutineUPP); external name '_DisposeComponentRoutineUPP';
{
 *  DisposeGetMissingComponentResourceUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeGetMissingComponentResourceUPP(userUPP: GetMissingComponentResourceUPP); external name '_DisposeGetMissingComponentResourceUPP';
{
 *  InvokeComponentMPWorkFunctionUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeComponentMPWorkFunctionUPP(globalRefCon: UnivPtr; header: ComponentMPWorkFunctionHeaderRecordPtr; userRoutine: ComponentMPWorkFunctionUPP): ComponentResult; external name '_InvokeComponentMPWorkFunctionUPP'; { old name was CallComponentMPWorkFunctionProc }
{
 *  InvokeComponentRoutineUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeComponentRoutineUPP(var cp: ComponentParameters; componentStorage: Handle; userRoutine: ComponentRoutineUPP): ComponentResult; external name '_InvokeComponentRoutineUPP'; { old name was CallComponentRoutineProc }
{
 *  InvokeGetMissingComponentResourceUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeGetMissingComponentResourceUPP(c: Component; resType: OSType; resID: SInt16; refCon: UnivPtr; var resource: Handle; userRoutine: GetMissingComponentResourceUPP): OSErr; external name '_InvokeGetMissingComponentResourceUPP'; { old name was CallGetMissingComponentResourceProc }
{ ProcInfos }






{$ALIGN MAC68K}
{#POP}
{unit Debugging}
{$ALIGN MAC68K}








{
  ______________________________________________________________________________________

    This file defines standard exception handling and assertion macros for
    system-level programming in C.  Originally used in QuickDraw GX, and heavily
    modified since, these macros are used extensively throughout Mac OS system
    software.  Now *you* can look and feel like a system software engineer.

    To activate debugger breaks, #define DEBUG to 1 (one) before including this file.
    Five further levels of debugging are available, selected by #defining one
    of the following conditionals to 1 after DEBUG is defined to 1.

        DEBUG_INTERNAL      the default; includes file and line number information

        DEBUG_EXTERNAL      used for code which must ship to developers outside
                            your organization; no file or line number information is
                            included in asserts

        DEBUG_BREAK_ONLY    where an assertion would normally be sent to the debugger,
                            send an empty string instead.

        PRODUCTION          used for shipping code; no debugger breaks are emitted

        PERFORMANCE         same as PRODUCTION

    #defining DEBUG to 0 is equivalent to #defining PRODUCTION 1 when DEBUG is 1.
    (No code for debugger breaks is emitted in either case.)

    Of the multitude of macros, the preferred ones are:

    debug_string(c-string)
        If debugging is on, c-string is printed in the debugger.
        In production builds, debug_string() does nothing.

    check(expression)
    check_noerr(error)
        If (expression) evaluates to false, break into the debugger.
        In production builds, check() does nothing.
        Code inside check() statements is not compiled into production builds.

    require(expression, label)
    require_noerr(expression, label)
        If (expression) evaluates to false, announce this fact via the
        debugger and then goto label.  In production builds, does not call
        the debugger but still goes to label if expression is false.

    require_action(expression, label, action)
    require_noerr_action(expression, label, action)
        Same as require, but executes (action) before jumping to label.

    check_string(expression, c-string)
    require_string(expression, label, c-string)
    require_noerr_string(expression, label, c-string)
        If expression evaluates to false, print string and then proceed as in
        a normal check/require statement

    verify(expression)
    verify_noerr(error)
        If debugging is on, verify is the same as check(expression).
        If debugging is off, verify still evaluates (expression)
        but ignores the result.  Code inside verify() statements
        is executed in both production and debug builds.

    Common usage:

        // my pixmap is not purgeable, so locking it should never fail
        verify( LockPixels(myPixMap) );
        verify_noerr( DisposeThread(myThread, &threadResult, true) );
  ______________________________________________________________________________________
}


{
  ______________________________________________________________________________________

   Before including this file, #define kComponentSignatureString to a C-string
   containing the name of your client.

   example: #define kComponentSignatureString "SurfWriter"
  ______________________________________________________________________________________
}





{
  ______________________________________________________________________________________

    DEBUGASSERTMSG - all error reporting is routed through this macro, which calls the
    system routine DebugAssert().  If you wish to use your own assertion/debugger break
    routine, you can override DEBUGASSERTMSG by defining it before including this file.
  ______________________________________________________________________________________
}


{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}

{
 *  DebugAssert()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DebugLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DebugAssert(componentSignature: OSType; options: UInt32; assertionString: ConstCStringPtr; exceptionString: ConstCStringPtr; errorString: ConstCStringPtr; fileName: ConstCStringPtr; lineNumber: SInt32; value: UnivPtr); external name '_DebugAssert';
{
    kBlessedBusErrorBait is an address that will never be mapped
    by Mac OS 8 or 9. It is close to the middle of the 64K range from
    0x68F10000 to 0x68F1FFFF that is unmapped and cannot be accessed
    without causing an exception. Thus, it's a good value to use for
    filling uninitialized pointers, etc.
}

const
    kBlessedBusErrorBait        = $68F168F1;


    {   TaskLevel masks }
    k68kInterruptLevelMask      = $00000007;
    kInVBLTaskMask              = $00000010;
    kInDeferredTaskMask         = $00000020;
    kInSecondaryIntHandlerMask  = $00000040;
    kInNestedInterruptMask      = $00000080;

    kComponentDebugOption       = 0;                            {  optionSelectorNum to turn breaks for component on/off }

    kGetDebugOption             = 1;                            {  get current debug option setting }
    kSetDebugOption             = 2;                            {  set debug option }

    {
        DebugComponentCallback
        DebugComponentCallback is the callback into a component that registers with DebugLib.
        It is called to get the debug option setting, or to turn a debug option on or off.
            Inputs:
                optionSelectorNum   The component debug option to set
                command             The command:
                                        kGetDebugOption     - get current debug option setting
                                        kSetDebugOption     - set debug option
            Outputs:
                optionSetting       The current setting if kGetDebugOption;
                                    the new debug option if kSetDebugOption
    }

type
    DebugComponentCallbackProcPtr = procedure(optionSelectorNum: SInt32; command: UInt32; var optionSetting: boolean);

    DebugComponentCallbackUPP = ^SInt32; { an opaque UPP }
    {
        TaskLevel
        TaskLevel returns 0 if we're (probably) running at non-interrupt time.
        There's no way to make this perfect, but this is as close as we can get.
        If TaskLevel doesn't return 0, then the following masks can be used to learn more:
            k68kInterruptLevelMask      = 0x00000007
            kInVBLTaskMask              = 0x00000010
            kInDeferredTaskMask         = 0x00000020
            kInSecondaryIntHandlerMask  = 0x00000040
            kInNestedInterruptMask      = 0x00000080
    }
    {
     *  TaskLevel()
     *
     *  Availability:
     *    Non-Carbon CFM:   in DebugLib 1.0 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function TaskLevel: UInt32; external name '_TaskLevel';
{
    NewDebugComponent
    NewDebugComponent registers a component with DebugLib.
        Inputs:
            componentSignature  The unique signature of component
            componentName       The displayable string naming the component
            componentCallback   The callback into component for working with options
        Result:
            noErr                           no error
            memFullErr                      could not allocate memory
            debuggingExecutionContextErr    routine cannot be called at this time
            debuggingDuplicateSignatureErr  componentSignature already registered
            debuggingInvalidNameErr         componentName is invalid (NULL)
}
{
 *  NewDebugComponent()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DebugLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewDebugComponent(componentSignature: OSType; const (*var*) componentName: Str255; componentCallback: DebugComponentCallbackUPP): OSStatus; external name '_NewDebugComponent';
{
    NewDebugOption
    NewDebugOption registers a debug option with DebugLib.
        Inputs:
            componentSignature  The signature of component to register a debug option for
            optionSelectorNum   The selector number of this debug option
            optionName          The displayable string naming this debug option
        Result:
            noErr                           no error
            memFullErr                      could not allocate memory
            debuggingExecutionContextErr    called at interrupt time
            debuggingDuplicateOptionErr     optionSelectorNum already registered
            debuggingInvalidSignatureErr    componentSignature not registered
            debuggingInvalidNameErr         optionName is invalid (NULL)
            debuggingNoCallbackErr          debugging component has no callback
}
{
 *  NewDebugOption()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DebugLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewDebugOption(componentSignature: OSType; optionSelectorNum: SInt32; const (*var*) optionName: Str255): OSStatus; external name '_NewDebugOption';
{
    DisposeDebugComponent
    DisposeDebugComponent removes a component registration and all related debug options from DebugLib.
        Input:
            componentSignature  The unique signature of a component
        Result:
            noErr                           no error
            debuggingExecutionContextErr    called at interrupt time
            debuggingInvalidSignatureErr    componentSignature not registered
}
{
 *  DisposeDebugComponent()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DebugLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DisposeDebugComponent(componentSignature: OSType): OSStatus; external name '_DisposeDebugComponent';
{
    GetDebugComponentInfo
    GetDebugComponentInfo returns a component registered with DebugLib.
        Inputs:
            index               The index into the list of registered components (1-based)
        Outputs:
            componentSignature  The unique signature of a component
            componentName       The displayable string naming a component
        Result:
            noErr                           no error
            debuggingNoMatchErr             debugging component not found at this index
}
{
 *  GetDebugComponentInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DebugLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetDebugComponentInfo(index: UInt32; var componentSignature: OSType; var componentName: Str255): OSStatus; external name '_GetDebugComponentInfo';
{
    GetDebugOptionInfo
    GetDebugOptionInfo returns a debug option registered with DebugLib.
        Inputs:
            index               The index into the list of registered debug options (0-based);
                                    0 = kComponentDebugOption
            componentSignature  The unique signature of a component
        Outputs:
            optionSelectorNum   The selector number of this debug option
            optionName          The displayable string naming this debug option
            optionSetting       The current debug option setting
        Result:
            noErr                           no error
            debuggingInvalidSignatureErr    componentSignature not registered
            debuggingNoMatchErr             option not found at this index
}
{
 *  GetDebugOptionInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DebugLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetDebugOptionInfo(index: UInt32; componentSignature: OSType; var optionSelectorNum: SInt32; var optionName: Str255; var optionSetting: boolean): OSStatus; external name '_GetDebugOptionInfo';
{
    SetDebugOptionValue
    SetDebugOptionValue sets a debug option registered with DebugLib.
        Inputs:
            componentSignature  The unique signature of a component
            optionSelectorNum   The selector number of this debug option
            newOptionSetting    The new debug option setting
        Result:
            noErr                           no error
            debuggingInvalidSignatureErr    componentSignature not registered
            debuggingInvalidOptionErr       optionSelectorNum is not registered
}
{
 *  SetDebugOptionValue()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DebugLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetDebugOptionValue(componentSignature: OSType; optionSelectorNum: SInt32; newOptionSetting: boolean): OSStatus; external name '_SetDebugOptionValue';
{
    DebugAssertOutputHandler
    DebugAssertOutputHandler is the callback that registers with DebugLib to handle the
    output from DebugAssert.
        Inputs:
            "componentSignature" through "value" are the raw values passed to DebugAssert
                when an exception occurs.
            outputMsg is the string DebugAssert build which would normally be passed to
                DebugStr if a DebugAssertOutputHandler isn't installed.
}

type
    DebugAssertOutputHandlerProcPtr = procedure(componentSignature: OSType; options: UInt32; assertionString: ConstCStringPtr; exceptionString: ConstCStringPtr; errorString: ConstCStringPtr; fileName: ConstCStringPtr; lineNumber: SInt32; value: UnivPtr; outputMsg: Str255);

    DebugAssertOutputHandlerUPP = ^SInt32; { an opaque UPP }
    {
        InstallDebugAssertOutputHandler
        InstallDebugAssertOutputHandler installs a DebugAssertOutputHandler which DebugAssert calls
        instead of DebugStr.
            Inputs:
                handler     the DebugAssertOutputHandler to install or NULL to switch back to
                            the default handler (DebugStr).
    }
    {
     *  InstallDebugAssertOutputHandler()
     *
     *  Availability:
     *    Non-Carbon CFM:   in DebugLib 1.0 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
procedure InstallDebugAssertOutputHandler(handler: DebugAssertOutputHandlerUPP); external name '_InstallDebugAssertOutputHandler';
{
    dprintf() takes a variable argument list and 'prints' that to the debugging output
    handler.  Calling dprintf() from anything but C or C++ is tricky.
}


const
    uppDebugComponentCallbackProcInfo = $00000FC0;
    uppDebugAssertOutputHandlerProcInfo = $00FFFFC0;
    {
     *  NewDebugComponentCallbackUPP()
     *
     *  Availability:
     *    Non-Carbon CFM:   available as macro/inline
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function NewDebugComponentCallbackUPP(userRoutine: DebugComponentCallbackProcPtr): DebugComponentCallbackUPP; external name '_NewDebugComponentCallbackUPP'; { old name was NewDebugComponentCallbackProc }
{
 *  NewDebugAssertOutputHandlerUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewDebugAssertOutputHandlerUPP(userRoutine: DebugAssertOutputHandlerProcPtr): DebugAssertOutputHandlerUPP; external name '_NewDebugAssertOutputHandlerUPP'; { old name was NewDebugAssertOutputHandlerProc }
{
 *  DisposeDebugComponentCallbackUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeDebugComponentCallbackUPP(userUPP: DebugComponentCallbackUPP); external name '_DisposeDebugComponentCallbackUPP';
{
 *  DisposeDebugAssertOutputHandlerUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeDebugAssertOutputHandlerUPP(userUPP: DebugAssertOutputHandlerUPP); external name '_DisposeDebugAssertOutputHandlerUPP';
{
 *  InvokeDebugComponentCallbackUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvokeDebugComponentCallbackUPP(optionSelectorNum: SInt32; command: UInt32; var optionSetting: boolean; userRoutine: DebugComponentCallbackUPP); external name '_InvokeDebugComponentCallbackUPP'; { old name was CallDebugComponentCallbackProc }
{
 *  InvokeDebugAssertOutputHandlerUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvokeDebugAssertOutputHandlerUPP(componentSignature: OSType; options: UInt32; assertionString: ConstCStringPtr; exceptionString: ConstCStringPtr; errorString: ConstCStringPtr; fileName: ConstCStringPtr; lineNumber: SInt32; value: UnivPtr; const (*var*) outputMsg: Str255; userRoutine: DebugAssertOutputHandlerUPP); external name '_InvokeDebugAssertOutputHandlerUPP'; { old name was CallDebugAssertOutputHandlerProc }
{
  ______________________________________________________________________________________

    Tech Q&A PLAT-30 says to check bit 5 of the byte at 0xbff to
    determine whether MacsBug ( or any other low level debugger )
    is installed; I also check that MacJmp ( which points to the
    entry point for the debugger ) is not nil and not -1.

    MacJmpFlag:
        Bit 5 should be set to indicate the debugger is installed.
        Bit 6 should be set to indicate the debugger is initialized.
        Bit 7 should be clear to indicate that the debugger is NOT busy

    Dr. MacsBug says to also check that the byte at 0xBFF isn't 0xFF.
  ______________________________________________________________________________________
}

{  no-op asserts for production code }

{______________________________________________________________________________________}
{______________________________________________________________________________________}
{______________________________________________________________________________________}




{______________________________________________________________________________________}
{______________________________________________________________________________________}
{______________________________________________________________________________________}
{______________________________________________________________________________________}
{______________________________________________________________________________________}

{______________________________________________________________________________________}
{______________________________________________________________________________________}

{______________________________________________________________________________________}

{______________________________________________________________________________________}
{______________________________________________________________________________________}
{______________________________________________________________________________________}

{______________________________________________________________________________________}

{______________________________________________________________________________________}


{______________________________________________________________________________________}


{$ALIGN MAC68K}
{#POP}
{unit InternetConfig}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}

{***********************************************************************************************
  IC error codes
 ***********************************************************************************************}


const
    icPrefNotFoundErr           = -666;                         {  preference not found (duh!)   }
    icPermErr                   = -667;                         {  cannot set preference   }
    icPrefDataErr               = -668;                         {  problem with preference data   }
    icInternalErr               = -669;                         {  hmm, this is not good   }
    icTruncatedErr              = -670;                         {  more data was present than was returned   }
    icNoMoreWritersErr          = -671;                         {  you cannot begin a write session because someone else is already doing it   }
    icNothingToOverrideErr      = -672;                         {  no component for the override component to capture   }
    icNoURLErr                  = -673;                         {  no URL found   }
    icConfigNotFoundErr         = -674;                         {  no configuration was found   }
    icConfigInappropriateErr    = -675;                         {  incorrect manufacturer code   }
    icProfileNotFoundErr        = -676;                         {  profile not found   }
    icTooManyProfilesErr        = -677;                         {  too many profiles in database   }

    {   ***********************************************************************************************
      IC versions (not necessarily, but historically, from a component)
     ***********************************************************************************************    }

    kICComponentInterfaceVersion0 = $00000000;                  {  IC >= 1.0   }
    kICComponentInterfaceVersion1 = $00010000;                  {  IC >= 1.1   }
    kICComponentInterfaceVersion2 = $00020000;                  {  IC >= 1.2   }
    kICComponentInterfaceVersion3 = $00030000;                  {  IC >= 2.0   }
    kICComponentInterfaceVersion4 = $00040000;                  {  IC >= 2.5   }
    kICComponentInterfaceVersion = $00040000;                   {  current version number is 4   }

    {   ***********************************************************************************************
      opaque type for preference reference
     ***********************************************************************************************    }


type
    ICInstance    = ^SInt32; { an opaque 32-bit type }
    ICInstancePtr = ^ICInstance;  { when a var xx:ICInstance parameter can be nil, it is changed to xx: ICInstancePtr }

    {   ***********************************************************************************************
      a record that specifies a folder, an array of such records, and a pointer to such an array
     ***********************************************************************************************    }
    ICDirSpecPtr = ^ICDirSpec;
    ICDirSpec = record
        vRefNum:                SInt16;
        dirID:                  SInt32;
    end;

    ICDirSpecArray                      = array [0..3] of ICDirSpec;
    ICDirSpecArrayPtr                   = ^ICDirSpecArray;

    {   ***********************************************************************************************
      preference attributes type, bit number constants, and mask constants
     ***********************************************************************************************    }
    ICAttr                              = UInt32;


const
    kICAttrLockedBit            = 0;
    kICAttrVolatileBit          = 1;

    kICAttrNoChange             = $FFFFFFFF;                    {  pass this to ICSetPref to tell it not to change the attributes   }
    kICAttrLockedMask           = $00000001;
    kICAttrVolatileMask         = $00000002;

    {   ***********************************************************************************************
      permissions for use with ICBegin
     ***********************************************************************************************    }


type
    ICPerm                              = UInt8;


const
    icNoPerm                    = 0;
    icReadOnlyPerm              = 1;
    icReadWritePerm             = 2;

    {   ***********************************************************************************************
      a reference to an instance's current configuration
     ***********************************************************************************************    }


{***********************************************************************************************
  profile IDs
 ***********************************************************************************************}

type
    ICProfileID                         = SInt32;
    ICProfileIDPtr                      = ^ICProfileID;


const
    kICNilProfileID             = 0;

    {   ***********************************************************************************************
      other constants
     ***********************************************************************************************    }

    kICNoUserInteractionBit     = 0;

    kICNoUserInteractionMask    = $00000001;

    kICFileType                 = $49434170 (* 'ICAp' *);
    kICCreator                  = $49434170 (* 'ICAp' *);

    {   ***********************************************************************************************
      Apple event constants
     ***********************************************************************************************    }

    kInternetEventClass         = $4755524C (* 'GURL' *);
    kAEGetURL                   = $4755524C (* 'GURL' *);
    kAEFetchURL                 = $4655524C (* 'FURL' *);
    keyAEAttaching              = $41746368 (* 'Atch' *);

    {    AERegistry.i defines a compatible keyAEDestination     }

    kICEditPreferenceEventClass = $49434170 (* 'ICAp' *);
    kICEditPreferenceEvent      = $49434170 (* 'ICAp' *);
    keyICEditPreferenceDestination = $64657374 (* 'dest' *);

    {   ***********************************************************************************************
      constants for use with ICGetVersion
     ***********************************************************************************************    }

    kICComponentVersion         = 0;                            {  Return a component version, comparable to kICComponentInterfaceVersion   }
    kICNumVersion               = 1;                            {  Return a NumVersion structure   }

    {   ***********************************************************************************************
      types and constants for use with kICDocumentFont, et. al.
     ***********************************************************************************************    }

type
    ICFontRecordPtr = ^ICFontRecord;
    ICFontRecord = record
        size:                   SInt16;
        face:                   SInt8;
        pad:                    SInt8;
        font:                   Str255;
    end;

    ICFontRecordHandle                  = ^ICFontRecordPtr;

    {   ***********************************************************************************************
      types and constants for use with kICCharacterSet, et. al.
     ***********************************************************************************************    }
    ICCharTablePtr = ^ICCharTable;
    ICCharTable = record
        netToMac:               packed array [0..255] of UInt8;
        macToNet:               packed array [0..255] of UInt8;
    end;

    ICCharTableHandle                   = ^ICCharTablePtr;

    {   ***********************************************************************************************
      types and constants for use with kICHelper, et. al.
     ***********************************************************************************************    }
    ICAppSpecPtr = ^ICAppSpec;
    ICAppSpec = record
        fCreator:               OSType;
        name:                   Str63;
    end;

    ICAppSpecHandle                     = ^ICAppSpecPtr;
    ICAppSpecListPtr = ^ICAppSpecList;
    ICAppSpecList = record
        numberOfItems:          SInt16;
        appSpecs:               array [0..0] of ICAppSpec;
    end;

    ICAppSpecListHandle                 = ^ICAppSpecListPtr;

    {   ***********************************************************************************************
      types and constants for use with kICDownloadFolder, et. al.
     ***********************************************************************************************    }

    ICFileSpecPtr = ^ICFileSpec;
    ICFileSpec = record
        volName:                Str31;
        volCreationDate:        SInt32;
        fss:                    FSSpec;
        alias:                  AliasRecord;
                                                                        {  plus extra data, aliasSize 0 means no alias manager present when }
                                                                        {  ICFileSpecification was created }
    end;

    ICFileSpecHandle                    = ^ICFileSpecPtr;


const
    kICFileSpecHeaderSize       = 106;

    {   ***********************************************************************************************
      types and constants for use with ICMapFilename, et. al.
     ***********************************************************************************************    }

type
    ICMapEntryFlags                     = SInt32;
    ICFixedLength                       = SInt16;

    ICMapEntryPtr = ^ICMapEntry;
    ICMapEntry = record
        totalLength:            SInt16;
        fixedLength:            ICFixedLength;
        version:                SInt16;
        fileType:               OSType;
        fileCreator:            OSType;
        postCreator:            OSType;
        flags:                  ICMapEntryFlags;
                                                                        {  variable part starts here }
        extension:              Str255;
        creatorAppName:         Str255;
        postAppName:            Str255;
        MIMEType:               Str255;
        entryName:              Str255;
    end;

    ICMapEntryHandle                    = ^ICMapEntryPtr;



const
    kICMapFixedLength           = 22;                           {  number in fixedLength field }

    kICMapBinaryBit             = 0;                            {  file should be transfered in binary as opposed to text mode }
    kICMapResourceForkBit       = 1;                            {  the resource fork of the file is significant }
    kICMapDataForkBit           = 2;                            {  the data fork of the file is significant }
    kICMapPostBit               = 3;                            {  post process using post fields }
    kICMapNotIncomingBit        = 4;                            {  ignore this mapping for incoming files }
    kICMapNotOutgoingBit        = 5;                            {  ignore this mapping for outgoing files }

    kICMapBinaryMask            = $00000001;                    {  file should be transfered in binary as opposed to text mode }
    kICMapResourceForkMask      = $00000002;                    {  the resource fork of the file is significant }
    kICMapDataForkMask          = $00000004;                    {  the data fork of the file is significant }
    kICMapPostMask              = $00000008;                    {  post process using post fields }
    kICMapNotIncomingMask       = $00000010;                    {  ignore this mapping for incoming files }
    kICMapNotOutgoingMask       = $00000020;                    {  ignore this mapping for outgoing files }

    {   ***********************************************************************************************
      types and constants for use with kICServices, et. al.
     ***********************************************************************************************    }

type
    ICServiceEntryFlags                 = SInt16;
    ICServiceEntryPtr = ^ICServiceEntry;
    ICServiceEntry = record
        name:                   Str255;
        port:                   SInt16;
        flags:                  ICServiceEntryFlags;
    end;

    ICServiceEntryHandle                = ^ICServiceEntryPtr;


const
    kICServicesTCPBit           = 0;
    kICServicesUDPBit           = 1;                            {  both bits can be set, which means the service is both TCP and UDP, eg daytime }

    kICServicesTCPMask          = $00000001;
    kICServicesUDPMask          = $00000002;                    {  both bits can be set, which means the service is both TCP and UDP, eg daytime }


type
    ICServicesPtr = ^ICServices;
    ICServices = record
        count:                  SInt16;
        services:               array [0..0] of ICServiceEntry;
    end;

    ICServicesHandle                    = ^ICServicesPtr;

    {   ***********************************************************************************************
      default file name, for internal use, overridden by a component resource
     ***********************************************************************************************    }


{***********************************************************************************************
  keys
 ***********************************************************************************************}
{
    key reserved for use by Internet Config
}

const
    kICReservedKey              = 'kICReservedKey';
    {
        STR# -- formatted, list of Archie servers
        }
    kICArchieAll                = 'ArchieAll';
    {
        PString -- formatted, preferred Archie server
        }
    kICArchiePreferred          = 'ArchiePreferred';
    {
        ICCharTable -- Mac-to-Net and Net-to-Mac character translation
        }
    kICCharacterSet             = 'CharacterSet';
    {
        ICFontRecord -- font used for proportional text
        }
    kICDocumentFont             = 'DocumentFont';
    {
        ICFileSpec -- where to put newly downloaded files
        }
    kICDownloadFolder           = 'DownloadFolder';
    {
        PString -- user@host.domain, email address of user, ie return address
        }
    kICEmail                    = 'Email';
    {
        PString -- host.domain, default FTP server
        }
    kICFTPHost                  = 'FTPHost';
    {
        PString -- second level FTP proxy authorisation
        }
    kICFTPProxyAccount          = 'FTPProxyAccount';
    {
        PString -- host.domain
        }
    kICFTPProxyHost             = 'FTPProxyHost';
    {
        PString -- scrambled, password for FTPProxyUser
        }
    kICFTPProxyPassword         = 'FTPProxyPassword';
    {
        PString -- first level FTP proxy authorisation
        }
    kICFTPProxyUser             = 'FTPProxyUser';
    {
        PString -- host.domain, default finger server
        }
    kICFingerHost               = 'FingerHost';
    {
        PString -- host.domain, default Gopher server
        }
    kICGopherHost               = 'GopherHost';
    {
        PString -- host.domain, see note in Prog Docs
        }
    kICGopherProxy              = 'GopherProxy';
    {
        PString -- host.domain
        }
    kICHTTPProxyHost            = 'HTTPProxyHost';
    {
        ICAppSpec -- helpers for URL schemes
        }
    kICHelper                   = 'Helper¥';
    {
        PString -- description for URL scheme
        }
    kICHelperDesc               = 'HelperDesc¥';
    {
        ICAppSpecList -- list of common helpers for URL schemes
        }
    kICHelperList               = 'HelperList¥';
    {
        PString -- host.domain, Internet Relay Chat server
        }
    kICIRCHost                  = 'IRCHost';
    {
        STR# -- formatted, list of Info-Mac servers
        }
    kICInfoMacAll               = 'InfoMacAll';
    {
        PString -- formatted, preferred Info-Mac server
        }
    kICInfoMacPreferred         = 'InfoMacPreferred';
    {
        PString -- string LDAP thing
        }
    kICLDAPSearchbase           = 'LDAPSearchbase';
    {
        PString -- host.domain
        }
    kICLDAPServer               = 'LDAPServer';
    {
        ICFontRecord -- font used for lists of items (eg news article lists)
        }
    kICListFont                 = 'ListFont';
    {
        PString -- host for MacSearch queries
        }
    kICMacSearchHost            = 'MacSearchHost';
    {
        PString -- user@host.domain, account from which to fetch mail
        }
    kICMailAccount              = 'MailAccount';
    {
        TEXT -- extra headers for mail messages
        }
    kICMailHeaders              = 'MailHeaders';
    {
        PString -- scrambled, password for MailAccount
        }
    kICMailPassword             = 'MailPassword';
    {
        ICMapEntries -- file type mapping, see documentation
        }
    kICMapping                  = 'Mapping';
    {
        PString -- host.domain, NNTP server
        }
    kICNNTPHost                 = 'NNTPHost';
    {
        PString -- host.domain, Network Time Protocol (NTP)
        }
    kICNTPHost                  = 'NTPHost';
    {
        Boolean
        }
    kICNewMailDialog            = 'NewMailDialog';
    {
        Boolean -- how to announce new mail
        }
    kICNewMailFlashIcon         = 'NewMailFlashIcon';
    {
        Boolean
        }
    kICNewMailPlaySound         = 'NewMailPlaySound';
    {
        PString
        }
    kICNewMailSoundName         = 'NewMailSoundName';
    {
        PString -- scrambled, password for NewsAuthUsername
        }
    kICNewsAuthPassword         = 'NewsAuthPassword';
    {
        PString -- user name for authorised news servers
        }
    kICNewsAuthUsername         = 'NewsAuthUsername';
    {
        TEXT -- extra headers for news messages
        }
    kICNewsHeaders              = 'NewsHeaders';
    {
        STR# -- list of domains not to be proxied
        }
    kICNoProxyDomains           = 'NoProxyDomains';
    {
        PString -- for X-Organization string
        }
    kICOrganization             = 'Organization';
    {
        PString -- host.domain, default Ph server
        }
    kICPhHost                   = 'PhHost';
    {
        TEXT -- default response for finger servers
        }
    kICPlan                     = $506C616E (* 'Plan' *);
    {
        ICFontRecord -- font used to print ScreenFont
        }
    kICPrinterFont              = 'PrinterFont';
    {
        PString -- used to quote responses in news and mail
        }
    kICQuotingString            = 'QuotingString';
    {
        PString -- real name of user
        }
    kICRealName                 = 'RealName';
    {
        PString -- RTSP Proxy Host
        }
    kICRTSPProxyHost            = 'RTSPProxyHost';
    {
        PString -- host.domain, SMTP server
        }
    kICSMTPHost                 = 'SMTPHost';
    {
        ICFontRecord -- font used for monospaced text (eg news articles)
        }
    kICScreenFont               = 'ScreenFont';
    {
        ICServices -- TCP and IP port-to-name mapping
        }
    kICServices                 = 'Services';
    {
        TEXT -- append to news and mail messages
        }
    kICSignature                = 'Signature';
    {
        TEXT -- preferred mailing address
        }
    kICSnailMailAddress         = 'SnailMailAddress';
    {
        PString -- host.domain, remember that host.domain format allows ":port" and " port"
        }
    kICSocksHost                = 'SocksHost';
    {
        PString -- host.domain, default Telnet address
        }
    kICTelnetHost               = 'TelnetHost';
    {
        STR# -- formatted, list of UMich servers
        }
    kICUMichAll                 = 'UMichAll';
    {
        PString -- formatted, preferred UMich server
        }
    kICUMichPreferred           = 'UMichPreferred';
    {
        Boolean
        }
    kICUseFTPProxy              = 'UseFTPProxy';
    {
        Boolean
        }
    kICUseGopherProxy           = 'UseGopherProxy';
    {
        Boolean
        }
    kICUseHTTPProxy             = 'UseHTTPProxy';
    {
        Boolean -- use PASV command for FTP transfers
        }
    kICUsePassiveFTP            = 'UsePassiveFTP';
    {
        Boolean
        }
    kICUseRTSPProxy             = 'UseRTSPProxy';
    {
        Boolean
        }
    kICUseSocks                 = 'UseSocks';
    {
        PString -- no idea
        }
    kICWAISGateway              = 'WAISGateway';
    {
        PString -- URL, users default WWW page
        }
    kICWWWHomePage              = 'WWWHomePage';
    {
        RGBColor -- background colour for web pages
        }
    kICWebBackgroundColour      = 'WebBackgroundColour';
    {
        RGBColor -- colour for read links
        }
    kICWebReadColor             = '646F6777¥WebReadColor';
    {
        PString -- URL, users default search page
        }
    kICWebSearchPagePrefs       = 'WebSearchPagePrefs';
    {
        RGBColor -- colour for normal text
        }
    kICWebTextColor             = 'WebTextColor';
    {
        Boolean -- whether to underline links
        }
    kICWebUnderlineLinks        = '646F6777¥WebUnderlineLinks';
    {
        RGBColor -- colour for unread links
        }
    kICWebUnreadColor           = '646F6777¥WebUnreadColor';
    {
        PString -- host.domain, default whois server
        }
    kICWhoisHost                = 'WhoisHost';

    {   ***********************************************************************************************

          FUNCTIONS

          What do the annotations after each API mean?
          --------------------------------------------

          [r1] Requires IC 1.1 or higher.
          [r2] Requires IC 1.2 or higher.
          [r3] Requires IC 2.0 or higher.
          [r4] Requires IC 2.5 or higher.

          IMPORTANT:

          In IC 2.5, instances automatically use the default configuration.
          You no longer need to configure an instance explicitly, except
          if your code might run with an older version of IC.  So the following
          notes only apply to IC 2.0 and earlier.

          [c1]  You must have specified a configuration before calling this routine.

          [c2]  You must have specified the default configuration before calling this
                routine.

          [c3]  You do not need to specify a configuration before calling this routine.

          [b1]  You must be inside a Begin/End pair when calling this routine.

          [b2]  You must be inside a Begin/End read/write pair when calling this routine.

          [b3]  You do not need to be inside a Begin/End pair when calling this routine.

          [b4]  If you are getting or setting multiple preferences, you should make this
                call inside a Begin/End pair. If you do not make this call inside a Begin/End
                pair, the call will automatically do it for you.

          [b5]  It is illegal to call this routine inside a Begin/End pair.

     ***********************************************************************************************    }

    {    ***** Starting Up and Shutting Down *****      }
    {
     *  ICStart()
     *
     *  Availability:
     *    Non-Carbon CFM:   in InternetConfig 2.5 and later
     *    CarbonLib:        in CarbonLib 1.0.2 and later
     *    Mac OS X:         in version 10.0 and later
        }
function ICStart(var inst: ICInstance; signature: OSType): OSStatus; external name '_ICStart';

{ Call this at application initialisation. Set signature to a value
   * which has been regsitered with DTS to allow for future expansion
   * of the IC system. Returns inst as a connection to the IC system.
   }
{
 *  ICStop()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InternetConfig 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ICStop(inst: ICInstance): OSStatus; external name '_ICStop';

{ [b5]
   * Call this at application initialisation, after which inst
   * is no longer valid connection to IC.
   }
{
 *  ICGetVersion()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InternetConfig 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ICGetVersion(inst: ICInstance; whichVersion: SInt32; var version: UInt32): OSStatus; external name '_ICGetVersion';
{ [r4] [c3] [b3]
   * Returns the version of Internet Config.  Pass kICComponentVersion
   * to get the version as previously returned by GetComponenVerson.
   * Pass kICNumVersion to get a NumVersion structure.
   }
{ ***** Specifying a Configuration *****  }

{
 *  ICGetConfigName()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InternetConfig 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ICGetConfigName(inst: ICInstance; longname: boolean; var name: Str255): OSStatus; external name '_ICGetConfigName';
{ [r2] [c1] [b3]
   * Returns a string that describes the current configuration at a user
   * level. Set longname to true if you want a long name, up to 255
   * characters, or false if you want a short name, typically about 32
   * characters.
   * The returned string is for user display only. If you rely on the
   * exact format of it, you will conflict with any future IC
   * implementation that doesn't use explicit preference files.
   }

{
 *  ICGetSeed()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InternetConfig 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ICGetSeed(inst: ICInstance; var seed: SInt32): OSStatus; external name '_ICGetSeed';
{ [c3] [b3]
   * Returns the current seed for the IC prefs database.
   * This seed changes each time a non-volatile preference is changed.
   * You can poll this to determine if any cached preferences change.
   }
{
 *  ICGetPerm()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InternetConfig 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ICGetPerm(inst: ICInstance; var perm: ICPerm): OSStatus; external name '_ICGetPerm';
{ [c3] [b3]
   * Returns the access permissions currently associated with this instance.
   * While applications normally know what permissions they have,
   * this routine is designed for use by override components.
   }

{
 *  ICBegin()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InternetConfig 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ICBegin(inst: ICInstance; perm: ByteParameter): OSStatus; external name '_ICBegin';
{ [c1] [b5]
   * Starting reading or writing multiple preferences.
   * A call to this must be balanced by a call to ICEnd.
   * Do not call WaitNextEvent between these calls.
   * The perm specifies whether you intend to read or read/write.
   * Only one writer is allowed per instance.
   * Note that this may open resource files that are not closed
   * until you call ICEnd.
   }
{
 *  ICGetPref()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InternetConfig 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ICGetPref(inst: ICInstance; const (*var*) key: Str255; var attr: ICAttr; buf: UnivPtr; var size: SInt32): OSStatus; external name '_ICGetPref';
{ [c1] [b4]
   * Reads the preference specified by key from the IC database to the
   * buffer pointed to by buf and size.
   * key must not be the empty string.
   * If buf is nil then no data is returned.
   * size must be non-negative.
   * attr and size are always set on return. On errors (except icTruncatedErr)
   * attr is set to ICattr_no_change and size is set to 0.
   * size is the actual size of the data.
   * attr is set to the attributes associated with the preference.
   * If this routine returns icTruncatedErr then the other returned
   * values are valid except that only the first size bytes have been
   * return. size is adjusted to reflect the true size of the preference.
   * Returns icPrefNotFound if there is no preference for the key.
   }
{
 *  ICSetPref()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InternetConfig 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ICSetPref(inst: ICInstance; const (*var*) key: Str255; attr: ICAttr; buf: UnivPtr; size: SInt32): OSStatus; external name '_ICSetPref';
{ [c1] [b4]
   * Sets the preference specified by key from the IC database to the
   * value pointed to by buf and size.
   * key must not be the empty string.
   * size must be non-negative.
   * If buf is nil then the preference value is not set and size is ignored.
   * If buf is not nil then the preference value is set to the size
   * bytes pointed to by buf.
   * If attr is ICattr_no_change then the preference attributes are not set.
   * Otherwise the preference attributes are set to attr.
   * Returns icPermErr if the previous ICBegin was passed icReadOnlyPerm.
   * Returns icPermErr if current attr is locked, new attr is locked and buf <> nil.
   }
{
 *  ICFindPrefHandle()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InternetConfig 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ICFindPrefHandle(inst: ICInstance; const (*var*) key: Str255; var attr: ICAttr; prefh: Handle): OSStatus; external name '_ICFindPrefHandle';
{ [r2] [c1] [b4]
   * This routine effectively replaces ICGetPrefHandle.
   * Reads the preference specified by key from the IC database into
   * a handle, prefh.
   * key must not be the empty string.
   * attr is set to the attributes associated with the preference.
   * You must set prefh to a non-nil handle before calling this routine.
   * If the preference does not exist, icPrefNotFoundErr is returned.
   }
{
 *  ICGetPrefHandle()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InternetConfig 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ICGetPrefHandle(inst: ICInstance; const (*var*) key: Str255; var attr: ICAttr; var prefh: Handle): OSStatus; external name '_ICGetPrefHandle';
{ [r1] [c1] [b4]
   * This routine is now obsolete. Use ICFindPrefHandle instead.
   * Reads the preference specified by key from the IC database into
   * a newly created handle, prefh.
   * key must not be the empty string.
   * attr is set to the attributes associated with the preference.
   * The incoming value of prefh is ignored.
   * A new handle is created in the current heap and returned in prefh.
   * If the routine returns an error, prefh is set to nil.
   * If the preference does not exist, no error is returned and prefh is set
   * to an empty handle.
   }
{
 *  ICSetPrefHandle()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InternetConfig 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ICSetPrefHandle(inst: ICInstance; const (*var*) key: Str255; attr: ICAttr; prefh: Handle): OSStatus; external name '_ICSetPrefHandle';
{ [r1] [c1] [b4]
   * Sets the preference specified by key from the IC database to the
   * value contained in prefh.
   * key must not be the empty string.
   * If prefh is nil then the preference value is not set.
   * If buf is not nil then the preference value is set to the data
   * contained in it.
   * If attr is ICattr_no_change then the preference attributes are not set.
   * Otherwise the preference attributes are set to attr.
   * Returns icPermErr if the previous ICBegin was passed icReadOnlyPerm.
   * Returns icPermErr if current attr is locked, new attr is locked and prefh <> nil.
   }
{
 *  ICCountPref()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InternetConfig 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ICCountPref(inst: ICInstance; var count: SInt32): OSStatus; external name '_ICCountPref';
{ [c1] [b1]
   * Counts the total number of preferences.
   * If the routine returns an error, count is set to 0.
   }
{
 *  ICGetIndPref()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InternetConfig 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ICGetIndPref(inst: ICInstance; index: SInt32; var key: Str255): OSStatus; external name '_ICGetIndPref';
{ [c1] [b1]
   * Returns the key of the index'th preference.
   * index must be positive.
   * Returns icPrefNotFoundErr if index is greater than the total number of preferences.
   * If the routine returns an error, key is undefined.
   }
{
 *  ICDeletePref()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InternetConfig 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ICDeletePref(inst: ICInstance; const (*var*) key: Str255): OSStatus; external name '_ICDeletePref';
{ [c1] [b2]
   * Deletes the preference specified by key.
   * key must not be the empty string.
   * Returns icPrefNotFound if the preference specified by key is not present.
   }
{
 *  ICEnd()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InternetConfig 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ICEnd(inst: ICInstance): OSStatus; external name '_ICEnd';
{ [c1] [b1]
   * Terminates a preference session, as started by ICBegin.
   * You must have called ICBegin before calling this routine.
   }
{
 *  ICGetDefaultPref()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InternetConfig 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ICGetDefaultPref(inst: ICInstance; const (*var*) key: Str255; prefH: Handle): OSStatus; external name '_ICGetDefaultPref';
{ [r4] [c3] [b5]
   * Returns a default preference value for the specified key.  You
   * must pass in a valid prefH, which is resized to fit the data.
   }
{ ***** User Interface Stuff *****  }
{
 *  ICEditPreferences()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InternetConfig 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ICEditPreferences(inst: ICInstance; const (*var*) key: Str255): OSStatus; external name '_ICEditPreferences';
{ [r1] [c1] [b3]
   * Instructs IC to display the user interface associated with editing
   * preferences and focusing on the preference specified by key.
   * If key is the empty string then no preference should be focused upon.
   * You must have specified a configuration before calling this routine.
   * You do not need to call ICBegin before calling this routine.
   * In the current implementation this launches the IC application
   * (or brings it to the front) and displays the window containing
   * the preference specified by key.
   * It may have a radically different implementation in future
   * IC systems.
   }
{ ***** URL Handling *****  }
{
 *  ICLaunchURL()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InternetConfig 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ICLaunchURL(inst: ICInstance; const (*var*) hint: Str255; data: UnivPtr; len: SInt32; var selStart: SInt32; var selEnd: SInt32): OSStatus; external name '_ICLaunchURL';
{ [r1] [c1] [b3]
   * Parses a URL out of the specified text and feeds it off to the
   * appropriate helper.
   * hint indicates the default scheme for URLs of the form "name@address".
   * If hint is the empty string then URLs of that form are not allowed.
   * data points to the start of the text. It must not be nil.
   * len indicates the length of the text. It must be non-negative.
   * selStart and selEnd should be passed in as the current selection of
   * the text. This selection is given in the same manner as TextEdit,
   * ie if selStart = selEnd then there is no selection only an insertion
   * point. Also selStart ² selEnd and 0 ² selStart ² len and 0 ² selEnd ² len.
   * selStart and selEnd are returned as the bounds of the URL. If the
   * routine returns an error then these new boundaries may be
   * invalid but they will be close.
   * The URL is parsed out of the text and passed off to the appropriate
   * helper using the GURL AppleEvent.
   }
{
 *  ICParseURL()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InternetConfig 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ICParseURL(inst: ICInstance; const (*var*) hint: Str255; data: UnivPtr; len: SInt32; var selStart: SInt32; var selEnd: SInt32; url: Handle): OSStatus; external name '_ICParseURL';
{ [r1] [c1] [b3]
   * Parses a URL out of the specified text and returns it in a canonical form
   * in a handle.
   * hint indicates the default scheme for URLs of the form "name@address".
   * If hint is the empty string then URLs of that form are not allowed.
   * data points to the start of the text. It must not be nil.
   * len indicates the length of the text. It must be non-negative.
   * selStart and selEnd should be passed in as the current selection of
   * the text. This selection is given in the same manner as TextEdit,
   * ie if selStart = selEnd then there is no selection only an insertion
   * point. Also selStart ² selEnd and 0 ² selStart ² len and 0 ² selEnd ² len.
   * selStart and selEnd are returned as the bounds of the URL. If the
   * routine returns an error then these new boundaries may be
   * invalid but they will be close.
   * The incoming url handle must not be nil.  The resulting URL is normalised
   * and copied into the url handle, which is resized to fit.
   }
{
 *  ICCreateGURLEvent()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InternetConfig 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ICCreateGURLEvent(inst: ICInstance; helperCreator: OSType; urlH: Handle; var theEvent: AppleEvent): OSStatus; external name '_ICCreateGURLEvent';
{ [r4] [c1] [b3]
   * Creates a GURL Apple event, targetted at the application whose creator
   * code is helperCreator, with a direct object containing the URL text from urlH.
   }
{
 *  ICSendGURLEvent()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InternetConfig 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ICSendGURLEvent(inst: ICInstance; var theEvent: AppleEvent): OSStatus; external name '_ICSendGURLEvent';
{ [r4] [c1] [b3]
   * Sends theEvent to the target application.
   }
{ ***** Mappings Routines *****
 *
 * Routines for interrogating mappings database.
 *
 * ----- High Level Routines -----
  }
{
 *  ICMapFilename()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InternetConfig 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ICMapFilename(inst: ICInstance; const (*var*) filename: Str255; var entry: ICMapEntry): OSStatus; external name '_ICMapFilename';
{ [r1] [c1] [b4]
   * Takes the name of an incoming file and returns the most appropriate
   * mappings database entry, based on its extension.
   * filename must not be the empty string.
   * Returns icPrefNotFoundErr if no suitable entry is found.
   }
{
 *  ICMapTypeCreator()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InternetConfig 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ICMapTypeCreator(inst: ICInstance; fType: OSType; fCreator: OSType; const (*var*) filename: Str255; var entry: ICMapEntry): OSStatus; external name '_ICMapTypeCreator';
{ [r1] [c1] [b4]
   * Takes the type and creator (and optionally the name) of an outgoing
   * file and returns the most appropriate mappings database entry.
   * The filename may be either the name of the outgoing file or
   * the empty string.
   * Returns icPrefNotFoundErr if no suitable entry found.
   }
{ ----- Mid Level Routines -----  }
{
 *  ICMapEntriesFilename()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InternetConfig 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ICMapEntriesFilename(inst: ICInstance; entries: Handle; const (*var*) filename: Str255; var entry: ICMapEntry): OSStatus; external name '_ICMapEntriesFilename';
{ [r1] [c1] [b3]
   * Takes the name of an incoming file and returns the most appropriate
   * mappings database entry, based on its extension.
   * entries must be a handle to a valid IC mappings database preference.
   * filename must not be the empty string.
   * Returns icPrefNotFoundErr if no suitable entry is found.
   }
{
 *  ICMapEntriesTypeCreator()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InternetConfig 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ICMapEntriesTypeCreator(inst: ICInstance; entries: Handle; fType: OSType; fCreator: OSType; const (*var*) filename: Str255; var entry: ICMapEntry): OSStatus; external name '_ICMapEntriesTypeCreator';
{ [r1] [c1] [b3]
   * Takes the type and creator (and optionally the name) of an outgoing
   * file and returns the most appropriate mappings database entry.
   * entries must be a handle to a valid IC mappings database preference.
   * The filename may be either the name of the outgoing file or
   * the empty string.
   * Returns icPrefNotFoundErr if no suitable entry found.
   }
{ ----- Low Level Routines -----  }
{
 *  ICCountMapEntries()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InternetConfig 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ICCountMapEntries(inst: ICInstance; entries: Handle; var count: SInt32): OSStatus; external name '_ICCountMapEntries';
{ [r1] [c1] [b3]
   * Counts the number of entries in the mappings database.
   * entries must be a handle to a valid IC mappings database preference.
   * count is set to the number of entries.
   }
{
 *  ICGetIndMapEntry()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InternetConfig 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ICGetIndMapEntry(inst: ICInstance; entries: Handle; index: SInt32; var pos: SInt32; var entry: ICMapEntry): OSStatus; external name '_ICGetIndMapEntry';
{ [r1] [c1] [b3]
   * Gets the index'th entry in the mappings database.
   * entries must be a handle to a valid IC mappings database preference.
   * index must be in the range from 1 to the number of entries in the database.
   * The value of pos is ignored on input. pos is set to the position of
   * the index'th entry in the database and is suitable for passing back
   * into ICSetMapEntry.
   * Does not return any user data associated with the entry.
   }
{
 *  ICGetMapEntry()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InternetConfig 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ICGetMapEntry(inst: ICInstance; entries: Handle; pos: SInt32; var entry: ICMapEntry): OSStatus; external name '_ICGetMapEntry';
{ [r1] [c1] [b3]
   * Returns the entry located at position pos in the mappings database.
   * entries must be a handle to a valid IC mappings database preference.
   * pos should be 0 to get the first entry. To get the subsequent entries, add
   * entry.total_size to pos and iterate.
   * Does not return any user data associated with the entry.
   }
{
 *  ICSetMapEntry()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InternetConfig 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ICSetMapEntry(inst: ICInstance; entries: Handle; pos: SInt32; const (*var*) entry: ICMapEntry): OSStatus; external name '_ICSetMapEntry';
{ [r1] [c1] [b3]
   * Sets the entry located at position pos in the mappings database.
   * entries must be a handle to a valid IC mappings database preference.
   * pos should be either a value returned from ICGetIndMapEntry or a value
   * calculated using ICGetMapEntry.
   * entry is a var parameter purely for stack space reasons. It is not
   * modified in any way.
   * Any user data associated with the entry is unmodified.
   }
{
 *  ICDeleteMapEntry()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InternetConfig 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ICDeleteMapEntry(inst: ICInstance; entries: Handle; pos: SInt32): OSStatus; external name '_ICDeleteMapEntry';
{ [r1] [c1] [b3]
   * Deletes the mappings database entry at pos.
   * entries must be a handle to a valid IC mappings database preference.
   * pos should be either a value returned from ICGetIndMapEntry or a value
   * calculated using ICGetMapEntry.
   * Also deletes any user data associated with the entry.
   }
{
 *  ICAddMapEntry()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InternetConfig 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ICAddMapEntry(inst: ICInstance; entries: Handle; const (*var*) entry: ICMapEntry): OSStatus; external name '_ICAddMapEntry';
{ [r1] [c1] [b3]
   * Adds an entry to the mappings database.
   * entries must be a handle to a valid IC mappings database preference.
   * The entry is added to the end of the entries database.
   * No user data is added.
   }
{ ***** Profile Management Routines *****  }
{
 *  ICGetCurrentProfile()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InternetConfig 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ICGetCurrentProfile(inst: ICInstance; var currentID: ICProfileID): OSStatus; external name '_ICGetCurrentProfile';
{ [r3] [c1] [b3]
   * Returns the profile ID of the current profile.
   }
{
 *  ICSetCurrentProfile()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InternetConfig 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ICSetCurrentProfile(inst: ICInstance; newID: ICProfileID): OSStatus; external name '_ICSetCurrentProfile';
{ [r3] [c1] [b3]
   * Sets the current profile to the profile specified in newProfile.
   }
{
 *  ICCountProfiles()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InternetConfig 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ICCountProfiles(inst: ICInstance; var count: SInt32): OSStatus; external name '_ICCountProfiles';
{ [r3] [c1] [b1]
   * Returns the total number of profiles.
   }
{
 *  ICGetIndProfile()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InternetConfig 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ICGetIndProfile(inst: ICInstance; index: SInt32; var thisID: ICProfileID): OSStatus; external name '_ICGetIndProfile';
{ [r3] [c1] [b1]
   * Returns the profile ID of the index'th profile.  index must be positive.
   * Returns icProfileNotFoundErr if index is greater than the total number
   * of profiles.
   }
{
 *  ICGetProfileName()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InternetConfig 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ICGetProfileName(inst: ICInstance; thisID: ICProfileID; var name: Str255): OSStatus; external name '_ICGetProfileName';
{ [r3] [c1] [b3]
   * Returns the name of a profile given its ID.  The name may not uniquely
   * identify the profile.  [That's what the profile ID is for!]  The name
   * is assumed to be in the system script.
   }
{
 *  ICSetProfileName()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InternetConfig 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ICSetProfileName(inst: ICInstance; thisID: ICProfileID; const (*var*) name: Str255): OSStatus; external name '_ICSetProfileName';
{ [r3] [c1] [b3]
   * This routine sets the name of the specified profile.  Profile names
   * need not be unique.  The name should be in the system script.
   }
{
 *  ICAddProfile()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InternetConfig 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ICAddProfile(inst: ICInstance; prototypeID: ICProfileID; var newID: ICProfileID): OSStatus; external name '_ICAddProfile';
{ [r3] [c1] [b2]
   * If prototypeID = kICNilProfileID, this routine
   * creates a default profile, otherwise it creates a
   * profile by cloning the prototype profile.  The ID
   * of the new profile is returned in newID.
   * The new profile will be give a new, unique, name.
   * This does not switch to the new profile.
   }
{
 *  ICDeleteProfile()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InternetConfig 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ICDeleteProfile(inst: ICInstance; thisID: ICProfileID): OSStatus; external name '_ICDeleteProfile';
{ [r3] [c1] [b2]
   * This routine deletes the profile specified by
   * thisID.  Attempting to delete the current profile
   * or the last profile will return error.
   }
{***********************************************************************************************
  NOTHING BELOW THIS DIVIDER IS IN CARBON
 ***********************************************************************************************}
{ ***** Interrupt Safe Routines *****  }


{***********************************************************************************************
  old names for stuff declared above
 ***********************************************************************************************}


{$ALIGN MAC68K}
{#POP}
{unit LaunchServices}
{$ALIGN MAC68K}








{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}



{ ======================================================================================================== }
{ LaunchServices Structures and Enums                                                                      }
{ ======================================================================================================== }


const
    kLSAppInTrashErr            = -10660;                       { The app cannot be run when inside a Trash folder }
    kLSUnknownErr               = -10810;
    kLSNotAnApplicationErr      = -10811;
    kLSNotInitializedErr        = -10812;
    kLSDataUnavailableErr       = -10813;                       {  e.g. no kind string }
    kLSApplicationNotFoundErr   = -10814;                       {  e.g. no application claims the file }
    kLSUnknownTypeErr           = -10815;
    kLSDataTooOldErr            = -10816;
    kLSDataErr                  = -10817;
    kLSLaunchInProgressErr      = -10818;                       {  e.g. opening an alreay opening application }
    kLSNotRegisteredErr         = -10819;
    kLSAppDoesNotClaimTypeErr   = -10820;
    kLSAppDoesNotSupportSchemeWarning = -10821;                 {  not an error, just a warning }
    kLSServerCommunicationErr   = -10822;                       {  cannot set recent items }
    kLSCannotSetInfoErr         = -10823;                       {  you may not set item info for this item }
    kLSNoRegistrationInfoErr    = -10824;                       { the item contains no registration info }
    kLSIncompatibleSystemVersionErr = -10825;                   { the app cannot run on the current OS version }
    kLSNoLaunchPermissionErr    = -10826;                       { user doesn't have permission to launch the app (managed networks) }
    kLSNoExecutableErr          = -10827;                       { the executable is missing or has an unusable format }
    kLSNoClassicEnvironmentErr  = -10828;                       { the Classic environment was required but is not available }
    kLSMultipleSessionsNotSupportedErr = -10829;                { the app cannot run simultaneously in two different sessions }


type
    LSInitializeFlags                   = OptionBits;

const
    kLSInitializeDefaults       = $00000001;

    kLSMinCatInfoBitmap         = $0000180A;                    { do not use }{  minimum info needed to avoid a FSGetCatalogInfo call when fetching item information  }

    kLSInvalidExtensionIndex    = $FFFFFFFF;                    {  Index returned from LSGetExtensionInfo when name has no extension }


type
    LSRequestedInfo                     = OptionBits;

const
    kLSRequestExtension         = $00000001;                    {  safe to use from threads } { thread-safe in 10.0 }
    kLSRequestTypeCreator       = $00000002;                    {  safe to use from threads } { thread-safe in 10.0 }
    kLSRequestBasicFlagsOnly    = $00000004;                    {  all but type of application and extension flags - safe to use from threads } { thread-safe in 10.2 }
    kLSRequestAppTypeFlags      = $00000008;                    {  NOT SAFE to use from threads } { thread-safe in 10.2 }
    kLSRequestAllFlags          = $00000010;                    {  NOT SAFE to use from threads } { thread-safe in 10.2 }
    kLSRequestIconAndKind       = $00000020;                    {  NOT SAFE to use from threads } { thread-safe in 10.2 }
    kLSRequestExtensionFlagsOnly = $00000040;                   {  safe to use from threads } { thread-safe in 10.0 }
    kLSRequestAllInfo           = $FFFFFFFF;                    {  NOT SAFE to use from threads } { thread-safe in 10.2 }


type
    LSItemInfoFlags                     = OptionBits;

const
    kLSItemInfoIsPlainFile      = $00000001;                    {  none of the following applies }
    kLSItemInfoIsPackage        = $00000002;                    {  app, doc, or bundle package }
    kLSItemInfoIsApplication    = $00000004;                    {  single-file or packaged }
    kLSItemInfoIsContainer      = $00000008;                    {  folder or volume }
    kLSItemInfoIsAliasFile      = $00000010;                    {  'real' alias }
    kLSItemInfoIsSymlink        = $00000020;                    {  UNIX symbolic link only }
    kLSItemInfoIsInvisible      = $00000040;                    {  does not include '.' files or '.hidden' entries }
    kLSItemInfoIsNativeApp      = $00000080;                    {  Carbon or Cocoa native app }
    kLSItemInfoIsClassicApp     = $00000100;                    {  CFM Classic app }
    kLSItemInfoAppPrefersNative = $00000200;                    {  Carbon app that prefers to be launched natively }
    kLSItemInfoAppPrefersClassic = $00000400;                   {  Carbon app that prefers to be launched in Classic }
    kLSItemInfoAppIsScriptable  = $00000800;                    {  App can be scripted }
    kLSItemInfoIsVolume         = $00001000;                    {  item is a volume }
    kLSItemInfoExtensionIsHidden = $00100000;                   {  item has a hidden extension }


type
    LSRolesMask                         = OptionBits;

const
    kLSRolesNone                = $00000001;                    {  no claim is made about support for this type/scheme }
    kLSRolesViewer              = $00000002;                    {  claim to be able to view this type/scheme }
    kLSRolesEditor              = $00000004;                    {  claim to be able to edit this type/scheme }
    kLSRolesAll                 = $FFFFFFFF;                    {  claim to do it all }


type
    LSKindID                            = UInt32;

const
    kLSUnknownKindID            = 0;

    kLSUnknownType              = 0;
    kLSUnknownCreator           = 0;


type
    LSItemInfoRecordPtr = ^LSItemInfoRecord;
    LSItemInfoRecord = record
        flags:                  LSItemInfoFlags;
        filetype:               OSType;
        creator:                OSType;
        extension:              CFStringRef;                            {  release when finished }
        iconFileName:           CFStringRef;                            {  not for general use }
        kindID:                 LSKindID;                               {  not for general use }
    end;

    LSAcceptanceFlags                   = OptionBits;

const
    kLSAcceptDefault            = $00000001;
    kLSAcceptAllowLoginUI       = $00000002;                    {  show UI to log in if necessary }


type
    LSLaunchFlags                       = OptionBits;

const
    kLSLaunchDefaults           = $00000001;                    {  default = open, async, use Info.plist, start Classic }
    kLSLaunchAndPrint           = $00000002;                    {  print items instead of open them }
    kLSLaunchReserved2          = $00000004;
    kLSLaunchReserved3          = $00000008;
    kLSLaunchReserved4          = $00000010;
    kLSLaunchReserved5          = $00000020;
    kLSLaunchReserved6          = $00000040;
    kLSLaunchInhibitBGOnly      = $00000080;                    {  causes launch to fail if target is background-only. }
    kLSLaunchDontAddToRecents   = $00000100;                    {  do not add app or documents to recents menus. }
    kLSLaunchDontSwitch         = $00000200;                    {  don't bring new app to the foreground. }
    kLSLaunchNoParams           = $00000800;                    {  Use Info.plist to determine launch parameters }
    kLSLaunchAsync              = $00010000;                    {  launch async; obtain results from kCPSNotifyLaunch. }
    kLSLaunchStartClassic       = $00020000;                    {  start up Classic environment if required for app. }
    kLSLaunchInClassic          = $00040000;                    {  force app to launch in Classic environment. }
    kLSLaunchNewInstance        = $00080000;                    {  Instantiate app even if it is already running. }
    kLSLaunchAndHide            = $00100000;                    {  Send child a "hide" request as soon as it checks in. }
    kLSLaunchAndHideOthers      = $00200000;                    {  Hide all other apps when child checks in. }


type
    LSLaunchFSRefSpecPtr = ^LSLaunchFSRefSpec;
    LSLaunchFSRefSpec = record
        appRef:                 FSRefPtr;                               {  app to use, can be NULL }
        numDocs:                UInt32;                                 {  items to open/print, can be NULL }
        itemRefs:               FSRefPtr;                               {  array of FSRefs }
        passThruParams:         AEDescPtr;                              {  passed untouched to application as optional parameter }
        launchFlags:            LSLaunchFlags;
        asyncRefCon:            Ptr;                                    {  used if you register for app birth/death notification }
    end;

    LSLaunchURLSpecPtr = ^LSLaunchURLSpec;
    LSLaunchURLSpec = record
        appURL:                 CFURLRef;                               {  app to use, can be NULL }
        itemURLs:               CFArrayRef;                             {  items to open/print, can be NULL }
        passThruParams:         AEDescPtr;                              {  passed untouched to application as optional parameter }
        launchFlags:            LSLaunchFlags;
        asyncRefCon:            Ptr;                                    {  used if you register for app birth/death notification }
    end;



    {    ========================================================================================================   }
    {    LaunchServices Public Entry Points                                                                         }
    {    ========================================================================================================   }

    {
     *  LSInit()   *** DEPRECATED in 10.3 ***
     *
     *  Discussion:
     *    LSInit is deprecated. Do not use.
     *
     *  Pre 10.3 Summary:
     *    Initialize LaunchServices for use.
     *
     *  Pre 10.3 Discussion:
     *    LSInit is optional but should be called by top level applications
     *    to explicitly incur any startup costs at a known time. Frameworks
     *    and libraries need never call LSInit.
     *
     *  Pre 10.3 Parameters:
     *
     *    inFlags:
     *      Use kLSInitializeDefaults.
     *
     *  Availability:
     *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework but deprecated in 10.3
     *    CarbonLib:        not available in CarbonLib 1.x
     *    Non-Carbon CFM:   not available
        }

// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_3
function LSInit(inFlags: LSInitializeFlags): OSStatus; external name '_LSInit';


{
 *  LSTerm()   *** DEPRECATED in 10.3 ***
 *
 *  Discussion:
 *    LSTerm is deprecated. It does nothing.
 *
 *  Pre 10.3 Summary:
 *    Terminate LaunchServices use.
 *
 *  Pre 10.3 Discussion:
 *    LSTerm is optional but should be called by top level applications
 *    to explicitly terminate LaunchServices activity at a known time.
 *    Frameworks and libraries need never call LSTerm.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework but deprecated in 10.3
 *    CarbonLib:        not available in CarbonLib 1.x
 *    Non-Carbon CFM:   not available
 }

// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_3
function LSTerm: OSStatus; external name '_LSTerm';


{
 *  LSCopyItemInfoForRef()
 *
 *  Summary:
 *    Return information about an item.
 *
 *  Discussion:
 *    Returns as much or as little information as requested about
 *    inItemRef. Some information is available in a thread-safe manner,
 *    some is not. All CFStrings must be released after use.
 *
 *  Mac OS X threading:
 *    Thread safe since version 10.2
 *
 *  Parameters:
 *
 *    inItemRef:
 *      The FSRef of the item about which information is requested.
 *
 *    inWhichInfo:
 *      Flags indicating which information to return
 *
 *    outItemInfo:
 *      Information is returned in this structure. Must not be NULL
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 }
function LSCopyItemInfoForRef(const (*var*) inItemRef: FSRef; inWhichInfo: LSRequestedInfo; var outItemInfo: LSItemInfoRecord): OSStatus; external name '_LSCopyItemInfoForRef';


{
 *  LSCopyItemInfoForURL()
 *
 *  Summary:
 *    Return information about an item.
 *
 *  Discussion:
 *    Returns as much or as little information as requested about
 *    inURL. Some information is available in a thread-safe manner,
 *    some is not. All CFStrings must be released after use.
 *
 *  Mac OS X threading:
 *    Thread safe since version 10.2
 *
 *  Parameters:
 *
 *    inURL:
 *      The CFURLRef of the item about which information is requested.
 *
 *    inWhichInfo:
 *      Flags indicating which information to return
 *
 *    outItemInfo:
 *      Information is returned in this structure. Must not be NULL
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 }
function LSCopyItemInfoForURL(inURL: CFURLRef; inWhichInfo: LSRequestedInfo; var outItemInfo: LSItemInfoRecord): OSStatus; external name '_LSCopyItemInfoForURL';


{
 *  LSGetExtensionInfo()
 *
 *  Summary:
 *    Get information about the extension for a file system name.
 *
 *  Discussion:
 *    Returns the starting index of the extension (not including the
 *    period) or kLSInvalidExtensionIndex if the input name has no
 *    extension.
 *
 *  Mac OS X threading:
 *    Thread safe since version 10.2
 *
 *  Parameters:
 *
 *    inNameLen:
 *      The number of the UniChars in inNameBuffer.
 *
 *    inNameBuffer:
 *      The buffer containing the name's Unicode characters.
 *
 *    outExtStartIndex:
 *      On success, the starting index of the extension if there is one
 *      (not including the period). Set to kLSInvalidExtensionIndex if
 *      inNameBuffer does not contain a valid extension.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x
 *    Mac OS X:         in version 10.1 and later in ApplicationServices.framework
 }
function LSGetExtensionInfo(inNameLen: UniCharCount; inNameBuffer: ConstUniCharPtr; var outExtStartIndex: UniCharCount): OSStatus; external name '_LSGetExtensionInfo';


{
 *  LSCopyDisplayNameForRef()
 *
 *  Summary:
 *    Get the display name for an FSRef.
 *
 *  Discussion:
 *    Return a copy of the display name for an FSRef. Takes into
 *    consideration whether this item has a hidden extension or not.
 *
 *  Mac OS X threading:
 *    Thread safe since version 10.2
 *
 *  Parameters:
 *
 *    inRef:
 *      The FSRef for which the display name is desired.
 *
 *    outDisplayName:
 *      Pointer to the CFString into which the display name should be
 *      copied. Callers must dispose of the resulting CFString.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x
 *    Mac OS X:         in version 10.1 and later in ApplicationServices.framework
 }
function LSCopyDisplayNameForRef(const (*var*) inRef: FSRef; var outDisplayName: CFStringRef): OSStatus; external name '_LSCopyDisplayNameForRef';


{
 *  LSCopyDisplayNameForURL()
 *
 *  Summary:
 *    Get the display name for a CFURLRef.
 *
 *  Discussion:
 *    Return a copy of the display name for a CFURLRef. Takes into
 *    consideration whether this item has a hidden extension or not.
 *
 *  Mac OS X threading:
 *    Thread safe since version 10.2
 *
 *  Parameters:
 *
 *    inURL:
 *      The URL for which the display name is desired.
 *
 *    outDisplayName:
 *      Pointer to the CFString into which the display name should be
 *      copied. Callers must dispose of the resulting CFString.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x
 *    Mac OS X:         in version 10.1 and later in ApplicationServices.framework
 }
function LSCopyDisplayNameForURL(inURL: CFURLRef; var outDisplayName: CFStringRef): OSStatus; external name '_LSCopyDisplayNameForURL';


{
 *  LSSetExtensionHiddenForRef()
 *
 *  Summary:
 *    Sets whether the extension for an FSRef is hidden or not.
 *
 *  Discussion:
 *    Sets the necessary file system state to indicate that the
 *    extension for inRef is hidden, as in the Finder. You can
 *    determine if an FSRef's extension is hidden using
 *    LSCopyItemInfoForRef.
 *
 *  Mac OS X threading:
 *    Thread safe since version 10.2
 *
 *  Parameters:
 *
 *    inRef:
 *      The FSRef for which the extension is to be hidden or shown.
 *
 *    inHide:
 *      True to hide inRef's extension, false to show it.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x
 *    Mac OS X:         in version 10.1 and later in ApplicationServices.framework
 }
function LSSetExtensionHiddenForRef(const (*var*) inRef: FSRef; inHide: boolean): OSStatus; external name '_LSSetExtensionHiddenForRef';


{
 *  LSSetExtensionHiddenForURL()
 *
 *  Summary:
 *    Sets whether the extension for a CFURLRef is hidden or not.
 *
 *  Discussion:
 *    Sets the necessary file system state to indicate that the
 *    extension for inURL is hidden, as in the Finder. You can
 *    determine if a CFURLRef's extension is hidden using
 *    LSCopyItemInfoForURL.
 *
 *  Mac OS X threading:
 *    Thread safe since version 10.2
 *
 *  Parameters:
 *
 *    inURL:
 *      The CFURLRef for which the extension is to be hidden or shown.
 *
 *    inHide:
 *      True to hide inURL's extension, false to show it.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x
 *    Mac OS X:         in version 10.1 and later in ApplicationServices.framework
 }
function LSSetExtensionHiddenForURL(inURL: CFURLRef; inHide: boolean): OSStatus; external name '_LSSetExtensionHiddenForURL';


{
 *  LSCopyKindStringForRef()
 *
 *  Summary:
 *    Get the kind string for an item.
 *
 *  Discussion:
 *    Returns the kind string as used in the Finder and elsewhere for
 *    inFSRef. The CFStringRef must be released after use.
 *
 *  Mac OS X threading:
 *    Thread safe since version 10.2
 *
 *  Parameters:
 *
 *    inFSRef:
 *      The item for which the kind string is requested.
 *
 *    outKindString:
 *      A non-NULL CFStringRef* into which the kind string will be
 *      copied. This CFStringRef must be released after use.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 }
function LSCopyKindStringForRef(const (*var*) inFSRef: FSRef; var outKindString: CFStringRef): OSStatus; external name '_LSCopyKindStringForRef';


{
 *  LSCopyKindStringForURL()
 *
 *  Summary:
 *    Get the kind string for an item.
 *
 *  Discussion:
 *    Returns the kind string as used in the Finder and elsewhere for
 *    inURL. The CFStringRef must be released after use.
 *
 *  Mac OS X threading:
 *    Thread safe since version 10.2
 *
 *  Parameters:
 *
 *    inURL:
 *      The item for which the kind string is requested.
 *
 *    outKindString:
 *      A non-NULL CFStringRef* into which the kind string will be
 *      copied. This CFStringRef must be released after use.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 }
function LSCopyKindStringForURL(inURL: CFURLRef; var outKindString: CFStringRef): OSStatus; external name '_LSCopyKindStringForURL';

{
 *  LSCopyKindStringForTypeInfo()
 *
 *  Summary:
 *    Return the kind string for items like the provided info
 *
 *  Discussion:
 *    Returns the kind string as shown in the Finder for the those
 *    items whose type, creator, and/or extension match the provided
 *    information. The kind string returned will be the one that most
 *    closely describes all the information provided. The kind string
 *    is subject to the document binding preferences that have been
 *    specified by the user. For example, if a creator is specified but
 *    the user has asked for files with the given
 *    creator/type/extension combination to open in an application with
 *    a different creator, the kind string will be loaded from the
 *    user's preferred application.
 *
 *  Mac OS X threading:
 *    Thread safe since version 10.2
 *
 *  Parameters:
 *
 *    inType:
 *      The OSType file type for which you want a kind string. Specify
 *      kLSUnknownType if no file type information is available.
 *
 *    inCreator:
 *      The OSType creator for which you want a kind string. Specify
 *      kLSUnknownCreator if no creator information is available.
 *
 *    inExtension:
 *      The extension for which you want a kind string. Specify NULL if
 *      no extension information is available.
 *
 *    outKindString:
 *      A CFStringRef* to receive the copied kind string object. This
 *      CFStringRef must be released eventually.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in ApplicationServices.framework
 *    CarbonLib:        not available in CarbonLib 1.x
 *    Non-Carbon CFM:   not available
 }

// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
function LSCopyKindStringForTypeInfo(
  inType: OSType;
  inCreator: OSType;
  inExtension: CFStringRef;         { can be NULL }
  VAR outKindString: CFStringRef): OSStatus; external name '_LSCopyKindStringForTypeInfo';



{
 *  LSCopyKindStringForMIMEType()
 *
 *  Summary:
 *    Get the kind string for the specified MIME type.
 *
 *  Discussion:
 *    Returns the localized kind string describing the specified MIME
 *    type.
 *
 *  Mac OS X threading:
 *    Thread safe since version 10.2
 *
 *  Parameters:
 *
 *    inMIMEType:
 *      The string specifying the MIME type.
 *
 *    outKindString:
 *      A CFStringRef* to receive the copied kind string object. This
 *      CFStringRef must be released eventually.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in ApplicationServices.framework
 *    CarbonLib:        not available in CarbonLib 1.x
 *    Non-Carbon CFM:   not available
 }

// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
function LSCopyKindStringForMIMEType(
  inMIMEType: CFStringRef;
  VAR outKindString: CFStringRef): OSStatus; external name '_LSCopyKindStringForMIMEType';

{
 *  LSGetApplicationForItem()
 *
 *  Summary:
 *    Return the application used to open an item.
 *
 *  Discussion:
 *    Consults the binding tables to return the application that would
 *    be used to open inItemRef if it were double-clicked in the
 *    Finder. This application will be the user-specified override if
 *    appropriate or the default otherwise. If no application is known
 *    to LaunchServices suitable for opening this item,
 *    kLSApplicationNotFoundErr will be returned.
 *
 *  Mac OS X threading:
 *    Thread safe since version 10.2
 *
 *  Parameters:
 *
 *    inItemRef:
 *      The FSRef of the item for which the application is requested.
 *
 *    inRoleMask:
 *      Whether to return the editor or viewer for inItemRef. If you
 *      don't care which, use kLSRolesAll.
 *
 *    outAppRef:
 *      Filled in with the FSRef of the application if not NULL.
 *
 *    outAppURL:
 *      Filled in with the CFURLRef of the application if not NULL.
 *      THIS FUNCTION, DESPITE ITS NAME, RETAINS THE URL REFERENCE ON
 *      BEHALF OF THE CALLER. THE CALLER MUST EVENTUALLY RELEASE THE
 *      RETURNED URL REFERENCE.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 }
function LSGetApplicationForItem(const (*var*) inItemRef: FSRef; inRoleMask: LSRolesMask; outAppRef: FSRefPtr; outAppURL: CFURLRefPtr): OSStatus; external name '_LSGetApplicationForItem';


{
 *  LSGetApplicationForInfo()
 *
 *  Summary:
 *    Return the application used to open items with particular data.
 *
 *  Discussion:
 *    Consults the binding tables to return the application that would
 *    be used to open items with type, creator, and/or extension as
 *    provided if they were double-clicked in the Finder. This
 *    application will be the default for items like this if one has
 *    been set. If no application is known to LaunchServices suitable
 *    for opening such items, kLSApplicationNotFoundErr will be
 *    returned. Not all three input parameters can be NULL at the same
 *    time nor can both output parameters be NULL at the same time.
 *
 *  Mac OS X threading:
 *    Thread safe since version 10.2
 *
 *  Parameters:
 *
 *    inType:
 *      The file type to consider. Can be kLSUnknownType.
 *
 *    inCreator:
 *      The file creator to consider. Can be kLSUnknownCreator.
 *
 *    inExtension:
 *      The file name extension to consider. Can be NULL.
 *
 *    inRoleMask:
 *      Whether to return the editor or viewer for inItemRef. If you
 *      don't care which, use kLSRolesAll.
 *
 *    outAppRef:
 *      Filled in with the FSRef of the application if not NULL.
 *
 *    outAppURL:
 *      Filled in with the CFURLRef of the application if not NULL.
 *      THIS FUNCTION, DESPITE ITS NAME, RETAINS THE URL REFERENCE ON
 *      BEHALF OF THE CALLER. THE CALLER MUST EVENTUALLY RELEASE THE
 *      RETURNED URL REFERENCE.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 }
function LSGetApplicationForInfo(inType: OSType; inCreator: OSType; inExtension: CFStringRef; inRoleMask: LSRolesMask; outAppRef: FSRefPtr; outAppURL: CFURLRefPtr): OSStatus; external name '_LSGetApplicationForInfo';

{
 *  LSCopyApplicationForMIMEType()
 *
 *  Summary:
 *    Return the application used to handle data with the specified
 *    MIME type.
 *
 *  Discussion:
 *    The returned application URL will be the user's preferred handler
 *    for the MIME type if one has been set. If no user preferred
 *    application has been set, Launch Services will select a default
 *    handler for the MIME type. If no application is known to handle
 *    the MIME type, kLSApplicationNotFoundErr will be returned.
 *
 *  Mac OS X threading:
 *    Thread safe since version 10.2
 *
 *  Parameters:
 *
 *    inMIMEType:
 *      The string specifying the MIME type.
 *
 *    inRoleMask:
 *      A role mask that the chosen application must satisfy. Use
 *      kLSRolesAll if the role is not important.
 *
 *    outAppURL:
 *      Receives the copied CFURLRef, which must be released by the
 *      caller.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in ApplicationServices.framework
 *    CarbonLib:        not available in CarbonLib 1.x
 *    Non-Carbon CFM:   not available
 }

// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
function LSCopyApplicationForMIMEType(
  inMIMEType: CFStringRef;
  inRoleMask: LSRolesMask;
  VAR outAppURL: CFURLRef): OSStatus; external name '_LSCopyApplicationForMIMEType';


{
 *  LSGetApplicationForURL()
 *
 *  Summary:
 *    Return the application used to open an item.
 *
 *  Discussion:
 *    Consults the binding tables to return the application that would
 *    be used to open inURL if it were double-clicked in the Finder.
 *    This application will be the user-specified override if
 *    appropriate or the default otherwise. If no application is known
 *    to LaunchServices suitable for opening this item,
 *    kLSApplicationNotFoundErr will be returned.
 *
 *  Mac OS X threading:
 *    Thread safe since version 10.2
 *
 *  Parameters:
 *
 *    inURL:
 *      The CFURLRef of the item for which the application is requested.
 *
 *    inRoleMask:
 *      Whether to return the editor or viewer for inItemRef. If you
 *      don't care which, use kLSRolesAll.
 *
 *    outAppRef:
 *      Filled in with the FSRef of the application if not NULL.
 *
 *    outAppURL:
 *      Filled in with the CFURLRef of the application if not NULL.
 *      THIS FUNCTION, DESPITE ITS NAME, RETAINS THE URL REFERENCE ON
 *      BEHALF OF THE CALLER. THE CALLER MUST EVENTUALLY RELEASE THE
 *      RETURNED URL REFERENCE.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 }
function LSGetApplicationForURL(inURL: CFURLRef; inRoleMask: LSRolesMask; var outAppRef: FSRef; var outAppURL: CFURLRef): OSStatus; external name '_LSGetApplicationForURL';


{
 *  LSFindApplicationForInfo()
 *
 *  Summary:
 *    Locate a specific application.
 *
 *  Discussion:
 *    Returns the application with the corresponding input information.
 *    The registry of applications is consulted first in order of
 *    bundleID, then creator, then name. All comparisons are case
 *    insensitive and 'ties' are decided first by version, then by
 *    native vs. Classic.
 *
 *  Mac OS X threading:
 *    Thread safe since version 10.2
 *
 *  Parameters:
 *
 *    inCreator:
 *      The file creator to consider. Can be kLSUnknownCreator.
 *
 *    inBundleID:
 *      The bundle ID to consider. Can be NULL.
 *
 *    inName:
 *      The name to consider. Can be NULL. Must include any extensions
 *      that are part of the file system name, e.g. '.app'.
 *
 *    outAppRef:
 *      Filled in with the FSRef of the application if not NULL.
 *
 *    outAppURL:
 *      Filled in with the CFURLRef of the application if not NULL.
 *      THIS FUNCTION, DESPITE ITS NAME, RETAINS THE URL REFERENCE ON
 *      BEHALF OF THE CALLER. THE CALLER MUST EVENTUALLY RELEASE THE
 *      RETURNED URL REFERENCE.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 }
function LSFindApplicationForInfo(inCreator: OSType; inBundleID: CFStringRef; inName: CFStringRef; outAppRef: FSRefPtr; outAppURL: CFURLRefPtr): OSStatus; external name '_LSFindApplicationForInfo';


{
 *  LSCanRefAcceptItem()
 *
 *  Summary:
 *    Determine whether an item can accept another item.
 *
 *  Discussion:
 *    Returns in outAcceptsItem whether inTargetRef can accept
 *    inItemFSRef as in a drag and drop operation. If inRoleMask is
 *    other than kLSRolesAll then make sure inTargetRef claims to
 *    fulfill the requested role.
 *
 *  Mac OS X threading:
 *    Thread safe since version 10.2
 *
 *  Parameters:
 *
 *    inItemFSRef:
 *      FSRef of the item about which acceptance is requested.
 *
 *    inTargetRef:
 *      FSRef of the potential target.
 *
 *    inRoleMask:
 *      The role(s) the target must claim in order to consider
 *      acceptance.
 *
 *    inFlags:
 *      Use kLSAcceptDefault.
 *
 *    outAcceptsItem:
 *      Filled in with result. Must not be NULL.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 }
function LSCanRefAcceptItem(const (*var*) inItemFSRef: FSRef; const (*var*) inTargetRef: FSRef; inRoleMask: LSRolesMask; inFlags: LSAcceptanceFlags; var outAcceptsItem: boolean): OSStatus; external name '_LSCanRefAcceptItem';


{
 *  LSCanURLAcceptURL()
 *
 *  Summary:
 *    Determine whether an item can accept another item.
 *
 *  Discussion:
 *    Returns in outAcceptsItem whether inTargetURL can accept
 *    inItemURL as in a drag and drop operation. If inRoleMask is other
 *    than kLSRolesAll then make sure inTargetRef claims to fulfill the
 *    requested role.
 *
 *  Mac OS X threading:
 *    Thread safe since version 10.2
 *
 *  Parameters:
 *
 *    inItemURL:
 *      CFURLRef of the item about which acceptance is requested.
 *
 *    inTargetURL:
 *      CFURLRef of the potential target.
 *
 *    inRoleMask:
 *      The role(s) the target must claim in order to consider
 *      acceptance.
 *
 *    inFlags:
 *      Use kLSAcceptDefault.
 *
 *    outAcceptsItem:
 *      Filled in with result. Must not be NULL.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 }
function LSCanURLAcceptURL(inItemURL: CFURLRef; inTargetURL: CFURLRef; inRoleMask: LSRolesMask; inFlags: LSAcceptanceFlags; var outAcceptsItem: boolean): OSStatus; external name '_LSCanURLAcceptURL';


{
 *  LSRegisterURL()
 *
 *  Discussion:
 *    If the specified URL refers to an application or other bundle
 *    claiming to handle documents or URLs, add the bundle's document
 *    and URL claims to the Launch Services database.
 *
 *  Mac OS X threading:
 *    Thread safe since version 10.3
 *
 *  Parameters:
 *
 *    inURL:
 *      The CFURLRef of the item (a directory or file) to be registered.
 *
 *    inUpdate:
 *      When false, LSRegisterURL does not register the item if it has
 *      already been registered and the current modification date of
 *      the item has not changed from when it was last registered. When
 *      true, the item's registered info is updated, even if the
 *      modification has not changed.
 *
 *  Result:
 *    An OSStatus value: noErr - Success kLSNoRegistrationInfoErr - The
 *    item does not contain info requiring registration kLSDataErr -
 *    The item's property list info is malformed.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in ApplicationServices.framework
 *    CarbonLib:        not available in CarbonLib 1.x
 *    Non-Carbon CFM:   not available
 }

// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function LSRegisterURL(
  inURL: CFURLRef;
  inUpdate: Boolean): OSStatus; external name '_LSRegisterURL';


{
 *  LSRegisterFSRef()
 *
 *  Discussion:
 *    If the specified FSRef refers to an application or other bundle
 *    claiming to handle documents or URLs, add the bundle's document
 *    and URL claims to the Launch Services database.
 *
 *  Mac OS X threading:
 *    Thread safe since version 10.3
 *
 *  Parameters:
 *
 *    inRef:
 *      The FSRef of the item to be registered.
 *
 *    inUpdate:
 *      When false, LSRegisterFSRef does not register the item if it
 *      has already been registered and the current modification date
 *      of the item has not changed from when it was last registered.
 *      When true, the item's registered info is updated, even if the
 *      modification has not changed.
 *
 *  Result:
 *    An OSStatus value: noErr - Success kLSNoRegistrationInfoErr - The
 *    item does not contain info requiring registration kLSDataErr -
 *    The item's property list info is malformed.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in ApplicationServices.framework
 *    CarbonLib:        not available in CarbonLib 1.x
 *    Non-Carbon CFM:   not available
 }

// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function LSRegisterFSRef(
   const (*var*) inRef: FSRef;
  inUpdate: Boolean): OSStatus; external name '_LSRegisterFSRef';



{
 *  LSCopyApplicationURLsForURL()
 *
 *  Discussion:
 *    Returns an array of URLs to applications that offer the requested
 *    role(s) for the input item.
 *
 *  Mac OS X threading:
 *    Thread safe since version 10.3
 *
 *  Parameters:
 *
 *    inURL:
 *      The CFURLRef of the item for which all suitable applications
 *      are desired. If the URL is a file URL, it is treated as a
 *      document, and applications are selected based on the document's
 *      type information. Otherwise, applications are selected based on
 *      the URL's scheme.
 *
 *    inRoleMask:
 *      The role(s) which must intersect with the role provided by an
 *      application for the specified item in order for the application
 *      to be included in the result. Pass kLSRolesAll if any role is
 *      acceptable.
 *
 *  Result:
 *    An array of CFURLRefs, one for each application which can open
 *    inURL with at least one of the roles in inRoleMask, or NULL if no
 *    applications can open the item. When an array is returned, you
 *    must eventually release it.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in ApplicationServices.framework
 *    CarbonLib:        not available in CarbonLib 1.x
 *    Non-Carbon CFM:   not available
 }

// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function LSCopyApplicationURLsForURL(
  inURL: CFURLRef;
  inRoleMask: LSRolesMask): CFArrayRef; external name '_LSCopyApplicationURLsForURL';


{
 *  LSOpenFSRef()
 *
 *  Summary:
 *    Open an application, document, or folder.
 *
 *  Discussion:
 *    Opens applications, documents, and folders. Applications are
 *    opened via an 'oapp' or 'rapp' event. Documents are opened in
 *    their user-overridden or default applications as appropriate.
 *    Folders are opened in the Finder. Use the more specific
 *    LSOpenFromRefSpec for more control over launching.
 *
 *  Mac OS X threading:
 *    Thread safe since version 10.2
 *
 *  Parameters:
 *
 *    inRef:
 *      The FSRef of the item to launch.
 *
 *    outLaunchedRef:
 *      The FSRef of the item actually launched. For inRefs that are
 *      documents, outLaunchedRef will be the application used to
 *      launch the document. Can be NULL.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 }
function LSOpenFSRef(const (*var*) inRef: FSRef; outLaunchedRef: FSRefPtr): OSStatus; external name '_LSOpenFSRef';


{
 *  LSOpenCFURLRef()
 *
 *  Summary:
 *    Open an application, document, or folder.
 *
 *  Discussion:
 *    Opens applications, documents, and folders. Applications are
 *    opened via an 'oapp' or 'rapp' event. Documents are opened in
 *    their user-overridden or default applications as appropriate.
 *    Folders are opened in the Finder. Use the more specific
 *    LSOpenFromURLSpec for more control over launching.
 *
 *  Mac OS X threading:
 *    Thread safe since version 10.2
 *
 *  Parameters:
 *
 *    inURL:
 *      The CFURLRef of the item to launch.
 *
 *    outLaunchedURL:
 *      The CFURLRef of the item actually launched. For inURLs that are
 *      documents, outLaunchedURL will be the application used to
 *      launch the document. Can be NULL. THIS FUNCTION, DESPITE ITS
 *      NAME, RETAINS THE URL REFERENCE ON BEHALF OF THE CALLER. THE
 *      CALLER MUST EVENTUALLY RELEASE THE RETURNED URL REFERENCE.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 }
function LSOpenCFURLRef(inURL: CFURLRef; outLaunchedURL: CFURLRefPtr): OSStatus; external name '_LSOpenCFURLRef';


{
 *  LSOpenFromRefSpec()
 *
 *  Summary:
 *    Opens an application or one or more documents or folders.
 *
 *  Discussion:
 *    Opens applications, documents, and folders.
 *
 *  Mac OS X threading:
 *    Thread safe since version 10.2
 *
 *  Parameters:
 *
 *    inLaunchSpec:
 *      The specification of what to launch and how to launch it.
 *
 *    outLaunchedRef:
 *      The FSRef of the item actually launched. For inRefs that are
 *      documents, outLaunchedRef will be the application used to
 *      launch the document. Can be NULL.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 }
function LSOpenFromRefSpec(const (*var*) inLaunchSpec: LSLaunchFSRefSpec; outLaunchedRef: FSRefPtr): OSStatus; external name '_LSOpenFromRefSpec';


{
 *  LSOpenFromURLSpec()
 *
 *  Summary:
 *    Opens an application or one or more documents or folders.
 *
 *  Discussion:
 *    Opens applications, documents, and folders.
 *
 *  Mac OS X threading:
 *    Thread safe since version 10.2
 *
 *  Parameters:
 *
 *    inLaunchSpec:
 *      The specification of what to launch and how to launch it.
 *
 *    outLaunchedURL:
 *      The CFURLRef of the item actually launched. For inURLs that are
 *      documents, outLaunchedURL will be the application used to
 *      launch the document. Can be NULL. THIS FUNCTION, DESPITE ITS
 *      NAME, RETAINS THE URL REFERENCE ON BEHALF OF THE CALLER. THE
 *      CALLER MUST EVENTUALLY RELEASE THE RETURNED URL REFERENCE.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x
 *    Mac OS X:         in version 10.0 and later
 }
function LSOpenFromURLSpec(const (*var*) inLaunchSpec: LSLaunchURLSpec; outLaunchedURL: CFURLRefPtr): OSStatus; external name '_LSOpenFromURLSpec';


{$ALIGN MAC68K}
{#POP}
{unit Pasteboard}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN POWER}
{#LibExport+}


{
 *  Pasteboard Manager
 *
 *  Discussion:
 *    Pasteboard Manager is the replacement of the Scrap and Drag
 *    flavor APIs. Like the Scrap Manager, it is a cross process data
 *    transport mechanism. Unlike the Drag Manager, it is not bound to
 *    particular high level user actions to initiate and resolve the
 *    data transport. This allows the Pasteboard Manager to be used as
 *    the data transport mechanism for copy and paste, drag and drop,
 *    services, as well as generic cross process communication.
 *
 *
 *    Like scraps, pasteboards are local references to global, cross
 *    process, resources. Although, where scraps exist forever,
 *    pasteboard are CFTypes and should be released at the end of their
 *    usefulness. Multiple pasteboard references in a single
 *    application may point to the same global pasteboard resource.
 *    Once the global pasteboard resource has been cleared, all
 *    pasteboard references to that global resource in the application
 *    share ownership allowing any of them to add data to the
 *    pasteboard. Of course, this is not a free for all. Once a flavor
 *    has been added it can not be overwritten by another local
 *    reference. Calling CFRelease() on any one of these references
 *    will implicitly call in promises, but only those made through the
 *    particular pasteboard reference being released. In this way,
 *    local pasteboard references in various components of the
 *    application can add data, make promises, keep those promises, and
 *    release their local pasteboard reference independently of the
 *    other components.
 *
 *    For long lived pasteboards, like the clipboard or find
 *    pasteboards, the suggested usage model is for a component to
 *    create a local reference to a pasteboard at the beginning of its
 *    life cycle, hold on to it, and release it at the end of its life
 *    cycle. As long as a pasteboard reference in any application still
 *    points to the global pasteboard resource, the global resource
 *    will not be released. When the final reference is released,
 *    promises will not be called in as the global pasteboard resource
 *    will be released. Only if you want to guarantee a global
 *    pasteboard resource continues to exist beyond the life of your
 *    application should you refrain from calling CFRelease(). In this
 *    case, be sure to call PasteboardResolvePromises() to make sure
 *    any promises are called in. This is not necessary for the
 *    clipboard and find pasteboards as they are retained by the system
 *    and never released.
 *
 *    Like the Drag Manager, the Pasteboard Manager allows the use of
 *    multiple items each with its own set of flavors. When using the
 *    clipboard or find pasteboards, it's traditionally been common to
 *    only use the first item, but now multiple items can be copied as
 *    is the case in the Finder. This also opens up the ability for
 *    services to act on multiple items. Another difference from both
 *    the Scrap and Drag Managers is the use of Uniform Type Identifier
 *    based flavor types rather than four character code OSTypes. These
 *    have several advantages. They allow compatiblity with Cocoa's
 *    NSPasteboard, more accurately describe the data being
 *    transported, provied a type inheritance mechanism and allow
 *    namespacing with a reverse DNS scheme.
 }

type
    PasteboardRef               = ^SInt32; { an opaque 32-bit type }
    PasteboardItemID            = Ptr;

{ Pasteboard Manager error codes }
const
  badPasteboardSyncErr          = -25130; { pasteboard has been modified and must be synchronized }
  badPasteboardIndexErr         = -25131; { item index does not exist }
  badPasteboardItemErr          = -25132; { item reference does not exist }
  badPasteboardFlavorErr        = -25133; { item flavor does not exist }
  duplicatePasteboardFlavorErr  = -25134; { item flavor already exists }
  notPasteboardOwnerErr         = -25135; { client did not clear the pasteboard }
  noPasteboardPromiseKeeperErr  = -25136; { a promise is being added without a promise keeper }



{
 *  PasteboardSyncFlags
 *
 *  Summary:
 *    The following constants are used by the PasteboardSynchronize()
 *    routine to indicate the status of the local pasteboard reference
 *    in relation to the global, cross process pasteboard resource.
 }
type
    PasteboardSyncFlags = UInt32;

const

  {
   * Indicates that the global pasteboard resource has been modified
   * since the last time it was accessed via the local pasteboard
   * reference. The call to PasteboardSynchronize() has updated the
   * local pasteboard reference to sync it up with the global resource.
   * This is a good time to see what new information has been placed on
   * the pasteboard to determine wether any tasty flavors have been
   * added and possibly enable pasting.
   }
    kPasteboardModified           = $00000001; {(1 << 0)}

 {
   * Indicates that the global pasteboard resource was most recently
   * cleared by the this application. Any local pasteboard reference in
   * the client application may add data to the global pasteboard
   * resource.
   }
    kPasteboardClientIsOwner      = $00000002; {(1 << 1)}


{
 *  PasteboardFlavorFlags
 *
 *  Summary:
 *    Pasteboard Flavor Flags
 *
 *  Discussion:
 *    The following constants are used to tag pasteboard item flavors
 *    with bits of useful information. The first five are settable by
 *    the client via PasteboardPutItemFlavor(). They may all be
 *    received via PasteboardGetItemFlavorFlags().
 }
type
    PasteboardFlavorFlags   = UInt32;

const

  {
   * No additional information exists for this flavor.
   }
    kPasteboardFlavorNoFlags            = $00000000;

  {
   * Only the process which has added this flavor can see it. If the
   * process that owns the pasteboard places this flag on a flavor
   * you'll never see it as the receiver so there's no reason to test
   * for it.
   }
    kPasteboardFlavorSenderOnly         = $00000001; {(1 << 0)}

  {
   * The data for this flavor was translated in some manner by the
   * sender before adding it to the pasteboard. Flavors marked with
   * this flag are not stored by the Finder in clipping files.
   }
    kPasteboardFlavorSenderTranslated       = $00000002; {(1 << 1)}

  {
   * Set by the sender if the flavor data should not be saved by the
   * receiver. The data contained may become stale after the end of the
   * drag. Flavors marked with this flag are not stored by the Finder
   * in clipping files.
   }
    kPasteboardFlavorNotSaved               = $00000004; {(1 << 2)}

  {
   * Like kPasteboardFlavorSenderOnly, when the sender adds this flag,
   * the presence of this flavor will not be made known when
   * PasteboardCopyItemFlavors() is called by the receiver. However,
   * the flavor flags and data can be accessed when explicitly
   * requested via PasteboardGetItemFlavorFlags() or
   * PasteboardCopyItemFlavorData(). This allows a suite of
   * applications to communicate without exporting their method of
   * communication.
   }
    kPasteboardFlavorRequestOnly            = $00000008; {(1 << 3)}

  {
   * The data for this flavor is provided by the Translation Manager as
   * a convenience to receivers. Flavors marked with this flag are not
   * stored by the Finder in clipping files. This flag can not be added
   * by clients. It is automatically added by the Pasteboard Manager
   * when appropriate.
   }
    kPasteboardFlavorSystemTranslated = $00000100; {(1 << 8)}

  {
   * The data for this flavor has not yet been added to the pasteboard
   * by the sender. This may have been done as a performance measure if
   * the data is expensive to generate. A request by the receiver to
   * obtain the data will cause the promise to be kept by the sender.
   * This flag can not be added by clients. It is automatically added
   * by the Pasteboard Manager when appropriate.
   }
    kPasteboardFlavorPromised     = $00000200; {(1 << 9)}

{
 *  PasteboardGetTypeID()
 *
 *  Summary:
 *    Returns the CFType identifier for a pasteboard object.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Result:
 *    A CFTypeID unique to pasteboard instances.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in ApplicationServices.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
 *    Non-Carbon CFM:   not available
 }

// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function PasteboardGetTypeID: CFTypeID; external name '_PasteboardGetTypeID';

{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kPasteboardClipboard CFSTRP('com.apple.pasteboard.clipboard')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kPasteboardFind CFSTRP('com.apple.pasteboard.find')}
{$endc}

const
    kPasteboardUniqueName   = NIL;

{
 *  PasteboardCreate()
 *
 *  Summary:
 *    Creates a local pasteboard reference to the global pasteboard
 *    resource of the same name.
 *
 *  Discussion:
 *    If the the global pasteboard resource doesn't yet exist,
 *    PasteboardCreate creates a new one with the provided name.
 *    Pasteboard names are typically represented in a reverse DNS
 *    scheme (i.e., com.apple.pasteboard.clipboard). Multiple local
 *    pasteboard references may point to the same global pasteboard
 *    resource within an application. An application, window, plug-in,
 *    or object may each hold separate references. These should be held
 *    and used for the life time of the objects. Pasteboard references
 *    are CFTypes. Their memory should be released by calling
 *    CFRelease(). CFRelease() automatically resolves all promises made
 *    to the global pasteboard resource through the reference being
 *    released.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inName:
 *      The name of the pasteboard to reference or create. Passing
 *      kPasteboardUniqueName, or NULL, will guarantee that a new
 *      global pasteboard resource is created. kPasteboardClipboard is
 *      the traditional copy and paste pasteboard. kPasteboardFind is
 *      compatible with Cocoa's global find pasteboard.
 *
 *    outPasteboard:
 *      The created pasteboard reference.
 *
 *  Result:
 *    An operating system result code.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in ApplicationServices.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
 *    Non-Carbon CFM:   not available
 }

// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function PasteboardCreate(
  inName: CFStringRef;              { can be NULL }
  var outPasteboard: PasteboardRef): OSStatus; external name '_PasteboardCreate';

{
 *  PasteboardSynchronize()
 *
 *  Summary:
 *    Compares a local pasteboard reference with the global pasteboard
 *    resource to which it refers, determining whether the global
 *    pasteboard resource has been modified. If so, it updates the
 *    local pasteboard reference to reflect the change. The pasteboard
 *    reference provided is always brought up to date. This routine is
 *    lightweight whether a synchronization is required or not.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inPasteboard:
 *      A local pasteboard reference.
 *
 *  Result:
 *    A set of pasteboard synchronization flags.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in ApplicationServices.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
 *    Non-Carbon CFM:   not available
 }

// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function PasteboardSynchronize(inPasteboard: PasteboardRef): PasteboardSyncFlags; external name '_PasteboardSynchronize';


{
 *  PasteboardClear()
 *
 *  Summary:
 *    Clears all data from the global pasteboard resource associated
 *    with the pasteboard reference provided. The application now owns
 *    the pasteboard and data may be placed onto the global pasteboard
 *    resource from all local pasteboards in the client application
 *    which reference it. PasteboardClear must be called before the
 *    pasteboard can be modified.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inPasteboard:
 *      A local pasteboard reference.
 *
 *  Result:
 *    An operating system result code.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in ApplicationServices.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
 *    Non-Carbon CFM:   not available
 }

// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function PasteboardClear(inPasteboard: PasteboardRef): OSStatus; external name '_PasteboardClear';


{
 *  PasteboardGetItemCount()
 *
 *  Summary:
 *    Returns the number of items on the pasteboard.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inPasteboard:
 *      A local pasteboard reference.
 *
 *    outItemCount:
 *      An ItemCount reference which receives number of pasteboard
 *      items.
 *
 *  Result:
 *    An operating system result code.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in ApplicationServices.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
 *    Non-Carbon CFM:   not available
 }

// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function PasteboardGetItemCount(
  inPasteboard: PasteboardRef;
  var outItemCount: ItemCount): OSStatus; external name '_PasteboardGetItemCount';


{
 *  PasteboardGetItemIdentifier()
 *
 *  Summary:
 *    Returns the item identifier for the nth pasteboard item.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inPasteboard:
 *      A local pasteboard reference.
 *
 *    inIndex:
 *      A UInt32 index requesting the nth pasteboard item reference.
 *
 *    outItem:
 *      A PasteboardItemID which receives the nth pasteboard item
 *      reference.
 *
 *  Result:
 *    An operating system result code.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in ApplicationServices.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
 *    Non-Carbon CFM:   not available
 }

// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function PasteboardGetItemIdentifier(
  inPasteboard: PasteboardRef;
  inIndex: UInt32;
  var outItem: PasteboardItemID): OSStatus; external name '_PasteboardGetItemIdentifier';

{
 *  PasteboardCopyItemFlavors()
 *
 *  Summary:
 *    Returns the array of flavors for the provided pasteboard
 *    reference.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inPasteboard:
 *      A local pasteboard reference.
 *
 *    inItem:
 *      A pasteboard item identifier containing the flavors of interest.
 *
 *    outFlavorTypes:
 *      A CFArrayRef reference which receives the array of Uniform Type
 *      Identifier based flavor types.  It is the client's
 *      responsibility to release the flavor array via CFRelease().
 *
 *  Result:
 *    An operating system result code.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in ApplicationServices.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
 *    Non-Carbon CFM:   not available
 }

// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function PasteboardCopyItemFlavors(
  inPasteboard: PasteboardRef;
  inItem: PasteboardItemID;
  var outFlavorTypes: CFArrayRef): OSStatus; external name '_PasteboardCopyItemFlavors';


{
 *  PasteboardGetItemFlavorFlags()
 *
 *  Summary:
 *    Returns the array of flags for the provided flavor, including
 *    implicit translations included by the system automatically.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inPasteboard:
 *      A local pasteboard reference.
 *
 *    inItem:
 *      A pasteboard item identifier containing the flavor of interest.
 *
 *    inFlavorType:
 *      A Uniform Type Identifier based flavor type whose flags are
 *      being interrogated.
 *
 *    outFlags:
 *      A PasteboardFlavorFlags reference which receives the flavor
 *      flags.
 *
 *  Result:
 *    An operating system result code.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in ApplicationServices.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
 *    Non-Carbon CFM:   not available
}

// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function PasteboardGetItemFlavorFlags(
  inPasteboard: PasteboardRef;
  inItem: PasteboardItemID;
  inFlavorType: CFStringRef;
  var outFlags: PasteboardFlavorFlags): OSStatus; external name '_PasteboardGetItemFlavorFlags';


{
 *  PasteboardCopyItemFlavorData()
 *
 *  Summary:
 *    Returns the data for the provided flavor.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inPasteboard:
 *      A local pasteboard reference.
 *
 *    inItem:
 *      A pasteboard item identifier containing the flavor of interest.
 *
 *    inFlavorType:
 *      A Uniform Type Idendtifier based flavor type whose data is
 *      being retrieved.
 *
 *    outData:
 *      A CFDataRef reference which receives the flavor data. It is the
 *      client's responsibility to release the data via CFRelease().
 *
 *  Result:
 *    An operating system result code.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in ApplicationServices.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
 *    Non-Carbon CFM:   not available
 }

// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function PasteboardCopyItemFlavorData(
  inPasteboard: PasteboardRef;
  inItem: PasteboardItemID;
  inFlavorType: CFStringRef;
  var outData: CFDataRef): OSStatus; external name '_PasteboardCopyItemFlavorData';

const
    kPasteboardPromisedData = NIL;

{
 *  PasteboardPutItemFlavor()
 *
 *  Summary:
 *    Adds flavor data or a promise to the global pasteboard resource.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inPasteboard:
 *      A local pasteboard reference.
 *
 *    inItem:
 *      A pasteboard item identifier in which to add the data or
 *      promise. Pasteboard item identifiers are unique values created
 *      by the owning application when adding pasteboard item flavor
 *      information to a drag. Additional flavors may be added to an
 *      existing item by using the same item identifier value.
 *      Depending on the application, it might be easier to use
 *      internal memory addresses as item identifiers (as long as each
 *      item being added has a unique item reference number).
 *      Pasteboard item identifiers should only be interpreted by the
 *      owning application.
 *
 *    inFlavorType:
 *      A Uniform Type Identifier based flavor type associated with the
 *      data. If multiple flavors are to be added to an item, the
 *      owning application should add them in order of preference or
 *      richness as determined by the owing application.  The ordering
 *      will be retained when viewed by the receiving application.
 *
 *    inData:
 *      A CFDataRef reference which receives the flavor data. Passing
 *      kPasteboardPromisedData, or NULL, indicates the data is
 *      promised. This is useful if the data is expensive to generate.
 *      Making promises requires the sender to also implement a promise
 *      keeper which must be set before the promise is made.
 *
 *    inFlags:
 *      A PasteboardFlavorFlags set of flags to attach to the data.
 *
 *  Result:
 *    An operating system result code.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in ApplicationServices.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
 *    Non-Carbon CFM:   not available
}

// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function PasteboardPutItemFlavor(
  inPasteboard: PasteboardRef;
  inItem: PasteboardItemID;
  inFlavorType: CFStringRef;
  inData: CFDataRef;             { can be NULL }
  inFlags: PasteboardFlavorFlags): OSStatus; external name '_PasteboardPutItemFlavor';


{
 *  PasteboardCopyPasteLocation()
 *
 *  Summary:
 *    Called by the owner of a pasteboard while providing promised data
 *    to determine the paste location set by the pasteboard receiver.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inPasteboard:
 *      A local pasteboard reference.
 *
 *    outPasteLocation:
 *      A CFURL reference describing the paste location. It is the
 *      client's responsibility to release the data via CFRelease().
 *
 *  Result:
 *    An operating system result code.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in ApplicationServices.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
 *    Non-Carbon CFM:   not available
 }

// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function PasteboardCopyPasteLocation(
  inPasteboard: PasteboardRef;
  var outPasteLocation: CFURLRef): OSStatus; external name '_PasteboardCopyPasteLocation';


{
 *  PasteboardSetPasteLocation()
 *
 *  Summary:
 *    Called by the receiver of a pasteboard before requesting any item
 *    flavor data via PasteboardCopyItemFlavorData.  When a sending
 *    application's pasteboard promise keeper is called to provide data
 *    to the receiver, PasteboardGetDropLocation can be called to
 *    determine the paste location while providing data.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inPasteboard:
 *      A local pasteboard reference.
 *
 *    inPasteLocation:
 *      A CFURL describing the paste location.
 *
 *  Result:
 *    An operating system result code.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in ApplicationServices.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
 *    Non-Carbon CFM:   not available
 }

// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function PasteboardSetPasteLocation(
  inPasteboard: PasteboardRef;
  inPasteLocation: CFURLRef): OSStatus; external name '_PasteboardSetPasteLocation';


{
 *  PasteboardPromiseKeeperProcPtr
 *
 *  Summary:
 *    Callback for providing data previously promised on the pasteboard.
 *
 *  Parameters:
 *
 *    pasteboard:
 *      The local pasteboard reference on which the promise was made.
 *
 *    item:
 *      The pasteboard item identifier containing the promised flavor.
 *
 *    flavorType:
 *      The Uniform Type Identifier based flavor type for which the
 *      promised data is being requested.
 *
 *    context:
 *      The value passed as the context in PasteboardSetPromiseKeeper().
 *
 *  Result:
 *    An operating system result code.
}

type
    PasteboardPromiseKeeperProcPtr = function(pasteboard: PasteboardRef; item: PasteboardItemID; flavorType: CFStringRef; context: Ptr): OSStatus;

{
 *  PasteboardSetPromiseKeeper()
 *
 *  Summary:
 *    Associates a promise keeper callback with a local pasteboard
 *    reference. The promise keeper must be set before a promise is
 *    made.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inPasteboard:
 *      The local pasteboard reference on which promises will be made.
 *
 *    inPromiseKeeper:
 *      A PasteboardPromiseKeeperProcPtr promise keeper proc.
 *
 *    inContext:
 *      The value passed in this parameter is passed on to your promise
 *      keeper proc when it is called.
 *
 *  Result:
 *    An operating system result code.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in ApplicationServices.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
 *    Non-Carbon CFM:   not available
 }

// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function PasteboardSetPromiseKeeper(
  inPasteboard: PasteboardRef;
  inPromiseKeeper: PasteboardPromiseKeeperProcPtr;
  inContext: Ptr): OSStatus; external name '_PasteboardSetPromiseKeeper';

const
    kPasteboardResolveAllPromises = NIL;

{
 *  PasteboardResolvePromises()
 *
 *  Summary:
 *    Resolves promises on the provided local pasteboard reference. If
 *    multiple local pasteboard references to the same global
 *    pasteboard resource exist, only those promises made through the
 *    provided reference are resolved.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inPasteboard:
 *      The local pasteboard reference for which promises will be
 *      resolved. Passing kPasteboardResolveAllPromises, or NULL, will
 *      cause all promises on all global pasteboard resources currently
 *      owned by this application to be resolved.
 *
 *  Result:
 *    An operating system result code.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in ApplicationServices.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
 *    Non-Carbon CFM:   not available
 }

// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER;
function PasteboardResolvePromises(inPasteboard: PasteboardRef): OSStatus; external name '_PasteboardResolvePromises';

{$ALIGN MAC68K}
{#POP}
{unit UTType}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN POWER}
{#LibExport+}

{ ======================================================================================================== }
{ Uniform Type Identification API                                                                          }
{ ======================================================================================================== }
{
    Uniform Type Identification Primer

    Uniform Type Identifiers (or UTIs) are strings which uniquely identify
    abstract types. They can be used to describe a file format or
    data type, but can also be used to describe type information for
    other sorts of entities, such as directories, volumes, or packages.

    The syntax of a uniform type identifier looks like a bundle identifier.
    It has the form of a reversed DNS name, although some special top-level
    UTI domains are reserved by Apple and are outside the currect IANA
    top-level Internet domain name space.

    Examples:

        public.jpeg
        public.utf16-plain-text
        com.apple.xml-plist
        com.apple.appleworks.doc

    Types which are standard or not controlled by any one organization
    are declared in the "public" domain. Currently, public types may
    be declared only by Apple.

    Types specific to Mac OS are declared with identifiers in the
    com.apple.macos domain.

    Third parties should declare their own uniform type identifiers
    in their respective registered Internet domain spaces.

    Type declarations appear in bundle property lists and tell
    the system several things about a type, including the following:

    Conformance

    A type may "conform" to one or more other types. For example, the
    type com.apple.macos.xml-property-list conforms to both the
    com.apple.macos.property-list and public.xml types. The public.xml
    type in turn conforms to type public.text. Finally, type public.text
    conforms to public.data, which is the base type for all types
    describing bytes stream formats. Conformance relationships between
    types are established in type declarations.

    Conformance relationships establish a multiple inheritanace hierarchy
    between types. Type property values may be inherited at runtime
    according to the conformance relationships each type. When a type's
    declaration does not include a value for particular type property,
    then the type's supertypes are searched for a value. Supertypes are
    searched depth-first, in the order given in the type declaration.
    This is the only way in which the declared order of the conforms-to
    supertypes is signitificant.

    Tags

    A "tag" is a string which indicates a type in some other type
    identification space, such as a filename extension, MIME Type,
    or NSPboardType. Each type declaration may include a
    "tag specification", which is a dictionary listing all of the
    tags associated with the type.

    A tag's "class" is the namespace of a tag: filename extension,
    MIME type, OSType, etc. Tag classes are themselves identified by
    uniform type identifiers so that the set of valid tag classes is
    easily extendend in the future.

    Other Type Properties

    Type declarations may include several other properties: a localizable
    user description of the type, the name of an icon resource in
    the declaring bundle, a reference URL identifying technical
    documentation about the type itself, and finally a version number,
    which can be incremented as a type evolves. All of these properties
    are optional.

    Exported vs. Imported Type Declarations

    Type declarations are either exported or imported. An exported
    type declaration means that the type itself is defined or owned
    by the organization making the declaration. For example, a propietary
    document type declaration should only be exported by the application
    which controls the document format.

    An imported declatation is for applications which depend on the
    existence of someone else's type declaration. If application A can
    open application B's document format, then application A makes
    an imported declaration of application B's document type so that
    even if application B is not present on the system, there is an
    acessible declaration of its document type.

    An exported declaration of a particular type identifier is always
    preferred over an imported declaration.

    Example XML Type Declaration

    Appearing below is an XML excerpt from a bundle Info.plist file which
    declares the public type "public.jpeg":

        <key>UTExportedTypeDeclarations</key>
        <array>
            <dict>
                <key>UTTypeIdentifier</key>
                <string>public.jpeg</string>
                <key>UTTypeReferenceURL</key>
                <string>http://www.w3.org/Graphics/JPEG/</string>
                <key>UTTypeDescription</key>
                <string>JPEG image</string>
                <key>UTTypeIconName</key>
                <string>public.jpeg.icns</string>
                <key>UTTypeConformsTo</key>
                <array>
                    <string>public.image</string>
                    <string>public.data</string>
                </array>
                <key>UTTypeTagSpecification</key>
                <dict>
                    <key>com.apple.macos.ostype</key>
                    <string>JPEG</string>
                    <key>public.filename-extension</key>
                    <array>
                        <string>jpeg</string>
                        <string>jpg</string>
                    </array>
                    <key>public.mime-type</key>
                    <string>image/jpeg</string>
                </dict>
            </dict>
        </array>


    Dynamic Type Identifiers

    Uniform Type Identifiation uses dynamic type identifiers to
    represent types for which no identifier has been declared. A
    dynamic type identifier is syntactially a regular uniform
    type identifier in the "dyn" domain. However, after the
    initial domain label, a dynamic type identifier is an
    opaque encoding of a tag specification. Dynamic type
    identifiers cannot be declared. They are generated on-demand
    with whatever type information is available at the time, often
    a single (otherwise unknown) type tag.

    A dynamic identifier therefore carries within it a minimal
    amount of type information, but enough to work well with the
    Uniform Type Identification API. For example, a client can
    extract from a dynamic type identifier the original tag
    specification with which it was created. A client can also
    test a dynamic type identifier for equality to another
    uniform type identifier. If the dynamic identifier's
    tag specification is a subset of the other identifier's
    tags, the two are considered equal.

    Dynamic type identifiers do not express the full richness
    of type information associated with a declared type
    identifier, but dynamic type identifiers allow the behavior
    to degrade gracefully in the presence of incomplete
    declared type information.

    A dynamic type identifier may be transmitted across processes
    on a given system, but it should never be stored persistently
    or transmitted over the wire to another system. In particular,
    dynamic identifiers should not appear in bundle info property
    lists, and they will generally be ignored when they do. Apple
    reserves the right to change the opaque format of dynamic
    identifiers in future versions of Mac OS X.
}

{
    Type Declaration Dictionary Keys

    The following keys are used in type declarations
}
{
 *  kUTExportedTypeDeclarationsKey
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in ApplicationServices.framework
 *    CarbonLib:        not available in CarbonLib 1.x
 *    Non-Carbon CFM:   not available
 }

// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
var kUTExportedTypeDeclarationsKey: CFStringRef; external name '_kUTExportedTypeDeclarationsKey'; (* attribute const *)

{
 *  kUTImportedTypeDeclarationsKey
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in ApplicationServices.framework
 *    CarbonLib:        not available in CarbonLib 1.x
 *    Non-Carbon CFM:   not available
}

// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
var kUTImportedTypeDeclarationsKey: CFStringRef; external name '_kUTImportedTypeDeclarationsKey'; (* attribute const *)

{
 *  kUTTypeIdentifierKey
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in ApplicationServices.framework
 *    CarbonLib:        not available in CarbonLib 1.x
 *    Non-Carbon CFM:   not available
 }

// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
var kUTTypeIdentifierKey: CFStringRef; external name '_kUTTypeIdentifierKey'; (* attribute const *)

{
 *  kUTTypeTagSpecificationKey
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in ApplicationServices.framework
 *    CarbonLib:        not available in CarbonLib 1.x
 *    Non-Carbon CFM:   not available
 }

// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
var kUTTypeTagSpecificationKey: CFStringRef; external name '_kUTTypeTagSpecificationKey'; (* attribute const *)

{
 *  kUTTypeConformsToKey
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in ApplicationServices.framework
 *    CarbonLib:        not available in CarbonLib 1.x
 *    Non-Carbon CFM:   not available
 }

// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
var kUTTypeConformsToKey: CFStringRef; external name '_kUTTypeConformsToKey'; (* attribute const *)

{
 *  kUTTypeDescriptionKey
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in ApplicationServices.framework
 *    CarbonLib:        not available in CarbonLib 1.x
 *    Non-Carbon CFM:   not available
 }

// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
var kUTTypeDescriptionKey: CFStringRef; external name '_kUTTypeDescriptionKey'; (* attribute const *)

{
 *  kUTTypeIconFileKey
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in ApplicationServices.framework
 *    CarbonLib:        not available in CarbonLib 1.x
 *    Non-Carbon CFM:   not available
 }

// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
var kUTTypeIconFileKey: CFStringRef; external name '_kUTTypeIconFileKey'; (* attribute const *)

{
 *  kUTTypeReferenceURLKey
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in ApplicationServices.framework
 *    CarbonLib:        not available in CarbonLib 1.x
 *    Non-Carbon CFM:   not available
 }

// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
var kUTTypeReferenceURLKey: CFStringRef; external name '_kUTTypeReferenceURLKey'; (* attribute const *)

{
 *  kUTTypeVersionKey
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in ApplicationServices.framework
 *    CarbonLib:        not available in CarbonLib 1.x
 *    Non-Carbon CFM:   not available
 }

// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
var kUTTypeVersionKey: CFStringRef; external name '_kUTTypeVersionKey'; (* attribute const *)


{
    Type Tag Classes

    The following constant strings identify tag classes for use
    when converting uniform type identifiers to and from
    equivalent tags.
}
{
 *  kUTTagClassFilenameExtension
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in ApplicationServices.framework
 *    CarbonLib:        not available in CarbonLib 1.x
 *    Non-Carbon CFM:   not available
 }

// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER:
var kUTTagClassFilenameExtension: CFStringRef; external name '_kUTTagClassFilenameExtension'; (* attribute const *)

{
 *  kUTTagClassMIMEType
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in ApplicationServices.framework
 *    CarbonLib:        not available in CarbonLib 1.x
 *    Non-Carbon CFM:   not available
 }

// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
var kUTTagClassMIMEType: CFStringRef; external name '_kUTTagClassMIMEType'; (* attribute const *)

{
 *  kUTTagClassNSPboardType
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in ApplicationServices.framework
 *    CarbonLib:        not available in CarbonLib 1.x
 *    Non-Carbon CFM:   not available
 }

// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
var kUTTagClassNSPboardType: CFStringRef; external name '_kUTTagClassNSPboardType'; (* attribute const *)

{
 *  kUTTagClassOSType
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in ApplicationServices.framework
 *    CarbonLib:        not available in CarbonLib 1.x
 *    Non-Carbon CFM:   not available
 }

// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
var kUTTagClassOSType: CFStringRef; external name '_kUTTagClassOSType'; (* attribute const *)

{
 *  UTTypeCreatePreferredIdentifierForTag()
 *
 *  Discussion:
 *    Creates a uniform type identifier for the type indicated by the
 *    specified tag. This is the primary function to use for going from
 *    tag (extension/MIMEType/OSType) to uniform type identifier.
 *    Optionally, the returned type identifiers must conform to the
 *    identified "conforming-to" type argument. This is a hint to the
 *    implementation to constrain the search to a particular tree of
 *    types. For example, the client may want to know the type
 *    indicated by a particular extension tag. If the client knows that
 *    the extension is associated with a directory (rather than a
 *    file), the client may specify "public.directory" for the
 *    conforming-to argument. This will allow the implementation to
 *    ignore all types associated with byte data formats (public.data
 *    base type). If more than one type is indicated, preference is
 *    given to a public type over a non-public type on the theory that
 *    instances of public types are more common, and therefore more
 *    likely to be correct. When there a choice must be made between
 *    multiple public types or multiple non-public types, the selection
 *    rules are undefined. Clients needing finer control should use
 *    UTTypeCreateAllIdentifiersWithTag. If no declared type is
 *    indicated, a dynamic type identifier is generated which satisfies
 *    the parameters.
 *
 *  Mac OS X threading:
 *    Thread safe since version 10.3
 *
 *  Parameters:
 *
 *    inTagClass:
 *      the class identifier of the tag argument
 *
 *    inTag:
 *      the tag string
 *
 *    inConformingToTypeIdentifier:
 *      the identifier of a type to which the result must conform
 *
 *  Result:
 *    a new CFStringRef containing the type identifier, or NULL if
 *    inTagClass is not a known tag class
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in ApplicationServices.framework
 *    CarbonLib:        not available in CarbonLib 1.x
 *    Non-Carbon CFM:   not available
 }

// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function UTTypeCreatePreferredIdentifierForTag(
  inTagClass: CFStringRef;
  inTag: CFStringRef;
  inConformingToTypeIdentifier: CFStringRef): CFStringRef; external name '_UTTypeCreatePreferredIdentifierForTag'; { can be NULL }



{
 *  UTTypeCreateAllIdentifiersForTag()
 *
 *  Discussion:
 *    Creates an array of all uniform type identifiers indicated by the
 *    specified tag. An overloaded tag (e.g., an extension used by
 *    several applications for different file formats) may indicate
 *    multiple types. If no declared type identifiers have the
 *    specified tag, then a single dynamic type identifier will be
 *    created for the tag. Optionally, the returned type identifiers
 *    must conform to the identified "conforming-to" type argument.
 *    This is a hint to the implementation to constrain the search to a
 *    particular tree of types. For example, the client may want to
 *    know the type indicated by a particular extension tag. If the
 *    client knows that the extension is associated with a directory
 *    (rather than a file), the client may specify "public.directory"
 *    for the conforming-to argument. This will allow the
 *    implementation to ignore all types associated with byte data
 *    formats (public.data base type).
 *
 *  Mac OS X threading:
 *    Thread safe since version 10.3
 *
 *  Parameters:
 *
 *    inTagClass:
 *      the class identifier of the tag argument
 *
 *    inTag:
 *      the tag string
 *
 *    inConformingToTypeIdentifier:
 *      the identifier of a type to which the results must conform
 *
 *  Result:
 *    An array of uniform type identifiers, or NULL if inTagClass is
 *    not a known tag class
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in ApplicationServices.framework
 *    CarbonLib:        not available in CarbonLib 1.x
 *    Non-Carbon CFM:   not available
 }

// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function UTTypeCreateAllIdentifiersForTag(
  inTagClass: CFStringRef;
  inTag: CFStringRef;
  inConformingToTypeIdentifier: CFStringRef): CFArrayRef; external name '_UTTypeCreateAllIdentifiersForTag'; { can be NULL }



{
 *  UTTypeCopyPreferredTagWithClass()
 *
 *  Discussion:
 *    Returns the identified type's preferred tag with the specified
 *    tag class as a CSString. This is the primary function to use for
 *    going from uniform type identifier to tag. If the type
 *    declaration included more than one tag with the specified class,
 *    the first tag in the declared tag array is the preferred tag.
 *
 *  Mac OS X threading:
 *    Thread safe since version 10.3
 *
 *  Parameters:
 *
 *    inTypeIdentifier:
 *      the uniform type identifier
 *
 *    inTagClass:
 *      the class of tags to return
 *
 *  Result:
 *    an array of tags (as CFStrings), or NULL if there are no tags
 *    with the specified class.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in ApplicationServices.framework
 *    CarbonLib:        not available in CarbonLib 1.x
 *    Non-Carbon CFM:   not available
 }

// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function UTTypeCopyPreferredTagWithClass(
  inTypeIdentifier: CFStringRef;
  inTagClass: CFStringRef): CFStringRef; external name '_UTTypeCopyPreferredTagWithClass';



{
 *  UTTypeEqual()
 *
 *  Discussion:
 *    Compares two identified types for equality. Types are equal if
 *    their identifier strings are equal using a case-insensitive
 *    comparison. In addition, if one or both of the identifiers is a
 *    dynamic identifier, then the types are equal if either
 *    identifier's tag specification is a subset of the other
 *    identifier's tag specification.
 *
 *  Mac OS X threading:
 *    Thread safe since version 10.3
 *
 *  Parameters:
 *
 *    inTypeIdentifier1:
 *      a uniform type identifier
 *
 *    inTypeIdentifier2:
 *      another uniform type identifier
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in ApplicationServices.framework
 *    CarbonLib:        not available in CarbonLib 1.x
 *    Non-Carbon CFM:   not available
 }

// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function UTTypeEqual(
  inTypeIdentifier1: CFStringRef;
  inTypeIdentifier2: CFStringRef): Boolean; external name '_UTTypeEqual';



{
 *  UTTypeConformsTo()
 *
 *  Discussion:
 *    Tests for a conformance relationship between the two identified
 *    types. Returns true if the types are equal, or if the first type
 *    conforms, directly or indirectly, to the second type.
 *
 *  Mac OS X threading:
 *    Thread safe since version 10.3
 *
 *  Parameters:
 *
 *    inTypeIdentifier:
 *      the uniform type identifier to test
 *
 *    inConformsToTypeIdentifier:
 *      the uniform type identifier against which to test conformance.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in ApplicationServices.framework
 *    CarbonLib:        not available in CarbonLib 1.x
 *    Non-Carbon CFM:   not available
 }

// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function UTTypeConformsTo(
  inTypeIdentifier: CFStringRef;
  inConformsToTypeIdentifier: CFStringRef): Boolean; external name '_UTTypeConformsTo';



{
 *  UTTypeCopyDescription()
 *
 *  Discussion:
 *    Returns the localized, user-readable type description string
 *
 *  Mac OS X threading:
 *    Thread safe since version 10.3
 *
 *  Parameters:
 *
 *    inTypeIdentifier:
 *      the uniform type identifier
 *
 *  Result:
 *    a localized string, or NULL of no type description is available
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in ApplicationServices.framework
 *    CarbonLib:        not available in CarbonLib 1.x
 *    Non-Carbon CFM:   not available
 }

// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function UTTypeCopyDescription(inTypeIdentifier: CFStringRef): CFStringRef; external name '_UTTypeCopyDescription';



{
 *  UTTypeCopyDeclaration()
 *
 *  Discussion:
 *    Returns the identified type's declaration dictionary, as it
 *    appears in the declaring bundle's info property list. This the
 *    access path to other type properties for which direct access is
 *    rarely needed.
 *
 *  Mac OS X threading:
 *    Thread safe since version 10.3
 *
 *  Parameters:
 *
 *    inTypeIdentifier:
 *      the uniform type identifier
 *
 *  Result:
 *    a tag declaration dictionary, or NULL if the type is not declared
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in ApplicationServices.framework
 *    CarbonLib:        not available in CarbonLib 1.x
 *    Non-Carbon CFM:   not available
 }

// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function UTTypeCopyDeclaration(inTypeIdentifier: CFStringRef): CFDictionaryRef; external name '_UTTypeCopyDeclaration';



{
 *  UTTypeCopyDeclaringBundleURL()
 *
 *  Discussion:
 *    Returns the URL of the bundle containing the type declaration of
 *    the identified type.
 *
 *  Mac OS X threading:
 *    Thread safe since version 10.3
 *
 *  Parameters:
 *
 *    inTypeIdentifier:
 *      the uniform type identifier
 *
 *  Result:
 *    a URL, or NULL if the bundle cannot be located.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in ApplicationServices.framework
 *    CarbonLib:        not available in CarbonLib 1.x
 *    Non-Carbon CFM:   not available
 }

// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function UTTypeCopyDeclaringBundleURL(inTypeIdentifier: CFStringRef): CFURLRef; external name '_UTTypeCopyDeclaringBundleURL';



{
 *  UTCreateStringForOSType()
 *
 *  Discussion:
 *    A helper function to canonically encode an OSType as a CFString
 *    suitable for use as a tag argument.
 *
 *  Mac OS X threading:
 *    Thread safe since version 10.3
 *
 *  Parameters:
 *
 *    inOSType:
 *      the OSType value to encode
 *
 *  Result:
 *    a new CFString representing the OSType, or NULL if the argument
 *    is 0 or '????'
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in ApplicationServices.framework
 *    CarbonLib:        not available in CarbonLib 1.x
 *    Non-Carbon CFM:   not available
 }

// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function UTCreateStringForOSType(inOSType: OSType): CFStringRef; external name '_UTCreateStringForOSType';



{
 *  UTGetOSTypeFromString()
 *
 *  Discussion:
 *    A helper function to canonically decode a string-encoded OSType
 *    back to the original OSType value.
 *
 *  Mac OS X threading:
 *    Thread safe since version 10.3
 *
 *  Parameters:
 *
 *    inString:
 *      the string to decode
 *
 *  Result:
 *    the OSType value encoded in the string, or 0 if the string is not
 *    a valid encoding of an OSType
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in ApplicationServices.framework
 *    CarbonLib:        not available in CarbonLib 1.x
 *    Non-Carbon CFM:   not available
 }

// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function UTGetOSTypeFromString(inString: CFStringRef): OSType; external name '_UTGetOSTypeFromString';



{$ALIGN MAC68K}
{#POP}
{unit ATSFont}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}


const
    kATSOptionFlagsDefault      = 0;
    kATSOptionFlagsComposeFontPostScriptName = $01;             {  ATSFontGetPostScriptName  }
    kATSOptionFlagsUseDataForkAsResourceFork = $0100;           {  ATSFontActivateFromFileSpecification  }
    kATSOptionFlagsUseResourceFork = $0200;
    kATSOptionFlagsUseDataFork  = $0300;

    kATSIterationCompleted      = -980;
    kATSInvalidFontFamilyAccess = -981;
    kATSInvalidFontAccess       = -982;
    kATSIterationScopeModified  = -983;
    kATSInvalidFontTableAccess  = -984;
    kATSInvalidFontContainerAccess = -985;
  kATSInvalidGlyphAccess        = -986;


type
    ATSFontContext                      = UInt32;

const
    kATSFontContextUnspecified  = 0;
    kATSFontContextGlobal       = 1;
  kATSFontContextLocal          = 2;

const
  kATSOptionFlagsProcessSubdirectories = $00000001 shl 6; { Used by activation/deactivation & iteration }
  kATSOptionFlagsDoNotNotify    = $00000001 shl 7; { Do not notify after global activation/deactivation }

{ Iteration Option Flags }
const
  kATSOptionFlagsIterateByPrecedenceMask = $00000001 shl 5;
  kATSOptionFlagsIterationScopeMask = $00000007 shl 12; { Mask option bits 12-14 for iteration scopes }
  kATSOptionFlagsDefaultScope   = $00000000 shl 12;
  kATSOptionFlagsUnRestrictedScope = $00000001 shl 12;
  kATSOptionFlagsRestrictedScope = $00000002 shl 12;


type
    ATSFontFormat                       = UInt32;

const
    kATSFontFormatUnspecified   = 0;


type
    ATSFontFamilyApplierFunction = function(iFamily: ATSFontFamilyRef; iRefCon: UnivPtr): OSStatus;

    ATSFontApplierFunction = function(iFont: ATSFontRef; iRefCon: UnivPtr): OSStatus;

    ATSFontFamilyIterator    = ^SInt32; { an opaque 32-bit type }
    ATSFontFamilyIteratorPtr = ^ATSFontFamilyIterator;  { when a var xx:ATSFontFamilyIterator parameter can be nil, it is changed to xx: ATSFontFamilyIteratorPtr }
    ATSFontIterator    = ^SInt32; { an opaque 32-bit type }
    ATSFontIteratorPtr = ^ATSFontIterator;  { when a var xx:ATSFontIterator parameter can be nil, it is changed to xx: ATSFontIteratorPtr }

const
    kATSFontFilterCurrentVersion = 0;


type
    ATSFontFilterSelector       = SInt32;
const
    kATSFontFilterSelectorUnspecified = 0;
    kATSFontFilterSelectorGeneration = 3;
    kATSFontFilterSelectorFontFamily = 7;
    kATSFontFilterSelectorFontFamilyApplierFunction = 8;
    kATSFontFilterSelectorFontApplierFunction = 9;


type
    ATSFontFilterPtr = ^ATSFontFilter;
    ATSFontFilter = record
        version:                UInt32;
        filterSelector:         ATSFontFilterSelector;
        case SInt16 of
        0: (
            generationFilter:   ATSGeneration;
            );
        1: (
            fontFamilyFilter:   ATSFontFamilyRef;
            );
        2: (
            fontFamilyApplierFunctionFilter: ATSFontFamilyApplierFunction;
            );
        3: (
            fontApplierFunctionFilter: ATSFontApplierFunction;
            );
    end;

{ Notification related }
type
    ATSFontNotificationRef    = ^SInt32; { an opaque 32-bit type }
    ATSFontNotificationRefPtr = ^ATSFontNotificationRef;
    ATSFontNotificationInfoRef    = ^SInt32; { an opaque 32-bit type }
    ATSFontNotificationInfoRefPtr = ^ATSFontNotificationInfoRef;

{
 *  ATSFontNotifyOption
 *
 *  Discussion:
 *    Options used with ATSFontNotificationSubscribe.  Any of the
 *    options that follow may be used together in order to alter the
 *    default behavior of ATS notifications.
 }
type
    ATSFontNotifyOption = SInt32;
const

  {
   * Default behavior of ATSFontNotificationSubscribe.
   }
  kATSFontNotifyOptionDefault   = 0;

  {
   * Normally applications will only receive ATS notifications while in
   * the foreground.   If suspended, the notification will be delivered
   * when then application comes to the foreground.  This is the
   * default.  You should set this option if you are a server or tool
   * that performs font management functions and require immediate
   * notification when something changes.
   }
  kATSFontNotifyOptionReceiveWhileSuspended = 1 shl 0;

{
 *  ATSFontNotifyAction
 *
 *  Discussion:
 *    Used with ATSFontNotify.   The following is a list of actions you
 *    might wish the ATS server to perform and notify clients if
 *    appropriate.
 }
type
    ATSFontNotifyAction = SInt32;
const

  {
   * Used after a batch (de)activation of fonts occurs.   Typically the
   * caller has exercised multiple global (De)Activation calls with the
   * kATSOptionFlagsDoNotNotify set. Once all calls are completed, one
   * may use ATSFontNotify with this action to ask ATS to notify all
   * clients.
   }
  kATSFontNotifyActionFontsChanged = 1;

  {
   * The ATS system with the help of the Finder keeps track of changes
   * to any of the font directories in the system domains ( System,
   * Local, Network, User, & Classic). However, one may wish to
   * add/remove fonts to these locations programmatically. This action
   * is used to let ATS server to rescan these directories and post
   * notifications if necessary.
   }
  kATSFontNotifyActionDirectoriesChanged = 2;



{
 *  ATSNotificationCallback
 *
 *  Discussion:
 *    Callback delivered for ATS notifications.
 *
 *  Parameters:
 *
 *    info:
 *      Parameter is placed here for future improvements.  Initially
 *      the contents of this parameter will be NULL.
 *
 *    refCon:
 *      User data/state to be supplied to callback function
 }
type ATSNotificationCallback = procedure( info: ATSFontNotificationInfoRef; refCon: UnivPtr );

    {    -----------------------------------------------------------------------------------------  }
    {    Font container                                                                             }
    {    -----------------------------------------------------------------------------------------  }
    {
     *  ATSGetGeneration()
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function ATSGetGeneration: ATSGeneration; external name '_ATSGetGeneration';

{
 *  ATSFontActivateFromFileSpecification()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ATSFontActivateFromFileSpecification(const (*var*) iFile: FSSpec; iContext: ATSFontContext; iFormat: ATSFontFormat; iReserved: UnivPtr; iOptions: ATSOptionFlags; var oContainer: ATSFontContainerRef): OSStatus; external name '_ATSFontActivateFromFileSpecification';

{
 *  ATSFontActivateFromMemory()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ATSFontActivateFromMemory(iData: LogicalAddress; iLength: ByteCount; iContext: ATSFontContext; iFormat: ATSFontFormat; iReserved: UnivPtr; iOptions: ATSOptionFlags; var oContainer: ATSFontContainerRef): OSStatus; external name '_ATSFontActivateFromMemory';

{
 *  ATSFontDeactivate()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ATSFontDeactivate(iContainer: ATSFontContainerRef; iRefCon: UnivPtr; iOptions: ATSOptionFlags): OSStatus; external name '_ATSFontDeactivate';

{ ----------------------------------------------------------------------------------------- }
{ Font family                                                                               }
{ ----------------------------------------------------------------------------------------- }
{
 *  ATSFontFamilyApplyFunction()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ATSFontFamilyApplyFunction(iFunction: ATSFontFamilyApplierFunction; iRefCon: UnivPtr): OSStatus; external name '_ATSFontFamilyApplyFunction';

{
 *  ATSFontFamilyIteratorCreate()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ATSFontFamilyIteratorCreate(iContext: ATSFontContext; iFilter: {Const}ATSFontFilterPtr; iRefCon: UnivPtr; iOptions: ATSOptionFlags; var ioIterator: ATSFontFamilyIterator): OSStatus; external name '_ATSFontFamilyIteratorCreate';

{
 *  ATSFontFamilyIteratorRelease()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ATSFontFamilyIteratorRelease(var ioIterator: ATSFontFamilyIterator): OSStatus; external name '_ATSFontFamilyIteratorRelease';

{
 *  ATSFontFamilyIteratorReset()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ATSFontFamilyIteratorReset(iContext: ATSFontContext; iFilter: {Const}ATSFontFilterPtr; iRefCon: UnivPtr; iOptions: ATSOptionFlags; var ioIterator: ATSFontFamilyIterator): OSStatus; external name '_ATSFontFamilyIteratorReset';

{
 *  ATSFontFamilyIteratorNext()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ATSFontFamilyIteratorNext(iIterator: ATSFontFamilyIterator; var oFamily: ATSFontFamilyRef): OSStatus; external name '_ATSFontFamilyIteratorNext';

{
 *  ATSFontFamilyFindFromName()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ATSFontFamilyFindFromName(iName: CFStringRef; iOptions: ATSOptionFlags): ATSFontFamilyRef; external name '_ATSFontFamilyFindFromName';

{
 *  ATSFontFamilyGetGeneration()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ATSFontFamilyGetGeneration(iFamily: ATSFontFamilyRef): ATSGeneration; external name '_ATSFontFamilyGetGeneration';

{
 *  ATSFontFamilyGetName()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ATSFontFamilyGetName(iFamily: ATSFontFamilyRef; iOptions: ATSOptionFlags; var oName: CFStringRef): OSStatus; external name '_ATSFontFamilyGetName';

{
 *  ATSFontFamilyGetEncoding()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ATSFontFamilyGetEncoding(iFamily: ATSFontFamilyRef): TextEncoding; external name '_ATSFontFamilyGetEncoding';

{ ----------------------------------------------------------------------------------------- }
{ Font                                                                                      }
{ ----------------------------------------------------------------------------------------- }
{
 *  ATSFontApplyFunction()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ATSFontApplyFunction(iFunction: ATSFontApplierFunction; iRefCon: UnivPtr): OSStatus; external name '_ATSFontApplyFunction';

{
 *  ATSFontIteratorCreate()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ATSFontIteratorCreate(iContext: ATSFontContext; iFilter: {Const}ATSFontFilterPtr; iRefCon: UnivPtr; iOptions: ATSOptionFlags; var ioIterator: ATSFontIterator): OSStatus; external name '_ATSFontIteratorCreate';

{
 *  ATSFontIteratorRelease()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ATSFontIteratorRelease(var ioIterator: ATSFontIterator): OSStatus; external name '_ATSFontIteratorRelease';

{
 *  ATSFontIteratorReset()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ATSFontIteratorReset(iContext: ATSFontContext; iFilter: {Const}ATSFontFilterPtr; iRefCon: UnivPtr; iOptions: ATSOptionFlags; var ioIterator: ATSFontIterator): OSStatus; external name '_ATSFontIteratorReset';

{
 *  ATSFontIteratorNext()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ATSFontIteratorNext(iIterator: ATSFontIterator; var oFont: ATSFontRef): OSStatus; external name '_ATSFontIteratorNext';

{
 *  ATSFontFindFromName()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ATSFontFindFromName(iName: CFStringRef; iOptions: ATSOptionFlags): ATSFontRef; external name '_ATSFontFindFromName';

{
 *  ATSFontFindFromPostScriptName()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ATSFontFindFromPostScriptName(iName: CFStringRef; iOptions: ATSOptionFlags): ATSFontRef; external name '_ATSFontFindFromPostScriptName';

{
 *  ATSFontFindFromContainer()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ATSFontFindFromContainer(iContainer: ATSFontContainerRef; iOptions: ATSOptionFlags; iCount: ItemCount; var ioArray: ATSFontRef; var oCount: ItemCount): OSStatus; external name '_ATSFontFindFromContainer';

{
 *  ATSFontGetGeneration()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ATSFontGetGeneration(iFont: ATSFontRef): ATSGeneration; external name '_ATSFontGetGeneration';

{
 *  ATSFontGetName()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ATSFontGetName(iFont: ATSFontRef; iOptions: ATSOptionFlags; var oName: CFStringRef): OSStatus; external name '_ATSFontGetName';

{
 *  ATSFontGetPostScriptName()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ATSFontGetPostScriptName(iFont: ATSFontRef; iOptions: ATSOptionFlags; var oName: CFStringRef): OSStatus; external name '_ATSFontGetPostScriptName';

{
 *  ATSFontGetTableDirectory()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ATSFontGetTableDirectory(iFont: ATSFontRef; iBufferSize: ByteCount; ioBuffer: UnivPtr; oSize: ByteCountPtr): OSStatus; external name '_ATSFontGetTableDirectory';

{
 *  ATSFontGetTable()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ATSFontGetTable(iFont: ATSFontRef; iTag: FourCharCode; iOffset: ByteOffset; iBufferSize: ByteCount; ioBuffer: UnivPtr; oSize: ByteCountPtr): OSStatus; external name '_ATSFontGetTable';

{
 *  ATSFontGetHorizontalMetrics()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ATSFontGetHorizontalMetrics(iFont: ATSFontRef; iOptions: ATSOptionFlags; var oMetrics: ATSFontMetrics): OSStatus; external name '_ATSFontGetHorizontalMetrics';

{
 *  ATSFontGetVerticalMetrics()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ATSFontGetVerticalMetrics(iFont: ATSFontRef; iOptions: ATSOptionFlags; var oMetrics: ATSFontMetrics): OSStatus; external name '_ATSFontGetVerticalMetrics';

{ ----------------------------------------------------------------------------------------- }
{ Compatibiity                                                                              }
{ ----------------------------------------------------------------------------------------- }
{
 *  ATSFontFamilyFindFromQuickDrawName()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ATSFontFamilyFindFromQuickDrawName(const (*var*) iName: Str255): ATSFontFamilyRef; external name '_ATSFontFamilyFindFromQuickDrawName';

{
 *  ATSFontFamilyGetQuickDrawName()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ATSFontFamilyGetQuickDrawName(iFamily: ATSFontFamilyRef; var oName: Str255): OSStatus; external name '_ATSFontFamilyGetQuickDrawName';

{
 *  ATSFontGetFileSpecification()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ATSFontGetFileSpecification(iFont: ATSFontRef; var oFile: FSSpec): OSStatus; external name '_ATSFontGetFileSpecification';

{
 *  ATSFontGetFontFamilyResource()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ATSFontGetFontFamilyResource(iFont: ATSFontRef; iBufferSize: ByteCount; ioBuffer: UnivPtr; oSize: ByteCountPtr): OSStatus; external name '_ATSFontGetFontFamilyResource';

{ ----------------------------------------------------------------------------------------- }
{ Notification                                                                              }
{ ----------------------------------------------------------------------------------------- }
{
 *  ATSFontNotify()
 *
 *  Summary:
 *    Used to alert ATS that an action which may require notification
 *    to clients has occurred.
 *
 *  Parameters:
 *
 *    action:
 *      Action that should be taken by the ATS Server
 *
 *    info:
 *      Any required or optional information that may be required by
 *      the action taken. can be NULL
 *
 *  Result:
 *    noErr Action successfully reported paramErr Invalid action passed
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in ApplicationServices.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
function ATSFontNotify( action: ATSFontNotifyAction; info: UnivPtr ): OSStatus; external name '_ATSFontNotify';



{
 *  ATSFontNotificationSubscribe()
 *
 *  Summary:
 *    Ask the ATS System to notify caller when certain events have
 *    occurred.  Note that your application must have a CFRunLoop in
 *    order to receive notifications. Any Appkit or Carbon event loop
 *    based application will have one by default.
 *
 *  Parameters:
 *
 *    callback:
 *      Function that will be called by the ATS system whenever an
 *      event of interest takes place.
 *
 *    options:
 *      Set the wanted ATSFontNotificationOptions to modify the default
 *      behavior of ATS Notifications.
 *
 *    iRefcon:
 *      User data/state which will be passed to the callback funtion. can be NULL
 *
 *    oNotificationRef:
 *      You may use this reference to un-subscribe to this notification. can be NULL
 *
 *  Result:
 *    noErr Subscribed successfully paramErr NULL callback was passed.
 *    memFullErr Could not allocate enough memory for internal data
 *    structures.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in ApplicationServices.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
function ATSFontNotificationSubscribe( callback: ATSNotificationCallback; options: ATSFontNotifyOption; iRefcon: UnivPtr; oNotificationRef: ATSFontNotificationRefPtr ): OSStatus; external name '_ATSFontNotificationSubscribe';



{
 *  ATSFontNotificationUnsubscribe()
 *
 *  Summary:
 *    Release subscription and stop receiving notifications for a given
 *    reference.
 *
 *  Parameters:
 *
 *    notificationRef:
 *      Notification reference for which you want to stop receiving
 *      notifications. Note, if more than one notification has been
 *      requested of ATS, you will still receive notifications on those
 *      requests.
 *
 *  Result:
 *    noErr Unsubscribed successfully paramErr NULL/invalid
 *    notificationRef passed
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in ApplicationServices.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
function ATSFontNotificationUnsubscribe( notificationRef: ATSFontNotificationRef ): OSStatus; external name '_ATSFontNotificationUnsubscribe';



{ ----------------------------------------------------------------------------------------- }
{ Font query message hooks                                                                  }
{ ----------------------------------------------------------------------------------------- }

{
 *  ATSFontQuerySourceContext
 *
 *  Summary:
 *    A parameter block for client information to be retained by ATS
 *    and passed back to an ATSFontQueryCallback function.
 }
type
    ATSFontQuerySourceContext = record

  {
   * A 32-bit unsigned integer that indicates the version of this
   * structure. This should be set to 0.
   }
        version: UInt32;

  {
   * A pointer-sized client datum that should be passed back to an
   * ATSFontQueryCallback function.
   }
        refCon: Ptr;

  {
   * The callback used to add a retain to the refCon.
   }
        retain: CFAllocatorRetainCallBack;

  {
   * The callback used to remove a retain to the refCon.
   }
        release: CFAllocatorReleaseCallBack;
    end;
    ATSFontQuerySourceContextPtr = ^ATSFontQuerySourceContext;

{
 *  ATSFontQueryMessageID
 *
 *  Discussion:
 *    Constants for ATS font query message types.
 }
type
    ATSFontQueryMessageID = SInt32;
const

  {
   * The message ID for a font request query. The data for a message
   * with this ID is a flattened CFDictionaryRef with keys and values
   * as decribed below. A query dictionary may have any or all of these
   * entries.
   }
  kATSQueryActivateFontMessage  = $61747361 (* 'atsa' *);


{
 *  ATSFontQueryCallback
 *
 *  Summary:
 *    Callback for receiving font-related queries from ATS.
 *
 *  Parameters:
 *
 *    msgid:
 *      An ATSFontQueryMessageID that identifies the message type.
 *
 *    data:
 *      A CFPropertyListRef that represents the query. The content is
 *      message type-specific.
 *
 *    refCon:
 *      A pointer-sized client datum that was optionally provided to
 *      ATSCreateFontQueryRunLoopSource.
 *
 *  Result:
 *    A CFPropertyListRef that represents the message type-specific
 *    response to the query. May be NULL.
 }
type ATSFontQueryCallback = function( msgid: ATSFontQueryMessageID; data: CFPropertyListRef; refCon: UnivPtr ): CFPropertyListRef;
{
 *  ATSCreateFontQueryRunLoopSource()
 *
 *  Summary:
 *    Creates a CFRunLoopSourceRef that will be used to convey font
 *    queries from ATS.
 *
 *  Parameters:
 *
 *    queryOrder:
 *      A CFIndex that specifies the priority of this query receiver
 *      relative to others. When ATS makes a font query, it will send
 *      the query to each receiver in priority order, from highest to
 *      lowest. "Normal" priority is 0.
 *
 *    sourceOrder:
 *      The order of the created run loop source.
 *
 *    callout:
 *      A function pointer of type ATSFontQueryCallback that will be
 *      called to process a font query.
 *
 *    context:
 *      An ATSFontQuerySourceContext parameter block that provides a
 *      pointer-sized client datum which will be retained by ATS and
 *      passed to the callout function. May be NULL.
 *
 *  Result:
 *    A CFRunLoopSourceRef. To stop receiving queries, invalidate this
 *    run loop source.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in ApplicationServices.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
function ATSCreateFontQueryRunLoopSource( queryOrder: CFIndex; sourceOrder: CFIndex; callout: ATSFontQueryCallback; context: ATSFontQuerySourceContextPtr ): CFRunLoopSourceRef; external name '_ATSCreateFontQueryRunLoopSource';

{ ----------------------------------------------------------------------------------------- }
{ Font request query message content                                                        }
{ ----------------------------------------------------------------------------------------- }
{ Keys in a font request query dictionary. }
{ These keys appear in the dictionary for a kATSQueryActivateFontMessage query. }

//const
{
 *  kATSQueryClientPID
 *
 *  Discussion:
 *    The process ID of the application making the query. The
 *    corresponding value is a CFNumberRef that contains a pid_t.
 }
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kATSQueryClientPID CFSTRP('ATS client pid')}
{$endc}

{
 *  kATSQueryQDFamilyName
 *
 *  Discussion:
 *    The Quickdraw-style family name of the font being requested, e.g.
 *    the name passed to GetFNum. The corresponding value is a
 *    CFStringRef.
 }
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kATSQueryQDFamilyName CFSTRP('font family name')}
{$endc}

{
 *  kATSQueryFontName
 *
 *  Discussion:
 *    The name of the font being requested. The corresponding value is
 *    a CFStringRef suitable as an argument to ATSFontFindFromName().
 *    This should match a candidate font's unique or full name.
 }
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kATSQueryFontName CFSTRP('font name')}
{$endc}

{
 *  kATSQueryFontPostScriptName
 *
 *  Discussion:
 *    The PostScript name of the font being requested. The
 *    corresponding value is a CFStringRef suitable as an argument to
 *    ATSFontFindFromPostScriptName(). This should match either the
 *    PostScript name derived from the font's FOND resource or its sfnt
 *    name table, with preference given to the FOND PostScript name.
 }
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kATSQueryFontPostScriptName CFSTRP('font PS name')}
{$endc}

{
 *  kATSQueryFontNameTableEntries
 *
 *  Discussion:
 *    A descriptor for sfnt name table entries that the requested font
 *    must have. The corresponding value is a CFArrayRef of
 *    CFDictionaryRefs that describe name table entries. A font must
 *    have all of the specified entries to be considered a match.
 }
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kATSQueryFontNameTableEntries CFSTRP('font name table entries')}
{$endc}
{ Keys in a font raw name descriptor dictionary. }

{
 *  kATSFontNameTableCode
 *
 *  Discussion:
 *    The font name's name code. The corresponding value is a
 *    CFNumberRef. If missing, assume kFontNoNameCode.
 }
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kATSFontNameTableCode CFSTRP('font name code')}
{$endc}

{
 *  kATSFontNameTablePlatform
 *
 *  Discussion:
 *    The font name's platform code. The corresponding value is a
 *    CFNumberRef. If missing, assume kFontNoPlatformCode.
 }
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kATSFontNameTablePlatform CFSTRP('font platform code')}
{$endc}

{
 *  kATSFontNameTableScript
 *
 *  Discussion:
 *    The font name's script code. The corresponding value is a
 *    CFNumberRef. If missing, assume kFontNoScriptCode.
 }
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kATSFontNameTableScript CFSTRP('font script code')}
{$endc}

{
 *  kATSFontNameTableLanguage
 *
 *  Discussion:
 *    The font name's language code. The corresponding value is a
 *    CFNumberRef. If missing, assume kFontNoLanguageCode.
 }
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kATSFontNameTableLanguage CFSTRP('font language code')}
{$endc}

{
 *  kATSFontNameTableBytes
 *
 *  Discussion:
 *    The raw bytes of the font name. The corresponding value is a
 *    CFDataRef that contains the raw name bytes.
 }
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kATSFontNameTableBytes CFSTRP('font name table bytes')}
{$endc}

{$ALIGN MAC68K}
{#POP}
{unit ATSLayoutTypes}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}

{ --------------------------------------------------------------------------- }
{ CONSTANTS and related scalar types }
{ --------------------------------------------------------------------------- }
{ Miscellaneous constants }

const
  kATSUseGlyphAdvance   = $7FFFFFFF;                    { assignment to use natural glyph advance value }
    kATSUseLineHeight           = $7FFFFFFF;                    {  assignment to use natural line ascent/descent values  }
    kATSNoTracking              = $80000000;                    {  negativeInfinity  }

{
 *  ATSULayoutOperationSelector
 *
 *  Summary:
 *    This is used to select which operations to override, or which
 *    operation is currently being run.
 }
type ATSULayoutOperationSelector = UInt32;
const

  {
   * No Layout operation is currently selected.
   }
  kATSULayoutOperationNone      = $00000000;

  {
   * Select the Justification operation.
   }
  kATSULayoutOperationJustification = $00000001;

  {
   * Select the character morphing operation.
   }
  kATSULayoutOperationMorph     = $00000002;

  {
   * Select the kerning adjustment operation.
   }
  kATSULayoutOperationKerningAdjustment = $00000004;

  {
   * Select the baseline adjustment operation.
   }
  kATSULayoutOperationBaselineAdjustment = $00000008;

  {
   * Select the tracking adjustment operation.
   }
  kATSULayoutOperationTrackingAdjustment = $00000010;

  {
   * Select the period of time after ATSUI has finished all of it's
   * layout operations.
   }
  kATSULayoutOperationPostLayoutAdjustment = $00000020;
  kATSULayoutOperationAppleReserved = $FFFFFFC0;

{ ---------------------------------------------------------------------------- }

{
 *  ATSULayoutOperationCallbackStatus
 *
 *  Summary:
 *    One of these must be returned by a
 *    ATSUDLayoutOperationOverrideUPP callback function in order to
 *    indicate ATSUI's status.
 }
type ATSULayoutOperationCallbackStatus = UInt32;
const

  {
   * Return this if the callback function has totally handled the
   * operation which triggered the callback and does not need ATSUI to
   * run any further processing for the operation.
   }
  kATSULayoutOperationCallbackStatusHandled = $00000000;

  {
   * Return this if the callback function has not totally handled the
   * operation which triggered the callback and needs ATSUI to run it's
   * own processing.
   }
  kATSULayoutOperationCallbackStatusContinue = $00000001;


{ ---------------------------------------------------------------------------- }

{
 *  ATSLineLayoutOptions
 *
 *  Summary:
 *    ATSLineLayoutOptions are normally set in an ATSUTextLayout object
 *    via the kATSULineLayoutOptionsTag layout control attribute. They
 *    can also be set in an ATSLineLayoutParams structure.
 }
type ATSLineLayoutOptions = UInt32;
const

  {
   * No options specified.
   }
  kATSLineNoLayoutOptions       = $00000000;

  {
   * This line option is no longer used.
   }
  kATSLineIsDisplayOnly         = $00000001; { obsolete option }

  {
   * Specifies that no hangers to be formed on the line.
   }
  kATSLineHasNoHangers          = $00000002;

  {
   * Specifies that no optical alignment to be performed on the line.
   }
  kATSLineHasNoOpticalAlignment = $00000004;

  {
   * Specifies that space charcters should not be treated as hangers.
   }
  kATSLineKeepSpacesOutOfMargin = $00000008;

  {
   * Specifies no post-compensation justification is to be performed.
   }
  kATSLineNoSpecialJustification = $00000010;

  {
   * Specifies that if the line is the last of a paragraph, it will not
   * get justified.
   }
  kATSLineLastNoJustification   = $00000020;

  {
   * Specifies that the displayed line glyphs will adjust for device
   * metrics.
   }
  kATSLineFractDisable          = $00000040;

  {
   * Specifies that the carets at the ends of the line will be
   * guarenteed to be perpendicular to the baseline.
   }
  kATSLineImposeNoAngleForEnds  = $00000080;

  {
   * Highlights for the line end characters will be extended to 0 and
   * the specified line width.
   }
  kATSLineFillOutToWidth        = $00000100;

  {
   * Specifies that the tab character width will be automatically
   * adjusted to fit the specified line width.
   }
  kATSLineTabAdjustEnabled      = $00000200;

  {
   * Specifies that any leading value specified by a font will be
   * ignored.
   }
  kATSLineIgnoreFontLeading     = $00000400;

  {
   * Specifies that ATS produce antialiased glyph images despite system
   * preferences or CGContext settings.
   }
  kATSLineApplyAntiAliasing     = $00000800;

  {
   * Specifies that ATS turn-off antialiasing glyph imaging despite
   * system preferences or CGContext settings (negates
   * kATSLineApplyAntiAliasing bit if set).
   }
  kATSLineNoAntiAliasing        = $00001000;

  {
   * Specifies that if the line width is not sufficient to hold all its
   * glyphs, glyph positions are allowed to extend beyond the line's
   * assigned width so negative justification is not used.
   }
  kATSLineDisableNegativeJustification = $00002000;

  {
   * Specifies that lines with any integer glyph positioning (due to
   * either any character non-antialiased or kATSLineFractDisable
   * specified), not automatically esthetically adjust individual
   * character positions while rendering to display.
   }
  kATSLineDisableAutoAdjustDisplayPos = $00004000;

  {
   * Specifies that rendering be done through Quickdraw (default
   * rendering in ATSUI is through CoreGraphics on MacOSX).
   }
  kATSLineUseQDRendering        = $00008000;

  {
   * Specifies that any Justification operations will not be run.
   }
  kATSLineDisableAllJustification = $00010000;

  {
   * Specifies that any glyph morphing operations will not be run.
   }
  kATSLineDisableAllGlyphMorphing = $00020000;

  {
   * Specifies that any kerning adjustment operations will not be run.
   }
  kATSLineDisableAllKerningAdjustments = $00040000;

  {
   * Specifies that any baseline adjustment operations will not be run.
   }
  kATSLineDisableAllBaselineAdjustments = $00080000;

  {
   * Specifies that any tracking adjustment operations will not be run.
   }
  kATSLineDisableAllTrackingAdjustments = $00100000;

  {
   * Convenience constant for turning-off all adjustments.
   }
  kATSLineDisableAllLayoutOperations = kATSLineDisableAllJustification or kATSLineDisableAllGlyphMorphing or kATSLineDisableAllKerningAdjustments or kATSLineDisableAllBaselineAdjustments or kATSLineDisableAllTrackingAdjustments;

  {
   * Specifies to optimize for displaying text only.  Note, rounded
   * device metrics will be used instead of fractional path metrics.
   }
  kATSLineUseDeviceMetrics      = $01000000;

  {
   * Specifies that line breaking should occur at the nearest
   * character, not word.  This could cause a word to be split among
   * multiple lines.
   }
  kATSLineBreakToNearestCharacter = $02000000;

  {
   * These bits are reserved by Apple and will result in a invalid
   * value error if attemped to set. Obsolete constants:
   }
  kATSLineAppleReserved         = $FCE00000;


{ --------------------------------------------------------------------------- }

{
 *  ATSStyleRenderingOptions
 *
 *  Summary:
 *    ATSStyleRenderingOptions are set in the ATSUStyle object via the
 *    attribute tag kATSUStyleRenderingOptions. They provide finer
 *    control over how the style is rendered.
 }
type ATSStyleRenderingOptions = UInt32;
const

  {
   * No options specified.
   }
  kATSStyleNoOptions            = $00000000;

  {
   * Specifies that ATS produce "unhinted" glyph outlines (default is
   * hinted glyph outlines).
   }
  kATSStyleNoHinting            = $00000001;

  {
   * Specifies that ATS produce antialiased glyph images despite system
   * preferences or CGContext settings.
   }
  kATSStyleApplyAntiAliasing    = $00000002;

  {
   * Specifies that ATS turn-off antialiasing glyph imaging despite
   * system preferences or CGContext settings (negates
   * kATSStyleApplyAntiAliasing bit if set).
   }
  kATSStyleNoAntiAliasing       = $00000004;

  {
   * These bits are reserved by Apple and will result in a invalid
   * value error if attemped to set.
   }
  kATSStyleAppleReserved        = $FFFFFFF8;

  {
   * (OBSOLETE) Specifies that ATS produce "hinted" glyph outlines (the
   * default behavior). THIS NAME IS OBSOLETE. DO NOT USE. It's only
   * left in for backwards compatibility.
   }
  kATSStyleApplyHints           = kATSStyleNoOptions;

{
 *  ATSGlyphInfoFlags
 *
 *  Summary:
 *    ATSGlyphInfoFlags are set in the individual ATSLayoutRecord
 *    structures and apply only to the ATSGlyphRef in that structure.
 *    The are used by the layout engine to flag a glyph with specific
 *    properties.
 }
type ATSGlyphInfoFlags = UInt32;
const

  {
   * These bits are Apple reserved and may result in an invalid value
   * error if attempted to set.
   }
  kATSGlyphInfoAppleReserved    = $1FFBFFE8;

  {
   * The glyph attaches to another glyph.
   }
  kATSGlyphInfoIsAttachment     = $80000000;

  {
   * The glyph can hang off left/top edge of line.
   }
  kATSGlyphInfoIsLTHanger       = $40000000;

  {
   * The glyph can hang off right/bottom edge of line.
   }
  kATSGlyphInfoIsRBHanger       = $20000000;

  {
   * The glyph is not really a glyph at all, but an end-marker designed
   * to allow the calculation of the previous glyph's advance.
   }
  kATSGlyphInfoTerminatorGlyph  = $00080000;

  {
   * The glyph is a white space glyph.
   }
  kATSGlyphInfoIsWhiteSpace     = $00040000;

  {
   * Glyph has a style specified imposed width (i.e. advance)
   }
  kATSGlyphInfoHasImposedWidth  = $00000010;

  {
   * A three-bit mask, that can be used to get the size of the original
   * character that spawned this glyph. When a logical 'and' operation
   * with this mask and an ATSGlyphInfoFlags variable, it will yield
   * the size in bytes of the original character (0 - 7 bytes possible).
   }
  kATSGlyphInfoByteSizeMask     = $00000007;


{ --------------------------------------------------------------------------- }

{
 *  Summary:
 *    These values are passed into the ATSUGetGlyphBounds function to
 *    indicate whether the width of the resulting typographic glyph
 *    bounds will be determined using the caret origin, glyph origin in
 *    device space, or glyph origin in fractional absolute positions
 }
const

  {
   * Specifies that the width of the typographic glyph bounds will be
   * determined using the caret origin. The caret origin is halfway
   * between two characters.
   }
  kATSUseCaretOrigins           = 0;

  {
   * Specifies that the width of the typographic glyph bounds will be
   * determined using the glyph origin in device space. This is useful
   * for adjusting text on the screen.
   }
  kATSUseDeviceOrigins          = 1;

  {
   * Specifies that the width of the typographic glyph bounds will be
   * determined using the glyph origin in fractional absolute
   * positions, which are uncorrected for device display. This provides
   * the ideal position of laid-out text and is useful for scaling text
   * on the screen. This origin is also used to get the width of the
   * typographic bounding rectangle when you call ATSUMeasureText.
   }
  kATSUseFractionalOrigins      = 2;
  kATSUseOriginFlags            = 3;


    {    ---------------------------------------------------------------------------    }
    {    STRUCTURED TYPES and related constants     }
    {    ---------------------------------------------------------------------------    }

    {
        The ATSTrapezoid structure supplies a convenient container
        for glyph bounds in trapezoidal form.
        }

type
    ATSTrapezoidPtr = ^ATSTrapezoid;
    ATSTrapezoid = record
        upperLeft:              FixedPoint;
        upperRight:             FixedPoint;
        lowerRight:             FixedPoint;
        lowerLeft:              FixedPoint;
    end;

    {
        The JustWidthDeltaEntryOverride structure specifies values for the grow and shrink case during
        justification, both on the left and on the right. It also contains flags.  This particular structure
        is used for passing justification overrides to LLC.  For further sfnt resource 'just' table
        constants and structures, see SFNTLayoutTypes.h.
        }
    ATSJustWidthDeltaEntryOverridePtr = ^ATSJustWidthDeltaEntryOverride;
    ATSJustWidthDeltaEntryOverride = record
        beforeGrowLimit:        Fixed;                                  {  ems AW can grow by at most on LT  }
        beforeShrinkLimit:      Fixed;                                  {  ems AW can shrink by at most on LT  }
        afterGrowLimit:         Fixed;                                  {  ems AW can grow by at most on RB  }
        afterShrinkLimit:       Fixed;                                  {  ems AW can shrink by at most on RB  }
        growFlags:              JustificationFlags;                     {  flags controlling grow case  }
        shrinkFlags:            JustificationFlags;                     {  flags controlling shrink case  }
    end;

    {    The JustPriorityOverrides type is an array of 4 width delta records, one per priority level override.  }
    ATSJustPriorityWidthDeltaOverrides  = array [0..3] of ATSJustWidthDeltaEntryOverride;
    {    ---------------------------------------------------------------------------    }

{
 *  ATSULineRef
 *
 *  Summary:
 *    A reference to a line that is being laid out. This is passed into
 *    the ATSUDirectLayoutOperationOverrideUPP callback function to be
 *    used by the ATSUDirectGetLayoutDataArrayPtrFromLineRef function.
 *    The only way to get a line ref is inside of the callback. The
 *    only time the line ref is valid is inside of the callback.
 }
type
    ATSULineRef    = ^SInt32; { an opaque 32-bit type }
{ ---------------------------------------------------------------------------- }
{ DirectAccess Layout Callback Definitions                                     }
{ ---------------------------------------------------------------------------- }

{
 *  ATSUDirectLayoutOperationOverrideProcPtr
 *
 *  Summary:
 *    Callback definition for a low-level adjustment routine hook.
 *
 *  Discussion:
 *    This callback can be set in an ATSUTextLayout object by setting
 *    the attribute tag kATSULayoutOperationOverrideTag and passing in
 *    a ATSULayoutOperationOverrideSpecifier structure into
 *    ATSUSetLayoutAttribute. This callback will be called whenever an
 *    ATSUI call triggers a re-layout for each operation it is
 *    installed for. The operation that triggered the callback will be
 *    set in the iCurrentOperation parameter. The callback function
 *    defined by the developer is only required to do one thing: return
 *    it's status to ATSUI as to what it has done. This is done via the
 *    oCallbackStatus parameter. It needs to tell ATSUI if it had
 *    handled the layout operation or if it still needs ATSUI to run
 *    it's own processes. iOperationCallbackParameterPtr is there in
 *    case there are ever any ATSUDirectLayoutOperationSelector which
 *    require extra parameters to be passed into the callback function.
 *    It is currently unused and will always be set to NULL. iRefCon is
 *    the constant that is set in the ATSUTextLayout object that
 *    spawned the operation by the ATSUSetTextLayoutRefCon() API.
 *    Within the context of the callback itself, only a limited subset
 *    of ATSUI APIs may be called. Basically, only the APIs that have
 *    no chance of triggering a re-layout are allowed to be called. The
 *    reason for this restriction is to prevent runaway recursion. Most
 *    of the APIs that have "create", "get", or "copy" are safe. Any
 *    attempt to call one of the restricted APIs will result in an
 *    immediate return with the kATSUInvalidCallInsideCallbackErr
 *    error. ATSULayoutOperationSelector and
 *    ATSULayoutOperationCallbackStatus are defined in ATSLayoutTypes.i.
 }
type ATSUDirectLayoutOperationOverrideProcPtr = function( iCurrentOperation: ATSULayoutOperationSelector; iLineRef: ATSULineRef; iRefCon: UInt32; iOperationCallbackParameterPtr: UnivPtr; var oCallbackStatus: ATSULayoutOperationCallbackStatus ): OSStatus;
// Beats me what this translates to.  If someone finds out they can tell me and we'll update it
// typedef STACK_UPP_TYPE(ATSUDirectLayoutOperationOverrideProcPtr)  ATSUDirectLayoutOperationOverrideUPP;
type ATSUDirectLayoutOperationOverrideUPP = Ptr;
{
 *  NewATSUDirectLayoutOperationOverrideUPP()
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in ApplicationServices.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
 *    Non-Carbon CFM:   available as macro/inline
 }
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
function NewATSUDirectLayoutOperationOverrideUPP( userRoutine: ATSUDirectLayoutOperationOverrideProcPtr ): ATSUDirectLayoutOperationOverrideUPP; external name '_NewATSUDirectLayoutOperationOverrideUPP';

{
 *  DisposeATSUDirectLayoutOperationOverrideUPP()
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in ApplicationServices.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
 *    Non-Carbon CFM:   available as macro/inline
 }
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
procedure DisposeATSUDirectLayoutOperationOverrideUPP( userUPP: ATSUDirectLayoutOperationOverrideUPP ); external name '_DisposeATSUDirectLayoutOperationOverrideUPP';

{
 *  InvokeATSUDirectLayoutOperationOverrideUPP()
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in ApplicationServices.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
 *    Non-Carbon CFM:   available as macro/inline
 }
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
function InvokeATSUDirectLayoutOperationOverrideUPP( iCurrentOperation: ATSULayoutOperationSelector; iLineRef: ATSULineRef; iRefCon: UInt32; iOperationCallbackParameterPtr: UnivPtr; var oCallbackStatus: ATSULayoutOperationCallbackStatus; userUPP: ATSUDirectLayoutOperationOverrideUPP ): OSStatus; external name '_InvokeATSUDirectLayoutOperationOverrideUPP';

{ ---------------------------------------------------------------------------- }

{
 *  ATSULayoutOperationOverrideSpecifier
 *
 *  Summary:
 *    This structure is used to install a callback for one or more
 *    ATSUI operations. To do this, simply passed one of these
 *    structure into the ATSUSetLayoutControls call with the
 *    kATSULayoutOperationOverrideTag tag.
 }
type
    ATSULayoutOperationOverrideSpecifier = record
            {
             * A bitfield containing the selector for the operations in which the
             * callback will be installed for.
             }
        operationSelector: ATSULayoutOperationSelector;
        overrideUPP: ATSUDirectLayoutOperationOverrideUPP;
    end;
    ATSULayoutOperationOverrideSpecifierPtr = ^ATSULayoutOperationOverrideSpecifier;


{$ALIGN MAC68K}
{#POP}
{unit CFBundle}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}


type
    CFBundleRef    = ^SInt32; { an opaque 32-bit type }
    CFBundleRefPtr = ^CFBundleRef;  { when a var xx:CFBundleRef parameter can be nil, it is changed to xx: CFBundleRefPtr }
    CFPlugInRef    = CFBundleRef;
    CFPlugInRefPtr = ^CFPlugInRef;  { when a var xx:CFPlugInRef parameter can be nil, it is changed to xx: CFPlugInRefPtr }
    {    ===================== Standard Info.plist keys =====================   }
var kCFBundleInfoDictionaryVersionKey: CFStringRef; external name '_kCFBundleInfoDictionaryVersionKey'; (* attribute const *)
    {
     *  kCFBundleInfoDictionaryVersionKey
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
    {    The version of the Info.plist format   }
var kCFBundleExecutableKey: CFStringRef; external name '_kCFBundleExecutableKey'; (* attribute const *)
    {
     *  kCFBundleExecutableKey
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
    {    The name of the executable in this bundle (if any)     }
var kCFBundleIdentifierKey: CFStringRef; external name '_kCFBundleIdentifierKey'; (* attribute const *)
    {
     *  kCFBundleIdentifierKey
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
    {    The bundle identifier (for CFBundleGetBundleWithIdentifier())  }
var kCFBundleVersionKey: CFStringRef; external name '_kCFBundleVersionKey'; (* attribute const *)
    {
     *  kCFBundleVersionKey
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
    {    The version number of the bundle.  Clients should use CFBundleGetVersionNumber() instead of accessing this key directly
        since that function will properly convert a version number in string format into its interger representation.   }
var kCFBundleDevelopmentRegionKey: CFStringRef; external name '_kCFBundleDevelopmentRegionKey'; (* attribute const *)
    {
     *  kCFBundleDevelopmentRegionKey
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
    {    The name of the development language of the bundle.    }
var kCFBundleNameKey: CFStringRef; external name '_kCFBundleNameKey'; (* attribute const *)
    {
     *  kCFBundleNameKey
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
    {    The human-readable name of the bundle.  This key is often found in the InfoPlist.strings since it is usually localized.    }
    {    ===================== Finding Bundles =====================    }
    {
     *  CFBundleGetMainBundle()
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function CFBundleGetMainBundle: CFBundleRef; external name '_CFBundleGetMainBundle';

{
 *  CFBundleGetBundleWithIdentifier()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFBundleGetBundleWithIdentifier(bundleID: CFStringRef): CFBundleRef; external name '_CFBundleGetBundleWithIdentifier';

{ A bundle can name itself by providing a key in the info dictionary. }
{ This facility is meant to allow bundle-writers to get hold of their }
{ bundle from their code without having to know where it was on the disk. }
{ This is meant to be a replacement mechanism for +bundleForClass: users. }
{
 *  CFBundleGetAllBundles()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFBundleGetAllBundles: CFArrayRef; external name '_CFBundleGetAllBundles';

{ This is potentially expensive.  Use with care. }
{ ===================== Creating Bundles ===================== }
{
 *  CFBundleGetTypeID()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFBundleGetTypeID: UInt32; external name '_CFBundleGetTypeID';

{
 *  CFBundleCreate()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFBundleCreate(allocator: CFAllocatorRef; bundleURL: CFURLRef): CFBundleRef; external name '_CFBundleCreate';

{ Might return an existing instance with the ref-count bumped. }
{
 *  CFBundleCreateBundlesFromDirectory()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFBundleCreateBundlesFromDirectory(allocator: CFAllocatorRef; directoryURL: CFURLRef; bundleType: CFStringRef): CFArrayRef; external name '_CFBundleCreateBundlesFromDirectory';

{ Create instances for all bundles in the given directory matching the given }
{ type (or all of them if bundleType is NULL) }
{ ==================== Basic Bundle Info ==================== }
{
 *  CFBundleCopyBundleURL()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFBundleCopyBundleURL(bundle: CFBundleRef): CFURLRef; external name '_CFBundleCopyBundleURL';

{
 *  CFBundleGetValueForInfoDictionaryKey()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFBundleGetValueForInfoDictionaryKey(bundle: CFBundleRef; key: CFStringRef): CFTypeRef; external name '_CFBundleGetValueForInfoDictionaryKey';

{ Returns a localized value if available, otherwise the global value. }
{
 *  CFBundleGetInfoDictionary()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFBundleGetInfoDictionary(bundle: CFBundleRef): CFDictionaryRef; external name '_CFBundleGetInfoDictionary';

{ This is the global info dictionary.  Note that CFBundle may add }
{ extra keys to the dictionary for its own use. }
{
 *  CFBundleGetLocalInfoDictionary()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFBundleGetLocalInfoDictionary(bundle: CFBundleRef): CFDictionaryRef; external name '_CFBundleGetLocalInfoDictionary';

{ This is the localized info dictionary. }
{
 *  CFBundleGetPackageInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CFBundleGetPackageInfo(bundle: CFBundleRef; var packageType: OSType; var packageCreator: OSType); external name '_CFBundleGetPackageInfo';

{
 *  CFBundleGetIdentifier()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFBundleGetIdentifier(bundle: CFBundleRef): CFStringRef; external name '_CFBundleGetIdentifier';

{
 *  CFBundleGetVersionNumber()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFBundleGetVersionNumber(bundle: CFBundleRef): UInt32; external name '_CFBundleGetVersionNumber';

{
 *  CFBundleGetDevelopmentRegion()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFBundleGetDevelopmentRegion(bundle: CFBundleRef): CFStringRef; external name '_CFBundleGetDevelopmentRegion';

{
 *  CFBundleCopySupportFilesDirectoryURL()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFBundleCopySupportFilesDirectoryURL(bundle: CFBundleRef): CFURLRef; external name '_CFBundleCopySupportFilesDirectoryURL';

{
 *  CFBundleCopyResourcesDirectoryURL()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFBundleCopyResourcesDirectoryURL(bundle: CFBundleRef): CFURLRef; external name '_CFBundleCopyResourcesDirectoryURL';

{
 *  CFBundleCopyPrivateFrameworksURL()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFBundleCopyPrivateFrameworksURL(bundle: CFBundleRef): CFURLRef; external name '_CFBundleCopyPrivateFrameworksURL';

{
 *  CFBundleCopySharedFrameworksURL()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFBundleCopySharedFrameworksURL(bundle: CFBundleRef): CFURLRef; external name '_CFBundleCopySharedFrameworksURL';

{
 *  CFBundleCopySharedSupportURL()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFBundleCopySharedSupportURL(bundle: CFBundleRef): CFURLRef; external name '_CFBundleCopySharedSupportURL';

{
 *  CFBundleCopyBuiltInPlugInsURL()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFBundleCopyBuiltInPlugInsURL(bundle: CFBundleRef): CFURLRef; external name '_CFBundleCopyBuiltInPlugInsURL';

{ ------------- Basic Bundle Info without a CFBundle instance ------------- }
{ This API is provided to enable developers to retrieve basic information }
{ about a bundle without having to create an instance of CFBundle. }
{
 *  CFBundleCopyInfoDictionaryInDirectory()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFBundleCopyInfoDictionaryInDirectory(bundleURL: CFURLRef): CFDictionaryRef; external name '_CFBundleCopyInfoDictionaryInDirectory';

{
 *  CFBundleGetPackageInfoInDirectory()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFBundleGetPackageInfoInDirectory(url: CFURLRef; var packageType: UInt32; var packageCreator: UInt32): boolean; external name '_CFBundleGetPackageInfoInDirectory';

{ ==================== Resource Handling API ==================== }
{
 *  CFBundleCopyResourceURL()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFBundleCopyResourceURL(bundle: CFBundleRef; resourceName: CFStringRef; resourceType: CFStringRef; subDirName: CFStringRef): CFURLRef; external name '_CFBundleCopyResourceURL';

{
 *  CFBundleCopyResourceURLsOfType()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFBundleCopyResourceURLsOfType(bundle: CFBundleRef; resourceType: CFStringRef; subDirName: CFStringRef): CFArrayRef; external name '_CFBundleCopyResourceURLsOfType';

{
 *  CFBundleCopyLocalizedString()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFBundleCopyLocalizedString(bundle: CFBundleRef; key: CFStringRef; value: CFStringRef; tableName: CFStringRef): CFStringRef; external name '_CFBundleCopyLocalizedString';

{ ------------- Resource Handling without a CFBundle instance ------------- }
{ This API is provided to enable developers to use the CFBundle resource }
{ searching policy without having to create an instance of CFBundle. }
{ Because of caching behavior when a CFBundle instance exists, it will be faster }
{ to actually create a CFBundle if you need to access several resources. }
{
 *  CFBundleCopyResourceURLInDirectory()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFBundleCopyResourceURLInDirectory(bundleURL: CFURLRef; resourceName: CFStringRef; resourceType: CFStringRef; subDirName: CFStringRef): CFURLRef; external name '_CFBundleCopyResourceURLInDirectory';

{
 *  CFBundleCopyResourceURLsOfTypeInDirectory()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFBundleCopyResourceURLsOfTypeInDirectory(bundleURL: CFURLRef; resourceType: CFStringRef; subDirName: CFStringRef): CFArrayRef; external name '_CFBundleCopyResourceURLsOfTypeInDirectory';

{ =========== Localization-specific Resource Handling API =========== }
{ This API allows finer-grained control over specific localizations,  }
{ as distinguished from the above API, which always uses the user's   }
{ preferred localizations.  }
{
 *  CFBundleCopyBundleLocalizations()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFBundleCopyBundleLocalizations(bundle: CFBundleRef): CFArrayRef; external name '_CFBundleCopyBundleLocalizations';

{ Lists the localizations that a bundle contains.  }
{
 *  CFBundleCopyPreferredLocalizationsFromArray()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFBundleCopyPreferredLocalizationsFromArray(locArray: CFArrayRef): CFArrayRef; external name '_CFBundleCopyPreferredLocalizationsFromArray';

{ Given an array of possible localizations, returns the one or more }
{ that CFBundle would use in the current context. To find out which }
{ localizations are in use for a particular bundle, apply this to   }
{ the result of CFBundleCopyBundleLocalizations.  }
{
 *  CFBundleCopyResourceURLForLocalization()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFBundleCopyResourceURLForLocalization(bundle: CFBundleRef; resourceName: CFStringRef; resourceType: CFStringRef; subDirName: CFStringRef; localizationName: CFStringRef): CFURLRef; external name '_CFBundleCopyResourceURLForLocalization';

{
 *  CFBundleCopyResourceURLsOfTypeForLocalization()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFBundleCopyResourceURLsOfTypeForLocalization(bundle: CFBundleRef; resourceType: CFStringRef; subDirName: CFStringRef; localizationName: CFStringRef): CFArrayRef; external name '_CFBundleCopyResourceURLsOfTypeForLocalization';

{ ==================== Primitive Code Loading API ==================== }
{ This API abstracts the various different executable formats supported on }
{ various platforms.  It can load DYLD, CFM, or DLL shared libraries (on their }
{ appropriate platforms) and gives a uniform API for looking up functions. }
{ Note that Cocoa-based bundles containing Objective-C or Java code must }
{ be loaded with NSBundle, not CFBundle.  Once they are loaded, however, }
{ either CFBundle or NSBundle can be used. }
{
 *  CFBundleCopyExecutableURL()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFBundleCopyExecutableURL(bundle: CFBundleRef): CFURLRef; external name '_CFBundleCopyExecutableURL';

{
 *  CFBundleIsExecutableLoaded()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFBundleIsExecutableLoaded(bundle: CFBundleRef): boolean; external name '_CFBundleIsExecutableLoaded';

{
 *  CFBundleLoadExecutable()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFBundleLoadExecutable(bundle: CFBundleRef): boolean; external name '_CFBundleLoadExecutable';

{
 *  CFBundleUnloadExecutable()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CFBundleUnloadExecutable(bundle: CFBundleRef); external name '_CFBundleUnloadExecutable';

{
 *  CFBundleGetFunctionPointerForName()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFBundleGetFunctionPointerForName(bundle: CFBundleRef; functionName: CFStringRef): Ptr; external name '_CFBundleGetFunctionPointerForName';

{
 *  CFBundleGetFunctionPointersForNames()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CFBundleGetFunctionPointersForNames(bundle: CFBundleRef; functionNames: CFArrayRef; var ftbl: UnivPtr); external name '_CFBundleGetFunctionPointersForNames';

{
 *  CFBundleGetDataPointerForName()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFBundleGetDataPointerForName(bundle: CFBundleRef; symbolName: CFStringRef): Ptr; external name '_CFBundleGetDataPointerForName';

{
 *  CFBundleGetDataPointersForNames()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CFBundleGetDataPointersForNames(bundle: CFBundleRef; symbolNames: CFArrayRef; var stbl: UnivPtr); external name '_CFBundleGetDataPointersForNames';

{
 *  CFBundleCopyAuxiliaryExecutableURL()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFBundleCopyAuxiliaryExecutableURL(bundle: CFBundleRef; executableName: CFStringRef): CFURLRef; external name '_CFBundleCopyAuxiliaryExecutableURL';

{ This function can be used to find executables other than your main }
{ executable.  This is useful, for instance, for applications that have }
{ some command line tool that is packaged with and used by the application. }
{ The tool can be packaged in the various platform executable directories }
{ in the bundle and can be located with this function.  This allows an }
{ app to ship versions of the tool for each platform as it does for the }
{ main app executable. }
{ ==================== Getting a bundle's plugIn ==================== }
{
 *  CFBundleGetPlugIn()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFBundleGetPlugIn(bundle: CFBundleRef): CFPlugInRef; external name '_CFBundleGetPlugIn';

{ ==================== Resource Manager-Related API ==================== }
{
 *  CFBundleOpenBundleResourceMap()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFBundleOpenBundleResourceMap(bundle: CFBundleRef): SInt16; external name '_CFBundleOpenBundleResourceMap';

{ This function opens the non-localized and the localized resource files }
{ (if any) for the bundle, creates and makes current a single read-only }
{ resource map combining both, and returns a reference number for it. }
{ If it is called multiple times, it opens the files multiple times, }
{ and returns distinct reference numbers.  }
{
 *  CFBundleOpenBundleResourceFiles()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFBundleOpenBundleResourceFiles(bundle: CFBundleRef; var refNum: SInt16; var localizedRefNum: SInt16): SInt32; external name '_CFBundleOpenBundleResourceFiles';

{ Similar to CFBundleOpenBundleResourceMap, except that it creates two }
{ separate resource maps and returns reference numbers for both. }
{
 *  CFBundleCloseBundleResourceMap()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CFBundleCloseBundleResourceMap(bundle: CFBundleRef; refNum: SInt16); external name '_CFBundleCloseBundleResourceMap';

{$ALIGN MAC68K}
{#POP}
{unit CFHTTPMessage}
{$ALIGN MAC68K}






{
 *  kCFHTTPVersion1_0
 *
 *  Availability:
 *    Mac OS X:         in version 10.1 and later in CoreServices.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER
var kCFHTTPVersion1_0: CFStringRef; external name '_kCFHTTPVersion1_0'; (* attribute const *)
{
 *  kCFHTTPVersion1_1
 *
 *  Availability:
 *    Mac OS X:         in version 10.1 and later in CoreServices.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER
var kCFHTTPVersion1_1: CFStringRef; external name '_kCFHTTPVersion1_1'; (* attribute const *)
{
 *  kCFHTTPAuthenticationSchemeBasic
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in CoreServices.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
var kCFHTTPAuthenticationSchemeBasic: CFStringRef; external name '_kCFHTTPAuthenticationSchemeBasic'; (* attribute const *)
{
 *  kCFHTTPAuthenticationSchemeDigest
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in CoreServices.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
var kCFHTTPAuthenticationSchemeDigest: CFStringRef; external name '_kCFHTTPAuthenticationSchemeDigest'; (* attribute const *)
{ Currently unsupported }
type
    CFHTTPMessageRef    = ^SInt32; { an opaque 32-bit type }
{
 *  CFHTTPMessageGetTypeID()
 *
 *  Availability:
 *    Mac OS X:         in version 10.1 and later in CoreServices.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER
function CFHTTPMessageGetTypeID: CFTypeID; external name '_CFHTTPMessageGetTypeID';


{
 *  CFHTTPMessageCreateRequest()
 *
 *  Availability:
 *    Mac OS X:         in version 10.1 and later in CoreServices.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER
function CFHTTPMessageCreateRequest( allocator: CFAllocatorRef; requestMethod: CFStringRef; url: CFURLRef; httpVersion: CFStringRef ): CFHTTPMessageRef; external name '_CFHTTPMessageCreateRequest';


{ Pass NULL to use the standard description for the given status code, as found in RFC 2616}
{
 *  CFHTTPMessageCreateResponse()
 *
 *  Availability:
 *    Mac OS X:         in version 10.1 and later in CoreServices.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER
function CFHTTPMessageCreateResponse( allocator: CFAllocatorRef; statusCode: SInt32; statusDescription: CFStringRef; httpVersion: CFStringRef ): CFHTTPMessageRef; external name '_CFHTTPMessageCreateResponse';


{ Creates an empty request or response, which you can then append bytes to via CFHTTPMessageAppendBytes().  The HTTP header information will be parsed out as the bytes are appended.}
{
 *  CFHTTPMessageCreateEmpty()
 *
 *  Availability:
 *    Mac OS X:         in version 10.1 and later in CoreServices.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER
function CFHTTPMessageCreateEmpty( allocator: CFAllocatorRef; isRequest: Boolean ): CFHTTPMessageRef; external name '_CFHTTPMessageCreateEmpty';


{
 *  CFHTTPMessageCreateCopy()
 *
 *  Availability:
 *    Mac OS X:         in version 10.1 and later in CoreServices.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER
function CFHTTPMessageCreateCopy( allocator: CFAllocatorRef; message: CFHTTPMessageRef ): CFHTTPMessageRef; external name '_CFHTTPMessageCreateCopy';


{ Whether the message is a response or a request}
{
 *  CFHTTPMessageIsRequest()
 *
 *  Availability:
 *    Mac OS X:         in version 10.1 and later in CoreServices.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER
function CFHTTPMessageIsRequest( message: CFHTTPMessageRef ): Boolean; external name '_CFHTTPMessageIsRequest';


{
 *  CFHTTPMessageCopyVersion()
 *
 *  Availability:
 *    Mac OS X:         in version 10.1 and later in CoreServices.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER
function CFHTTPMessageCopyVersion( message: CFHTTPMessageRef ): CFStringRef; external name '_CFHTTPMessageCopyVersion';


{
 *  CFHTTPMessageCopyBody()
 *
 *  Availability:
 *    Mac OS X:         in version 10.1 and later in CoreServices.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER
function CFHTTPMessageCopyBody( message: CFHTTPMessageRef ): CFDataRef; external name '_CFHTTPMessageCopyBody';


{
 *  CFHTTPMessageSetBody()
 *
 *  Availability:
 *    Mac OS X:         in version 10.1 and later in CoreServices.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER
procedure CFHTTPMessageSetBody( message: CFHTTPMessageRef; bodyData: CFDataRef ); external name '_CFHTTPMessageSetBody';


{
 *  CFHTTPMessageCopyHeaderFieldValue()
 *
 *  Availability:
 *    Mac OS X:         in version 10.1 and later in CoreServices.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER
function CFHTTPMessageCopyHeaderFieldValue( message: CFHTTPMessageRef; headerField: CFStringRef ): CFStringRef; external name '_CFHTTPMessageCopyHeaderFieldValue';


{
 *  CFHTTPMessageCopyAllHeaderFields()
 *
 *  Availability:
 *    Mac OS X:         in version 10.1 and later in CoreServices.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER
function CFHTTPMessageCopyAllHeaderFields( message: CFHTTPMessageRef ): CFDictionaryRef; external name '_CFHTTPMessageCopyAllHeaderFields';


{
 *  CFHTTPMessageSetHeaderFieldValue()
 *
 *  Availability:
 *    Mac OS X:         in version 10.1 and later in CoreServices.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER
procedure CFHTTPMessageSetHeaderFieldValue( message: CFHTTPMessageRef; headerField: CFStringRef; value: CFStringRef ); external name '_CFHTTPMessageSetHeaderFieldValue';


{ The following function appends the given bytes to the message given (parsing out any control information if appropriate).  Returns FALSE if a parsing error occurs while processing the new data.}
{
 *  CFHTTPMessageAppendBytes()
 *
 *  Availability:
 *    Mac OS X:         in version 10.1 and later in CoreServices.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER
function CFHTTPMessageAppendBytes( message: CFHTTPMessageRef; newBytes: UnivPtr; numBytes: CFIndex ): Boolean; external name '_CFHTTPMessageAppendBytes';


{ Whether further header data is expected by the message}
{
 *  CFHTTPMessageIsHeaderComplete()
 *
 *  Availability:
 *    Mac OS X:         in version 10.1 and later in CoreServices.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER
function CFHTTPMessageIsHeaderComplete( message: CFHTTPMessageRef ): Boolean; external name '_CFHTTPMessageIsHeaderComplete';


{
 *  CFHTTPMessageCopySerializedMessage()
 *
 *  Availability:
 *    Mac OS X:         in version 10.1 and later in CoreServices.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER
function CFHTTPMessageCopySerializedMessage( request: CFHTTPMessageRef ): CFDataRef; external name '_CFHTTPMessageCopySerializedMessage';


{*******************}
{ Request functions }
{*******************}
{
 *  CFHTTPMessageCopyRequestURL()
 *
 *  Availability:
 *    Mac OS X:         in version 10.1 and later in CoreServices.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER
function CFHTTPMessageCopyRequestURL( request: CFHTTPMessageRef ): CFURLRef; external name '_CFHTTPMessageCopyRequestURL';


{
 *  CFHTTPMessageCopyRequestMethod()
 *
 *  Availability:
 *    Mac OS X:         in version 10.1 and later in CoreServices.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER
function CFHTTPMessageCopyRequestMethod( request: CFHTTPMessageRef ): CFStringRef; external name '_CFHTTPMessageCopyRequestMethod';


{ Tries to modify request to contain the authentication information
   requested by authenticationFailureResponse (which presumably is a
   401 or 407 response).  Returns TRUE if successful; FALSE otherwise
   (leaving request unmodified).  If authenticationScheme is NULL, the
   strongest supported scheme listed in failedResponse will be used. }
{
 *  CFHTTPMessageAddAuthentication()
 *
 *  Availability:
 *    Mac OS X:         in version 10.1 and later in CoreServices.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER
function CFHTTPMessageAddAuthentication( request: CFHTTPMessageRef; authenticationFailureResponse: CFHTTPMessageRef; username: CFStringRef; password: CFStringRef; authenticationScheme: CFStringRef; forProxy: Boolean ): Boolean; external name '_CFHTTPMessageAddAuthentication';


{********************}
{ Response functions }
{********************}
{
 *  CFHTTPMessageGetResponseStatusCode()
 *
 *  Availability:
 *    Mac OS X:         in version 10.1 and later in CoreServices.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER
function CFHTTPMessageGetResponseStatusCode( response: CFHTTPMessageRef ): UInt32; external name '_CFHTTPMessageGetResponseStatusCode';


{
 *  CFHTTPMessageCopyResponseStatusLine()
 *
 *  Availability:
 *    Mac OS X:         in version 10.1 and later in CoreServices.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER
function CFHTTPMessageCopyResponseStatusLine( response: CFHTTPMessageRef ): CFStringRef; external name '_CFHTTPMessageCopyResponseStatusLine';
{unit CFPlugIn}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}

{ ================ Standard Info.plist keys for plugIns ================ }
var kCFPlugInDynamicRegistrationKey: CFStringRef; external name '_kCFPlugInDynamicRegistrationKey'; (* attribute const *)
{
 *  kCFPlugInDynamicRegistrationKey
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
var kCFPlugInDynamicRegisterFunctionKey: CFStringRef; external name '_kCFPlugInDynamicRegisterFunctionKey'; (* attribute const *)
{
 *  kCFPlugInDynamicRegisterFunctionKey
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
var kCFPlugInUnloadFunctionKey: CFStringRef; external name '_kCFPlugInUnloadFunctionKey'; (* attribute const *)
{
 *  kCFPlugInUnloadFunctionKey
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
var kCFPlugInFactoriesKey: CFStringRef; external name '_kCFPlugInFactoriesKey'; (* attribute const *)
{
 *  kCFPlugInFactoriesKey
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
var kCFPlugInTypesKey: CFStringRef; external name '_kCFPlugInTypesKey'; (* attribute const *)
{
 *  kCFPlugInTypesKey
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
{ ================= Function prototypes for various callbacks ================= }
{ Function types that plugIn authors can implement for various purposes. }

type
    CFPlugInDynamicRegisterFunction = procedure(plugIn: CFPlugInRef);

    CFPlugInUnloadFunction = procedure(plugIn: CFPlugInRef);

    CFPlugInFactoryFunction = function(allocator: CFAllocatorRef; typeUUID: CFUUIDRef): Ptr;

    {    ================= Creating PlugIns =================   }
    {
     *  CFPlugInGetTypeID()
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function CFPlugInGetTypeID: UInt32; external name '_CFPlugInGetTypeID';

{
 *  CFPlugInCreate()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFPlugInCreate(allocator: CFAllocatorRef; plugInURL: CFURLRef): CFPlugInRef; external name '_CFPlugInCreate';

{ Might return an existing instance with the ref-count bumped. }
{
 *  CFPlugInGetBundle()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFPlugInGetBundle(plugIn: CFPlugInRef): CFBundleRef; external name '_CFPlugInGetBundle';

{ ================= Controlling load on demand ================= }
{ For plugIns. }
{ PlugIns that do static registration are load on demand by default. }
{ PlugIns that do dynamic registration are not load on demand by default. }
{ A dynamic registration function can call CFPlugInSetLoadOnDemand(). }
{
 *  CFPlugInSetLoadOnDemand()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CFPlugInSetLoadOnDemand(plugIn: CFPlugInRef; flag: boolean); external name '_CFPlugInSetLoadOnDemand';

{
 *  CFPlugInIsLoadOnDemand()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFPlugInIsLoadOnDemand(plugIn: CFPlugInRef): boolean; external name '_CFPlugInIsLoadOnDemand';

{ ================= Finding factories and creating instances ================= }
{ For plugIn hosts. }
{ Functions for finding factories to create specific types and actually creating instances of a type. }
{
 *  CFPlugInFindFactoriesForPlugInType()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFPlugInFindFactoriesForPlugInType(typeUUID: CFUUIDRef): CFArrayRef; external name '_CFPlugInFindFactoriesForPlugInType';

{ This function finds all the factories from any plugin for the given type.  }
{
 *  CFPlugInFindFactoriesForPlugInTypeInPlugIn()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFPlugInFindFactoriesForPlugInTypeInPlugIn(typeUUID: CFUUIDRef; plugIn: CFPlugInRef): CFArrayRef; external name '_CFPlugInFindFactoriesForPlugInTypeInPlugIn';

{ This function restricts the result to factories from the given plug-in that can create the given type }
{
 *  CFPlugInInstanceCreate()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFPlugInInstanceCreate(allocator: CFAllocatorRef; factoryUUID: CFUUIDRef; typeUUID: CFUUIDRef): Ptr; external name '_CFPlugInInstanceCreate';

{ This function returns the IUnknown interface for the new instance. }
{ ================= Registering factories and types ================= }
{ For plugIn writers who must dynamically register things. }
{ Functions to register factory functions and to associate factories with types. }
{
 *  CFPlugInRegisterFactoryFunction()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFPlugInRegisterFactoryFunction(factoryUUID: CFUUIDRef; func: CFPlugInFactoryFunction): boolean; external name '_CFPlugInRegisterFactoryFunction';

{
 *  CFPlugInRegisterFactoryFunctionByName()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFPlugInRegisterFactoryFunctionByName(factoryUUID: CFUUIDRef; plugIn: CFPlugInRef; functionName: CFStringRef): boolean; external name '_CFPlugInRegisterFactoryFunctionByName';

{
 *  CFPlugInUnregisterFactory()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFPlugInUnregisterFactory(factoryUUID: CFUUIDRef): boolean; external name '_CFPlugInUnregisterFactory';

{
 *  CFPlugInRegisterPlugInType()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFPlugInRegisterPlugInType(factoryUUID: CFUUIDRef; typeUUID: CFUUIDRef): boolean; external name '_CFPlugInRegisterPlugInType';

{
 *  CFPlugInUnregisterPlugInType()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFPlugInUnregisterPlugInType(factoryUUID: CFUUIDRef; typeUUID: CFUUIDRef): boolean; external name '_CFPlugInUnregisterPlugInType';

{ ================= Registering instances ================= }
{ When a new instance of a type is created, the instance is responsible for registering itself with the factory that created it and unregistering when it deallocates. }
{ This means that an instance must keep track of the CFUUIDRef of the factory that created it so it can unregister when it goes away. }
{
 *  CFPlugInAddInstanceForFactory()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CFPlugInAddInstanceForFactory(factoryID: CFUUIDRef); external name '_CFPlugInAddInstanceForFactory';

{
 *  CFPlugInRemoveInstanceForFactory()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CFPlugInRemoveInstanceForFactory(factoryID: CFUUIDRef); external name '_CFPlugInRemoveInstanceForFactory';


{ Obsolete API }

type
    CFPlugInInstanceRef    = ^SInt32; { an opaque 32-bit type }
    CFPlugInInstanceRefPtr = ^CFPlugInInstanceRef;  { when a var xx:CFPlugInInstanceRef parameter can be nil, it is changed to xx: CFPlugInInstanceRefPtr }
    CFPlugInInstanceGetInterfaceFunction = function(instance: CFPlugInInstanceRef; interfaceName: CFStringRef; var ftbl: UnivPtr): boolean;

    CFPlugInInstanceDeallocateInstanceDataFunction = procedure(instanceData: UnivPtr);

    {
     *  CFPlugInInstanceGetInterfaceFunctionTable()
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function CFPlugInInstanceGetInterfaceFunctionTable(instance: CFPlugInInstanceRef; interfaceName: CFStringRef; var ftbl: UnivPtr): boolean; external name '_CFPlugInInstanceGetInterfaceFunctionTable';

{
 *  CFPlugInInstanceGetFactoryName()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFPlugInInstanceGetFactoryName(instance: CFPlugInInstanceRef): CFStringRef; external name '_CFPlugInInstanceGetFactoryName';

{
 *  CFPlugInInstanceGetInstanceData()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFPlugInInstanceGetInstanceData(instance: CFPlugInInstanceRef): Ptr; external name '_CFPlugInInstanceGetInstanceData';

{
 *  CFPlugInInstanceGetTypeID()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFPlugInInstanceGetTypeID: UInt32; external name '_CFPlugInInstanceGetTypeID';

{
 *  CFPlugInInstanceCreateWithInstanceDataSize()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CFPlugInInstanceCreateWithInstanceDataSize(allocator: CFAllocatorRef; instanceDataSize: CFIndex; deallocateInstanceFunction: CFPlugInInstanceDeallocateInstanceDataFunction; factoryName: CFStringRef; getInterfaceFunction: CFPlugInInstanceGetInterfaceFunction): CFPlugInInstanceRef; external name '_CFPlugInInstanceCreateWithInstanceDataSize';

{$ALIGN MAC68K}
{#POP}
{unit CFPlugInCOM}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}

{ ================= IUnknown definition (C struct) ================= }
{$ALIGN MAC68K}
{#POP}
{unit CFStream}
{$ALIGN MAC68K}






type
    CFStreamStatus = SInt32;
const
    kCFStreamStatusNotOpen = 0;
    kCFStreamStatusOpening = 1;  { open is in-progress }
    kCFStreamStatusOpen = 2;
    kCFStreamStatusReading = 3;
    kCFStreamStatusWriting = 4;
    kCFStreamStatusAtEnd = 5;    { no further bytes can be read/written }
    kCFStreamStatusClosed = 6;
    kCFStreamStatusError = 7;

type
    CFStreamErrorDomain = SInt32;
const
    kCFStreamErrorDomainCustom = -1;      { custom to the kind of stream in question }
    kCFStreamErrorDomainPOSIX = 1;        { POSIX errno; interpret using <sys/errno.h> }
    kCFStreamErrorDomainMacOSStatus = 2;      { OSStatus type from Carbon APIs; interpret using <MacTypes.h> }


type CFStreamError = record
    domain: CFStreamErrorDomain;
    error: SInt32;
end;
CFStreamErrorPtr = ^CFStreamError;

type
    CFStreamEventType = SInt32;
const
    kCFStreamEventNone = 0;
    kCFStreamEventOpenCompleted = 1;
    kCFStreamEventHasBytesAvailable = 2;
    kCFStreamEventCanAcceptBytes = 4;
    kCFStreamEventErrorOccurred = 8;
    kCFStreamEventEndEncountered = 16;

type
    CFStreamClientContext = record
        version: CFIndex;
        info: Ptr;
    retain: function( info: Ptr ): Ptr;
    release: procedure( info: Ptr );
    copyDescription: function( info: Ptr ): CFStringRef;
    end;

type
    CFReadStreamRef    = ^SInt32; { an opaque 32-bit type }
    CFReadStreamRefPtr = ^CFReadStreamRef;
    CFWriteStreamRef    = ^SInt32; { an opaque 32-bit type }
    CFWriteStreamRefPtr = ^CFWriteStreamRef;

type
    CFReadStreamClientCallBack = procedure( stream: CFReadStreamRef; typ: CFStreamEventType; clientCallBackInfo: Ptr );
    CFWriteStreamClientCallBack = procedure( stream: CFWriteStreamRef; typ: CFStreamEventType; clientCallBackInfo: Ptr );

function CFReadStreamGetTypeID: CFTypeID; external name '_CFReadStreamGetTypeID';
function CFWriteStreamGetTypeID: CFTypeID; external name '_CFWriteStreamGetTypeID';

{ Memory streams }

{ Value will be a CFData containing all bytes thusfar written; used to recover the data written to a memory write stream. }
var kCFStreamPropertyDataWritten: CFStringRef; external name '_kCFStreamPropertyDataWritten'; (* attribute const *)

{ Pass kCFAllocatorNull for bytesDeallocator to prevent CFReadStream from deallocating bytes; otherwise, CFReadStream will deallocate bytes when the stream is destroyed }
function CFReadStreamCreateWithBytesNoCopy( alloc: CFAllocatorRef; bytes: UnivPtr; length: CFIndex; bytesDeallocator: CFAllocatorRef ): CFReadStreamRef; external name '_CFReadStreamCreateWithBytesNoCopy';

{ The stream writes into the buffer given; when bufferCapacity is exhausted, the stream is exhausted (status becomes kCFStreamStatusAtEnd) }
function CFWriteStreamCreateWithBuffer( alloc: CFAllocatorRef; buffer: UnivPtr; bufferCapacity: CFIndex ): CFWriteStreamRef; external name '_CFWriteStreamCreateWithBuffer';

{ New buffers are allocated from bufferAllocator as bytes are written to the stream.  At any point, you can recover the bytes thusfar written by asking for the property kCFStreamPropertyDataWritten, above }
function CFWriteStreamCreateWithAllocatedBuffers( alloc: CFAllocatorRef; bufferAllocator: CFAllocatorRef ): CFWriteStreamRef; external name '_CFWriteStreamCreateWithAllocatedBuffers';

{ File streams }
function CFReadStreamCreateWithFile( alloc: CFAllocatorRef; fileURL: CFURLRef ): CFReadStreamRef; external name '_CFReadStreamCreateWithFile';
function CFWriteStreamCreateWithFile( alloc: CFAllocatorRef; fileURL: CFURLRef ): CFWriteStreamRef; external name '_CFWriteStreamCreateWithFile';

{ Property for file write streams; value should be a CFBoolean.  Set to TRUE to append to a file, rather than to replace its contents }
var kCFStreamPropertyAppendToFile: CFStringRef; external name '_kCFStreamPropertyAppendToFile'; (* attribute const *)

//AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
var kCFStreamPropertyFileCurrentOffset: CFStringRef; external name '_kCFStreamPropertyFileCurrentOffset'; (* attribute const *)

{ Socket stream properties }

{ Value will be a CFData containing the native handle }
var kCFStreamPropertySocketNativeHandle: CFStringRef; external name '_kCFStreamPropertySocketNativeHandle'; (* attribute const *)

{ Value will be a CFString, or NULL if unknown }
var kCFStreamPropertySocketRemoteHostName: CFStringRef; external name '_kCFStreamPropertySocketRemoteHostName'; (* attribute const *)

{ Value will be a CFNumber, or NULL if unknown }
var kCFStreamPropertySocketRemotePortNumber: CFStringRef; external name '_kCFStreamPropertySocketRemotePortNumber'; (* attribute const *)

{ Socket streams; the returned streams are paired such that they use the same socket; pass NULL if you want only the read stream or the write stream }
procedure CFStreamCreatePairWithSocket( alloc: CFAllocatorRef; sock: CFSocketNativeHandle; var readStream: CFReadStreamRef; var writeStream: CFWriteStreamRef ); external name '_CFStreamCreatePairWithSocket';
procedure CFStreamCreatePairWithSocketToHost( alloc: CFAllocatorRef; host: CFStringRef; port: UInt32; var readStream: CFReadStreamRef; var writeStream: CFWriteStreamRef ); external name '_CFStreamCreatePairWithSocketToHost';
procedure CFStreamCreatePairWithPeerSocketSignature( alloc: CFAllocatorRef; const (*var*) signature: CFSocketSignature; var readStream: CFReadStreamRef; var writeStream: CFWriteStreamRef ); external name '_CFStreamCreatePairWithPeerSocketSignature';


{ Returns the current state of the stream }
function CFReadStreamGetStatus( stream: CFReadStreamRef ): CFStreamStatus; external name '_CFReadStreamGetStatus';
function CFWriteStreamGetStatus( stream: CFWriteStreamRef ): CFStreamStatus; external name '_CFWriteStreamGetStatus';

{ 0 is returned if no error has occurred.  errorDomain specifies the domain
   in which the error code should be interpretted; pass NULL if you are not
   interested. }
function CFReadStreamGetError( stream: CFReadStreamRef ): CFStreamError; external name '_CFReadStreamGetError';
function CFWriteStreamGetError( stream: CFWriteStreamRef ): CFStreamError; external name '_CFWriteStreamGetError';

{ Returns success/failure.  Opening a stream causes it to reserve all the system
   resources it requires.  If the stream can open non-blocking, this will always
   return TRUE; listen to the run loop source to find out when the open completes
   and whether it was successful, or poll using CFRead/WriteStreamGetStatus(), waiting
   for a status of kCFStreamStatusOpen or kCFStreamStatusError.  }
function CFReadStreamOpen( stream: CFReadStreamRef ): Boolean; external name '_CFReadStreamOpen';
function CFWriteStreamOpen( stream: CFWriteStreamRef ): Boolean; external name '_CFWriteStreamOpen';

{ Terminates the flow of bytes; releases any system resources required by the
   stream.  The stream may not fail to close.  You may call CFStreamClose() to
   effectively abort a stream. }
procedure CFReadStreamClose( stream: CFReadStreamRef ); external name '_CFReadStreamClose';
procedure CFWriteStreamClose( stream: CFWriteStreamRef ); external name '_CFWriteStreamClose';

{ Whether there is data currently available for reading; returns TRUE if it's
   impossible to tell without trying }
function CFReadStreamHasBytesAvailable( stream: CFReadStreamRef ): Boolean; external name '_CFReadStreamHasBytesAvailable';

{ Returns the number of bytes read, or -1 if an error occurs preventing any
   bytes from being read, or 0 if the stream's end was encountered.
   It is an error to try and read from a stream that hasn't been opened first.
   This call will block until at least one byte is available; it will NOT block
   until the entire buffer can be filled.  To avoid blocking, either poll using
   CFReadStreamHasBytesAvailable() or use the run loop and listen for the
   kCFStreamCanRead event for notification of data available. }
function CFReadStreamRead( stream: CFReadStreamRef; buffer: UnivPtr; bufferLength: CFIndex ): CFIndex; external name '_CFReadStreamRead';

{ Returns a pointer to an internal buffer if possible (setting *numBytesRead
   to the length of the returned buffer), otherwise returns NULL; guaranteed
   to return in O(1).  Bytes returned in the buffer are considered read from
   the stream; if maxBytesToRead is greater than 0, not more than maxBytesToRead
   will be returned.  If maxBytesToRead is less than or equal to zero, as many bytes
   as are readily available will be returned.  The returned buffer is good only
   until the next stream operation called on the stream.  Caller should neither
   change the contents of the returned buffer nor attempt to deallocate the buffer;
   it is still owned by the stream. }
function CFReadStreamGetBuffer( stream: CFReadStreamRef; maxBytesToRead: CFIndex; var numBytesRead: CFIndex ): UInt8Ptr; external name '_CFReadStreamGetBuffer';

{ Whether the stream can currently be written to without blocking;
   returns TRUE if it's impossible to tell without trying }
function CFWriteStreamCanAcceptBytes( stream: CFWriteStreamRef ): Boolean; external name '_CFWriteStreamCanAcceptBytes';

{ Returns the number of bytes successfully written, -1 if an error has
   occurred, or 0 if the stream has been filled to capacity (for fixed-length
   streams).  If the stream is not full, this call will block until at least
   one byte is written.  To avoid blocking, either poll via CFWriteStreamCanAcceptBytes
   or use the run loop and listen for the kCFStreamCanWrite event. }
function CFWriteStreamWrite( stream: CFWriteStreamRef; buffer: UnivPtr; bufferLength: CFIndex ): CFIndex; external name '_CFWriteStreamWrite';

{ Particular streams can name properties and assign meanings to them; you
   access these properties through the following calls.  A property is any interesting
   information about the stream other than the data being transmitted itself.
   Examples include the headers from an HTTP transmission, or the expected
   number of bytes, or permission information, etc.  Properties that can be set
   configure the behavior of the stream, and may only be settable at particular times
   (like before the stream has been opened).  See the documentation for particular
   properties to determine their get- and set-ability. }
function CFReadStreamCopyProperty( stream: CFReadStreamRef; propertyName: CFStringRef ): CFTypeRef; external name '_CFReadStreamCopyProperty';
function CFWriteStreamCopyProperty( stream: CFWriteStreamRef; propertyName: CFStringRef ): CFTypeRef; external name '_CFWriteStreamCopyProperty';

{ Returns TRUE if the stream recognizes and accepts the given property-value pair;
   FALSE otherwise. }
function CFReadStreamSetProperty( stream: CFReadStreamRef; propertyName: CFStringRef; propertyValue: CFTypeRef ): Boolean; external name '_CFReadStreamSetProperty';
function CFWriteStreamSetProperty( stream: CFWriteStreamRef; propertyName: CFStringRef; propertyValue: CFTypeRef ): Boolean; external name '_CFWriteStreamSetProperty';

{ Asynchronous processing - If you wish to neither poll nor block, you may register
   a client to hear about interesting events that occur on a stream.  Only one client
   per stream is allowed; registering a new client replaces the previous one.

   Once you have set a client, you need to schedule a run loop on which that client
   can be notified.  You may schedule multiple run loops (for instance, if you are
   using a thread pool).  The client callback will be triggered via one of the scheduled
   run loops; It is the caller's responsibility to ensure that at least one of the
   scheduled run loops is being run.

   NOTE: not all streams provide these notifications.  If a stream does not support
   asynchronous notification, CFStreamSetClient() will return NO; typically, such
   streams will never block for device I/O (e.g. a stream on memory)
}

function CFReadStreamSetClient( stream: CFReadStreamRef; streamEvents: CFOptionFlags; clientCB: CFReadStreamClientCallBack; var clientContext: CFStreamClientContext ): Boolean; external name '_CFReadStreamSetClient';
function CFWriteStreamSetClient( stream: CFWriteStreamRef; streamEvents: CFOptionFlags; clientCB: CFWriteStreamClientCallBack; var clientContext: CFStreamClientContext ): Boolean; external name '_CFWriteStreamSetClient';

procedure CFReadStreamScheduleWithRunLoop( stream: CFReadStreamRef; runLoop: CFRunLoopRef; runLoopMode: CFStringRef ); external name '_CFReadStreamScheduleWithRunLoop';
procedure CFWriteStreamScheduleWithRunLoop( stream: CFWriteStreamRef; runLoop: CFRunLoopRef; runLoopMode: CFStringRef ); external name '_CFWriteStreamScheduleWithRunLoop';

procedure CFReadStreamUnscheduleFromRunLoop( stream: CFReadStreamRef; runLoop: CFRunLoopRef; runLoopMode: CFStringRef ); external name '_CFReadStreamUnscheduleFromRunLoop';
procedure CFWriteStreamUnscheduleFromRunLoop( stream: CFWriteStreamRef; runLoop: CFRunLoopRef; runLoopMode: CFStringRef ); external name '_CFWriteStreamUnscheduleFromRunLoop';
{unit CGColorSpace}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}


type
    CGColorSpaceRef    = ^SInt32; { an opaque 32-bit type }
    CGColorSpaceRefPtr = ^CGColorSpaceRef;  { when a var xx:CGColorSpaceRef parameter can be nil, it is changed to xx: CGColorSpaceRefPtr }
    CGColorRenderingIntent      = SInt32;
    TristimulusValue = array[0..2] of Single;
    RedGreenBlueValue = array[0..2] of Single;
    Single4 = array[0..3] of Single;
    Single9 = array[0..8] of Single;
const
    kCGRenderingIntentDefault   = 0;
    kCGRenderingIntentAbsoluteColorimetric = 1;
    kCGRenderingIntentRelativeColorimetric = 2;
    kCGRenderingIntentPerceptual = 3;
    kCGRenderingIntentSaturation = 4;


    {   * Device-dependent color spaces.  * }
    {    Create a DeviceGray colorspace.    }
    {
     *  CGColorSpaceCreateDeviceGray()
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        not available
     *    Mac OS X:         in version 10.0 and later
        }
function CGColorSpaceCreateDeviceGray: CGColorSpaceRef; external name '_CGColorSpaceCreateDeviceGray';

{ Create a DeviceRGB colorspace. }
{
 *  CGColorSpaceCreateDeviceRGB()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGColorSpaceCreateDeviceRGB: CGColorSpaceRef; external name '_CGColorSpaceCreateDeviceRGB';

{ Create a DeviceCMYK colorspace. }
{
 *  CGColorSpaceCreateDeviceCMYK()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGColorSpaceCreateDeviceCMYK: CGColorSpaceRef; external name '_CGColorSpaceCreateDeviceCMYK';

{* Device-independent color spaces. *}
{ Create a calibrated gray colorspace.  `whitePoint' is an array of 3
 * numbers specifying the tristimulus value, in the CIE 1931 XYZ-space, of
 * the diffuse white point.  `blackPoint' is an array of 3 numbers
 * specifying the tristimulus value, in CIE 1931 XYZ-space, of the diffuse
 * black point. `gamma' defines the gamma for the gray component. }
{
 *  CGColorSpaceCreateCalibratedGray()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGColorSpaceCreateCalibratedGray(const (*var*) whitePoint: TristimulusValue; const (*var*) blackPoint: TristimulusValue; gamma: Single): CGColorSpaceRef; external name '_CGColorSpaceCreateCalibratedGray';

{ Create a calibrated RGB colorspace.  `whitePoint' is an array of 3
 * numbers specifying the tristimulus value, in the CIE 1931 XYZ-space, of
 * the diffuse white point.  `blackPoint' is an array of 3 numbers
 * specifying the tristimulus value, in CIE 1931 XYZ-space, of the diffuse
 * black point. `gamma' is an array of 3 numbers specifying the gamma for
 * the red, green, and blue components of the color space. `matrix' is an
 * array of 9 numbers specifying the linear interpretation of the
 * gamma-modified RGB values of the colorspace with respect to the final
 * XYZ representation. }
{
 *  CGColorSpaceCreateCalibratedRGB()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGColorSpaceCreateCalibratedRGB(const (*var*) whitePoint: TristimulusValue; const (*var*) blackPoint: TristimulusValue; const (*var*) gamma: RedGreenBlueValue; const (*var*) matrix: Single9): CGColorSpaceRef; external name '_CGColorSpaceCreateCalibratedRGB';

{ Create an L*a*b* colorspace.  `whitePoint' is an array of 3 numbers
 * specifying the tristimulus value, in the CIE 1931 XYZ-space, of the
 * diffuse white point.  `blackPoint' is an array of 3 numbers specifying
 * the tristimulus value, in CIE 1931 XYZ-space, of the diffuse black
 * point. `range' is an array of four numbers specifying the range of valid
 * values for the a* and b* components of the color space. }
{
 *  CGColorSpaceCreateLab()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGColorSpaceCreateLab(const (*var*) whitePoint: TristimulusValue; const (*var*) blackPoint: TristimulusValue; const (*var*) range: Single4): CGColorSpaceRef; external name '_CGColorSpaceCreateLab';

{ Create an ICC-based colorspace.  `nComponents' specifies the number of
 * color components in the color space defined by the ICC profile data.
 * This must match the number of components actually in the ICC profile,
 * and must be 1, 3, or 4.  `range' is an array of 2*nComponents numbers
 * specifying the minimum and maximum valid values of the corresponding
 * color components, so that for color component k, range[2*k] <= c[k] <=
 * range[2*k+1], where c[k] is the k'th color component.  `profile' is a
 * data provider specifying the ICC profile.  `alternate' specifies an
 * alternate colorspace to be used in case the ICC profile is not
 * supported.  It must have `nComponents' color components. If `alternate'
 * is NULL, then the color space used will be DeviceGray, DeviceRGB, or
 * DeviceCMYK, depending on whether `nComponents' is 1, 3, or 4,
 * respectively. }
{
 *  CGColorSpaceCreateICCBased()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGColorSpaceCreateICCBased(nComponents: size_t; (*const*) var range: Single; profile: CGDataProviderRef; alternateSpace: CGColorSpaceRef): CGColorSpaceRef; external name '_CGColorSpaceCreateICCBased';

{* Special colorspaces. *}
{ Create an indexed colorspace.  A sample value in an indexed color space
 * is treated as an index into the color table of the color space.  `base'
 * specifies the base color space in which the values in the color table
 * are to be interpreted. `lastIndex' is an SInt16 which specifies the
 * maximum valid index value; it must be less than or equal to 255.
 * `colorTable' is an array of m * (lastIndex + 1) bytes, where m is
 * the number of color components in the base color space.  Each byte
 * is an unsigned SInt16 in the range 0 to 255 that is scaled to the
 * range of the corresponding color component in the base color space. }
{
 *  CGColorSpaceCreateIndexed()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGColorSpaceCreateIndexed(baseSpace: CGColorSpaceRef; lastIndex: size_t; colorTable: UInt8Ptr): CGColorSpaceRef; external name '_CGColorSpaceCreateIndexed';

{ Create a pattern colorspace. `baseSpace' is the underlying colorspace of
 * the pattern colorspace.  For colored patterns, `baseSpace' should be
 * NULL; for uncolored patterns, `baseSpace' specifies the colorspace of
 * colors which will be painted through the pattern. }
{
 *  CGColorSpaceCreatePattern()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.1 and later
 }
function CGColorSpaceCreatePattern(baseSpace: CGColorSpaceRef): CGColorSpaceRef; external name '_CGColorSpaceCreatePattern';

{ Create a CGColorSpace using `platformColorSpaceReference', a pointer to
 * a platform-specific color space reference. For MacOS X,
 * `platformColorSpaceReference' should be a pointer to a CMProfileRef. }
{
 *  CGColorSpaceCreateWithPlatformColorSpace()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.1 and later
 }
function CGColorSpaceCreateWithPlatformColorSpace(platformColorSpaceReference: UnivPtr): CGColorSpaceRef; external name '_CGColorSpaceCreateWithPlatformColorSpace';


{* Colorspace information. *}
{ Return the number of color components supported by the colorspace `cs'. }
{
 *  CGColorSpaceGetNumberOfComponents()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGColorSpaceGetNumberOfComponents(cs: CGColorSpaceRef): size_t; external name '_CGColorSpaceGetNumberOfComponents';

{* Retaining & releasing colorspaces. *}
{ Increment the retain count of `cs' and return it.  All colorspaces are
 * created with an initial retain count of 1. }
{
 *  CGColorSpaceRetain()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGColorSpaceRetain(cs: CGColorSpaceRef): CGColorSpaceRef; external name '_CGColorSpaceRetain';

{ Decrement the retain count of `cs'.  If the retain count reaches 0, then
 * release it and any associated resources. }
{
 *  CGColorSpaceRelease()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
procedure CGColorSpaceRelease(cs: CGColorSpaceRef); external name '_CGColorSpaceRelease';

{$ALIGN MAC68K}
{#POP}
{unit CGImage}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}


type
    CGImageRef    = ^SInt32; { an opaque 32-bit type }
    CGImageRefPtr = ^CGImageRef;  { when a var xx:CGImageRef parameter can be nil, it is changed to xx: CGImageRefPtr }
    CGImageAlphaInfo            = SInt32;
const
    kCGImageAlphaNone           = 0;
    kCGImageAlphaPremultipliedLast = 1;                         {  For example, premultiplied RGBA  }
    kCGImageAlphaPremultipliedFirst = 2;                        {  For example, premultiplied ARGB  }
    kCGImageAlphaLast           = 3;                            {  For example, non-premultiplied RGBA  }
    kCGImageAlphaFirst          = 4;                            {  For example, non-premultiplied ARGB  }
    kCGImageAlphaNoneSkipLast   = 5;                            {  Equivalent to kCGImageAlphaNone.  }
    kCGImageAlphaNoneSkipFirst  = 6;


{ Return the CFTypeID for CGImageRefs. }

function CGImageGetTypeID: CFTypeID; external name '_CGImageGetTypeID';

    {    Create an image.   }
    {
     *  CGImageCreate()
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        not available
     *    Mac OS X:         in version 10.0 and later
        }
function CGImageCreate(width: size_t; height: size_t; bitsPerComponent: size_t; bitsPerPixel: size_t; bytesPerRow: size_t; colorspace: CGColorSpaceRef; alphaInfo: CGImageAlphaInfo; provider: CGDataProviderRef; decode: SinglePtr; shouldInterpolate: SInt32; intent: CGColorRenderingIntent): CGImageRef; external name '_CGImageCreate';

{ Create an image mask. }
{
 *  CGImageMaskCreate()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGImageMaskCreate(width: size_t; height: size_t; bitsPerComponent: size_t; bitsPerPixel: size_t; bytesPerRow: size_t; provider: CGDataProviderRef; decode: SinglePtr; shouldInterpolate: SInt32): CGImageRef; external name '_CGImageMaskCreate';

{ Create an image from `source', a data provider of JPEG-encoded data. }
{
 *  CGImageCreateWithJPEGDataProvider()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.1 and later
 }
function CGImageCreateWithJPEGDataProvider(source: CGDataProviderRef; decode: SinglePtr; shouldInterpolate: SInt32; intent: CGColorRenderingIntent): CGImageRef; external name '_CGImageCreateWithJPEGDataProvider';

{ Create an image using `source', a data provider for PNG-encoded data. }

function CGImageCreateWithPNGDataProvider( source: CGDataProviderRef; decode: SinglePtr; shouldInterpolate: Boolean; intent: CGColorRenderingIntent ): CGImageRef; external name '_CGImageCreateWithPNGDataProvider';

{ Create a copy of `image', replacing the image's colorspace with
 * `colorspace'.  Returns NULL if `image' is an image mask, or if the
 * number of components of `colorspace' isn't the same as the number of
 * components of the colorspace of `image'. }

// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function CGImageCreateCopyWithColorSpace( image: CGImageRef; colorspace: CGColorSpaceRef ): CGImageRef; external name '_CGImageCreateCopyWithColorSpace';

{ Increment the retain count of `image' and return it.  All images are
 * created with an initial retain count of 1. }
{
 *  CGImageRetain()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGImageRetain(image: CGImageRef): CGImageRef; external name '_CGImageRetain';

{ Decrement the retain count of `image'.  If the retain count reaches 0,
 * then release it and any associated resources. }
{
 *  CGImageRelease()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
procedure CGImageRelease(image: CGImageRef); external name '_CGImageRelease';

{ Return 1 if `image' is an image mask, 0 otherwise. }
{
 *  CGImageIsMask()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGImageIsMask(image: CGImageRef): SInt32; external name '_CGImageIsMask';

{ Return the width of `image'. }
{
 *  CGImageGetWidth()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGImageGetWidth(image: CGImageRef): size_t; external name '_CGImageGetWidth';

{ Return the height of `image'. }
{
 *  CGImageGetHeight()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGImageGetHeight(image: CGImageRef): size_t; external name '_CGImageGetHeight';

{ Return the number of bits/component of `image'. }
{
 *  CGImageGetBitsPerComponent()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGImageGetBitsPerComponent(image: CGImageRef): size_t; external name '_CGImageGetBitsPerComponent';

{ Return the number of bits/pixel of `image'. }
{
 *  CGImageGetBitsPerPixel()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGImageGetBitsPerPixel(image: CGImageRef): size_t; external name '_CGImageGetBitsPerPixel';

{ Return the number of bytes/row of `image'. }
{
 *  CGImageGetBytesPerRow()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGImageGetBytesPerRow(image: CGImageRef): size_t; external name '_CGImageGetBytesPerRow';

{ Return the colorspace of `image', or NULL if `image' is an image
 * mask. }
{
 *  CGImageGetColorSpace()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGImageGetColorSpace(image: CGImageRef): CGColorSpaceRef; external name '_CGImageGetColorSpace';

{ Return the alpha info of `image'. }
{
 *  CGImageGetAlphaInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGImageGetAlphaInfo(image: CGImageRef): CGImageAlphaInfo; external name '_CGImageGetAlphaInfo';

{Return the data provider of `image'. }
{
 *  CGImageGetDataProvider()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGImageGetDataProvider(image: CGImageRef): CGDataProviderRef; external name '_CGImageGetDataProvider';

{ Return the decode array of `image'. }
{
 *  CGImageGetDecode()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGImageGetDecode(image: CGImageRef): SinglePtr; external name '_CGImageGetDecode';

{ Return the interpolation parameter of `image'. }
{
 *  CGImageGetShouldInterpolate()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGImageGetShouldInterpolate(image: CGImageRef): SInt32; external name '_CGImageGetShouldInterpolate';

{ Return the rendering intent of `image'. }
{
 *  CGImageGetRenderingIntent()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGImageGetRenderingIntent(image: CGImageRef): CGColorRenderingIntent; external name '_CGImageGetRenderingIntent';

{$ALIGN MAC68K}
{#POP}
{unit CodeFragments}
{$ALIGN MAC68K}











{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}

{
   ¤
   ===========================================================================================
   General Types and Constants
   ===========================
}



const
    kCFragResourceType          = $63667267 (* 'cfrg' *);
    kCFragResourceID            = 0;
    kCFragLibraryFileType       = $73686C62 (* 'shlb' *);
    kCFragAllFileTypes          = $FFFFFFFF;



type
    CFragArchitecture                   = OSType;

const
                                                                {  Values for type CFragArchitecture. }
    kPowerPCCFragArch           = $70777063 (* 'pwpc' *);
    kMotorola68KCFragArch       = $6D36386B (* 'm68k' *);
    kAnyCFragArch               = $3F3F3F3F;


    kCompiledCFragArch          = $70777063 (* 'pwpc' *);




type
    CFragVersionNumber                  = UInt32;

const
    kNullCFragVersion           = 0;
    kWildcardCFragVersion       = $FFFFFFFF;



type
    CFragUsage                          = UInt8;

const
                                                                {  Values for type CFragUsage. }
    kImportLibraryCFrag         = 0;                            {  Standard CFM import library. }
    kApplicationCFrag           = 1;                            {  MacOS application. }
    kDropInAdditionCFrag        = 2;                            {  Application or library private extension/plug-in }
    kStubLibraryCFrag           = 3;                            {  Import library used for linking only }
    kWeakStubLibraryCFrag       = 4;                            {  Import library used for linking only and will be automatically weak linked }


    kIsCompleteCFrag            = 0;                            {  A "base" fragment, not an update. }
    kFirstCFragUpdate           = 1;                            {  The first update, others are numbered 2, 3, ... }


    kCFragGoesToEOF             = 0;






type
    CFragLocatorKind                    = UInt8;

const
                                                                {  Values for type CFragLocatorKind. }
    kMemoryCFragLocator         = 0;                            {  Container is in memory. }
    kDataForkCFragLocator       = 1;                            {  Container is in a file's data fork. }
    kResourceCFragLocator       = 2;                            {  Container is in a file's resource fork. }
    kNamedFragmentCFragLocator  = 4;                            {  ! Reserved for possible future use! }
    kCFBundleCFragLocator       = 5;                            {  Container is in the executable of a CFBundle }
    kCFBundleIntCFragLocator    = 6;                            {  passed to init routines in lieu of kCFBundleCFragLocator }


    {
       --------------------------------------------------------------------------------------
       A 'cfrg' resource consists of a header followed by a sequence of variable length
       members.  The constant kDefaultCFragNameLen only provides for a legal ANSI declaration
       and for a reasonable display in a debugger.  The actual name field is cut to fit.
       There may be "extensions" after the name, the memberSize field includes them.  The
       general form of an extension is a 16 bit type code followed by a 16 bit size in bytes.
       Only one standard extension type is defined at present, it is used by SOM's searching
       mechanism.
    }



type
    CFragUsage1UnionPtr = ^CFragUsage1Union;
    CFragUsage1Union = record
        case SInt16 of
                                                                        {  ! Meaning differs depending on value of "usage". }
        0: (
            appStackSize:       UInt32;                                 {  If the fragment is an application. (Not used by CFM!) }
            );
    end;

    CFragUsage2UnionPtr = ^CFragUsage2Union;
    CFragUsage2Union = record
        case SInt16 of
                                                                        {  ! Meaning differs depending on value of "usage". }
        0: (
            appSubdirID:        SInt16;                                 {  If the fragment is an application. }
            );
        1: (
            libFlags:           UInt16;                                 {  If the fragment is an import library. }
            );
    end;


const
                                                                {  Bit masks for the CFragUsage2Union libFlags variant. }
    kCFragLibUsageMapPrivatelyMask = $0001;                     {  Put container in app heap if necessary. }


type
    CFragWhere1UnionPtr = ^CFragWhere1Union;
    CFragWhere1Union = record
        case SInt16 of
                                                                        {  ! Meaning differs depending on value of "where". }
        0: (
            spaceID:            UInt32;                                 {  If the fragment is in memory.  (Actually an AddressSpaceID.) }
            );
    end;

    CFragWhere2UnionPtr = ^CFragWhere2Union;
    CFragWhere2Union = record
        case SInt16 of
                                                                        {  ! Meaning differs depending on value of "where". }
        0: (
            reserved:           UInt16;
            );
    end;


const
    kDefaultCFragNameLen        = 16;



type
    CFragResourceMemberPtr = ^CFragResourceMember;
    CFragResourceMember = record
        architecture:           CFragArchitecture;
        reservedA:              UInt16;                                 {  ! Must be zero! }
        reservedB:              SInt8;                                  {  ! Must be zero! }
        updateLevel:            SInt8;
        currentVersion:         CFragVersionNumber;
        oldDefVersion:          CFragVersionNumber;
        uUsage1:                CFragUsage1Union;
        uUsage2:                CFragUsage2Union;
        usage:                  SInt8;
        where:                  SInt8;
        offset:                 UInt32;
        length:                 UInt32;
        uWhere1:                CFragWhere1Union;
        uWhere2:                CFragWhere2Union;
        extensionCount:         UInt16;                                 {  The number of extensions beyond the name. }
        memberSize:             UInt16;                                 {  Size in bytes, includes all extensions. }
        name:                   packed array [0..15] of UInt8;          {  ! Actually a sized PString. }
    end;

    CFragResourceExtensionHeaderPtr = ^CFragResourceExtensionHeader;
    CFragResourceExtensionHeader = record
        extensionKind:          UInt16;
        extensionSize:          UInt16;
    end;

    CFragResourceSearchExtensionPtr = ^CFragResourceSearchExtension;
    CFragResourceSearchExtension = record
        header:                 CFragResourceExtensionHeader;
        libKind:                OSType;
        qualifiers:             SInt8;                                  {  ! Actually four PStrings. }
    end;


const
    kCFragResourceSearchExtensionKind = $30EE;



type
    CFragResourcePtr = ^CFragResource;
    CFragResource = record
        reservedA:              UInt32;                                 {  ! Must be zero! }
        reservedB:              UInt32;                                 {  ! Must be zero! }
        reservedC:              UInt16;                                 {  ! Must be zero! }
        version:                UInt16;
        reservedD:              UInt32;                                 {  ! Must be zero! }
        reservedE:              UInt32;                                 {  ! Must be zero! }
        reservedF:              UInt32;                                 {  ! Must be zero! }
        reservedG:              UInt32;                                 {  ! Must be zero! }
        reservedH:              UInt16;                                 {  ! Must be zero! }
        memberCount:            UInt16;
        firstMember:            CFragResourceMember;
    end;

    CFragResourceHandle                 = ^CFragResourcePtr;

const
    kCurrCFragResourceVersion   = 1;




type
    CFragContextID                      = MPProcessID;
    CFragConnectionID    = ^SInt32; { an opaque 32-bit type }
    CFragConnectionIDPtr = ^CFragConnectionID;  { when a var xx:CFragConnectionID parameter can be nil, it is changed to xx: CFragConnectionIDPtr }
    CFragClosureID    = ^SInt32; { an opaque 32-bit type }
    CFragClosureIDPtr = ^CFragClosureID;  { when a var xx:CFragClosureID parameter can be nil, it is changed to xx: CFragClosureIDPtr }
    CFragContainerID    = ^SInt32; { an opaque 32-bit type }
    CFragContainerIDPtr = ^CFragContainerID;  { when a var xx:CFragContainerID parameter can be nil, it is changed to xx: CFragContainerIDPtr }
    CFragLoadOptions                    = OptionBits;
    mainAddrPtr         = ^Ptr;  { when a var mainAddr: Ptr parameter can be nil, it is changed to mainAddr: mainAddrPtr }
    symAddrPtr          = ^Ptr;  { when a var symAddr: Ptr parameter can be nil, it is changed to symAddr: symAddrPtr }

const
                                                                {  Values for type CFragLoadOptions. }
    kReferenceCFrag             = $0001;                        {  Try to use existing copy, increment reference counts. }
    kFindCFrag                  = $0002;                        {  Try find an existing copy, do not increment reference counts. }
    kPrivateCFragCopy           = $0005;                        {  Prepare a new private copy.  (kReferenceCFrag | 0x0004) }


    kUnresolvedCFragSymbolAddress = 0;



type
    CFragSymbolClass                    = UInt8;
    CFragSymbolClassPtr                 = ^CFragSymbolClass;  { when a var xx:CFragSymbolClass parameter can be nil, it is changed to xx: CFragSymbolClassPtr }

const
                                                                {  Values for type CFragSymbolClass. }
    kCodeCFragSymbol            = 0;
    kDataCFragSymbol            = 1;
    kTVectorCFragSymbol         = 2;
    kTOCCFragSymbol             = 3;
    kGlueCFragSymbol            = 4;


    {
       ¤
       ===========================================================================================
       Macros and Functions
       ====================
    }


    {
     *  GetSharedLibrary()
     *
     *  Discussion:
     *    The connID, mainAddr, and errMessage parameters may be NULL with
     *    MacOS 8.5 and later. Passing NULL as those parameters when
     *    running Mac OS 8.1 and earlier systems will corrupt low-memory.
     *
     *  Availability:
     *    Non-Carbon CFM:   in CFragManager 1.0 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function GetSharedLibrary(const (*var*) libName: Str63; archType: CFragArchitecture; options: CFragLoadOptions; var connID: CFragConnectionID; var mainAddr: Ptr; var errMessage: Str255): OSErr; external name '_GetSharedLibrary';
{
 *  GetDiskFragment()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CFragManager 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetDiskFragment(const (*var*) fileSpec: FSSpec; offset: UInt32; length: UInt32; fragName: ConstStringPtr; options: CFragLoadOptions; connID: CFragConnectionIDPtr; mainAddr: mainAddrPtr; errMessage: StringPtr): OSErr; external name '_GetDiskFragment';
{
 *  GetMemFragment()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CFragManager 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetMemFragment(memAddr: UnivPtr; length: UInt32; fragName: ConstStringPtr; options: CFragLoadOptions; connID: CFragConnectionIDPtr; mainAddr: mainAddrPtr; errMessage: StringPtr): OSErr; external name '_GetMemFragment';
{
 *  CloseConnection()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CFragManager 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CloseConnection(var connID: CFragConnectionID): OSErr; external name '_CloseConnection';
{
 *  FindSymbol()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CFragManager 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FindSymbol(connID: CFragConnectionID; const (*var*) symName: Str255; symAddr: symAddrPtr; symClass: CFragSymbolClassPtr): OSErr; external name '_FindSymbol';
{
 *  CountSymbols()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CFragManager 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CountSymbols(connID: CFragConnectionID; var symCount: SInt32): OSErr; external name '_CountSymbols';
{
 *  GetIndSymbol()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CFragManager 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetIndSymbol(connID: CFragConnectionID; symIndex: SInt32; symName: StringPtr; symAddr: symAddrPtr; symClass: CFragSymbolClassPtr): OSErr; external name '_GetIndSymbol';
{
   ¤
   ===========================================================================================
   Initialization & Termination Routines
   =====================================
}


{
   -----------------------------------------------------------------------------------------
   A fragment's initialization and termination routines are called when a new incarnation of
   the fragment is created or destroyed, respectively.  Exactly when this occurs depends on
   what kinds of section sharing the fragment has and how the fragment is prepared.  Import
   libraries have at most one incarnation per process.  Fragments prepared with option
   kPrivateCFragCopy may have many incarnations per process.
   The initialization function is passed a pointer to an initialization information structure
   and returns an OSErr.  If an initialization function returns a non-zero value the entire
   closure of which it is a part fails.  The C prototype for an initialization function is:
        OSErr   CFragInitFunction   ( const CFragInitBlock *    initBlock );
   The termination procedure takes no parameters and returns nothing.  The C prototype for a
   termination procedure is:
        void    CFragTermProcedure  ( void );
   Note that since the initialization and termination routines are themselves "CFM"-style
   routines whether or not they have the "pascal" keyword is irrelevant.
}


{
   -----------------------------------------------------------------------------------------
   ! Note:
   ! The "System7" portion of these type names was introduced during the evolution towards
   ! the now defunct Copland version of Mac OS.  Copland was to be called System 8 and there
   ! were slightly different types for System 7 and System 8.  The "generic" type names were
   ! conditionally defined for the desired target system.
   ! Always use the generic types, e.g. CFragInitBlock!  The "System7" names have been kept
   ! only to avoid perturbing code that (improperly) used the target specific type.
}



type
    CFragSystem7MemoryLocatorPtr = ^CFragSystem7MemoryLocator;
    CFragSystem7MemoryLocator = record
        address:                LogicalAddress;
        length:                 UInt32;
        inPlace:                boolean;
        reservedA:              SInt8;                                  {  ! Must be zero! }
        reservedB:              UInt16;                                 {  ! Must be zero! }
    end;

    CFragSystem7DiskFlatLocatorPtr = ^CFragSystem7DiskFlatLocator;
    CFragSystem7DiskFlatLocator = record
        fileSpec:               FSSpecPtr;
        offset:                 UInt32;
        length:                 UInt32;
    end;

    {  ! This must have a file specification at the same offset as a disk flat locator! }
    CFragSystem7SegmentedLocatorPtr = ^CFragSystem7SegmentedLocator;
    CFragSystem7SegmentedLocator = record
        fileSpec:               FSSpecPtr;
        rsrcType:               OSType;
        rsrcID:                 SInt16;
        reservedA:              UInt16;                                 {  ! Must be zero! }
    end;

    {
       The offset and length for a "Bundle" locator refers to the offset in
       the CFM executable contained by the bundle.
    }
    CFragCFBundleLocatorPtr = ^CFragCFBundleLocator;
    CFragCFBundleLocator = record
        fragmentBundle:         CFBundleRef;                            {  Do not call CFRelease on this bundle! }
        offset:                 UInt32;
        length:                 UInt32;
    end;

    CFragSystem7LocatorPtr = ^CFragSystem7Locator;
    CFragSystem7Locator = record
        where:                  SInt32;
        case SInt16 of
        0: (
            onDisk:             CFragSystem7DiskFlatLocator;
            );
        1: (
            inMem:              CFragSystem7MemoryLocator;
            );
        2: (
            inSegs:             CFragSystem7SegmentedLocator;
            );
        3: (
            inBundle:           CFragCFBundleLocator;
            );
    end;

    CFragSystem7InitBlockPtr = ^CFragSystem7InitBlock;
    CFragSystem7InitBlock = record
        contextID:              CFragContextID;
        closureID:              CFragClosureID;
        connectionID:           CFragConnectionID;
        fragLocator:            CFragSystem7Locator;
        libName:                StringPtr;
        reservedA:              UInt32;                                 {  ! Must be zero! }
    end;

    CFragInitBlock                      = CFragSystem7InitBlock;
    CFragInitBlockPtr                   = ^CFragInitBlock;
    {  These init/term routine types are only of value to CFM itself. }
    CFragInitFunction = function(const (*var*) initBlock: CFragInitBlock): OSErr;

    CFragTermProcedure = procedure;

    {
       For use by init routines. If you get a BundleIntLocator (used to be BundlePreLocator),
       convert it to a CFBundleLocator with this. Only call this once per locator.
    }
    {
     *  ConvertBundlePreLocator()
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.4 and later
     *    Mac OS X:         in version 10.0 and later
        }
function ConvertBundlePreLocator(initBlockLocator: CFragSystem7LocatorPtr): OSErr; external name '_ConvertBundlePreLocator';



{
   ¤
   ===========================================================================================
   Old Name Spellings
   ==================
}


{
   -------------------------------------------------------------------------------------------
   We've tried to reduce the risk of name collisions in the future by introducing the phrase
   "CFrag" into constant and type names.  The old names are defined below in terms of the new.
}



const
    kLoadCFrag                  = $0001;








{$ALIGN MAC68K}
{#POP}
{unit DriverFamilyMatching}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}

{
  ##############################################
   Well known properties in the Name Registry
  ##############################################
}
{ CPassThru }
{
  #########################################################
   Descriptor for Drivers and NDRVs
  #########################################################
}
{
    QuickTime 3.0: "DriverType" has a name collision with cross-platform code.
    Use Mac prefix to avoid collision
}
{ Driver Typing Information Used to Match Drivers With Devices }

type
    MacDriverTypePtr = ^MacDriverType;
    MacDriverType = record
        nameInfoStr:            Str31;                                  {  Driver Name/Info String }
        version:                NumVersion;                             {  Driver Version Number }
    end;

    DriverType                          = MacDriverType;
    DriverTypePtr                       = ^DriverType;

    {    OS Runtime Information Used to Setup and Maintain a Driver's Runtime Environment   }
    RuntimeOptions                      = OptionBits;

const
    kDriverIsLoadedUponDiscovery = $00000001;                   {  auto-load driver when discovered }
    kDriverIsOpenedUponLoad     = $00000002;                    {  auto-open driver when loaded }
    kDriverIsUnderExpertControl = $00000004;                    {  I/O expert handles loads/opens }
    kDriverIsConcurrent         = $00000008;                    {  supports concurrent requests }
    kDriverQueuesIOPB           = $00000010;                    {  device manager doesn't queue IOPB }
    kDriverIsLoadedAtBoot       = $00000020;                    {  Driver is loaded at the boot time  }
    kDriverIsForVirtualDevice   = $00000040;                    {  Driver is for a virtual Device  }
    kDriverSupportDMSuspendAndResume = $00000080;               {  Driver supports Device Manager Suspend and Resume command  }


type
    DriverOSRuntimePtr = ^DriverOSRuntime;
    DriverOSRuntime = record
        driverRuntime:          RuntimeOptions;                         {  Options for OS Runtime }
        driverName:             Str31;                                  {  Driver's name to the OS }
        driverDescReserved:     array [0..7] of UInt32;                 {  Reserved area }
    end;

    {    OS Service Information Used To Declare What APIs a Driver Supports     }
    ServiceCount                        = UInt32;
    DriverServiceInfoPtr = ^DriverServiceInfo;
    DriverServiceInfo = record
        serviceCategory:        OSType;                                 {  Service Category Name }
        serviceType:            OSType;                                 {  Type within Category }
        serviceVersion:         NumVersion;                             {  Version of service }
    end;

    DriverOSServicePtr = ^DriverOSService;
    DriverOSService = record
        nServices:              ServiceCount;                           {  Number of Services Supported }
        service:                array [0..0] of DriverServiceInfo;      {  The List of Services (at least one) }
    end;

    {    Categories     }

const
    kServiceCategoryDisplay     = $64697370 (* 'disp' *);                       {  Display Manager }
    kServiceCategoryOpenTransport = $6F74616E (* 'otan' *);                     {  Open Transport }
    kServiceCategoryBlockStorage = $626C6F6B (* 'blok' *);                      {  Block Storage }
    kServiceCategoryNdrvDriver  = $6E647276 (* 'ndrv' *);                       {  Generic Native Driver }
    kServiceCategoryScsiSIM     = $73637369 (* 'scsi' *);                       {  SCSI  }
    kServiceCategoryFileManager = $66696C65 (* 'file' *);                       {  File Manager  }
    kServiceCategoryIDE         = $6964652D (* 'ide-' *);                       {  ide  }
    kServiceCategoryADB         = $6164622D (* 'adb-' *);                       {  adb  }
    kServiceCategoryPCI         = $7063692D (* 'pci-' *);                       {  pci bus  }
                                                                {  Nu Bus  }
    kServiceCategoryDFM         = $64666D2D (* 'dfm-' *);                       {  DFM  }
    kServiceCategoryMotherBoard = $6D726264 (* 'mrbd' *);                       {  mother Board  }
    kServiceCategoryKeyboard    = $6B796264 (* 'kybd' *);                       {  Keyboard  }
    kServiceCategoryPointing    = $706F6974 (* 'poit' *);                       {  Pointing  }
    kServiceCategoryRTC         = $7274632D (* 'rtc-' *);                       {  RTC  }
    kServiceCategoryNVRAM       = $6E72616D (* 'nram' *);                       {  NVRAM  }
    kServiceCategorySound       = $736F6E64 (* 'sond' *);                       {  Sound (1/3/96 MCS)  }
    kServiceCategoryPowerMgt    = $70676D74 (* 'pgmt' *);                       {  Power Management  }
    kServiceCategoryGeneric     = $67656E72 (* 'genr' *);                       {  Generic Service Category to receive general Events  }

    {    Ndrv ServiceCategory Types     }
    kNdrvTypeIsGeneric          = $67656E72 (* 'genr' *);                       {  generic }
    kNdrvTypeIsVideo            = $7669646F (* 'vido' *);                       {  video }
    kNdrvTypeIsBlockStorage     = $626C6F6B (* 'blok' *);                       {  block storage }
    kNdrvTypeIsNetworking       = $6E657477 (* 'netw' *);                       {  networking }
    kNdrvTypeIsSerial           = $7365726C (* 'serl' *);                       {  serial }
    kNdrvTypeIsParallel         = $7061726C (* 'parl' *);                       {  parallel  }
    kNdrvTypeIsSound            = $736F6E64 (* 'sond' *);                       {  sound }
    kNdrvTypeIsBusBridge        = $62726467 (* 'brdg' *);
    kNdrvTypeIsFWConference     = $63727368 (* 'crsh' *);                       {  FireWire conference camera  }
    kNdrvTypeIsAVC              = $61766320 (* 'avc ' *);                       {  FireWire AVC devices (DV cameras)  }


type
    DriverDescVersion                   = UInt32;
    {     The Driver Description    }

const
    kTheDescriptionSignature    = $6D74656A (* 'mtej' *);
    kDriverDescriptionSignature = $70646573 (* 'pdes' *);

    kInitialDriverDescriptor    = 0;
    kVersionOneDriverDescriptor = 1;


type
    DriverDescriptionPtr = ^DriverDescription;
    DriverDescription = record
        driverDescSignature:    OSType;                                 {  Signature field of this structure }
        driverDescVersion:      DriverDescVersion;                      {  Version of this data structure }
        driverType:             MacDriverType;                          {  Type of Driver }
        driverOSRuntimeInfo:    DriverOSRuntime;                        {  OS Runtime Requirements of Driver }
        driverServices:         DriverOSService;                        {  Apple Service API Membership }
    end;



{$ALIGN MAC68K}
{#POP}
{unit NSLCore}
{$ALIGN MAC68K}








{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}



const
    kNSLMinSystemVersion        = $0900;                        {  equivalent to 9.0 }
    kNSLMinOTVersion            = $0130;                        {  equivalent to 1.3 }

    kNSLDefaultListSize         = 256;                          {  default list size for service and protocol lists }

    kNSLURLDelimiter            = 44;                           {  delimits URL's within memory buffers }

    kNSLNoContext               = 0;                            {  the default context for NSLError structs }


type
    NSLErrorPtr = ^NSLError;
    NSLError = record
        theErr:                 OSStatus;
        theContext:             UInt32;
    end;


const
                                                                {  Constants to use with NSLPrepareRequest }
                                                                {  kNSLDuplicateSearchInProgress is not strictly an error.  The client is free to ignore }
                                                                {  this result, and nothing bad will happen if it does.  It is }
                                                                {  informational only. }
    kNSLDuplicateSearchInProgress = 100;
    kNSLUserCanceled            = -128;                         {  User hit cancel from the NSLStandardGetURL dialog  }
                                                                {  Invalid enumeratorRef   }
    kNSLInvalidEnumeratorRef    = 0;                            {  this is not an error; it is the equiv to a NULL ptr }


type
    NSLSearchState              = UInt16;
const
                                                                {  State codes for notifiers. }
    kNSLSearchStateBufferFull   = 1;
    kNSLSearchStateOnGoing      = 2;
    kNSLSearchStateComplete     = 3;
    kNSLSearchStateStalled      = 4;
    kNSLWaitingForContinue      = 5;


type
    NSLEventCode                = UInt32;
const
                                                                {  Event codes }
    kNSLServicesLookupDataEvent = 6;
    kNSLNeighborhoodLookupDataEvent = 7;
    kNSLNewDataEvent            = 8;
    kNSLContinueLookupEvent     = 9;



type
    NSLClientRef                        = UInt32;
    NSLRequestRef                       = UInt32;
    NSLOneBasedIndex                    = UInt32;
    NSLPath                             = ^char;
    NSLServiceType                      = ^char;
    NSLServicesList                     = Handle;
    NSLNeighborhood                     = ^UInt8;
    {
       cstring which is a comma delimited list of protocols which can be used to
       create a NSLProtocolList internally
    }
    {  the async information block for client<->manager interaction }
    NSLClientAsyncInfoPtr = ^NSLClientAsyncInfo;
    NSLClientAsyncInfo = record
        clientContextPtr:       Ptr;                                    {  set by the client for its own use }
        mgrContextPtr:          Ptr;                                    {  set by NSL mgr; ptr to request object ptr }
        resultBuffer:           CStringPtr;
        bufferLen:              SInt32;
        maxBufferSize:          SInt32;
        startTime:              UInt32;                                 {  when the search starts, to use with maxSearchTime to determine time-out condition }
        intStartTime:           UInt32;                                 {  used with alertInterval }
        maxSearchTime:          UInt32;                                 {  total time for search, in ticks (0 == no time limit) }
        alertInterval:          UInt32;                                 {  call client's notifier or return, every this many ticks ( 0 == don't use this param) }
        totalItems:             UInt32;                                 {  total number of tuples currently in buffer }
        alertThreshold:         UInt32;                                 {  call client's notifier or return, every this many items found ( 0 == don't use this param) }
        searchState:            NSLSearchState;
        searchResult:           NSLError;
        searchDataType:         NSLEventCode;                           {  this is a data type code which allows the client's asyncNotifier to properly }
                                                                        {  handle the data in resultBuffer. }
    end;

    {  the async information block plugin<->manager interaction }
    NSLPluginAsyncInfoPtr = ^NSLPluginAsyncInfo;
    NSLPluginAsyncInfo = record
        mgrContextPtr:          Ptr;                                    {  set by NSL mgr; ptr to request object ptr }
        pluginContextPtr:       Ptr;                                    {  set/used by individual plugins }
        pluginPtr:              Ptr;                                    {  ptr to the plugin object waiting for continue lookup call }
        resultBuffer:           CStringPtr;                             {  set by plugin to point at data }
        bufferLen:              SInt32;
        maxBufferSize:          SInt32;
        maxSearchTime:          UInt32;                                 {  total time for search, in ticks (0 == no time limit) }
        reserved1:              UInt32;
        reserved2:              UInt32;
        reserved3:              UInt32;
        clientRef:              NSLClientRef;
        requestRef:             NSLRequestRef;
        searchState:            NSLSearchState;
        searchResult:           OSStatus;
    end;

    {  the manager asynchronous notifier routine. }
    NSLMgrNotifyProcPtr = procedure(var thePluginAsyncInfo: NSLPluginAsyncInfo);

    {  the client asynchronous notifier routine. }
    NSLClientNotifyProcPtr = procedure(var theClientAsyncInfo: NSLClientAsyncInfo);

    NSLMgrNotifyUPP = ^SInt32; { an opaque UPP }
    NSLClientNotifyUPP = ^SInt32; { an opaque UPP }

const
    uppNSLMgrNotifyProcInfo = $000000C0;
    uppNSLClientNotifyProcInfo = $000000C0;
    {
     *  NewNSLMgrNotifyUPP()
     *
     *  Availability:
     *    Non-Carbon CFM:   available as macro/inline
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function NewNSLMgrNotifyUPP(userRoutine: NSLMgrNotifyProcPtr): NSLMgrNotifyUPP; external name '_NewNSLMgrNotifyUPP'; { old name was NewNSLMgrNotifyProc }
{
 *  NewNSLClientNotifyUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewNSLClientNotifyUPP(userRoutine: NSLClientNotifyProcPtr): NSLClientNotifyUPP; external name '_NewNSLClientNotifyUPP'; { old name was NewNSLClientNotifyProc }
{
 *  DisposeNSLMgrNotifyUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeNSLMgrNotifyUPP(userUPP: NSLMgrNotifyUPP); external name '_DisposeNSLMgrNotifyUPP';
{
 *  DisposeNSLClientNotifyUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeNSLClientNotifyUPP(userUPP: NSLClientNotifyUPP); external name '_DisposeNSLClientNotifyUPP';
{
 *  InvokeNSLMgrNotifyUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvokeNSLMgrNotifyUPP(var thePluginAsyncInfo: NSLPluginAsyncInfo; userRoutine: NSLMgrNotifyUPP); external name '_InvokeNSLMgrNotifyUPP'; { old name was CallNSLMgrNotifyProc }
{
 *  InvokeNSLClientNotifyUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvokeNSLClientNotifyUPP(var theClientAsyncInfo: NSLClientAsyncInfo; userRoutine: NSLClientNotifyUPP); external name '_InvokeNSLClientNotifyUPP'; { old name was CallNSLClientNotifyProc }
{
   this struct is a format for dealing with our internal data representation.  Typed data will be contiguous chunk of
   memory, with the first 4 bytes being a data "descriptor".
}

type
    NSLTypedDataPtr = ^NSLTypedData;
    NSLTypedData = record
        dataType:               UInt32;
        lengthOfData:           UInt32;
    end;

    {
       This is just a header at the beginning of a handle that stores our list of service types.
       Each service type is a pascal string, so each service type starts after the end of the
       previous one.
    }
    NSLServicesListHeaderPtr = ^NSLServicesListHeader;
    NSLServicesListHeader = record
        numServices:            UInt32;
        logicalLen:             UInt32;                                 {  length of all usable data in handle }
    end;

    {  some defs for common protocols }
    {
       general information from a plug-in.  Includes supported protocols, data types and services,
       as well as an info/comment string describing the function of the plug-in in human-readable
       form.  The offsets point to the beginning of each list of data returned, and the protocol
       data offset is the startOfData member of the struct
    }
    NSLPluginDataPtr = ^NSLPluginData;
    NSLPluginData = record
        reserved1:              SInt32;
        reserved2:              SInt32;
        reserved3:              SInt32;
        supportsRegistration:   boolean;
        isPurgeable:            boolean;
        totalLen:               UInt16;                                 {  length of everything, including header }
        dataTypeOffset:         UInt16;
        serviceListOffset:      UInt16;
        protocolListOffset:     UInt16;
        commentStringOffset:    UInt16;
                                                                        {  protocol data is first on the list }
    end;

    {
      -----------------------------------------------------------------------------
        Finding out if the library is present and getting its version
      -----------------------------------------------------------------------------
    }

    {
     *  NSLLibraryVersion()
     *
     *  Availability:
     *    Non-Carbon CFM:   in NSLPPCLib 1.1 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function NSLLibraryVersion: UInt32; external name '_NSLLibraryVersion';


{
    NSLLibraryPresent() is a macro available only in C/C++.
}
{
  -----------------------------------------------------------------------------
    High level API calls: the following two calls are ALL an application needs
    to register/deregister its service.
    If you use these, you don't need to make any of the other calls to NSLAPI
    (including NSLOpenNavigationAPI)
  -----------------------------------------------------------------------------
}

{ <--- error code from registration }
{ ---> urlToRegister is a null terminated url that has only legal characters defined for URLs.  Use HexEncodeText to encode}
{          portions of the url that have illegal characters }
{ ---> neighborhoodToRegisterIn is an optional parameter for explicitly defining a neighborhood to register in.
            If parameter is NULL, then the plugins will determine where to register the service }
{
 *  NSLStandardRegisterURL()
 *
 *  Availability:
 *    Non-Carbon CFM:   in NSLPPCLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NSLStandardRegisterURL(urlToRegister: NSLPath; neighborhoodToRegisterIn: NSLNeighborhood): NSLError; external name '_NSLStandardRegisterURL';

{ <--- error code from registration }
{ ---> urlToRegister is a null terminated url that has only legal characters defined for URLs.  Use HexEncodeText to encode}
{          portions of the url that have illegal characters }
{ ---> neighborhoodToDeregisterIn is an optional parameter for explicitly defining a neighborhood to register in.
            If parameter is NULL, then the plugins will determine where to register the service }
{
 *  NSLStandardDeregisterURL()
 *
 *  Availability:
 *    Non-Carbon CFM:   in NSLPPCLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NSLStandardDeregisterURL(urlToDeregister: NSLPath; neighborhoodToDeregisterIn: NSLNeighborhood): NSLError; external name '_NSLStandardDeregisterURL';


{ ----------------------------------------------------------------------------- }

{
 *  NSLHexEncodeText()
 *
 *  Availability:
 *    Non-Carbon CFM:   in NSLPPCLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NSLHexEncodeText(rawText: ConstCStringPtr; rawTextLen: UInt16; newTextBuffer: CStringPtr; var newTextBufferLen: UInt16; var textChanged: boolean): OSStatus; external name '_NSLHexEncodeText';

{
 *  NSLHexDecodeText()
 *
 *  Availability:
 *    Non-Carbon CFM:   in NSLPPCLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NSLHexDecodeText(encodedText: ConstCStringPtr; encodedTextLen: UInt16; decodedTextBuffer: CStringPtr; var decodedTextBufferLen: UInt16; var textChanged: boolean): OSStatus; external name '_NSLHexDecodeText';

{
  -----------------------------------------------------------------------------
    Basic API Utility calls: sufficient to create, and parse data structures
  -----------------------------------------------------------------------------
}

{
 *  NSLMakeNewServicesList()
 *
 *  Availability:
 *    Non-Carbon CFM:   in NSLPPCLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NSLMakeNewServicesList(initialServiceList: ConstCStringPtr): NSLServicesList; external name '_NSLMakeNewServicesList';

{
 *  NSLAddServiceToServicesList()
 *
 *  Availability:
 *    Non-Carbon CFM:   in NSLPPCLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NSLAddServiceToServicesList(serviceList: NSLServicesList; serviceType: NSLServiceType): NSLError; external name '_NSLAddServiceToServicesList';

{
 *  NSLDisposeServicesList()
 *
 *  Availability:
 *    Non-Carbon CFM:   in NSLPPCLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure NSLDisposeServicesList(theList: NSLServicesList); external name '_NSLDisposeServicesList';

{
    The name reflects the name of the Neighborhood, i.e. "apple.com." or "AppleTalk Zone One".
    The protocolList is a comma delimited list of protocols that the Neighborhood might exist in.
    If the user passes in NULL, then all protocols will be queried.  The result must be disposed
    of by the user by calling NSLFreeNeighborhood.
}
{
 *  NSLMakeNewNeighborhood()
 *
 *  Availability:
 *    Non-Carbon CFM:   in NSLPPCLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NSLMakeNewNeighborhood(name: ConstCStringPtr; protocolList: ConstCStringPtr): NSLNeighborhood; external name '_NSLMakeNewNeighborhood';

{ creates an exact copy of an existing neighborhood }
{
 *  NSLCopyNeighborhood()
 *
 *  Availability:
 *    Non-Carbon CFM:   in NSLPPCLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NSLCopyNeighborhood(neighborhood: NSLNeighborhood): NSLNeighborhood; external name '_NSLCopyNeighborhood';

{
 *  NSLFreeNeighborhood()
 *
 *  Availability:
 *    Non-Carbon CFM:   in NSLPPCLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NSLFreeNeighborhood(neighborhood: NSLNeighborhood): NSLNeighborhood; external name '_NSLFreeNeighborhood';

{
 *  NSLGetNameFromNeighborhood()
 *
 *  Availability:
 *    Non-Carbon CFM:   in NSLPPCLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure NSLGetNameFromNeighborhood(neighborhood: NSLNeighborhood; var name: CStringPtr; var length: SInt32); external name '_NSLGetNameFromNeighborhood';

{
   create a block of formatted data, pointed to by newDataPtr.  This will be used
   in calls (typically request-related calls) for plug-ins that handle the NSL data type.
}
{
 *  NSLMakeServicesRequestPB()
 *
 *  Availability:
 *    Non-Carbon CFM:   in NSLPPCLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NSLMakeServicesRequestPB(serviceList: NSLServicesList; var newDataPtr: NSLTypedDataPtr): OSStatus; external name '_NSLMakeServicesRequestPB';

{  releases any storage created with MakeXXXPB calls, associated with TypedData. }
{
 *  NSLFreeTypedDataPtr()
 *
 *  Availability:
 *    Non-Carbon CFM:   in NSLPPCLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NSLFreeTypedDataPtr(nslTypeData: NSLTypedDataPtr): NSLTypedDataPtr; external name '_NSLFreeTypedDataPtr';

{
   utility function that returns whether a url was found, a pointer to the beginning
   of the url, and the length of the URL.
}
{
 *  NSLGetNextUrl()
 *
 *  Availability:
 *    Non-Carbon CFM:   in NSLPPCLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NSLGetNextUrl(infoPtr: NSLClientAsyncInfoPtr; var urlPtr: CStringPtr; var urlLength: SInt32): boolean; external name '_NSLGetNextUrl';

{
   utility function that returns whether a Neighborhood was found, a pointer to the beginning
   of the Neighborhood, and the length of the Neighborhood.
}
{
 *  NSLGetNextNeighborhood()
 *
 *  Availability:
 *    Non-Carbon CFM:   in NSLPPCLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NSLGetNextNeighborhood(infoPtr: NSLClientAsyncInfoPtr; var neighborhood: NSLNeighborhood; var neighborhoodLength: SInt32): boolean; external name '_NSLGetNextNeighborhood';


{
   NSLErrorToString:    convert a numeric error code to its string equivalent.  Caller must
                        have allocated sufficient space to store both strings.  (Max 255 chars each)

                        The errorString parameter will return a textual explanation of what is wrong,
                        while the solutionString returns a possible solution to get around the problem
}

{
 *  NSLErrorToString()
 *
 *  Availability:
 *    Non-Carbon CFM:   in NSLPPCLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NSLErrorToString(theErr: NSLError; errorString: CStringPtr; solutionString: CStringPtr): OSStatus; external name '_NSLErrorToString';


{
  -----------------------------------------------------------------------------
    Basic API calls: sufficient to create simple requests, and receive answers
  -----------------------------------------------------------------------------
}

{
 *  NSLOpenNavigationAPI()
 *
 *  Availability:
 *    Non-Carbon CFM:   in NSLPPCLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NSLOpenNavigationAPI(var newRef: NSLClientRef): OSStatus; external name '_NSLOpenNavigationAPI';

{
 *  NSLCloseNavigationAPI()
 *
 *  Availability:
 *    Non-Carbon CFM:   in NSLPPCLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure NSLCloseNavigationAPI(theClient: NSLClientRef); external name '_NSLCloseNavigationAPI';

{
    NSLPrepareRequest:  creates an NSLRequestRef, sets up some internal data
    notifier is an NSLClientNotifyUPP that will be called when data is available, when the lookup has
    completed, or if an error occurs.  When the notifier is called, the cookie will be the NSLRequestRef.
    If notifier is NULL, then the NSLManager will assume that the request is made synchronously.  This
    should only be used while in a separate thread, so that the client app can still process events, etc.

    contextPtr is a void* which is passed as the contextPtr argument when the notifier is called.

    upon exit:
    1) ref will contain a pointer to a NSLRequestRef which must be passed to all other functions
    which require a NSLRequestRef.
    2) infoPtr will point to a newly created ClientAsycnInfoPtr which will be disposed by the manager when the search is completed
    NOTE: Only one search can be running at a time per clientRef.
}

{
 *  NSLPrepareRequest()
 *
 *  Availability:
 *    Non-Carbon CFM:   in NSLPPCLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NSLPrepareRequest(notifier: NSLClientNotifyUPP; contextPtr: UnivPtr; theClient: NSLClientRef; var ref: NSLRequestRef; bufPtr: CStringPtr; bufLen: UInt32; var infoPtr: NSLClientAsyncInfoPtr): NSLError; external name '_NSLPrepareRequest';


{
   NSLStartNeighborhoodLookup: looking for neighborhoods associated with or neighboring a particular neighborhood
    Passing in NULL for neighborhood will generate a list of a default neighborhood(s)

}

{
 *  NSLStartNeighborhoodLookup()
 *
 *  Availability:
 *    Non-Carbon CFM:   in NSLPPCLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NSLStartNeighborhoodLookup(ref: NSLRequestRef; neighborhood: NSLNeighborhood; var asyncInfo: NSLClientAsyncInfo): NSLError; external name '_NSLStartNeighborhoodLookup';

{
   NSLStartServicesLookup: starts looking for entities if the specified type in the specified neighborhood

}

{
 *  NSLStartServicesLookup()
 *
 *  Availability:
 *    Non-Carbon CFM:   in NSLPPCLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NSLStartServicesLookup(ref: NSLRequestRef; neighborhood: NSLNeighborhood; requestData: NSLTypedDataPtr; var asyncInfo: NSLClientAsyncInfo): NSLError; external name '_NSLStartServicesLookup';


{  NSLContinueLookup:  continues a paused/outstanding lookup }

{
 *  NSLContinueLookup()
 *
 *  Availability:
 *    Non-Carbon CFM:   in NSLPPCLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NSLContinueLookup(var asyncInfo: NSLClientAsyncInfo): NSLError; external name '_NSLContinueLookup';


{  NSLCancelRequest: cancels an ongoing search }

{
 *  NSLCancelRequest()
 *
 *  Availability:
 *    Non-Carbon CFM:   in NSLPPCLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NSLCancelRequest(ref: NSLRequestRef): NSLError; external name '_NSLCancelRequest';

{
   NSLDeleteRequest: deletes info associated with this ref.  The ClientAsyncInfoPtr will no longer be valid
    This must be called when the client is no longer using this requestRef.
}

{
 *  NSLDeleteRequest()
 *
 *  Availability:
 *    Non-Carbon CFM:   in NSLPPCLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NSLDeleteRequest(ref: NSLRequestRef): NSLError; external name '_NSLDeleteRequest';


{
  -----------------------------------------------------------------------------
   Utility API calls: use these accessors to manipulate NSL's typed data
  -----------------------------------------------------------------------------
}

{  NSLParseServicesRequestPB provides the inverse of NSLMakeRequestPB, filling out the offsets found within newDataPtr }
{ <--- returns an OSStatus if any errors occur parsing the data }
{ <--- newDataPtr is the construct passed to the plugin }
{ ---> serviceListPtr is the address of a pointer which will be set to point at the portion of the newDataPtr that holds the serviceList to be searched }
{ ---> serviceListLen is the length of the serviceListPtr data pointed to by serviceListPtr }
{
 *  NSLParseServicesRequestPB()
 *
 *  Availability:
 *    Non-Carbon CFM:   in NSLPPCLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NSLParseServicesRequestPB(newDataPtr: NSLTypedDataPtr; var serviceListPtr: CStringPtr; var serviceListLen: UInt16): OSStatus; external name '_NSLParseServicesRequestPB';


{ NSLParseServiceRegistrationPB provides for breaking apart a registration request from a client to a plugin }
{ <--- returns an OSStatus if any errors occur parsing the data }
{ <--- newDataPtr is the construct passed to the plugin }
{ ---> neighborhoodPtr gets set to point at the portion of the newDataPtr that contains the neighborhood }
{ ---> neighborhoodLen is the length of the neighborhood pointed to by neighborhoodPtr }
{ ---> urlPtr is the address of a pointer which will be set to point at the portion of the newDataPtr that holds the url to be registered }
{ ---> urlLen is the length of the url data pointed to by urlPtr }
{
 *  NSLParseServiceRegistrationPB()
 *
 *  Availability:
 *    Non-Carbon CFM:   in NSLPPCLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NSLParseServiceRegistrationPB(newDataPtr: NSLTypedDataPtr; var neighborhoodPtr: NSLNeighborhood; var neighborhoodLen: UInt16; var urlPtr: CStringPtr; var urlLen: UInt16): OSStatus; external name '_NSLParseServiceRegistrationPB';

{ NSLGetErrorStringsFromResource is obsolete in X.  It will ignore the fileSpecPtr }
{ and errorResID parameters and return the standard error strings. }
{ NSLGetErrorStringsFromResource makes a basic assumption: }
{ errorString and solutionString both point to valid memory of at least 256 bytes! }
{ <--- returns an OSStatus if any errors occur }
{ ---> theErr is an OSStatus to be matched against a resource list of errors }
{ ---> fileSpecPtr is a FSSpecPtr to the resource containing the list of errors }
{ ---> errorResID is the resourceID of the NSLI resource of the list of errors }
{ <--> errorString is a pointer to valid memory of at least 256 bytes which will be filled out by the error portion of the error string }
{ <--> solutionString is a pointer to valid memory of at least 256 bytes which will be filled out by the solution portion of the error string }
{
 *  NSLGetErrorStringsFromResource()
 *
 *  Availability:
 *    Non-Carbon CFM:   in NSLPPCLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NSLGetErrorStringsFromResource(theErr: OSStatus; const (*var*) fileSpecPtr: FSSpec; errorResID: SInt16; errorString: CStringPtr; solutionString: CStringPtr): OSStatus; external name '_NSLGetErrorStringsFromResource';

{ <--- Returns true if given service is in the given service list }
{ ---> serviceList is a valid NSLServicesList containing information about services to be searched }
{ ---> svcToFind is an NSLServiceType of a particular service to check if it is in the serviceList }
{
 *  NSLServiceIsInServiceList()
 *
 *  Availability:
 *    Non-Carbon CFM:   in NSLPPCLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NSLServiceIsInServiceList(serviceList: NSLServicesList; svcToFind: NSLServiceType): boolean; external name '_NSLServiceIsInServiceList';

{ <--- returns an OSStatus if any errors occur parsing the data }
{ ---> svcString is the address of a pointer which will be set to point at the portion of theURL that holds the serviceType of theURL }
{ ---> svcLen is the length of the serviceType pointed to by svcString }
{
 *  NSLGetServiceFromURL()
 *
 *  Availability:
 *    Non-Carbon CFM:   in NSLPPCLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NSLGetServiceFromURL(theURL: CStringPtr; var svcString: CStringPtr; var svcLen: UInt16): OSStatus; external name '_NSLGetServiceFromURL';

{ <--- returns the length of a Neighborhood data structure }
{ ---> neighborhood is a valid NSLNeighborhood }
{
 *  NSLGetNeighborhoodLength()
 *
 *  Availability:
 *    Non-Carbon CFM:   in NSLPPCLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NSLGetNeighborhoodLength(neighborhood: NSLNeighborhood): SInt32; external name '_NSLGetNeighborhoodLength';

{
  -------------------------------------------------------------------------------------
   Utility API calls: use these routines to separate plugin threads from client threads
  -------------------------------------------------------------------------------------
}

{ this routine works the same as the Thread manager's routine NewThread, except }
{ that the thread is added to the NSL manager's thread list. }
{
 *  NSLNewThread()
 *
 *  Availability:
 *    Non-Carbon CFM:   in NSLPPCLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NSLNewThread(threadStyle: ThreadStyle; threadEntry: ThreadEntryProcPtr; threadParam: UnivPtr; stackSize: Size; options: ThreadOptions; var threadResult: UnivPtr; var threadMade: ThreadID): OSErr; external name '_NSLNewThread';

{ this routine works the same as the Thread manager's routine DisposeThread, except }
{ that the thread is removed from the NSL manager's thread list. }
{
 *  NSLDisposeThread()
 *
 *  Availability:
 *    Non-Carbon CFM:   in NSLPPCLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NSLDisposeThread(threadToDump: ThreadID; threadResult: UnivPtr; recycleThread: boolean): OSErr; external name '_NSLDisposeThread';



{$ALIGN MAC68K}
{#POP}
{unit OpenTransportProtocol}
{$ALIGN MAC68K}











{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}


{  ***** Setup Default Compiler Variables ***** }

{
   OTKERNEL is used to indicate whether the code is being built
   for the kernel environment.  It defaults to 0.  If you include
   "OpenTransportKernel.h" before including this file,
   it will be 1 and you will only be able to see stuff available
   to kernel code.
   As we've included "OpenTransport.h" and it defaults this variable
   to 0 if it's not already been defined, it should always be defined
   by the time we get here.  So we just assert that.  Assertions in
   header files!  Cool (-:
}


{  ***** Shared Client Memory ***** }
{
   These allocators allocate memory in the shared client pool,
   which is shared between all clients and is not disposed when
   a particular client goes away.  See DTS Technote ¥¥¥
   "Understanding Open Transport Memory Management" for details.
}

{  ***** UNIX Types ***** }

{  ***** From the Mentat "stropts.h" ***** }



const
    I_NREAD                     = $4101;                        {  return the number of bytes in 1st msg  }
    I_PUSH                      = $4102;                        {  push module just below stream head  }
    I_POP                       = $4103;                        {  pop module below stream head  }
    I_LOOK                      = $4104;                        {  retrieve name of first stream module  }
    I_FLUSH                     = $4105;                        {  flush all input and/or output queues  }
    I_SRDOPT                    = $4106;                        {  set the read mode  }
    I_GRDOPT                    = $4107;                        {  get the current read mode  }
    I_STR                       = $4108;                        {  create an internal ioctl message       }
    I_SETSIG                    = $4109;                        {  request SIGPOLL signal on events  }
    I_GETSIG                    = $410A;                        {  query the registered events  }
    I_FIND                      = $410B;                        {  check for module in stream           }
    I_LINK                      = $410C;                        {  connect stream under mux fd  }
    I_UNLINK                    = $410D;                        {  disconnect two streams  }
    I_PEEK                      = $410F;                        {  peek at data on read queue  }
    I_FDINSERT                  = $4110;                        {  create a message and send downstream  }
    I_SENDFD                    = $4111;                        {  send an fd to a connected pipe stream  }
    I_RECVFD                    = $4112;                        {  retrieve a file descriptor  }
    I_FLUSHBAND                 = $4113;                        {  flush a particular input and/or output band  }
    I_SWROPT                    = $4114;                        {  set the write mode  }
    I_GWROPT                    = $4115;                        {  get the current write mode  }
    I_LIST                      = $4116;                        {  get a list of all modules on a stream   }
    I_ATMARK                    = $4117;                        {  check to see if the next message is "marked"  }
    I_CKBAND                    = $4118;                        {  check for a message of a particular band  }
    I_GETBAND                   = $4119;                        {  get the band of the next message to be read  }
    I_CANPUT                    = $411A;                        {  check to see if a message may be passed on a stream  }
    I_SETCLTIME                 = $411B;                        {  set the close timeout wait  }
    I_GETCLTIME                 = $411C;                        {  get the current close timeout wait  }
    I_PLINK                     = $411D;                        {  permanently connect a stream under a mux  }
    I_PUNLINK                   = $411E;                        {  disconnect a permanent link  }
    I_GETMSG                    = $4128;                        {  getmsg() system call  }
    I_PUTMSG                    = $4129;                        {  putmsg() system call  }
    I_POLL                      = $412A;                        {  poll() system call  }
    I_SETDELAY                  = $412B;                        {  set blocking status  }
    I_GETDELAY                  = $412C;                        {  get blocking status  }
    I_RUN_QUEUES                = $412D;                        {  sacrifice for the greater good  }
    I_GETPMSG                   = $412E;                        {  getpmsg() system call  }
    I_PUTPMSG                   = $412F;                        {  putpmsg() system call  }
    I_AUTOPUSH                  = $4130;                        {  for systems that cannot do the autopush in open  }
    I_PIPE                      = $4131;                        {  for pipe library call  }
    I_HEAP_REPORT               = $4132;                        {  get heap statistics  }
    I_FIFO                      = $4133;                        {  for fifo library call  }

    {    priority message request on putmsg() or strpeek    }
    RS_HIPRI                    = $01;

    {    flags for getpmsg and putpmsg  }
    MSG_HIPRI                   = $01;
    MSG_BAND                    = $02;                          {  Retrieve a message from a particular band  }
    MSG_ANY                     = $04;                          {  Retrieve a message from any band  }

    {    return values from getmsg(), 0 indicates all ok    }
    MORECTL                     = $01;                          {  more control info available  }
    MOREDATA                    = $02;                          {  more data available  }


    FMNAMESZ                    = 31;                           {  maximum length of a module or device name  }


    {    Infinite poll wait time    }
    INFTIM                      = $FFFFFFFF;

    {    flush requests     }
    FLUSHR                      = $01;                          {  Flush the read queue  }
    FLUSHW                      = $02;                          {  Flush the write queue  }
    FLUSHRW                     = $03;                          {  Flush both  }

    {
       FLUSHBAND conflicts with flushband in "OpenTransportKernel.h"
       in case-sensitive languages, so we define kOTFLUSHBAND instead.
    }
    kOTFLUSHBAND                = $40;                          {  Flush a particular band  }

    {    I_FLUSHBAND    }

type
    bandinfoPtr = ^bandinfo;
    bandinfo = record
        bi_pri:                 SInt8;                                  {  Band to flush  }
        pad1:                   SInt8;
        bi_flag:                SInt32;                                 {  One of the above flush requests  }
    end;

    {    flags for I_ATMARK     }

const
    ANYMARK                     = $01;                          {  Check if message is marked  }
    LASTMARK                    = $02;                          {  Check if this is the only message marked  }

    {    signal event masks     }
    S_INPUT                     = $01;                          {  A non-M_PCPROTO message has arrived  }
    S_HIPRI                     = $02;                          {  A priority (M_PCPROTO) message is available  }
    S_OUTPUT                    = $04;                          {  The write queue is no longer full  }
    S_MSG                       = $08;                          {  A signal message has reached the front of read queue  }
    S_RDNORM                    = $10;                          {  A non-priority message is available  }
    S_RDBAND                    = $20;                          {  A banded messsage is available  }
    S_WRNORM                    = $40;                          {  Same as S_OUTPUT  }
    S_WRBAND                    = $80;                          {  A priority band exists and is writable  }
    S_ERROR                     = $0100;                        {  Error message has arrived  }
    S_HANGUP                    = $0200;                        {  Hangup message has arrived  }
    S_BANDURG                   = $0400;                        {  Use SIGURG instead of SIGPOLL on S_RDBAND signals  }

    {    read mode bits for I_S|GRDOPT; choose one of the following     }
    RNORM                       = $01;                          {  byte-stream mode, default  }
    RMSGD                       = $02;                          {  message-discard mode  }
    RMSGN                       = $04;                          {  message-nondiscard mode  }
    RFILL                       = $08;                          {  fill read buffer mode (PSE private)  }

    {    More read modes, these are bitwise or'ed with the modes above  }
    RPROTNORM                   = $10;                          {  Normal handling of M_PROTO/M_PCPROTO messages, default  }
    RPROTDIS                    = $20;                          {  Discard M_PROTO/M_PCPROTO message blocks  }
    RPROTDAT                    = $40;                          {  Convert M_PROTO/M_PCPROTO message blocks into M_DATA  }

    {    write modes for I_S|GWROPT     }
    SNDZERO                     = $01;                          {  Send a zero-length message downstream on a write of zero bytes  }

    MUXID_ALL                   = -1;                           {  Unlink all lower streams for I_UNLINK and I_PUNLINK  }

    {
       strbuf is moved to "OpenTransport.h" because that header file
       exports provider routines that take it as a parameter.
    }

    {    structure of ioctl data on I_FDINSERT  }

type
    strfdinsertPtr = ^strfdinsert;
    strfdinsert = record
        ctlbuf:                 strbuf;
        databuf:                strbuf;
        flags:                  SInt32;                             {  type of message, 0 or RS_HIPRI  }
        fildes:                 SInt32;                             {  fd of other stream (FDCELL)  }
        offset:                 SInt32;                                 {  where to put other stream read qp  }
    end;

    {    I_LIST structures  }
    str_mlistPtr = ^str_mlist;
    str_mlist = record
        l_name:                 packed array [0..31] of char;
    end;

    str_listPtr = ^str_list;
    str_list = record
        sl_nmods:               SInt32;                                 {  number of modules in sl_modlist array  }
        sl_modlist:             str_mlistPtr;
    end;

    {    I_PEEK structure   }
    strpeekPtr = ^strpeek;
    strpeek = record
        ctlbuf:                 strbuf;
        databuf:                strbuf;
        flags:                  SInt32;                             {  if RS_HIPRI, get priority messages only  }
    end;

    {    structure for getpmsg and putpmsg  }
    strpmsgPtr = ^strpmsg;
    strpmsg = record
        ctlbuf:                 strbuf;
        databuf:                strbuf;
        band:                   SInt32;
        flags:                  SInt32;
    end;

    {    structure of ioctl data on I_RECVFD    }
    strrecvfdPtr = ^strrecvfd;
    strrecvfd = record
        fd:                     SInt32;                             {  new file descriptor (FDCELL)  }
        uid:                    UInt16;                                 {  user id of sending stream  }
        gid:                    UInt16;
        fill:                   packed array [0..7] of char;
    end;

    {    structure of ioctl data on I_STR   }
    strioctlPtr = ^strioctl;
    strioctl = record
        ic_cmd:                 SInt32;                                 {  downstream command  }
        ic_timout:              SInt32;                                 {  ACK/NAK timeout  }
        ic_len:                 SInt32;                                 {  length of data arg  }
        ic_dp:                  CStringPtr;                             {  ptr to data arg  }
    end;

    {  ***** From the Mentat "strlog.h" ***** }

    log_ctlPtr = ^log_ctl;
    log_ctl = record
        mid:                    SInt16;
        sid:                    SInt16;
        level:                  SInt8;
        pad1:                   SInt8;
        flags:                  SInt16;
        ltime:                  SInt32;
        ttime:                  SInt32;
        seq_no:                 SInt32;
    end;


const
    SL_FATAL                    = $01;                          {  Fatal error  }
    SL_NOTIFY                   = $02;                          {  Notify the system administrator  }
    SL_ERROR                    = $04;                          {  Pass message to error logger  }
    SL_TRACE                    = $08;                          {  Pass message to tracer  }
    SL_CONSOLE                  = $00;                          {  Console messages are disabled  }
    SL_WARN                     = $20;                          {  Warning  }
    SL_NOTE                     = $40;                          {  Notice this message  }


type
    trace_idsPtr = ^trace_ids;
    trace_ids = record
        ti_mid:                 SInt16;
        ti_sid:                 SInt16;
        ti_level:               SInt8;
    end;


const
    I_TRCLOG                    = $6201;
    I_ERRLOG                    = $6202;

    LOGMSGSZ                    = 128;

    {  ***** From the Mentat "tihdr.h" ***** }


{  ***** Port Utilities ***** }
{
   These types and routines are used during sophisticated
   port management.  High-level clients may get involved
   for things like request a port to be yielding, but typically
   this stuff is used by protocol infrastructure.
}
{
   OTPortCloseStruct is used when processing the kOTClosePortRequest
   and kOTYieldPortRequest events.
}


type
    OTPortCloseStructPtr = ^OTPortCloseStruct;
    OTPortCloseStruct = record
        fPortRef:               OTPortRef;                              {  The port requested to be closed. }
        fTheProvider:           ProviderRef;                            {  The provider using the port. }
        fDenyReason:            OSStatus;                               {  Set to a negative number to deny the request }
    end;

    {  OTClientList structure is used with the OTYieldPortRequest function. }
    OTClientListPtr = ^OTClientList;
    OTClientList = record
        fNumClients:            ItemCount;
        fBuffer:                packed array [0..3] of UInt8;
    end;

    {
       Returns a buffer containing all of the clients that refused to yield the port.
       "size" is the total number of bytes @ buffer, including the fNumClients field.
    }

{  ***** Timers *****  }
{
   STREAMS plug-ins code should not use these timers, instead
   they should use timer messages, ie mi_timer etc.
}


type
    OTTimerTask                         = SInt32;
    {
       Under Carbon, OTCreateTimerTask takes a client context pointer.  Applications may pass NULL
       after calling InitOpenTransport(kInitOTForApplicationMask, ...).  Non-applications must always pass a
       valid client context.
    }
    {
     *  OTCreateTimerTaskInContext()
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function OTCreateTimerTaskInContext(upp: OTProcessUPP; arg: UnivPtr; clientContext: OTClientContextPtr): SInt32; external name '_OTCreateTimerTaskInContext';

{
 *  OTCancelTimerTask()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTCancelTimerTask(timerTask: OTTimerTask): boolean; external name '_OTCancelTimerTask';

{
 *  OTDestroyTimerTask()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure OTDestroyTimerTask(timerTask: OTTimerTask); external name '_OTDestroyTimerTask';

{
 *  OTScheduleTimerTask()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTScheduleTimerTask(timerTask: OTTimerTask; milliSeconds: OTTimeout): boolean; external name '_OTScheduleTimerTask';

{  The following macro may be used by applications only. }

{  ***** Miscellaneous Helpful Functions ***** }

{
   These routines allow you to manipulate OT's buffer structures.
   If you use no-copy receives (described in "OpenTransport.h")
   you will need some of these routines, and may choose to use others.
   See "Open Tranport Advanced Client Programming" for documentation.
}
{
 *  OTBufferDataSize()
 *
 *  Availability:
 *    Non-Carbon CFM:   in OTUtilityLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTBufferDataSize(var buffer: OTBuffer): OTByteCount; external name '_OTBufferDataSize';

{
 *  OTReadBuffer()
 *
 *  Availability:
 *    Non-Carbon CFM:   in OTUtilityLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTReadBuffer(var buffer: OTBufferInfo; dest: UnivPtr; var len: OTByteCount): boolean; external name '_OTReadBuffer';

{
 *  OTReleaseBuffer()
 *
 *  Availability:
 *    Non-Carbon CFM:   in OTUtilityLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure OTReleaseBuffer(var buffer: OTBuffer); external name '_OTReleaseBuffer';



{  ***** OTConfiguration ***** }

{  ***** OTStateMachine ***** }

{  ***** Common Utilities ***** }
{
   The utilities defined in this section are available to both client
   and kernel code.  Cool huh?  These utilities differ from those
   provided in "OpenTransport.h" in that they are only available to native
   architecture clients.
}

{  Bitmap functions }

{  These functions atomically deal with a bitmap that is multiple-bytes long }

{
   Set the first clear bit in "bitMap", starting with bit "startBit",
   giving up after "numBits".  Returns the bit # that was set, or
   a kOTNotFoundErr if there was no clear bit available
}
{
 *  OTSetFirstClearBit()
 *
 *  Availability:
 *    Non-Carbon CFM:   in OTUtilityLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTSetFirstClearBit(bitMap: UInt8Ptr; startBit: OTByteCount; numBits: OTByteCount): OTResult; external name '_OTSetFirstClearBit';

{  Standard clear, set and test bit functions }
{
 *  OTClearBit()
 *
 *  Availability:
 *    Non-Carbon CFM:   in OTUtilityLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTClearBit(bitMap: UInt8Ptr; bitNo: OTByteCount): boolean; external name '_OTClearBit';

{
 *  OTSetBit()
 *
 *  Availability:
 *    Non-Carbon CFM:   in OTUtilityLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTSetBit(bitMap: UInt8Ptr; bitNo: OTByteCount): boolean; external name '_OTSetBit';

{
 *  OTTestBit()
 *
 *  Availability:
 *    Non-Carbon CFM:   in OTUtilityLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OTTestBit(bitMap: UInt8Ptr; bitNo: OTByteCount): boolean; external name '_OTTestBit';

{  OTHashList }

{
   This implements a simple, but efficient hash list.  It is not
   thread-safe.
}


type
    OTHashProcPtr = function(var linkToHash: OTLink): UInt32;

    OTHashSearchProcPtr = function(ref: UnivPtr; var linkToCheck: OTLink): boolean;

    OTHashListPtr = ^OTHashList;
    OTHashList = record
        fHashProc:              OTHashProcPtr;
        fHashTableSize:         ByteCount;
        fHashBuckets:           ^OTLinkPtr;
    end;

    {
       Return the number of bytes of memory needed to create a hash list
       of at least "numEntries" entries.
    }

{  Random functions }

{
   These implement a very simple random number generator, suitable
   for protocol implementations but not "cryptographically" random.
}



type
    OTGateProcPtr = function(var thisLink: OTLink): boolean;

    OTGatePtr = ^OTGate;
    OTGate = record
        fLIFO:                  OTLIFO;
        fList:                  OTList;
        fProc:                  OTGateProcPtr;
        fNumQueued:             SInt32;
        fInside:                SInt32;
    end;




{$ALIGN MAC68K}
{#POP}
{unit AuthorizationDB}
{$ALIGN MAC68K}





{!
    @header AuthorizationDB
    Version 1.0

    This API allows for any programs to get, modify, delete and add new right definitions to the policy database.  Meta-rights specify whether and what authorization is required to make these modifications.

    AuthorizationRightSet(NULL, "com.ifoo.ifax.send", CFSTR(kRuleIsAdmin), CFSTR("You must authenticate to send a fax."), NULL, NULL)

    add a rule for letting admins send faxes using a canned rule, delegating to a pre-specified rule that authorizes everyone who is an admin.

    AuthorizationRightSet(NULL, "com.ifoo.ifax.send", [[CFSTR(kRightRule), CFSTR(kRuleIsAdmin)], [CFSTR(kRightComment), CFSTR("authorizes sending of 1 fax message")]], CFSTR("Authorize sending of a fax"), NULL, NULL)

    add identical rule, but specify additional attributes this time.

    Keep in mind while specifying a comment to be specific about what you need to authorize for (1 fax), in terms of a general message for user.  The means of proof required for kRuleIsAdmin (enter username/password for example) should not be included here, since it could be configured differently.

}

{!  @define kRightRule
    rule delegation key.  Instead of specifying exact behavior some canned rules
   are shipped that may be switched by configurable security.
}
const kAuthorizationRightRule = 'rule';

{! @defined kRuleIsAdmin
    canned rule values for use with rule delegation definitions: require user to be an admin.
}
const kAuthorizationRuleIsAdmin = 'is-admin';

{! @defined kRuleAuthenticateAsSessionUser
    canned rule value for use with rule delegation definitions: require user to authenticate as the session owner (logged-in user).
}
const kAuthorizationRuleAuthenticateAsSessionUser = 'authenticate-session-user';

{! @defined kRuleAuthenticateAsAdmin
    Canned rule value for use with rule delegation definitions: require user to authenticate as admin.
}
const kAuthorizationRuleAuthenticateAsAdmin = 'authenticate-admin';

{! @defined kAuthorizationRuleClassAllow
    Class that allows anything.
}
const kAuthorizationRuleClassAllow = 'allow';

{! @defined kAuthorizationRuleClassDeny
    Class that denies anything.
}
const kAuthorizationRuleClassDeny = 'deny';

{! @defined kAuthorizationComment
    comments for the administrator on what is being customized here;
   as opposed to (localized) descriptions presented to the user.
}
const kAuthorizationComment = 'comment';


{!
    @function AuthorizationRightGet

    Retrieves a right definition as a dictionary.  There are no restrictions to keep anyone from retrieving these definitions.

    @param rightName (input) the rightname (ASCII).  Wildcard rightname definitions are okay.
    @param rightDefinition (output/optional) the dictionary with all keys defining the right.  See documented keys.  Passing in NULL will just check if there is a definition.  The caller is responsible for releasing the returned dictionary.

    @result errAuthorizationSuccess 0 No error.

    errAuthorizationDenied -60005 No definition found.

}
function AuthorizationRightGet( rightName: ConstCStringPtr; rightDefinition: CFDictionaryRefPtr ): OSStatus; external name '_AuthorizationRightGet';
// attribute(weak_import);

{!
    @function AuthorizationRightSet

    Create or update a right entry.  Only normal rights can be registered (wildcard rights are denied); wildcard rights are considered to be put in by an administrator putting together a site configuration.

    @param authRef (input) authRef to authorize modifications.
    @param rightName (input) the rightname (ASCII).  Wildcard rightnames are not okay.
    @param rightDefinition (input) a CFString of the name of a rule to use (delegate) or CFDictionary containing keys defining one.
    @param descriptionKey (input/optional) a CFString to use as a key for looking up localized descriptions.  If no localization is found this will be the description itself.
    @param bundle (input/optional) a bundle to get localizations from if not the main bundle.
    @param localeTableName (input/optional) stringtable name to get localizations from.

    @result errAuthorizationSuccess 0 added right definition successfully.

    errAuthorizationDenied -60005 Unable to create or update right definition.

    errAuthorizationCanceled -60006 Authorization was canceled by user.

    errAuthorizationInteractionNotAllowed -60007 Interaction was required but not possible.

}
function AuthorizationRightSet(authRef: AuthorizationRef; rightName: ConstCStringPtr; rightDefinition: CFTypeRef; descriptionKey: CFStringRef; bundle: CFBundleRef; localeTableName: CFStringRef): OSStatus; external name '_AuthorizationRightSet';
// attribute(weak_import);



{!
    @function AuthorizationRightRemove

    Request to remove a right from the policy database.

    @param authRef (input) authRef, to be used to authorize this action.
    @param rightName (input) the rightname (ASCII).  Wildcard rightnames are not okay.

}
function AuthorizationRightRemove(authRef: AuthorizationRef; rightName: ConstCStringPtr): OSStatus; external name '_AuthorizationRightRemove';
{unit CFFTPStream}
{$ALIGN MAC68K}






{
 *  kCFStreamErrorDomainFTP
 *
 *  Discussion:
 *    Result code returned by FTP server
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in CoreServices.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
var kCFStreamErrorDomainFTP: SInt32; external name '_kCFStreamErrorDomainFTP'; (* attribute const *)


{
FTP Stream Property keys.  These keys can be passed to the stream
property "set/get" functions, such as CFReadStreamSetProperty/
CFReadStreamCopyProperty, or to a CFDictionary creator or an item
accessor/mutator.  The comment before each key declaration (treated
as definition) indicates the value type of the property.
}


{
 *  kCFStreamPropertyFTPUserName
 *
 *  Discussion:
 *    Stream property key, for both set and copy operations.  CFString
 *    type to hold login user name.  Don't set this property if you
 *    want anonymous FTP.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in CoreServices.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
var kCFStreamPropertyFTPUserName: CFStringRef; external name '_kCFStreamPropertyFTPUserName'; (* attribute const *)


{
 *  kCFStreamPropertyFTPPassword
 *
 *  Discussion:
 *    Stream property key, for both set and copy operations. CFString
 *    type to hold login password.  Don't set this property if you want
 *    anonymous FTP.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in CoreServices.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
var kCFStreamPropertyFTPPassword: CFStringRef; external name '_kCFStreamPropertyFTPPassword'; (* attribute const *)


{
 *  kCFStreamPropertyFTPUsePassiveMode
 *
 *  Discussion:
 *    Stream property key, for both set and copy operations. CFBoolean
 *    type. kCFBooleanTrue means use passive mode, kCFBooleanFalse
 *    otherwise
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in CoreServices.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
var kCFStreamPropertyFTPUsePassiveMode: CFStringRef; external name '_kCFStreamPropertyFTPUsePassiveMode'; (* attribute const *)


{
 *  kCFStreamPropertyFTPResourceSize
 *
 *  Discussion:
 *    Stream property key, for read stream copy operations.  CFNumber
 *    of kCFNumberLongLongType to hold resource size in bytes.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in CoreServices.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
var kCFStreamPropertyFTPResourceSize: CFStringRef; external name '_kCFStreamPropertyFTPResourceSize'; (* attribute const *)


{
 *  kCFStreamPropertyFTPFetchResourceInfo
 *
 *  Discussion:
 *    Stream property key, for both set and copy operations.  CFBoolean
 *    type.  TRUE means that resource info, such as size, must be
 *    provided before download starts at higher cost.  Don't set if
 *    resource size/other info is unnecessary.  Initially, only
 *    resource size is implemented.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in CoreServices.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
var kCFStreamPropertyFTPFetchResourceInfo: CFStringRef; external name '_kCFStreamPropertyFTPFetchResourceInfo'; (* attribute const *)


{
 *  kCFStreamPropertyFTPFileTransferOffset
 *
 *  Discussion:
 *    Stream property key, for both set and copy operations.  CFNumber
 *    of kCFNumberLongLongType for the file offset to start transfer at.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in CoreServices.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
var kCFStreamPropertyFTPFileTransferOffset: CFStringRef; external name '_kCFStreamPropertyFTPFileTransferOffset'; (* attribute const *)


{
 *  kCFStreamPropertyFTPAttemptPersistentConnection
 *
 *  Discussion:
 *    Stream property key, for both set and copy operations.  CFBoolean
 *    type.  TRUE by default, set to FALSE to avoid reusing existing
 *    server connections.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in CoreServices.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
var kCFStreamPropertyFTPAttemptPersistentConnection: CFStringRef; external name '_kCFStreamPropertyFTPAttemptPersistentConnection'; (* attribute const *)


{
 *  kCFStreamPropertyFTPProxy
 *
 *  Discussion:
 *    Stream property key, for both set and copy operations.
 *    CFDictionary type that holds key-value pairs of proxy dictionary.
 *     The dictionary returned by SystemConfiguration can also be
 *    passed directly as the value.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in CoreServices.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
var kCFStreamPropertyFTPProxy: CFStringRef; external name '_kCFStreamPropertyFTPProxy'; (* attribute const *)


{
 *  kCFStreamPropertyFTPProxyHost
 *
 *  Discussion:
 *    Stream property key or FTP Proxy dictionary key, for both set and
 *    copy operations.  It matches kSCPropNetProxiesFTPProxy defined in
 *    SCSchemaDefinitions.h.  CFString for proxy server host name.
 *    This property can be set and copied individually or via a
 *    CFDictionary.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in CoreServices.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
var kCFStreamPropertyFTPProxyHost: CFStringRef; external name '_kCFStreamPropertyFTPProxyHost'; (* attribute const *)


{
 *  kCFStreamPropertyFTPProxyPort
 *
 *  Discussion:
 *    Stream property key or FTP Proxy dictionary key, for both set and
 *    copy operations.  It matches kSCPropNetProxiesFTPPort defined in
 *    SCSchemaDefinitions.h.  CFNumber of kCFNumberIntType for proxy
 *    server port number.  This property can be set and copied
 *    individually or via a CFDictionary.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in CoreServices.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
var kCFStreamPropertyFTPProxyPort: CFStringRef; external name '_kCFStreamPropertyFTPProxyPort'; (* attribute const *)

{
 *  kCFStreamPropertyFTPProxyUser
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in CoreServices.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
var kCFStreamPropertyFTPProxyUser: CFStringRef; external name '_kCFStreamPropertyFTPProxyUser'; (* attribute const *)
{
 *  kCFStreamPropertyFTPProxyPassword
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in CoreServices.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
var kCFStreamPropertyFTPProxyPassword: CFStringRef; external name '_kCFStreamPropertyFTPProxyPassword'; (* attribute const *)


{
CFDictionary keys for resource information.  The information is
extracted from a line of the directory list by function
CFFTPCreateParsedResourceListing.
}


{
 *  kCFFTPResourceMode
 *
 *  Discussion:
 *    CFDictinary key, for get value operation.  CFNumber to hold the
 *    resource access permission defined in sys/types.h.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in CoreServices.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
var kCFFTPResourceMode: CFStringRef; external name '_kCFFTPResourceMode'; (* attribute const *)


{
 *  kCFFTPResourceName
 *
 *  Discussion:
 *    CFDictinary key, for get value operation.  CFString that holds
 *    the resource name.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in CoreServices.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
var kCFFTPResourceName: CFStringRef; external name '_kCFFTPResourceName'; (* attribute const *)


{
 *  kCFFTPResourceOwner
 *
 *  Discussion:
 *    CFDictinary key, for get value operation.  CFString that holds
 *    the resource owner's name.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in CoreServices.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
var kCFFTPResourceOwner: CFStringRef; external name '_kCFFTPResourceOwner'; (* attribute const *)


{
 *  kCFFTPResourceGroup
 *
 *  Discussion:
 *    CFDictinary key, for get value operation.  CFString to hold the
 *    name of the group that shares the resource.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in CoreServices.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
var kCFFTPResourceGroup: CFStringRef; external name '_kCFFTPResourceGroup'; (* attribute const *)


{
 *  kCFFTPResourceLink
 *
 *  Discussion:
 *    CFDictinary key, for get value operation.  CFString to hold
 *    symbolic link information.  If the item is a symbolic link the
 *    string will contain the path to the item the link references.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in CoreServices.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
var kCFFTPResourceLink: CFStringRef; external name '_kCFFTPResourceLink'; (* attribute const *)


{
 *  kCFFTPResourceSize
 *
 *  Discussion:
 *    CFDictinary key, for get value operation.  CFNumber of
 *    kCFNumberLongLongType to hold the resource length in bytes.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in CoreServices.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
var kCFFTPResourceSize: CFStringRef; external name '_kCFFTPResourceSize'; (* attribute const *)


{
 *  kCFFTPResourceType
 *
 *  Discussion:
 *    CFDictinary key, for get value operation.  CFNumber to hold the
 *    resource type as defined in sys/dirent.h.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in CoreServices.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
var kCFFTPResourceType: CFStringRef; external name '_kCFFTPResourceType'; (* attribute const *)


{
 *  kCFFTPResourceModDate
 *
 *  Discussion:
 *    CFDictinary key, for get value operation.  CFDate to hold the
 *    last modification date and time information.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in CoreServices.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
var kCFFTPResourceModDate: CFStringRef; external name '_kCFFTPResourceModDate'; (* attribute const *)


{
 *  CFReadStreamCreateWithFTPURL()
 *
 *  Discussion:
 *    Create an FTP read stream for downloading operation from an FTP
 *    URL. If the URL refers to a directory, the stream is a filtered
 *    line-at-a-time read stream corresponding to the listing results
 *    provided by the server. If it's a file, then the stream is a
 *    regular read stream providing the data for that file.
 *
 *  Mac OS X threading:
 *    Thread safe
 *
 *  Parameters:
 *
 *    alloc:
 *      A pointer to the CFAllocator which should be used to allocate
 *      memory for the CF read stream and its storage for values. If
 *      this reference is not a valid CFAllocator, the behavior is
 *      undefined.
 *
 *    ftpURL:
 *      A pointer to a CFURL structure created by CFURLCreateWithString
 *      function.  If this parameter is not a pointer to a valid CFURL
 *      structure, the behavior is undefined.
 *
 *  Result:
 *    A pointer to the CF read stream created, or NULL if failed. It is
 *    caller's responsibilty to release the memory allocated for the
 *    read stream.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in CoreServices.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function CFReadStreamCreateWithFTPURL( alloc: CFAllocatorRef; ftpURL: CFURLRef ): CFReadStreamRef; external name '_CFReadStreamCreateWithFTPURL';



{
 *  CFFTPCreateParsedResourceListing()
 *
 *  Discussion:
 *    Parse a line of file or folder listing of Unix format, and store
 *    the extracted result in a CFDictionary.
 *
 *  Mac OS X threading:
 *    Thread safe
 *
 *  Parameters:
 *
 *    alloc:
 *      A pointer to the CFAllocator which should be used to allocate
 *      memory for the CFDictionary to hold resource info.  If this
 *      reference is not a valid CFAllocator, the behavior is undefined.
 *
 *    buffer:
 *      A pointer to a buffer that may hold lines of resource listing,
 *      but only the first line starting from buffer[0] will be parsed
 *      each call.
 *
 *    bufferLength:
 *      The maximum buffer size in bytes started from the location
 *      pointed by "buffer."
 *
 *    parsed:
 *      A pointer to a CFDictionary pointer.  The dictionary holds the
 *      extracted resource information.  When parsing fails, a NULL
 *      pointer will be returned.  It is caller's responsibilty to
 *      release the memory allocated for the dictionary.
 *
 *  Result:
 *    The number of bytes consumed from buffer, 0 if there are not
 *    enough bytes, or -1 if a parse failure occurs.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in CoreServices.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function CFFTPCreateParsedResourceListing( alloc: CFAllocatorRef; buffer: UnivPtr; bufferLength: CFIndex; var parsed: CFDictionaryRef ): CFIndex; external name '_CFFTPCreateParsedResourceListing';



{
 *  CFWriteStreamCreateWithFTPURL()
 *
 *  Discussion:
 *    Create an FTP write stream for uploading operation to a FTP URL.
 *    If the URL specifies a directory, the open will be followed by a
 *    close event/state and the directory will have been created.
 *    Intermediary directory structure is not created.
 *
 *  Mac OS X threading:
 *    Thread safe
 *
 *  Parameters:
 *
 *    alloc:
 *      A pointer to the CFAllocator which should be used to allocate
 *      memory for the CF read stream and its storage for values. If
 *      this reference is not a valid CFAllocator, the behavior is
 *      undefined.
 *
 *    ftpURL:
 *      A pointer to a CFURL structure created by CFURLCreateWithString
 *      function.  If this parameter is not a pointer to a valid CFURL
 *      structure, the behavior is undefined.
 *
 *  Result:
 *    A pointer to the CF write stream created, or NULL if failed. It
 *    is caller's responsibilty to release the memory allocated for the
 *    write stream.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in CoreServices.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function CFWriteStreamCreateWithFTPURL( alloc: CFAllocatorRef; ftpURL: CFURLRef ): CFWriteStreamRef; external name '_CFWriteStreamCreateWithFTPURL';
{unit CFHTTPStream}
{$ALIGN MAC68K}






{
 *  kCFStreamErrorDomainHTTP
 *
 *  Availability:
 *    Mac OS X:         in version 10.1 and later in CoreServices.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER
var kCFStreamErrorDomainHTTP: SInt32; external name '_kCFStreamErrorDomainHTTP'; (* attribute const *)
type
    CFStreamErrorHTTP = SInt32;
const
  kCFStreamErrorHTTPParseFailure = -1;
  kCFStreamErrorHTTPRedirectionLoop = -2;
  kCFStreamErrorHTTPBadURL      = -3;

{ Value is a CFHTTPMessage with 0 bytes data. }
{
 *  kCFStreamPropertyHTTPResponseHeader
 *
 *  Availability:
 *    Mac OS X:         in version 10.1 and later in CoreServices.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER
var kCFStreamPropertyHTTPResponseHeader: CFStringRef; external name '_kCFStreamPropertyHTTPResponseHeader'; (* attribute const *)
{ Value is the CFURL from the final request; will only differ from the URL in the original request if an autoredirection has occurred. }
{
 *  kCFStreamPropertyHTTPFinalURL
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in CoreServices.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
var kCFStreamPropertyHTTPFinalURL: CFStringRef; external name '_kCFStreamPropertyHTTPFinalURL'; (* attribute const *)
{************************************}
{Set-able properties on HTTP streams }
{************************************}
{ HTTP proxy information is set the same way as SOCKS proxies (see CFSocketStream.h).
   Call CFReadStreamSetProperty() passing an HTTP stream and the property kCFStreamPropertyHTTPProxy.
   The value should be a CFDictionary that includes at least one Host/Port pair from the keys below.
   The dictionary returned by SystemConfiguration.framework can also be passed directly as the value }
{
 *  kCFStreamPropertyHTTPProxy
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in CoreServices.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
var kCFStreamPropertyHTTPProxy: CFStringRef; external name '_kCFStreamPropertyHTTPProxy'; (* attribute const *)
{
 *  kCFStreamPropertyHTTPProxyHost
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in CoreServices.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
var kCFStreamPropertyHTTPProxyHost: CFStringRef; external name '_kCFStreamPropertyHTTPProxyHost'; (* attribute const *)
{ matches kSCPropNetProxiesHTTPProxy; value should be a CFString}
{
 *  kCFStreamPropertyHTTPProxyPort
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in CoreServices.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
var kCFStreamPropertyHTTPProxyPort: CFStringRef; external name '_kCFStreamPropertyHTTPProxyPort'; (* attribute const *)
{ matches kSCPropNetProxiesHTTPPort; value should be a CFNumber }
{
 *  kCFStreamPropertyHTTPSProxyHost
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in CoreServices.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
var kCFStreamPropertyHTTPSProxyHost: CFStringRef; external name '_kCFStreamPropertyHTTPSProxyHost'; (* attribute const *)
{ matches kSCPropNetProxiesHTTPSProxy; value should be a CFString }
{
 *  kCFStreamPropertyHTTPSProxyPort
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in CoreServices.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
var kCFStreamPropertyHTTPSProxyPort: CFStringRef; external name '_kCFStreamPropertyHTTPSProxyPort'; (* attribute const *)
{ matches kSCPropNetProxiesHTTPSPort; value should be a CFNumber }
{ Value should be a CFBoolean }
{
 *  kCFStreamPropertyHTTPShouldAutoredirect
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in CoreServices.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
var kCFStreamPropertyHTTPShouldAutoredirect: CFStringRef; external name '_kCFStreamPropertyHTTPShouldAutoredirect'; (* attribute const *)
{ Value should be a CFBoolean.  If this property is set to true, an HTTP stream will look for an appropriate extant persistent connection to use, and if it finds none, will try to create one.  }
{
 *  kCFStreamPropertyHTTPAttemptPersistentConnection
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in CoreServices.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
var kCFStreamPropertyHTTPAttemptPersistentConnection: CFStringRef; external name '_kCFStreamPropertyHTTPAttemptPersistentConnection'; (* attribute const *)
{ Value is a CFNumber; this property can only be retrieved, not set.  The number returned is the number of bytes from the body of the request that have been written to the underlying socket }
{
 *  kCFStreamPropertyHTTPRequestBytesWrittenCount
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in CoreServices.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
var kCFStreamPropertyHTTPRequestBytesWrittenCount: CFStringRef; external name '_kCFStreamPropertyHTTPRequestBytesWrittenCount'; (* attribute const *)
{*******************}
{ Creation routines }
{*******************}
{ Creates a read stream for the response to the given request; when the stream is opened,
  it will begin transmitting the request.  The bytes returned are the pure body bytes; the response header has been parsed off.
  To retrieve the response header, ask for kCFStreamPropertyHTTPResponseHeader, above, any time after the first bytes arrive on
  the stream (or when stream end is reported, if there are no data bytes).
}
{
 *  CFReadStreamCreateForHTTPRequest()
 *
 *  Availability:
 *    Mac OS X:         in version 10.1 and later in CoreServices.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER
function CFReadStreamCreateForHTTPRequest( alloc: CFAllocatorRef; request: CFHTTPMessageRef ): CFReadStreamRef; external name '_CFReadStreamCreateForHTTPRequest';


{ Creates a read stream for the response to the given requestHeaders plus requestBody.  Use in preference to
  CFReadStreamCreateForHTTPRequest() when the body of the request is larger than you wish to be resident in memory.  Note that
  because streams cannot be reset, read streams created this way cannot have autoredirection enabled.  If the Content-Length
  header is set in requestHeaders, it is assumed that the caller got the length right and that requestBody will report
  end-of-stream after precisely Content-Length bytes have been read from it.  If the Content-Length header is not set, the
  chunked transfer-encoding will be added to requestHeaders, and bytes read from requestBody will be transmitted chunked.
  The body of requestHeaders is ignored.
}
{
 *  CFReadStreamCreateForStreamedHTTPRequest()
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in CoreServices.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
function CFReadStreamCreateForStreamedHTTPRequest( alloc: CFAllocatorRef; requestHeaders: CFHTTPMessageRef; requestBody: CFReadStreamRef ): CFReadStreamRef; external name '_CFReadStreamCreateForStreamedHTTPRequest';


{ Deprecated - Use the properties kCFStreamPropertyHTTPShouldAutoredirect and kCFStreamPropertyHTTPProxy above instead }
{
 *  CFHTTPReadStreamSetRedirectsAutomatically()
 *
 *  Availability:
 *    Mac OS X:         in version 10.1 and later in CoreServices.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER
procedure CFHTTPReadStreamSetRedirectsAutomatically( httpStream: CFReadStreamRef; shouldAutoRedirect: Boolean ); external name '_CFHTTPReadStreamSetRedirectsAutomatically';


{
 *  CFHTTPReadStreamSetProxy()
 *
 *  Availability:
 *    Mac OS X:         in version 10.1 and later in CoreServices.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER
procedure CFHTTPReadStreamSetProxy( httpStream: CFReadStreamRef; proxyHost: CFStringRef; proxyPort: CFIndex ); external name '_CFHTTPReadStreamSetProxy';
{unit CFHost}
{$ALIGN MAC68K}






{
 *  CFHostRef
 *
 *  Discussion:
 *    This is the type of a reference to a host name or address lookup.
 }
type
    CFHostRef    = ^SInt32; { an opaque 32-bit type }

{
 *  kCFStreamErrorDomainNetDB
 *
 *  Discussion:
 *    Errors listed in netdb.h
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in CoreServices.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
var kCFStreamErrorDomainNetDB: SInt32; external name '_kCFStreamErrorDomainNetDB'; (* attribute const *)


{
 *  kCFStreamErrorDomainSystemConfiguration
 *
 *  Discussion:
 *    Errors listed in SystemConfiguration/SystemConfiguration.h
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in CoreServices.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
var kCFStreamErrorDomainSystemConfiguration: SInt32; external name '_kCFStreamErrorDomainSystemConfiguration'; (* attribute const *)



{
 *  CFHostInfoType
 *
 *  Discussion:
 *    Host information types to be resolved.
 }
type
    CFHostInfoType = SInt32;
const
  {
   * Results value is a CFArray of CFData's (each being a struct
   * sockaddr)
   }
  kCFHostAddresses              = 0;

  {
   * Results value is a CFArray of CFString's
   }
  kCFHostNames                  = 1;

  {
   * Results value is a CFData wrapping SCNetworkConnectionFlags
   * (defined in SystemConfiguration/SCNetwork.h)
   }
  kCFHostReachability           = 2;


{
 *  CFHostClientContext
 *
 *  Discussion:
 *    Structure containing the user-defined data and callbacks for
 *    CFHost objects.
 }
type
    CFHostClientContext = record
        {
         * The version number of the structure type being passed in as a
         * parameter to the CFHost client function. Valid version number is
         * currently 0.
         }
        version: CFIndex;

        {
         * An arbitrary pointer to client-defined data, which can be
         * associated with the host and is passed to the callbacks.
         }
        info: Ptr;

        {
         * The callback used to add a retain for the host on the info pointer
         * for the life of the host, and may be used for temporary references
         * the host needs to take. This callback returns the actual info
         * pointer to store in the host, almost always just the pointer
         * passed as the parameter.
         }
        retain: CFAllocatorRetainCallBack;

        {
         * The callback used to remove a retain previously added for the host
         * on the info pointer.
         }
        release: CFAllocatorReleaseCallBack;

        {
         * The callback used to create a descriptive string representation of
         * the info pointer (or the data pointed to by the info pointer) for
         * debugging purposes. This is used by the CFCopyDescription()
         * function.
         }
        copyDescription: CFAllocatorCopyDescriptionCallBack;
    end;
    CFHostClientContextPtr = ^CFHostClientContext;

{
 *  CFHostClientCallBack
 *
 *  Discussion:
 *    Callback function which is called upon error or completion of an
 *    asynchronous resolve.
 *
 *  Parameters:
 *
 *    theHost:
 *      Host whose resolution is complete.
 *
 *    typeInfo:
 *      Enum representing which info resolution is complete.
 *
 *    error:
 *      Reference to an error structure if the resolution failed.
 *
 *    info:
 *      Client's info reference which was passed into the client
 *      context.
 }
type CFHostClientCallBack = procedure( theHost: CFHostRef; typeInfo: CFHostInfoType; const (*var*) error: CFStreamError; info: UnivPtr );


{
 *  CFHostGetTypeID()
 *
 *  Discussion:
 *    Returns the type identifier of all CFHost instances.
 *
 *  Mac OS X threading:
 *    Thread safe
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in CoreServices.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function CFHostGetTypeID: CFTypeID; external name '_CFHostGetTypeID';


{
 *  CFHostCreateWithName()
 *
 *  Discussion:
 *    Creates a new host object with the given name.
 *
 *  Mac OS X threading:
 *    Thread safe
 *
 *  Parameters:
 *
 *    allocator:
 *      The CFAllocator which should be used to allocate memory for the
 *      host. If this reference is not a valid CFAllocator, the
 *      behavior is undefined.
 *
 *    hostname:
 *      A CFStringRef representing the name of the host. Must be
 *      non-NULL.  If this If this reference is not a valid
 *      CFStringRef, the behavior is undefined.
 *
 *  Result:
 *    A valid CFHostRef which may now be resolved, or NULL if
 *    unsuccessful.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in CoreServices.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function CFHostCreateWithName( allocator: CFAllocatorRef; hostname: CFStringRef ): CFHostRef; external name '_CFHostCreateWithName';


{
 *  CFHostCreateWithAddress()
 *
 *  Discussion:
 *    Creates a new host object with the given address.
 *
 *  Mac OS X threading:
 *    Thread safe
 *
 *  Parameters:
 *
 *    allocator:
 *      The CFAllocator which should be used to allocate memory for the
 *      host. If this reference is not a valid CFAllocator, the
 *      behavior is undefined.
 *
 *    addr:
 *      A CFDataRef containing a struct sockaddr which is the address
 *      of the host. Must be non-NULL.  If this If this reference is
 *      not a valid CFDataRef, the behavior is undefined.
 *
 *  Result:
 *    A valid CFHostRef which may now be resolved, or NULL if
 *    unsuccessful.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in CoreServices.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function CFHostCreateWithAddress( allocator: CFAllocatorRef; addr: CFDataRef ): CFHostRef; external name '_CFHostCreateWithAddress';


{
 *  CFHostCreateCopy()
 *
 *  Discussion:
 *    Creates a new host object as a copy of host argument.
 *
 *  Mac OS X threading:
 *    Thread safe
 *
 *  Parameters:
 *
 *    alloc:
 *      The CFAllocator which should be used to allocate memory for the
 *      new host. If this reference is not a valid CFAllocator, the
 *      behavior is undefined.
 *
 *    host:
 *      A CFHostRef representing the original host. Must be non-NULL.
 *      If this If this reference is not a valid CFHostRef, the
 *      behavior is undefined.
 *
 *  Result:
 *    A valid CFHostRef which contains a copy of all previously
 *    resolved data from the original.  NULL is returned in the case of
 *    failure.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in CoreServices.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function CFHostCreateCopy( alloc: CFAllocatorRef; host: CFHostRef ): CFHostRef; external name '_CFHostCreateCopy';


{
 *  CFHostStartInfoResolution()
 *
 *  Discussion:
 *    Performs a lookup for the given host.  It will search for the
 *    requested information if there is no other active request.
 *    Previously cached information of the given type will be released.
 *
 *  Mac OS X threading:
 *    Thread safe
 *
 *  Parameters:
 *
 *    theHost:
 *      The CFHostRef which should be resolved. Must be non-NULL. If
 *      this reference is not a valid CFHostRef, the behavior is
 *      undefined.
 *
 *    info:
 *      The enum representing the type of information to be retrieved.
 *      If the value is not a valid type, the behavior is undefined.
 *
 *    error:
 *      A reference to a CFStreamError structure which will be filled
 *      with any error information should an error occur.  May be set
 *      to NULL if error information is not wanted.
 *
 *  Result:
 *    Returns TRUE on success and FALSE on failure.  In asynchronous
 *    mode, this function will return immediately.  In synchronous
 *    mode, it will block until the resolve has completed or until the
 *    resolve is cancelled.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in CoreServices.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function CFHostStartInfoResolution( theHost: CFHostRef; info: CFHostInfoType; error: CFStreamErrorPtr ): Boolean; external name '_CFHostStartInfoResolution';


{
 *  CFHostGetAddressing()
 *
 *  Discussion:
 *    Tries to retrieve the known addresses from the given host.
 *    Returns a CFArrayRef of addresses if known and there were some.
 *    NULL is returned otherwise.  Each address is a CFDataRef wrapping
 *    a struct sockaddr.
 *
 *  Mac OS X threading:
 *    Thread safe
 *    The function gets the data in a thread-safe manner, but the
 *    resulting data is not safe.  Since it is returned as a matter of
 *    a get opposed to a copy, the data is not safe if the host is
 *    being altered from another thread.
 *
 *  Parameters:
 *
 *    theHost:
 *      The CFHostRef which contains the relevant information. Must be
 *      non-NULL. If this reference is not a valid CFHostRef, the
 *      behavior is undefined.
 *
 *    hasBeenResolved:
 *      A reference to a Boolean which returns FALSE if the information
 *      was not available (e.g. CFHostStartInfoResolution has not been
 *      called), otherwise TRUE will be returned.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in CoreServices.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function CFHostGetAddressing( theHost: CFHostRef; var hasBeenResolved: Boolean ): CFArrayRef; external name '_CFHostGetAddressing';


{
 *  CFHostGetNames()
 *
 *  Discussion:
 *    Tries to retrieve the names/aliases from the given host. Returns
 *    a CFArrayRef of names for the given host.  NULL is returned
 *    otherwise.
 *
 *  Mac OS X threading:
 *    Thread safe
 *    The function gets the data in a thread-safe manner, but the
 *    resulting data is not safe.  Since it is returned as a matter of
 *    a get opposed to a copy, the data is not safe if the host is
 *    being altered from another thread.
 *
 *  Parameters:
 *
 *    theHost:
 *      The CFHostRef which contains the relevant information. Must be
 *      non-NULL. If this reference is not a valid CFHostRef, the
 *      behavior is undefined.
 *
 *    hasBeenResolved:
 *      A reference to a Boolean which returns FALSE if the information
 *      was not available (e.g. CFHostStartInfoResolution has not been
 *      called), otherwise TRUE will be returned.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in CoreServices.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function CFHostGetNames( theHost: CFHostRef; var hasBeenResolved: Boolean ): CFArrayRef; external name '_CFHostGetNames';


{
 *  CFHostGetReachability()
 *
 *  Discussion:
 *    Tries to retrieve the reachability of the given host. Returns a
 *    CFDataRef which wraps the reachability flags. NULL will be
 *    returned if the value has not been resolved. The possible values
 *    of these flags is declared in SystemConfiguration/SCNetwork.h.
 *    Returns FALSE if the information was not available, otherwise
 *    TRUE will be returned with the results containing the requested
 *    information.
 *
 *  Mac OS X threading:
 *    Thread safe
 *    The function gets the data in a thread-safe manner, but the
 *    resulting data is not safe.  Since it is returned as a matter of
 *    a get opposed to a copy, the data is not safe if the host is
 *    being altered from another thread.
 *
 *  Parameters:
 *
 *    theHost:
 *      The CFHostRef which contains the relevant information. Must be
 *      non-NULL. If this reference is not a valid CFHostRef, the
 *      behavior is undefined.
 *
 *    hasBeenResolved:
 *      A reference to a Boolean which returns FALSE if the information
 *      was not available (e.g. CFHostStartInfoResolution has not been
 *      called), otherwise TRUE will be returned.  can be NULL
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in CoreServices.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function CFHostGetReachability( theHost: CFHostRef; hasBeenResolved: BooleanPtr ): CFDataRef; external name '_CFHostGetReachability';


{
 *  CFHostCancelInfoResolution()
 *
 *  Discussion:
 *    Cancels an outstanding asynchronous or synchronous resolve.
 *
 *  Mac OS X threading:
 *    Thread safe
 *
 *  Parameters:
 *
 *    theHost:
 *      The CFHostRef which is currently resolving.  Must be non-NULL.
 *      If this reference is not a valid CFHostRef, the behavior is
 *      undefined.
 *
 *    info:
 *      The enum representing which resolution to be canceled.  If the
 *      value is not a valid type, the behavior is undefined.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in CoreServices.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
procedure CFHostCancelInfoResolution( theHost: CFHostRef; info: CFHostInfoType ); external name '_CFHostCancelInfoResolution';


{
 *  CFHostSetClient()
 *
 *  Discussion:
 *    Associates a client context and callback function with a
 *    CFHostRef.  This is required for asynchronous usage.  If not set,
 *    resolve will take place synchronously.
 *
 *  Mac OS X threading:
 *    Thread safe
 *
 *  Parameters:
 *
 *    theHost:
 *      The CFHostRef which is getting a client.  Must be non-NULL. If
 *      this reference is not a valid CFHostRef, the behavior is
 *      undefined.
 *
 *    clientCB:
 *      A CFHostClientCallBack which will be called when the resolve
 *      completes or is cancelled.  Use NULL to remove the client
 *      association with a host object.
 *
 *    clientContext:
 *      A CFHostClientContext which is used to set the contextual
 *      information associated with the host object.  The info pointer
 *      from the struct will be passed to the callback function. If
 *      setting a client, this value must be non-NULL.
 *
 *  Result:
 *    Returns TRUE if the procedure was a success, otherwise it returns
 *    FALSE.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in CoreServices.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function CFHostSetClient( theHost: CFHostRef; clientCB: CFHostClientCallBack; clientContext: CFHostClientContextPtr ): Boolean; external name '_CFHostSetClient';


{
 *  CFHostScheduleWithRunLoop()
 *
 *  Discussion:
 *    Schedules the given host on a run loop and mode so the client
 *    will receive its callbacks on that loop and mode.
 *
 *  Mac OS X threading:
 *    Thread safe
 *
 *  Parameters:
 *
 *    theHost:
 *      The CFHostRef which is being scheduled.  Must be non-NULL. If
 *      this reference is not a valid CFHostRef, the behavior is
 *      undefined.
 *
 *    runLoop:
 *      A CFRunLoopRef on which the host should be scheduled. Must be
 *      non-NULL.  If this reference is not a valid CFRunLoopRef, the
 *      behavior is undefined.
 *
 *    runLoopMode:
 *      A CFStringRef which is the mode in which the run loop will be
 *      running when notification occurs.  Must be non-NULL. If this
 *      reference is not a valid CFStringRef, the behavior is undefined.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in CoreServices.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
procedure CFHostScheduleWithRunLoop( theHost: CFHostRef; runLoop: CFRunLoopRef; runLoopMode: CFStringRef ); external name '_CFHostScheduleWithRunLoop';


{
 *  CFHostUnscheduleFromRunLoop()
 *
 *  Discussion:
 *    Unschedules the given host from a run loop and mode so the client
 *    will not receive its callbacks on that loop and mode.
 *
 *  Mac OS X threading:
 *    Thread safe
 *
 *  Parameters:
 *
 *    theHost:
 *      The CFHostRef which is being unscheduled.  Must be non-NULL. If
 *      this reference is not a valid CFHostRef, the behavior is
 *      undefined.
 *
 *    runLoop:
 *      A CFRunLoopRef on which the host is scheduled and should now be
 *      unscheduled.  Must be non-NULL.  If this reference is not a
 *      valid CFRunLoopRef, the behavior is undefined.
 *
 *    runLoopMode:
 *      A CFStringRef which is the mode in which the host is scheduled
 *      and should be unscheduled.  Must be non-NULL. If this reference
 *      is not a valid CFStringRef, the behavior is undefined.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in CoreServices.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
procedure CFHostUnscheduleFromRunLoop( theHost: CFHostRef; runLoop: CFRunLoopRef; runLoopMode: CFStringRef ); external name '_CFHostUnscheduleFromRunLoop';
{unit CFNetServices}
{$ALIGN MAC68K}





{
CFNetServices
Network Services is composed of two objects, a Network Service and
a Network Service Browser.  A Network Service represents a single
point service on the network.  Associated with a service is its name,
type of service, domain, port, and possibly protocol specific information
(for legacy protocols).  Services can be registered and resolved.
Registering a service advertises the service on the network, so other
computers can use the service.  Resolving a service performs a network
lookup in order to find the computer which has registered the service.
Lookup is contained by the services name, type of service, and the domain.
The port and address of the registered service will be returned.  Services
can be created or discovered.

Discovery of services takes place through the use of the Network Service
Browser.  Given a domain and a service type, the browser will search out
those services on the network.  The returned services can then be resolved
and then used.

Service type values are keywords as registered with IANA.  A list of values
may be retrieved from their web site at
<http://www.iana.org/assignments/port-numbers>.
}

{
 *  CFNetServiceRef
 *
 *  Discussion:
 *    This is the type of a reference to a service.  It may be used for
 *    registering or for resolving.
 }
type
    CFNetServiceRef                         = ^SInt32;

{
 *  CFNetServiceBrowserRef
 *
 *  Discussion:
 *    This is the type of a reference to a service or domain browser.
 *    It may be used for discovering services or domains.
 }
type
    CFNetServiceBrowserRef                          = ^SInt32;

{
 *  kCFStreamErrorDomainMach
 *
 *  Discussion:
 *    Errors reported by mach.  See <mach/error.h>
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in CoreServices.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
var kCFStreamErrorDomainMach: SInt32; external name '_kCFStreamErrorDomainMach'; (* attribute const *)


{
 *  kCFStreamErrorDomainNetServices
 *
 *  Discussion:
 *    Errors listed below
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in CoreServices.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
var kCFStreamErrorDomainNetServices: SInt32; external name '_kCFStreamErrorDomainNetServices'; (* attribute const *)



{
 *  CFNetServicesError
 *
 *  Discussion:
 *    Errors from the kCFStreamErrorDomainNetServices domain.
 }
type CFNetServicesError = SInt32;
const
  {
   * An error of unknown type has occured.
   }
  kCFNetServicesErrorUnknown    = -72000;

  {
   * The given registration has had a name collision.  Registration
   * should be cancelled and should try again probably with a different
   * name.
   }
  kCFNetServicesErrorCollision  = -72001;

  {
   * Not used
   }
  kCFNetServicesErrorNotFound   = -72002;

  {
   * There is already a register, resolve, or browse invoke on the
   * given object.
   }
  kCFNetServicesErrorInProgress = -72003;

  {
   * Not used
   }
  kCFNetServicesErrorBadArgument = -72004;

  {
   * The register, resolve, or browse on the object has been cancelled.
   }
  kCFNetServicesErrorCancel     = -72005;

  {
   * The given CFNetServiceBrowser has already been invalidated and can
   * no longer be used for browsing.
   }
  kCFNetServicesErrorInvalid    = -72006;


{
 *  CFNetServiceBrowser flags
 *
 *  Discussion:
 *    Result bit flags passed to CFNetServiceBrowserClientCallBack.
 }
const
    kCFNetServiceFlagMoreComing   = 1;    { Client will get another callback briefly and shouldn't do costly screen updates (or such). }
  kCFNetServiceFlagIsDomain     = 2;    { If off, the result is a service. }
  kCFNetServiceFlagIsRegistrationDomain = 4; { The result domain is the default registration domain. }
  kCFNetServiceFlagRemove       = 8;     { The result item should be removed and not added. }



{
 *  CFNetServiceClientContext
 *
 *  Discussion:
 *    Structure containing the user-defined data and callbacks for
 *    CFNetService and CFNetServiceBrowser objects.
 }
type CFNetServiceClientContext = record

  {
   * The version number of the structure type being passed in as a
   * parameter to the CFNetService(Browser) client function. Valid
   * version number is currently 0.
   }
  version: CFIndex;

  {
   * An arbitrary pointer to client-defined data, which can be
   * associated with the service/browser and is passed to the callbacks.
   }
  info: Ptr;

  {
   * The callback used to add a retain for the service/browser on the
   * info pointer for the life of the service/browser, and may be used
   * for temporary references the service/browser needs to take. This
   * callback returns the actual info pointer to store in the
   * service/browser, almost always just the pointer passed as the
   * parameter.
   }
  retain: CFAllocatorRetainCallBack;

  {
   * The callback used to remove a retain previously added for the
   * service/browser on the info pointer.
   }
  release: CFAllocatorReleaseCallBack;

  {
   * The callback used to create a descriptive string representation of
   * the info pointer (or the data pointed to by the info pointer) for
   * debugging purposes. This is used by the CFCopyDescription()
   * function.
   }
  copyDescription: CFAllocatorCopyDescriptionCallBack;
end;
CFNetServiceClientContextPtr = ^CFNetServiceClientContext;

{
 *  CFNetServiceClientCallBack
 *
 *  Discussion:
 *    Callback function which is called upon error or completion of
 *    resolve or register.  If resolving, the callback may be called
 *    multiple times, once for each resolved address.
 *
 *  Parameters:
 *
 *    theService:
 *      Service receiving the event.
 *
 *    error:
 *      Reference to an error structure if the event is a failure.
 *
 *    info:
 *      Client's info reference which was passed into the client
 *      context.
 }
    type
        CFNetServiceClientCallBack = procedure( service: CFNetServiceRef; var error: CFStreamError; info: Ptr );

{
 *  CFNetServiceBrowserClientCallBack
 *
 *  Discussion:
 *    Callback function which is called upon error or upon successful
 *    discovery of services or domains.
 *
 *  Parameters:
 *
 *    browser:
 *      CFNetServiceBrowser receiving the event.
 *
 *    flags:
 *      Bitwise flags indicating the event or further information about
 *      the event.
 *
 *    domainOrService:
 *      If searching for domains, a CFStringRef indicating the domain
 *      which was found or is going away.  If searching for services,
 *      the service which was found or is going away.
 *
 *    error:
 *      Reference to an error structure if the event is a failure.
 *
 *    info:
 *      Client's info reference which was passed into the client
 *      context.
 }
    type
        CFNetServiceBrowserClientCallBack = procedure( browser: CFNetServiceBrowserRef; flags: CFOptionFlags; domainOrService: CFTypeRef; var error: CFStreamError; info: Ptr );


{
 *  CFNetServiceGetTypeID()
 *
 *  Discussion:
 *    Returns the type identifier of all CFNetService instances.
 *
 *  Mac OS X threading:
 *    Thread safe
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in CoreServices.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
function CFNetServiceGetTypeID: CFTypeID; external name '_CFNetServiceGetTypeID';


{
 *  CFNetServiceBrowserGetTypeID()
 *
 *  Discussion:
 *    Returns the type identifier of all CFNetServiceBrowser instances.
 *
 *  Mac OS X threading:
 *    Thread safe
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in CoreServices.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
function CFNetServiceBrowserGetTypeID: CFTypeID; external name '_CFNetServiceBrowserGetTypeID';



{
 *  CFNetServiceCreate()
 *
 *  Discussion:
 *    Creates an instance of a Network Service.
 *
 *  Mac OS X threading:
 *    Thread safe
 *
 *  Parameters:
 *
 *    alloc:
 *      The CFAllocator which should be used to allocate memory for the
 *      service and its storage for values. If this reference is not a
 *      valid CFAllocator, the behavior is undefined.
 *
 *    domain:
 *      The network domain in which it is registered or will be
 *      registered. This value must be non-NULL.
 *
 *    serviceType:
 *      The type of service being registered or resolved on the
 *      network. This value must be non-NULL.
 *
 *    name:
 *      The name of the machine or application advertising the service.
 *       If this value is not unique, registering will eventually fail.
 *       This value must be non-NULL.  This value is usually displayed
 *      in a browser for the user.
 *
 *    port:
 *      The port on which the service is listening.  This must be
 *      non-zero for services which are to be registered.
 *
 *  Result:
 *    A valid CFNetService which may now be registered or resolved, or
 *    NULL if unsuccessful.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in CoreServices.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
function CFNetServiceCreate(alloc: CFAllocatorRef; domain: CFStringRef; typ: CFStringRef; name: CFStringRef; port: UInt32): CFNetServiceRef; external name '_CFNetServiceCreate';



{
 *  CFNetServiceCreateCopy()
 *
 *  Discussion:
 *    Creates a new CFNetService object as a copy of service argument.
 *
 *  Mac OS X threading:
 *    Thread safe
 *
 *  Parameters:
 *
 *    alloc:
 *      The CFAllocator which should be used to allocate memory for the
 *      new service. If this reference is not a valid CFAllocator, the
 *      behavior is undefined.
 *
 *    service:
 *      A CFNetServiceRef representing the original service. Must be
 *      non-NULL.  If this If this reference is not a valid
 *      CFNetServiceRef, the behavior is undefined.
 *
 *  Result:
 *    Returns a valid CFNetServiceRef which contains a copy of all
 *    previously resolved data from the original.  NULL is returned in
 *    the case of failure.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in CoreServices.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function CFNetServiceCreateCopy( alloc: CFAllocatorRef; service: CFNetServiceRef ): CFNetServiceRef; external name '_CFNetServiceCreateCopy';



{
 *  CFNetServiceGetDomain()
 *
 *  Discussion:
 *    Query a Network Service for its domain.
 *
 *  Mac OS X threading:
 *    Thread safe
 *    The function gets the data in a thread-safe manner, but the
 *    resulting data is not safe.  Since it is returned as a matter of
 *    a get opposed to a copy, the data is not safe if the service is
 *    being altered from another thread.
 *
 *  Parameters:
 *
 *    theService:
 *      The Network Service to be queried.  Must be non-NULL.
 *
 *  Result:
 *    CFStringRef which is the service's domain.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in CoreServices.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
function CFNetServiceGetDomain(theService: CFNetServiceRef): CFStringRef; external name '_CFNetServiceGetDomain';



{
 *  CFNetServiceGetType()
 *
 *  Discussion:
 *    Query a Network Service for its type.
 *
 *  Mac OS X threading:
 *    Thread safe
 *    The function gets the data in a thread-safe manner, but the
 *    resulting data is not safe.  Since it is returned as a matter of
 *    a get opposed to a copy, the data is not safe if the service is
 *    being altered from another thread.
 *
 *  Parameters:
 *
 *    theService:
 *      The Network Service to be queried.  Must be non-NULL.
 *
 *  Result:
 *    CFStringRef which is the service's service type.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in CoreServices.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
function CFNetServiceGetType(theService: CFNetServiceRef): CFStringRef; external name '_CFNetServiceGetType';



{
 *  CFNetServiceGetName()
 *
 *  Discussion:
 *    Query a Network Service for its name.
 *
 *  Mac OS X threading:
 *    Thread safe
 *    The function gets the data in a thread-safe manner, but the
 *    resulting data is not safe.  Since it is returned as a matter of
 *    a get opposed to a copy, the data is not safe if the service is
 *    being altered from another thread.
 *
 *  Parameters:
 *
 *    theService:
 *      The Network Service to be queried.  Must be non-NULL.
 *
 *  Result:
 *    CFStringRef which is the service's name.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in CoreServices.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
function CFNetServiceGetName(theService: CFNetServiceRef): CFStringRef; external name '_CFNetServiceGetName';



{
 *  CFNetServiceGetAddressing()
 *
 *  Discussion:
 *    Query a Network Service for its addressing.
 *
 *  Mac OS X threading:
 *    Thread safe
 *    The function gets the data in a thread-safe manner, but the
 *    resulting data is not safe.  Since it is returned as a matter of
 *    a get opposed to a copy, the data is not safe if the service is
 *    being altered from another thread.
 *
 *  Parameters:
 *
 *    theService:
 *      The Network Service to be queried.  Must be non-NULL.
 *
 *  Result:
 *    Returns NULL if the entity's addressing is not known (has not
 *    been resolved).  The array will contain a CFDataRef for each
 *    address resolved.  Each CFDataRef contains a struct sockaddr
 *    representing the address of the service.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in CoreServices.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
function CFNetServiceGetAddressing(theService: CFNetServiceRef): CFArrayRef; external name '_CFNetServiceGetAddressing';



{
 *  CFNetServiceGetProtocolSpecificInformation()
 *
 *  Discussion:
 *    Query a Network Service for its protocol specific information.
 *
 *  Mac OS X threading:
 *    Thread safe
 *    The function gets the data in a thread-safe manner, but the
 *    resulting data is not safe.  Since it is returned as a matter of
 *    a get opposed to a copy, the data is not safe if the service is
 *    being altered from another thread.
 *
 *  Parameters:
 *
 *    theService:
 *      The Network Service to be queried.  Must be non-NULL.
 *
 *  Result:
 *    Returns NULL if a resolve has not been performed or if
 *    CFNetServiceSetProtocolSpecificInformation has not been called.
 *    It will return a CFStringRef containing the specific information
 *    if there is some.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in CoreServices.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
function CFNetServiceGetProtocolSpecificInformation(theService: CFNetServiceRef): CFStringRef; external name '_CFNetServiceGetProtocolSpecificInformation';



{
 *  CFNetServiceSetProtocolSpecificInformation()
 *
 *  Discussion:
 *    Set a Network Service's protocol specific information.
 *
 *  Mac OS X threading:
 *    Thread safe
 *
 *  Parameters:
 *
 *    theService:
 *      The Network Service to be queried.  Must be non-NULL.
 *
 *    theInfo:
 *      The protocol specific information to be added.  Pass NULL to
 *      remove the information from the service.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in CoreServices.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
procedure CFNetServiceSetProtocolSpecificInformation(theService: CFNetServiceRef;theInfo: CFStringRef); external name '_CFNetServiceSetProtocolSpecificInformation';


{
 *  CFNetServiceRegister()
 *
 *  Discussion:
 *    Registers the entity on the network.  This requires that the
 *    service has a domain, a type, a name, and a port.  The service is
 *    registered on the network until this function returns or is
 *    cancelled by calling CFNetServiceCancel.  In synchronous mode,
 *    this function will block until there is an error or it is
 *    cancelled from another thread.  In asynchronous mode, this
 *    function returns immediately and the underlying network
 *    registration process will start.
 *
 *  Mac OS X threading:
 *    Thread safe
 *
 *  Parameters:
 *
 *    theService:
 *      The Network Service to register on the network.  Must be
 *      non-NULL.
 *
 *    error:
 *      A reference to an error struct which will be set to the error
 *      and domain of the error should one occur.  If the value of
 *      error is not desired, set to NULL.
 *
 *  Result:
 *    Returns FALSE if domain, type, name or port is NULL.  In
 *    synchronous mode, it will always return FALSE as a result of the
 *    error or the cancellation.  In asynchronous mode, it will return
 *    TRUE if the registration process could start.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in CoreServices.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
function CFNetServiceRegister(theService: CFNetServiceRef;error: CFStreamErrorPtr): Boolean; external name '_CFNetServiceRegister';


{
 *  CFNetServiceResolve()
 *
 *  Discussion:
 *    Resolves the addressing for the given service.  This requires
 *    that the service has a domain, a type, and a name.  The service
 *    is  resolved on the network until this function returns or is
 *    cancelled by calling CFNetServiceCancel. In synchronous mode,
 *    this function will block until there is an error or it is
 *    cancelled from another thread.  In asynchronous mode, this
 *    function returns immediately and the underlying network
 *    resolution process will start.
 *
 *  Mac OS X threading:
 *    Thread safe
 *
 *  Parameters:
 *
 *    theService:
 *      The Network Service to resolve on the network.  Must be
 *      non-NULL.
 *
 *    error:
 *      A reference to an error struct which will be set to the error
 *      and domain of the error should one occur.  If the value of
 *      error is not desired, set to NULL.
 *
 *  Result:
 *    Returns FALSE if domain, type, or name is NULL.  In synchronous
 *    mode, it will return FALSE as a result of an error or a
 *    cancellation.  It will return TRUE if the resolution does
 *    succeed.  In asynchronous mode, it will return TRUE if the
 *    resolution process could start.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in CoreServices.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
function CFNetServiceResolve(theService: CFNetServiceRef;error: CFStreamErrorPtr): Boolean; external name '_CFNetServiceResolve';



{
 *  CFNetServiceCancel()
 *
 *  Discussion:
 *    Cancels an outstanding request for registration or resolution.
 *
 *  Mac OS X threading:
 *    Thread safe
 *
 *  Parameters:
 *
 *    theService:
 *      The Network Service which is active.  Must be non-NULL.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in CoreServices.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
procedure CFNetServiceCancel(theService: CFNetServiceRef); external name '_CFNetServiceCancel';



{
 *  CFNetServiceSetClient()
 *
 *  Discussion:
 *    Sets up the service to be used in asynchronous mode.
 *    Notification of registration failure or resolution completion
 *    will occur through the given callback.  Once the client is set,
 *    the service must be scheduled on a runloop. The client callback
 *    will be triggered via one of the scheduled run loops; It is the
 *    caller's responsibility to ensure that at least one of the
 *    scheduled run loops is being run.  This call must be performed
 *    before calling CFNetServiceRegister or CFNetServiceResolve,
 *    otherwise it will return FALSE.  TRUE will be returned if the
 *    client could be set.
 *
 *  Mac OS X threading:
 *    Thread safe
 *
 *  Parameters:
 *
 *    theService:
 *      The service to set up for asynchronous mode.  Must be non-NULL.
 *
 *    clientCB:
 *      Function pointer will be called upon registration failure or
 *      upon resolution completion.  In the case of resolution, this
 *      callback may be called multiple times if there is more than one
 *      address for a service.  Passing NULL will remove the client
 *      from the entity and cancel any outstanding activity.
 *
 *    clientContext:
 *      Client contextual information to be used when calling clientCB.
 *      Passing NULL will remove the client from the entity and cancel
 *      any outstanding activity.
 *
 *  Result:
 *    Returns FALSE if the client could not be set, TRUE otherwise.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in CoreServices.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
function CFNetServiceSetClient(theService: CFNetServiceRef; clientCB: CFNetServiceClientCallBack; clientContext: CFNetServiceClientContextPtr): Boolean; external name '_CFNetServiceSetClient';


{
 *  CFNetServiceScheduleWithRunLoop()
 *
 *  Discussion:
 *    Schedule the given service on the given run loop and mode.
 *
 *  Mac OS X threading:
 *    Thread safe
 *
 *  Parameters:
 *
 *    theService:
 *      The service which is set up for asynchronous mode. Must be
 *      non-NULL.
 *
 *    runLoop:
 *      A reference to a runloop on which the service should be
 *      scheduled. Must be non-NULL.
 *
 *    runLoopMode:
 *      The mode on which to schedule the service.  Must be non-NULL.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in CoreServices.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
procedure CFNetServiceScheduleWithRunLoop(theService: CFNetServiceRef; runLoop: CFRunLoopRef; runLoopMode: CFStringRef); external name '_CFNetServiceScheduleWithRunLoop';


{
 *  CFNetServiceUnscheduleFromRunLoop()
 *
 *  Discussion:
 *    Unschedule the given service from the given run loop and mode.
 *
 *  Mac OS X threading:
 *    Thread safe
 *
 *  Parameters:
 *
 *    theService:
 *      The service which is set up for asynchronous mode.  Must be
 *      non-NULL.
 *
 *    runLoop:
 *      A reference to a runloop from which the service should be
 *      unscheduled.  Must be non-NULL.
 *
 *    runLoopMode:
 *      The mode from which to unschedule the service.  Must be
 *      non-NULL.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in CoreServices.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
procedure CFNetServiceUnscheduleFromRunLoop(theService: CFNetServiceRef; runLoop: CFRunLoopRef; runLoopMode: CFStringRef); external name '_CFNetServiceUnscheduleFromRunLoop';


{
 *  CFNetServiceBrowserCreate()
 *
 *  Discussion:
 *    Creates an instance of a browser object.
 *
 *  Mac OS X threading:
 *    Thread safe
 *
 *  Parameters:
 *
 *    alloc:
 *      The CFAllocator which should be used to allocate memory for the
 *      browser and its storage for values. If this reference is not a
 *      valid CFAllocator, the behavior is undefined.
 *
 *    clientCB:
 *      Function pointer that will be called as domains or services are
 *      found on the network.  Must be non-NULL.
 *
 *    clientContext:
 *      Client ontextual information to be used when calling clientCB.
 *      Must be non-NULL.
 *
 *  Result:
 *    Returns a new instance of a browser, or NULL if the instance
 *    could not be created.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in CoreServices.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
function CFNetServiceBrowserCreate(alloc: CFAllocatorRef; clientCB: CFNetServiceBrowserClientCallBack; var clientContext: CFNetServiceClientContext): CFNetServiceBrowserRef; external name '_CFNetServiceBrowserCreate';


{
 *  CFNetServiceBrowserInvalidate()
 *
 *  Discussion:
 *    Invalidates the given browser object so that it may no longer be
 *    scheduled and callback never be called.  This will also stop any
 *    searches currently in progress.
 *
 *  Parameters:
 *
 *    browser:
 *      Network Service Browser to invalidate.  Must be non-NULL.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in CoreServices.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
procedure CFNetServiceBrowserInvalidate(browser: CFNetServiceBrowserRef); external name '_CFNetServiceBrowserInvalidate';



{
 *  CFNetServiceBrowserSearchForDomains()
 *
 *  Discussion:
 *    Starts a search for domains.  The browser will either try to find
 *    "Browse" domains or will search for "Registration" domains.  If
 *    there is already an outstanding search, it will return FALSE.  In
 *    syncronous mode, this call blocks until the search is stopped.
 *    It will return FALSE if there is an error performing the search.
 *    It will return TRUE otherwise.  In asynchronous mode, this call
 *    will return TRUE or FALSE depending if the underlying network
 *    search could be started.
 *
 *  Mac OS X threading:
 *    Thread safe
 *
 *  Parameters:
 *
 *    browser:
 *      Network Service Browser to perform the search.  Must be
 *      non-NULL.
 *
 *    registrationDomains:
 *      FALSE if "Browse" domains are to be discovered. TRUE if only
 *      "Registration" domains are to be discovered.
 *
 *    error:
 *      A reference to an error struct which will be set to the error
 *      and domain of the error should one occur.  If the value of
 *      error is not desired, set to NULL.
 *
 *  Result:
 *    Returns FALSE if an error occurs during a synchronous search or
 *    if the search could not start.  It returns TRUE otherwise.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in CoreServices.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
function CFNetServiceBrowserSearchForDomains(browser: CFNetServiceBrowserRef; registrationDomains: Boolean; error: CFStreamErrorPtr): Boolean; external name '_CFNetServiceBrowserSearchForDomains';



{
 *  CFNetServiceBrowserSearchForServices()
 *
 *  Discussion:
 *    Starts a search for a service type on the given domain.  If there
 *    is already an outstanding search, it will return FALSE.  In
 *    syncronous mode, this call blocks until the search is stopped.
 *    It will return FALSE if there is an error performing the search
 *    or if there is some other error.  It will return TRUE otherwise.
 *    In asynchronous mode, this call will return TRUE or FALSE
 *    depending if the underlying network search could be instantiated.
 *
 *  Mac OS X threading:
 *    Thread safe
 *
 *  Parameters:
 *
 *    browser:
 *      Network Service Browser to perform the search.  Must be
 *      non-NULL.
 *
 *    domain:
 *      Network domain to search in order to find the service.  Must be
 *      non-NULL.
 *
 *    serviceType:
 *      Service type for which to search.  Must be non-NULL.
 *
 *    error:
 *      A reference to an error struct which will be set to the error
 *      and domain of the error should one occur.  If the value of
 *      error is not desired, set to NULL.
 *
 *  Result:
 *    Returns FALSE if an error occurs during a synchronous search or
 *    if the search could not start.  It returns TRUE otherwise.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in CoreServices.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
function CFNetServiceBrowserSearchForServices(browser: CFNetServiceBrowserRef; domain: CFStringRef; typ: CFStringRef; error: CFStreamErrorPtr): Boolean; external name '_CFNetServiceBrowserSearchForServices';


{
 *  CFNetServiceBrowserStopSearch()
 *
 *  Discussion:
 *    Stops an outstanding browser search.
 *
 *  Mac OS X threading:
 *    Thread safe
 *
 *  Parameters:
 *
 *    browser:
 *      Network Service Browser performing the search.  Must be
 *      non-NULL.
 *
 *    error:
 *      Error value to be returned in "error" in
 *      CFNetServiceBrowserStartServiceSearch if search is being
 *      performed in synchronous mode.  In this case, a non-zero of the
 *      error field of the struct will cause
 *      CFNetServiceBrowserStartServiceSearch to return FALSE. In
 *      asynchronous mode, the client call back will be called with
 *      this error.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in CoreServices.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
procedure CFNetServiceBrowserStopSearch(browser: CFNetServiceBrowserRef;var error: CFStreamError); external name '_CFNetServiceBrowserStopSearch';



{
 *  CFNetServiceBrowserScheduleWithRunLoop()
 *
 *  Discussion:
 *    Schedules the browser on a run loop and mode.  Use this to place
 *    the given browser into asynchronous mode.  The client callback
 *    will be triggered via one of the scheduled run loops; It is the
 *    caller's responsibility to ensure that at least one of the
 *    scheduled run loops is being run.
 *
 *  Mac OS X threading:
 *    Thread safe
 *
 *  Parameters:
 *
 *    browser:
 *      Network Service Browser to schedule.  Must be non-NULL.
 *
 *    runLoop:
 *      A reference to a runloop on which the browser should be
 *      scheduled.  Must be non-NULL.
 *
 *    runLoopMode:
 *      The mode on which to schedule the browser.  Must be non-NULL.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in CoreServices.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
procedure CFNetServiceBrowserScheduleWithRunLoop(browser: CFNetServiceBrowserRef; runLoop: CFRunLoopRef; runLoopMode: CFStringRef); external name '_CFNetServiceBrowserScheduleWithRunLoop';



{
 *  CFNetServiceBrowserUnscheduleFromRunLoop()
 *
 *  Discussion:
 *    Unschedules the browser from a run loop and mode.
 *
 *  Mac OS X threading:
 *    Thread safe
 *
 *  Parameters:
 *
 *    browser:
 *      Network Service Browser to unschedule.  Must be non-NULL.
 *
 *    runLoop:
 *      A reference to a runloop from which the browser should be
 *      unscheduled. Must be non-NULL.
 *
 *    runLoopMode:
 *      The mode from which to unschedule the browser.  Must be
 *      non-NULL.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in CoreServices.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
procedure CFNetServiceBrowserUnscheduleFromRunLoop(browser: CFNetServiceBrowserRef; runLoop: CFRunLoopRef; runLoopMode: CFStringRef); external name '_CFNetServiceBrowserUnscheduleFromRunLoop';
{unit CFSocketStream}
{$ALIGN MAC68K}






{
 *  kCFStreamErrorDomainSSL
 *
 *  Discussion:
 *    Errors located in Security/SecureTransport.h
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
var kCFStreamErrorDomainSSL: SInt32; external name '_kCFStreamErrorDomainSSL'; (* attribute const *)


{
 *  kCFStreamPropertySocketSecurityLevel
 *
 *  Discussion:
 *    Stream property key, for both set and copy operations. To set a
 *    stream to be secure, call CFReadStreamSetProperty or
 *    CFWriteStreamSetPropertywith the property name set to
 *    kCFStreamPropertySocketSecurityLevel and the value being one of
 *    the following values.  Streams may set a security level after
 *    open in order to allow on-the-fly securing of a stream.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
var kCFStreamPropertySocketSecurityLevel: CFStringRef; external name '_kCFStreamPropertySocketSecurityLevel'; (* attribute const *)


{
 *  kCFStreamSocketSecurityLevelNone
 *
 *  Discussion:
 *    Stream property value, for both set and copy operations.
 *    Indicates to use no security (default setting).
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
var kCFStreamSocketSecurityLevelNone: CFStringRef; external name '_kCFStreamSocketSecurityLevelNone'; (* attribute const *)


{
 *  kCFStreamSocketSecurityLevelSSLv2
 *
 *  Discussion:
 *    Stream property value, for both set and copy operations.
 *    Indicates to use SSLv2 security.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
var kCFStreamSocketSecurityLevelSSLv2: CFStringRef; external name '_kCFStreamSocketSecurityLevelSSLv2'; (* attribute const *)


{
 *  kCFStreamSocketSecurityLevelSSLv3
 *
 *  Discussion:
 *    Stream property value, for both set and copy operations.
 *    Indicates to use SSLv3 security.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
var kCFStreamSocketSecurityLevelSSLv3: CFStringRef; external name '_kCFStreamSocketSecurityLevelSSLv3'; (* attribute const *)


{
 *  kCFStreamSocketSecurityLevelTLSv1
 *
 *  Discussion:
 *    Stream property value, for both set and copy operations.
 *    Indicates to use TLSv1 security.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
var kCFStreamSocketSecurityLevelTLSv1: CFStringRef; external name '_kCFStreamSocketSecurityLevelTLSv1'; (* attribute const *)


{
 *  kCFStreamSocketSecurityLevelNegotiatedSSL
 *
 *  Discussion:
 *    Stream property value, for both set and copy operations.
 *    Indicates to use TLS or SSL with fallback to lower versions. This
 *    is what HTTPS does, for instance.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
var kCFStreamSocketSecurityLevelNegotiatedSSL: CFStringRef; external name '_kCFStreamSocketSecurityLevelNegotiatedSSL'; (* attribute const *)


{
 *  kCFStreamErrorDomainSOCKS
 *
 *  Discussion:
 *    SOCKS proxy error domain.  Errors formulated using inlines below.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
var kCFStreamErrorDomainSOCKS: SInt32; external name '_kCFStreamErrorDomainSOCKS'; (* attribute const *)


(*
CF_INLINE
SInt32 CFSocketStreamSOCKSGetErrorSubdomain(CFStreamError* error) {
    return ((error->domain >> 16) & 0x0000FFFF);
}

CF_INLINE
SInt32 CFSocketStreamSOCKSGetError(CFStreamError* error) {
    return (error->domain & 0x0000FFFF);
}
*)

const
  kCFStreamErrorSOCKSSubDomainNone = 0; { Error code is a general SOCKS error }
  kCFStreamErrorSOCKSSubDomainVersionCode = 1; { Error code is the version of SOCKS which the server wishes to use }
  kCFStreamErrorSOCKS4SubDomainResponse = 2; { Error code is the status code returned by the server }
  kCFStreamErrorSOCKS5SubDomainUserPass = 3; { Error code is the status code that the server returned }
  kCFStreamErrorSOCKS5SubDomainMethod = 4; { Error code is the server's desired negotiation method }
  kCFStreamErrorSOCKS5SubDomainResponse = 5; { Error code is the response code that the server returned in reply to the connection request }


{ kCFStreamErrorSOCKSSubDomainNone}
const
  kCFStreamErrorSOCKS5BadResponseAddr = 1;
  kCFStreamErrorSOCKS5BadState  = 2;
  kCFStreamErrorSOCKSUnknownClientVersion = 3;

{ kCFStreamErrorSOCKS4SubDomainResponse}
const
  kCFStreamErrorSOCKS4RequestFailed = 91; { request rejected or failed }
  kCFStreamErrorSOCKS4IdentdFailed = 92; { request rejected because SOCKS server cannot connect to identd on the client }
  kCFStreamErrorSOCKS4IdConflict = 93;   { request rejected because the client program and identd report different user-ids }

{ kCFStreamErrorSOCKS5SubDomainMethod}
const
  kSOCKS5NoAcceptableMethod     = $0FF;  { other values indicate the server's desired method }


{
 *  kCFStreamPropertySOCKSProxy
 *
 *  Discussion:
 *    Stream property key, for both set and copy operations.  To set a
 *    stream to use a SOCKS proxy, call CFReadStreamSetProperty or
 *    CFWriteStreamSetProperty with the property name set to
 *    kCFStreamPropertySOCKSProxy and the value being a dictionary with
 *    at least the following two keys: kCFStreamPropertySOCKSProxyHost
 *    and kCFStreamPropertySOCKSProxyPort.  The dictionary returned by
 *    SystemConfiguration for SOCKS proxies will work without
 *    alteration.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
var kCFStreamPropertySOCKSProxy: CFStringRef; external name '_kCFStreamPropertySOCKSProxy'; (* attribute const *)

{
 *  kCFStreamPropertySOCKSProxyHost
 *
 *  Discussion:
 *    CFDictinary key for SOCKS proxy information.  The key
 *    kCFStreamPropertySOCKSProxyHost should contain a CFStringRef
 *    value representing the SOCKS proxy host.  Defined to match
 *    kSCPropNetProxiesSOCKSProxy
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
var kCFStreamPropertySOCKSProxyHost: CFStringRef; external name '_kCFStreamPropertySOCKSProxyHost'; (* attribute const *)

{
 *  kCFStreamPropertySOCKSProxyPort
 *
 *  Discussion:
 *    CFDictinary key for SOCKS proxy information.  The key
 *    kCFStreamPropertySOCKSProxyPort should contain a CFNumberRef
 *    which itself is of type kCFNumberSInt32Type.  This value should
 *    represent the port on which the proxy is listening.  Defined to
 *    match kSCPropNetProxiesSOCKSPort
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
var kCFStreamPropertySOCKSProxyPort: CFStringRef; external name '_kCFStreamPropertySOCKSProxyPort'; (* attribute const *)

{
 *  kCFStreamPropertySOCKSVersion
 *
 *  Discussion:
 *    CFDictinary key for SOCKS proxy information.  By default, SOCKS5
 *    will be used unless there is a kCFStreamPropertySOCKSVersion key
 *    in the dictionary.  Its value must be
 *    kCFStreamSocketSOCKSVersion4 or kCFStreamSocketSOCKSVersion5 to
 *    set SOCKS4 or SOCKS5, respectively.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
var kCFStreamPropertySOCKSVersion: CFStringRef; external name '_kCFStreamPropertySOCKSVersion'; (* attribute const *)

{
 *  kCFStreamSocketSOCKSVersion4
 *
 *  Discussion:
 *    CFDictionary value for SOCKS proxy information.  Indcates that
 *    SOCKS will or is using version 4 of the SOCKS protocol.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
var kCFStreamSocketSOCKSVersion4: CFStringRef; external name '_kCFStreamSocketSOCKSVersion4'; (* attribute const *)

{
 *  kCFStreamSocketSOCKSVersion5
 *
 *  Discussion:
 *    CFDictionary value for SOCKS proxy information.  Indcates that
 *    SOCKS will or is using version 5 of the SOCKS protocol.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
var kCFStreamSocketSOCKSVersion5: CFStringRef; external name '_kCFStreamSocketSOCKSVersion5'; (* attribute const *)

{
 *  kCFStreamPropertySOCKSUser
 *
 *  Discussion:
 *    CFDictinary key for SOCKS proxy information.  To set a user name
 *    and/or password, if required, the dictionary must contain the
 *    key(s) kCFStreamPropertySOCKSUser and/or
 *    kCFStreamPropertySOCKSPassword with the value being the user's
 *    name as a CFStringRef and/or the user's password as a
 *    CFStringRef, respectively.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
var kCFStreamPropertySOCKSUser: CFStringRef; external name '_kCFStreamPropertySOCKSUser'; (* attribute const *)

{
 *  kCFStreamPropertySOCKSPassword
 *
 *  Discussion:
 *    CFDictinary key for SOCKS proxy information.  To set a user name
 *    and/or password, if required, the dictionary must contain the
 *    key(s) kCFStreamPropertySOCKSUser and/or
 *    kCFStreamPropertySOCKSPassword with the value being the user's
 *    name as a CFStringRef and/or the user's password as a
 *    CFStringRef, respectively.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
var kCFStreamPropertySOCKSPassword: CFStringRef; external name '_kCFStreamPropertySOCKSPassword'; (* attribute const *)


{
 *  kCFStreamPropertyShouldCloseNativeSocket
 *
 *  Discussion:
 *    Set the value to kCFBooleanTrue if the stream should close and
 *    release the underlying native socket when the stream is released.
 *     Set the value to kCFBooleanFalse to keep the native socket from
 *    closing and releasing when the stream is released. If the stream
 *    was created with a native socket, the default property setting on
 *    the stream is kCFBooleanFalse. The
 *    kCFStreamPropertyShouldCloseNativeSocket can be set through
 *    CFReadStreamSetProperty or CFWriteStreamSetProperty.  The
 *    property can be copied through CFReadStreamCopyProperty or
 *    CFWriteStreamCopyProperty.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
var kCFStreamPropertyShouldCloseNativeSocket: CFStringRef; external name '_kCFStreamPropertyShouldCloseNativeSocket'; (* attribute const *)


{
 *  kCFStreamPropertySocketRemoteHost
 *
 *  Discussion:
 *    Stream property key for copy operations. Returns a CFHostRef if
 *    known, otherwise NULL.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in CoreServices.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
var kCFStreamPropertySocketRemoteHost: CFStringRef; external name '_kCFStreamPropertySocketRemoteHost'; (* attribute const *)


{
 *  kCFStreamPropertySocketRemoteNetService
 *
 *  Discussion:
 *    Stream property key for copy operations. Returns a
 *    CFNetServiceRef if known, otherwise NULL.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in CoreServices.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
var kCFStreamPropertySocketRemoteNetService: CFStringRef; external name '_kCFStreamPropertySocketRemoteNetService'; (* attribute const *)


{
 *  CFStreamCreatePairWithSocketToCFHost()
 *
 *  Discussion:
 *    Given a CFHostRef, this function will create a pair of streams
 *    suitable for connecting to the host.  If there is a failure
 *    during creation, the stream references will be set to NULL.
 *
 *  Mac OS X threading:
 *    Thread safe
 *
 *  Parameters:
 *
 *    alloc:
 *      The CFAllocator which should be used to allocate memory for the
 *      streams. If this reference is not a valid CFAllocator, the
 *      behavior is undefined.
 *
 *    host:
 *      A reference to a CFHost to which the streams are desired.  If
 *      unresolved, the host will be resolved prior to connecting.
 *
 *    port:
 *      The port to which the connection should be established.
 *
 *    readStream:
 *      A pointer to a CFReadStreamRef which will be set to the new
 *      read stream instance.  Can be set to NULL if not desired.
 *
 *    writeStream:
 *      A pointer to a CFWriteStreamRef which will be set to the new
 *      write stream instance.  Can be set to NULL if not desired.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in CoreServices.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
procedure CFStreamCreatePairWithSocketToCFHost( alloc: CFAllocatorRef; host: CFHostRef; port: UInt32; readStream: CFReadStreamRefPtr; writeStream: CFWriteStreamRefPtr ); external name '_CFStreamCreatePairWithSocketToCFHost';


{
 *  CFStreamCreatePairWithSocketToNetService()
 *
 *  Discussion:
 *    Given a CFNetService, this function will create a pair of streams
 *    suitable for connecting to the service.  If there is a failure
 *    during creation, the stream references will be set to NULL.
 *
 *  Mac OS X threading:
 *    Thread safe
 *
 *  Parameters:
 *
 *    alloc:
 *      The CFAllocator which should be used to allocate memory for the
 *      streams. If this reference is not a valid CFAllocator, the
 *      behavior is undefined.
 *
 *    service:
 *      A reference to a CFNetService to which the streams are desired.
 *       If unresolved, the service will be resolved prior to
 *      connecting.
 *
 *    readStream:
 *      A pointer to a CFReadStreamRef which will be set to the new
 *      read stream instance.  Can be set to NULL if not desired.
 *
 *    writeStream:
 *      A pointer to a CFWriteStreamRef which will be set to the new
 *      write stream instance.  Can be set to NULL if not desired.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in CoreServices.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
procedure CFStreamCreatePairWithSocketToNetService( alloc: CFAllocatorRef; service: CFNetServiceRef; readStream: CFReadStreamRefPtr; writeStream: CFWriteStreamRefPtr ); external name '_CFStreamCreatePairWithSocketToNetService';




{
 *  CFStreamSocketSecurityProtocol
 *
 *  Discussion:
 *    These enum values and CFSocketStreamPairSetSecurityProtocol have
 *    been deprecated in favor of CFReadStreamSetProperty and
 *    CFWriteStreamSetProperty with the previously mentioned property
 *    and values.
 }
type
    CFStreamSocketSecurityProtocol = SInt32;
const
  {
   * DEPRECATED, use kCFStreamSocketSecurityLevelNone
   }
  kCFStreamSocketSecurityNone   = 0;

  {
   * DEPRECATED, use kCFStreamSocketSecurityLevelSSLv2
   }
  kCFStreamSocketSecuritySSLv2  = 1;

  {
   * DEPRECATED, use kCFStreamSocketSecurityLevelSSLv3
   }
  kCFStreamSocketSecuritySSLv3  = 2;

  {
   * DEPRECATED, use kCFStreamSocketSecurityLevelNegotiatedSSL
   }
  kCFStreamSocketSecuritySSLv23 = 3;

  {
   * DEPRECATED, use kCFStreamSocketSecurityLevelTLSv1
   }
  kCFStreamSocketSecurityTLSv1  = 4;

{
 *  CFSocketStreamPairSetSecurityProtocol()   *** DEPRECATED ***
 *
 *  Discussion:
 *    CFSocketStreamPairSetSecurityProtocol has been deprecated in
 *    favor of CFReadStreamSetProperty and CFWriteStreamSetProperty
 *    with the previously mentioned property and values.  Sets the
 *    security level on a pair of streams.
 *
 *  Mac OS X threading:
 *    Thread safe
 *
 *  Parameters:
 *
 *    socketReadStream:
 *      Read stream reference which is to have its security level
 *      changed.
 *
 *    socketWriteStream:
 *      Write stream reference which is to have its security level
 *      changed.
 *
 *    securityProtocol:
 *      CFStreamSocketSecurityProtocol enum indicating the security
 *      level to be set.
 *
 *  Result:
 *    Returns TRUE if the settings were placed on the stream, FALSE
 *    otherwise.
 *
 *  Availability:
 *    Mac OS X:         in version 10.1 and later in CoreServices.framework but deprecated in 10.2
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_2
function CFSocketStreamPairSetSecurityProtocol( socketReadStream: CFReadStreamRef; socketWriteStream: CFWriteStreamRef; securityProtocol: CFStreamSocketSecurityProtocol ): Boolean; external name '_CFSocketStreamPairSetSecurityProtocol';
{unit CGContext}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}


type
    CGContextRef    = ^SInt32; { an opaque 32-bit type }
    CGContextRefPtr = ^CGContextRef;  { when a var xx:CGContextRef parameter can be nil, it is changed to xx: CGContextRefPtr }
    CGPatternRef    = ^SInt32; { an opaque 32-bit type }
    CGPatternRefPtr = ^CGPatternRef;  { when a var xx:CGPatternRef parameter can be nil, it is changed to xx: CGPatternRefPtr }
    {    Line join styles.  }
    CGLineJoin                  = SInt32;
const
    kCGLineJoinMiter            = 0;
    kCGLineJoinRound            = 1;
    kCGLineJoinBevel            = 2;

    {    Line cap styles.   }

type
    CGLineCap                   = SInt32;
const
    kCGLineCapButt              = 0;
    kCGLineCapRound             = 1;
    kCGLineCapSquare            = 2;

    {    Drawing modes for paths.   }

type
    CGPathDrawingMode           = SInt32;
const
    kCGPathFill                 = 0;
    kCGPathEOFill               = 1;
    kCGPathStroke               = 2;
    kCGPathFillStroke           = 3;
    kCGPathEOFillStroke         = 4;

    {    Drawing modes for text.    }

type
    CGTextDrawingMode           = SInt32;
const
    kCGTextFill                 = 0;
    kCGTextStroke               = 1;
    kCGTextFillStroke           = 2;
    kCGTextInvisible            = 3;
    kCGTextFillClip             = 4;
    kCGTextStrokeClip           = 5;
    kCGTextFillStrokeClip       = 6;
    kCGTextClip                 = 7;

    {    Text encodings.    }

type
    CGTextEncoding              = SInt32;
const
    kCGEncodingFontSpecific     = 0;
    kCGEncodingMacRoman         = 1;


type
    CGInterpolationQuality      = SInt32;
const
    kCGInterpolationDefault     = 0;                            {  Let the context decide.  }
    kCGInterpolationNone        = 1;                            {  Never interpolate.  }
    kCGInterpolationLow         = 2;                            {  Fast, low quality.  }
    kCGInterpolationHigh        = 3;                            {  Slow, high quality.  }


    {   * Graphics state functions. *   }
    {    Push a copy of the current graphics state onto the graphics state
     * stack. Note that the path is not considered part of the gstate, and is
     * not saved.   }
    {
     *  CGContextSaveGState()
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        not available
     *    Mac OS X:         in version 10.0 and later
        }
procedure CGContextSaveGState(ctx: CGContextRef); external name '_CGContextSaveGState';

{ Restore the current graphics state from the one on the top of the
 * graphics state stack, popping the graphics state stack in the
 * process. }
{
 *  CGContextRestoreGState()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
procedure CGContextRestoreGState(ctx: CGContextRef); external name '_CGContextRestoreGState';

{* Coordinate space transformations. *}
{ Scale the current graphics state's transformation matrix (the CTM) by
 * `(sx, sy)'. }
{
 *  CGContextScaleCTM()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
procedure CGContextScaleCTM(ctx: CGContextRef; sx: Single; sy: Single); external name '_CGContextScaleCTM';

{ Translate the current graphics state's transformation matrix (the CTM)
 * by `(tx, ty)'. }
{
 *  CGContextTranslateCTM()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
procedure CGContextTranslateCTM(ctx: CGContextRef; tx: Single; ty: Single); external name '_CGContextTranslateCTM';

{ Rotate the current graphics state's transformation matrix (the CTM) by
 * `angle' radians. }
{
 *  CGContextRotateCTM()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
procedure CGContextRotateCTM(ctx: CGContextRef; angle: Single); external name '_CGContextRotateCTM';

{ Concatenate the current graphics state's transformation matrix (the CTM)
 * with the affine transform `transform'. }
{
 *  CGContextConcatCTM()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
procedure CGContextConcatCTM(ctx: CGContextRef; transform: CGAffineTransform); external name '_CGContextConcatCTM';

{ Return the current graphics state's transformation matrix. }
{
 *  CGContextGetCTM()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGContextGetCTM(ctx: CGContextRef): CGAffineTransform; external name '_CGContextGetCTM';

{* Drawing attribute functions. *}
{ Set the line width in the current graphics state to `width'. }
{
 *  CGContextSetLineWidth()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
procedure CGContextSetLineWidth(ctx: CGContextRef; width: Single); external name '_CGContextSetLineWidth';

{ Set the line cap in the current graphics state to `cap'. }
{
 *  CGContextSetLineCap()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
procedure CGContextSetLineCap(ctx: CGContextRef; cap: CGLineCap); external name '_CGContextSetLineCap';

{ Set the line join in the current graphics state to `join'. }
{
 *  CGContextSetLineJoin()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
procedure CGContextSetLineJoin(ctx: CGContextRef; join: CGLineJoin); external name '_CGContextSetLineJoin';

{ Set the miter limit in the current graphics state to `limit'. }
{
 *  CGContextSetMiterLimit()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
procedure CGContextSetMiterLimit(ctx: CGContextRef; limit: Single); external name '_CGContextSetMiterLimit';

{ Set the line dash patttern in the current graphics state. }
{
 *  CGContextSetLineDash()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
procedure CGContextSetLineDash(ctx: CGContextRef; phase: Single; lengths: SinglePtr; count: size_t); external name '_CGContextSetLineDash';

{ Set the path flatness parameter in the current graphics state to
 * `flatness'. }
{
 *  CGContextSetFlatness()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
procedure CGContextSetFlatness(ctx: CGContextRef; flatness: Single); external name '_CGContextSetFlatness';

{ Set the alpha value in the current graphics state to `alpha'. }
{
 *  CGContextSetAlpha()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
procedure CGContextSetAlpha(ctx: CGContextRef; alpha: Single); external name '_CGContextSetAlpha';

{* Path construction functions. *}
{ Note that a context has a single path in use at any time: a path is not
 * part of the graphics state. }
{ Begin a new path.  The old path is discarded. }
{
 *  CGContextBeginPath()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
procedure CGContextBeginPath(ctx: CGContextRef); external name '_CGContextBeginPath';

{ Start a new subpath at point `(x, y)' in the context's path. }
{
 *  CGContextMoveToPoint()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
procedure CGContextMoveToPoint(ctx: CGContextRef; x: Single; y: Single); external name '_CGContextMoveToPoint';

{ Append a straight line segment from the current point to `(x, y)'. }
{
 *  CGContextAddLineToPoint()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
procedure CGContextAddLineToPoint(ctx: CGContextRef; x: Single; y: Single); external name '_CGContextAddLineToPoint';

{ Append a cubic Bezier curve from the current point to `(x,y)', with
 * control points `(cp1x, cp1y)' and `(cp2x, cp2y)'. }
{
 *  CGContextAddCurveToPoint()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
procedure CGContextAddCurveToPoint(ctx: CGContextRef; cp1x: Single; cp1y: Single; cp2x: Single; cp2y: Single; x: Single; y: Single); external name '_CGContextAddCurveToPoint';

{ Append a quadratic curve from the current point to `(x, y)', with
 * control point `(cpx, cpy)'. }
{
 *  CGContextAddQuadCurveToPoint()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
procedure CGContextAddQuadCurveToPoint(ctx: CGContextRef; cpx: Single; cpy: Single; x: Single; y: Single); external name '_CGContextAddQuadCurveToPoint';

{ Close the current subpath of the context's path. }
{
 *  CGContextClosePath()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
procedure CGContextClosePath(ctx: CGContextRef); external name '_CGContextClosePath';

{* Path construction convenience functions. *}
{ Add a single rect to the context's path. }
{
 *  CGContextAddRect()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
procedure CGContextAddRect(ctx: CGContextRef; rect: CGRect); external name '_CGContextAddRect';

{ Add a set of rects to the context's path. }
{
 *  CGContextAddRects()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
procedure CGContextAddRects(ctx: CGContextRef; const (*var*) rects: CGRect; count: size_t); external name '_CGContextAddRects';

{ Add a set of lines to the context's path. }
{
 *  CGContextAddLines()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
procedure CGContextAddLines(ctx: CGContextRef; const (*var*) points: CGPoint; count: size_t); external name '_CGContextAddLines';

{ Add an arc of a circle to the context's path, possibly preceded by a
 * straight line segment.  `(x, y)' is the center of the arc; `radius' is
 * its radius; `startAngle' is the angle to the first endpoint of the arc;
 * `endAngle' is the angle to the second endpoint of the arc; and
 * `clockwise' is 1 if the arc is to be drawn clockwise, 0 otherwise.
 * `startAngle' and `endAngle' are measured in radians. }
{
 *  CGContextAddArc()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
procedure CGContextAddArc(ctx: CGContextRef; x: Single; y: Single; radius: Single; startAngle: Single; endAngle: Single; clockwise: SInt32); external name '_CGContextAddArc';

{ Add an arc of a circle to the context's path, possibly preceded by a
 * straight line segment.  `radius' is the radius of the arc.  The arc is
 * tangent to the line from the current point to `(x1, y1)', and the line
 * from `(x1, y1)' to `(x2, y2)'. }
{
 *  CGContextAddArcToPoint()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
procedure CGContextAddArcToPoint(ctx: CGContextRef; x1: Single; y1: Single; x2: Single; y2: Single; radius: Single); external name '_CGContextAddArcToPoint';

{* Path information functions. *}
{ Return 1 if the context's path contains no elements, 0 otherwise. }
{
 *  CGContextIsPathEmpty()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGContextIsPathEmpty(ctx: CGContextRef): SInt32; external name '_CGContextIsPathEmpty';

{ Return the current point of the current subpath of the context's
 * path. }
{
 *  CGContextGetPathCurrentPoint()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGContextGetPathCurrentPoint(ctx: CGContextRef): CGPoint; external name '_CGContextGetPathCurrentPoint';

{ Return the bounding box of the context's path.  The bounding box is the
 * smallest rectangle completely enclosing all points in the path,
 * including control points for Bezier and quadratic curves. }
{
 *  CGContextGetPathBoundingBox()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGContextGetPathBoundingBox(ctx: CGContextRef): CGRect; external name '_CGContextGetPathBoundingBox';

{* Path drawing functions. *}
{ Draw the context's path using drawing mode `mode'. }
{
 *  CGContextDrawPath()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
procedure CGContextDrawPath(ctx: CGContextRef; mode: CGPathDrawingMode); external name '_CGContextDrawPath';

{* Path drawing convenience functions. *}
{ Fill the context's path using the winding-number fill rule.  Any open
 * subpath of the path is implicitly closed. }
{
 *  CGContextFillPath()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
procedure CGContextFillPath(ctx: CGContextRef); external name '_CGContextFillPath';

{ Fill the context's path using the even-odd fill rule.  Any open subpath
 * of the path is implicitly closed. }
{
 *  CGContextEOFillPath()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
procedure CGContextEOFillPath(ctx: CGContextRef); external name '_CGContextEOFillPath';

{ Stroke the context's path. }
{
 *  CGContextStrokePath()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
procedure CGContextStrokePath(ctx: CGContextRef); external name '_CGContextStrokePath';

{ Fill `rect' with the current fill color. }
{
 *  CGContextFillRect()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
procedure CGContextFillRect(ctx: CGContextRef; rect: CGRect); external name '_CGContextFillRect';

{ Fill `rects', an array of `count' CGRects, with the current fill
 * color. }
{
 *  CGContextFillRects()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
procedure CGContextFillRects(ctx: CGContextRef; const (*var*) rects: CGRect; count: size_t); external name '_CGContextFillRects';

{ Stroke `rect' with the current stroke color and the current linewidth. }
{
 *  CGContextStrokeRect()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
procedure CGContextStrokeRect(ctx: CGContextRef; rect: CGRect); external name '_CGContextStrokeRect';

{ Stroke `rect' with the current stroke color, using `width' as the the
 * line width. }
{
 *  CGContextStrokeRectWithWidth()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
procedure CGContextStrokeRectWithWidth(ctx: CGContextRef; rect: CGRect; width: Single); external name '_CGContextStrokeRectWithWidth';

{ Clear `rect' (that is, set the region within the rect to
 * transparent). }
{
 *  CGContextClearRect()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
procedure CGContextClearRect(c: CGContextRef; rect: CGRect); external name '_CGContextClearRect';

{* Clipping functions. *}
{ Intersect the context's path with the current clip path and use the
 * resulting path as the clip path for subsequent rendering operations.
 * Use the winding-number fill rule for deciding what's inside the path. }
{
 *  CGContextClip()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
procedure CGContextClip(ctx: CGContextRef); external name '_CGContextClip';

{ Intersect the context's path with the current clip path and use the
 * resulting path as the clip path for subsequent rendering operations.
 * Use the even-odd fill rule for deciding what's inside the path. }
{
 *  CGContextEOClip()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
procedure CGContextEOClip(ctx: CGContextRef); external name '_CGContextEOClip';

{* Clipping convenience functions. *}
{ Intersect the current clipping path with `rect'.  Note that this
 * function resets the context's path to the empty path. }
{
 *  CGContextClipToRect()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
procedure CGContextClipToRect(ctx: CGContextRef; rect: CGRect); external name '_CGContextClipToRect';

{ Intersect the current clipping path with the clipping region formed by
 * creating a path consisting of all rects in `rects'.  Note that this
 * function resets the context's path to the empty path. }
{
 *  CGContextClipToRects()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
procedure CGContextClipToRects(ctx: CGContextRef; const (*var*) rects: CGRect; count: size_t); external name '_CGContextClipToRects';

{* Colorspace functions. *}
{ Set the components of the current fill color in the context `ctx' to the
 * values specifed by `components'.  The number of elements in `components'
 * must be one greater than the number of components in the current fill
 * colorspace (N color components + 1 alpha component).  The current fill
 * colorspace must not be a pattern colorspace. }
{
 *  CGContextSetFillColorSpace()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
procedure CGContextSetFillColorSpace(ctx: CGContextRef; colorspace: CGColorSpaceRef); external name '_CGContextSetFillColorSpace';

{ Set the components of the current fill color in the context `ctx' to the
 * values specifed by `components'.  The number of elements in `components'
 * must be one greater than the number of components in the current fill
 * colorspace (N color components + 1 alpha component).  The current fill
 * colorspace must not be a pattern colorspace. }
{
 *  CGContextSetStrokeColorSpace()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
procedure CGContextSetStrokeColorSpace(ctx: CGContextRef; colorspace: CGColorSpaceRef); external name '_CGContextSetStrokeColorSpace';

{* Color functions. *}
{ Set the components of the current fill color in the context `c' to the
 * values specifed by `components'.  The number of elements in `components'
 * must be one greater than the number of components in the current fill
 * colorspace (N color components + 1 alpha component).  The current fill
 * colorspace must not be a pattern colorspace. }
{
 *  CGContextSetFillColor()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
procedure CGContextSetFillColor(c: CGContextRef; components: SinglePtr); external name '_CGContextSetFillColor';

{ Set the components of the current stroke color in the context `c' to the
 * values specifed by `components'.  The number of elements in `components'
 * must be one greater than the number of components in the current stroke
 * colorspace (N color components + 1 alpha component).  The current stroke
 * colorspace must not be a pattern colorspace. }
{
 *  CGContextSetStrokeColor()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
procedure CGContextSetStrokeColor(c: CGContextRef; components: SinglePtr); external name '_CGContextSetStrokeColor';

{* Pattern functions. *}
{ Set the components of the current fill color in the context `c' to the
 * values specifed by `components', and set the current fill pattern to
 * `pattern'.  The number of elements in `components' must be one greater
 * than the number of components in the current fill colorspace (N color
 * components + 1 alpha component).  The current fill colorspace must be a
 * pattern colorspace. }
{
 *  CGContextSetFillPattern()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.1 and later
 }
procedure CGContextSetFillPattern(c: CGContextRef; pattern: CGPatternRef; components: SinglePtr); external name '_CGContextSetFillPattern';

{ Set the components of the current stroke color in the context `c' to the
 * values specifed by `components', and set the current stroke pattern to
 * `pattern'.  The number of elements in `components' must be one greater
 * than the number of components in the current stroke colorspace (N color
 * components + 1 alpha component).  The current stroke colorspace must be
 * a pattern colorspace. }
{
 *  CGContextSetStrokePattern()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.1 and later
 }
procedure CGContextSetStrokePattern(c: CGContextRef; pattern: CGPatternRef; components: SinglePtr); external name '_CGContextSetStrokePattern';


{* Color convenience functions. *}
{ Set the current fill colorspace in the context `c' to `DeviceGray' and
 * set the components of the current fill color to `(gray, alpha)'. }
{
 *  CGContextSetGrayFillColor()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
procedure CGContextSetGrayFillColor(ctx: CGContextRef; gray: Single; alpha: Single); external name '_CGContextSetGrayFillColor';

{ Set the current stroke colorspace in the context `c' to `DeviceGray' and
 * set the components of the current stroke color to `(gray, alpha)'. }
{
 *  CGContextSetGrayStrokeColor()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
procedure CGContextSetGrayStrokeColor(ctx: CGContextRef; gray: Single; alpha: Single); external name '_CGContextSetGrayStrokeColor';

{ Set the current fill colorspace in the context `c' to `DeviceRGB' and
 * set the components of the current fill color to `(red, green, blue,
 * alpha)'. }
{
 *  CGContextSetRGBFillColor()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
procedure CGContextSetRGBFillColor(ctx: CGContextRef; red: Single; green: Single; blue: Single; alpha: Single); external name '_CGContextSetRGBFillColor';

{ Set the current stroke colorspace in the context `c' to `DeviceRGB' and
 * set the components of the current stroke color to `(red, green, blue,
 * alpha)'. }
{
 *  CGContextSetRGBStrokeColor()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
procedure CGContextSetRGBStrokeColor(ctx: CGContextRef; red: Single; green: Single; blue: Single; alpha: Single); external name '_CGContextSetRGBStrokeColor';

{ Set the current fill colorspace in the context `c' to `DeviceCMYK' and
 * set the components of the current fill color to `(cyan, magenta, yellow,
 * black, alpha)'. }
{
 *  CGContextSetCMYKFillColor()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
procedure CGContextSetCMYKFillColor(ctx: CGContextRef; cyan: Single; magenta: Single; yellow: Single; black: Single; alpha: Single); external name '_CGContextSetCMYKFillColor';

{ Set the current stroke colorspace in the context `c' to `DeviceCMYK' and
 * set the components of the current stroke color to `(cyan, magenta,
 * yellow, black, alpha)'. }
{
 *  CGContextSetCMYKStrokeColor()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
procedure CGContextSetCMYKStrokeColor(ctx: CGContextRef; cyan: Single; magenta: Single; yellow: Single; black: Single; alpha: Single); external name '_CGContextSetCMYKStrokeColor';

{* Rendering intent. *}
{ Set the rendering intent in the graphics state to `intent'. }
{
 *  CGContextSetRenderingIntent()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
procedure CGContextSetRenderingIntent(c: CGContextRef; intent: CGColorRenderingIntent); external name '_CGContextSetRenderingIntent';

{* Image functions. *}
{ Draw `image' in the rectangular area specified by `rect'.  The image is
 * scaled, if necessary, to fit into `rect'. }
{
 *  CGContextDrawImage()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
procedure CGContextDrawImage(ctx: CGContextRef; rect: CGRect; image: CGImageRef); external name '_CGContextDrawImage';

{ Return the interpolation quality for image rendering of the context `c'.
 * The interpolation quality is a gstate-parameter which controls the level
 * of interpolation performed when an image is interpolated (for example,
 * when scaling the image). Note that it is merely a hint to the context:
 * not all contexts support all interpolation quality levels. }
{
 *  CGContextGetInterpolationQuality()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.1 and later
 }
function CGContextGetInterpolationQuality(c: CGContextRef): CGInterpolationQuality; external name '_CGContextGetInterpolationQuality';

{ Set the interpolation quality of the context `c' to `quality'. }
{
 *  CGContextSetInterpolationQuality()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.1 and later
 }
procedure CGContextSetInterpolationQuality(c: CGContextRef; quality: CGInterpolationQuality); external name '_CGContextSetInterpolationQuality';


{* Text functions. *}
{ Set the current character spacing in the context `ctx' to `spacing'.  The
 * character spacing is added to the displacement between the origin of one
 * character and the origin of the next. }
{
 *  CGContextSetCharacterSpacing()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
procedure CGContextSetCharacterSpacing(ctx: CGContextRef; spacing: Single); external name '_CGContextSetCharacterSpacing';

{ Set the user-space point at which text will be drawn to (x,y). }
{
 *  CGContextSetTextPosition()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
procedure CGContextSetTextPosition(ctx: CGContextRef; x: Single; y: Single); external name '_CGContextSetTextPosition';

{ Return the current user-space point at which text will be drawn to (x,y). }
{
 *  CGContextGetTextPosition()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGContextGetTextPosition(ctx: CGContextRef): CGPoint; external name '_CGContextGetTextPosition';

{ Set the text matrix to `transform'. }
{
 *  CGContextSetTextMatrix()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
procedure CGContextSetTextMatrix(ctx: CGContextRef; transform: CGAffineTransform); external name '_CGContextSetTextMatrix';

{ Return the text matrix. }
{
 *  CGContextGetTextMatrix()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGContextGetTextMatrix(ctx: CGContextRef): CGAffineTransform; external name '_CGContextGetTextMatrix';

{ Set the text drawing mode to `mode'. }
{
 *  CGContextSetTextDrawingMode()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
procedure CGContextSetTextDrawingMode(ctx: CGContextRef; mode: CGTextDrawingMode); external name '_CGContextSetTextDrawingMode';

{ Set the current font to `font'. }
{
 *  CGContextSetFont()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
procedure CGContextSetFont(ctx: CGContextRef; font: CGFontRef); external name '_CGContextSetFont';

{ Set the current font size to `size'. }
{
 *  CGContextSetFontSize()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
procedure CGContextSetFontSize(ctx: CGContextRef; size: Single); external name '_CGContextSetFontSize';


{ Attempts to find the font named `name'.  If successful, scales it to
 * `size' units in user space.  `textEncoding' specifies how to translate
 * from bytes to glyphs. }
{
 *  CGContextSelectFont()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
procedure CGContextSelectFont(ctx: CGContextRef; name: ConstCStringPtr; size: Single; textEncoding: CGTextEncoding); external name '_CGContextSelectFont';

{ Draw `string', a string of `length' bytes, at the point specified by the
 * current text matrix.  Each byte of the string is mapped through the
 * encoding vector of the current font to obtain the glyph to display. }
{
 *  CGContextShowText()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
procedure CGContextShowText(ctx: CGContextRef; cstring: ConstCStringPtr; length: size_t); external name '_CGContextShowText';

{ Draw the glyphs pointed to by `g', an array of `count' glyphs, at the
 * point specified by the current text matrix. }
{
 *  CGContextShowGlyphs()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
procedure CGContextShowGlyphs(ctx: CGContextRef; g: CGGlyphPtr; count: size_t); external name '_CGContextShowGlyphs';


{* Text convenience functions. *}
{ Draw `string', a string of `length' bytes, at the point `(x, y)',
 * specified in user space.  Each byte of the string is mapped through the
 * encoding vector of the current font to obtain the glyph to display. }
{
 *  CGContextShowTextAtPoint()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
procedure CGContextShowTextAtPoint(ctx: CGContextRef; x: Single; y: Single; cstring: ConstCStringPtr; length: size_t); external name '_CGContextShowTextAtPoint';

{ Display the glyphs pointed to by `g', an array of `count' glyph ids, at
 * the point `(x, y)', specified in user space. }
{
 *  CGContextShowGlyphsAtPoint()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
procedure CGContextShowGlyphsAtPoint(ctx: CGContextRef; x: Single; y: Single; g: CGGlyphPtr; count: size_t); external name '_CGContextShowGlyphsAtPoint';


{* PDF document functions. *}
{ Draw `page' in `document' in the rectangular area specified by `rect'.
 * The media box of the page is scaled, if necessary, to fit into
 * `rect'. }
{
 *  CGContextDrawPDFDocument()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
procedure CGContextDrawPDFDocument(ctx: CGContextRef; rect: CGRect; document: CGPDFDocumentRef; page: SInt32); external name '_CGContextDrawPDFDocument';

{* Page functions. *}
{ Begin a new page. }
{
 *  CGContextBeginPage()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
procedure CGContextBeginPage(ctx: CGContextRef; const (*var*) mediaBox: CGRect); external name '_CGContextBeginPage';

{ End the current page. }
{
 *  CGContextEndPage()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
procedure CGContextEndPage(ctx: CGContextRef); external name '_CGContextEndPage';

{* Context functions. *}
{ Increment the retain count of `ctx' and return it.  All contexts are
 * created with an initial retain count of 1. }
{
 *  CGContextRetain()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGContextRetain(ctx: CGContextRef): CGContextRef; external name '_CGContextRetain';

{ Decrement the retain count of `ctx'.  If the retain count reaches 0,
 * then free `ctx' and any associated resources. }
{
 *  CGContextRelease()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
procedure CGContextRelease(ctx: CGContextRef); external name '_CGContextRelease';

{ Flush all drawing to the destination. }
{
 *  CGContextFlush()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
procedure CGContextFlush(ctx: CGContextRef); external name '_CGContextFlush';

{ Synchronized drawing. }
{
 *  CGContextSynchronize()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
procedure CGContextSynchronize(ctx: CGContextRef); external name '_CGContextSynchronize';

{* Antialiasing functions. *}
{ Turn off antialiasing if `shouldAntialias' is zero; turn it on
 * otherwise.  This parameter is part of the graphics state. }
{
 *  CGContextSetShouldAntialias()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
procedure CGContextSetShouldAntialias(ctx: CGContextRef; shouldAntialias: SInt32); external name '_CGContextSetShouldAntialias';

{$ALIGN MAC68K}
{#POP}
{unit CGPDFContext}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}

{ Create a PDF context, using `consumer' for output. `mediaBox' is the
 * default page media bounding box; if NULL, then a default page size is
 * used.  `auxiliaryInfo' specifies additional information used by the PDF
 * context when generating the PDF file.  The keys and values in
 * `auxiliaryInfo' must be CFStrings.  The following keys are recognized:
 *   Key       Value
 *   --------  --------
 *   Title     The document's title.
 *   Author    The name of the person who created the document.
 *   Creator   If the document was converted to PDF from another format,
 *             the name of the application that created the original
 *             document from which it was converted.
 }
{
 *  CGPDFContextCreate()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGPDFContextCreate(consumer: CGDataConsumerRef; const (*var*) mediaBox: CGRect; auxiliaryInfo: CFDictionaryRef): CGContextRef; external name '_CGPDFContextCreate';

{ Convenience function: create a PDF context, writing to `url'. }
{
 *  CGPDFContextCreateWithURL()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGPDFContextCreateWithURL(url: CFURLRef; const (*var*) mediaBox: CGRect; auxiliaryInfo: CFDictionaryRef): CGContextRef; external name '_CGPDFContextCreateWithURL';

{$ALIGN MAC68K}
{#POP}
{unit CGPattern}
{$ALIGN MAC68K}










{ kCGPatternTilingNoDistortion: The pattern cell is not distorted when
 * painted, however the spacing between pattern cells may vary by as much
 * as 1 device pixel.
 *
 * kCGPatternTilingConstantSpacingMinimalDistortion: Pattern cells are
 * spaced consistently, however the pattern cell may be distorted by as
 * much as 1 device pixel when the pattern is painted.
 *
 * kCGPatternTilingConstantSpacing: Pattern cells are spaced consistently
 * as with kCGPatternTilingConstantSpacingMinimalDistortion, however the
 * pattern cell may be distorted additionally to permit a more efficient
 * implementation. }

{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}


type
    CGPatternTiling             = SInt32;
const
    kCGPatternTilingNoDistortion = 0;
    kCGPatternTilingConstantSpacingMinimalDistortion = 1;
    kCGPatternTilingConstantSpacing = 2;


    {    The drawing of the pattern is delegated to the callbacks.  The callbacks
     * may be called one or many times to draw the pattern.
     *
     * `version' is the version number of the structure passed in as a
     * parameter to the CGPattern creation functions. The structure defined
     * below is version 0.
     *
     * `drawPattern' should draw the pattern in the context `c'. `info' is the
     * parameter originally passed to the CGPattern creation functions.
     *
     * `releaseInfo' is called when the pattern is deallocated.     }

type
    CGDrawPatternProcPtr = procedure(info: UnivPtr; c: CGContextRef);

    CGReleaseInfoProcPtr = procedure(info: UnivPtr);

    CGPatternCallbacksPtr = ^CGPatternCallbacks;
    CGPatternCallbacks = record
        version:                UInt32;
        drawPattern:            CGDrawPatternProcPtr;
        releaseInfo:            CGReleaseInfoProcPtr;
    end;

    {    Create a pattern.  }
    {
     *  CGPatternCreate()
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        not available
     *    Mac OS X:         in version 10.1 and later
        }
function CGPatternCreate(info: UnivPtr; bounds: CGRect; matrix: CGAffineTransform; xStep: Single; yStep: Single; tiling: CGPatternTiling; isColored: SInt32; const (*var*) callbacks: CGPatternCallbacks): CGPatternRef; external name '_CGPatternCreate';

{ Increment the retain count of `pattern' and return it.  All patterns are
 * created with an initial retain count of 1. }
{
 *  CGPatternRetain()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.1 and later
 }
function CGPatternRetain(pattern: CGPatternRef): CGPatternRef; external name '_CGPatternRetain';

{ Decrement the retain count of `pattern'.  If the retain count reaches 0,
 * then free it and release any associated resources. }
{
 *  CGPatternRelease()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.1 and later
 }
procedure CGPatternRelease(pattern: CGPatternRef); external name '_CGPatternRelease';

{$ALIGN MAC68K}
{#POP}
{unit QDPictToCGContext}
{$ALIGN MAC68K}






type
    QDPictRef    = ^SInt32; { an opaque 32-bit type }

{
    Note: QuickDraw picture data typically comes in two forms: a PICT resource
    that begins the picture header data at the beginning of the resource and PICT
    files that begin with 512 bytes of arbitrary data, followed by
    the picture header data. For this reason, the routines that create a QDPictRef
    attempt to find the picture header data beginning at either the first byte
    of the data provided or at byte 513 of the data provided.

    Additionally the Picture Bounds must not be an empty rect.
}
{ Create a QDPict reference, using `provider' to obtain the QDPict's data.
 * It is assumed that either the first byte or the 513th byte of data
 * in the file referenced by the URL is the first byte of the
 * picture header. If the URL does not begin PICT data at one
 * of these places in the data fork then the QDPictRef returned will be NULL.
}
{
 *  QDPictCreateWithProvider()
 *
 *  Availability:
 *    Mac OS X:         in version 10.1 and later in ApplicationServices.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER
function QDPictCreateWithProvider( provider: CGDataProviderRef ): QDPictRef; external name '_QDPictCreateWithProvider';


{ Create a QDPict reference from `url'.
 * It is assumed that either the first byte or the 513th byte of data
 * in the file referenced by the URL is the first byte of the
 * picture header. If the URL does not begin PICT data at one
 * of these places in the data fork then the QDPictRef returned will be NULL.
}
{
 *  QDPictCreateWithURL()
 *
 *  Availability:
 *    Mac OS X:         in version 10.1 and later in ApplicationServices.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER
function QDPictCreateWithURL( url: CFURLRef ): QDPictRef; external name '_QDPictCreateWithURL';


{ Increment the retain count of `pictRef' and return it.  All
 * pictRefs are created with an initial retain count of 1. }
{
 *  QDPictRetain()
 *
 *  Availability:
 *    Mac OS X:         in version 10.1 and later in ApplicationServices.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER
function QDPictRetain( pictRef: QDPictRef ): QDPictRef; external name '_QDPictRetain';


{ Decrement the retain count of `pictRef'.  If the retain count reaches 0,
 * then free it and any associated resources. }
{
 *  QDPictRelease()
 *
 *  Availability:
 *    Mac OS X:         in version 10.1 and later in ApplicationServices.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER
procedure QDPictRelease( pictRef: QDPictRef ); external name '_QDPictRelease';


{ Return the Picture Bounds of the QuickDraw picture represented by `pictRef'. This
    rectangle is in the default user space with one unit = 1/72 inch.
}
{
 *  QDPictGetBounds()
 *
 *  Availability:
 *    Mac OS X:         in version 10.1 and later in ApplicationServices.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER
function QDPictGetBounds( pictRef: QDPictRef ): CGRect; external name '_QDPictGetBounds';


{ Return the resolution of the QuickDraw picture represented by `pictRef'.
    This data, together with the CGRect returned by QDPictGetBounds, can be
    used to compute the size of the picture in pixels, which is what QuickDraw
    really records into pictures.
}
{
 *  QDPictGetResolution()
 *
 *  Availability:
 *    Mac OS X:         in version 10.1 and later in ApplicationServices.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER
procedure QDPictGetResolution( pictRef: QDPictRef; var xRes, yRes: Float32 ); external name '_QDPictGetResolution';


{ Draw `pictRef' in the rectangular area specified by `rect'.
 * The PICT bounds of the page is scaled, if necessary, to fit into
 * `rect'. To get unscaled results, supply a rect the size of the rect
 * returned by QDPictGetBounds.
}
{
 *  QDPictDrawToCGContext()
 *
 *  Availability:
 *    Mac OS X:         in version 10.1 and later in ApplicationServices.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER
function QDPictDrawToCGContext( ctx: CGContextRef; rect: CGRect; pictRef: QDPictRef ): OSStatus; external name '_QDPictDrawToCGContext';
{unit Quickdraw}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}


const
    invalColReq                 = -1;                           { invalid color table request }

                                                                {  transfer modes  }
    srcCopy                     = 0;                            { the 16 transfer modes }
    srcOr                       = 1;
    srcXor                      = 2;
    srcBic                      = 3;
    notSrcCopy                  = 4;
    notSrcOr                    = 5;
    notSrcXor                   = 6;
    notSrcBic                   = 7;
    patCopy                     = 8;
    patOr                       = 9;
    patXor                      = 10;
    patBic                      = 11;
    notPatCopy                  = 12;
    notPatOr                    = 13;
    notPatXor                   = 14;
    notPatBic                   = 15;                           {  Special Text Transfer Mode  }
    grayishTextOr               = 49;
    hilitetransfermode          = 50;
    hilite                      = 50;                           {  Arithmetic transfer modes  }
    blend                       = 32;
    addPin                      = 33;
    addOver                     = 34;
    subPin                      = 35;
    addMax                      = 37;
    adMax                       = 37;
    subOver                     = 38;
    adMin                       = 39;
    ditherCopy                  = 64;                           {  Transparent mode constant  }
    transparent                 = 36;

    italicBit                   = 1;
    ulineBit                    = 2;
    outlineBit                  = 3;
    shadowBit                   = 4;
    condenseBit                 = 5;
    extendBit                   = 6;

                                                                {  QuickDraw color separation constants  }
    normalBit                   = 0;                            { normal screen mapping }
    inverseBit                  = 1;                            { inverse screen mapping }
    redBit                      = 4;                            { RGB additive mapping }
    greenBit                    = 3;
    blueBit                     = 2;
    cyanBit                     = 8;                            { CMYBk subtractive mapping }
    magentaBit                  = 7;
    yellowBit                   = 6;
    blackBit                    = 5;

    blackColor                  = 33;                           { colors expressed in these mappings }
    whiteColor                  = 30;
    redColor                    = 205;
    greenColor                  = 341;
    blueColor                   = 409;
    cyanColor                   = 273;
    magentaColor                = 137;
    yellowColor                 = 69;

    picLParen                   = 0;                            { standard picture comments }
    picRParen                   = 1;
    clutType                    = 0;                            { 0 if lookup table }
    fixedType                   = 1;                            { 1 if fixed table }
    directType                  = 2;                            { 2 if direct values }
    gdDevType                   = 0;                            { 0 = monochrome 1 = color }

    interlacedDevice            = 2;                            {  1 if single pixel lines look bad  }
    hwMirroredDevice            = 4;                            {  1 if device is HW mirrored  }
    roundedDevice               = 5;                            {  1 if device has been ÒroundedÓ into the GrayRgn  }
    hasAuxMenuBar               = 6;                            {  1 if device has an aux menu bar on it  }
    burstDevice                 = 7;
    ext32Device                 = 8;
    ramInit                     = 10;                           { 1 if initialized from 'scrn' resource }
    mainScreen                  = 11;                           {  1 if main screen  }
    allInit                     = 12;                           {  1 if all devices initialized  }
    screenDevice                = 13;                           { 1 if screen device [not used] }
    noDriver                    = 14;                           {  1 if no driver for this GDevice  }
    screenActive                = 15;                           { 1 if in use }
    hiliteBit                   = 7;                            { flag bit in LMGet/SetHiliteMode }
    pHiliteBit                  = 0;                            { flag bit in LMGet/SetHiliteMode when used with BitClr }
    defQDColors                 = 127;                          { resource ID of clut for default QDColors }
                                                                {  pixel type  }
    RGBDirect                   = 16;                           {  16 & 32 bits/pixel pixelType value  }
                                                                {  pmVersion values  }
    baseAddr32                  = 4;                            { pixmap base address is 32-bit address }


    sysPatListID                = 0;
    iBeamCursor                 = 1;
    crossCursor                 = 2;
    plusCursor                  = 3;
    watchCursor                 = 4;

    kQDGrafVerbFrame            = 0;
    kQDGrafVerbPaint            = 1;
    kQDGrafVerbErase            = 2;
    kQDGrafVerbInvert           = 3;
    kQDGrafVerbFill             = 4;



type
    GrafVerb                            = SInt8;

const
    chunky                      = 0;
    chunkyPlanar                = 1;
    planar                      = 2;


type
    PixelType                           = SInt8;
    Bits16                              = array [0..15] of SInt16;

    {   **************   IMPORTANT NOTE REGARDING Pattern  **************************************
       Patterns were originally defined as:

            C:          typedef unsigned char Pattern[8];
            Pascal:     Pattern = packed array [0..7] of 0..255;

       The old array definition of Pattern would cause 68000 based CPU's to crash in certain circum-
       stances. The new struct definition is safe, but may require source code changes to compile.

    ********************************************************************************************    }
    PatternPtr = ^Pattern;
    Pattern = record
        pat:                    packed array [0..7] of UInt8;
    end;

    PatPtr                              = ^Pattern;
    PatHandle                           = ^PatPtr;
    QDByte                              = SignedByte;
    QDPtr                               = Ptr;
    QDHandle                            = Handle;
    QDErr                               = SInt16;

const
    singleDevicesBit            = 0;
    dontMatchSeedsBit           = 1;
    allDevicesBit               = 2;

    singleDevices               = $01;
    dontMatchSeeds              = $02;
    allDevices                  = $04;


type
    DeviceLoopFlags                     = UInt32;
    {
        PrinterStatusOpcode.  For communication with downloading and printing services.
        }
    PrinterStatusOpcode                 = SInt32;

const
    kPrinterFontStatus          = 0;
    kPrinterScalingStatus       = 1;


type
    PrinterFontStatusPtr = ^PrinterFontStatus;
    PrinterFontStatus = record
        oResult:                SInt32;
        iFondID:                SInt16;
        iStyle:                 SInt8;
    end;

    PrinterScalingStatusPtr = ^PrinterScalingStatus;
    PrinterScalingStatus = record
        oScalingFactors:        Point;
    end;

    BitMapPtr = ^BitMap;
    BitMap = record
        baseAddr:               Ptr;
        rowBytes:               SInt16;
        bounds:                 Rect;
    end;

    BitMapHandle                        = ^BitMapPtr;
    CursorPtr = ^Cursor;
    Cursor = record
        data:                   Bits16;
        mask:                   Bits16;
        hotSpot:                Point;
    end;

    CursPtr                             = ^Cursor;
    CursHandle                          = ^CursPtr;
    PenStatePtr = ^PenState;
    PenState = record
        pnLoc:                  Point;
        pnSize:                 Point;
        pnMode:                 SInt16;
        pnPat:                  Pattern;
    end;

    RgnHandle    = ^SInt32; { an opaque 32-bit type }
    RgnHandlePtr = ^RgnHandle;  { when a var xx:RgnHandle parameter can be nil, it is changed to xx: RgnHandlePtr }

    PicturePtr = ^Picture;
    Picture = record
        picSize:                SInt16;
        picFrame:               Rect;
    end;

    PicPtr                              = ^Picture;
    PicHandle                           = ^PicPtr;
    MacPolygonPtr = ^MacPolygon;
    MacPolygon = record
        polySize:               SInt16;
        polyBBox:               Rect;
        polyPoints:             array [0..0] of Point;
    end;

    {
       The type name "Polygon" has a name space collision on Win32.
       Use MacPolygon to be cross-platfrom safe.
    }
    Polygon                             = MacPolygon;
    PolygonPtr                          = ^Polygon;

    PolyPtr                             = ^MacPolygon;
    PolyHandle                          = ^PolyPtr;
    QDTextProcPtr = procedure(byteCount: SInt16; textBuf: UnivPtr; numer: Point; denom: Point);

    QDLineProcPtr = procedure(newPt: Point);

    QDRectProcPtr = procedure(verb: GrafVerb; const (*var*) r: Rect);

    QDRRectProcPtr = procedure(verb: GrafVerb; const (*var*) r: Rect; ovalWidth: SInt16; ovalHeight: SInt16);

    QDOvalProcPtr = procedure(verb: GrafVerb; const (*var*) r: Rect);

    QDArcProcPtr = procedure(verb: GrafVerb; const (*var*) r: Rect; startAngle: SInt16; arcAngle: SInt16);

    QDPolyProcPtr = procedure(verb: GrafVerb; poly: PolyHandle);

    QDRgnProcPtr = procedure(verb: GrafVerb; rgn: RgnHandle);

    QDBitsProcPtr = procedure(const (*var*) srcBits: BitMap; const (*var*) srcRect: Rect; const (*var*) dstRect: Rect; mode: SInt16; maskRgn: RgnHandle);

    QDCommentProcPtr = procedure(kind: SInt16; dataSize: SInt16; dataHandle: Handle);

    QDTxMeasProcPtr = function(byteCount: SInt16; textAddr: UnivPtr; var numer: Point; var denom: Point; var info: FontInfo): SInt16;

    QDGetPicProcPtr = procedure(dataPtr: UnivPtr; byteCount: SInt16);

    QDPutPicProcPtr = procedure(dataPtr: UnivPtr; byteCount: SInt16);

    QDOpcodeProcPtr = procedure(const (*var*) fromRect: Rect; const (*var*) toRect: Rect; opcode: UInt16; version: SInt16);

    QDStdGlyphsProcPtr = function(dataStream: UnivPtr; size: ByteCount): OSStatus;

    QDJShieldCursorProcPtr = procedure(left: SInt16; top: SInt16; right: SInt16; bottom: SInt16);

    QDTextUPP = ^SInt32; { an opaque UPP }
    QDLineUPP = ^SInt32; { an opaque UPP }
    QDRectUPP = ^SInt32; { an opaque UPP }
    QDRRectUPP = ^SInt32; { an opaque UPP }
    QDOvalUPP = ^SInt32; { an opaque UPP }
    QDArcUPP = ^SInt32; { an opaque UPP }
    QDPolyUPP = ^SInt32; { an opaque UPP }
    QDRgnUPP = ^SInt32; { an opaque UPP }
    QDBitsUPP = ^SInt32; { an opaque UPP }
    QDCommentUPP = ^SInt32; { an opaque UPP }
    QDTxMeasUPP = ^SInt32; { an opaque UPP }
    QDGetPicUPP = ^SInt32; { an opaque UPP }
    QDPutPicUPP = ^SInt32; { an opaque UPP }
    QDOpcodeUPP = ^SInt32; { an opaque UPP }
    QDStdGlyphsUPP = ^SInt32; { an opaque UPP }
    QDJShieldCursorUPP = ^SInt32; { an opaque UPP }
    QDProcsPtr = ^QDProcs;
    QDProcs = record
        textProc:               QDTextUPP;
        lineProc:               QDLineUPP;
        rectProc:               QDRectUPP;
        rRectProc:              QDRRectUPP;
        ovalProc:               QDOvalUPP;
        arcProc:                QDArcUPP;
        polyProc:               QDPolyUPP;
        rgnProc:                QDRgnUPP;
        bitsProc:               QDBitsUPP;
        commentProc:            QDCommentUPP;
        txMeasProc:             QDTxMeasUPP;
        getPicProc:             QDGetPicUPP;
        putPicProc:             QDPutPicUPP;
    end;


const
    uppQDTextProcInfo = $00003F80;
    uppQDLineProcInfo = $000000C0;
    uppQDRectProcInfo = $00000340;
    uppQDRRectProcInfo = $00002B40;
    uppQDOvalProcInfo = $00000340;
    uppQDArcProcInfo = $00002B40;
    uppQDPolyProcInfo = $00000340;
    uppQDRgnProcInfo = $00000340;
    uppQDBitsProcInfo = $0000EFC0;
    uppQDCommentProcInfo = $00000E80;
    uppQDTxMeasProcInfo = $0000FFA0;
    uppQDGetPicProcInfo = $000002C0;
    uppQDPutPicProcInfo = $000002C0;
    uppQDOpcodeProcInfo = $00002BC0;
    uppQDStdGlyphsProcInfo = $000003F1;
    uppQDJShieldCursorProcInfo = $00002A80;
    {
     *  NewQDTextUPP()
     *
     *  Availability:
     *    Non-Carbon CFM:   available as macro/inline
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function NewQDTextUPP(userRoutine: QDTextProcPtr): QDTextUPP; external name '_NewQDTextUPP'; { old name was NewQDTextProc }
{
 *  NewQDLineUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewQDLineUPP(userRoutine: QDLineProcPtr): QDLineUPP; external name '_NewQDLineUPP'; { old name was NewQDLineProc }
{
 *  NewQDRectUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewQDRectUPP(userRoutine: QDRectProcPtr): QDRectUPP; external name '_NewQDRectUPP'; { old name was NewQDRectProc }
{
 *  NewQDRRectUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewQDRRectUPP(userRoutine: QDRRectProcPtr): QDRRectUPP; external name '_NewQDRRectUPP'; { old name was NewQDRRectProc }
{
 *  NewQDOvalUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewQDOvalUPP(userRoutine: QDOvalProcPtr): QDOvalUPP; external name '_NewQDOvalUPP'; { old name was NewQDOvalProc }
{
 *  NewQDArcUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewQDArcUPP(userRoutine: QDArcProcPtr): QDArcUPP; external name '_NewQDArcUPP'; { old name was NewQDArcProc }
{
 *  NewQDPolyUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewQDPolyUPP(userRoutine: QDPolyProcPtr): QDPolyUPP; external name '_NewQDPolyUPP'; { old name was NewQDPolyProc }
{
 *  NewQDRgnUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewQDRgnUPP(userRoutine: QDRgnProcPtr): QDRgnUPP; external name '_NewQDRgnUPP'; { old name was NewQDRgnProc }
{
 *  NewQDBitsUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewQDBitsUPP(userRoutine: QDBitsProcPtr): QDBitsUPP; external name '_NewQDBitsUPP'; { old name was NewQDBitsProc }
{
 *  NewQDCommentUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewQDCommentUPP(userRoutine: QDCommentProcPtr): QDCommentUPP; external name '_NewQDCommentUPP'; { old name was NewQDCommentProc }
{
 *  NewQDTxMeasUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewQDTxMeasUPP(userRoutine: QDTxMeasProcPtr): QDTxMeasUPP; external name '_NewQDTxMeasUPP'; { old name was NewQDTxMeasProc }
{
 *  NewQDGetPicUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewQDGetPicUPP(userRoutine: QDGetPicProcPtr): QDGetPicUPP; external name '_NewQDGetPicUPP'; { old name was NewQDGetPicProc }
{
 *  NewQDPutPicUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewQDPutPicUPP(userRoutine: QDPutPicProcPtr): QDPutPicUPP; external name '_NewQDPutPicUPP'; { old name was NewQDPutPicProc }
{
 *  NewQDOpcodeUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewQDOpcodeUPP(userRoutine: QDOpcodeProcPtr): QDOpcodeUPP; external name '_NewQDOpcodeUPP'; { old name was NewQDOpcodeProc }
{
 *  NewQDStdGlyphsUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewQDStdGlyphsUPP(userRoutine: QDStdGlyphsProcPtr): QDStdGlyphsUPP; external name '_NewQDStdGlyphsUPP'; { old name was NewQDStdGlyphsProc }
{
 *  NewQDJShieldCursorUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewQDJShieldCursorUPP(userRoutine: QDJShieldCursorProcPtr): QDJShieldCursorUPP; external name '_NewQDJShieldCursorUPP'; { old name was NewQDJShieldCursorProc }
{
 *  DisposeQDTextUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeQDTextUPP(userUPP: QDTextUPP); external name '_DisposeQDTextUPP';
{
 *  DisposeQDLineUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeQDLineUPP(userUPP: QDLineUPP); external name '_DisposeQDLineUPP';
{
 *  DisposeQDRectUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeQDRectUPP(userUPP: QDRectUPP); external name '_DisposeQDRectUPP';
{
 *  DisposeQDRRectUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeQDRRectUPP(userUPP: QDRRectUPP); external name '_DisposeQDRRectUPP';
{
 *  DisposeQDOvalUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeQDOvalUPP(userUPP: QDOvalUPP); external name '_DisposeQDOvalUPP';
{
 *  DisposeQDArcUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeQDArcUPP(userUPP: QDArcUPP); external name '_DisposeQDArcUPP';
{
 *  DisposeQDPolyUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeQDPolyUPP(userUPP: QDPolyUPP); external name '_DisposeQDPolyUPP';
{
 *  DisposeQDRgnUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeQDRgnUPP(userUPP: QDRgnUPP); external name '_DisposeQDRgnUPP';
{
 *  DisposeQDBitsUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeQDBitsUPP(userUPP: QDBitsUPP); external name '_DisposeQDBitsUPP';
{
 *  DisposeQDCommentUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeQDCommentUPP(userUPP: QDCommentUPP); external name '_DisposeQDCommentUPP';
{
 *  DisposeQDTxMeasUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeQDTxMeasUPP(userUPP: QDTxMeasUPP); external name '_DisposeQDTxMeasUPP';
{
 *  DisposeQDGetPicUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeQDGetPicUPP(userUPP: QDGetPicUPP); external name '_DisposeQDGetPicUPP';
{
 *  DisposeQDPutPicUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeQDPutPicUPP(userUPP: QDPutPicUPP); external name '_DisposeQDPutPicUPP';
{
 *  DisposeQDOpcodeUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeQDOpcodeUPP(userUPP: QDOpcodeUPP); external name '_DisposeQDOpcodeUPP';
{
 *  DisposeQDStdGlyphsUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeQDStdGlyphsUPP(userUPP: QDStdGlyphsUPP); external name '_DisposeQDStdGlyphsUPP';
{
 *  DisposeQDJShieldCursorUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeQDJShieldCursorUPP(userUPP: QDJShieldCursorUPP); external name '_DisposeQDJShieldCursorUPP';
{
 *  InvokeQDTextUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvokeQDTextUPP(byteCount: SInt16; textBuf: UnivPtr; numer: Point; denom: Point; userRoutine: QDTextUPP); external name '_InvokeQDTextUPP'; { old name was CallQDTextProc }
{
 *  InvokeQDLineUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvokeQDLineUPP(newPt: Point; userRoutine: QDLineUPP); external name '_InvokeQDLineUPP'; { old name was CallQDLineProc }
{
 *  InvokeQDRectUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvokeQDRectUPP(verb: GrafVerb; const (*var*) r: Rect; userRoutine: QDRectUPP); external name '_InvokeQDRectUPP'; { old name was CallQDRectProc }
{
 *  InvokeQDRRectUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvokeQDRRectUPP(verb: GrafVerb; const (*var*) r: Rect; ovalWidth: SInt16; ovalHeight: SInt16; userRoutine: QDRRectUPP); external name '_InvokeQDRRectUPP'; { old name was CallQDRRectProc }
{
 *  InvokeQDOvalUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvokeQDOvalUPP(verb: GrafVerb; const (*var*) r: Rect; userRoutine: QDOvalUPP); external name '_InvokeQDOvalUPP'; { old name was CallQDOvalProc }
{
 *  InvokeQDArcUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvokeQDArcUPP(verb: GrafVerb; const (*var*) r: Rect; startAngle: SInt16; arcAngle: SInt16; userRoutine: QDArcUPP); external name '_InvokeQDArcUPP'; { old name was CallQDArcProc }
{
 *  InvokeQDPolyUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvokeQDPolyUPP(verb: GrafVerb; poly: PolyHandle; userRoutine: QDPolyUPP); external name '_InvokeQDPolyUPP'; { old name was CallQDPolyProc }
{
 *  InvokeQDRgnUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvokeQDRgnUPP(verb: GrafVerb; rgn: RgnHandle; userRoutine: QDRgnUPP); external name '_InvokeQDRgnUPP'; { old name was CallQDRgnProc }
{
 *  InvokeQDBitsUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvokeQDBitsUPP(const (*var*) srcBits: BitMap; const (*var*) srcRect: Rect; const (*var*) dstRect: Rect; mode: SInt16; maskRgn: RgnHandle; userRoutine: QDBitsUPP); external name '_InvokeQDBitsUPP'; { old name was CallQDBitsProc }
{
 *  InvokeQDCommentUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvokeQDCommentUPP(kind: SInt16; dataSize: SInt16; dataHandle: Handle; userRoutine: QDCommentUPP); external name '_InvokeQDCommentUPP'; { old name was CallQDCommentProc }
{
 *  InvokeQDTxMeasUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeQDTxMeasUPP(byteCount: SInt16; textAddr: UnivPtr; var numer: Point; var denom: Point; var info: FontInfo; userRoutine: QDTxMeasUPP): SInt16; external name '_InvokeQDTxMeasUPP'; { old name was CallQDTxMeasProc }
{
 *  InvokeQDGetPicUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvokeQDGetPicUPP(dataPtr: UnivPtr; byteCount: SInt16; userRoutine: QDGetPicUPP); external name '_InvokeQDGetPicUPP'; { old name was CallQDGetPicProc }
{
 *  InvokeQDPutPicUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvokeQDPutPicUPP(dataPtr: UnivPtr; byteCount: SInt16; userRoutine: QDPutPicUPP); external name '_InvokeQDPutPicUPP'; { old name was CallQDPutPicProc }
{
 *  InvokeQDOpcodeUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvokeQDOpcodeUPP(const (*var*) fromRect: Rect; const (*var*) toRect: Rect; opcode: UInt16; version: SInt16; userRoutine: QDOpcodeUPP); external name '_InvokeQDOpcodeUPP'; { old name was CallQDOpcodeProc }
{
 *  InvokeQDStdGlyphsUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeQDStdGlyphsUPP(dataStream: UnivPtr; size: ByteCount; userRoutine: QDStdGlyphsUPP): OSStatus; external name '_InvokeQDStdGlyphsUPP'; { old name was CallQDStdGlyphsProc }
{
 *  InvokeQDJShieldCursorUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvokeQDJShieldCursorUPP(left: SInt16; top: SInt16; right: SInt16; bottom: SInt16; userRoutine: QDJShieldCursorUPP); external name '_InvokeQDJShieldCursorUPP'; { old name was CallQDJShieldCursorProc }

type
    WindowPtr    = ^SInt32; { an opaque 32-bit type }
    WindowPtrPtr = ^WindowPtr;  { when a var xx:WindowPtr parameter can be nil, it is changed to xx: WindowPtrPtr }
    DialogPtr    = ^SInt32; { an opaque 32-bit type }
    DialogPtrPtr = ^DialogPtr;  { when a var xx:DialogPtr parameter can be nil, it is changed to xx: DialogPtrPtr }
    GrafPtr    = ^SInt32; { an opaque 32-bit type }
    GrafPtrPtr = ^GrafPtr;  { when a var xx:GrafPtr parameter can be nil, it is changed to xx: GrafPtrPtr }

    WindowRef                           = WindowPtr;
    WindowRefPtr                        = ^WindowRef; { when a var xx:WindowRef parameter can be nil, it is changed to xx: WindowRefPtr }
    {  DragConstraint constants to pass to DragGray,DragTheRgn, or ConstrainedDragRgn }
    DragConstraint                      = UInt16;

const
    kNoConstraint               = 0;
    kVerticalConstraint         = 1;
    kHorizontalConstraint       = 2;



type
    DragGrayRgnProcPtr = procedure;

    {
     *  Here ends the list of things that "belong" in Windows.
        }


    RGBColorPtr = ^RGBColor;
    RGBColor = record
        red:                    UInt16;                                 { magnitude of red component }
        green:                  UInt16;                                 { magnitude of green component }
        blue:                   UInt16;                                 { magnitude of blue component }
    end;

    RGBColorHdl                         = ^RGBColorPtr;
    ColorSearchProcPtr = function(var rgb: RGBColor; var position: SInt32): boolean;

    ColorComplementProcPtr = function(var rgb: RGBColor): boolean;

    DragGrayRgnUPP = ^SInt32; { an opaque UPP }
    ColorSearchUPP = ^SInt32; { an opaque UPP }
    ColorComplementUPP = ^SInt32; { an opaque UPP }

const
    uppDragGrayRgnProcInfo = $00000000;
    uppColorSearchProcInfo = $000003D0;
    uppColorComplementProcInfo = $000000D0;
    {
     *  NewDragGrayRgnUPP()
     *
     *  Availability:
     *    Non-Carbon CFM:   available as macro/inline
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function NewDragGrayRgnUPP(userRoutine: DragGrayRgnProcPtr): DragGrayRgnUPP; external name '_NewDragGrayRgnUPP'; { old name was NewDragGrayRgnProc }
{
 *  NewColorSearchUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewColorSearchUPP(userRoutine: ColorSearchProcPtr): ColorSearchUPP; external name '_NewColorSearchUPP'; { old name was NewColorSearchProc }
{
 *  NewColorComplementUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewColorComplementUPP(userRoutine: ColorComplementProcPtr): ColorComplementUPP; external name '_NewColorComplementUPP'; { old name was NewColorComplementProc }
{
 *  DisposeDragGrayRgnUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeDragGrayRgnUPP(userUPP: DragGrayRgnUPP); external name '_DisposeDragGrayRgnUPP';
{
 *  DisposeColorSearchUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeColorSearchUPP(userUPP: ColorSearchUPP); external name '_DisposeColorSearchUPP';
{
 *  DisposeColorComplementUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeColorComplementUPP(userUPP: ColorComplementUPP); external name '_DisposeColorComplementUPP';
{
 *  InvokeDragGrayRgnUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvokeDragGrayRgnUPP(userRoutine: DragGrayRgnUPP); external name '_InvokeDragGrayRgnUPP'; { old name was CallDragGrayRgnProc }
{
 *  InvokeColorSearchUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeColorSearchUPP(var rgb: RGBColor; var position: SInt32; userRoutine: ColorSearchUPP): boolean; external name '_InvokeColorSearchUPP'; { old name was CallColorSearchProc }
{
 *  InvokeColorComplementUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeColorComplementUPP(var rgb: RGBColor; userRoutine: ColorComplementUPP): boolean; external name '_InvokeColorComplementUPP'; { old name was CallColorComplementProc }
type
    ColorSpecPtr = ^ColorSpec;
    ColorSpec = record
        value:                  SInt16;                             { index or other value }
        rgb:                    RGBColor;                               { true color }
    end;

    CSpecArray                          = array [0..0] of ColorSpec;
    ColorTablePtr = ^ColorTable;
    ColorTable = record
        ctSeed:                 SInt32;                             { unique identifier for table }
        ctFlags:                SInt16;                             { high bit: 0 = PixMap; 1 = device }
        ctSize:                 SInt16;                             { number of entries in CTTable }
        ctTable:                CSpecArray;                             { array [0..0] of ColorSpec }
    end;

    CTabPtr                             = ^ColorTable;
    CTabHandle                          = ^CTabPtr;
    xColorSpecPtr = ^xColorSpec;
    xColorSpec = record
        value:                  SInt16;                             { index or other value }
        rgb:                    RGBColor;                               { true color }
        xalpha:                 SInt16;
    end;

    xCSpecArray                         = array [0..0] of xColorSpec;
    MatchRecPtr = ^MatchRec;
    MatchRec = record
        red:                    UInt16;
        green:                  UInt16;
        blue:                   UInt16;
        matchData:              SInt32;
    end;

    {
        QuickTime 3.0 makes PixMap data structure available on non-Mac OS's.
        In order to implement PixMap in these alternate environments, the PixMap
        had to be extended. The pmReserved field was changed to pmExt which is
        a Handle to extra info.  The planeBytes field was changed to pixelFormat.

        In OS X, Quickdraw also uses the new PixMap data structure.
        }
{$setc OLDPIXMAPSTRUCT := 0}

    {  pixel formats }

const
    k1MonochromePixelFormat     = $00000001;                    {  1 bit indexed }
    k2IndexedPixelFormat        = $00000002;                    {  2 bit indexed }
    k4IndexedPixelFormat        = $00000004;                    {  4 bit indexed }
    k8IndexedPixelFormat        = $00000008;                    {  8 bit indexed }
    k16BE555PixelFormat         = $00000010;                    {  16 bit BE rgb 555 (Mac) }
    k24RGBPixelFormat           = $00000018;                    {  24 bit rgb  }
    k32ARGBPixelFormat          = $00000020;                    {  32 bit argb    (Mac) }
    k1IndexedGrayPixelFormat    = $00000021;                    {  1 bit indexed gray }
    k2IndexedGrayPixelFormat    = $00000022;                    {  2 bit indexed gray }
    k4IndexedGrayPixelFormat    = $00000024;                    {  4 bit indexed gray }
    k8IndexedGrayPixelFormat    = $00000028;                    {  8 bit indexed gray }


    {  values for PixMap.pixelFormat }
    k16LE555PixelFormat         = $4C353535 (* 'L555' *);                       {  16 bit LE rgb 555 (PC) }
    k16LE5551PixelFormat        = $35353531 (* '5551' *);                       {  16 bit LE rgb 5551 }
    k16BE565PixelFormat         = $42353635 (* 'B565' *);                       {  16 bit BE rgb 565 }
    k16LE565PixelFormat         = $4C353635 (* 'L565' *);                       {  16 bit LE rgb 565 }
    k24BGRPixelFormat           = $32344247 (* '24BG' *);                       {  24 bit bgr  }
    k32BGRAPixelFormat          = $42475241 (* 'BGRA' *);                       {  32 bit bgra    (Matrox) }
    k32ABGRPixelFormat          = $41424752 (* 'ABGR' *);                       {  32 bit abgr     }
    k32RGBAPixelFormat          = $52474241 (* 'RGBA' *);                       {  32 bit rgba     }
    kYUVSPixelFormat            = $79757673 (* 'yuvs' *);                       {  YUV 4:2:2 byte ordering 16-unsigned = 'YUY2' }
    kYUVUPixelFormat            = $79757675 (* 'yuvu' *);                       {  YUV 4:2:2 byte ordering 16-signed }
    kYVU9PixelFormat            = $59565539 (* 'YVU9' *);                       {  YVU9 Planar    9 }
    kYUV411PixelFormat          = $59343131 (* 'Y411' *);                       {  YUV 4:1:1 Interleaved  16 }
    kYVYU422PixelFormat         = $59565955 (* 'YVYU' *);                       {  YVYU 4:2:2 byte ordering   16 }
    kUYVY422PixelFormat         = $55595659 (* 'UYVY' *);                       {  UYVY 4:2:2 byte ordering   16 }
    kYUV211PixelFormat          = $59323131 (* 'Y211' *);                       {  YUV 2:1:1 Packed   8 }
    k2vuyPixelFormat            = $32767579 (* '2vuy' *);                       {  UYVY 4:2:2 byte ordering   16 }



type
    PixMapPtr = ^PixMap;
    PixMap = record
        baseAddr:               Ptr;                                    { pointer to pixels }
        rowBytes:               SInt16;                             { offset to next line }
        bounds:                 Rect;                                   { encloses bitmap }
        pmVersion:              SInt16;                             { pixMap version number }
        packType:               SInt16;                             { defines packing format }
        packSize:               SInt32;                             { length of pixel data }
        hRes:                   Fixed;                                  { horiz. resolution (ppi) }
        vRes:                   Fixed;                                  { vert. resolution (ppi) }
        pixelType:              SInt16;                             { defines pixel type }
        pixelSize:              SInt16;                             { # bits in pixel }
        cmpCount:               SInt16;                             { # components in pixel }
        cmpSize:                SInt16;                             { # bits per component }
        planeBytes:             SInt32;                             { offset to next plane }
        pmTable:                CTabHandle;                             { color map for this pixMap }
        pmReserved:             SInt32;
    end;

    PixMapHandle                        = ^PixMapPtr;
    PixPatPtr = ^PixPat;
    PixPat = record
        patType:                SInt16;                             { type of pattern }
        patMap:                 PixMapHandle;                           { the pattern's pixMap }
        patData:                Handle;                                 { pixmap's data }
        patXData:               Handle;                                 { expanded Pattern data }
        patXValid:              SInt16;                             { flags whether expanded Pattern valid }
        patXMap:                Handle;                                 { Handle to expanded Pattern data }
        pat1Data:               Pattern;                                { old-Style pattern/RGB color }
    end;

    PixPatHandle                        = ^PixPatPtr;
    CCrsrPtr = ^CCrsr;
    CCrsr = record
        crsrType:               SInt16;                             { type of cursor }
        crsrMap:                PixMapHandle;                           { the cursor's pixmap }
        crsrData:               Handle;                                 { cursor's data }
        crsrXData:              Handle;                                 { expanded cursor data }
        crsrXValid:             SInt16;                             { depth of expanded data (0 if none) }
        crsrXHandle:            Handle;                                 { future use }
        crsr1Data:              Bits16;                                 { one-bit cursor }
        crsrMask:               Bits16;                                 { cursor's mask }
        crsrHotSpot:            Point;                                  { cursor's hotspot }
        crsrXTable:             SInt32;                             { private }
        crsrID:                 SInt32;                             { private }
    end;

    CCrsrHandle                         = ^CCrsrPtr;
    GammaTblPtr = ^GammaTbl;
    GammaTbl = record
        gVersion:               SInt16;                             { gamma version number }
        gType:                  SInt16;                             { gamma data type }
        gFormulaSize:           SInt16;                             { Formula data size }
        gChanCnt:               SInt16;                             { number of channels of data }
        gDataCnt:               SInt16;                             { number of values/channel }
        gDataWidth:             SInt16;                             { bits/corrected value (data packed to next larger byte size) }
        gFormulaData:           array [0..0] of SInt16;             { data for formulas followed by gamma values }
    end;

    GammaTblHandle                      = ^GammaTblPtr;
    ITabPtr = ^ITab;
    ITab = record
        iTabSeed:               SInt32;                             { copy of CTSeed from source CTable }
        iTabRes:                SInt16;                             { bits/channel resolution of iTable }
        iTTable:                SInt8;                                  { byte colortable index values }
    end;

    ITabHandle                          = ^ITabPtr;
    SProcRecPtr = ^SProcRec;
    SProcRec = record
        nxtSrch:                Handle;                                 { SProcHndl Handle to next SProcRec }
        srchProc:               ColorSearchUPP;                         { search procedure proc ptr }
    end;

    SProcPtr                            = ^SProcRec;
    SProcHndl                           = ^SProcPtr;
    CProcRecPtr = ^CProcRec;
    CProcRec = record
        nxtComp:                Handle;                                 { CProcHndl Handle to next CProcRec }
        compProc:               ColorComplementUPP;                     { complement procedure proc ptr }
    end;

    CProcPtr                            = ^CProcRec;
    CProcHndl                           = ^CProcPtr;
    {
        QuickTime 3.0 makes GDevice data structure available on non-Mac OS's.
        In order to implement GDevice in these alternate environments, the GDevice
        had to be extended. The gdReserved field was changed to gdExt which is
        a Handle to extra info.
        }
{$setc OLDGDEVICESTRUCT := 0}

    GDevicePtr = ^GDevice;
    GDPtr                               = ^GDevice;
    GDHandle                            = ^GDPtr;
    GDHandlePtr                         = ^GDHandle; { when a VAR xx: GDHandle parameter can be nil, it is changed to xx: GDHandlePtr }
    GDevice = record
        gdRefNum:               SInt16;                             { driver's unit number }
        gdID:                   SInt16;                             { client ID for search procs }
        gdType:                 SInt16;                             { fixed/CLUT/direct }
        gdITable:               ITabHandle;                             { Handle to inverse lookup table }
        gdResPref:              SInt16;                             { preferred resolution of GDITable }
        gdSearchProc:           SProcHndl;                              { search proc list head }
        gdCompProc:             CProcHndl;                              { complement proc list }
        gdFlags:                SInt16;                             { grafDevice flags word }
        gdPMap:                 PixMapHandle;                           { describing pixMap }
        gdRefCon:               SInt32;                             { reference value }
        gdNextGD:               GDHandle;                               { GDHandle Handle of next gDevice }
        gdRect:                 Rect;                                   {  device's bounds in global coordinates }
        gdMode:                 SInt32;                             { device's current mode }
        gdCCBytes:              SInt16;                             { depth of expanded cursor data }
        gdCCDepth:              SInt16;                             { depth of expanded cursor data }
        gdCCXData:              Handle;                                 { Handle to cursor's expanded data }
        gdCCXMask:              Handle;                                 { Handle to cursor's expanded mask }
        gdReserved:             SInt32;                             { future use. MUST BE 0 }
    end;

    GrafVars = record
        rgbOpColor:             RGBColor;                               { color for addPin  subPin and average }
        rgbHiliteColor:         RGBColor;                               { color for hiliting }
        pmFgColor:              Handle;                                 { palette Handle for foreground color }
        pmFgIndex:              SInt16;                                { index value for foreground }
        pmBkColor:              Handle;                                 { palette Handle for background color }
        pmBkIndex:              SInt16;                                { index value for background }
        pmFlags:                SInt16;                                { flags for Palette Manager }
    end;
    GVarPtr                             = ^GrafVars;
    GVarHandle                          = ^GVarPtr;

    CGrafPtr                            = GrafPtr;
    CGrafPtrPtr                         = ^CGrafPtr;

    QDPrinterStatusProcPtr = function(opcode: PrinterStatusOpcode; currentPort: CGrafPtr; printerStatus: UnivPtr): OSStatus;

    QDPrinterStatusUPP = ^SInt32; { an opaque UPP }

    CQDProcsPtr = ^CQDProcs;
    CQDProcs = record
        textProc:               QDTextUPP;
        lineProc:               QDLineUPP;
        rectProc:               QDRectUPP;
        rRectProc:              QDRRectUPP;
        ovalProc:               QDOvalUPP;
        arcProc:                QDArcUPP;
        polyProc:               QDPolyUPP;
        rgnProc:                QDRgnUPP;
        bitsProc:               QDBitsUPP;
        commentProc:            QDCommentUPP;
        txMeasProc:             QDTxMeasUPP;
        getPicProc:             QDGetPicUPP;
        putPicProc:             QDPutPicUPP;
        opcodeProc:             QDOpcodeUPP;
        newProc1:               UniversalProcPtr;                       {  this is the StdPix bottleneck -- see ImageCompression.h  }
        glyphsProc:             QDStdGlyphsUPP;                         {  was newProc2; now used in Unicode text drawing  }
        printerStatusProc:      QDPrinterStatusUPP;                     {  was newProc3;  now used to communicate status between Printing code and System imaging code  }
        newProc4:               UniversalProcPtr;
        newProc5:               UniversalProcPtr;
        newProc6:               UniversalProcPtr;
    end;


    CWindowPtr                          = WindowPtr;

    ReqListRecPtr = ^ReqListRec;
    ReqListRec = record
        reqLSize:               SInt16;                             { request list size }
        reqLData:               array [0..0] of SInt16;             { request list data }
    end;

    OpenCPicParamsPtr = ^OpenCPicParams;
    OpenCPicParams = record
        srcRect:                Rect;
        hRes:                   Fixed;
        vRes:                   Fixed;
        version:                SInt16;
        reserved1:              SInt16;
        reserved2:              SInt32;
    end;


const
    kCursorImageMajorVersion    = $0001;
    kCursorImageMinorVersion    = $0000;


type
    CursorImageRecPtr = ^CursorImageRec;
    CursorImageRec = record
        majorVersion:           UInt16;
        minorVersion:           UInt16;
        cursorPixMap:           PixMapHandle;
        cursorBitMask:          BitMapHandle;
    end;

    CursorImagePtr                      = ^CursorImageRec;
    DeviceLoopDrawingProcPtr = procedure(depth: SInt16; deviceFlags: SInt16; targetDevice: GDHandle; userData: SInt32);

    DeviceLoopDrawingUPP = ^SInt32; { an opaque UPP }

const
    uppQDPrinterStatusProcInfo = $00000FF1;
    uppDeviceLoopDrawingProcInfo = $00003E80;

{
 *  NewDeviceLoopDrawingUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewDeviceLoopDrawingUPP(userRoutine: DeviceLoopDrawingProcPtr): DeviceLoopDrawingUPP; external name '_NewDeviceLoopDrawingUPP'; { old name was NewDeviceLoopDrawingProc }

{
 *  DisposeDeviceLoopDrawingUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeDeviceLoopDrawingUPP(userUPP: DeviceLoopDrawingUPP); external name '_DisposeDeviceLoopDrawingUPP';

{
 *  InvokeDeviceLoopDrawingUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvokeDeviceLoopDrawingUPP(depth: SInt16; deviceFlags: SInt16; targetDevice: GDHandle; userData: SInt32; userRoutine: DeviceLoopDrawingUPP); external name '_InvokeDeviceLoopDrawingUPP'; { old name was CallDeviceLoopDrawingProc }


{
 *  LockPortBits()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function LockPortBits(port: GrafPtr): OSErr; external name '_LockPortBits';

{
 *  UnlockPortBits()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function UnlockPortBits(port: GrafPtr): OSErr; external name '_UnlockPortBits';

{  Break a region up into rectangles. }


const
    kQDParseRegionFromTop       = $01;
    kQDParseRegionFromBottom    = $02;
    kQDParseRegionFromLeft      = $04;
    kQDParseRegionFromRight     = $08;
    kQDParseRegionFromTopLeft   = $05;
    kQDParseRegionFromBottomRight = $0A;


type
    QDRegionParseDirection              = SInt32;

const
    kQDRegionToRectsMsgInit     = 1;
    kQDRegionToRectsMsgParse    = 2;
    kQDRegionToRectsMsgTerminate = 3;


type
    RegionToRectsProcPtr = function(message: UInt16; rgn: RgnHandle; const (*var*) rect: Rect; refCon: UnivPtr): OSStatus;

    RegionToRectsUPP = ^SInt32; { an opaque UPP }

const
    uppRegionToRectsProcInfo = $00003FB1;
    {
     *  NewRegionToRectsUPP()
     *
     *  Availability:
     *    Non-Carbon CFM:   available as macro/inline
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function NewRegionToRectsUPP(userRoutine: RegionToRectsProcPtr): RegionToRectsUPP; external name '_NewRegionToRectsUPP'; { old name was NewRegionToRectsProc }
{
 *  DisposeRegionToRectsUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeRegionToRectsUPP(userUPP: RegionToRectsUPP); external name '_DisposeRegionToRectsUPP';
{
 *  InvokeRegionToRectsUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeRegionToRectsUPP(message: UInt16; rgn: RgnHandle; const (*var*) rect: Rect; refCon: UnivPtr; userRoutine: RegionToRectsUPP): OSStatus; external name '_InvokeRegionToRectsUPP'; { old name was CallRegionToRectsProc }
{
 *  QDRegionToRects()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function QDRegionToRects(rgn: RgnHandle; dir: QDRegionParseDirection; proc: RegionToRectsUPP; userData: UnivPtr): OSStatus; external name '_QDRegionToRects';



{
 *  [Mac]SetPort()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetPort(port: GrafPtr); external name '_SetPort';
{
 *  GetPort()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure GetPort(var port: GrafPtr); external name '_GetPort';
{
 *  QDSwapPort()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.5 and later
 *    Mac OS X:         in version 10.1 and later
 }
function QDSwapPort(inNewPort: CGrafPtr; outOldPort: CGrafPtrPtr): boolean; external name '_QDSwapPort';

{
 *  GrafDevice()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure GrafDevice(device: SInt16); external name '_GrafDevice';
{
 *  SetPortBits()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetPortBits(const (*var*) bm: BitMap); external name '_SetPortBits';
{
 *  PortSize()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure PortSize(width: SInt16; height: SInt16); external name '_PortSize';
{
 *  MovePortTo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure MovePortTo(leftGlobal: SInt16; topGlobal: SInt16); external name '_MovePortTo';
{
 *  SetOrigin()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetOrigin(h: SInt16; v: SInt16); external name '_SetOrigin';
{
 *  SetClip()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetClip(rgn: RgnHandle); external name '_SetClip';
{
 *  GetClip()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure GetClip(rgn: RgnHandle); external name '_GetClip';
{
 *  ClipRect()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure ClipRect(const (*var*) r: Rect); external name '_ClipRect';
{
 *  BackPat()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure BackPat(const (*var*) pat: Pattern); external name '_BackPat';
{
 *  InitCursor()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InitCursor; external name '_InitCursor';
{
 *  [Mac]SetCursor()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetCursor(const (*var*) crsr: Cursor); external name '_SetCursor';
{
 *  HideCursor()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure HideCursor; external name '_HideCursor';
{
 *  [Mac]ShowCursor()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure ShowCursor; external name '_ShowCursor';
{
 *  ObscureCursor()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure ObscureCursor; external name '_ObscureCursor';
{
 *  HidePen()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure HidePen; external name '_HidePen';
{
 *  ShowPen()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure ShowPen; external name '_ShowPen';
{
 *  GetPen()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure GetPen(var pt: Point); external name '_GetPen';
{
 *  GetPenState()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure GetPenState(var pnState: PenState); external name '_GetPenState';
{
 *  SetPenState()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetPenState(const (*var*) pnState: PenState); external name '_SetPenState';
{
 *  PenSize()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure PenSize(width: SInt16; height: SInt16); external name '_PenSize';
{
 *  PenMode()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure PenMode(mode: SInt16); external name '_PenMode';
{
 *  PenPat()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure PenPat(const (*var*) pat: Pattern); external name '_PenPat';
{
 *  PenNormal()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure PenNormal; external name '_PenNormal';
{
 *  MoveTo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure MoveTo(h: SInt16; v: SInt16); external name '_MoveTo';
{
 *  Move()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure Move(dh: SInt16; dv: SInt16); external name '_Move';
{
 *  [Mac]LineTo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure LineTo(h: SInt16; v: SInt16); external name '_LineTo';
{
 *  Line()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure Line(dh: SInt16; dv: SInt16); external name '_Line';
{
 *  ForeColor()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure ForeColor(color: SInt32); external name '_ForeColor';
{
 *  BackColor()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure BackColor(color: SInt32); external name '_BackColor';
{
 *  ColorBit()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure ColorBit(whichBit: SInt16); external name '_ColorBit';
{
 *  [Mac]SetRect()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetRect(var r: Rect; left: SInt16; top: SInt16; right: SInt16; bottom: SInt16); external name '_SetRect';
{
 *  [Mac]OffsetRect()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure OffsetRect(var r: Rect; dh: SInt16; dv: SInt16); external name '_OffsetRect';
{
 *  [Mac]InsetRect()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InsetRect(var r: Rect; dh: SInt16; dv: SInt16); external name '_InsetRect';
{
 *  SectRect()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SectRect(const (*var*) src1: Rect; const (*var*) src2: Rect; var dstRect: Rect): boolean; external name '_SectRect';
{
 *  [Mac]UnionRect()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure UnionRect(const (*var*) src1: Rect; const (*var*) src2: Rect; var dstRect: Rect); external name '_UnionRect';
{
 *  [Mac]EqualRect()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function EqualRect(const (*var*) rect1: Rect; const (*var*) rect2: Rect): boolean; external name '_EqualRect';
{
 *  EmptyRect()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function EmptyRect(const (*var*) r: Rect): boolean; external name '_EmptyRect';
{
 *  [Mac]FrameRect()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure FrameRect(const (*var*) r: Rect); external name '_FrameRect';
{
 *  PaintRect()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure PaintRect(const (*var*) r: Rect); external name '_PaintRect';
{
 *  EraseRect()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure EraseRect(const (*var*) r: Rect); external name '_EraseRect';
{
 *  [Mac]InvertRect()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvertRect(const (*var*) r: Rect); external name '_InvertRect';
{
 *  [Mac]FillRect()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure FillRect(const (*var*) r: Rect; const (*var*) pat: Pattern); external name '_FillRect';
{
 *  FrameOval()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure FrameOval(const (*var*) r: Rect); external name '_FrameOval';
{
 *  PaintOval()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure PaintOval(const (*var*) r: Rect); external name '_PaintOval';
{
 *  EraseOval()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure EraseOval(const (*var*) r: Rect); external name '_EraseOval';
{
 *  InvertOval()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvertOval(const (*var*) r: Rect); external name '_InvertOval';
{
 *  FillOval()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure FillOval(const (*var*) r: Rect; const (*var*) pat: Pattern); external name '_FillOval';
{
 *  FrameRoundRect()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure FrameRoundRect(const (*var*) r: Rect; ovalWidth: SInt16; ovalHeight: SInt16); external name '_FrameRoundRect';
{
 *  PaintRoundRect()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure PaintRoundRect(const (*var*) r: Rect; ovalWidth: SInt16; ovalHeight: SInt16); external name '_PaintRoundRect';
{
 *  EraseRoundRect()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure EraseRoundRect(const (*var*) r: Rect; ovalWidth: SInt16; ovalHeight: SInt16); external name '_EraseRoundRect';
{
 *  InvertRoundRect()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvertRoundRect(const (*var*) r: Rect; ovalWidth: SInt16; ovalHeight: SInt16); external name '_InvertRoundRect';
{
 *  FillRoundRect()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure FillRoundRect(const (*var*) r: Rect; ovalWidth: SInt16; ovalHeight: SInt16; const (*var*) pat: Pattern); external name '_FillRoundRect';
{
 *  FrameArc()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure FrameArc(const (*var*) r: Rect; startAngle: SInt16; arcAngle: SInt16); external name '_FrameArc';
{
 *  PaintArc()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure PaintArc(const (*var*) r: Rect; startAngle: SInt16; arcAngle: SInt16); external name '_PaintArc';
{
 *  EraseArc()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure EraseArc(const (*var*) r: Rect; startAngle: SInt16; arcAngle: SInt16); external name '_EraseArc';
{
 *  InvertArc()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvertArc(const (*var*) r: Rect; startAngle: SInt16; arcAngle: SInt16); external name '_InvertArc';
{
 *  FillArc()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure FillArc(const (*var*) r: Rect; startAngle: SInt16; arcAngle: SInt16; const (*var*) pat: Pattern); external name '_FillArc';
{
 *  NewRgn()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewRgn: RgnHandle; external name '_NewRgn';
{
 *  OpenRgn()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure OpenRgn; external name '_OpenRgn';
{
 *  CloseRgn()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CloseRgn(dstRgn: RgnHandle); external name '_CloseRgn';
{
 *  BitMapToRegion()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function BitMapToRegion(region: RgnHandle; const (*var*) bMap: BitMap): OSErr; external name '_BitMapToRegion';
{
 *  HandleToRgn()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure HandleToRgn(oldRegion: Handle; region: RgnHandle); external name '_HandleToRgn';

{
 *  RgnToHandle()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.1 and later
 }
procedure RgnToHandle(region: RgnHandle; flattenedRgnDataHdl: Handle); external name '_RgnToHandle';

{
 *  DisposeRgn()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeRgn(rgn: RgnHandle); external name '_DisposeRgn';
{
 *  [Mac]CopyRgn()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CopyRgn(srcRgn: RgnHandle; dstRgn: RgnHandle); external name '_CopyRgn';
{
 *  SetEmptyRgn()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetEmptyRgn(rgn: RgnHandle); external name '_SetEmptyRgn';
{
 *  [Mac]SetRectRgn()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetRectRgn(rgn: RgnHandle; left: SInt16; top: SInt16; right: SInt16; bottom: SInt16); external name '_SetRectRgn';
{
 *  RectRgn()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure RectRgn(rgn: RgnHandle; const (*var*) r: Rect); external name '_RectRgn';
{
 *  [Mac]OffsetRgn()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure OffsetRgn(rgn: RgnHandle; dh: SInt16; dv: SInt16); external name '_OffsetRgn';
{
 *  InsetRgn()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InsetRgn(rgn: RgnHandle; dh: SInt16; dv: SInt16); external name '_InsetRgn';
{
 *  SectRgn()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SectRgn(srcRgnA: RgnHandle; srcRgnB: RgnHandle; dstRgn: RgnHandle); external name '_SectRgn';
{
 *  [Mac]UnionRgn()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure UnionRgn(srcRgnA: RgnHandle; srcRgnB: RgnHandle; dstRgn: RgnHandle); external name '_UnionRgn';
{
 *  DiffRgn()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DiffRgn(srcRgnA: RgnHandle; srcRgnB: RgnHandle; dstRgn: RgnHandle); external name '_DiffRgn';
{
 *  [Mac]XorRgn()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure XorRgn(srcRgnA: RgnHandle; srcRgnB: RgnHandle; dstRgn: RgnHandle); external name '_XorRgn';
{
 *  RectInRgn()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function RectInRgn(const (*var*) r: Rect; rgn: RgnHandle): boolean; external name '_RectInRgn';
{
 *  [Mac]EqualRgn()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function EqualRgn(rgnA: RgnHandle; rgnB: RgnHandle): boolean; external name '_EqualRgn';
{
 *  EmptyRgn()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function EmptyRgn(rgn: RgnHandle): boolean; external name '_EmptyRgn';
{
 *  [Mac]FrameRgn()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure FrameRgn(rgn: RgnHandle); external name '_FrameRgn';
{
 *  [Mac]PaintRgn()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure PaintRgn(rgn: RgnHandle); external name '_PaintRgn';
{
 *  EraseRgn()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure EraseRgn(rgn: RgnHandle); external name '_EraseRgn';
{
 *  [Mac]InvertRgn()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvertRgn(rgn: RgnHandle); external name '_InvertRgn';
{
 *  [Mac]FillRgn()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure FillRgn(rgn: RgnHandle; const (*var*) pat: Pattern); external name '_FillRgn';
{
 *  ScrollRect()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure ScrollRect(const (*var*) r: Rect; dh: SInt16; dv: SInt16; updateRgn: RgnHandle); external name '_ScrollRect';
{
 *  CopyBits()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CopyBits(const (*var*) srcBits: BitMap; const (*var*) dstBits: BitMap; const (*var*) srcRect: Rect; const (*var*) dstRect: Rect; mode: SInt16; maskRgn: RgnHandle); external name '_CopyBits';
{
 *  SeedFill()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SeedFill(srcPtr: UnivPtr; dstPtr: UnivPtr; srcRow: SInt16; dstRow: SInt16; height: SInt16; words: SInt16; seedH: SInt16; seedV: SInt16); external name '_SeedFill';
{
 *  CalcMask()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CalcMask(srcPtr: UnivPtr; dstPtr: UnivPtr; srcRow: SInt16; dstRow: SInt16; height: SInt16; words: SInt16); external name '_CalcMask';
{
 *  CopyMask()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CopyMask(const (*var*) srcBits: BitMap; const (*var*) maskBits: BitMap; const (*var*) dstBits: BitMap; const (*var*) srcRect: Rect; const (*var*) maskRect: Rect; const (*var*) dstRect: Rect); external name '_CopyMask';
{
 *  OpenPicture()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OpenPicture(const (*var*) picFrame: Rect): PicHandle; external name '_OpenPicture';
{
 *  PicComment()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure PicComment(kind: SInt16; dataSize: SInt16; dataHandle: Handle); external name '_PicComment';
{
 *  ClosePicture()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure ClosePicture; external name '_ClosePicture';
{
 *  DrawPicture()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DrawPicture(myPicture: PicHandle; const (*var*) dstRect: Rect); external name '_DrawPicture';
{
 *  KillPicture()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure KillPicture(myPicture: PicHandle); external name '_KillPicture';
{
 *  OpenPoly()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OpenPoly: PolyHandle; external name '_OpenPoly';
{
 *  ClosePoly()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure ClosePoly; external name '_ClosePoly';
{
 *  KillPoly()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure KillPoly(poly: PolyHandle); external name '_KillPoly';
{
 *  OffsetPoly()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure OffsetPoly(poly: PolyHandle; dh: SInt16; dv: SInt16); external name '_OffsetPoly';
{
 *  FramePoly()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure FramePoly(poly: PolyHandle); external name '_FramePoly';
{
 *  PaintPoly()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure PaintPoly(poly: PolyHandle); external name '_PaintPoly';
{
 *  ErasePoly()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure ErasePoly(poly: PolyHandle); external name '_ErasePoly';
{
 *  InvertPoly()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvertPoly(poly: PolyHandle); external name '_InvertPoly';
{
 *  FillPoly()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure FillPoly(poly: PolyHandle; const (*var*) pat: Pattern); external name '_FillPoly';
{
 *  SetPt()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetPt(var pt: Point; h: SInt16; v: SInt16); external name '_SetPt';
{
 *  LocalToGlobal()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure LocalToGlobal(var pt: Point); external name '_LocalToGlobal';
{
 *  GlobalToLocal()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure GlobalToLocal(var pt: Point); external name '_GlobalToLocal';
{
 *  Random()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function Random: SInt16; external name '_Random';
{
 *  StuffHex()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure StuffHex(thingPtr: UnivPtr; const (*var*) s: Str255); external name '_StuffHex';
{
 *  [Mac]GetPixel()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetPixel(h: SInt16; v: SInt16): boolean; external name '_GetPixel';
{
 *  ScalePt()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure ScalePt(var pt: Point; const (*var*) srcRect: Rect; const (*var*) dstRect: Rect); external name '_ScalePt';
{
 *  MapPt()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure MapPt(var pt: Point; const (*var*) srcRect: Rect; const (*var*) dstRect: Rect); external name '_MapPt';
{
 *  MapRect()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure MapRect(var r: Rect; const (*var*) srcRect: Rect; const (*var*) dstRect: Rect); external name '_MapRect';
{
 *  MapRgn()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure MapRgn(rgn: RgnHandle; const (*var*) srcRect: Rect; const (*var*) dstRect: Rect); external name '_MapRgn';
{
 *  MapPoly()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure MapPoly(poly: PolyHandle; const (*var*) srcRect: Rect; const (*var*) dstRect: Rect); external name '_MapPoly';
{
 *  SetStdProcs()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetStdProcs(var procs: QDProcs); external name '_SetStdProcs';
{
 *  StdRect()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure StdRect(verb: GrafVerb; const (*var*) r: Rect); external name '_StdRect';
{
 *  StdRRect()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure StdRRect(verb: GrafVerb; const (*var*) r: Rect; ovalWidth: SInt16; ovalHeight: SInt16); external name '_StdRRect';
{
 *  StdOval()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure StdOval(verb: GrafVerb; const (*var*) r: Rect); external name '_StdOval';
{
 *  StdArc()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure StdArc(verb: GrafVerb; const (*var*) r: Rect; startAngle: SInt16; arcAngle: SInt16); external name '_StdArc';
{
 *  StdPoly()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure StdPoly(verb: GrafVerb; poly: PolyHandle); external name '_StdPoly';
{
 *  StdRgn()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure StdRgn(verb: GrafVerb; rgn: RgnHandle); external name '_StdRgn';
{
 *  StdBits()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure StdBits(const (*var*) srcBits: BitMap; const (*var*) srcRect: Rect; const (*var*) dstRect: Rect; mode: SInt16; maskRgn: RgnHandle); external name '_StdBits';
{
 *  StdComment()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure StdComment(kind: SInt16; dataSize: SInt16; dataHandle: Handle); external name '_StdComment';
{
 *  StdGetPic()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure StdGetPic(dataPtr: UnivPtr; byteCount: SInt16); external name '_StdGetPic';
{
 *  StdPutPic()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure StdPutPic(dataPtr: UnivPtr; byteCount: SInt16); external name '_StdPutPic';
{
 *  StdOpcode()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure StdOpcode(const (*var*) fromRect: Rect; const (*var*) toRect: Rect; opcode: UInt16; version: SInt16); external name '_StdOpcode';
{
 *  AddPt()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure AddPt(src: Point; var dst: Point); external name '_AddPt';
{
 *  EqualPt()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function EqualPt(pt1: Point; pt2: Point): boolean; external name '_EqualPt';
{
 *  [Mac]PtInRect()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PtInRect(pt: Point; const (*var*) r: Rect): boolean; external name '_PtInRect';
{
 *  Pt2Rect()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure Pt2Rect(pt1: Point; pt2: Point; var dstRect: Rect); external name '_Pt2Rect';
{
 *  PtToAngle()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure PtToAngle(const (*var*) r: Rect; pt: Point; var angle: SInt16); external name '_PtToAngle';
{
 *  SubPt()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SubPt(src: Point; var dst: Point); external name '_SubPt';
{
 *  PtInRgn()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PtInRgn(pt: Point; rgn: RgnHandle): boolean; external name '_PtInRgn';
{
 *  StdLine()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure StdLine(newPt: Point); external name '_StdLine';

{
 *  NewPixMap()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewPixMap: PixMapHandle; external name '_NewPixMap';
{
 *  DisposePixMap()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposePixMap(pm: PixMapHandle); external name '_DisposePixMap';
{
 *  CopyPixMap()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CopyPixMap(srcPM: PixMapHandle; dstPM: PixMapHandle); external name '_CopyPixMap';
{
 *  NewPixPat()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewPixPat: PixPatHandle; external name '_NewPixPat';
{
 *  DisposePixPat()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposePixPat(pp: PixPatHandle); external name '_DisposePixPat';
{
 *  CopyPixPat()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CopyPixPat(srcPP: PixPatHandle; dstPP: PixPatHandle); external name '_CopyPixPat';
{
 *  PenPixPat()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure PenPixPat(pp: PixPatHandle); external name '_PenPixPat';
{
 *  BackPixPat()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure BackPixPat(pp: PixPatHandle); external name '_BackPixPat';
{
 *  GetPixPat()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetPixPat(patID: SInt16): PixPatHandle; external name '_GetPixPat';
{
 *  MakeRGBPat()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure MakeRGBPat(pp: PixPatHandle; const (*var*) myColor: RGBColor); external name '_MakeRGBPat';
{
 *  FillCRect()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure FillCRect(const (*var*) r: Rect; pp: PixPatHandle); external name '_FillCRect';
{
 *  FillCOval()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure FillCOval(const (*var*) r: Rect; pp: PixPatHandle); external name '_FillCOval';
{
 *  FillCRoundRect()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure FillCRoundRect(const (*var*) r: Rect; ovalWidth: SInt16; ovalHeight: SInt16; pp: PixPatHandle); external name '_FillCRoundRect';
{
 *  FillCArc()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure FillCArc(const (*var*) r: Rect; startAngle: SInt16; arcAngle: SInt16; pp: PixPatHandle); external name '_FillCArc';
{
 *  FillCRgn()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure FillCRgn(rgn: RgnHandle; pp: PixPatHandle); external name '_FillCRgn';
{
 *  FillCPoly()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure FillCPoly(poly: PolyHandle; pp: PixPatHandle); external name '_FillCPoly';
{
 *  RGBForeColor()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure RGBForeColor(const (*var*) color: RGBColor); external name '_RGBForeColor';
{
 *  RGBBackColor()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure RGBBackColor(const (*var*) color: RGBColor); external name '_RGBBackColor';
{
 *  SetCPixel()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetCPixel(h: SInt16; v: SInt16; const (*var*) cPix: RGBColor); external name '_SetCPixel';
{
 *  SetPortPix()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetPortPix(pm: PixMapHandle); external name '_SetPortPix';
{
 *  GetCPixel()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure GetCPixel(h: SInt16; v: SInt16; var cPix: RGBColor); external name '_GetCPixel';
{
 *  GetForeColor()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure GetForeColor(var color: RGBColor); external name '_GetForeColor';
{
 *  GetBackColor()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure GetBackColor(var color: RGBColor); external name '_GetBackColor';
{
 *  SeedCFill()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SeedCFill(const (*var*) srcBits: BitMap; const (*var*) dstBits: BitMap; const (*var*) srcRect: Rect; const (*var*) dstRect: Rect; seedH: SInt16; seedV: SInt16; matchProc: ColorSearchUPP; matchData: SInt32); external name '_SeedCFill';
{
 *  CalcCMask()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CalcCMask(const (*var*) srcBits: BitMap; const (*var*) dstBits: BitMap; const (*var*) srcRect: Rect; const (*var*) dstRect: Rect; const (*var*) seedRGB: RGBColor; matchProc: ColorSearchUPP; matchData: SInt32); external name '_CalcCMask';
{
 *  OpenCPicture()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OpenCPicture(const (*var*) newHeader: OpenCPicParams): PicHandle; external name '_OpenCPicture';
{
 *  OpColor()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure OpColor(const (*var*) color: RGBColor); external name '_OpColor';
{
 *  HiliteColor()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure HiliteColor(const (*var*) color: RGBColor); external name '_HiliteColor';
{
 *  DisposeCTable()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeCTable(cTable: CTabHandle); external name '_DisposeCTable';
{
 *  GetCTable()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetCTable(ctID: SInt16): CTabHandle; external name '_GetCTable';
{
 *  GetCCursor()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetCCursor(crsrID: SInt16): CCrsrHandle; external name '_GetCCursor';
{
 *  SetCCursor()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetCCursor(cCrsr: CCrsrHandle); external name '_SetCCursor';
{
 *  AllocCursor()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure AllocCursor; external name '_AllocCursor';
{
 *  DisposeCCursor()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeCCursor(cCrsr: CCrsrHandle); external name '_DisposeCCursor';
{  GetCIcon(), PlotCIcon(), and DisposeCIcon() moved to Icons.h }

{
 *  SetStdCProcs()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetStdCProcs(var procs: CQDProcs); external name '_SetStdCProcs';
{
 *  GetMaxDevice()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetMaxDevice(const (*var*) globalRect: Rect): GDHandle; external name '_GetMaxDevice';
{
 *  GetCTSeed()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetCTSeed: SInt32; external name '_GetCTSeed';
{
 *  GetDeviceList()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetDeviceList: GDHandle; external name '_GetDeviceList';
{
 *  GetMainDevice()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetMainDevice: GDHandle; external name '_GetMainDevice';
{
 *  GetNextDevice()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetNextDevice(curDevice: GDHandle): GDHandle; external name '_GetNextDevice';
{
 *  TestDeviceAttribute()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TestDeviceAttribute(gdh: GDHandle; attribute: SInt16): boolean; external name '_TestDeviceAttribute';
{
 *  SetDeviceAttribute()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetDeviceAttribute(gdh: GDHandle; attribute: SInt16; value: boolean); external name '_SetDeviceAttribute';
{
 *  InitGDevice()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InitGDevice(qdRefNum: SInt16; mode: SInt32; gdh: GDHandle); external name '_InitGDevice';
{
 *  NewGDevice()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewGDevice(refNum: SInt16; mode: SInt32): GDHandle; external name '_NewGDevice';
{
 *  DisposeGDevice()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeGDevice(gdh: GDHandle); external name '_DisposeGDevice';
{
 *  SetGDevice()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetGDevice(gd: GDHandle); external name '_SetGDevice';
{
 *  GetGDevice()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetGDevice: GDHandle; external name '_GetGDevice';
{
 *  Color2Index()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function Color2Index(const (*var*) myColor: RGBColor): SInt32; external name '_Color2Index';
{
 *  Index2Color()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure Index2Color(index: SInt32; var aColor: RGBColor); external name '_Index2Color';
{
 *  InvertColor()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvertColor(var myColor: RGBColor); external name '_InvertColor';
{
 *  RealColor()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function RealColor(const (*var*) color: RGBColor): boolean; external name '_RealColor';
{
 *  GetSubTable()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure GetSubTable(myColors: CTabHandle; iTabRes: SInt16; targetTbl: CTabHandle); external name '_GetSubTable';
{
 *  MakeITable()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure MakeITable(cTabH: CTabHandle; iTabH: ITabHandle; res: SInt16); external name '_MakeITable';
{
 *  AddSearch()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure AddSearch(searchProc: ColorSearchUPP); external name '_AddSearch';
{
 *  AddComp()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure AddComp(compProc: ColorComplementUPP); external name '_AddComp';
{
 *  DelSearch()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DelSearch(searchProc: ColorSearchUPP); external name '_DelSearch';
{
 *  DelComp()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DelComp(compProc: ColorComplementUPP); external name '_DelComp';
{
 *  SetClientID()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetClientID(id: SInt16); external name '_SetClientID';
{
 *  ProtectEntry()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure ProtectEntry(index: SInt16; protect: boolean); external name '_ProtectEntry';
{
 *  ReserveEntry()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure ReserveEntry(index: SInt16; reserve: boolean); external name '_ReserveEntry';
{
 *  SetEntries()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetEntries(start: SInt16; count: SInt16; var aTable: CSpecArray); external name '_SetEntries';
{
 *  SaveEntries()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SaveEntries(srcTable: CTabHandle; resultTable: CTabHandle; var selection: ReqListRec); external name '_SaveEntries';
{
 *  RestoreEntries()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure RestoreEntries(srcTable: CTabHandle; dstTable: CTabHandle; var selection: ReqListRec); external name '_RestoreEntries';
{
 *  QDError()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function QDError: SInt16; external name '_QDError';
{
 *  CopyDeepMask()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CopyDeepMask(const (*var*) srcBits: BitMap; const (*var*) maskBits: BitMap; const (*var*) dstBits: BitMap; const (*var*) srcRect: Rect; const (*var*) maskRect: Rect; const (*var*) dstRect: Rect; mode: SInt16; maskRgn: RgnHandle); external name '_CopyDeepMask';
{
 *  DeviceLoop()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DeviceLoop(drawingRgn: RgnHandle; drawingProc: DeviceLoopDrawingUPP; userData: SInt32; flags: DeviceLoopFlags); external name '_DeviceLoop';
{
 *  GetMaskTable()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetMaskTable: Ptr; external name '_GetMaskTable';
{
 *  GetPattern()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetPattern(patternID: SInt16): PatHandle; external name '_GetPattern';
{
 *  [Mac]GetCursor()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetCursor(cursorID: SInt16): CursHandle; external name '_GetCursor';
{
 *  GetPicture()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetPicture(pictureID: SInt16): PicHandle; external name '_GetPicture';
{
 *  DeltaPoint()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DeltaPoint(ptA: Point; ptB: Point): SInt32; external name '_DeltaPoint';
{
 *  ShieldCursor()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure ShieldCursor(const (*var*) shieldRect: Rect; offsetPt: Point); external name '_ShieldCursor';
{
 *  ScreenRes()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure ScreenRes(var scrnHRes: SInt16; var scrnVRes: SInt16); external name '_ScreenRes';
{
 *  GetIndPattern()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure GetIndPattern(var thePat: Pattern; patternListID: SInt16; index: SInt16); external name '_GetIndPattern';


{
    From ToolUtils.i
}
{
 *  PackBits()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure PackBits(var srcPtr: Ptr; var dstPtr: Ptr; srcBytes: SInt16); external name '_PackBits';
{
 *  UnpackBits()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure UnpackBits(var srcPtr: Ptr; var dstPtr: Ptr; dstBytes: SInt16); external name '_UnpackBits';
{
 *  SlopeFromAngle()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SlopeFromAngle(angle: SInt16): Fixed; external name '_SlopeFromAngle';
{
 *  AngleFromSlope()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function AngleFromSlope(slope: Fixed): SInt16; external name '_AngleFromSlope';
{ New transfer modes }

const
    colorXorXFer                = 52;
    noiseXFer                   = 53;
    customXFer                  = 54;

    {    Custom XFer flags  }
    kXFer1PixelAtATime          = $00000001;                    {  1 pixel passed to custom XFer proc }
    kXFerConvertPixelToRGB32    = $00000002;                    {  All color depths converted to 32 bit RGB }


type
    CustomXFerRecPtr = ^CustomXFerRec;
    CustomXFerRec = record
        version:                UInt32;
        srcPixels:              Ptr;
        destPixels:             Ptr;
        resultPixels:           Ptr;
        refCon:                 UInt32;
        pixelSize:              UInt32;
        pixelCount:             UInt32;
        firstPixelHV:           Point;
        destBounds:             Rect;
    end;

    CustomXFerProcPtr = procedure(info: CustomXFerRecPtr);

    {
     *  GetPortCustomXFerProc()
     *
     *  Availability:
     *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function GetPortCustomXFerProc(port: CGrafPtr; var proc: CustomXFerProcPtr; var flags: UInt32; var refCon: UInt32): OSErr; external name '_GetPortCustomXFerProc';
{
 *  SetPortCustomXFerProc()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetPortCustomXFerProc(port: CGrafPtr; proc: CustomXFerProcPtr; flags: UInt32; refCon: UInt32): OSErr; external name '_SetPortCustomXFerProc';
const
    kCursorComponentsVersion    = $00010001;

    kCursorComponentType        = $63757273 (* 'curs' *);

    {    Cursor Component capabilities flags    }
    cursorDoesAnimate           = $00000001;
    cursorDoesHardware          = $00000002;
    cursorDoesUnreadableScreenBits = $00000004;

    {    Cursor Component output mode flags     }
    kRenderCursorInHardware     = $00000001;
    kRenderCursorInSoftware     = $00000002;

    {    Cursor Component Info  }

type
    CursorInfoPtr = ^CursorInfo;
    CursorInfo = record
        version:                SInt32;                             {  use kCursorComponentsVersion  }
        capabilities:           SInt32;
        animateDuration:        SInt32;                             {  approximate time between animate tickles  }
        bounds:                 Rect;
        hotspot:                Point;
        reserved:               SInt32;                             {  must set to zero  }
    end;

    {    Cursor Component Selectors     }

const
    kCursorComponentInit        = $0001;
    kCursorComponentGetInfo     = $0002;
    kCursorComponentSetOutputMode = $0003;
    kCursorComponentSetData     = $0004;
    kCursorComponentReconfigure = $0005;
    kCursorComponentDraw        = $0006;
    kCursorComponentErase       = $0007;
    kCursorComponentMove        = $0008;
    kCursorComponentAnimate     = $0009;
    kCursorComponentLastReserved = $0050;

    {
     *  OpenCursorComponent()
     *
     *  Availability:
     *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function OpenCursorComponent(c: Component; var ci: ComponentInstance): OSErr; external name '_OpenCursorComponent';
{
 *  CloseCursorComponent()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CloseCursorComponent(ci: ComponentInstance): OSErr; external name '_CloseCursorComponent';
{
 *  SetCursorComponent()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetCursorComponent(ci: ComponentInstance): OSErr; external name '_SetCursorComponent';
{
 *  CursorComponentChanged()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CursorComponentChanged(ci: ComponentInstance): OSErr; external name '_CursorComponentChanged';
{
 *  CursorComponentSetData()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CursorComponentSetData(ci: ComponentInstance; data: SInt32): OSErr; external name '_CursorComponentSetData';

{ Available in CarbonLib... }
{
 *  IsValidPort()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function IsValidPort(port: CGrafPtr): boolean; external name '_IsValidPort';


{ GrafPort }
{ Getters }
{
 *  GetPortPixMap()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetPortPixMap(port: CGrafPtr): PixMapHandle; external name '_GetPortPixMap';

{
 *  GetPortBitMapForCopyBits()
 *
 *  Discussion:
 *    GetPortBitMapForCopyBits is provided for the specific purpose of
 *    using the return value as a parameter to CopyBits. The return
 *    value can be used as the srcBits or dstBits parameter to CopyBits
 *    regardless of whether the port is color. If the port parameter is
 *    a color port, however, the returned BitMapPtr does not actually
 *    point to a BitMap; it points to the PixMapHandle and other fields
 *    in the CGrafPort structure. You should not dereference the
 *    BitMapPtr or otherwise depend on its contents unless you've
 *    confirmed that this port is a non-color port.
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0.2 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetPortBitMapForCopyBits(port: CGrafPtr): BitMapPtr; external name '_GetPortBitMapForCopyBits';

{
 *  GetPortBounds()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetPortBounds(port: CGrafPtr; var rect: Rect): RectPtr; external name '_GetPortBounds';

{
 *  GetPortForeColor()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetPortForeColor(port: CGrafPtr; var foreColor: RGBColor): RGBColorPtr; external name '_GetPortForeColor';

{
 *  GetPortBackColor()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetPortBackColor(port: CGrafPtr; var backColor: RGBColor): RGBColorPtr; external name '_GetPortBackColor';

{
 *  GetPortOpColor()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetPortOpColor(port: CGrafPtr; var opColor: RGBColor): RGBColorPtr; external name '_GetPortOpColor';

{
 *  GetPortHiliteColor()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetPortHiliteColor(port: CGrafPtr; var hiliteColor: RGBColor): RGBColorPtr; external name '_GetPortHiliteColor';

{
 *  GetPortGrafProcs()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetPortGrafProcs(port: CGrafPtr): CQDProcsPtr; external name '_GetPortGrafProcs';

{
 *  GetPortTextFont()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetPortTextFont(port: CGrafPtr): SInt16; external name '_GetPortTextFont';

{
 *  GetPortTextFace()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetPortTextFace(port: CGrafPtr): ByteParameter; external name '_GetPortTextFace';

{
 *  GetPortTextMode()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetPortTextMode(port: CGrafPtr): SInt16; external name '_GetPortTextMode';

{
 *  GetPortTextSize()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetPortTextSize(port: CGrafPtr): SInt16; external name '_GetPortTextSize';

{
 *  GetPortChExtra()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetPortChExtra(port: CGrafPtr): SInt16; external name '_GetPortChExtra';

{
 *  GetPortFracHPenLocation()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetPortFracHPenLocation(port: CGrafPtr): SInt16; external name '_GetPortFracHPenLocation';

{
 *  GetPortSpExtra()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetPortSpExtra(port: CGrafPtr): Fixed; external name '_GetPortSpExtra';

{
 *  GetPortPenVisibility()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetPortPenVisibility(port: CGrafPtr): SInt16; external name '_GetPortPenVisibility';

{
 *  GetPortVisibleRegion()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetPortVisibleRegion(port: CGrafPtr; visRgn: RgnHandle): RgnHandle; external name '_GetPortVisibleRegion';

{
 *  GetPortClipRegion()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetPortClipRegion(port: CGrafPtr; clipRgn: RgnHandle): RgnHandle; external name '_GetPortClipRegion';

{
 *  GetPortBackPixPat()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetPortBackPixPat(port: CGrafPtr; backPattern: PixPatHandle): PixPatHandle; external name '_GetPortBackPixPat';

{
 *  GetPortPenPixPat()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetPortPenPixPat(port: CGrafPtr; penPattern: PixPatHandle): PixPatHandle; external name '_GetPortPenPixPat';

{
 *  GetPortFillPixPat()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetPortFillPixPat(port: CGrafPtr; fillPattern: PixPatHandle): PixPatHandle; external name '_GetPortFillPixPat';

{
 *  GetPortPenSize()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetPortPenSize(port: CGrafPtr; var penSize: Point): PointPtr; external name '_GetPortPenSize';

{
 *  GetPortPenMode()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetPortPenMode(port: CGrafPtr): SInt32; external name '_GetPortPenMode';

{
 *  GetPortPenLocation()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetPortPenLocation(port: CGrafPtr; var penLocation: Point): PointPtr; external name '_GetPortPenLocation';

{
 *  IsPortRegionBeingDefined()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function IsPortRegionBeingDefined(port: CGrafPtr): boolean; external name '_IsPortRegionBeingDefined';

{
 *  IsPortPictureBeingDefined()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function IsPortPictureBeingDefined(port: CGrafPtr): boolean; external name '_IsPortPictureBeingDefined';

{
 *  IsPortPolyBeingDefined()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.3 and later
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 }
function IsPortPolyBeingDefined(port: CGrafPtr): boolean; external name '_IsPortPolyBeingDefined';

{
 *  IsPortOffscreen()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function IsPortOffscreen(port: CGrafPtr): boolean; external name '_IsPortOffscreen';

{
 *  IsPortColor()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0.2 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
function IsPortColor(port: CGrafPtr): boolean; external name '_IsPortColor';

{
 *  IsPortVisibleRegionEmpty()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.1 and later
 }
function IsPortVisibleRegionEmpty(port: CGrafPtr): boolean; external name '_IsPortVisibleRegionEmpty';

{
 *  IsPortClipRegionEmpty()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.1 and later
 }
function IsPortClipRegionEmpty(port: CGrafPtr): boolean; external name '_IsPortClipRegionEmpty';

{
 *  SectRegionWithPortClipRegion()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.1 and later
 }
procedure SectRegionWithPortClipRegion(port: CGrafPtr; ioRegion: RgnHandle); external name '_SectRegionWithPortClipRegion';

{
 *  SectRegionWithPortVisibleRegion()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.1 and later
 }
procedure SectRegionWithPortVisibleRegion(port: CGrafPtr; ioRegion: RgnHandle); external name '_SectRegionWithPortVisibleRegion';


{ Swappers }
{
 *  SwapPortPicSaveHandle()
 *
 *  Summary:
 *    Sets the port's picSave Handle, and returns the previous picSave
 *
 *  Discussion:
 *    Historically, the picSave field in a GrafPort is != NULL if a
 *    Picture is being defined; and it has been documented that picture
 *    definition can be temporarily suspended by saving the current
 *    picSave Handle and setting picSave to NULL. Restoring the saved
 *    picSave Handle resumes picture definition.
 *
 *  Parameters:
 *
 *    port:
 *      The port whose picSave field is being swapped.
 *
 *    inPicSaveHdl:
 *      The picSave Handle to be set.
 *
 *  Result:
 *    The previous picSave Handle in the port.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.5 and later
 *    Mac OS X:         in version 10.1 and later
 }
function SwapPortPicSaveHandle(port: CGrafPtr; inPicSaveHdl: Handle): Handle; external name '_SwapPortPicSaveHandle';

{ Similarly: }
{
 *  SwapPortPolySaveHandle()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.6 and later
 *    Mac OS X:         in version 10.2 and later
 }
function SwapPortPolySaveHandle(port: CGrafPtr; inPolySaveHdl: Handle): Handle; external name '_SwapPortPolySaveHandle';

{
 *  SwapPortRegionSaveHandle()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.6 and later
 *    Mac OS X:         in version 10.2 and later
 }
function SwapPortRegionSaveHandle(port: CGrafPtr; inRegionSaveHdl: Handle): Handle; external name '_SwapPortRegionSaveHandle';


{ Setters }
{
 *  SetPortBounds()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetPortBounds(port: CGrafPtr; const (*var*) rect: Rect); external name '_SetPortBounds';

{
 *  SetPortOpColor()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetPortOpColor(port: CGrafPtr; const (*var*) opColor: RGBColor); external name '_SetPortOpColor';

{
 *  SetPortGrafProcs()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetPortGrafProcs(port: CGrafPtr; procs: CQDProcsPtr); external name '_SetPortGrafProcs';

{
 *  SetPortTextFont()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.5 and later
 *    Mac OS X:         in version 10.1 and later
 }
procedure SetPortTextFont(port: CGrafPtr; txFont: SInt16); external name '_SetPortTextFont';

{
 *  SetPortTextSize()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.5 and later
 *    Mac OS X:         in version 10.1 and later
 }
procedure SetPortTextSize(port: CGrafPtr; txSize: SInt16); external name '_SetPortTextSize';

{
 *  SetPortTextFace()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.5 and later
 *    Mac OS X:         in version 10.1 and later
 }
procedure SetPortTextFace(port: CGrafPtr; face: StyleParameter); external name '_SetPortTextFace';

{
 *  SetPortTextMode()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.5 and later
 *    Mac OS X:         in version 10.1 and later
 }
procedure SetPortTextMode(port: CGrafPtr; mode: SInt16); external name '_SetPortTextMode';

{
 *  SetPortVisibleRegion()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetPortVisibleRegion(port: CGrafPtr; visRgn: RgnHandle); external name '_SetPortVisibleRegion';

{
 *  SetPortClipRegion()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetPortClipRegion(port: CGrafPtr; clipRgn: RgnHandle); external name '_SetPortClipRegion';

{
 *  SetPortPenPixPat()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetPortPenPixPat(port: CGrafPtr; penPattern: PixPatHandle); external name '_SetPortPenPixPat';

{
 *  SetPortFillPixPat()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.2 and later
 *    CarbonLib:        in CarbonLib 1.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetPortFillPixPat(port: CGrafPtr; penPattern: PixPatHandle); external name '_SetPortFillPixPat';

{
 *  SetPortBackPixPat()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetPortBackPixPat(port: CGrafPtr; backPattern: PixPatHandle); external name '_SetPortBackPixPat';

{
 *  SetPortPenSize()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetPortPenSize(port: CGrafPtr; penSize: Point); external name '_SetPortPenSize';

{
 *  SetPortPenMode()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetPortPenMode(port: CGrafPtr; penMode: SInt32); external name '_SetPortPenMode';

{
 *  SetPortFracHPenLocation()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetPortFracHPenLocation(port: CGrafPtr; pnLocHFrac: SInt16); external name '_SetPortFracHPenLocation';

{ PixMap }
{
 *  GetPixBounds()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetPixBounds(pixMap: PixMapHandle; var bounds: Rect): RectPtr; external name '_GetPixBounds';

{
 *  GetPixDepth()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetPixDepth(pixMap: PixMapHandle): SInt16; external name '_GetPixDepth';

{ QDGlobals }
{ Getters }
{
 *  GetQDGlobalsRandomSeed()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetQDGlobalsRandomSeed: SInt32; external name '_GetQDGlobalsRandomSeed';

{
 *  GetQDGlobalsScreenBits()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetQDGlobalsScreenBits(var screenBits: BitMap): BitMapPtr; external name '_GetQDGlobalsScreenBits';

{
 *  GetQDGlobalsArrow()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetQDGlobalsArrow(var arrow: Cursor): CursorPtr; external name '_GetQDGlobalsArrow';

{
 *  GetQDGlobalsDarkGray()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetQDGlobalsDarkGray(var dkGray: Pattern): PatternPtr; external name '_GetQDGlobalsDarkGray';

{
 *  GetQDGlobalsLightGray()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetQDGlobalsLightGray(var ltGray: Pattern): PatternPtr; external name '_GetQDGlobalsLightGray';

{
 *  GetQDGlobalsGray()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetQDGlobalsGray(var gray: Pattern): PatternPtr; external name '_GetQDGlobalsGray';

{
 *  GetQDGlobalsBlack()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetQDGlobalsBlack(var black: Pattern): PatternPtr; external name '_GetQDGlobalsBlack';

{
 *  GetQDGlobalsWhite()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetQDGlobalsWhite(var white: Pattern): PatternPtr; external name '_GetQDGlobalsWhite';

{
 *  GetQDGlobalsThePort()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetQDGlobalsThePort: CGrafPtr; external name '_GetQDGlobalsThePort';

{ Setters }
{
 *  SetQDGlobalsRandomSeed()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetQDGlobalsRandomSeed(randomSeed: SInt32); external name '_SetQDGlobalsRandomSeed';

{
 *  SetQDGlobalsArrow()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetQDGlobalsArrow(const (*var*) arrow: Cursor); external name '_SetQDGlobalsArrow';

{ Regions }
{
 *  GetRegionBounds()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetRegionBounds(region: RgnHandle; var bounds: Rect): RectPtr; external name '_GetRegionBounds';

{
 *  IsRegionRectangular()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function IsRegionRectangular(region: RgnHandle): boolean; external name '_IsRegionRectangular';

{ Utilities }
{ To prevent upward dependencies, GetWindowFromPort() is defined in Window Manager interface: }
{      pascal WindowRef        GetWindowFromPort(CGrafPtr port); }
{ NewPtr/OpenCPort doesn't work with opaque structures }
{
 *  CreateNewPort()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CreateNewPort: CGrafPtr; external name '_CreateNewPort';

{
 *  DisposePort()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposePort(port: CGrafPtr); external name '_DisposePort';


{
 *  SetQDError()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0.2 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetQDError(err: OSErr); external name '_SetQDError';


{  Helpful Carbon-only utilities (finally made public) }

{
 *  QDLocalToGlobalPoint()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function QDLocalToGlobalPoint(port: CGrafPtr; var point: Point): PointPtr; external name '_QDLocalToGlobalPoint';

{
 *  QDGlobalToLocalPoint()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function QDGlobalToLocalPoint(port: CGrafPtr; var point: Point): PointPtr; external name '_QDGlobalToLocalPoint';

{
 *  QDLocalToGlobalRect()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function QDLocalToGlobalRect(port: CGrafPtr; var bounds: Rect): RectPtr; external name '_QDLocalToGlobalRect';

{
 *  QDGlobalToLocalRect()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function QDGlobalToLocalRect(port: CGrafPtr; var bounds: Rect): RectPtr; external name '_QDGlobalToLocalRect';

{
 *  QDLocalToGlobalRegion()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function QDLocalToGlobalRegion(port: CGrafPtr; region: RgnHandle): RgnHandle; external name '_QDLocalToGlobalRegion';

{
 *  QDGlobalToLocalRegion()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function QDGlobalToLocalRegion(port: CGrafPtr; region: RgnHandle): RgnHandle; external name '_QDGlobalToLocalRegion';


{
   Routines available on Mac OS X to flush buffered window ports...
   These calls do nothing on Mac OS 8/9. QDIsPortBuffered will always return false there.
}

{
 *  QDIsPortBuffered()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
function QDIsPortBuffered(port: CGrafPtr): boolean; external name '_QDIsPortBuffered';

{
 *  QDIsPortBufferDirty()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
function QDIsPortBufferDirty(port: CGrafPtr): boolean; external name '_QDIsPortBufferDirty';

{
 *  QDFlushPortBuffer()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure QDFlushPortBuffer(port: CGrafPtr; region: RgnHandle); external name '_QDFlushPortBuffer';

{
 *  QDGetDirtyRegion()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function QDGetDirtyRegion(port: CGrafPtr; rgn: RgnHandle): OSStatus; external name '_QDGetDirtyRegion';

{
 *  QDSetDirtyRegion()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function QDSetDirtyRegion(port: CGrafPtr; rgn: RgnHandle): OSStatus; external name '_QDSetDirtyRegion';

{
 *  QDAddRectToDirtyRegion()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.5 and later
 *    Mac OS X:         in version 10.0 and later
 }
function QDAddRectToDirtyRegion(inPort: CGrafPtr; const (*var*) inBounds: Rect): OSStatus; external name '_QDAddRectToDirtyRegion';

{
 *  QDAddRegionToDirtyRegion()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.5 and later
 *    Mac OS X:         in version 10.0 and later
 }
function QDAddRegionToDirtyRegion(inPort: CGrafPtr; inRegion: RgnHandle): OSStatus; external name '_QDAddRegionToDirtyRegion';


{
 *  CreateCGContextForPort()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CreateCGContextForPort(inPort: CGrafPtr; var outContext: CGContextRef): OSStatus; external name '_CreateCGContextForPort';

{
 *  ClipCGContextToRegion()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ClipCGContextToRegion(gc: CGContextRef; const (*var*) portRect: Rect; region: RgnHandle): OSStatus; external name '_ClipCGContextToRegion';

{
 *  SyncCGContextOriginWithPort()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SyncCGContextOriginWithPort(inContext: CGContextRef; port: CGrafPtr): OSStatus; external name '_SyncCGContextOriginWithPort';

{
 *  QDBeginCGContext()
 *
 *  Summary:
 *    Allow CoreGraphics drawing in a CGrafPort
 *
 *  Discussion:
 *    So far, CreateCGContextForPort() was used to create a CGContext
 *    for CG drawing from a CGrafPort. However, if the current port is
 *    a printing port, the CreateCGContextForPort fails; consequently,
 *    there was no way to mix Quickdraw and CoreGraphics drawing and
 *    still print it. If, instead, the CoreGraphics drawing is
 *    bracketed by QDBeginCGContext/QDEndCGContext calls, the drawing
 *    will also appear in print. There are some restrictions on the
 *    usage of QDBeginCGContext/QDEndCGContext:
 *    - Between QDBeginCGContext and QDEndCGContext, Quickdraw drawing
 *    is disabled; only CoreGraphics drawing is allowed
 *    - QDBeginCGContext/QDEndCGContext calls can not be nested
 *    - QDEndCGContext releases the CGContext returned from
 *    QDBeginCGContext and sets it to NULL.
 *
 *  Parameters:
 *
 *    inPort:
 *      The current port
 *
 *    outContext:
 *      The CGContextRef to be used for CG drawing
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.1 and later
 *    Mac OS X:         in version 10.1 and later
 }
function QDBeginCGContext(inPort: CGrafPtr; var outContext: CGContextRef): OSStatus; external name '_QDBeginCGContext';

{
 *  QDEndCGContext()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.1 and later
 *    Mac OS X:         in version 10.1 and later
 }
function QDEndCGContext(inPort: CGrafPtr; var inoutContext: CGContextRef): OSStatus; external name '_QDEndCGContext';

{
    The following routines are implemented in CarbonLib, and on Mac OS X in QD proper.
    They save the pixel data of a region in a packed format for quick save/restore
    without using a lot of memory to do a large, hollow region, such as the region
    used when drag hiliting (which is where this is used).
}


type
    QDRegionBitsRef    = ^SInt32; { an opaque 32-bit type }
    QDRegionBitsRefPtr = ^QDRegionBitsRef;  { when a var xx:QDRegionBitsRef parameter can be nil, it is changed to xx: QDRegionBitsRefPtr }
    {
     *  QDSaveRegionBits()
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.1 and later
        }
function QDSaveRegionBits(region: RgnHandle): QDRegionBitsRef; external name '_QDSaveRegionBits';

{
 *  QDRestoreRegionBits()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.1 and later
 }
function QDRestoreRegionBits(region: RgnHandle; regionBits: QDRegionBitsRef): OSStatus; external name '_QDRestoreRegionBits';

{
 *  QDDisposeRegionBits()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.1 and later
 }
function QDDisposeRegionBits(regionBits: QDRegionBitsRef): OSStatus; external name '_QDDisposeRegionBits';

{
   Developers need a way to go from a CGDirectDisplay environment to Quickdraw.
   The following is equivalent to CreateNewPort(), but instead of taking the
   portPixMap from the current GDevice, it uses the GDevice corresponding to
   the CGSDisplayID passed in. If the CGSDisplayID is invalid, the mainDevice
   is used instead.
}
{
 *  CreateNewPortForCGDisplayID()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CreateNewPortForCGDisplayID(inCGDisplayID: UInt32): CGrafPtr; external name '_CreateNewPortForCGDisplayID';

{
   In Mac OS X, developers should be able to turn the WaitCursor (spinning wheel)
   on and off. QDDisplayWaitCursor() keeps track of nested calls.
   Passing FALSE will resume automatic wait cursor operation.
   Call this function only from an application in the foreground.
}
{
 *  QDDisplayWaitCursor()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure QDDisplayWaitCursor(forceWaitCursor: boolean); external name '_QDDisplayWaitCursor';

{
 *  QDSetPatternOrigin()
 *
 *  Summary:
 *    Sets the pattern origin for the current port.
 *
 *  Discussion:
 *    When a QuickDraw drawing operation uses a pattern (either a
 *    black&white pattern or a PixPat), the pattern's image is aligned
 *    with port origin, modified by the pattern origin of the port. For
 *    example, if the background pattern is a 10x10 image, and a
 *    rectangle with coordinates (3, 3, 10, 10) is filled with that
 *    pattern, then only the bottom right 7x7 portion of the pattern
 *    image will be drawn into the rectangle. When drawing a pattern,
 *    QuickDraw always starts with the port origin and then adjusts it
 *    by the pattern origin to determine the actual origin point of
 *    pattern drawing. QDSetPatternOrigin can be used to set the
 *    pattern origin relative to the port origin. It is often used in
 *    conjuction with SetOrigin to maintain the pattern alignment at
 *    (0,0) in a window's content area, regardless of the port origin;
 *    for example, after changing the port's origin to (10,10), an
 *    application might change the port's pattern origin to (-10, -10)
 *    so that patterns are still aligned with the window's content area.
 *
 *  Parameters:
 *
 *    origin:
 *      The new pattern origin of the port.
 *
 *  Availability:
 *    Non-Carbon CFM:   in NQD 8.5 and later
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.1 and later
 }
procedure QDSetPatternOrigin(origin: Point); external name '_QDSetPatternOrigin';

{
 *  QDGetPatternOrigin()
 *
 *  Summary:
 *    Returns the pattern origin of the current port.
 *
 *  Parameters:
 *
 *    origin:
 *      On exit, contains the current port's pattern origin.
 *
 *  Availability:
 *    Non-Carbon CFM:   in NQD 8.5 and later
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.1 and later
 }
procedure QDGetPatternOrigin(var origin: Point); external name '_QDGetPatternOrigin';

{
 *  QDIsNamedPixMapCursorRegistered()
 *
 *  Summary:
 *    Returns whether a named cursor has already been registered.
 *
 *  Discussion:
 *    The CoreGraphics Scalable Cursor Registry provides support for
 *    cursors based on PixMaps for crsrData and crsrMask, with sizes up
 *    to 64x64 pixels. Such cursors need to be registered via
 *    QDRegisterNamedPixMapCursor, and can then be set by
 *    QDSetNamedPixMapCursor.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    name:
 *      (see below at QDRegisterNamedPixMapCursor)
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in ApplicationServices.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
function QDIsNamedPixMapCursorRegistered( name: ConstCStringPtr ): Boolean; external name '_QDIsNamedPixMapCursorRegistered';



{
 *  QDRegisterNamedPixMapCursor()
 *
 *  Summary:
 *    Register a new cursor by name
 *
 *  Discussion:
 *    In order to set a PixMapCursor, it needs to be registered first
 *    by name. This only succeeds if the system supports Hardware
 *    Cursors (depending on video circuits). There is also the obvious
 *    companion function QDUnregisterNamedPixMapCursor. NOTE: The
 *    original implementation of QDUnregisterNamedPixMapCursor was
 *    misspelled "QDUnregisterNamedPixMapCursur".
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    crsrData:
 *      A PixMapHandle representing the cursor pixels. If the
 *      pixelDepth is 32, the crsrMask PixMapHandle can be NULL; in
 *      this case, the alpha channel in the ARGB PixMap is used as
 *      mask. If a crsrMask is provided, the alpha channel in crsrData
 *      is ignored. The pixelDepth can be any of 1, 2, 4, 8, 16 or 32.
 *
 *    crsrMask:
 *      A PixMapHandle representing the mask. It is assumed to be in
 *      8-bit deep grayScale format, although other depths are accepted
 *      and converted to 8-bit grayScale (using CopyBits). The
 *      (**crsrMask).bounds rectangle needs to match
 *      (**crsrData).bounds. If the crsrData are 32-bit deep, crsrMask
 *      can be NULL, and the alpha bytes in the crsrData ARGB pixels
 *      are used as mask.
 *
 *    hotSpot:
 *      The usual cursor hotspot, in coordinates relativ to
 *      (**crsrData).bounds.topLeft.
 *
 *    name:
 *      A naming convention involving the name of your application and
 *      descriptive cursor names or resource IDs is suggested. Cursor
 *      names are 0-terminated C-strings up to a length of 127. $result
 *              OSStatus: noErr = 0 for success, or (constants from
 *      MacErrors.h): kQDNoColorHWCursorSupport,
 *      kQDCursorAlreadyRegistered, paramErr, memFullErr, or a CGError
 *      as returned internally from CoreGraphics.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in ApplicationServices.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
function QDRegisterNamedPixMapCursor( crsrData: PixMapHandle; crsrMask: PixMapHandle; hotSpot: Point; name: ConstCStringPtr ): OSStatus; external name '_QDRegisterNamedPixMapCursor';


{
 *  QDUnregisterNamedPixMapCursur()
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in ApplicationServices.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
function QDUnregisterNamedPixMapCursur( name: ConstCStringPtr ): OSStatus; external name '_QDUnregisterNamedPixMapCursur';


{
 *  QDUnregisterNamedPixMapCursor()
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in ApplicationServices.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function QDUnregisterNamedPixMapCursor( name: ConstCStringPtr ): OSStatus; external name '_QDUnregisterNamedPixMapCursor';


{
 *  QDSetNamedPixMapCursor()
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in ApplicationServices.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
function QDSetNamedPixMapCursor( name: ConstCStringPtr ): OSStatus; external name '_QDSetNamedPixMapCursor';


type
    QDXSystemCursorID = UInt32;
const
  kQDXArrowCursor               = 0;
  kQDXIBeamCursor               = 1;
  kQDXIBeamXORCursor            = 2;
  kQDXAliasCursor               = 3;
  kQDXCopyCursor                = 4;
  kQDXMoveCursor                = 5;
  kQDXNumberOfSystemCursors     = 6;     { Must be last }


{
 *  QDGetCursorNameForSystemCursor()
 *
 *  Summary:
 *    Return the name of one of the predefined Mac OS X system cursors
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    cursorID:
 *      UInt32 in the range 0 ... kQDXNumberOfSystemCursors - 1 (see
 *      enum above)
 *
 *  Result:
 *    const char* name, or NULL if 'cursorID' is out of range
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in ApplicationServices.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function QDGetCursorNameForSystemCursor( cursorID: QDXSystemCursorID ): ConstCStringPtr; external name '_QDGetCursorNameForSystemCursor';




{
 *  QDSetCursorScale()
 *
 *  Summary:
 *    Set a scaling factor for the cursor.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    scale:
 *      Must be at least 0.5, and integer values (1.0, 2.0, 3.0, 4.0)
 *      are recommended. The scaling factor is system-wide (applies to
 *      all apps), and is intended for use in such things as assisting
 *      the visually impaired.  The scaling factor is treated as a hint
 *      to the system, and the exact scale applied may be limited by
 *      device driver capabilities and performance considerations.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in ApplicationServices.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
function QDSetCursorScale( scale: Float32 ): OSStatus; external name '_QDSetCursorScale';


{
 *  QDGetCursorScale()
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in ApplicationServices.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function QDGetCursorScale( outScale: Float32Ptr ): OSStatus; external name '_QDGetCursorScale';



{
 *  QDGetCursorData()
 *
 *  Summary:
 *    Allocate and return a PixMapHandle with the cursor data; also
 *    return the hotSpot. The caller is responsible for calling
 *    DisposePtr((**crsrData).baseAddr) and DisposePixMap(crsrData)
 *    when done with the crsrData returned.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    contextCursor:
 *      A Boolean; if true, return data for the current context cursor,
 *      if false, return data for the currently showing global cursor.
 *
 *    crsrData:
 *      Allocates a PixMapHandle and pixelData in baseAddr,
 *      corresponding to the cursorData. The pixelData are in 32-bit
 *      ARGB format, with the mask contained in the alpha channel. This
 *      PixMapHandle can be passed as crsrData to
 *      QDRegisterNamedPixMapCursor, above (with crsrMask = NULL). If
 *      the return result indicates an error, NULL is returned.
 *
 *    hotSpot:
 *      Contains the cursor hotSpot, if successful.
 *
 *  Result:
 *    noErr if successful, or whatever error is returned from lower
 *    levels otherwise.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in ApplicationServices.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function QDGetCursorData( contextCursor: Boolean; var crsrData: PixMapHandle; var hotSpot: Point ): OSStatus; external name '_QDGetCursorData';

const
  kQDUseDefaultTextRendering    = 0;    { Sets whatever is specified in system defaults. }
                                        { Currently sets kQDUseTrueTypeScalerGlyphs if nothing is specified.}
  kQDUseTrueTypeScalerGlyphs    = (1 shl 0); { bit 0}
  kQDUseCGTextRendering         = (1 shl 1); { bit 1}
  kQDUseCGTextMetrics           = (1 shl 2); { bit 2}
  kQDSupportedFlags             = kQDUseTrueTypeScalerGlyphs or kQDUseCGTextRendering or kQDUseCGTextMetrics;
  kQDDontChangeFlags            = $FFFFFFFF; { to request the current state, without changing anything }



{
 *  QDSwapTextFlags()
 *
 *  Summary:
 *    Returns current flags and optionally sets new flags.
 *
 *  Discussion:
 *    Currently, only the flag bits in the enum above are supported.
 *    The typical usage is UInt32 savedFlags =
 *    QDSwapTextFlags(newFlags); // ... draw text under the conditions
 *    of "newFlags" ... (void)QDSwapTextFlags(savedFlags);  // restore
 *    previous setting
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    newFlags:
 *      Use the enums above; example "kQDUseCGTextRendering |
 *      kQDUseCGTextMetrics".
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in ApplicationServices.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
function QDSwapTextFlags( newFlags: UInt32 ): UInt32; external name '_QDSwapTextFlags';


{
 *  QDSwapPortTextFlags()
 *
 *  Summary:
 *    Same as QDSwapTextFlags, but per GrafPort.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    port:
 *      Settings per port override any global settings. If port ==
 *      NULL, the current port is used.
 *
 *    newFlags:
 *      As in QDSwapTextFlags, above.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in ApplicationServices.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
function QDSwapPortTextFlags( port: CGrafPtr; newFlags: UInt32 ): UInt32; external name '_QDSwapPortTextFlags';



{
 *  QDGetCGDirectDisplayID()
 *
 *  Summary:
 *    Return the CGDirectDisplayID corresponding to a GDHandle
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inGDevice:
 *      The GDevice handle corresponding to the device for which the
 *      CGDirectDisplayID is requested
 *
 *  Result:
 *    The CGDirectDisplayID, or 0 if the GDHandle does not represent a
 *    display.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in ApplicationServices.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function QDGetCGDirectDisplayID( inGDevice: GDHandle ): CGDirectDisplayID; external name '_QDGetCGDirectDisplayID';

{
    LowMem accessor functions previously in LowMem.h
}
{
 *  LMGetScrVRes()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function LMGetScrVRes: SInt16; external name '_LMGetScrVRes';
{
 *  LMSetScrVRes()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure LMSetScrVRes(value: SInt16); external name '_LMSetScrVRes';
{
 *  LMGetScrHRes()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function LMGetScrHRes: SInt16; external name '_LMGetScrHRes';
{
 *  LMSetScrHRes()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure LMSetScrHRes(value: SInt16); external name '_LMSetScrHRes';
{
 *  LMGetMainDevice()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function LMGetMainDevice: GDHandle; external name '_LMGetMainDevice';
{
 *  LMSetMainDevice()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure LMSetMainDevice(value: GDHandle); external name '_LMSetMainDevice';
{
 *  LMGetDeviceList()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function LMGetDeviceList: GDHandle; external name '_LMGetDeviceList';
{
 *  LMSetDeviceList()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure LMSetDeviceList(value: GDHandle); external name '_LMSetDeviceList';
{
 *  LMGetQDColors()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function LMGetQDColors: Handle; external name '_LMGetQDColors';
{
 *  LMSetQDColors()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure LMSetQDColors(value: Handle); external name '_LMSetQDColors';
{
 *  LMGetWidthListHand()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function LMGetWidthListHand: Handle; external name '_LMGetWidthListHand';
{
 *  LMSetWidthListHand()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure LMSetWidthListHand(value: Handle); external name '_LMSetWidthListHand';
{
 *  LMGetHiliteMode()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function LMGetHiliteMode: ByteParameter; external name '_LMGetHiliteMode';
{
 *  LMSetHiliteMode()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure LMSetHiliteMode(value: ByteParameter); external name '_LMSetHiliteMode';
{
 *  LMGetWidthPtr()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function LMGetWidthPtr: Ptr; external name '_LMGetWidthPtr';
{
 *  LMSetWidthPtr()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure LMSetWidthPtr(value: Ptr); external name '_LMSetWidthPtr';
{
 *  LMGetWidthTabHandle()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function LMGetWidthTabHandle: Handle; external name '_LMGetWidthTabHandle';
{
 *  LMSetWidthTabHandle()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure LMSetWidthTabHandle(value: Handle); external name '_LMSetWidthTabHandle';
{
 *  LMGetLastSPExtra()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function LMGetLastSPExtra: SInt32; external name '_LMGetLastSPExtra';
{
 *  LMSetLastSPExtra()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure LMSetLastSPExtra(value: SInt32); external name '_LMSetLastSPExtra';
{
 *  LMGetLastFOND()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function LMGetLastFOND: Handle; external name '_LMGetLastFOND';
{
 *  LMSetLastFOND()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure LMSetLastFOND(value: Handle); external name '_LMSetLastFOND';
{
 *  LMGetFractEnable()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function LMGetFractEnable: ByteParameter; external name '_LMGetFractEnable';
{
 *  LMSetFractEnable()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure LMSetFractEnable(value: ByteParameter); external name '_LMSetFractEnable';
{
 *  LMGetTheGDevice()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function LMGetTheGDevice: GDHandle; external name '_LMGetTheGDevice';
{
 *  LMSetTheGDevice()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure LMSetTheGDevice(value: GDHandle); external name '_LMSetTheGDevice';
{
 *  LMGetHiliteRGB()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure LMGetHiliteRGB(var hiliteRGBValue: RGBColor); external name '_LMGetHiliteRGB';

{
 *  LMSetHiliteRGB()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure LMSetHiliteRGB(const (*var*) hiliteRGBValue: RGBColor); external name '_LMSetHiliteRGB';


{
 *  LMGetCursorNew()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function LMGetCursorNew: boolean; external name '_LMGetCursorNew';
{
 *  LMSetCursorNew()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure LMSetCursorNew(value: boolean); external name '_LMSetCursorNew';
{$ALIGN MAC68K}
{#POP}
{unit TextEdit}
{$ALIGN MAC68K}










{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}


type
    TERecPtr = ^TERec;
    TEPtr                               = ^TERec;
    TEHandle                            = ^TEPtr;
    HighHookProcPtr = procedure(const (*var*) r: Rect; pTE: TEPtr);

    EOLHookProcPtr = function(theChar: ByteParameter; pTE: TEPtr; hTE: TEHandle): boolean;

    CaretHookProcPtr = procedure(const (*var*) r: Rect; pTE: TEPtr);

    WidthHookProcPtr = function(textLen: UInt16; textOffset: UInt16; textBufferPtr: UnivPtr; pTE: TEPtr; hTE: TEHandle): UInt16;

    TextWidthHookProcPtr = function(textLen: UInt16; textOffset: UInt16; textBufferPtr: UnivPtr; pTE: TEPtr; hTE: TEHandle): UInt16;

    NWidthHookProcPtr = function(styleRunLen: UInt16; styleRunOffset: UInt16; slop: SInt16; direction: SInt16; textBufferPtr: UnivPtr; var lineStart: SInt16; pTE: TEPtr; hTE: TEHandle): UInt16;

    DrawHookProcPtr = procedure(textOffset: UInt16; drawLen: UInt16; textBufferPtr: UnivPtr; pTE: TEPtr; hTE: TEHandle);

    HitTestHookProcPtr = function(styleRunLen: UInt16; styleRunOffset: UInt16; slop: UInt16; textBufferPtr: UnivPtr; pTE: TEPtr; hTE: TEHandle; var pixelWidth: UInt16; var charOffset: UInt16; var pixelInChar: boolean): boolean;

    TEFindWordProcPtr = procedure(currentPos: UInt16; caller: SInt16; pTE: TEPtr; hTE: TEHandle; var wordStart: UInt16; var wordEnd: UInt16);

    TERecalcProcPtr = procedure(pTE: TEPtr; changeLength: UInt16; var lineStart: UInt16; var firstChar: UInt16; var lastChar: UInt16);

    TEDoTextProcPtr = procedure(pTE: TEPtr; firstChar: UInt16; lastChar: UInt16; selector: SInt16; var currentGrafPort: GrafPtr; var charPosition: SInt16);

    TEClickLoopProcPtr = function(pTE: TEPtr): boolean;

    WordBreakProcPtr = function(text: Ptr; charPos: SInt16): boolean;

    {
        Important note about TEClickLoopProcPtr and WordBreakProcPtr

        At one point these were defined as returning the function result in the
        condition code Z-bit.  This was correct, in that it was what the 68K
        implementation of TextEdit actually tested.  But, MixedMode had a different
        idea of what returning a boolean in the Z-bit meant.  MixedMode was setting
        the Z-bit the complement of what was wanted.

        Therefore, these ProcPtrs have been changed (back) to return the result in
        register D0.  It turns out that for register based routines,
        MixedMode sets the Z-bit of the 68K emulator based on the contents
        of the return result register.  Thus we can get the Z-bit set correctly.

        But, when TextEdit is recoded in PowerPC, if it calls a 68K ClickLoop
        or WordBreak routine, register D0 had better have the result (in addition
        to the Z-bit). Therefore all 68K apps should make sure their ClickLoop or
        WordBreak routines set register D0 at the end.
        }

    {
        There is no function to get/set the low-mem for FindWordHook at 0x07F8.
        This is because it is not a low-mem ProcPtr. That address is the entry
        in the OS TrapTable for trap 0xA0FE.  You can use Get/SetTrapAddress to
        acccess it.
        }

    {
        The following ProcPtrs cannot be written in or called from a high-level
        language without the help of mixed mode or assembly glue because they
        use the following parameter-passing conventions:

        typedef pascal void (*HighHookProcPtr)(const Rect *r, TEPtr pTE);
        typedef pascal void (*CaretHookProcPtr)(const Rect *r, TEPtr pTE);

            In:
                =>  r                       on stack
                =>  pTE                     A3.L
            Out:
                none

        typedef pascal Boolean (*EOLHookProcPtr)(char theChar, TEPtr pTE, TEHandle hTE);

            In:
                =>  theChar                 D0.B
                =>  pTE                     A3.L
                =>  hTE                     A4.L
            Out:
                <=  Boolean                 Z bit of the CCR

        typedef pascal unsigned short (*WidthHookProcPtr)(unsigned short textLen,
         unsigned short textOffset, void *textBufferPtr, TEPtr pTE, TEHandle hTE);
        typedef pascal unsigned short (*TextWidthHookProcPtr)(unsigned short textLen,
         unsigned short textOffset, void *textBufferPtr, TEPtr pTE, TEHandle hTE);

            In:
                =>  textLen                 D0.W
                =>  textOffset              D1.W
                =>  textBufferPtr           A0.L
                =>  pTE                     A3.L
                =>  hTE                     A4.L
            Out:
                <=  unsigned short          D1.W

        typedef pascal unsigned short (*NWidthHookProcPtr)(unsigned short styleRunLen,
         unsigned short styleRunOffset, short slop, short direction, void *textBufferPtr,
         short *lineStart, TEPtr pTE, TEHandle hTE);

            In:
                =>  styleRunLen             D0.W
                =>  styleRunOffset          D1.W
                =>  slop                    D2.W (low)
                =>  direction               D2.W (high)
                =>  textBufferPtr           A0.L
                =>  lineStart               A2.L
                =>  pTE                     A3.L
                =>  hTE                     A4.L
            Out:
                <=  unsigned short          D1.W

        typedef pascal void (*DrawHookProcPtr)(unsigned short textOffset, unsigned short drawLen,
         void *textBufferPtr, TEPtr pTE, TEHandle hTE);

            In:
                =>  textOffset              D0.W
                =>  drawLen                 D1.W
                =>  textBufferPtr           A0.L
                =>  pTE                     A3.L
                =>  hTE                     A4.L
            Out:
                none

        typedef pascal Boolean (*HitTestHookProcPtr)(unsigned short styleRunLen,
         unsigned short styleRunOffset, unsigned short slop, void *textBufferPtr,
         TEPtr pTE, TEHandle hTE, unsigned short *pixelWidth, unsigned short *charOffset,
         Boolean *pixelInChar);

            In:
                =>  styleRunLen             D0.W
                =>  styleRunOffset          D1.W
                =>  slop                    D2.W
                =>  textBufferPtr           A0.L
                =>  pTE                     A3.L
                =>  hTE                     A4.L
            Out:
                <=  pixelWidth              D0.W (low)
                <=  Boolean                 D0.W (high)
                <=  charOffset              D1.W
                <=  pixelInChar             D2.W

        typedef pascal void (*TEFindWordProcPtr)(unsigned short currentPos, short caller,
         TEPtr pTE, TEHandle hTE, unsigned short *wordStart, unsigned short *wordEnd);

            In:
                =>  currentPos              D0.W
                =>  caller                  D2.W
                =>  pTE                     A3.L
                =>  hTE                     A4.L
            Out:
                <=  wordStart               D0.W
                <=  wordEnd                 D1.W

        typedef pascal void (*TERecalcProcPtr)(TEPtr pTE, unsigned short changeLength,
         unsigned short *lineStart, unsigned short *firstChar, unsigned short *lastChar);

            In:
                =>  pTE                     A3.L
                =>  changeLength            D7.W
            Out:
                <=  lineStart               D2.W
                <=  firstChar               D3.W
                <=  lastChar                D4.W

        typedef pascal void (*TEDoTextProcPtr)(TEPtr pTE, unsigned short firstChar, unsigned short lastChar,
                            short selector, GrafPtr *currentGrafPort, short *charPosition);

            In:
                =>  pTE                     A3.L
                =>  firstChar               D3.W
                =>  lastChar                D4.W
                =>  selector                D7.W
            Out:
                <=  currentGrafPort         A0.L
                <=  charPosition            D0.W

        }
    HighHookUPP = ^SInt32; { an opaque UPP }
    EOLHookUPP = ^SInt32; { an opaque UPP }
    CaretHookUPP = ^SInt32; { an opaque UPP }
    WidthHookUPP = ^SInt32; { an opaque UPP }
    TextWidthHookUPP = ^SInt32; { an opaque UPP }
    NWidthHookUPP = ^SInt32; { an opaque UPP }
    DrawHookUPP = ^SInt32; { an opaque UPP }
    HitTestHookUPP = ^SInt32; { an opaque UPP }
    TEFindWordUPP = ^SInt32; { an opaque UPP }
    TERecalcUPP = ^SInt32; { an opaque UPP }
    TEDoTextUPP = ^SInt32; { an opaque UPP }
    TEClickLoopUPP = ^SInt32; { an opaque UPP }
    WordBreakUPP = ^SInt32; { an opaque UPP }
    TERec = record
        destRect:               Rect;
        viewRect:               Rect;
        selRect:                Rect;
        lineHeight:             SInt16;
        fontAscent:             SInt16;
        selPoint:               Point;
        selStart:               SInt16;
        selEnd:                 SInt16;
        active:                 SInt16;
        wordBreak:              WordBreakUPP;                           {  NOTE: This field is ignored on non-Roman systems and on Carbon (see IM-Text 2-60)  }
        clickLoop:              TEClickLoopUPP;
        clickTime:              SInt32;
        clickLoc:               SInt16;
        caretTime:              SInt32;
        caretState:             SInt16;
        just:                   SInt16;
        teLength:               SInt16;
        hText:                  Handle;
        hDispatchRec:           SInt32;                             {  added to replace recalBack & recalLines.  it's a handle anyway  }
        clikStuff:              SInt16;
        crOnly:                 SInt16;
        txFont:                 SInt16;
        txFace:                 StyleField;                             { StyleField occupies 16-bits, but only first 8-bits are used }
        txMode:                 SInt16;
        txSize:                 SInt16;
        inPort:                 GrafPtr;
        highHook:               HighHookUPP;
        caretHook:              CaretHookUPP;
        nLines:                 SInt16;
        lineStarts:             array [0..16000] of SInt16;
    end;


const
                                                                {  Justification (word alignment) styles  }
    teJustLeft                  = 0;
    teJustCenter                = 1;
    teJustRight                 = -1;
    teForceLeft                 = -2;                           {  new names for the Justification (word alignment) styles  }
    teFlushDefault              = 0;                            { flush according to the line direction  }
    teCenter                    = 1;                            { center justify (word alignment)  }
    teFlushRight                = -1;                           { flush right for all scripts  }
    teFlushLeft                 = -2;                           { flush left for all scripts  }

                                                                {  Set/Replace style modes  }
    fontBit                     = 0;                            { set font }
    faceBit                     = 1;                            { set face }
    sizeBit                     = 2;                            { set size }
    clrBit                      = 3;                            { set color }
    addSizeBit                  = 4;                            { add size mode }
    toggleBit                   = 5;                            { set faces in toggle mode }

                                                                {  TESetStyle/TEContinuousStyle modes  }
    doFont                      = 1;                            {  set font (family) number }
    doFace                      = 2;                            { set character style }
    doSize                      = 4;                            { set type size }
    doColor                     = 8;                            { set color }
    doAll                       = 15;                           { set all attributes }
    addSize                     = 16;                           { adjust type size }
    doToggle                    = 32;                           { toggle mode for TESetStyle }

                                                                {  offsets into TEDispatchRec  }
    EOLHook                     = 0;                            { [UniversalProcPtr] TEEOLHook }
    DRAWHook                    = 4;                            { [UniversalProcPtr] TEWidthHook }
    WIDTHHook                   = 8;                            { [UniversalProcPtr] TEDrawHook }
    HITTESTHook                 = 12;                           { [UniversalProcPtr] TEHitTestHook }
    nWIDTHHook                  = 24;                           { [UniversalProcPtr] nTEWidthHook }
    TextWidthHook               = 28;                           { [UniversalProcPtr] TETextWidthHook }

                                                                {  selectors for TECustomHook  }
    intEOLHook                  = 0;                            { TEIntHook value }
    intDrawHook                 = 1;                            { TEIntHook value }
    intWidthHook                = 2;                            { TEIntHook value }
    intHitTestHook              = 3;                            { TEIntHook value }
    intNWidthHook               = 6;                            { TEIntHook value for new version of WidthHook }
    intTextWidthHook            = 7;                            { TEIntHook value for new TextWidthHook }
    intInlineInputTSMTEPreUpdateHook = 8;                       { TEIntHook value for TSMTEPreUpdateProcPtr callback }
    intInlineInputTSMTEPostUpdateHook = 9;                      { TEIntHook value for TSMTEPostUpdateProcPtr callback }

                                                                {  feature or bit definitions for TEFeatureFlag  }
    teFAutoScroll               = 0;                            { 00000001b }
    teFTextBuffering            = 1;                            { 00000010b }
    teFOutlineHilite            = 2;                            { 00000100b }
    teFInlineInput              = 3;                            { 00001000b  }
    teFUseWhiteBackground       = 4;                            { 00010000b  }
    teFUseInlineInput           = 5;                            { 00100000b  }
    teFInlineInputAutoScroll    = 6;                            { 01000000b  }

                                                                {  feature or bit definitions for TEFeatureFlag -- Carbon only                 }
                                                                {  To avoid having to call TEIdle in Carbon apps, automatic idling can be activated    }
                                                                {  via the following feature flag, but you must ensure that the destRect and/or      }
                                                                {  GrafPort's origin be setup properly for drawing in a given TERec when        }
                                                                {  the timer fires.    When this feature flag is set, TEIdle is a noop.           }
                                                                {  Activate this feature flag before calling TEActivate.                  }
    teFIdleWithEventLoopTimer   = 7;                            { 10000000b  }

                                                                {  action for the new "bit (un)set" interface, TEFeatureFlag  }
    teBitClear                  = 0;
    teBitSet                    = 1;                            { set the selector bit }
    teBitTest                   = -1;                           { no change; just return the current setting }

                                                                { constants for identifying the routine that called FindWord  }
    teWordSelect                = 4;                            { clickExpand to select word }
    teWordDrag                  = 8;                            { clickExpand to drag new word }
    teFromFind                  = 12;                           { FindLine called it ($0C) }
    teFromRecal                 = 16;                           { RecalLines called it ($10)      obsolete  }

                                                                { constants for identifying TEDoText selectors  }
    teFind                      = 0;                            { TEDoText called for searching }
    teHighlight                 = 1;                            { TEDoText called for highlighting }
    teDraw                      = -1;                           { TEDoText called for drawing text }
    teCaret                     = -2;                           { TEDoText called for drawing the caret }



type
    Chars                               = packed array [0..32000] of char;
    CharsPtr                            = ^Chars;
    CharsHandle                         = ^CharsPtr;
    StyleRunPtr = ^StyleRun;
    StyleRun = record
        startChar:              SInt16;                             { starting character position }
        styleIndex:             SInt16;                             { index in style table }
    end;

    STElementPtr = ^STElement;
    STElement = record
        stCount:                SInt16;                             { number of runs in this style }
        stHeight:               SInt16;                             { line height }
        stAscent:               SInt16;                             { font ascent }
        stFont:                 SInt16;                             { font (family) number }
        stFace:                 StyleField;                             { StyleField occupies 16-bits, but only first 8-bits are used  }
        stSize:                 SInt16;                             { size in points }
        stColor:                RGBColor;                               { absolute (RGB) color }
    end;

    TEStyleTable                        = array [0..1776] of STElement;
    STPtr                               = ^TEStyleTable;
    STHandle                            = ^STPtr;
    LHElementPtr = ^LHElement;
    LHElement = record
        lhHeight:               SInt16;                             { maximum height in line }
        lhAscent:               SInt16;                             { maximum ascent in line }
    end;

    LHTable                             = array [0..8000] of LHElement;
    LHPtr                               = ^LHTable;
    LHHandle                            = ^LHPtr;
    ScrpSTElementPtr = ^ScrpSTElement;
    ScrpSTElement = record
        scrpStartChar:          SInt32;                             { starting character position }
        scrpHeight:             SInt16;
        scrpAscent:             SInt16;
        scrpFont:               SInt16;
        scrpFace:               StyleField;                             { StyleField occupies 16-bits, but only first 8-bits are used }
        scrpSize:               SInt16;
        scrpColor:              RGBColor;
    end;

    {    array [0..1600] of ScrpSTElement   }
    ScrpSTTable                         = array [0..1600] of ScrpSTElement;
    StScrpRecPtr = ^StScrpRec;
    StScrpRec = record
        scrpNStyles:            SInt16;                             { number of styles in scrap }
        scrpStyleTab:           ScrpSTTable;                            { table of styles for scrap }
    end;

    StScrpPtr                           = ^StScrpRec;
    StScrpHandle                        = ^StScrpPtr;
    NullStRecPtr = ^NullStRec;
    NullStRec = record
        teReserved:             SInt32;                             { reserved for future expansion }
        nullScrap:              StScrpHandle;                           { handle to scrap style table }
    end;

    NullStPtr                           = ^NullStRec;
    NullStHandle                        = ^NullStPtr;
    TEStyleRecPtr = ^TEStyleRec;
    TEStyleRec = record
        nRuns:                  SInt16;                             { number of style runs }
        nStyles:                SInt16;                             { size of style table }
        styleTab:               STHandle;                               { handle to style table }
        lhTab:                  LHHandle;                               { handle to line-height table }
        teRefCon:               SInt32;                             { reserved for application use }
        nullStyle:              NullStHandle;                           { Handle to style set at null selection }
        runs:                   array [0..8000] of StyleRun;            { array [0..8000] of StyleRun }
    end;

    TEStylePtr                          = ^TEStyleRec;
    TEStyleHandle                       = ^TEStylePtr;
    TextStylePtr = ^TextStyle;
    TextStyle = record
        tsFont:                 SInt16;                             { font (family) number }
        tsFace:                 StyleField;                             { StyleField occupies 16-bits, but only first 8-bits are used }
        tsSize:                 SInt16;                             { size in point }
        tsColor:                RGBColor;                               { absolute (RGB) color }
    end;

    TextStyleHandle                     = ^TextStylePtr;
    TEIntHook                           = SInt16;

const
    uppHighHookProcInfo = $0000000F;
    uppEOLHookProcInfo = $0000001F;
    uppCaretHookProcInfo = $0000000F;
    uppWidthHookProcInfo = $0000002F;
    uppTextWidthHookProcInfo = $0000002F;
    uppNWidthHookProcInfo = $0000003F;
    uppDrawHookProcInfo = $0000004F;
    uppHitTestHookProcInfo = $0000005F;
    uppTEFindWordProcInfo = $0000006F;
    uppTERecalcProcInfo = $0000009F;
    uppTEDoTextProcInfo = $000000AF;
    uppTEClickLoopProcInfo = $0000F812;
    uppWordBreakProcInfo = $00029812;
    {
     *  NewHighHookUPP()
     *
     *  Availability:
     *    Non-Carbon CFM:   available as macro/inline
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function NewHighHookUPP(userRoutine: HighHookProcPtr): HighHookUPP; external name '_NewHighHookUPP'; { old name was NewHighHookProc }
{
 *  NewEOLHookUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewEOLHookUPP(userRoutine: EOLHookProcPtr): EOLHookUPP; external name '_NewEOLHookUPP'; { old name was NewEOLHookProc }
{
 *  NewCaretHookUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewCaretHookUPP(userRoutine: CaretHookProcPtr): CaretHookUPP; external name '_NewCaretHookUPP'; { old name was NewCaretHookProc }
{
 *  NewWidthHookUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewWidthHookUPP(userRoutine: WidthHookProcPtr): WidthHookUPP; external name '_NewWidthHookUPP'; { old name was NewWidthHookProc }
{
 *  NewTextWidthHookUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewTextWidthHookUPP(userRoutine: TextWidthHookProcPtr): TextWidthHookUPP; external name '_NewTextWidthHookUPP'; { old name was NewTextWidthHookProc }
{
 *  NewNWidthHookUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewNWidthHookUPP(userRoutine: NWidthHookProcPtr): NWidthHookUPP; external name '_NewNWidthHookUPP'; { old name was NewNWidthHookProc }
{
 *  NewDrawHookUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewDrawHookUPP(userRoutine: DrawHookProcPtr): DrawHookUPP; external name '_NewDrawHookUPP'; { old name was NewDrawHookProc }
{
 *  NewHitTestHookUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewHitTestHookUPP(userRoutine: HitTestHookProcPtr): HitTestHookUPP; external name '_NewHitTestHookUPP'; { old name was NewHitTestHookProc }
{
 *  NewTEFindWordUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewTEFindWordUPP(userRoutine: TEFindWordProcPtr): TEFindWordUPP; external name '_NewTEFindWordUPP'; { old name was NewTEFindWordProc }
{
 *  NewTERecalcUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewTERecalcUPP(userRoutine: TERecalcProcPtr): TERecalcUPP; external name '_NewTERecalcUPP'; { old name was NewTERecalcProc }
{
 *  NewTEDoTextUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewTEDoTextUPP(userRoutine: TEDoTextProcPtr): TEDoTextUPP; external name '_NewTEDoTextUPP'; { old name was NewTEDoTextProc }
{
 *  NewTEClickLoopUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewTEClickLoopUPP(userRoutine: TEClickLoopProcPtr): TEClickLoopUPP; external name '_NewTEClickLoopUPP'; { old name was NewTEClickLoopProc }

{
 *  DisposeHighHookUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeHighHookUPP(userUPP: HighHookUPP); external name '_DisposeHighHookUPP';
{
 *  DisposeEOLHookUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeEOLHookUPP(userUPP: EOLHookUPP); external name '_DisposeEOLHookUPP';
{
 *  DisposeCaretHookUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeCaretHookUPP(userUPP: CaretHookUPP); external name '_DisposeCaretHookUPP';
{
 *  DisposeWidthHookUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeWidthHookUPP(userUPP: WidthHookUPP); external name '_DisposeWidthHookUPP';
{
 *  DisposeTextWidthHookUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeTextWidthHookUPP(userUPP: TextWidthHookUPP); external name '_DisposeTextWidthHookUPP';
{
 *  DisposeNWidthHookUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeNWidthHookUPP(userUPP: NWidthHookUPP); external name '_DisposeNWidthHookUPP';
{
 *  DisposeDrawHookUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeDrawHookUPP(userUPP: DrawHookUPP); external name '_DisposeDrawHookUPP';
{
 *  DisposeHitTestHookUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeHitTestHookUPP(userUPP: HitTestHookUPP); external name '_DisposeHitTestHookUPP';
{
 *  DisposeTEFindWordUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeTEFindWordUPP(userUPP: TEFindWordUPP); external name '_DisposeTEFindWordUPP';
{
 *  DisposeTERecalcUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeTERecalcUPP(userUPP: TERecalcUPP); external name '_DisposeTERecalcUPP';
{
 *  DisposeTEDoTextUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeTEDoTextUPP(userUPP: TEDoTextUPP); external name '_DisposeTEDoTextUPP';
{
 *  DisposeTEClickLoopUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeTEClickLoopUPP(userUPP: TEClickLoopUPP); external name '_DisposeTEClickLoopUPP';

{
 *  InvokeHighHookUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvokeHighHookUPP(const (*var*) r: Rect; pTE: TEPtr; userRoutine: HighHookUPP); external name '_InvokeHighHookUPP'; { old name was CallHighHookProc }
{
 *  InvokeEOLHookUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeEOLHookUPP(theChar: ByteParameter; pTE: TEPtr; hTE: TEHandle; userRoutine: EOLHookUPP): boolean; external name '_InvokeEOLHookUPP'; { old name was CallEOLHookProc }
{
 *  InvokeCaretHookUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvokeCaretHookUPP(const (*var*) r: Rect; pTE: TEPtr; userRoutine: CaretHookUPP); external name '_InvokeCaretHookUPP'; { old name was CallCaretHookProc }
{
 *  InvokeWidthHookUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeWidthHookUPP(textLen: UInt16; textOffset: UInt16; textBufferPtr: UnivPtr; pTE: TEPtr; hTE: TEHandle; userRoutine: WidthHookUPP): UInt16; external name '_InvokeWidthHookUPP'; { old name was CallWidthHookProc }
{
 *  InvokeTextWidthHookUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeTextWidthHookUPP(textLen: UInt16; textOffset: UInt16; textBufferPtr: UnivPtr; pTE: TEPtr; hTE: TEHandle; userRoutine: TextWidthHookUPP): UInt16; external name '_InvokeTextWidthHookUPP'; { old name was CallTextWidthHookProc }
{
 *  InvokeNWidthHookUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeNWidthHookUPP(styleRunLen: UInt16; styleRunOffset: UInt16; slop: SInt16; direction: SInt16; textBufferPtr: UnivPtr; var lineStart: SInt16; pTE: TEPtr; hTE: TEHandle; userRoutine: NWidthHookUPP): UInt16; external name '_InvokeNWidthHookUPP'; { old name was CallNWidthHookProc }
{
 *  InvokeDrawHookUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvokeDrawHookUPP(textOffset: UInt16; drawLen: UInt16; textBufferPtr: UnivPtr; pTE: TEPtr; hTE: TEHandle; userRoutine: DrawHookUPP); external name '_InvokeDrawHookUPP'; { old name was CallDrawHookProc }
{
 *  InvokeHitTestHookUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeHitTestHookUPP(styleRunLen: UInt16; styleRunOffset: UInt16; slop: UInt16; textBufferPtr: UnivPtr; pTE: TEPtr; hTE: TEHandle; var pixelWidth: UInt16; var charOffset: UInt16; var pixelInChar: boolean; userRoutine: HitTestHookUPP): boolean; external name '_InvokeHitTestHookUPP'; { old name was CallHitTestHookProc }
{
 *  InvokeTEFindWordUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvokeTEFindWordUPP(currentPos: UInt16; caller: SInt16; pTE: TEPtr; hTE: TEHandle; var wordStart: UInt16; var wordEnd: UInt16; userRoutine: TEFindWordUPP); external name '_InvokeTEFindWordUPP'; { old name was CallTEFindWordProc }
{
 *  InvokeTERecalcUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvokeTERecalcUPP(pTE: TEPtr; changeLength: UInt16; var lineStart: UInt16; var firstChar: UInt16; var lastChar: UInt16; userRoutine: TERecalcUPP); external name '_InvokeTERecalcUPP'; { old name was CallTERecalcProc }
{
 *  InvokeTEDoTextUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvokeTEDoTextUPP(pTE: TEPtr; firstChar: UInt16; lastChar: UInt16; selector: SInt16; var currentGrafPort: GrafPtr; var charPosition: SInt16; userRoutine: TEDoTextUPP); external name '_InvokeTEDoTextUPP'; { old name was CallTEDoTextProc }
{
 *  InvokeTEClickLoopUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeTEClickLoopUPP(pTE: TEPtr; userRoutine: TEClickLoopUPP): boolean; external name '_InvokeTEClickLoopUPP'; { old name was CallTEClickLoopProc }


const
                                                                {  feature bit 4 for TEFeatureFlag no longer in use  }
    teFUseTextServices          = 4;                            { 00010000b  }


    {
     *  TEScrapHandle()
     *
     *  Availability:
     *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function TEScrapHandle: Handle; external name '_TEScrapHandle';
{
 *  TEGetScrapLength()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TEGetScrapLength: SInt32; external name '_TEGetScrapLength';


{
 *  TENew()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TENew(const (*var*) destRect: Rect; const (*var*) viewRect: Rect): TEHandle; external name '_TENew';
{
 *  TEDispose()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure TEDispose(hTE: TEHandle); external name '_TEDispose';
{
 *  TESetText()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure TESetText(text: UnivPtr; length: SInt32; hTE: TEHandle); external name '_TESetText';
{
 *  TEGetText()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TEGetText(hTE: TEHandle): CharsHandle; external name '_TEGetText';
{
 *  TEIdle()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure TEIdle(hTE: TEHandle); external name '_TEIdle';
{
 *  TESetSelect()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure TESetSelect(selStart: SInt32; selEnd: SInt32; hTE: TEHandle); external name '_TESetSelect';
{
 *  TEActivate()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure TEActivate(hTE: TEHandle); external name '_TEActivate';
{
 *  TEDeactivate()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure TEDeactivate(hTE: TEHandle); external name '_TEDeactivate';
{
 *  TEKey()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure TEKey(key: CharParameter; hTE: TEHandle); external name '_TEKey';
{
 *  TECut()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure TECut(hTE: TEHandle); external name '_TECut';
{
 *  TECopy()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure TECopy(hTE: TEHandle); external name '_TECopy';
{
 *  TEPaste()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure TEPaste(hTE: TEHandle); external name '_TEPaste';
{
 *  TEDelete()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure TEDelete(hTE: TEHandle); external name '_TEDelete';
{
 *  TEInsert()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure TEInsert(text: UnivPtr; length: SInt32; hTE: TEHandle); external name '_TEInsert';
{
 *  TESetAlignment()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure TESetAlignment(just: SInt16; hTE: TEHandle); external name '_TESetAlignment';
{
 *  TEUpdate()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure TEUpdate(const (*var*) rUpdate: Rect; hTE: TEHandle); external name '_TEUpdate';
{
 *  TETextBox()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure TETextBox(text: UnivPtr; length: SInt32; const (*var*) box: Rect; just: SInt16); external name '_TETextBox';
{
 *  TEScroll()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure TEScroll(dh: SInt16; dv: SInt16; hTE: TEHandle); external name '_TEScroll';
{
 *  TESelView()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure TESelView(hTE: TEHandle); external name '_TESelView';
{
 *  TEPinScroll()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure TEPinScroll(dh: SInt16; dv: SInt16; hTE: TEHandle); external name '_TEPinScroll';
{
 *  TEAutoView()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure TEAutoView(fAuto: boolean; hTE: TEHandle); external name '_TEAutoView';
{
 *  TECalText()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure TECalText(hTE: TEHandle); external name '_TECalText';
{
 *  TEGetOffset()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TEGetOffset(pt: Point; hTE: TEHandle): SInt16; external name '_TEGetOffset';
{
 *  TEGetPoint()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TEGetPoint(offset: SInt16; hTE: TEHandle): Point; external name '_TEGetPoint';
{
 *  TEClick()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure TEClick(pt: Point; fExtend: boolean; h: TEHandle); external name '_TEClick';
{
 *  TEStyleNew()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TEStyleNew(const (*var*) destRect: Rect; const (*var*) viewRect: Rect): TEHandle; external name '_TEStyleNew';
{
 *  TESetStyleHandle()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure TESetStyleHandle(theHandle: TEStyleHandle; hTE: TEHandle); external name '_TESetStyleHandle';
{
 *  TEGetStyleHandle()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TEGetStyleHandle(hTE: TEHandle): TEStyleHandle; external name '_TEGetStyleHandle';
{
 *  TEGetStyle()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure TEGetStyle(offset: SInt16; var theStyle: TextStyle; var lineHeight: SInt16; var fontAscent: SInt16; hTE: TEHandle); external name '_TEGetStyle';
{
 *  TEStylePaste()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure TEStylePaste(hTE: TEHandle); external name '_TEStylePaste';
{
 *  TESetStyle()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure TESetStyle(mode: SInt16; const (*var*) newStyle: TextStyle; fRedraw: boolean; hTE: TEHandle); external name '_TESetStyle';
{
 *  TEReplaceStyle()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure TEReplaceStyle(mode: SInt16; const (*var*) oldStyle: TextStyle; const (*var*) newStyle: TextStyle; fRedraw: boolean; hTE: TEHandle); external name '_TEReplaceStyle';
{
 *  TEGetStyleScrapHandle()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TEGetStyleScrapHandle(hTE: TEHandle): StScrpHandle; external name '_TEGetStyleScrapHandle';
{
 *  TEStyleInsert()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure TEStyleInsert(text: UnivPtr; length: SInt32; hST: StScrpHandle; hTE: TEHandle); external name '_TEStyleInsert';
{
 *  TEGetHeight()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TEGetHeight(endLine: SInt32; startLine: SInt32; hTE: TEHandle): SInt32; external name '_TEGetHeight';
{
 *  TEContinuousStyle()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TEContinuousStyle(var mode: SInt16; var aStyle: TextStyle; hTE: TEHandle): boolean; external name '_TEContinuousStyle';
{
 *  TEUseStyleScrap()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure TEUseStyleScrap(rangeStart: SInt32; rangeEnd: SInt32; newStyles: StScrpHandle; fRedraw: boolean; hTE: TEHandle); external name '_TEUseStyleScrap';
{
 *  TECustomHook()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure TECustomHook(which: TEIntHook; var addr: UniversalProcPtr; hTE: TEHandle); external name '_TECustomHook';
{
 *  TENumStyles()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TENumStyles(rangeStart: SInt32; rangeEnd: SInt32; hTE: TEHandle): SInt32; external name '_TENumStyles';
{
 *  TEFeatureFlag()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TEFeatureFlag(feature: SInt16; action: SInt16; hTE: TEHandle): SInt16; external name '_TEFeatureFlag';
{
 *  TEGetHiliteRgn()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DragLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TEGetHiliteRgn(region: RgnHandle; hTE: TEHandle): OSErr; external name '_TEGetHiliteRgn';
{
 *  TESetScrapLength()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure TESetScrapLength(length: SInt32); external name '_TESetScrapLength';

{
 *  TEFromScrap()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TEFromScrap: OSErr; external name '_TEFromScrap';

{
 *  TEToScrap()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TEToScrap: OSErr; external name '_TEToScrap';

{
 *  TESetClickLoop()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure TESetClickLoop(clikProc: TEClickLoopUPP; hTE: TEHandle); external name '_TESetClickLoop';


{
 *  TEGetDoTextHook()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TEGetDoTextHook: TEDoTextUPP; external name '_TEGetDoTextHook';

{
 *  TESetDoTextHook()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure TESetDoTextHook(value: TEDoTextUPP); external name '_TESetDoTextHook';

{
 *  TEGetRecalcHook()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TEGetRecalcHook: TERecalcUPP; external name '_TEGetRecalcHook';

{
 *  TESetRecalcHook()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure TESetRecalcHook(value: TERecalcUPP); external name '_TESetRecalcHook';

{
 *  TEGetFindWordHook()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TEGetFindWordHook: TEFindWordUPP; external name '_TEGetFindWordHook';

{
 *  TESetFindWordHook()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure TESetFindWordHook(value: TEFindWordUPP); external name '_TESetFindWordHook';

{
 *  TEGetScrapHandle()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TEGetScrapHandle: Handle; external name '_TEGetScrapHandle';

{
 *  TESetScrapHandle()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure TESetScrapHandle(value: Handle); external name '_TESetScrapHandle';



{ LMGetWordRedraw and LMSetWordRedraw were previously in LowMem.h  }
{ Deprecated for Carbon on MacOS X                                 }
{ This lomem is no longer used by the implementation of TextEdit   }
{ on MacOS X, so setting it will have no effect.                   }
{
 *  LMGetWordRedraw()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function LMGetWordRedraw: ByteParameter; external name '_LMGetWordRedraw';
{
 *  LMSetWordRedraw()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure LMSetWordRedraw(value: ByteParameter); external name '_LMSetWordRedraw';

{$ALIGN MAC68K}
{#POP}
{unit TranslationExtensions}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}


const
    kSupportsFileTranslation    = 1;
    kSupportsScrapTranslation   = 2;
    kTranslatorCanGenerateFilename = 4;

    {   ****************************************************************************************    }
    {  better names for 4-char codes }

type
    FileType                            = OSType;
    FileTypePtr                         = ^FileType;
    ScrapType                           = ResType;
    {   ****************************************************************************************    }
    TranslationAttributes       = UInt32;
const
    taDstDocNeedsResourceFork   = 1;
    taDstIsAppTranslation       = 2;

    {   ****************************************************************************************    }

type
    FileTypeSpecPtr = ^FileTypeSpec;
    FileTypeSpec = record
        format:                 FileType;
        hint:                   SInt32;
        flags:                  TranslationAttributes;                  {  taDstDocNeedsResourceFork, taDstIsAppTranslation }
        catInfoType:            OSType;
        catInfoCreator:         OSType;
    end;

    FileTranslationListPtr = ^FileTranslationList;
    FileTranslationList = record
        modDate:                UInt32;
        groupCount:             UInt32;
                                                                        {  conceptual declarations: }
                                                                        {     unsigned long group1SrcCount; }
                                                                        {     unsigned long group1SrcEntrySize = sizeof(FileTypeSpec); }
                                                                        {   FileTypeSpec  group1SrcTypes[group1SrcCount] }
                                                                        {   unsigned long group1DstCount; }
                                                                        {   unsigned long group1DstEntrySize = sizeof(FileTypeSpec); }
                                                                        {   FileTypeSpec  group1DstTypes[group1DstCount] }
    end;

    FileTranslationListHandle           = ^FileTranslationListPtr;
    {   ****************************************************************************************    }
    ScrapTypeSpecPtr = ^ScrapTypeSpec;
    ScrapTypeSpec = record
        format:                 ScrapType;
        hint:                   SInt32;
    end;

    ScrapTranslationListPtr = ^ScrapTranslationList;
    ScrapTranslationList = record
        modDate:                UInt32;
        groupCount:             UInt32;
                                                                        {  conceptual declarations: }
                                                                        {     unsigned long     group1SrcCount; }
                                                                        {     unsigned long     group1SrcEntrySize = sizeof(ScrapTypeSpec); }
                                                                        {   ScrapTypeSpec     group1SrcTypes[group1SrcCount] }
                                                                        {   unsigned long     group1DstCount; }
                                                                        {     unsigned long     group1DstEntrySize = sizeof(ScrapTypeSpec); }
                                                                        {   ScrapTypeSpec     group1DstTypes[group1DstCount] }
    end;

    ScrapTranslationListHandle          = ^ScrapTranslationListPtr;
    {   ******************************************************************************************

        definition of callbacks to update progress dialog

    ******************************************************************************************  }
    TranslationRefNum                   = SInt32;
    {   ******************************************************************************************

        This routine sets the advertisement in the top half of the progress dialog.
        It is called once at the beginning of your DoTranslateFile routine.

        Enter   :   refNum          Translation reference supplied to DoTranslateFile.
                    advertisement   A handle to the picture to display.  This must be non-purgable.
                                    Before returning from DoTranslateFile, you should dispose
                                    of the memory.  (Normally, it is in the temp translation heap
                                    so it is cleaned up for you.)

        Exit    :   returns         noErr, paramErr, or memFullErr

    ******************************************************************************************  }
    {
     *  SetTranslationAdvertisement()
     *
     *  Availability:
     *    Non-Carbon CFM:   in Translation 1.0 and later
     *    CarbonLib:        in CarbonLib 1.0 thru 1.0.2
     *    Mac OS X:         in version 10.0 and later
        }
function SetTranslationAdvertisement(refNum: TranslationRefNum; advertisement: PicHandle): OSErr; external name '_SetTranslationAdvertisement';
{******************************************************************************************

    This routine updates the progress bar in the progress dialog.
    It is called repeatedly from within your DoTranslateFile routine.
    It should be called often, so that the user will get feedback if
    he tries to cancel.

    Enter   :   refNum      translation reference supplied to DoTranslateFile.
                progress    percent complete (0-100)

    Exit    :   canceled    TRUE if the user clicked the Cancel button, FALSE otherwise

    Return  :   noErr, paramErr, or memFullErr

******************************************************************************************}
{
 *  UpdateTranslationProgress()
 *
 *  Availability:
 *    Non-Carbon CFM:   in Translation 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 thru 1.0.2
 *    Mac OS X:         in version 10.0 and later
 }
function UpdateTranslationProgress(refNum: TranslationRefNum; percentDone: SInt16; var canceled: boolean): OSErr; external name '_UpdateTranslationProgress';
{******************************************************************************************

    Component Manager component selectors for translation extension routines

******************************************************************************************}

const
    kTranslateGetFileTranslationList = 0;
    kTranslateIdentifyFile      = 1;
    kTranslateTranslateFile     = 2;
    kTranslateGetTranslatedFilename = 3;
    kTranslateGetScrapTranslationList = 10;
    kTranslateIdentifyScrap     = 11;
    kTranslateTranslateScrap    = 12;
    kTranslateGetScrapTranslationListConsideringData = 13;


    {   ******************************************************************************************

        routines which implement translation extensions

    ******************************************************************************************  }

type
    DoGetFileTranslationListProcPtr = function(self: ComponentInstance; translationList: FileTranslationListHandle): ComponentResult;

    DoIdentifyFileProcPtr = function(self: ComponentInstance; const (*var*) theDocument: FSSpec; var docType: FileType): ComponentResult;

    DoTranslateFileProcPtr = function(self: ComponentInstance; refNum: TranslationRefNum; const (*var*) sourceDocument: FSSpec; srcType: FileType; srcTypeHint: SInt32; const (*var*) dstDoc: FSSpec; dstType: FileType; dstTypeHint: SInt32): ComponentResult;

    DoGetTranslatedFilenameProcPtr = function(self: ComponentInstance; dstType: FileType; dstTypeHint: SInt32; var theDocument: FSSpec): ComponentResult;

    DoGetScrapTranslationListProcPtr = function(self: ComponentInstance; list: ScrapTranslationListHandle): ComponentResult;

    DoIdentifyScrapProcPtr = function(self: ComponentInstance; dataPtr: UnivPtr; dataLength: Size; var dataFormat: ScrapType): ComponentResult;

    DoTranslateScrapProcPtr = function(self: ComponentInstance; refNum: TranslationRefNum; srcDataPtr: UnivPtr; srcDataLength: Size; srcType: ScrapType; srcTypeHint: SInt32; dstData: Handle; dstType: ScrapType; dstTypeHint: SInt32): ComponentResult;

{$ALIGN MAC68K}
{#POP}
{unit Video}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}


const
    mBaseOffset                 = 1;                            { Id of mBaseOffset. }
    mRowBytes                   = 2;                            { Video sResource parameter Id's  }
    mBounds                     = 3;                            { Video sResource parameter Id's  }
    mVersion                    = 4;                            { Video sResource parameter Id's  }
    mHRes                       = 5;                            { Video sResource parameter Id's  }
    mVRes                       = 6;                            { Video sResource parameter Id's  }
    mPixelType                  = 7;                            { Video sResource parameter Id's  }
    mPixelSize                  = 8;                            { Video sResource parameter Id's  }
    mCmpCount                   = 9;                            { Video sResource parameter Id's  }
    mCmpSize                    = 10;                           { Video sResource parameter Id's  }
    mPlaneBytes                 = 11;                           { Video sResource parameter Id's  }
    mVertRefRate                = 14;                           { Video sResource parameter Id's  }
    mVidParams                  = 1;                            { Video parameter block id. }
    mTable                      = 2;                            { Offset to the table. }
    mPageCnt                    = 3;                            { Number of pages }
    mDevType                    = 4;                            { Device Type }
    oneBitMode                  = 128;                          { Id of OneBitMode Parameter list. }
    twoBitMode                  = 129;                          { Id of TwoBitMode Parameter list. }
    fourBitMode                 = 130;                          { Id of FourBitMode Parameter list. }
    eightBitMode                = 131;                          { Id of EightBitMode Parameter list. }

    sixteenBitMode              = 132;                          { Id of SixteenBitMode Parameter list. }
    thirtyTwoBitMode            = 133;                          { Id of ThirtyTwoBitMode Parameter list. }
    firstVidMode                = 128;                          { The new, better way to do the above.  }
    secondVidMode               = 129;                          {  QuickDraw only supports six video  }
    thirdVidMode                = 130;                          {  at this time.       }
    fourthVidMode               = 131;
    fifthVidMode                = 132;
    sixthVidMode                = 133;
    spGammaDir                  = 64;
    spVidNamesDir               = 65;


    {    csTimingFormat values in VDTimingInfo  }
    {    look in the declaration rom for timing info    }
    kDeclROMtables              = $6465636C (* 'decl' *);
    kDetailedTimingFormat       = $61726261 (* 'arba' *);                       {  Timing is a detailed timing }

    {    Size of a block of EDID (Extended Display Identification Data)     }
    kDDCBlockSize               = 128;

    {  ddcBlockType constants }
    kDDCBlockTypeEDID           = 0;                            {  EDID block type.  }

    {  ddcFlags constants }
    kDDCForceReadBit            = 0;                            {  Force a new read of the EDID.  }
    kDDCForceReadMask           = $01;                          {  Mask for kddcForceReadBit.  }


    {    Timing mode constants for Display Manager MultiMode support
        Corresponding   .h equates are in Video.h
                        .a equates are in Video.a
                        .r equates are in DepVideoEqu.r

        The second enum is the old names (for compatibility).
        The first enum is the new names.
        }
    timingInvalid               = 0;                            {     Unknown timingÉ force user to confirm.  }
    timingInvalid_SM_T24        = 8;                            {     Work around bug in SM Thunder24 card. }
    timingApple_FixedRateLCD    = 42;                           {     Lump all fixed-rate LCDs into one category. }
    timingApple_512x384_60hz    = 130;                          {   512x384  (60 Hz) Rubik timing.  }
    timingApple_560x384_60hz    = 135;                          {   560x384  (60 Hz) Rubik-560 timing.  }
    timingApple_640x480_67hz    = 140;                          {   640x480  (67 Hz) HR timing.  }
    timingApple_640x400_67hz    = 145;                          {   640x400  (67 Hz) HR-400 timing.  }
    timingVESA_640x480_60hz     = 150;                          {   640x480  (60 Hz) VGA timing.  }
    timingVESA_640x480_72hz     = 152;                          {   640x480  (72 Hz) VGA timing.  }
    timingVESA_640x480_75hz     = 154;                          {   640x480  (75 Hz) VGA timing.  }
    timingVESA_640x480_85hz     = 158;                          {   640x480  (85 Hz) VGA timing.  }
    timingGTF_640x480_120hz     = 159;                          {   640x480  (120 Hz) VESA Generalized Timing Formula  }
    timingApple_640x870_75hz    = 160;                          {   640x870  (75 Hz) FPD timing. }
    timingApple_640x818_75hz    = 165;                          {   640x818  (75 Hz) FPD-818 timing. }
    timingApple_832x624_75hz    = 170;                          {   832x624  (75 Hz) GoldFish timing. }
    timingVESA_800x600_56hz     = 180;                          {   800x600  (56 Hz) SVGA timing.  }
    timingVESA_800x600_60hz     = 182;                          {   800x600  (60 Hz) SVGA timing.  }
    timingVESA_800x600_72hz     = 184;                          {   800x600  (72 Hz) SVGA timing.  }
    timingVESA_800x600_75hz     = 186;                          {   800x600  (75 Hz) SVGA timing.  }
    timingVESA_800x600_85hz     = 188;                          {   800x600  (85 Hz) SVGA timing.  }
    timingVESA_1024x768_60hz    = 190;                          {  1024x768  (60 Hz) VESA 1K-60Hz timing.  }
    timingVESA_1024x768_70hz    = 200;                          {  1024x768  (70 Hz) VESA 1K-70Hz timing.  }
    timingVESA_1024x768_75hz    = 204;                          {  1024x768  (75 Hz) VESA 1K-75Hz timing (very similar to timingApple_1024x768_75hz).  }
    timingVESA_1024x768_85hz    = 208;                          {  1024x768  (85 Hz) VESA timing.  }
    timingApple_1024x768_75hz   = 210;                          {  1024x768  (75 Hz) Apple 19" RGB.  }
    timingApple_1152x870_75hz   = 220;                          {  1152x870  (75 Hz) Apple 21" RGB.  }
    timingAppleNTSC_ST          = 230;                          {   512x384  (60 Hz, interlaced, non-convolved).  }
    timingAppleNTSC_FF          = 232;                          {   640x480  (60 Hz, interlaced, non-convolved).  }
    timingAppleNTSC_STconv      = 234;                          {   512x384  (60 Hz, interlaced, convolved).  }
    timingAppleNTSC_FFconv      = 236;                          {   640x480  (60 Hz, interlaced, convolved).  }
    timingApplePAL_ST           = 238;                          {   640x480  (50 Hz, interlaced, non-convolved).  }
    timingApplePAL_FF           = 240;                          {   768x576  (50 Hz, interlaced, non-convolved).  }
    timingApplePAL_STconv       = 242;                          {   640x480  (50 Hz, interlaced, convolved).  }
    timingApplePAL_FFconv       = 244;                          {   768x576  (50 Hz, interlaced, convolved).  }
    timingVESA_1280x960_75hz    = 250;                          {  1280x960  (75 Hz)  }
    timingVESA_1280x960_60hz    = 252;                          {  1280x960  (60 Hz)  }
    timingVESA_1280x960_85hz    = 254;                          {  1280x960  (85 Hz)  }
    timingVESA_1280x1024_60hz   = 260;                          {  1280x1024 (60 Hz)  }
    timingVESA_1280x1024_75hz   = 262;                          {  1280x1024 (75 Hz)  }
    timingVESA_1280x1024_85hz   = 268;                          {  1280x1024 (85 Hz)  }
    timingVESA_1600x1200_60hz   = 280;                          {  1600x1200 (60 Hz) VESA timing.  }
    timingVESA_1600x1200_65hz   = 282;                          {  1600x1200 (65 Hz) VESA timing.  }
    timingVESA_1600x1200_70hz   = 284;                          {  1600x1200 (70 Hz) VESA timing.  }
    timingVESA_1600x1200_75hz   = 286;                          {  1600x1200 (75 Hz) VESA timing (pixel clock is 189.2 Mhz dot clock).  }
    timingVESA_1600x1200_80hz   = 288;                          {  1600x1200 (80 Hz) VESA timing (pixel clock is 216>? Mhz dot clock) - proposed only.  }
    timingVESA_1600x1200_85hz   = 289;                          {  1600x1200 (85 Hz) VESA timing (pixel clock is 229.5 Mhz dot clock).  }
    timingVESA_1792x1344_60hz   = 296;                          {  1792x1344 (60 Hz) VESA timing (204.75 Mhz dot clock).  }
    timingVESA_1792x1344_75hz   = 298;                          {  1792x1344 (75 Hz) VESA timing (261.75 Mhz dot clock).  }
    timingVESA_1856x1392_60hz   = 300;                          {  1856x1392 (60 Hz) VESA timing (218.25 Mhz dot clock).  }
    timingVESA_1856x1392_75hz   = 302;                          {  1856x1392 (75 Hz) VESA timing (288 Mhz dot clock).  }
    timingVESA_1920x1440_60hz   = 304;                          {  1920x1440 (60 Hz) VESA timing (234 Mhz dot clock).  }
    timingVESA_1920x1440_75hz   = 306;                          {  1920x1440 (75 Hz) VESA timing (297 Mhz dot clock).  }
    timingSMPTE240M_60hz        = 400;                          {  60Hz V, 33.75KHz H, interlaced timing, 16:9 aspect, typical resolution of 1920x1035.  }
    timingFilmRate_48hz         = 410;                          {  48Hz V, 25.20KHz H, non-interlaced timing, typical resolution of 640x480.  }
    timingSony_1600x1024_76hz   = 500;                          {  1600x1024 (76 Hz) Sony timing (pixel clock is 170.447 Mhz dot clock).  }
    timingSony_1920x1080_60hz   = 510;                          {  1920x1080 (60 Hz) Sony timing (pixel clock is 159.84 Mhz dot clock).  }
    timingSony_1920x1080_72hz   = 520;                          {  1920x1080 (72 Hz) Sony timing (pixel clock is 216.023 Mhz dot clock).  }
    timingSony_1920x1200_76hz   = 540;                          {  1900x1200 (76 Hz) Sony timing (pixel clock is 243.20 Mhz dot clock).  }
    timingApple_0x0_0hz_Offline = 550;                          {  Indicates that this timing will take the display off-line and remove it from the system.  }


    {  Deprecated timing names. }
    timingApple12               = 130;
    timingApple12x              = 135;
    timingApple13               = 140;
    timingApple13x              = 145;
    timingAppleVGA              = 150;
    timingApple15               = 160;
    timingApple15x              = 165;
    timingApple16               = 170;
    timingAppleSVGA             = 180;
    timingApple1Ka              = 190;
    timingApple1Kb              = 200;
    timingApple19               = 210;
    timingApple21               = 220;
    timingSony_1900x1200_74hz   = 530;                          {  1900x1200 (74 Hz) Sony timing (pixel clock is 236.25 Mhz dot clock).  }
    timingSony_1900x1200_76hz   = 540;                          {  1900x1200 (76 Hz) Sony timing (pixel clock is 245.48 Mhz dot clock).  }

    {    csConnectFlags values in VDDisplayConnectInfo  }
    kAllModesValid              = 0;                            {  All modes not trimmed by primary init are good close enough to try  }
    kAllModesSafe               = 1;                            {  All modes not trimmed by primary init are know to be safe  }
    kReportsTagging             = 2;                            {  Can detect tagged displays (to identify smart monitors)  }
    kHasDirectConnection        = 3;                            {  True implies that driver can talk directly to device (e.g. serial data link via sense lines)  }
    kIsMonoDev                  = 4;                            {  Says whether thereÕs an RGB (0) or Monochrome (1) connection.  }
    kUncertainConnection        = 5;                            {  There may not be a display (no sense lines?).  }
    kTaggingInfoNonStandard     = 6;                            {  Set when csConnectTaggedType/csConnectTaggedData are non-standard (i.e., not the Apple CRT sense codes).  }
    kReportsDDCConnection       = 7;                            {  Card can do ddc (set kHasDirectConnect && kHasDDCConnect if you actually found a ddc display).  }
    kHasDDCConnection           = 8;                            {  Card has ddc connect now.  }
    kConnectionInactive         = 9;                            {  Set when the connection is NOT currently active (generally used in a multiconnection environment).  }
    kDependentConnection        = 10;                           {  Set when some ascpect of THIS connection depends on another (will generally be set in a kModeSimulscan environment).  }
    kBuiltInConnection          = 11;                           {  Set when connection is KNOWN to be built-in (this is not the same as kHasDirectConnection).  }
    kOverrideConnection         = 12;                           {  Set when the reported connection is not the true one, but is one that has been forced through a SetConnection call  }
    kFastCheckForDDC            = 13;                           {  Set when all 3 are true: 1) sense codes indicate DDC display could be attached 2) attempted fast check 3) DDC failed  }
    kReportsHotPlugging         = 14;                           {  Detects and reports hot pluggging on connector (via VSL also implies DDC will be up to date w/o force read)  }


    {    csDisplayType values in VDDisplayConnectInfo   }
    kUnknownConnect             = 1;                            {  Not sure how weÕll use this, but seems like a good idea.  }
    kPanelConnect               = 2;                            {  For use with fixed-in-place LCD panels.  }
    kPanelTFTConnect            = 2;                            {  Alias for kPanelConnect  }
    kFixedModeCRTConnect        = 3;                            {   For use with fixed-mode (i.e., very limited range) displays.  }
    kMultiModeCRT1Connect       = 4;                            {  320x200 maybe, 12" maybe, 13" (default), 16" certain, 19" maybe, 21" maybe  }
    kMultiModeCRT2Connect       = 5;                            {  320x200 maybe, 12" maybe, 13" certain, 16" (default), 19" certain, 21" maybe  }
    kMultiModeCRT3Connect       = 6;                            {  320x200 maybe, 12" maybe, 13" certain, 16" certain, 19" default, 21" certain  }
    kMultiModeCRT4Connect       = 7;                            {  Expansion to large multi mode (not yet used)  }
    kModelessConnect            = 8;                            {  Expansion to modeless model (not yet used)  }
    kFullPageConnect            = 9;                            {  640x818 (to get 8bpp in 512K case) and 640x870 (these two only)  }
    kVGAConnect                 = 10;                           {  640x480 VGA default -- question everything else  }
    kNTSCConnect                = 11;                           {  NTSC ST (default), FF, STconv, FFconv  }
    kPALConnect                 = 12;                           {  PAL ST (default), FF, STconv, FFconv  }
    kHRConnect                  = 13;                           {  Straight-6 connect -- 640x480 and 640x400 (to get 8bpp in 256K case) (these two only)  }
    kPanelFSTNConnect           = 14;                           {  For use with fixed-in-place LCD FSTN (aka ÒSupertwistÓ) panels  }
    kMonoTwoPageConnect         = 15;                           {  1152x870 Apple color two-page display  }
    kColorTwoPageConnect        = 16;                           {  1152x870 Apple B&W two-page display  }
    kColor16Connect             = 17;                           {  832x624 Apple B&W two-page display  }
    kColor19Connect             = 18;                           {  1024x768 Apple B&W two-page display  }
    kGenericCRT                 = 19;                           {  Indicates nothing except that connection is CRT in nature.  }
    kGenericLCD                 = 20;                           {  Indicates nothing except that connection is LCD in nature.  }
    kDDCConnect                 = 21;                           {  DDC connection, always set kHasDDCConnection  }
    kNoConnect                  = 22;                           {  No display is connected - load sensing or similar level of hardware detection is assumed (used by resident drivers that support hot plugging when nothing is currently connected)  }

    {    csTimingFlags values in VDTimingInfoRec    }
    kModeValid                  = 0;                            {  Says that this mode should NOT be trimmed.  }
    kModeSafe                   = 1;                            {  This mode does not need confirmation  }
    kModeDefault                = 2;                            {  This is the default mode for this type of connection  }
    kModeShowNow                = 3;                            {  This mode should always be shown (even though it may require a confirm)  }
    kModeNotResize              = 4;                            {  This mode should not be used to resize the display (eg. mode selects a different connector on card)  }
    kModeRequiresPan            = 5;                            {  This mode has more pixels than are actually displayed  }
    kModeInterlaced             = 6;                            {  This mode is interlaced (single pixel lines look bad).  }
    kModeShowNever              = 7;                            {  This mode should not be shown in the user interface.  }
    kModeSimulscan              = 8;                            {  Indicates that more than one display connection can be driven from a single framebuffer controller.  }
    kModeNotPreset              = 9;                            {  Indicates that the timing is not a factory preset for the current display (geometry may need correction)  }
    kModeBuiltIn                = 10;                           {  Indicates that the display mode is for the built-in connect only (on multiconnect devices like the PB 3400) Only the driver is quieried  }
    kModeStretched              = 11;                           {  Indicates that the display mode will be stretched/distorted to match the display aspect ratio  }
    kModeNotGraphicsQuality     = 12;                           {  Indicates that the display mode is not the highest quality (eg. stretching artifacts).  Intended as a hint  }

    {    csDepthFlags in VDVideoParametersInfoRec   }
    kDepthDependent             = 0;                            {  Says that this depth mode may cause dependent changes in other framebuffers (and .  }

    {    csResolutionFlags bit flags for VDResolutionInfoRec    }
    kResolutionHasMultipleDepthSizes = 0;                       {  Says that this mode has different csHorizontalPixels, csVerticalLines at different depths (usually slightly larger at lower depths)  }


                                                                {     Power Mode constants for VDPowerStateRec.powerState.  Note the numeric order does not match the power state order  }
    kAVPowerOff                 = 0;
    kAVPowerStandby             = 1;
    kAVPowerSuspend             = 2;
    kAVPowerOn                  = 3;
    kHardwareSleep              = 128;
    kHardwareWake               = 129;
    kHardwareWakeFromSuspend    = 130;
    kHardwareWakeToDoze         = 131;
    kHardwareWakeToDozeFromSuspend = 132;
    kHardwarePark               = 133;
    kHardwareDrive              = 134;

                                                                {     Power Mode masks and bits for VDPowerStateRec.powerFlags.   }
    kPowerStateNeedsRefresh     = 0;                            {  When leaving this power mode, a display will need refreshing    }
    kPowerStateSleepAwareBit    = 1;                            {  if gestaltPCCardDockingSelectorFix, Docking mgr checks this bit before checking kPowerStateSleepAllowedBit  }
    kPowerStateSleepForbiddenBit = 2;                           {  if kPowerStateSleepAwareBit, Docking mgr checks this bit before sleeping  }
    kPowerStateSleepCanPowerOffBit = 3;                         {  supports power down sleep (ie PCI power off) }
    kPowerStateSleepNoDPMSBit   = 4;                            {  Bug #2425210.  Do not use DPMS with this display. }
    kPowerStateSleepWaketoDozeBit = 5;                          {  Supports Wake to Doze  }
    kPowerStateNeedsRefreshMask = $00000001;
    kPowerStateSleepAwareMask   = $00000002;
    kPowerStateSleepForbiddenMask = $00000004;
    kPowerStateSleepCanPowerOffMask = $00000008;
    kPowerStateSleepNoDPMSMask  = $00000010;
    kPowerStateSleepWaketoDozeMask = $00000020;


                                                                {  Control Codes  }
    cscReset                    = 0;
    cscKillIO                   = 1;
    cscSetMode                  = 2;
    cscSetEntries               = 3;
    cscSetGamma                 = 4;
    cscGrayPage                 = 5;
    cscGrayScreen               = 5;
    cscSetGray                  = 6;
    cscSetInterrupt             = 7;
    cscDirectSetEntries         = 8;
    cscSetDefaultMode           = 9;
    cscSwitchMode               = 10;                           {  Takes a VDSwitchInfoPtr  }
    cscSetSync                  = 11;                           {  Takes a VDSyncInfoPtr  }
    cscSavePreferredConfiguration = 16;                         {  Takes a VDSwitchInfoPtr  }
    cscSetHardwareCursor        = 22;                           {  Takes a VDSetHardwareCursorPtr  }
    cscDrawHardwareCursor       = 23;                           {  Takes a VDDrawHardwareCursorPtr  }
    cscSetConvolution           = 24;                           {  Takes a VDConvolutionInfoPtr  }
    cscSetPowerState            = 25;                           {  Takes a VDPowerStatePtr  }
    cscPrivateControlCall       = 26;                           {  Takes a VDPrivateSelectorDataPtr  }
    cscSetMultiConnect          = 28;                           {  Takes a VDMultiConnectInfoPtr  }
    cscSetClutBehavior          = 29;                           {  Takes a VDClutBehavior  }
    cscSetDetailedTiming        = 31;                           {  Takes a VDDetailedTimingPtr  }
    cscDoCommunication          = 33;                           {  Takes a VDCommunicationPtr  }
    cscProbeConnection          = 34;                           {  Takes nil pointer (may generate a kFBConnectInterruptServiceType service interrupt) }
    cscSetScaler                = 36;                           {  Takes a VDScalerPtr }
    cscSetMirror                = 37;                           {  Takes a VDMirrorPtr }
    cscUnusedCall               = 127;                          {  This call used to expend the scrn resource.  Its imbedded data contains more control info  }

                                                                {  Status Codes  }
    cscGetMode                  = 2;
    cscGetEntries               = 3;
    cscGetPageCnt               = 4;
    cscGetPages                 = 4;                            {  This is what C&D 2 calls it.  }
    cscGetPageBase              = 5;
    cscGetBaseAddr              = 5;                            {  This is what C&D 2 calls it.  }
    cscGetGray                  = 6;
    cscGetInterrupt             = 7;
    cscGetGamma                 = 8;
    cscGetDefaultMode           = 9;
    cscGetCurMode               = 10;                           {  Takes a VDSwitchInfoPtr  }
    cscGetSync                  = 11;                           {  Takes a VDSyncInfoPtr  }
    cscGetConnection            = 12;                           {  Return information about the connection to the display  }
    cscGetModeTiming            = 13;                           {  Return timing info for a mode  }
    cscGetModeBaseAddress       = 14;                           {  Return base address information about a particular mode  }
    cscGetScanProc              = 15;                           {  QuickTime scan chasing routine  }
    cscGetPreferredConfiguration = 16;                          {  Takes a VDSwitchInfoPtr  }
    cscGetNextResolution        = 17;                           {  Takes a VDResolutionInfoPtr  }
    cscGetVideoParameters       = 18;                           {  Takes a VDVideoParametersInfoPtr  }
    cscGetGammaInfoList         = 20;                           {  Takes a VDGetGammaListPtr  }
    cscRetrieveGammaTable       = 21;                           {  Takes a VDRetrieveGammaPtr  }
    cscSupportsHardwareCursor   = 22;                           {  Takes a VDSupportsHardwareCursorPtr  }
    cscGetHardwareCursorDrawState = 23;                         {  Takes a VDHardwareCursorDrawStatePtr  }
    cscGetConvolution           = 24;                           {  Takes a VDConvolutionInfoPtr  }
    cscGetPowerState            = 25;                           {  Takes a VDPowerStatePtr  }
    cscPrivateStatusCall        = 26;                           {  Takes a VDPrivateSelectorDataPtr  }
    cscGetDDCBlock              = 27;                           {  Takes a VDDDCBlockPtr   }
    cscGetMultiConnect          = 28;                           {  Takes a VDMultiConnectInfoPtr  }
    cscGetClutBehavior          = 29;                           {  Takes a VDClutBehaviorPtr  }
    cscGetTimingRanges          = 30;                           {  Takes a VDDisplayTimingRangePtr  }
    cscGetDetailedTiming        = 31;                           {  Takes a VDDetailedTimingPtr  }
    cscGetCommunicationInfo     = 32;                           {  Takes a VDCommunicationInfoPtr  }
    cscGetScalerInfo            = 35;                           {  Takes a VDScalerInfoPtr  }
    cscGetScaler                = 36;                           {  Takes a VDScalerPtr }
    cscGetMirror                = 37;                           {  Takes a VDMirrorPtr }

    {  Bit definitions for the Get/Set Sync call }
    kDisableHorizontalSyncBit   = 0;
    kDisableVerticalSyncBit     = 1;
    kDisableCompositeSyncBit    = 2;
    kEnableSyncOnBlue           = 3;
    kEnableSyncOnGreen          = 4;
    kEnableSyncOnRed            = 5;
    kNoSeparateSyncControlBit   = 6;
    kTriStateSyncBit            = 7;
    kHorizontalSyncMask         = $01;
    kVerticalSyncMask           = $02;
    kCompositeSyncMask          = $04;
    kDPMSSyncMask               = $07;
    kTriStateSyncMask           = $80;
    kSyncOnBlueMask             = $08;
    kSyncOnGreenMask            = $10;
    kSyncOnRedMask              = $20;
    kSyncOnMask                 = $38;

                                                                {     Power Mode constants for translating DPMS modes to Get/SetSync calls.   }
    kDPMSSyncOn                 = 0;
    kDPMSSyncStandby            = 1;
    kDPMSSyncSuspend            = 2;
    kDPMSSyncOff                = 7;

    {  Bit definitions for the Get/Set Convolution call }
    kConvolved                  = 0;
    kLiveVideoPassThru          = 1;
    kConvolvedMask              = $01;
    kLiveVideoPassThruMask      = $02;



type
    VPBlockPtr = ^VPBlock;
    VPBlock = record
        vpBaseOffset:           SInt32;                             { Offset to page zero of video RAM (From minorBaseOS). }
        vpRowBytes:             SInt16;                             { Width of each row of video memory. }
        vpBounds:               Rect;                                   { BoundsRect for the video display (gives dimensions). }
        vpVersion:              SInt16;                             { PixelMap version number. }
        vpPackType:             SInt16;
        vpPackSize:             SInt32;
        vpHRes:                 SInt32;                             { Horizontal resolution of the device (pixels per inch). }
        vpVRes:                 SInt32;                             { Vertical resolution of the device (pixels per inch). }
        vpPixelType:            SInt16;                             { Defines the pixel type. }
        vpPixelSize:            SInt16;                             { Number of bits in pixel. }
        vpCmpCount:             SInt16;                             { Number of components in pixel. }
        vpCmpSize:              SInt16;                             { Number of bits per component }
        vpPlaneBytes:           SInt32;                             { Offset from one plane to the next. }
    end;

    VDEntryRecordPtr = ^VDEntryRecord;
    VDEntryRecord = record
        csTable:                Ptr;                                    { (long) pointer to color table entry=value, r,g,b:SInt16 }
    end;

    VDEntRecPtr                         = ^VDEntryRecord;
    {    Parm block for SetGray control call    }
    VDGrayRecordPtr = ^VDGrayRecord;
    VDGrayRecord = record
        csMode:                 boolean;                                { Same as GDDevType value (0=color, 1=mono) }
        filler:                 SInt8;
    end;

    VDGrayPtr                           = ^VDGrayRecord;
    {    Parm block for SetInterrupt call   }
    VDFlagRecordPtr = ^VDFlagRecord;
    VDFlagRecord = record
        csMode:                 SInt8;
        filler:                 SInt8;
    end;

    VDFlagRecPtr                        = ^VDFlagRecord;
    {    Parm block for SetEntries control call     }
    VDSetEntryRecordPtr = ^VDSetEntryRecord;
    VDSetEntryRecord = record
        csTable:                ColorSpecPtr;                           { Pointer to an array of color specs }
        csStart:                SInt16;                             { Which spec in array to start with, or -1 }
        csCount:                SInt16;                             { Number of color spec entries to set }
    end;

    VDSetEntryPtr                       = ^VDSetEntryRecord;
    {    Parm block for SetGamma control call   }
    VDGammaRecordPtr = ^VDGammaRecord;
    VDGammaRecord = record
        csGTable:               Ptr;                                    { pointer to gamma table }
    end;

    VDGamRecPtr                         = ^VDGammaRecord;
    VDBaseAddressInfoRecPtr = ^VDBaseAddressInfoRec;
    VDBaseAddressInfoRec = record
        csDevData:              SInt32;                             {  SInt32 - (long) timing mode  }
        csDevBase:              SInt32;                             {  SInt32 - (long) base address of the mode  }
        csModeReserved:         SInt16;                             {  SInt16 - (short) will some day be the depth  }
        csModeBase:             SInt32;                             {  SInt32 - (long) reserved  }
    end;

    VDBaseAddressInfoPtr                = ^VDBaseAddressInfoRec;
    VDSwitchInfoRecPtr = ^VDSwitchInfoRec;
    VDSwitchInfoRec = record
        csMode:                 UInt16;                                 { (word) mode depth }
        csData:                 UInt32;                                 { (long) functional sResource of mode }
        csPage:                 UInt16;                                 { (word) page to switch in }
        csBaseAddr:             Ptr;                                    { (long) base address of page (return value) }
        csReserved:             UInt32;                                 { (long) Reserved (set to 0)  }
    end;

    VDSwitchInfoPtr                     = ^VDSwitchInfoRec;
    VDTimingInfoRecPtr = ^VDTimingInfoRec;
    VDTimingInfoRec = record
        csTimingMode:           UInt32;                                 {  SInt32 - (long) timing mode (a la InitGDevice)  }
        csTimingReserved:       UInt32;                                 {  SInt32 - (long) reserved  }
        csTimingFormat:         UInt32;                                 {  SInt32 - (long) what format is the timing info  }
        csTimingData:           UInt32;                                 {  SInt32 - (long) data supplied by driver  }
        csTimingFlags:          UInt32;                                 {  SInt32 - (long) mode within device  }
    end;

    VDTimingInfoPtr                     = ^VDTimingInfoRec;
    VDDisplayConnectInfoRecPtr = ^VDDisplayConnectInfoRec;
    VDDisplayConnectInfoRec = record
        csDisplayType:          UInt16;                                 {  SInt16 - (word) Type of display connected  }
        csConnectTaggedType:    SInt8;                                  {  BYTE - type of tagging  }
        csConnectTaggedData:    SInt8;                                  {  BYTE - tagging data  }
        csConnectFlags:         UInt32;                                 {  SInt32 - (long) tell us about the connection  }
        csDisplayComponent:     UInt32;                                 {  SInt32 - (long) if the card has a direct connection to the display, it returns the display component here (FUTURE)  }
        csConnectReserved:      UInt32;                                 {  SInt32 - (long) reserved  }
    end;

    VDDisplayConnectInfoPtr             = ^VDDisplayConnectInfoRec;
    VDMultiConnectInfoRecPtr = ^VDMultiConnectInfoRec;
    VDMultiConnectInfoRec = record
        csDisplayCountOrNumber: UInt32;                                 {  For GetMultiConnect, returns count n of 1..n connections; otherwise, indicates the ith connection. }
        csConnectInfo:          VDDisplayConnectInfoRec;                {  Standard VDDisplayConnectionInfo for connection i. }
    end;

    VDMultiConnectInfoPtr               = ^VDMultiConnectInfoRec;
    {    RawSenseCode
        This abstract data type is not exactly abstract.  Rather, it is merely enumerated constants
        for the possible raw sense code values when 'standard' sense code hardware is implemented.

        For 'standard' sense code hardware, the raw sense is obtained as follows:
            ¥ Instruct the frame buffer controller NOT to actively drive any of the monitor sense lines
            ¥ Read the state of the monitor sense lines 2, 1, and 0.  (2 is the MSB, 0 the LSB)

        IMPORTANT Note:
        When the 'kTaggingInfoNonStandard' bit of 'csConnectFlags' is FALSE, then these constants
        are valid 'csConnectTaggedType' values in 'VDDisplayConnectInfo'

        }
    RawSenseCode                        = UInt8;

const
    kRSCZero                    = 0;
    kRSCOne                     = 1;
    kRSCTwo                     = 2;
    kRSCThree                   = 3;
    kRSCFour                    = 4;
    kRSCFive                    = 5;
    kRSCSix                     = 6;
    kRSCSeven                   = 7;


    {    ExtendedSenseCode
        This abstract data type is not exactly abstract.  Rather, it is merely enumerated constants
        for the values which are possible when the extended sense algorithm is applied to hardware
        which implements 'standard' sense code hardware.

        For 'standard' sense code hardware, the extended sense code algorithm is as follows:
        (Note:  as described here, sense line 'A' corresponds to '2', 'B' to '1', and 'C' to '0')
            ¥ Drive sense line 'A' low and read the values of 'B' and 'C'.
            ¥ Drive sense line 'B' low and read the values of 'A' and 'C'.
            ¥ Drive sense line 'C' low and read the values of 'A' and 'B'.

        In this way, a six-bit number of the form BC/AC/AB is generated.

        IMPORTANT Note:
        When the 'kTaggingInfoNonStandard' bit of 'csConnectFlags' is FALSE, then these constants
        are valid 'csConnectTaggedData' values in 'VDDisplayConnectInfo'

        }

type
    ExtendedSenseCode                   = UInt8;

const
    kESCZero21Inch              = $00;                          {  21" RGB                      }
    kESCOnePortraitMono         = $14;                          {  Portrait Monochrome               }
    kESCTwo12Inch               = $21;                          {  12" RGB                     }
    kESCThree21InchRadius       = $31;                          {  21" RGB (Radius)                }
    kESCThree21InchMonoRadius   = $34;                          {  21" Monochrome (Radius)            }
    kESCThree21InchMono         = $35;                          {  21" Monochrome                }
    kESCFourNTSC                = $0A;                          {  NTSC                      }
    kESCFivePortrait            = $1E;                          {  Portrait RGB               }
    kESCSixMSB1                 = $03;                          {  MultiScan Band-1 (12" thru 1Six")   }
    kESCSixMSB2                 = $0B;                          {  MultiScan Band-2 (13" thru 19")        }
    kESCSixMSB3                 = $23;                          {  MultiScan Band-3 (13" thru 21")        }
    kESCSixStandard             = $2B;                          {  13"/14" RGB or 12" Monochrome    }
    kESCSevenPAL                = $00;                          {  PAL                         }
    kESCSevenNTSC               = $14;                          {  NTSC                      }
    kESCSevenVGA                = $17;                          {  VGA                         }
    kESCSeven16Inch             = $2D;                          {  16" RGB (GoldFish)                }
    kESCSevenPALAlternate       = $30;                          {  PAL (Alternate)                 }
    kESCSeven19Inch             = $3A;                          {  Third-Party 19Ó                  }
    kESCSevenDDC                = $3E;                          {  DDC display                    }
    kESCSevenNoDisplay          = $3F;                          {  No display connected            }

    {    DepthMode
        This abstract data type is used to to reference RELATIVE pixel depths.
        Its definition is largely derived from its past usage, analogous to 'xxxVidMode'

        Bits per pixel DOES NOT directly map to 'DepthMode'  For example, on some
        graphics hardware, 'kDepthMode1' may represent 1 BPP, whereas on other
        hardware, 'kDepthMode1' may represent 8BPP.

        DepthMode IS considered to be ordinal, i.e., operations such as <, >, ==, etc.
        behave as expected.  The values of the constants which comprise the set are such
        that 'kDepthMode4 < kDepthMode6' behaves as expected.
        }

type
    DepthMode                           = UInt16;

const
    kDepthMode1                 = 128;
    kDepthMode2                 = 129;
    kDepthMode3                 = 130;
    kDepthMode4                 = 131;
    kDepthMode5                 = 132;
    kDepthMode6                 = 133;

    kFirstDepthMode             = 128;                          {  These constants are obsolete, and just included     }
    kSecondDepthMode            = 129;                          {  for clients that have converted to the above      }
    kThirdDepthMode             = 130;                          {  kDepthModeXXX constants.                 }
    kFourthDepthMode            = 131;
    kFifthDepthMode             = 132;
    kSixthDepthMode             = 133;



type
    VDPageInfoPtr = ^VDPageInfo;
    VDPageInfo = record
        csMode:                 SInt16;                             { (word) mode within device }
        csData:                 SInt32;                             { (long) data supplied by driver }
        csPage:                 SInt16;                             { (word) page to switch in }
        csBaseAddr:             Ptr;                                    { (long) base address of page }
    end;

    VDPgInfoPtr                         = ^VDPageInfo;
    VDSizeInfoPtr = ^VDSizeInfo;
    VDSizeInfo = record
        csHSize:                SInt16;                             { (word) desired/returned h size }
        csHPos:                 SInt16;                             { (word) desired/returned h position }
        csVSize:                SInt16;                             { (word) desired/returned v size }
        csVPos:                 SInt16;                             { (word) desired/returned v position }
    end;

    VDSzInfoPtr                         = ^VDSizeInfo;
    VDSettingsPtr = ^VDSettings;
    VDSettings = record
        csParamCnt:             SInt16;                             { (word) number of params }
        csBrightMax:            SInt16;                             { (word) max brightness }
        csBrightDef:            SInt16;                             { (word) default brightness }
        csBrightVal:            SInt16;                             { (word) current brightness }
        csCntrstMax:            SInt16;                             { (word) max contrast }
        csCntrstDef:            SInt16;                             { (word) default contrast }
        csCntrstVal:            SInt16;                             { (word) current contrast }
        csTintMax:              SInt16;                             { (word) max tint }
        csTintDef:              SInt16;                             { (word) default tint }
        csTintVal:              SInt16;                             { (word) current tint }
        csHueMax:               SInt16;                             { (word) max hue }
        csHueDef:               SInt16;                             { (word) default hue }
        csHueVal:               SInt16;                             { (word) current hue }
        csHorizDef:             SInt16;                             { (word) default horizontal }
        csHorizVal:             SInt16;                             { (word) current horizontal }
        csHorizMax:             SInt16;                             { (word) max horizontal }
        csVertDef:              SInt16;                             { (word) default vertical }
        csVertVal:              SInt16;                             { (word) current vertical }
        csVertMax:              SInt16;                             { (word) max vertical }
    end;

    VDDefModePtr = ^VDDefMode;
    VDDefMode = record
        csID:                   SInt8;
        filler:                 SInt8;
    end;

    VDSyncInfoRecPtr = ^VDSyncInfoRec;
    VDSyncInfoRec = record
        csMode:                 SInt8;
        csFlags:                SInt8;
    end;

    VDSyncInfoPtr                       = ^VDSyncInfoRec;
    AVIDType                            = UInt32;
    DisplayIDType                       = AVIDType;
    DisplayModeID                       = UInt32;
    VideoDeviceType                     = UInt32;
    GammaTableID                        = UInt32;
    {
       All displayModeID values from 0x80000000 to 0xFFFFFFFF and 0x00
       are reserved for Apple Computer.
    }
    {    Constants for the cscGetNextResolution call    }

const
    kDisplayModeIDCurrent       = $00;                          {  Reference the Current DisplayModeID  }
    kDisplayModeIDInvalid       = $FFFFFFFF;                    {  A bogus DisplayModeID in all cases  }
    kDisplayModeIDFindFirstResolution = $FFFFFFFE;              {  Used in cscGetNextResolution to reset iterator  }
    kDisplayModeIDNoMoreResolutions = $FFFFFFFD;                {  Used in cscGetNextResolution to indicate End Of List  }
    kDisplayModeIDFindFirstProgrammable = $FFFFFFFC;            {  Used in cscGetNextResolution to find unused programmable timing  }
    kDisplayModeIDBootProgrammable = $FFFFFFFB;                 {  This is the ID given at boot time by the of driver to a programmable timing  }
    kDisplayModeIDReservedBase  = $80000000;                    {  Lowest (unsigned) DisplayModeID reserved by Apple  }

    {    Constants for the GetGammaInfoList call    }
    kGammaTableIDFindFirst      = $FFFFFFFE;                    {  Get the first gamma table ID  }
    kGammaTableIDNoMoreTables   = $FFFFFFFD;                    {  Used to indicate end of list  }
    kGammaTableIDSpecific       = $00;                          {  Return the info for the given table id  }

    {  Constants for GetMultiConnect call }
    kGetConnectionCount         = $FFFFFFFF;                    {  Used to get the number of possible connections in a Òmulti-headedÓ framebuffer environment. }
    kActivateConnection         = $00;                          {  Used for activating a connection (csConnectFlags value). }
    kDeactivateConnection       = $0200;                        {  Used for deactivating a connection (csConnectFlags value.) }

    {  VDCommunicationRec.csBusID values }
    kVideoDefaultBus            = 0;


    {  VDCommunicationInfoRec.csBusType values }
    kVideoBusTypeInvalid        = 0;
    kVideoBusTypeI2C            = 1;


    {  VDCommunicationRec.csSendType and VDCommunicationRec.csReplyType values and bits in VDCommunicationInfoRec.csSupportedTypes. }
    kVideoNoTransactionType     = 0;                            {  No transaction }
    kVideoSimpleI2CType         = 1;                            {  Simple I2C message }
    kVideoDDCciReplyType        = 2;                            {  DDC/ci message (with imbedded length) }

    {  VDCommunicationRec.csCommFlags and VDCommunicationInfoRec.csSupportedCommFlags }
    kVideoReplyMicroSecDelayMask = $01;                         {  If set, the driver should delay csMinReplyDelay micro seconds between send and recieve }




type
    VDResolutionInfoRecPtr = ^VDResolutionInfoRec;
    VDResolutionInfoRec = record
        csPreviousDisplayModeID: DisplayModeID;                         {  ID of the previous resolution in a chain  }
        csDisplayModeID:        DisplayModeID;                          {  ID of the next resolution  }
        csHorizontalPixels:     UInt32;                                 {  # of pixels in a horizontal line at the max depth  }
        csVerticalLines:        UInt32;                                 {  # of lines in a screen at the max depth  }
        csRefreshRate:          Fixed;                                  {  Vertical Refresh Rate in Hz  }
        csMaxDepthMode:         DepthMode;                              {  0x80-based number representing max bit depth  }
        csResolutionFlags:      UInt32;                                 {  Reserved - flag bits  }
        csReserved:             UInt32;                                 {  Reserved  }
    end;

    VDResolutionInfoPtr                 = ^VDResolutionInfoRec;
    VDVideoParametersInfoRecPtr = ^VDVideoParametersInfoRec;
    VDVideoParametersInfoRec = record
        csDisplayModeID:        DisplayModeID;                          {  the ID of the resolution we want info on  }
        csDepthMode:            DepthMode;                              {  The bit depth we want the info on (0x80 based)  }
        csVPBlockPtr:           VPBlockPtr;                             {  Pointer to a video parameter block  }
        csPageCount:            UInt32;                                 {  Number of pages supported by the resolution  }
        csDeviceType:           VideoDeviceType;                        {  Device Type:  Direct, Fixed or CLUT;  }
        csDepthFlags:           UInt32;                                 {  Flags  }
    end;

    VDVideoParametersInfoPtr            = ^VDVideoParametersInfoRec;
    VDGammaInfoRecPtr = ^VDGammaInfoRec;
    VDGammaInfoRec = record
        csLastGammaID:          GammaTableID;                           {  the ID of the previous gamma table  }
        csNextGammaID:          GammaTableID;                           {  the ID of the next gamma table  }
        csGammaPtr:             Ptr;                                    {  Ptr to a gamma table data  }
        csReserved:             UInt32;                                 {  Reserved  }
    end;

    VDGammaInfoPtr                      = ^VDGammaInfoRec;
    VDGetGammaListRecPtr = ^VDGetGammaListRec;
    VDGetGammaListRec = record
        csPreviousGammaTableID: GammaTableID;                           {  ID of the previous gamma table  }
        csGammaTableID:         GammaTableID;                           {  ID of the gamma table following csPreviousDisplayModeID  }
        csGammaTableSize:       UInt32;                                 {  Size of the gamma table in bytes  }
        csGammaTableName:       CStringPtr;                             {  Gamma table name (c-string)  }
    end;

    VDGetGammaListPtr                   = ^VDGetGammaListRec;
    VDRetrieveGammaRecPtr = ^VDRetrieveGammaRec;
    VDRetrieveGammaRec = record
        csGammaTableID:         GammaTableID;                           {  ID of gamma table to retrieve  }
        csGammaTablePtr:        GammaTblPtr;                            {  Location to copy desired gamma to  }
    end;

    VDRetrieveGammaPtr                  = ^VDRetrieveGammaRec;
    VDSetHardwareCursorRecPtr = ^VDSetHardwareCursorRec;
    VDSetHardwareCursorRec = record
        csCursorRef:            Ptr;                                    {  reference to cursor data  }
        csReserved1:            UInt32;                                 {  reserved for future use  }
        csReserved2:            UInt32;                                 {  should be ignored  }
    end;

    VDSetHardwareCursorPtr              = ^VDSetHardwareCursorRec;
    VDDrawHardwareCursorRecPtr = ^VDDrawHardwareCursorRec;
    VDDrawHardwareCursorRec = record
        csCursorX:              SInt32;                                 {  x coordinate  }
        csCursorY:              SInt32;                                 {  y coordinate  }
        csCursorVisible:        UInt32;                                 {  true if cursor is must be visible  }
        csReserved1:            UInt32;                                 {  reserved for future use  }
        csReserved2:            UInt32;                                 {  should be ignored  }
    end;

    VDDrawHardwareCursorPtr             = ^VDDrawHardwareCursorRec;
    VDSupportsHardwareCursorRecPtr = ^VDSupportsHardwareCursorRec;
    VDSupportsHardwareCursorRec = record
        csSupportsHardwareCursor: UInt32;
                                                                        {  true if hardware cursor is supported  }
        csReserved1:            UInt32;                                 {  reserved for future use  }
        csReserved2:            UInt32;                                 {  must be zero  }
    end;

    VDSupportsHardwareCursorPtr         = ^VDSupportsHardwareCursorRec;
    VDHardwareCursorDrawStateRecPtr = ^VDHardwareCursorDrawStateRec;
    VDHardwareCursorDrawStateRec = record
        csCursorX:              SInt32;                                 {  x coordinate  }
        csCursorY:              SInt32;                                 {  y coordinate  }
        csCursorVisible:        UInt32;                                 {  true if cursor is visible  }
        csCursorSet:            UInt32;                                 {  true if cursor successfully set by last set control call  }
        csReserved1:            UInt32;                                 {  reserved for future use  }
        csReserved2:            UInt32;                                 {  must be zero  }
    end;

    VDHardwareCursorDrawStatePtr        = ^VDHardwareCursorDrawStateRec;
    VDConvolutionInfoRecPtr = ^VDConvolutionInfoRec;
    VDConvolutionInfoRec = record
        csDisplayModeID:        DisplayModeID;                          {  the ID of the resolution we want info on  }
        csDepthMode:            DepthMode;                              {  The bit depth we want the info on (0x80 based)  }
        csPage:                 UInt32;
        csFlags:                UInt32;
        csReserved:             UInt32;
    end;

    VDConvolutionInfoPtr                = ^VDConvolutionInfoRec;
    VDPowerStateRecPtr = ^VDPowerStateRec;
    VDPowerStateRec = record
        powerState:             UInt32;
        powerFlags:             UInt32;
        powerReserved1:         UInt32;
        powerReserved2:         UInt32;
    end;

    VDPowerStatePtr                     = ^VDPowerStateRec;
    {
        Private Data to video drivers.

        In versions of MacOS with multiple address spaces (System 8), the OS
        must know the extent of parameters in order to move them between the caller
        and driver.  The old private-selector model for video drivers does not have
        this information so:

        For post-7.x Systems private calls should be implemented using the cscPrivateCall
        }
    VDPrivateSelectorDataRecPtr = ^VDPrivateSelectorDataRec;
    VDPrivateSelectorDataRec = record
        privateParameters:      LogicalAddress;                         {  Caller's parameters }
        privateParametersSize:  ByteCount;                              {  Size of data sent from caller to driver }
        privateResults:         LogicalAddress;                         {  Caller's return area. Can be nil, or same as privateParameters. }
        privateResultsSize:     ByteCount;                              {  Size of data driver returns to caller. Can be nil, or same as privateParametersSize. }
    end;


    VDPrivateSelectorRecPtr = ^VDPrivateSelectorRec;
    VDPrivateSelectorRec = record
        reserved:               UInt32;                                 {  Reserved (set to 0).  }
        data:                   array [0..0] of VDPrivateSelectorDataRec;
    end;

    VDDDCBlockRecPtr = ^VDDDCBlockRec;
    VDDDCBlockRec = record
        ddcBlockNumber:         UInt32;                                 {  Input -- DDC EDID (Extended Display Identification Data) number (1-based)  }
        ddcBlockType:           ResType;                                {  Input -- DDC block type (EDID/VDIF)  }
        ddcFlags:               UInt32;                                 {  Input -- DDC Flags }
        ddcReserved:            UInt32;                                 {  Reserved  }
        ddcBlockData:           packed array [0..127] of Byte;          {  Output -- DDC EDID/VDIF data (kDDCBlockSize)  }
    end;

    VDDDCBlockPtr                       = ^VDDDCBlockRec;


const
                                                                {  timingSyncConfiguration }
    kSyncInterlaceMask          = $80;
    kSyncAnalogCompositeMask    = 0;
    kSyncAnalogCompositeSerrateMask = $04;
    kSyncAnalogCompositeRGBSyncMask = $02;
    kSyncAnalogBipolarMask      = $08;
    kSyncAnalogBipolarSerrateMask = $04;
    kSyncAnalogBipolarSRGBSyncMask = $02;
    kSyncDigitalCompositeMask   = $10;
    kSyncDigitalCompositeSerrateMask = $04;
    kSyncDigitalCompositeMatchHSyncMask = $04;
    kSyncDigitalSeperateMask    = $18;
    kSyncDigitalVSyncPositiveMask = $04;
    kSyncDigitalHSyncPositiveMask = $02;




type
    VDDisplayTimingRangeRecPtr = ^VDDisplayTimingRangeRec;
    VDDisplayTimingRangeRec = record
        csRangeSize:            UInt32;                                 {  Init to sizeof(VDDisplayTimingRangeRec)  }
        csRangeType:            UInt32;                                 {  Init to 0  }
        csRangeVersion:         UInt32;                                 {  Init to 0  }
        csRangeReserved:        UInt32;                                 {  Init to 0  }
        csRangeBlockIndex:      UInt32;                                 {  Requested block (first index is 0) }
        csRangeGroup:           UInt32;                                 {  set to 0  }
        csRangeBlockCount:      UInt32;                                 {  # blocks  }
        csRangeFlags:           UInt32;                                 {  dependent video  }
        csMinPixelClock:        UInt64;                                 {  Min dot clock in Hz  }
        csMaxPixelClock:        UInt64;                                 {  Max dot clock in Hz  }
        csMaxPixelError:        UInt32;                                 {  Max dot clock error  }
        csTimingRangeSyncFlags: UInt32;
        csTimingRangeSignalLevels: UInt32;
        csReserved0:            UInt32;
        csMinFrameRate:         UInt32;                                 {  Hz  }
        csMaxFrameRate:         UInt32;                                 {  Hz  }
        csMinLineRate:          UInt32;                                 {  Hz  }
        csMaxLineRate:          UInt32;                                 {  Hz  }
        csMaxHorizontalTotal:   UInt32;                                 {  Clocks - Maximum total (active + blanking)  }
        csMaxVerticalTotal:     UInt32;                                 {  Clocks - Maximum total (active + blanking)  }
        csMaxTotalReserved1:    UInt32;                                 {  Reserved  }
        csMaxTotalReserved2:    UInt32;                                 {  Reserved  }
                                                                        {  Some cards require that some timing elements }
                                                                        {  be multiples of a "character size" (often 8 }
                                                                        {  clocks).  The "xxxxCharSize" fields document }
                                                                        {  those requirements. }
        csCharSizeHorizontalActive: SInt8;                              {  Character size  }
        csCharSizeHorizontalBlanking: SInt8;                            {  Character size  }
        csCharSizeHorizontalSyncOffset: SInt8;                          {  Character size  }
        csCharSizeHorizontalSyncPulse: SInt8;                           {  Character size  }
        csCharSizeVerticalActive: SInt8;                                {  Character size  }
        csCharSizeVerticalBlanking: SInt8;                              {  Character size  }
        csCharSizeVerticalSyncOffset: SInt8;                            {  Character size  }
        csCharSizeVerticalSyncPulse: SInt8;                             {  Character size  }
        csCharSizeHorizontalBorderLeft: SInt8;                          {  Character size  }
        csCharSizeHorizontalBorderRight: SInt8;                         {  Character size  }
        csCharSizeVerticalBorderTop: SInt8;                             {  Character size  }
        csCharSizeVerticalBorderBottom: SInt8;                          {  Character size  }
        csCharSizeHorizontalTotal: SInt8;                               {  Character size for active + blanking  }
        csCharSizeVerticalTotal: SInt8;                                 {  Character size for active + blanking  }
        csCharSizeReserved1:    UInt16;                                 {  Reserved (Init to 0)  }
        csMinHorizontalActiveClocks: UInt32;
        csMaxHorizontalActiveClocks: UInt32;
        csMinHorizontalBlankingClocks: UInt32;
        csMaxHorizontalBlankingClocks: UInt32;
        csMinHorizontalSyncOffsetClocks: UInt32;
        csMaxHorizontalSyncOffsetClocks: UInt32;
        csMinHorizontalPulseWidthClocks: UInt32;
        csMaxHorizontalPulseWidthClocks: UInt32;
        csMinVerticalActiveClocks: UInt32;
        csMaxVerticalActiveClocks: UInt32;
        csMinVerticalBlankingClocks: UInt32;
        csMaxVerticalBlankingClocks: UInt32;
        csMinVerticalSyncOffsetClocks: UInt32;
        csMaxVerticalSyncOffsetClocks: UInt32;
        csMinVerticalPulseWidthClocks: UInt32;
        csMaxVerticalPulseWidthClocks: UInt32;
        csMinHorizontalBorderLeft: UInt32;
        csMaxHorizontalBorderLeft: UInt32;
        csMinHorizontalBorderRight: UInt32;
        csMaxHorizontalBorderRight: UInt32;
        csMinVerticalBorderTop: UInt32;
        csMaxVerticalBorderTop: UInt32;
        csMinVerticalBorderBottom: UInt32;
        csMaxVerticalBorderBottom: UInt32;
        csReserved1:            UInt32;                                 {  Reserved (Init to 0) }
        csReserved2:            UInt32;                                 {  Reserved (Init to 0) }
        csReserved3:            UInt32;                                 {  Reserved (Init to 0) }
        csReserved4:            UInt32;                                 {  Reserved (Init to 0) }
        csReserved5:            UInt32;                                 {  Reserved (Init to 0) }
        csReserved6:            UInt32;                                 {  Reserved (Init to 0) }
        csReserved7:            UInt32;                                 {  Reserved (Init to 0) }
        csReserved8:            UInt32;                                 {  Reserved (Init to 0) }
    end;

    VDDisplayTimingRangePtr             = ^VDDisplayTimingRangeRec;


const
                                                                {  csDisplayModeState }
    kDMSModeReady               = 0;                            {  Display Mode ID is configured and ready }
    kDMSModeNotReady            = 1;                            {  Display Mode ID is is being programmed }
    kDMSModeFree                = 2;                            {  Display Mode ID is not associated with a timing }


    {    Video driver Errors -10930 to -10959   }
    kTimingChangeRestrictedErr  = -10930;
    kVideoI2CReplyPendingErr    = -10931;
    kVideoI2CTransactionErr     = -10932;
    kVideoI2CBusyErr            = -10933;
    kVideoI2CTransactionTypeErr = -10934;
    kVideoBufferSizeErr         = -10935;
    kVideoCannotMirrorErr       = -10936;


                                                                {  csTimingRangeSignalLevels }
    kRangeSupportsSignal_0700_0300_Bit = 0;
    kRangeSupportsSignal_0714_0286_Bit = 1;
    kRangeSupportsSignal_1000_0400_Bit = 2;
    kRangeSupportsSignal_0700_0000_Bit = 3;
    kRangeSupportsSignal_0700_0300_Mask = $01;
    kRangeSupportsSignal_0714_0286_Mask = $02;
    kRangeSupportsSignal_1000_0400_Mask = $04;
    kRangeSupportsSignal_0700_0000_Mask = $08;


                                                                {  csSignalConfig }
    kDigitalSignalBit           = 0;                            {  Do not set.  Mac OS does not currently support arbitrary digital timings }
    kAnalogSetupExpectedBit     = 1;                            {  Analog displays - display expects a blank-to-black setup or pedestal.  See VESA signal standards. }
    kDigitalSignalMask          = $01;
    kAnalogSetupExpectedMask    = $02;


                                                                {  csSignalLevels for analog }
    kAnalogSignalLevel_0700_0300 = 0;
    kAnalogSignalLevel_0714_0286 = 1;
    kAnalogSignalLevel_1000_0400 = 2;
    kAnalogSignalLevel_0700_0000 = 3;


                                                                {  csTimingRangeSyncFlags }
    kRangeSupportsSeperateSyncsBit = 0;
    kRangeSupportsSyncOnGreenBit = 1;
    kRangeSupportsCompositeSyncBit = 2;
    kRangeSupportsVSyncSerrationBit = 3;
    kRangeSupportsSeperateSyncsMask = $01;
    kRangeSupportsSyncOnGreenMask = $02;
    kRangeSupportsCompositeSyncMask = $04;
    kRangeSupportsVSyncSerrationMask = $08;



                                                                {  csHorizontalSyncConfig and csVerticalSyncConfig }
    kSyncPositivePolarityBit    = 0;                            {  Digital separate sync polarity for analog interfaces (0 => negative polarity) }
    kSyncPositivePolarityMask   = $01;




    {  For timings with kDetailedTimingFormat. }

type
    VDDetailedTimingRecPtr = ^VDDetailedTimingRec;
    VDDetailedTimingRec = record
        csTimingSize:           UInt32;                                 {  Init to sizeof(VDDetailedTimingRec) }
        csTimingType:           UInt32;                                 {  Init to 0 }
        csTimingVersion:        UInt32;                                 {  Init to 0 }
        csTimingReserved:       UInt32;                                 {  Init to 0 }
        csDisplayModeID:        DisplayModeID;                          {  Init to 0 }
        csDisplayModeSeed:      UInt32;                                 {   }
        csDisplayModeState:     UInt32;                                 {  Display Mode state }
        csDisplayModeAlias:     UInt32;                                 {  Mode to use when programmed. }
        csSignalConfig:         UInt32;
        csSignalLevels:         UInt32;
        csPixelClock:           UInt64;                                 {  Hz }
        csMinPixelClock:        UInt64;                                 {  Hz - With error what is slowest actual clock  }
        csMaxPixelClock:        UInt64;                                 {  Hz - With error what is fasted actual clock  }
        csHorizontalActive:     UInt32;                                 {  Pixels }
        csHorizontalBlanking:   UInt32;                                 {  Pixels }
        csHorizontalSyncOffset: UInt32;                                 {  Pixels }
        csHorizontalSyncPulseWidth: UInt32;                             {  Pixels }
        csVerticalActive:       UInt32;                                 {  Lines }
        csVerticalBlanking:     UInt32;                                 {  Lines }
        csVerticalSyncOffset:   UInt32;                                 {  Lines }
        csVerticalSyncPulseWidth: UInt32;                               {  Lines }
        csHorizontalBorderLeft: UInt32;                                 {  Pixels }
        csHorizontalBorderRight: UInt32;                                {  Pixels }
        csVerticalBorderTop:    UInt32;                                 {  Lines }
        csVerticalBorderBottom: UInt32;                                 {  Lines }
        csHorizontalSyncConfig: UInt32;
        csHorizontalSyncLevel:  UInt32;                                 {  Future use (init to 0) }
        csVerticalSyncConfig:   UInt32;
        csVerticalSyncLevel:    UInt32;                                 {  Future use (init to 0) }
        csReserved1:            UInt32;                                 {  Init to 0 }
        csReserved2:            UInt32;                                 {  Init to 0 }
        csReserved3:            UInt32;                                 {  Init to 0 }
        csReserved4:            UInt32;                                 {  Init to 0 }
        csReserved5:            UInt32;                                 {  Init to 0 }
        csReserved6:            UInt32;                                 {  Init to 0 }
        csReserved7:            UInt32;                                 {  Init to 0 }
        csReserved8:            UInt32;                                 {  Init to 0 }
    end;

    VDDetailedTimingPtr                 = ^VDDetailedTimingRec;


const
                                                                {  csScalerFeatures }
    kScaleStretchOnlyMask       = $01;                          {  True means the driver cannot add borders to avoid non-square pixels }
    kScaleCanUpSamplePixelsMask = $02;                          {  True means timings with more active clocks than pixels (ie 640x480 pixels on a 1600x1200 timing) }
    kScaleCanDownSamplePixelsMask = $04;                        {  True means timings with fewer active clocks than pixels (ie 1600x1200  pixels on a 640x480 timing) }

                                                                {  csScalerFlags }
    kScaleStretchToFitMask      = $01;                          {  True means the driver should avoid borders and allow non-square pixels }




type
    VDClutBehavior                      = UInt32;
    VDClutBehaviorPtr                   = ^VDClutBehavior;

const
    kSetClutAtSetEntries        = 0;                            {  SetEntries behavior is to update clut during SetEntries call }
    kSetClutAtVBL               = 1;                            {  SetEntries behavior is to upate clut at next vbl }



type
    VDCommunicationRecPtr = ^VDCommunicationRec;
    VDCommunicationRec = record
        csBusID:                SInt32;                                 {  kVideoDefaultBus for single headed cards. }
        csCommFlags:            UInt32;                                 {  Always zero }
        csMinReplyDelay:        UInt32;                                 {  Minimum delay between send and reply transactions (units depend on csCommFlags) }
        csReserved2:            UInt32;                                 {  Always zero }
        csSendAddress:          UInt32;                                 {  Usually I2C address (eg 0x6E) }
        csSendType:             UInt32;                                 {  See kVideoSimpleI2CType etc. }
        csSendBuffer:           LogicalAddress;                         {  Pointer to the send buffer }
        csSendSize:             ByteCount;                              {  Number of bytes to send }
        csReplyAddress:         UInt32;                                 {  Address from which to read (eg 0x6F for kVideoDDCciReplyType I2C address) }
        csReplyType:            UInt32;                                 {  See kVideoDDCciReplyType etc. }
        csReplyBuffer:          LogicalAddress;                         {  Pointer to the reply buffer }
        csReplySize:            ByteCount;                              {  Max bytes to reply (size of csReplyBuffer) }
        csReserved3:            UInt32;
        csReserved4:            UInt32;
        csReserved5:            UInt32;                                 {  Always zero }
        csReserved6:            UInt32;                                 {  Always zero }
    end;

    VDCommunicationPtr                  = ^VDCommunicationRec;
    VDCommunicationInfoRecPtr = ^VDCommunicationInfoRec;
    VDCommunicationInfoRec = record
        csBusID:                SInt32;                                 {  kVideoDefaultBus for single headed cards.  }
        csBusType:              UInt32;                                 {  See kVideoBusI2C etc. }
        csMinBus:               SInt32;                                 {  Minimum bus (usually kVideoDefaultBus).  Used to probe additional busses }
        csMaxBus:               SInt32;                                 {  Max bus (usually kVideoDefaultBus).  Used to probe additional busses }
        csSupportedTypes:       UInt32;                                 {  Bit field for first 32 supported transaction types.  Eg. 0x07 => support for kVideoNoTransactionType, kVideoSimpleI2CType and kVideoDDCciReplyType. }
        csSupportedCommFlags:   UInt32;                                 {  Return the flags csCommFlags understood by this driver. }
        csReserved2:            UInt32;                                 {  Always zero }
        csReserved3:            UInt32;                                 {  Always zero }
        csReserved4:            UInt32;                                 {  Always zero }
        csReserved5:            UInt32;                                 {  Always zero }
        csReserved6:            UInt32;                                 {  Always zero }
        csReserved7:            UInt32;                                 {  Always zero }
    end;

    VDCommunicationInfoPtr              = ^VDCommunicationInfoRec;
    VDScalerRecPtr = ^VDScalerRec;
    VDScalerRec = record
        csScalerSize:           UInt32;                                 {  Init to sizeof(VDScalerRec) }
        csScalerVersion:        UInt32;                                 {  Init to 0 }
        csReserved1:            UInt32;                                 {  Init to 0 }
        csReserved2:            UInt32;                                 {  Init to 0 }
        csDisplayModeID:        DisplayModeID;                          {  Display Mode ID modified by this call. }
        csDisplayModeSeed:      UInt32;                                 {   }
        csDisplayModeState:     UInt32;                                 {  Display Mode state }
        csReserved3:            UInt32;                                 {  Init to 0 }
        csScalerFlags:          UInt32;                                 {  Init to 0 }
        csHorizontalPixels:     UInt32;                                 {  Graphics system addressable pixels }
        csVerticalPixels:       UInt32;                                 {  Graphics system addressable lines }
        csReserved4:            UInt32;                                 {  Init to 0 }
        csReserved5:            UInt32;                                 {  Init to 0 }
        csReserved6:            UInt32;                                 {  Init to 0 }
        csReserved7:            UInt32;                                 {  Init to 0 }
        csReserved8:            UInt32;                                 {  Init to 0 }
    end;

    VDScalerPtr                         = ^VDScalerRec;
    VDScalerInfoRecPtr = ^VDScalerInfoRec;
    VDScalerInfoRec = record
        csScalerInfoSize:       UInt32;                                 {  Init to sizeof(VDScalerInfoRec) }
        csScalerInfoVersion:    UInt32;                                 {  Init to 0 }
        csReserved1:            UInt32;                                 {  Init to 0 }
        csReserved2:            UInt32;                                 {  Init to 0 }
        csScalerFeatures:       UInt32;                                 {  Feature flags }
        csMaxHorizontalPixels:  UInt32;                                 {  limit to horizontal scaled pixels }
        csMaxVerticalPixels:    UInt32;                                 {  limit to vertical scaled pixels }
        csReserved3:            UInt32;                                 {  Init to 0 }
        csReserved4:            UInt32;                                 {  Init to 0 }
        csReserved5:            UInt32;                                 {  Init to 0 }
        csReserved6:            UInt32;                                 {  Init to 0 }
        csReserved7:            UInt32;                                 {  Init to 0 }
    end;

    VDScalerInfoPtr                     = ^VDScalerInfoRec;

const
                                                                {  csMirrorFeatures }
    kMirrorSameDepthOnlyMirrorMask = $01;                       {  Commonly true - Mirroring can only be done if the displays are the same bitdepth }
    kMirrorSameSizeOnlyMirrorMask = $02;                        {  Commonly false - Mirroring can only be done if the displays are the same size }
    kMirrorSameTimingOnlyMirrorMask = $04;                      {  Sometimes true - Mirroring can only be done if the displays are the same timing }
    kMirrorCommonGammaMask      = $08;                          {  Sometimes true - Only one gamma correction LUT. }

                                                                {  csMirrorSupportedFlags and csMirrorFlags }
    kMirrorCanMirrorMask        = $01;                          {  Set means we can HW mirrored right now (uses csMirrorEntryID) }
    kMirrorAreMirroredMask      = $02;                          {  Set means we are HW mirrored right now (uses csMirrorEntryID) }
    kMirrorUnclippedMirrorMask  = $04;                          {  Set means mirrored displays are not clipped to their intersection }
    kMirrorHAlignCenterMirrorMask = $08;                        {  Set means mirrored displays can/should be centered horizontally }
    kMirrorVAlignCenterMirrorMask = $10;                        {  Set means mirrored displays can/should be centered vertically }
    kMirrorCanChangePixelFormatMask = $20;                      {  Set means mirrored the device should change the pixel format of mirrored displays to allow mirroring. }
    kMirrorCanChangeTimingMask  = $40;                          {  Set means mirrored the device should change the timing of mirrored displays to allow mirroring. }



type
    VDMirrorRecPtr = ^VDMirrorRec;
    VDMirrorRec = record
        csMirrorSize:           UInt32;                                 {  Init to sizeof(VDMirrorRec) }
        csMirrorVersion:        UInt32;                                 {  Init to 0 }
        csMirrorRequestID:      RegEntryID;                             {  Input RegEntryID to check for mirroring support and state }
        csMirrorResultID:       RegEntryID;                             {  Output RegEntryID of the next mirrored device }
        csMirrorFeatures:       UInt32;                                 {  Output summary features of the driver }
        csMirrorSupportedFlags: UInt32;                                 {  Output configuration options supported by the driver }
        csMirrorFlags:          UInt32;                                 {  Output configuration options active now }
        csReserved1:            UInt32;                                 {  Init to 0 }
        csReserved2:            UInt32;                                 {  Init to 0 }
        csReserved3:            UInt32;                                 {  Init to 0 }
        csReserved4:            UInt32;                                 {  Init to 0 }
        csReserved5:            UInt32;                                 {  Init to 0 }
    end;

    VDMirrorPtr                         = ^VDMirrorRec;
{$ALIGN MAC68K}
{#POP}
{unit CGBitmapContext}
{$ALIGN MAC68K}










{ Create a bitmap context.  The context draws into a bitmap which is
 * `width' pixels wide and `height' pixels high.  The number of components
 * for each pixel is specified by `colorspace', which also may specify a
 * destination color profile. The number of bits for each component of a
 * pixel is specified by `bitsPerComponent', which must be 1, 2, 4, or 8.
 * Each row of the bitmap consists of `bytesPerRow' bytes, which must be at
 * least `(width * bitsPerComponent * number of components + 7)/8' bytes.
 * `data' points a block of memory at least `bytesPerRow * height' bytes.
 * `alphaInfo' specifies whether the bitmap should contain an alpha
 * channel, and how it's to be generated. }

{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}

{
 *  CGBitmapContextCreate()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CGBitmapContextCreate(data: UnivPtr; width: size_t; height: size_t; bitsPerComponent: size_t; bytesPerRow: size_t; colorspace: CGColorSpaceRef; alphaInfo: CGImageAlphaInfo): CGContextRef; external name '_CGBitmapContextCreate';

{$ALIGN MAC68K}
{#POP}
{unit Devices}
{$ALIGN MAC68K}








{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}

{ Values of the 'message' parameter to a Chooser device package }

const
    chooserInitMsg              = 11;                           {  the user selected this device package  }
    newSelMsg                   = 12;                           {  the user made new device selections  }
    fillListMsg                 = 13;                           {  fill the device list with choices  }
    getSelMsg                   = 14;                           {  mark one or more choices as selected  }
    selectMsg                   = 15;                           {  the user made a selection  }
    deselectMsg                 = 16;                           {  the user canceled a selection  }
    terminateMsg                = 17;                           {  allows device package to clean up  }
    buttonMsg                   = 19;                           {  the user selected a button  }


    {    Values of the 'caller' parameter to a Chooser device package   }
    chooserID                   = 1;


    {    Values of the 'message' parameter to a Monitor 'mntr'  }
    initMsg                     = 1;                            { initialization }
    okMsg                       = 2;                            { user clicked OK button }
    cancelMsg                   = 3;                            { user clicked Cancel button }
    hitMsg                      = 4;                            { user clicked control in Options dialog }
    nulMsg                      = 5;                            { periodic event }
    updateMsg                   = 6;                            { update event }
    activateMsg                 = 7;                            { not used }
    deactivateMsg               = 8;                            { not used }
    keyEvtMsg                   = 9;                            { keyboard event }
    superMsg                    = 10;                           { show superuser controls }
    normalMsg                   = 11;                           { show only normal controls }
    startupMsg                  = 12;                           { code has been loaded }


    {    control codes for DeskAccessories  }
    goodbye                     = -1;                           {  heap being reinitialized  }
    killCode                    = 1;                            {  KillIO requested  }
    accEvent                    = 64;                           {  handle an event  }
    accRun                      = 65;                           {  time for periodic action  }
    accCursor                   = 66;                           {  change cursor shape  }
    accMenu                     = 67;                           {  handle menu item  }
    accUndo                     = 68;                           {  handle undo command  }
    accCut                      = 70;                           {  handle cut command  }
    accCopy                     = 71;                           {  handle copy command  }
    accPaste                    = 72;                           {  handle paste command  }
    accClear                    = 73;                           {  handle clear command  }

    {    Control/Status Call Codes  }
    {    drvStsCode, ejectCode and tgBuffCode are now defined in Disks.h/p/a    }

    {    miscellaneous Device Manager constants     }
    ioInProgress                = 1;                            {  predefined value of ioResult while I/O is pending  }
    aRdCmd                      = 2;                            {  low byte of ioTrap for Read calls  }
    aWrCmd                      = 3;                            {  low byte of ioTrap for Write calls  }
    asyncTrpBit                 = 10;                           {  trap word modifier  }
    noQueueBit                  = 9;                            {  trap word modifier  }

    {    flags used in the driver header and device control entry   }
    dReadEnable                 = 0;                            {  set if driver responds to read requests  }
    dWritEnable                 = 1;                            {  set if driver responds to write requests  }
    dCtlEnable                  = 2;                            {  set if driver responds to control requests  }
    dStatEnable                 = 3;                            {  set if driver responds to status requests  }
    dNeedGoodBye                = 4;                            {  set if driver needs time for performing periodic tasks  }
    dNeedTime                   = 5;                            {  set if driver needs time for performing periodic tasks  }
    dNeedLock                   = 6;                            {  set if driver must be locked in memory as soon as it is opened  }

    dNeedLockMask               = $4000;                        {  set if driver must be locked in memory as soon as it is opened  }
    dNeedTimeMask               = $2000;                        {  set if driver needs time for performing periodic tasks  }
    dNeedGoodByeMask            = $1000;                        {  set if driver needs to be called before the application heap is initialized  }
    dStatEnableMask             = $0800;                        {  set if driver responds to status requests  }
    dCtlEnableMask              = $0400;                        {  set if driver responds to control requests  }
    dWritEnableMask             = $0200;                        {  set if driver responds to write requests  }
    dReadEnableMask             = $0100;                        {  set if driver responds to read requests  }


    {    run-time flags used in the device control entry    }
    dVMImmuneBit                = 0;                            {  driver does not need VM protection  }
    dOpened                     = 5;                            {  driver is open  }
    dRAMBased                   = 6;                            {  dCtlDriver is a handle (1) or pointer (0)  }
    drvrActive                  = 7;                            {  driver is currently processing a request  }

    dVMImmuneMask               = $0001;                        {  driver does not need VM protection  }
    dOpenedMask                 = $0020;                        {  driver is open  }
    dRAMBasedMask               = $0040;                        {  dCtlDriver is a handle (1) or pointer (0)  }
    drvrActiveMask              = $0080;                        {  driver is currently processing a request  }


type
    DRVRHeaderPtr = ^DRVRHeader;
    DRVRHeader = record
        drvrFlags:              SInt16;
        drvrDelay:              SInt16;
        drvrEMask:              SInt16;
        drvrMenu:               SInt16;
        drvrOpen:               SInt16;
        drvrPrime:              SInt16;
        drvrCtl:                SInt16;
        drvrStatus:             SInt16;
        drvrClose:              SInt16;
        drvrName:               SInt8;
    end;

    DRVRHeaderHandle                    = ^DRVRHeaderPtr;
    DCtlEntryPtr = ^DCtlEntry;
    DCtlEntry = record
        dCtlDriver:             Ptr;
        dCtlFlags:              SInt16;
        dCtlQHdr:               QHdr;
        dCtlPosition:           SInt32;
        dCtlStorage:            Handle;
        dCtlRefNum:             SInt16;
        dCtlCurTicks:           SInt32;
        dCtlWindow:             GrafPtr;
        dCtlDelay:              SInt16;
        dCtlEMask:              SInt16;
        dCtlMenu:               SInt16;
    end;

    DCtlPtr                             = ^DCtlEntry;
    DCtlHandle                          = ^DCtlPtr;
    AuxDCEPtr = ^AuxDCE;
    AuxDCE = packed record
        dCtlDriver:             Ptr;
        dCtlFlags:              SInt16;
        dCtlQHdr:               QHdr;
        dCtlPosition:           SInt32;
        dCtlStorage:            Handle;
        dCtlRefNum:             SInt16;
        dCtlCurTicks:           SInt32;
        dCtlWindow:             GrafPtr;
        dCtlDelay:              SInt16;
        dCtlEMask:              SInt16;
        dCtlMenu:               SInt16;
        dCtlSlot:               SInt8;
        dCtlSlotId:             SInt8;
        dCtlDevBase:            SInt32;
        dCtlOwner:              Ptr;
        dCtlExtDev:             SInt8;
        fillByte:               SInt8;
        dCtlNodeID:             UInt32;
    end;

    AuxDCEHandle                        = ^AuxDCEPtr;
    {     The NDRV Driver IO Entry Point and Commands   }
    UnitNumber                          = UInt16;
    DriverOpenCount                     = UInt32;
    DriverRefNum                        = SInt16;
    DriverFlags                         = SInt16;
    IOCommandCode                       = UInt32;

const
    kOpenCommand                = 0;
    kCloseCommand               = 1;
    kReadCommand                = 2;
    kWriteCommand               = 3;
    kControlCommand             = 4;
    kStatusCommand              = 5;
    kKillIOCommand              = 6;
    kInitializeCommand          = 7;                            {  init driver and device }
    kFinalizeCommand            = 8;                            {  shutdown driver and device }
    kReplaceCommand             = 9;                            {  replace an old driver }
    kSupersededCommand          = 10;                           {  prepare to be replaced by a new driver }
    kSuspendCommand             = 11;                           {  prepare driver to go to sleep }
    kResumeCommand              = 12;                           {  wake up sleeping driver }

                                                                {  one more IOCommandCode }
    kPowerManagementCommand     = 13;                           {  power management command, supercedes kSuspendCommand and kResumeCommand }


type
    AddressSpaceID                      = MPAddressSpaceID;
    IOCommandID    = ^SInt32; { an opaque 32-bit type }
    IOCommandIDPtr = ^IOCommandID;  { when a var xx:IOCommandID parameter can be nil, it is changed to xx: IOCommandIDPtr }
    IOCommandKind                       = UInt32;

const
    kSynchronousIOCommandKind   = $00000001;
    kAsynchronousIOCommandKind  = $00000002;
    kImmediateIOCommandKind     = $00000004;


type
    DriverInitInfoPtr = ^DriverInitInfo;
    DriverInitInfo = record
        refNum:                 DriverRefNum;
        deviceEntry:            RegEntryID;
    end;

    DriverReplaceInfo                   = DriverInitInfo;
    DriverReplaceInfoPtr                = ^DriverReplaceInfo;
    DriverFinalInfoPtr = ^DriverFinalInfo;
    DriverFinalInfo = record
        refNum:                 DriverRefNum;
        deviceEntry:            RegEntryID;
    end;

    DriverSupersededInfo                = DriverFinalInfo;
    DriverSupersededInfoPtr             = ^DriverSupersededInfo;

    {  Contents are command specific }

    IOCommandContentsPtr = ^IOCommandContents;
    IOCommandContents = record
        case SInt16 of
        0: (
            pb:                 ParmBlkPtr;
            );
        1: (
            initialInfo:        DriverInitInfoPtr;
            );
        2: (
            finalInfo:          DriverFinalInfoPtr;
            );
        3: (
            replaceInfo:        DriverReplaceInfoPtr;
            );
        4: (
            supersededInfo:     DriverSupersededInfoPtr;
            );
    end;

    DriverEntryPointPtr = function(SpaceID: AddressSpaceID; CommandID: IOCommandID; Contents: IOCommandContents; Code: IOCommandCode; Kind: IOCommandKind): OSErr;

    {    Record to describe a file-based driver candidate   }
    FileBasedDriverRecordPtr = ^FileBasedDriverRecord;
    FileBasedDriverRecord = record
        theSpec:                FSSpec;                                 {  file specification }
        theType:                MacDriverType;                          {  nameInfoStr + version number }
        compatibleProp:         boolean;                                {  true if matched using a compatible name }
        pad:                    packed array [0..2] of UInt8;           {  alignment }
    end;

    {    Detailed Record to describe a file-based driver candidate. Includes fragment name  }
    FileBasedDriverDetailedPtr = ^FileBasedDriverDetailed;
    FileBasedDriverDetailed = record
        fileBasedDriver:        FileBasedDriverRecord;
        fragName:               Str63;
    end;

    {    Driver Loader API  }

{
 *  PBCloseSync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBCloseSync(paramBlock: ParmBlkPtr): OSErr; external name '_PBCloseSync';
{
 *  PBCloseAsync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBCloseAsync(paramBlock: ParmBlkPtr): OSErr; external name '_PBCloseAsync';

{
 *  PBReadSync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBReadSync(paramBlock: ParmBlkPtr): OSErr; external name '_PBReadSync';
{
 *  PBReadAsync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBReadAsync(paramBlock: ParmBlkPtr): OSErr; external name '_PBReadAsync';

{
 *  PBWriteSync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBWriteSync(paramBlock: ParmBlkPtr): OSErr; external name '_PBWriteSync';
{
 *  PBWriteAsync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBWriteAsync(paramBlock: ParmBlkPtr): OSErr; external name '_PBWriteAsync';

{
 *  PBWaitIOComplete()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PBWaitIOComplete(paramBlock: ParmBlkPtr; timeout: Duration): OSErr; external name '_PBWaitIOComplete';

{ AddDrive and GetDrvQHdr are now defined in Disks.h/p/a }






{
    The PBxxx() routines are obsolete.

    Use the PBxxxSync(), PBxxxAsync(), or PBxxxImmed version instead.
}








{$ALIGN MAC68K}
{#POP}
{unit Events}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}


type
    EventKind                           = UInt16;
    EventMask                           = UInt16;

const
    nullEvent                   = 0;
    mouseDown                   = 1;
    mouseUp                     = 2;
    keyDown                     = 3;
    keyUp                       = 4;
    autoKey                     = 5;
    updateEvt                   = 6;
    diskEvt                     = 7;                            {  Not sent in Carbon. See kEventClassVolume in CarbonEvents.h }
    activateEvt                 = 8;
    osEvt                       = 15;
    kHighLevelEvent             = 23;

    mDownMask                   = $02;                          {  mouse button pressed }
    mUpMask                     = $04;                          {  mouse button released }
    keyDownMask                 = $08;                          {  key pressed }
    keyUpMask                   = $10;                          {  key released }
    autoKeyMask                 = $20;                          {  key repeatedly held down }
    updateMask                  = $40;                          {  window needs updating }
    diskMask                    = $80;                          {  disk inserted }
    activMask                   = $0100;                        {  activate/deactivate window }
    highLevelEventMask          = $0400;                        {  high-level events (includes AppleEvents) }
    osMask                      = $8000;                        {  operating system events (suspend, resume) }
    everyEvent                  = $FFFF;                        {  all of the above }

    charCodeMask                = $000000FF;
    keyCodeMask                 = $0000FF00;
    adbAddrMask                 = $00FF0000;
    osEvtMessageMask            = $FF000000;

                                                                {  OS event messages.  Event (sub)code is in the high byte of the message field. }
    mouseMovedMessage           = $00FA;
    suspendResumeMessage        = $0001;

    resumeFlag                  = 1;                            {  Bit 0 of message indicates resume vs suspend }


    {
        CARBON ALERT! BATTLESTATIONS!

        The EventModifiers bits defined here are also used in the newer Carbon Event
        key modifiers parameters. There are two main differences:

        1)  The Carbon key modifiers parameter is a UInt32, not a UInt16. Never try to
            extract the key modifiers parameter from a Carbon Event into an EventModifiers
            type. You will probably get your stack trashed.
        2)  The Carbon key modifiers is just that: key modifiers. That parameter will
            never contain the button state bit.
        }

type
    EventModifiers                      = UInt16;

const
                                                                {  modifiers  }
    activeFlagBit               = 0;                            {  activate? (activateEvt and mouseDown) }
    btnStateBit                 = 7;                            {  state of button? }
    cmdKeyBit                   = 8;                            {  command key down? }
    shiftKeyBit                 = 9;                            {  shift key down? }
    alphaLockBit                = 10;                           {  alpha lock down? }
    optionKeyBit                = 11;                           {  option key down? }
    controlKeyBit               = 12;                           {  control key down? }
    rightShiftKeyBit            = 13;                           {  right shift key down? }
    rightOptionKeyBit           = 14;                           {  right Option key down? }
    rightControlKeyBit          = 15;                           {  right Control key down? }

    activeFlag                  = $01;
    btnState                    = $80;
    cmdKey                      = $0100;
    shiftKey                    = $0200;
    alphaLock                   = $0400;
    optionKey                   = $0800;
    controlKey                  = $1000;
    rightShiftKey               = $2000;
    rightOptionKey              = $4000;
    rightControlKey             = $8000;

    {  MacRoman character codes }
    kNullCharCode               = 0;
    kHomeCharCode               = 1;
    kEnterCharCode              = 3;
    kEndCharCode                = 4;
    kHelpCharCode               = 5;
    kBellCharCode               = 7;
    kBackspaceCharCode          = 8;
    kTabCharCode                = 9;
    kLineFeedCharCode           = 10;
    kVerticalTabCharCode        = 11;
    kPageUpCharCode             = 11;
    kFormFeedCharCode           = 12;
    kPageDownCharCode           = 12;
    kReturnCharCode             = 13;
    kFunctionKeyCharCode        = 16;
    kCommandCharCode            = 17;                           {  glyph available only in system fonts }
    kCheckCharCode              = 18;                           {  glyph available only in system fonts }
    kDiamondCharCode            = 19;                           {  glyph available only in system fonts }
    kAppleLogoCharCode          = 20;                           {  glyph available only in system fonts }
    kEscapeCharCode             = 27;
    kClearCharCode              = 27;
    kLeftArrowCharCode          = 28;
    kRightArrowCharCode         = 29;
    kUpArrowCharCode            = 30;
    kDownArrowCharCode          = 31;
    kSpaceCharCode              = 32;
    kDeleteCharCode             = 127;
    kBulletCharCode             = 165;
    kNonBreakingSpaceCharCode   = 202;

    {  useful Unicode code points }
    kShiftUnicode               = $21E7;                        {  Unicode UPWARDS WHITE ARROW }
    kControlUnicode             = $2303;                        {  Unicode UP ARROWHEAD }
    kOptionUnicode              = $2325;                        {  Unicode OPTION KEY }
    kCommandUnicode             = $2318;                        {  Unicode PLACE of INTEREST SIGN }
    kPencilUnicode              = $270E;                        {  Unicode LOWER RIGHT PENCIL }
    kCheckUnicode               = $2713;                        {  Unicode CHECK MARK }
    kDiamondUnicode             = $25C6;                        {  Unicode BLACK DIAMOND }
    kBulletUnicode              = $2022;                        {  Unicode BULLET }
    kAppleLogoUnicode           = $F8FF;                        {  Unicode APPLE LOGO }


type
    EventRecordPtr = ^EventRecord;
    EventRecord = record
        what:                   EventKind;
        message:                UInt32;
        when:                   UInt32;
        where:                  Point;
        modifiers:              EventModifiers;
    end;

    FKEYProcPtr = procedure;

    FKEYUPP = ^SInt32; { an opaque UPP }

const
    uppFKEYProcInfo = $00000000;

{
 *  GetMouse()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure GetMouse(var mouseLoc: Point); external name '_GetMouse';
{
 *  Button()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function Button: boolean; external name '_Button';
{
 *  StillDown()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function StillDown: boolean; external name '_StillDown';
{
 *  WaitMouseUp()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function WaitMouseUp: boolean; external name '_WaitMouseUp';
{
 *  KeyTranslate()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function KeyTranslate(transData: UnivPtr; keycode: UInt16; var state: UInt32): UInt32; external name '_KeyTranslate';
{
 *  GetCaretTime()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetCaretTime: UInt32; external name '_GetCaretTime';
type
    KeyMap                          = packed array [0..127] of boolean;
{
 *  GetKeys()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure GetKeys(var theKeys: KeyMap); external name '_GetKeys';
{ Obsolete event types & masks }

const
    networkEvt                  = 10;
    driverEvt                   = 11;
    app1Evt                     = 12;
    app2Evt                     = 13;
    app3Evt                     = 14;
    app4Evt                     = 15;
    networkMask                 = $0400;
    driverMask                  = $0800;
    app1Mask                    = $1000;
    app2Mask                    = $2000;
    app3Mask                    = $4000;
    app4Mask                    = $8000;


type
    EvQElPtr = ^EvQEl;
    EvQEl = record
        qLink:                  QElemPtr;
        qType:                  SInt16;
        evtQWhat:               EventKind;                              {  this part is identical to the EventRecord as defined above  }
        evtQMessage:            UInt32;
        evtQWhen:               UInt32;
        evtQWhere:              Point;
        evtQModifiers:          EventModifiers;
    end;

    GetNextEventFilterProcPtr = procedure(var theEvent: EventRecord; var result: boolean);

    GetNextEventFilterUPP = ^SInt32; { an opaque UPP }

const
    uppGetNextEventFilterProcInfo = $000000BF;


type
    GNEFilterUPP                        = GetNextEventFilterUPP;
    {
     *  GetDblTime()
     *
     *  Availability:
     *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function GetDblTime: UInt32; external name '_GetDblTime';
{
 *  SetEventMask()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetEventMask(value: EventMask); external name '_SetEventMask';


{
 *  GetNextEvent()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetNextEvent(eventMask: EventMask; var theEvent: EventRecord): boolean; external name '_GetNextEvent';
{
 *  WaitNextEvent()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function WaitNextEvent(eventMask: EventMask; var theEvent: EventRecord; sleep: UInt32; mouseRgn: RgnHandle): boolean; external name '_WaitNextEvent';
{
 *  EventAvail()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function EventAvail(eventMask: EventMask; var theEvent: EventRecord): boolean; external name '_EventAvail';
{
 *  PostEvent()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PostEvent(eventNum: EventKind; eventMsg: UInt32): OSErr; external name '_PostEvent';
{
    For Carbon, use EventAvail, TickCount, GetGlobalMouse,
    GetKeys, or GetCurrentKeyModifiers instead of
    OSEventAvail, and use GetNextEvent or WaitNextEvent
    instead of GetOSEvent.
}


{
 *  FlushEvents()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure FlushEvents(whichMask: EventMask; stopMask: EventMask); external name '_FlushEvents';


{
    GetGlobalMouse, GetCurrentKeyModifiers, and CheckEventQueueForUserCancel
    are only available as part of the Carbon API.
}

{
 *  GetGlobalMouse()
 *
 *  Summary:
 *    Returns the position of the mouse in global coordinates.
 *
 *  Parameters:
 *
 *    globalMouse:
 *      On exit, contains the mouse position in global coordinates.
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure GetGlobalMouse(var globalMouse: Point); external name '_GetGlobalMouse';

{
 *  GetCurrentKeyModifiers()
 *
 *  Summary:
 *    Returns the current state of the keyboard modifier keys.
 *
 *  Discussion:
 *    The format of the return value is the same as the modifiers field
 *    of the EventRecord.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetCurrentKeyModifiers: UInt32; external name '_GetCurrentKeyModifiers';

{
 *  CheckEventQueueForUserCancel()
 *
 *  Summary:
 *    Determines if there is a cancel event in the event queue.
 *
 *  Discussion:
 *    This API supports two cancel events: Escape and Cmd-Period. Mouse
 *    or keyboard events in front of the cancel event in the event
 *    queue will be removed.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CheckEventQueueForUserCancel: boolean; external name '_CheckEventQueueForUserCancel';


{
    The core data structure for the Carbon event system. It is declared here instead of
    in CarbonEvents.h to avoid recursive include problems.
}

type
    EventRef    = ^SInt32; { an opaque 32-bit type }
    EventRefPtr = ^EventRef;  { when a var xx:EventRef parameter can be nil, it is changed to xx: EventRefPtr }
    {
     *  KeyScript()
     *
     *  Availability:
     *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
procedure KeyScript(code: SInt16); external name '_KeyScript';
{
 *  IsCmdChar()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function IsCmdChar(const (*var*) event: EventRecord; test: SInt16): boolean; external name '_IsCmdChar';
{
    LowMem accessor functions previously in LowMem.h
}
{
 *  LMGetKeyThresh()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function LMGetKeyThresh: SInt16; external name '_LMGetKeyThresh';
{
 *  LMSetKeyThresh()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure LMSetKeyThresh(value: SInt16); external name '_LMSetKeyThresh';
{
 *  LMGetKeyRepThresh()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function LMGetKeyRepThresh: SInt16; external name '_LMGetKeyRepThresh';
{
 *  LMSetKeyRepThresh()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure LMSetKeyRepThresh(value: SInt16); external name '_LMSetKeyRepThresh';
{
 *  LMGetKbdLast()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function LMGetKbdLast: ByteParameter; external name '_LMGetKbdLast';
{
 *  LMSetKbdLast()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure LMSetKbdLast(value: ByteParameter); external name '_LMSetKbdLast';
{
 *  LMGetKbdType()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function LMGetKbdType: ByteParameter; external name '_LMGetKbdType';
{
 *  LMSetKbdType()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure LMSetKbdType(value: ByteParameter); external name '_LMSetKbdType';
{$ALIGN MAC68K}
{#POP}
{unit Fonts}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}


const
    systemFont                  = 0;
    applFont                    = 1;

    kFMDefaultOptions           = 0;

    {    Activation contexts    }
    kFMDefaultActivationContext = 0;
    kFMGlobalActivationContext  = $00000001;
    kFMLocalActivationContext   = 0;

    {    Iteration scopes   }
    kFMDefaultIterationScope    = 0;
    kFMGlobalIterationScope     = $00000001;
    kFMLocalIterationScope      = 0;


    {    kPlatformDefaultGuiFontID is used in QuickTime 3.0.    }
    kPlatformDefaultGuiFontID   = 1;


    commandMark                 = 17;
    checkMark                   = 18;
    diamondMark                 = 19;
    appleMark                   = 20;

    propFont                    = 36864;
    prpFntH                     = 36865;
    prpFntW                     = 36866;
    prpFntHW                    = 36867;
    fixedFont                   = 45056;
    fxdFntH                     = 45057;
    fxdFntW                     = 45058;
    fxdFntHW                    = 45059;
    fontWid                     = 44208;


type
    FMInputPtr = ^FMInput;
    FMInput = packed record
        family:                 SInt16;
        size:                   SInt16;
        face:                   Style;
        needBits:               boolean;
        device:                 SInt16;
        numer:                  Point;
        denom:                  Point;
    end;

    FMOutputPtr = ^FMOutput;
    FMOutput = packed record
        errNum:                 SInt16;
        fontHandle:             Handle;
        boldPixels:             UInt8;
        italicPixels:           UInt8;
        ulOffset:               UInt8;
        ulShadow:               UInt8;
        ulThick:                UInt8;
        shadowPixels:           UInt8;
        extra:                  SInt8;
        ascent:                 UInt8;
        descent:                UInt8;
        widMax:                 UInt8;
        leading:                SInt8;
        curStyle:               SInt8;
        numer:                  Point;
        denom:                  Point;
    end;

    FMOutPtr                            = FMOutputPtr;
    FMetricRecPtr = ^FMetricRec;
    FMetricRec = record
        ascent:                 Fixed;                                  { base line to top }
        descent:                Fixed;                                  { base line to bottom }
        leading:                Fixed;                                  { leading between lines }
        widMax:                 Fixed;                                  { maximum character width }
        wTabHandle:             Handle;                                 { handle to font width table }
    end;

    FMetricRecHandle                    = ^FMetricRecPtr;

{
 *  GetFontName()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure GetFontName(familyID: SInt16; var name: Str255); external name '_GetFontName';
{
 *  GetFNum()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure GetFNum(const (*var*) name: Str255; var familyID: SInt16); external name '_GetFNum';
{
 *  RealFont()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function RealFont(fontNum: SInt16; size: SInt16): boolean; external name '_RealFont';

{
 *  FMSwapFont()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FMSwapFont(const (*var*) inRec: FMInput): FMOutPtr; external name '_FMSwapFont';
{
 *  SetFScaleDisable()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetFScaleDisable(fscaleDisable: boolean); external name '_SetFScaleDisable';
{
 *  FontMetrics()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure FontMetrics(theMetrics: FMetricRecPtr); external name '_FontMetrics';
{
 *  SetFractEnable()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetFractEnable(fractEnable: boolean); external name '_SetFractEnable';
{
 *  GetDefFontSize()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetDefFontSize: SInt16; external name '_GetDefFontSize';
{
 *  IsOutline()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function IsOutline(numer: Point; denom: Point): boolean; external name '_IsOutline';
{
 *  SetOutlinePreferred()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetOutlinePreferred(outlinePreferred: boolean); external name '_SetOutlinePreferred';
{
 *  GetOutlinePreferred()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetOutlinePreferred: boolean; external name '_GetOutlinePreferred';
{
 *  OutlineMetrics()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OutlineMetrics(byteCount: SInt16; textPtr: UnivPtr; numer: Point; denom: Point; var yMax: SInt16; var yMin: SInt16; awArray: FixedPtr; lsbArray: FixedPtr; boundsArray: RectPtr): OSErr; external name '_OutlineMetrics';
{
 *  SetPreserveGlyph()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetPreserveGlyph(preserveGlyph: boolean); external name '_SetPreserveGlyph';
{
 *  GetPreserveGlyph()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetPreserveGlyph: boolean; external name '_GetPreserveGlyph';

{
 *  GetSysFont()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetSysFont: SInt16; external name '_GetSysFont';
{
 *  GetAppFont()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetAppFont: SInt16; external name '_GetAppFont';
{--------------------------------------------------------------------------------------}
{  Extended font data functions (available only with Mac OS 8.5 or later)              }
{--------------------------------------------------------------------------------------}
{
 *  SetAntiAliasedTextEnabled()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 8.6 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetAntiAliasedTextEnabled(iEnable: boolean; iMinFontSize: SInt16): OSStatus; external name '_SetAntiAliasedTextEnabled';
{
 *  IsAntiAliasedTextEnabled()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 8.6 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function IsAntiAliasedTextEnabled(var oMinFontSize: SInt16): boolean; external name '_IsAntiAliasedTextEnabled';
{
 *  QDTextBounds()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 8.6 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure QDTextBounds(byteCount: SInt16; textAddr: UnivPtr; var bounds: Rect); external name '_QDTextBounds';
{
 *  FetchFontInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 8.6 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FetchFontInfo(fontID: SInt16; fontSize: SInt16; fontStyle: SInt16; var info: FontInfo): OSErr; external name '_FetchFontInfo';
{--------------------------------------------------------------------------------------}
{  Font access and data management functions (available only with Mac OS 9.0 or later) }
{--------------------------------------------------------------------------------------}
{ Enumeration }
{
 *  FMCreateFontFamilyIterator()
 *
 *  Availability:
 *    Non-Carbon CFM:   in FontManager 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FMCreateFontFamilyIterator(iFilter: {Const}FMFilterPtr; iRefCon: UnivPtr; iOptions: OptionBits; var ioIterator: FMFontFamilyIterator): OSStatus; external name '_FMCreateFontFamilyIterator';

{
 *  FMDisposeFontFamilyIterator()
 *
 *  Availability:
 *    Non-Carbon CFM:   in FontManager 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FMDisposeFontFamilyIterator(var ioIterator: FMFontFamilyIterator): OSStatus; external name '_FMDisposeFontFamilyIterator';

{
 *  FMResetFontFamilyIterator()
 *
 *  Availability:
 *    Non-Carbon CFM:   in FontManager 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FMResetFontFamilyIterator(iFilter: {Const}FMFilterPtr; iRefCon: UnivPtr; iOptions: OptionBits; var ioIterator: FMFontFamilyIterator): OSStatus; external name '_FMResetFontFamilyIterator';

{
 *  FMGetNextFontFamily()
 *
 *  Availability:
 *    Non-Carbon CFM:   in FontManager 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FMGetNextFontFamily(var ioIterator: FMFontFamilyIterator; var oFontFamily: FMFontFamily): OSStatus; external name '_FMGetNextFontFamily';

{
 *  FMCreateFontIterator()
 *
 *  Availability:
 *    Non-Carbon CFM:   in FontManager 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FMCreateFontIterator(iFilter: {Const}FMFilterPtr; iRefCon: UnivPtr; iOptions: OptionBits; var ioIterator: FMFontIterator): OSStatus; external name '_FMCreateFontIterator';

{
 *  FMDisposeFontIterator()
 *
 *  Availability:
 *    Non-Carbon CFM:   in FontManager 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FMDisposeFontIterator(var ioIterator: FMFontIterator): OSStatus; external name '_FMDisposeFontIterator';

{
 *  FMResetFontIterator()
 *
 *  Availability:
 *    Non-Carbon CFM:   in FontManager 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FMResetFontIterator(iFilter: {Const}FMFilterPtr; iRefCon: UnivPtr; iOptions: OptionBits; var ioIterator: FMFontIterator): OSStatus; external name '_FMResetFontIterator';

{
 *  FMGetNextFont()
 *
 *  Availability:
 *    Non-Carbon CFM:   in FontManager 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FMGetNextFont(var ioIterator: FMFontIterator; var oFont: FMFont): OSStatus; external name '_FMGetNextFont';

{ Font families }
{
 *  FMCreateFontFamilyInstanceIterator()
 *
 *  Availability:
 *    Non-Carbon CFM:   in FontManager 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FMCreateFontFamilyInstanceIterator(iFontFamily: FMFontFamily; var ioIterator: FMFontFamilyInstanceIterator): OSStatus; external name '_FMCreateFontFamilyInstanceIterator';

{
 *  FMDisposeFontFamilyInstanceIterator()
 *
 *  Availability:
 *    Non-Carbon CFM:   in FontManager 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FMDisposeFontFamilyInstanceIterator(var ioIterator: FMFontFamilyInstanceIterator): OSStatus; external name '_FMDisposeFontFamilyInstanceIterator';

{
 *  FMResetFontFamilyInstanceIterator()
 *
 *  Availability:
 *    Non-Carbon CFM:   in FontManager 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FMResetFontFamilyInstanceIterator(iFontFamily: FMFontFamily; var ioIterator: FMFontFamilyInstanceIterator): OSStatus; external name '_FMResetFontFamilyInstanceIterator';

{
 *  FMGetNextFontFamilyInstance()
 *
 *  Availability:
 *    Non-Carbon CFM:   in FontManager 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FMGetNextFontFamilyInstance(var ioIterator: FMFontFamilyInstanceIterator; var oFont: FMFont; oStyle: FMFontStylePtr; oSize: FMFontSizePtr): OSStatus; external name '_FMGetNextFontFamilyInstance';

{
 *  FMGetFontFamilyFromName()
 *
 *  Availability:
 *    Non-Carbon CFM:   in FontManager 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FMGetFontFamilyFromName(const (*var*) iName: Str255): FMFontFamily; external name '_FMGetFontFamilyFromName';

{
 *  FMGetFontFamilyName()
 *
 *  Availability:
 *    Non-Carbon CFM:   in FontManager 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FMGetFontFamilyName(iFontFamily: FMFontFamily; var oName: Str255): OSStatus; external name '_FMGetFontFamilyName';

{
 *  FMGetFontFamilyTextEncoding()
 *
 *  Availability:
 *    Non-Carbon CFM:   in FontManager 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FMGetFontFamilyTextEncoding(iFontFamily: FMFontFamily; var oTextEncoding: TextEncoding): OSStatus; external name '_FMGetFontFamilyTextEncoding';

{
 *  FMGetFontFamilyGeneration()
 *
 *  Availability:
 *    Non-Carbon CFM:   in FontManager 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FMGetFontFamilyGeneration(iFontFamily: FMFontFamily; var oGeneration: FMGeneration): OSStatus; external name '_FMGetFontFamilyGeneration';

{ Fonts }
{
 *  FMGetFontFormat()
 *
 *  Availability:
 *    Non-Carbon CFM:   in FontManager 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FMGetFontFormat(iFont: FMFont; var oFormat: FourCharCode): OSStatus; external name '_FMGetFontFormat';

{
 *  FMGetFontTableDirectory()
 *
 *  Availability:
 *    Non-Carbon CFM:   in FontManager 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FMGetFontTableDirectory(iFont: FMFont; iLength: ByteCount; iBuffer: UnivPtr; oActualLength: ByteCountPtr): OSStatus; external name '_FMGetFontTableDirectory';

{
 *  FMGetFontTable()
 *
 *  Availability:
 *    Non-Carbon CFM:   in FontManager 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FMGetFontTable(iFont: FMFont; iTag: FourCharCode; iOffset: ByteOffset; iLength: ByteCount; iBuffer: UnivPtr; oActualLength: ByteCountPtr): OSStatus; external name '_FMGetFontTable';

{
 *  FMGetFontGeneration()
 *
 *  Availability:
 *    Non-Carbon CFM:   in FontManager 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FMGetFontGeneration(iFont: FMFont; var oGeneration: FMGeneration): OSStatus; external name '_FMGetFontGeneration';

{
 *  FMGetFontContainer()
 *
 *  Availability:
 *    Non-Carbon CFM:   in FontManager 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FMGetFontContainer(iFont: FMFont; var oFontContainer: FSSpec): OSStatus; external name '_FMGetFontContainer';

{ Conversion }
{
 *  FMGetFontFromFontFamilyInstance()
 *
 *  Availability:
 *    Non-Carbon CFM:   in FontManager 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FMGetFontFromFontFamilyInstance(iFontFamily: FMFontFamily; iStyle: FMFontStyle; var oFont: FMFont; oIntrinsicStyle: FMFontStylePtr): OSStatus; external name '_FMGetFontFromFontFamilyInstance';

{
 *  FMGetFontFamilyInstanceFromFont()
 *
 *  Availability:
 *    Non-Carbon CFM:   in FontManager 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FMGetFontFamilyInstanceFromFont(iFont: FMFont; var oFontFamily: FMFontFamily; var oStyle: FMFontStyle): OSStatus; external name '_FMGetFontFamilyInstanceFromFont';

{
 *  FMGetATSFontRefFromFont()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.1 and later
 *    Mac OS X:         in version 10.1 and later
 }
function FMGetATSFontRefFromFont(iFont: FMFont): ATSFontRef; external name '_FMGetATSFontRefFromFont';

{
 *  FMGetATSFontFamilyRefFromFontFamily()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.1 and later
 *    Mac OS X:         in version 10.1 and later
 }
function FMGetATSFontFamilyRefFromFontFamily(iFamily: FMFontFamily): ATSFontFamilyRef; external name '_FMGetATSFontFamilyRefFromFontFamily';

{
 *  FMGetFontFromATSFontRef()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.1 and later
 *    Mac OS X:         in version 10.1 and later
 }
function FMGetFontFromATSFontRef(iFont: ATSFontRef): FMFont; external name '_FMGetFontFromATSFontRef';

{
 *  FMGetFontFamilyFromATSFontFamilyRef()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.1 and later
 *    Mac OS X:         in version 10.1 and later
 }
function FMGetFontFamilyFromATSFontFamilyRef(iFamily: ATSFontFamilyRef): FMFontFamily; external name '_FMGetFontFamilyFromATSFontFamilyRef';

{ Activation }
{
 *  FMActivateFonts()
 *
 *  Availability:
 *    Non-Carbon CFM:   in FontManager 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FMActivateFonts(const (*var*) iFontContainer: FSSpec; iFilter: {Const}FMFilterPtr; iRefCon: UnivPtr; iOptions: OptionBits): OSStatus; external name '_FMActivateFonts';

{
 *  FMDeactivateFonts()
 *
 *  Availability:
 *    Non-Carbon CFM:   in FontManager 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FMDeactivateFonts(const (*var*) iFontContainer: FSSpec; iFilter: {Const}FMFilterPtr; iRefCon: UnivPtr; iOptions: OptionBits): OSStatus; external name '_FMDeactivateFonts';

{
 *  FMGetGeneration()
 *
 *  Availability:
 *    Non-Carbon CFM:   in FontManager 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FMGetGeneration: FMGeneration; external name '_FMGetGeneration';

{ Container Access }
{
 *  FMGetFontContainerFromFontFamilyInstance()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.5 and later
 *    Mac OS X:         in version 10.1 and later
 }
function FMGetFontContainerFromFontFamilyInstance(iFontFamily: FMFontFamily; iStyle: FMFontStyle; iFontSize: FMFontSize; var oFontContainer: FSSpec): OSStatus; external name '_FMGetFontContainerFromFontFamilyInstance';

{
 *  FMGetFontFamilyResource()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.5 and later
 *    Mac OS X:         in version 10.1 and later
 }
function FMGetFontFamilyResource(iFontFamily: FMFontFamily; iFontStyle: FMFontStyle; iFontSize: FMFontSize; iBufferSize: ByteCount; ioBuffer: UnivPtr; oSize: ByteCountPtr): OSStatus; external name '_FMGetFontFamilyResource';



type
    FontFamilyID                        = FMFontFamily;
    FontPointSize                       = FMFontSize;
    {   --------------------------------------------------------------------------------------  }
    {    Deprecated constant and type definitions                                               }
    {   --------------------------------------------------------------------------------------  }
    {    The font identifier constants are deprecated; use GetFNum or FMGetFontFamilyFromName
       to find a font family from a standard QuickDraw name.
        }

const
    kFMUseGlobalScopeOption     = $00000001;

    kFontIDNewYork              = 2;
    kFontIDGeneva               = 3;
    kFontIDMonaco               = 4;
    kFontIDVenice               = 5;
    kFontIDLondon               = 6;
    kFontIDAthens               = 7;
    kFontIDSanFrancisco         = 8;
    kFontIDToronto              = 9;
    kFontIDCairo                = 11;
    kFontIDLosAngeles           = 12;
    kFontIDTimes                = 20;
    kFontIDHelvetica            = 21;
    kFontIDCourier              = 22;
    kFontIDSymbol               = 23;
    kFontIDMobile               = 24;

    {    The following data structures referenced by the low memory global variables of the
       Font Manager are deprecated on Mac OS X and CarbonLib 1.1. The low memory global
       variables are not shared between processes and may result in inconsistencies
       compared to previous releases of the system software. Changes made to the
       information contained in the low memory global variables, including any
       indirectly referenced width tables, font family records, and font records, are
       not reflected in the global state of the Font Manager and may only be accessed
       through the font access and data management functions of the Font Manager or ATS.
        }

type
    WidEntryPtr = ^WidEntry;
    WidEntry = record
        widStyle:               SInt16;                             { style entry applies to }
    end;

    WidTablePtr = ^WidTable;
    WidTable = record
        numWidths:              SInt16;                             { number of entries - 1 }
    end;

    AsscEntryPtr = ^AsscEntry;
    AsscEntry = record
        fontSize:               SInt16;
        fontStyle:              SInt16;
        fontID:                 SInt16;                             { font resource ID }
    end;

    FontAssocPtr = ^FontAssoc;
    FontAssoc = record
        numAssoc:               SInt16;                             { number of entries - 1 }
    end;

    StyleTablePtr = ^StyleTable;
    StyleTable = record
        fontClass:              SInt16;
        offset:                 SInt32;
        reserved:               SInt32;
        indexes:                packed array [0..47] of char;
    end;

    NameTablePtr = ^NameTable;
    NameTable = record
        stringCount:            SInt16;
        baseFontName:           Str255;
    end;

    KernPairPtr = ^KernPair;
    KernPair = record
        kernFirst:              SInt8;                                  { 1st character of kerned pair }
        kernSecond:             SInt8;                                  { 2nd character of kerned pair }
        kernWidth:              SInt16;                             { kerning in 1pt fixed format }
    end;

    KernEntryPtr = ^KernEntry;
    KernEntry = record
        kernStyle:              SInt16;                             { style the entry applies to }
        kernLength:             SInt16;                             { length of this entry }
    end;

    KernTablePtr = ^KernTable;
    KernTable = record
        numKerns:               SInt16;                             { number of kerning entries }
    end;

    WidthTablePtr = ^WidthTable;
    WidthTable = packed record
        tabData:                array [0..255] of Fixed;                { character widths }
        tabFont:                Handle;                                 { font record used to build table }
        sExtra:                 SInt32;                             { space extra used for table }
        style:                  SInt32;                             { extra due to style }
        fID:                    SInt16;                             { font family ID }
        fSize:                  SInt16;                             { font size request }
        face:                   SInt16;                             { style (face) request }
        device:                 SInt16;                             { device requested }
        inNumer:                Point;                                  { scale factors requested }
        inDenom:                Point;                                  { scale factors requested }
        aFID:                   SInt16;                             { actual font family ID for table }
        fHand:                  Handle;                                 { family record used to build up table }
        usedFam:                boolean;                                { used fixed point family widths }
        aFace:                  UInt8;                                  { actual face produced }
        vOutput:                SInt16;                             { vertical scale output value }
        hOutput:                SInt16;                             { horizontal scale output value }
        vFactor:                SInt16;                             { vertical scale output value }
        hFactor:                SInt16;                             { horizontal scale output value }
        aSize:                  SInt16;                             { actual size of actual font used }
        tabSize:                SInt16;                             { total size of table }
    end;

    WidthTableHdl                       = ^WidthTablePtr;
    FamRecPtr = ^FamRec;
    FamRec = record
        ffFlags:                SInt16;                             { flags for family }
        ffFamID:                SInt16;                             { family ID number }
        ffFirstChar:            SInt16;                             { ASCII code of 1st character }
        ffLastChar:             SInt16;                             { ASCII code of last character }
        ffAscent:               SInt16;                             { maximum ascent for 1pt font }
        ffDescent:              SInt16;                             { maximum descent for 1pt font }
        ffLeading:              SInt16;                             { maximum leading for 1pt font }
        ffWidMax:               SInt16;                             { maximum widMax for 1pt font }
        ffWTabOff:              SInt32;                             { offset to width table }
        ffKernOff:              SInt32;                             { offset to kerning table }
        ffStylOff:              SInt32;                             { offset to style mapping table }
        ffProperty:             array [0..8] of SInt16;             { style property info }
        ffIntl:                 array [0..1] of SInt16;             { for international use }
        ffVersion:              SInt16;                             { version number }
    end;

    FontRecPtr = ^FontRec;
    FontRec = record
        fontType:               SInt16;                             { font type }
        firstChar:              SInt16;                             { ASCII code of first character }
        lastChar:               SInt16;                             { ASCII code of last character }
        widMax:                 SInt16;                             { maximum character width }
        kernMax:                SInt16;                             { negative of maximum character kern }
        nDescent:               SInt16;                             { negative of descent }
        fRectWidth:             SInt16;                             { width of font rectangle }
        fRectHeight:            SInt16;                             { height of font rectangle }
        owTLoc:                 UInt16;                                 { offset to offset/width table }
        ascent:                 SInt16;                             { ascent }
        descent:                SInt16;                             { descent }
        leading:                SInt16;                             { leading }
        rowWords:               SInt16;                             { row width of bit image / 2  }
    end;

    FontRecHdl                          = ^FontRecPtr;
    {   --------------------------------------------------------------------------------------  }

{--------------------------------------------------------------------------------------}
{$ALIGN MAC68K}
{#POP}
{unit Icons}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}

{ The following are icons for which there are both icon suites and SICNs. }
{ Avoid using icon resources if possible. Use IconServices instead. }

const
    kGenericDocumentIconResource = -4000;
    kGenericStationeryIconResource = -3985;
    kGenericEditionFileIconResource = -3989;
    kGenericApplicationIconResource = -3996;
    kGenericDeskAccessoryIconResource = -3991;
    kGenericFolderIconResource  = -3999;
    kPrivateFolderIconResource  = -3994;
    kFloppyIconResource         = -3998;
    kTrashIconResource          = -3993;
    kGenericRAMDiskIconResource = -3988;
    kGenericCDROMIconResource   = -3987;

    {    The following are icons for which there are SICNs only.    }
    {    Avoid using icon resources if possible. Use IconServices instead.  }
    kDesktopIconResource        = -3992;
    kOpenFolderIconResource     = -3997;
    kGenericHardDiskIconResource = -3995;
    kGenericFileServerIconResource = -3972;
    kGenericSuitcaseIconResource = -3970;
    kGenericMoverObjectIconResource = -3969;

    {    The following are icons for which there are icon suites only.  }
    {    Avoid using icon resources if possible. Use IconServices instead.  }
    kGenericPreferencesIconResource = -3971;
    kGenericQueryDocumentIconResource = -16506;
    kGenericExtensionIconResource = -16415;
    kSystemFolderIconResource   = -3983;
    kHelpIconResource           = -20271;
    kAppleMenuFolderIconResource = -3982;

    {    Obsolete. Use named constants defined above.   }
    genericDocumentIconResource = -4000;
    genericStationeryIconResource = -3985;
    genericEditionFileIconResource = -3989;
    genericApplicationIconResource = -3996;
    genericDeskAccessoryIconResource = -3991;
    genericFolderIconResource   = -3999;
    privateFolderIconResource   = -3994;
    floppyIconResource          = -3998;
    trashIconResource           = -3993;
    genericRAMDiskIconResource  = -3988;
    genericCDROMIconResource    = -3987;
    desktopIconResource         = -3992;
    openFolderIconResource      = -3997;
    genericHardDiskIconResource = -3995;
    genericFileServerIconResource = -3972;
    genericSuitcaseIconResource = -3970;
    genericMoverObjectIconResource = -3969;
    genericPreferencesIconResource = -3971;
    genericQueryDocumentIconResource = -16506;
    genericExtensionIconResource = -16415;
    systemFolderIconResource    = -3983;
    appleMenuFolderIconResource = -3982;

    {    Avoid using icon resources if possible. Use IconServices instead.  }
    kStartupFolderIconResource  = -3981;
    kOwnedFolderIconResource    = -3980;
    kDropFolderIconResource     = -3979;
    kSharedFolderIconResource   = -3978;
    kMountedFolderIconResource  = -3977;
    kControlPanelFolderIconResource = -3976;
    kPrintMonitorFolderIconResource = -3975;
    kPreferencesFolderIconResource = -3974;
    kExtensionsFolderIconResource = -3973;
    kFontsFolderIconResource    = -3968;
    kFullTrashIconResource      = -3984;

    {    Obsolete. Use named constants defined above.   }
    startupFolderIconResource   = -3981;
    ownedFolderIconResource     = -3980;
    dropFolderIconResource      = -3979;
    sharedFolderIconResource    = -3978;
    mountedFolderIconResource   = -3977;
    controlPanelFolderIconResource = -3976;
    printMonitorFolderIconResource = -3975;
    preferencesFolderIconResource = -3974;
    extensionsFolderIconResource = -3973;
    fontsFolderIconResource     = -3968;
    fullTrashIconResource       = -3984;

    {    The following icon types can only be used as an icon element   }
    {    inside a 'icns' icon family    }
    kThumbnail32BitData         = $69743332 (* 'it32' *);
    kThumbnail8BitMask          = $74386D6B (* 't8mk' *);

    kHuge1BitMask               = $69636823 (* 'ich#' *);
    kHuge4BitData               = $69636834 (* 'ich4' *);
    kHuge8BitData               = $69636838 (* 'ich8' *);
    kHuge32BitData              = $69683332 (* 'ih32' *);
    kHuge8BitMask               = $68386D6B (* 'h8mk' *);

    {    The following icon types can be used as a resource type    }
    {    or as an icon element type inside a 'icns' icon family     }
    kLarge1BitMask              = $49434E23 (* 'ICN#' *);
    kLarge4BitData              = $69636C34 (* 'icl4' *);
    kLarge8BitData              = $69636C38 (* 'icl8' *);
    kLarge32BitData             = $696C3332 (* 'il32' *);
    kLarge8BitMask              = $6C386D6B (* 'l8mk' *);
    kSmall1BitMask              = $69637323 (* 'ics#' *);
    kSmall4BitData              = $69637334 (* 'ics4' *);
    kSmall8BitData              = $69637338 (* 'ics8' *);
    kSmall32BitData             = $69733332 (* 'is32' *);
    kSmall8BitMask              = $73386D6B (* 's8mk' *);
    kMini1BitMask               = $69636D23 (* 'icm#' *);
    kMini4BitData               = $69636D34 (* 'icm4' *);
    kMini8BitData               = $69636D38 (* 'icm8' *);

    {     Icon Variants     }
    {    These can be used as an element of an 'icns' icon family   }
    {    or as a parameter to GetIconRefVariant     }
    kTileIconVariant            = $74696C65 (* 'tile' *);
    kRolloverIconVariant        = $6F766572 (* 'over' *);
    kDropIconVariant            = $64726F70 (* 'drop' *);
    kOpenIconVariant            = $6F70656E (* 'open' *);
    kOpenDropIconVariant        = $6F647270 (* 'odrp' *);

    {    Obsolete. Use names defined above.     }
    large1BitMask               = $49434E23 (* 'ICN#' *);
    large4BitData               = $69636C34 (* 'icl4' *);
    large8BitData               = $69636C38 (* 'icl8' *);
    small1BitMask               = $69637323 (* 'ics#' *);
    small4BitData               = $69637334 (* 'ics4' *);
    small8BitData               = $69637338 (* 'ics8' *);
    mini1BitMask                = $69636D23 (* 'icm#' *);
    mini4BitData                = $69636D34 (* 'icm4' *);
    mini8BitData                = $69636D38 (* 'icm8' *);

    {    Alignment type values.     }
    kAlignNone                  = $00;
    kAlignVerticalCenter        = $01;
    kAlignTop                   = $02;
    kAlignBottom                = $03;
    kAlignHorizontalCenter      = $04;
    kAlignAbsoluteCenter        = $05;
    kAlignCenterTop             = $06;
    kAlignCenterBottom          = $07;
    kAlignLeft                  = $08;
    kAlignCenterLeft            = $09;
    kAlignTopLeft               = $0A;
    kAlignBottomLeft            = $0B;
    kAlignRight                 = $0C;
    kAlignCenterRight           = $0D;
    kAlignTopRight              = $0E;
    kAlignBottomRight           = $0F;

    {    Obsolete. Use names defined above.     }
    atNone                      = $00;
    atVerticalCenter            = $01;
    atTop                       = $02;
    atBottom                    = $03;
    atHorizontalCenter          = $04;
    atAbsoluteCenter            = $05;
    atCenterTop                 = $06;
    atCenterBottom              = $07;
    atLeft                      = $08;
    atCenterLeft                = $09;
    atTopLeft                   = $0A;
    atBottomLeft                = $0B;
    atRight                     = $0C;
    atCenterRight               = $0D;
    atTopRight                  = $0E;
    atBottomRight               = $0F;


type
    IconAlignmentType                   = SInt16;
    {    Transform type values.     }

const
    kTransformNone              = $00;
    kTransformDisabled          = $01;
    kTransformOffline           = $02;
    kTransformOpen              = $03;
    kTransformLabel1            = $0100;
    kTransformLabel2            = $0200;
    kTransformLabel3            = $0300;
    kTransformLabel4            = $0400;
    kTransformLabel5            = $0500;
    kTransformLabel6            = $0600;
    kTransformLabel7            = $0700;
    kTransformSelected          = $4000;
    kTransformSelectedDisabled  = $4001;
    kTransformSelectedOffline   = $4002;
    kTransformSelectedOpen      = $4003;

    {    Obsolete. Use names defined above.     }
    ttNone                      = $00;
    ttDisabled                  = $01;
    ttOffline                   = $02;
    ttOpen                      = $03;
    ttLabel1                    = $0100;
    ttLabel2                    = $0200;
    ttLabel3                    = $0300;
    ttLabel4                    = $0400;
    ttLabel5                    = $0500;
    ttLabel6                    = $0600;
    ttLabel7                    = $0700;
    ttSelected                  = $4000;
    ttSelectedDisabled          = $4001;
    ttSelectedOffline           = $4002;
    ttSelectedOpen              = $4003;


type
    IconTransformType                   = SInt16;
    {    Selector mask values.  }

const
    kSelectorLarge1Bit          = $00000001;
    kSelectorLarge4Bit          = $00000002;
    kSelectorLarge8Bit          = $00000004;
    kSelectorLarge32Bit         = $00000008;
    kSelectorLarge8BitMask      = $00000010;
    kSelectorSmall1Bit          = $00000100;
    kSelectorSmall4Bit          = $00000200;
    kSelectorSmall8Bit          = $00000400;
    kSelectorSmall32Bit         = $00000800;
    kSelectorSmall8BitMask      = $00001000;
    kSelectorMini1Bit           = $00010000;
    kSelectorMini4Bit           = $00020000;
    kSelectorMini8Bit           = $00040000;
    kSelectorHuge1Bit           = $01000000;
    kSelectorHuge4Bit           = $02000000;
    kSelectorHuge8Bit           = $04000000;
    kSelectorHuge32Bit          = $08000000;
    kSelectorHuge8BitMask       = $10000000;
    kSelectorAllLargeData       = $000000FF;
    kSelectorAllSmallData       = $0000FF00;
    kSelectorAllMiniData        = $00FF0000;
    kSelectorAllHugeData        = $FF000000;
    kSelectorAll1BitData        = $01010101;
    kSelectorAll4BitData        = $02020202;
    kSelectorAll8BitData        = $04040404;
    kSelectorAll32BitData       = $08000808;
    kSelectorAllAvailableData   = $FFFFFFFF;


    {    Obsolete. Use names defined above.     }
    svLarge1Bit                 = $00000001;
    svLarge4Bit                 = $00000002;
    svLarge8Bit                 = $00000004;
    svSmall1Bit                 = $00000100;
    svSmall4Bit                 = $00000200;
    svSmall8Bit                 = $00000400;
    svMini1Bit                  = $00010000;
    svMini4Bit                  = $00020000;
    svMini8Bit                  = $00040000;
    svAllLargeData              = $000000FF;
    svAllSmallData              = $0000FF00;
    svAllMiniData               = $00FF0000;
    svAll1BitData               = $01010101;
    svAll4BitData               = $02020202;
    svAll8BitData               = $04040404;
    svAllAvailableData          = $FFFFFFFF;


type
    IconSelectorValue                   = UInt32;
    IconActionProcPtr = function(theType: ResType; var theIcon: Handle; yourDataPtr: UnivPtr): OSErr;

    IconGetterProcPtr = function(theType: ResType; yourDataPtr: UnivPtr): Handle;

    IconActionUPP = ^SInt32; { an opaque UPP }
    IconGetterUPP = ^SInt32; { an opaque UPP }

const
    uppIconActionProcInfo = $00000FE0;
    uppIconGetterProcInfo = $000003F0;
    {
     *  NewIconActionUPP()
     *
     *  Availability:
     *    Non-Carbon CFM:   available as macro/inline
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function NewIconActionUPP(userRoutine: IconActionProcPtr): IconActionUPP; external name '_NewIconActionUPP'; { old name was NewIconActionProc }
{
 *  NewIconGetterUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewIconGetterUPP(userRoutine: IconGetterProcPtr): IconGetterUPP; external name '_NewIconGetterUPP'; { old name was NewIconGetterProc }
{
 *  DisposeIconActionUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeIconActionUPP(userUPP: IconActionUPP); external name '_DisposeIconActionUPP';
{
 *  DisposeIconGetterUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeIconGetterUPP(userUPP: IconGetterUPP); external name '_DisposeIconGetterUPP';
{
 *  InvokeIconActionUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeIconActionUPP(theType: ResType; var theIcon: Handle; yourDataPtr: UnivPtr; userRoutine: IconActionUPP): OSErr; external name '_InvokeIconActionUPP'; { old name was CallIconActionProc }
{
 *  InvokeIconGetterUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeIconGetterUPP(theType: ResType; yourDataPtr: UnivPtr; userRoutine: IconGetterUPP): Handle; external name '_InvokeIconGetterUPP'; { old name was CallIconGetterProc }
type
    IconGetter                          = IconGetterProcPtr;
    IconAction                          = IconActionProcPtr;
    {  CIconHandle, GetCIcon(), PlotCIcon(), and DisposeCIcon() moved here from Quickdraw.h }
    CIconPtr = ^CIcon;
    CIcon = record
        iconPMap:               PixMap;                                 { the icon's pixMap }
        iconMask:               BitMap;                                 { the icon's mask }
        iconBMap:               BitMap;                                 { the icon's bitMap }
        iconData:               Handle;                                 { the icon's data }
        iconMaskData:           array [0..0] of SInt16;                 { icon's mask and BitMap data }
    end;

    CIconHandle                         = ^CIconPtr;
    {
     *  GetCIcon()
     *
     *  Availability:
     *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function GetCIcon(iconID: SInt16): CIconHandle; external name '_GetCIcon';
{
 *  PlotCIcon()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure PlotCIcon(const (*var*) theRect: Rect; theIcon: CIconHandle); external name '_PlotCIcon';
{
 *  DisposeCIcon()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeCIcon(theIcon: CIconHandle); external name '_DisposeCIcon';
{  GetIcon and PlotIcon moved here from ToolUtils }
{
 *  GetIcon()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetIcon(iconID: SInt16): Handle; external name '_GetIcon';
{
 *  PlotIcon()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure PlotIcon(const (*var*) theRect: Rect; theIcon: Handle); external name '_PlotIcon';
{
    Note:   IconSuiteRef and IconCacheRef should be an abstract types,
            but too much source code already relies on them being of type Handle.
}

type
    IconSuiteRef                        = Handle;
    IconCacheRef                        = Handle;
    {  IconRefs are 32-bit values identifying cached icon data. IconRef 0 is invalid. }
    IconRef    = ^SInt32; { an opaque 32-bit type }
    IconRefPtr = ^IconRef;  { when a var xx:IconRef parameter can be nil, it is changed to xx: IconRefPtr }
    {
     *  PlotIconID()
     *
     *  Availability:
     *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function PlotIconID(const (*var*) theRect: Rect; align: IconAlignmentType; transform: IconTransformType; theResID: SInt16): OSErr; external name '_PlotIconID';
{
 *  NewIconSuite()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewIconSuite(var theIconSuite: IconSuiteRef): OSErr; external name '_NewIconSuite';
{
 *  AddIconToSuite()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function AddIconToSuite(theIconData: Handle; theSuite: IconSuiteRef; theType: ResType): OSErr; external name '_AddIconToSuite';
{
 *  GetIconFromSuite()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetIconFromSuite(var theIconData: Handle; theSuite: IconSuiteRef; theType: ResType): OSErr; external name '_GetIconFromSuite';
{
 *  ForEachIconDo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ForEachIconDo(theSuite: IconSuiteRef; selector: IconSelectorValue; action: IconActionUPP; yourDataPtr: UnivPtr): OSErr; external name '_ForEachIconDo';
{
 *  GetIconSuite()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetIconSuite(var theIconSuite: IconSuiteRef; theResID: SInt16; selector: IconSelectorValue): OSErr; external name '_GetIconSuite';
{
 *  DisposeIconSuite()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DisposeIconSuite(theIconSuite: IconSuiteRef; disposeData: boolean): OSErr; external name '_DisposeIconSuite';
{
 *  PlotIconSuite()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PlotIconSuite(const (*var*) theRect: Rect; align: IconAlignmentType; transform: IconTransformType; theIconSuite: IconSuiteRef): OSErr; external name '_PlotIconSuite';
{
 *  MakeIconCache()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function MakeIconCache(var theCache: IconCacheRef; makeIcon: IconGetterUPP; yourDataPtr: UnivPtr): OSErr; external name '_MakeIconCache';
{
 *  LoadIconCache()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function LoadIconCache(const (*var*) theRect: Rect; align: IconAlignmentType; transform: IconTransformType; theIconCache: IconCacheRef): OSErr; external name '_LoadIconCache';
{
 *  PlotIconMethod()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PlotIconMethod(const (*var*) theRect: Rect; align: IconAlignmentType; transform: IconTransformType; theMethod: IconGetterUPP; yourDataPtr: UnivPtr): OSErr; external name '_PlotIconMethod';
{
 *  GetLabel()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetLabel(labelNumber: SInt16; var labelColor: RGBColor; var labelString: Str255): OSErr; external name '_GetLabel';
{
 *  PtInIconID()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PtInIconID(testPt: Point; const (*var*) iconRect: Rect; align: IconAlignmentType; iconID: SInt16): boolean; external name '_PtInIconID';
{
 *  PtInIconSuite()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PtInIconSuite(testPt: Point; const (*var*) iconRect: Rect; align: IconAlignmentType; theIconSuite: IconSuiteRef): boolean; external name '_PtInIconSuite';
{
 *  PtInIconMethod()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PtInIconMethod(testPt: Point; const (*var*) iconRect: Rect; align: IconAlignmentType; theMethod: IconGetterUPP; yourDataPtr: UnivPtr): boolean; external name '_PtInIconMethod';
{
 *  RectInIconID()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function RectInIconID(const (*var*) testRect: Rect; const (*var*) iconRect: Rect; align: IconAlignmentType; iconID: SInt16): boolean; external name '_RectInIconID';
{
 *  RectInIconSuite()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function RectInIconSuite(const (*var*) testRect: Rect; const (*var*) iconRect: Rect; align: IconAlignmentType; theIconSuite: IconSuiteRef): boolean; external name '_RectInIconSuite';
{
 *  RectInIconMethod()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function RectInIconMethod(const (*var*) testRect: Rect; const (*var*) iconRect: Rect; align: IconAlignmentType; theMethod: IconGetterUPP; yourDataPtr: UnivPtr): boolean; external name '_RectInIconMethod';
{
 *  IconIDToRgn()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function IconIDToRgn(theRgn: RgnHandle; const (*var*) iconRect: Rect; align: IconAlignmentType; iconID: SInt16): OSErr; external name '_IconIDToRgn';
{
 *  IconSuiteToRgn()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function IconSuiteToRgn(theRgn: RgnHandle; const (*var*) iconRect: Rect; align: IconAlignmentType; theIconSuite: IconSuiteRef): OSErr; external name '_IconSuiteToRgn';
{
 *  IconMethodToRgn()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function IconMethodToRgn(theRgn: RgnHandle; const (*var*) iconRect: Rect; align: IconAlignmentType; theMethod: IconGetterUPP; yourDataPtr: UnivPtr): OSErr; external name '_IconMethodToRgn';
{
 *  SetSuiteLabel()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetSuiteLabel(theSuite: IconSuiteRef; theLabel: SInt16): OSErr; external name '_SetSuiteLabel';
{
 *  GetSuiteLabel()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetSuiteLabel(theSuite: IconSuiteRef): SInt16; external name '_GetSuiteLabel';
{
 *  GetIconCacheData()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetIconCacheData(theCache: IconCacheRef; var theData: UnivPtr): OSErr; external name '_GetIconCacheData';
{
 *  SetIconCacheData()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetIconCacheData(theCache: IconCacheRef; theData: UnivPtr): OSErr; external name '_SetIconCacheData';
{
 *  GetIconCacheProc()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetIconCacheProc(theCache: IconCacheRef; var theProc: IconGetterUPP): OSErr; external name '_GetIconCacheProc';
{
 *  SetIconCacheProc()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetIconCacheProc(theCache: IconCacheRef; theProc: IconGetterUPP): OSErr; external name '_SetIconCacheProc';
{
 *  PlotIconHandle()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PlotIconHandle(const (*var*) theRect: Rect; align: IconAlignmentType; transform: IconTransformType; theIcon: Handle): OSErr; external name '_PlotIconHandle';
{
 *  PlotSICNHandle()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PlotSICNHandle(const (*var*) theRect: Rect; align: IconAlignmentType; transform: IconTransformType; theSICN: Handle): OSErr; external name '_PlotSICNHandle';
{
 *  PlotCIconHandle()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PlotCIconHandle(const (*var*) theRect: Rect; align: IconAlignmentType; transform: IconTransformType; theCIcon: CIconHandle): OSErr; external name '_PlotCIconHandle';
{
   IconServices is an efficient mechanism to share icon data amongst multiple
   clients. It avoids duplication of data; it provides efficient caching,
   releasing memory when the icon data is no longer needed; it can provide
   the appropriate icon for any filesystem object; it can provide commonly
   used icons (caution, note, help...); it is Appearance-savvy: the icons
   are switched when appropriate.
   IconServices refer to cached icon data using IconRef, a 32-bit opaque
   value. IconRefs are reference counted. When there are no more "owners"
   of an IconRef, the memory used by the icon bitmap is disposed of.
   Two files of same type and creator with no custom icon will have the same IconRef.
   Files with custom icons will have their own IconRef.
}

{
   Use the special creator kSystemIconsCreator to get "standard" icons
   that are not associated with a file, such as the help icon.
   Note that all lowercase creators are reserved by Apple.
}

const
    kSystemIconsCreator         = $6D616373 (* 'macs' *);


    {
       Type of the predefined/generic icons. For example, the call:
          err = GetIconRef(kOnSystemDisk, kSystemIconsCreator, kHelpIcon, &iconRef);
       will retun in iconRef the IconRef for the standard help icon.
    }

    {    Generic Finder icons   }
    kClipboardIcon              = $434C4950 (* 'CLIP' *);
    kClippingUnknownTypeIcon    = $636C7075 (* 'clpu' *);
    kClippingPictureTypeIcon    = $636C7070 (* 'clpp' *);
    kClippingTextTypeIcon       = $636C7074 (* 'clpt' *);
    kClippingSoundTypeIcon      = $636C7073 (* 'clps' *);
    kDesktopIcon                = $6465736B (* 'desk' *);
    kFinderIcon                 = $464E4452 (* 'FNDR' *);
    kComputerIcon                   = $726F6F74 (* 'root' *);
    kFontSuitcaseIcon           = $4646494C (* 'FFIL' *);
    kFullTrashIcon              = $66747268 (* 'ftrh' *);
    kGenericApplicationIcon     = $4150504C (* 'APPL' *);
    kGenericCDROMIcon           = $63646472 (* 'cddr' *);
    kGenericControlPanelIcon    = $41505043 (* 'APPC' *);
    kGenericControlStripModuleIcon = $73646576 (* 'sdev' *);
    kGenericComponentIcon       = $74686E67 (* 'thng' *);
    kGenericDeskAccessoryIcon   = $41505044 (* 'APPD' *);
    kGenericDocumentIcon        = $646F6375 (* 'docu' *);
    kGenericEditionFileIcon     = $65647466 (* 'edtf' *);
    kGenericExtensionIcon       = $494E4954 (* 'INIT' *);
    kGenericFileServerIcon      = $73727672 (* 'srvr' *);
    kGenericFontIcon            = $6666696C (* 'ffil' *);
    kGenericFontScalerIcon      = $73636C72 (* 'sclr' *);
    kGenericFloppyIcon          = $666C7079 (* 'flpy' *);
    kGenericHardDiskIcon        = $6864736B (* 'hdsk' *);
    kGenericIDiskIcon           = $6964736B (* 'idsk' *);
    kGenericRemovableMediaIcon  = $726D6F76 (* 'rmov' *);
    kGenericMoverObjectIcon     = $6D6F7672 (* 'movr' *);
    kGenericPCCardIcon          = $70636D63 (* 'pcmc' *);
    kGenericPreferencesIcon     = $70726566 (* 'pref' *);
    kGenericQueryDocumentIcon   = $71657279 (* 'qery' *);
    kGenericRAMDiskIcon         = $72616D64 (* 'ramd' *);
    kGenericSharedLibaryIcon    = $73686C62 (* 'shlb' *);
    kGenericStationeryIcon      = $73646F63 (* 'sdoc' *);
    kGenericSuitcaseIcon        = $73756974 (* 'suit' *);
    kGenericURLIcon             = $6775726C (* 'gurl' *);
    kGenericWORMIcon            = $776F726D (* 'worm' *);
    kInternationalResourcesIcon = $6966696C (* 'ifil' *);
    kKeyboardLayoutIcon         = $6B66696C (* 'kfil' *);
    kSoundFileIcon              = $7366696C (* 'sfil' *);
    kSystemSuitcaseIcon         = $7A737973 (* 'zsys' *);
    kTrashIcon                  = $74727368 (* 'trsh' *);
    kTrueTypeFontIcon           = $7466696C (* 'tfil' *);
    kTrueTypeFlatFontIcon       = $73666E74 (* 'sfnt' *);
    kTrueTypeMultiFlatFontIcon  = $74746366 (* 'ttcf' *);
    kUserIDiskIcon              = $7564736B (* 'udsk' *);
    kUnknownFSObjectIcon                = $756E6673 (* 'unfs' *);
    kInternationResourcesIcon   = $6966696C (* 'ifil' *);                       {  old misspelling }

    {    Internet locations     }
    kInternetLocationHTTPIcon   = $696C6874 (* 'ilht' *);
    kInternetLocationFTPIcon    = $696C6674 (* 'ilft' *);
    kInternetLocationAppleShareIcon = $696C6166 (* 'ilaf' *);
    kInternetLocationAppleTalkZoneIcon = $696C6174 (* 'ilat' *);
    kInternetLocationFileIcon   = $696C6669 (* 'ilfi' *);
    kInternetLocationMailIcon   = $696C6D61 (* 'ilma' *);
    kInternetLocationNewsIcon   = $696C6E77 (* 'ilnw' *);
    kInternetLocationNSLNeighborhoodIcon = $696C6E73 (* 'ilns' *);
    kInternetLocationGenericIcon = $696C6765 (* 'ilge' *);

    {    Folders    }
    kGenericFolderIcon          = $666C6472 (* 'fldr' *);
    kDropFolderIcon             = $64626F78 (* 'dbox' *);
    kMountedFolderIcon          = $6D6E7464 (* 'mntd' *);
    kOpenFolderIcon             = $6F666C64 (* 'ofld' *);
    kOwnedFolderIcon            = $6F776E64 (* 'ownd' *);
    kPrivateFolderIcon          = $70727666 (* 'prvf' *);
    kSharedFolderIcon           = $7368666C (* 'shfl' *);

    {    Sharing Privileges icons   }
    kSharingPrivsNotApplicableIcon = $73686E61 (* 'shna' *);
    kSharingPrivsReadOnlyIcon   = $7368726F (* 'shro' *);
    kSharingPrivsReadWriteIcon  = $73687277 (* 'shrw' *);
    kSharingPrivsUnknownIcon    = $7368756B (* 'shuk' *);
    kSharingPrivsWritableIcon   = $77726974 (* 'writ' *);


    {    Users and Groups icons     }
    kUserFolderIcon             = $75666C64 (* 'ufld' *);
    kWorkgroupFolderIcon        = $77666C64 (* 'wfld' *);
    kGuestUserIcon              = $67757372 (* 'gusr' *);
    kUserIcon                   = $75736572 (* 'user' *);
    kOwnerIcon                  = $73757372 (* 'susr' *);
    kGroupIcon                  = $67727570 (* 'grup' *);

    {    Special folders    }
    kAppearanceFolderIcon       = $61707072 (* 'appr' *);
    kAppleExtrasFolderIcon      = $616578C4 (* 'aexÄ' *);
    kAppleMenuFolderIcon        = $616D6E75 (* 'amnu' *);
    kApplicationsFolderIcon     = $61707073 (* 'apps' *);
    kApplicationSupportFolderIcon = $61737570 (* 'asup' *);
    kAssistantsFolderIcon       = $617374C4 (* 'astÄ' *);
    kColorSyncFolderIcon        = $70726F66 (* 'prof' *);
    kContextualMenuItemsFolderIcon = $636D6E75 (* 'cmnu' *);
    kControlPanelDisabledFolderIcon = $63747244 (* 'ctrD' *);
    kControlPanelFolderIcon     = $6374726C (* 'ctrl' *);
    kControlStripModulesFolderIcon = $736476C4 (* 'sdvÄ' *);
    kDocumentsFolderIcon        = $646F6373 (* 'docs' *);
    kExtensionsDisabledFolderIcon = $65787444 (* 'extD' *);
    kExtensionsFolderIcon       = $6578746E (* 'extn' *);
    kFavoritesFolderIcon        = $66617673 (* 'favs' *);
    kFontsFolderIcon            = $666F6E74 (* 'font' *);
    kHelpFolderIcon             = $C4686C70 (* 'Ählp' *);
    kInternetFolderIcon         = $696E74C4 (* 'intÄ' *);
    kInternetPlugInFolderIcon   = $C46E6574 (* 'Änet' *);
    kInternetSearchSitesFolderIcon = $69737366 (* 'issf' *);
    kLocalesFolderIcon          = $C46C6F63 (* 'Äloc' *);
    kMacOSReadMeFolderIcon      = $6D6F72C4 (* 'morÄ' *);
    kPublicFolderIcon           = $70756266 (* 'pubf' *);
    kPreferencesFolderIcon      = $707266C4 (* 'prfÄ' *);
    kPrinterDescriptionFolderIcon = $70706466 (* 'ppdf' *);
    kPrinterDriverFolderIcon    = $C4707264 (* 'Äprd' *);
    kPrintMonitorFolderIcon     = $70726E74 (* 'prnt' *);
    kRecentApplicationsFolderIcon = $72617070 (* 'rapp' *);
    kRecentDocumentsFolderIcon  = $72646F63 (* 'rdoc' *);
    kRecentServersFolderIcon    = $72737276 (* 'rsrv' *);
    kScriptingAdditionsFolderIcon = $C4736372 (* 'Äscr' *);
    kSharedLibrariesFolderIcon  = $C46C6962 (* 'Älib' *);
    kScriptsFolderIcon          = $736372C4 (* 'scrÄ' *);
    kShutdownItemsDisabledFolderIcon = $73686444 (* 'shdD' *);
    kShutdownItemsFolderIcon    = $73686466 (* 'shdf' *);
    kSpeakableItemsFolder       = $73706B69 (* 'spki' *);
    kStartupItemsDisabledFolderIcon = $73747244 (* 'strD' *);
    kStartupItemsFolderIcon     = $73747274 (* 'strt' *);
    kSystemExtensionDisabledFolderIcon = $6D616344 (* 'macD' *);
    kSystemFolderIcon           = $6D616373 (* 'macs' *);
    kTextEncodingsFolderIcon    = $C4746578 (* 'Ätex' *);
    kUsersFolderIcon            = $757372C4 (* 'usrÄ' *);
    kUtilitiesFolderIcon        = $757469C4 (* 'utiÄ' *);
    kVoicesFolderIcon           = $66766F63 (* 'fvoc' *);
    kSystemFolderXIcon          = $6D616378 (* 'macx' *);

    {    Badges     }
    kAppleScriptBadgeIcon       = $73637270 (* 'scrp' *);
    kLockedBadgeIcon            = $6C626467 (* 'lbdg' *);
    kMountedBadgeIcon           = $6D626467 (* 'mbdg' *);
    kSharedBadgeIcon            = $73626467 (* 'sbdg' *);
    kAliasBadgeIcon             = $61626467 (* 'abdg' *);
    kAlertCautionBadgeIcon      = $63626467 (* 'cbdg' *);

    {    Alert icons    }
    kAlertNoteIcon              = $6E6F7465 (* 'note' *);
    kAlertCautionIcon           = $63617574 (* 'caut' *);
    kAlertStopIcon              = $73746F70 (* 'stop' *);

    {    Networking icons   }
    kAppleTalkIcon              = $61746C6B (* 'atlk' *);
    kAppleTalkZoneIcon          = $61747A6E (* 'atzn' *);
    kAFPServerIcon              = $61667073 (* 'afps' *);
    kFTPServerIcon              = $66747073 (* 'ftps' *);
    kHTTPServerIcon             = $68747073 (* 'htps' *);
    kGenericNetworkIcon         = $676E6574 (* 'gnet' *);
    kIPFileServerIcon           = $69737276 (* 'isrv' *);

    {    Toolbar icons  }
    kToolbarCustomizeIcon       = $74637573 (* 'tcus' *);
    kToolbarDeleteIcon          = $7464656C (* 'tdel' *);
    kToolbarFavoritesIcon       = $74666176 (* 'tfav' *);
    kToolbarHomeIcon            = $74686F6D (* 'thom' *);

    {    Other icons    }
    kAppleLogoIcon              = $6361706C (* 'capl' *);
    kAppleMenuIcon              = $7361706C (* 'sapl' *);
    kBackwardArrowIcon          = $6261726F (* 'baro' *);
    kFavoriteItemsIcon          = $66617672 (* 'favr' *);
    kForwardArrowIcon           = $6661726F (* 'faro' *);
    kGridIcon                   = $67726964 (* 'grid' *);
    kHelpIcon                   = $68656C70 (* 'help' *);
    kKeepArrangedIcon           = $61726E67 (* 'arng' *);
    kLockedIcon                 = $6C6F636B (* 'lock' *);
    kNoFilesIcon                = $6E66696C (* 'nfil' *);
    kNoFolderIcon               = $6E666C64 (* 'nfld' *);
    kNoWriteIcon                = $6E777274 (* 'nwrt' *);
    kProtectedApplicationFolderIcon = $70617070 (* 'papp' *);
    kProtectedSystemFolderIcon  = $70737973 (* 'psys' *);
    kRecentItemsIcon            = $72636E74 (* 'rcnt' *);
    kShortcutIcon               = $73687274 (* 'shrt' *);
    kSortAscendingIcon          = $61736E64 (* 'asnd' *);
    kSortDescendingIcon         = $64736E64 (* 'dsnd' *);
    kUnlockedIcon               = $756C636B (* 'ulck' *);
    kConnectToIcon              = $636E6374 (* 'cnct' *);
    kGenericWindowIcon          = $6777696E (* 'gwin' *);
    kQuestionMarkIcon           = $71756573 (* 'ques' *);
    kDeleteAliasIcon            = $64616C69 (* 'dali' *);
    kEjectMediaIcon             = $656A6563 (* 'ejec' *);
    kBurningIcon                = $6275726E (* 'burn' *);
    kRightContainerArrowIcon    = $72636172 (* 'rcar' *);



    {     IconServicesUsageFlags    }

type
    IconServicesUsageFlags              = UInt32;

const
    kIconServicesNormalUsageFlag    = $00000000;
    kIconServicesNoBadgeFlag        = $00000001;     // available on Panther and later
    kIconServicesUpdateIfNeededFlag = $00000002;     // available on Panther and later


    {
      kIconServicesCatalogInfoMask - Minimal bitmask for use with
        GetIconRefFromFileInfo(). Use this mask with FSGetCatalogInfo
        before calling GetIconRefFromFileInfo().
        }
    kIconServicesCatalogInfoMask = $0008181E;


    {
     *  PlotIconRefFlags
     *
     *  Discussion:
     *    Flags that can be passed to the PlotIconRefInContext routine.
        }

type
    PlotIconRefFlags            = UInt32;
const
    kPlotIconRefNormalFlags     = 0;
    kPlotIconRefNoImage         = $02;
    kPlotIconRefNoMask          = $04;



    {
        IconFamily 'icns' resources contain an entire IconFamily (all sizes and depths).
       For custom icons, icns IconFamily resources of the custom icon resource ID are fetched first before
       the classic custom icons (individual 'ics#, ICN#, etc) are fetched.  If the fetch of the icns resource
       succeeds then the icns is looked at exclusively for the icon data.
       For custom icons, new icon features such as 32-bit deep icons are only fetched from the icns resource.
       This is to avoid incompatibilities with cut & paste of new style icons with an older version of the
       MacOS Finder.
       DriverGestalt is called with code kdgMediaIconSuite by IconServices after calling FSM to determine a
       driver icon for a particular device.  The result of the kdgMediaIconSuite call to DriverGestalt should
       be a pointer an an IconFamily.  In this manner driver vendors can provide rich, detailed drive icons
       instead of the 1-bit variety previously supported.
    }
    kIconFamilyType             = $69636E73 (* 'icns' *);



type
    IconFamilyElementPtr = ^IconFamilyElement;
    IconFamilyElement = record
        elementType:            OSType;                                 {  'ICN#', 'icl8', etc... }
        elementSize:            Size;                                   {  Size of this element }
        elementData:            SInt8;
    end;

    IconFamilyResourcePtr = ^IconFamilyResource;
    IconFamilyResource = record
        resourceType:           OSType;                                 {  Always 'icns' }
        resourceSize:           Size;                                   {  Total size of this resource }
        elements:               array [0..0] of IconFamilyElement;
    end;

    IconFamilyPtr                       = ^IconFamilyResource;
    IconFamilyHandle                    = ^IconFamilyPtr;
    {
      ==============================================================================
       Initialization and Termination
      ==============================================================================
    }

    {
       IconServicesInit

       Call this routine once per classic 68K application initialization.
       This routine does not need to be called at boot time.
    }


{
  ==============================================================================
   Converting data structures
  ==============================================================================
}


{
   IconRefToIconFamily
   This routines returns a new IconFamily that contains the data corresponding
   to the specified IconRef.
}

{
 *  IconRefToIconFamily()
 *
 *  Availability:
 *    Non-Carbon CFM:   in IconServicesLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function IconRefToIconFamily(theIconRef: IconRef; whichIcons: IconSelectorValue; var iconFamily: IconFamilyHandle): OSErr; external name '_IconRefToIconFamily';
{
   IconFamilyToIconSuite
   This routine transfers the data from an icon family handle into an icon suite.
}

{
 *  IconFamilyToIconSuite()
 *
 *  Availability:
 *    Non-Carbon CFM:   in IconServicesLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function IconFamilyToIconSuite(iconFamily: IconFamilyHandle; whichIcons: IconSelectorValue; var iconSuite: IconSuiteRef): OSErr; external name '_IconFamilyToIconSuite';
{
   IconSuiteToIconFamily
   This routine transfers the data in an icon suite into an icon family.
}

{
 *  IconSuiteToIconFamily()
 *
 *  Availability:
 *    Non-Carbon CFM:   in IconServicesLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function IconSuiteToIconFamily(iconSuite: IconSuiteRef; whichIcons: IconSelectorValue; var iconFamily: IconFamilyHandle): OSErr; external name '_IconSuiteToIconFamily';
{
   SetIconFamilyData
   Change the data of an icon family. The data is copied.
   The type can be one of the icon type, or 'PICT'.
   The data will be compressed if needed.
}

{
 *  SetIconFamilyData()
 *
 *  Availability:
 *    Non-Carbon CFM:   in IconServicesLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetIconFamilyData(iconFamily: IconFamilyHandle; iconType: OSType; h: Handle): OSErr; external name '_SetIconFamilyData';
{
   GetIconFamilyData
   Return a copy of the data in the icon family.
   The type can be one of the icon type, or 'PICT'
   The data will be returned uncompressed.
   The handle (h) will be resized as appropriate. If no data of the
   requested type is present, the handle size will be set to 0.
}

{
 *  GetIconFamilyData()
 *
 *  Availability:
 *    Non-Carbon CFM:   in IconServicesLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetIconFamilyData(iconFamily: IconFamilyHandle; iconType: OSType; h: Handle): OSErr; external name '_GetIconFamilyData';
{
  ==============================================================================
   Reference counting
  ==============================================================================
}


{
   GetIconRefOwners

   This routine returns the reference count for the IconRef, or number of owners.

   A valid IconRef always has at least one owner.
}

{
 *  GetIconRefOwners()
 *
 *  Availability:
 *    Non-Carbon CFM:   in IconServicesLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetIconRefOwners(theIconRef: IconRef; var owners: UInt16): OSErr; external name '_GetIconRefOwners';
{
   AcquireIconRef
   This routine increments the reference count for the IconRef
}

{
 *  AcquireIconRef()
 *
 *  Availability:
 *    Non-Carbon CFM:   in IconServicesLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function AcquireIconRef(theIconRef: IconRef): OSErr; external name '_AcquireIconRef';
{
   ReleaseIconRef

   This routine decrements the reference count for the IconRef.

   When the reference count reaches 0, all memory allocated for the icon
   is disposed. Any subsequent use of the IconRef is invalid.
}

{
 *  ReleaseIconRef()
 *
 *  Availability:
 *    Non-Carbon CFM:   in IconServicesLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ReleaseIconRef(theIconRef: IconRef): OSErr; external name '_ReleaseIconRef';
{
  ==============================================================================
   Getting an IconRef
  ==============================================================================
}


{
   GetIconRefFromFile

   This routine returns an icon ref for the specified file, folder or volume.
   The label information is provided separately, since two files with the same icon
   but a different label would share the same iconRef. The label can be used in
   PlotIconRef() for example.

   Use this routine if you have no information about the file system object. If
   you have already done a GetCatInfo on the file and want to save some I/O,
   call GetIconRefFromFolder() if you know it's a folder with no custom icon or
   call GetIconRef() if it's a file with no custom icon.
   This routine increments the reference count of the returned IconRef. Call
   ReleaseIconRef() when you're done with it.
}

{
 *  GetIconRefFromFile()
 *
 *  Availability:
 *    Non-Carbon CFM:   in IconServicesLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetIconRefFromFile(const (*var*) theFile: FSSpec; var theIconRef: IconRef; var theLabel: SInt16): OSErr; external name '_GetIconRefFromFile';
{
   GetIconRef

   This routine returns an icon ref for an icon in the desktop database or
   for a registered icon.
   The system registers a set of icon such as the help icon with the creator
   code kSystemIconsCreator. See above for a list of the registered system types.
   The vRefNum is used as a hint on where to look for the icon first. Use
   kOnSystemDisk if you don't know what to pass.
   This routine increments the reference count of the returned IconRef. Call
   ReleaseIconRef() when you're done with it.
}

{
 *  GetIconRef()
 *
 *  Availability:
 *    Non-Carbon CFM:   in IconServicesLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetIconRef(vRefNum: SInt16; creator: OSType; iconType: OSType; var theIconRef: IconRef): OSErr; external name '_GetIconRef';
{
   GetIconRefFromFolder

   This routine returns an icon ref for a folder with no custom icon.
   Use the more generic, but slightly slower, GetIconRefFromFile() if
   you don't already have the necessary info about the file.
   Attributes should be CInfoPBRec.dirInfo.ioFlAttrib for this folder.
   Access privileges should be CInfoPBRec.dirInfo.ioACUser for this folder.
   This routine increments the reference count of the IconRef. Call ReleaseIconRef()
   when you're done with it.
}

{
 *  GetIconRefFromFolder()
 *
 *  Availability:
 *    Non-Carbon CFM:   in IconServicesLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetIconRefFromFolder(vRefNum: SInt16; parentFolderID: SInt32; folderID: SInt32; attributes: SInt8; accessPrivileges: SInt8; var theIconRef: IconRef): OSErr; external name '_GetIconRefFromFolder';
{  GetIconRefFromFileInfo }
{
 *  GetIconRefFromFileInfo()
 *
 *  Summary:
 *    This routine returns an IconRef for a file with minimal file I/O.
 *
 *  Discussion:
 *    To minimize file operations, FSGetCatalogInfo should be called
 *    prior to calling this routine. The FSCatalogInfo should
 *    correspond to kIconServicesCatalogInfoMask The name should be
 *    fetched and passed in. If either the name or the correct catalog
 *    info is not passed in, this routine will do file operations for
 *    this information instead.
 *
 *  Parameters:
 *
 *    inRef:
 *      An FSRef for the target file
 *
 *    inFileNameLength:
 *      The length of the name of the target file
 *
 *    inFileName:
 *      The name of the target file
 *
 *    inWhichInfo:
 *      The mask of file info already acquired.
 *
 *    inCatalogInfo:
 *      The catalog info already acquired.
 *
 *    inUsageFlags:
 *      The usage flags for this call (use
 *      kIconServicesNormalUsageFlag).
 *
 *    outIconRef:
 *      The output IconRef for the routine.
 *
 *    outLabel:
 *      The output label for the icon/file.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.1 and later
 *    Mac OS X:         in version 10.1 and later
 }
function GetIconRefFromFileInfo(const (*var*) inRef: FSRef; inFileNameLength: UniCharCount; inFileName: UniCharPtr; inWhichInfo: FSCatalogInfoBitmap; inCatalogInfo: {Const}FSCatalogInfoPtr; inUsageFlags: IconServicesUsageFlags; var outIconRef: IconRef; var outLabel: SInt16): OSStatus; external name '_GetIconRefFromFileInfo';

{ GetIconRefFromTypeInfo}
{
 *  GetIconRefFromTypeInfo()
 *
 *  Summary:
 *    Create an IconRef for a type information.
 *
 *  Discussion:
 *    Creates IconRef based on provided type info. Any of the input
 *    parameters can be zero (meaning it is unknown). Returns generic
 *    document icon in case if all parameters are zeroes. Calling the
 *    routine with non zero inCreator and inType and zero inExtension
 *    and inMIMEType is equivalent to GetIconRef(kOnSystemDisk,
 *    inCreator, inType).
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inCreator:
 *      The creator.
 *
 *    inType:
 *      The type.
 *
 *    inExtension:
 *      The extension.
 *
 *    inMIMEType:
 *      The MIME type.
 *
 *    inUsageFlags:
 *      The usage flags for this call (use
 *      kIconServicesNormalUsageFlag).
 *
 *    outIconRef:
 *      The output IconRef for the routine.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in ApplicationServices.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function GetIconRefFromTypeInfo( inCreator: OSType; inType: OSType; inExtension: CFStringRef; inMIMEType: CFStringRef; inUsageFlags: IconServicesUsageFlags; var outIconRef: IconRef ): OSErr; external name '_GetIconRefFromTypeInfo';

{ GetIconRefFromIconFamilyPtr}
{
 *  GetIconRefFromIconFamilyPtr()
 *
 *  Summary:
 *    Create an IconRef for the IconFamilyPtr.
 *
 *  Discussion:
 *    This routine creates IconRef for the IconFamilyPtr.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inIconFamilyPtr:
 *      The icon data
 *
 *    inSize:
 *      The icon data size
 *
 *    outIconRef:
 *      The output IconRef for the routine.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in ApplicationServices.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function GetIconRefFromIconFamilyPtr( const (*var*) inIconFamilyPtr: IconFamilyResource; inSize: Size; var outIconRef: IconRef ): OSStatus; external name '_GetIconRefFromIconFamilyPtr';

{
  ==============================================================================
   Adding and modifying IconRef
  ==============================================================================
}


{
   RegisterIconRefFromIconFamily
   This routine adds a new entry to the IconRef registry. Other clients will be
   able to access it using the (creator, iconType) pair specified here.
   Lower-case creators are reserved for the system.
   Consider using RegisterIconRefFromResource() if possible, since the data
   registered using RegisterIconRefFromFamily() cannot be purged.
   The iconFamily data is copied and the caller is reponsible for disposing of it.
   This routine increments the reference count of the IconRef. Call ReleaseIconRef()
   when you're done with it.
}

{
 *  RegisterIconRefFromIconFamily()
 *
 *  Availability:
 *    Non-Carbon CFM:   in IconServicesLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function RegisterIconRefFromIconFamily(creator: OSType; iconType: OSType; iconFamily: IconFamilyHandle; var theIconRef: IconRef): OSErr; external name '_RegisterIconRefFromIconFamily';
{
   RegisterIconRefFromResource

   Registers an IconRef from a resouce file.
   Lower-case creators are reserved for the system.
   The icon data to be fetched is either classic icon data or an icon family.
   The 'icns' icon family is searched for before the classic icon data.
   This routine increments the reference count of the IconRef. Call ReleaseIconRef()
   when you're done with it.
}

{
 *  RegisterIconRefFromResource()
 *
 *  Availability:
 *    Non-Carbon CFM:   in IconServicesLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function RegisterIconRefFromResource(creator: OSType; iconType: OSType; const (*var*) resourceFile: FSSpec; resourceID: SInt16; var theIconRef: IconRef): OSErr; external name '_RegisterIconRefFromResource';
{  RegisterIconRefFromFSRef }
{
 *  RegisterIconRefFromFSRef()
 *
 *  Discussion:
 *    This routine registers an IconRef from a ".icns" file and
 *    associates it with a creator/type pair.
 *
 *  Parameters:
 *
 *    creator:
 *      The creator code for the icns file.
 *
 *    iconType:
 *      The type code for the icns file
 *
 *    iconFile:
 *      The FSRef of the icns file.
 *
 *    theIconRef:
 *      The output IconRef for the routine.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.1 and later
 *    Mac OS X:         in version 10.1 and later
 }
function RegisterIconRefFromFSRef(creator: OSType; iconType: OSType; const (*var*) iconFile: FSRef; var theIconRef: IconRef): OSStatus; external name '_RegisterIconRefFromFSRef';

{
   UnregisterIconRef

   Removes the specified icon from the icon cache (if there are no users of it).
   If some clients are using this iconRef, then the IconRef will be removed when the
   last user calls ReleaseIconRef.
}

{
 *  UnregisterIconRef()
 *
 *  Availability:
 *    Non-Carbon CFM:   in IconServicesLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function UnregisterIconRef(creator: OSType; iconType: OSType): OSErr; external name '_UnregisterIconRef';
{
   UpdateIconRef

   Call this routine to force an update of the data for iconRef.

   For example after changing an icon in the desktop database or changing the custom
   icon of a file. Note that after _adding_ a custom icon to file or folder, you
   need to call GetIconRefFromFile() to get a new IconRef specific to this file.

   This routine does nothing if the IconRef is a registered icon.
}

{
 *  UpdateIconRef()
 *
 *  Availability:
 *    Non-Carbon CFM:   in IconServicesLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function UpdateIconRef(theIconRef: IconRef): OSErr; external name '_UpdateIconRef';
{
   OverrideIconRefFromResource

   This routines replaces the bitmaps of the specified IconRef with the ones
   in the specified resource file.
}

{
 *  OverrideIconRefFromResource()
 *
 *  Availability:
 *    Non-Carbon CFM:   in IconServicesLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OverrideIconRefFromResource(theIconRef: IconRef; const (*var*) resourceFile: FSSpec; resourceID: SInt16): OSErr; external name '_OverrideIconRefFromResource';
{
   OverrideIconRef

   This routines replaces the bitmaps of the specified IconRef with the ones
   from the new IconRef.
}

{
 *  OverrideIconRef()
 *
 *  Availability:
 *    Non-Carbon CFM:   in IconServicesLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OverrideIconRef(oldIconRef: IconRef; newIconRef: IconRef): OSErr; external name '_OverrideIconRef';
{
   RemoveIconRefOverride
   This routine remove an override if one was applied to the icon and
   reverts back to the original bitmap data.
}

{
 *  RemoveIconRefOverride()
 *
 *  Availability:
 *    Non-Carbon CFM:   in IconServicesLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function RemoveIconRefOverride(theIconRef: IconRef): OSErr; external name '_RemoveIconRefOverride';
{
  ==============================================================================
   Creating composite IconRef
  ==============================================================================
}


{
   CompositeIconRef

   Superimposes an IconRef on top of another one
}

{
 *  CompositeIconRef()
 *
 *  Availability:
 *    Non-Carbon CFM:   in IconServicesLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CompositeIconRef(backgroundIconRef: IconRef; foregroundIconRef: IconRef; var compositeIconRef: IconRef): OSErr; external name '_CompositeIconRef';
{
   IsIconRefComposite
   Indicates if a given icon ref is a composite of two other icon refs (and which ones)
   If it isn't a composite, backgroundIconRef and foreGroundIconRef will be 0.
}

{
 *  IsIconRefComposite()
 *
 *  Availability:
 *    Non-Carbon CFM:   in IconServicesLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function IsIconRefComposite(compositeIconRef: IconRef; var backgroundIconRef: IconRef; var foregroundIconRef: IconRef): OSErr; external name '_IsIconRefComposite';
{
  ==============================================================================
   Using IconRef
  ==============================================================================
}

{
   IsValidIconRef
   Return true if the iconRef passed in is a valid icon ref
}

{
 *  IsValidIconRef()
 *
 *  Availability:
 *    Non-Carbon CFM:   in IconServicesLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function IsValidIconRef(theIconRef: IconRef): boolean; external name '_IsValidIconRef';
{
   PlotIconRef

   This routine plots the IconRef.  It mostly takes the same parameters as
   PlotIconSuite. Pass kIconServicesNormalUsageFlag as a default value for
   IconServicesUsageFlags.
}

{
 *  PlotIconRef()
 *
 *  Availability:
 *    Non-Carbon CFM:   in IconServicesLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PlotIconRef(const (*var*) theRect: Rect; align: IconAlignmentType; transform: IconTransformType; theIconServicesUsageFlags: IconServicesUsageFlags; theIconRef: IconRef): OSErr; external name '_PlotIconRef';
{  PlotIconRefInContext }
{
 *  PlotIconRefInContext()
 *
 *  Discussion:
 *    This routines plots an IconRef using Quartz/CoreGraphics.
 *
 *  Parameters:
 *
 *    inContext:
 *      The graphics context to use.
 *
 *    inRect:
 *      The rect to plot the icon in.
 *
 *    inAlign:
 *      The icon alignment.
 *
 *    inTransform:
 *      The icon transform.
 *
 *    inLabelColor:
 *      The icon label color.
 *
 *    inFlags:
 *      The drawing flags to use (usually kPlotIconRefNormalFlags).
 *
 *    inIconRef:
 *      The IconRef to plot.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.1 and later
 *    Mac OS X:         in version 10.1 and later
 }
function PlotIconRefInContext(inContext: CGContextRef; const (*var*) inRect: CGRect; inAlign: IconAlignmentType; inTransform: IconTransformType; inLabelColor: RGBColorPtr; inFlags: PlotIconRefFlags; inIconRef: IconRef): OSStatus; external name '_PlotIconRefInContext';


{
   PtInIconRef

   This routine indicates if testPt would hit the icon designated by iconRef.
   It mostly takes the same parameters as PtInIconSuite.
   Pass kIconServicesNormalUsageFlag as a default value for IconServicesUsageFlags.
}


{
 *  PtInIconRef()
 *
 *  Availability:
 *    Non-Carbon CFM:   in IconServicesLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PtInIconRef(const (*var*) testPt: Point; const (*var*) iconRect: Rect; align: IconAlignmentType; theIconServicesUsageFlags: IconServicesUsageFlags; theIconRef: IconRef): boolean; external name '_PtInIconRef';
{
   RectInIconRef

   This routine indicates if testRect would intersect the icon designated by iconRef.
   It mostly takes the same parameters as RectInIconSuite.
   Pass kIconServicesNormalUsageFlag as a default value for IconServicesUsageFlags.
}


{
 *  RectInIconRef()
 *
 *  Availability:
 *    Non-Carbon CFM:   in IconServicesLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function RectInIconRef(const (*var*) testRect: Rect; const (*var*) iconRect: Rect; align: IconAlignmentType; iconServicesUsageFlags: IconServicesUsageFlags; theIconRef: IconRef): boolean; external name '_RectInIconRef';
{
   IconRefToRgn

   This routine returns a region for the icon.
   It mostly takes the same parameters as IconSuiteToRgn.
   Pass kIconServicesNormalUsageFlag as a default value for IconServicesUsageFlags.
}

{
 *  IconRefToRgn()
 *
 *  Availability:
 *    Non-Carbon CFM:   in IconServicesLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function IconRefToRgn(theRgn: RgnHandle; const (*var*) iconRect: Rect; align: IconAlignmentType; iconServicesUsageFlags: IconServicesUsageFlags; theIconRef: IconRef): OSErr; external name '_IconRefToRgn';
{
   GetIconSizesFromIconRef

   This routine returns an IconSelectorValue indicating the depths and sizes of
   icon data which are actually available.  It takes an IconSelectorValue
   indicating which sizes/depths the caller is interested and returns an
   IconSelectorValue indicating which sizes/depths exist.

   Caution:

   This is potentially an extremely expensive call as IconServices may be forced
   to attempt fetching the data for the IconRef's sizes/depths which may result
   in hitting the local disk or even the network to obtain the data to determine
   which sizes/depths actually exist.
   Pass kIconServicesNormalUsageFlag as a default value for IconServicesUsageFlags.
}

{
 *  GetIconSizesFromIconRef()
 *
 *  Availability:
 *    Non-Carbon CFM:   in IconServicesLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetIconSizesFromIconRef(iconSelectorInput: IconSelectorValue; var iconSelectorOutputPtr: IconSelectorValue; iconServicesUsageFlags: IconServicesUsageFlags; theIconRef: IconRef): OSErr; external name '_GetIconSizesFromIconRef';
{
  ==============================================================================
   Flushing IconRef data
  ==============================================================================
}


{
   FlushIconRefs

   Making this call will dispose of all the data for the specified icons if
   the data can be reacquired, for example if the data is provided from a resource.
   '****' is a wildcard for all types or all creators.
}

{
 *  FlushIconRefs()
 *
 *  Availability:
 *    Non-Carbon CFM:   in IconServicesLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FlushIconRefs(creator: OSType; iconType: OSType): OSErr; external name '_FlushIconRefs';
{
   FlushIconRefsByVolume

   This routine disposes of the data for the icons related to the indicated volume
   if this data can be reacquired, for example if the data is provided from a
   resource.
}

{
 *  FlushIconRefsByVolume()
 *
 *  Availability:
 *    Non-Carbon CFM:   in IconServicesLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FlushIconRefsByVolume(vRefNum: SInt16): OSErr; external name '_FlushIconRefsByVolume';
{
  ==============================================================================
   Controling custom icons
  ==============================================================================
}


{
   SetCustomIconsEnabled

   Enable or disable custom icons on the specified volume.
}

{
 *  SetCustomIconsEnabled()
 *
 *  Availability:
 *    Non-Carbon CFM:   in IconServicesLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetCustomIconsEnabled(vRefNum: SInt16; enableCustomIcons: boolean): OSErr; external name '_SetCustomIconsEnabled';
{
   GetCustomIconsEnabled

   Return true if custom icons are enabled on the specified volume, false otherwise.
}

{
 *  GetCustomIconsEnabled()
 *
 *  Availability:
 *    Non-Carbon CFM:   in IconServicesLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetCustomIconsEnabled(vRefNum: SInt16; var customIconsEnabled: boolean): OSErr; external name '_GetCustomIconsEnabled';
{
   IsIconRefMaskEmpty
   Returns true if the mask for this icon is blank
}

{
 *  IsIconRefMaskEmpty()
 *
 *  Availability:
 *    Non-Carbon CFM:   in IconServicesLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function IsIconRefMaskEmpty(iconRef: IconRef): boolean; external name '_IsIconRefMaskEmpty';
{
   GetIconRefVariant
   Icon variants allows different images to be used with different icon state.
   For example, the 'open' variant for a folder could be represented with
   an open folder.
   Given an icon ref and a desired variant, this routine returns an icon
   ref (which may be the same as the input icon ref) and a transformation
   which should be used with PlotIconRef() to render the icon appropriately.
   The returned icon ref should be used to do hit-testing.
}

{
 *  GetIconRefVariant()
 *
 *  Availability:
 *    Non-Carbon CFM:   in IconServicesLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetIconRefVariant(inIconRef: IconRef; inVariant: OSType; var outTransform: IconTransformType): IconRef; external name '_GetIconRefVariant';
{
  ==============================================================================
   Icon files (.icns files)
  ==============================================================================
}


{
   RegisterIconRefFromIconFile
   This routine adds a new entry to the IconRef registry. Other clients will be
   able to access it using the (creator, iconType) pair specified here.
   Lower-case creators are reserved for the system.
   If the creator is kSystemIconsCreator and the iconType is 0, a new IconRef
   is always returned. Otherwise, if the creator and type have already been
   registered, the previously registered IconRef is returned.
   This routine increments the reference count of the IconRef. Call ReleaseIconRef()
   when you're done with it.
}

{
 *  RegisterIconRefFromIconFile()
 *
 *  Availability:
 *    Non-Carbon CFM:   in IconServicesLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function RegisterIconRefFromIconFile(creator: OSType; iconType: OSType; const (*var*) iconFile: FSSpec; var theIconRef: IconRef): OSErr; external name '_RegisterIconRefFromIconFile';
{
   ReadIconFile
   Read the specified icon file into the icon family handle.
   The caller is responsible for disposing the iconFamily
}

{
 *  ReadIconFile()
 *
 *  Availability:
 *    Non-Carbon CFM:   in IconServicesLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ReadIconFile(const (*var*) iconFile: FSSpec; var iconFamily: IconFamilyHandle): OSErr; external name '_ReadIconFile';
{  ReadIconFromFSRef }
{
 *  ReadIconFromFSRef()
 *
 *  Discussion:
 *    This routine reads an icon (icns) file into memory.
 *
 *  Parameters:
 *
 *    ref:
 *      The FSRef for the icon file.
 *
 *    iconFamily:
 *      The handle for the icon family.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.1 and later
 *    Mac OS X:         in version 10.1 and later
 }
function ReadIconFromFSRef(const (*var*) ref: FSRef; var iconFamily: IconFamilyHandle): OSStatus; external name '_ReadIconFromFSRef';


{
   WriteIconFile
   Write the iconFamily handle to the specified file
}

{
 *  WriteIconFile()
 *
 *  Availability:
 *    Non-Carbon CFM:   in IconServicesLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function WriteIconFile(iconFamily: IconFamilyHandle; const (*var*) iconFile: FSSpec): OSErr; external name '_WriteIconFile';
{$ALIGN MAC68K}
{#POP}
{unit NSL}
{$ALIGN MAC68K}








{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}



type
    NSLDialogOptionFlags        = UInt32;
const
    kNSLDefaultNSLDlogOptions   = $00000000;                    {  use defaults for all the options  }
    kNSLNoURLTEField            = $00000001;                    {  don't show url text field for manual entry  }
    kNSLAddServiceTypes         = $00000002;                    {  add the service type if a user enters an incomplete URL  }
    kNSLClientHandlesRecents    = $00000004;                    {  Stops NSLStandardGetURL from adding the selection to the recent items folder  }


type
    NSLDialogOptionsPtr = ^NSLDialogOptions;
    NSLDialogOptions = record
        version:                UInt16;
        dialogOptionFlags:      NSLDialogOptionFlags;                   {  option flags for affecting the dialog's behavior  }
        windowTitle:            Str255;
        actionButtonLabel:      Str255;                                 {  label of the default button (or null string for default)  }
        cancelButtonLabel:      Str255;                                 {  label of the cancel button (or null string for default)  }
        message:                Str255;                                 {  custom message prompt (or null string for default)  }
    end;

    NSLURLFilterProcPtr = function(url: CStringPtr; var displayString: Str255): boolean;

    {  you can provide for calls to NSLStandardGetURL }
    NSLEventProcPtr = procedure(var newEvent: EventRecord; userContext: UnivPtr);

    NSLURLFilterUPP = ^SInt32; { an opaque UPP }
    NSLEventUPP = ^SInt32; { an opaque UPP }

const
    uppNSLURLFilterProcInfo = $000003D0;
    uppNSLEventProcInfo = $000003C0;
    {
     *  NewNSLURLFilterUPP()
     *
     *  Availability:
     *    Non-Carbon CFM:   available as macro/inline
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function NewNSLURLFilterUPP(userRoutine: NSLURLFilterProcPtr): NSLURLFilterUPP; external name '_NewNSLURLFilterUPP'; { old name was NewNSLURLFilterProc }
{
 *  NewNSLEventUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewNSLEventUPP(userRoutine: NSLEventProcPtr): NSLEventUPP; external name '_NewNSLEventUPP'; { old name was NewNSLEventProc }
{
 *  DisposeNSLURLFilterUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeNSLURLFilterUPP(userUPP: NSLURLFilterUPP); external name '_DisposeNSLURLFilterUPP';
{
 *  DisposeNSLEventUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeNSLEventUPP(userUPP: NSLEventUPP); external name '_DisposeNSLEventUPP';
{
 *  InvokeNSLURLFilterUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeNSLURLFilterUPP(url: CStringPtr; var displayString: Str255; userRoutine: NSLURLFilterUPP): boolean; external name '_InvokeNSLURLFilterUPP'; { old name was CallNSLURLFilterProc }
{
 *  InvokeNSLEventUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvokeNSLEventUPP(var newEvent: EventRecord; userContext: UnivPtr; userRoutine: NSLEventUPP); external name '_InvokeNSLEventUPP'; { old name was CallNSLEventProc }
{ <--- function returns OSStatus of the operation.  noErr will be returned if valid, kNSLUserCanceled will be returned if the user cancels }
{ ---> dialogOptions }
{ ---> eventProc }
{ ---> eventProcContextPtr }
{ ---> filterProc }
{ ---> serviceTypeList }
{ <--- userSelectedURL }
{ NSLDialogOptions* dialogOptions }
{
   dialogOptions is a user defined structure defining the look, feel and operation of NSLStandardGetURL dialog
   default behavior can be achieved by passing in a pointer to a structure that has been filled out by a previous
   call to NSLGetDefaultDialogOptions or by passing in NULL.
}
{ NSLEventUPP eventProc }
{
   the eventProc is a callback NSLURLFilterUPP that will
   get called with Events that the dialog doesn't handle.  If you pass in nil,
   you won't get update events while the NSLStandardGetURL dialog is open.
}
{ void* eventProcContextPtr }
{  you can provide a pointer to some contextual data that you want to have sent to your eventProc filter }
{ NSLURLFilterProcPtr filterProc }
{
   the filter param is a callback NSLURLFilterUPP that
   will get called (if not nil) for each url that is going to be displayed in
   the dialog's result list.  A result of false will not include the url for the
   user to select from.  You also have the option of handling the way the url looks
   in the dialog listing by copying the preferred name into the displayString
   parameter.  (If left alone, NSLStandardGetURL dialog will strip the service type
   portion off the url).
}
{ char* serviceTypeList }
{
   the serviceTypeList parameter is a null terminated string that will
   directly affect the contents of the services popup in the dialog.
   The structure of this string is a set of tuples as follows:
   Name of ServiceType as to be represented in the popup followed by
   a comma delimted list of service descriptors (ie http,https) that will
   used in the search of that type.  Each comma delimited tuple is delimited
   by semi-colons.
}
{
   For example:
   If you want to search for services of type http (web), https (secure web),
   and ftp, you could pass in the string "Web Servers,http,https;FTP Servers,ftp".
   This would result in a popup list with two items ("Web Servers" and "FTP Servers")
   and searches performed on them will provide results of type http and https for the
   first, and ftp for the second.
}

{
   Results list Icons:
   NSLStandardGetURL provides icons in its listings for the following types:
   "http", "https", "ftp", "afp", "lpr", "LaserWriter", "AFPServer"
   any other types will get a generic icon.  However, you can provide icons
   if you wish by including an '#ics8' resource id at the end of your comma
   delimited list.  The dialog will then use that icon if found in its results
   list.  This icon will be used for all types in a tuple.
   For example:
   The param "Web Servers,http,https;Telnet Servers,telnet;NFS Servers,nfs,129"
   would result in lists of http and https services to be shown with their default
   icons, telnet servers would be shown with the default misc. icon and nfs
   servers would be shown with your icon at resource id 129.
}

{ char** url }
{
   pass in the address of a char* and it will point to the resulting url.  If the user
   cancels (the function returns false), the pointer will be set to nil.  If the function
   returns true (user selected a url), then you must call NSLFreeURL on the pointer when
   you are done with it.
}
{
   Call this to have the user select a url based service from a dialog.
   Function takes on input an optional filter proc, a serviceTypeList, and an address to a Ptr.
   Function sets the value of the Ptr to a newly created c-style null terminated string
   containing the user's choice of URL.
}

{
 *  NSLStandardGetURL()
 *
 *  Availability:
 *    Non-Carbon CFM:   in NSLPPCLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NSLStandardGetURL(dialogOptions: NSLDialogOptionsPtr; eventProc: NSLEventUPP; eventProcContextPtr: UnivPtr; filterProc: NSLURLFilterUPP; serviceTypeList: CStringPtr; var userSelectedURL: CStringPtr): OSStatus; external name '_NSLStandardGetURL';

{
 *  NSLGetDefaultDialogOptions()
 *
 *  Availability:
 *    Non-Carbon CFM:   in NSLPPCLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NSLGetDefaultDialogOptions(var dialogOptions: NSLDialogOptions): OSStatus; external name '_NSLGetDefaultDialogOptions';

{ <--- function returns null (useful for setting variable at same time as freeing it }
{ ---> url is memory created by a call to NSLStandardGetURL }
{
 *  NSLFreeURL()
 *
 *  Availability:
 *    Non-Carbon CFM:   in NSLPPCLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NSLFreeURL(url: CStringPtr): CStringPtr; external name '_NSLFreeURL';

{ <--- function returns kNSLErrNullPtrError, file mgr errors, or resource mgr errors }
{ ---> folderSelectorType is one of the well-known folders defined in Folders.h }
{ ---> url is any valid url }
{ ---> userFriendlyName is used for the file name and the display name (in the UI) }
{
 *  NSLSaveURLAliasToFolder()
 *
 *  Availability:
 *    Non-Carbon CFM:   in NSLPPCLib 1.1 and later
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function NSLSaveURLAliasToFolder(folderSelectorType: OSType; url: ConstCStringPtr; userFriendlyName: ConstCStringPtr): OSErr; external name '_NSLSaveURLAliasToFolder';



{$ALIGN MAC68K}
{#POP}
{unit Palettes}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}


const
    pmCourteous                 = 0;                            { Record use of color on each device touched. }
    pmDithered                  = $0001;
    pmTolerant                  = $0002;                        { render ciRGB if ciTolerance is exceeded by best match. }
    pmAnimated                  = $0004;                        { reserve an index on each device touched and render ciRGB. }
    pmExplicit                  = $0008;                        { no reserve, no render, no record; stuff index into port. }
    pmWhite                     = $0010;
    pmBlack                     = $0020;
    pmInhibitG2                 = $0100;
    pmInhibitC2                 = $0200;
    pmInhibitG4                 = $0400;
    pmInhibitC4                 = $0800;
    pmInhibitG8                 = $1000;
    pmInhibitC8                 = $2000;                        {  NSetPalette Update Constants  }
    pmNoUpdates                 = $8000;                        { no updates }
    pmBkUpdates                 = $A000;                        { background updates only }
    pmFgUpdates                 = $C000;                        { foreground updates only }
    pmAllUpdates                = $E000;                        { all updates }


type
    ColorInfoPtr = ^ColorInfo;
    ColorInfo = record
        ciRGB:                  RGBColor;                               { true RGB values }
        ciUsage:                SInt16;                             { color usage }
        ciTolerance:            SInt16;                             { tolerance value }
        ciDataFields:           array [0..2] of SInt16;             { private fields }
    end;

    ColorInfoHandle                     = ^ColorInfoPtr;
    PalettePtr = ^Palette;
    Palette = record
        pmEntries:              SInt16;                             { entries in pmTable }
        pmDataFields:           array [0..6] of SInt16;             { private fields }
        pmInfo:                 array [0..0] of ColorInfo;
    end;

    PaletteHandle                       = ^PalettePtr;
    {
     *  InitPalettes()
     *
     *  Availability:
     *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
procedure InitPalettes; external name '_InitPalettes';
{
 *  NewPalette()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewPalette(entries: SInt16; srcColors: CTabHandle; srcUsage: SInt16; srcTolerance: SInt16): PaletteHandle; external name '_NewPalette';
{
 *  GetNewPalette()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetNewPalette(PaletteID: SInt16): PaletteHandle; external name '_GetNewPalette';
{
 *  DisposePalette()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposePalette(srcPalette: PaletteHandle); external name '_DisposePalette';
{
 *  ActivatePalette()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure ActivatePalette(srcWindow: WindowRef); external name '_ActivatePalette';
{
 *  SetPalette()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetPalette(dstWindow: WindowRef; srcPalette: PaletteHandle; cUpdates: boolean); external name '_SetPalette';
{
 *  NSetPalette()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure NSetPalette(dstWindow: WindowRef; srcPalette: PaletteHandle; nCUpdates: SInt16); external name '_NSetPalette';
{
 *  GetPalette()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetPalette(srcWindow: WindowRef): PaletteHandle; external name '_GetPalette';
{
 *  CopyPalette()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CopyPalette(srcPalette: PaletteHandle; dstPalette: PaletteHandle; srcEntry: SInt16; dstEntry: SInt16; dstLength: SInt16); external name '_CopyPalette';
{
 *  PmForeColor()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure PmForeColor(dstEntry: SInt16); external name '_PmForeColor';
{
 *  PmBackColor()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure PmBackColor(dstEntry: SInt16); external name '_PmBackColor';
{
 *  AnimateEntry()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure AnimateEntry(dstWindow: WindowRef; dstEntry: SInt16; const (*var*) srcRGB: RGBColor); external name '_AnimateEntry';
{
 *  [Mac]AnimatePalette()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure AnimatePalette(dstWindow: WindowRef; srcCTab: CTabHandle; srcIndex: SInt16; dstEntry: SInt16; dstLength: SInt16); external name '_AnimatePalette';
{
 *  GetEntryColor()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure GetEntryColor(srcPalette: PaletteHandle; srcEntry: SInt16; var dstRGB: RGBColor); external name '_GetEntryColor';
{
 *  SetEntryColor()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetEntryColor(dstPalette: PaletteHandle; dstEntry: SInt16; const (*var*) srcRGB: RGBColor); external name '_SetEntryColor';
{
 *  GetEntryUsage()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure GetEntryUsage(srcPalette: PaletteHandle; srcEntry: SInt16; var dstUsage: SInt16; var dstTolerance: SInt16); external name '_GetEntryUsage';
{
 *  SetEntryUsage()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetEntryUsage(dstPalette: PaletteHandle; dstEntry: SInt16; srcUsage: SInt16; srcTolerance: SInt16); external name '_SetEntryUsage';
{
 *  CTab2Palette()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CTab2Palette(srcCTab: CTabHandle; dstPalette: PaletteHandle; srcUsage: SInt16; srcTolerance: SInt16); external name '_CTab2Palette';
{
 *  Palette2CTab()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure Palette2CTab(srcPalette: PaletteHandle; dstCTab: CTabHandle); external name '_Palette2CTab';
{
 *  Entry2Index()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function Entry2Index(entry: SInt16): SInt32; external name '_Entry2Index';
{
 *  RestoreDeviceClut()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure RestoreDeviceClut(gd: GDHandle); external name '_RestoreDeviceClut';
{
 *  [Mac]ResizePalette()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure ResizePalette(p: PaletteHandle; size: SInt16); external name '_ResizePalette';
{
 *  SaveFore()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SaveFore(var c: ColorSpec); external name '_SaveFore';
{
 *  SaveBack()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SaveBack(var c: ColorSpec); external name '_SaveBack';
{
 *  RestoreFore()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure RestoreFore(const (*var*) c: ColorSpec); external name '_RestoreFore';
{
 *  RestoreBack()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure RestoreBack(const (*var*) c: ColorSpec); external name '_RestoreBack';
{
 *  SetDepth()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetDepth(gd: GDHandle; depth: SInt16; whichFlags: SInt16; flags: SInt16): OSErr; external name '_SetDepth';
{
 *  HasDepth()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function HasDepth(gd: GDHandle; depth: SInt16; whichFlags: SInt16; flags: SInt16): SInt16; external name '_HasDepth';
{
 *  PMgrVersion()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PMgrVersion: SInt16; external name '_PMgrVersion';
{
 *  SetPaletteUpdates()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetPaletteUpdates(p: PaletteHandle; updates: SInt16); external name '_SetPaletteUpdates';
{
 *  GetPaletteUpdates()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetPaletteUpdates(p: PaletteHandle): SInt16; external name '_GetPaletteUpdates';
{
 *  GetGray()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetGray(device: GDHandle; const (*var*) backGround: RGBColor; var foreGround: RGBColor): boolean; external name '_GetGray';
{$ALIGN MAC68K}
{#POP}
{unit PictUtils}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}

{ verbs for the GetPictInfo, GetPixMapInfo, and NewPictInfo calls }

const
    returnColorTable            = $0001;
    returnPalette               = $0002;
    recordComments              = $0004;
    recordFontInfo              = $0008;
    suppressBlackAndWhite       = $0010;

                                                                {  color pick methods  }
    systemMethod                = 0;                            {  system color pick method  }
    popularMethod               = 1;                            {  method that chooses the most popular set of colors  }
    medianMethod                = 2;                            {  method that chooses a good average mix of colors  }

                                                                {  color bank types  }
    ColorBankIsCustom           = -1;
    ColorBankIsExactAnd555      = 0;
    ColorBankIs555              = 1;


type
    PictInfoID                          = SInt32;
    CommentSpecPtr = ^CommentSpec;
    CommentSpec = record
        count:                  SInt16;                             {  number of occurrances of this comment ID  }
        ID:                     SInt16;                             {  ID for the comment in the picture  }
    end;

    CommentSpecHandle                   = ^CommentSpecPtr;
    FontSpecPtr = ^FontSpec;
    FontSpec = record
        pictFontID:             SInt16;                             {  ID of the font in the picture  }
        sysFontID:              SInt16;                             {  ID of the same font in the current system file  }
        size:                   array [0..3] of SInt32;             {  bit array of all the sizes found (1..127) (bit 0 means > 127)  }
        style:                  SInt16;                             {  combined style of all occurrances of the font  }
        nameOffset:             SInt32;                             {  offset into the fontNamesHdl handle for the fontÕs name  }
    end;

    FontSpecHandle                      = ^FontSpecPtr;
    PictInfoPtr = ^PictInfo;
    PictInfo = record
        version:                SInt16;                             {  this is always zero, for now  }
        uniqueColors:           SInt32;                             {  the number of actual colors in the picture(s)/pixmap(s)  }
        thePalette:             PaletteHandle;                          {  handle to the palette information  }
        theColorTable:          CTabHandle;                             {  handle to the color table  }
        hRes:                   Fixed;                                  {  maximum horizontal resolution for all the pixmaps  }
        vRes:                   Fixed;                                  {  maximum vertical resolution for all the pixmaps  }
        depth:                  SInt16;                             {  maximum depth for all the pixmaps (in the picture)  }
        sourceRect:             Rect;                                   {  the picture frame rectangle (this contains the entire picture)  }
        textCount:              SInt32;                             {  total number of text strings in the picture  }
        lineCount:              SInt32;                             {  total number of lines in the picture  }
        rectCount:              SInt32;                             {  total number of rectangles in the picture  }
        rRectCount:             SInt32;                             {  total number of round rectangles in the picture  }
        ovalCount:              SInt32;                             {  total number of ovals in the picture  }
        arcCount:               SInt32;                             {  total number of arcs in the picture  }
        polyCount:              SInt32;                             {  total number of polygons in the picture  }
        regionCount:            SInt32;                             {  total number of regions in the picture  }
        bitMapCount:            SInt32;                             {  total number of bitmaps in the picture  }
        pixMapCount:            SInt32;                             {  total number of pixmaps in the picture  }
        commentCount:           SInt32;                             {  total number of comments in the picture  }
        uniqueComments:         SInt32;                             {  the number of unique comments in the picture  }
        commentHandle:          CommentSpecHandle;                      {  handle to all the comment information  }
        uniqueFonts:            SInt32;                             {  the number of unique fonts in the picture  }
        fontHandle:             FontSpecHandle;                         {  handle to the FontSpec information  }
        fontNamesHandle:        Handle;                                 {  handle to the font names  }
        reserved1:              SInt32;
        reserved2:              SInt32;
    end;

    PictInfoHandle                      = ^PictInfoPtr;
    InitPickMethodProcPtr = function(colorsRequested: SInt16; var dataRef: UInt32; var colorBankType: SInt16): OSErr;

    RecordColorsProcPtr = function(dataRef: UInt32; var colorsArray: RGBColor; colorCount: SInt32; var uniqueColors: SInt32): OSErr;

    CalcColorTableProcPtr = function(dataRef: UInt32; colorsRequested: SInt16; colorBankPtr: UnivPtr; var resultPtr: CSpecArray): OSErr;

    DisposeColorPickMethodProcPtr = function(dataRef: UInt32): OSErr;

    InitPickMethodUPP = ^SInt32; { an opaque UPP }
    RecordColorsUPP = ^SInt32; { an opaque UPP }
    CalcColorTableUPP = ^SInt32; { an opaque UPP }
    DisposeColorPickMethodUPP = ^SInt32; { an opaque UPP }

const
    uppInitPickMethodProcInfo = $00000FA0;
    uppRecordColorsProcInfo = $00003FE0;
    uppCalcColorTableProcInfo = $00003EE0;
    uppDisposeColorPickMethodProcInfo = $000000E0;
    {
     *  NewInitPickMethodUPP()
     *
     *  Availability:
     *    Non-Carbon CFM:   available as macro/inline
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function NewInitPickMethodUPP(userRoutine: InitPickMethodProcPtr): InitPickMethodUPP; external name '_NewInitPickMethodUPP'; { old name was NewInitPickMethodProc }
{
 *  NewRecordColorsUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewRecordColorsUPP(userRoutine: RecordColorsProcPtr): RecordColorsUPP; external name '_NewRecordColorsUPP'; { old name was NewRecordColorsProc }
{
 *  NewCalcColorTableUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewCalcColorTableUPP(userRoutine: CalcColorTableProcPtr): CalcColorTableUPP; external name '_NewCalcColorTableUPP'; { old name was NewCalcColorTableProc }
{
 *  NewDisposeColorPickMethodUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewDisposeColorPickMethodUPP(userRoutine: DisposeColorPickMethodProcPtr): DisposeColorPickMethodUPP; external name '_NewDisposeColorPickMethodUPP'; { old name was NewDisposeColorPickMethodProc }
{
 *  DisposeInitPickMethodUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeInitPickMethodUPP(userUPP: InitPickMethodUPP); external name '_DisposeInitPickMethodUPP';
{
 *  DisposeRecordColorsUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeRecordColorsUPP(userUPP: RecordColorsUPP); external name '_DisposeRecordColorsUPP';
{
 *  DisposeCalcColorTableUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeCalcColorTableUPP(userUPP: CalcColorTableUPP); external name '_DisposeCalcColorTableUPP';
{
 *  DisposeDisposeColorPickMethodUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeDisposeColorPickMethodUPP(userUPP: DisposeColorPickMethodUPP); external name '_DisposeDisposeColorPickMethodUPP';
{
 *  InvokeInitPickMethodUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeInitPickMethodUPP(colorsRequested: SInt16; var dataRef: UInt32; var colorBankType: SInt16; userRoutine: InitPickMethodUPP): OSErr; external name '_InvokeInitPickMethodUPP'; { old name was CallInitPickMethodProc }
{
 *  InvokeRecordColorsUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeRecordColorsUPP(dataRef: UInt32; var colorsArray: RGBColor; colorCount: SInt32; var uniqueColors: SInt32; userRoutine: RecordColorsUPP): OSErr; external name '_InvokeRecordColorsUPP'; { old name was CallRecordColorsProc }
{
 *  InvokeCalcColorTableUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeCalcColorTableUPP(dataRef: UInt32; colorsRequested: SInt16; colorBankPtr: UnivPtr; var resultPtr: CSpecArray; userRoutine: CalcColorTableUPP): OSErr; external name '_InvokeCalcColorTableUPP'; { old name was CallCalcColorTableProc }
{
 *  InvokeDisposeColorPickMethodUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeDisposeColorPickMethodUPP(dataRef: UInt32; userRoutine: DisposeColorPickMethodUPP): OSErr; external name '_InvokeDisposeColorPickMethodUPP'; { old name was CallDisposeColorPickMethodProc }
{
 *  GetPictInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetPictInfo(thePictHandle: PicHandle; var thePictInfo: PictInfo; verb: SInt16; colorsRequested: SInt16; colorPickMethod: SInt16; version: SInt16): OSErr; external name '_GetPictInfo';
{
 *  GetPixMapInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetPixMapInfo(thePixMapHandle: PixMapHandle; var thePictInfo: PictInfo; verb: SInt16; colorsRequested: SInt16; colorPickMethod: SInt16; version: SInt16): OSErr; external name '_GetPixMapInfo';
{
 *  NewPictInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewPictInfo(var thePictInfoID: PictInfoID; verb: SInt16; colorsRequested: SInt16; colorPickMethod: SInt16; version: SInt16): OSErr; external name '_NewPictInfo';
{
 *  RecordPictInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function RecordPictInfo(thePictInfoID: PictInfoID; thePictHandle: PicHandle): OSErr; external name '_RecordPictInfo';
{
 *  RecordPixMapInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function RecordPixMapInfo(thePictInfoID: PictInfoID; thePixMapHandle: PixMapHandle): OSErr; external name '_RecordPixMapInfo';
{
 *  RetrievePictInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function RetrievePictInfo(thePictInfoID: PictInfoID; var thePictInfo: PictInfo; colorsRequested: SInt16): OSErr; external name '_RetrievePictInfo';
{
 *  DisposePictInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DisposePictInfo(thePictInfoID: PictInfoID): OSErr; external name '_DisposePictInfo';




{$ALIGN MAC68K}
{#POP}
{unit Processes}
{$ALIGN MAC68K}








{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}

{ type for unique process identifier }

type
    ProcessSerialNumberPtr = ^ProcessSerialNumber;
    ProcessSerialNumber = record
        highLongOfPSN:          UInt32;
        lowLongOfPSN:           UInt32;
    end;


const
                                                                {  Process identifier - Various reserved process serial numbers  }
    kNoProcess                  = 0;
    kSystemProcess              = 1;
    kCurrentProcess             = 2;

    {    Definition of the parameter block passed to _Launch    }
    {  Typedef and flags for launchControlFlags field }

type
    LaunchFlags                         = UInt16;

const
    launchContinue              = $4000;
    launchNoFileFlags           = $0800;
    launchUseMinimum            = $0400;
    launchDontSwitch            = $0200;
    launchAllow24Bit            = $0100;
    launchInhibitDaemon         = $0080;

    {    Format for first AppleEvent to pass to new process.  The size of the overall
      buffer variable: the message body immediately follows the messageLength   }

type
    AppParametersPtr = ^AppParameters;
    AppParameters = record
        theMsgEvent:            EventRecord;
        eventRefCon:            UInt32;
        messageLength:          UInt32;
    end;

    {    Parameter block to _Launch     }
    LaunchParamBlockRecPtr = ^LaunchParamBlockRec;
    LaunchParamBlockRec = record
        reserved1:              UInt32;
        reserved2:              UInt16;
        launchBlockID:          UInt16;
        launchEPBLength:        UInt32;
        launchFileFlags:        UInt16;
        launchControlFlags:     LaunchFlags;
        launchAppSpec:          FSSpecPtr;
        launchProcessSN:        ProcessSerialNumber;
        launchPreferredSize:    UInt32;
        launchMinimumSize:      UInt32;
        launchAvailableSize:    UInt32;
        launchAppParameters:    AppParametersPtr;
    end;

    LaunchPBPtr                         = ^LaunchParamBlockRec;
    {    Set launchBlockID to extendedBlock to specify that extensions exist.
     Set launchEPBLength to extendedBlockLen for compatibility. }

const
    extendedBlock               = $4C43;                        {  'LC'  }
    extendedBlockLen            = 32;

                                                                {  Definition of the information block returned by GetProcessInformation  }
    modeReserved                = $01000000;
    modeControlPanel            = $00080000;
    modeLaunchDontSwitch        = $00040000;
    modeDeskAccessory           = $00020000;
    modeMultiLaunch             = $00010000;
    modeNeedSuspendResume       = $00004000;
    modeCanBackground           = $00001000;
    modeDoesActivateOnFGSwitch  = $00000800;
    modeOnlyBackground          = $00000400;
    modeGetFrontClicks          = $00000200;
    modeGetAppDiedMsg           = $00000100;
    mode32BitCompatible         = $00000080;
    modeHighLevelEventAware     = $00000040;
    modeLocalAndRemoteHLEvents  = $00000020;
    modeStationeryAware         = $00000010;
    modeUseTextEditServices     = $00000008;
    modeDisplayManagerAware     = $00000004;

    {
       Record returned by GetProcessInformation
        When calling GetProcessInformation(), the input ProcesInfoRec
        should have the processInfoLength set to sizeof(ProcessInfoRec),
        the processName field set to nil or a pointer to a Str255, and
        processAppSpec set to nil or a pointer to an FSSpec.  If
        processName or processAppSpec are not specified, this routine
        will very likely write data to whatever random location in memory
        these happen to point to, which is not a good thing.
    }

type
    ProcessInfoRecPtr = ^ProcessInfoRec;
    ProcessInfoRec = record
        processInfoLength:      UInt32;
        processName:            StringPtr;
        processNumber:          ProcessSerialNumber;
        processType:            UInt32;
        processSignature:       OSType;
        processMode:            UInt32;
        processLocation:        Ptr;
        processSize:            UInt32;
        processFreeMem:         UInt32;
        processLauncher:        ProcessSerialNumber;
        processLaunchDate:      UInt32;
        processActiveTime:      UInt32;
        processAppSpec:         FSSpecPtr;
    end;

    {
        Some applications assumed the size of a ProcessInfoRec would never change,
        which has caused problems trying to return additional information.  In
        the future, we will add fields to ProcessInfoExtendedRec when necessary,
        and callers which wish to access 'more' data than originally was present
        in ProcessInfoRec should allocate space for a ProcessInfoExtendedRec,
        fill in the processInfoLength ( and processName and processAppSpec ptrs ),
        then coerce this to a ProcessInfoRecPtr in the call to
        GetProcessInformation().
    }
    ProcessInfoExtendedRecPtr = ^ProcessInfoExtendedRec;
    ProcessInfoExtendedRec = record
        processInfoLength:      UInt32;
        processName:            StringPtr;
        processNumber:          ProcessSerialNumber;
        processType:            UInt32;
        processSignature:       OSType;
        processMode:            UInt32;
        processLocation:        Ptr;
        processSize:            UInt32;
        processFreeMem:         UInt32;
        processLauncher:        ProcessSerialNumber;
        processLaunchDate:      UInt32;
        processActiveTime:      UInt32;
        processAppSpec:         FSSpecPtr;
        processTempMemTotal:    UInt32;
        processPurgeableTempMemTotal: UInt32;
    end;

    {    Record corresponding to the SIZE resource definition   }
    SizeResourceRecPtr = ^SizeResourceRec;
    SizeResourceRec = record
        flags:                  UInt16;
        preferredHeapSize:      UInt32;
        minimumHeapSize:        UInt32;
    end;

    SizeResourceRecHandle               = ^SizeResourceRecPtr;
    {
        Applications and background applications can control when they are asked to quit
        by the system at restart/shutdown by setting these bits in a 'quit' ( 0 ) resource
        in their application's resource fork.  Applications without a 'quit' ( 0 ) will
        be quit at kQuitAtNormalTime mask.
    }

const
    kQuitBeforeNormalTimeMask   = 1;
    kQuitAtNormalTimeMask       = 2;
    kQuitBeforeFBAsQuitMask     = 4;
    kQuitBeforeShellQuitsMask   = 8;
    kQuitBeforeTerminatorAppQuitsMask = 16;
    kQuitNeverMask              = 32;
    kQuitOptionsMask            = $7F;
    kQuitNotQuitDuringInstallMask = $0100;
    kQuitNotQuitDuringLogoutMask = $0200;
    kQuitReserved1Mask          = $1000;


    {
     *  LaunchApplication()
     *
     *  Availability:
     *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function LaunchApplication(LaunchParams: LaunchPBPtr): OSErr; external name '_LaunchApplication';

{
 *  [Mac]GetCurrentProcess()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetCurrentProcess(var PSN: ProcessSerialNumber): OSErr; external name '_GetCurrentProcess';
{
 *  GetFrontProcess()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetFrontProcess(var PSN: ProcessSerialNumber): OSErr; external name '_GetFrontProcess';
{
 *  GetNextProcess()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetNextProcess(var PSN: ProcessSerialNumber): OSErr; external name '_GetNextProcess';
{
 *  GetProcessInformation()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetProcessInformation(const (*var*) PSN: ProcessSerialNumber; var info: ProcessInfoRec): OSErr; external name '_GetProcessInformation';
{
 *  SetFrontProcess()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetFrontProcess(const (*var*) PSN: ProcessSerialNumber): OSErr; external name '_SetFrontProcess';
{
 *  WakeUpProcess()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function WakeUpProcess(const (*var*) PSN: ProcessSerialNumber): OSErr; external name '_WakeUpProcess';
{
 *  SameProcess()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SameProcess(const (*var*) PSN1: ProcessSerialNumber; const (*var*) PSN2: ProcessSerialNumber; var result: boolean): OSErr; external name '_SameProcess';
{   ExitToShell was previously in SegLoad.h }
{
 *  ExitToShell()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure ExitToShell; external name '_ExitToShell';
{
   LaunchControlPanel is similar to LaunchDeskAccessory, but for Control Panel files instead.
   It launches a control panel in an application shell maintained by the Process Manager.
}

{
 *  GetApplicationTextEncoding()
 *
 *  Summary:
 *    Returns the application text encoding for Resource Manager
 *    resources.
 *
 *  Discussion:
 *    The application text encoding is used when you create a
 *    CFStringRef from text stored in Resource Manager resources, which
 *    typically uses one of the Mac encodings such as MacRoman or
 *    MacJapanese.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetApplicationTextEncoding: TextEncoding; external name '_GetApplicationTextEncoding';

{
 *  GetApplicationScript()
 *
 *  Summary:
 *    Returns the application script.
 *
 *  Discussion:
 *    The application script is used when you need a ScriptCode to pass
 *    to some other API, such as UseThemeFont.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetApplicationScript: ScriptCode; external name '_GetApplicationScript';

{
 *  GetProcessBundleLocation()
 *
 *  Summary:
 *    Retrieve the filesystem location of the process bundle, or
 *    executable if unbundled.
 *
 *  Discussion:
 *    Retrieves a reference to the filesystem location of the specified
 *    application.  For an application that is packaged as an app
 *    bundle, this will be the app bundle directory; otherwise it will
 *    be the location of the executable itself.
 *
 *  Parameters:
 *
 *    psn:
 *      Serial number of the target process
 *
 *    location:
 *      Location of the bundle or executable, as an FSRef
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.5 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetProcessBundleLocation(const (*var*) psn: ProcessSerialNumber; var location: FSRef): OSStatus; external name '_GetProcessBundleLocation';

{
 *  CopyProcessName()
 *
 *  Summary:
 *    Get a copy of the name of a process.
 *
 *  Discussion:
 *    Use this call to get the name of a process as a CFString.  The
 *    name returned is a copy, so the caller must CFRelease the name
 *    when finished with it.  The difference between this call and the
 *    processName field filled in by GetProcessInformation is that the
 *    name here is a CFString, and thus is capable of representing a
 *    multi-lingual name, whereas previously only a mac-encoded string
 *    was possible.
 *
 *  Parameters:
 *
 *    psn:
 *      Serial number of the target process
 *
 *    name:
 *      CFString representing the name of the process (must be released
 *      by caller with CFRelease)
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.5 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CopyProcessName(const (*var*) psn: ProcessSerialNumber; var name: CFStringRef): OSStatus; external name '_CopyProcessName';

{************************************************************************
 *  Process Visibility.
 ************************************************************************}
{
 *  IsProcessVisible()
 *
 *  Summary:
 *    Determines whether a particular process is visible or not.
 *
 *  Discussion:
 *    Given a psn, this call will return true or false depending on
 *    whether or not the process is currently visible.
 *
 *  Parameters:
 *
 *    psn:
 *      Serial number of the process
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.5 and later
 *    Mac OS X:         in version 10.1 and later
 }
function IsProcessVisible(const (*var*) psn: ProcessSerialNumber): boolean; external name '_IsProcessVisible';
{
 *  ShowHideProcess()
 *
 *  Summary:
 *    Hides or shows a given process.
 *
 *  Discussion:
 *    Given a psn, this call will hide or show the process specified in
 *    the psn parameter. You determine whether you would like to show
 *    or hide the process with the visible parameter. True passed into
 *    visible indicates you wish for the process to become visible.
 *
 *  Parameters:
 *
 *    psn:
 *      Serial number of the process
 *
 *    visible:
 *      true = show process; false = hide process
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.5 and later
 *    Mac OS X:         in version 10.1 and later
 }
function ShowHideProcess(const (*var*) psn: ProcessSerialNumber; visible: boolean): OSErr; external name '_ShowHideProcess';
{ Values of the 'message' parameter to a Control Panel 'cdev' }

const
    initDev                     = 0;                            { Time for cdev to initialize itself }
    hitDev                      = 1;                            { Hit on one of my items }
    closeDev                    = 2;                            { Close yourself }
    nulDev                      = 3;                            { Null event }
    updateDev                   = 4;                            { Update event }
    activDev                    = 5;                            { Activate event }
    deactivDev                  = 6;                            { Deactivate event }
    keyEvtDev                   = 7;                            { Key down/auto key }
    macDev                      = 8;                            { Decide whether or not to show up }
    undoDev                     = 9;
    cutDev                      = 10;
    copyDev                     = 11;
    pasteDev                    = 12;
    clearDev                    = 13;
    cursorDev                   = 14;

    {    Special values a Control Panel 'cdev' can return   }
    cdevGenErr                  = -1;                           { General error; gray cdev w/o alert }
    cdevMemErr                  = 0;                            { Memory shortfall; alert user please }
    cdevResErr                  = 1;                            { Couldn't get a needed resource; alert }
    cdevUnset                   = 3;                            {  cdevValue is initialized to this }

    {    Control Panel Default Proc     }

type
    ControlPanelDefProcPtr = function(message: SInt16; item: SInt16; numItems: SInt16; cPanelID: SInt16; var theEvent: EventRecord; cdevValue: SInt32; cpDialog: DialogPtr): SInt32;

    ControlPanelDefUPP = ^SInt32; { an opaque UPP }

const
    uppControlPanelDefProcInfo = $000FEAB0;


{$ALIGN MAC68K}
{#POP}
{unit QDOffscreen}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}

{
    NOTE:   GWorldFlags is no longer defined as a set.  Instead it is a SInt32
            and the set elements are bit masks.  You will need to use Bit-OR's
            to build a set and Bit-AND's to test sets.
}

const
    pixPurgeBit                 = 0;
    noNewDeviceBit              = 1;
    useTempMemBit               = 2;
    keepLocalBit                = 3;
    useDistantHdwrMemBit        = 4;
    useLocalHdwrMemBit          = 5;
    pixelsPurgeableBit          = 6;
    pixelsLockedBit             = 7;
    mapPixBit                   = 16;
    newDepthBit                 = 17;
    alignPixBit                 = 18;
    newRowBytesBit              = 19;
    reallocPixBit               = 20;
    clipPixBit                  = 28;
    stretchPixBit               = 29;
    ditherPixBit                = 30;
    gwFlagErrBit                = 31;

    pixPurge                    = $00000001;
    noNewDevice                 = $00000002;
    useTempMem                  = $00000004;
    keepLocal                   = $00000008;
    useDistantHdwrMem           = $00000010;
    useLocalHdwrMem             = $00000020;
    pixelsPurgeable             = $00000040;
    pixelsLocked                = $00000080;
    kAllocDirectDrawSurface     = $00004000;
    mapPix                      = $00010000;
    newDepth                    = $00020000;
    alignPix                    = $00040000;
    newRowBytes                 = $00080000;
    reallocPix                  = $00100000;
    clipPix                     = $10000000;
    stretchPix                  = $20000000;
    ditherPix                   = $40000000;
    gwFlagErr                   = $80000000;


type
    GWorldFlags                         = UInt32;
    {    Type definition of a GWorldPtr     }
    GWorldPtr                           = CGrafPtr;
    {
     *  NewGWorld()
     *
     *  Availability:
     *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function NewGWorld(var offscreenGWorld: GWorldPtr; PixelDepth: SInt16; const (*var*) boundsRect: Rect; cTable: CTabHandle; aGDevice: GDHandle; flags: GWorldFlags): QDErr; external name '_NewGWorld';
{  GDevice attribute bits for Carbon and QuickTime 3.0 }

const
    deviceIsIndirect            = $00000001;
    deviceNeedsLock             = $00000002;
    deviceIsStatic              = $00000004;
    deviceIsExternalBuffer      = $00000008;
    deviceIsDDSurface           = $00000010;
    deviceIsDCISurface          = $00000020;
    deviceIsGDISurface          = $00000040;
    deviceIsAScreen             = $00000080;
    deviceIsOverlaySurface      = $00000100;


{
 *  NewGWorldFromPtr()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewGWorldFromPtr(var offscreenGWorld: GWorldPtr; PixelFormat: UInt32; const (*var*) boundsRect: Rect; cTable: CTabHandle; aGDevice: GDHandle; flags: GWorldFlags; newBuffer: Ptr; rowBytes: SInt32): QDErr; external name '_NewGWorldFromPtr';

{
 *  LockPixels()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function LockPixels(pm: PixMapHandle): boolean; external name '_LockPixels';
{
 *  UnlockPixels()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure UnlockPixels(pm: PixMapHandle); external name '_UnlockPixels';
{
 *  UpdateGWorld()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function UpdateGWorld(var offscreenGWorld: GWorldPtr; pixelDepth: SInt16; const (*var*) boundsRect: Rect; cTable: CTabHandle; aGDevice: GDHandle; flags: GWorldFlags): GWorldFlags; external name '_UpdateGWorld';
{
 *  DisposeGWorld()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeGWorld(offscreenGWorld: GWorldPtr); external name '_DisposeGWorld';
{
 *  GetGWorld()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure GetGWorld(var port: CGrafPtr; var gdh: GDHandle); external name '_GetGWorld';
{
 *  SetGWorld()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetGWorld(port: CGrafPtr; gdh: GDHandle); external name '_SetGWorld';
{
 *  CTabChanged()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CTabChanged(ctab: CTabHandle); external name '_CTabChanged';
{
 *  PixPatChanged()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure PixPatChanged(ppat: PixPatHandle); external name '_PixPatChanged';
{
 *  PortChanged()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure PortChanged(port: GrafPtr); external name '_PortChanged';
{
 *  GDeviceChanged()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure GDeviceChanged(gdh: GDHandle); external name '_GDeviceChanged';
{
 *  AllowPurgePixels()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure AllowPurgePixels(pm: PixMapHandle); external name '_AllowPurgePixels';
{
 *  NoPurgePixels()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure NoPurgePixels(pm: PixMapHandle); external name '_NoPurgePixels';
{
 *  GetPixelsState()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetPixelsState(pm: PixMapHandle): GWorldFlags; external name '_GetPixelsState';
{
 *  SetPixelsState()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetPixelsState(pm: PixMapHandle; state: GWorldFlags); external name '_SetPixelsState';
{
 *  GetPixBaseAddr()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetPixBaseAddr(pm: PixMapHandle): Ptr; external name '_GetPixBaseAddr';
{
 *  GetPixRowBytes()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetPixRowBytes(pm: PixMapHandle): SInt32; external name '_GetPixRowBytes';
{
 *  NewScreenBuffer()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewScreenBuffer(const (*var*) globalRect: Rect; purgeable: boolean; var gdh: GDHandle; var offscreenPixMap: PixMapHandle): QDErr; external name '_NewScreenBuffer';
{
 *  DisposeScreenBuffer()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeScreenBuffer(offscreenPixMap: PixMapHandle); external name '_DisposeScreenBuffer';
{
 *  GetGWorldDevice()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetGWorldDevice(offscreenGWorld: GWorldPtr): GDHandle; external name '_GetGWorldDevice';
{
 *  QDDone()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function QDDone(port: GrafPtr): boolean; external name '_QDDone';
{
 *  OffscreenVersion()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OffscreenVersion: SInt32; external name '_OffscreenVersion';
{
 *  NewTempScreenBuffer()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewTempScreenBuffer(const (*var*) globalRect: Rect; purgeable: boolean; var gdh: GDHandle; var offscreenPixMap: PixMapHandle): QDErr; external name '_NewTempScreenBuffer';
{
 *  PixMap32Bit()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PixMap32Bit(pmHandle: PixMapHandle): boolean; external name '_PixMap32Bit';
{
 *  GetGWorldPixMap()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetGWorldPixMap(offscreenGWorld: GWorldPtr): PixMapHandle; external name '_GetGWorldPixMap';
{$ALIGN MAC68K}
{#POP}
{unit Translation}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}

{  enumerated types on how a document can be opened }

type
    DocOpenMethod                       = SInt16;

const
    domCannot                   = 0;
    domNative                   = 1;
    domTranslateFirst           = 2;
    domWildcard                 = 3;

    {  0L terminated array of OSTypes, or FileTypes }

type
    TypesBlock                          = array [0..63] of OSType;
    TypesBlockPtr                       = ^OSType;
    {  Progress dialog resource ID }

const
    kTranslationScrapProgressDialogID = -16555;

    {  block of data that describes how to translate }

type
    FileTranslationSpecPtr = ^FileTranslationSpec;
    FileTranslationSpec = record
        componentSignature:     OSType;
        translationSystemInfo:  Ptr;
        src:                    FileTypeSpec;
        dst:                    FileTypeSpec;
    end;

    FileTranslationSpecArray            = array [0..0] of FileTranslationSpec;
    FileTranslationSpecArrayPtr         = ^FileTranslationSpecArray;
    FileTranslationSpecArrayHandle      = ^FileTranslationSpecArrayPtr;

    {   ****************************************************************************************
    *
    *   GetFileTypesThatAppCanNativelyOpen
    *
    *  This routine returns a list of all FileTypes that an application can open by itself
    *
    *  Enter:   appVRefNumHint      volume where application resides (can be wrong, and if is, will be used as a starting point)
    *           appSignature        signature (creator) of application
    *           nativeTypes         pointer to a buffer to be filled with up to 64 FileTypes
    *
    *  Exit:    nativeTypes         zero terminated array of FileTypes that can be opened by app
        }
    {
     *  GetFileTypesThatAppCanNativelyOpen()
     *
     *  Availability:
     *    Non-Carbon CFM:   in Translation 1.0 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function GetFileTypesThatAppCanNativelyOpen(appVRefNumHint: SInt16; appSignature: OSType; var nativeTypes: TypesBlock): OSErr; external name '_GetFileTypesThatAppCanNativelyOpen';
{****************************************************************************************
*
*  ExtendFileTypeList
*
*  This routine makes a new list of file types that can be translated into a type in the given list
*  Used by StandardFile
*
*  Enter:   originalTypeList        pointer to list of file types that can be opened
*           numberOriginalTypes     number of file types in orgTypeList
*           extendedTypeList        pointer to a buffer to be filled with file types
*           numberExtendedTypes     max number of file types that can be put in extendedTypeList
*
*  Exit:    extendedTypeList        buffer filled in with file types that can be translated
*           numberExtendedTypes     number of file types put in extendedTypeList
}
{
 *  ExtendFileTypeList()
 *
 *  Availability:
 *    Non-Carbon CFM:   in Translation 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ExtendFileTypeList(originalTypeList: FileTypePtr; numberOriginalTypes: SInt16; extendedTypeList: FileTypePtr; var numberExtendedTypes: SInt16): OSErr; external name '_ExtendFileTypeList';
{****************************************************************************************
*
*
*  This routine checks if a file can be opened by a particular application.
*  If so, it returns if it needs to be translated first, and if so then how.
*  The FileTypes that the app can open are specified by nativelyOpenableTypes,
*  or if it is NULL, GetFileTypesThatAppCanNativelyOpen is called.
*
*  Enter:   targetDocument      document to check if it can be opened
*           appVRefNumHint      vRefNum of application to open doc ( can be wrong, and if is, will be used as a starting point)
*           appSignature        signature (creator) of application to open doc
*           nativeTypes         zero terminated list of FileTypes app can open natively, or NULL to use default list
*           onlyNative          whether to consider if document can be translated before opening
*           howToOpen           pointer to buffer in which to put how the document can be opened
*           howToTranslate      pointer to buffer in which to put a FileTranslationSpec record
*
*  Exit:    howToOpen           whether file needs to be translated to be read
*           howToTranslate      if file can be translated, buffer filled in with how to translate
*           returns             noErr, noPrefAppErr
}
{
 *  CanDocBeOpened()
 *
 *  Availability:
 *    Non-Carbon CFM:   in Translation 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CanDocBeOpened(const (*var*) targetDocument: FSSpec; appVRefNumHint: SInt16; appSignature: OSType; nativeTypes: FileTypePtr; onlyNative: boolean; var howToOpen: DocOpenMethod; var howToTranslate: FileTranslationSpec): OSErr; external name '_CanDocBeOpened';
{****************************************************************************************
*
*  GetFileTranslationPaths
*
*  This routine returns a list of all ways a translation can occure to or from a FileType.
*  The app is checked to exist.  The hint for each app is the VRefNum and DTRefNum
*
*  Enter:   srcDoc          source file or NULL for all matches
*           dstDoc          destination FileType or 0 for all matches
*           maxResultCount
*           resultBuffer
*  Exit:    number of paths
}
{
 *  GetFileTranslationPaths()
 *
 *  Availability:
 *    Non-Carbon CFM:   in Translation 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetFileTranslationPaths(const (*var*) srcDocument: FSSpec; dstDocType: FileType; maxResultCount: UInt16; resultBuffer: FileTranslationSpecArrayPtr): SInt16; external name '_GetFileTranslationPaths';
{****************************************************************************************
*
*  GetPathFromTranslationDialog
*
*  This routine, with a given document, application, and a passed typelist will display the
*  Macintosh Easy Open translation dialog allowing the user to make a choice.  The choice
*  made will be written as a preference (so the next call to CanDocBeOpened() will work).
*  The routine returns the translation path information.
*
*  Enter:   theDocument         FSSpec to document to open
*           theApplication      FSSpec to application to open document
*           typeList            Nil terminated list of FileType's (e.g. SFTypeList-like) of types
*                               you would like the documented translated to.  Order most perferred
*                               to least.
*
*  Exit:    howToOpen           Translation method needed to open document
*           howToTranslate      Translation specification
*           returns             Any errors that might occur.
}
{
 *  GetPathFromTranslationDialog()
 *
 *  Availability:
 *    Non-Carbon CFM:   in Translation 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetPathFromTranslationDialog(const (*var*) theDocument: FSSpec; const (*var*) theApplication: FSSpec; typeList: TypesBlockPtr; var howToOpen: DocOpenMethod; var howToTranslate: FileTranslationSpec): OSErr; external name '_GetPathFromTranslationDialog';
{****************************************************************************************
*
*   TranslateFile
*
*  This routine reads a file of one format and writes it to another file in another format.
*  The information on how to translated is generated by the routine CanDocBeOpened.
*  TranslateFile calls through to the TranslateFile Extension's DoTranslateFile routine.
*  The destination file must not exist.  It is created by this routine.
*
*  Enter:   sourceDocument          input file to translate
*           destinationDocument     output file of translation
*           howToTranslate          pointer to info on how to translate
*  Exit:    returns                 noErr, badTranslationSpecErr
}
{
 *  TranslateFile()
 *
 *  Availability:
 *    Non-Carbon CFM:   in Translation 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TranslateFile(const (*var*) sourceDocument: FSSpec; const (*var*) destinationDocument: FSSpec; const (*var*) howToTranslate: FileTranslationSpec): OSErr; external name '_TranslateFile';
{****************************************************************************************
*
*   GetDocumentKindString
*
*  This routine returns the string the Finder should show for the "kind" of a document
*  in the GetInfo window and in the kind column of a list view.
*
*  Enter:   docVRefNum      The volume containing the document
*           docType         The catInfo.fdType of the document
*           docCreator      The catInfo.fdCreator of the document
*           kindString      pointer to where to return the string
*
*  Exit:    kindString      pascal string.  Ex: "\pSurfCalc spreadsheet"
*           returns         noErr, or afpItemNoFound if kind could not be determined
}
{
 *  GetDocumentKindString()
 *
 *  Availability:
 *    Non-Carbon CFM:   in Translation 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetDocumentKindString(docVRefNum: SInt16; docType: OSType; docCreator: OSType; var kindString: Str63): OSErr; external name '_GetDocumentKindString';
{****************************************************************************************
*
*  GetTranslationExtensionName
*
*  This routine returns the translation system name from a specified TranslationSpec
*
*  Enter:   translationMethod   The translation path to get the translation name from
*
*  Exit:    extensionName       The name of the translation system
*           returns             Any errors that might occur
}
{
 *  GetTranslationExtensionName()
 *
 *  Availability:
 *    Non-Carbon CFM:   in Translation 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetTranslationExtensionName(const (*var*) translationMethod: FileTranslationSpec; var extensionName: Str31): OSErr; external name '_GetTranslationExtensionName';
{****************************************************************************************
*
*  GetScrapDataProcPtr
*
*  This is a prototype for the function you must supply to TranslateScrap. It is called to
*  get the data to be translated.  The first call TranslateScrap will make to this is to
*  ask for the 'fmts' data.  That is a special.   You should resize and fill in the handle
*  with a list all the formats that you have available to be translated, and the length of each.
*  (See I.M. VI 4-23 for details of 'fmts').  It will then be called again asking for one of
*  the formats that 'fmts' list said was available.
*
*  Enter:   requestedFormat         Format of data that TranslateScrap needs.
*           dataH                   Handle in which to put the requested data
*           srcDataGetterRefCon     Extra parameter for you passed to TranslateScrap
*
*  Exit:    dataH                   Handle is resized and filled with data in requested format
}

type
    GetScrapDataProcPtr = function(requestedFormat: ScrapType; dataH: Handle; srcDataGetterRefCon: UnivPtr): OSErr;

    GetScrapDataUPP = ^SInt32; { an opaque UPP }

const
    uppGetScrapDataProcInfo = $00000FE0;
    {
     *  NewGetScrapDataUPP()
     *
     *  Availability:
     *    Non-Carbon CFM:   available as macro/inline
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function NewGetScrapDataUPP(userRoutine: GetScrapDataProcPtr): GetScrapDataUPP; external name '_NewGetScrapDataUPP'; { old name was NewGetScrapDataProc }
{
 *  DisposeGetScrapDataUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeGetScrapDataUPP(userUPP: GetScrapDataUPP); external name '_DisposeGetScrapDataUPP';
{
 *  InvokeGetScrapDataUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeGetScrapDataUPP(requestedFormat: ScrapType; dataH: Handle; srcDataGetterRefCon: UnivPtr; userRoutine: GetScrapDataUPP): OSErr; external name '_InvokeGetScrapDataUPP'; { old name was CallGetScrapDataProc }
type
    GetScrapData                        = GetScrapDataUPP;
    {   ****************************************************************************************
    *
    *  TranslateScrap
    *
    *  This routine resizes the destination handle and fills it with data of the requested format.
    *  The data is generated by translated one or more source formats of data supplied by
    *  the procedure srcDataGetter.
    *  This routine is automatically called by GetScrap and ReadEdition.  You only need to call
    *  this if you need to translated scrap style data, but are not using the ScrapMgr or EditionMgr.
    *
    *  Enter:   sourceDataGetter            Pointer to routine that can get src data
    *           sourceDataGetterRefCon      Extra parameter for dataGetter
    *           destinationFormat           Format of data desired
    *           destinationData             Handle in which to store translated data
    *
    *  Exit:    dstData                     Handle is resized and filled with data in requested format
        }
    {
     *  TranslateScrap()
     *
     *  Availability:
     *    Non-Carbon CFM:   in Translation 1.0 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function TranslateScrap(sourceDataGetter: GetScrapDataUPP; sourceDataGetterRefCon: UnivPtr; destinationFormat: ScrapType; destinationData: Handle; progressDialogID: SInt16): OSErr; external name '_TranslateScrap';
{$ALIGN MAC68K}
{#POP}
{unit TypeSelect}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}


type
    TSCode                      = SInt16;
const
    tsPreviousSelectMode        = -1;
    tsNormalSelectMode          = 0;
    tsNextSelectMode            = 1;


type
    TypeSelectRecordPtr = ^TypeSelectRecord;
    TypeSelectRecord = record
        tsrLastKeyTime:         UInt32;
        tsrScript:              ScriptCode;
        tsrKeyStrokes:          Str63;
    end;

    IndexToStringProcPtr = function(item: SInt16; var itemsScript: ScriptCode; var itemsStringPtr: StringPtr; yourDataPtr: UnivPtr): boolean;

    IndexToStringUPP = ^SInt32; { an opaque UPP }
    {
     *  TypeSelectClear()
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
procedure TypeSelectClear(var tsr: TypeSelectRecord); external name '_TypeSelectClear';
{
        Long ago the implementation of TypeSelectNewKey had a bug that
        required the high word of D0 to be zero or the function did not work.
        Although fixed now, we are continuing to clear the high word
        just in case someone tries to run on an older system.
    }
{
 *  TypeSelectNewKey()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TypeSelectNewKey(const (*var*) theEvent: EventRecord; var tsr: TypeSelectRecord): boolean; external name '_TypeSelectNewKey';
{
 *  TypeSelectFindItem()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TypeSelectFindItem(const (*var*) tsr: TypeSelectRecord; listSize: SInt16; selectMode: TSCode; getStringProc: IndexToStringUPP; yourDataPtr: UnivPtr): SInt16; external name '_TypeSelectFindItem';
{
 *  TypeSelectCompare()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TypeSelectCompare(const (*var*) tsr: TypeSelectRecord; testStringScript: ScriptCode; testStringPtr: StringPtr): SInt16; external name '_TypeSelectCompare';
const
    uppIndexToStringProcInfo = $00003F90;
    {
     *  NewIndexToStringUPP()
     *
     *  Availability:
     *    Non-Carbon CFM:   available as macro/inline
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function NewIndexToStringUPP(userRoutine: IndexToStringProcPtr): IndexToStringUPP; external name '_NewIndexToStringUPP'; { old name was NewIndexToStringProc }
{
 *  DisposeIndexToStringUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeIndexToStringUPP(userUPP: IndexToStringUPP); external name '_DisposeIndexToStringUPP';
{
 *  InvokeIndexToStringUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeIndexToStringUPP(item: SInt16; var itemsScript: ScriptCode; var itemsStringPtr: StringPtr; yourDataPtr: UnivPtr; userRoutine: IndexToStringUPP): boolean; external name '_InvokeIndexToStringUPP'; { old name was CallIndexToStringProc }
{$ALIGN MAC68K}
{#POP}
{unit URLAccess}
{$ALIGN MAC68K}








{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}

{ Data structures and types }

type
    URLReference    = ^SInt32; { an opaque 32-bit type }
    URLReferencePtr = ^URLReference;  { when a var xx:URLReference parameter can be nil, it is changed to xx: URLReferencePtr }
    URLOpenFlags                = UInt32;
const
    kURLReplaceExistingFlag     = $01;
    kURLBinHexFileFlag          = $02;                          {  Binhex before uploading if necessary }
    kURLExpandFileFlag          = $04;                          {  Use StuffIt engine to expand file if necessary }
    kURLDisplayProgressFlag     = $08;
    kURLDisplayAuthFlag         = $10;                          {  Display auth dialog if guest connection fails }
    kURLUploadFlag              = $20;                          {  Do an upload instead of a download }
    kURLIsDirectoryHintFlag     = $40;                          {  Hint: the URL is a directory }
    kURLDoNotTryAnonymousFlag   = $80;                          {  Don't try to connect anonymously before getting logon info }
    kURLDirectoryListingFlag    = $0100;                        {  Download the directory listing, not the whole directory }
    kURLExpandAndVerifyFlag     = $0200;                        {  Expand file and then verify using signature resource }
    kURLNoAutoRedirectFlag      = $0400;                        {  Do not automatically redirect to new URL }
    kURLDebinhexOnlyFlag        = $0800;                        {  Do not use Stuffit Expander - just internal debinhex engine }
    kURLDoNotDeleteOnErrorFlag  = $1000;                        {  Do not delete the downloaded file if an error or abort occurs. }
                                                                {  This flag applies to downloading only and should be used if }
                                                                {  interested in later resuming the download. }
    kURLResumeDownloadFlag      = $2000;                        {  The passed in file is partially downloaded, attempt to resume }
                                                                {  it.  Currently works for HTTP only.  If no FSSpec passed in, }
                                                                {  this flag will be ignored. Overriden by kURLReplaceExistingFlag.  }
    kURLReservedFlag            = $80000000;                    {  reserved for Apple internal use }


type
    URLState                    = UInt32;
const
    kURLNullState               = 0;
    kURLInitiatingState         = 1;
    kURLLookingUpHostState      = 2;
    kURLConnectingState         = 3;
    kURLResourceFoundState      = 4;
    kURLDownloadingState        = 5;
    kURLDataAvailableState      = $15;
    kURLTransactionCompleteState = 6;
    kURLErrorOccurredState      = 7;
    kURLAbortingState           = 8;
    kURLCompletedState          = 9;
    kURLUploadingState          = 10;


type
    URLEvent                    = UInt32;
const
    kURLInitiatedEvent          = 1;
    kURLResourceFoundEvent      = 4;
    kURLDownloadingEvent        = 5;
    kURLAbortInitiatedEvent     = 8;
    kURLCompletedEvent          = 9;
    kURLErrorOccurredEvent      = 7;
    kURLDataAvailableEvent      = $15;
    kURLTransactionCompleteEvent = 6;
    kURLUploadingEvent          = 10;
    kURLSystemEvent             = 29;
    kURLPercentEvent            = 30;
    kURLPeriodicEvent           = 31;
    kURLPropertyChangedEvent    = 32;


type
    URLEventMask                        = UInt32;

const
    kURLInitiatedEventMask      = $01;
    kURLResourceFoundEventMask  = $08;
    kURLDownloadingMask         = $10;
    kURLUploadingMask           = $0200;
    kURLAbortInitiatedMask      = $80;
    kURLCompletedEventMask      = $0100;
    kURLErrorOccurredEventMask  = $40;
    kURLDataAvailableEventMask  = $00100000;
    kURLTransactionCompleteEventMask = $20;
    kURLSystemEventMask         = $10000000;
    kURLPercentEventMask        = $20000000;
    kURLPeriodicEventMask       = $40000000;
    kURLPropertyChangedEventMask = $80000000;
    kURLAllBufferEventsMask     = $00100020;
    kURLAllNonBufferEventsMask  = $E00003D1;
    kURLAllEventsMask           = $FFFFFFFF;



type
    URLCallbackInfoPtr = ^URLCallbackInfo;
    URLCallbackInfo = record
        version:                UInt32;
        urlRef:                 URLReference;
        proprty:                ConstCStringPtr;
        currentSize:            UInt32;
        systemEvent:            EventRecordPtr;
    end;


    {  authentication type flags }

const
    kUserNameAndPasswordFlag    = $00000001;

    kURLURL                     = 'URLString';
    kURLResourceSize            = 'URLResourceSize';
    kURLLastModifiedTime        = 'URLLastModifiedTime';
    kURLMIMEType                = 'URLMIMEType';
    kURLFileType                = 'URLFileType';
    kURLFileCreator             = 'URLFileCreator';
    kURLCharacterSet            = 'URLCharacterSet';
    kURLResourceName            = 'URLResourceName';
    kURLHost                    = 'URLHost';
    kURLAuthType                = 'URLAuthType';
    kURLUserName                = 'URLUserName';
    kURLPassword                = 'URLPassword';
    kURLStatusString            = 'URLStatusString';
    kURLIsSecure                = 'URLIsSecure';
    kURLCertificate             = 'URLCertificate';
    kURLTotalItems              = 'URLTotalItems';
    kURLConnectTimeout          = 'URLConnectTimeout';
    {  http and https properties }
    kURLHTTPRequestMethod       = 'URLHTTPRequestMethod';
    kURLHTTPRequestHeader       = 'URLHTTPRequestHeader';
    kURLHTTPRequestBody         = 'URLHTTPRequestBody';
    kURLHTTPRespHeader          = 'URLHTTPRespHeader';
    kURLHTTPUserAgent           = 'URLHTTPUserAgent';
    kURLHTTPRedirectedURL       = 'URLHTTPRedirectedURL';
    kURLSSLCipherSuite          = 'URLSSLCipherSuite';




    {
     *  URLGetURLAccessVersion()
     *
     *  Availability:
     *    Non-Carbon CFM:   in URLAccessLib 1.0 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function URLGetURLAccessVersion(var returnVers: UInt32): OSStatus; external name '_URLGetURLAccessVersion';


{ URL Access is always available on OS X }


type
    URLNotifyProcPtr = function(userContext: UnivPtr; event: URLEvent; var callbackInfo: URLCallbackInfo): OSStatus;

    URLSystemEventProcPtr = function(userContext: UnivPtr; var event: EventRecord): OSStatus;

    URLNotifyUPP = ^SInt32; { an opaque UPP }
    URLSystemEventUPP = ^SInt32; { an opaque UPP }

const
    uppURLNotifyProcInfo = $00000FF0;
    uppURLSystemEventProcInfo = $000003F0;
    {
     *  NewURLNotifyUPP()
     *
     *  Availability:
     *    Non-Carbon CFM:   available as macro/inline
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function NewURLNotifyUPP(userRoutine: URLNotifyProcPtr): URLNotifyUPP; external name '_NewURLNotifyUPP';
{
 *  NewURLSystemEventUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewURLSystemEventUPP(userRoutine: URLSystemEventProcPtr): URLSystemEventUPP; external name '_NewURLSystemEventUPP';
{
 *  DisposeURLNotifyUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeURLNotifyUPP(userUPP: URLNotifyUPP); external name '_DisposeURLNotifyUPP';
{
 *  DisposeURLSystemEventUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeURLSystemEventUPP(userUPP: URLSystemEventUPP); external name '_DisposeURLSystemEventUPP';
{
 *  InvokeURLNotifyUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeURLNotifyUPP(userContext: UnivPtr; event: URLEvent; var callbackInfo: URLCallbackInfo; userRoutine: URLNotifyUPP): OSStatus; external name '_InvokeURLNotifyUPP';
{
 *  InvokeURLSystemEventUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeURLSystemEventUPP(userContext: UnivPtr; var event: EventRecord; userRoutine: URLSystemEventUPP): OSStatus; external name '_InvokeURLSystemEventUPP';
{
 *  URLSimpleDownload()
 *
 *  Availability:
 *    Non-Carbon CFM:   in URLAccessLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function URLSimpleDownload(url: ConstCStringPtr; destination: FSSpecPtr; destinationHandle: Handle; openFlags: URLOpenFlags; eventProc: URLSystemEventUPP; userContext: UnivPtr): OSStatus; external name '_URLSimpleDownload';

{
 *  URLDownload()
 *
 *  Availability:
 *    Non-Carbon CFM:   in URLAccessLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function URLDownload(urlRef: URLReference; destination: FSSpecPtr; destinationHandle: Handle; openFlags: URLOpenFlags; eventProc: URLSystemEventUPP; userContext: UnivPtr): OSStatus; external name '_URLDownload';

{
 *  URLSimpleUpload()
 *
 *  Availability:
 *    Non-Carbon CFM:   in URLAccessLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function URLSimpleUpload(url: ConstCStringPtr; const (*var*) source: FSSpec; openFlags: URLOpenFlags; eventProc: URLSystemEventUPP; userContext: UnivPtr): OSStatus; external name '_URLSimpleUpload';

{
 *  URLUpload()
 *
 *  Availability:
 *    Non-Carbon CFM:   in URLAccessLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function URLUpload(urlRef: URLReference; const (*var*) source: FSSpec; openFlags: URLOpenFlags; eventProc: URLSystemEventUPP; userContext: UnivPtr): OSStatus; external name '_URLUpload';

{
 *  URLNewReference()
 *
 *  Availability:
 *    Non-Carbon CFM:   in URLAccessLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function URLNewReference(url: ConstCStringPtr; var urlRef: URLReference): OSStatus; external name '_URLNewReference';

{
 *  URLDisposeReference()
 *
 *  Availability:
 *    Non-Carbon CFM:   in URLAccessLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function URLDisposeReference(urlRef: URLReference): OSStatus; external name '_URLDisposeReference';

{
 *  URLOpen()
 *
 *  Availability:
 *    Non-Carbon CFM:   in URLAccessLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function URLOpen(urlRef: URLReference; fileSpec: FSSpecPtr; openFlags: URLOpenFlags; notifyProc: URLNotifyUPP; eventRegister: URLEventMask; userContext: UnivPtr): OSStatus; external name '_URLOpen';

{
 *  URLAbort()
 *
 *  Availability:
 *    Non-Carbon CFM:   in URLAccessLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function URLAbort(urlRef: URLReference): OSStatus; external name '_URLAbort';

{
 *  URLGetDataAvailable()
 *
 *  Availability:
 *    Non-Carbon CFM:   in URLAccessLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function URLGetDataAvailable(urlRef: URLReference; var dataSize: Size): OSStatus; external name '_URLGetDataAvailable';

{
 *  URLGetBuffer()
 *
 *  Availability:
 *    Non-Carbon CFM:   in URLAccessLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function URLGetBuffer(urlRef: URLReference; var buffer: UnivPtr; var bufferSize: Size): OSStatus; external name '_URLGetBuffer';

{
 *  URLReleaseBuffer()
 *
 *  Availability:
 *    Non-Carbon CFM:   in URLAccessLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function URLReleaseBuffer(urlRef: URLReference; buffer: UnivPtr): OSStatus; external name '_URLReleaseBuffer';

{
 *  URLGetProperty()
 *
 *  Availability:
 *    Non-Carbon CFM:   in URLAccessLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function URLGetProperty(urlRef: URLReference; proprty: ConstCStringPtr; propertyBuffer: UnivPtr; bufferSize: Size): OSStatus; external name '_URLGetProperty';

{
 *  URLGetPropertySize()
 *
 *  Availability:
 *    Non-Carbon CFM:   in URLAccessLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function URLGetPropertySize(urlRef: URLReference; proprty: ConstCStringPtr; var propertySize: Size): OSStatus; external name '_URLGetPropertySize';

{
 *  URLSetProperty()
 *
 *  Availability:
 *    Non-Carbon CFM:   in URLAccessLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function URLSetProperty(urlRef: URLReference; proprty: ConstCStringPtr; propertyBuffer: UnivPtr; bufferSize: Size): OSStatus; external name '_URLSetProperty';

{
 *  URLGetCurrentState()
 *
 *  Availability:
 *    Non-Carbon CFM:   in URLAccessLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function URLGetCurrentState(urlRef: URLReference; var state: URLState): OSStatus; external name '_URLGetCurrentState';

{
 *  URLGetError()
 *
 *  Availability:
 *    Non-Carbon CFM:   in URLAccessLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function URLGetError(urlRef: URLReference; var urlError: OSStatus): OSStatus; external name '_URLGetError';

{
 *  URLIdle()
 *
 *  Availability:
 *    Non-Carbon CFM:   in URLAccessLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function URLIdle: OSStatus; external name '_URLIdle';

{
 *  URLGetFileInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in URLAccessLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function URLGetFileInfo(fName: StringPtr; var fType: OSType; var fCreator: OSType): OSStatus; external name '_URLGetFileInfo';

{$ALIGN MAC68K}
{#POP}
{unit USB}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}

{ ************* Constants ************* }


const
                                                                {  Flags  }
    kUSBTaskTimeFlag            = 1;
    kUSBHubPower                = 2;
    kUSBPowerReset              = 4;
    kUSBHubReaddress            = 8;
    kUSBAddressRequest          = 16;
    kUSBReturnOnException       = 32;
    kUSBNo5SecTimeout           = 64;
    kUSBTimeout                 = 128;
    kUSBNoDataTimeout           = 256;
    kUSBDebugAwareFlag          = 512;
    kUSBResetDescriptorCache    = 1024;
    kUSBHighSpeedFlag           = 2048;
    kUSBDevZeroDetatch          = 4096;
    kUSBLowSpeedFlag            = 8192;
    kUSBTaskTimeSetAddressFlag  = 16384;

                                                                {  Hub messages  }
    kUSBHubPortResetRequest     = 1;
    kUSBHubPortSuspendRequest   = 2;
    kUSBHubPortStatusRequest    = 3;

    kVendorID_AppleComputer     = $05AC;

    {    ************* types *************  }


type
    USBReference                        = SInt32;
    USBDeviceRef                        = USBReference;
    USBDeviceRefPtr                     = ^USBDeviceRef;
    USBInterfaceRef                     = USBReference;
    USBPipeRef                          = USBReference;
    USBBusRef                           = USBReference;
    USBPipeState                        = UInt32;
    USBCount                            = UInt32;
    USBFlags                            = UInt32;
    USBRequest                          = UInt8;
    USBDirection                        = UInt8;
    USBRqRecipient                      = UInt8;
    USBRqType                           = UInt8;
    USBRqIndex                          = UInt16;
    USBRqValue                          = UInt16;


    usbControlBitsPtr = ^usbControlBits;
    usbControlBits = record
        BMRequestType:          SInt8;
        BRequest:               SInt8;
        WValue:                 USBRqValue;
        WIndex:                 USBRqIndex;
        reserved4:              UInt16;
    end;

    USBIsocFramePtr = ^USBIsocFrame;
    USBIsocFrame = record
        frStatus:               OSStatus;
        frReqCount:             UInt16;
        frActCount:             UInt16;
    end;


const
    kUSBMaxIsocFrameReqCount    = 1023;                         {  maximum size (bytes) of any one Isoc frame }


type
    usbIsocBitsPtr = ^usbIsocBits;
    usbIsocBits = record
        FrameList:              USBIsocFramePtr;
        NumFrames:              UInt32;
    end;

    usbHubBitsPtr = ^usbHubBits;
    usbHubBits = record
        Request:                UInt32;
        Spare:                  UInt32;
    end;

    USBPBPtr = ^USBPB;
    USBCompletion = procedure(pb: USBPBPtr);

    USBVariantBitsPtr = ^USBVariantBits;
    USBVariantBits = record
        case SInt16 of
        0: (
            cntl:               usbControlBits;
            );
        1: (
            isoc:               usbIsocBits;
            );
        2: (
            hub:                usbHubBits;
            );
    end;

    USBPB = packed record
        qlink:                  Ptr;
        qType:                  UInt16;
        pbLength:               UInt16;
        pbVersion:              UInt16;
        reserved1:              UInt16;
        reserved2:              UInt32;
        usbStatus:              OSStatus;
        usbCompletion:          USBCompletion;
        usbRefcon:              UInt32;
        usbReference:           USBReference;
        usbBuffer:              Ptr;
        usbReqCount:            USBCount;
        usbActCount:            USBCount;
        usbFlags:               USBFlags;
        usb:                    USBVariantBits;
        usbFrame:               UInt32;
        usbClassType:           UInt8;
        usbSubclass:            UInt8;
        usbProtocol:            UInt8;
        usbOther:               UInt8;
        reserved6:              UInt32;
        reserved7:              UInt16;
        reserved8:              UInt16;
    end;

    uslReqPtr = ^uslReq;
    uslReq = record
        usbDirection:           SInt8;
        usbType:                SInt8;
        usbRecipient:           SInt8;
        usbRequest:             SInt8;
    end;



const
                                                                {  BT 19Aug98, bump up to v1.10 for Isoc }
    kUSBCurrentPBVersion        = $0100;                        {  v1.00 }
    kUSBIsocPBVersion           = $0109;                        {  v1.10 }
    kUSBCurrentHubPB            = $0109;




    kUSBNoCallBack              = -1;



type
    bcdUSB                              = UInt8;

const
    kUSBControl                 = 0;
    kUSBIsoc                    = 1;
    kUSBBulk                    = 2;
    kUSBInterrupt               = 3;
    kUSBAnyType                 = $FF;

    {    endpoint type  }
    kUSBOut                     = 0;
    kUSBIn                      = 1;
    kUSBNone                    = 2;
    kUSBAnyDirn                 = 3;

    {   USBDirection    }
    kUSBStandard                = 0;
    kUSBClass                   = 1;
    kUSBVendor                  = 2;

    {   USBRqType   }
    kUSBDevice                  = 0;
    kUSBInterface               = 1;
    kUSBEndpoint                = 2;
    kUSBOther                   = 3;

    {   USBRqRecipient  }
    kUSBRqGetStatus             = 0;
    kUSBRqClearFeature          = 1;
    kUSBRqReserved1             = 2;
    kUSBRqSetFeature            = 3;
    kUSBRqReserved2             = 4;
    kUSBRqSetAddress            = 5;
    kUSBRqGetDescriptor         = 6;
    kUSBRqSetDescriptor         = 7;
    kUSBRqGetConfig             = 8;
    kUSBRqSetConfig             = 9;
    kUSBRqGetInterface          = 10;
    kUSBRqSetInterface          = 11;
    kUSBRqSyncFrame             = 12;

    {   USBRequest  }

    kUSBDeviceDesc              = 1;
    kUSBConfDesc                = 2;
    kUSBStringDesc              = 3;
    kUSBInterfaceDesc           = 4;
    kUSBEndpointDesc            = 5;
    kUSBHIDDesc                 = $21;
    kUSBReportDesc              = $22;
    kUSBPhysicalDesc            = $23;
    kUSBHUBDesc                 = $29;

    {    descriptorType     }

    kUSBFeatureDeviceRemoteWakeup = 1;
    kUSBFeatureEndpointStall    = 0;

    {    Feature selectors  }
    kUSBActive                  = 0;                            {  Pipe can accept new transactions }
    kUSBIdle                    = 1;                            {  Pipe will not accept new transactions }
    kUSBStalled                 = 2;                            {  An error occured on the pipe }
    kUSBSuspended               = 4;                            {  Device is suspended }
    kUSBNoBandwidth             = 8;                            {  (Isoc or Int) Pipe could not be initialised due to bandwidth constraint }

    kUSB100mAAvailable          = 50;
    kUSB500mAAvailable          = 250;
    kUSB100mA                   = 50;
    kUSBAtrBusPowered           = $80;
    kUSBAtrSelfPowered          = $40;
    kUSBAtrRemoteWakeup         = $20;

    kUSBRel10                   = $0100;
    kUSBRel11                   = $0110;
    kUSBRel20                   = $0200;

    kUSBDeviceDescriptorLength  = $12;
    kUSBInterfaceDescriptorLength = $09;
    kUSBConfigDescriptorLength  = $09;


type
    USBDeviceDescriptorPtr = ^USBDeviceDescriptor;
    USBDeviceDescriptor = record
        length:                 SInt8;
        descType:               SInt8;
        usbRel:                 UInt16;
        deviceClass:            SInt8;
        deviceSubClass:         SInt8;
        protocol:               SInt8;
        maxPacketSize:          SInt8;
        vendor:                 UInt16;
        product:                UInt16;
        devRel:                 UInt16;
        manuIdx:                SInt8;
        prodIdx:                SInt8;
        serialIdx:              SInt8;
        numConf:                SInt8;
    end;

    USBDescriptorHeaderPtr = ^USBDescriptorHeader;
    USBDescriptorHeader = record
        length:                 SInt8;
        descriptorType:         SInt8;
    end;

    USBConfigurationDescriptorPtr = ^USBConfigurationDescriptor;
    USBConfigurationDescriptor = packed record
        length:                 UInt8;
        descriptorType:         UInt8;
        totalLength:            UInt16;
        numInterfaces:          UInt8;
        configValue:            UInt8;
        configStrIndex:         UInt8;
        attributes:             UInt8;
        maxPower:               UInt8;
    end;

    USBInterfaceDescriptorPtr = ^USBInterfaceDescriptor;
    USBInterfaceDescriptor = packed record
        length:                 UInt8;
        descriptorType:         UInt8;
        interfaceNumber:        UInt8;
        alternateSetting:       UInt8;
        numEndpoints:           UInt8;
        interfaceClass:         UInt8;
        interfaceSubClass:      UInt8;
        interfaceProtocol:      UInt8;
        interfaceStrIndex:      UInt8;
    end;

    USBEndPointDescriptorPtr = ^USBEndPointDescriptor;
    USBEndPointDescriptor = packed record
        length:                 UInt8;
        descriptorType:         UInt8;
        endpointAddress:        UInt8;
        attributes:             UInt8;
        maxPacketSize:          UInt16;
        interval:               UInt8;
    end;

    USBHIDDescriptorPtr = ^USBHIDDescriptor;
    USBHIDDescriptor = packed record
        descLen:                UInt8;
        descType:               UInt8;
        descVersNum:            UInt16;
        hidCountryCode:         UInt8;
        hidNumDescriptors:      UInt8;
        hidDescriptorType:      UInt8;
        hidDescriptorLengthLo:  UInt8;                                  {  can't make this a single 16bit value or the compiler will add a filler byte }
        hidDescriptorLengthHi:  UInt8;
    end;

    USBHIDReportDescPtr = ^USBHIDReportDesc;
    USBHIDReportDesc = packed record
        hidDescriptorType:      UInt8;
        hidDescriptorLengthLo:  UInt8;                                  {  can't make this a single 16bit value or the compiler will add a filler byte }
        hidDescriptorLengthHi:  UInt8;
    end;

    USBHubPortStatusPtr = ^USBHubPortStatus;
    USBHubPortStatus = record
        portFlags:              UInt16;                                 {  Port status flags  }
        portChangeFlags:        UInt16;                                 {  Port changed flags  }
    end;

    {    ********* ProtoTypes ***************   }
    {    For dealing with endianisms    }


const
    kUSBDevicePower_PowerOK     = 0;
    kUSBDevicePower_BusPowerInsufficient = 1;
    kUSBDevicePower_BusPowerNotAllFeatures = 2;
    kUSBDevicePower_SelfPowerInsufficient = 3;
    kUSBDevicePower_SelfPowerNotAllFeatures = 4;
    kUSBDevicePower_HubPortOk   = 5;
    kUSBDevicePower_HubPortOverCurrent = 6;
    kUSBDevicePower_BusPoweredHubOnLowPowerPort = 7;
    kUSBDevicePower_BusPoweredHubToBusPoweredHub = 8;
    kUSBDevicePower_Reserved3   = 9;
    kUSBDevicePower_Reserved4   = 10;


    {    For hubs only  }


type
    USBLocationID                       = UInt32;

const
    kUSBLocationNibbleFormat    = 0;                            {  Other values are reserved for future types (like when we have more than 16 ports per hub) }


    kNoDeviceRef                = -1;

    {  Status Level constants }
    {
    Level 1: Fatal errors
    Level 2: General errors that may or may not effect operation
    Level 3: General driver messages.  The "AddStatus" call that drivers use comes through as a level 3.  This is also the default level at boot time.
    Level 4: Important status messages from the Expert and USL.
    Level 5: General status messages from the Expert and USL.
        }
    kUSBStatusLevelFatal        = 1;
    kUSBStatusLevelError        = 2;
    kUSBStatusLevelClient       = 3;
    kUSBStatusLevelGeneral      = 4;
    kUSBStatusLevelVerbose      = 5;

    {  Expert Notification Types }

type
    USBNotificationType         = UInt8;
const
    kNotifyAddDevice            = $00;
    kNotifyRemoveDevice         = $01;
    kNotifyAddInterface         = $02;
    kNotifyRemoveInterface      = $03;
    kNotifyGetDeviceDescriptor  = $04;
    kNotifyGetInterfaceDescriptor = $05;
    kNotifyGetNextDeviceByClass = $06;
    kNotifyGetDriverConnectionID = $07;
    kNotifyInstallDeviceNotification = $08;
    kNotifyRemoveDeviceNotification = $09;
    kNotifyDeviceRefToBusRef    = $0A;
    kNotifyDriverNotify         = $0C;
    kNotifyParentNotify         = $0D;
    kNotifyAnyEvent             = $FF;
    kNotifyPowerState           = $17;
    kNotifyStatus               = $18;
    kNotifyFatalError           = $19;
    kNotifyStatusLevel          = $20;


type
    USBDriverMessage                    = USBNotificationType;
    {
       USB Manager wildcard constants for USBGetNextDeviceByClass
       and USBInstallDeviceNotification.
    }
    USBManagerWildcard          = UInt16;
const
    kUSBAnyClass                = $FFFF;
    kUSBAnySubClass             = $FFFF;
    kUSBAnyProtocol             = $FFFF;
    kUSBAnyVendor               = $FFFF;
    kUSBAnyProduct              = $FFFF;




type
    ExpertNotificationDataPtr = ^ExpertNotificationData;
    ExpertNotificationData = record
        notification:           SInt8;
        filler:                 SInt8;                                  {  unused due to 2-byte 68k alignment }
        deviceRef:              USBDeviceRefPtr;
        busPowerAvailable:      UInt32;
        data:                   Ptr;
        info1:                  UInt32;
        info2:                  UInt32;
    end;

    {  Definition of function pointer passed in ExpertEntryProc }
    ExpertNotificationProcPtr = function(pNotificationData: ExpertNotificationDataPtr): OSStatus;

    {  Definition of expert's callback installation function }
    ExpertEntryProcPtr = function(pExpertNotify: ExpertNotificationProcPtr): OSStatus;

    {  Device Notification Callback Routine }
    USBDeviceNotificationCallbackProcPtr = procedure(pb: UnivPtr);

    {  Device Notification Parameter Block }
    USBDeviceNotificationParameterBlockPtr = ^USBDeviceNotificationParameterBlock;
    USBDeviceNotificationParameterBlock = record
        pbLength:               UInt16;
        pbVersion:              UInt16;
        usbDeviceNotification:  SInt8;
        reserved1:              SInt8;                                  {  needed because of 2-byte 68k alignment }
        usbDeviceRef:           USBDeviceRef;
        usbClass:               UInt16;
        usbSubClass:            UInt16;
        usbProtocol:            UInt16;
        usbVendor:              UInt16;
        usbProduct:             UInt16;
        result:                 OSStatus;
        token:                  UInt32;
        callback:               USBDeviceNotificationCallbackProcPtr;
        refcon:                 UInt32;
    end;

    {  Definition of USBDriverNotificationCallback Routine }
    USBDriverNotificationCallbackPtr = procedure(status: OSStatus; refcon: UInt32);

    {  Public Functions }


type
    HIDInterruptProcPtr = procedure(refcon: UInt32; theData: UnivPtr);

    HIDNotificationProcPtr = procedure(refcon: UInt32; reportSize: UInt32; theReport: UnivPtr; theInterfaceRef: USBReference);

    {  HID Install Interrupt prototype }
    USBHIDInstallInterruptProcPtr = function(pInterruptProc: HIDInterruptProcPtr; refcon: UInt32): OSStatus;

    {  HID Poll Device prototype }
    USBHIDPollDeviceProcPtr = function: OSStatus;

    {  HID Control Device prototype }
    USBHIDControlDeviceProcPtr = function(theControlSelector: UInt32; theControlData: UnivPtr): OSStatus;

    {  HID Get Device Info prototype }
    USBHIDGetDeviceInfoProcPtr = function(theInfoSelector: UInt32; theInfo: UnivPtr): OSStatus;

    {  HID Enter Polled Mode prototype }
    USBHIDEnterPolledModeProcPtr = function: OSStatus;

    {  HID Exit Polled Mode prototype }
    USBHIDExitPolledModeProcPtr = function: OSStatus;

    {  HID Install Notification prototype }
    USBHIDInstallNotificationProcPtr = function(pNotificationProc: HIDNotificationProcPtr; refcon: UInt32): OSStatus;


const
    kHIDStandardDispatchVersion = 0;
    kHIDReservedDispatchVersion = 1;
    kHIDNotificationDispatchVersion = 2;
    kHIDCurrentDispatchVersion  = 2;



type
    USBHIDRev2DispatchTablePtr = ^USBHIDRev2DispatchTable;
    USBHIDRev2DispatchTable = record
        hidDispatchVersion:     UInt32;
        pUSBHIDInstallInterrupt: USBHIDInstallInterruptProcPtr;
        pUSBHIDPollDevice:      USBHIDPollDeviceProcPtr;
        pUSBHIDControlDevice:   USBHIDControlDeviceProcPtr;
        pUSBHIDGetDeviceInfo:   USBHIDGetDeviceInfoProcPtr;
        pUSBHIDEnterPolledMode: USBHIDEnterPolledModeProcPtr;
        pUSBHIDExitPolledMode:  USBHIDExitPolledModeProcPtr;
        pUSBHIDInstallNotification: USBHIDInstallNotificationProcPtr;
    end;

    USBHIDModuleDispatchTablePtr = ^USBHIDModuleDispatchTable;
    USBHIDModuleDispatchTable = record
        hidDispatchVersion:     UInt32;
        pUSBHIDInstallInterrupt: USBHIDInstallInterruptProcPtr;
        pUSBHIDPollDevice:      USBHIDPollDeviceProcPtr;
        pUSBHIDControlDevice:   USBHIDControlDeviceProcPtr;
        pUSBHIDGetDeviceInfo:   USBHIDGetDeviceInfoProcPtr;
        pUSBHIDEnterPolledMode: USBHIDEnterPolledModeProcPtr;
        pUSBHIDExitPolledMode:  USBHIDExitPolledModeProcPtr;
    end;

    {     Prototypes Tue, Mar 17, 1998 4:54:30 PM   }


const
    kHIDRqGetReport             = 1;
    kHIDRqGetIdle               = 2;
    kHIDRqGetProtocol           = 3;
    kHIDRqSetReport             = 9;
    kHIDRqSetIdle               = 10;
    kHIDRqSetProtocol           = 11;

    kHIDRtInputReport           = 1;
    kHIDRtOutputReport          = 2;
    kHIDRtFeatureReport         = 3;

    kHIDBootProtocolValue       = 0;
    kHIDReportProtocolValue     = 1;

    kHIDKeyboardInterfaceProtocol = 1;
    kHIDMouseInterfaceProtocol  = 2;

    kHIDSetLEDStateByBits       = 1;
    kHIDSetLEDStateByBitMask    = 1;
    kHIDSetLEDStateByIDNumber   = 2;
    kHIDRemoveInterruptHandler  = 3;
    kHIDEnableDemoMode          = 4;
    kHIDDisableDemoMode         = 5;
    kHIDRemoveNotification      = $1000;

    kHIDGetLEDStateByBits       = 1;                            {  not supported in 1.0 of keyboard module }
    kHIDGetLEDStateByBitMask    = 1;                            {  not supported in 1.0 of keyboard module }
    kHIDGetLEDStateByIDNumber   = 2;
    kHIDGetDeviceCountryCode    = 3;                            {  not supported in 1.0 HID modules }
    kHIDGetDeviceUnitsPerInch   = 4;                            {  only supported in mouse HID module }
    kHIDGetInterruptHandler     = 5;
    kHIDGetCurrentKeys          = 6;                            {  only supported in keyboard HID module }
    kHIDGetInterruptRefcon      = 7;
    kHIDGetVendorID             = 8;
    kHIDGetProductID            = 9;


    kNumLockLED                 = 0;
    kCapsLockLED                = 1;
    kScrollLockLED              = 2;
    kComposeLED                 = 3;
    kKanaLED                    = 4;

    kNumLockLEDMask             = $01;
    kCapsLockLEDMask            = $02;
    kScrollLockLEDMask          = $04;
    kComposeLEDMask             = $08;
    kKanaLEDMask                = $10;

    kUSBCapsLockKey             = $39;
    kUSBNumLockKey              = $53;
    kUSBScrollLockKey           = $47;


type
    USBMouseDataPtr = ^USBMouseData;
    USBMouseData = record
        buttons:                UInt16;
        XDelta:                 SInt16;
        YDelta:                 SInt16;
    end;

    USBKeyboardDataPtr = ^USBKeyboardData;
    USBKeyboardData = record
        keycount:               UInt16;
        usbkeycode:             array [0..31] of UInt16;
    end;

    USBHIDDataPtr = ^USBHIDData;
    USBHIDData = record
        case SInt16 of
        0: (
            kbd:                USBKeyboardData;
            );
        1: (
            mouse:              USBMouseData;
            );
    end;



const
    kUSBCompositeClass          = 0;
    kUSBAudioClass              = 1;
    kUSBCommClass               = 2;
    kUSBHIDClass                = 3;
    kUSBDisplayClass            = 4;
    kUSBPrintingClass           = 7;
    kUSBMassStorageClass        = 8;
    kUSBHubClass                = 9;
    kUSBDataClass               = 10;
    kUSBVendorSpecificClass     = $FF;

    kUSBCompositeSubClass       = 0;
    kUSBHubSubClass             = 1;
    kUSBPrinterSubclass         = 1;
    kUSBVendorSpecificSubClass  = $FF;

    kUSBHIDInterfaceClass       = $03;

    kUSBNoInterfaceSubClass     = $00;
    kUSBBootInterfaceSubClass   = $01;

    kUSBNoInterfaceProtocol     = $00;
    kUSBKeyboardInterfaceProtocol = $01;
    kUSBMouseInterfaceProtocol  = $02;
    kUSBVendorSpecificProtocol  = $FF;

    kUSBPrinterUnidirectionalProtocol = $01;
    kUSBPrinterBidirectionalProtocol = $02;


    kServiceCategoryUSB         = $75736220 (* 'usb ' *);                       {  USB }

    kUSBDriverFileType          = $6E647276 (* 'ndrv' *);
    kUSBDriverRsrcType          = $75736264 (* 'usbd' *);
    kUSBShimRsrcType            = $75736273 (* 'usbs' *);

    kTheUSBDriverDescriptionSignature = $75736264 (* 'usbd' *);

    kInitialUSBDriverDescriptor = 0;



type
    USBDriverDescVersion                = UInt32;
    {   Driver Loading Options }
    USBDriverLoadingOptions     = UInt32;
const
    kUSBDoNotMatchGenericDevice = $00000001;                    {  Driver's VendorID must match Device's VendorID }
    kUSBDoNotMatchInterface     = $00000002;                    {  Do not load this driver as an interface driver. }
    kUSBProtocolMustMatch       = $00000004;                    {  Do not load this driver if protocol field doesn't match. }
    kUSBInterfaceMatchOnly      = $00000008;                    {  Only load this driver as an interface driver. }

    kClassDriverPluginVersion   = $00001100;




type
    USBDeviceInfoPtr = ^USBDeviceInfo;
    USBDeviceInfo = record
        usbVendorID:            UInt16;                                 {  USB Vendor ID }
        usbProductID:           UInt16;                                 {  USB Product ID. }
        usbDeviceReleaseNumber: UInt16;                                 {  Release Number of Device }
        usbDeviceProtocol:      UInt16;                                 {  Protocol Info. }
    end;

    USBInterfaceInfoPtr = ^USBInterfaceInfo;
    USBInterfaceInfo = record
        usbConfigValue:         SInt8;                                  {  Configuration Value }
        usbInterfaceNum:        SInt8;                                  {  Interface Number }
        usbInterfaceClass:      SInt8;                                  {  Interface Class }
        usbInterfaceSubClass:   SInt8;                                  {  Interface SubClass }
        usbInterfaceProtocol:   SInt8;                                  {  Interface Protocol }
    end;

    USBDriverTypePtr = ^USBDriverType;
    USBDriverType = record
        nameInfoStr:            Str31;                                  {  Driver's name when loading into the Name Registry. }
        usbDriverClass:         SInt8;                                  {  USB Class this driver belongs to. }
        usbDriverSubClass:      SInt8;                                  {  Module type }
        usbDriverVersion:       NumVersion;                             {  Class driver version number. }
    end;

    USBDriverDescriptionPtr = ^USBDriverDescription;
    USBDriverDescription = record
        usbDriverDescSignature: OSType;                                 {  Signature field of this structure. }
        usbDriverDescVersion:   USBDriverDescVersion;                   {  Version of this data structure. }
        usbDeviceInfo:          USBDeviceInfo;                          {  Product & Vendor Info }
        usbInterfaceInfo:       USBInterfaceInfo;                       {  Interface info }
        usbDriverType:          USBDriverType;                          {  Driver Info. }
        usbDriverLoadingOptions: USBDriverLoadingOptions;               {  Options for class driver loading. }
    end;

    {
       Dispatch Table
       Definition of class driver's HW Validation proc.
    }
    USBDValidateHWProcPtr = function(device: USBDeviceRef; pDesc: USBDeviceDescriptorPtr): OSStatus;

    {
       Definition of class driver's device initialization proc.
       Called if the driver is being loaded for a device
    }
    USBDInitializeDeviceProcPtr = function(device: USBDeviceRef; pDesc: USBDeviceDescriptorPtr; busPowerAvailable: UInt32): OSStatus;

    {  Definition of class driver's interface initialization proc. }
    USBDInitializeInterfaceProcPtr = function(interfaceNum: UInt32; pInterface: USBInterfaceDescriptorPtr; pDevice: USBDeviceDescriptorPtr; interfaceRef: USBInterfaceRef): OSStatus;

    {  Definition of class driver's finalization proc. }
    USBDFinalizeProcPtr = function(device: USBDeviceRef; pDesc: USBDeviceDescriptorPtr): OSStatus;

    USBDriverNotification       = UInt32;
const
    kNotifySystemSleepRequest   = $00000001;
    kNotifySystemSleepDemand    = $00000002;
    kNotifySystemSleepWakeUp    = $00000003;
    kNotifySystemSleepRevoke    = $00000004;
    kNotifyHubEnumQuery         = $00000006;
    kNotifyChildMessage         = $00000007;
    kNotifyExpertTerminating    = $00000008;
    kNotifyDriverBeingRemoved   = $0000000B;
    kNotifyAllowROMDriverRemoval = $0000000E;

    {
       Definition of driver's notification proc.
       Added refcon for 1.1 version of dispatch table
    }

type
    USBDDriverNotifyProcPtr = function(notification: USBDriverNotification; pointer: UnivPtr; refcon: UInt32): OSStatus;

    USBClassDriverPluginDispatchTablePtr = ^USBClassDriverPluginDispatchTable;
    USBClassDriverPluginDispatchTable = record
        pluginVersion:          UInt32;
        validateHWProc:         USBDValidateHWProcPtr;                  {  Proc for driver to verify proper HW }
        initializeDeviceProc:   USBDInitializeDeviceProcPtr;            {  Proc that initializes the class driver. }
        initializeInterfaceProc: USBDInitializeInterfaceProcPtr;        {  Proc that initializes a particular interface in the class driver. }
        finalizeProc:           USBDFinalizeProcPtr;                    {  Proc that finalizes the class driver. }
        notificationProc:       USBDDriverNotifyProcPtr;                {  Proc to pass notifications to the driver. }
    end;

    {  Shim Defines }

const
    kTheUSBShimDescriptionSignature = $75736273 (* 'usbs' *);


type
    USBShimDescVersion          = UInt32;
const
    kCurrentUSBShimDescVers     = $0100;

    {   Shim Loading Options }

type
    USBShimLoadingOptions       = UInt32;
const
    kUSBRegisterShimAsSharedLibrary = $00000001;                {  Driver's VendorID must match Device's VendorID }


type
    USBShimDescriptionPtr = ^USBShimDescription;
    USBShimDescription = record
        usbShimDescSignature:   OSType;                                 {  Signature field of this structure. }
        usbShimDescVersion:     USBShimDescVersion;                     {  Version of this data structure. }
        usbDriverLoadingOptions: USBShimLoadingOptions;                 {  Options for shim loading. }
        libraryName:            Str63;                                  {  For optional shared library registration }
    end;

    {  Hub defines }


const
    kUSBHubDescriptorType       = $29;

                                                                {  Hub features  }
    kUSBHubLocalPowerChangeFeature = 0;
    kUSBHubOverCurrentChangeFeature = 1;                        {  port features  }
    kUSBHubPortConnectionFeature = 0;
    kUSBHubPortEnableFeature    = 1;
    kUSBHubPortSuspendFeature   = 2;
    kUSBHubPortOverCurrentFeature = 3;
    kUSBHubPortResetFeature     = 4;
    kUSBHubPortPowerFeature     = 8;
    kUSBHubPortLowSpeedFeature  = 9;
    kUSBHubPortConnectionChangeFeature = 16;
    kUSBHubPortEnableChangeFeature = 17;
    kUSBHubPortSuspendChangeFeature = 18;
    kUSBHubPortOverCurrentChangeFeature = 19;
    kUSBHubPortResetChangeFeature = 20;


    kHubPortConnection          = 1;
    kHubPortEnabled             = 2;
    kHubPortSuspend             = 4;
    kHubPortOverCurrent         = 8;
    kHubPortBeingReset          = 16;
    kHubPortPower               = $0100;
    kHubPortLowSpeed            = $0200;
    kHubPortHighSpeed           = $0400;
    kHubPortTestMode            = $0800;
    kHubPortPortIndicator       = $1000;

                                                                {  Originally this was a Boolean, (low speed)? }
    kUSBFullSpeed               = 0;
    kUSBLowSpeed                = 1;
    kUSBHighSpeed               = 2;

    kHubLocalPowerStatus        = 1;
    kHubOverCurrentIndicator    = 2;
    kHubLocalPowerStatusChange  = 1;
    kHubOverCurrentIndicatorChange = 2;

    off                         = false;
    on                          = true;



type
    hubDescriptorPtr = ^hubDescriptor;
    hubDescriptor = packed record
                                                                        {  See usbDoc pg 250??  }
        dummy:                  UInt8;                                  {  to align charcteristics  }
        length:                 UInt8;
        hubType:                UInt8;
        numPorts:               UInt8;
        characteristics:        UInt16;
        powerOnToGood:          UInt8;                                  {  Port settling time, in 2ms  }
        hubCurrent:             UInt8;
                                                                        {  These are received packed, will have to be unpacked  }
        removablePortFlags:     packed array [0..7] of UInt8;
        pwrCtlPortFlags:        packed array [0..7] of UInt8;
    end;



{$ALIGN MAC68K}
{#POP}
{unit AEInteraction}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}

{*************************************************************************
  AppleEvent callbacks.
*************************************************************************}

type
    AEIdleProcPtr = function(var theEvent: EventRecord; var sleepTime: SInt32; var mouseRgn: RgnHandle): boolean;

    AEFilterProcPtr = function(var theEvent: EventRecord; returnID: SInt32; transactionID: SInt32; const (*var*) sender: AEAddressDesc): boolean;

    AEIdleUPP = ^SInt32; { an opaque UPP }
    AEFilterUPP = ^SInt32; { an opaque UPP }

    {   *************************************************************************
      The next couple of calls are basic routines used to create, send,
      and process AppleEvents.
    *************************************************************************   }
    {
     *  AESend()
     *
     *  Availability:
     *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function AESend(const (*var*) theAppleEvent: AppleEvent; var reply: AppleEvent; sendMode: AESendMode; sendPriority: AESendPriority; timeOutInTicks: SInt32; idleProc: AEIdleUPP; filterProc: AEFilterUPP): OSErr; external name '_AESend';
{
 *  AEProcessAppleEvent()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function AEProcessAppleEvent(const (*var*) theEventRecord: EventRecord): OSErr; external name '_AEProcessAppleEvent';
{
 Note: during event processing, an event handler may realize that it is likely
 to exceed the client's timeout limit. Passing the reply to this
 routine causes a wait event to be generated that asks the client
 for more time.
}
{
 *  AEResetTimer()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function AEResetTimer(const (*var*) reply: AppleEvent): OSErr; external name '_AEResetTimer';
{*************************************************************************
  The following three calls are used to allow applications to behave
  courteously when a user interaction such as a dialog box is needed.
*************************************************************************}


type
    AEInteractAllowed           = SInt8;
const
    kAEInteractWithSelf         = 0;
    kAEInteractWithLocal        = 1;
    kAEInteractWithAll          = 2;

    {
     *  AEGetInteractionAllowed()
     *
     *  Availability:
     *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function AEGetInteractionAllowed(var level: AEInteractAllowed): OSErr; external name '_AEGetInteractionAllowed';
{
 *  AESetInteractionAllowed()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function AESetInteractionAllowed(level: ByteParameter): OSErr; external name '_AESetInteractionAllowed';
{
 *  AEInteractWithUser()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function AEInteractWithUser(timeOutInTicks: SInt32; nmReqPtr: NMRecPtr; idleProc: AEIdleUPP): OSErr; external name '_AEInteractWithUser';
{*************************************************************************
 The following four calls are available for applications which need more
 sophisticated control over when and how events are processed. Applications
 which implement multi-session servers or which implement their own
 internal event queueing will probably be the major clients of these
 routines. They can be called from within a handler to prevent the AEM from
 disposing of the AppleEvent when the handler returns. They can be used to
 asynchronously process the event (as MacApp does).
*************************************************************************}
{
 *  AESuspendTheCurrentEvent()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function AESuspendTheCurrentEvent(const (*var*) theAppleEvent: AppleEvent): OSErr; external name '_AESuspendTheCurrentEvent';
{
 Note: The following routine tells the AppleEvent manager that processing
 is either about to resume or has been completed on a previously suspended
 event. The procPtr passed in as the dispatcher parameter will be called to
 attempt to redispatch the event. Several constants for the dispatcher
 parameter allow special behavior. They are:
    - kAEUseStandardDispatch means redispatch as if the event was just
      received, using the standard AppleEvent dispatch mechanism.
    - kAENoDispatch means ignore the parameter.
      Use this in the case where the event has been handled and no
      redispatch is needed.
    - non nil means call the routine which the dispatcher points to.
}
{ Constants for Refcon in AEResumeTheCurrentEvent with kAEUseStandardDispatch }

const
    kAEDoNotIgnoreHandler       = $00000000;
    kAEIgnoreAppPhacHandler     = $00000001;                    {  available only in vers 1.0.1 and greater  }
    kAEIgnoreAppEventHandler    = $00000002;                    {  available only in vers 1.0.1 and greater  }
    kAEIgnoreSysPhacHandler     = $00000004;                    {  available only in vers 1.0.1 and greater  }
    kAEIgnoreSysEventHandler    = $00000008;                    {  available only in vers 1.0.1 and greater  }
    kAEIngoreBuiltInEventHandler = $00000010;                   {  available only in vers 1.0.1 and greater  }
    kAEDontDisposeOnResume      = $80000000;                    {  available only in vers 1.0.1 and greater  }

    {    Constants for AEResumeTheCurrentEvent  }
    kAENoDispatch               = 0;                            {  dispatch parameter to AEResumeTheCurrentEvent takes a pointer to a dispatch  }
    kAEUseStandardDispatch      = $FFFFFFFF;                    {  table, or one of these two constants  }

    {
     *  AEResumeTheCurrentEvent()
     *
     *  Availability:
     *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function AEResumeTheCurrentEvent(const (*var*) theAppleEvent: AppleEvent; const (*var*) reply: AppleEvent; dispatcher: AEEventHandlerUPP; handlerRefcon: SInt32): OSErr; external name '_AEResumeTheCurrentEvent';
{
 *  AEGetTheCurrentEvent()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function AEGetTheCurrentEvent(var theAppleEvent: AppleEvent): OSErr; external name '_AEGetTheCurrentEvent';
{
 *  AESetTheCurrentEvent()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function AESetTheCurrentEvent(const (*var*) theAppleEvent: AppleEvent): OSErr; external name '_AESetTheCurrentEvent';
{*************************************************************************
  AppleEvent callbacks.
*************************************************************************}

const
    uppAEIdleProcInfo = $00000FD0;
    uppAEFilterProcInfo = $00003FD0;
    {
     *  NewAEIdleUPP()
     *
     *  Availability:
     *    Non-Carbon CFM:   available as macro/inline
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function NewAEIdleUPP(userRoutine: AEIdleProcPtr): AEIdleUPP; external name '_NewAEIdleUPP'; { old name was NewAEIdleProc }
{
 *  NewAEFilterUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewAEFilterUPP(userRoutine: AEFilterProcPtr): AEFilterUPP; external name '_NewAEFilterUPP'; { old name was NewAEFilterProc }
{
 *  DisposeAEIdleUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeAEIdleUPP(userUPP: AEIdleUPP); external name '_DisposeAEIdleUPP';
{
 *  DisposeAEFilterUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeAEFilterUPP(userUPP: AEFilterUPP); external name '_DisposeAEFilterUPP';
{
 *  InvokeAEIdleUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeAEIdleUPP(var theEvent: EventRecord; var sleepTime: SInt32; var mouseRgn: RgnHandle; userRoutine: AEIdleUPP): boolean; external name '_InvokeAEIdleUPP'; { old name was CallAEIdleProc }
{
 *  InvokeAEFilterUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeAEFilterUPP(var theEvent: EventRecord; returnID: SInt32; transactionID: SInt32; const (*var*) sender: AEAddressDesc; userRoutine: AEFilterUPP): boolean; external name '_InvokeAEFilterUPP'; { old name was CallAEFilterProc }
{$ALIGN MAC68K}
{#POP}
{unit ATSUnicodeTypes}
{$ALIGN MAC68K}






{ See also ATSLayoutTypes.h for more ATSUI-related types and constants }
{ ---------------------------------------------------------------------------- }
{ ATSUI types and related constants                                            }
{ ---------------------------------------------------------------------------- }

{
 *  ATSUTextLayout
 *
 *  Discussion:
 *    Text layout objects are the heart of ATSUI. These opaque objects
 *    associate Unicode text with style runs, store information about
 *    softbreaks, line and layout controls, and other information about
 *    the text. Text drawing is done by passing a valid layout object
 *    and a range of text to draw to the function ATSUDrawText, after
 *    initial setup work on the layout has been done. See the
 *    definitions of the functions ATSUCreateTextLayout and
 *    ATSUCreateTextLayoutWithTextPtr for more information about
 *    creating layouts.
 }
type
    ATSUTextLayout    = ^SInt32; { an opaque 32-bit type }

{
 *  ATSUStyle
 *
 *  Discussion:
 *    Style objects retain information about text such as font, point
 *    size, color and other attributes. Styles are associated with text
 *    through a layout object. See the definitions of the functions
 *    ATSUSetRunStyle and ATSUCreateTextLayoutWithTextPtr for more
 *    information about assigning styles to runs of text in a layout
 *    object. See the definitions of the functions ATSUCreateStyle and
 *    ATSUSetAttributes for more information on creating and
 *    manipulating styles.
 }
type
    ATSUStyle    = ^SInt32; { an opaque 32-bit type }
    ATSUStylePtr = ^ATSUStyle;

{
 *  ATSUFontFallbacks
 *
 *  Discussion:
 *    ATSUFontFallbacks objects are used to store the desired font
 *    fallback mode, list, and associated cache information. See the
 *    definitions of ATSUFontFallbackMethod and ATSUSetObjFontFallbacks
 *    for more information about setting up font fallbacks.
 }
type
    ATSUFontFallbacks    = ^SInt32; { an opaque 32-bit type }

{
 *  ATSUTextMeasurement
 *
 *  Discussion:
 *    ATSUTextMeasurement is specific to ATSUI in that measurement
 *    quantities are in fractional Fixed format instead of shorts used
 *    in QuickDraw Text. This provides exact outline metrics and line
 *    specifications such as line width, ascent, descent, and so on.
 *    See FixMath.h for conversion functions for Fixed numbers.
 }
type
    ATSUTextMeasurement = Fixed;
    ATSUTextMeasurementPtr = ^ATSUTextMeasurement;

{
 *  ATSUFontID
 *
 *  Discussion:
 *    ATSUFontID indicates a particular font family and face.
 *    ATSUFontID's are not guaranteed to remain constant across
 *    sessions. Clients should use the font's unique name to get a font
 *    token to store in documents which is guaranteed to remain
 *    constant across sessions.
 }
type
    ATSUFontID = FMFont;
    ATSUFontIDPtr = ^ATSUFontID;

{
 *  ATSUFontFeatureType
 *
 *  Discussion:
 *    Used to identify a font feature type for a particular font. See
 *    the definitions of the functions ATSUGetAllFontFeatures and
 *    ATSUGetFontFeature for more information about font features.
 }
type
    ATSUFontFeatureType = UInt16;
    ATSUFontFeatureTypePtr = ^ATSUFontFeatureType;

{
 *  ATSUFontFeatureSelector
 *
 *  Discussion:
 *    Used to identify a font feature selector for a particular font.
 *    See the definitions of the functions ATSUGetAllFontFeatures and
 *    ATSUGetFontFeature for more information about font features.
 }
type
    ATSUFontFeatureSelector = UInt16;
    ATSUFontFeatureSelectorPtr = ^ATSUFontFeatureSelector;

{
 *  ATSUFontVariationAxis
 *
 *  Discussion:
 *    Used to identify a font variation axis for a particular font. See
 *    the definitions of the functions ATSUGetAllFontVariations and
 *    ATSUGetFontVariation for more information about font variations.
 }
type
    ATSUFontVariationAxis = FourCharCode;
    ATSUFontVariationAxisPtr = ^ATSUFontVariationAxis;

{
 *  ATSUFontVariationValue
 *
 *  Discussion:
 *    Used to identify a font variation value for a particular font.
 *    See the definitions of the functions ATSUGetAllFontVariations and
 *    ATSUGetFontVariation for more information about font variations.
 }
type
    ATSUFontVariationValue = Fixed;
    ATSUFontVariationValuePtr = ^ATSUFontVariationValue;

{
 *  ATSUAttributeTag
 *
 *  Summary:
 *    Constants used for style attributes, line controls, and layout
 *    controls.
 *
 *  Discussion:
 *    The following constants are used to change settings in text
 *    layout and style objects. Use the functions ATSUSetLineControls,
 *    ATSUSetLayoutControls, and ATSUSetAttributes to set these values
 *    in lines, layouts, and styles, respectively. Apple reserves tag
 *    values 0 to 65535 (0 to 0x0000FFFF). ATSUI clients may create
 *    their own tags with any other value.
 }
type
    ATSUAttributeTag = UInt32;
    ATSUAttributeTagPtr = ^ATSUAttributeTag;
const

  {
   * (Type: ATSUTextMeasurement) (Default value: 0) Must not be less
   * than zero. May be set as a line or layout control.
   }
  kATSULineWidthTag             = 1;

  {
   * (Type: Fixed) (Default value: 0) Angle is specified in degrees in
   * right-handed coordinate system. May be set as a line control.
   }
  kATSULineRotationTag          = 2;

  {
   * (Type: Boolean) (Default value: GetSysDirection()) Must be 0 or 1.
   * See below for convenience constants. May be set as a line or
   * layout control.
   }
  kATSULineDirectionTag         = 3;

  {
   * (Type: Fract) (Default value: kATSUNoJustification) May be set as
   * a line or layout control.
   }
  kATSULineJustificationFactorTag = 4;

  {
   * (Type: Fract) (Default value: kATSUStartAlignment) May be set as a
   * line or layout control.
   }
  kATSULineFlushFactorTag       = 5;

  {
   * (Type: BslnBaselineRecord) (Default value: all zeros) Calculated
   * from other style attributes (e.g., font and point size). May be
   * set as a line or layout control.
   }
  kATSULineBaselineValuesTag    = 6;

  {
   * (Type: ATSLineLayoutOptions) (Default value: all zeros) See
   * ATSLayoutTypes.h for a definition of the ATSLineLayoutOptions type
   * and a list of possible values. May be set as a line or layout
   * control.
   }
  kATSULineLayoutOptionsTag     = 7;

  {
   * (Type: ATSUTextMeasurement) (Default value: determined by font(s))
   * Must not be less than zero. Starting in Mac OS X 10.2, you can
   * retrieve this value as a line or layout control, even if you have
   * not explicitly set it. This makes it easy to calculate line
   * height. May be set as a line or layout control.
   }
  kATSULineAscentTag            = 8;

  {
   * (Type: ATSUTextMeasurement) (Default value: determined by font(s))
   * Must not be less than zero. Starting in Mac OS X, you can retrieve
   * this value as a line or layout control, even if you have not
   * explicitly set it. This makes it easy to calculate line height.
   * May be set as a line or layout control.
   }
  kATSULineDescentTag           = 9;

  {
   * (Type: RegionCode) (Default value: kTextRegionDontCare) See
   * Script.h for possible values. May be set as a line or layout
   * control.
   }
  kATSULineLangRegionTag        = 10;

  {
   * (Type: TextBreakLocatorRef) (Default value: NULL) See
   * UnicodeUtilities.h for more information on creating a
   * TextBreakLocator. May be set as a line or layout control.
   }
  kATSULineTextLocatorTag       = 11;

  {
   * (Type: ATSULineTruncation) (Default value: kATSUTruncateNone) See
   * the definition of ATSULineTruncation for possible values. May be
   * set as a line or layout control.
   }
  kATSULineTruncationTag        = 12;

  {
   * (Type: ATSUFontFallbacks) (Default value: current global fallback
   * state) The current global fallback state is determined using the
   * ATSUSetFontFallbacks function. The use of this function is not
   * recommended. Instead, use the functions ATSUCreateFontFallbacks
   * and ATSUSetObjFontFallbacks to create a ATSUFontFallbacks object,
   * and then use the kATSULineFontFallbacksTag attribute to set the
   * font fallbacks object as a layout control. See the definition of
   * ATSUFontFallbacks for more information. May be set as a layout
   * control.
   }
  kATSULineFontFallbacksTag     = 13;

  {
   * (Type: CFStringRef) (Default value: user setting in System
   * Preferences) Indicates current setting for the decimal separator.
   * This affects the behavior of decimal tabs. May be set as a line or
   * layout control.
   }
  kATSULineDecimalTabCharacterTag = 14;

  {
   * (Type: ATSULayoutOperationOverrideSpecifier) (Default value: NULL)
   * See ATSUnicodeDirectAccess.h for a definition of the
   * ATSULayoutOperationOverrideSpecifier type. May be set as a layout
   * control.
   }
  kATSULayoutOperationOverrideTag = 15;

  {
   * (Type: CGColorRef) (Default value: user setting in System
   * Preferences) Indicates current setting for the highlight color.
   * May be set as a line or layout control.
   }
  kATSULineHighlightCGColorTag  = 17;

  {
   * This is just for convenience. It is the upper limit of the line
   * and layout tags.
   }
  kATSUMaxLineTag               = 18;

  {
   * This tag is obsolete. Please use kATSULineLangRegionTag instead.
   }
  kATSULineLanguageTag          = 10;

  {
   * (Type: CGContextRef) (Default value: NULL) Use this tag to produce
   * Quartz rendering with ATSUI. See the definitions of the functions
   * QDBeginCGContext and QDEndCGContext in Quickdraw.h for more
   * information about creating a CGContext from a graphics port. May
   * be set as a layout control.
   }
  kATSUCGContextTag             = 32767;

  {
   * (Type: Boolean) (Default value: false) For compatability purposes
   * only. Choosing typographic styles from font families is preferred.
   * Note this tag will produce a synthetic style for fonts that do not
   * have a typographic style. May be set as a style attribute.
   }
  kATSUQDBoldfaceTag            = 256;

  {
   * (Type: Boolean) (Default value: false) For compatability purposes
   * only. Choosing typographic styles from font families is preferred.
   * Note this tag will produce a synthetic style for fonts that do not
   * have a typographic style. May be set as a style attribute.
   }
  kATSUQDItalicTag              = 257;

  {
   * (Type: Boolean) (Default value: false) For compatability purposes
   * only. May be set as a style attribute.
   }
  kATSUQDUnderlineTag           = 258;

  {
   * (Type: Boolean) (Default value: false) For compatability purposes
   * only. May be set as a style attribute.
   }
  kATSUQDCondensedTag           = 259;

  {
   * (Type: Boolean) (Default value: false) For compatability purposes
   * only. May be set as a style attribute.
   }
  kATSUQDExtendedTag            = 260;

  {
   * (Type: ATSUFontID) (Default value: LMGetApFontID() or if not
   * valid, LMGetSysFontFam()) May be set as a style attribute.
   }
  kATSUFontTag                  = 261;

  {
   * (Type: Fixed) (Default value: Long2Fix(LMGetSysFontSize())) May be
   * set as a style attribute.
   }
  kATSUSizeTag                  = 262;

  {
   * (Type: RGBColor) (Default value: (0, 0, 0)) May be set as a style
   * attribute.
   }
  kATSUColorTag                 = 263;

  {
   * (Type: RegionCode) (Default value:
   * GetScriptManagerVariable(smRegionCode)) See Script.h for a list of
   * possible values. May be set as a style attribute.
   }
  kATSULangRegionTag            = 264;

  {
   * (Type: ATSUVerticalCharacterType) (Default value:
   * kATSUStronglyHorizontal) See the definition of
   * ATSUVerticalCharacterType for a list of possible values. May be
   * set as a style attribute.
   }
  kATSUVerticalCharacterTag     = 265;

  {
   * (Type: ATSUTextMeasurement) (Default value: kATSUseGlyphAdvance)
   * Must not be less than zero. May be set as a style attribute.
   }
  kATSUImposeWidthTag           = 266;

  {
   * (Type: Fixed) (Default value: 0) May be set as a style attribute.
   }
  kATSUBeforeWithStreamShiftTag = 267;

  {
   * (Type: Fixed) (Default value: 0) May be set as a style attribute.
   }
  kATSUAfterWithStreamShiftTag  = 268;

  {
   * (Type: Fixed) (Default value: 0) May be set as a style attribute.
   }
  kATSUCrossStreamShiftTag      = 269;

  {
   * (Type: Fixed) (Default value: kATSNoTracking) May be set as a
   * style attribute.
   }
  kATSUTrackingTag              = 270;

  {
   * (Type: Fract) (Default value: 0) May be set as a style attribute.
   }
  kATSUHangingInhibitFactorTag  = 271;

  {
   * (Type: Fract) (Default value: 0) May be set as a style attribute.
   }
  kATSUKerningInhibitFactorTag  = 272;

  {
   * (Type: Fixed) (Default value: 0) Must be between -1.0 and 1.0. May
   * be set as a style attribute.
   }
  kATSUDecompositionFactorTag   = 273;

  {
   * (Type: BslnBaselineClass) (Default value: kBSLNRomanBaseline) See
   * SFNTLayoutTypes.h for more information. Use the constant
   * kBSLNNoBaselineOverride to use intrinsic baselines. May be set as
   * a style attribute.
   }
  kATSUBaselineClassTag         = 274;

  {
   * (Type: ATSJustPriorityWidthDeltaOverrides) (Default value: all
   * zeros) See ATSLayoutTypes.h for more information. May be set as a
   * style attribute.
   }
  kATSUPriorityJustOverrideTag  = 275;

  {
   * (Type: Boolean) (Default value: false) When set to true, ligatures
   * and compound characters will not have divisable components. May be
   * set as a style attribute.
   }
  kATSUNoLigatureSplitTag       = 276;

  {
   * (Type: Boolean) (Default value: false) When set to true, ATSUI
   * will not use a glyph's angularity to determine its boundaries. May
   * be set as a style attribute.
   }
  kATSUNoCaretAngleTag          = 277;

  {
   * (Type: Boolean) (Default value: false) When set to true, ATSUI
   * will suppress automatic cross kerning (defined by font). May be
   * set as a style attribute.
   }
  kATSUSuppressCrossKerningTag  = 278;

  {
   * (Type: Boolean) (Default value: false) When set to true, ATSUI
   * will suppress glyphs' automatic optical positional alignment. May
   * be set as a style attribute.
   }
  kATSUNoOpticalAlignmentTag    = 279;

  {
   * (Type: Boolean) (Default value: false) When set to true, ATSUI
   * will force glyphs to hang beyond the line boundaries. May be set
   * as a style attribute.
   }
  kATSUForceHangingTag          = 280;

  {
   * (Type: Boolean) (Default value: false) When set to true, ATSUI
   * will not perform post-compensation justification if needed. May be
   * set as a style attribute.
   }
  kATSUNoSpecialJustificationTag = 281;

  {
   * (Type: TextBreakLocatorRef) (Default value: NULL) See
   * UnicodeUtilities.h for more information about creating a
   * TextBreakLocator. May be set as a style attribute.
   }
  kATSUStyleTextLocatorTag      = 282;

  {
   * (Type: ATSStyleRenderingOptions) (Default value:
   * kATSStyleNoOptions) See ATSLayoutTypes.h for a definition of
   * ATSStyleRenderingOptions and a list of possible values. May be set
   * as a style attribute.
   }
  kATSUStyleRenderingOptionsTag = 283;

  {
   * (Type: ATSUTextMeasurement) (Default value: determined by font)
   * Must not be less than zero. Starting in Mac OS X 10.2, you can
   * retrieve a value for this attribute, even if you have not
   * explicitly set it. This can make calculating line height easier.
   * May be set as a style attribute.
   }
  kATSUAscentTag                = 284;

  {
   * (Type: ATSUTextMeasurement) (Default value: determined by font)
   * Must not be less than zero. Starting in Mac OS X 10.2, you can
   * retrieve a value for this attribute, even if you have not
   * explicitly set it. This can make calculating line height easier.
   * May be set as a style attribute.
   }
  kATSUDescentTag               = 285;

  {
   * (Type: ATSUTextMeasurement) (Default value: determined by font)
   * Must not be less than zero. Starting in Mac OS X 10.2, you can
   * retrieve a value for this attribute, even if you have not
   * explicitly set it. This can make calculating line height easier.
   * May be set as a style attribute.
   }
  kATSULeadingTag               = 286;

  {
   * (Type: ATSUGlyphSelector) (Default value: 0) See the definition of
   * ATSUGlyphSelector for more information and a list of possible
   * values. May be set as a style attribute.
   }
  kATSUGlyphSelectorTag         = 287;

  {
   * (Type: ATSURGBAlphaColor) (Default value: (0, 0, 0, 1)) See the
   * definition of ATSURGBAlphaColor for more information. May be set
   * as a style attribute.
   }
  kATSURGBAlphaColorTag         = 288;

  {
   * (Type: CGAffineTransform) (Default value:
   * CGAffineTransformIdentity) See the definition of CGAffineTransform
   * in CGAffineTransform.h for more information. May be set as a style
   * attribute.
   }
  kATSUFontMatrixTag            = 289;

  {
   * (Type: ATSUStyleLineCountType) (Default value:
   * kATSUStyleSingleLineCount) Used to specify the number of strokes
   * to be drawn for an underline. May be set as a style attribute.
   }
  kATSUStyleUnderlineCountOptionTag = 290;

  {
   * (Type: CGColorRef) (Default value: NULL) Used to specify the color
   * of the strokes to draw for an underlined run of text. If NULL, the
   * text color is used. May be set as a style attribute.
   }
  kATSUStyleUnderlineColorOptionTag = 291;

  {
   * (Type: Boolean) (Default value: false) Used to specify
   * strikethrough style. May be set as a style attribute.
   }
  kATSUStyleStrikeThroughTag    = 292;

  {
   * (Type: ATSUStyleLineCountType) (Default value:
   * kATSUStyleSingleLineCount) Used to specify the number of strokes
   * to be drawn for a strikethrough. May be set as a style attribute.
   }
  kATSUStyleStrikeThroughCountOptionTag = 293;

  {
   * (Type: CGColorRef) (Default value: NULL) Used to specify the color
   * of the strokes to draw for a strikethrough style. If NULL, the
   * text color is used. May be set as a style attribute.
   }
  kATSUStyleStrikeThroughColorOptionTag = 294;

  {
   * (Type: Boolean) (Default value: false) Used to specify if text
   * should be drawn with a drop shadow. Only takes effect if a
   * CGContext is used for drawing. May be set as a style attribute.
   }
  kATSUStyleDropShadowTag       = 295;

  {
   * (Type: float) (Default value: 0.0) Used to specify the amount of
   * blur for a dropshadow. May be set as a style attribute.
   }
  kATSUStyleDropShadowBlurOptionTag = 296;

  {
   * (Type: CGSize) (Default value: (3.0, -3.0)) Used to specify the
   * amount of offset from the text to be used when drawing a
   * dropshadow. May be set as a style attribute.
   }
  kATSUStyleDropShadowOffsetOptionTag = 297;

  {
   * (Type: CGColorRef) (Default value: NULL) Used to specify the color
   * of the dropshadow. May be set as a style attribute.
   }
  kATSUStyleDropShadowColorOptionTag = 298;

  {
   * This is just for convenience. It is the upper limit of the style
   * tags.
   }
  kATSUMaxStyleTag              = 299;

  {
   * This tag is obsolete. Please use kATSULangRegionTag instead. This
   * is the maximum Apple ATSUI reserved tag value.  Client defined
   * tags must be larger.
   }
  kATSULanguageTag              = 264;
  kATSUMaxATSUITagValue         = 65535;


{
 *  ATSUAttributeValuePtr
 *
 *  Summary:
 *    Used to provide generic access for storage of attribute values,
 *    which vary in size.
 }
type
    ATSUAttributeValuePtr = Ptr;
    ConstATSUAttributeValuePtr = Ptr;
    ATSUAttributeValuePtrPtr = ^ATSUAttributeValuePtr;

{
 *  ATSUAttributeInfo
 *
 *  Discussion:
 *    ATSUAttributeInfo is used to provide a tag/size pairing. This
 *    makes it possible to provide the client information about all the
 *    attributes for a given range of text.  This structure is only
 *    used to return to the client information about a complete set of
 *    attributes.  An array of ATSUAttributeInfos is passed as a
 *    parameter so that the client can find out what attributes are set
 *    and what their individual sizes are; with that information, they
 *    can then query about the values of the attributes they're
 *    interested in. Because arrays of ATSUAttributeInfos are used as
 *    parameters to functions, they have to be of a fixed size, hence
 *    the value is not included in the structure.
 }
type
    ATSUAttributeInfo = record
        fTag: ATSUAttributeTag;
        fValueSize: ByteCount;
    end;
    ATSUAttributeInfoPtr = ^ATSUAttributeInfo;

{
 *  ATSUCaret
 *
 *  Discussion:
 *    Contains the complete information needed to render a caret.  fX
 *    and fY is the position of one of the caret's ends relative to the
 *    origin position of the line the caret belongs. fDeltaX and
 *    fDeltaY is the position of the caret's other end. Hence, to draw
 *    a caret, simply call MoveTo(fX, fY) followed by LineTo(fDeltaX,
 *    fDeltaY) or equivalent.  The ATSUCaret will contain the positions
 *    needed to draw carets on angled lines and reflect angled carets
 *    and leading/trailing split caret appearances.
 }
type
    ATSUCaret = record
        fX: Fixed;
        fY: Fixed;
        fDeltaX: Fixed;
        fDeltaY: Fixed;
    end;
    ATSUCaretPtr = ^ATSUCaret;

{
 *  ATSUCursorMovementType
 *
 *  Discussion:
 *    Used to indicate how much to move the cursor when using the ATSUI
 *    cusor movement routines. Note that kATSUByCharacterCluster is
 *    only available in Mac OS X and in CarbonLib versions 1.3 and
 *    later.
 }
type ATSUCursorMovementType = UInt16;
const

  {
   * Cursor movement based on individual characters. The cursor will
   * step through individual characters within ligatures.
   }
  kATSUByCharacter              = 0;

  {
   * Like kATSUByCharacter, but the cursor will treat ligatures as
   * single entities.
   }
  kATSUByTypographicCluster     = 1;

  {
   * Cursor movement by whole words.
   }
  kATSUByWord                   = 2;

  {
   * Cursor movement by clusters based on characters only.
   }
  kATSUByCharacterCluster       = 3;

  {
   * Obsolete name for kATSUByTypographicCluster; do not use.
   }
  kATSUByCluster                = 1;


{
 *  ATSULineTruncation
 *
 *  Summary:
 *    Constants used with the kATSULineTruncationTag layout and line
 *    control.
 *
 *  Discussion:
 *    The constants kATSUTruncateNone, kATSUTruncateStart,
 *    kATSUTruncateEnd, and kATSUTruncateMiddle represent different
 *    places in the text where glyphs should be replaced with an
 *    elipsis should the text not fit within the width set by the
 *    kATSULineWidthTag line and layout control. The constant
 *    kATSUTruncFeatNoSquishing is special and can be bitwise OR'd with
 *    any of the other constants. It indicates that ATSUI should not
 *    perform negative justification to make the text fit. This can be
 *    desirable for situations such as live resize, to prevent the text
 *    from "wiggling".
 }
type ATSULineTruncation = UInt32;
const
  kATSUTruncateNone             = 0;
  kATSUTruncateStart            = 1;
  kATSUTruncateEnd              = 2;
  kATSUTruncateMiddle           = 3;
  kATSUTruncateSpecificationMask = $00000007;
  kATSUTruncFeatNoSquishing     = $00000008;


{
 *  ATSUStyleLineCountType
 *
 *  Discussion:
 *    ATSUStyleLineCountType is used to designate how many lines will
 *    be drawn for a given style type.  Currently only the underline
 *    and strikethrough styles support this type.
 }
type ATSUStyleLineCountType = UInt16;
const
  kATSUStyleSingleLineCount     = 1;
  kATSUStyleDoubleLineCount     = 2;


{
 *  ATSUVerticalCharacterType
 *
 *  Discussion:
 *    Use these constants along with the kATSUVerticalCharacterTag
 *    layout control to determine whether the vertical or horizontal
 *    forms of glyphs should be used. Note that this is independent of
 *    line rotation.
 }
type ATSUVerticalCharacterType = UInt16;
const
  kATSUStronglyHorizontal       = 0;
  kATSUStronglyVertical         = 1;


{
 *  ATSUStyleComparison
 *
 *  Discussion:
 *    ATSUStyleComparison is an enumeration with four values, and is
 *    used by ATSUCompareStyles() to indicate if the first style
 *    parameter contains as a proper subset, is equal to, or is
 *    contained by the second style parameter.
 }
type ATSUStyleComparison = UInt16;
const
  kATSUStyleUnequal             = 0;
  kATSUStyleContains            = 1;
  kATSUStyleEquals              = 2;
  kATSUStyleContainedBy         = 3;


{
 *  ATSUFontFallbackMethod
 *
 *  Discussion:
 *    ATSUFontFallbackMethod type defines the method by which ATSUI
 *    will try to find an appropriate font for a character if the
 *    assigned font does not contain the needed glyph(s) to represent
 *    it.  This affects ATSUMatchFontsToText and font selection during
 *    layout and drawing when ATSUSetTransientFontMatching is set ON.
 }
type ATSUFontFallbackMethod = UInt16;
const

  {
   * When this constant is specified, all fonts on the system are
   * searched for substitute glyphs.
   }
  kATSUDefaultFontFallbacks     = 0;

  {
   * This constant specifies that only the special last resort font be
   * used for substitute glyphs.
   }
  kATSULastResortOnlyFallback   = 1;

  {
   * This constant specifies that a font list you provide should be
   * sequentially searched for substitute glyphs before the ATSUI
   * searches through all available fonts on the system. You specify
   * this list through the iFonts parameter to the
   * ATSUSetObjFontFallbacks function.
   }
  kATSUSequentialFallbacksPreferred = 2;

  {
   * This constants specifies that only the font list you provide
   * should be sequentially searched for substitute glyphs. All other
   * fonts on the system are ignored, except for the special last
   * resort font. You specify the list of fonts you want ATSUI to use
   * by passing it to the iFonts parameter of the
   * ATSUSetObjFontFallbacks function.
   }
  kATSUSequentialFallbacksExclusive = 3;


{
 *  ATSUTabType
 *
 *  Discussion:
 *    ATSUTabType type defines the characteristic of ATSUI tabs. A Left
 *    tab type specifies that the left side of affected text is to be
 *    maintained flush against the tab stop.  A Right tab type
 *    specifies that the right side of affected text is to be
 *    maintained flush against the tab stop.  A Center tab type
 *    specifies that the affected text centered about the tab stop. A
 *    Decimal tab type specifies that the affected text will be aligned
 *    such that the decimal character will by flush against the tab
 *    stop.  The default decimal character is defined in System
 *    Preferences.  A different decimal character can be defined by
 *    using the ATSUAttributeTag kATSULineDecimalTabCharacterTag.
 }

type ATSUTabType = UInt16;
const
  kATSULeftTab                  = 0;
  kATSUCenterTab                = 1;
  kATSURightTab                 = 2;
  kATSUDecimalTab               = 3;
  kATSUNumberTabTypes           = 4;


{
 *  ATSUTab
 *
 *  Discussion:
 *    ATSUTab specifies the position and type of tab stop to be applied
 *    to a ATSUTextLayout set through the ATSUI routine ATSUSetTabArray
 *    and returned through ATSUGetTabArray.
 }
type
    ATSUTab = record
    tabPosition: ATSUTextMeasurement;
      tabType: ATSUTabType;
    end;
    ATSUTabPtr = ^ATSUTab;

{
 *  ATSURGBAlphaColor
 *
 *  Discussion:
 *    Use this structure with the kATSURGBAlphaColorTag attribute to
 *    specify color for your text in an ATSUStyle. All values range
 *    from 0.0 to 1.0.
 }
type
    ATSURGBAlphaColor = record
        red: Float32;
        green: Float32;
        blue: Float32;
        alpha: Float32;
    end;
    ATSURGBAlphaColorPtr = ^ATSURGBAlphaColor;

{
 *  GlyphCollection
 *
 *  Discussion:
 *    GlyphCollection types represent the specific character
 *    collection.  If the value is zero, kGlyphCollectionGID, then this
 *    indicates that the glyph value represents the actual glyphID of a
 *    specific font. Adobe collections are based on CID, rather than
 *    glyph ID.
 }

type GlyphCollection = UInt16;
const
  kGlyphCollectionGID           = 0;
  kGlyphCollectionAdobeCNS1     = 1;
  kGlyphCollectionAdobeGB1      = 2;
  kGlyphCollectionAdobeJapan1   = 3;
  kGlyphCollectionAdobeJapan2   = 4;
  kGlyphCollectionAdobeKorea1   = 5;
  kGlyphCollectionUnspecified   = $FF;



{
 *  ATSUGlyphSelector
 *
 *  Discussion:
 *    ATSUGlyphSelector can direct ATSUI to use a specific glyph
 *    instead of the one that ATSUI normally derives.  The glyph can be
 *    specified either as a glyphID (specific to the font used) or CID
 *    from a specfic collection defined by the collection entry.
 }
type
    ATSUGlyphSelector = record

  {
   * A glyph collection constant. See the definition of GlyphCollection
   * for possible values for this field.
   }
        collection: GlyphCollection;

  {
   * The glyph ID of the glyph (when collection is
   * kGlyphCollectionGID). For Adobe glyph collections, this value
   * represents a CID
   }
        glyphID: GlyphID;
    end;
    ATSUGlyphSelectorPtr = ^ATSUGlyphSelector;

type ATSUCustomAllocFunc = function( refCon: UnivPtr; howMuch: ByteCount ): Ptr;
type ATSUCustomFreeFunc = procedure( refCon: UnivPtr; doomedBlock: UnivPtr );
type ATSUCustomGrowFunc = function( refCon: UnivPtr; oldBlock: UnivPtr; oldSize: ByteCount; newSize: ByteCount ): Ptr;

{
 *  ATSUMemoryCallbacks
 *
 *  Discussion:
 *    ATSUMemoryCallbacks is a union struct that allows the ATSUI
 *    client to specify a specific heap for ATSUI use or allocation
 *    callbacks of which ATSUI is to use each time ATSUI performs a
 *    memory operation (alloc, grow, free).
 }
type
    ATSUMemoryCallbacks = record
        case SInt16 of
            1: (
                callbacks: record
                    Alloc: ATSUCustomAllocFunc;
                    Free: ATSUCustomFreeFunc;
                    Grow: ATSUCustomGrowFunc;
                    memoryRefCon: Ptr;
                end;
            );
            2: (
                heapToUse: THz;
            );
    end;
    ATSUMemoryCallbacksPtr = ^ATSUMemoryCallbacks;

{
 *  ATSUHeapSpec
 *
 *  Discussion:
 *    ATSUHeapSpec provides the ATSUI client a means of specifying the
 *    heap from which ATSUI should allocate its dynamic memory or
 *    specifying that ATSUI should use the memory callback provided by
 *    the client.
 }
type ATSUHeapSpec = UInt16;
const
  kATSUUseCurrentHeap           = 0;
  kATSUUseAppHeap               = 1;
  kATSUUseSpecificHeap          = 2;
  kATSUUseCallbacks             = 3;



{
 *  ATSUMemorySetting
 *
 *  Discussion:
 *    ATSUMemorySetting is used to store the results from a
 *    ATSUSetMemoryAlloc or a ATSUGetCurrentMemorySetting call.  It can
 *    also be used to change the current ATSUMemorySetting by passing
 *    it into the ATSUSetCurrentMemorySetting call.
 }
type
    ATSUMemorySetting    = ^SInt32; { an opaque 32-bit type }


{
 *  ATSUGlyphInfo
 *
 *  Summary:
 *    Structure returned by ATSUGetGlyphInfo
 *
 *  Discussion:
 *    ATSUGetGlyphInfo will return an array of these structs, one for
 *    each glyph in the specified range. You can then make changes to
 *    the data before drawing it with ATSUDrawGlyphInfo. These
 *    functions are no longer recommended; see ATSUnicodeDirectAccess.h
 *    for replacement functions.
 }
type
    ATSUGlyphInfo = record
        glyphID: GlyphID;
        reserved: UInt16;
        layoutFlags: UInt32;
        charIndex: UniCharArrayOffset;
        style: ATSUStyle;
        deltaY: Float32;
        idealX: Float32;
        screenX: SInt16;
        caretX: SInt16;
    end;
    ATSUGlyphInfoPtr = ^ATSUGlyphInfo;

{
 *  ATSUGlyphInfoArray
 *
 *  Summary:
 *    Structure returned by ATSUGetGlyphInfo
 *
 *  Discussion:
 *    This data structure is returned by ATSUGetGlyphInfo. layout is
 *    the same layout you pass in to ATSUGetGlyphInfo, numGlyphs is the
 *    number of glyphs stored in the array glyphs. See the definition
 *    of ATSUGlyphInfo for more information about the data structures
 *    contained in the glyphs array. The ATSUGetGlyphInfo function is
 *    no longer recommended; see ATSUnicodeDirectAccess.h for
 *    replacement functions.
 }
type
    ATSUGlyphInfoArray = record
        layout: ATSUTextLayout;
        numGlyphs: ItemCount;
    glyphs: array[0..0] of ATSUGlyphInfo;
    end;
    ATSUGlyphInfoArrayPtr = ^ATSUGlyphInfoArray;
{*******************************************************************************}
{  ATSUI highlighting method constants and typedefs                             }
{*******************************************************************************}

{
 *  ATSUHighlightMethod
 *
 *  Discussion:
 *    Use the constants with the function ATSUSetHighlightingMethod to
 *    determine the method of highlighting to use. kInvertHighlighting
 *    will cause ATSUI to perform a simple color inversion on the area
 *    around the text. Although this method requires the least work, it
 *    does not produce the best visual results. kRedrawHighlighting
 *    will cause ATSUI to redraw the text whenever highlighting or
 *    unhighlighting it. This method produces the best visual results,
 *    but it does require you to specify a way for ATSUI to redraw the
 *    background behind the text after an unhighlight operation. See
 *    the definitions of ATSUUnhighlightData, ATSUBackgroundData,
 *    ATSUBackgroundDataType, and RedrawBackgroundProcPtr for more
 *    information.
 }
type ATSUHighlightMethod = UInt32;
const
  kInvertHighlighting           = 0;
  kRedrawHighlighting           = 1;


{
 *  ATSUBackgroundDataType
 *
 *  Discussion:
 *    Use these constants for the dataType field in the
 *    ATSUUnhighlightData structure. kATSUBackgroundColor refers to a
 *    solid color background, while kATSUBackgroundCallback refers to a
 *    redrawing callback function. Note that if you specify
 *    kATSUBackgroundCallback, you must provide a callback function.
 }
type ATSUBackgroundDataType = UInt32;
const
  kATSUBackgroundColor          = 0;
  kATSUBackgroundCallback       = 1;


{
 *  ATSUBackgroundColor
 *
 *  Discussion:
 *    A background color used by ATSUI to redraw the background after a
 *    call to ATSUUnhighlight text when the highlighting method is set
 *    to kRedrawHighlighting. See the definitions of ATSUBackgroundData
 *    and ATSUUnhighlightData for more information.
 }

type ATSUBackgroundColor = ATSURGBAlphaColor;

{
 *  RedrawBackgroundProcPtr
 *
 *  Discussion:
 *    RedrawBackgroundProcPtr is a pointer to a client-supplied
 *    callback function (e.g. MyRedrawBackgroundProc) for redrawing
 *    complex backgrounds (and optionally the text as well) that can be
 *    called by ATSUI for highlighting if the client has called
 *    ATSUSetHighlightingMethod with kRedrawHighlighting for the
 *    iMethod parameter. In order for ATSUI to call the client
 *    function, the client must (1) pass a pointer to the client
 *    function to NewRedrawBackgroundUPP() in order to obtain a
 *    RedrawBackgroundUPP, and (2) pass the RedrawBackgroundUPP in the
 *    unhighlightData.backgroundUPP field of the iUnhighlightData
 *    parameter for the ATSUSetHighlightingMethod call. When finished,
 *    the client should call DisposeRedrawBackgroundUPP with the
 *    RedrawBackgroundUPP.
 *
 *  Parameters:
 *
 *    iLayout:
 *      The layout to which the highlighting is being applied. The
 *      client function can use this to redraw the text.
 *
 *    iTextOffset:
 *      The offset of the text that is being highlighted; can be used
 *      by the client function to redraaw the text.
 *
 *    iTextLength:
 *      The length of the text that is being highlighted; can be used
 *      by the client function to redraaw the text.
 *
 *    iUnhighlightArea:
 *      An array of ATSTrapezoids that describes the highlight area.
 *      The ATSTrapezoid array is ALWAYS in QD coordinates.
 *
 *    iTrapezoidCount:
 *      The count of ATSTrapezoids in iUnhighlightArea.
 *
 *  Result:
 *    A Boolean result indicating whether ATSUI should redraw the text.
 *    If the client function redraws the text, it should return false,
 *    otherwise it should return true to have ATSUI redraw any text
 *    that needs to be redrawn.
 }
type RedrawBackgroundProcPtr = function( iLayout: ATSUTextLayout; iTextOffset: UniCharArrayOffset; iTextLength: UniCharCount; iUnhighlightArea: ATSTrapezoidPtr; iTrapezoidCount: ItemCount ): Boolean;
// typedef STACK_UPP_TYPE(RedrawBackgroundProcPtr)                 RedrawBackgroundUPP;
// Beats me what this translates to.  If someone finds out they can tell me and we'll update it
type RedrawBackgroundUPP = Ptr;

{
 *  NewRedrawBackgroundUPP()
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function NewRedrawBackgroundUPP( userRoutine: RedrawBackgroundProcPtr ): RedrawBackgroundUPP; external name '_NewRedrawBackgroundUPP';

{
 *  DisposeRedrawBackgroundUPP()
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
procedure DisposeRedrawBackgroundUPP( userUPP: RedrawBackgroundUPP ); external name '_DisposeRedrawBackgroundUPP';

{
 *  InvokeRedrawBackgroundUPP()
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function InvokeRedrawBackgroundUPP( iLayout: ATSUTextLayout; iTextOffset: UniCharArrayOffset; iTextLength: UniCharCount; iUnhighlightArea: ATSTrapezoidPtr; iTrapezoidCount: ItemCount; userUPP: RedrawBackgroundUPP ): Boolean; external name '_InvokeRedrawBackgroundUPP';


{
 *  ATSUBackgroundData
 *
 *  Summary:
 *    Data describing one of two methods for ATSUI to unhighlight text.
 *
 *  Discussion:
 *    When you call ATSUUnhighlightText and the highlighting method
 *    used is kRedrawHighlighting, ATSUI must redraw the text,
 *    including the background, when unhighlighting. The two ways of
 *    doing this are by telling ATSUI to (1) use a solid color to
 *    repaint the background (2) use a callback function to repaint the
 *    background. This union provides that information to ATSUI. See
 *    the definitions of ATSUUnhighlightData, RedrawBackgroundProcPtr,
 *    and ATSUSetHighlightingMethod for more information.
 }
type
    ATSUBackgroundData = record
        case SInt16 of
            1: (
                {
                 * Specifies a color for ATSUI to repaint the background.
                 }
                    backgroundColor: ATSUBackgroundColor;
            );
            2: (
                {
                 * Specifies a Universal Procedure Pointer for ATSUI to call to
                 * redraw the background.
                 }
                    backgroundUPP: RedrawBackgroundUPP;
            );
    end;
    ATSUBackgroundDataPtr = ^ATSUBackgroundData;

{
 *  ATSUUnhighlightData
 *
 *  Summary:
 *    Struct for defining a method for ATSUI to unhighlight text.
 *
 *  Discussion:
 *    There are two methods of highlighting available on Mac OS X:
 *    invert and redraw. For the invert method, no unhighlight method
 *    needs to be specified. ATSUI will simply higlight text by
 *    performing a color inversion on the area surrounding the test.
 *    However, for best results, the redraw method is perferred. With
 *    this method, ATSUI will redraw text with a new background when
 *    highlighting, and redraw it again when unhighlighting. When using
 *    the redraw method, ATSUI needs to know how to restore the
 *    backround when unhighlighting text. That is where the unhighlight
 *    data comes in. This struct tells ATSUI how to restore the
 *    background after a highlight. There are two methods for
 *    specifying this information to ATSUI. One is by specifying a
 *    solid color, the other by providing a callback for redrawing part
 *    of the background.
 }
type
    ATSUUnhighlightData = record

  {
   * Determines which method to use for restoring the background after
   * a highlight; solid color (kATSUBackgroundColor), or drawing
   * callback (kATSUBackgroundCallback). See also the definition of
   * ATSUBackgroundDataType.
   }
        dataType: ATSUBackgroundDataType;

  {
   * This union provides the actual data for ATSUI to use when
   * redrawing the background. See the definition of ATSUBackgroundData
   * for more information.
   }
        unhighlightData: ATSUBackgroundData;
    end;
    ATSUUnhighlightDataPtr = ^ATSUUnhighlightData;
{******************************************************************************}
{ Other ATSUI constants                                                        }
{******************************************************************************}

{
 *  Summary:
 *    Line direction types
 *
 *  Discussion:
 *    These constants are used with the kATSULineDirectionTag control
 *    to determine overall line direction.
 }
const
  {
   * Imposes left-to-right or top-to-bottom dominant direction.
   }
  kATSULeftToRightBaseDirection = 0;

  {
   * Impose right-to-left or bottom-to-top dominant direction.
   }
  kATSURightToLeftBaseDirection = 1;

const
    kATSUStartAlignment    = Fract($00000000);
    kATSUEndAlignment      = Fract($40000000);
    kATSUCenterAlignment   = Fract($20000000);
    kATSUNoJustification   = Fract($00000000);
    kATSUFullJustification = Fract($40000000);

{
 *  Summary:
 *    This constant will be returned from ATSUFindFontFromName if no
 *    valid font can be found. If you pass this constant to
 *    ATSUSetAttributes, it will produce an error.
 }
const
  kATSUInvalidFontID            = 0;


{
 *  Summary:
 *    Pass this constant to line breaking functions (i.e.,
 *    ATSUBreakLine, ATSUBatchBreakLines) if you have already set a
 *    line width as a layout control via the kATSULineWidthTag
 *    attribute.
 }
const
  kATSUUseLineControlWidth      = $7FFFFFFF;


{
 *  Summary:
 *    Pass this constant to the iSelector parameter of the
 *    ATSUGetFontFeatureNameCode function if you wish to obtain the
 *    name code for a feature type rather than a feature selector.
 }
const
  kATSUNoSelector               = $0000FFFF;


{
 *  Summary:
 *    Text buffer convenience constants.
 *
 *  Discussion:
 *    These constants refer to the beginning and end of a text buffer.
 *    Functions which accept these constants are marked below. Do not
 *    pass these constants to functions which do not explicity state
 *    they will accept them.
 }
const

  {
   * Refers to the beginning of a text buffer.
   }
  kATSUFromTextBeginning        = $FFFFFFFF;

  {
   * Refers to the end of a text buffer.
   }
  kATSUToTextEnd                = $FFFFFFFF;

  {
   * Used for bidi cursor movement between paragraphs.
   }
  kATSUFromPreviousLayout       = $FFFFFFFE;

  {
   * Used for bidi cursor movement between paragraphs.
   }
  kATSUFromFollowingLayout      = $FFFFFFFD;


{
 *  Summary:
 *    Other convenience constants.
 }
const

  {
   * Pass this constant to functions that require a set of coordinates
   * (i.e., ATSUDrawText, ATSUHighlightText) if you want ATSUI to use
   * the current Quickdraw graphics port pen location.
   }
  kATSUUseGrafPortPenLoc        = $FFFFFFFF;

  {
   * Pass this constant to functions such as ATSUClearAttributes and
   * ATSUClearLayoutControls if you wish to clear all settings instead
   * of a specific array of settings.
   }
  kATSUClearAll                 = $FFFFFFFF;
{unit AppleEvents}
{$ALIGN MAC68K}







{
    Note:   The functions and types for the building and parsing AppleEvent
            messages has moved to AEDataModel.h
}

{
    Note:   The functions for interacting with events has moved to AEInteraction.h
}

{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}


const
                                                                {  Keywords for Apple event parameters  }
    keyDirectObject             = $2D2D2D2D (* '----' *);
    keyErrorNumber              = $6572726E (* 'errn' *);
    keyErrorString              = $65727273 (* 'errs' *);
    keyProcessSerialNumber      = $70736E20 (* 'psn ' *);                       {  Keywords for special handlers  }
    keyPreDispatch              = $70686163 (* 'phac' *);                       {  preHandler accessor call  }
    keySelectProc               = $73656C68 (* 'selh' *);                       {  more selector call  }
                                                                {  Keyword for recording  }
    keyAERecorderCount          = $72656372 (* 'recr' *);                       {  available only in vers 1.0.1 and greater  }
                                                                {  Keyword for version information  }
    keyAEVersion                = $76657273 (* 'vers' *);                       {  available only in vers 1.0.1 and greater  }

    {    Event Class    }
    kCoreEventClass             = $61657674 (* 'aevt' *);

    {    Event IDÕs     }
    kAEOpenApplication          = $6F617070 (* 'oapp' *);
    kAEOpenDocuments            = $6F646F63 (* 'odoc' *);
    kAEPrintDocuments           = $70646F63 (* 'pdoc' *);
    kAEQuitApplication          = $71756974 (* 'quit' *);
    kAEAnswer                   = $616E7372 (* 'ansr' *);
    kAEApplicationDied          = $6F626974 (* 'obit' *);
    kAEShowPreferences          = $70726566 (* 'pref' *);                       {  sent by Mac OS X when the user chooses the Preferences item  }

    {    Constants for recording    }
    kAEStartRecording           = $72656361 (* 'reca' *);                       {  available only in vers 1.0.1 and greater  }
    kAEStopRecording            = $72656363 (* 'recc' *);                       {  available only in vers 1.0.1 and greater  }
    kAENotifyStartRecording     = $72656331 (* 'rec1' *);                       {  available only in vers 1.0.1 and greater  }
    kAENotifyStopRecording      = $72656330 (* 'rec0' *);                       {  available only in vers 1.0.1 and greater  }
    kAENotifyRecording          = $72656372 (* 'recr' *);                       {  available only in vers 1.0.1 and greater  }





    {
     * AEEventSource is defined as an SInt8 for compatability with pascal.
     * Important note: keyEventSourceAttr is returned by AttributePtr as a typeShortInteger.
     * Be sure to pass at least two bytes of storage to AEGetAttributePtr - the result can be
     * compared directly against the following enums.
        }

type
    AEEventSource               = SInt8;
const
    kAEUnknownSource            = 0;
    kAEDirectCall               = 1;
    kAESameProcess              = 2;
    kAELocalProcess             = 3;
    kAERemoteProcess            = 4;

    {   *************************************************************************
      These calls are used to set up and modify the event dispatch table.
    *************************************************************************   }
    {
     *  AEInstallEventHandler()
     *
     *  Availability:
     *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function AEInstallEventHandler(theAEEventClass: AEEventClass; theAEEventID: AEEventID; handler: AEEventHandlerUPP; handlerRefcon: SInt32; isSysHandler: boolean): OSErr; external name '_AEInstallEventHandler';
{
 *  AERemoveEventHandler()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function AERemoveEventHandler(theAEEventClass: AEEventClass; theAEEventID: AEEventID; handler: AEEventHandlerUPP; isSysHandler: boolean): OSErr; external name '_AERemoveEventHandler';
{
 *  AEGetEventHandler()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function AEGetEventHandler(theAEEventClass: AEEventClass; theAEEventID: AEEventID; var handler: AEEventHandlerUPP; var handlerRefcon: SInt32; isSysHandler: boolean): OSErr; external name '_AEGetEventHandler';
{*************************************************************************
  These calls are used to set up and modify special hooks into the
  AppleEvent manager.
*************************************************************************}
{
 *  AEInstallSpecialHandler()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function AEInstallSpecialHandler(functionClass: AEKeyword; handler: AEEventHandlerUPP; isSysHandler: boolean): OSErr; external name '_AEInstallSpecialHandler';
{
 *  AERemoveSpecialHandler()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function AERemoveSpecialHandler(functionClass: AEKeyword; handler: AEEventHandlerUPP; isSysHandler: boolean): OSErr; external name '_AERemoveSpecialHandler';
{
 *  AEGetSpecialHandler()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function AEGetSpecialHandler(functionClass: AEKeyword; var handler: AEEventHandlerUPP; isSysHandler: boolean): OSErr; external name '_AEGetSpecialHandler';
{*************************************************************************
  This call was added in version 1.0.1. If called with the keyword
  keyAERecorderCount ('recr'), the number of recorders that are
  currently active is returned in 'result'
  (available only in vers 1.0.1 and greater).
*************************************************************************}
{
 *  AEManagerInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function AEManagerInfo(keyWord: AEKeyword; var result: SInt32): OSErr; external name '_AEManagerInfo';
{$ALIGN MAC68K}
{#POP}
{unit Drag}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}

    {
     *  HIPoint
     *
     *  Discussion:
     *    HIPoint is a new, floating point-based type to help express
     *    coordinates in a much richer fashion than the classic QuickDraw
     *    points. It will, in time, be more heavily used throughout the
     *    Toolbox. For now, it is replacing our use of typeQDPoint in mouse
     *    events. This is to better support sub-pixel tablet coordinates.
     *    If you ask for a mouse location with typeQDPoint, and the point
     *    is actually stored as typeHIPoint, it will automatically be
     *    coerced to typeQDPoint for you, so this change should be largely
     *    transparent to applications. HIPoints are in screen space, i.e.
     *    the top left of the screen is 0, 0.
     }

type
    HIPoint = CGPoint;
    HIPointPtr = ^HIPoint;

    {
     *  HISize
     *
     *  Discussion:
     *    HISize is a floating point-based type to help express dimensions
     *    in a much richer fashion than the classic QuickDraw coordinates.
     }

    HISize = CGSize;
    HISizePtr = ^HISize;

    {
     *  HIRect
     *
     *  Discussion:
     *    HIRect is a new, floating point-based type to help express
     *    rectangles in a much richer fashion than the classic QuickDraw
     *    rects. It will, in time, be more heavily used throughout the
     *    Toolbox. HIRects are in screen space, i.e. the top left of the
     *    screen is 0, 0.
     }

     HIRect = CGRect;
     HIRectPtr = ^HIRect; {Added for functions returning pointer to HIRect.}
                          { when a VAR xx:HIRect parameter can be nil, it is changed to xx: HIRectPtr }


{
  _________________________________________________________________________________________________________

   ¥ DRAG MANAGER DATA TYPES
  _________________________________________________________________________________________________________
}


type
    DragRef    = ^SInt32; { an opaque 32-bit type }
    DragRefPtr = ^DragRef;  { when a var xx:DragRef parameter can be nil, it is changed to xx: DragRefPtr }
    DragItemRef                         = UInt32;
    FlavorType                          = OSType;
    {
      _________________________________________________________________________________________________________

       ¥ DRAG ATTRIBUTES
      _________________________________________________________________________________________________________
    }
    DragAttributes              = UInt32;
const
    kDragHasLeftSenderWindow    = $00000001;                    {  drag has left the source window since TrackDrag }
    kDragInsideSenderApplication = $00000002;                   {  drag is occurring within the sender application }
    kDragInsideSenderWindow     = $00000004;                    {  drag is occurring within the sender window }

    {
      _________________________________________________________________________________________________________

       ¥ DRAG BEHAVIORS
      _________________________________________________________________________________________________________
    }

type
    DragBehaviors               = UInt32;
const
    kDragBehaviorNone           = 0;
    kDragBehaviorZoomBackAnimation = $00000001;                 {  do zoomback animation for failed drags (normally enabled). }

    {
      _________________________________________________________________________________________________________

       ¥ DRAG IMAGE FLAGS
      _________________________________________________________________________________________________________
    }

type
    DragImageFlags              = UInt32;
const
    kDragRegionAndImage         = $00000010;                    {  drag region and image }

    {
      _________________________________________________________________________________________________________

       ¥ DRAG IMAGE TRANSLUCENCY LEVELS
      _________________________________________________________________________________________________________
    }

    kDragStandardTranslucency   = 0;                            {  65% image translucency (standard) }
    kDragDarkTranslucency       = 1;                            {  50% image translucency }
    kDragDarkerTranslucency     = 2;                            {  25% image translucency }
    kDragOpaqueTranslucency     = 3;                            {  0% image translucency (opaque) }

    {
      _________________________________________________________________________________________________________

       ¥ DRAG DRAWING procedure MESSAGES
      _________________________________________________________________________________________________________
    }


type
    DragRegionMessage           = SInt16;
const
    kDragRegionBegin            = 1;                            {  initialize drawing }
    kDragRegionDraw             = 2;                            {  draw drag feedback }
    kDragRegionHide             = 3;                            {  hide drag feedback }
    kDragRegionIdle             = 4;                            {  drag feedback idle time }
    kDragRegionEnd              = 5;                            {  end of drawing }

    {
      _________________________________________________________________________________________________________

       ¥ ZOOM ACCELERATION
      _________________________________________________________________________________________________________
    }


type
    ZoomAcceleration            = SInt16;
const
    kZoomNoAcceleration         = 0;                            {  use linear interpolation }
    kZoomAccelerate             = 1;                            {  ramp up step size }
    kZoomDecelerate             = 2;                            {  ramp down step size }

    {
      _________________________________________________________________________________________________________

       ¥ FLAVOR FLAGS
      _________________________________________________________________________________________________________
    }


type
    FlavorFlags                 = UInt32;
const
    flavorSenderOnly            = $01;                          {  flavor is available to sender only }
    flavorSenderTranslated      = $02;                          {  flavor is translated by sender }
    flavorNotSaved              = $04;                          {  flavor should not be saved }
    flavorSystemTranslated      = $0100;                        {  flavor is translated by system }
    flavorDataPromised          = $0200;                        {  flavor data is promised by sender }

    {
      _________________________________________________________________________________________________________

       ¥ FILE SYSTEM CONSTANTS
      _________________________________________________________________________________________________________
    }

    kDragFlavorTypeHFS          = $68667320 (* 'hfs ' *);                       {  flavor type for HFS data }
    kDragFlavorTypePromiseHFS   = $70686673 (* 'phfs' *);                       {  flavor type for promised HFS data }
    flavorTypeHFS               = $68667320 (* 'hfs ' *);                       {  old name }
    flavorTypePromiseHFS        = $70686673 (* 'phfs' *);                       {  old name }

    kDragPromisedFlavorFindFile = $72576D31 (* 'rWm1' *);                       {  promisedFlavor value for Find File }
    kDragPromisedFlavor         = $66737350 (* 'fssP' *);                       {  promisedFlavor value for everything else }

    kDragPseudoCreatorVolumeOrDirectory = $4D414353 (* 'MACS' *);               {  "creator code" for volume or directory }
    kDragPseudoFileTypeVolume   = $6469736B (* 'disk' *);                       {  "file type" for volume }
    kDragPseudoFileTypeDirectory = $666F6C64 (* 'fold' *);                      {  "file type" for directory }

    {
      _________________________________________________________________________________________________________

       ¥ SPECIAL FLAVORS
      _________________________________________________________________________________________________________
    }

    flavorTypeDirectory         = $64697279 (* 'diry' *);                       {  flavor type for AOCE directories }

    {
      _________________________________________________________________________________________________________

       ¥ FLAVORS FOR FINDER 8.0 AND LATER
      _________________________________________________________________________________________________________
    }

    kFlavorTypeClippingName             = $636C6E6D (* 'clnm' *);               {  name hint for clipping file (preferred over 'clfn') }
    kFlavorTypeClippingFilename         = $636C666E (* 'clfn' *);               {  name for clipping file }
    kFlavorTypeUnicodeClippingName      = $75636C6E (* 'ucln' *);               { unicode name hint for clipping file (preferred over 'uclf')}
    kFlavorTypeUnicodeClippingFilename  = $75636C66 (* 'uclf' *);               { unicode name for clipping file}
    kFlavorTypeDragToTrashOnly          = $66647474 (* 'fdtt' *);               {  for apps that want to allow dragging private data to the trash }
    kFlavorTypeFinderNoTrackingBehavior = $666E7462 (* 'fntb' *);               {  Finder completely ignores any drag containing this flavor }

    {
      _________________________________________________________________________________________________________

       ¥ DRAG TRACKING HANDLER MESSAGES
      _________________________________________________________________________________________________________
    }


type
    DragTrackingMessage         = SInt16;
const
    kDragTrackingEnterHandler   = 1;                            {  drag has entered handler }
    kDragTrackingEnterWindow    = 2;                            {  drag has entered window }
    kDragTrackingInWindow       = 3;                            {  drag is moving within window }
    kDragTrackingLeaveWindow    = 4;                            {  drag has exited window }
    kDragTrackingLeaveHandler   = 5;                            {  drag has exited handler }


    {
      ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
       ¥ STANDARD DROP LOCATIONS
      ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
    }


    {
     *  Summary:
     *    Standard Drop Location constants
     *
     *  Discussion:
     *    The following constants define common "meta" drop locations.
     }
const

  {
   * The drop location was in the trash.  This is set when a drag is
   * dropped on the trash icon.  Setting this standard drop location
   * sets the traditional drop location to an alias to the trash folder
   * automatically.
  }
  kDragStandardDropLocationTrash = $74727368 (* 'trsh' *);

  {
   * The receiver did not specify a drop lcoation. This is the default.
   }
  kDragStandardDropLocationUnknown = $756E6B6E (* 'unkn' *);

type
  StandardDropLocation = OSType;

    {
      _________________________________________________________________________________________________________

       ¥ DRAG ACTIONS
      _________________________________________________________________________________________________________
    }


    {
     *  Summary:
     *    Drag Action constants
     *
     *  Discussion:
     *    The following constants define, in a general way, what actions a
     *    drag should or has performed.  Some drag actions enforce a mode
     *    of operation while others are flexible suggestions.  These
     *    constants are used in conjunction with the
     *    Get/SetDragAllowableActions() and Get/SetDragDropAction() APIs.
     *    Adopting the Drag Action APIs increases compatability with the
     *    Cocoa drag operation model.
        }
const
    kDragActionNothing          = 0;
    kDragActionCopy             = 1;
    kDragActionAlias            = $00000002;
    kDragActionGeneric          = $00000004;
    kDragActionPrivate          = $00000008;
    kDragActionMove             = $00000010;
    kDragActionDelete           = $00000020;
    kDragActionAll              = $FFFFFFFF;


type
    DragActions                         = UInt32;
    {
      _________________________________________________________________________________________________________

       ¥ HFS FLAVORS
      _________________________________________________________________________________________________________
    }
    HFSFlavorPtr = ^HFSFlavor;
    HFSFlavor = record
        fileType:               OSType;                                 {  file type  }
        fileCreator:            OSType;                                 {  file creator  }
        fdFlags:                UInt16;                                 {  Finder flags  }
        fileSpec:               FSSpec;                                 {  file system specification  }
    end;

    PromiseHFSFlavorPtr = ^PromiseHFSFlavor;
    PromiseHFSFlavor = record
        fileType:               OSType;                                 {  file type  }
        fileCreator:            OSType;                                 {  file creator  }
        fdFlags:                UInt16;                                 {  Finder flags  }
        promisedFlavor:         FlavorType;                             {  promised flavor containing an FSSpec  }
    end;

    {
      _________________________________________________________________________________________________________

       ¥ APPLICATION-DEFINED DRAG HANDLER ROUTINES
      _________________________________________________________________________________________________________
    }
    DragTrackingHandlerProcPtr = function(message: DragTrackingMessage; theWindow: WindowRef; handlerRefCon: UnivPtr; theDrag: DragRef): OSErr;

    DragReceiveHandlerProcPtr = function(theWindow: WindowRef; handlerRefCon: UnivPtr; theDrag: DragRef): OSErr;

    DragTrackingHandlerUPP = ^SInt32; { an opaque UPP }
    DragReceiveHandlerUPP = ^SInt32; { an opaque UPP }

const
    uppDragTrackingHandlerProcInfo = $00003FA0;
    uppDragReceiveHandlerProcInfo = $00000FE0;
    {
     *  NewDragTrackingHandlerUPP()
     *
     *  Availability:
     *    Non-Carbon CFM:   available as macro/inline
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function NewDragTrackingHandlerUPP(userRoutine: DragTrackingHandlerProcPtr): DragTrackingHandlerUPP; external name '_NewDragTrackingHandlerUPP'; { old name was NewDragTrackingHandlerProc }
{
 *  NewDragReceiveHandlerUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewDragReceiveHandlerUPP(userRoutine: DragReceiveHandlerProcPtr): DragReceiveHandlerUPP; external name '_NewDragReceiveHandlerUPP'; { old name was NewDragReceiveHandlerProc }
{
 *  DisposeDragTrackingHandlerUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeDragTrackingHandlerUPP(userUPP: DragTrackingHandlerUPP); external name '_DisposeDragTrackingHandlerUPP';
{
 *  DisposeDragReceiveHandlerUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeDragReceiveHandlerUPP(userUPP: DragReceiveHandlerUPP); external name '_DisposeDragReceiveHandlerUPP';
{
 *  InvokeDragTrackingHandlerUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeDragTrackingHandlerUPP(message: DragTrackingMessage; theWindow: WindowRef; handlerRefCon: UnivPtr; theDrag: DragRef; userRoutine: DragTrackingHandlerUPP): OSErr; external name '_InvokeDragTrackingHandlerUPP'; { old name was CallDragTrackingHandlerProc }
{
 *  InvokeDragReceiveHandlerUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeDragReceiveHandlerUPP(theWindow: WindowRef; handlerRefCon: UnivPtr; theDrag: DragRef; userRoutine: DragReceiveHandlerUPP): OSErr; external name '_InvokeDragReceiveHandlerUPP'; { old name was CallDragReceiveHandlerProc }
{
  _________________________________________________________________________________________________________

   ¥ APPLICATION-DEFINED ROUTINES
  _________________________________________________________________________________________________________
}

type
    DragSendDataProcPtr = function(theType: FlavorType; dragSendRefCon: UnivPtr; theItemRef: DragItemRef; theDrag: DragRef): OSErr;

    DragInputProcPtr = function(var mouse: Point; var modifiers: SInt16; dragInputRefCon: UnivPtr; theDrag: DragRef): OSErr;

    DragDrawingProcPtr = function(message: DragRegionMessage; showRegion: RgnHandle; showOrigin: Point; hideRegion: RgnHandle; hideOrigin: Point; dragDrawingRefCon: UnivPtr; theDrag: DragRef): OSErr;

    DragSendDataUPP = ^SInt32; { an opaque UPP }
    DragInputUPP = ^SInt32; { an opaque UPP }
    DragDrawingUPP = ^SInt32; { an opaque UPP }

const
    uppDragSendDataProcInfo = $00003FE0;
    uppDragInputProcInfo = $00003FE0;
    uppDragDrawingProcInfo = $000FFFA0;
    {
     *  NewDragSendDataUPP()
     *
     *  Availability:
     *    Non-Carbon CFM:   available as macro/inline
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function NewDragSendDataUPP(userRoutine: DragSendDataProcPtr): DragSendDataUPP; external name '_NewDragSendDataUPP'; { old name was NewDragSendDataProc }
{
 *  NewDragInputUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewDragInputUPP(userRoutine: DragInputProcPtr): DragInputUPP; external name '_NewDragInputUPP'; { old name was NewDragInputProc }
{
 *  NewDragDrawingUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewDragDrawingUPP(userRoutine: DragDrawingProcPtr): DragDrawingUPP; external name '_NewDragDrawingUPP'; { old name was NewDragDrawingProc }
{
 *  DisposeDragSendDataUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeDragSendDataUPP(userUPP: DragSendDataUPP); external name '_DisposeDragSendDataUPP';
{
 *  DisposeDragInputUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeDragInputUPP(userUPP: DragInputUPP); external name '_DisposeDragInputUPP';
{
 *  DisposeDragDrawingUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeDragDrawingUPP(userUPP: DragDrawingUPP); external name '_DisposeDragDrawingUPP';
{
 *  InvokeDragSendDataUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeDragSendDataUPP(theType: FlavorType; dragSendRefCon: UnivPtr; theItemRef: DragItemRef; theDrag: DragRef; userRoutine: DragSendDataUPP): OSErr; external name '_InvokeDragSendDataUPP'; { old name was CallDragSendDataProc }
{
 *  InvokeDragInputUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeDragInputUPP(var mouse: Point; var modifiers: SInt16; dragInputRefCon: UnivPtr; theDrag: DragRef; userRoutine: DragInputUPP): OSErr; external name '_InvokeDragInputUPP'; { old name was CallDragInputProc }
{
 *  InvokeDragDrawingUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeDragDrawingUPP(message: DragRegionMessage; showRegion: RgnHandle; showOrigin: Point; hideRegion: RgnHandle; hideOrigin: Point; dragDrawingRefCon: UnivPtr; theDrag: DragRef; userRoutine: DragDrawingUPP): OSErr; external name '_InvokeDragDrawingUPP'; { old name was CallDragDrawingProc }
{
  _________________________________________________________________________________________________________

   ¥ INSTALLING AND REMOVING HANDLERS API'S
  _________________________________________________________________________________________________________
}

{
 *  InstallTrackingHandler()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DragLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InstallTrackingHandler(trackingHandler: DragTrackingHandlerUPP; theWindow: WindowRef; handlerRefCon: UnivPtr): OSErr; external name '_InstallTrackingHandler';
{
 *  InstallReceiveHandler()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DragLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InstallReceiveHandler(receiveHandler: DragReceiveHandlerUPP; theWindow: WindowRef; handlerRefCon: UnivPtr): OSErr; external name '_InstallReceiveHandler';
{
 *  RemoveTrackingHandler()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DragLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function RemoveTrackingHandler(trackingHandler: DragTrackingHandlerUPP; theWindow: WindowRef): OSErr; external name '_RemoveTrackingHandler';
{
 *  RemoveReceiveHandler()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DragLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function RemoveReceiveHandler(receiveHandler: DragReceiveHandlerUPP; theWindow: WindowRef): OSErr; external name '_RemoveReceiveHandler';
{
  _________________________________________________________________________________________________________

   ¥ CREATING & DISPOSING
  _________________________________________________________________________________________________________
}

{
 *  NewDrag()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DragLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewDrag(var theDrag: DragRef): OSErr; external name '_NewDrag';
{
 *  DisposeDrag()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DragLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DisposeDrag(theDrag: DragRef): OSErr; external name '_DisposeDrag';
{
  _________________________________________________________________________________________________________

   ¥ ADDING DRAG ITEM FLAVORS
  _________________________________________________________________________________________________________
}

{
    The method for setting Drag Manager promises differs from that for Scrap Manger promises.  This chart
    describes the method for setting drag promises via AddDragItemFlavor().

        dataPtr         dataSize                                result
     pointer value  actual data size    The data of size dataSize pointed to by dataPtr is added to the drag.
        NULL             ignored        A promise is placed on the drag.
}
{
 *  AddDragItemFlavor()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DragLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function AddDragItemFlavor(theDrag: DragRef; theItemRef: DragItemRef; theType: FlavorType; dataPtr: UnivPtr; dataSize: Size; theFlags: FlavorFlags): OSErr; external name '_AddDragItemFlavor';
{
 *  SetDragItemFlavorData()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DragLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetDragItemFlavorData(theDrag: DragRef; theItemRef: DragItemRef; theType: FlavorType; dataPtr: UnivPtr; dataSize: Size; dataOffset: UInt32): OSErr; external name '_SetDragItemFlavorData';
{
  _________________________________________________________________________________________________________

   ¥ PROVIDING CALLBACK PROCEDURES
  _________________________________________________________________________________________________________
}

{
 *  SetDragSendProc()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DragLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetDragSendProc(theDrag: DragRef; sendProc: DragSendDataUPP; dragSendRefCon: UnivPtr): OSErr; external name '_SetDragSendProc';
{
 *  SetDragInputProc()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DragLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetDragInputProc(theDrag: DragRef; inputProc: DragInputUPP; dragInputRefCon: UnivPtr): OSErr; external name '_SetDragInputProc';
{
 *  SetDragDrawingProc()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DragLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetDragDrawingProc(theDrag: DragRef; drawingProc: DragDrawingUPP; dragDrawingRefCon: UnivPtr): OSErr; external name '_SetDragDrawingProc';
{
  _________________________________________________________________________________________________________

   ¥ SETTING THE DRAG IMAGE
  _________________________________________________________________________________________________________
}

{
 *  SetDragImage()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DragLib 7.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetDragImage(theDrag: DragRef; imagePixMap: PixMapHandle; imageRgn: RgnHandle; imageOffsetPt: Point; theImageFlags: DragImageFlags): OSErr; external name '_SetDragImage';

{
 *  SetDragImageWithCGImage()
 *
 *  Discussion:
 *    Used by the sender of the drag to set the image, in CGImage
 *    format, to be displayed as user feedback during the drag.  This
 *    API may be called  at any point during the drag to update the
 *    image.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inDrag:
 *      The drag reference for which the image will be displayed.
 *
 *    inCGImage:
 *      The CGImageRef for the image to be displayed during the drag.
 *      The image is retained internally by the Drag Manager for the
 *      duration of the drag so it may be released by the client
 *      immediately after setting.
 *
 *    inImageOffsetPt:
 *      A pointer to the offset from the mouse to the upper left of the
 *      image (normally expressed in negative values).  This differs
 *      from the usage of the offset passed to SetDragImage().  Here,
 *      an offset of ( -30, -30 ) will center a 60x60 pixel image on
 *      the drag mouse.
 *
 *    inImageFlags:
 *      The flags determining image drawing during the drag.
 *
 *  Result:
 *    An operating system result code.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }

  function SetDragImageWithCGImage(
    inDrag: DragRef;
    inCGImage: CGImageRef;
    const (*var*) inImageOffsetPt: HIPoint;
    inImageFlags: DragImageFlags): OSStatus; external name '_SetDragImageWithCGImage';


{
  _________________________________________________________________________________________________________

   ¥ ALTERING THE BEHAVIOR of A DRAG
  _________________________________________________________________________________________________________
}
{
 *  ChangeDragBehaviors()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DragLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ChangeDragBehaviors(theDrag: DragRef; inBehaviorsToSet: DragBehaviors; inBehaviorsToClear: DragBehaviors): OSErr; external name '_ChangeDragBehaviors';
{
  _________________________________________________________________________________________________________

   ¥ PERFORMING A DRAG
  _________________________________________________________________________________________________________
}
{
 *  TrackDrag()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DragLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TrackDrag(theDrag: DragRef; const (*var*) theEvent: EventRecord; theRegion: RgnHandle): OSErr; external name '_TrackDrag';
{
  _________________________________________________________________________________________________________

   ¥ GETTING DRAG ITEM INFORMATION
  _________________________________________________________________________________________________________
}

{
 *  CountDragItems()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DragLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CountDragItems(theDrag: DragRef; var numItems: UInt16): OSErr; external name '_CountDragItems';
{
 *  GetDragItemReferenceNumber()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DragLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetDragItemReferenceNumber(theDrag: DragRef; index: UInt16; var theItemRef: DragItemRef): OSErr; external name '_GetDragItemReferenceNumber';
{
 *  CountDragItemFlavors()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DragLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CountDragItemFlavors(theDrag: DragRef; theItemRef: DragItemRef; var numFlavors: UInt16): OSErr; external name '_CountDragItemFlavors';
{
 *  GetFlavorType()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DragLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetFlavorType(theDrag: DragRef; theItemRef: DragItemRef; index: UInt16; var theType: FlavorType): OSErr; external name '_GetFlavorType';
{
 *  GetFlavorFlags()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DragLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetFlavorFlags(theDrag: DragRef; theItemRef: DragItemRef; theType: FlavorType; var theFlags: FlavorFlags): OSErr; external name '_GetFlavorFlags';
{
 *  GetFlavorDataSize()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DragLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetFlavorDataSize(theDrag: DragRef; theItemRef: DragItemRef; theType: FlavorType; var dataSize: Size): OSErr; external name '_GetFlavorDataSize';
{
 *  GetFlavorData()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DragLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetFlavorData(theDrag: DragRef; theItemRef: DragItemRef; theType: FlavorType; dataPtr: UnivPtr; var dataSize: Size; dataOffset: UInt32): OSErr; external name '_GetFlavorData';
{
  _________________________________________________________________________________________________________

   ¥ DRAG ITEM BOUNDS
  _________________________________________________________________________________________________________
}

{
 *  GetDragItemBounds()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DragLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetDragItemBounds(theDrag: DragRef; theItemRef: DragItemRef; var itemBounds: Rect): OSErr; external name '_GetDragItemBounds';
{
 *  SetDragItemBounds()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DragLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetDragItemBounds(theDrag: DragRef; theItemRef: DragItemRef; const (*var*) itemBounds: Rect): OSErr; external name '_SetDragItemBounds';
{
  _________________________________________________________________________________________________________

   ¥ DROP LOCATIONS
  _________________________________________________________________________________________________________
}

{
 *  GetDropLocation()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DragLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetDropLocation(theDrag: DragRef; var dropLocation: AEDesc): OSErr; external name '_GetDropLocation';
{
 *  SetDropLocation()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DragLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetDropLocation(theDrag: DragRef; const (*var*) dropLocation: AEDesc): OSErr; external name '_SetDropLocation';

{
  _________________________________________________________________________________________________________

   ¥ STANDARD DROP LOCATIONS
  _________________________________________________________________________________________________________
}

{
 *  GetStandardDropLocation()
 *
 *  Discussion:
 *    Gets the standard drop location that was set by the receiver of
 *    the drag.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    theDrag:
 *      The drag reference from which to retrieve the allowable drag
 *      actions.
 *
 *    outDropLocation:
 *      A pointer to the standard drop location, set by the receiver,
 *      representing the location where the drag was dropped.
 *
 *  Result:
 *    An operating system result code.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
 *    Non-Carbon CFM:   not available
 }

function GetStandardDropLocation(
  theDrag: DragRef;
  Var outDropLocation: StandardDropLocation): OSStatus; external name '_GetStandardDropLocation';


{
 *  SetStandardDropLocation()
 *
 *  Discussion:
 *    Used by the receiver of the drag to set the standard drop
 *    location.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    theDrag:
 *      The drag reference from which to retrieve the allowable drag
 *      actions.
 *
 *    dropLocation:
 *      The standard drop location representing the location where the
 *      drag was dropped.
 *
 *  Result:
 *    An operating system result code.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
 *    Non-Carbon CFM:   not available
 }

function SetStandardDropLocation(
  theDrag: DragRef;
  dropLocation: StandardDropLocation): OSStatus; external name '_SetStandardDropLocation';


{
  _________________________________________________________________________________________________________

   ¥ GETTING INFORMATION ABOUT A DRAG
  _________________________________________________________________________________________________________
}

{
 *  GetDragAttributes()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DragLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetDragAttributes(theDrag: DragRef; var flags: DragAttributes): OSErr; external name '_GetDragAttributes';
{
 *  GetDragMouse()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DragLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetDragMouse(theDrag: DragRef; var mouse: Point; var globalPinnedMouse: Point): OSErr; external name '_GetDragMouse';
{
 *  SetDragMouse()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DragLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetDragMouse(theDrag: DragRef; globalPinnedMouse: Point): OSErr; external name '_SetDragMouse';
{
 *  GetDragOrigin()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DragLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetDragOrigin(theDrag: DragRef; var globalInitialMouse: Point): OSErr; external name '_GetDragOrigin';
{
 *  GetDragModifiers()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DragLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetDragModifiers(theDrag: DragRef; var modifiers: SInt16; var mouseDownModifiers: SInt16; var mouseUpModifiers: SInt16): OSErr; external name '_GetDragModifiers';
{
  _________________________________________________________________________________________________________

   ¥ ACCESSING DRAG ACTIONS
  _________________________________________________________________________________________________________
}

{
 *  GetDragAllowableActions()
 *
 *  Discussion:
 *    Gets the actions the drag sender has allowed the receiver to
 *    perform. These are not requirements, but they highly suggested
 *    actions which allows the drag receiver to improve harmony across
 *    the system.  The allowable actions received are always those
 *    local to the caller's process.
 *
 *  Parameters:
 *
 *    theDrag:
 *      The drag reference from which to retreive the allowable drag
 *      actions.
 *
 *    outActions:
 *      A pointer to receive the field of allowable drag actions.
 *
 *  Result:
 *    An operating system result code.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.1 and later
 *    Mac OS X:         in version 10.1 and later
 }
function GetDragAllowableActions(theDrag: DragRef; var outActions: DragActions): OSStatus; external name '_GetDragAllowableActions';

{
 *  SetDragAllowableActions()
 *
 *  Discussion:
 *    Sets the actions the receiver of the drag is allowed to perform.
 *    These are not requirements, but they highly suggested actions
 *    which allows the drag receiver to improve harmony across the
 *    system.  The caller may select wether these drag actions apply to
 *    a local or remote process.
 *
 *  Parameters:
 *
 *    theDrag:
 *      The drag reference in which to set the allowable drag actions.
 *
 *    inActions:
 *      A field of allowable drag actions to be set.
 *
 *    isLocal:
 *      A boolean value allowing the drag sender to distinguish between
 *      those drag actions allowable by the local receiver versus a
 *      remote one.
 *
 *  Result:
 *    An operating system result code.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.1 and later
 *    Mac OS X:         in version 10.1 and later
 }
function SetDragAllowableActions(theDrag: DragRef; inActions: DragActions; isLocal: boolean): OSStatus; external name '_SetDragAllowableActions';

{
 *  GetDragDropAction()
 *
 *  Discussion:
 *    Gets the action performed by the receiver of the drag.  More than
 *    one action may have been performed.
 *
 *  Parameters:
 *
 *    theDrag:
 *      The drag reference from which to retreive the performed drop
 *      action.
 *
 *    outAction:
 *      A pointer to receive the drag action performed.
 *
 *  Result:
 *    An operating system result code.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.1 and later
 *    Mac OS X:         in version 10.1 and later
 }
function GetDragDropAction(theDrag: DragRef; var outAction: DragActions): OSStatus; external name '_GetDragDropAction';

{
 *  SetDragDropAction()
 *
 *  Discussion:
 *    Sets the action performed by the receiver of the drag.  More than
 *    one action may be performed.
 *
 *  Parameters:
 *
 *    theDrag:
 *      The drag reference in which to set the performed drop action.
 *
 *    inAction:
 *      The drop action performed.
 *
 *  Result:
 *    An operating system result code.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.1 and later
 *    Mac OS X:         in version 10.1 and later
 }
function SetDragDropAction(theDrag: DragRef; inAction: DragActions): OSStatus; external name '_SetDragDropAction';

{
  _________________________________________________________________________________________________________

   ¥ DRAG HIGHLIGHTING
  _________________________________________________________________________________________________________
}

{
 *  ShowDragHilite()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DragLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ShowDragHilite(theDrag: DragRef; hiliteFrame: RgnHandle; inside: boolean): OSErr; external name '_ShowDragHilite';
{
 *  HideDragHilite()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DragLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function HideDragHilite(theDrag: DragRef): OSErr; external name '_HideDragHilite';
{
 *  DragPreScroll()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DragLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DragPreScroll(theDrag: DragRef; dH: SInt16; dV: SInt16): OSErr; external name '_DragPreScroll';
{
 *  DragPostScroll()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DragLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DragPostScroll(theDrag: DragRef): OSErr; external name '_DragPostScroll';
{
 *  UpdateDragHilite()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DragLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function UpdateDragHilite(theDrag: DragRef; updateRgn: RgnHandle): OSErr; external name '_UpdateDragHilite';
{
 *  GetDragHiliteColor()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DragLib 7.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetDragHiliteColor(window: WindowRef; var color: RGBColor): OSErr; external name '_GetDragHiliteColor';
{
  _________________________________________________________________________________________________________

   ¥ UTILITIES
  _________________________________________________________________________________________________________
}


{
 *  WaitMouseMoved()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DragLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function WaitMouseMoved(initialMouse: Point): boolean; external name '_WaitMouseMoved';
{
 *  ZoomRects()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DragLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ZoomRects(const (*var*) fromRect: Rect; const (*var*) toRect: Rect; zoomSteps: SInt16; acceleration: ZoomAcceleration): OSErr; external name '_ZoomRects';
{
 *  ZoomRegion()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DragLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ZoomRegion(region: RgnHandle; zoomDistance: Point; zoomSteps: SInt16; acceleration: ZoomAcceleration): OSErr; external name '_ZoomRegion';
{
  _________________________________________________________________________________________________________
   ¥ OLD NAMES
     These are provided for compatiblity with older source bases.  It is recommended to not use them since
     they may removed from this interface file at any time.
  _________________________________________________________________________________________________________
}


type
    DragReference                       = DragRef;
    ItemReference                       = DragItemRef;

{$ALIGN MAC68K}
{#POP}
{unit DriverGestalt}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}

{__________________________________________________________________________________}
{ The Driver Gestalt bit in the dCtlFlags }

const
    kbDriverGestaltEnable       = 2;
    kmDriverGestaltEnableMask   = $04;

    {   __________________________________________________________________________________  }
    {    Driver Gestalt related csCodes     }
    kDriverGestaltCode          = 43;                           {  various uses  }
    kDriverConfigureCode        = 43;                           {  various uses  }
    kcsSetBootPartitionCode     = 44;                           {  Set Startup Partition Control Call  }
    kcsGetBootPartitionStatus   = 44;                           {  Get Startup Partition Status Call  }
    kdgLowPowerMode             = 70;                           {  Sets/Returns the current energy consumption level  }
    kdgReturnDeviceID           = 120;                          {  returns SCSI DevID in csParam[0]  }
    kdgGetCDDeviceInfo          = 121;                          {  returns CDDeviceCharacteristics in csParam[0]  }

    {   __________________________________________________________________________________  }
    {    Driver Gestalt selectors   }
    kdgVersion                  = $76657273 (* 'vers' *);                       {  Version number of the driver in standard Apple format  }
    kdgDeviceType               = $64657674 (* 'devt' *);                       {  The type of device the driver is driving.  }
    kdgInterface                = $696E7466 (* 'intf' *);                       {  The underlying interface that the driver is using (if any)  }
    kdgSync                     = $73796E63 (* 'sync' *);                       {  True if driver only behaves synchronously.  }
    kdgBoot                     = $626F6F74 (* 'boot' *);                       {  value to place in PRAM for this drive (long)  }
    kdgWide                     = $77696465 (* 'wide' *);                       {  True if driver supports ioWPosOffset  }
    kdgPurge                    = $70757267 (* 'purg' *);                       {  Driver purge permission (True = purge; False = no purge)  }
    kdgSupportsSwitching        = $6C707772 (* 'lpwr' *);                       {  True if driver supports power switching  }
    kdgMin3VPower               = $706D6E33 (* 'pmn3' *);                       {  Minimum 3.3V power consumption in microWatts  }
    kdgMin5VPower               = $706D6E35 (* 'pmn5' *);                       {  Minimum 5V power consumption in microWatts  }
    kdgMax3VPower               = $706D7833 (* 'pmx3' *);                       {  Maximum 3.3V power consumption in microWatts  }
    kdgMax5VPower               = $706D7835 (* 'pmx5' *);                       {  Maximum 5V power consumption in microWatts  }
    kdgInHighPower              = $70737461 (* 'psta' *);                       {  True if device is currently in high power mode  }
    kdgSupportsPowerCtl         = $70737570 (* 'psup' *);                       {  True if driver supports following five calls  }
    kdgAPI                      = $64415049 (* 'dAPI' *);                       {  API support for PC Exchange  }
    kdgEject                    = $656A6563 (* 'ejec' *);                       {  Eject options for shutdown/restart (Shutdown Mgr)  }
    kdgFlush                    = $666C7573 (* 'flus' *);                       {  Determine if disk driver supports flush and if it needs a flush  }
    kdgVMOptions                = $766D6F70 (* 'vmop' *);                       {  Disk drive's Virtual Memory options  }
    kdgMediaInfo                = $6D696E66 (* 'minf' *);                       {  return media specific information  }
    kdgPhysDriveIconSuite       = $64696373 (* 'dics' *);                       {  Return a pointer to a IconFamily ('icns') data structure for  }
                                                                {  Disk Driver physical drive (formerly in csCode 21) in driverGestaltResponse.  }
    kdgMediaIconSuite           = $6D696373 (* 'mics' *);                       {  Return a pointer to a IconFamily ('icns') data structure for  }
                                                                {  Disk Driver media (formerly in csCode 22) in driverGestaltResponse.  }
                                                                {  See IconServices.r for information detailing the 'icns' resource data format  }
    kdgMediaName                = $6D6E616D (* 'mnam' *);                       {  Return a pointer to a pascal string describing the Disk Driver (formerly in csCode 21) in driverGestaltResponse.  }
    kdgGetDriveAddInfo          = $64696774 (* 'digt' *);                       {  Get a disk driver's add-drive information record  }
    kdcAddDriveWithInfo         = $64696164 (* 'diad' *);                       {  Tell disk driver to add the drive specified with the drive information record  }
                                                                {  DriverGestalt selector for ATA drivers to signify that they are device 0/1 compliant.  }
                                                                {  see http://developer.apple.com/techpubs/hardware/Developer_Notes/System_Software/ATA_Device_Zero_One.pdf  }
    kdgATADev1                  = $64657631 (* 'dev1' *);
    kdgDeviceReference          = $64767266 (* 'dvrf' *);                       {  Returns a 32-bit reference number for the device, format is interface specific  }
    kdgNameRegistryEntry        = $6E6D7267 (* 'nmrg' *);                       {  Returns a pointer to the Name Registry ID for the device  }
    kdgDeviceModelInfo          = $696E666F (* 'info' *);                       {  Returns a pointer to a Device Model Info structure  }
    kdgSupportedMediaTypes      = $6D647479 (* 'mdty' *);                       {  Returns a count and a pointer to list of all media types supported by the device  }
    kdgOpenFirmwareBootSupport  = $6F667074 (* 'ofpt' *);                       {  Returns information that Open Firmware needs to support booting from the device  }
    kdgOpenFirmwareBootingSupport = $6F666274 (* 'ofbt' *);                     {  Returns same information as kdgOpenFirmwareBootSupport, but is only used during booting }

    {   __________________________________________________________________________________  }
    {    Driver Configure selectors     }
    kdcFlush                    = $666C7573 (* 'flus' *);                       {  Tell a disk driver to flush its cache and any hardware caches  }
    kdcVMOptions                = $766D6F70 (* 'vmop' *);                       {  Change the disk driver's Virtual Memory options  }

    {   __________________________________________________________________________________  }
    {    control parameter block for Driver Configure calls     }

type
    DriverConfigParamPtr = ^DriverConfigParam;
    DriverConfigParam = record
        qLink:                  QElemPtr;
        qType:                  SInt16;
        ioTrap:                 SInt16;
        ioCmdAddr:              Ptr;
        ioCompletion:           ProcPtr;
        ioResult:               OSErr;
        ioNamePtr:              StringPtr;
        ioVRefNum:              SInt16;
        ioCRefNum:              SInt16;                             {  refNum for I/O operation  }
        csCode:                 SInt16;                             {  == kDriverConfigureCode  }
        driverConfigureSelector: OSType;
        driverConfigureParameter: UInt32;
    end;

    {   __________________________________________________________________________________  }
    {    status parameter block for Driver Gestalt calls    }
    DriverGestaltParamPtr = ^DriverGestaltParam;
    DriverGestaltParam = record
        qLink:                  QElemPtr;
        qType:                  SInt16;
        ioTrap:                 SInt16;
        ioCmdAddr:              Ptr;
        ioCompletion:           ProcPtr;
        ioResult:               OSErr;
        ioNamePtr:              StringPtr;
        ioVRefNum:              SInt16;
        ioCRefNum:              SInt16;                             {  refNum for I/O operation  }
        csCode:                 SInt16;                             {     == kDriverGestaltCode  }
        driverGestaltSelector:  OSType;                                 {  'sync', 'vers', etc.  }
        driverGestaltResponse:  UInt32;                                 {  Could be a pointer, bit field or other format  }
        driverGestaltResponse1: UInt32;                                 {  Could be a pointer, bit field or other format  }
        driverGestaltResponse2: UInt32;                                 {  Could be a pointer, bit field or other format  }
        driverGestaltResponse3: UInt32;                                 {  Could be a pointer, bit field or other format  }
        driverGestaltfiller:    UInt16;                                 {  To pad out to the size of a controlPB  }
    end;

    {   __________________________________________________________________________________  }
    {    Device Types response  }
    DriverGestaltDevTResponsePtr = ^DriverGestaltDevTResponse;
    DriverGestaltDevTResponse = record
        deviceType:             OSType;
    end;


const
    kdgDiskType                 = $6469736B (* 'disk' *);                       {  standard r/w disk drive  }
    kdgTapeType                 = $74617065 (* 'tape' *);                       {  tape drive  }
    kdgPrinterType              = $70726E74 (* 'prnt' *);                       {  printer  }
    kdgProcessorType            = $70726F63 (* 'proc' *);                       {  processor  }
    kdgWormType                 = $776F726D (* 'worm' *);                       {  write-once  }
    kdgCDType                   = $6364726D (* 'cdrm' *);                       {  cd-rom drive  }
    kdgFloppyType               = $666C6F70 (* 'flop' *);                       {  floppy disk drive  }
    kdgScannerType              = $7363616E (* 'scan' *);                       {  scanner  }
    kdgFileType                 = $66696C65 (* 'file' *);                       {  Logical Partition type based on a file (Drive Container)  }
    kdgRemovableType            = $7264736B (* 'rdsk' *);                       {  A removable media hard disk drive ie. Syquest, Bernioulli  }

    {   __________________________________________________________________________________  }
    {    Device Interfaces response     }

type
    DriverGestaltIntfResponsePtr = ^DriverGestaltIntfResponse;
    DriverGestaltIntfResponse = record
        interfaceType:          OSType;
    end;


const
    kdgScsiIntf                 = $73637369 (* 'scsi' *);
    kdgPcmciaIntf               = $70636D63 (* 'pcmc' *);
    kdgATAIntf                  = $61746120 (* 'ata ' *);
    kdgUSBIntf                  = $75736220 (* 'usb ' *);
    kdgFireWireIntf             = $66697265 (* 'fire' *);
    kdgExtBus                   = $63617264 (* 'card' *);
    kdgNetworkIntf              = $6E657420 (* 'net ' *);

    {   __________________________________________________________________________________  }
    {    Power Saving   }

type
    DriverGestaltPowerResponsePtr = ^DriverGestaltPowerResponse;
    DriverGestaltPowerResponse = record
        powerValue:             UInt32;                                 {  Power consumed in µWatts  }
    end;

    {   __________________________________________________________________________________  }
    {    Disk Specific  }
    DriverGestaltSyncResponsePtr = ^DriverGestaltSyncResponse;
    DriverGestaltSyncResponse = record
        behavesSynchronously:   boolean;
        pad:                    packed array [0..2] of UInt8;
    end;

    DriverGestaltBootResponsePtr = ^DriverGestaltBootResponse;
    DriverGestaltBootResponse = record
        extDev:                 SInt8;                                  {   Packed target (upper 5 bits) LUN (lower 3 bits)  }
        partition:              SInt8;                                  {   Unused  }
        SIMSlot:                SInt8;                                  {   Slot  }
        SIMsRSRC:               SInt8;                                  {   sRsrcID  }
    end;

    DriverGestaltAPIResponsePtr = ^DriverGestaltAPIResponse;
    DriverGestaltAPIResponse = record
        partitionCmds:          SInt16;                             {  if bit 0 is nonzero, supports partition control and status calls  }
                                                                        {        prohibitMounting (control, kProhibitMounting)  }
                                                                        {       partitionToVRef (status, kGetPartitionStatus)  }
                                                                        {       getPartitionInfo (status, kGetPartInfo)  }
        unused1:                SInt16;                             {  all the unused fields should be zero  }
        unused2:                SInt16;
        unused3:                SInt16;
        unused4:                SInt16;
        unused5:                SInt16;
        unused6:                SInt16;
        unused7:                SInt16;
        unused8:                SInt16;
        unused9:                SInt16;
        unused10:               SInt16;
    end;

    DriverGestaltFlushResponsePtr = ^DriverGestaltFlushResponse;
    DriverGestaltFlushResponse = record
        canFlush:               boolean;                                {  Return true if driver supports the  }
                                                                        {  kdcFlush Driver Configure _Control call  }
        needsFlush:             boolean;                                {  Return true if driver/device has data cached  }
                                                                        {  and needs to be flushed when the disk volume  }
                                                                        {  is flushed by the File Manager  }
        pad:                    packed array [0..1] of UInt8;
    end;

    {    Flags for purge permissions    }

const
    kbCloseOk                   = 0;                            {  Ok to call Close  }
    kbRemoveOk                  = 1;                            {  Ok to call RemoveDrvr  }
    kbPurgeOk                   = 2;                            {  Ok to call DisposePtr  }
    kmNoCloseNoPurge            = 0;
    kmOkCloseNoPurge            = $03;
    kmOkCloseOkPurge            = $07;

    {    Driver purge permission structure  }

type
    DriverGestaltPurgeResponsePtr = ^DriverGestaltPurgeResponse;
    DriverGestaltPurgeResponse = record
        purgePermission:        UInt16;                                 {  0 = Do not change the state of the driver  }
                                                                        {  3 = Do Close() and DrvrRemove() this driver  }
                                                                        {  but don't deallocate driver code  }
                                                                        {  7 = Do Close(), DrvrRemove(), and DisposePtr()  }
        purgeReserved:          UInt16;
        purgeDriverPointer:     Ptr;                                    {  pointer to the start of the driver block (valid  }
                                                                        {  only of DisposePtr permission is given  }
    end;

    DriverGestaltEjectResponsePtr = ^DriverGestaltEjectResponse;
    DriverGestaltEjectResponse = record
        ejectFeatures:          UInt32;                                 {    }
    end;

    {    Flags for Ejection Features field  }

const
    kRestartDontEject           = 0;                            {  Dont Want eject during Restart  }
    kShutDownDontEject          = 1;                            {  Dont Want eject during Shutdown  }
    kRestartDontEject_Mask      = $01;
    kShutDownDontEject_Mask     = $02;

    {
        The DriverGestaltVMOptionsResponse is returned by a disk driver in response to a
        kdgVMOptions Driver Gestalt request. This allows a disk driver to tell VM a few
        things about a disk drive. For example:

        ¥ A drive that should never be in the page fault path should return kAllowVMNoneMask.
          Examples of this are drives that have manual eject buttons that are not disabled by
          software, drives with very slow throughput, or drives that depend on
          a network connection.
        ¥ A drive that should never be written to but is safe for read-only file mapping
          should return kAllowVMReadOnlyMask. Examples of this are WORM drives where each write
          eats write-once space on the disk and CD-ROM drives which are read-only media.
        ¥ A drive that should allow VM to create its main backing store file should return
          kAllowVMReadWriteMask. Examples of this are fast read/write drives that don't allow
          manual eject and don't use a network connection.

        A disk driver must look at the ioVRefNum field of the DriverGestaltParam to determine
        what disk drive this call is for. This is a per-drive call, not a per-driver call.

        The only three valid responses to kdgVMOptions at this time are kAllowVMNoneMask,
        kAllowVMReadOnlyMask, and kAllowVMReadWriteMask (i.e., setting only kAllowVMWriteBit
        is not valid).

        Important: All bits not defined here are reserved and should be set to zero until
        they are defined for a specific purpose.

        The kdcVMOptions Driver Configure _Control call provides the ability to change a driver's
        response to kdgVMOptions Driver Gestalt requests. A driver should return controlErr if
        it doesn't want to provide the ability to change the kdgVMOptions response. If a driver
        supports the kdcVMOptions Driver Configure _Control call, but is asked to set an option bit
        that it doesn't support (for example, if a read-only device is asked to set the kAllowVMWriteBit),
        it should return paramErr.
        }

type
    DriverGestaltVMOptionsResponsePtr = ^DriverGestaltVMOptionsResponse;
    DriverGestaltVMOptionsResponse = record
        vmOptions:              UInt32;
    end;

    {    Bits and masks for DriverGestaltVMOptionsResponse.vmOptions field  }

const
    kAllowVMReadBit             = 0;                            {  Allow VM to use this drive for read access  }
    kAllowVMWriteBit            = 1;                            {  Allow VM to use this drive for write access  }
    kAllowVMNoneMask            = 0;
    kAllowVMReadOnlyMask        = $01;
    kAllowVMReadWriteMask       = $03;

    {
    kdgGetDriveAddInfo/kdcAddDriveWithInfo is used by the Alias Manager to
    assist in the  remounting of container files. eg DiskCopy.  The driver
    can use it to store whatever information it needs to remount a drive
    For example the Volume name and FileID..  What is in here is entirely
    dependant on the driver, we never interpret it.

    This extension to the Alias Manager works as such:

    When creating an alias
    ----------------------

    If driver supports Driver Gestalt, the Alias Mgr calls the driver with a
     kdgGetDriveAddInfo DriverGestalt request.

    Inputs to DriverGestalt:
        ioVRefNum   = drive number
        ioCRefNum   = driver refNum
        csCode      = kDriverGestaltCode
        driverGestaltSelector = kdgGetDriveAddInfo

    If the driver supports kdgGetDriveAddInfo, it returns a pointer to the drive's
    drive  information record (DriverGestaltDriveAddInfoResponse*) in the
    driverGestaltResponse field and returns noErr.

      The memory used by the DriverGestaltDriveAddInfoResponse and it's pointed
    to data, must be previously held by the disk driver with HoldMemory.

    If the driver doesn't support kdgGetDriveAddInfo,  it returns statusErr.

    If noErr, the Alias Mgr stores the drive information record in the alias record
    (the length of the drive information record data is in the length field).


    When resolving an alias:
    ------------------------

    If driver supports Driver Gestalt, the Alias Mgr holds the drive information record
    in the alias with HoldMemory and then calls the driver with a kdcAddDriveWithInfo
    DriverConfigure request.

    Inputs to DriverConfigure:
        ioCRefNum   = driver refNum
        csCode      = kDriverConfigureCode
        driverGestaltSelector = pointer to DriverGestaltDriveAddInfoResponse


    If the driver supports kdcAddDriveWithInfo, it uses the information in the drive
    information record to add a drive to the drive queue. If the drive is added,
    the driver returns noErr and returns the drive number in the ioVRefNum field of
    the parameter block.

    If the drive cannot be added  (but kdcAddDriveWithInfo is supported), the driver
    returns nsDrvErr.

    If the driver doesn't  support kdcAddDriveWithInfo, it returns controlErr.

    If noErr is returned, but the data in the  drive information record is not
    up-to-date, the driver should set driveInfoChangedBit in the options field of the
    drive information record.

    If driveInfoInteractBit in the options field  is set at input, the driver
    may perform user interaction to mount the drive.

    If noErr, the Alias Mgr tries to resolve the alias the rest of the way.
        }
    {    drive info option flags    }
    driveInfoInteractBit        = 31;                           {  Input to kdcAddDriveWithInfo: If set, it's OK for the driver  }
    driveInfoInteractMask       = $80000000;                    {   to perform user interaction to add the drive  }
    driveInfoChangedBit         = 30;                           {  Output from kdgGetDriveInfo: If set, the drive was mounted, but  }
    driveInfoChangedMask        = $40000000;                    {   the drive information record needs to be updated.  }
    driveInfoDriverReservedMask = $0000FFFF;                    {  bits 0-15 are defined by each driver for its own use  }
    driveInfoSystemReservedMask = $FFFF0000;                    {  bits 16-31 are reserved for Apple system use  }



type
    DriverGestaltDriveAddInfoResponsePtr = ^DriverGestaltDriveAddInfoResponse;
    DriverGestaltDriveAddInfoResponse = record
        options:                OptionBits;                             {  option flags.  }
        length:                 ByteCount;                              {  length of data  }
        data:                   Ptr;                                    {  this data must be held with HoldMemory  }
    end;

    {
        The DriverGestaltMediaInfoResponse is returned by a disk driver in response to a
        kdgMediaInfo DriverGestalt request. This allows a disk driver to tell callers the
        physical block size, the number of blocks that are of that size, and the media type
        for a given device.

        A disk driver must look at the ioVRefNum field of the DriverGestaltParam to determine
        what disk drive this call is for. This is a per-drive call, not a per-driver call.

        On drives that support ejectable media, the response can change depending on what
        media is currently in the drive.
        }
    DriverGestaltMediaInfoResponsePtr = ^DriverGestaltMediaInfoResponse;
    DriverGestaltMediaInfoResponse = record
        numberBlocks:           UInt32;                                 {  number of blocks  }
        blockSize:              UInt32;                                 {  physical size of blocks  }
        mediaType:              SInt16;                                 {  media type identifier  }
    end;

    {    DriverGestaltMediaInfoResponse.mediaType constants     }

const
    kMediaTypeUnknown           = 128;                          {  media type is unknown  }
    kMediaTypeCDROM             = 129;                          {  media type is a CD-ROM  }
    kMediaTypeDVDROM            = 130;                          {  media type is a DVD-ROM  }
    kMediaTypeDVDRAM            = 131;                          {  media type is a DVD-RAM  }
    kMediaTypeDVDR              = 132;                          {  media type is a DVD-RW  }
    kMediaTypeReadOnly          = 133;                          {  basic read only type  }
    kMediaTypeWriteOnce         = 134;                          {  basic write once type  }
    kMediaTypeRewritable        = 135;                          {  rewritable media, i.e CD-RW  }
    kMediaTypeOverwritable      = 136;                          {  random access read write media  }
    kMediaTypeNoMedia           = -1;                           {  no media is present  }


type
    DriverGestaltATADev1ResponsePtr = ^DriverGestaltATADev1Response;
    DriverGestaltATADev1Response = record
        dev1Support:            UInt32;                                 {  1 = supports devices 0 and 1 }
    end;

    {   __________________________________________________________________________________  }
    {    Device Reference   }
    {
        The driver will return a 32-bit device reference number in the driverGestaltResponse
        field of the DriverGestaltParam structure. The device refernce number will be interpreted
        differently depending on the interface retrieved by using the 'intf' Driver Gestalt call.
        }
    {   The union for the kdgDeviceReference Gestalt    }
    DriverGestaltDeviceReferenceResponsePtr = ^DriverGestaltDeviceReferenceResponse;
    DriverGestaltDeviceReferenceResponse = record
        case SInt16 of
        0: (
            devRef:             UInt32;                                 {  Generic reference number for interfaces not specified  }
            );
        1: (
            scsiID:             DeviceIdent;                            {  kdgScsiIntf devices will return a DeviceIdent  }
            );
        2: (
            ataID:              DeviceIdent;                            {  kdgATAIntf devices will return a DeviceIdent  }
            );
        3: (
            usbRef:             USBDeviceRef;                           {  kdgUSBIntf devices will return a USBDeviceRef }
            );
    end;

    {   __________________________________________________________________________________  }
    {    Name Registry ID   }
    {
        The driver will pass back in the driverGestaltResponse field of the DriverGestaltParam
        a pointer to the Name Registry Entry ID for the device that it controls
        }
    {    The structure for the kdgNameRegistryEntry Gestalt     }
    DriverGestaltNameRegistryResponsePtr = ^DriverGestaltNameRegistryResponse;
    DriverGestaltNameRegistryResponse = record
        entryID:                RegEntryIDPtr;
    end;

    {   __________________________________________________________________________________  }
    {    Device Model Information   }
    {
        The driver will pass a pointer to the DriverGestaltDeviceModelInfoResponse in the
        driverGestaltResponse field of the DriverGestaltParam structure

        The structure for the kdgDeviceModelInfo Gestalt
        If any of theses pointers are nil, that means that the device doesn't provide that information
        }
    DriverGestaltDeviceModelInfoResponsePtr = ^DriverGestaltDeviceModelInfoResponse;
    DriverGestaltDeviceModelInfoResponse = record
        infoStructVersion:      UInt32;
        vendorName:             StringPtr;
        productName:            StringPtr;
        revisionNumber:         StringPtr;
        subRevisionNumber:      StringPtr;
        serialNumber:           StringPtr;
    end;

    {    infoStructVersion field values     }
    {    NOTE: May need/want to add a UniCode version of the InfoStruct at some point   }

const
    kInfoStructStringPtrsVers1  = 1;


    {   __________________________________________________________________________________  }
    {    Supported Media Types  }
    {
        The driver will return the number of media types supported by the device in the
        driverGestaltResponse field of the DriverGestaltParam structure and an array of
        'devt' values for the supported media types will be returned in the driverGestaltResponse1
        field of the DriverGestaltParam.

        This call will return the number of media types supported by the device, and an array
        of 'devt' values for the media types (i.e. if a device supports floppy disks
        and large capacity removables, the driver would return that 2 media types are supported,
        and the array would contain kdgFloppyType ('flop') and kdgRemovableType ('rdsk')).
        }
    {    The structure for the kdgSupportedMediaTypes Gestalt   }

type
    DriverGestaltSupportedMediaTypesResponsePtr = ^DriverGestaltSupportedMediaTypesResponse;
    DriverGestaltSupportedMediaTypesResponse = record
        supportTypesCount:      UInt32;                                 {  The number of Media Types in the array  }
        supportedTypesArray:    array [0..0] of OSType;                 {  Array of supported media types   }
    end;

    {   __________________________________________________________________________________  }
    {    Open Firmware Boot support  and Open Firmware Booting support  }
    {
        The kdgOpenFirmwareBootSupport selector is used to get information about boot support
        for the driver/device.  The kdgOpenFirmwareBootingSupport is used during the boot
        process to allow booting from partitions that Open Firmware may not be able to read
        directly (i.e. Disk Array partitions, encrypted partitions, compressed partitions, etc..)

        The driver will return the bootPartitionQualifier value in the driverGestaltResponse
        field of the DriverGestaltParam and will return the exact partition map entry for
        the boot partition in the driverGestaltResponse1 field of the DriverGestaltParam if
        kOFBootSpecifiedPartition is returned in the driverGestaltResponse.
        The number that is returned for the bootPartitionMapEntry field if the kOFBootSpecifiedPartition
        is returned is the partition map entry number for the partition. (i.e. If the partition map entry
        for the boot partition is the 2nd partition entry in the partition map, the bootPartitionMapEntry
        field would be set to 2.  If the partition map entry for the boot partition is the 3rd partition
        map, the bootPartitionMapEntry field would be set to 3 and etc.)
        }
    DriverGestaltOFBootSupportResponsePtr = ^DriverGestaltOFBootSupportResponse;
    DriverGestaltOFBootSupportResponse = record
        bootPartitionQualifier: UInt32;                                 {     The exact level of booting that the driver and device supports  }
        bootPartitionMapEntry:  UInt32;                                 {     The Partition Map entry for the boot partition if applicable  }
    end;

    {    Levels of boot support that the driver/device supports     }
    {    These values are used in the bootPartitionQualifier field of the DriverGestaltOFBootSupportResponse    }

const
    kOFBootAnyPartition         = 1;
    kOFBootSpecifiedPartition   = 2;
    kOFBootNotBootable          = 3;
    kOFBootNotPartitioned       = 4;

    {   __________________________________________________________________________________  }
    {    CD-ROM Specific    }
    {    The CDDeviceCharacteristics result is returned in csParam[0..2] of a
       standard CntrlParam parameter block called with csCode kdgGetCDDeviceInfo.
        }

type
    CDDeviceCharacteristicsPtr = ^CDDeviceCharacteristics;
    CDDeviceCharacteristics = record
        speedMajor:             SInt8;                                  {  High byte of fixed point number containing drive speed  }
        speedMinor:             SInt8;                                  {  Low byte of "" CD 300 == 2.2, CD_SC == 1.0 etc.  }
        cdFeatures:             UInt16;                                 {  Flags field for features and transport type of this CD-ROM  }
        extendedCdFeatures:     UInt16;                                 {  extended flags to support new DVD-ROM/DVD-R etc.  }
    end;


const
    cdFeatureFlagsMask          = $FFFC;                        {  The Flags are in the first 14 bits of the cdFeatures field  }
    cdTransportMask             = $0003;                        {  The transport type is in the last 2 bits of the cdFeatures field  }


    {    Flags for cdFeatures field     }
    cdPowerInject               = 0;                            {  device supports power inject of media }
    cdNotPowerEject             = 1;                            {  device does not support power eject of media }
    cdMute                      = 2;                            {  device supports audio channels muting }
    cdLeftToChannel             = 3;                            {  device supports left channel only mono audio }
    cdRightToChannel            = 4;                            {  device supports right channel only mono audio }
    cdLeftPlusRight             = 5;                            {  device supports left + right channels mono audio }
    cdSCSI_2                    = 10;                           {  device supports SCSI2 command set (SCSI only) }
    cdStereoVolume              = 11;                           {  device supports independent volume per channel }
    cdDisconnect                = 12;                           {  device supports disconnect / reconnect (SCSI only) }
    cdWriteOnce                 = 13;                           {  device is a write-once type of drive }
    cdLockableButton            = 14;                           {  device drawer/tray can be locked }
    cdExtendedFeatures          = 15;                           {  extendedCdFeatures field is used }
    cdPowerInject_Mask          = $01;
    cdNotPowerEject_Mask        = $02;
    cdMute_Mask                 = $04;
    cdLeftToChannel_Mask        = $08;
    cdRightToChannel_Mask       = $10;
    cdLeftPlusRight_Mask        = $20;
    cdSCSI_2_Mask               = $0400;
    cdStereoVolume_Mask         = $0800;
    cdDisconnect_Mask           = $1000;
    cdWriteOnce_Mask            = $2000;
    cdLockableButton_Mask       = $4000;
    cdExtendedFeatures_Mask     = $8000;

    {    Transport types    }
    cdCaddy                     = 0;                            {  CD_SC,CD_SC_PLUS,CD-300 etc. - power eject only }
    cdTray                      = $01;                          {  CD_300_PLUS etc. - power inject only }
    cdLid                       = $02;                          {  Power CD - no power inject/no power eject }

    {
        Flags for extendedCdFeatures field
        Only valid when cdExtendedFeatures_Mask bit of cdFeatures field is set
    }
    cdDVDROM                    = 0;                            {  device reads DVD-ROM media }
    cdDVDR                      = 1;                            {  device writes DVD-R media }
    cdDVDRAM                    = 2;                            {  device writes DVD-RAM media }
    cdDVDAudio                  = 3;                            {  device reads DVD-Audio media }
    cdDVDRW                     = 4;                            {  device writes DVD-RW media }
    cdCDRom                     = 5;                            {  device reads CD-ROM media }
    cdCDR                       = 6;                            {  device writes CD-R media }
    cdCDRW                      = 7;                            {  device writes CD-RW media }
    cdDVDROM_Mask               = $01;
    cdDVDR_Mask                 = $02;
    cdDVDRAM_Mask               = $04;
    cdDVDAudio_Mask             = $08;
    cdDVDRW_Mask                = $10;
    cdCDRom_Mask                = $20;
    cdCDR_Mask                  = $40;
    cdCDRW_Mask                 = $80;



    {  the following are used by PC Exchange (and Apple DOS/PC Compatibility Card) }

    {  Control Codes }
    kRegisterPartition          = 50;                           {  PCX needs a new Drive (for a non-macintosh partition found on the disk) }
    OLD_REGISTER_PARTITION      = 301;                          {  left in for compatibility with shipping Apple DOS/PC Compatibility Card }
    THE_DRIVE                   = 0;                            {  DrvQElPtr for the partition to register }
    THE_PHYS_START              = 1;                            {  The start of the partition in logical blocks }
    THE_PHYS_SIZE               = 2;                            {  The size of the partition in logical blocks }
    kGetADrive                  = 51;                           {  control call to ask the driver to create a drive }
    OLD_GET_A_DRIVE             = 302;                          {  left in for compatibility with shipping Apple DOS/PC Compatibility Card }
    THE_VAR_QUEL                = 0;                            {  a var parameter for the returned DrvQElPtr }
    kProhibitMounting           = 52;                           {  Dont allow mounting of the following drives }
    kOldProhibitMounting        = 2100;                         {  left in for compatibility with shipping Apple DOS/PC Compatibility Card }
    kProhibitDevice             = 0;                            {  CS Param 0 and 1 (partInfoRecPtr) }
    kIsContainerMounted         = 53;
    kOldIsContainerMounted      = 2201;                         {  left in for compatibility with shipping Apple DOS/PC Compatibility Card          }
    kContainerVRef              = 0;                            {  CS Param 0 and 1 (VRefNum) }
    kContainerParID             = 1;                            {  CS Param 2 and 3 (Parent ID) }
    kContainerName              = 2;                            {  CS Param 4 and 5 (File Name) }
    kContainerResponse          = 3;                            {  CS Param 6 and 7 (var pointer to short result) }
    kMountVolumeImg             = 54;
    OLD_MOUNT_VOLUME_IMG        = 2000;
    MV_HOST_VREFNUM             = 0;
    MV_HOST_PAR_ID              = 1;
    MV_HOST_NAME                = 2;
    MV_REQ_PERM                 = 3;

    {  Status Codes }

    kGetPartitionStatus         = 50;                           {  what is the status of this partition? }
    kOldGetPartitionStatus      = 2200;                         {  left in for compatibility with shipping Apple DOS/PC Compatibility Card }
    kDeviceToQuery              = 0;                            {  CS Param 0 and 1 (partInfoRecPtr) }
    kDeviceResponse             = 1;                            {  CS Param 2 and 3 (var pointer to short result) }
    kGetPartInfo                = 51;                           {  Get a partition info record based on the provided vrefnum }
    kOldGetPartInfo             = 2300;                         {  left in for compatibility with shipping Apple DOS/PC Compatibility Card }
    kPartInfoResponse           = 0;                            {  var parameter (pointer to partInfoRec) CSParam [0-1] }
    kGetContainerAlias          = 52;                           {  Get the alias that describes the file this drive was mounted from. }
    kOldGetContainerAlias       = 2400;                         {  left in for compatibility with shipping Apple DOS/PC Compatibility Card }
    kGetAliasResponse           = 0;                            {     var parameter (pointer to a Handle) CSParam [0-1] }

    {  the result codes to come from the driver interface  }

    DRIVER_NOT_INSTALLED        = -1;
    DRIVER_BUSY                 = -2;
    CANT_MOUNT_WITHIN_THIS_FS   = -3;                           {  can only mount container within residing on HFS volume }
    VOLUME_ALREADY_MOUNTED      = -4;                           {  Already Mounted }

    {  requisite structures for PCX control and status calls }

    kMaxProhibted               = 2;                            {  the max number of volumes the PC can possibly have mounted }

    {  GestaltSelector for Finding Driver information }

    kGetDriverInfo              = $76647263 (* 'vdrc' *);

    {    VerifyCmd, FormatCmd and EjectCmd are now defined in Disks.h/p/a   }
    {  Partition information passed back and forth between PCX and the driver }

type
    partInfoRecPtr = ^partInfoRec;
    partInfoRec = record
        SCSIID:                 DeviceIdent;                            {  DeviceIdent for the device }
        physPartitionLoc:       UInt32;                                 {  physical block number of beginning of partition }
        partitionNumber:        UInt32;                                 {  the partition number of this partition }
    end;

    vPartInfoRecPtr = ^vPartInfoRec;
    vPartInfoRec = record
        VPRTVers:               SInt8;                                  {  Virtual partition version number }
        VPRTType:               SInt8;                                  {  virtual partition type (DOS, HFS, etc) }
        drvrRefNum:             SInt16;                                 {  Driver Reference number of partition driver }
    end;

    {  Information related to DOS partitions }

const
    kDOSSigLow                  = $01FE;                        {  offset into boot block for DOS signature }
    kDOSSigHi                   = $01FF;                        {  offset into boot block for DOS signature }
    kDOSSigValLo                = $55;                          {  DOS signature value in low byte }
    kDOSSigValHi                = $AA;                          {  DOS signature value in high byte }


{$ALIGN MAC68K}
{#POP}
{unit FontSync}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN POWER}
{#LibExport+}


{ Matching Options }

type
    FNSMatchOptions             = UInt32;
    FNSMatchOptionsPtr          = ^FNSMatchOptions; { when a VAR xx: FNSMatchOptions parameter can be nil, it is changed to xx: FNSMatchOptionsPtr }
const
    kFNSMatchNames              = $00000001;                    {  font names must match  }
    kFNSMatchTechnology         = $00000002;                    {  scaler technology must match  }
    kFNSMatchGlyphs             = $00000004;                    {  glyph data must match  }
    kFNSMatchEncodings          = $00000008;                    {  cmaps must match  }
    kFNSMatchQDMetrics          = $00000010;                    {  QuickDraw Text metrics must match  }
    kFNSMatchATSUMetrics        = $00000020;                    {  ATSUI metrics (incl. vertical) must match  }
    kFNSMatchKerning            = $00000040;                    {  kerning data must match  }
    kFNSMatchWSLayout           = $00000080;                    {  WorldScript layout tables must match  }
    kFNSMatchAATLayout          = $00000100;                    {  AAT (incl. OpenType) layout tables must match  }
    kFNSMatchPrintEncoding      = $00000200;                    {  PostScript font and glyph names and re-encoding vector must match  }
    kFNSMissingDataNoMatch      = $80000000;                    {  treat missing data as mismatch  }
    kFNSMatchAll                = $FFFFFFFF;                    {  everything must match  }
    kFNSMatchDefaults           = 0;                            {  use global default match options  }

    {
     *  FNSMatchDefaultsGet()
     *
     *  Availability:
     *    Non-Carbon CFM:   in FontSyncLib 1.0 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function FNSMatchDefaultsGet: FNSMatchOptions; external name '_FNSMatchDefaultsGet';


{ Version control }

type
    FNSObjectVersion            = UInt32;
const
    kFNSVersionDontCare         = 0;
    kFNSCurSysInfoVersion       = 1;

    {  No features defined yet. }

type
    FNSFeatureFlags                     = UInt32;
    {
       The FontSync library version number is binary-coded decimal:
       8 bits of major version, 4 minor version and 4 bits revision.
    }
    FNSSysInfoPtr = ^FNSSysInfo;
    FNSSysInfo = record
        iSysInfoVersion:        FNSObjectVersion;                       {  fill this in before calling FNSSysInfoGet }
        oFeatures:              FNSFeatureFlags;
        oCurRefVersion:         FNSObjectVersion;
        oMinRefVersion:         FNSObjectVersion;
        oCurProfileVersion:     FNSObjectVersion;
        oMinProfileVersion:     FNSObjectVersion;
        oFontSyncVersion:       UInt16;
    end;

    {
     *  FNSSysInfoGet()
     *
     *  Availability:
     *    Non-Carbon CFM:   in FontSyncLib 1.0 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
procedure FNSSysInfoGet(var ioInfo: FNSSysInfo); external name '_FNSSysInfoGet';


{ FontSync References }

type
    FNSFontReference    = ^SInt32; { an opaque 32-bit type }
    FNSFontReferencePtr = ^FNSFontReference;  { when a var xx:FNSFontReference parameter can be nil, it is changed to xx: FNSFontReferencePtr }
    {
     *  FNSReferenceGetVersion()
     *
     *  Availability:
     *    Non-Carbon CFM:   in FontSyncLib 1.0 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function FNSReferenceGetVersion(iReference: FNSFontReference; var oVersion: FNSObjectVersion): OSStatus; external name '_FNSReferenceGetVersion';

{
 *  FNSReferenceDispose()
 *
 *  Availability:
 *    Non-Carbon CFM:   in FontSyncLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FNSReferenceDispose(iReference: FNSFontReference): OSStatus; external name '_FNSReferenceDispose';

{
 *  FNSReferenceMatch()
 *
 *  Availability:
 *    Non-Carbon CFM:   in FontSyncLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FNSReferenceMatch(iReference1: FNSFontReference; iReference2: FNSFontReference; iOptions: FNSMatchOptions; oFailedMatchOptions: FNSMatchOptionsPtr): OSStatus; external name '_FNSReferenceMatch';

{
 *  FNSReferenceFlattenedSize()
 *
 *  Availability:
 *    Non-Carbon CFM:   in FontSyncLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FNSReferenceFlattenedSize(iReference: FNSFontReference; var oFlattenedSize: ByteCount): OSStatus; external name '_FNSReferenceFlattenedSize';

{
 *  FNSReferenceFlatten()
 *
 *  Availability:
 *    Non-Carbon CFM:   in FontSyncLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FNSReferenceFlatten(iReference: FNSFontReference; oFlatReference: UnivPtr; oFlattenedSize: ByteCountPtr): OSStatus; external name '_FNSReferenceFlatten';

{
 *  FNSReferenceUnflatten()
 *
 *  Availability:
 *    Non-Carbon CFM:   in FontSyncLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FNSReferenceUnflatten(iFlatReference: UnivPtr; iFlattenedSize: ByteCount; var oReference: FNSFontReference): OSStatus; external name '_FNSReferenceUnflatten';


{ FontSync Profiles }

const
    kFNSCreatorDefault          = 0;
    kFNSProfileFileType         = $666E7370 (* 'fnsp' *);


type
    FNSFontProfile    = ^SInt32; { an opaque 32-bit type }
    FNSFontProfilePtr = ^FNSFontProfile;  { when a var xx:FNSFontProfile parameter can be nil, it is changed to xx: FNSFontProfilePtr }
    {
     *  FNSProfileCreate()
     *
     *  Availability:
     *    Non-Carbon CFM:   in FontSyncLib 1.0 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function FNSProfileCreate(const (*var*) iFile: FSSpec; iCreator: FourCharCode; iEstNumRefs: ItemCount; iDesiredVersion: FNSObjectVersion; var oProfile: FNSFontProfile): OSStatus; external name '_FNSProfileCreate';

{
 *  FNSProfileOpen()
 *
 *  Availability:
 *    Non-Carbon CFM:   in FontSyncLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FNSProfileOpen(const (*var*) iFile: FSSpec; iOpenForWrite: boolean; var oProfile: FNSFontProfile): OSStatus; external name '_FNSProfileOpen';


{
 *  FNSProfileCreateWithFSRef()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.1 and later
 *    Mac OS X:         in version 10.1 and later
 }
function FNSProfileCreateWithFSRef(const (*var*) iParentDirectory: FSRef; iNameLength: UniCharCount; iName: ConstUniCharPtr; iCreator: FourCharCode; iEstNumRefs: ItemCount; iDesiredVersion: FNSObjectVersion; var oProfile: FNSFontProfile): OSStatus; external name '_FNSProfileCreateWithFSRef';

{
 *  FNSProfileOpenWithFSRef()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.1 and later
 *    Mac OS X:         in version 10.1 and later
 }
function FNSProfileOpenWithFSRef(const (*var*) iFile: FSRef; iOpenForWrite: boolean; var oProfile: FNSFontProfile): OSStatus; external name '_FNSProfileOpenWithFSRef';

{
 *  FNSProfileGetVersion()
 *
 *  Availability:
 *    Non-Carbon CFM:   in FontSyncLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FNSProfileGetVersion(iProfile: FNSFontProfile; var oVersion: FNSObjectVersion): OSStatus; external name '_FNSProfileGetVersion';

{
 *  FNSProfileCompact()
 *
 *  Availability:
 *    Non-Carbon CFM:   in FontSyncLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FNSProfileCompact(iProfile: FNSFontProfile): OSStatus; external name '_FNSProfileCompact';

{
 *  FNSProfileClose()
 *
 *  Availability:
 *    Non-Carbon CFM:   in FontSyncLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FNSProfileClose(iProfile: FNSFontProfile): OSStatus; external name '_FNSProfileClose';

{
 *  FNSProfileAddReference()
 *
 *  Availability:
 *    Non-Carbon CFM:   in FontSyncLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FNSProfileAddReference(iProfile: FNSFontProfile; iReference: FNSFontReference): OSStatus; external name '_FNSProfileAddReference';

{
 *  FNSProfileRemoveReference()
 *
 *  Availability:
 *    Non-Carbon CFM:   in FontSyncLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FNSProfileRemoveReference(iProfile: FNSFontProfile; iReference: FNSFontReference): OSStatus; external name '_FNSProfileRemoveReference';

{
 *  FNSProfileRemoveIndReference()
 *
 *  Availability:
 *    Non-Carbon CFM:   in FontSyncLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FNSProfileRemoveIndReference(iProfile: FNSFontProfile; iIndex: UInt32): OSStatus; external name '_FNSProfileRemoveIndReference';

{
 *  FNSProfileClear()
 *
 *  Availability:
 *    Non-Carbon CFM:   in FontSyncLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FNSProfileClear(iProfile: FNSFontProfile): OSStatus; external name '_FNSProfileClear';

{
 *  FNSProfileCountReferences()
 *
 *  Availability:
 *    Non-Carbon CFM:   in FontSyncLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FNSProfileCountReferences(iProfile: FNSFontProfile; var oCount: ItemCount): OSStatus; external name '_FNSProfileCountReferences';

{
 *  FNSProfileGetIndReference()
 *
 *  Availability:
 *    Non-Carbon CFM:   in FontSyncLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FNSProfileGetIndReference(iProfile: FNSFontProfile; iWhichReference: UInt32; var oReference: FNSFontReference): OSStatus; external name '_FNSProfileGetIndReference';

{
 *  FNSProfileMatchReference()
 *
 *  Availability:
 *    Non-Carbon CFM:   in FontSyncLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FNSProfileMatchReference(iProfile: FNSFontProfile; iReference: FNSFontReference; iMatchOptions: FNSMatchOptions; iOutputSize: ItemCount; oIndices: UInt32Ptr; oNumMatches: ItemCountPtr): OSStatus; external name '_FNSProfileMatchReference';


{ Mapping to and from Font Objects }
{
 *  FNSReferenceCreate()
 *
 *  Availability:
 *    Non-Carbon CFM:   in FontSyncLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FNSReferenceCreate(iFont: FMFont; iDesiredVersion: FNSObjectVersion; var oReference: FNSFontReference): OSStatus; external name '_FNSReferenceCreate';

{
 *  FNSReferenceMatchFonts()
 *
 *  Availability:
 *    Non-Carbon CFM:   in FontSyncLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FNSReferenceMatchFonts(iReference: FNSFontReference; iMatchOptions: FNSMatchOptions; iOutputSize: ItemCount; oFonts: FMFontPtr; oNumMatches: ItemCountPtr): OSStatus; external name '_FNSReferenceMatchFonts';


{ Mapping to and from Font Families }
{
 *  FNSReferenceCreateFromFamily()
 *
 *  Availability:
 *    Non-Carbon CFM:   in FontSyncLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FNSReferenceCreateFromFamily(iFamily: FMFontFamily; iStyle: FMFontStyle; iDesiredVersion: FNSObjectVersion; oReference: FNSFontReferencePtr; oActualStyle: FMFontStylePtr): OSStatus; external name '_FNSReferenceCreateFromFamily';

{
 *  FNSReferenceMatchFamilies()
 *
 *  Availability:
 *    Non-Carbon CFM:   in FontSyncLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FNSReferenceMatchFamilies(iReference: FNSFontReference; iMatchOptions: FNSMatchOptions; iOutputSize: ItemCount; oFonts: FMFontFamilyInstancePtr; oNumMatches: ItemCountPtr): OSStatus; external name '_FNSReferenceMatchFamilies';


{ UI Support }
{
 *  FNSReferenceGetFamilyInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in FontSyncLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FNSReferenceGetFamilyInfo(iReference: FNSFontReference; oFamilyName: StringPtr; oFamilyNameScript: ScriptCodePtr; oActualStyle: FMFontStylePtr): OSStatus; external name '_FNSReferenceGetFamilyInfo';

{
 *  FNSReferenceCountNames()
 *
 *  Availability:
 *    Non-Carbon CFM:   in FontSyncLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FNSReferenceCountNames(iReference: FNSFontReference; var oNameCount: ItemCount): OSStatus; external name '_FNSReferenceCountNames';

{
 *  FNSReferenceGetIndName()
 *
 *  Availability:
 *    Non-Carbon CFM:   in FontSyncLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FNSReferenceGetIndName(iReference: FNSFontReference; iFontNameIndex: ItemCount; iMaximumNameLength: ByteCount; oName: Ptr; oActualNameLength: ByteCountPtr; oFontNameCode: FontNameCodePtr; oFontNamePlatform: FontPlatformCodePtr; oFontNameScript: FontScriptCodePtr; oFontNameLanguage: FontLanguageCodePtr): OSStatus; external name '_FNSReferenceGetIndName';

{
 *  FNSReferenceFindName()
 *
 *  Availability:
 *    Non-Carbon CFM:   in FontSyncLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FNSReferenceFindName(iReference: FNSFontReference; iFontNameCode: FontNameCode; iFontNamePlatform: FontPlatformCode; iFontNameScript: FontScriptCode; iFontNameLanguage: FontLanguageCode; iMaximumNameLength: ByteCount; oName: Ptr; oActualNameLength: ByteCountPtr; oFontNameIndex: ItemCountPtr): OSStatus; external name '_FNSReferenceFindName';

{ Miscellany }
{
 *  FNSEnabled()
 *
 *  Availability:
 *    Non-Carbon CFM:   in FontSyncLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FNSEnabled: boolean; external name '_FNSEnabled';

{$ALIGN MAC68K}
{#POP}
{unit KeychainCore}
{$ALIGN MAC68K}








{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}

{ Data structures and types }

type
    SecKeychainRef    = ^SInt32; { an opaque 32-bit type }
    SecKeychainRefPtr = ^SecKeychainRef;  { when a var xx:SecKeychainRef parameter can be nil, it is changed to xx: SecKeychainRefPtr }
    SecKeychainItemRef    = ^SInt32; { an opaque 32-bit type }
    SecKeychainItemRefPtr = ^SecKeychainItemRef;  { when a var xx:SecKeychainItemRef parameter can be nil, it is changed to xx: SecKeychainItemRefPtr }
    SecKeychainSearchRef    = ^SInt32; { an opaque 32-bit type }
    SecKeychainSearchRefPtr = ^SecKeychainSearchRef;  { when a var xx:SecKeychainSearchRef parameter can be nil, it is changed to xx: SecKeychainSearchRefPtr }
    SecKeychainAttrType                 = OSType;
    SecKeychainStatus                   = UInt32;
    SecKeychainAttributePtr = ^SecKeychainAttribute;
    SecKeychainAttribute = record
        tag:                    SecKeychainAttrType;                    {  4-byte attribute tag  }
        length:                 UInt32;                                 {  Length of attribute data  }
        data:                   Ptr;                                    {  Pointer to attribute data  }
    end;

    SecKeychainAttributeListPtr = ^SecKeychainAttributeList;
    SecKeychainAttributeList = record
        count:                  UInt32;                                 {  How many attributes in the array  }
        attr:                   SecKeychainAttributePtr;                {  Pointer to first attribute in array  }
    end;

    KCRef                               = SecKeychainRef;
    KCItemRef                           = SecKeychainItemRef;
    KCSearchRef                         = SecKeychainSearchRef;
    KCRefPtr                            = ^KCRef;
    KCItemRefPtr                        = ^KCItemRef;
    KCSearchRefPtr                      = ^KCSearchRef;
    KCAttribute                         = SecKeychainAttribute;
    KCAttributePtr                      = ^KCAttribute;
    KCAttributeList                     = SecKeychainAttributeList;
    KCAttributeListPtr                  = ^KCAttributeList;
    KCAttrType                          = SecKeychainAttrType;
    KCStatus                            = SecKeychainStatus;
    KCEvent                     = UInt16;
const
    kIdleKCEvent                = 0;                            {  null event  }
    kLockKCEvent                = 1;                            {  a keychain was locked  }
    kUnlockKCEvent              = 2;                            {  a keychain was unlocked  }
    kAddKCEvent                 = 3;                            {  an item was added to a keychain  }
    kDeleteKCEvent              = 4;                            {  an item was deleted from a keychain  }
    kUpdateKCEvent              = 5;                            {  an item was updated  }
    kPasswordChangedKCEvent     = 6;                            {  the keychain identity was changed  }
    kSystemKCEvent              = 8;                            {  the keychain client can process events  }
    kDefaultChangedKCEvent      = 9;                            {  the default keychain was changed  }
    kDataAccessKCEvent          = 10;                           {  a process has accessed a keychain item's data  }
    kKeychainListChangedKCEvent = 11;                           {  the list of keychains has changed  }


type
    KCEventMask                 = UInt16;
const
    kIdleKCEventMask            = $01;
    kLockKCEventMask            = $02;
    kUnlockKCEventMask          = $04;
    kAddKCEventMask             = $08;
    kDeleteKCEventMask          = $10;
    kUpdateKCEventMask          = $20;
    kPasswordChangedKCEventMask = $40;
    kSystemEventKCEventMask     = $0100;
    kDefaultChangedKCEventMask  = $0200;
    kDataAccessKCEventMask      = $0400;
    kEveryKCEventMask           = $FFFF;                        {  all of the above }


type
    AFPServerSignature                  = packed array [0..15] of UInt8;
    AFPServerSignaturePtr               = ^AFPServerSignature; { when a VAR xx: AFPServerSignature parameter can be nil, it is changed to xx: AFPServerSignaturePtr }
    KCPublicKeyHash                     = packed array [0..19] of UInt8;
    KCCallbackInfoPtr = ^KCCallbackInfo;
    KCCallbackInfo = record
        version:                UInt32;
        item:                   KCItemRef;
        processID:              ProcessSerialNumber;
        event:                  EventRecord;
        keychain:               KCRef;
    end;


const
    kUnlockStateKCStatus        = 1;
    kRdPermKCStatus             = 2;
    kWrPermKCStatus             = 4;


    kCertificateKCItemClass     = $63657274 (* 'cert' *);                       {  Certificate  }
    kAppleSharePasswordKCItemClass = $61736870 (* 'ashp' *);                    {  Appleshare password  }
    kInternetPasswordKCItemClass = $696E6574 (* 'inet' *);                      {  Internet password  }
    kGenericPasswordKCItemClass = $67656E70 (* 'genp' *);                       {  Generic password  }


type
    KCItemClass                         = FourCharCode;

const
                                                                {  Common attributes  }
    kClassKCItemAttr            = $636C6173 (* 'clas' *);                       {  Item class (KCItemClass)  }
    kCreationDateKCItemAttr     = $63646174 (* 'cdat' *);                       {  Date the item was created (UInt32)  }
    kModDateKCItemAttr          = $6D646174 (* 'mdat' *);                       {  Last time the item was updated (UInt32)  }
    kDescriptionKCItemAttr      = $64657363 (* 'desc' *);                       {  User-visible description string (string)  }
    kCommentKCItemAttr          = $69636D74 (* 'icmt' *);                       {  User's comment about the item (string)  }
    kCreatorKCItemAttr          = $63727472 (* 'crtr' *);                       {  Item's creator (OSType)  }
    kTypeKCItemAttr             = $74797065 (* 'type' *);                       {  Item's type (OSType)  }
    kScriptCodeKCItemAttr       = $73637270 (* 'scrp' *);                       {  Script code for all strings (ScriptCode)  }
    kLabelKCItemAttr            = $6C61626C (* 'labl' *);                       {  Item label (string)  }
    kInvisibleKCItemAttr        = $696E7669 (* 'invi' *);                       {  Invisible (boolean)  }
    kNegativeKCItemAttr         = $6E656761 (* 'nega' *);                       {  Negative (boolean)  }
    kCustomIconKCItemAttr       = $63757369 (* 'cusi' *);                       {  Custom icon (boolean)  }
    kAccountKCItemAttr          = $61636374 (* 'acct' *);                       {  User account (string)  }
                                                                {  Unique Generic password attributes  }
    kServiceKCItemAttr          = $73766365 (* 'svce' *);                       {  Service (string)  }
    kGenericKCItemAttr          = $67656E61 (* 'gena' *);                       {  User-defined attribute (untyped bytes)  }
                                                                {  Unique Internet password attributes  }
    kSecurityDomainKCItemAttr   = $73646D6E (* 'sdmn' *);                       {  Security domain (string)  }
    kServerKCItemAttr           = $73727672 (* 'srvr' *);                       {  Server's domain name or IP address (string)  }
    kAuthTypeKCItemAttr         = $61747970 (* 'atyp' *);                       {  Authentication Type (KCAuthType)  }
    kPortKCItemAttr             = $706F7274 (* 'port' *);                       {  Port (UInt16)  }
    kPathKCItemAttr             = $70617468 (* 'path' *);                       {  Path (string)  }
                                                                {  Unique Appleshare password attributes  }
    kVolumeKCItemAttr           = $766C6D65 (* 'vlme' *);                       {  Volume (string)  }
    kAddressKCItemAttr          = $61646472 (* 'addr' *);                       {  Server address (IP or domain name) or zone name (string)  }
    kSignatureKCItemAttr        = $73736967 (* 'ssig' *);                       {  Server signature block (AFPServerSignature)  }
                                                                {  Unique AppleShare and Internet attributes  }
    kProtocolKCItemAttr         = $7074636C (* 'ptcl' *);                       {  Protocol (KCProtocolType)  }
                                                                {  Certificate attributes  }
    kSubjectKCItemAttr          = $7375626A (* 'subj' *);                       {  Subject distinguished name (DER-encoded data)  }
    kCommonNameKCItemAttr       = $636E2020 (* 'cn  ' *);                       {  Common Name (UTF8-encoded string)  }
    kIssuerKCItemAttr           = $69737375 (* 'issu' *);                       {  Issuer distinguished name (DER-encoded data)  }
    kSerialNumberKCItemAttr     = $736E6272 (* 'snbr' *);                       {  Certificate serial number (DER-encoded data)  }
    kEMailKCItemAttr            = $6D61696C (* 'mail' *);                       {  E-mail address (ASCII-encoded string)  }
    kPublicKeyHashKCItemAttr    = $68706B79 (* 'hpky' *);                       {  Hash of public key (KCPublicKeyHash), 20 bytes max.  }
    kIssuerURLKCItemAttr        = $6975726C (* 'iurl' *);                       {  URL of the certificate issuer (ASCII-encoded string)  }
                                                                {  Shared by keys and certificates  }
    kEncryptKCItemAttr          = $656E6372 (* 'encr' *);                       {  Encrypt (Boolean)  }
    kDecryptKCItemAttr          = $64656372 (* 'decr' *);                       {  Decrypt (Boolean)  }
    kSignKCItemAttr             = $7369676E (* 'sign' *);                       {  Sign (Boolean)  }
    kVerifyKCItemAttr           = $76657269 (* 'veri' *);                       {  Verify (Boolean)  }
    kWrapKCItemAttr             = $77726170 (* 'wrap' *);                       {  Wrap (Boolean)  }
    kUnwrapKCItemAttr           = $756E7772 (* 'unwr' *);                       {  Unwrap (Boolean)  }
    kStartDateKCItemAttr        = $73646174 (* 'sdat' *);                       {  Start Date (UInt32)  }
    kEndDateKCItemAttr          = $65646174 (* 'edat' *);                       {  End Date (UInt32)  }


type
    KCItemAttr                          = FourCharCode;

const
    kKCAuthTypeNTLM             = $6E746C6D (* 'ntlm' *);
    kKCAuthTypeMSN              = $6D736E61 (* 'msna' *);
    kKCAuthTypeDPA              = $64706161 (* 'dpaa' *);
    kKCAuthTypeRPA              = $72706161 (* 'rpaa' *);
    kKCAuthTypeHTTPDigest       = $68747464 (* 'httd' *);
    kKCAuthTypeDefault          = $64666C74 (* 'dflt' *);


type
    KCAuthType                          = FourCharCode;

const
    kKCProtocolTypeFTP          = $66747020 (* 'ftp ' *);
    kKCProtocolTypeFTPAccount   = $66747061 (* 'ftpa' *);
    kKCProtocolTypeHTTP         = $68747470 (* 'http' *);
    kKCProtocolTypeIRC          = $69726320 (* 'irc ' *);
    kKCProtocolTypeNNTP         = $6E6E7470 (* 'nntp' *);
    kKCProtocolTypePOP3         = $706F7033 (* 'pop3' *);
    kKCProtocolTypeSMTP         = $736D7470 (* 'smtp' *);
    kKCProtocolTypeSOCKS        = $736F7820 (* 'sox ' *);
    kKCProtocolTypeIMAP         = $696D6170 (* 'imap' *);
    kKCProtocolTypeLDAP         = $6C646170 (* 'ldap' *);
    kKCProtocolTypeAppleTalk    = $61746C6B (* 'atlk' *);
    kKCProtocolTypeAFP          = $61667020 (* 'afp ' *);
    kKCProtocolTypeTelnet       = $74656C6E (* 'teln' *);


type
    KCProtocolType                      = FourCharCode;
    KCCertAddOptions            = UInt32;
const
    kSecOptionReserved          = $000000FF;                    {  First byte reserved for SecOptions flags  }
    kCertUsageShift             = 8;                            {  start at bit 8  }
    kCertUsageSigningAdd        = $0100;
    kCertUsageSigningAskAndAdd  = $0200;
    kCertUsageVerifyAdd         = $0400;
    kCertUsageVerifyAskAndAdd   = $0800;
    kCertUsageEncryptAdd        = $1000;
    kCertUsageEncryptAskAndAdd  = $2000;
    kCertUsageDecryptAdd        = $4000;
    kCertUsageDecryptAskAndAdd  = $8000;
    kCertUsageKeyExchAdd        = $00010000;
    kCertUsageKeyExchAskAndAdd  = $00020000;
    kCertUsageRootAdd           = $00040000;
    kCertUsageRootAskAndAdd     = $00080000;
    kCertUsageSSLAdd            = $00100000;
    kCertUsageSSLAskAndAdd      = $00200000;
    kCertUsageAllAdd            = $7FFFFF00;


type
    KCVerifyStopOn              = UInt16;
const
    kPolicyKCStopOn             = 0;
    kNoneKCStopOn               = 1;
    kFirstPassKCStopOn          = 2;
    kFirstFailKCStopOn          = 3;


type
    KCCertSearchOptions         = UInt32;
const
    kCertSearchShift            = 0;                            {  start at bit 0  }
    kCertSearchSigningIgnored   = 0;
    kCertSearchSigningAllowed   = $01;
    kCertSearchSigningDisallowed = $02;
    kCertSearchSigningMask      = $03;
    kCertSearchVerifyIgnored    = 0;
    kCertSearchVerifyAllowed    = $04;
    kCertSearchVerifyDisallowed = $08;
    kCertSearchVerifyMask       = $0C;
    kCertSearchEncryptIgnored   = 0;
    kCertSearchEncryptAllowed   = $10;
    kCertSearchEncryptDisallowed = $20;
    kCertSearchEncryptMask      = $30;
    kCertSearchDecryptIgnored   = 0;
    kCertSearchDecryptAllowed   = $40;
    kCertSearchDecryptDisallowed = $80;
    kCertSearchDecryptMask      = $C0;
    kCertSearchWrapIgnored      = 0;
    kCertSearchWrapAllowed      = $0100;
    kCertSearchWrapDisallowed   = $0200;
    kCertSearchWrapMask         = $0300;
    kCertSearchUnwrapIgnored    = 0;
    kCertSearchUnwrapAllowed    = $0400;
    kCertSearchUnwrapDisallowed = $0800;
    kCertSearchUnwrapMask       = $0C00;
    kCertSearchPrivKeyRequired  = $1000;
    kCertSearchAny              = 0;

    {    Other constants    }
    kAnyPort                    = 0;

    kAnyProtocol                = 0;
    kAnyAuthType                = 0;

    {    Opening and getting information about the Keychain Manager     }
    {
     *  KCGetKeychainManagerVersion()
     *
     *  Availability:
     *    Non-Carbon CFM:   in KeychainLib 1.0 and later
     *    CarbonLib:        in CarbonLib 1.1 and later
     *    Mac OS X:         not available
        }
function KCGetKeychainManagerVersion(var returnVers: UInt32): OSStatus; external name '_KCGetKeychainManagerVersion';


{ Managing the Human Interface }
{
 *  KCSetInteractionAllowed()
 *
 *  Availability:
 *    Non-Carbon CFM:   in KeychainLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function KCSetInteractionAllowed(state: boolean): OSStatus; external name '_KCSetInteractionAllowed';

{
 *  KCIsInteractionAllowed()
 *
 *  Availability:
 *    Non-Carbon CFM:   in KeychainLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function KCIsInteractionAllowed: boolean; external name '_KCIsInteractionAllowed';

{ Creating references to keychains }
{
 *  KCMakeKCRefFromFSSpec()
 *
 *  Availability:
 *    Non-Carbon CFM:   in KeychainLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function KCMakeKCRefFromFSSpec(var keychainFSSpec: FSSpec; var keychain: KCRef): OSStatus; external name '_KCMakeKCRefFromFSSpec';

{
 *  KCMakeKCRefFromAlias()
 *
 *  Availability:
 *    Non-Carbon CFM:   in KeychainLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function KCMakeKCRefFromAlias(keychainAlias: AliasHandle; var keychain: KCRef): OSStatus; external name '_KCMakeKCRefFromAlias';

{
 *  KCMakeAliasFromKCRef()
 *
 *  Availability:
 *    Non-Carbon CFM:   in KeychainLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function KCMakeAliasFromKCRef(keychain: KCRef; var keychainAlias: AliasHandle): OSStatus; external name '_KCMakeAliasFromKCRef';

{
 *  KCReleaseKeychain()
 *
 *  Availability:
 *    Non-Carbon CFM:   in KeychainLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function KCReleaseKeychain(var keychain: KCRef): OSStatus; external name '_KCReleaseKeychain';

{ Specifying the default keychain }
{
 *  KCGetDefaultKeychain()
 *
 *  Availability:
 *    Non-Carbon CFM:   in KeychainLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function KCGetDefaultKeychain(var keychain: KCRef): OSStatus; external name '_KCGetDefaultKeychain';

{
 *  KCSetDefaultKeychain()
 *
 *  Availability:
 *    Non-Carbon CFM:   in KeychainLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function KCSetDefaultKeychain(keychain: KCRef): OSStatus; external name '_KCSetDefaultKeychain';

{ Getting information about a keychain }
{
 *  KCGetStatus()
 *
 *  Availability:
 *    Non-Carbon CFM:   in KeychainLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function KCGetStatus(keychain: KCRef; var keychainStatus: UInt32): OSStatus; external name '_KCGetStatus';

{
 *  KCGetKeychain()
 *
 *  Availability:
 *    Non-Carbon CFM:   in KeychainLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function KCGetKeychain(item: KCItemRef; var keychain: KCRef): OSStatus; external name '_KCGetKeychain';

{
 *  KCGetKeychainName()
 *
 *  Availability:
 *    Non-Carbon CFM:   in KeychainLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function KCGetKeychainName(keychain: KCRef; keychainName: StringPtr): OSStatus; external name '_KCGetKeychainName';

{ Enumerating available keychains }
{
 *  KCCountKeychains()
 *
 *  Availability:
 *    Non-Carbon CFM:   in KeychainLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function KCCountKeychains: UInt16; external name '_KCCountKeychains';

{
 *  KCGetIndKeychain()
 *
 *  Availability:
 *    Non-Carbon CFM:   in KeychainLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function KCGetIndKeychain(index: UInt16; var keychain: KCRef): OSStatus; external name '_KCGetIndKeychain';


type
    KCCallbackProcPtr = function(keychainEvent: KCEvent; var info: KCCallbackInfo; userContext: UnivPtr): OSStatus;

    KCCallbackUPP = ^SInt32; { an opaque UPP }

const
    uppKCCallbackProcInfo = $00000FB0;
    {
     *  NewKCCallbackUPP()
     *
     *  Availability:
     *    Non-Carbon CFM:   available as macro/inline
     *    CarbonLib:        in CarbonLib 1.1 and later
     *    Mac OS X:         in version 10.0 and later
        }
function NewKCCallbackUPP(userRoutine: KCCallbackProcPtr): KCCallbackUPP; external name '_NewKCCallbackUPP'; { old name was NewKCCallbackProc }
{
 *  DisposeKCCallbackUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeKCCallbackUPP(userUPP: KCCallbackUPP); external name '_DisposeKCCallbackUPP';
{
 *  InvokeKCCallbackUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeKCCallbackUPP(keychainEvent: KCEvent; var info: KCCallbackInfo; userContext: UnivPtr; userRoutine: KCCallbackUPP): OSStatus; external name '_InvokeKCCallbackUPP'; { old name was CallKCCallbackProc }
{ Keychain Manager callbacks }
{
 *  KCAddCallback()
 *
 *  Availability:
 *    Non-Carbon CFM:   in KeychainLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function KCAddCallback(callbackProc: KCCallbackUPP; eventMask: KCEventMask; userContext: UnivPtr): OSStatus; external name '_KCAddCallback';

{
 *  KCRemoveCallback()
 *
 *  Availability:
 *    Non-Carbon CFM:   in KeychainLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function KCRemoveCallback(callbackProc: KCCallbackUPP): OSStatus; external name '_KCRemoveCallback';


{ Creating and editing a keychain item }
{
 *  KCNewItem()
 *
 *  Availability:
 *    Non-Carbon CFM:   in KeychainLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function KCNewItem(itemClass: KCItemClass; itemCreator: OSType; length: UInt32; data: UnivPtr; var item: KCItemRef): OSStatus; external name '_KCNewItem';

{
 *  KCSetAttribute()
 *
 *  Availability:
 *    Non-Carbon CFM:   in KeychainLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function KCSetAttribute(item: KCItemRef; var attr: KCAttribute): OSStatus; external name '_KCSetAttribute';

{
 *  KCGetAttribute()
 *
 *  Availability:
 *    Non-Carbon CFM:   in KeychainLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function KCGetAttribute(item: KCItemRef; var attr: KCAttribute; var actualLength: UInt32): OSStatus; external name '_KCGetAttribute';

{
 *  KCSetData()
 *
 *  Availability:
 *    Non-Carbon CFM:   in KeychainLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function KCSetData(item: KCItemRef; length: UInt32; data: UnivPtr): OSStatus; external name '_KCSetData';

{ Managing keychain items }
{
 *  KCUpdateItem()
 *
 *  Availability:
 *    Non-Carbon CFM:   in KeychainLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function KCUpdateItem(item: KCItemRef): OSStatus; external name '_KCUpdateItem';

{
 *  KCReleaseItem()
 *
 *  Availability:
 *    Non-Carbon CFM:   in KeychainLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function KCReleaseItem(var item: KCItemRef): OSStatus; external name '_KCReleaseItem';

{
 *  KCCopyItem()
 *
 *  Availability:
 *    Non-Carbon CFM:   in KeychainLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function KCCopyItem(item: KCItemRef; destKeychain: KCRef; var copy: KCItemRef): OSStatus; external name '_KCCopyItem';

{ Searching and enumerating keychain items }
{
 *  KCFindFirstItem()
 *
 *  Availability:
 *    Non-Carbon CFM:   in KeychainLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function KCFindFirstItem(keychain: KCRef; attrList: {Const}KCAttributeListPtr; var search: KCSearchRef; var item: KCItemRef): OSStatus; external name '_KCFindFirstItem';

{
 *  KCFindNextItem()
 *
 *  Availability:
 *    Non-Carbon CFM:   in KeychainLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function KCFindNextItem(search: KCSearchRef; var item: KCItemRef): OSStatus; external name '_KCFindNextItem';

{
 *  KCReleaseSearch()
 *
 *  Availability:
 *    Non-Carbon CFM:   in KeychainLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function KCReleaseSearch(var search: KCSearchRef): OSStatus; external name '_KCReleaseSearch';


{ Managing keychain items }
{
 *  KCDeleteItem()
 *
 *  Availability:
 *    Non-Carbon CFM:   in KeychainLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function KCDeleteItem(item: KCItemRef): OSStatus; external name '_KCDeleteItem';

{
 *  KCGetData()
 *
 *  Availability:
 *    Non-Carbon CFM:   in KeychainLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function KCGetData(item: KCItemRef; maxLength: UInt32; data: UnivPtr; var actualLength: UInt32): OSStatus; external name '_KCGetData';

{ Storing and retrieving AppleShare passwords }
{
 *  KCAddAppleSharePassword()
 *
 *  Availability:
 *    Non-Carbon CFM:   in KeychainLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function KCAddAppleSharePassword(var serverSignature: AFPServerSignature; serverAddress: StringPtr; serverName: StringPtr; volumeName: StringPtr; accountName: StringPtr; passwordLength: UInt32; passwordData: UnivPtr; item: KCItemRefPtr): OSStatus; external name '_KCAddAppleSharePassword';

{
 *  KCFindAppleSharePassword()
 *
 *  Availability:
 *    Non-Carbon CFM:   in KeychainLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function KCFindAppleSharePassword(serverSignature: AFPServerSignaturePtr; serverAddress: StringPtr; serverName: StringPtr; volumeName: StringPtr; accountName: StringPtr; maxLength: UInt32; passwordData: UnivPtr; var actualLength: UInt32; item: KCItemRefPtr): OSStatus; external name '_KCFindAppleSharePassword';

{ Storing and retrieving Internet passwords }
{
 *  KCAddInternetPassword()
 *
 *  Availability:
 *    Non-Carbon CFM:   in KeychainLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function KCAddInternetPassword(serverName: StringPtr; securityDomain: StringPtr; accountName: StringPtr; port: UInt16; protocol: OSType; authType: OSType; passwordLength: UInt32; passwordData: UnivPtr; item: KCItemRefPtr): OSStatus; external name '_KCAddInternetPassword';

{
 *  KCAddInternetPasswordWithPath()
 *
 *  Availability:
 *    Non-Carbon CFM:   in KeychainLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function KCAddInternetPasswordWithPath(serverName: StringPtr; securityDomain: StringPtr; accountName: StringPtr; path: StringPtr; port: UInt16; protocol: OSType; authType: OSType; passwordLength: UInt32; passwordData: UnivPtr; item: KCItemRefPtr): OSStatus; external name '_KCAddInternetPasswordWithPath';

{
 *  KCFindInternetPassword()
 *
 *  Availability:
 *    Non-Carbon CFM:   in KeychainLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function KCFindInternetPassword(serverName: StringPtr; securityDomain: StringPtr; accountName: StringPtr; port: UInt16; protocol: OSType; authType: OSType; maxLength: UInt32; passwordData: UnivPtr; var actualLength: UInt32; item: KCItemRefPtr): OSStatus; external name '_KCFindInternetPassword';

{
 *  KCFindInternetPasswordWithPath()
 *
 *  Availability:
 *    Non-Carbon CFM:   in KeychainLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function KCFindInternetPasswordWithPath(serverName: StringPtr; securityDomain: StringPtr; accountName: StringPtr; path: StringPtr; port: UInt16; protocol: OSType; authType: OSType; maxLength: UInt32; passwordData: UnivPtr; var actualLength: UInt32; item: KCItemRefPtr): OSStatus; external name '_KCFindInternetPasswordWithPath';

{ Storing and retrieving other types of passwords }
{
 *  KCAddGenericPassword()
 *
 *  Availability:
 *    Non-Carbon CFM:   in KeychainLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function KCAddGenericPassword(serviceName: StringPtr; accountName: StringPtr; passwordLength: UInt32; passwordData: UnivPtr; item: KCItemRefPtr): OSStatus; external name '_KCAddGenericPassword';

{
 *  KCFindGenericPassword()
 *
 *  Availability:
 *    Non-Carbon CFM:   in KeychainLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function KCFindGenericPassword(serviceName: StringPtr; accountName: StringPtr; maxLength: UInt32; passwordData: UnivPtr; var actualLength: UInt32; item: KCItemRefPtr): OSStatus; external name '_KCFindGenericPassword';

{
 *  KCLock()
 *
 *  Availability:
 *    Non-Carbon CFM:   in KeychainLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function KCLock(keychain: KCRef): OSStatus; external name '_KCLock';


{$ALIGN MAC68K}
{#POP}
{unit KeychainHI}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}

{ Locking and unlocking a keychain }
{
 *  KCUnlock()
 *
 *  Availability:
 *    Non-Carbon CFM:   in KeychainLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function KCUnlock(keychain: KCRef; password: StringPtr): OSStatus; external name '_KCUnlock';

{ Managing keychain items }
{
 *  KCAddItem()
 *
 *  Availability:
 *    Non-Carbon CFM:   in KeychainLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function KCAddItem(item: KCItemRef): OSStatus; external name '_KCAddItem';

{ Creating a new keychain }
{
 *  KCCreateKeychain()
 *
 *  Availability:
 *    Non-Carbon CFM:   in KeychainLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function KCCreateKeychain(password: StringPtr; keychain: KCRefPtr): OSStatus; external name '_KCCreateKeychain';

{ Changing a keychain's settings }
{
 *  KCChangeSettings()
 *
 *  Availability:
 *    Non-Carbon CFM:   in KeychainLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function KCChangeSettings(keychain: KCRef): OSStatus; external name '_KCChangeSettings';

{ Working with certificates }

{$ALIGN MAC68K}
{#POP}
{unit Menus}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}


{
 *  Menu Manager
 }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{  ¥ Menu Constants                                                                    }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}

const
    noMark                      = 0;                            {  mark symbol for SetItemMark; other mark symbols are defined in Fonts.h  }

    {
        A Short Course on Menu Definition Functions

        A menu definition function is used to implement a custom visual appearance for a menu.
        Menu definition functions are still supported in Carbon, but the messages sent to a
        menu definition function in Carbon are different than for a non-Carbon application.

        In general, Apple recommends using the system menu definition whenever possible.
        Menu definition functions will continue to be supported, but it is not easy to write
        a correct menu definition, especially one that attempts to imitate the standard system
        menu appearance. If you require special features in your menu that the system menu
        definition does not support, please mail <toolbox@apple.com> and describe your requirements;
        we would much rather enhance the system menu definition than have you write a custom one.

        Menu definition functions before Carbon used the following messages:

            kMenuDrawMsg
            kMenuChooseMsg
            kMenuSizeMsg
            kMenuPopUpMsg
            kMenuDrawItemMsg
            kMenuCalcItemMsg
            kMenuThemeSavvyMsg

        kMenuChooseMsg and kMenuDrawItemMsg are not supported in Carbon and are not sent to
        Carbon menu definitions. In Carbon, kMenuChooseMsg is replaced by kMenuFindItemMsg and
        kMenuHiliteItemMsg. Menu definition functions in Carbon use the following messages:

            kMenuInitMsg
            kMenuDisposeMsg
            kMenuFindItemMsg
            kMenuHiliteItemMsg
            kMenuDrawItemsMsg
            kMenuDrawMsg
            kMenuSizeMsg
            kMenuPopUpMsg
            kMenuCalcItemMsg
            kMenuThemeSavvyMsg

        The rest of this documentation will focus on Carbon menu definitions only.

        Menu Definition Messages

            Carbon menu definition functions should support the following messages:

            kMenuInitMsg

                menuRect        unused
                hitPt           unused
                whichItem       OSErr*

                Sent when a menu is created. This message gives the menu definition an opportunity
                to initialize its own state. If the menu definition encounters an error while
                initializing, it should set *whichItem to a non-zero error code; this will cause the
                Menu Manager to destroy the menu and return an error back from the API that was used
                to create the menu.

            kMenuDisposeMsg

                menuRect        unused
                hitPt           unused
                whichItem       unused

                Sent when a menu is destroyed. This message gives the menu definition an opportunity
                to destroy its own data.

            kMenuFindItemMsg

                menuRect        menu bounds
                hitPt           point to hit-test
                whichItem       MDEFFindItemData*

                Sent when the Menu Manager is displaying a menu and needs to know what item is under
                the mouse. The whichItem parameter is actually a pointer to a MenuTrackingData structure.
                On entry, the menu, virtualMenuTop, and virtualMenuBottom fields of this structure are
                valid. The menu definition should determine which item containst the given point, if any,
                and fill in the itemUnderMouse, itemSelected, and itemRect fields. If an item is found,
                the menu definition should always fill in the itemUnderMouse and itemRect fields. The
                menu definition should only fill in the itemSelected field if the item is available for
                selection; if it is unavailable (because it is disabled, or for some other reason), the
                menu definition should set the itemSelected field to zero.

                The values placed in the itemUnderMouse and itemSelected fields should be less than or
                equal to the number of items returned by CountMenuItems on this menu.

                The menu definition should not hilite the found item during this message. The Menu
                Manager will send a separate kMenuHiliteItemMsg to request hiliting of the item.

                If the menu definition supports scrolling, it should scroll the menu during this message,
                and update the virtualMenuTop and virtualMenuBottom fields of the MenuTrackingData to
                indicate the menu's new scrolled position.

                If the menu definition uses QuickDraw to draw while scrolling, it should draw into the
                current port.

                If the menu definition uses CoreGraphics to draw while scrolling, it should use the
                CGContextRef passed in the context field of the MDEFHiliteItemData structure.

                Menu definitions must use the ScrollMenuImage API, if available, to scroll the menu contents.
                This API is available in CarbonLib 1.5 and later, and in Mac OS X 10.1 and later. ScrollMenuImage
                properly supports scrolling the alpha channel in the menu's image data. Use of QuickDraw's
                ScrollRect API to scroll the menu contents will result in the alpha channel being set to 0xFF
                (opaque) and the menu will no longer be transparent.

                The menu definition should not modify the menu field of the MenuTrackingData.

            kMenuHiliteItemMsg

                menuRect        menu bounds
                hitPt           unused
                whichItem       MDEFHiliteItemData*

                Sent when the Menu Manager is displaying a menu and needs to hilite a newly selected
                item. The whichItem parameter is actually a pointer to a MDEFHiliteItemData structure.
                The menu definition should unhilite the item in the previousItem field, if non-zero,
                and hilite the item in the newItem field.

                Menu definitions should use the EraseMenuBackground API to erase the old menu contents
                before unhiliting a menu item, if the menu definition is using the Appearance Manager's
                menu drawing APIs. This is necessary because the background of a menu is transparent on
                Aqua, and if the old hilite is not erased first, it will show through the new unhilited
                menu background.

                If the menu definition uses QuickDraw to draw, it should draw into the current port.

                If the menu definition uses CoreGraphics to draw, it should use the CGContextRef passed
                in the context field of the MDEFHiliteItemData structure.

            kMenuDrawItemsMsg

                menuRect        menu bounds
                hitPt           unused
                whichItem       MDEFDrawItemsData*

                Sent when the Menu Manager is displaying a menu and needs to redraw a portion of the
                menu. This message is used by the dynamic menu item support code in the Menu Manager;
                for example, if items five and six in a menu are a dynamic group, the Menu Manager will
                send a DrawItems message when the group's modifier key is pressed or released to redraw
                the appropriate item, but no other items in the menu.

                The whichItem parameter for this message is actually a pointer to a MDEFDrawItemsData
                structure. The menu definition should redraw the items starting with firstItem and
                ending with lastItem, inclusive.

                If the menu definition uses QuickDraw to draw, it should draw into the current port.

                If the menu definition uses CoreGraphics to draw, it should use the CGContextRef passed
                in the context field of the MDEFDrawItemsData structure.

            kMenuDrawMsg

                menuRect        menu bounds
                hitPt           unused
                whichItem       MDEFDrawData*

                Sent when the Menu Manager is displaying a menu and needs to redraw the entire menu.
                The whichItem parameter is actually a pointer to a MenuTrackingData structure. On entry,
                the menu field of this structure is valid. The menu definition should draw the menu and,
                if it supports scrolling, should also fill in the virtualMenuTop and virtualMenuBottom
                fields of the structure to indicate the menu's initial unscrolled position; typically,
                virtualMenuTop would be set to the same value as the top coordinate of the menu rect,
                and virtualMenuBottom would be set to virtualMenuTop plus the virtual height of the menu.

                If the menu definition uses QuickDraw to draw, it should draw into the current port.

                If the menu definition uses CoreGraphics to draw, it should use the CGContextRef passed
                in the context field of the MDEFDrawData structure.

            kMenuSizeMsg

                menuRect        unused
                hitPt           maximum width and height of the menu
                whichItem       unused

                Sent when the Menu Manager needs to determine the size of a menu. The menu definition
                should calculate the width and height of the menu and store the sizes into the menu with
                SetMenuWidth and SetMenuHeight.

                If the gestaltMenuMgrSendsMenuBoundsToDefProc bit is set in the Menu Manager's Gestalt
                value, then the hitPt parameter to this message is the maximum width (hitPt.h) and height
                (hitPt.v) of the menu. The menu definition should ensure that the width and height that it
                places in the menu do not exceed these values. If the gestalt bit is not set, the menu
                definition should just use the main GDevice's width and height as constraints on the menu's
                width and height.

            kMenuPopUpMsg

                menuRect        on entry, constraints on the menu's position; on exit, menu bounds
                hitPt           requested menu location, with swapped coordinates
                whichItem       on entry, requested initial selection; on exit, virtual menu top

                Sent when the Menu Manager is about to display a popup menu. The menu definition should
                calculate the appropriate menu bounds to contain the menu based on the requested menu
                location and selected item. It should write the menuBounds into the rect given by the
                menuRect parameter.

                If the gestaltMenuMgrSendsMenuBoundsToDefProc bit is set in the Menu Manager's Gestalt
                value, then the menuRect parameter on entry to this message contains a constraint rect,
                in global coordinates, outside of which the popup menu should not be positioned. The menu
                definition should take this constraint rect into account as it calculates the menu bounds.
                If the gestalt bit is not set, the menu definition should use the bounds of the GDevice
                containing the menu's top left corner as a constraint on the menu's position.

                The hitPt parameter is a requested location for the top left corner of the menu. The
                coordinates of this parameter are swapped from their normal order; the h field of the
                hitPt parameter contains the vertical coordinate, and the v field of hitPt contains
                the horizontal coordinate.

                On entry, the whichItem parameter points at a menu item index which is requested to be
                the initial selection when the menu is displayed. After calculating the menu's bounds,
                the menu definition should write the menu's virtual top coordinate into the location
                pointed at by the whichItem parameter. If displaying the menu at the requested location
                does not require scrolling, the virtual top will be the same as the menu bounds top;
                if the menu must scroll to fit in the requested location, the virtual top may be different.

            kMenuCalcItemMsg

                menuRect        on exit, item bounds
                hitPt           unused
                whichItem       the item whose rect to calculate

                Sent when the Menu Manager needs to know the bounds of a menu item. The menu definition
                should calculate the size of the item specified by the whichItem parameter, and store
                the bounds in the rect specified by the menuRect parameter.

                Some sample menu definition code provided by Apple has previously shown an implementation
                of this message that always sets the top left corner of the item bounds to (0,0), regardless
                of the item's actual position in the menu. For best future compatibility, menu definitions
                should begin storing an item bounds that gives the item's actual position in the menu based
                on the menu's current virtual top. For example, if the virtual menu top starts at 20, then
                the menu definition would calculate an item bounds for the first item that starts at (0,20),
                an item bounds for the second item that starts at (0,40), and so on. The menu definition
                should call GetMenuTrackingData to get the menu's current virtual position, and use zero
                for the menu top if GetMenuTrackingData returns an error.

            kMenuThemeSavvyMsg

                menuRect        unused
                hitPt           unused
                whichItem       on exit, indicates theme-savvyness of the menu definition

                Sent by the Menu Manager to determine whether the MDEF uses the Appearance Manager
                menu-drawing functions to draw its menu. If it does, the menu definition should return
                kThemeSavvyMenuResponse in the location pointed to by whichItem. If the menu definition
                draws its own custom content without using the Appearance Manager menu-drawing functions,
                it should ignore this message.

        Low-memory Global Replacements

            Pre-Carbon menu definitions needed to use several low-memory globals to communicate with the
            Menu Manager. These globals have all been replaced or made obsolete in Carbon, as follows:

            MenuDisable

                MenuDisable is now set automatically by the Menu Manager using the value returned in the
                itemUnderMouse field of the MenuTrackingData structure passed to kMenuFindItemMsg.

            TopMenuItem
            AtMenuBottom

                TopMenuItem and AtMenuBottom are now set automatically by the Menu Manager using the
                values returned in the virtualMenuTop and virtualMenuBottom fields of the MenuTrackingData
                structure passed to kMenuDrawMsg and kMenuFindItemMsg.

            mbSaveLoc

                This undocumented low-memory global was used by pre-Carbon menu definitions to store
                the bounding rect of the currently selected item and to avoid drawing glitches while
                the menu definition was scrolling the contents of a menu that had submenus. The Menu
                Manager now automatically sets the selected item bounds using the value returned in
                the itemRect field of the MenuTrackingData structure passed to kMenuFindItemMsg. In
                order to correctly support scrolling of menus with submenus, a menu definition should
                verify, before scrolling the menu contents, that no submenus of the scrolling menu are
                currently visible. A menu definition can use GetMenuTrackingData to verify this condition,
                as follows:

                    Boolean SafeToScroll( MenuRef menuBeingScrolled )
                    (
                        MenuTrackingData lastMenuData;
                        return GetMenuTrackingData( NULL, &lastMenuData ) == noErr
                               && lastMenuData.menu == menuBeingScrolled;
                    )

                If SafeToScroll returns false, the menu definition should not scroll the menu.
        }
                                                                {  menu defProc messages  }
    kMenuDrawMsg                = 0;
    kMenuSizeMsg                = 2;
    kMenuPopUpMsg               = 3;
    kMenuCalcItemMsg            = 5;
    kMenuThemeSavvyMsg          = 7;                            {  is your MDEF theme-savvy?  If so, return kThemeSavvyMenuResponse in the whichItem parameter }
    mDrawMsg                    = 0;
    mSizeMsg                    = 2;
    mPopUpMsg                   = 3;                            {  position the popup menu rect appropriately  }
    mCalcItemMsg                = 5;


    kThemeSavvyMenuResponse     = $7473;                        {  should be returned in *whichItem when handling kMenuThemeSavvyMsg }

    {  these MDEF messages are only supported in Carbon }
    kMenuInitMsg                = 8;
    kMenuDisposeMsg             = 9;
    kMenuFindItemMsg            = 10;
    kMenuHiliteItemMsg          = 11;
    kMenuDrawItemsMsg           = 12;

    textMenuProc                = 0;
    hMenuCmd                    = 27;                           { itemCmd == 0x001B ==> hierarchical menu }
    hierMenu                    = -1;                           { a hierarchical menu - for InsertMenu call }
    kInsertHierarchicalMenu     = -1;                           { a better name for hierMenu  }
    mctAllItems                 = -98;                          { search for all Items for the given ID }
    mctLastIDIndic              = -99;                          { last color table entry has this in ID field }

    {  Constants for use with MacOS 8.0 (Appearance 1.0) and later }
    kMenuStdMenuProc            = 63;
    kMenuStdMenuBarProc         = 63;

    {  For use with Get/SetMenuItemModifiers }
    kMenuNoModifiers            = 0;                            {  Mask for no modifiers }
    kMenuShiftModifier          = $01;                          {  Mask for shift key modifier }
    kMenuOptionModifier         = $02;                          {  Mask for option key modifier }
    kMenuControlModifier        = $04;                          {  Mask for control key modifier }
    kMenuNoCommandModifier      = $08;                          {  Mask for no command key modifier }

    {  For use with Get/SetMenuItemIconHandle }
    kMenuNoIcon                 = 0;                            {  No icon }
    kMenuIconType               = 1;                            {  Type for ICON }
    kMenuShrinkIconType         = 2;                            {  Type for ICON plotted 16 x 16 }
    kMenuSmallIconType          = 3;                            {  Type for SICN }
    kMenuColorIconType          = 4;                            {  Type for cicn }
    kMenuIconSuiteType          = 5;                            {  Type for Icon Suite }
    kMenuIconRefType            = 6;                            {  Type for Icon Ref }
    kMenuCGImageRefType         = 7;                            {  Type for a CGImageRef (Mac OS X only) }
    kMenuSystemIconSelectorType = 8;                            {  Type for an IconRef registered with Icon Services under kSystemIconsCreator (Mac OS X 10.1 and later only) }
    kMenuIconResourceType       = 9;                            {  Type for a CFStringRef naming a resource in the main bundle of the process (Mac OS X 10.1 and later only) }

    {  For use with Get/SetMenuItemKeyGlyph }
    kMenuNullGlyph              = $00;                          {  Null (always glyph 1) }
    kMenuTabRightGlyph          = $02;                          {  Tab to the right key (for left-to-right script systems) }
    kMenuTabLeftGlyph           = $03;                          {  Tab to the left key (for right-to-left script systems) }
    kMenuEnterGlyph             = $04;                          {  Enter key }
    kMenuShiftGlyph             = $05;                          {  Shift key }
    kMenuControlGlyph           = $06;                          {  Control key }
    kMenuOptionGlyph            = $07;                          {  Option key }
    kMenuSpaceGlyph             = $09;                          {  Space (always glyph 3) key }
    kMenuDeleteRightGlyph       = $0A;                          {  Delete to the right key (for right-to-left script systems) }
    kMenuReturnGlyph            = $0B;                          {  Return key (for left-to-right script systems) }
    kMenuReturnR2LGlyph         = $0C;                          {  Return key (for right-to-left script systems) }
    kMenuNonmarkingReturnGlyph  = $0D;                          {  Nonmarking return key }
    kMenuPencilGlyph            = $0F;                          {  Pencil key }
    kMenuDownwardArrowDashedGlyph = $10;                        {  Downward dashed arrow key }
    kMenuCommandGlyph           = $11;                          {  Command key }
    kMenuCheckmarkGlyph         = $12;                          {  Checkmark key }
    kMenuDiamondGlyph           = $13;                          {  Diamond key }
    kMenuAppleLogoFilledGlyph   = $14;                          {  Apple logo key (filled) }
    kMenuParagraphKoreanGlyph   = $15;                          {  Unassigned (paragraph in Korean) }
    kMenuDeleteLeftGlyph        = $17;                          {  Delete to the left key (for left-to-right script systems) }
    kMenuLeftArrowDashedGlyph   = $18;                          {  Leftward dashed arrow key }
    kMenuUpArrowDashedGlyph     = $19;                          {  Upward dashed arrow key }
    kMenuRightArrowDashedGlyph  = $1A;                          {  Rightward dashed arrow key }
    kMenuEscapeGlyph            = $1B;                          {  Escape key }
    kMenuClearGlyph             = $1C;                          {  Clear key }
    kMenuLeftDoubleQuotesJapaneseGlyph = $1D;                   {  Unassigned (left double quotes in Japanese) }
    kMenuRightDoubleQuotesJapaneseGlyph = $1E;                  {  Unassigned (right double quotes in Japanese) }
    kMenuTrademarkJapaneseGlyph = $1F;                          {  Unassigned (trademark in Japanese) }
    kMenuBlankGlyph             = $61;                          {  Blank key }
    kMenuPageUpGlyph            = $62;                          {  Page up key }
    kMenuCapsLockGlyph          = $63;                          {  Caps lock key }
    kMenuLeftArrowGlyph         = $64;                          {  Left arrow key }
    kMenuRightArrowGlyph        = $65;                          {  Right arrow key }
    kMenuNorthwestArrowGlyph    = $66;                          {  Northwest arrow key }
    kMenuHelpGlyph              = $67;                          {  Help key }
    kMenuUpArrowGlyph           = $68;                          {  Up arrow key }
    kMenuSoutheastArrowGlyph    = $69;                          {  Southeast arrow key }
    kMenuDownArrowGlyph         = $6A;                          {  Down arrow key }
    kMenuPageDownGlyph          = $6B;                          {  Page down key }
    kMenuAppleLogoOutlineGlyph  = $6C;                          {  Apple logo key (outline) }
    kMenuContextualMenuGlyph    = $6D;                          {  Contextual menu key }
    kMenuPowerGlyph             = $6E;                          {  Power key }
    kMenuF1Glyph                = $6F;                          {  F1 key }
    kMenuF2Glyph                = $70;                          {  F2 key }
    kMenuF3Glyph                = $71;                          {  F3 key }
    kMenuF4Glyph                = $72;                          {  F4 key }
    kMenuF5Glyph                = $73;                          {  F5 key }
    kMenuF6Glyph                = $74;                          {  F6 key }
    kMenuF7Glyph                = $75;                          {  F7 key }
    kMenuF8Glyph                = $76;                          {  F8 key }
    kMenuF9Glyph                = $77;                          {  F9 key }
    kMenuF10Glyph               = $78;                          {  F10 key }
    kMenuF11Glyph               = $79;                          {  F11 key }
    kMenuF12Glyph               = $7A;                          {  F12 key }
    kMenuF13Glyph               = $87;                          {  F13 key }
    kMenuF14Glyph               = $88;                          {  F14 key }
    kMenuF15Glyph               = $89;                          {  F15 key }
    kMenuControlISOGlyph        = $8A;                          {  Control key (ISO standard) }


    {
     *  MenuAttributes
     *
     *  Summary:
     *    Menu attributes control behavior of the entire menu. They are
     *    used with the Get/ChangeMenuAttributes APIs.
        }

type
    MenuAttributes              = UInt32;
const
    kMenuAttrExcludesMarkColumn = $01;
    kMenuAttrAutoDisable        = $04;
    kMenuAttrUsePencilGlyph     = $08;
    kMenuAttrHidden             = $10;


    {
     *  MenuItemAttributes
     *
     *  Summary:
     *    Menu item attributes control behavior of individual menu items.
     *    They are used with the Get/ChangeMenuItemAttributes APIs.
        }

type
    MenuItemAttributes          = UInt32;
const
    kMenuItemAttrDisabled       = $01;
    kMenuItemAttrIconDisabled   = $02;
    kMenuItemAttrSubmenuParentChoosable = $04;
    kMenuItemAttrDynamic        = $08;
    kMenuItemAttrNotPreviousAlternate = $10;
    kMenuItemAttrHidden         = $20;
    kMenuItemAttrSeparator      = $40;
    kMenuItemAttrSectionHeader  = $80;
    kMenuItemAttrIgnoreMeta     = $0100;
    kMenuItemAttrAutoRepeat     = $0200;
    kMenuItemAttrUseVirtualKey  = $0400;
    kMenuItemAttrCustomDraw     = $0800;
    kMenuItemAttrIncludeInCmdKeyMatching = $1000;


    {
     *  MenuTrackingMode
     *
     *  Summary:
     *    A menu tracking mode constant is part of the
     *    kEventMenuBeginTracking and kEventMenuChangeTrackingMode Carbon
     *    events. It indicates whether menus are being tracked using the
     *    mouse or keyboard.
        }

type
    MenuTrackingMode            = UInt32;
const
    kMenuTrackingModeMouse      = 1;
    kMenuTrackingModeKeyboard   = 2;


    {
     *  MenuEventOptions
     *
     *  Summary:
     *    Menu event options control how the menus are searched for an item
     *    matching a particular keyboard event. They are used with the
     *    IsMenuKeyEvent API.
        }

type
    MenuEventOptions            = UInt32;
const
    kMenuEventIncludeDisabledItems = $0001;
    kMenuEventQueryOnly         = $0002;
    kMenuEventDontCheckSubmenus = $0004;

    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {     ¥ Menu Types                                                                          }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }

type
    MenuID                              = SInt16;
    MenuItemIndex                       = UInt16;
    MenuItemIndexPtr                    = ^MenuItemIndex; { when a VAR xx: MenuItemIndex parameter can be nil, it is changed to xx: MenuItemIndexPtr }
    MenuCommand                         = UInt32;
    MenuHandle    = ^SInt32; { an opaque 32-bit type }
    MenuHandlePtr = ^MenuHandle;  { when a var xx:MenuHandle parameter can be nil, it is changed to xx: MenuHandlePtr }

    {  MenuRef and MenuHandle are equivalent. Use either. We don't care. }
    MenuRef                             = MenuHandle;
    MenuRefPtr                          = ^MenuRef; { when a var xx:MenuRef parameter can be nil, it is changed to xx: MenuRefPtr }
    {
       A MenuBarHandle is a handle to a MenuBarHeader. An instance of this structure is returned
       by the GetMenuBar and GetNewMBar APIs. It is typedef'd to a plain Handle to retain
       source compatibility with previous versions of this header file.
    }
    MenuBarHandle                       = Handle;

    {
     *  MenuBarHeader
     *
     *  Summary:
     *    This structure is contained in a MenuBarHandle. It contains a
     *    list of the non-hierarchical menus that have been inserted into
     *    the menubar.
     *
     *  Discussion:
     *    The MenuBarHandle is a dynamically sized object which cannot be
     *    directly expressed as a C or Pascal structure. First is the
     *    MenuBarHeader structure, followed by a dynamically sized array of
     *    MenuBarMenus, one for each menu. This array is followed by the
     *    HMenuBarHeader, followed by another dynamically sized array of
     *    HMenuBarMenus, one for each hierarchical menu.
        }
    MenuBarHeaderPtr = ^MenuBarHeader;
    MenuBarHeader = record
        lastMenu:               UInt16;
        lastRight:              SInt16;
        mbResID:                SInt16;
    end;


    {
     *  HMenuBarHeader
     *
     *  Summary:
     *    This structure is contained in a MenuBarHandle. It contains a
     *    list of the hierarchical menus that have been inserted into the
     *    menubar with InsertMenu( menu, -1 ).
     *
     *  Discussion:
     *    The hierarchical portion of the menubar follows the
     *    non-hierarchical portion in a menubar handle. The hierarchical
     *    portion begins with the HMenuBarHeader structure, followed by a
     *    dynamically sized array of HMenuBarMenus.
        }
    HMenuBarHeaderPtr = ^HMenuBarHeader;
    HMenuBarHeader = record
        lastHMenu:              UInt16;
        menuTitleBits:          PixMapHandle;
    end;


    {
     *  MenuBarMenu
     *
     *  Summary:
     *    This structure contains a single menu in the menubar. It is an
     *    element in an array in the MenuBarHeader data strucuture.
        }
    MenuBarMenuPtr = ^MenuBarMenu;
    MenuBarMenu = record
        menu:                   MenuRef;
        menuLeft:               SInt16;
    end;


    {
     *  HMenuBarMenu
     *
     *  Summary:
     *    This structure contains a single hierarchical menu in the
     *    menubar. It is an element in an array in the HMenuBarHeader data
     *    strucuture.
        }
    HMenuBarMenuPtr = ^HMenuBarMenu;
    HMenuBarMenu = record
        menu:                   MenuRef;
        reserved:               SInt16;
    end;

    MCEntryPtr = ^MCEntry;
    MCEntry = record
        mctID:                  MenuID;                                 { menu ID.  ID = 0 is the menu bar }
        mctItem:                SInt16;                             { menu Item. Item = 0 is a title }
        mctRGB1:                RGBColor;                               { usage depends on ID and Item }
        mctRGB2:                RGBColor;                               { usage depends on ID and Item }
        mctRGB3:                RGBColor;                               { usage depends on ID and Item }
        mctRGB4:                RGBColor;                               { usage depends on ID and Item }
        mctReserved:            SInt16;                             { reserved for internal use }
    end;

    MCTable                             = array [0..0] of MCEntry;
    MCTablePtr                          = ^MCTable;
    MCTableHandle                       = ^MCTablePtr;
    MenuCRsrcPtr = ^MenuCRsrc;
    MenuCRsrc = record
        numEntries:             SInt16;                             { number of entries }
        mcEntryRecs:            MCTable;                                { array [1..numEntries] of MCEntry }
    end;

    MenuCRsrcHandle                     = ^MenuCRsrcPtr;


{
 *  MenuTrackingData
 *
 *  Summary:
 *    The MenuTrackingData structure contains information about a menu
 *    currently being displayed. It is used with the
 *    GetMenuTrackingData API.
 }

type
    MenuTrackingDataPtr = ^MenuTrackingData;
    MenuTrackingData = record
        menu:                   MenuRef;
        itemSelected:           MenuItemIndex;
        itemUnderMouse:         MenuItemIndex;
        itemRect:               Rect;
        virtualMenuTop:         SInt32;
        virtualMenuBottom:      SInt32;
    end;


    {
     *  MDEFHiliteItemData
     *
     *  Summary:
     *    The MDEFHiliteItemData structure contains information about which
     *    menu items should be hilited and unhilited as the user moves
     *    through the menus. It is used by menu definition functions, which
     *    receive a pointer to an MDEFHiliteItemData structure as the
     *    whichItem parameter during kMenuHiliteItemMsg.
        }
    MDEFHiliteItemDataPtr = ^MDEFHiliteItemData;
    MDEFHiliteItemData = record
        previousItem:           MenuItemIndex;
        newItem:                MenuItemIndex;
        context:                Ptr;
    end;

    HiliteMenuItemData                  = MDEFHiliteItemData;
    HiliteMenuItemDataPtr               = ^HiliteMenuItemData;

    {
     *  MDEFDrawData
     *
     *  Summary:
     *    The MDEFDrawData structure contains information needed to draw a
     *    menu. It is used by menu definition functions, which receive a
     *    pointer to an MDEFDrawData structure as the whichItem parameter
     *    during kMenuDrawMsg.
        }
    MDEFDrawDataPtr = ^MDEFDrawData;
    MDEFDrawData = record
        trackingData:           MenuTrackingData;
        context:                Ptr;
    end;


    {
     *  MDEFFindItemData
     *
     *  Summary:
     *    The MDEFFindItemData structure contains information needed to
     *    determine which item is currently selected by the user. It is
     *    used by menu definition functions, which receive a pointer to an
     *    MDEFDrawData structure as the whichItem parameter during
     *    kMenuFindItemMsg.
        }
    MDEFFindItemDataPtr = ^MDEFFindItemData;
    MDEFFindItemData = record
        trackingData:           MenuTrackingData;
        context:                Ptr;
    end;


    {
     *  MDEFDrawItemsData
     *
     *  Summary:
     *    The MDEFDrawItemsData structure contains information about which
     *    menu items to redraw. It is used by menu definition functions,
     *    which receive a pointer to an MDEFDrawItemsData structure as the
     *    whichItem parameter during kMenuDrawItemsMsg.
        }
    MDEFDrawItemsDataPtr = ^MDEFDrawItemsData;
    MDEFDrawItemsData = record
        firstItem:              MenuItemIndex;
        lastItem:               MenuItemIndex;
        trackingData:           MenuTrackingDataPtr;
        context:                Ptr;
    end;


    {
     *  Summary:
     *    A MenuItemDataFlags value indicates which fields of a
     *    MenuItemDataRec structure should be used by the
     *    Copy/SetMenuItemData APIs. All MenuItemDataFlags may be used when
     *    getting or setting the contents of a menu item; some may also be
     *    used when getting or setting information about the menu itself,
     *    if the item index given to Copy/SetMenuItemData is 0.
        }

const
    kMenuItemDataText           = $01;
    kMenuItemDataMark           = $02;
    kMenuItemDataCmdKey         = $04;
    kMenuItemDataCmdKeyGlyph    = $08;
    kMenuItemDataCmdKeyModifiers = $10;
    kMenuItemDataStyle          = $20;
    kMenuItemDataEnabled        = $40;
    kMenuItemDataIconEnabled    = $80;
    kMenuItemDataIconID         = $0100;
    kMenuItemDataIconHandle     = $0200;
    kMenuItemDataCommandID      = $0400;
    kMenuItemDataTextEncoding   = $0800;
    kMenuItemDataSubmenuID      = $1000;
    kMenuItemDataSubmenuHandle  = $2000;
    kMenuItemDataFontID         = $4000;
    kMenuItemDataRefcon         = $8000;
    kMenuItemDataAttributes     = $00010000;
    kMenuItemDataCFString       = $00020000;
    kMenuItemDataProperties     = $00040000;
    kMenuItemDataIndent         = $00080000;
    kMenuItemDataCmdVirtualKey  = $00100000;
    kMenuItemDataAllDataVersionOne = $000FFFFF;
    kMenuItemDataAllDataVersionTwo = $001FFFFF;


type
    MenuItemDataFlags                   = UInt64;
    MenuItemDataFlagsPtr                = ^MenuItemDataFlags;

    {
     *  MenuItemDataRec
     *
     *  Summary:
     *    The MenuItemDataRec structure is used to get and change aspects
     *    of a menu item. It is used with the Copy/SetMenuItemData APIs.
     *
     *  Discussion:
     *    When using this structure with Copy/SetMenuItemData, the caller
     *    must first set the whichData field to a combination of
     *    MenuItemDataFlags indicating which specific data should be
     *    retrieved or set. Some fields also require initialization before
     *    calling CopyMenuItemData; see the individual MenuItemDataFlags
     *    documentation for details.
        }
    MenuItemDataRecPtr = ^MenuItemDataRec;
    MenuItemDataRec = record
        whichData:              MenuItemDataFlags;
        text:                   StringPtr;
        mark:                   UniChar;
        cmdKey:                 UniChar;
        cmdKeyGlyph:            UInt32;
        cmdKeyModifiers:        UInt32;
        style:                  SInt8;
        enabled:                boolean;
        iconEnabled:            boolean;
        filler1:                SInt8;
        iconID:                 SInt32;
        iconType:               UInt32;
        iconHandle:             Handle;
        cmdID:                  MenuCommand;
        encoding:               TextEncoding;
        submenuID:              MenuID;
        submenuHandle:          MenuRef;
        fontID:                 SInt32;
        refcon:                 UInt32;
        attr:                   OptionBits;
        cfText:                 CFStringRef;
        properties:             Collection;
        indent:                 UInt32;
        cmdVirtualKey:          UInt16;
    end;

    MenuItemDataPtr                     = ^MenuItemDataRec;
    MenuItemID                          = UInt32;
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {     ¥ Menu ProcPtrs                                                                       }
    {                                                                                           }
    {     All of these procs are considered deprecated.  Developers interested in portability   }
    {     to Carbon should avoid them entirely, if at all possible.                             }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    MenuDefProcPtr = procedure(message: SInt16; theMenu: MenuRef; var menuRect: Rect; hitPt: Point; var whichItem: SInt16);

    MenuDefUPP = ^SInt32; { an opaque UPP }

const
    uppMenuDefProcInfo = $0000FF80;
    {
     *  NewMenuDefUPP()
     *
     *  Availability:
     *    Non-Carbon CFM:   available as macro/inline
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function NewMenuDefUPP(userRoutine: MenuDefProcPtr): MenuDefUPP; external name '_NewMenuDefUPP'; { old name was NewMenuDefProc }
{
 *  DisposeMenuDefUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeMenuDefUPP(userUPP: MenuDefUPP); external name '_DisposeMenuDefUPP';
{
 *  InvokeMenuDefUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvokeMenuDefUPP(message: SInt16; theMenu: MenuRef; var menuRect: Rect; hitPt: Point; var whichItem: SInt16; userRoutine: MenuDefUPP); external name '_InvokeMenuDefUPP'; { old name was CallMenuDefProc }
type
    MenuBarDefProcPtr = function(selector: SInt16; message: SInt16; parameter1: SInt16; parameter2: SInt32): SInt32;

    MenuHookProcPtr = procedure;

    MBarHookProcPtr = function(var menuRect: Rect): SInt16;

    MenuBarDefUPP = ^SInt32; { an opaque UPP }
    MenuHookUPP = ^SInt32; { an opaque UPP }
    MBarHookUPP = ^SInt32; { an opaque UPP }

const
    uppMenuBarDefProcInfo = $00003AB0;
    uppMenuHookProcInfo = $00000000;
    uppMBarHookProcInfo = $000000CF;


const
    kMenuDefProcPtr             = 0;                            {  raw proc-ptr access based on old MDEF  }


type
    MenuDefType                         = UInt32;
    MenuDefSpecPtr = ^MenuDefSpec;
    MenuDefSpec = record
        defType:                MenuDefType;
        case SInt16 of
        0: (
            defProc:            MenuDefUPP;
            );
    end;

    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {     ¥ Menu Manager Initialization                                                         }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }

{
 *  NewMenu()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewMenu(menuID: MenuID; const (*var*) menuTitle: Str255): MenuRef; external name '_NewMenu';
{
 *  [Mac]GetMenu()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetMenu(resourceID: SInt16): MenuRef; external name '_GetMenu';
{
 *  DisposeMenu()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeMenu(theMenu: MenuRef); external name '_DisposeMenu';
{
 *  CalcMenuSize()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CalcMenuSize(theMenu: MenuRef); external name '_CalcMenuSize';

{
 *  CountMenuItems()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.3 and later or as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CountMenuItems(theMenu: MenuRef): UInt16; external name '_CountMenuItems';
{  Routines available in Mac OS 8.5 and later, and on Mac OS 8.1 and later using CarbonLib 1.1 and later }

{
 *  GetMenuFont()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MenusLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetMenuFont(menu: MenuRef; var outFontID: SInt16; var outFontSize: UInt16): OSStatus; external name '_GetMenuFont';

{
 *  SetMenuFont()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MenusLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetMenuFont(menu: MenuRef; inFontID: SInt16; inFontSize: UInt16): OSStatus; external name '_SetMenuFont';

{
 *  GetMenuExcludesMarkColumn()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MenusLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetMenuExcludesMarkColumn(menu: MenuRef): boolean; external name '_GetMenuExcludesMarkColumn';

{
 *  SetMenuExcludesMarkColumn()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MenusLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetMenuExcludesMarkColumn(menu: MenuRef; excludesMark: boolean): OSStatus; external name '_SetMenuExcludesMarkColumn';

{
 *  RegisterMenuDefinition()
 *
 *  Summary:
 *    Registers or unregisters a binding between a resource ID and a
 *    menu definition function.
 *
 *  Discussion:
 *    In the Mac OS 8.x Menu Manager, a 'MENU' resource can contain an
 *    embedded MDEF procID that is used by the Menu Manager as the
 *    resource ID of an 'MDEF' resource to measure and draw the menu.
 *    The 'MDEF' resource is loaded by the Menu Manager when you load
 *    the menu with GetMenu. Since MDEFs can no longer be packaged as
 *    code resources on Carbon, the procID can no longer refer directly
 *    to an MDEF resource. However, using RegisterMenuDefinition you
 *    can instead specify a UniversalProcPtr pointing to code in your
 *    application code fragment.
 *
 *  Parameters:
 *
 *    inResID:
 *      An MDEF proc ID, as used in a 'MENU' resource.
 *
 *    inDefSpec:
 *      Specifies the MenuDefUPP that should be used for menus with the
 *      given MDEF proc ID. Passing NULL allows you to unregister the
 *      menu definition that had been associated with the given MDEF
 *      proc ID.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function RegisterMenuDefinition(inResID: SInt16; inDefSpec: MenuDefSpecPtr): OSStatus; external name '_RegisterMenuDefinition';

{
 *  CreateNewMenu()
 *
 *  Summary:
 *    Creates a new, untitled, empty menu.
 *
 *  Discussion:
 *    CreateNewMenu is preferred over NewMenu because it allows you to
 *    specify the menu's attributes and it does not require you to
 *    specify a Str255-based menu title. To set the menu title, you can
 *    use either SetMenuTitle or SetMenuTitleWithCFString.
 *
 *  Parameters:
 *
 *    inMenuID:
 *      The menu ID to use for the new menu.
 *
 *    inMenuAttributes:
 *      The menu attributes to use for the new menu.
 *
 *    outMenuRef:
 *      On exit, contains the new menu.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CreateNewMenu(inMenuID: MenuID; inMenuAttributes: MenuAttributes; var outMenuRef: MenuRef): OSStatus; external name '_CreateNewMenu';

{
 *  CreateCustomMenu()
 *
 *  Summary:
 *    Creates a new, untitled, empty menu using a custom menu
 *    definition function.
 *
 *  Discussion:
 *    Similar to CreateNewMenu, but also allows you to specify a custom
 *    menu definition function.
 *
 *  Parameters:
 *
 *    inDefSpec:
 *      Specifies a custom menu definition function. defSpec->defType
 *      must be kMenuDefProcPtr.
 *
 *    inMenuID:
 *      The menu ID to use for the new menu.
 *
 *    inMenuAttributes:
 *      The menu attributes to use for the new menu.
 *
 *    outMenuRef:
 *      On exit, contains the new menu.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CreateCustomMenu(const (*var*) inDefSpec: MenuDefSpec; inMenuID: MenuID; inMenuAttributes: MenuAttributes; var outMenuRef: MenuRef): OSStatus; external name '_CreateCustomMenu';

{
 *  IsValidMenu()
 *
 *  Summary:
 *    Determines if a menu is valid.
 *
 *  Parameters:
 *
 *    inMenu:
 *      The menu to check for validity.
 *
 *  Result:
 *    Indicates whether the menu is valid.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function IsValidMenu(inMenu: MenuRef): boolean; external name '_IsValidMenu';

{
 *  GetMenuRetainCount()
 *
 *  Summary:
 *    Returns the retain count of this menu.
 *
 *  Parameters:
 *
 *    inMenu:
 *      The menu whose retain count to increment.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetMenuRetainCount(inMenu: MenuRef): ItemCount; external name '_GetMenuRetainCount';

{
 *  RetainMenu()
 *
 *  Summary:
 *    Increments the retain count of a menu.
 *
 *  Discussion:
 *    RetainMenu does not create a new menu. It simply adds one to the
 *    retain count. If called on a menu that was not created by
 *    CarbonLib, it will not affect the menu's retain count.
 *
 *  Parameters:
 *
 *    inMenu:
 *      The menu whose retain count to increment.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function RetainMenu(inMenu: MenuRef): OSStatus; external name '_RetainMenu';

{
 *  ReleaseMenu()
 *
 *  Summary:
 *    Decrements the retain count of a menu.
 *
 *  Discussion:
 *    If called on a menu that was not created by CarbonLib, it will
 *    not affect the menu's retain count.
 *
 *  Parameters:
 *
 *    inMenu:
 *      The menu whose retain count to decrement. If the retain count
 *      falls to zero, the menu is destroyed.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ReleaseMenu(inMenu: MenuRef): OSStatus; external name '_ReleaseMenu';

{
 *  DuplicateMenu()
 *
 *  Summary:
 *    Creates a new menu that is a copy of another menu.
 *
 *  Discussion:
 *    Unlike RetainMenu, DuplicateMenu creates an entirely new menu
 *    that is an exact copy of the original menu. The MDEF for the new
 *    menu will receive an init message after the menu has been fully
 *    created.
 *
 *  Parameters:
 *
 *    inSourceMenu:
 *      The menu to duplicate.
 *
 *    outMenu:
 *      On exit, a copy of the source menu.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DuplicateMenu(inSourceMenu: MenuRef; var outMenu: MenuRef): OSStatus; external name '_DuplicateMenu';

{
 *  CopyMenuTitleAsCFString()
 *
 *  Summary:
 *    Returns a CFString containing the title of a menu.
 *
 *  Parameters:
 *
 *    inMenu:
 *      The menu whose title to return.
 *
 *    outString:
 *      On exit, a CFString containing the menu's title. This string
 *      must be released by the caller.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CopyMenuTitleAsCFString(inMenu: MenuRef; var outString: CFStringRef): OSStatus; external name '_CopyMenuTitleAsCFString';

{
 *  SetMenuTitleWithCFString()
 *
 *  Summary:
 *    Sets the title of a menu to the text contained in a CFString.
 *
 *  Discussion:
 *    The Menu Manager will either make its own copy or just increment
 *    the refcount of the CFString before returning from
 *    SetMenuTitleWithCFString, depending on whether the string is
 *    mutable or immutable. If the string is mutable, modifying the
 *    string after calling SetMenuTitleWithCFString will have no effect
 *    on the menu's actual title. The caller may release the string
 *    after calling SetMenuTitleWithCFString.
 *
 *  Parameters:
 *
 *    inMenu:
 *      The menu whose title to set.
 *
 *    inString:
 *      The string containing the new menu title text.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetMenuTitleWithCFString(inMenu: MenuRef; inString: CFStringRef): OSStatus; external name '_SetMenuTitleWithCFString';

{
 *  SetMenuTitleIcon()
 *
 *  Summary:
 *    Sets the title of a menu to be an icon.
 *
 *  Discussion:
 *    The Menu Manager takes ownership of the supplied icon after this
 *    call. When a menu with an title icon is disposed, the Menu
 *    Manager will dispose the icon also; the Menu Manager will also
 *    dispose of the current title icon when a new text or icon title
 *    is supplied for a menu. If an IconRef is specified, the Menu
 *    Manager will increment its refcount, so you may freely release
 *    your reference to the IconRef without invalidating the Menu
 *    Manager's copy. The menubar will be invalidated by this call, and
 *    redrawn at the next opportunity.
 *
 *  Parameters:
 *
 *    inMenu:
 *      The menu whose title to set.
 *
 *    inType:
 *      The type of icon being used to specify the icon title; use
 *      kMenuNoIcon to remove the icon from the menu title. The
 *      supported types are kMenuIconSuiteType and kMenuIconRefType.
 *
 *    inIcon:
 *      The icon; must be NULL if inType is kMenuNoIcon. The supported
 *      icon formats are IconSuiteRef and IconRef.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetMenuTitleIcon(inMenu: MenuRef; inType: UInt32; inIcon: UnivPtr): OSStatus; external name '_SetMenuTitleIcon';

{
 *  GetMenuTitleIcon()
 *
 *  Summary:
 *    Retrieves the icon, if any, being used as the title of a menu.
 *
 *  Discussion:
 *    This API does not increment a refcount on the returned icon. The
 *    caller should not release the icon.
 *
 *  Parameters:
 *
 *    inMenu:
 *      The menu whose icon title to retrieve.
 *
 *    outType:
 *      On exit, contains the type of icon being used as the title of
 *      the menu. Contains kMenuNoIcon if the menu does not have an
 *      icon title.
 *
 *    outIcon:
 *      On exit, contains the IconSuiteRef or IconRef being used as the
 *      title of the menu, or NULL if the menu does not have an icon
 *      title. May be NULL.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetMenuTitleIcon(inMenu: MenuRef; outType: UInt32Ptr; outIcon: UnivPtr): OSStatus; external name '_GetMenuTitleIcon';

{
 *  InvalidateMenuSize()
 *
 *  Summary:
 *    Invalidates the menu size so that it will be recalculated when
 *    next displayed.
 *
 *  Discussion:
 *    The pre-Carbon technique for invalidating the menu size was to
 *    set the width and height to -1. Although this technique still
 *    works, for best compatibility it's preferable to use the
 *    InvalidateMenuSize API so that the Menu Manager has explicit
 *    notification that the menu is invalid.
 *
 *  Parameters:
 *
 *    inMenu:
 *      The menu whose size to invalidate.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvalidateMenuSize(inMenu: MenuRef): OSStatus; external name '_InvalidateMenuSize';

{
 *  IsMenuSizeInvalid()
 *
 *  Summary:
 *    Determines if a menu's size is invalid and should be recalculated.
 *
 *  Discussion:
 *    The pre-Carbon technique for determining if a menu's size is
 *    invalid was to check if the width or height was -1. This
 *    technique is not always reliable on Carbon due to implementation
 *    changes in the Menu Manager. You should now use IsMenuSizeInvalid
 *    instead.
 *
 *  Parameters:
 *
 *    inMenu:
 *      The menu whose size to examine.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function IsMenuSizeInvalid(inMenu: MenuRef): boolean; external name '_IsMenuSizeInvalid';

{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{  ¥ÊMDEF support                                                                      }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{
 *  EraseMenuBackground()
 *
 *  Summary:
 *    Erases a portion of a menu background in preparation for further
 *    drawing.
 *
 *  Discussion:
 *    It is necessary to erase the menu background before calling
 *    DrawThemeMenuBackground because some themes (such as Aqua on Mac
 *    OS X) draw the menu background using the alpha channel, and if
 *    the area underneath the menu background is not erased, portions
 *    of the old image will show through the menu background.
 *
 *  Parameters:
 *
 *    inMenu:
 *      The menu whose background to erase.
 *
 *    inEraseRect:
 *      The bounds of the area to erase, in local coordinates to the
 *      current port.
 *
 *    inContext:
 *      The CG context to erase. If NULL, EraseMenuBackground will
 *      create a context based on the current port.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.5 and later
 *    Mac OS X:         in version 10.1 and later
 }
function EraseMenuBackground(inMenu: MenuRef; const (*var*) inEraseRect: Rect; inContext: CGContextRef): OSStatus; external name '_EraseMenuBackground';

{
 *  ScrollMenuImage()
 *
 *  Summary:
 *    Scrolls a portion of the menu image.
 *
 *  Discussion:
 *    Menus on Mac OS X use an alpha channel, and QuickDraw does not
 *    support alpha channels. Therefore, scrolling a menu image with
 *    ScrollRect or other QuickDraw APIs does not work correctly; it
 *    results in the destruction of the alpha channel data. The
 *    ScrollMenuImage API uses CoreGraphics to move the menu image,
 *    preserving the alpha channel.
 *
 *  Parameters:
 *
 *    inMenu:
 *      The menu whose image to scroll.
 *
 *    inScrollRect:
 *      The bounds of the rect to scroll.
 *
 *    inHScroll:
 *      The distance to scroll horizontally.
 *
 *    inVScroll:
 *      The distance to scroll vertically.
 *
 *    inContext:
 *      The CG context to erase. If NULL, ScrollMenuImage will create a
 *      context based on the current port.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.5 and later
 *    Mac OS X:         in version 10.1 and later
 }
function ScrollMenuImage(inMenu: MenuRef; const (*var*) inScrollRect: Rect; inHScroll: SInt32; inVScroll: SInt32; inContext: CGContextRef): OSStatus; external name '_ScrollMenuImage';

{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{  ¥ Menu Item Insertion                                                               }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{
 *  [Mac]AppendMenu()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure AppendMenu(menu: MenuRef; const (*var*) data: Str255); external name '_AppendMenu';
{
 *  InsertResMenu()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InsertResMenu(theMenu: MenuRef; theType: ResType; afterItem: SInt16); external name '_InsertResMenu';
{
 *  AppendResMenu()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure AppendResMenu(theMenu: MenuRef; theType: ResType); external name '_AppendResMenu';
{
 *  [Mac]InsertMenuItem()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InsertMenuItem(theMenu: MenuRef; const (*var*) itemString: Str255; afterItem: SInt16); external name '_InsertMenuItem';
{
 *  DeleteMenuItem()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DeleteMenuItem(theMenu: MenuRef; item: SInt16); external name '_DeleteMenuItem';
{
 *  InsertFontResMenu()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InsertFontResMenu(theMenu: MenuRef; afterItem: SInt16; scriptFilter: SInt16); external name '_InsertFontResMenu';
{
 *  InsertIntlResMenu()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InsertIntlResMenu(theMenu: MenuRef; theType: ResType; afterItem: SInt16; scriptFilter: SInt16); external name '_InsertIntlResMenu';
{
 *  AppendMenuItemText()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MenusLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function AppendMenuItemText(menu: MenuRef; const (*var*) inString: Str255): OSStatus; external name '_AppendMenuItemText';

{
 *  InsertMenuItemText()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MenusLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InsertMenuItemText(menu: MenuRef; const (*var*) inString: Str255; afterItem: MenuItemIndex): OSStatus; external name '_InsertMenuItemText';

{
 *  CopyMenuItems()
 *
 *  Summary:
 *    Copies menu items from one menu to another.
 *
 *  Parameters:
 *
 *    inSourceMenu:
 *      The menu from which to copy items.
 *
 *    inFirstItem:
 *      The first item to copy.
 *
 *    inNumItems:
 *      The number of items to copy.
 *
 *    inDestMenu:
 *      The menu to which to copy items.
 *
 *    inInsertAfter:
 *      The menu item in the destination menu after which to insert the
 *      copied items.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CopyMenuItems(inSourceMenu: MenuRef; inFirstItem: MenuItemIndex; inNumItems: ItemCount; inDestMenu: MenuRef; inInsertAfter: MenuItemIndex): OSStatus; external name '_CopyMenuItems';

{
 *  DeleteMenuItems()
 *
 *  Summary:
 *    Deletes multiple menu items.
 *
 *  Discussion:
 *    This API is more efficient than calling DeleteMenuItem multiple
 *    times.
 *
 *  Parameters:
 *
 *    inMenu:
 *      The menu from which to delete items.
 *
 *    inFirstItem:
 *      The first item to delete.
 *
 *    inNumItems:
 *      The number of items to delete.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DeleteMenuItems(inMenu: MenuRef; inFirstItem: MenuItemIndex; inNumItems: ItemCount): OSStatus; external name '_DeleteMenuItems';

{
 *  AppendMenuItemTextWithCFString()
 *
 *  Summary:
 *    Appends a new menu item with text from a CFString.
 *
 *  Discussion:
 *    The Menu Manager will either make its own copy or just increment
 *    the refcount of the CFString before returning from
 *    AppendMenuItemWithTextCFString, depending on whether the string
 *    is mutable or immutable. If the string is mutable, modifying the
 *    string after calling AppendMenuItemTextWithCFString will have no
 *    effect on the menu item's actual text. The caller may release the
 *    string after calling AppendMenuItemTextWithCFString.
 *
 *  Parameters:
 *
 *    inMenu:
 *      The menu to which to append the new item.
 *
 *    inString:
 *      The text of the new item.
 *
 *    inAttributes:
 *      The attributes of the new item.
 *
 *    inCommandID:
 *      The command ID of the new item.
 *
 *    outNewItem:
 *      On exit, the index of the new item. May be NULL if the caller
 *      does not need this information.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function AppendMenuItemTextWithCFString(inMenu: MenuRef; inString: CFStringRef; inAttributes: MenuItemAttributes; inCommandID: MenuCommand; outNewItem: MenuItemIndexPtr): OSStatus; external name '_AppendMenuItemTextWithCFString';

{
 *  InsertMenuItemTextWithCFString()
 *
 *  Summary:
 *    Inserts a new menu item with text from a CFString.
 *
 *  Discussion:
 *    The Menu Manager will either make its own copy or just increment
 *    the refcount of the CFString before returning from
 *    InsertMenuItemWithCFString, depending on whether the string is
 *    mutable or immutable. If the string is mutable, modifying the
 *    string after calling InsertMenuItemWithCFString will have no
 *    effect on the menu item's actual text. The caller may release the
 *    string after calling InsertMenuItemWithCFString.
 *
 *  Parameters:
 *
 *    inMenu:
 *      The menu in which to insert the new item.
 *
 *    inString:
 *      The text of the new item.
 *
 *    inAfterItem:
 *      The item after which to insert the new item.
 *
 *    inAttributes:
 *      The attributes of the new item.
 *
 *    inCommandID:
 *      The command ID of the new item.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InsertMenuItemTextWithCFString(inMenu: MenuRef; inString: CFStringRef; inAfterItem: MenuItemIndex; inAttributes: MenuItemAttributes; inCommandID: MenuCommand): OSStatus; external name '_InsertMenuItemTextWithCFString';

{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{  ¥ Menu Events                                                                       }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{
 *  MenuKey()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function MenuKey(ch: CharParameter): SInt32; external name '_MenuKey';
{
 *  MenuSelect()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function MenuSelect(startPt: Point): SInt32; external name '_MenuSelect';
{
 *  PopUpMenuSelect()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PopUpMenuSelect(menu: MenuRef; top: SInt16; left: SInt16; popUpItem: SInt16): SInt32; external name '_PopUpMenuSelect';
{
 *  MenuChoice()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function MenuChoice: SInt32; external name '_MenuChoice';
{
 *  MenuEvent()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function MenuEvent(const (*var*) inEvent: EventRecord): UInt32; external name '_MenuEvent';
{
 *  IsMenuKeyEvent()
 *
 *  Summary:
 *    Determines if an event corresponds to a menu command key.
 *
 *  Discussion:
 *    By default, IsMenuKeyEvent searches the menus in the current menu
 *    bar and hilites the menu title of the menu containing the
 *    selected item.
 *
 *  Parameters:
 *
 *    inStartMenu:
 *      IsMenuKeyEvent searches for matching menu items in this menu
 *      and all of its submenus. May be NULL to search the current menu
 *      bar contents.
 *
 *    inEvent:
 *      The event to match against. Non-keyboard events are ignored.
 *
 *    inOptions:
 *      Options controlling how to search. Pass kNilOptions for the
 *      default behavior.
 *
 *    outMenu:
 *      On exit, the menu containing the matching item. May be NULL.
 *
 *    outMenuItem:
 *      On exit, the menu item that matched. May be NULL.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function IsMenuKeyEvent(inStartMenu: MenuRef; inEvent: EventRef; inOptions: MenuEventOptions; outMenu: MenuRefPtr; outMenuItem: MenuItemIndexPtr): boolean; external name '_IsMenuKeyEvent';

{
 *  InvalidateMenuEnabling()
 *
 *  Summary:
 *    Causes the menu enable state to be recalculated at the next
 *    convenient opportunity.
 *
 *  Discussion:
 *    It is common for state changes in an application (for example,
 *    selection of text) to cause a change in the enabling of items in
 *    the application's menu (for example, the Copy menu item might
 *    become enabled). In a Carbon-event-savvy application, menu items
 *    are enabled or disabled in response to an
 *    kEventCommandUpdateStatus event; however, this event is normally
 *    only sent before a command key press or a click in the menubar.
 *    You can request an explicit recalculation of a menu's enable
 *    state with the InvalidateMenuEnabling API. The Carbon Event
 *    Manager will automatically invalidate the enable state of all
 *    top-level menus when a user event is dispatched, the user focus
 *    changes, or the active window changes, so in many cases you will
 *    not need to explicitly invalidate the menu enabling state.
 *
 *  Parameters:
 *
 *    inMenu:
 *      A menu to re-enable, or NULL if all menus in the root menu
 *      should be re-enabled.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvalidateMenuEnabling(inMenu: MenuRef): OSStatus; external name '_InvalidateMenuEnabling';


{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{  ¥ Menu Bar                                                                          }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{
 *  GetMBarHeight()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetMBarHeight: SInt16; external name '_GetMBarHeight';
{
 *  [Mac]DrawMenuBar()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DrawMenuBar; external name '_DrawMenuBar';
{
 *  InvalMenuBar()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvalMenuBar; external name '_InvalMenuBar';
{
 *  IsMenuBarInvalid()
 *
 *  Summary:
 *    Determines if the menubar is invalid and should be redrawn.
 *
 *  Parameters:
 *
 *    rootMenu:
 *      The root menu for the menubar to be examined. Pass NULL to
 *      check the state of the current menubar.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function IsMenuBarInvalid(rootMenu: MenuRef): boolean; external name '_IsMenuBarInvalid';

{
 *  HiliteMenu()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure HiliteMenu(menuID: MenuID); external name '_HiliteMenu';
{
 *  GetNewMBar()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetNewMBar(menuBarID: SInt16): MenuBarHandle; external name '_GetNewMBar';
{
 *  GetMenuBar()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetMenuBar: MenuBarHandle; external name '_GetMenuBar';
{
 *  SetMenuBar()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetMenuBar(mbar: MenuBarHandle); external name '_SetMenuBar';
{
 *  DuplicateMenuBar()
 *
 *  Summary:
 *    Duplicates a menubar handle.
 *
 *  Discussion:
 *    This API should be used in Carbon applications when duplicating a
 *    handle returned from GetMenuBar or GetNewMBar. You should not use
 *    Memory Manager APIs (HandToHand, NewHandle, etc) to duplicate
 *    such a handle. This is necessary in Carbon so that the refcounts
 *    of the menus in the menubar handle can be incremented when the
 *    handle is duplicated.
 *
 *  Parameters:
 *
 *    inMbar:
 *      The menubar handle to duplicate.
 *
 *    outMbar:
 *      On exit, contains the new menubar handle.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DuplicateMenuBar(inMbar: MenuBarHandle; var outMbar: MenuBarHandle): OSStatus; external name '_DuplicateMenuBar';

{
 *  DisposeMenuBar()
 *
 *  Summary:
 *    Releases a menubar handle.
 *
 *  Discussion:
 *    This API should be used in Carbon applications when releasing a
 *    handle returned from GetMenuBar or GetNewMBar. You should not use
 *    DisposeHandle to release such a handle. This is necessary in
 *    Carbon so that the refcounts of the menus in the menubar handle
 *    can be decremented when the handle is released.
 *
 *  Parameters:
 *
 *    inMbar:
 *      The menubar handle to release.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DisposeMenuBar(inMbar: MenuBarHandle): OSStatus; external name '_DisposeMenuBar';

{
 *  GetMenuHandle()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetMenuHandle(menuID: MenuID): MenuRef; external name '_GetMenuHandle';
{
 *  [Mac]InsertMenu()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InsertMenu(theMenu: MenuRef; beforeID: MenuID); external name '_InsertMenu';
{
 *  [Mac]DeleteMenu()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DeleteMenu(menuID: MenuID); external name '_DeleteMenu';
{
 *  ClearMenuBar()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure ClearMenuBar; external name '_ClearMenuBar';

{
 *  SetMenuFlashCount()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.3 and later or as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetMenuFlashCount(count: SInt16); external name '_SetMenuFlashCount';
{
 *  FlashMenuBar()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure FlashMenuBar(menuID: MenuID); external name '_FlashMenuBar';
{  These are obsolete because Carbon does not support desk accessories. }

{
 *  IsMenuBarVisible()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MenusLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function IsMenuBarVisible: boolean; external name '_IsMenuBarVisible';

{
 *  ShowMenuBar()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MenusLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure ShowMenuBar; external name '_ShowMenuBar';

{
 *  HideMenuBar()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MenusLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure HideMenuBar; external name '_HideMenuBar';

{
 *  AcquireRootMenu()
 *
 *  Summary:
 *    Get the menu whose contents are displayed in the menubar.
 *
 *  Discussion:
 *    The refcount of the root menu is incremented by this API. The
 *    caller should release a refcount with ReleaseMenu when itÕs done
 *    with the menu.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function AcquireRootMenu: MenuRef; external name '_AcquireRootMenu';

{
 *  SetRootMenu()
 *
 *  Summary:
 *    Sets the menu whose contents are displayed in the menubar.
 *
 *  Discussion:
 *    The refcount of the root menu is incremented by this API. The
 *    caller may release the menu after calling SetRootMenu.
 *
 *  Parameters:
 *
 *    inMenu:
 *      The new root menu.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetRootMenu(inMenu: MenuRef): OSStatus; external name '_SetRootMenu';

{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{  ¥ Menu Item Accessors                                                               }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}

{
 *  [Mac]CheckMenuItem()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.3 and later or as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CheckMenuItem(theMenu: MenuRef; item: SInt16; checked: boolean); external name '_CheckMenuItem';
{
 *  SetMenuItemText()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetMenuItemText(theMenu: MenuRef; item: SInt16; const (*var*) itemString: Str255); external name '_SetMenuItemText';
{
 *  GetMenuItemText()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure GetMenuItemText(theMenu: MenuRef; item: SInt16; var itemString: Str255); external name '_GetMenuItemText';
{
 *  SetItemMark()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetItemMark(theMenu: MenuRef; item: SInt16; markChar: CharParameter); external name '_SetItemMark';
{
 *  GetItemMark()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure GetItemMark(theMenu: MenuRef; item: SInt16; var markChar: CharParameter); external name '_GetItemMark';
{
 *  SetItemCmd()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetItemCmd(theMenu: MenuRef; item: SInt16; cmdChar: CharParameter); external name '_SetItemCmd';
{
 *  GetItemCmd()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure GetItemCmd(theMenu: MenuRef; item: SInt16; var cmdChar: CharParameter); external name '_GetItemCmd';
{
 *  SetItemIcon()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetItemIcon(theMenu: MenuRef; item: SInt16; iconIndex: SInt16); external name '_SetItemIcon';

{
 *  SetItemStyle()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetItemStyle(theMenu: MenuRef; item: SInt16; chStyle: StyleParameter); external name '_SetItemStyle';
{
 *  GetItemStyle()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure GetItemStyle(theMenu: MenuRef; item: SInt16; var chStyle: Style); external name '_GetItemStyle';

{ These APIs are not supported in Carbon. Please use EnableMenuItem and }
{ DisableMenuItem (available back through Mac OS 8.5) instead.          }

{
 *  SetMenuItemCommandID()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetMenuItemCommandID(inMenu: MenuRef; inItem: SInt16; inCommandID: MenuCommand): OSErr; external name '_SetMenuItemCommandID';
{
 *  GetMenuItemCommandID()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetMenuItemCommandID(inMenu: MenuRef; inItem: SInt16; var outCommandID: MenuCommand): OSErr; external name '_GetMenuItemCommandID';
{
 *  SetMenuItemModifiers()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetMenuItemModifiers(inMenu: MenuRef; inItem: SInt16; inModifiers: ByteParameter): OSErr; external name '_SetMenuItemModifiers';
{
 *  GetMenuItemModifiers()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetMenuItemModifiers(inMenu: MenuRef; inItem: SInt16; var outModifiers: UInt8): OSErr; external name '_GetMenuItemModifiers';
{
 *  SetMenuItemIconHandle()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetMenuItemIconHandle(inMenu: MenuRef; inItem: SInt16; inIconType: ByteParameter; inIconHandle: Handle): OSErr; external name '_SetMenuItemIconHandle';
{
 *  GetMenuItemIconHandle()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetMenuItemIconHandle(inMenu: MenuRef; inItem: SInt16; var outIconType: UInt8; var outIconHandle: Handle): OSErr; external name '_GetMenuItemIconHandle';
{
 *  SetMenuItemTextEncoding()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetMenuItemTextEncoding(inMenu: MenuRef; inItem: SInt16; inScriptID: TextEncoding): OSErr; external name '_SetMenuItemTextEncoding';
{
 *  GetMenuItemTextEncoding()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetMenuItemTextEncoding(inMenu: MenuRef; inItem: SInt16; var outScriptID: TextEncoding): OSErr; external name '_GetMenuItemTextEncoding';
{
 *  SetMenuItemHierarchicalID()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetMenuItemHierarchicalID(inMenu: MenuRef; inItem: SInt16; inHierID: MenuID): OSErr; external name '_SetMenuItemHierarchicalID';
{
 *  GetMenuItemHierarchicalID()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetMenuItemHierarchicalID(inMenu: MenuRef; inItem: SInt16; var outHierID: MenuID): OSErr; external name '_GetMenuItemHierarchicalID';
{
 *  SetMenuItemFontID()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetMenuItemFontID(inMenu: MenuRef; inItem: SInt16; inFontID: SInt16): OSErr; external name '_SetMenuItemFontID';
{
 *  GetMenuItemFontID()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetMenuItemFontID(inMenu: MenuRef; inItem: SInt16; var outFontID: SInt16): OSErr; external name '_GetMenuItemFontID';
{
 *  SetMenuItemRefCon()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetMenuItemRefCon(inMenu: MenuRef; inItem: SInt16; inRefCon: UInt32): OSErr; external name '_SetMenuItemRefCon';
{
 *  GetMenuItemRefCon()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetMenuItemRefCon(inMenu: MenuRef; inItem: SInt16; var outRefCon: UInt32): OSErr; external name '_GetMenuItemRefCon';
{  Please use the menu item property APIs in Carbon. }

{
 *  SetMenuItemKeyGlyph()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetMenuItemKeyGlyph(inMenu: MenuRef; inItem: SInt16; inGlyph: SInt16): OSErr; external name '_SetMenuItemKeyGlyph';
{
 *  GetMenuItemKeyGlyph()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetMenuItemKeyGlyph(inMenu: MenuRef; inItem: SInt16; var outGlyph: SInt16): OSErr; external name '_GetMenuItemKeyGlyph';
{  Routines available in Mac OS 8.5 and later (supporting enabling/disabling of > 31 items) }

{
 *  [Mac]EnableMenuItem()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MenusLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure EnableMenuItem(theMenu: MenuRef; item: MenuItemIndex); external name '_EnableMenuItem';

{
 *  DisableMenuItem()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MenusLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisableMenuItem(theMenu: MenuRef; item: MenuItemIndex); external name '_DisableMenuItem';

{
 *  IsMenuItemEnabled()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MenusLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function IsMenuItemEnabled(menu: MenuRef; item: MenuItemIndex): boolean; external name '_IsMenuItemEnabled';

{
 *  EnableMenuItemIcon()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MenusLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure EnableMenuItemIcon(theMenu: MenuRef; item: MenuItemIndex); external name '_EnableMenuItemIcon';
{
 *  DisableMenuItemIcon()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MenusLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisableMenuItemIcon(theMenu: MenuRef; item: MenuItemIndex); external name '_DisableMenuItemIcon';
{
 *  IsMenuItemIconEnabled()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MenusLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function IsMenuItemIconEnabled(menu: MenuRef; item: MenuItemIndex): boolean; external name '_IsMenuItemIconEnabled';
{
 *  SetMenuItemHierarchicalMenu()
 *
 *  Summary:
 *    Attaches a submenu to a menu item.
 *
 *  Discussion:
 *    Using SetMenuItemHierarchicalMenu, it is possible to directly
 *    specify the submenu for a menu item without specifying its menu
 *    ID. It is not necessary to insert the submenu into the
 *    hierarchical portion of the menubar, and it is not necessary for
 *    the submenu to have a unique menu ID; it is recommended that you
 *    use 0 as the menu ID for the submenu, and identify selections
 *    from the menu by command ID. The Menu Manager will increment the
 *    refcount of the submenu that you specify, and the submenu's
 *    refcount will be decremented automatically when the parent menu
 *    item is deleted or the parent menu is disposed.
 *
 *  Parameters:
 *
 *    inMenu:
 *      The parent menu.
 *
 *    inItem:
 *      The parent item.
 *
 *    inHierMenu:
 *      The submenu. You may pass NULL to remove any existing submenu.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetMenuItemHierarchicalMenu(inMenu: MenuRef; inItem: MenuItemIndex; inHierMenu: MenuRef): OSStatus; external name '_SetMenuItemHierarchicalMenu';

{
 *  GetMenuItemHierarchicalMenu()
 *
 *  Summary:
 *    Returns the submenu attached to a menu item.
 *
 *  Discussion:
 *    GetMenuItemHierarchicalMenu will return the submenu attached to a
 *    menu item regardless of how the submenu was specified. If the
 *    submenu was specified by menu ID (using SetItemCmd or
 *    SetMenuItemHierarchicalID), GetMenuItemHierarchicalMenu will
 *    return the currently installed menu with that ID, if any. The
 *    only case where GetMenuItemHierarchicalMenu will fail to return
 *    the item's submenu is when the submenu is specified by menu ID,
 *    but the submenu is not currently inserted in the menu bar.
 *
 *  Parameters:
 *
 *    inMenu:
 *      The parent menu.
 *
 *    inItem:
 *      The parent item.
 *
 *    outHierMenu:
 *      On exit, the item's submenu, or NULL if it does not have one.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetMenuItemHierarchicalMenu(inMenu: MenuRef; inItem: MenuItemIndex; var outHierMenu: MenuRef): OSStatus; external name '_GetMenuItemHierarchicalMenu';

{
 *  CopyMenuItemTextAsCFString()
 *
 *  Summary:
 *    Returns a CFString containing the text of a menu item.
 *
 *  Parameters:
 *
 *    inMenu:
 *      The menu containing the item.
 *
 *    inItem:
 *      The item whose text to return.
 *
 *    outString:
 *      On exit, a CFString containing the item's text. This string
 *      must be released by the caller.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CopyMenuItemTextAsCFString(inMenu: MenuRef; inItem: MenuItemIndex; var outString: CFStringRef): OSStatus; external name '_CopyMenuItemTextAsCFString';

{
 *  SetMenuItemTextWithCFString()
 *
 *  Summary:
 *    Sets the text of a menu item to the text contained in a CFString.
 *
 *  Discussion:
 *    The Menu Manager will either make its own copy or just increment
 *    the refcount of the CFString before returning from
 *    SetMenuItemTextWithCFString, depending on whether the string is
 *    mutable or immutable. If the string is mutable, modifying the
 *    string after calling SetMenuItemTextWithCFString will have no
 *    effect on the menu item's actual text. The caller may release the
 *    string after calling SetMenuItemTextWithCFString.
 *
 *  Parameters:
 *
 *    inMenu:
 *      The menu containing the item.
 *
 *    inItem:
 *      The item whose text to return.
 *
 *    inString:
 *      The string containing the new menu item text.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetMenuItemTextWithCFString(inMenu: MenuRef; inItem: MenuItemIndex; inString: CFStringRef): OSStatus; external name '_SetMenuItemTextWithCFString';

{
 *  GetMenuItemIndent()
 *
 *  Summary:
 *    Gets the indent level of a menu item.
 *
 *  Discussion:
 *    The indent level of an item is an amount of extra space added to
 *    the left of the item's icon or checkmark. The level is simply a
 *    number, starting at zero, which the Menu Manager multiplies by a
 *    constant to get the indent in pixels. The default indent level is
 *    zero.
 *
 *  Parameters:
 *
 *    inMenu:
 *      The menu containing the item.
 *
 *    inItem:
 *      The item whose indent to retrieve.
 *
 *    outIndent:
 *      On exit, the indent level of the item.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetMenuItemIndent(inMenu: MenuRef; inItem: MenuItemIndex; var outIndent: UInt32): OSStatus; external name '_GetMenuItemIndent';

{
 *  SetMenuItemIndent()
 *
 *  Summary:
 *    Sets the indent level of a menu item.
 *
 *  Discussion:
 *    The indent level of an item is an amount of extra space added to
 *    the left of the item's icon or checkmark. The level is simply a
 *    number, starting at zero, which the Menu Manager multiplies by a
 *    constant to get the indent in pixels. The default indent level is
 *    zero.
 *
 *  Parameters:
 *
 *    inMenu:
 *      The menu containing the item.
 *
 *    inItem:
 *      The item whose indent to set.
 *
 *    inIndent:
 *      The new indent level of the item.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetMenuItemIndent(inMenu: MenuRef; inItem: MenuItemIndex; inIndent: UInt32): OSStatus; external name '_SetMenuItemIndent';

{
 *  GetMenuItemCommandKey()
 *
 *  Summary:
 *    Gets the keyboard equivalent of a menu item.
 *
 *  Discussion:
 *    A menu item's keyboard equivalent may be either a character code
 *    or a virtual keycode. An item's character code and virtual
 *    keycode are stored separately and may contain different values,
 *    but only one is used by the Menu Manager at any given time. When
 *    requesting a menu item's virtual keycode equivalent, you should
 *    first check that the item is using a virtual keycode by testing
 *    the kMenuItemAttrUseVirtualKey attribute for that item. If this
 *    attribute is not set, the item's virtual keycode is ignored by
 *    the Menu Manager. Note that zero is a valid virtual keycode, so
 *    you cannot test the returned keycode against zero to determine if
 *    the item is using a virtual keycode equivalent. You must test the
 *    kMenuItemAttrUseVirtualKey attribute.
 *
 *  Parameters:
 *
 *    inMenu:
 *      The menu containing the item.
 *
 *    inItem:
 *      The item whose keyboard equivalent to retrieve.
 *
 *    inGetVirtualKey:
 *      Indicates whether to retrieve the item's character code or
 *      virtual keycode equivalent.
 *
 *    outKey:
 *      On exit, the keyboard equivalent of the item.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetMenuItemCommandKey(inMenu: MenuRef; inItem: MenuItemIndex; inGetVirtualKey: boolean; var outKey: UInt16): OSStatus; external name '_GetMenuItemCommandKey';

{
 *  SetMenuItemCommandKey()
 *
 *  Summary:
 *    Sets the keyboard equivalent of a menu item.
 *
 *  Discussion:
 *    A menu item's keyboard equivalent may be either a character code
 *    or a virtual keycode. The character code is always used to draw
 *    the item's keyboard equivalent in the menu, but either may be
 *    used for keyboard equivalent matching by MenuEvent and
 *    IsMenuKeyEvent, depending on whether the
 *    kMenuItemAttrUseVirtualKey item attribute is set. If
 *    SetMenuItemCommandKey is used to set the virtual keycode
 *    equivalent for a menu item, it also automatically sets the
 *    kMenuItemAttrUseVirtualKey item attribute. To make the menu item
 *    stop using the virtual keycode equivalent and use the character
 *    code equivalent instead, use ChangeMenuItemAttributes to clear
 *    the kMenuItemAttrUseVirtualKey item attribute.
 *
 *  Parameters:
 *
 *    inMenu:
 *      The menu containing the item.
 *
 *    inItem:
 *      The item whose keyboard equivalent to set.
 *
 *    inSetVirtualKey:
 *      Indicates whether to set the item's character code or virtual
 *      keycode equivalent.
 *
 *    inKey:
 *      The item's new character code or virtual keycode equivalent.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetMenuItemCommandKey(inMenu: MenuRef; inItem: MenuItemIndex; inSetVirtualKey: boolean; inKey: UInt16): OSStatus; external name '_SetMenuItemCommandKey';

{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{  ¥ Menu Item Color Tables                                                            }
{                                                                                      }
{  Menu color manipulation is considered deprecated with the advent of the Appearance  }
{  Manager.  Avoid using these routines if possible                                    }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{
 *  DeleteMCEntries()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DeleteMCEntries(menuID: MenuID; menuItem: SInt16); external name '_DeleteMCEntries';
{
 *  GetMCInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetMCInfo: MCTableHandle; external name '_GetMCInfo';
{
 *  SetMCInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetMCInfo(menuCTbl: MCTableHandle); external name '_SetMCInfo';
{
 *  DisposeMCInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeMCInfo(menuCTbl: MCTableHandle); external name '_DisposeMCInfo';
{
 *  GetMCEntry()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetMCEntry(menuID: MenuID; menuItem: SInt16): MCEntryPtr; external name '_GetMCEntry';
{
 *  SetMCEntries()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetMCEntries(numEntries: SInt16; menuCEntries: MCTablePtr); external name '_SetMCEntries';
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{ ¥ Properties  (Mac OS 8.5 and later)                                                 }
{                                                                                      }
{ With the following property APIs, you can attach any piece of data you'd like to a   }
{ menu or menu item. Passing zero for the item number parameter indicates you'd like   }
{ to attach the data to the menu itself, and not to any specific menu item.            }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}

const
    kMenuPropertyPersistent     = $00000001;                    {  whether this property gets saved when flattening the menu }

    {
     *  GetMenuItemProperty()
     *
     *  Availability:
     *    Non-Carbon CFM:   in MenusLib 8.5 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function GetMenuItemProperty(menu: MenuRef; item: MenuItemIndex; propertyCreator: OSType; propertyTag: OSType; bufferSize: UInt32; var actualSize: UInt32; propertyBuffer: UnivPtr): OSStatus; external name '_GetMenuItemProperty';

{
 *  GetMenuItemPropertySize()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MenusLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetMenuItemPropertySize(menu: MenuRef; item: MenuItemIndex; propertyCreator: OSType; propertyTag: OSType; var size: UInt32): OSStatus; external name '_GetMenuItemPropertySize';

{
 *  SetMenuItemProperty()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MenusLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetMenuItemProperty(menu: MenuRef; item: MenuItemIndex; propertyCreator: OSType; propertyTag: OSType; propertySize: UInt32; propertyData: UnivPtr): OSStatus; external name '_SetMenuItemProperty';

{
 *  RemoveMenuItemProperty()
 *
 *  Availability:
 *    Non-Carbon CFM:   in MenusLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function RemoveMenuItemProperty(menu: MenuRef; item: MenuItemIndex; propertyCreator: OSType; propertyTag: OSType): OSStatus; external name '_RemoveMenuItemProperty';

{
 *  GetMenuItemPropertyAttributes()
 *
 *  Summary:
 *    Gets the attributes of a menu item property.
 *
 *  Parameters:
 *
 *    menu:
 *      The menu.
 *
 *    item:
 *      The menu item.
 *
 *    propertyCreator:
 *      The creator code of the property.
 *
 *    propertyTag:
 *      The property tag.
 *
 *    attributes:
 *      On exit, contains the attributes of the property.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetMenuItemPropertyAttributes(menu: MenuRef; item: MenuItemIndex; propertyCreator: OSType; propertyTag: OSType; var attributes: UInt32): OSStatus; external name '_GetMenuItemPropertyAttributes';

{
 *  ChangeMenuItemPropertyAttributes()
 *
 *  Summary:
 *    Changes the attributes of a menu item property.
 *
 *  Parameters:
 *
 *    menu:
 *      The menu.
 *
 *    item:
 *      The menu item.
 *
 *    propertyCreator:
 *      The creator code of the property.
 *
 *    propertyTag:
 *      The property tag.
 *
 *    attributesToSet:
 *      The attributes to add to the menu item property.
 *
 *    attributesToClear:
 *      The attributes to remove from the menu item property.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ChangeMenuItemPropertyAttributes(menu: MenuRef; item: MenuItemIndex; propertyCreator: OSType; propertyTag: OSType; attributesToSet: UInt32; attributesToClear: UInt32): OSStatus; external name '_ChangeMenuItemPropertyAttributes';

{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{  ¥ Attributes (Carbon and later)                                                     }
{                                                                                      }
{  Each menu and menu item has attribute flags.                                        }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{
 *  GetMenuAttributes()
 *
 *  Summary:
 *    Gets the attributes of a menu.
 *
 *  Parameters:
 *
 *    menu:
 *      The menu.
 *
 *    outAttributes:
 *      On exit, contains the attributes of the menu.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetMenuAttributes(menu: MenuRef; var outAttributes: MenuAttributes): OSStatus; external name '_GetMenuAttributes';

{
 *  ChangeMenuAttributes()
 *
 *  Summary:
 *    Changes the attributes of a menu.
 *
 *  Parameters:
 *
 *    menu:
 *      The menu.
 *
 *    setTheseAttributes:
 *      The attributes to add to the menu.
 *
 *    clearTheseAttributes:
 *      The attributes to remove from the menu.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ChangeMenuAttributes(menu: MenuRef; setTheseAttributes: MenuAttributes; clearTheseAttributes: MenuAttributes): OSStatus; external name '_ChangeMenuAttributes';

{
 *  GetMenuItemAttributes()
 *
 *  Summary:
 *    Gets the attributes of a menu item.
 *
 *  Parameters:
 *
 *    menu:
 *      The menu.
 *
 *    item:
 *      The menu item.
 *
 *    outAttributes:
 *      On exit, contains the attributes of the menu item.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetMenuItemAttributes(menu: MenuRef; item: MenuItemIndex; var outAttributes: MenuItemAttributes): OSStatus; external name '_GetMenuItemAttributes';

{
 *  ChangeMenuItemAttributes()
 *
 *  Summary:
 *    Changes the attributes of a menu item.
 *
 *  Parameters:
 *
 *    menu:
 *      The menu.
 *
 *    item:
 *      The menu item.
 *
 *    setTheseAttributes:
 *      The attributes to add to the menu item.
 *
 *    clearTheseAttributes:
 *      The attributes to remove from the menu item.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ChangeMenuItemAttributes(menu: MenuRef; item: MenuItemIndex; setTheseAttributes: MenuItemAttributes; clearTheseAttributes: MenuItemAttributes): OSStatus; external name '_ChangeMenuItemAttributes';

{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{  ¥ Mass menu item enabling and disabling (Carbon and later)                          }
{                                                                                      }
{  Useful when rewriting code that modifies the enableFlags field directly.            }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{
 *  DisableAllMenuItems()
 *
 *  Summary:
 *    Disables all items in a menu.
 *
 *  Discussion:
 *    This API is equivalent to pre-Carbon code that masked the
 *    enableFlags field of the MenuInfo with 0x01. It disables all
 *    items (including items past item 31) but does not affect the
 *    state of the menu title.
 *
 *  Parameters:
 *
 *    theMenu:
 *      The menu whose items to disable.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisableAllMenuItems(theMenu: MenuRef); external name '_DisableAllMenuItems';

{
 *  EnableAllMenuItems()
 *
 *  Summary:
 *    Enables all items in a menu.
 *
 *  Discussion:
 *    This API is equivalent to pre-Carbon code that or'd the
 *    enableFlags field of the MenuInfo with 0xFFFFFFFE. It enables all
 *    items (including items past item 31) but does not affect the
 *    state of the menu title.
 *
 *  Parameters:
 *
 *    theMenu:
 *      The menu whose items to enable.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure EnableAllMenuItems(theMenu: MenuRef); external name '_EnableAllMenuItems';

{
 *  MenuHasEnabledItems()
 *
 *  Summary:
 *    Determines if any items in a menu are enabled.
 *
 *  Discussion:
 *    This API is equivalent to pre-Carbon code that compared the
 *    enableFlags field of the MenuInfo with 0. It checks the enable
 *    state of all items to see if any are enabled, but ignores the
 *    state of the menu title. It will return true even if the menu
 *    title is disabled.
 *
 *  Parameters:
 *
 *    theMenu:
 *      The menu whose items to examine.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function MenuHasEnabledItems(theMenu: MenuRef): boolean; external name '_MenuHasEnabledItems';

{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{  ¥ Menu tracking status (Carbon and later)                                           }
{                                                                                      }
{  Get info about the selected menu item during menu tracking. Replaces direct access  }
{  to low-mem globals that previously held this info.                                  }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{
 *  GetMenuTrackingData()
 *
 *  Summary:
 *    Gets information about the menu currently selected by the user.
 *
 *  Discussion:
 *    This API replaces direct access to the low-memory globals
 *    TopMenuItem, AtMenuBottom, MenuDisable, and mbSaveLoc. It is only
 *    valid to call this API while menu tracking is occurring. This API
 *    will most commonly be used by custom MDEFs.
 *
 *  Parameters:
 *
 *    theMenu:
 *      The menu about which to get tracking information. May be NULL
 *      to get information about the menu that the user is currently
 *      selecting. If the menu is not currently open, menuNotFoundErr
 *      is returned.
 *
 *    outData:
 *      On exit, contains tracking data about the menu. On CarbonLib,
 *      the itemRect field is not supported and is always set to an
 *      empty rect.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetMenuTrackingData(theMenu: MenuRef; var outData: MenuTrackingData): OSStatus; external name '_GetMenuTrackingData';

{
 *  GetMenuType()
 *
 *  Summary:
 *    Gets the display type (pulldown, hierarchical, or popup) of a
 *    menu.
 *
 *  Discussion:
 *    This API may only be called when the menu is displayed. If the
 *    menu is not currently open, an error is returned. The display
 *    type of a menu may vary from one menu tracking session to
 *    another; for example, the same menu might be displayed as a
 *    pulldown menu and as a popup menu.
 *
 *  Parameters:
 *
 *    theMenu:
 *      The menu whose type to get.
 *
 *    outType:
 *      On exit, the type of the menu. The returned value will be one
 *      of the ThemeMenuType constants: kThemeMenuTypePullDown, PopUp,
 *      or Hierarchical. The kThemeMenuTypeInactive bit will never be
 *      set.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetMenuType(theMenu: MenuRef; var outType: UInt16): OSStatus; external name '_GetMenuType';

{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{  ¥ÊUniversal command ID access (Carbon and later)                                    }
{                                                                                      }
{  These APIs allow you to operate on menu items strictly by command ID, with no       }
{  knowledge of a menu item's index.                                                   }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{
 *  CountMenuItemsWithCommandID()
 *
 *  Summary:
 *    Counts the menu items with a specified command ID.
 *
 *  Discussion:
 *    In CarbonLib 1.0.x and 1.1, this API always returns zero or one;
 *    it stops after finding the first menu item with the specified
 *    command ID. In CarbonLib 1.2 and Mac OS X 10.0 and later, it
 *    counts all menu items with the specified command ID. In Mac OS X
 *    10.0 and CarbonLib 1.0 through 1.4, this API only searches
 *    top-level menus (menus visible in the menubar) and submenus of
 *    top-level menus. It does not search hierarchical menus that are
 *    inserted in the menubar but are not submenus of a top-level menus
 *    (for example, it does not search menus that are inserted for use
 *    in a popup menu control). In Mac OS X 10.1 and CarbonLib 1.5 and
 *    later, this API also searches inserted hierarchical menus.
 *
 *  Parameters:
 *
 *    inMenu:
 *      The menu in which to begin searching for items with the
 *      specified command ID. Pass NULL to hegin searching with the
 *      root menu. The search will descend into all submenus of this
 *      menu.
 *
 *    inCommandID:
 *      The command ID for which to search.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CountMenuItemsWithCommandID(inMenu: MenuRef; inCommandID: MenuCommand): ItemCount; external name '_CountMenuItemsWithCommandID';

{
 *  GetIndMenuItemWithCommandID()
 *
 *  Summary:
 *    Finds a menu item with a specified command ID.
 *
 *  Discussion:
 *    This API searches the specified menu and its submenus for the
 *    n'th menu item with the specified command ID. In CarbonLib 1.0.x
 *    and 1.1, only the first menu item is returned. In CarbonLib 1.2
 *    and Mac OS X 10.0 and later, this API iterates over all menu
 *    items with the specified command ID. In Mac OS X 10.0 and
 *    CarbonLib 1.0 through 1.4, this API only searches top-level menus
 *    (menus visible in the menubar) and submenus of top-level menus.
 *    It does not search hierarchical menus that are inserted in the
 *    menubar but are not submenus of a top-level menus (for example,
 *    it does not search menus that are inserted for use in a popup
 *    menu control). In Mac OS X 10.1 and CarbonLib 1.5 and later, this
 *    API also searches inserted hierarchical menus.
 *
 *  Parameters:
 *
 *    inMenu:
 *      The menu in which to begin searching for items with the
 *      specified command ID. Pass NULL to hegin searching with the
 *      root menu. The search will descend into all submenus of this
 *      menu.
 *
 *    inCommandID:
 *      The command ID for which to search.
 *
 *    inItemIndex:
 *      The 1-based index of the menu item to retrieve. In CarbonLib
 *      1.0.x and 1.1, this parameter must be 1. In CarbonLib 1.2 and
 *      Mac OS X 10.0, this parameter may vary from 1 to the number of
 *      menu items with the specified command ID.
 *
 *    outMenu:
 *      On exit, the menu containing the menu item with the specified
 *      command ID.
 *
 *    outIndex:
 *      On exit, the item index of the menu item with the specified
 *      command ID.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetIndMenuItemWithCommandID(inMenu: MenuRef; inCommandID: MenuCommand; inItemIndex: UInt32; outMenu: MenuRefPtr; outIndex: MenuItemIndexPtr): OSStatus; external name '_GetIndMenuItemWithCommandID';

{
 *  EnableMenuCommand()
 *
 *  Summary:
 *    Enables the menu item with a specified command ID.
 *
 *  Parameters:
 *
 *    inMenu:
 *      The menu in which to begin searching for the item. Pass NULL to
 *      begin searching with the root menu. The search will descend
 *      into all submenus of this menu.
 *
 *    inCommandID:
 *      The command ID of the menu item to be enabled. If more than one
 *      item has this command ID, only the first will be enabled.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure EnableMenuCommand(inMenu: MenuRef; inCommandID: MenuCommand); external name '_EnableMenuCommand';

{
 *  DisableMenuCommand()
 *
 *  Summary:
 *    Disables the menu item with a specified command ID.
 *
 *  Parameters:
 *
 *    inMenu:
 *      The menu in which to begin searching for the item. Pass NULL to
 *      begin searching with the root menu. The search will descend
 *      into all submenus of this menu.
 *
 *    inCommandID:
 *      The command ID of the menu item to be disabled. If more than
 *      one item has this command ID, only the first will be disabled.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisableMenuCommand(inMenu: MenuRef; inCommandID: MenuCommand); external name '_DisableMenuCommand';

{
 *  IsMenuCommandEnabled()
 *
 *  Summary:
 *    Determines if the menu item with a specified command ID is
 *    enabled.
 *
 *  Parameters:
 *
 *    inMenu:
 *      The menu in which to begin searching for the item. Pass NULL to
 *      begin searching with the root menu. The search will descend
 *      into all submenus of this menu.
 *
 *    inCommandID:
 *      The command ID of the menu item to examine. If more than one
 *      item has this command ID, only the first will be examined.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function IsMenuCommandEnabled(inMenu: MenuRef; inCommandID: MenuCommand): boolean; external name '_IsMenuCommandEnabled';

{
 *  SetMenuCommandMark()
 *
 *  Summary:
 *    Locates the menu item with a specified command ID and sets its
 *    mark character.
 *
 *  Parameters:
 *
 *    inMenu:
 *      The menu in which to begin searching for the item. Pass NULL to
 *      begin searching with the root menu. The search will descend
 *      into all submenus of this menu.
 *
 *    inCommandID:
 *      The command ID of the menu item to be modified. If more than
 *      one item has this command ID, only the first will be modified.
 *
 *    inMark:
 *      The new mark character. This is a Unicode character. On Mac OS
 *      8.x, the low byte of this character will be used as the mark
 *      character. On Mac OS X, the entire UniChar will be used and
 *      drawn.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetMenuCommandMark(inMenu: MenuRef; inCommandID: MenuCommand; inMark: UniChar): OSStatus; external name '_SetMenuCommandMark';

{
 *  GetMenuCommandMark()
 *
 *  Summary:
 *    Locates the menu item with a specified command ID and returns its
 *    mark character.
 *
 *  Parameters:
 *
 *    inMenu:
 *      The menu in which to begin searching for the item. Pass NULL to
 *      begin searching with the root menu. The search will descend
 *      into all submenus of this menu.
 *
 *    inCommandID:
 *      The command ID of the menu item to be examined. If more than
 *      one item has this command ID, only the first will be examined.
 *
 *    outMark:
 *      On exit, the menu item's mark character.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetMenuCommandMark(inMenu: MenuRef; inCommandID: MenuCommand; var outMark: UniChar): OSStatus; external name '_GetMenuCommandMark';

{
 *  GetMenuCommandProperty()
 *
 *  Summary:
 *    Retrives property data for a menu item with a specified command
 *    ID.
 *
 *  Parameters:
 *
 *    inMenu:
 *      The menu in which to begin searching for the item. Pass NULL to
 *      begin searching with the root menu. The search will descend
 *      into all submenus of this menu.
 *
 *    inCommandID:
 *      The command ID of the menu item containing the property. If
 *      more than one item has this command ID, only the first will be
 *      used.
 *
 *    inPropertyCreator:
 *      The property creator.
 *
 *    inPropertyTag:
 *      The property tag.
 *
 *    inBufferSize:
 *      The size of the output buffer, in bytes.
 *
 *    outActualSize:
 *      On exit, contains the actual size of the property data. May be
 *      NULL if you do not need this information.
 *
 *    inPropertyBuffer:
 *      The address of a buffer in which to place the property data.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetMenuCommandProperty(inMenu: MenuRef; inCommandID: MenuCommand; inPropertyCreator: OSType; inPropertyTag: OSType; inBufferSize: ByteCount; outActualSize: ByteCountPtr; inPropertyBuffer: UnivPtr): OSStatus; external name '_GetMenuCommandProperty';

{
 *  GetMenuCommandPropertySize()
 *
 *  Summary:
 *    Retrives the size of property data for a menu item with a
 *    specified command ID.
 *
 *  Parameters:
 *
 *    inMenu:
 *      The menu in which to begin searching for the item. Pass NULL to
 *      begin searching with the root menu. The search will descend
 *      into all submenus of this menu.
 *
 *    inCommandID:
 *      The command ID of the menu item containing the property. If
 *      more than one item has this command ID, only the first will be
 *      used.
 *
 *    inPropertyCreator:
 *      The property creator.
 *
 *    inPropertyTag:
 *      The property tag.
 *
 *    outSize:
 *      On exit, contains the size of the property data.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetMenuCommandPropertySize(inMenu: MenuRef; inCommandID: MenuCommand; inPropertyCreator: OSType; inPropertyTag: OSType; var outSize: ByteCount): OSStatus; external name '_GetMenuCommandPropertySize';

{
 *  SetMenuCommandProperty()
 *
 *  Summary:
 *    Sets property data for a menu item with a specified command ID.
 *
 *  Parameters:
 *
 *    inMenu:
 *      The menu in which to begin searching for the item. Pass NULL to
 *      begin searching with the root menu. The search will descend
 *      into all submenus of this menu.
 *
 *    inCommandID:
 *      The command ID of the menu item that will receive the property.
 *      If more than one item has this command ID, only the first will
 *      be modified.
 *
 *    inPropertyCreator:
 *      The property creator.
 *
 *    inPropertyTag:
 *      The property tag.
 *
 *    inPropertySize:
 *      The size of the property data, in bytes.
 *
 *    inPropertyData:
 *      The address of the property data.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetMenuCommandProperty(inMenu: MenuRef; inCommandID: MenuCommand; inPropertyCreator: OSType; inPropertyTag: OSType; inPropertySize: ByteCount; inPropertyData: UnivPtr): OSStatus; external name '_SetMenuCommandProperty';

{
 *  RemoveMenuCommandProperty()
 *
 *  Summary:
 *    Removes a property from a menu item with a specified command ID.
 *
 *  Parameters:
 *
 *    inMenu:
 *      The menu in which to begin searching for the item. Pass NULL to
 *      begin searching with the root menu. The search will descend
 *      into all submenus of this menu.
 *
 *    inCommandID:
 *      The command ID of the menu item from which the property will be
 *      removed. If more than one item has this command ID, only the
 *      first will be modified.
 *
 *    inPropertyCreator:
 *      The property creator.
 *
 *    inPropertyTag:
 *      The property tag.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function RemoveMenuCommandProperty(inMenu: MenuRef; inCommandID: MenuCommand; inPropertyCreator: OSType; inPropertyTag: OSType): OSStatus; external name '_RemoveMenuCommandProperty';


{
 *  CopyMenuItemData()
 *
 *  Summary:
 *    Returns multiple attributes of a menu item at once.
 *
 *  Discussion:
 *    This function is used to retrieve many attributes of a menu item
 *    simultaneously; for example, it might be used by a menu
 *    definition function that needs to know how to draw a menu item.
 *    It is more efficient to use this function than to use the
 *    accessor functions for the individual attributes of the menu.
 *    This function returns a copy of the data in the menu, so any data
 *    in the MenuItemDataRec that is dynamically allocated (for
 *    example, the CFString item text) should be released by the caller.
 *
 *  Parameters:
 *
 *    inMenu:
 *      The menu from which to copy data. If inIsCommandID is true, you
 *      may pass NULL for this parameter to search for an item in the
 *      root menu; if inIsCommandID is false, this parameter must be a
 *      valid MenuRef.
 *
 *    inItem:
 *      The item or command ID from which to copy data.
 *
 *    inIsCommandID:
 *      Indicates whether inItem is a MenuItemIndex or MenuCommand. If
 *      inIsCommandID is true, the inItem parameter is interpreted as a
 *      menu command ID, and data is copied from the first item in the
 *      menu with that command ID. If inIsCommandID is false, the
 *      inItem parameter is interpreted as a menu item index, and data
 *      is copied for that item in the specified menu.
 *
 *    ioData:
 *      Data is copied from the item and placed here. On entry, the
 *      whichData field of this structure should be initialized to
 *      indicate which data the caller would like returned. Individual
 *      fields of the MenuItemDataRec structure may require
 *      pre-initialization also; see the individual MenuItemDataFlags
 *      documentation for details.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CopyMenuItemData(inMenu: MenuRef; inItem: MenuItemID; inIsCommandID: boolean; ioData: MenuItemDataPtr): OSStatus; external name '_CopyMenuItemData';

{
 *  SetMenuItemData()
 *
 *  Summary:
 *    Sets multiple attributes of a menu item at once.
 *
 *  Discussion:
 *    This function is used to set many attributes of a menu item
 *    simultaneously. It is more efficient to use this function than to
 *    use the accessor functions for the individual attributes of the
 *    menu.
 *
 *  Parameters:
 *
 *    inMenu:
 *      The menu to modify.
 *
 *    inItem:
 *      The item or command ID to modify.
 *
 *    inIsCommandID:
 *      Indicates whether inItem is a MenuItemIndex or MenuCommand. If
 *      inIsCommandID is true, the inItem parameter is interpreted as a
 *      menu command ID, and the first item in the menu with that
 *      command ID. is modified. If inIsCommandID is false, the inItem
 *      parameter is interpreted as a menu item index, and the item
 *      with that index in the specified menu is modified.
 *
 *    inData:
 *      The data to set. The caller should set the whichData field of
 *      this structure to indicate which data should be set. Only the
 *      fields of the structure corresponding to the non-zero whichData
 *      flags must be initialized; other fields are ignored.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetMenuItemData(inMenu: MenuRef; inItem: MenuItemID; inIsCommandID: boolean; const (*var*) inData: MenuItemDataRec): OSStatus; external name '_SetMenuItemData';


{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{  ¥ Dynamic menu item support (CarbonLib 1.1 and Carbon for Mac OS X, and later)      }
{                                                                                      }
{  Dynamic menu item support allows a menu item to be redrawn while the menu is open   }
{  and visible to the user. Carbon contains automatic support for dynamic items based  }
{  on keyboard modifier state. If you need to implement your own variable item state   }
{  based on other system state, you can use these APIs to implement it.                }
{                                                                                      }
{  To use the built-in support for dynamic items, you should create a menu containing  }
{  several contiguous items with the same command key but different text and modifier  }
{  keys. For example, you might have:                                                  }
{                                                                                      }
{      Close       cmd-W                                                               }
{      Close All   cmd-option-W                                                        }
{                                                                                      }
{  In your MENU resource, you would create the Close and Close All items and give      }
{  them each the letter 'W' as the command key; using an associated xmnu resource,     }
{  you would specify kMenuOptionModifier as the modifier for the Close All item.       }
{                                                                                      }
{  After loading your menu from the resource, you must set the kMenuItemAttrDynamic    }
{  flag for each dynamic item. In this example, you would use:                         }
{                                                                                      }
{      ChangeMenuItemAttributes( menu, kCloseItem, kMenuItemAttrDynamic, 0 );          }
{      ChangeMenuItemAttributes( menu, kCloseAllItem, kMenuItemAttrDynamic, 0 );       }
{                                                                                      }
{  The Menu Manager will now automatically display the correct item depending on       }
{  whether the Option key is pressed. The result from MenuSelect will be the item      }
{  number of the item that was visible when the menu closed.                           }
{                                                                                      }
{  If the Menu Manager's built-in support is not sufficient, you can also change the   }
{  attributes of an item yourself and use the UpdateInvalidMenuItems API to cause      }
{  the menu to redraw. Changes to a menu item (changing text, command key, style,      }
{  etc.) that occur while the menu is open will cause the menu item to be invalidated, }
{  but not redrawn. If you need to invalidate the item explicitly yourself, perhaps    }
{  because you have a custom MDEF that depends on state not accessed using Menu        }
{  Manager APIs, you can use the InvalidateMenuItems API. UpdateInvalidMenuItems will  }
{  scan the menu for invalid items and redraw each, clearing its invalid flag          }
{  afterwards.                                                                         }
{                                                                                      }
{  If you need to change menu contents based on modifier key state without using the   }
{  built-in support in the Menu Manager, we recommend that you install a Carbon event  }
{  handler on your menu for the [kEventClassKeyboard, kEventRawKeyModifiersChanged]    }
{  event. Modifier key events are passed to the currently open menu before being sent  }
{  to the user focus target.                                                           }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{
 *  IsMenuItemInvalid()
 *
 *  Summary:
 *    Determines if a menu item is invalid and should be redrawn.
 *
 *  Parameters:
 *
 *    inMenu:
 *      The menu whose item to examine.
 *
 *    inItem:
 *      The item to examine.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function IsMenuItemInvalid(inMenu: MenuRef; inItem: MenuItemIndex): boolean; external name '_IsMenuItemInvalid';

{
 *  InvalidateMenuItems()
 *
 *  Summary:
 *    Invalidates a group of menu items so that they will be redrawn
 *    when UpdateInvalidMenuItems is next called.
 *
 *  Discussion:
 *    Menu items are automatically invalidated when their contents are
 *    changed using Menu Manager APIs while the menu is open. However,
 *    you might need to use this API if you have a custom MDEF that
 *    draws using state not contained in the menu.
 *
 *  Parameters:
 *
 *    inMenu:
 *      The menu whose items to invalidate.
 *
 *    inFirstItem:
 *      The first item to invalidate.
 *
 *    inNumItems:
 *      The number of items to invalidate.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvalidateMenuItems(inMenu: MenuRef; inFirstItem: MenuItemIndex; inNumItems: ItemCount): OSStatus; external name '_InvalidateMenuItems';

{
 *  UpdateInvalidMenuItems()
 *
 *  Summary:
 *    Redraws the invalid items of an open menu.
 *
 *  Discussion:
 *    It is not necessary to use UpdateInvalidMenuItems if you are
 *    using Carbon's built-in support for dynamic items based on
 *    modifier key state. However, if you are modifying items
 *    dynamically using your own implementation, you should call
 *    UpdateInvalidMenuItems after completing your modifications for a
 *    single menu. It will redraw any items that have been marked as
 *    invalid, and clear the invalid flag for those items.
 *
 *  Parameters:
 *
 *    inMenu:
 *      The menu to update.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function UpdateInvalidMenuItems(inMenu: MenuRef): OSStatus; external name '_UpdateInvalidMenuItems';


{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{  ¥ÊStandard font menu (Carbon and later)                                             }
{                                                                                      }
{  These APIs allow you to create and use the standard font menu.                      }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}

const
    kHierarchicalFontMenuOption = $00000001;

    {
     *  CreateStandardFontMenu()
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function CreateStandardFontMenu(menu: MenuRef; afterItem: MenuItemIndex; firstHierMenuID: MenuID; options: OptionBits; var outHierMenuCount: ItemCount): OSStatus; external name '_CreateStandardFontMenu';

{
 *  UpdateStandardFontMenu()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function UpdateStandardFontMenu(menu: MenuRef; var outHierMenuCount: ItemCount): OSStatus; external name '_UpdateStandardFontMenu';

{
 *  GetFontFamilyFromMenuSelection()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetFontFamilyFromMenuSelection(menu: MenuRef; item: MenuItemIndex; var outFontFamily: FMFontFamily; var outStyle: FMFontStyle): OSStatus; external name '_GetFontFamilyFromMenuSelection';


{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{  ¥ Contextual Menu routines and constants                                            }
{  available with Conxtextual Menu extension 1.0 and later                             }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{ Gestalt Selector for classic 68K apps only. }
{ CFM apps should weak link and check the symbols. }

const
    gestaltContextualMenuAttr   = $636D6E75 (* 'cmnu' *);
    gestaltContextualMenuUnusedBit = 0;
    gestaltContextualMenuTrapAvailable = 1;
    gestaltContextualMenuHasAttributeAndModifierKeys = 2;       {  Contextual Menu Manager supports keyContextualMenuAttributes and keyContextualMenuModifiers  }
    gestaltContextualMenuHasUnicodeSupport = 3;                 {  Contextual Menu Manager supports typeUnicodeText and typeCFStringRef  }


    {
     *  Summary:
     *    Values indicating what kind of help the application supports
        }
    kCMHelpItemNoHelp           = 0;
    kCMHelpItemAppleGuide       = 1;
    kCMHelpItemOtherHelp        = 2;
    kCMHelpItemRemoveHelp       = 3;


    {
     *  Summary:
     *    Values indicating what was chosen from a contextual menu
        }
    kCMNothingSelected          = 0;
    kCMMenuItemSelected         = 1;
    kCMShowHelpSelected         = 3;



    {
     *  Summary:
     *    AERecord keywords used by the ExamineContext method of a
     *    Contextual Menu plugin to specify menu item contents.
        }
    keyContextualMenuName       = $706E616D (* 'pnam' *);
    keyContextualMenuCommandID  = $636D6364 (* 'cmcd' *);
    keyContextualMenuSubmenu    = $636D7362 (* 'cmsb' *);
    keyContextualMenuAttributes = $636D6174 (* 'cmat' *);
    keyContextualMenuModifiers  = $636D6D64 (* 'cmmd' *);

    {
     *  InitContextualMenus()
     *
     *  Summary:
     *    Adds the current process to the system registry of contextual
     *    menu clients.
     *
     *  Discussion:
     *    On Mac OS 8.x and 9.x, your program should call the
     *    InitContextualMenus function early in your startup code to
     *    register your application as a contextual menu client. If you do
     *    not register your program, some system-level functions may
     *    respond as though your program does not use contextual menus. Not
     *    registering your program may also cause
     *    ProcessIsContextualMenuClient to return an incorrect value. On
     *    Mac OS X, it is not necessary to call InitContextualMenus.
     *
     *  Availability:
     *    Non-Carbon CFM:   in ContextualMenu 1.0 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function InitContextualMenus: OSStatus; external name '_InitContextualMenus';
{
 *  IsShowContextualMenuClick()
 *
 *  Summary:
 *    Determines whether a particular EventRecord could invoke a
 *    contextual menu.
 *
 *  Discussion:
 *    Applications should call IsShowContextualMenuClick when they
 *    receive non-null events. If IsShowContextualMenuClick returns
 *    true, your application should generate its own menu and Apple
 *    Event descriptor (AEDesc), and then call ContextualMenuSelect to
 *    display and track the contextual menu, and then handle the user's
 *    choice. Some users may choose to use a two-button mouse with
 *    their Macintosh computer. This API does not return true for a
 *    right-click unless the mouse manufacturer has provided driver
 *    software that returns a control-left click in place of a right
 *    click. For proper recognition of a right-click gesture, you must
 *    use the IsShowContextualMenuEvent API.
 *
 *  Parameters:
 *
 *    inEvent:
 *      The event to examine.
 *
 *  Result:
 *    Returns true if the application should display a contextual menu,
 *    false if not.
 *
 *  Availability:
 *    Non-Carbon CFM:   in ContextualMenu 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function IsShowContextualMenuClick(const (*var*) inEvent: EventRecord): boolean; external name '_IsShowContextualMenuClick';
{
 *  IsShowContextualMenuEvent()
 *
 *  Summary:
 *    Determines whether a particular EventRef could invoke a
 *    contextual menu.
 *
 *  Discussion:
 *    This API is similar to IsShowContextualMenuClick, but takes a
 *    Carbon EventRef as its parameter instead of an EventRecord.
 *    EventRecords cannot express a right-mouse-click, but EventRefs
 *    can, so this API will return true for a right- click where
 *    IsShowContextualMenuClick will not.
 *
 *  Parameters:
 *
 *    inEvent:
 *      The event to examine.
 *
 *  Result:
 *    Returns true if the application should display a contextual menu,
 *    false if not.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function IsShowContextualMenuEvent(inEvent: EventRef): boolean; external name '_IsShowContextualMenuEvent';

{
 *  ContextualMenuSelect()
 *
 *  Summary:
 *    Displays a contextual menu.
 *
 *  Discussion:
 *    If IsShowContextualMenuClick returns true, you should call the
 *    ContextualMenuSelect API after generating your own menu and
 *    preparing an Apple Event descriptor (AEDesc) that describes the
 *    item for which your application is displaying a contextual menu.
 *    This descriptor may contain an object specifier or raw data and
 *    will be passed to all contextual menu plug-ins. The system will
 *    add other items before displaying the contextual menu, and it
 *    will remove those items before returning, leaving the menu in its
 *    original state. After all the system commands are added, the
 *    contextual menu is displayed and tracked. If the user selects one
 *    of the system items, it is handled by the system and the call
 *    returns as though the user didn't select anything from the menu.
 *    If the user selects any other item (or no item at all), the Menu
 *    Manager passes back appropriate values in the parameters
 *    outUserSelectionType, outMenuID, and outMenuItem. Your
 *    application should provide visual feedback indicating the item
 *    that was clicked upon. For example, a click on an icon should
 *    highlight the icon, while a click on editable text should not
 *    eliminate the current selection. If the outUserSelectionType
 *    parameter contains kCMMenuItemSelected, you should look at the
 *    outMenuID and outMenuItem parameters to determine what menu item
 *    the user chose and handle it appropriately. If the user selected
 *    kCMHelpItemSelected, you should open the proper Apple Guide
 *    sequence or other form of custom help.
 *
 *  Parameters:
 *
 *    inMenu:
 *      A menu containing application commands to display. The caller
 *      creates this menu based on the current context, the mouse
 *      location, and the current selection (if it was the target of
 *      the mouse). If you pass nil, only system commands will be
 *      displayed. The menu should be added to the menu list as a
 *      pop-up menu (using the InsertMenu function).
 *
 *    inGlobalLocation:
 *      The location (in global coordinates) of the mouse near which
 *      the menu is to be displayed.
 *
 *    inReserved:
 *      Reserved for future use. Pass false for this parameter.
 *
 *    inHelpType:
 *      An identifier specifying the type of help to be provided by the
 *      application; see kCMHelpItem constants.
 *
 *    inHelpItemString:
 *      A string containing the text to be displayed for the help menu
 *      item. This string is unused unless you also pass the constant
 *      kCMHelpItemOtherHelp in the inHelpType parameter.
 *
 *    inSelection:
 *      An object specifier for the current selection. This allows he
 *      system to examine the selection and add special system commands
 *      accordingly. Passing a value of nil indicates that no selection
 *      should be examined, and most likely, no special system actions
 *      will be included.
 *
 *    outUserSelectionType:
 *      On exit, the value indicates what the user selected from the
 *      contextual menu; see kCMNothingSelected, kCMMenuItemSelected,
 *      and kCMShowHelpSelected.
 *
 *    outMenuID:
 *      On exit, if outUserSelectionType is set to kCMMenuItemSelected,
 *      the value is set to the menu ID of the chosen item.
 *
 *    outMenuItem:
 *      On exit, if outUserSelectionType is set to kCMMenuItemSelected,
 *      the value is set to the menu item chosen.
 *
 *  Result:
 *    An OSStatus result code. ContextualMenuSelect returns the result
 *    code userCanceledErr and sets outUserSelectionType to
 *    kCMNothingSelected to indicate that the user did not select
 *    anything from the contextual menu and no further processing is
 *    needed.
 *
 *  Availability:
 *    Non-Carbon CFM:   in ContextualMenu 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ContextualMenuSelect(inMenu: MenuRef; inGlobalLocation: Point; inReserved: boolean; inHelpType: UInt32; inHelpItemString: ConstStringPtr; inSelection: {Const}AEDescPtr; var outUserSelectionType: UInt32; var outMenuID: SInt16; var outMenuItem: MenuItemIndex): OSStatus; external name '_ContextualMenuSelect';
{
 *  ProcessIsContextualMenuClient()
 *
 *  Summary:
 *    Determines whether the specified process is a contextual menu
 *    client.
 *
 *  Discussion:
 *    On Mac OS 9, this API consults a global table of all processes
 *    that have registered with the Contextual Menu Manager by calling
 *    InitContextualMenus. On Mac OS X, this API ignores the inPSN
 *    parameter and always returns whether the current process is
 *    registered with the Contextual Menu Manager.
 *
 *  Parameters:
 *
 *    inPSN:
 *      The process to examine.
 *
 *  Result:
 *    Whether the specified process (or, on Mac OS X, the current
 *    process) is registered with the Contextual Menu Manager.
 *
 *  Availability:
 *    Non-Carbon CFM:   in ContextualMenu 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ProcessIsContextualMenuClient(var inPSN: ProcessSerialNumber): boolean; external name '_ProcessIsContextualMenuClient';
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{  Contextual Menu Plugin Interface                                                    }
{                                                                                      }
{  For Mac OS X 10.1, we support a new type of Contextual Menu Plugin: the CFPlugIn    }
{  based plugin.  Each plugin must be in a CFPlugIn in the Contextual Menu Items       }
{  folder in one of these paths:                                                       }
{      /System/Library/Contextual Menu Items/                                          }
{      /Library/Contextual Menu Items/                                                 }
{      ~/Library/Contextual Menu Items/                                                }
{                                                                                      }
{  It must export the following functions using the following interface or a C++       }
{  interface inheriting from IUnknown and including similar functions.                 }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{
 *  CMPluginExamineContext()
 *
 *  Availability:
 *    Implemented by client
 }
function CMPluginExamineContext(thisInstance: UnivPtr; const (*var*) inContext: AEDesc; var outCommandPairs: AEDescList): OSStatus; external name '_CMPluginExamineContext';

{
 *  CMPluginHandleSelection()
 *
 *  Availability:
 *    Implemented by client
 }
function CMPluginHandleSelection(thisInstance: UnivPtr; var inContext: AEDesc; inCommandID: SInt32): OSStatus; external name '_CMPluginHandleSelection';

{
 *  CMPluginPostMenuCleanup()
 *
 *  Availability:
 *    Implemented by client
 }
procedure CMPluginPostMenuCleanup(thisInstance: UnivPtr); external name '_CMPluginPostMenuCleanup';


{ previously in LowMem.h.  This functions return the menu ID of the hilited menu }
{
 *  LMGetTheMenu()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function LMGetTheMenu: SInt16; external name '_LMGetTheMenu';

{ Getters }
{
 *  GetMenuID()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetMenuID(menu: MenuRef): MenuID; external name '_GetMenuID';

{
 *  GetMenuWidth()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetMenuWidth(menu: MenuRef): SInt16; external name '_GetMenuWidth';

{
 *  GetMenuHeight()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetMenuHeight(menu: MenuRef): SInt16; external name '_GetMenuHeight';

{
 *  GetMenuTitle()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetMenuTitle(menu: MenuRef; var title: Str255): StringPtr; external name '_GetMenuTitle';

{
 *  GetMenuDefinition()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetMenuDefinition(menu: MenuRef; outDefSpec: MenuDefSpecPtr): OSStatus; external name '_GetMenuDefinition';

{ Setters }
{
 *  SetMenuID()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetMenuID(menu: MenuRef; menuID: MenuID); external name '_SetMenuID';

{
 *  SetMenuWidth()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetMenuWidth(menu: MenuRef; width: SInt16); external name '_SetMenuWidth';

{
 *  SetMenuHeight()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetMenuHeight(menu: MenuRef; height: SInt16); external name '_SetMenuHeight';

{
 *  SetMenuTitle()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetMenuTitle(menu: MenuRef; const (*var*) title: Str255): OSStatus; external name '_SetMenuTitle';

{
 *  SetMenuDefinition()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetMenuDefinition(menu: MenuRef; const (*var*) defSpec: MenuDefSpec): OSStatus; external name '_SetMenuDefinition';






{$ALIGN MAC68K}
{#POP}
{unit StringCompare}
{$ALIGN MAC68K}








{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}

{

    Here are the current System 7 routine names and the translations to the older forms.
    Please use the newer forms in all new code and migrate the older names out of existing
    code as maintenance permits.

    NEW NAME                    OLD NAME                    OBSOLETE FORM (no handle)

    CompareString (Str255)      IUCompPString (hp only)     IUCompString (hp only)
    CompareText (ptr/len)       IUMagPString                IUMagString
    IdenticalString (Str255)    IUEqualPString (hp only)    IUEqualString  (hp only)
    IdenticalText (ptr/len)     IUMagIDPString              IUMagIDString
    LanguageOrder               IULangOrder
    ScriptOrder                 IUScriptOrder
    StringOrder (Str255)        IUStringOrder (hp only)
    TextOrder (ptr/len)         IUTextOrder

    RelString
    CmpString (a only)
    EqualString (hp only)

    ReplaceText

    Carbon only supports the new names.  The old names are undefined for Carbon targets.

    InterfaceLib always has exported the old names.  For C macros have been defined to allow
    the use of the new names.  For Pascal and Assembly using the new names will result
    in link errors.

}


const
                                                                {  Special language code values for Language Order }
    systemCurLang               = -2;                           {  current (itlbLang) lang for system script }
    systemDefLang               = -3;                           {  default (table) lang for system script }
    currentCurLang              = -4;                           {  current (itlbLang) lang for current script }
    currentDefLang              = -5;                           {  default lang for current script }
    scriptCurLang               = -6;                           {  current (itlbLang) lang for specified script }
    scriptDefLang               = -7;                           {  default language for a specified script }

    {  obsolete names }
    iuSystemCurLang             = -2;
    iuSystemDefLang             = -3;
    iuCurrentCurLang            = -4;
    iuCurrentDefLang            = -5;
    iuScriptCurLang             = -6;
    iuScriptDefLang             = -7;


    {
     *  These routines are available in Carbon with the new names.
        }
    {
     *  [Mac]ReplaceText()
     *
     *  Availability:
     *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function ReplaceText(baseText: Handle; substitutionText: Handle; var key: Str15): SInt16; external name '_ReplaceText';
{
 *  ScriptOrder()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ScriptOrder(script1: ScriptCode; script2: ScriptCode): SInt16; external name '_ScriptOrder';
{
 *  [Mac]CompareString()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CompareString(const (*var*) aStr: Str255; const (*var*) bStr: Str255; itl2Handle: Handle): SInt16; external name '_CompareString';

{
 *  IdenticalString()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function IdenticalString(const (*var*) aStr: Str255; const (*var*) bStr: Str255; itl2Handle: Handle): SInt16; external name '_IdenticalString';

{
 *  StringOrder()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function StringOrder(const (*var*) aStr: Str255; const (*var*) bStr: Str255; aScript: ScriptCode; bScript: ScriptCode; aLang: LangCode; bLang: LangCode): SInt16; external name '_StringOrder';

{
 *  CompareText()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CompareText(aPtr: UnivPtr; bPtr: UnivPtr; aLen: SInt16; bLen: SInt16; itl2Handle: Handle): SInt16; external name '_CompareText';
{
 *  IdenticalText()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function IdenticalText(aPtr: UnivPtr; bPtr: UnivPtr; aLen: SInt16; bLen: SInt16; itl2Handle: Handle): SInt16; external name '_IdenticalText';
{
 *  TextOrder()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TextOrder(aPtr: UnivPtr; bPtr: UnivPtr; aLen: SInt16; bLen: SInt16; aScript: ScriptCode; bScript: ScriptCode; aLang: LangCode; bLang: LangCode): SInt16; external name '_TextOrder';
{
 *  LanguageOrder()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function LanguageOrder(language1: LangCode; language2: LangCode): SInt16; external name '_LanguageOrder';
{
 *  These routines are available in InterfaceLib with old names.
 *  Macros are provided for C to allow source code use to the new names.
 }



{
 *  RelString()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function RelString(const (*var*) str1: Str255; const (*var*) str2: Str255; caseSensitive: boolean; diacSensitive: boolean): SInt16; external name '_RelString';

{
 *  EqualString()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function EqualString(const (*var*) str1: Str255; const (*var*) str2: Str255; caseSensitive: boolean; diacSensitive: boolean): boolean; external name '_EqualString';



{$ALIGN MAC68K}
{#POP}
{unit TextUtils}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}

{

    Here are the current System 7 routine names and the translations to the older forms.
    Please use the newer forms in all new code and migrate the older names out of existing
    code as maintainance permits.

    NEW NAME                    OLD NAMEs                   OBSOLETE FORM (no script code)

    FindScriptRun
    FindWordBreaks                                          NFindWord, FindWord
    GetIndString
    GetString
    Munger
    NewString
    SetString
    StyledLineBreak
    TruncString
    TruncText

    UpperString ($A054)         UprString, UprText
    UppercaseText               SCUpperText (a only)        UpperText ($A456)
    LowercaseText                                           LwrString, LowerText, LwrText ($A056)
    StripDiacritics                                         StripText ($A256)
    UppercaseStripDiacritics                                StripUpperText ($A656)


}

{ TruncCode, StyledLineBreakCode, and truncation constants moved to QuickDrawText.i }

type
    ScriptRunStatusPtr = ^ScriptRunStatus;
    ScriptRunStatus = record
        script:                 SInt8;
        runVariant:             SInt8;
    end;

    BreakTablePtr = ^BreakTable;
    BreakTable = record
        charTypes:              packed array [0..255] of char;
        tripleLength:           SInt16;
        triples:                array [0..0] of SInt16;
    end;

    NBreakTablePtr = ^NBreakTable;
    NBreakTable = record
        flags1:                 SInt8;
        flags2:                 SInt8;
        version:                SInt16;
        classTableOff:          SInt16;
        auxCTableOff:           SInt16;
        backwdTableOff:         SInt16;
        forwdTableOff:          SInt16;
        doBackup:               SInt16;
        length:                 SInt16;                             {  length of NBreakTable  }
        charTypes:              packed array [0..255] of char;
        tables:                 array [0..0] of SInt16;
    end;

    {  The following functions are new names that work on 68k and PowerPC }
    {
     *  Munger()
     *
     *  Availability:
     *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function Munger(h: Handle; offset: SInt32; ptr1: UnivPtr; len1: SInt32; ptr2: UnivPtr; len2: SInt32): SInt32; external name '_Munger';
{
 *  NewString()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewString(const (*var*) theString: Str255): StringHandle; external name '_NewString';
{
 *  SetString()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetString(theString: StringHandle; const (*var*) strNew: Str255); external name '_SetString';
{
 *  GetString()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetString(stringID: SInt16): StringHandle; external name '_GetString';
{
 *  GetIndString()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure GetIndString(var theString: Str255; strListID: SInt16; index: SInt16); external name '_GetIndString';

{
 *  FindWordBreaks()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure FindWordBreaks(textPtr: Ptr; textLength: SInt16; offset: SInt16; leadingEdge: boolean; breaks: BreakTablePtr; var offsets: OffsetTable; script: ScriptCode); external name '_FindWordBreaks';
{
 *  LowercaseText()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure LowercaseText(textPtr: Ptr; len: SInt16; script: ScriptCode); external name '_LowercaseText';
{
 *  UppercaseText()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure UppercaseText(textPtr: Ptr; len: SInt16; script: ScriptCode); external name '_UppercaseText';
{
 *  StripDiacritics()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure StripDiacritics(textPtr: Ptr; len: SInt16; script: ScriptCode); external name '_StripDiacritics';
{
 *  UppercaseStripDiacritics()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure UppercaseStripDiacritics(textPtr: Ptr; len: SInt16; script: ScriptCode); external name '_UppercaseStripDiacritics';
{
 *  FindScriptRun()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FindScriptRun(textPtr: Ptr; textLen: SInt32; var lenUsed: SInt32): ScriptRunStatus; external name '_FindScriptRun';
{
    The following functions are old names, but are required for PowerPC builds
    because InterfaceLib exports these names, instead of the new ones.
}


{
 *  UpperString()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure UpperString(var theString: Str255; diacSensitive: boolean); external name '_UpperString';

{  Old routine name but no new names are mapped to it: }

{
    Functions for converting between C and Pascal Strings
    (Previously in Strings.h)

    Note: CopyPascalStringToC, CopyCStringToPascal, c2pstrcpy, and p2cstrcpy
          are written to allow inplace conversion.  That is, the src and dst
          parameters can point to the memory location.  These functions
          are available in CarbonLib and CarbonAccessors.o.

    Note: c2pstr, C2PStr, p2cstr, and P2CStr are all deprecated.  These functions
          only do inplace conversion and often require casts to call them.  This can
          cause bugs because you can easily cast away a const and change the
          contents of a read-only buffer.  These functions are available
          in InterfaceLib, or when building for Carbon if you #define OLDP2C,
          then they are available as a macro.

}
{
 *  c2pstrcpy()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0.2 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure c2pstrcpy(var dst: Str255; src: ConstCStringPtr); external name '_c2pstrcpy';

{
 *  p2cstrcpy()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0.2 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure p2cstrcpy(dst: CStringPtr; const (*var*) src: Str255); external name '_p2cstrcpy';

{
 *  CopyPascalStringToC()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0.2 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CopyPascalStringToC(const (*var*) src: Str255; dst: CStringPtr); external name '_CopyPascalStringToC';

{
 *  CopyCStringToPascal()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0.2 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CopyCStringToPascal(src: ConstCStringPtr; var dst: Str255); external name '_CopyCStringToPascal';




{$ALIGN MAC68K}
{#POP}
{unit ToolUtils}
{$ALIGN MAC68K}








{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}

{
ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
    Note:

    The following routines that used to be in this header file, have moved to
    more appropriate headers.

        FixMath.h:      FixMul
                        FixRatio
                        FixRound

        Icons.h:        GetIcon
                        PlotIcon

        Quickdraw.h:    AngleFromSlope
                        DeltaPoint
                        GetCursor
                        GetIndPattern
                        GetPattern
                        GetPicture
                        PackBits
                        ScreenRes
                        ShieldCursor
                        SlopeFromAngle
                        UnpackBits

        TextUtils.h:    Munger
                        GetIndString
                        GetString
                        NewString
                        SetString
ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
}

{
 *  BitTst()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function BitTst(bytePtr: UnivPtr; bitNum: SInt32): boolean; external name '_BitTst';
{
 *  BitSet()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure BitSet(bytePtr: UnivPtr; bitNum: SInt32); external name '_BitSet';
{
 *  BitClr()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure BitClr(bytePtr: UnivPtr; bitNum: SInt32); external name '_BitClr';
{
 *  BitAnd()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function BitAnd(value1: SInt32; value2: SInt32): SInt32; external name '_BitAnd';
{
 *  BitOr()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function BitOr(value1: SInt32; value2: SInt32): SInt32; external name '_BitOr';
{
 *  BitXor()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function BitXor(value1: SInt32; value2: SInt32): SInt32; external name '_BitXor';
{
 *  BitNot()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function BitNot(value: SInt32): SInt32; external name '_BitNot';
{
 *  BitShift()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function BitShift(value: SInt32; count: SInt16): SInt32; external name '_BitShift';

{
   HiWord and LoWord are not in Carbon, but Metrowerks
   supplies an implementation on PPC
}
{
 *  HiWord()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib H.a.c.k and later
 *    Mac OS X:         not available
 }
function HiWord(x: SInt32): SInt16; external name '_HiWord';
{
 *  LoWord()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib H.a.c.k and later
 *    Mac OS X:         not available
 }
function LoWord(x: SInt32): SInt16; external name '_LoWord';
{$ALIGN MAC68K}
{#POP}
{unit ABPeoplePicker}
{$ALIGN MAC68K}






type
    ABPickerRef                         = ^SInt32;

{
 * Picker creation and manipulation
 }

// Creates an ABPickerRef. Release with CFRelease(). The window is created hidden. Call
// ABPickerSetVisibility() to show it.
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function ABPickerCreate: ABPickerRef; external name '_ABPickerCreate';

// Change the structural frame of the window.
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
procedure ABPickerSetFrame( inPicker: ABPickerRef; const (*var*) inFrame: HIRect ); external name '_ABPickerSetFrame';
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
procedure ABPickerGetFrame( inPicker: ABPickerRef; var outFrame: HIRect ); external name '_ABPickerGetFrame';

// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
procedure ABPickerSetVisibility( inPicker: ABPickerRef; visible: Boolean ); external name '_ABPickerSetVisibility';
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function ABPickerIsVisible( inPicker: ABPickerRef ): Boolean; external name '_ABPickerIsVisible';

{
 * Look and Feel
 }

const
    // Choose the selection behavior for the value column. If multiple behaviors are selected,
    // the most restrictive behavior will be used. Defaults to kABPickerSingleValueSelection set
    // to TRUE.
    kABPickerSingleValueSelection   = 1 shl 0; // Allow user to choose a single value for a person.
    kABPickerMultipleValueSelection = 1 shl 1; // Allow user to choose multiple values for a person.

    // Allow the user to select entire groups in the group column. If false, at least one
    // person in the group will be selected. Defaults to FALSE.
    kABPickerAllowGroupSelection    = 1 shl 2;

    // Allow the user to select more than one group/record at a time. Defaults to TRUE.
    kABPickerAllowMultipleSelection = 1 shl 3;

type ABPickerAttributes = OptionBits;

// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function ABPickerGetAttributes( inPicker: ABPickerRef ): ABPickerAttributes; external name '_ABPickerGetAttributes';
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
procedure ABPickerChangeAttributes( inPicker: ABPickerRef; inAttributesToSet: ABPickerAttributes; inAttributesToClear: ABPickerAttributes ); external name '_ABPickerChangeAttributes';

{
 * Value column
 }

    // These methods control what data (if any) is shown in the values column. The column will only
    // display if an AB property is added. A popup button in the column header will be used if more
    // than one property is added. Titles for built in properties will localized automatically. A
    // list of AB properties can be found in <AddressBook/ABGlobals.h>.
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
procedure ABPickerAddProperty( inPicker: ABPickerRef; inProperty: CFStringRef ); external name '_ABPickerAddProperty';
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
procedure ABPickerRemoveProperty( inPicker: ABPickerRef; inProperty: CFStringRef ); external name '_ABPickerRemoveProperty';
    // Returns an array of AB Properties as CFStringRefs.
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function ABPickerCopyProperties( inPicker: ABPickerRef ): CFArrayRef; external name '_ABPickerCopyProperties';

    // Localized titles for third party properties should be set with these methods.
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
procedure ABPickerSetColumnTitle( inPicker: ABPickerRef; inTitle: CFStringRef; inProperty: CFStringRef ); external name '_ABPickerSetColumnTitle';
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function ABPickerCopyColumnTitle( inPicker: ABPickerRef; inProperty: CFStringRef ): CFStringRef; external name '_ABPickerCopyColumnTitle';

    // Display one of the properties added above in the values column.
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
procedure ABPickerSetDisplayedProperty( inPicker: ABPickerRef; inProperty: CFStringRef ); external name '_ABPickerSetDisplayedProperty';
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function ABPickerCopyDisplayedProperty( inPicker: ABPickerRef ): CFStringRef; external name '_ABPickerCopyDisplayedProperty';

{
 * Selection
 }

    // Returns group column selection as an array of ABGroupRef objects.
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function ABPickerCopySelectedGroups( inPicker: ABPickerRef ): CFArrayRef; external name '_ABPickerCopySelectedGroups';

    // Returns names column selection as an array of ABGroupRef or ABPersonRef objects.
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function ABPickerCopySelectedRecords( inPicker: ABPickerRef ): CFArrayRef; external name '_ABPickerCopySelectedRecords';

    // This method returns an array of selected multi-value identifiers. Returns nil if the displayed
    // property is a single value type.
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function ABPickerCopySelectedIdentifiers( inPicker: ABPickerRef; inPerson: ABPersonRef ): CFArrayRef; external name '_ABPickerCopySelectedIdentifiers';

    // Returns an array containing CFStringRefs for each item selected in the values column.
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function ABPickerCopySelectedValues( inPicker: ABPickerRef ): CFArrayRef; external name '_ABPickerCopySelectedValues';

    // Select group/name/value programatically.
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
procedure ABPickerSelectGroup( inPicker: ABPickerRef; inGroup: ABGroupRef; inExtendSelection: Boolean ); external name '_ABPickerSelectGroup';
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
procedure ABPickerSelectRecord( inPicker: ABPickerRef; inRecord: ABRecordRef; inExtendSelection: Boolean ); external name '_ABPickerSelectRecord';
    // Individual values contained within an multi-value property can be selected with this method.
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
procedure ABPickerSelectIdentifier( inPicker: ABPickerRef; inPerson: ABPersonRef; inIdentifier: CFStringRef; inExtendSelection: Boolean ); external name '_ABPickerSelectIdentifier';

    // Remove selection
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
procedure ABPickerDeselectGroup( inPicker: ABPickerRef; inGroup: ABGroupRef ); external name '_ABPickerDeselectGroup';
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
procedure ABPickerDeselectRecord( inPicker: ABPickerRef; inRecord: ABRecordRef ); external name '_ABPickerDeselectRecord';
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
procedure ABPickerDeselectIdentifier( inPicker: ABPickerRef; inPerson: ABPersonRef; inIdentifier: CFStringRef ); external name '_ABPickerDeselectIdentifier';

// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
procedure ABPickerDeselectAll( inPicker: ABPickerRef ); external name '_ABPickerDeselectAll';

{
 * Events and Actions
 *
 * Your delegate will be notified when the user changes the selection or displayed property of the picker.
 * Picker events have an event class of kEventClassABPeoplePicker and one of the kinds listed below. Picker
 * events contain an event parameter which contains the ABPickerRef. To obtain this:
 *
 * GetEventParameter(inEvent, kEventParamABPickerRef,
 *                   typeCFTypeRef, NULL, sizeof(ABPickerRef),
 *                   NULL, &outPickerRef);
 *
 }

const
    // Carbon Event class for People Picker
    kEventClassABPeoplePicker = $61627070 (* 'abpp' *);

const
    // Carbon Event kinds for People Picker
    kEventABPeoplePickerGroupSelectionChanged     = 1;
    kEventABPeoplePickerNameSelectionChanged      = 2;
    kEventABPeoplePickerValueSelectionChanged     = 3;
    kEventABPeoplePickerDisplayedPropertyChanged  = 4;

    kEventABPeoplePickerGroupDoubleClicked        = 5;
    kEventABPeoplePickerNameDoubleClicked         = 6;

const
    // Carbon Event parameter name
    kEventParamABPickerRef  =  $61627070 (* 'abpp' *);

    // Set the event handler for People Picker events.
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
procedure ABPickerSetDelegate( inPicker: ABPickerRef; inDelegate: HIObjectRef ); external name '_ABPickerSetDelegate';
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function ABPickerGetDelegate( inPicker: ABPickerRef ): HIObjectRef; external name '_ABPickerGetDelegate';

    // Clear the search field and reset the list of displayed names.
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
procedure ABPickerClearSearchField( inPicker: ABPickerRef ); external name '_ABPickerClearSearchField';

    // Launch AddressBook and edit the current selection
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
procedure ABPickerEditInAddressBook( inPicker: ABPickerRef ); external name '_ABPickerEditInAddressBook';
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
procedure ABPickerSelectInAddressBook( inPicker: ABPickerRef ); external name '_ABPickerSelectInAddressBook';
{unit AEHelpers}
{$ALIGN MAC68K}








{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}

{
 * AEBuild is only available for C programmers.
 }
{
 * AEPrintDescToHandle
 *
 * AEPrintDescToHandle provides a way to turn an AEDesc into a textual
 * representation.  This is most useful for debugging calls to
 * AEBuildDesc and friends.  The Handle returned should be disposed by
 * the caller.  The size of the handle is the actual number of
 * characters in the string.
 }
{
 *  AEPrintDescToHandle()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function AEPrintDescToHandle(const (*var*) desc: AEDesc; var result: Handle): OSStatus; external name '_AEPrintDescToHandle';

{
 * AEStream:
 *
 * The AEStream interface allows you to build AppleEvents by appending
 * to an opaque structure (an AEStreamRef) and then turning this
 * structure into an AppleEvent.  The basic idea is to open the
 * stream, write data, and then close it - closing it produces an
 * AEDesc, which may be partially complete, or may be a complete
 * AppleEvent.
 }

type
    AEStreamRef    = ^SInt32; { an opaque 32-bit type }
    AEStreamRefPtr = ^AEStreamRef;  { when a var xx:AEStreamRef parameter can be nil, it is changed to xx: AEStreamRefPtr }
    {
       Create and return an AEStreamRef
       Returns NULL on memory allocation failure
    }
    {
     *  AEStreamOpen()
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.1 and later
     *    Mac OS X:         in version 10.0 and later
        }
function AEStreamOpen: AEStreamRef; external name '_AEStreamOpen';

{
   Closes and disposes of an AEStreamRef, producing
   results in the desc.  You must dispose of the desc yourself.
   If you just want to dispose of the AEStreamRef, you can pass NULL for desc.
}
{
 *  AEStreamClose()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function AEStreamClose(ref: AEStreamRef; var desc: AEDesc): OSStatus; external name '_AEStreamClose';

{
   Prepares an AEStreamRef for appending data to a newly created desc.
   You append data with AEStreamWriteData
}
{
 *  AEStreamOpenDesc()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function AEStreamOpenDesc(ref: AEStreamRef; newType: DescType): OSStatus; external name '_AEStreamOpenDesc';

{  Append data to the previously opened desc. }
{
 *  AEStreamWriteData()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function AEStreamWriteData(ref: AEStreamRef; data: UnivPtr; length: Size): OSStatus; external name '_AEStreamWriteData';

{
   Finish a desc.  After this, you can close the stream, or adding new
   descs, if you're assembling a list.
}
{
 *  AEStreamCloseDesc()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function AEStreamCloseDesc(ref: AEStreamRef): OSStatus; external name '_AEStreamCloseDesc';

{  Write data as a desc to the stream }
{
 *  AEStreamWriteDesc()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function AEStreamWriteDesc(ref: AEStreamRef; newType: DescType; data: UnivPtr; length: Size): OSStatus; external name '_AEStreamWriteDesc';

{  Write an entire desc to the stream }
{
 *  AEStreamWriteAEDesc()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function AEStreamWriteAEDesc(ref: AEStreamRef; const (*var*) desc: AEDesc): OSStatus; external name '_AEStreamWriteAEDesc';

{
   Begin a list.  You can then append to the list by doing
   AEStreamOpenDesc, or AEStreamWriteDesc.
}
{
 *  AEStreamOpenList()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function AEStreamOpenList(ref: AEStreamRef): OSStatus; external name '_AEStreamOpenList';

{  Finish a list. }
{
 *  AEStreamCloseList()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function AEStreamCloseList(ref: AEStreamRef): OSStatus; external name '_AEStreamCloseList';

{
   Begin a record.  A record usually has type 'reco', however, this is
   rather generic, and frequently a different type is used.
}
{
 *  AEStreamOpenRecord()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function AEStreamOpenRecord(ref: AEStreamRef; newType: DescType): OSStatus; external name '_AEStreamOpenRecord';

{  Change the type of a record. }
{
 *  AEStreamSetRecordType()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function AEStreamSetRecordType(ref: AEStreamRef; newType: DescType): OSStatus; external name '_AEStreamSetRecordType';

{  Finish a record }
{
 *  AEStreamCloseRecord()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function AEStreamCloseRecord(ref: AEStreamRef): OSStatus; external name '_AEStreamCloseRecord';

{
   Add a keyed descriptor to a record.  This is analogous to AEPutParamDesc.
   it can only be used when writing to a record.
}
{
 *  AEStreamWriteKeyDesc()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function AEStreamWriteKeyDesc(ref: AEStreamRef; key: AEKeyword; newType: DescType; data: UnivPtr; length: Size): OSStatus; external name '_AEStreamWriteKeyDesc';

{
   OpenDesc for a keyed record entry.  You can youse AEStreamWriteData
   after opening a keyed desc.
}
{
 *  AEStreamOpenKeyDesc()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function AEStreamOpenKeyDesc(ref: AEStreamRef; key: AEKeyword; newType: DescType): OSStatus; external name '_AEStreamOpenKeyDesc';

{  Write a key to the stream - you can follow this with an AEWriteDesc. }
{
 *  AEStreamWriteKey()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function AEStreamWriteKey(ref: AEStreamRef; key: AEKeyword): OSStatus; external name '_AEStreamWriteKey';

{
   Create a complete AppleEvent.  This creates and returns a new stream.
   Use this call to populate the meta fields in an AppleEvent record.
   After this, you can add your records, lists and other parameters.
}
{
 *  AEStreamCreateEvent()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function AEStreamCreateEvent(clazz: AEEventClass; id: AEEventID; targetType: DescType; targetData: UnivPtr; targetLength: SInt32; returnID: SInt16; transactionID: SInt32): AEStreamRef; external name '_AEStreamCreateEvent';

{
   This call lets you augment an existing AppleEvent using the stream
   APIs.  This would be useful, for example, in constructing the reply
   record in an AppleEvent handler.  Note that AEStreamOpenEvent will
   consume the AppleEvent passed in - you can't access it again until the
   stream is closed.  When you're done building the event, AEStreamCloseStream
    will reconstitute it.
}
{
 *  AEStreamOpenEvent()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function AEStreamOpenEvent(var event: AppleEvent): AEStreamRef; external name '_AEStreamOpenEvent';

{  Mark a keyword as being an optional parameter. }
{
 *  AEStreamOptionalParam()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function AEStreamOptionalParam(ref: AEStreamRef; key: AEKeyword): OSStatus; external name '_AEStreamOptionalParam';

{$ALIGN MAC68K}
{#POP}
{unit AEObjects}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}


const
                                                                { *** LOGICAL OPERATOR CONSTANTS  *** }
    kAEAND                      = $414E4420 (* 'AND ' *);                       {   0x414e4420   }
    kAEOR                       = $4F522020 (* 'OR  ' *);                       {   0x4f522020   }
    kAENOT                      = $4E4F5420 (* 'NOT ' *);                       {   0x4e4f5420   }
                                                                { *** ABSOLUTE ORDINAL CONSTANTS  *** }
    kAEFirst                    = $66697273 (* 'firs' *);                       {   0x66697273   }
    kAELast                     = $6C617374 (* 'last' *);                       {   0x6c617374   }
    kAEMiddle                   = $6D696464 (* 'midd' *);                       {   0x6d696464   }
    kAEAny                      = $616E7920 (* 'any ' *);                       {   0x616e7920   }
    kAEAll                      = $616C6C20 (* 'all ' *);                       {   0x616c6c20   }
                                                                { *** RELATIVE ORDINAL CONSTANTS  *** }
    kAENext                     = $6E657874 (* 'next' *);                       {   0x6e657874   }
    kAEPrevious                 = $70726576 (* 'prev' *);                       {   0x70726576   }
                                                                { *** KEYWORD CONSTANT    *** }
    keyAECompOperator           = $72656C6F (* 'relo' *);                       {   0x72656c6f   }
    keyAELogicalTerms           = $7465726D (* 'term' *);                       {   0x7465726d   }
    keyAELogicalOperator        = $6C6F6763 (* 'logc' *);                       {   0x6c6f6763   }
    keyAEObject1                = $6F626A31 (* 'obj1' *);                       {   0x6f626a31   }
    keyAEObject2                = $6F626A32 (* 'obj2' *);                       {   0x6f626a32   }
                                                                {     ... for Keywords for getting fields out of object specifier records.  }
    keyAEDesiredClass           = $77616E74 (* 'want' *);                       {   0x77616e74   }
    keyAEContainer              = $66726F6D (* 'from' *);                       {   0x66726f6d   }
    keyAEKeyForm                = $666F726D (* 'form' *);                       {   0x666f726d   }
    keyAEKeyData                = $73656C64 (* 'seld' *);                       {   0x73656c64   }

                                                                {     ... for Keywords for getting fields out of Range specifier records.  }
    keyAERangeStart             = $73746172 (* 'star' *);                       {   0x73746172   }
    keyAERangeStop              = $73746F70 (* 'stop' *);                       {   0x73746f70   }
                                                                {     ... special handler selectors for OSL Callbacks.  }
    keyDisposeTokenProc         = $78746F6B (* 'xtok' *);                       {   0x78746f6b   }
    keyAECompareProc            = $636D7072 (* 'cmpr' *);                       {   0x636d7072   }
    keyAECountProc              = $636F6E74 (* 'cont' *);                       {   0x636f6e74   }
    keyAEMarkTokenProc          = $6D6B6964 (* 'mkid' *);                       {   0x6d6b6964   }
    keyAEMarkProc               = $6D61726B (* 'mark' *);                       {   0x6d61726b   }
    keyAEAdjustMarksProc        = $61646A6D (* 'adjm' *);                       {   0x61646a6d   }
    keyAEGetErrDescProc         = $696E6463 (* 'indc' *);                       {   0x696e6463   }

    {   ***   VALUE and type CONSTANTS    ***   }
                                                                {     ... possible values for the keyAEKeyForm field of an object specifier.  }
    formAbsolutePosition        = $696E6478 (* 'indx' *);                       {   0x696e6478   }
    formRelativePosition        = $72656C65 (* 'rele' *);                       {   0x72656c65   }
    formTest                    = $74657374 (* 'test' *);                       {   0x74657374   }
    formRange                   = $72616E67 (* 'rang' *);                       {   0x72616e67   }
    formPropertyID              = $70726F70 (* 'prop' *);                       {   0x70726f70   }
    formName                    = $6E616D65 (* 'name' *);                       {   0x6e616d65   }
                                                                {     ... relevant types (some of these are often pared with forms above).  }
    typeObjectSpecifier         = $6F626A20 (* 'obj ' *);                       {   0x6f626a20   }
    typeObjectBeingExamined     = $65786D6E (* 'exmn' *);                       {   0x65786d6e   }
    typeCurrentContainer        = $63636E74 (* 'ccnt' *);                       {   0x63636e74   }
    typeToken                   = $746F6B65 (* 'toke' *);                       {   0x746f6b65   }
    typeRelativeDescriptor      = $72656C20 (* 'rel ' *);                       {   0x72656c20   }
    typeAbsoluteOrdinal         = $6162736F (* 'abso' *);                       {   0x6162736f   }
    typeIndexDescriptor         = $696E6465 (* 'inde' *);                       {   0x696e6465   }
    typeRangeDescriptor         = $72616E67 (* 'rang' *);                       {   0x72616e67   }
    typeLogicalDescriptor       = $6C6F6769 (* 'logi' *);                       {   0x6c6f6769   }
    typeCompDescriptor          = $636D7064 (* 'cmpd' *);                       {   0x636d7064   }
    typeOSLTokenList            = $6F73746C (* 'ostl' *);                       {   0x6F73746C   }

    {    Possible values for flags parameter to AEResolve.  They're additive    }
    kAEIDoMinimum               = $0000;
    kAEIDoWhose                 = $0001;
    kAEIDoMarking               = $0004;
    kAEPassSubDescs             = $0008;
    kAEResolveNestedLists       = $0010;
    kAEHandleSimpleRanges       = $0020;
    kAEUseRelativeIterators     = $0040;

    {   *** SPECIAL CONSTANTS FOR CUSTOM WHOSE-CLAUSE RESOLUTION    }
    typeWhoseDescriptor         = $77686F73 (* 'whos' *);                       {   0x77686f73   }
    formWhose                   = $77686F73 (* 'whos' *);                       {   0x77686f73   }
    typeWhoseRange              = $77726E67 (* 'wrng' *);                       {   0x77726e67   }
    keyAEWhoseRangeStart        = $77737472 (* 'wstr' *);                       {   0x77737472   }
    keyAEWhoseRangeStop         = $77737470 (* 'wstp' *);                       {   0x77737470   }
    keyAEIndex                  = $6B696478 (* 'kidx' *);                       {   0x6b696478   }
    keyAETest                   = $6B747374 (* 'ktst' *);                       {   0x6b747374   }

    {
        used for rewriting tokens in place of 'ccnt' descriptors
        This record is only of interest to those who, when they...
        ...get ranges as key data in their accessor procs, choose
        ...to resolve them manually rather than call AEResolve again.
        }

type
    ccntTokenRecordPtr = ^ccntTokenRecord;
    ccntTokenRecord = record
        tokenClass:             DescType;
        token:                  AEDesc;
    end;

    ccntTokenRecPtr                     = ^ccntTokenRecord;
    ccntTokenRecHandle                  = ^ccntTokenRecPtr;

    {    typedefs providing type checking for procedure pointers    }
    OSLAccessorProcPtr = function(desiredClass: DescType; const (*var*) container: AEDesc; containerClass: DescType; form: DescType; const (*var*) selectionData: AEDesc; var value: AEDesc; accessorRefcon: SInt32): OSErr;

    OSLCompareProcPtr = function(oper: DescType; const (*var*) obj1: AEDesc; const (*var*) obj2: AEDesc; var result: boolean): OSErr;

    OSLCountProcPtr = function(desiredType: DescType; containerClass: DescType; const (*var*) container: AEDesc; var result: SInt32): OSErr;

    OSLDisposeTokenProcPtr = function(var unneededToken: AEDesc): OSErr;

    OSLGetMarkTokenProcPtr = function(const (*var*) dContainerToken: AEDesc; containerClass: DescType; var result: AEDesc): OSErr;

    OSLGetErrDescProcPtr = function(var appDescPtr: AEDescPtr): OSErr;

    OSLMarkProcPtr = function(const (*var*) dToken: AEDesc; const (*var*) markToken: AEDesc; index: SInt32): OSErr;

    OSLAdjustMarksProcPtr = function(newStart: SInt32; newStop: SInt32; const (*var*) markToken: AEDesc): OSErr;

    OSLAccessorUPP = ^SInt32; { an opaque UPP }
    OSLCompareUPP = ^SInt32; { an opaque UPP }
    OSLCountUPP = ^SInt32; { an opaque UPP }
    OSLDisposeTokenUPP = ^SInt32; { an opaque UPP }
    OSLGetMarkTokenUPP = ^SInt32; { an opaque UPP }
    OSLGetErrDescUPP = ^SInt32; { an opaque UPP }
    OSLMarkUPP = ^SInt32; { an opaque UPP }
    OSLAdjustMarksUPP = ^SInt32; { an opaque UPP }

const
    uppOSLAccessorProcInfo = $000FFFE0;
    uppOSLCompareProcInfo = $00003FE0;
    uppOSLCountProcInfo = $00003FE0;
    uppOSLDisposeTokenProcInfo = $000000E0;
    uppOSLGetMarkTokenProcInfo = $00000FE0;
    uppOSLGetErrDescProcInfo = $000000E0;
    uppOSLMarkProcInfo = $00000FE0;
    uppOSLAdjustMarksProcInfo = $00000FE0;
    {
     *  NewOSLAccessorUPP()
     *
     *  Availability:
     *    Non-Carbon CFM:   available as macro/inline
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function NewOSLAccessorUPP(userRoutine: OSLAccessorProcPtr): OSLAccessorUPP; external name '_NewOSLAccessorUPP'; { old name was NewOSLAccessorProc }
{
 *  NewOSLCompareUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewOSLCompareUPP(userRoutine: OSLCompareProcPtr): OSLCompareUPP; external name '_NewOSLCompareUPP'; { old name was NewOSLCompareProc }
{
 *  NewOSLCountUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewOSLCountUPP(userRoutine: OSLCountProcPtr): OSLCountUPP; external name '_NewOSLCountUPP'; { old name was NewOSLCountProc }
{
 *  NewOSLDisposeTokenUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewOSLDisposeTokenUPP(userRoutine: OSLDisposeTokenProcPtr): OSLDisposeTokenUPP; external name '_NewOSLDisposeTokenUPP'; { old name was NewOSLDisposeTokenProc }
{
 *  NewOSLGetMarkTokenUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewOSLGetMarkTokenUPP(userRoutine: OSLGetMarkTokenProcPtr): OSLGetMarkTokenUPP; external name '_NewOSLGetMarkTokenUPP'; { old name was NewOSLGetMarkTokenProc }
{
 *  NewOSLGetErrDescUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewOSLGetErrDescUPP(userRoutine: OSLGetErrDescProcPtr): OSLGetErrDescUPP; external name '_NewOSLGetErrDescUPP'; { old name was NewOSLGetErrDescProc }
{
 *  NewOSLMarkUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewOSLMarkUPP(userRoutine: OSLMarkProcPtr): OSLMarkUPP; external name '_NewOSLMarkUPP'; { old name was NewOSLMarkProc }
{
 *  NewOSLAdjustMarksUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewOSLAdjustMarksUPP(userRoutine: OSLAdjustMarksProcPtr): OSLAdjustMarksUPP; external name '_NewOSLAdjustMarksUPP'; { old name was NewOSLAdjustMarksProc }
{
 *  DisposeOSLAccessorUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeOSLAccessorUPP(userUPP: OSLAccessorUPP); external name '_DisposeOSLAccessorUPP';
{
 *  DisposeOSLCompareUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeOSLCompareUPP(userUPP: OSLCompareUPP); external name '_DisposeOSLCompareUPP';
{
 *  DisposeOSLCountUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeOSLCountUPP(userUPP: OSLCountUPP); external name '_DisposeOSLCountUPP';
{
 *  DisposeOSLDisposeTokenUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeOSLDisposeTokenUPP(userUPP: OSLDisposeTokenUPP); external name '_DisposeOSLDisposeTokenUPP';
{
 *  DisposeOSLGetMarkTokenUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeOSLGetMarkTokenUPP(userUPP: OSLGetMarkTokenUPP); external name '_DisposeOSLGetMarkTokenUPP';
{
 *  DisposeOSLGetErrDescUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeOSLGetErrDescUPP(userUPP: OSLGetErrDescUPP); external name '_DisposeOSLGetErrDescUPP';
{
 *  DisposeOSLMarkUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeOSLMarkUPP(userUPP: OSLMarkUPP); external name '_DisposeOSLMarkUPP';
{
 *  DisposeOSLAdjustMarksUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeOSLAdjustMarksUPP(userUPP: OSLAdjustMarksUPP); external name '_DisposeOSLAdjustMarksUPP';
{
 *  InvokeOSLAccessorUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeOSLAccessorUPP(desiredClass: DescType; const (*var*) container: AEDesc; containerClass: DescType; form: DescType; const (*var*) selectionData: AEDesc; var value: AEDesc; accessorRefcon: SInt32; userRoutine: OSLAccessorUPP): OSErr; external name '_InvokeOSLAccessorUPP'; { old name was CallOSLAccessorProc }
{
 *  InvokeOSLCompareUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeOSLCompareUPP(oper: DescType; const (*var*) obj1: AEDesc; const (*var*) obj2: AEDesc; var result: boolean; userRoutine: OSLCompareUPP): OSErr; external name '_InvokeOSLCompareUPP'; { old name was CallOSLCompareProc }
{
 *  InvokeOSLCountUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeOSLCountUPP(desiredType: DescType; containerClass: DescType; const (*var*) container: AEDesc; var result: SInt32; userRoutine: OSLCountUPP): OSErr; external name '_InvokeOSLCountUPP'; { old name was CallOSLCountProc }
{
 *  InvokeOSLDisposeTokenUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeOSLDisposeTokenUPP(var unneededToken: AEDesc; userRoutine: OSLDisposeTokenUPP): OSErr; external name '_InvokeOSLDisposeTokenUPP'; { old name was CallOSLDisposeTokenProc }
{
 *  InvokeOSLGetMarkTokenUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeOSLGetMarkTokenUPP(const (*var*) dContainerToken: AEDesc; containerClass: DescType; var result: AEDesc; userRoutine: OSLGetMarkTokenUPP): OSErr; external name '_InvokeOSLGetMarkTokenUPP'; { old name was CallOSLGetMarkTokenProc }
{
 *  InvokeOSLGetErrDescUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeOSLGetErrDescUPP(var appDescPtr: AEDescPtr; userRoutine: OSLGetErrDescUPP): OSErr; external name '_InvokeOSLGetErrDescUPP'; { old name was CallOSLGetErrDescProc }
{
 *  InvokeOSLMarkUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeOSLMarkUPP(const (*var*) dToken: AEDesc; const (*var*) markToken: AEDesc; index: SInt32; userRoutine: OSLMarkUPP): OSErr; external name '_InvokeOSLMarkUPP'; { old name was CallOSLMarkProc }
{
 *  InvokeOSLAdjustMarksUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeOSLAdjustMarksUPP(newStart: SInt32; newStop: SInt32; const (*var*) markToken: AEDesc; userRoutine: OSLAdjustMarksUPP): OSErr; external name '_InvokeOSLAdjustMarksUPP'; { old name was CallOSLAdjustMarksProc }
{
 *  AEObjectInit()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ObjectSupportLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function AEObjectInit: OSErr; external name '_AEObjectInit';

{ Not done by inline, but by direct linking into code.  It sets up the pack
  such that further calls can be via inline }
{
 *  AESetObjectCallbacks()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ObjectSupportLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function AESetObjectCallbacks(myCompareProc: OSLCompareUPP; myCountProc: OSLCountUPP; myDisposeTokenProc: OSLDisposeTokenUPP; myGetMarkTokenProc: OSLGetMarkTokenUPP; myMarkProc: OSLMarkUPP; myAdjustMarksProc: OSLAdjustMarksUPP; myGetErrDescProcPtr: OSLGetErrDescUPP): OSErr; external name '_AESetObjectCallbacks';
{
 *  AEResolve()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ObjectSupportLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function AEResolve(const (*var*) objectSpecifier: AEDesc; callbackFlags: SInt16; var theToken: AEDesc): OSErr; external name '_AEResolve';
{
 *  AEInstallObjectAccessor()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ObjectSupportLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function AEInstallObjectAccessor(desiredClass: DescType; containerType: DescType; theAccessor: OSLAccessorUPP; accessorRefcon: SInt32; isSysHandler: boolean): OSErr; external name '_AEInstallObjectAccessor';
{
 *  AERemoveObjectAccessor()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ObjectSupportLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function AERemoveObjectAccessor(desiredClass: DescType; containerType: DescType; theAccessor: OSLAccessorUPP; isSysHandler: boolean): OSErr; external name '_AERemoveObjectAccessor';
{
 *  AEGetObjectAccessor()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ObjectSupportLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function AEGetObjectAccessor(desiredClass: DescType; containerType: DescType; var accessor: OSLAccessorUPP; var accessorRefcon: SInt32; isSysHandler: boolean): OSErr; external name '_AEGetObjectAccessor';
{
 *  AEDisposeToken()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ObjectSupportLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function AEDisposeToken(var theToken: AEDesc): OSErr; external name '_AEDisposeToken';
{
 *  AECallObjectAccessor()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ObjectSupportLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function AECallObjectAccessor(desiredClass: DescType; const (*var*) containerToken: AEDesc; containerClass: DescType; keyForm: DescType; const (*var*) keyData: AEDesc; var token: AEDesc): OSErr; external name '_AECallObjectAccessor';
{$ALIGN MAC68K}
{#POP}
{unit AEPackObject}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}

{ These are the object packing routines.  }
{
 *  CreateOffsetDescriptor()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ObjectSupportLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CreateOffsetDescriptor(theOffset: SInt32; var theDescriptor: AEDesc): OSErr; external name '_CreateOffsetDescriptor';

{
 *  CreateCompDescriptor()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ObjectSupportLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CreateCompDescriptor(comparisonOperator: DescType; var operand1: AEDesc; var operand2: AEDesc; disposeInputs: boolean; var theDescriptor: AEDesc): OSErr; external name '_CreateCompDescriptor';

{
 *  CreateLogicalDescriptor()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ObjectSupportLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CreateLogicalDescriptor(var theLogicalTerms: AEDescList; theLogicOperator: DescType; disposeInputs: boolean; var theDescriptor: AEDesc): OSErr; external name '_CreateLogicalDescriptor';


{
 *  CreateObjSpecifier()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ObjectSupportLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CreateObjSpecifier(desiredClass: DescType; var theContainer: AEDesc; keyForm: DescType; var keyData: AEDesc; disposeInputs: boolean; var objSpecifier: AEDesc): OSErr; external name '_CreateObjSpecifier';

{
 *  CreateRangeDescriptor()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ObjectSupportLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CreateRangeDescriptor(var rangeStart: AEDesc; var rangeStop: AEDesc; disposeInputs: boolean; var theDescriptor: AEDesc): OSErr; external name '_CreateRangeDescriptor';

{$ALIGN MAC68K}
{#POP}
{unit AERegistry}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}


const
    cAEList                     = $6C697374 (* 'list' *);                       {   0x6c697374   }
    cApplication                = $63617070 (* 'capp' *);                       {   0x63617070   }
    cArc                        = $63617263 (* 'carc' *);                       {   0x63617263   }
    cBoolean                    = $626F6F6C (* 'bool' *);                       {   0x626f6f6c   }
    cCell                       = $6363656C (* 'ccel' *);                       {   0x6363656c   }
    cChar                       = $63686120 (* 'cha ' *);                       {   0x63686120   }
    cColorTable                 = $636C7274 (* 'clrt' *);                       {   0x636c7274   }
    cColumn                     = $63636F6C (* 'ccol' *);                       {   0x63636f6c   }
    cDocument                   = $646F6375 (* 'docu' *);                       {   0x646f6375   }
    cDrawingArea                = $63647277 (* 'cdrw' *);                       {   0x63647277   }
    cEnumeration                = $656E756D (* 'enum' *);                       {   0x656e756d   }
    cFile                       = $66696C65 (* 'file' *);                       {   0x66696c65   }
    cFixed                      = $66697864 (* 'fixd' *);                       {   0x66697864   }
    cFixedPoint                 = $66706E74 (* 'fpnt' *);                       {   0x66706e74   }
    cFixedRectangle             = $66726374 (* 'frct' *);                       {   0x66726374   }
    cGraphicLine                = $676C696E (* 'glin' *);                       {   0x676c696e   }
    cGraphicObject              = $63676F62 (* 'cgob' *);                       {   0x63676f62   }
    cGraphicShape               = $63677368 (* 'cgsh' *);                       {   0x63677368   }
    cGraphicText                = $63677478 (* 'cgtx' *);                       {   0x63677478   }
    cGroupedGraphic             = $63706963 (* 'cpic' *);                       {   0x63706963   }

    cInsertionLoc               = $696E736C (* 'insl' *);                       {   0x696e736c   }
    cInsertionPoint             = $63696E73 (* 'cins' *);                       {   0x63696e73   }
    cIntlText                   = $69747874 (* 'itxt' *);                       {   0x69747874   }
    cIntlWritingCode            = $696E746C (* 'intl' *);                       {   0x696e746c   }
    cItem                       = $6369746D (* 'citm' *);                       {   0x6369746d   }
    cLine                       = $636C696E (* 'clin' *);                       {   0x636c696e   }
    cLongDateTime               = $6C647420 (* 'ldt ' *);                       {   0x6c647420   }
    cLongFixed                  = $6C667864 (* 'lfxd' *);                       {   0x6c667864   }
    cLongFixedPoint             = $6C667074 (* 'lfpt' *);                       {   0x6c667074   }
    cLongFixedRectangle         = $6C667263 (* 'lfrc' *);                       {   0x6c667263   }
    cLongInteger                = $6C6F6E67 (* 'long' *);                       {   0x6c6f6e67   }
    cLongPoint                  = $6C706E74 (* 'lpnt' *);                       {   0x6c706e74   }
    cLongRectangle              = $6C726374 (* 'lrct' *);                       {   0x6c726374   }
    cMachineLoc                 = $6D4C6F63 (* 'mLoc' *);                       {   0x6d4c6f63   }
    cMenu                       = $636D6E75 (* 'cmnu' *);                       {   0x636d6e75   }
    cMenuItem                   = $636D656E (* 'cmen' *);                       {   0x636d656e   }
    cObject                     = $636F626A (* 'cobj' *);                       {   0x636f626a   }
    cObjectSpecifier            = $6F626A20 (* 'obj ' *);                       {   0x6f626a20   }
    cOpenableObject             = $636F6F62 (* 'coob' *);                       {   0x636f6f62   }
    cOval                       = $636F766C (* 'covl' *);                       {   0x636f766c   }

    cParagraph                  = $63706172 (* 'cpar' *);                       {   0x63706172   }
    cPICT                       = $50494354 (* 'PICT' *);                       {   0x50494354   }
    cPixel                      = $6370786C (* 'cpxl' *);                       {   0x6370786c   }
    cPixelMap                   = $63706978 (* 'cpix' *);                       {   0x63706978   }
    cPolygon                    = $6370676E (* 'cpgn' *);                       {   0x6370676e   }
    cProperty                   = $70726F70 (* 'prop' *);                       {   0x70726f70   }
    cQDPoint                    = $51447074 (* 'QDpt' *);                       {   0x51447074   }
    cQDRectangle                = $71647274 (* 'qdrt' *);                       {   0x71647274   }
    cRectangle                  = $63726563 (* 'crec' *);                       {   0x63726563   }
    cRGBColor                   = $63524742 (* 'cRGB' *);                       {   0x63524742   }
    cRotation                   = $74726F74 (* 'trot' *);                       {   0x74726f74   }
    cRoundedRectangle           = $63727263 (* 'crrc' *);                       {   0x63727263   }
    cRow                        = $63726F77 (* 'crow' *);                       {   0x63726f77   }
    cSelection                  = $6373656C (* 'csel' *);                       {   0x6373656c   }
    cShortInteger               = $73686F72 (* 'shor' *);                       {   0x73686f72   }
    cTable                      = $6374626C (* 'ctbl' *);                       {   0x6374626c   }
    cText                       = $63747874 (* 'ctxt' *);                       {   0x63747874   }
    cTextFlow                   = $63666C6F (* 'cflo' *);                       {   0x63666c6f   }
    cTextStyles                 = $74737479 (* 'tsty' *);                       {   0x74737479   }
    cType                       = $74797065 (* 'type' *);                       {   0x74797065   }

    cVersion                    = $76657273 (* 'vers' *);                       {   0x76657273   }
    cWindow                     = $6377696E (* 'cwin' *);                       {   0x6377696e   }
    cWord                       = $63776F72 (* 'cwor' *);                       {   0x63776f72   }
    enumArrows                  = $6172726F (* 'arro' *);                       {   0x6172726f   }
    enumJustification           = $6A757374 (* 'just' *);                       {   0x6a757374   }
    enumKeyForm                 = $6B66726D (* 'kfrm' *);                       {   0x6b66726d   }
    enumPosition                = $706F7369 (* 'posi' *);                       {   0x706f7369   }
    enumProtection              = $7072746E (* 'prtn' *);                       {   0x7072746e   }
    enumQuality                 = $7175616C (* 'qual' *);                       {   0x7175616c   }
    enumSaveOptions             = $7361766F (* 'savo' *);                       {   0x7361766f   }
    enumStyle                   = $7374796C (* 'styl' *);                       {   0x7374796c   }
    enumTransferMode            = $7472616E (* 'tran' *);                       {   0x7472616e   }
    formUniqueID                = $49442020 (* 'ID  ' *);                       {   0x49442020   }
    kAEAbout                    = $61626F75 (* 'abou' *);                       {   0x61626f75   }
    kAEAfter                    = $61667465 (* 'afte' *);                       {   0x61667465   }
    kAEAliasSelection           = $73616C69 (* 'sali' *);                       {   0x73616c69   }
    kAEAllCaps                  = $616C6370 (* 'alcp' *);                       {   0x616c6370   }
    kAEArrowAtEnd               = $6172656E (* 'aren' *);                       {   0x6172656e   }
    kAEArrowAtStart             = $61727374 (* 'arst' *);                       {   0x61727374   }
    kAEArrowBothEnds            = $6172626F (* 'arbo' *);                       {   0x6172626f   }

    kAEAsk                      = $61736B20 (* 'ask ' *);                       {   0x61736b20   }
    kAEBefore                   = $6265666F (* 'befo' *);                       {   0x6265666f   }
    kAEBeginning                = $62676E67 (* 'bgng' *);                       {   0x62676e67   }
    kAEBeginsWith               = $62677774 (* 'bgwt' *);                       {   0x62677774   }
    kAEBeginTransaction         = $62656769 (* 'begi' *);                       {   0x62656769   }
    kAEBold                     = $626F6C64 (* 'bold' *);                       {   0x626f6c64   }
    kAECaseSensEquals           = $63736571 (* 'cseq' *);                       {   0x63736571   }
    kAECentered                 = $63656E74 (* 'cent' *);                       {   0x63656e74   }
    kAEChangeView               = $76696577 (* 'view' *);                       {   0x76696577   }
    kAEClone                    = $636C6F6E (* 'clon' *);                       {   0x636c6f6e   }
    kAEClose                    = $636C6F73 (* 'clos' *);                       {   0x636c6f73   }
    kAECondensed                = $636F6E64 (* 'cond' *);                       {   0x636f6e64   }
    kAEContains                 = $636F6E74 (* 'cont' *);                       {   0x636f6e74   }
    kAECopy                     = $636F7079 (* 'copy' *);                       {   0x636f7079   }
    kAECoreSuite                = $636F7265 (* 'core' *);                       {   0x636f7265   }
    kAECountElements            = $636E7465 (* 'cnte' *);                       {   0x636e7465   }
    kAECreateElement            = $6372656C (* 'crel' *);                       {   0x6372656c   }
    kAECreatePublisher          = $63707562 (* 'cpub' *);                       {   0x63707562   }
    kAECut                      = $63757420 (* 'cut ' *);                       {   0x63757420   }
    kAEDelete                   = $64656C6F (* 'delo' *);                       {   0x64656c6f   }

    kAEDoObjectsExist           = $646F6578 (* 'doex' *);                       {   0x646f6578   }
    kAEDoScript                 = $646F7363 (* 'dosc' *);                       {   0x646f7363   }
    kAEDrag                     = $64726167 (* 'drag' *);                       {   0x64726167   }
    kAEDuplicateSelection       = $73647570 (* 'sdup' *);                       {   0x73647570   }
    kAEEditGraphic              = $65646974 (* 'edit' *);                       {   0x65646974   }
    kAEEmptyTrash               = $656D7074 (* 'empt' *);                       {   0x656d7074   }
    kAEEnd                      = $656E6420 (* 'end ' *);                       {   0x656e6420   }
    kAEEndsWith                 = $656E6473 (* 'ends' *);                       {   0x656e6473   }
    kAEEndTransaction           = $656E6474 (* 'endt' *);                       {   0x656e6474   }
    kAEEquals                   = $3D202020 (* '=   ' *);                       {   0x3d202020   }
    kAEExpanded                 = $70657870 (* 'pexp' *);                       {   0x70657870   }
    kAEFast                     = $66617374 (* 'fast' *);                       {   0x66617374   }
    kAEFinderEvents             = $464E4452 (* 'FNDR' *);                       {   0x464e4452   }
    kAEFormulaProtect           = $6670726F (* 'fpro' *);                       {   0x6670726f   }
    kAEFullyJustified           = $66756C6C (* 'full' *);                       {   0x66756c6c   }
    kAEGetClassInfo             = $716F626A (* 'qobj' *);                       {   0x716f626a   }
    kAEGetData                  = $67657464 (* 'getd' *);                       {   0x67657464   }
    kAEGetDataSize              = $6473697A (* 'dsiz' *);                       {   0x6473697a   }
    kAEGetEventInfo             = $67746569 (* 'gtei' *);                       {   0x67746569   }
    kAEGetInfoSelection         = $73696E66 (* 'sinf' *);                       {   0x73696e66   }

    kAEGetPrivilegeSelection    = $73707276 (* 'sprv' *);                       {   0x73707276   }
    kAEGetSuiteInfo             = $67747369 (* 'gtsi' *);                       {   0x67747369   }
    kAEGreaterThan              = $3E202020 (* '>   ' *);                       {   0x3e202020   }
    kAEGreaterThanEquals        = $3E3D2020 (* '>=  ' *);                       {   0x3e3d2020   }
    kAEGrow                     = $67726F77 (* 'grow' *);                       {   0x67726f77   }
    kAEHidden                   = $6869646E (* 'hidn' *);                       {   0x6869646e   }
    kAEHiQuality                = $68697175 (* 'hiqu' *);                       {   0x68697175   }
    kAEImageGraphic             = $696D6772 (* 'imgr' *);                       {   0x696d6772   }
    kAEIsUniform                = $6973756E (* 'isun' *);                       {   0x6973756e   }
    kAEItalic                   = $6974616C (* 'ital' *);                       {   0x6974616c   }
    kAELeftJustified            = $6C656674 (* 'left' *);                       {   0x6c656674   }
    kAELessThan                 = $3C202020 (* '<   ' *);                       {   0x3c202020   }
    kAELessThanEquals           = $3C3D2020 (* '<=  ' *);                       {   0x3c3d2020   }
    kAELowercase                = $6C6F7763 (* 'lowc' *);                       {   0x6c6f7763   }
    kAEMakeObjectsVisible       = $6D766973 (* 'mvis' *);                       {   0x6d766973   }
    kAEMiscStandards            = $6D697363 (* 'misc' *);                       {   0x6d697363   }
    kAEModifiable               = $6D6F6466 (* 'modf' *);                       {   0x6d6f6466   }
    kAEMove                     = $6D6F7665 (* 'move' *);                       {   0x6d6f7665   }
    kAENo                       = $6E6F2020 (* 'no  ' *);                       {   0x6e6f2020   }
    kAENoArrow                  = $61726E6F (* 'arno' *);                       {   0x61726e6f   }

    kAENonmodifiable            = $6E6D6F64 (* 'nmod' *);                       {   0x6e6d6f64   }
    kAEOpen                     = $6F646F63 (* 'odoc' *);                       {   0x6f646f63   }
    kAEOpenSelection            = $736F7065 (* 'sope' *);                       {   0x736f7065   }
    kAEOutline                  = $6F75746C (* 'outl' *);                       {   0x6f75746c   }
    kAEPageSetup                = $70677375 (* 'pgsu' *);                       {   0x70677375   }
    kAEPaste                    = $70617374 (* 'past' *);                       {   0x70617374   }
    kAEPlain                    = $706C616E (* 'plan' *);                       {   0x706c616e   }
    kAEPrint                    = $70646F63 (* 'pdoc' *);                       {   0x70646f63   }
    kAEPrintSelection           = $73707269 (* 'spri' *);                       {   0x73707269   }
    kAEPrintWindow              = $7077696E (* 'pwin' *);                       {   0x7077696e   }
    kAEPutAwaySelection         = $73707574 (* 'sput' *);                       {   0x73707574   }
    kAEQDAddOver                = $6164646F (* 'addo' *);                       {   0x6164646f   }
    kAEQDAddPin                 = $61646470 (* 'addp' *);                       {   0x61646470   }
    kAEQDAdMax                  = $61646D78 (* 'admx' *);                       {   0x61646d78   }
    kAEQDAdMin                  = $61646D6E (* 'admn' *);                       {   0x61646d6e   }
    kAEQDBic                    = $62696320 (* 'bic ' *);                       {   0x62696320   }
    kAEQDBlend                  = $626C6E64 (* 'blnd' *);                       {   0x626c6e64   }
    kAEQDCopy                   = $63707920 (* 'cpy ' *);                       {   0x63707920   }
    kAEQDNotBic                 = $6E626963 (* 'nbic' *);                       {   0x6e626963   }
    kAEQDNotCopy                = $6E637079 (* 'ncpy' *);                       {   0x6e637079   }

    kAEQDNotOr                  = $6E746F72 (* 'ntor' *);                       {   0x6e746f72   }
    kAEQDNotXor                 = $6E786F72 (* 'nxor' *);                       {   0x6e786f72   }
    kAEQDOr                     = $6F722020 (* 'or  ' *);                       {   0x6f722020   }
    kAEQDSubOver                = $7375626F (* 'subo' *);                       {   0x7375626f   }
    kAEQDSubPin                 = $73756270 (* 'subp' *);                       {   0x73756270   }
    kAEQDSupplementalSuite      = $71647370 (* 'qdsp' *);                       {   0x71647370   }
    kAEQDXor                    = $786F7220 (* 'xor ' *);                       {   0x786f7220   }
    kAEQuickdrawSuite           = $71647277 (* 'qdrw' *);                       {   0x71647277   }
    kAEQuitAll                  = $71756961 (* 'quia' *);                       {   0x71756961   }
    kAERedo                     = $7265646F (* 'redo' *);                       {   0x7265646f   }
    kAERegular                  = $7265676C (* 'regl' *);                       {   0x7265676c   }
    kAEReopenApplication        = $72617070 (* 'rapp' *);                       {   0x72617070   }
    kAEReplace                  = $72706C63 (* 'rplc' *);                       {   0x72706c63   }
    kAERequiredSuite            = $72657164 (* 'reqd' *);                       {   0x72657164   }
    kAERestart                  = $72657374 (* 'rest' *);                       {   0x72657374   }
    kAERevealSelection          = $73726576 (* 'srev' *);                       {   0x73726576   }
    kAERevert                   = $72767274 (* 'rvrt' *);                       {   0x72767274   }
    kAERightJustified           = $72676874 (* 'rght' *);                       {   0x72676874   }
    kAESave                     = $73617665 (* 'save' *);                       {   0x73617665   }
    kAESelect                   = $736C6374 (* 'slct' *);                       {   0x736c6374   }
    kAESetData                  = $73657464 (* 'setd' *);                       {   0x73657464   }

    kAESetPosition              = $706F736E (* 'posn' *);                       {   0x706f736e   }
    kAEShadow                   = $73686164 (* 'shad' *);                       {   0x73686164   }
    kAEShowClipboard            = $7368636C (* 'shcl' *);                       {   0x7368636c   }
    kAEShutDown                 = $73687574 (* 'shut' *);                       {   0x73687574   }
    kAESleep                    = $736C6570 (* 'slep' *);                       {   0x736c6570   }
    kAESmallCaps                = $736D6370 (* 'smcp' *);                       {   0x736d6370   }
    kAESpecialClassProperties   = $63402321 (* 'c@#!' *);                       {   0x63402321   }
    kAEStrikethrough            = $7374726B (* 'strk' *);                       {   0x7374726b   }
    kAESubscript                = $73627363 (* 'sbsc' *);                       {   0x73627363   }
    kAESuperscript              = $73707363 (* 'spsc' *);                       {   0x73707363   }
    kAETableSuite               = $74626C73 (* 'tbls' *);                       {   0x74626c73   }
    kAETextSuite                = $54455854 (* 'TEXT' *);                       {   0x54455854   }
    kAETransactionTerminated    = $7474726D (* 'ttrm' *);                       {   0x7474726d   }
    kAEUnderline                = $756E646C (* 'undl' *);                       {   0x756e646c   }
    kAEUndo                     = $756E646F (* 'undo' *);                       {   0x756e646f   }
    kAEWholeWordEquals          = $77776571 (* 'wweq' *);                       {   0x77776571   }
    kAEYes                      = $79657320 (* 'yes ' *);                       {   0x79657320   }
    kAEZoom                     = $7A6F6F6D (* 'zoom' *);                       {   0x7a6f6f6d   }

    {    EventRecord Classes and EventIDs   }
    kAEMouseClass               = $6D6F7573 (* 'mous' *);
    kAEDown                     = $646F776E (* 'down' *);
    kAEUp                       = $75702020 (* 'up  ' *);
    kAEMoved                    = $6D6F7665 (* 'move' *);
    kAEStoppedMoving            = $73746F70 (* 'stop' *);
    kAEWindowClass              = $77696E64 (* 'wind' *);
    kAEUpdate                   = $75706474 (* 'updt' *);
    kAEActivate                 = $61637476 (* 'actv' *);
    kAEDeactivate               = $64616374 (* 'dact' *);
    kAECommandClass             = $636D6E64 (* 'cmnd' *);                       {  Modern Command Event Class  }
    kAEKeyClass                 = $6B657963 (* 'keyc' *);
    kAERawKey                   = $726B6579 (* 'rkey' *);                       {  Modern Raw Key Event  }
    kAEVirtualKey               = $6B657963 (* 'keyc' *);                       {  Modern Virtual Key Event  }
    kAENavigationKey            = $6E617665 (* 'nave' *);                       {  Modern Navigation Key Event  }
    kAEAutoDown                 = $6175746F (* 'auto' *);
    kAEApplicationClass         = $6170706C (* 'appl' *);
    kAESuspend                  = $73757370 (* 'susp' *);
    kAEResume                   = $72736D65 (* 'rsme' *);
    kAEDiskEvent                = $6469736B (* 'disk' *);
    kAENullEvent                = $6E756C6C (* 'null' *);
    kAEWakeUpEvent              = $77616B65 (* 'wake' *);
    kAEScrapEvent               = $73637270 (* 'scrp' *);
    kAEHighLevel                = $68696768 (* 'high' *);

    keyAEAngle                  = $6B616E67 (* 'kang' *);                       {   0x6b616e67   }
    keyAEArcAngle               = $70617263 (* 'parc' *);                       {   0x70617263   }

    keyAEBaseAddr               = $62616464 (* 'badd' *);                       {   0x62616464   }
    keyAEBestType               = $70627374 (* 'pbst' *);                       {   0x70627374   }
    keyAEBgndColor              = $6B62636C (* 'kbcl' *);                       {   0x6b62636c   }
    keyAEBgndPattern            = $6B627074 (* 'kbpt' *);                       {   0x6b627074   }
    keyAEBounds                 = $70626E64 (* 'pbnd' *);                       {   0x70626e64   }
    keyAECellList               = $6B636C74 (* 'kclt' *);                       {   0x6b636c74   }
    keyAEClassID                = $636C4944 (* 'clID' *);                       {   0x636c4944   }
    keyAEColor                  = $636F6C72 (* 'colr' *);                       {   0x636f6c72   }
    keyAEColorTable             = $636C7462 (* 'cltb' *);                       {   0x636c7462   }
    keyAECurveHeight            = $6B636864 (* 'kchd' *);                       {   0x6b636864   }
    keyAECurveWidth             = $6B637764 (* 'kcwd' *);                       {   0x6b637764   }
    keyAEDashStyle              = $70647374 (* 'pdst' *);                       {   0x70647374   }
    keyAEData                   = $64617461 (* 'data' *);                       {   0x64617461   }
    keyAEDefaultType            = $64656674 (* 'deft' *);                       {   0x64656674   }
    keyAEDefinitionRect         = $70647274 (* 'pdrt' *);                       {   0x70647274   }
    keyAEDescType               = $64737470 (* 'dstp' *);                       {   0x64737470   }
    keyAEDestination            = $64657374 (* 'dest' *);                       {   0x64657374   }
    keyAEDoAntiAlias            = $616E7461 (* 'anta' *);                       {   0x616e7461   }
    keyAEDoDithered             = $67646974 (* 'gdit' *);                       {   0x67646974   }
    keyAEDoRotate               = $6B647274 (* 'kdrt' *);                       {   0x6b647274   }

    keyAEDoScale                = $6B736361 (* 'ksca' *);                       {   0x6b736361   }
    keyAEDoTranslate            = $6B747261 (* 'ktra' *);                       {   0x6b747261   }
    keyAEEditionFileLoc         = $656C6F63 (* 'eloc' *);                       {   0x656c6f63   }
    keyAEElements               = $656C6D73 (* 'elms' *);                       {   0x656c6d73   }
    keyAEEndPoint               = $70656E64 (* 'pend' *);                       {   0x70656e64   }
    keyAEEventClass             = $6576636C (* 'evcl' *);                       {   0x6576636c   }
    keyAEEventID                = $65767469 (* 'evti' *);                       {   0x65767469   }
    keyAEFile                   = $6B66696C (* 'kfil' *);                       {   0x6b66696c   }
    keyAEFileType               = $666C7470 (* 'fltp' *);                       {   0x666c7470   }
    keyAEFillColor              = $666C636C (* 'flcl' *);                       {   0x666c636c   }
    keyAEFillPattern            = $666C7074 (* 'flpt' *);                       {   0x666c7074   }
    keyAEFlipHorizontal         = $6B66686F (* 'kfho' *);                       {   0x6b66686f   }
    keyAEFlipVertical           = $6B667674 (* 'kfvt' *);                       {   0x6b667674   }
    keyAEFont                   = $666F6E74 (* 'font' *);                       {   0x666f6e74   }
    keyAEFormula                = $70666F72 (* 'pfor' *);                       {   0x70666f72   }
    keyAEGraphicObjects         = $676F6273 (* 'gobs' *);                       {   0x676f6273   }
    keyAEID                     = $49442020 (* 'ID  ' *);                       {   0x49442020   }
    keyAEImageQuality           = $67717561 (* 'gqua' *);                       {   0x67717561   }
    keyAEInsertHere             = $696E7368 (* 'insh' *);                       {   0x696e7368   }
    keyAEKeyForms               = $6B657966 (* 'keyf' *);                       {   0x6b657966   }

    keyAEKeyword                = $6B797764 (* 'kywd' *);                       {   0x6b797764   }
    keyAELevel                  = $6C65766C (* 'levl' *);                       {   0x6c65766c   }
    keyAELineArrow              = $6172726F (* 'arro' *);                       {   0x6172726f   }
    keyAEName                   = $706E616D (* 'pnam' *);                       {   0x706e616d   }
    keyAENewElementLoc          = $706E656C (* 'pnel' *);                       {   0x706e656c   }
    keyAEObject                 = $6B6F626A (* 'kobj' *);                       {   0x6b6f626a   }
    keyAEObjectClass            = $6B6F636C (* 'kocl' *);                       {   0x6b6f636c   }
    keyAEOffStyles              = $6F667374 (* 'ofst' *);                       {   0x6f667374   }
    keyAEOnStyles               = $6F6E7374 (* 'onst' *);                       {   0x6f6e7374   }
    keyAEParameters             = $70726D73 (* 'prms' *);                       {   0x70726d73   }
    keyAEParamFlags             = $706D6667 (* 'pmfg' *);                       {   0x706d6667   }
    keyAEPenColor               = $7070636C (* 'ppcl' *);                       {   0x7070636c   }
    keyAEPenPattern             = $70707061 (* 'pppa' *);                       {   0x70707061   }
    keyAEPenWidth               = $70707764 (* 'ppwd' *);                       {   0x70707764   }
    keyAEPixelDepth             = $70647074 (* 'pdpt' *);                       {   0x70647074   }
    keyAEPixMapMinus            = $6B706D6D (* 'kpmm' *);                       {   0x6b706d6d   }
    keyAEPMTable                = $6B706D74 (* 'kpmt' *);                       {   0x6b706d74   }
    keyAEPointList              = $70746C74 (* 'ptlt' *);                       {   0x70746c74   }
    keyAEPointSize              = $7074737A (* 'ptsz' *);                       {   0x7074737a   }
    keyAEPosition               = $6B706F73 (* 'kpos' *);                       {   0x6b706f73   }

    keyAEPropData               = $70726474 (* 'prdt' *);                       {   0x70726474   }
    keyAEProperties             = $7170726F (* 'qpro' *);                       {   0x7170726f   }
    keyAEProperty               = $6B707270 (* 'kprp' *);                       {   0x6b707270   }
    keyAEPropFlags              = $70726667 (* 'prfg' *);                       {   0x70726667   }
    keyAEPropID                 = $70726F70 (* 'prop' *);                       {   0x70726f70   }
    keyAEProtection             = $7070726F (* 'ppro' *);                       {   0x7070726f   }
    keyAERenderAs               = $6B72656E (* 'kren' *);                       {   0x6b72656e   }
    keyAERequestedType          = $72747970 (* 'rtyp' *);                       {   0x72747970   }
    keyAEResult                 = $2D2D2D2D (* '----' *);                       {   0x2d2d2d2d   }
    keyAEResultInfo             = $7273696E (* 'rsin' *);                       {   0x7273696e   }
    keyAERotation               = $70726F74 (* 'prot' *);                       {   0x70726f74   }
    keyAERotPoint               = $6B727470 (* 'krtp' *);                       {   0x6b727470   }
    keyAERowList                = $6B726C73 (* 'krls' *);                       {   0x6b726c73   }
    keyAESaveOptions            = $7361766F (* 'savo' *);                       {   0x7361766f   }
    keyAEScale                  = $7073636C (* 'pscl' *);                       {   0x7073636c   }
    keyAEScriptTag              = $70736374 (* 'psct' *);                       {   0x70736374   }
    keyAEShowWhere              = $73686F77 (* 'show' *);                       {   0x73686f77   }
    keyAEStartAngle             = $70616E67 (* 'pang' *);                       {   0x70616e67   }
    keyAEStartPoint             = $70737470 (* 'pstp' *);                       {   0x70737470   }
    keyAEStyles                 = $6B737479 (* 'ksty' *);                       {   0x6b737479   }

    keyAESuiteID                = $73756974 (* 'suit' *);                       {   0x73756974   }
    keyAEText                   = $6B747874 (* 'ktxt' *);                       {   0x6b747874   }
    keyAETextColor              = $70747863 (* 'ptxc' *);                       {   0x70747863   }
    keyAETextFont               = $70747866 (* 'ptxf' *);                       {   0x70747866   }
    keyAETextPointSize          = $70747073 (* 'ptps' *);                       {   0x70747073   }
    keyAETextStyles             = $74787374 (* 'txst' *);                       {   0x74787374   }
    keyAETextLineHeight         = $6B746C68 (* 'ktlh' *);                       {  type ShortInteger  }
    keyAETextLineAscent         = $6B746173 (* 'ktas' *);                       {  type ShortInteger  }
    keyAETheText                = $74687478 (* 'thtx' *);                       {   0x74687478   }
    keyAETransferMode           = $7070746D (* 'pptm' *);                       {   0x7070746d   }
    keyAETranslation            = $70747273 (* 'ptrs' *);                       {   0x70747273   }
    keyAETryAsStructGraf        = $746F6F67 (* 'toog' *);                       {   0x746f6f67   }
    keyAEUniformStyles          = $7573746C (* 'ustl' *);                       {   0x7573746c   }
    keyAEUpdateOn               = $70757064 (* 'pupd' *);                       {   0x70757064   }
    keyAEUserTerm               = $7574726D (* 'utrm' *);                       {   0x7574726d   }
    keyAEWindow                 = $776E6477 (* 'wndw' *);                       {   0x776e6477   }
    keyAEWritingCode            = $77726364 (* 'wrcd' *);                       {   0x77726364   }

    keyMiscellaneous            = $666D7363 (* 'fmsc' *);                       {   0x666d7363   }
    keySelection                = $6673656C (* 'fsel' *);                       {   0x6673656c   }
    keyWindow                   = $6B776E64 (* 'kwnd' *);                       {   0x6b776e64   }
                                                                {  EventRecord keys  }
    keyWhen                     = $7768656E (* 'when' *);
    keyWhere                    = $77686572 (* 'wher' *);
    keyModifiers                = $6D6F6473 (* 'mods' *);
    keyKey                      = $6B657920 (* 'key ' *);
    keyKeyCode                  = $636F6465 (* 'code' *);
    keyKeyboard                 = $6B657962 (* 'keyb' *);
    keyDriveNumber              = $64727623 (* 'drv#' *);
    keyErrorCode                = $65727223 (* 'err#' *);
    keyHighLevelClass           = $68636C73 (* 'hcls' *);
    keyHighLevelID              = $68696420 (* 'hid ' *);

    pArcAngle                   = $70617263 (* 'parc' *);                       {   0x70617263   }
    pBackgroundColor            = $7062636C (* 'pbcl' *);                       {   0x7062636c   }
    pBackgroundPattern          = $70627074 (* 'pbpt' *);                       {   0x70627074   }
    pBestType                   = $70627374 (* 'pbst' *);                       {   0x70627374   }
    pBounds                     = $70626E64 (* 'pbnd' *);                       {   0x70626e64   }
    pClass                      = $70636C73 (* 'pcls' *);                       {   0x70636c73   }
    pClipboard                  = $70636C69 (* 'pcli' *);                       {   0x70636c69   }
    pColor                      = $636F6C72 (* 'colr' *);                       {   0x636f6c72   }
    pColorTable                 = $636C7462 (* 'cltb' *);                       {   0x636c7462   }
    pContents                   = $70636E74 (* 'pcnt' *);                       {   0x70636e74   }
    pCornerCurveHeight          = $70636864 (* 'pchd' *);                       {   0x70636864   }
    pCornerCurveWidth           = $70637764 (* 'pcwd' *);                       {   0x70637764   }
    pDashStyle                  = $70647374 (* 'pdst' *);                       {   0x70647374   }
    pDefaultType                = $64656674 (* 'deft' *);                       {   0x64656674   }
    pDefinitionRect             = $70647274 (* 'pdrt' *);                       {   0x70647274   }
    pEnabled                    = $656E626C (* 'enbl' *);                       {   0x656e626c   }
    pEndPoint                   = $70656E64 (* 'pend' *);                       {   0x70656e64   }
    pFillColor                  = $666C636C (* 'flcl' *);                       {   0x666c636c   }
    pFillPattern                = $666C7074 (* 'flpt' *);                       {   0x666c7074   }
    pFont                       = $666F6E74 (* 'font' *);                       {   0x666f6e74   }

    pFormula                    = $70666F72 (* 'pfor' *);                       {   0x70666f72   }
    pGraphicObjects             = $676F6273 (* 'gobs' *);                       {   0x676f6273   }
    pHasCloseBox                = $68636C62 (* 'hclb' *);                       {   0x68636c62   }
    pHasTitleBar                = $70746974 (* 'ptit' *);                       {   0x70746974   }
    pID                         = $49442020 (* 'ID  ' *);                       {   0x49442020   }
    pIndex                      = $70696478 (* 'pidx' *);                       {   0x70696478   }
    pInsertionLoc               = $70696E73 (* 'pins' *);                       {   0x70696e73   }
    pIsFloating                 = $6973666C (* 'isfl' *);                       {   0x6973666c   }
    pIsFrontProcess             = $70697366 (* 'pisf' *);                       {   0x70697366   }
    pIsModal                    = $706D6F64 (* 'pmod' *);                       {   0x706d6f64   }
    pIsModified                 = $696D6F64 (* 'imod' *);                       {   0x696d6f64   }
    pIsResizable                = $7072737A (* 'prsz' *);                       {   0x7072737a   }
    pIsStationeryPad            = $70737064 (* 'pspd' *);                       {   0x70737064   }
    pIsZoomable                 = $69737A6D (* 'iszm' *);                       {   0x69737a6d   }
    pIsZoomed                   = $707A756D (* 'pzum' *);                       {   0x707a756d   }
    pItemNumber                 = $69746D6E (* 'itmn' *);                       {   0x69746d6e   }
    pJustification              = $706A7374 (* 'pjst' *);                       {   0x706a7374   }
    pLineArrow                  = $6172726F (* 'arro' *);                       {   0x6172726f   }
    pMenuID                     = $6D6E6964 (* 'mnid' *);                       {   0x6d6e6964   }
    pName                       = $706E616D (* 'pnam' *);                       {   0x706e616d   }

    pNewElementLoc              = $706E656C (* 'pnel' *);                       {   0x706e656c   }
    pPenColor                   = $7070636C (* 'ppcl' *);                       {   0x7070636c   }
    pPenPattern                 = $70707061 (* 'pppa' *);                       {   0x70707061   }
    pPenWidth                   = $70707764 (* 'ppwd' *);                       {   0x70707764   }
    pPixelDepth                 = $70647074 (* 'pdpt' *);                       {   0x70647074   }
    pPointList                  = $70746C74 (* 'ptlt' *);                       {   0x70746c74   }
    pPointSize                  = $7074737A (* 'ptsz' *);                       {   0x7074737a   }
    pProtection                 = $7070726F (* 'ppro' *);                       {   0x7070726f   }
    pRotation                   = $70726F74 (* 'prot' *);                       {   0x70726f74   }
    pScale                      = $7073636C (* 'pscl' *);                       {   0x7073636c   }
    pScript                     = $73637074 (* 'scpt' *);                       {   0x73637074   }
    pScriptTag                  = $70736374 (* 'psct' *);                       {   0x70736374   }
    pSelected                   = $73656C63 (* 'selc' *);                       {   0x73656c63   }
    pSelection                  = $73656C65 (* 'sele' *);                       {   0x73656c65   }
    pStartAngle                 = $70616E67 (* 'pang' *);                       {   0x70616e67   }
    pStartPoint                 = $70737470 (* 'pstp' *);                       {   0x70737470   }
    pTextColor                  = $70747863 (* 'ptxc' *);                       {   0x70747863   }
    pTextFont                   = $70747866 (* 'ptxf' *);                       {   0x70747866   }
    pTextItemDelimiters         = $7478646C (* 'txdl' *);                       {   0x7478646c   }
    pTextPointSize              = $70747073 (* 'ptps' *);                       {   0x70747073   }

    pTextStyles                 = $74787374 (* 'txst' *);                       {   0x74787374   }
    pTransferMode               = $7070746D (* 'pptm' *);                       {   0x7070746d   }
    pTranslation                = $70747273 (* 'ptrs' *);                       {   0x70747273   }
    pUniformStyles              = $7573746C (* 'ustl' *);                       {   0x7573746c   }
    pUpdateOn                   = $70757064 (* 'pupd' *);                       {   0x70757064   }
    pUserSelection              = $7075736C (* 'pusl' *);                       {   0x7075736c   }
    pVersion                    = $76657273 (* 'vers' *);                       {   0x76657273   }
    pVisible                    = $70766973 (* 'pvis' *);                       {   0x70766973   }

    typeAEText                  = $74545854 (* 'tTXT' *);                       {   0x74545854   }
    typeArc                     = $63617263 (* 'carc' *);                       {   0x63617263   }
    typeBest                    = $62657374 (* 'best' *);                       {   0x62657374   }
    typeCell                    = $6363656C (* 'ccel' *);                       {   0x6363656c   }
    typeClassInfo               = $67636C69 (* 'gcli' *);                       {   0x67636c69   }
    typeColorTable              = $636C7274 (* 'clrt' *);                       {   0x636c7274   }
    typeColumn                  = $63636F6C (* 'ccol' *);                       {   0x63636f6c   }
    typeDashStyle               = $74646173 (* 'tdas' *);                       {   0x74646173   }
    typeData                    = $74647461 (* 'tdta' *);                       {   0x74647461   }
    typeDrawingArea             = $63647277 (* 'cdrw' *);                       {   0x63647277   }
    typeElemInfo                = $656C696E (* 'elin' *);                       {   0x656c696e   }
    typeEnumeration             = $656E756D (* 'enum' *);                       {   0x656e756d   }
    typeEPS                     = $45505320 (* 'EPS ' *);                       {   0x45505320   }
    typeEventInfo               = $6576696E (* 'evin' *);                       {   0x6576696e   }

    typeFinderWindow            = $6677696E (* 'fwin' *);                       {   0x6677696e   }
    typeFixedPoint              = $66706E74 (* 'fpnt' *);                       {   0x66706e74   }
    typeFixedRectangle          = $66726374 (* 'frct' *);                       {   0x66726374   }
    typeGraphicLine             = $676C696E (* 'glin' *);                       {   0x676c696e   }
    typeGraphicText             = $63677478 (* 'cgtx' *);                       {   0x63677478   }
    typeGroupedGraphic          = $63706963 (* 'cpic' *);                       {   0x63706963   }
    typeInsertionLoc            = $696E736C (* 'insl' *);                       {   0x696e736c   }
    typeIntlText                = $69747874 (* 'itxt' *);                       {   0x69747874   }
    typeIntlWritingCode         = $696E746C (* 'intl' *);                       {   0x696e746c   }
    typeLongDateTime            = $6C647420 (* 'ldt ' *);                       {   0x6c647420   }
    typeLongFixed               = $6C667864 (* 'lfxd' *);                       {   0x6c667864   }
    typeLongFixedPoint          = $6C667074 (* 'lfpt' *);                       {   0x6c667074   }
    typeLongFixedRectangle      = $6C667263 (* 'lfrc' *);                       {   0x6c667263   }
    typeLongPoint               = $6C706E74 (* 'lpnt' *);                       {   0x6c706e74   }
    typeLongRectangle           = $6C726374 (* 'lrct' *);                       {   0x6c726374   }
    typeMachineLoc              = $6D4C6F63 (* 'mLoc' *);                       {   0x6d4c6f63   }
    typeOval                    = $636F766C (* 'covl' *);                       {   0x636f766c   }
    typeParamInfo               = $706D696E (* 'pmin' *);                       {   0x706d696e   }
    typePict                    = $50494354 (* 'PICT' *);                       {   0x50494354   }

    typePixelMap                = $63706978 (* 'cpix' *);                       {   0x63706978   }
    typePixMapMinus             = $74706D6D (* 'tpmm' *);                       {   0x74706d6d   }
    typePolygon                 = $6370676E (* 'cpgn' *);                       {   0x6370676e   }
    typePropInfo                = $70696E66 (* 'pinf' *);                       {   0x70696e66   }
    typePtr                     = $70747220 (* 'ptr ' *);                       {   0x70747220   }
    typeQDPoint                 = $51447074 (* 'QDpt' *);                       {   0x51447074   }
    typeQDRegion                = $5172676E (* 'Qrgn' *);                       {   0x51447074  (data is actual region data, including rectangle and size, _not_ region handle or ptr) }
    typeRectangle               = $63726563 (* 'crec' *);                       {   0x63726563   }
    typeRGB16                   = $74723136 (* 'tr16' *);                       {   0x74723136   }
    typeRGB96                   = $74723936 (* 'tr96' *);                       {   0x74723936   }
    typeRGBColor                = $63524742 (* 'cRGB' *);                       {   0x63524742   }
    typeRotation                = $74726F74 (* 'trot' *);                       {   0x74726f74   }
    typeRoundedRectangle        = $63727263 (* 'crrc' *);                       {   0x63727263   }
    typeRow                     = $63726F77 (* 'crow' *);                       {   0x63726f77   }
    typeScrapStyles             = $7374796C (* 'styl' *);                       {   0x7374796c   }
    typeScript                  = $73637074 (* 'scpt' *);                       {   0x73637074   }
    typeStyledText              = $53545854 (* 'STXT' *);                       {   0x53545854   }
    typeSuiteInfo               = $7375696E (* 'suin' *);                       {   0x7375696e   }
    typeTable                   = $6374626C (* 'ctbl' *);                       {   0x6374626c   }
    typeTextStyles              = $74737479 (* 'tsty' *);                       {   0x74737479   }

    typeTIFF                    = $54494646 (* 'TIFF' *);                       {   0x54494646   }
    typeVersion                 = $76657273 (* 'vers' *);                       {   0x76657273   }

    kAEMenuClass                = $6D656E75 (* 'menu' *);
    kAEMenuSelect               = $6D686974 (* 'mhit' *);
    kAEMouseDown                = $6D64776E (* 'mdwn' *);
    kAEMouseDownInBack          = $6D64626B (* 'mdbk' *);
    kAEKeyDown                  = $6B64776E (* 'kdwn' *);
    kAEResized                  = $7273697A (* 'rsiz' *);
    kAEPromise                  = $70726F6D (* 'prom' *);

    keyMenuID                   = $6D696420 (* 'mid ' *);
    keyMenuItem                 = $6D69746D (* 'mitm' *);
    keyCloseAllWindows          = $63617720 (* 'caw ' *);
    keyOriginalBounds           = $6F626E64 (* 'obnd' *);
    keyNewBounds                = $6E626E64 (* 'nbnd' *);
    keyLocalWhere               = $6C776872 (* 'lwhr' *);

    typeHIMenu                  = $6D6F626A (* 'mobj' *);
    typeHIWindow                = $776F626A (* 'wobj' *);

    kBySmallIcon                = 0;
    kByIconView                 = 1;
    kByNameView                 = 2;
    kByDateView                 = 3;
    kBySizeView                 = 4;
    kByKindView                 = 5;
    kByCommentView              = 6;
    kByLabelView                = 7;
    kByVersionView              = 8;

    kAEInfo                     = 11;
    kAEMain                     = 0;
    kAESharing                  = 13;

    kAEZoomIn                   = 7;
    kAEZoomOut                  = 8;

    kTextServiceClass           = $74737663 (* 'tsvc' *);
    kUpdateActiveInputArea      = $75706474 (* 'updt' *);                       {  update the active input area  }
    kShowHideInputWindow        = $73686977 (* 'shiw' *);                       {  show or hide the input window  }
    kPos2Offset                 = $70327374 (* 'p2st' *);                       {  converting global coordinates to char position  }
    kOffset2Pos                 = $73743270 (* 'st2p' *);                       {  converting char position to global coordinates  }
    kUnicodeNotFromInputMethod  = $756E696D (* 'unim' *);                       {  Unicode text when event not handled by Input Method or no Input Method  }
    kGetSelectedText            = $67747874 (* 'gtxt' *);                       {  Get text for current selection  }
    keyAETSMDocumentRefcon      = $72656663 (* 'refc' *);                       {  TSM document refcon, typeLongInteger  }
    keyAEServerInstance         = $73727669 (* 'srvi' *);                       {  component instance  }
    keyAETheData                = $6B646174 (* 'kdat' *);                       {  typeText  }
    keyAEFixLength              = $6669786C (* 'fixl' *);                       {  fix len  }
    keyAEUpdateRange            = $75646E67 (* 'udng' *);                       {  typeTextRangeArray  }
    keyAECurrentPoint           = $63706F73 (* 'cpos' *);                       {  current point  }
    keyAEBufferSize             = $62756666 (* 'buff' *);                       {  buffer size to get the text  }
    keyAEMoveView               = $6D767677 (* 'mvvw' *);                       {  move view flag  }
    keyAENextBody               = $6E786264 (* 'nxbd' *);                       {  next or previous body  }
    keyAETSMScriptTag           = $73636C67 (* 'sclg' *);
    keyAETSMTextFont            = $6B747866 (* 'ktxf' *);                       {  FMFontFamily or FOND ID  }
    keyAETSMTextFMFont          = $6B74786D (* 'ktxm' *);                       {  FMFont  }
    keyAETSMTextPointSize       = $6B747073 (* 'ktps' *);
    keyAETSMEventRecord         = $74657674 (* 'tevt' *);                       {  Low level Event Record, typeLowLevelEventRecord  }
    keyAETSMEventRef            = $74657672 (* 'tevr' *);                       {  Carbon EventRef, typeEventRef  }
    keyAETextServiceEncoding    = $7473656E (* 'tsen' *);                       {  Text Service encoding, mac or Unicode in UpdateActiveInputArea or GetSelectedText events.  }
    keyAETextServiceMacEncoding = $746D656E (* 'tmen' *);                       {  Target mac encoding for TSM conversion of text from Unicode text service.  }
    typeTextRange               = $7478726E (* 'txrn' *);                       {  TextRange  }
    typeComponentInstance       = $636D7069 (* 'cmpi' *);                       {  server instance  }
    typeOffsetArray             = $6F666179 (* 'ofay' *);                       {  offset array  }
    typeTextRangeArray          = $74726179 (* 'tray' *);
    typeLowLevelEventRecord     = $65767472 (* 'evtr' *);                       {  Low Level Event Record  }
    typeEventRef                = $65767266 (* 'evrf' *);                       {  Carbon EventRef  }
    typeText                    = $54455854 (* 'TEXT' *);                       {  Plain text  }


    {    Desc type constants    }
    kTSMOutsideOfBody           = 1;
    kTSMInsideOfBody            = 2;
    kTSMInsideOfActiveInputArea = 3;

    kNextBody                   = 1;
    kPreviousBody               = 2;


type
    TextRangePtr = ^TextRange;
    TextRange = record
        fStart:                 SInt32;
        fEnd:                   SInt32;
        fHiliteStyle:           SInt16;
    end;

    TextRangeHandle                     = ^TextRangePtr;
    TextRangeArrayPtr = ^TextRangeArray;
    TextRangeArray = record
        fNumOfRanges:           SInt16;                             {  specify the size of the fRange array  }
        fRange:                 array [0..0] of TextRange;              {  when fNumOfRanges > 1, the size of this array has to be calculated  }
    end;

    TextRangeArrayHandle                = ^TextRangeArrayPtr;
    OffsetArrayPtr = ^OffsetArray;
    OffsetArray = record
        fNumOfOffsets:          SInt16;                             {  specify the size of the fOffset array  }
        fOffset:                array [0..0] of SInt32;             {  when fNumOfOffsets > 1, the size of this array has to be calculated  }
    end;

    OffsetArrayHandle                   = ^OffsetArrayPtr;
    WritingCodePtr = ^WritingCode;
    WritingCode = record
        theScriptCode:          ScriptCode;
        theLangCode:            LangCode;
    end;

    IntlTextPtr = ^IntlText;
    IntlText = record
        theScriptCode:          ScriptCode;
        theLangCode:            LangCode;
        theText:                SInt8;                                  {  variable length data  }
    end;


    {    Hilite styles  }

const
    kCaretPosition              = 1;                            {  specify caret position  }
    kRawText                    = 2;                            {  specify range of raw text  }
    kSelectedRawText            = 3;                            {  specify range of selected raw text  }
    kConvertedText              = 4;                            {  specify range of converted text  }
    kSelectedConvertedText      = 5;                            {  specify range of selected converted text  }
    kBlockFillText              = 6;                            {  Block Fill hilite style  }
    kOutlineText                = 7;                            {  Outline hilite style  }
    kSelectedText               = 8;                            {  Selected hilite style  }

    keyAEHiliteRange            = $68726E67 (* 'hrng' *);                       {  typeTextRangeArray for System 7, typeHiliteRangeArray for System 8  }
    keyAEPinRange               = $706E7267 (* 'pnrg' *);                       {  typeTextRange for System 7, typeTextRegionRange for System 8    }
    keyAEClauseOffsets          = $636C6175 (* 'clau' *);                       {  typeOffsetArray for System 7, typeClauseOffsetArray for System 8  }
    keyAEOffset                 = $6F667374 (* 'ofst' *);                       {  typeLongInteger for System 7, typeByteOffset for System 8   }
    keyAEPoint                  = $67706F73 (* 'gpos' *);                       {  typePoint for System 7, typeQDPoint for System 8  }
    keyAELeftSide               = $6B6C6566 (* 'klef' *);                       {  typeBoolean  }
    keyAERegionClass            = $72676E63 (* 'rgnc' *);                       {  typeShortInteger for System 7, typeRegionClass for System 8  }
    keyAEDragging               = $626F6F6C (* 'bool' *);                       {  typeBoolean  }



                                                                {  AppleScript 1.3: New Text types  }
    typeUnicodeText             = $75747874 (* 'utxt' *);
    typeStyledUnicodeText       = $73757478 (* 'sutx' *);
    typeEncodedString           = $656E6373 (* 'encs' *);
    typeCString                 = $63737472 (* 'cstr' *);
    typePString                 = $70737472 (* 'pstr' *);

                                                                {  AppleScript 1.3: Unit types  }
    typeMeters                  = $6D657472 (* 'metr' *);                       {  Base Unit  }
    typeInches                  = $696E6368 (* 'inch' *);
    typeFeet                    = $66656574 (* 'feet' *);
    typeYards                   = $79617264 (* 'yard' *);
    typeMiles                   = $6D696C65 (* 'mile' *);
    typeKilometers              = $6B6D7472 (* 'kmtr' *);
    typeCentimeters             = $636D7472 (* 'cmtr' *);
    typeSquareMeters            = $7371726D (* 'sqrm' *);                       {  Base Unit  }
    typeSquareFeet              = $73716674 (* 'sqft' *);
    typeSquareYards             = $73717964 (* 'sqyd' *);
    typeSquareMiles             = $73716D69 (* 'sqmi' *);
    typeSquareKilometers        = $73716B6D (* 'sqkm' *);
    typeLiters                  = $6C697472 (* 'litr' *);                       {  Base Unit  }
    typeQuarts                  = $71727473 (* 'qrts' *);
    typeGallons                 = $67616C6E (* 'galn' *);
    typeCubicMeters             = $636D6574 (* 'cmet' *);                       {  Base Unit  }
    typeCubicFeet               = $63666574 (* 'cfet' *);
    typeCubicInches             = $6375696E (* 'cuin' *);
    typeCubicCentimeter         = $63636D74 (* 'ccmt' *);
    typeCubicYards              = $63797264 (* 'cyrd' *);
    typeKilograms               = $6B67726D (* 'kgrm' *);                       {  Base Unit  }
    typeGrams                   = $6772616D (* 'gram' *);
    typeOunces                  = $6F7A7320 (* 'ozs ' *);
    typePounds                  = $6C627320 (* 'lbs ' *);
    typeDegreesC                = $64656763 (* 'degc' *);                       {  Base Unit  }
    typeDegreesF                = $64656766 (* 'degf' *);
    typeDegreesK                = $6465676B (* 'degk' *);

                                                                {  AppleScript 1.3: Folder Actions  }
    kFAServerApp                = $73737276 (* 'ssrv' *);                       {  Creator code for Folder Actions Server }
    kDoFolderActionEvent        = $666F6C61 (* 'fola' *);                       {  Event the Finder sends to the Folder Actions FBA }
    kFolderActionCode           = $6163746E (* 'actn' *);                       {  Parameter that contains the Folder Action }
    kFolderOpenedEvent          = $666F706E (* 'fopn' *);                       {  Value of kFolderActionCode parameter; sent to script as event }
    kFolderClosedEvent          = $66636C6F (* 'fclo' *);
    kFolderWindowMovedEvent     = $6673697A (* 'fsiz' *);
    kFolderItemsAddedEvent      = $66676574 (* 'fget' *);
    kFolderItemsRemovedEvent    = $666C6F73 (* 'flos' *);
    kItemList                   = $666C7374 (* 'flst' *);                       {  List parameter for added and removed items }
    kNewSizeParameter           = $666E737A (* 'fnsz' *);                       {  Parameter for moved window }
    kFASuiteCode                = $6661636F (* 'faco' *);                       {  Suite code for the following events }
    kFAAttachCommand            = $61746661 (* 'atfa' *);                       {  Attach event id }
    kFARemoveCommand            = $726D6661 (* 'rmfa' *);                       {  Remove event id }
    kFAEditCommand              = $65646661 (* 'edfa' *);                       {  Edit event id }
    kFAFileParam                = $6661616C (* 'faal' *);                       {  Key for file parameter for Attach }
    kFAIndexParam               = $696E6478 (* 'indx' *);                       {  Key for index (0-based) parameter for Remove and Edit }

    {    AppleScript 1.3 Internet Suite     }
                                                                {  Suite code  }
    kAEInternetSuite            = $6775726C (* 'gurl' *);
    kAEISWebStarSuite           = $575757BD (* 'WWW½' *);

                                                                {  Events  }
    kAEISGetURL                 = $6775726C (* 'gurl' *);
    KAEISHandleCGI              = $73646F63 (* 'sdoc' *);

                                                                {  Classes  }
    cURL                        = $75726C20 (* 'url ' *);
    cInternetAddress            = $49504144 (* 'IPAD' *);
    cHTML                       = $68746D6C (* 'html' *);
    cFTPItem                    = $66747020 (* 'ftp ' *);

                                                                {  Parameters  }
    kAEISHTTPSearchArgs         = $6B666F72 (* 'kfor' *);
    kAEISPostArgs               = $706F7374 (* 'post' *);
    kAEISMethod                 = $6D657468 (* 'meth' *);
    kAEISClientAddress          = $61646472 (* 'addr' *);
    kAEISUserName               = $75736572 (* 'user' *);
    kAEISPassword               = $70617373 (* 'pass' *);
    kAEISFromUser               = $66726D75 (* 'frmu' *);
    kAEISServerName             = $73766E6D (* 'svnm' *);
    kAEISServerPort             = $73767074 (* 'svpt' *);
    kAEISScriptName             = $73636E6D (* 'scnm' *);
    kAEISContentType            = $63747970 (* 'ctyp' *);
    kAEISReferrer               = $72656672 (* 'refr' *);
    kAEISUserAgent              = $41676E74 (* 'Agnt' *);
    kAEISAction                 = $4B616374 (* 'Kact' *);
    kAEISActionPath             = $4B617074 (* 'Kapt' *);
    kAEISClientIP               = $4B636970 (* 'Kcip' *);
    kAEISFullRequest            = $4B667271 (* 'Kfrq' *);

                                                                {  Properties  }
    pScheme                     = $70757363 (* 'pusc' *);
    pHost                       = $484F5354 (* 'HOST' *);
    pPath                       = $46545063 (* 'FTPc' *);
    pUserName                   = $5241756E (* 'RAun' *);
    pUserPassword               = $52417077 (* 'RApw' *);
    pDNSForm                    = $70444E53 (* 'pDNS' *);
    pURL                        = $7055524C (* 'pURL' *);
    pTextEncoding               = $70747865 (* 'ptxe' *);
    pFTPKind                    = $6B696E64 (* 'kind' *);

                                                                {  Scheme enumerations  }
    eScheme                     = $65736368 (* 'esch' *);
    eurlHTTP                    = $68747470 (* 'http' *);                       {  RFC 2068  }
    eurlHTTPS                   = $68747073 (* 'htps' *);
    eurlFTP                     = $66747020 (* 'ftp ' *);                       {  RFC 1738  }
    eurlMail                    = $6D61696C (* 'mail' *);                       {  RFC 2638  }
    eurlFile                    = $66696C65 (* 'file' *);                       {  RFC 1738  }
    eurlGopher                  = $67706872 (* 'gphr' *);                       {  RFC 1738  }
    eurlTelnet                  = $746C6E74 (* 'tlnt' *);                       {  RFC 1738  }
    eurlNews                    = $6E657773 (* 'news' *);                       {  RFC 1738  }
    eurlSNews                   = $736E7773 (* 'snws' *);
    eurlNNTP                    = $6E6E7470 (* 'nntp' *);                       {  RFC 1738  }
    eurlMessage                 = $6D657373 (* 'mess' *);
    eurlMailbox                 = $6D626F78 (* 'mbox' *);
    eurlMulti                   = $6D756C74 (* 'mult' *);
    eurlLaunch                  = $6C61756E (* 'laun' *);
    eurlAFP                     = $61667020 (* 'afp ' *);
    eurlAT                      = $61742020 (* 'at  ' *);
    eurlEPPC                    = $65707063 (* 'eppc' *);
    eurlRTSP                    = $72747370 (* 'rtsp' *);                       {  RFC 2326  }
    eurlIMAP                    = $696D6170 (* 'imap' *);                       {  RFC 2192  }
    eurlNFS                     = $756E6673 (* 'unfs' *);                       {  RFC 2224  }
    eurlPOP                     = $75706F70 (* 'upop' *);                       {  RFC 2384  }
    eurlLDAP                    = $756C6470 (* 'uldp' *);                       {  RFC 2255  }
    eurlUnknown                 = $75726C3F (* 'url?' *);

                                                                {  AppleScript 1.3: Connectivity Suite in aeut  }
    kConnSuite                  = $6D616363 (* 'macc' *);
    cDevSpec                    = $63646576 (* 'cdev' *);
    cAddressSpec                = $63616472 (* 'cadr' *);
    cADBAddress                 = $63616462 (* 'cadb' *);
    cAppleTalkAddress           = $63617420 (* 'cat ' *);
    cBusAddress                 = $63627573 (* 'cbus' *);
    cEthernetAddress            = $63656E20 (* 'cen ' *);
    cFireWireAddress            = $63667720 (* 'cfw ' *);
    cIPAddress                  = $63697020 (* 'cip ' *);
    cLocalTalkAddress           = $636C7420 (* 'clt ' *);
    cSCSIAddress                = $63736373 (* 'cscs' *);
    cTokenRingAddress           = $63746F6B (* 'ctok' *);
    cUSBAddress                 = $63757362 (* 'cusb' *);                       {   }
                                                                {  Properties  }
    pDeviceType                 = $70647674 (* 'pdvt' *);
    pDeviceAddress              = $70647661 (* 'pdva' *);
    pConduit                    = $70636F6E (* 'pcon' *);
    pProtocol                   = $70707274 (* 'pprt' *);                       {  cde 4/27/98 was 'ppro' conflicted with DB suite  }
    pATMachine                  = $7061746D (* 'patm' *);
    pATZone                     = $7061747A (* 'patz' *);
    pATType                     = $70617474 (* 'patt' *);
    pDottedDecimal              = $70697064 (* 'pipd' *);
    pDNS                        = $70646E73 (* 'pdns' *);
    pPort                       = $70706F72 (* 'ppor' *);
    pNetwork                    = $706E6574 (* 'pnet' *);
    pNode                       = $706E6F64 (* 'pnod' *);
    pSocket                     = $70736F63 (* 'psoc' *);
    pSCSIBus                    = $70736362 (* 'pscb' *);
    pSCSILUN                    = $70736C75 (* 'pslu' *);                       {  cde 5/22/98 per WWDC developer request  }
                                                                {  Enumerations and enumerators  }
    eDeviceType                 = $65647674 (* 'edvt' *);
    eAddressSpec                = $65616473 (* 'eads' *);
    eConduit                    = $65636F6E (* 'econ' *);
    eProtocol                   = $6570726F (* 'epro' *);
    eADB                        = $65616462 (* 'eadb' *);
    eAnalogAudio                = $65706175 (* 'epau' *);
    eAppleTalk                  = $65706174 (* 'epat' *);
    eAudioLineIn                = $65636169 (* 'ecai' *);
    eAudioLineOut               = $6563616C (* 'ecal' *);                       {  cde 4/24/98 changed from 'ecao' to not conflict  }
    eAudioOut                   = $6563616F (* 'ecao' *);
    eBus                        = $65627573 (* 'ebus' *);
    eCDROM                      = $65636420 (* 'ecd ' *);
    eCommSlot                   = $6563636D (* 'eccm' *);
    eDigitalAudio               = $65706461 (* 'epda' *);
    eDisplay                    = $65646473 (* 'edds' *);
    eDVD                        = $65647664 (* 'edvd' *);
    eEthernet                   = $6563656E (* 'ecen' *);
    eFireWire                   = $65636677 (* 'ecfw' *);
    eFloppy                     = $65666420 (* 'efd ' *);
    eHD                         = $65686420 (* 'ehd ' *);
    eInfrared                   = $65636972 (* 'ecir' *);
    eIP                         = $65706970 (* 'epip' *);
    eIrDA                       = $65706972 (* 'epir' *);
    eIRTalk                     = $65706974 (* 'epit' *);
    eKeyboard                   = $656B6264 (* 'ekbd' *);
    eLCD                        = $65646C63 (* 'edlc' *);
    eLocalTalk                  = $65636C74 (* 'eclt' *);
    eMacIP                      = $65706D69 (* 'epmi' *);
    eMacVideo                   = $65706D76 (* 'epmv' *);
    eMicrophone                 = $65636D69 (* 'ecmi' *);
    eModemPort                  = $65636D70 (* 'ecmp' *);
    eModemPrinterPort           = $656D7070 (* 'empp' *);
    eModem                      = $65646D6D (* 'edmm' *);
    eMonitorOut                 = $65636D6E (* 'ecmn' *);
    eMouse                      = $656D6F75 (* 'emou' *);
    eNuBusCard                  = $65646E62 (* 'ednb' *);
    eNuBus                      = $656E7562 (* 'enub' *);
    ePCcard                     = $65637063 (* 'ecpc' *);
    ePCIbus                     = $65637069 (* 'ecpi' *);
    ePCIcard                    = $65647069 (* 'edpi' *);
    ePDSslot                    = $65637064 (* 'ecpd' *);
    ePDScard                    = $65706473 (* 'epds' *);
    ePointingDevice             = $65647064 (* 'edpd' *);
    ePostScript                 = $65707073 (* 'epps' *);
    ePPP                        = $65707070 (* 'eppp' *);
    ePrinterPort                = $65637070 (* 'ecpp' *);
    ePrinter                    = $65647072 (* 'edpr' *);
    eSvideo                     = $65707376 (* 'epsv' *);
    eSCSI                       = $65637363 (* 'ecsc' *);
    eSerial                     = $65707372 (* 'epsr' *);
    eSpeakers                   = $65647370 (* 'edsp' *);
    eStorageDevice              = $65647374 (* 'edst' *);
    eSVGA                       = $65707367 (* 'epsg' *);
    eTokenRing                  = $65746F6B (* 'etok' *);
    eTrackball                  = $6574726B (* 'etrk' *);
    eTrackpad                   = $65647470 (* 'edtp' *);
    eUSB                        = $65637573 (* 'ecus' *);
    eVideoIn                    = $65637669 (* 'ecvi' *);
    eVideoMonitor               = $6564766D (* 'edvm' *);
    eVideoOut                   = $6563766F (* 'ecvo' *);

                                                                {  AppleScript 1.3: Keystroke class  }
    cKeystroke                  = $6B707273 (* 'kprs' *);
    pKeystrokeKey               = $6B4D7367 (* 'kMsg' *);
    pModifiers                  = $6B4D6F64 (* 'kMod' *);
    pKeyKind                    = $6B6B6E64 (* 'kknd' *);
    eModifiers                  = $654D6473 (* 'eMds' *);
    eOptionDown                 = $4B6F7074 (* 'Kopt' *);
    eCommandDown                = $4B636D64 (* 'Kcmd' *);
    eControlDown                = $4B63746C (* 'Kctl' *);
    eShiftDown                  = $4B736674 (* 'Ksft' *);
    eCapsLockDown               = $4B636C6B (* 'Kclk' *);
    eKeyKind                    = $656B7374 (* 'ekst' *);                       {   }
                                                                {  Special keys all start with 'ks'  }
    eEscapeKey                  = $6B733500;                    {  Third byte is virtual key code byte         }
    eDeleteKey                  = $6B733300;                    {  (see IM Mac Toolbox Essentials, pp. 2-43)  }
    eTabKey                     = $6B733000;
    eReturnKey                  = $6B732400;
    eClearKey                   = $6B734700;
    eEnterKey                   = $6B734C00;
    eUpArrowKey                 = $6B737E00;
    eDownArrowKey               = $6B737D00;
    eLeftArrowKey               = $6B737B00;
    eRightArrowKey              = $6B737C00;
    eHelpKey                    = $6B737200;
    eHomeKey                    = $6B737300;
    ePageUpKey                  = $6B737400;
    ePageDownKey                = $6B737900;
    eForwardDelKey              = $6B737500;
    eEndKey                     = $6B737700;
    eF1Key                      = $6B737A00;
    eF2Key                      = $6B737800;
    eF3Key                      = $6B736300;
    eF4Key                      = $6B737600;
    eF5Key                      = $6B736000;
    eF6Key                      = $6B736100;
    eF7Key                      = $6B736200;
    eF8Key                      = $6B736400;
    eF9Key                      = $6B736500;
    eF10Key                     = $6B736D00;
    eF11Key                     = $6B736700;
    eF12Key                     = $6B736F00;
    eF13Key                     = $6B736900;
    eF14Key                     = $6B736B00;
    eF15Key                     = $6B737100;

{$ALIGN MAC68K}
{#POP}
{unit ASRegistry}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}



const
    keyAETarget                 = $74617267 (* 'targ' *);
    keySubjectAttr              = $7375626A (* 'subj' *);                       {  Magic 'returning' parameter:  }
    keyASReturning              = $4B72746E (* 'Krtn' *);                       {  AppleScript Specific Codes:  }
    kASAppleScriptSuite         = $61736372 (* 'ascr' *);
    kASScriptEditorSuite        = $546F7953 (* 'ToyS' *);
    kASTypeNamesSuite           = $74706E6D (* 'tpnm' *);                       {  dynamic terminologies  }
    typeAETE                    = $61657465 (* 'aete' *);
    typeAEUT                    = $61657574 (* 'aeut' *);
    kGetAETE                    = $67647465 (* 'gdte' *);
    kGetAEUT                    = $67647574 (* 'gdut' *);
    kUpdateAEUT                 = $75647574 (* 'udut' *);
    kUpdateAETE                 = $75647465 (* 'udte' *);
    kCleanUpAEUT                = $63647574 (* 'cdut' *);
    kASComment                  = $636D6E74 (* 'cmnt' *);
    kASLaunchEvent              = $6E6F6F70 (* 'noop' *);
    keyScszResource             = $7363737A (* 'scsz' *);
    typeScszResource            = $7363737A (* 'scsz' *);                       {  subroutine calls  }
    kASSubroutineEvent          = $70736272 (* 'psbr' *);
    keyASSubroutineName         = $736E616D (* 'snam' *);
    kASPrepositionalSubroutine  = $70736272 (* 'psbr' *);
    keyASPositionalArgs         = $70617267 (* 'parg' *);

                                                                {  Add this parameter to a Get Data result if your app handled the 'as' parameter  }
    keyAppHandledCoercion       = $69646173 (* 'idas' *);

                                                                {  Miscellaneous AppleScript commands  }
    kASStartLogEvent            = $6C6F6731 (* 'log1' *);
    kASStopLogEvent             = $6C6F6730 (* 'log0' *);
    kASCommentEvent             = $636D6E74 (* 'cmnt' *);


    {    Operator Events:   }
                                                                {  Binary:  }
    kASAdd                      = $2B202020 (* '+   ' *);
    kASSubtract                 = $2D202020 (* '-   ' *);
    kASMultiply                 = $2A202020 (* '*   ' *);
    kASDivide                   = $2F202020 (* '/   ' *);
    kASQuotient                 = $64697620 (* 'div ' *);
    kASRemainder                = $6D6F6420 (* 'mod ' *);
    kASPower                    = $5E202020 (* '^   ' *);
    kASEqual                    = $3D202020 (* '=   ' *);
    kASNotEqual                 = $AD202020 (* '­   ' *);
    kASGreaterThan              = $3E202020 (* '>   ' *);
    kASGreaterThanOrEqual       = $3E3D2020 (* '>=  ' *);
    kASLessThan                 = $3C202020 (* '<   ' *);
    kASLessThanOrEqual          = $3C3D2020 (* '<=  ' *);
    kASComesBefore              = $63626672 (* 'cbfr' *);
    kASComesAfter               = $63616672 (* 'cafr' *);
    kASConcatenate              = $63636174 (* 'ccat' *);
    kASStartsWith               = $62677774 (* 'bgwt' *);
    kASEndsWith                 = $656E6473 (* 'ends' *);
    kASContains                 = $636F6E74 (* 'cont' *);

    kASAnd                      = $414E4420 (* 'AND ' *);
    kASOr                       = $4F522020 (* 'OR  ' *);                       {  Unary:  }
    kASNot                      = $4E4F5420 (* 'NOT ' *);
    kASNegate                   = $6E656720 (* 'neg ' *);
    keyASArg                    = $61726720 (* 'arg ' *);

                                                                {  event code for the 'error' statement  }
    kASErrorEventCode           = $65727220 (* 'err ' *);
    kOSAErrorArgs               = $65727261 (* 'erra' *);
    keyAEErrorObject            = $65726F62 (* 'erob' *);                       {  Properties:  }
    pLength                     = $6C656E67 (* 'leng' *);
    pReverse                    = $72767365 (* 'rvse' *);
    pRest                       = $72657374 (* 'rest' *);
    pInherits                   = $6340235E (* 'c@#^' *);
    pProperties                 = $70414C4C (* 'pALL' *);                       {  User-Defined Record Fields:  }
    keyASUserRecordFields       = $75737266 (* 'usrf' *);
    typeUserRecordFields        = $6C697374 (* 'list' *);

    {    Prepositions:  }
    keyASPrepositionAt          = $61742020 (* 'at  ' *);
    keyASPrepositionIn          = $696E2020 (* 'in  ' *);
    keyASPrepositionFrom        = $66726F6D (* 'from' *);
    keyASPrepositionFor         = $666F7220 (* 'for ' *);
    keyASPrepositionTo          = $746F2020 (* 'to  ' *);
    keyASPrepositionThru        = $74687275 (* 'thru' *);
    keyASPrepositionThrough     = $74686768 (* 'thgh' *);
    keyASPrepositionBy          = $62792020 (* 'by  ' *);
    keyASPrepositionOn          = $6F6E2020 (* 'on  ' *);
    keyASPrepositionInto        = $696E746F (* 'into' *);
    keyASPrepositionOnto        = $6F6E746F (* 'onto' *);
    keyASPrepositionBetween     = $6274776E (* 'btwn' *);
    keyASPrepositionAgainst     = $61677374 (* 'agst' *);
    keyASPrepositionOutOf       = $6F75746F (* 'outo' *);
    keyASPrepositionInsteadOf   = $6973746F (* 'isto' *);
    keyASPrepositionAsideFrom   = $61736466 (* 'asdf' *);
    keyASPrepositionAround      = $61726E64 (* 'arnd' *);
    keyASPrepositionBeside      = $62736964 (* 'bsid' *);
    keyASPrepositionBeneath     = $626E7468 (* 'bnth' *);
    keyASPrepositionUnder       = $756E6472 (* 'undr' *);

    keyASPrepositionOver        = $6F766572 (* 'over' *);
    keyASPrepositionAbove       = $61627665 (* 'abve' *);
    keyASPrepositionBelow       = $62656C77 (* 'belw' *);
    keyASPrepositionApartFrom   = $61707274 (* 'aprt' *);
    keyASPrepositionGiven       = $6769766E (* 'givn' *);
    keyASPrepositionWith        = $77697468 (* 'with' *);
    keyASPrepositionWithout     = $776F7574 (* 'wout' *);
    keyASPrepositionAbout       = $61626F75 (* 'abou' *);
    keyASPrepositionSince       = $736E6365 (* 'snce' *);
    keyASPrepositionUntil       = $74696C6C (* 'till' *);

                                                                {  Terminology & Dialect things:  }
    kDialectBundleResType       = $4462646C (* 'Dbdl' *);                       {  AppleScript Classes and Enums:  }
    cConstant                   = $656E756D (* 'enum' *);
    cClassIdentifier            = $70636C73 (* 'pcls' *);
    cObjectBeingExamined        = $65786D6E (* 'exmn' *);
    cList                       = $6C697374 (* 'list' *);
    cSmallReal                  = $73696E67 (* 'sing' *);
    cReal                       = $646F7562 (* 'doub' *);
    cRecord                     = $7265636F (* 'reco' *);
    cReference                  = $6F626A20 (* 'obj ' *);
    cUndefined                  = $756E6466 (* 'undf' *);
    cMissingValue               = $6D736E67 (* 'msng' *);
    cSymbol                     = $73796D62 (* 'symb' *);
    cLinkedList                 = $6C6C7374 (* 'llst' *);
    cVector                     = $76656374 (* 'vect' *);
    cEventIdentifier            = $65766E74 (* 'evnt' *);
    cKeyIdentifier              = $6B796964 (* 'kyid' *);
    cUserIdentifier             = $75696420 (* 'uid ' *);
    cPreposition                = $70726570 (* 'prep' *);
    cKeyForm                    = $6B66726D (* 'kfrm' *);
    cScript                     = $73637074 (* 'scpt' *);
    cHandler                    = $68616E64 (* 'hand' *);
    cProcedure                  = $70726F63 (* 'proc' *);

    cHandleBreakpoint           = $6272616B (* 'brak' *);

    cClosure                    = $636C7372 (* 'clsr' *);
    cRawData                    = $72646174 (* 'rdat' *);
    cStringClass                = $54455854 (* 'TEXT' *);
    cNumber                     = $6E6D6272 (* 'nmbr' *);
    cListElement                = $63656C6D (* 'celm' *);
    cListOrRecord               = $6C722020 (* 'lr  ' *);
    cListOrString               = $6C732020 (* 'ls  ' *);
    cListRecordOrString         = $6C727320 (* 'lrs ' *);
    cNumberOrString             = $6E732020 (* 'ns  ' *);
    cNumberOrDateTime           = $6E642020 (* 'nd  ' *);
    cNumberDateTimeOrString     = $6E647320 (* 'nds ' *);
    cAliasOrString              = $73662020 (* 'sf  ' *);
    cSeconds                    = $73636E64 (* 'scnd' *);
    typeSound                   = $736E6420 (* 'snd ' *);
    enumBooleanValues           = $626F6F76 (* 'boov' *);                       {   Use this instead of typeBoolean to avoid with/without conversion   }
    kAETrue                     = $74727565 (* 'true' *);
    kAEFalse                    = $66616C73 (* 'fals' *);
    enumMiscValues              = $6D697363 (* 'misc' *);
    kASCurrentApplication       = $63757261 (* 'cura' *);                       {  User-defined property ospecs:  }
    formUserPropertyID          = $75737270 (* 'usrp' *);

//  cString                     = $54455854 (* 'TEXT' *);                       {  old name for cStringClass - can't be used in .r files }

                                                                {  Global properties:  }
    pASIt                       = $69742020 (* 'it  ' *);
    pASMe                       = $6D652020 (* 'me  ' *);
    pASResult                   = $72736C74 (* 'rslt' *);
    pASSpace                    = $73706163 (* 'spac' *);
    pASReturn                   = $72657420 (* 'ret ' *);
    pASTab                      = $74616220 (* 'tab ' *);
    pASPi                       = $70692020 (* 'pi  ' *);
    pASParent                   = $70617265 (* 'pare' *);
    kASInitializeEventCode      = $696E6974 (* 'init' *);
    pASPrintLength              = $70726C6E (* 'prln' *);
    pASPrintDepth               = $70726470 (* 'prdp' *);
    pASTopLevelScript           = $61736372 (* 'ascr' *);

                                                                {  Considerations  }
    kAECase                     = $63617365 (* 'case' *);
    kAEDiacritic                = $64696163 (* 'diac' *);
    kAEWhiteSpace               = $77686974 (* 'whit' *);
    kAEHyphens                  = $68797068 (* 'hyph' *);
    kAEExpansion                = $65787061 (* 'expa' *);
    kAEPunctuation              = $70756E63 (* 'punc' *);
    kAEZenkakuHankaku           = $7A6B686B (* 'zkhk' *);
    kAESmallKana                = $736B6E61 (* 'skna' *);
    kAEKataHiragana             = $68696B61 (* 'hika' *);
    kASConsiderReplies          = $726D7465 (* 'rmte' *);
    enumConsiderations          = $636F6E73 (* 'cons' *);

    {    Considerations bit masks   }
    kAECaseConsiderMask         = $00000001;
    kAEDiacriticConsiderMask    = $00000002;
    kAEWhiteSpaceConsiderMask   = $00000004;
    kAEHyphensConsiderMask      = $00000008;
    kAEExpansionConsiderMask    = $00000010;
    kAEPunctuationConsiderMask  = $00000020;
    kASConsiderRepliesConsiderMask = $00000040;
    kAECaseIgnoreMask           = $00010000;
    kAEDiacriticIgnoreMask      = $00020000;
    kAEWhiteSpaceIgnoreMask     = $00040000;
    kAEHyphensIgnoreMask        = $00080000;
    kAEExpansionIgnoreMask      = $00100000;
    kAEPunctuationIgnoreMask    = $00200000;
    kASConsiderRepliesIgnoreMask = $00400000;
    enumConsidsAndIgnores       = $63736967 (* 'csig' *);

    cCoercion                   = $636F6563 (* 'coec' *);
    cCoerceUpperCase            = $74787570 (* 'txup' *);
    cCoerceLowerCase            = $74786C6F (* 'txlo' *);
    cCoerceRemoveDiacriticals   = $74786463 (* 'txdc' *);
    cCoerceRemovePunctuation    = $74787063 (* 'txpc' *);
    cCoerceRemoveHyphens        = $74786879 (* 'txhy' *);
    cCoerceOneByteToTwoByte     = $74786578 (* 'txex' *);
    cCoerceRemoveWhiteSpace     = $74787773 (* 'txws' *);
    cCoerceSmallKana            = $7478736B (* 'txsk' *);
    cCoerceZenkakuhankaku       = $74787A65 (* 'txze' *);
    cCoerceKataHiragana         = $74786B68 (* 'txkh' *);                       {  Lorax things:  }
    cZone                       = $7A6F6E65 (* 'zone' *);
    cMachine                    = $6D616368 (* 'mach' *);
    cAddress                    = $61646472 (* 'addr' *);
    cRunningAddress             = $72616464 (* 'radd' *);
    cStorage                    = $73746F72 (* 'stor' *);

                                                                {  DateTime things:  }
    pASWeekday                  = $776B6479 (* 'wkdy' *);
    pASMonth                    = $6D6E7468 (* 'mnth' *);
    pASDay                      = $64617920 (* 'day ' *);
    pASYear                     = $79656172 (* 'year' *);
    pASTime                     = $74696D65 (* 'time' *);
    pASDateString               = $64737472 (* 'dstr' *);
    pASTimeString               = $74737472 (* 'tstr' *);                       {  Months  }
    cMonth                      = $6D6E7468 (* 'mnth' *);
    cJanuary                    = $6A616E20 (* 'jan ' *);
    cFebruary                   = $66656220 (* 'feb ' *);
    cMarch                      = $6D617220 (* 'mar ' *);
    cApril                      = $61707220 (* 'apr ' *);
    cMay                        = $6D617920 (* 'may ' *);
    cJune                       = $6A756E20 (* 'jun ' *);
    cJuly                       = $6A756C20 (* 'jul ' *);
    cAugust                     = $61756720 (* 'aug ' *);
    cSeptember                  = $73657020 (* 'sep ' *);
    cOctober                    = $6F637420 (* 'oct ' *);
    cNovember                   = $6E6F7620 (* 'nov ' *);
    cDecember                   = $64656320 (* 'dec ' *);

                                                                {  Weekdays  }
    cWeekday                    = $776B6479 (* 'wkdy' *);
    cSunday                     = $73756E20 (* 'sun ' *);
    cMonday                     = $6D6F6E20 (* 'mon ' *);
    cTuesday                    = $74756520 (* 'tue ' *);
    cWednesday                  = $77656420 (* 'wed ' *);
    cThursday                   = $74687520 (* 'thu ' *);
    cFriday                     = $66726920 (* 'fri ' *);
    cSaturday                   = $73617420 (* 'sat ' *);                       {  AS 1.1 Globals:  }
    pASQuote                    = $71756F74 (* 'quot' *);
    pASSeconds                  = $73656373 (* 'secs' *);
    pASMinutes                  = $6D696E20 (* 'min ' *);
    pASHours                    = $686F7572 (* 'hour' *);
    pASDays                     = $64617973 (* 'days' *);
    pASWeeks                    = $7765656B (* 'week' *);                       {  Writing Code things:  }
    cWritingCodeInfo            = $6369746C (* 'citl' *);
    pScriptCode                 = $70736364 (* 'pscd' *);
    pLangCode                   = $706C6364 (* 'plcd' *);                       {  Magic Tell and End Tell events for logging:  }
    kASMagicTellEvent           = $74656C6C (* 'tell' *);
    kASMagicEndTellEvent        = $74656E64 (* 'tend' *);

{$ALIGN MAC68K}
{#POP}
{unit ATSUnicodeDirectAccess}
{$ALIGN MAC68K}







{ ---------------------------------------------------------------------------- }
{ Constants                                                                    }
{ ---------------------------------------------------------------------------- }

{
 *  ATSUDirectDataSelector
 *
 *  Summary:
 *    These are the data selectors used in the
 *    ATSUDirectGetLayoutDataArrayPtr function to get the needed layout
 *    data array pointer.
 }
type ATSUDirectDataSelector = UInt32;
const

  {
   * Returns the parallel advance delta (delta X) array. (Array Type):
   * Fixed (Return Time): Constant, unless creation is necessary, or
   * unless requested by ATSUDirectGetLayoutDataArrayPtrFromTextLayout.
   * (Creation): This array is created only on demand. Thus, if any
   * changes are to be made iCreate should be set to true. If the array
   * had not been previously allocated it will be allocated and
   * zero-filled when iCreate is set to true.
   }
  kATSUDirectDataAdvanceDeltaFixedArray = 0;

  {
   * Returns the parallel baseline delta (delta Y) array. (Array Type):
   * Fixed (Return Time): Constant, unless creation is necessary, or
   * unless requested by ATSUDirectGetLayoutDataArrayPtrFromTextLayout.
   * (Creation): This array is created only on demand. Thus, if any
   * changes are to be made iCreate should be set to true. If the array
   * had not been previously allocated it will be allocated and
   * zero-filled when iCreate is set to true.
   }
  kATSUDirectDataBaselineDeltaFixedArray = 1;

  {
   * Returns the parallel device delta array for device- specific
   * tweaking. This is an array of values which are used to adjust
   * truncated fractional values for devices that do not accept
   * fractional positioning. It is also used to provide precise
   * positioning for connected scripts. (Array Type): SInt16 (Return
   * Time): Constant, unless creation is necessary, or unless requested
   * by ATSUDirectGetLayoutDataArrayPtrFromTextLayout. (Creation): This
   * array is created only on demand. Thus, if any changes are to be
   * made iCreate should be set to true. If the array had not been
   * previously allocated it will be allocated and zero-filled when
   * iCreate is set to true.
   }
  kATSUDirectDataDeviceDeltaSInt16Array = 2;

  {
   * Returns the parallel style index array. The indexes setting in the
   * array are indexes into the the StyleSetting array, which can be
   * obtained using the
   * kATSUDirectDataStyleSettingATSUStyleSettingRefArray below. (Array
   * Type): UInt16 (Return Time): Constant, unless creation is
   * necessary, or unless requested by
   * ATSUDirectGetLayoutDataArrayPtrFromTextLayout. (Creation): This
   * array is created only on demand. Thus, if any changes are to be
   * made iCreate should be set to true. If the array had not been
   * previously allocated it will be allocated and zero-filled when
   * iCreate is set to true.
   }
  kATSUDirectDataStyleIndexUInt16Array = 3;

  {
   * Returns the style setting ref array. (Array Type):
   * ATSUStyleSettingRef (Return Time): Linear, based on the number of
   * styles applied to the given line. (Creation): This array is always
   * present if the layout has any text assigned to it at all. Setting
   * iCreate has no effect.
   }
  kATSUDirectDataStyleSettingATSUStyleSettingRefArray = 4;

  {
   * Returns the ATSLayoutRecord, version 1 array. This should not be
   * used directly at all. Rather, use the
   * kATSUDirectDataLayoutRecordATSLayoutRecordCurrent selector below.
   * This will ensure that the code will always be using the most
   * current version of the ATSLayoutRecord, should there ever be a
   * change. ATSUI will only ensure the most efficient processing will
   * occur for the latest version of ATSLayoutRecord. (Array Type):
   * ATSLayoutRecord, version 1 (Return Time): Constant, unless
   * creation is necessary, or unless requested by
   * ATSUDirectGetLayoutDataArrayPtrFromTextLayout. (Creation): This
   * array is always present if the layout has any text assigned to it
   * at all. Setting iCreate has no effect
   }
  kATSUDirectDataLayoutRecordATSLayoutRecordVersion1 = 100;

  {
   * Returns the ATSLayoutRecord. This will return the most current
   * version of the ATSLayoutRecord, and the one that's defined in this
   * file. Always use kATSUDirectDataLayoutRecordATSLayoutRecordCurrent
   * to get the array of ATSLayoutRecords. (Array Type):
   * ATSLayoutRecord (Return Time): Constant, unless creation is
   * necessary, or unless requested by
   * ATSUDirectGetLayoutDataArrayPtrFromTextLayout. (Creation): This
   * array is always present if the layout has any text assigned to it
   * at all. Setting iCreate has no effect.
   }
  kATSUDirectDataLayoutRecordATSLayoutRecordCurrent = kATSUDirectDataLayoutRecordATSLayoutRecordVersion1;

{ ---------------------------------------------------------------------------- }
{ Data Types                                                                   }
{ ---------------------------------------------------------------------------- }

{
 *  ATSUStyleSettingRef
 *
 *  Summary:
 *    A reference to a style setting object that represents an
 *    ATSUStyle plus any cached/set information about that style.
 }
type
    ATSUStyleSettingRef    = ^SInt32; { an opaque 32-bit type }
{ ---------------------------------------------------------------------------- }
{ Direct Accessors                                                             }
{ ---------------------------------------------------------------------------- }
{
 *  ATSUDirectGetLayoutDataArrayPtrFromLineRef()
 *
 *  Summary:
 *    Returns the data pointer specified by iDataSelector and
 *    referenced by iLineRef.
 *
 *  Discussion:
 *    This function simply returns the data pointer specified by
 *    iDataSelector and referenced by iLineRef. This data pointer
 *    should not be freed directly after it's been used. Rather, it
 *    should be released using ATSUDirectReleaseLayoutDataArrayPtr.
 *    Doing so serves as a signal to ATSUI that the caller is done with
 *    the data and that it can merge it in smoothly and adjust its
 *    internal processes. Furthermore, it may be the case that the
 *    pointer returned may be dynamically allocated one or contain
 *    dynamically allocated data. If it's not properly freed, a memory
 *    leak may result. This function may only be called within the
 *    context of an ATSUDirectLayoutOperationOverrideUPP callback. The
 *    pointer returned points to the exact data referenced by the
 *    ATSUTextLayout object that triggered the callback call. This is
 *    by far the most efficient way to use the direct access calls
 *    because for most requested data, no allocation and copy is done.
 *    Furthermore, because this a direct pointer to the data that ATSUI
 *    will use for it's layout, the data arrays returned by this can be
 *    tweaked and edited. Many of the requested arrays are created by
 *    ATSUI only when necessary. If these arrays are to be altered,
 *    then be sure to set iCreate to true. This will ensure that this
 *    array is created. If the arrays are not created, ATSUI
 *    automatically assumes that all entries in the array are zero. The
 *    pointer returned by this function is only valid within the
 *    context of the callback. Do not attempt to retain it for later
 *    use.
 *
 *  Parameters:
 *
 *    iLineRef:
 *      The ATSULineRef which was passed into a
 *      ATSUDirectLayoutOperationOverrideUPP callback function as a
 *      parameter.
 *
 *    iDataSelector:
 *      The selector for the data that is being requested.
 *
 *    iCreate:
 *      If the ATSULineRef passed in iLineRef does not reference the
 *      requested array, then a zero-filled one will be created and
 *      returned in oLayoutDataArray if this is set to true. For some
 *      ATSUDirectDataSelectors, these cannot be simply created. Thus,
 *      this flag will have no affect on these few
 *      ATSUDirectDataSelectors.
 *
 *    oLayoutDataArrayPtr:
 *      Upon sucessful return, this parameter will contain a pointer to
 *      an array of the requested values if the ATSULineRef passed in
 *      iLineRef references those values. If this is not the case, then
 *      NULL will be returned, unless iCreate is set to true and the
 *      array can be created. This parameter itself may be set to NULL
 *      if only a count of the entries is needed. can be NULL
 *
 *    oLayoutDataCount:
 *      Upon sucessful return, this parameter will contain a count of
 *      the entries in the array returned in oLayoutDataArray.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in ApplicationServices.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
function ATSUDirectGetLayoutDataArrayPtrFromLineRef( iLineRef: ATSULineRef; iDataSelector: ATSUDirectDataSelector; iCreate: Boolean; oLayoutDataArrayPtr: PtrPtr; var oLayoutDataCount: ItemCount ): OSStatus; external name '_ATSUDirectGetLayoutDataArrayPtrFromLineRef';


{ ---------------------------------------------------------------------------- }
{
 *  ATSUDirectGetLayoutDataArrayPtrFromTextLayout()
 *
 *  Summary:
 *    Returns the data pointer specified by iDataSelector and
 *    referenced by iTextLayout for the line starting at iLineOffset.
 *
 *  Discussion:
 *    This function simply returns the data pointer specified by
 *    iDataSelector and referenced by iTextLayout for the line starting
 *    at iLineOffset. This data pointer should not be freed directly
 *    after it's been used. Rather, it should be released using
 *    ATSUDirectReleaseLayoutDataArrayPtr. Doing so serves as a signal
 *    to ATSUI that the caller is done with the data. Furthermore, it
 *    may be the case that the pointer returned may be dynamically
 *    allocated one or contain dynamically allocated data. If it's not
 *    properly freed, a memory leak may result. This function may not
 *    be called inside the context of an
 *    ATSUDirectLayoutOperationOverrideUPP callback for the
 *    ATSUTextLayout data that triggered the callback.  All data
 *    returned will be a copy of the data in the object requested. This
 *    means two things: first of all, this means that it's a very
 *    inefficient way of using the data. All of the selectors that
 *    would have returned in constant time now would be forced to
 *    return in order-n time. Second of all, this means that the
 *    developer cannot change any of the data. Any changes the
 *    developer makes to the arrays returned by this API will have no
 *    effect on the layout. Using the
 *    kATSULayoutOperationPostLayoutAdjustment operation selector
 *    override and the ATSUDirectGetLayoutDataArrayPtrFromLineRef is a
 *    great alternative to using this API. Many of the requested arrays
 *    are created by ATSUI only when necessary. This means that it's
 *    possible that this API will return NULL pointer and a count of 0.
 *    In this case, if there's no error returned, the array simply
 *    doesn't exist and the caller should treat all of the entries in
 *    the array that they would have recieved as being 0.
 *
 *  Parameters:
 *
 *    iTextLayout:
 *      The ATSUTextLayout object from which the requested data will
 *      come from.
 *
 *    iLineOffset:
 *      The edge offset that corresponds to the beginning of the range
 *      of text of the line of the requested data. If the text has
 *      multiple lines, then ATSUDirectGetLayoutDataArrayPtrFromLineRef
 *      will need to be called for each of the lines in which the
 *      requested data is needed.
 *
 *    iDataSelector:
 *      The selector for the data that is being requested.
 *
 *    oLayoutDataArrayPtr:
 *      Upon sucessful return, this parameter will contain a pointer to
 *      an array of the requested values if the ATSUTextLayout passed
 *      in iTextLayout references those values for the line offset
 *      iLineOffset. If this is not the case, then NULL will be
 *      returned. This parameter itself may be set to NULL if only a
 *      count of the entries is needed. can be NULL
 *
 *    oLayoutDataCount:
 *      Upon sucessful return, this parameter will contain a count of
 *      the entries in the array returned in oLayoutDataArray.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in ApplicationServices.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
function ATSUDirectGetLayoutDataArrayPtrFromTextLayout( iTextLayout: ATSUTextLayout; iLineOffset: UniCharArrayOffset; iDataSelector: ATSUDirectDataSelector; oLayoutDataArrayPtr: PtrPtr; var oLayoutDataCount: ItemCount ): OSStatus; external name '_ATSUDirectGetLayoutDataArrayPtrFromTextLayout';


{ ---------------------------------------------------------------------------- }
{
 *  ATSUDirectReleaseLayoutDataArrayPtr()
 *
 *  Summary:
 *    Properly releases of an array pointer returned by
 *    ATSUDirectGetLayoutDataArrayPtrFromLineRef() or
 *    ATSUDirectGetLayoutDataArrayPtrFromTextLayout.
 *
 *  Discussion:
 *    This function is needed to let ATSUI know that the caller is
 *    finished with the pointer that was previously requested by
 *    ATSUDirectGetLayoutDataArrayPtrFromLineRef() or
 *    ATSUDirectGetLayoutDataArrayPtrFromTextLayout(). This is needed
 *    in case ATSUI needs to make any internal adjustments to it's
 *    internal structures.
 *
 *  Parameters:
 *
 *    iLineRef:
 *      The lineRef from which the layout data array pointer came from.
 *      If the layout data array pointer did not come from a lineRef,
 *      then set this to NULL. can be NULL
 *
 *    iDataSelector:
 *      The selector for which iLayoutDataArrayPtr was obtained.
 *
 *    iLayoutDataArrayPtr:
 *      A pointer to the layout data array which is to be disposed of.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in ApplicationServices.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
function ATSUDirectReleaseLayoutDataArrayPtr( iLineRef: ATSULineRef; iDataSelector: ATSUDirectDataSelector; iLayoutDataArrayPtr: PtrPtr ): OSStatus; external name '_ATSUDirectReleaseLayoutDataArrayPtr';


{ ---------------------------------------------------------------------------- }
{
 *  ATSUDirectAddStyleSettingRef()
 *
 *  Summary:
 *    This function will fetch a style index for the
 *    ATSUStyleSettingRef passed in.
 *
 *  Discussion:
 *    This function allows for glyph replacement or substitution from
 *    one layout or line to another layout or line. Not only will it
 *    look up the style index for iStyleSettingRef, but if the
 *    ATSUStyleSettingRef passed in iStyleSettingRef is not yet part of
 *    the line referenced by iLineRef, it will add it. If there is an
 *    outstanding ATSUStyleSettingRef array obtained by using the
 *    kATSUDirectDataStyleSettingATSUStyleSettingRefArray selector, the
 *    pointer obtained for this may no longer be valid after this
 *    function has been called. These pointers should be freed before
 *    calling this function and re-obtained afterwards.
 *
 *  Parameters:
 *
 *    iLineRef:
 *      An ATSULineRef which was passed into a
 *      ATSUDirectLayoutOperationOverrideUPP callback function as a
 *      parameter.
 *
 *    iStyleSettingRef:
 *      The ATSUStyleSettingRef to be looked up or added to the
 *      ATSUTextLayout referenced by iTextLayout for the line starting
 *      at the offset iLineOffset.
 *
 *    oStyleIndex:
 *      Upon sucessful return, this will parameter will be set to the
 *      index of the ATSUStyleSettingRef passed in iStyleSettingRef for
 *      the line referenced by iLineRef. If the ATSUStyleSettingRef
 *      does not exist, in that context, then it will be added and the
 *      new index will be returned here.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in ApplicationServices.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
function ATSUDirectAddStyleSettingRef( iLineRef: ATSULineRef; iStyleSettingRef: ATSUStyleSettingRef; var oStyleIndex: UInt16 ): OSStatus; external name '_ATSUDirectAddStyleSettingRef';
{unit ATSUnicodeDrawing}
{$ALIGN MAC68K}






{ ---------------------------------------------------------------------------- }
{  ATSUI drawing and measuring                                                 }
{ ---------------------------------------------------------------------------- }

{
 *  ATSUDrawText()
 *
 *  Summary:
 *    Draws a specified range of text in a QuickDraw graphics port or
 *    Quartz graphics context.
 *
 *  Discussion:
 *    Before calling ATSUDrawText, you will most likely want to call
 *    ATSUSetLayoutControls to set a value for the kATSUCGContextTag
 *    attribute in order to specify your current graphics context.
 *    Otherwise, ATSUI will attempt to draw using Quickdraw style text
 *    rendering in whatever Quickdraw GrafPort is currently active (use
 *    SetPort to determine the currently active Quickdraw GrafPort, see
 *    Quickdraw.h). Carbon applications can create a CGContext from a
 *    Quickdraw GrafPort using the functions QDBeginCGContext and
 *    QDEndCGContext (see Quickdraw.h). Cocoa applications can call the
 *    method "graphicsPort" on the current NSGraphicsContext in order
 *    to get a CGContextRef to pass into ATSUI (use the method
 *    "currentContext" to obtain the current NSGraphicsContext, see
 *    NSGraphicsContext.h for more information). ATSUDrawText examines
 *    the text layout object to ensure that each of the characters in
 *    the range is assigned to a style run. If there are gaps between
 *    style runs, ATSUI assigns the characters in the gap to the style
 *    run that precedes (in storage order) the gap. If there is no
 *    style run at the beginning of the text range, ATSUI assigns these
 *    characters to the first style run it finds. If there is no style
 *    run at the end of the text range, ATSUI assigns the remaining
 *    characters to the last style run it finds. If you want to draw a
 *    range of text that spans multiple lines, you should call
 *    ATSUDrawText for each line of text to draw, even if all the lines
 *    are in the same text layout object. You should adjust the
 *    iLineOffset parameter to reflect the beginning of each line to be
 *    drawn. Please note that when drawing into a GrafPort, calls to
 *    QDSwapTextFlags have no effect on ATSUI text rendering. The
 *    proper way to achieve Quartz text rendering from ATSUI is to use
 *    the kATSUCGContextTag attribute to specify a CGContextRef in each
 *    ATSUTextLayout before calling ATSUDrawText.
 *
 *  Parameters:
 *
 *    iTextLayout:
 *      A layout containing text to draw.
 *
 *    iLineOffset:
 *      The starting offset of the range of text to draw. To specify
 *      the beginning of the text buffer, pass kATSUFromTextBeginning
 *      for this parameter.
 *
 *    iLineLength:
 *      The length of the range of text to draw. To specify a range
 *      that continues to the end of the text buffer, pass
 *      kATSUToTextEnd for this parameter.
 *
 *    iLocationX:
 *      The x-coordinate of the origin (in either the current graphics
 *      port or Quartz graphics context) of the line containing the
 *      text range to render. Note that the ATSUTextMeasurement type is
 *      defined as a Fixed value, so you must ensure that your
 *      coordinates are converted to Fixed values before passing them
 *      to this function (see FixMath.h for conversion functions). Pass
 *      the constant kATSUUseGrafPortPenLoc to draw relative to the
 *      current pen location in the current graphics port.
 *
 *    iLocationY:
 *      The y-coordinate of the origin (in either the current graphics
 *      port or Quartz graphics context) of the line containing the
 *      text range to render. Note that the ATSUTextMeasurement type is
 *      defined as a Fixed value, so you must ensure that your
 *      coordinates are converted to Fixed values before passing them
 *      to this function (see FixMath.h for conversion functions). Pass
 *      the constant kATSUUseGrafPortPenLoc to draw relative to the
 *      current pen location in the current graphics port.
 *
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function ATSUDrawText( iTextLayout: ATSUTextLayout; iLineOffset: UniCharArrayOffset; iLineLength: UniCharCount; iLocationX: ATSUTextMeasurement; iLocationY: ATSUTextMeasurement ): OSStatus; external name '_ATSUDrawText';


{
 *  ATSUGetUnjustifiedBounds()
 *
 *  Summary:
 *    Obtains the typographic bounding rectangle for a line of text
 *    prior to final layout.
 *
 *  Discussion:
 *    This function calculates the typographic bounds (in coordinates
 *    independent of the rendering device) for a line of text. Note
 *    that ATSUGetUnjustifiedBounds calculates these bounds prior to
 *    the text's final layout, and therefore, the calculated bounds
 *    might not reflect those of the final laid-out line.
 *    Justification, truncation, and device level positioning are not
 *    taken into account. To obtain the typographic bounds of a line
 *    after it is laid out, you can call the function
 *    ATSUGetGlyphBounds. For more infomration about the difference
 *    between typographic and image bounds, please refer to the ATSUI
 *    documentation. Note that ATSUGetUnjustifiedBounds treats the
 *    specified text range as a single line. That is, if the range of
 *    text you specify is less than a line, it nevertheless treats the
 *    initial character in the range as the start of a line, for
 *    measuring purposes. If the range of text extends beyond a line,
 *    ATSUGetUnjustifiedBounds ignores soft line breaks, again,
 *    treating the text as a single line.
 *
 *  Parameters:
 *
 *    iTextLayout:
 *      The text layout object to obtain bounds information for.
 *
 *    iLineStart:
 *      The start of the line of text to obtain bounds information for.
 *      To indicate that the line starts at the beginning of the text
 *      buffer, you can pass the constant kATSUFromTextBeginning . To
 *      specify the entire text buffer, pass kATSUFromTextBeginning in
 *      this parameter and kATSUToTextEnd in the iLineLength parameter.
 *
 *    iLineLength:
 *      The length of the line to obtain bounds information for. If you
 *      want the line to extend to the end of the text buffer, you can
 *      pass the constant kATSUToTextEnd .
 *
 *    oTextBefore:
 *      On return, the value specifies the starting point of the
 *      typographic bounds for the line, relative to the origin (0,0)
 *      of the line and taking into account cross-stream shifting. Note
 *      that the ATSUMeasureText function might produce negative values
 *      for the typographic starting point of the line if, for example,
 *      the initial character of the line is allowed to hang into the
 *      margin. For horizontal text, this value corresponds to the left
 *      side of the bounding rectangle.
 *
 *    oTextAfter:
 *      On return, the end point of the typographic bounds for the
 *      line, relative to the origin (0,0) of the line and taking into
 *      account cross-stream shifting. For horizontal text, this value
 *      corresponds to the right side of the bounding rectangle.
 *
 *    oAscent:
 *      On return, the typographic bounds for the line, relative to the
 *      origin (0,0) of the line and taking into account cross-stream
 *      shifting. For horizontal text, this value corresponds to the
 *      top side of the bounding rectangle.
 *
 *    oDescent:
 *      On return, the typographic bounds for the line, relative to the
 *      origin (0,0) of the line and taking into account cross-stream
 *      shifting. For horizontal text, this value corresponds to the
 *      bottom side of the bounding rectangle.
 *
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in ApplicationServices.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
function ATSUGetUnjustifiedBounds( iTextLayout: ATSUTextLayout; iLineStart: UniCharArrayOffset; iLineLength: UniCharCount; var oTextBefore: ATSUTextMeasurement; var oTextAfter: ATSUTextMeasurement; var oAscent: ATSUTextMeasurement; var oDescent: ATSUTextMeasurement ): OSStatus; external name '_ATSUGetUnjustifiedBounds';


{
 *  ATSUMeasureTextImage()
 *
 *  Summary:
 *    Obtains the image bounding rectangle for a line of text after
 *    final layout.
 *
 *  Discussion:
 *    This function obtains the image bounds of a laid-out line of
 *    text. These bounds are described by the smallest rectangle that
 *    completely encloses the filled or framed parts of a block of
 *    textÑthat is, the text's "inked" glyphs. In measuring the line,
 *    the ATSUMeasureTextImage function takes into account line
 *    rotation, alignment, and justification, as well as other
 *    characteristics that affect layout, such as hanging punctuation.
 *    (If the line is rotated, the sides of the rectangle are parallel
 *    to the coordinate axes and encompass the rotated line.) If no
 *    attributes are set for the line, ATSUMeasureTextImage uses the
 *    global attributes set for the text layout object. Because the
 *    height of the image bounding rectangle is determined by the
 *    actual device metrics, ATSUMeasureTextImage ignores any
 *    previously set line ascent and descent values for the line it is
 *    measuring.
 *
 *  Parameters:
 *
 *    iTextLayout:
 *      The text layout for which to obtain image bounds.
 *
 *    iLineOffset:
 *      The first character of the line to examine. To indicate that
 *      the specified line starts at the beginning of the text buffer,
 *      you can pass the constant kATSUFromTextBeginning . To specify
 *      the entire text buffer, pass kATSUFromTextBeginning in this
 *      parameter and kATSUToTextEnd in the iLineLength parameter.
 *
 *    iLineLength:
 *      The length of the text range. If you want the range of text to
 *      extend to the end of the text buffer, you can pass the constant
 *      kATSUToTextEnd . However, the image bounds is restricted to the
 *      line in which iLineOffset resides.
 *
 *    iLocationX:
 *      The x-coordinate of the line's origin in the current graphics
 *      port or Quartz graphics context. Pass the constant
 *      kATSUUseGrafPortPenLoc for the dimensions of the bounds
 *      relative to the current pen location in the current graphics
 *      port or graphics context. You can pass 0to obtain only the
 *      dimensions of the bounding rectangle relative to one another,
 *      not their actual onscreen position.
 *
 *    iLocationY:
 *      The y-coordinate of the line's origin in the current graphics
 *      port or Quartz graphics context. Pass the constant
 *      kATSUUseGrafPortPenLoc for the dimensions of the bounds
 *      relative to the current pen location in the current graphics
 *      port or graphics context. You can pass 0to obtain only the
 *      dimensions of the bounding rectangle relative to one another,
 *      not their actual onscreen position.
 *
 *    oTextImageRect:
 *      On return, the dimensions of the image bounding rectangle for
 *      the text, offset by the values specified in the iLocationX and
 *      iLocationY parameters. If the line is rotated, the sides of the
 *      rectangle are parallel to the coordinate axis.
 *
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function ATSUMeasureTextImage( iTextLayout: ATSUTextLayout; iLineOffset: UniCharArrayOffset; iLineLength: UniCharCount; iLocationX: ATSUTextMeasurement; iLocationY: ATSUTextMeasurement; var oTextImageRect: Rect ): OSStatus; external name '_ATSUMeasureTextImage';


{
 *  ATSUGetGlyphBounds()
 *
 *  Summary:
 *    Obtains the typographic bounds of a line of glyphs after final
 *    layout.
 *
 *  Discussion:
 *    This function produces the enclosing trapezoid(s) that represent
 *    the typographic bounds for glyphs in a final, laid-out range of
 *    text. You typically call this function when you need to obtain an
 *    enclosing trapezoid for a line, taking rotation and all other
 *    layout attributes into account. ATSUI determines the height of
 *    each trapezoid by examining any line ascent and descent attribute
 *    values you may have set for the line. If you have not set these
 *    attributes for the line, the ATSUGetGlyphBounds function uses any
 *    line ascent and descent values you may have set for the text
 *    layout object containing the line. If these are not set,
 *    ATSUGetGlyphBounds uses the font's natural line ascent and
 *    descent values for the line. If these are previously set,
 *    ATSUGetGlyphBounds uses the ATSUStyle ascent and or
 *    descent/leading values. Note that the coordinates produced for
 *    the trapezoid(s) are offset by the amount specified in the
 *    iTextBasePointX and iTextBasePointY parameters. If your goal in
 *    calling the ATSUGetGlyphBounds function is to obtain metrics for
 *    drawing the typographic bounds on the screen, pass the position
 *    of the origin of the line in the current graphics port or
 *    graphics context in these parameters. This enables
 *    ATSUGetGlyphBounds to match the trapezoids to their onscreen
 *    image. When the range specified by the iBoundsCharStart and
 *    iBoundsCharLength parameters covers an entire line, you are
 *    guaranteed to receive only one trapezoid on return. Otherwise,
 *    multiple trapezoids may be returned to cover incomplete sections
 *    of bidi runs. In such cases, you would typically call
 *    ATSUGetGlyphBounds twice, as follows: (1) Pass NULL for the
 *    oGlyphBounds parameter, 0 for the iMaxNumberOfBounds parameter,
 *    and valid values for the other parameters. The ATSUGetGlyphBounds
 *    function returns the actual number of trapezoids needed to
 *    enclose the glyphs in the oActualNumberOfBounds parameter. (2)
 *    Allocate enough space for a buffer of the returned size, then
 *    call the function again, passing a valid pointer to the buffer in
 *    the oGlyphBounds parameter. On return, the buffer contains the
 *    trapezoids for the glyphs' typographic bounds. To obtain the
 *    typographic bounds of a line of text prior to line layout, call
 *    the function ATSUGetUnjustifiedBounds. To calculate the image
 *    bounding rectangle for a final laid-out line, call the function
 *    ATSUMeasureTextImage. For more infomration about the difference
 *    between typographic and image bounds, please refer to the ATSUI
 *    documentation.
 *
 *  Parameters:
 *
 *    iTextLayout:
 *      The text layout object for which glyph bounds are to be
 *      obtained.
 *
 *    iTextBasePointX:
 *      The x-coordinate of the origin of the line containing the
 *      glyphs in the current graphics port or Quartz graphics context.
 *      Pass the constant kATSUUseGrafPortPenLoc to obtain the glyph
 *      bounds relative to the current pen location in the current
 *      graphics port or graphics context. You may pass 0 to obtain
 *      only the dimensions of the bounds relative to one another, not
 *      their actual onscreen position.
 *
 *    iTextBasePointY:
 *      The y-coordinate of the origin of the line containing the
 *      glyphs in the current graphics port or Quartz graphics context.
 *      Pass the constant kATSUUseGrafPortPenLoc to obtain the glyph
 *      bounds relative to the current pen location in the current
 *      graphics port or graphics context. You may pass 0 to obtain
 *      only the dimensions of the bounds relative to one another, not
 *      their actual onscreen position.
 *
 *    iBoundsCharStart:
 *      The offset from the beginning of the text buffer to the
 *      character corresponding to the first glyph to measure. To
 *      indicate that the text range starts at the beginning of the
 *      text buffer, you can pass the constant kATSUFromTextBeginning.
 *
 *    iBoundsCharLength:
 *      The length of text range to measure. If you want the range to
 *      extend to the end of the text buffer, you can pass the constant
 *      kATSUToTextEnd.
 *
 *    iTypeOfBounds:
 *      The type of bounds you wish to obtain. See ATSLayoutTypes.h for
 *      a list of possible values to pass in here.
 *
 *    iMaxNumberOfBounds:
 *      The maximum number of bounding trapezoids to obtain. Typically,
 *      this is equivalent to the number of bounds in the oGlyphBounds
 *      array. To determine this value, see the Discussion.
 *
 *    oGlyphBounds:
 *      A pointer to memory you have allocated for an array of
 *      ATSTrapezoid values. On return, the array contains a trapezoid
 *      representing the typographic bounds for glyphs in the text
 *      range. If the specified range of text encloses nested
 *      bidirectional text, ATSUGetGlyphBounds produces multiple
 *      trapezoids defining these regions.In ATSUI 1.1, the maximum
 *      number of enclosing trapezoids that can be returned is 31; in
 *      ATSUI 1.2, the maximum number is 127. If you pass a range that
 *      covers an entire line, ATSUGetGlyphBounds always returns only 1
 *      trapezoid. If you are uncertain of how much memory to allocate
 *      for this array, see the Discussion. can be NULL
 *
 *    oActualNumberOfBounds:
 *      On return, the value specifies the actual number of enclosing
 *      trapezoids bounding the specified characters. This may be
 *      greater than the value you provide in the iMaxNumberOfBounds
 *      parameter. can be NULL
 *
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.6 and later
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function ATSUGetGlyphBounds( iTextLayout: ATSUTextLayout; iTextBasePointX: ATSUTextMeasurement; iTextBasePointY: ATSUTextMeasurement; iBoundsCharStart: UniCharArrayOffset; iBoundsCharLength: UniCharCount; iTypeOfBounds: UInt16; iMaxNumberOfBounds: ItemCount; oGlyphBounds: ATSTrapezoidPtr; var oActualNumberOfBounds: ItemCount ): OSStatus; external name '_ATSUGetGlyphBounds';


{ ---------------------------------------------------------------------------- }
{  ATSUI line breaking                                                         }
{ ---------------------------------------------------------------------------- }
{
 *  ATSUBatchBreakLines()
 *
 *  Summary:
 *    Soft wraps a range of text in a layout to a constant line width.
 *
 *  Discussion:
 *    Equivalent to repeatedly calling the ATSUBreakLine function with
 *    the parameter iUseAsSoftLineBreak set to true. Use this function
 *    to gain a substantial performance increase over the use of
 *    ATSUBreakLine. It will set soft breaks in a layout for multiple
 *    lines in a single call. It assumes constant line width. Soft line
 *    breaks within a layout are what divide it into lines. You can
 *    manipulate the soft breaks that are currently set within a layout
 *    using the functions ATSUGetSoftLineBreaks, ATSUSetSoftLineBreak,
 *    and ATSUClearSoftLineBreaks.
 *
 *  Parameters:
 *
 *    iTextLayout:
 *      The layout containing text to be soft wrapped.
 *
 *    iRangeStart:
 *      Beginning offset for the rage of text to be soft wrapped.
 *
 *    iRangeLength:
 *      The length of the range of text to be soft wrapped.
 *
 *    iLineWidth:
 *      The line width at which to force soft wrapping of text. Note
 *      that this parameter is of type ATSUTextMeasurement, which is
 *      defined as Fixed. See FixMath.h for conversion routines for
 *      fixed point values.
 *
 *    oBreakCount:
 *      On return, the number of soft breaks that were set in the
 *      layout. Use this to determine how much memory to allocate when
 *      calling ATSUGetSoftLineBreaks. can be NULL
 *
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in ApplicationServices.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
function ATSUBatchBreakLines( iTextLayout: ATSUTextLayout; iRangeStart: UniCharArrayOffset; iRangeLength: UniCharCount; iLineWidth: ATSUTextMeasurement; oBreakCount: ItemCountPtr ): OSStatus; external name '_ATSUBatchBreakLines';


{
 *  ATSUBreakLine()
 *
 *  Summary:
 *    Soft wraps a single line of text within a layout.
 *
 *  Discussion:
 *    This function will automatically determine the optimal place to
 *    set a soft break in a given range of text. It suggests a soft
 *    line break each time it encounters a hard line break character
 *    such as a carriage return, line feed, form feed, line separator,
 *    or paragraph separator. If ATSUBreakLine does not encounter a
 *    hard line break, it uses the line width you specify to determine
 *    how many characters fit on a line and suggests soft line breaks
 *    accordingly. You can loop over ATSUBreakLine, repeatedly calling
 *    it on the same layout, until all the text in the entire layout
 *    has been soft wrapped. However, for maximum efficiency, you
 *    should use ATSUBatchBreakLines. ATSUBreakLine should only be used
 *    if you have special needs, such as a non-constant line width.
 *
 *  Parameters:
 *
 *    iTextLayout:
 *      The layout containing text to be soft wrapped.
 *
 *    iLineStart:
 *      The beginning of the line you wish to soft wrap. To specify the
 *      beginning of the text buffer, pass the constant
 *      kATSUFromTextBeginning.
 *
 *    iLineWidth:
 *      The line width at which to force soft wrapping of text. Note
 *      that this parameter is of type ATSUTextMeasurement, which is
 *      defined as Fixed. See FixMath.h for conversion routines for
 *      fixed point values.
 *
 *    iUseAsSoftLineBreak:
 *      A Boolean value indicating whether ATSUBreakLine should
 *      automatically set the line break produced in the oLineBreak
 *      parameter. If true ,ATSUBreakLine sets the line break and
 *      clears any previously-set soft line breaks that precede the new
 *      break in the line but lie after the offset specified by
 *      iLineStart. You should ususally pass true for this parameter,
 *      unless you plan to use ATSUSetSoftLineBreak to set the soft
 *      break somewhere other than what is suggested by ATSUBreakLine.
 *
 *    oLineBreak:
 *      On return, the value specifies the soft line break as
 *      determined by ATSUBreakLine. If the value returned is the same
 *      value as specified in iLineStart , you have made an input
 *      parameter error. In this case, check to make sure that the line
 *      width specified in iLineWidth is big enough for ATSUBreakLine
 *      to perform line breaking. ATSUBreakLine does not return an
 *      error in this case.
 *
 *  Result:
 *    On success, noErr is returned. TSUI usually calculates a soft
 *    line break to be at the beginning of the first word that does ont
 *    fit on the line. But if ATSUBreakLine calculates the most optimal
 *    line break to be in the middle of a word, it returns the result
 *    code kATSULineBreakInWord. Note that ATSUI produces a line break
 *    in the middle of a word only as a last resort. See MacErrors.h
 *    for other possible error codes. can be NULL
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function ATSUBreakLine( iTextLayout: ATSUTextLayout; iLineStart: UniCharArrayOffset; iLineWidth: ATSUTextMeasurement; iUseAsSoftLineBreak: Boolean; oLineBreak: UniCharArrayOffsetPtr ): OSStatus; external name '_ATSUBreakLine';


{
 *  ATSUSetSoftLineBreak()
 *
 *  Summary:
 *    Sets a soft line break at the specified point in a text layout.
 *
 *  Discussion:
 *    You should typically only call ATSUSetSoftLineBreak to set line
 *    breaks when you are using your own line-breaking algorithm to
 *    calculate these breaks. For optimal performance, you should use
 *    ATSUBatchBreakLines to both calculate and set soft line breaks in
 *    your text. After calling ATSUSetSoftLineBreak , you should call
 *    the function ATSUGetUnjustifiedBounds to determine whether the
 *    characters still fit within the line, which is necessary due to
 *    end-of-line effects such as swashes.
 *
 *  Parameters:
 *
 *    iTextLayout:
 *      The layout in which to set the soft break.
 *
 *    iLineBreak:
 *      An offset into the text buffer specifying the location to set
 *      the soft break at.
 *
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function ATSUSetSoftLineBreak( iTextLayout: ATSUTextLayout; iLineBreak: UniCharArrayOffset ): OSStatus; external name '_ATSUSetSoftLineBreak';


{
 *  ATSUGetSoftLineBreaks()
 *
 *  Summary:
 *    Obtains the soft line breaks that are currently set in a given
 *    text range.
 *
 *  Discussion:
 *    Typically you use the function ATSUGetSoftLineBreaks by calling
 *    it twice, as follows: (1) Pass valid values for the iTextLayout,
 *    iRangeStart, iRangeLength, and oBreakCount parameters. Pass NULL
 *    for the oBreaks parameter and 0 for the iMaximumBreaks parameter.
 *    ATSUGetSoftLineBreaks returns the size of the font array in the
 *    oBreakCount parameter. (2) Allocate enough space for an array of
 *    the returned size, then call the function again, passing a valid
 *    pointer in the oBreaks parameter. On return, the pointer refers
 *    to an array containing the text range's soft line breaks. If you
 *    have just called ATSUBatchBreakLines, the oBreakCount parameter
 *    will give you the value you would normally obtain from step 1,
 *    allowing you to skip this step in such cases.
 *
 *  Parameters:
 *
 *    iTextLayout:
 *      A text layout to obtain a list of soft breaks from.
 *
 *    iRangeStart:
 *      The beginning of the range of text for which to obtain a list
 *      of softbreaks. To indicate that the specified text range starts
 *      at the beginning of the text buffer, you can pass the constant
 *      kATSUFromTextBeginning, To specify the entire text buffer, pass
 *      kATSUFromTextBeginning in this parameter and kATSUToTextEnd in
 *      the iRangeLength parameter.
 *
 *    iRangeLength:
 *      The end of the range of text for which to obtain a list of
 *      softbreaks. If you want the range of text to extend to the end
 *      of the text buffer, you can pass the constant kATSUToTextEnd.
 *
 *    iMaximumBreaks:
 *      The maximum number of soft line breaks to obtain. Typically,
 *      this is equivalent to the number of UniCharArrayOffset values
 *      for which you have allocated memory in the oBreaks array. To
 *      determine this value, see the Discussion.
 *
 *    oBreaks:
 *      On return, the array contains offsets from the beginning of the
 *      text buffer to each of the soft line breaks in the text range.
 *      If you are uncertain of how much memory to allocate for this
 *      array, see the Discussion. can be NULL
 *
 *    oBreakCount:
 *      On return, the number of soft breaks set in iTextLayout. Note
 *      that this value may be greater than what you pass in for
 *      iMaximumBreaks. can be NULL
 *
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function ATSUGetSoftLineBreaks( iTextLayout: ATSUTextLayout; iRangeStart: UniCharArrayOffset; iRangeLength: UniCharCount; iMaximumBreaks: ItemCount; oBreaks: UniCharArrayOffsetPtr; oBreakCount: ItemCountPtr ): OSStatus; external name '_ATSUGetSoftLineBreaks';


{
 *  ATSUClearSoftLineBreaks()
 *
 *  Summary:
 *    Unsets any currently set soft breaks in a range of text.
 *
 *  Discussion:
 *    This function clears all previously set soft line breaks for the
 *    specified text range and clears any associated layout caches as
 *    well.
 *
 *  Parameters:
 *
 *    iTextLayout:
 *      The text layout object for which to remove line breaks.
 *
 *    iRangeStart:
 *      The beginning of the text range over which to clear soft line
 *      breaks. To indicate that the specified text range starts at the
 *      beginning of the text buffer, you can pass the constant
 *      kATSUFromTextBeginning . To specify the entire text buffer,
 *      pass kATSUFromTextBeginning in this parameter and
 *      kATSUToTextEnd in the iRangeLength parameter.
 *
 *    iRangeLength:
 *      The length of the text range over which to clear soft line
 *      breaks. If you want the range of text to extend to the end of
 *      the text buffer, you can pass the constant kATSUToTextEnd.
 *
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function ATSUClearSoftLineBreaks( iTextLayout: ATSUTextLayout; iRangeStart: UniCharArrayOffset; iRangeLength: UniCharCount ): OSStatus; external name '_ATSUClearSoftLineBreaks';


{ ---------------------------------------------------------------------------- }
{  ATSUI highlighting                                                          }
{ ---------------------------------------------------------------------------- }
{
 *  ATSUSetHighlightingMethod()
 *
 *  Summary:
 *    Specifies the methods ATSUI will use for highlighting and
 *    unhighlighting text in a given layout.
 *
 *  Discussion:
 *    By default, ATSUI highlights text by "inverting" the region
 *    containing the text, that is, its background color. Although
 *    inversion provides satisfactory highlighting in most cases, it
 *    does not always provide the best result for grayscale text. (Mac
 *    OS X sets a lower threshold for antialiasing, while in Mac OS 9
 *    grayscale text can be turned off by the user.) In Mac OS X, when
 *    using a Quartz graphics context, you can instruct ATSUI to use
 *    the redraw method of highlighting, rather than simple inversion.
 *    (Note that Cocoa applications always use the redraw method of
 *    highlighting.) The redraw method allows for accurate highlighting
 *    of more complex backgrounds, such as those containing multiple
 *    colors, patterns, or pictures. To set redrawing on, call the
 *    ATSUSetHighlightingMethod function and specify that the redraw
 *    method be used (by passing kRedrawHighlighting in the iMethod
 *    parameter). If you specify the redraw method of highlighting when
 *    you call ATSUSetHighlightingMethod, then you must also specify
 *    how the background is to be redrawn when the function
 *    ATSUUnhighlightText is called. ATSUI can restore the desired
 *    background in one of two ways, depending on the background's
 *    complexity: (1) When the background is a single color (such as
 *    white), ATSUI can readily unhighlight the background. In such a
 *    case, you specify the background color that ATSUI uses by calling
 *    ATSUSetHighlightingMethod and setting iUnhighlightData.dataType
 *    to kATSUBackgroundColor and providing the background color in
 *    iUnhighlightData.unhighlightData. With these settings defined,
 *    when you call ATSUUnhighlightText, ATSUI simply calculates the
 *    previously highlighted area, repaints it with the specified
 *    background color, and then redraws the text. (2) When the
 *    background is more complex (containing, for example, multiple
 *    colors, patterns, or pictures), you must provide a redraw
 *    background callback function when you call
 *    ATSUSetHighlightingMethod. You do this by setting
 *    iUnhighlightData.dataType to kATSUBackgroundCallback and
 *    providing a RedrawBackgroundUPP in
 *    iUnhighlightData.unhighlightData . Then when you call
 *    ATSUUnhighlightText and ATSUI calls your callback, you are
 *    responsible for redrawing the background of the unhighlighted
 *    area. If you choose to also redraw the text, then your callback
 *    should return false as a function result. If your callback
 *    returns true ATSUI redraws any text that needs to be redrawn. See
 *    RedrawBackgroundProcPtr for additional information.
 *
 *  Parameters:
 *
 *    iTextLayout:
 *      The layout to which this highlight method should be applied.
 *
 *    iMethod:
 *      The type of highlighting to use; inversion
 *      (kInvertHighlighting) or redrawing (kRedrawHighlighting). The
 *      default is inversion. If you are happy with that technique
 *      there is no reason to call this function.
 *
 *    iUnhighlightData:
 *      Data needed to redraw the background or NULL if inversion is
 *      being chosen. See the definition of ATSUUnhighlightData for
 *      more information about the possible contents of this structure.
 *      Also see the Discussion for this function. can be NULL
 *
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function ATSUSetHighlightingMethod( iTextLayout: ATSUTextLayout; iMethod: ATSUHighlightMethod; iUnhighlightData: ATSUUnhighlightDataPtr ): OSStatus; external name '_ATSUSetHighlightingMethod';


{
 *  ATSUHighlightText()
 *
 *  Summary:
 *    Renders a highlighted range of text at a specified location in a
 *    QuickDraw graphics port or Quartz graphics context.
 *
 *  Discussion:
 *    When the user selects a series of glyphs, the characters in
 *    memory corresponding to the glyphs make up the selection range
 *    and should be highlighted to indicate where the next editing
 *    operation is to occur. The characters in a selection range are
 *    always contiguous in memory, but their corresponding glyphs are
 *    not necessarily so onscreen. If the selection range crosses a
 *    direction boundary, it is appropriate to display discontinuous
 *    highlighting. The ATSUHighlightText function renders a
 *    highlighted range of text at a specified location in a QuickDraw
 *    graphics port or Quartz graphics context, using the highlight
 *    information in the graphics port or context. ATSUHighlightText
 *    automatically produces discontinuous highlighting, if needed. You
 *    typically call the ATSUHighlightText function every time you need
 *    to draw or redraw highlighted text.
 *
 *  Parameters:
 *
 *    iTextLayout:
 *      A layout containing text to be highlighted.
 *
 *    iTextBasePointX:
 *      The x-coordinate of the origin (in either the current graphics
 *      port or in a Quartz graphics context) of the line containing
 *      the text range. Pass the constant kATSUUseGrafPortPenLoc to
 *      draw relative to the current pen location in the current
 *      graphics port.
 *
 *    iTextBasePointY:
 *      The y-coordinate of the origin (in either the current graphics
 *      port or in a Quartz graphics context) of the line containing
 *      the text range. Pass the constant kATSUUseGrafPortPenLoc to
 *      draw relative to the current pen location in the current
 *      graphics port.
 *
 *    iHighlightStart:
 *      The first character of the text range to be highlighted. If the
 *      text range spans multiple lines, you should call
 *      ATSUHighlightText for each line, passing the offset
 *      corresponding to the beginning of the new line to draw with
 *      each call. To indicate that the specified text range starts at
 *      the beginning of the text buffer, you can pass the constant
 *      kATSUFromTextBeginning. To specify the entire text buffer, pass
 *      kATSUFromTextBeginning in this parameter and kATSUToTextEnd in
 *      the iHighlightLength parameter.
 *
 *    iHighlightLength:
 *      The length of the text range to be highlighted. To indicate
 *      that the text range extends to the end of the text buffer, pass
 *      the constant kATSUToTextEnd.
 *
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function ATSUHighlightText( iTextLayout: ATSUTextLayout; iTextBasePointX: ATSUTextMeasurement; iTextBasePointY: ATSUTextMeasurement; iHighlightStart: UniCharArrayOffset; iHighlightLength: UniCharCount ): OSStatus; external name '_ATSUHighlightText';


{
 *  ATSUUnhighlightText()
 *
 *  Summary:
 *    Renders a previously highlighted range of text in an
 *    unhighlighted state.
 *
 *  Discussion:
 *    This function renders a previously highlighted range of text in
 *    an unhighlighted state. You should always call
 *    ATSUUnhighlightText after calling the function ATSUHighlightText
 *    to properly redraw the unhighlighted text and background. If the
 *    inversion method of highlighting was used, when you call
 *    ATSUUnhighlightText, it merely undoes the inversion and renders
 *    the text. If the redraw method of highlighting was used,
 *    ATSUUnhighlightText turns off the highlighting and restores the
 *    desired background. Depending on the complexity of the
 *    background, ATSUI restores the background in one of two ways:
 *    filling in a solid color, or repainting the background using a
 *    callback. See the function ATSUSetHighlightingMethod and the
 *    definition ATSUUnhighlightData for more information.
 *
 *  Parameters:
 *
 *    iTextLayout:
 *      A layout containing text to be unhighlighted.
 *
 *    iTextBasePointX:
 *      The x-coordinate of the origin (in either the current graphics
 *      port or in a Quartz graphics context) of the line containing
 *      the text range. Pass the constant kATSUUseGrafPortPenLoc to
 *      draw relative to the current pen location in the current
 *      graphics port.
 *
 *    iTextBasePointY:
 *      The y-coordinate of the origin (in either the current graphics
 *      port or in a Quartz graphics context) of the line containing
 *      the text range. Pass the constant kATSUUseGrafPortPenLoc to
 *      draw relative to the current pen location in the current
 *      graphics port.
 *
 *    iHighlightStart:
 *      The first character of the text range to be unhighlighted. If
 *      the text range spans multiple lines, you should call
 *      ATSUUnhighlightText for each line, passing the offset
 *      corresponding to the beginning of the new line to draw with
 *      each call. To indicate that the specified text range starts at
 *      the beginning of the text buffer, you can pass the constant
 *      kATSUFromTextBeginning. To specify the entire text buffer, pass
 *      kATSUFromTextBeginning in this parameter and kATSUToTextEnd in
 *      the iHighlightLength parameter.
 *
 *    iHighlightLength:
 *      The length of the text range to be unhighlighted. To indicate
 *      that the text range extends to the end of the text buffer, pass
 *      the constant kATSUToTextEnd.
 *
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function ATSUUnhighlightText( iTextLayout: ATSUTextLayout; iTextBasePointX: ATSUTextMeasurement; iTextBasePointY: ATSUTextMeasurement; iHighlightStart: UniCharArrayOffset; iHighlightLength: UniCharCount ): OSStatus; external name '_ATSUUnhighlightText';


{
 *  ATSUGetTextHighlight()
 *
 *  Summary:
 *    Obtains the highlight region for a range of text.
 *
 *  Discussion:
 *    Use this function to obtain the screen region that ATSUI would
 *    normally highlight automatically when ATSUHighlightText is
 *    called. This is useful if you wish to perform your own
 *    highlighting.
 *
 *  Parameters:
 *
 *    iTextLayout:
 *      A layout containing text to be highlighted.
 *
 *    iTextBasePointX:
 *      The x-coordinate of the origin (in either the current graphics
 *      port or in a Quartz graphics context) of the line containing
 *      the text range. Pass the constant kATSUUseGrafPortPenLoc to
 *      draw relative to the current pen location in the current
 *      graphics port.
 *
 *    iTextBasePointY:
 *      The y-coordinate of the origin (in either the current graphics
 *      port or in a Quartz graphics context) of the line containing
 *      the text range. Pass the constant kATSUUseGrafPortPenLoc to
 *      draw relative to the current pen location in the current
 *      graphics port.
 *
 *    iHighlightStart:
 *      The first character of the text range to be highlighted. If the
 *      text range spans multiple lines, you should call
 *      ATSUGetTextHighlight for each line, passing the offset
 *      corresponding to the beginning of the new line to draw with
 *      each call. To indicate that the specified text range starts at
 *      the beginning of the text buffer, you can pass the constant
 *      kATSUFromTextBeginning. To specify the entire text buffer, pass
 *      kATSUFromTextBeginning in this parameter and kATSUToTextEnd in
 *      the iHighlightLength parameter.
 *
 *    iHighlightLength:
 *      The length of the text range to be highlighted. To indicate
 *      that the text range extends to the end of the text buffer, pass
 *      the constant kATSUToTextEnd.
 *
 *    oHighlightRegion:
 *      On return, ATSUGetTextHighlight produces a MacRegion structure
 *      containing the highlight region for the specified range of
 *      text. In the case of discontinuous highlighting, the region
 *      consists of multiple components, with MacRegion.rgnBBox
 *      specifying the bounding box around the entire area of
 *      discontinuous highlighting.
 *
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function ATSUGetTextHighlight( iTextLayout: ATSUTextLayout; iTextBasePointX: ATSUTextMeasurement; iTextBasePointY: ATSUTextMeasurement; iHighlightStart: UniCharArrayOffset; iHighlightLength: UniCharCount; oHighlightRegion: RgnHandle ): OSStatus; external name '_ATSUGetTextHighlight';


{
 *  ATSUHighlightInactiveText()
 *
 *  Summary:
 *    Highlights text using the standard Mac OS X UI convention for an
 *    inactive window or UI pane.
 *
 *  Discussion:
 *    Use this function to redraw text when a window or UI pane
 *    containing highlighted text becomes inactive. Once the window or
 *    UI pane becomes active again, call ATSUHighlightText to
 *    rehighlight the text in active mode.
 *
 *  Parameters:
 *
 *    iTextLayout:
 *      A layout containing text to be highlighted.
 *
 *    iTextBasePointX:
 *      The x-coordinate of the origin (in either the current graphics
 *      port or in a Quartz graphics context) of the line containing
 *      the text range. Pass the constant kATSUUseGrafPortPenLoc to
 *      draw relative to the current pen location in the current
 *      graphics port.
 *
 *    iTextBasePointY:
 *      The y-coordinate of the origin (in either the current graphics
 *      port or in a Quartz graphics context) of the line containing
 *      the text range. Pass the constant kATSUUseGrafPortPenLoc to
 *      draw relative to the current pen location in the current
 *      graphics port.
 *
 *    iHighlightStart:
 *      The first character of the text range to be highlighted. If the
 *      text range spans multiple lines, you should call
 *      ATSUHighlightInactiveText for each line, passing the offset
 *      corresponding to the beginning of the new line to draw with
 *      each call. To indicate that the specified text range starts at
 *      the beginning of the text buffer, you can pass the constant
 *      kATSUFromTextBeginning. To specify the entire text buffer, pass
 *      kATSUFromTextBeginning in this parameter and kATSUToTextEnd in
 *      the iHighlightLength parameter.
 *
 *    iHighlightLength:
 *      The length of the text range to be highlighted. To indicate
 *      that the text range extends to the end of the text buffer, pass
 *      the constant kATSUToTextEnd.
 *
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in ApplicationServices.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
function ATSUHighlightInactiveText( iTextLayout: ATSUTextLayout; iTextBasePointX: ATSUTextMeasurement; iTextBasePointY: ATSUTextMeasurement; iHighlightStart: UniCharArrayOffset; iHighlightLength: UniCharCount ): OSStatus; external name '_ATSUHighlightInactiveText';


{ ---------------------------------------------------------------------------- }
{  ATSUI hit-testing                                                           }
{ ---------------------------------------------------------------------------- }
{
 *  ATSUPositionToOffset()
 *
 *  Summary:
 *    Obtains the memory offset for the glyph edge nearest a mouse-down
 *    event.
 *
 *  Discussion:
 *    The process of hit-testing text obtains the location of a
 *    mouse-down event relative both to the position of onscreen glyphs
 *    and to the corresponding offset between character codes in
 *    memory. You can then use the location information obtained by
 *    hit-testing to set the insertion point (that is, the caret) or
 *    selection range (for highlighting). Hit-testing text is
 *    complicated by the fact that a given line of text may be
 *    bidirectional. Therefore, the onscreen order of glyphs may not
 *    readily correspond to the storage order of the corresponding
 *    character codes. And the concept of which glyph comes "first" in
 *    a line of text cannot always be limited to the visual terms
 *    "left" and "right." Because of these complexities, it is more
 *    accurate to speak in terms of "leading" and "trailing" edges to
 *    glyphs. A "leading edge" is defined as the edge of a glyph that
 *    you first encounter when you read the text that includes that
 *    glyph. For example, when reading Roman text, you first encounter
 *    the left edge of a Roman glyph. Similarly, the "trailing edge" is
 *    defined as the edge of the glyph encountered last. This function
 *    produces the memory offset corresponding to the glyph edge
 *    nearest the event. If the mouse-down event occurs at a line
 *    direction boundary or within a glyph cluster,
 *    ATSUPositionToOffset produces two offsets. You can then provide
 *    the offset(s) to the ATSUOffsetToPosition function to obtain the
 *    actual caret position(s) for the event. When you call the
 *    ATSUPositionToOffset function, ATSUI examines the Unicode
 *    directionality of the character corresponding to the event
 *    location. The ATSUPositionToOffset function produces a value of
 *    true in the oIsLeading parameter if the offset is leading (that
 *    is, more closely associated with the subsequent character in
 *    memory and therefore indicative of a left-to-right line
 *    direction). It produces a value of false if the offset is
 *    trailing (that is, more closely associated with the preceding
 *    character in memory and indicative of a right-to-left line
 *    direction). Finally, note that when the event occurs beyond the
 *    leftmost or rightmost caret positions of the line (not taking
 *    into account line rotation), such that no glyph corresponds to
 *    the location of the hit, the ATSUPositionToOffset function
 *    produces the primary offset of the closest edge of the line to
 *    the input location. The oIsLeading flag depends on the
 *    directionality of the closest glyph and the side of the line to
 *    which the input location is closest. In this case, the secondary
 *    offset is equal to the primary offset, since no glyph was hit.
 *
 *  Parameters:
 *
 *    iTextLayout:
 *      The layout object in which the mouse-down event occurred.
 *
 *    iLocationX:
 *      The x-coordinate of the event, in local coordinates, relative
 *      to the origin of the line where the event occurred. That is, to
 *      specify the x-coordinate value, you should subtract the
 *      x-coordinate of the line origin from the x-coordinate of the
 *      hit point (in local coordinates). You can pass the constant
 *      kATSUUseGrafPortPenLoc for the location of the mouse-down event
 *      relative to the current pen location in the current graphics
 *      port.
 *
 *    iLocationY:
 *      The y-coordinate of the event, in local coordinates, relative
 *      to the origin of the line where the event occurred. That is, to
 *      specify the y-coordinate value, you should subtract the
 *      y-coordinate of the line origin from the y-coordinate of the
 *      hit point (in local coordinates). You can pass the constant
 *      kATSUUseGrafPortPenLoc for the location of the mouse-down event
 *      relative to the current pen location in the current graphics
 *      port.
 *
 *    ioPrimaryOffset:
 *      On input, a pointer to a UniCharArrayOffset value specifying
 *      the offset corresponding to the beginning of the line where the
 *      event occurred. On return, the value specifies the offset
 *      corresponding to the glyph edge that is visually closest to the
 *      event. To determine whether this offset indicates the leading
 *      or trailing edge of the glyph, you can examine the value
 *      produced in the oIsLeading parameter.
 *
 *    oIsLeading:
 *      On return, the value indicates whether the offset produced in
 *      the ioPrimaryOffset parameter is leading or trailing. The
 *      function ATSUPositionToOffset produces a value of true if the
 *      offset is leading (that is, more closely associated with the
 *      subsequent character in memory). It produces a value of false
 *      if the offset is trailing (that is, more closely associated
 *      with the preceding character in memory).
 *
 *    oSecondaryOffset:
 *      On return, the value typically specifies the same offset as
 *      that produced in the ioPrimaryOffset parameter, unless the
 *      event occurred within a glyph cluster or at a line direction
 *      boundary. If so, the value specifies a secondary offset. The
 *      secondary offset is associated with the glyph that has a
 *      different direction from the primary line direction.
 *
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function ATSUPositionToOffset( iTextLayout: ATSUTextLayout; iLocationX: ATSUTextMeasurement; iLocationY: ATSUTextMeasurement; var ioPrimaryOffset: UniCharArrayOffset; var oIsLeading: Boolean; var oSecondaryOffset: UniCharArrayOffset ): OSStatus; external name '_ATSUPositionToOffset';


{
 *  ATSUOffsetToPosition()
 *
 *  Summary:
 *    Obtains the caret position(s) corresponding to a memory offset.
 *
 *  Discussion:
 *    This function produces two structures of type ATSUCaret. These
 *    structures contain the pen positioning information needed to draw
 *    the caret(s) for the event, specified relative to the origin of
 *    the line in the current graphics port or graphics context.
 *    Specifically, the ATSUCaret structures contain x-y coordinates
 *    for both the caret's starting and ending pen positions (the
 *    latter taking into account line rotation, caret slanting, and
 *    split-caret appearances). If the offset you pass to
 *    ATSUOffsetToPosition is at a line boundary, the structure
 *    produced in the oMainCaret parameter contains the starting and
 *    ending pen locations for the high caret, while the oSecondCaret
 *    parameter contains the corresponding values for the low caret. If
 *    the offset is not at a line boundary, both parameters contain the
 *    starting and ending pen locations of the main caret. Because you
 *    provide the ATSUOffsetToPosition function an offset relative to
 *    the origin of the line where the hit occurred,
 *    ATSUOffsetToPosition produces positioning information that is
 *    also relative. Therefore, you must transform the positions
 *    produced by the ATSUOffsetToPosition function before drawing the
 *    caret(s). To transform the caret location(s), add the starting
 *    and ending caret coordinates to the coordinates of the origin of
 *    the line in which the hit occurred. For example, if
 *    ATSUOffsetToPosition produces starting and ending pen locations
 *    of (25,0), (25,25) in the oMainCaret parameter (and the
 *    oSecondCaret parameter contains the same coordinates, meaning
 *    that the caret was not split), you would add these to the
 *    position of the origin of the line in the graphics port or
 *    context. If the position of the line origin was at (50,50), then
 *    the starting and ending pen locations of the caret would be
 *    (75,50), (75,75).
 *
 *  Parameters:
 *
 *    iTextLayout:
 *      The layout containing the offset.
 *
 *    iOffset:
 *      The offset into the text buffer for which you wish to obtain a
 *      caret position. To respond to a mouse-down event, pass the
 *      offset returned in the ioPrimaryOffset parameter from the
 *      function ATSUPositionToOffset. That is, the offset
 *      corresponding to the glyph edge closest to the event.
 *
 *    iIsLeading:
 *      A Boolean value indicating whether the offset corresponds to
 *      the leading or trailing edge of the glyph. You can obtain this
 *      information from the function ATSUPositionToOffset. This value
 *      is relevant if the offset occurs at a line direction boundary
 *      or within a glyph cluster.
 *
 *    oMainCaret:
 *      On return, contains the starting and ending pen locations of
 *      the high caret if the value produced in oCaretIsSplit is true.
 *      If the value is false, the structure contains the starting and
 *      ending pen locations of the main caret.
 *
 *    oSecondCaret:
 *      On return, contains the starting and ending pen locations of
 *      the low caret if the value passed back in the oCaretIsSplit
 *      parameter is true. If the value is false, the structure
 *      contains the starting and ending pen locations of the main
 *      caret (that is, the same values as the oMainCaret parameter).
 *
 *    oCaretIsSplit:
 *      On return, indicates whether the offset specified in the
 *      iOffset parameter occurs at a line direction boundary. If true,
 *      the offset occurs at a line direction boundary; otherwise,
 *      false.
 *
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function ATSUOffsetToPosition( iTextLayout: ATSUTextLayout; iOffset: UniCharArrayOffset; iIsLeading: Boolean; var oMainCaret: ATSUCaret; var oSecondCaret: ATSUCaret; var oCaretIsSplit: Boolean ): OSStatus; external name '_ATSUOffsetToPosition';


{
 *  ATSUPositionToCursorOffset()
 *
 *  Summary:
 *    Obtains the memory offset for the glyph edge nearest a mouse-down
 *    event, after a move of the specified length.
 *
 *  Discussion:
 *    This function produces the memory offset for the glyph edge
 *    nearest a mouse-down event, after a move of the specified length.
 *    This offset corresponds to where an insertion point would be
 *    placed after the move.
 *
 *  Parameters:
 *
 *    iTextLayout:
 *      The layout in which the mouse down event occured.
 *
 *    iLocationX:
 *      The x-coordinate of the event, in local coordinates, relative
 *      to the origin of the line where the event occurred. That is, to
 *      specify the x-coordinate value, you should subtract the
 *      x-coordinate of the line origin from the x-coordinate of the
 *      hit point (in local coordinates). You can pass the constant
 *      kATSUUseGrafPortPenLoc for the location of the mouse-down event
 *      relative to the current pen location in the current graphics
 *      port.
 *
 *    iLocationY:
 *      The y-coordinate of the event, in local coordinates, relative
 *      to the origin of the line where the event occurred. That is, to
 *      specify the y-coordinate value, you should subtract the
 *      y-coordinate of the line origin from the y-coordinate of the
 *      hit point (in local coordinates). You can pass the constant
 *      kATSUUseGrafPortPenLoc for the location of the mouse-down event
 *      relative to the current pen location in the current graphics
 *      port.
 *
 *    iMovementType:
 *      A constant specifying the type of cursor movement to use. See
 *      the definition of ATSUCursorMovementType for possible values to
 *      pass for this parameter.
 *
 *    ioPrimaryOffset:
 *      On input, the offset corresponding to the beginning of the line
 *      where the event occurred. On return, the offset corresponding
 *      to the glyph edge nearest the event, after a movement of the
 *      specified type. This offset corresponds to where the insertion
 *      point would be placed after the move. To determine whether this
 *      offset indicates the leading or trailing edge of the glyph, you
 *      can examine the value produced in the oIsLeading parameter.
 *
 *    oIsLeading:
 *      On return, the value indicates whether the offset produced in
 *      the ioPrimaryOffset parameter is leading or trailing. The
 *      ATSUPositionToOffset function produces a value of true if the
 *      offset is leading (that is, more closely associated with the
 *      subsequent character in memory). It produces a value of false
 *      if the offset is trailing (that is, more closely associated
 *      with the preceding character in memory).
 *
 *    oSecondaryOffset:
 *      On return, the value typically specifies the same offset as
 *      that produced in the ioPrimaryOffset parameter, unless the
 *      event occurred within a glyph cluster or at a line direction
 *      boundary. If so, the value specifies the secondary offset, for
 *      the glyph edge furthest from the event.
 *
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.5 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 9.2.2 and later
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function ATSUPositionToCursorOffset( iTextLayout: ATSUTextLayout; iLocationX: ATSUTextMeasurement; iLocationY: ATSUTextMeasurement; iMovementType: ATSUCursorMovementType; var ioPrimaryOffset: UniCharArrayOffset; var oIsLeading: Boolean; var oSecondaryOffset: UniCharArrayOffset ): OSStatus; external name '_ATSUPositionToCursorOffset';


{
 *  ATSUOffsetToCursorPosition()
 *
 *  Summary:
 *    Obtains the caret position(s) corresponding to a memory offset,
 *    after a move of the specified length.
 *
 *  Discussion:
 *    Use this function in conjunction with ATSUPositionToCursorOffset
 *    to determine where to draw the caret after a mouse-down event.
 *    The movement type parameter allows you to have the cursor "snap"
 *    to different parts of the text depending on the type of movement
 *    selected (i.e., words or characters). See the definition of
 *    ATSUCursorMovementType for more information on possible values.
 *
 *  Parameters:
 *
 *    iTextLayout:
 *      The text layout object in which the mouse-down event occurred.
 *
 *    iOffset:
 *      The offset corresponding to the glyph edge nearest the event,
 *      after a movement of the specified type. You can obtain this
 *      value by examining the offset produced in the ioPrimaryOffset
 *      parameter of the function ATSUPositionToCursorOffset.
 *
 *    iIsLeading:
 *      A Boolean value indicating whether the specified offset
 *      corresponds to the leading or trailing edge of the glyph. You
 *      can obtain this information from the function
 *      ATSUPositionToCursorOffset . This value is relevant if the
 *      offset occurs at a line direction boundary or within a glyph
 *      cluster.
 *
 *    iMovementType:
 *      A constant specifying the unit of cursor movement. See the
 *      definition of ATSUCursorMovementType for possible values to
 *      pass for this parameter.
 *
 *    oMainCaret:
 *      On return, the structure contains the starting and ending pen
 *      locations of the high caret if the value produced in the
 *      oCaretIsSplit parameter is true. If the value is false, the
 *      structure contains the starting and ending pen locations of the
 *      main caret.
 *
 *    oSecondCaret:
 *      On return, the structure contains the starting and ending pen
 *      locations of the low caret if the value passed back in the
 *      oCaretIsSplit parameter is true. If the value is false, the
 *      structure contains the starting and ending pen locations of the
 *      main caret (that is, the same values as the oMainCaret
 *      parameter).
 *
 *    oCaretIsSplit:
 *      On return, the value indicates whether the offset specified in
 *      the iOffset parameter occurs at a line direction boundary. If
 *      true, the offset occurs at a line direction boundary;
 *      otherwise, false.
 *
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.5 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 9.2.2 and later
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function ATSUOffsetToCursorPosition( iTextLayout: ATSUTextLayout; iOffset: UniCharArrayOffset; iIsLeading: Boolean; iMovementType: ATSUCursorMovementType; var oMainCaret: ATSUCaret; var oSecondCaret: ATSUCaret; var oCaretIsSplit: Boolean ): OSStatus; external name '_ATSUOffsetToCursorPosition';


{ ---------------------------------------------------------------------------- }
{  ATSUI cursor movement                                                       }
{ ---------------------------------------------------------------------------- }
{
 *  ATSUNextCursorPosition()
 *
 *  Summary:
 *    Obtains the memory offset for the insertion point that follows
 *    the current insertion point in storage order, as determined by a
 *    move of the specified length and type.
 *
 *  Discussion:
 *    Together with ATSUPreviousCursorPosition, this function allows an
 *    application to "walk" the text buffer in storage order, moving
 *    the cursor by a specified amount and movement type at each step.
 *    To move through the text buffer in screen order, use the
 *    functions ATSURightwardCursorPosition and
 *    ATSULeftwardCursorPosition.
 *
 *  Parameters:
 *
 *    iTextLayout:
 *      The layout in which to perform the cursor movement.
 *
 *    iOldOffset:
 *      The previous cursor position.
 *
 *    iMovementType:
 *      A constant specifying the unit of cursor movement. See the
 *      definition of ATSUCursorMovementType for possible values to
 *      pass for this parameter.
 *
 *    oNewOffset:
 *      On return, the new cursor position.
 *
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function ATSUNextCursorPosition( iTextLayout: ATSUTextLayout; iOldOffset: UniCharArrayOffset; iMovementType: ATSUCursorMovementType; var oNewOffset: UniCharArrayOffset ): OSStatus; external name '_ATSUNextCursorPosition';


{
 *  ATSUPreviousCursorPosition()
 *
 *  Summary:
 *    Obtains the memory offset for the insertion point that preceeds
 *    the current insertion point in storage order, as determined by a
 *    move of the specified length and type.
 *
 *  Discussion:
 *    Together with ATSUNextCursorPosition, this function allows an
 *    application to "walk" the text buffer in storage order, moving
 *    the cursor by a specified amount and movement type at each step.
 *    To move through the text buffer in screen order, use the
 *    functions ATSURightwardCursorPosition and
 *    ATSULeftwardCursorPosition.
 *
 *  Parameters:
 *
 *    iTextLayout:
 *      The layout in which to perform the cursor movement.
 *
 *    iOldOffset:
 *      The previous cursor position.
 *
 *    iMovementType:
 *      A constant specifying the unit of cursor movement. See the
 *      definition of ATSUCursorMovementType for possible values to
 *      pass for this parameter.
 *
 *    oNewOffset:
 *      On return, the new cursor position.
 *
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function ATSUPreviousCursorPosition( iTextLayout: ATSUTextLayout; iOldOffset: UniCharArrayOffset; iMovementType: ATSUCursorMovementType; var oNewOffset: UniCharArrayOffset ): OSStatus; external name '_ATSUPreviousCursorPosition';


{
 *  ATSURightwardCursorPosition()
 *
 *  Summary:
 *    Obtains the memory offset for the insertion point that is to the
 *    right of the current insertion point, as determined by a move of
 *    the specified length and type.
 *
 *  Discussion:
 *    Together with ATSULeftwardCursorPosition, this function allows an
 *    application to "walk" the text buffer in screen order, moving the
 *    cursor by a specified amount and movement type at each step. To
 *    move through the text buffer in storage order, use the functions
 *    ATSUNextCursorPosition and ATSUPreviousCursorPosition. Note that
 *    if you are drawing the cursor after a cursor move, you should use
 *    ATSUOffsetToPosition to obtain an ATSUCaret that determines the
 *    on screen location of the new cursor position. Always store the
 *    ATSUCaret from the previous cursor position as well, as this can
 *    help determine which caret to use in the case of a split caret.
 *    When performing leftward and rightward cursor movement, always
 *    use the caret closest to the previous caret. This maintains
 *    visual order when moving the cursor on screen.
 *
 *  Parameters:
 *
 *    iTextLayout:
 *      The layout in which to perform the cursor movement.
 *
 *    iOldOffset:
 *      The previous cursor position.
 *
 *    iMovementType:
 *      A constant specifying the unit of cursor movement. See the
 *      definition of ATSUCursorMovementType for possible values to
 *      pass for this parameter.
 *
 *    oNewOffset:
 *      On return, the new cursor position.
 *
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function ATSURightwardCursorPosition( iTextLayout: ATSUTextLayout; iOldOffset: UniCharArrayOffset; iMovementType: ATSUCursorMovementType; var oNewOffset: UniCharArrayOffset ): OSStatus; external name '_ATSURightwardCursorPosition';


{
 *  ATSULeftwardCursorPosition()
 *
 *  Summary:
 *    Obtains the memory offset for the insertion point that is to the
 *    left of the current insertion point, as determined by a move of
 *    the specified length and type.
 *
 *  Discussion:
 *    Together with ATSURightwardCursorPosition, this function allows
 *    an application to "walk" the text buffer in screen order, moving
 *    the cursor by a specified amount and movement type at each step.
 *    To move through the text buffer in storage order, use the
 *    functions ATSUNextCursorPosition and ATSUPreviousCursorPosition.
 *    Note that if you are drawing the cursor after a cursor move, you
 *    should use ATSUOffsetToPosition to obtain an ATSUCaret that
 *    determines the on screen location of the new cursor position.
 *    Always store the ATSUCaret from the previous cursor position as
 *    well, as this can help determine which caret to use in the case
 *    of a split caret. When performing leftward and rightward cursor
 *    movement, always use the caret closest to the previous caret.
 *    This maintains visual order when moving the cursor on screen.
 *
 *  Parameters:
 *
 *    iTextLayout:
 *      The layout in which to perform the cursor movement.
 *
 *    iOldOffset:
 *      The previous cursor position.
 *
 *    iMovementType:
 *      A constant specifying the unit of cursor movement. See the
 *      definition of ATSUCursorMovementType for possible values to
 *      pass for this parameter.
 *
 *    oNewOffset:
 *      On return, the new cursor position.
 *
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function ATSULeftwardCursorPosition( iTextLayout: ATSUTextLayout; iOldOffset: UniCharArrayOffset; iMovementType: ATSUCursorMovementType; var oNewOffset: UniCharArrayOffset ): OSStatus; external name '_ATSULeftwardCursorPosition';


{ Functions listed beyond this point are either deprecated or not recommended }

{
 *  ATSUMeasureText()
 *
 *  Discussion:
 *    This function is no longer recommended. Please use
 *    ATSUGetUnjustifiedBounds instead.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function ATSUMeasureText( iTextLayout: ATSUTextLayout; iLineStart: UniCharArrayOffset; iLineLength: UniCharCount; var oTextBefore: ATSUTextMeasurement; var oTextAfter: ATSUTextMeasurement; var oAscent: ATSUTextMeasurement; var oDescent: ATSUTextMeasurement ): OSStatus; external name '_ATSUMeasureText';
{unit ATSUnicodeFlattening}
{$ALIGN MAC68K}







{ ---------------------------------------------------------------------------- }
{ Constants                                                                    }
{ ---------------------------------------------------------------------------- }
{
   ATSUFlattenedDataStreamFormat is used to inform the APIs which flatten and
   unflatten style runs exactly what type of data that they should be generating
   or parsing.
}

type ATSUFlattenedDataStreamFormat = UInt32;
const
  kATSUDataStreamUnicodeStyledText = $7573746C (* 'ustl' *);


{
   ATSUFlattenStyleRunOptions is a bitfield list of options that can be passed
   into the ATSUFlattenStyleRunsToStream API. Currently, there are no options.
   This is here for future expansion.
}
type ATSUFlattenStyleRunOptions = UInt32;
const
  kATSUFlattenOptionNoOptionsMask = $00000000;

{
   ATSUUnFlattenStyleRunOptions is a bitfield list of options that can be passed
   into the ATSUUnFlattenStyleRunsToStream API. Currently, there are no options.
   This is here for future expansion.
}
type ATSUUnFlattenStyleRunOptions = UInt32;
const
  kATSUUnFlattenOptionNoOptionsMask = $00000000;


{ ---------------------------------------------------------------------------- }
{ Data Types                                                                   }
{ ---------------------------------------------------------------------------- }

{
   ATSUStyleRunInfo is a structure that contrains an index into an array of
   unique ATSUStyle objects as well as the length of the run that the style run
   object covers. This structure is utilized by ATSUUnflattenStyleRunsFromStream()
   to return the style run info to the caller.
}
type
    ATSUStyleRunInfo = record
        runLength: UniCharCount;
        styleObjectIndex: ItemCount;
    end;
    ATSUStyleRunInfoPtr = ^ATSUStyleRunInfo;
{ ---------------------------------------------------------------------------- }
{ 'ustl' structure data structures and definitions                             }
{ ---------------------------------------------------------------------------- }
{
   The 'ustl' data structure follows this format:
   1. Main Data Structure Block Header
   2. Flattened Text Layout Data
   3. Flattened Style Run Data
   4. Flattened Style Data
   Per the 'ustl' spec, these structures should maintain four-byte alignment.
   For things that are variable width (such as font names), padding bytes must
   be added to ensure that this alignment is always kept.
}

{
   structure versioning - the version of the 'ustl' that the ATSUI parsing
   and generating functions will handle is version 2 or greater. Earlier
   versions were not completly specified and have been obsoleted.
}
const
  kATSFlatDataUstlVersion0      = 0;
  kATSFlatDataUstlVersion1      = 1;
  kATSFlatDataUstlVersion2      = 2;
  kATSFlatDataUstlCurrentVersion = kATSFlatDataUstlVersion2;

{ ------------------ }
{ Block 1 Structures }
{ ------------------ }

{
   This is the main data structure block header. It describes the rest
   of the data and how it is structured.
}
type
    ATSFlatDataMainHeaderBlock = record

                                              { the 'ustl' version number. This needs to be the first item in the}
                                              { data block do as not to confuse parsers of earlier (and possibly}
                                              { later) versions of the spec *|}
        version: UInt32;

                                              { the total size of the stream in bytes, including the four bytes in}
                                              { the version above}
        sizeOfDataBlock: ByteCount;

                                              { offset from the beginning of the stream to the flattened text layout data.}
                                              { This can be set to 0 if there are no text layouts stored in the stream.}
        offsetToTextLayouts: ByteCount;

                                              { offset from the beginning of the stream to the flattened style run data. }
                                              { This can be set to 0 if there is no flattened style run data in the stream}
        offsetToStyleRuns: ByteCount;

                                              { offset to the flattened style list data. This can be set to 0 if there}
                                              { is no flattened style list data}
        offsetToStyleList: ByteCount;
    end;
    ATSFlatDataMainHeaderBlockPtr = ^ATSFlatDataMainHeaderBlock;
{ ------------------ }
{ Block 2 Structures }
{ ------------------ }
{
   The Block 2 Structures are not currently used by any of ATSUI's internal parsing
   or packing routines. They are, however, part of the 'ustl' standard and are put
   here for developer conveniance, as well as to properly define the standard.
}

{
   This is the header that is attached to each flattened text layout. The
   number of flattened text layouts in the stucture is specified by the
   ATSFlatDataTextLayoutHeader structure that is below.
}
type
    ATSFlatDataTextLayoutDataHeader = record

                                              { the total size of this particular flattened text layout, including any}
                                              { padding bytes and such. }
        sizeOfLayoutData: ByteCount;

                                              { the number of characters covered by this flattened text layout}
        textLayoutLength: ByteCount;

                                              { the byte offset relative to the start of this structure to the flattened}
                                              { layout control data. This can be set to zero if there are no layout}
                                              { controls.}
        offsetToLayoutControls: ByteCount;

                                              { the byte offset, relative to the start of this structure to the}
                                              { flattened line info. This can be set to zero if there is no line info }
                                              { in this layout.}
        offsetToLineInfo: ByteCount;

                                              { if the offsetToLayoutControls is non-zero, then following this block}
                                              { there will be a ATSFlattenedLayoutDataFlattenedLayoutControlsHeader}
                                              { followed by an array of ATSFlattenedLayoutDataFlattenedLayoutControls}
                                              { structures. If the offsetToLineInfo is non-zero, then following the}
                                              { flattened layout controls will be a ATSFlatDataLineInfoHeader}
                                              { structure.}
    end;
    ATSFlatDataTextLayoutDataHeaderPtr = ^ATSFlatDataTextLayoutDataHeader;
{
   This is the the main header for block 2. If there is a block 2, then there
   needs to be one of these. This structure is what the offsetToTextLayouts
   points to in block 1.
}
type
    ATSFlatDataTextLayoutHeader = record

                                              { the total number of flattened text layouts stored in this block.}
                                              { This must be non-zero, as if there were no flattened text layouts, the}
                                              { entire block 2 would not exist}
        numFlattenedTextLayouts: ItemCount;

                                              { first of possibly many flattened text layouts. There should be one of}
                                              { these for each flattened text layout as determined by the}
                                              { numFlattenedTextLayouts above. }
        flattenedTextLayouts: array[0..0] of ATSFlatDataTextLayoutDataHeader;
    end;
    ATSFlatDataTextLayoutHeaderPtr = ^ATSFlatDataTextLayoutHeader;
{
   This is the header for the flattened layout controls structure. This is
   the structure that a non-zero offsetToLayoutControls points to in the
   ATSFlatDataTextLayoutDataHeader
}
type
    ATSFlatDataLayoutControlsDataHeader = record

                                              { the number of flattened layout controls. It is suggested that there be}
                                              { at least one layout control to output the line direction for the layout}
        numberOfLayoutControls: ItemCount;

                                              { first of possibly many flattened layout controls. There should be one }
                                              { of these for each layout control as determined by the}
                                              { numberOfLayoutControls above. Of course, if there are no layout controls,}
                                              { then this structure shouldn't even exist. Each attribute info structure}
                                              { in the array could be followed by additional padding bytes in order}
                                              { to maintain four-byte alignment. These padding bytes are not to be}
                                              { included in the fValueSize member of each structure. }
        controlArray: array[0..0] of ATSUAttributeInfo;
    end;
    ATSFlatDataLayoutControlsDataHeaderPtr = ^ATSFlatDataLayoutControlsDataHeader;
type
    ATSFlatDataLineInfoData = record

                                              { the length of this particular line in UniChars}
        lineLength: UniCharCount;

                                              { the number of line controls applied to this line. This can be set}
                                              { to zero if there are no special line controls applied to this line.}
        numberOfLineControls: ItemCount;

                                              { the numberOfLineControls is non-zero, then following this structure}
                                              { must be an array of ATSUAttributeInfo structures. There must be one}
                                              { ATSUAttributeInfo structure for each numberOfLineControls above.}
    end;
    ATSFlatDataLineInfoDataPtr = ^ATSFlatDataLineInfoData;
{
   This structure is the main data header for the flattened line info data. This
   is what a non-zero offsetToLineInfo points to in the
   ATSFlatDataTextLayoutDataHeader structure above.
}
type
    ATSFlatDataLineInfoHeader = record

                                              { the number of flattened line info structures that are stored in this}
                                              { block. This value should really be equal to the number of soft line}
                                              { breaks in the layout + 1. Of course if numberOfLines is zero, then}
                                              { this structure shouldn't even be used.}
        numberOfLines: ItemCount;

                                              { the first in a array of ATSFlatDataLineInfoData structures. There}
                                              { needs to be a ATSFlatDataLineInfoData for each numberOfLines}
                                              { specified above.}
        lineInfoArray: array[0..0] of ATSFlatDataLineInfoData;
    end;
    ATSFlatDataLineInfoHeaderPtr = ^ATSFlatDataLineInfoHeader;
{ ------------------ }
{ Block 3 Structures }
{ ------------------ }
{
   The block 3 structures are used by ATSUI style run flattening and parsing
   functions, ATSUFlattenStyleRunsToStream and ATSUUnflattenStyleRunsFromStream
   to represent flattened style run information. These structures go hand and
   hand with the block 4 structures.
}

{
   This is the data header that appears before the style run data structures.
   This structure is what a non-zero offsetToStyleRuns in the
   ATSFlatDataMainHeaderBlock points to in block 1.
}
type
    ATSFlatDataStyleRunDataHeader = record

                                              { the number of style run data structures stored in this block}
        numberOfStyleRuns: ItemCount;

                                              { the first in an array of ATSUStyleRunInfo structures. There needs to}
                                              { be a ATSUStyleRunInfo structure for each numberOfStyleRuns specified}
                                              { above. This structure is defined in ATSUnicode.h}
        styleRunArray: array[0..0] of ATSUStyleRunInfo;
    end;
    ATSFlatDataStyleRunDataHeaderPtr = ^ATSFlatDataStyleRunDataHeader;
{ ------------------ }
{ Block 4 Structures }
{ ------------------ }
{
   The block 4 structures store flattened ATSUStyle objects. This too, is
   currently used by the ATSUI style run flattening and parsing functions,
   ATSUFlattenStyleRunsToStream and ATSUUnflattenStyleRunsFromStream.
}

{
   this structure forms the beginning of an individually flattened ATSUStyle
   object.
}
type
    ATSFlatDataStyleListStyleDataHeader = record

                                              { the size of this flattened style object, including these four bytes and}
                                              { any padding bytes at the end of the structure. Basically, this can be}
                                              { used to determine where the next structure in the array begins.}
        sizeOfStyleInfo: ByteCount;

                                              { the number of attributes set in this flattened style object. This should }
                                              { be at least one for the font data, although it can be 0 if this is to be}
                                              { unspecfied.}
        numberOfSetAttributes: ItemCount;

                                              { the number of font features set in the flattened style object. This can}
                                              { be set to 0 if there are no font features set in the style object. }
        numberOfSetFeatures: ItemCount;

                                              { the number of font variations set in the flattened style object. This}
                                              { can be set to 0 if there are no font variations set in the style object.}
        numberOfSetVariations: ItemCount;

                                              { after this structure header, there is the following data in this block:}

                                              { 1. if the numberOfSetAttributes is non-zero, then there will be an}
                                              {       array of ATSUAttributeInfo structures immediately following the}
                                              {       above header data to store the style attributes. This is a variable}
                                              {       structure array. There must be one ATSUAttributeInfo for}
                                              {       for each numberOfSetAttributes. If numberOfSetAttributes is zero,}
                                              {       then skip to the next data section 2.}

                                              { 2. if the numberOfSetFeatures is non-zero, then there will be an array}
                                              {       of ATSFlatDataStyleListFeatureData structures immediately after}
                                              {       the ATSUAttributeInfo array above (if any). There must be one}
                                              {       ATSFlatDataStyleListFeatureData structure for each }
                                              {       numberOfSetFeatures set in the header above. If numberOfSetFeatures}
                                              {       is zero, then skip to the next data section 3.}

                                              { 3. if the numberOfSetVariations is non-zero, then there will be an}
                                              {       array of ATSFlatDataStyleListVariationData immediately after the}
                                              {       ATSFlatDataStyleListFeatureData array above (if any). There must be}
                                              {       one ATSFlatDataStyleListVariationData structure for each }
                                              {       numberOfSetVariations set in the header above.}
    end;
    ATSFlatDataStyleListStyleDataHeaderPtr = ^ATSFlatDataStyleListStyleDataHeader;
{
   this structure is the main header for this block. This structure is what a
   non-zero offsetToStyleList in the ATSFlatDataMainHeaderBlock points to in
   block 1.
}
type
    ATSFlatDataStyleListHeader = record

                                              { the total number of flattened style objects stored in this block}
        numberOfStyles: ItemCount;

                                              { the first in an array of flattned style entries. The data stored}
                                              { in them is variably sized, so a simply array access won't do for}
                                              { iterating through these. However, there must be one of these}
                                              { ATSFlatDataStyleListStyleDataHeader structures for each }
                                              { numberOfStyles above.}
        styleDataArray: array[0..0] of ATSFlatDataStyleListStyleDataHeader;

    end;
    ATSFlatDataStyleListHeaderPtr = ^ATSFlatDataStyleListHeader;
{
   this structure stores flattened font feature data. An array of these comes
   after the array of font data attributes (if any) if the numberOfSetFeatures is
   non-zero. There must be one of these structures for each numberOfSetFeatures.
}
type
    ATSFlatDataStyleListFeatureData = record

                                              { the font feature type}
        theFeatureType: ATSUFontFeatureType;

                                              { the font feature selector}
        theFeatureSelector: ATSUFontFeatureSelector;
    end;
    ATSFlatDataStyleListFeatureDataPtr = ^ATSFlatDataStyleListFeatureData;
{
   this structure stores the flattened font variation data. An array of these
   comes after the array of ATSFlatDataStyleListFeatureData structures (if any)
   if the numberOfSetVariations is non-zero. There must be one of these
   structures for each numberOfSetFeatures.
}
type
    ATSFlatDataStyleListVariationData = record

                                              { the variation axis}
        theVariationAxis: ATSUFontVariationAxis;

                                              { the variation value}
        theVariationValue: ATSUFontVariationValue;
    end;
    ATSFlatDataStyleListVariationDataPtr = ^ATSFlatDataStyleListVariationData;
{ ------------------------ }
{ Flattened Font Data Info }
{ ------------------------ }
{
   This is somewhat of an addendum to the 'ustl' structure above. These flattened
   data structures are stored in block 4 as a font attribute with the attribute
   tag of kATSUFontTag. They can store font data in a few different ways, such as
   by a FontSync reference or by simple raw font name data. Just as with the
   'ustl' above, this structure must maintain four byte alignment.
}


{ these are the currenly supported font specifiers. }
type ATSFlatDataFontSpeciferType = UInt32;
const
                                        { this specifier allows the storage of font data based on name data. This}
                                        { uses the stuctures below to store the actual data itself.}
  kATSFlattenedFontSpecifierRawNameData = $6E616D64 (* 'namd' *);

{
   this is the main header for the font data. It dictates what type of data
   is stored. The actual data stored must match the type specified by the
   nameSpecType.
}
type
    ATSFlatDataFontNameDataHeader = record

                                              { the type of data that is flattened in this structure}
        nameSpecifierType: ATSFlatDataFontSpeciferType;

                                              { the size of the data that is flattened in this structre, not including }
                                              { any padding bytes that may be necessary to achive the four byte }
                                              { alignment of the data, unless they are specified as part of structure, }
                                              { such as with the ATSFlatDataFontSpecRawNameData structure.}
        nameSpecifierSize: ByteCount;

                                              { after this header comes the flattened font name data which matches}
                                              { the type specified by the nameSpecifierType above. For instance, if }
                                              { the nameSpecType is kATSFlattenedFontNameSpecifierRawNameData, the}
                                              { structure that immediately follows this would be a}
                                              { ATSFlatDataFontNameRawNameDataHeader structure. }

    end;
    ATSFlatDataFontNameDataHeaderPtr = ^ATSFlatDataFontNameDataHeader;
{
   the next two structures are only used when the nameSpecType is set to
   kATSFlattenedFontSpecifierRawNameData. They are setup to store multiple
   font name table entries for the purposes of reconstructing an ATSUFontID
   for (hopefully) the same font some time in the future.
}
{ this is the structure in which raw font name data is actually stored. }
type
    ATSFlatDataFontSpecRawNameData = record

                                              { the type of name being specified}
        fontNameType: FontNameCode;

                                              { the platform type of the font name, whether it be Unicode, Mac, etc.  }
                                              { This should be specified if known. If not known, then specify}
                                              { kFontNoPlatform, but then all matching will be done based on the first}
                                              { font in the name table matching the other parameters.}
        fontNamePlatform: FontPlatformCode;

                                              { the script code of the fontÕs name based on the platform that was passed}
                                              { in above. If set to kFontNoScript, then the name will be matched based}
                                              { on the first font in the name table matching the other font name}
                                              { parameters.}
        fontNameScript: FontScriptCode;

                                              { the language of the font name. If set to kFontNoLanguage, then the name }
                                              { will be matched based on the first font in the name table matching the}
                                              { other font name parameters.}
        fontNameLanguage: FontLanguageCode;

                                              { the length of the font name in bytes, not including any padding bytes}
                                              { added to maintain the four byte alignment}
        fontNameLength: ByteCount;

                                              { after the name length comes the actual font name data itself, plus any}
                                              { padding bytes needed to maintain the four byte alignment.}

    end;
    ATSFlatDataFontSpecRawNameDataPtr = ^ATSFlatDataFontSpecRawNameData;
{
   this is a header structure that defines some things constant throughout
   the entire search for the font name, as well as the array of
   ATSFlatDataFontNameData structures. In order to gaurantee that the same font
   will be used, more than one name specifer should be stored. The standard ATSUI
   style run flattening and parsing functions, ATSUFlattenStyleRunsToStream and
   ATSUUnflattenStyleRunsFromStream. These will store both the font's full name
   (kFontFullName) as well as the font's manufacturer name (kFontManufacturerName)
   and match fonts based on both of
   these.
}
type
    ATSFlatDataFontSpecRawNameDataHeader = record

                                              { the number of flattened font names. There must be at least one flattened }
                                              { font name, otherwise the structure is malformed.}
        numberOfFlattenedNames: ItemCount;

                                              { the first in an array of possibly many font name specifiers - depending}
                                              { on how specific the caller wants this. There must be one }
                                              { ATSFlatDataFontNameData structure for each numberOfFlattenedNames}
                                              { above.}
        nameDataArray: array[0..0] of ATSFlatDataFontSpecRawNameData;

    end;
    ATSFlatDataFontSpecRawNameDataHeaderPtr = ^ATSFlatDataFontSpecRawNameDataHeader;
{ ---------------------------------------------------------------------------- }
{ Style Flattening and Parsing Functions                                       }
{ ---------------------------------------------------------------------------- }
{
 *  ATSUFlattenStyleRunsToStream()
 *
 *  Summary:
 *    Converts a series of ATSUStyle objects and associated run info to
 *    a flat binary representation.
 *
 *  Discussion:
 *    This function takes an array of ATSUStyle objects and style run
 *    information and flattens the data to the specified format. The
 *    style runs must all reference the same block of Unicode text
 *    (usually passed separately as text in the 'utxt' format). The
 *    style runs must also be in ascending order relative to the text
 *    in the text block. Typically you use the function
 *    ATSUFlattenStyleRunsFromStream by calling it twice, as follows:
 *    (1) Provide appropriate values for the iStreamFormat,
 *    iFlattenOptions, iNumberOfRunInfo, iRunInfoArray,
 *    iNumberOfStyleObjects, and iStyleArray parameters. Set
 *    iStreamBufferSize to 0, oStreamBuffer to NULL, and pass a valid
 *    reference to a ByteCount variable in the oActualStreamBufferSize
 *    parameter. Call the function ATSUFlattenStyleRunsToStream. On
 *    return, oActualStreamBufferSize points to the size needed for the
 *    buffer. (2) Allocate an appropriately-sized buffer for the
 *    oStreamBuffer parameter and then call the function
 *    ATSUFlattenStyleRunsToStream a second time.
 *
 *  Parameters:
 *
 *    iStreamFormat:
 *      The format of the flattened data. There is only one format
 *      supported at this time ('ustl'), so you must pass the constant
 *      kATSUDataStreamUnicodeStyledText.
 *
 *    iFlattenOptions:
 *      The options you want to use to flatten the data. There are no
 *      options supported at this time, so you must pass the constant
 *      kATSUFlattenOptionsNoOptionsMask.
 *
 *    iNumberOfRunInfo:
 *      The number of style run information structures passed in the
 *      iRunInfoArray parameter. If you pass 0, ATSUI assumes there is
 *      only one style for the entire text block passed in the
 *      oStreamBuffer parameter. The flattened data format passed to
 *      the iStreamFormat parameter must support the use of one style.
 *
 *    iRunInfoArray:
 *      An array of ATSUStyleRunInfo structures that describes the
 *      style runs to be flattened. This array must contain
 *      iNumberOfRunInfo entries. An ATSUStyleRunInfo structure
 *      contains an index into an array of unique ATSUStyle objects and
 *      the length of the run to which the style object applies. Each
 *      index in the ATSUStyleRunInfo structure must reference a valid
 *      ATSUStyle object passed in the iStyleArray parameter. You can
 *      pass NULL, only if iNumberOfRunInfo is set to zero.
 *
 *    iNumberOfStyleObjects:
 *      The number of ATSUStyle objects in the array passed to the
 *      iStyleArray parameter. You must pass a value that is greater
 *      than 0.
 *
 *    iStyleArray:
 *      An array of ATSUStyle objects to be flattened. You cannot pass
 *      NULL.
 *
 *    iStreamBufferSize:
 *      The size of the stream buffer, pointed to by the oStreamBuffer
 *      parameter. You can pass 0only if the iStreamBufferSize
 *      parameter is set to NULL. If you are uncertain of the size of
 *      the array, see the Discussion.
 *
 *    oStreamBuffer:
 *      On input, a pointer to the data you want to flatten. On return,
 *      points to the flattened data. If you pass NULL for this
 *      parameter, no data is flattened. Instead, the size of the
 *      buffer is calculated by ATSUI and returned in oActualStreamSize
 *      parameter. See the Discussion for more details. You are
 *      responsible for allocating the text buffer passed in the
 *      oStreamBuffer parameter.
 *
 *    oActualStreamBufferSize:
 *      On return, the size of the data written to the oStreamBuffer
 *      parameter. You can pass NULL only if the oStreamBuffer
 *      parameter is not NULL.
 *
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in ApplicationServices.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
function ATSUFlattenStyleRunsToStream( iStreamFormat: ATSUFlattenedDataStreamFormat; iFlattenOptions: ATSUFlattenStyleRunOptions; iNumberOfRunInfo: ItemCount; iRunInfoArray: ATSUStyleRunInfoPtr; iNumberOfStyleObjects: ItemCount; iStyleArray: ATSUStylePtr; iStreamBufferSize: ByteCount; oStreamBuffer: UnivPtr; oActualStreamBufferSize: ByteCountPtr ): OSStatus; external name '_ATSUFlattenStyleRunsToStream';


{
 *  ATSUUnflattenStyleRunsFromStream()
 *
 *  Summary:
 *    Creates a series of ATSUStyle objects and associated run
 *    information from a flat binary representation.
 *
 *  Discussion:
 *    This function extracts the ATSUI style run information from
 *    previously-flattened data. The style objects and style run
 *    information structures are returned in two separate arraysÑthe
 *    array oStyleArray and the array oRunInfoArray. These arrays are
 *    not parallel. Each ATSUStyle object in the oStyleArray is a
 *    unique ATSUStyle object. To figure out which ATSUStyle object
 *    belongs to which text run, the caller must parse the array of
 *    ATSUStyleRunInfo structures. These structures contain the style
 *    run lengths and an index into the oStyleArray. Typically you use
 *    the function ATSUUnflattenStyleRunsFromStream by calling it
 *    twice, as follows: (1) Provide appropriate values for the
 *    iStreamFormat, iUnflattenOptions, and iStreamBuffer parameters.
 *    Pass 0for the iNumberOfRunInfo and iNumberOfStyleObjects
 *    parameters, NULL for the oRunInfoArray and oStyleArray,
 *    parameters and valid ItemCount references for the
 *    oActualNumberOfRunInfo and oActualNumberOfStyleObjects
 *    parameters. On return, oActualNumberOfRunInfo and
 *    oActualNumberOfStyleObjects point to the sizes needed to allocate
 *    these arrays. (2) Allocate appropriately-sized arrays of
 *    ATSUStyleRunStructures and ATSUStyle object references. Call the
 *    function ATSUUnflattenStyleRunsFromStream a second time, passing
 *    the newly allocated arrays in the oRunInfoArray and oStyleArray
 *    parameters, with the iNumberOfRunInfo and iNumberOfStyleObjects
 *    parameters set to the values you obtained from the first call.
 *
 *  Parameters:
 *
 *    iStreamFormat:
 *      The format of the flattened data. There is only one format
 *      supported at this time ('ustl'), so you must pass the constant
 *      kATSUDataStreamUnicodeStyledText.
 *
 *    iUnflattenOptions:
 *      The options you want to use to unflatten the data. There are no
 *      options supported at this time, so you must pass the constant
 *      kATSUUnflattenOptionsNoOptionsMask.
 *
 *    iStreamBufferSize:
 *      The size of the buffer pointed to by the iStreamBuffer
 *      parameter. You must pass a value greater than 0.
 *
 *    iStreamBuffer:
 *      A pointer to the buffer that contains the flattened data. The
 *      data must be of the format specified by the iStreamFormat
 *      parameter and must be of size specified by the
 *      iStreamBufferSize parameter. You cannot pass NULL .
 *
 *    iNumberOfRunInfo:
 *      The number of style run information structures passed in the
 *      iRunInfoArray parameter. If you are uncertain of the number of
 *      style run information structures, see the Discussion.
 *
 *    iNumberOfStyleObjects:
 *      The number of ATSUStyle objects in the array passed into the
 *      iStyleArray parameter. If you are uncertain of the number of
 *      ATSUStyle objects, see the Discussion.
 *
 *    oRunInfoArray:
 *      On return, points to an array of style run information
 *      structures. Each structure contains a style run length and
 *      index into the oStyleArray array. If you are uncertain of how
 *      much memory to allocate for this array, see the Discussion. You
 *      are responsible for disposing of the array when you no longer
 *      need it.
 *
 *    oStyleArray:
 *      On return, a pointer to an array of the unique ATSUStyle
 *      objects obtained from the flattened data. The indices returned
 *      in the array oRunInfoArray are indices into this array. If you
 *      are uncertain of how much memory to allocate for this array,
 *      see the Discussion. You are responsible for disposing of the
 *      array and the ATSUI style objects in the array when you no
 *      longer need the array.
 *
 *    oActualNumberOfRunInfo:
 *      On return, points to the actual number of ATSUStyleRunInfo
 *      structures obtained from the flattened data. The actual number
 *      of structures is the number of entries added to the array
 *      oRunInfoArray. You can pass NULL if you to not want to obtain
 *      this value.
 *
 *    oActualNumberOfStyleObjects:
 *      On return, points to the actual number of unique ATSUStyle
 *      objects obtained from the flattened data. The actual number is
 *      the number of entries added to the oStyleArray array. You can
 *      pass NULL if you do no want to obtain this value.
 *
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in ApplicationServices.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
function ATSUUnflattenStyleRunsFromStream( iStreamFormat: ATSUFlattenedDataStreamFormat; iUnflattenOptions: ATSUUnFlattenStyleRunOptions; iStreamBufferSize: ByteCount; iStreamBuffer: UnivPtr; iNumberOfRunInfo: ItemCount; iNumberOfStyleObjects: ItemCount; oRunInfoArray: ATSUStyleRunInfoPtr; oStyleArray: ATSUStylePtr; oActualNumberOfRunInfo: ItemCountPtr; oActualNumberOfStyleObjects: ItemCountPtr ): OSStatus; external name '_ATSUUnflattenStyleRunsFromStream';


{ Functions listed beyond this point are either deprecated or not recommended }

{
 *  ATSUCopyToHandle()
 *
 *  Discussion:
 *    This function is no longer recommended. Please use
 *    ATSUFlattenStyleRunsToStream instead.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function ATSUCopyToHandle( iStyle: ATSUStyle; oStyleHandle: Handle ): OSStatus; external name '_ATSUCopyToHandle';


{
 *  ATSUPasteFromHandle()
 *
 *  Discussion:
 *    This function is no longer recommended. Please use
 *    ATSUUnflattenStyleRunsFromStream instead.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function ATSUPasteFromHandle( iStyle: ATSUStyle; iStyleHandle: Handle ): OSStatus; external name '_ATSUPasteFromHandle';
{unit ATSUnicodeFonts}
{$ALIGN MAC68K}







{ ---------------------------------------------------------------------------- }
{  Font features                                                               }
{ ---------------------------------------------------------------------------- }

{
 *  ATSUSetFontFeatures()
 *
 *  Summary:
 *    Sets font features in a style object.
 *
 *  Discussion:
 *    This function enables you to set multiple font features for a
 *    style object. Any unset font features retain their font-defined
 *    default values. To set style attributes and font variations for a
 *    style object, call the functions ATSUSetAttributes and
 *    ATSUSetVariations, respectively. The constants that represent
 *    font feature types are defined in the header file
 *    SFNTLayoutTypes.h. When you use ATSUI to access and set font
 *    features, you must use the constants defined in this header file,
 *    which are described in "Inside Mac OS X: Rendering Unicode Text
 *    With ATSUI". As feature types can be added at any time, you
 *    should check Apple's font feature registry website for the most
 *    up-to-date list of font feature types and selectors:
 *    http://developer.apple.com/fonts/Registry/index.html.
 *
 *  Parameters:
 *
 *    iStyle:
 *      The style object for which to set font features.
 *
 *    iFeatureCount:
 *      The number of font features to set. This value should
 *      correspond to the number of elements in the iType and iSelector
 *      arrays.
 *
 *    iType:
 *      An array of feature types. Each element in the array must
 *      contain a valid feature type that corresponds to a feature
 *      selector in the iSelector array. To obtain the valid feature
 *      types for a font, call the function ATSUGetFontFeatureTypes .
 *
 *    iSelector:
 *      An array of feature selectors. Each element in the array must
 *      contain a valid feature selector that corresponds to a feature
 *      type in the iType array. To obtain the valid feature selectors
 *      for a font, call the function ATSUGetFontFeatureSelectors .
 *
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function ATSUSetFontFeatures( iStyle: ATSUStyle; iFeatureCount: ItemCount; iType: ATSUFontFeatureTypePtr; iSelector: ATSUFontFeatureSelectorPtr ): OSStatus; external name '_ATSUSetFontFeatures';


{
 *  ATSUGetFontFeature()
 *
 *  Summary:
 *    Obtains the font feature corresponding to an index into an array
 *    of font features for a style object.
 *
 *  Discussion:
 *    You might typically call ATSUGetFontFeature if you need to obtain
 *    one previously set feature after another within your program's
 *    processing loop. To obtain all previously set font features for a
 *    given style object, you can call the function
 *    ATSUGetAllFontFeatures. Before calling ATSUGetFontFeature, you
 *    should call the function ATSUGetAllFontFeatures to obtain a count
 *    of the font features that are set in the style object. You can
 *    then pass the index for the feature whose setting you want to
 *    obtain in the iTag and iMaximumValueSize parameters of
 *    ATSUGetFontFeature.
 *
 *  Parameters:
 *
 *    iStyle:
 *      The style you wish to obtain font feature information for.
 *
 *    iFeatureIndex:
 *      An index into the array of font features for the style object.
 *      This index identifies the font feature to examine. Because this
 *      index is zero-based, you must pass a value between 0 and one
 *      less than the value produced in the oActualFeatureCount
 *      parameter of the function ATSUGetAllFontFeatures.
 *
 *    oFeatureType:
 *      On return, the value identifies the font feature type
 *      corresponding to the index passed in the iFeatureIndex
 *      parameter. You must allocate space for ATSUGetFontFeature to
 *      store this value.
 *
 *    oFeatureSelector:
 *      On return, the value identifies the font feature selector that
 *      corresponds to the feature type produced in the oFeatureType
 *      parameter. ou must allocate space for ATSUGetFontFeature to
 *      store this value.
 *
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function ATSUGetFontFeature( iStyle: ATSUStyle; iFeatureIndex: ItemCount; oFeatureType: ATSUFontFeatureTypePtr; oFeatureSelector: ATSUFontFeatureSelectorPtr ): OSStatus; external name '_ATSUGetFontFeature';


{
 *  ATSUGetAllFontFeatures()
 *
 *  Summary:
 *    Obtains the font features of a style object that are not at
 *    default settings.
 *
 *  Discussion:
 *    The ATSUGetAllFontFeatures function obtains all of a style
 *    object's font features that are not at default settings. Font
 *    features are grouped into categories called feature types, within
 *    which individual feature selectors define particular feature
 *    settings. The arrays produced by ATSUGetAllFontFeatures contain
 *    constants identifying the object's font types and their
 *    corresponding font selectors. Typically you use the function
 *    ATSUGetAllFontFeatures by calling it twice, as follows: (1) Pass
 *    a reference to the style object to examine in the iStyle
 *    parameter, a valid pointer to an ItemCount value in the
 *    oActualFeatureCount parameter, NULL for the oFeatureType and
 *    oFeatureSelector parameters, and 0 for the iMaximumFeatureCount
 *    parameter. ATSUGetAllFontFeatures returns the size in the
 *    oActualFeatureCount parameter to use for the feature type and
 *    selector arrays. (2) Allocate enough space for arrays of the
 *    returned size, then call ATSUGetAllFontFeatures again, passing a
 *    pointer to the arrays in the oFeatureType and oFeatureSelector
 *    parameters. On return, the arrays contain the font feature types
 *    and selectors, respectively, for the style object.
 *
 *  Parameters:
 *
 *    iStyle:
 *      The style for which you wish to obtain font feature information.
 *
 *    iMaximumFeatureCount:
 *      The maximum number of feature types and selectors to obtain for
 *      the style object. Typically, this is equivalent to the number
 *      of ATSUFontFeatureType and ATSUFontFeatureSelector values for
 *      which you have allocated memory in the oFeatureType and
 *      oFeatureSelector parameters, respectively. To determine this
 *      value, see the Discussion.
 *
 *    oFeatureType:
 *      On return, the array contains constants identifying each type
 *      of font feature that is at a nondefault setting in the style
 *      object. If you are uncertain of how much memory to allocate for
 *      this array, see the Discussion. can be NULL
 *
 *    oFeatureSelector:
 *      On return, the array contains constants identifying the feature
 *      selectors that are at nondefault settings in the style object.
 *      Each selector determines the setting for a corresponding
 *      feature type produced in the oFeatureType parameter. If you are
 *      uncertain of how much memory to allocate for this array, see
 *      the Discussion.  can be NULL
 *
 *    oActualFeatureCount:
 *      On return, the value specifies the actual number of font
 *      feature types and selectors in the style object. This may be
 *      greater than the value you specified in the
 *      iMaximumFeatureCount parameter. can be NULL
 *
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function ATSUGetAllFontFeatures( iStyle: ATSUStyle; iMaximumFeatureCount: ItemCount; oFeatureType: ATSUFontFeatureTypePtr; oFeatureSelector: ATSUFontFeatureSelectorPtr; oActualFeatureCount: ItemCountPtr ): OSStatus; external name '_ATSUGetAllFontFeatures';


{
 *  ATSUClearFontFeatures()
 *
 *  Summary:
 *    Restores default settings to the specified font features of a
 *    style object.
 *
 *  Discussion:
 *    This function removes those font features that are identified by
 *    the feature selector and type constants in the iSelector and
 *    iType arrays and replaces them with their font-defined default
 *    values. Note that if you pass ATSUClearFontFeatures a font
 *    feature and selector that are already at default settings, the
 *    function does not return an error. To restore default font
 *    variations to a style object, call the function
 *    ATSUClearFontVariations. To restore default style attributes to a
 *    style object, call ATSUClearAttributes. To restore all default
 *    settings to a style object (for font features, variations, and
 *    style attributes), call the function ATSUClearStyle.
 *
 *  Parameters:
 *
 *    iStyle:
 *      A style whose font features you wish to clear.
 *
 *    iFeatureCount:
 *      The number of font features to restore to default settings.
 *      This value should correspond to the number of elements in the
 *      iType and iSelector arrays. To restore default settings to all
 *      the font features in the specified style object, pass the
 *      constant kATSUClearAll in this parameter. In this case, the
 *      values in the iType and iSelector parameters are ignored.
 *
 *    iType:
 *      An array of feature types. Each value should identify a font
 *      feature to restore to its default setting. To obtain all
 *      previously set font features for a given style object, you can
 *      call the function ATSUGetAllFontFeatures. You may pass NULL for
 *      this parameter if you are passing kATSUClearAll for the
 *      iFeatureCount parameter. can be NULL
 *
 *    iSelector:
 *      An array of feature selectors. Each element in the array must
 *      contain a valid feature selector corresponding to a font
 *      feature you provide in the iType parameter. To obtain all
 *      previously set feature selectors for a given style object, you
 *      can call the function ATSUGetAllFontFeatures. You may pass NULL
 *      for this parameter if you are passing kATSUClearAll for the
 *      iFeatureCount parameter. can be NULL
 *
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function ATSUClearFontFeatures( iStyle: ATSUStyle; iFeatureCount: ItemCount; iType: ATSUFontFeatureTypePtr; iSelector: ATSUFontFeatureSelectorPtr ): OSStatus; external name '_ATSUClearFontFeatures';


{ ---------------------------------------------------------------------------- }
{  Font variations                                                             }
{ ---------------------------------------------------------------------------- }
{
 *  ATSUSetVariations()
 *
 *  Summary:
 *    Sets font variation axes and values in a style object.
 *
 *  Discussion:
 *    If you supply font variation axes and values to the
 *    ATSUSetVariations function, you can change the appearance of a
 *    style object's font accordingly. You may specify any number of
 *    variation axes and values in a style object. Any of the font's
 *    variations that you do not set retain their font-defined default
 *    values. You can also use the ATSUSetVariations function to supply
 *    your own value within any variation axes defined for the font.
 *    However, if the font does not support the variation axis you
 *    specify, your custom variation has no visual effect. By calling
 *    the function ATSUGetIndFontVariation, you can obtain a variation
 *    axis and its maximum, minimum, and default values for a font.
 *
 *  Parameters:
 *
 *    iStyle:
 *      The style object for which to set font variation values.
 *
 *    iVariationCount:
 *      The number of font variation values to set. This value should
 *      correspond to the number of elements in the iAxes and iValue
 *      arrays.
 *
 *    iAxes:
 *      An array of font variation axes. Each element in the array must
 *      represent a valid variation axis tag that corresponds to a
 *      variation value in the iValue array. To obtain a valid
 *      variation axis tag for a font, you can call the functions
 *      ATSUGetIndFontVariation or ATSUGetFontInstance.
 *
 *    iValue:
 *      An array of font variation values. Each element in the array
 *      must contain a value that is valid for the corresponding
 *      variation axis in the iAxes parameter. You can obtain a font's
 *      maximum, minimum, and default values for a given variation axis
 *      by calling the function ATSUGetIndFontVariation . You can
 *      obtain the font variation axis values for a font instance by
 *      calling ATSUGetFontInstance.
 *
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function ATSUSetVariations( iStyle: ATSUStyle; iVariationCount: ItemCount; iAxes: ATSUFontVariationAxisPtr; iValue: ATSUFontVariationValuePtr ): OSStatus; external name '_ATSUSetVariations';


{
 *  ATSUGetFontVariationValue()
 *
 *  Summary:
 *    Obtains the current value for a single font variation axis in a
 *    style object.
 *
 *  Discussion:
 *    This function obtains the setting for a specified font variation
 *    axis in a style object. You might typically call
 *    ATSUGetFontVariationValue if you need to obtain one previously
 *    set variation axis value after another within your program's
 *    processing loop. To obtain all nondefault font variation axis
 *    values for a given style object, you can call the function
 *    ATSUGetAllFontVariations. Before calling
 *    ATSUGetFontVariationValue, call the function
 *    ATSUGetAllFontVariations to obtain the font variation axes that
 *    are set for the style object.
 *
 *  Parameters:
 *
 *    iStyle:
 *      The style for which you want to obtain a variation value.
 *
 *    iFontVariationAxis:
 *      A tag specifying the style object's variation axis to examine.
 *      You can obtain a list of variation axis tags that are set to
 *      non-default values in a particular style object from the
 *      function ATSUGetAllFontVariations.
 *
 *    oFontVariationValue:
 *      On return, ATSUGetFontVariationValue produces the currently set
 *      value for the style object's specified variation axis. If this
 *      value has not been set, ATSUGetFontVariationValue produces the
 *      font-defined default value.
 *
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function ATSUGetFontVariationValue( iStyle: ATSUStyle; iFontVariationAxis: ATSUFontVariationAxis; oFontVariationValue: ATSUFontVariationValuePtr ): OSStatus; external name '_ATSUGetFontVariationValue';


{
 *  ATSUGetAllFontVariations()
 *
 *  Summary:
 *    Obtains a style object's font variation values that are not at
 *    default settings.
 *
 *  Discussion:
 *    This function obtains all of a style object's font variation axes
 *    that are not at default settings, as well as the current values
 *    for the axes. Typically you use the function
 *    ATSUGetAllFontVariations by calling it twice, as follows: (1)
 *    Pass a reference to the style object to examine in the iStyle
 *    parameter, a pointer to an ItemCount value in the
 *    oActualVariationCount parameter, NULL for the oVariationAxes and
 *    oFontVariationValues parameters, and 0 for the iVariationCount
 *    parameter. ATSUGetAllFontVariations returns the size to use for
 *    the variation axes and value arrays in the oActualVariationCount
 *    parameter. (2) Allocate enough space for arrays of the returned
 *    size, then call ATSUGetAllFontVariations again, passing a pointer
 *    to the arrays in the oVariationAxes and oFontVariationValues
 *    parameters. On return, the arrays contain the font variation axes
 *    and their corresponding values, respectively, for the style
 *    object.
 *
 *  Parameters:
 *
 *    iStyle:
 *      A style for which you wish to obtain information about current
 *      variation settings.
 *
 *    iVariationCount:
 *      The maximum number of font variation values to obtain for the
 *      style object. Typically, this is equivalent to the number of
 *      ATSUFontVariationAxis and ATSUFontVariationValue values for
 *      which you have allocated memory in the oVariationAxes and
 *      oFontVariationValues parameters, respectively. To determine
 *      this value, see the Discussion.
 *
 *    oVariationAxes:
 *      On return, the array contains the current font variation values
 *      for the font variation axes produced in the oVariationAxes
 *      array. If you are uncertain of how much memory to allocate for
 *      this array, see the Discussion. can be NULL
 *
 *    oFontVariationValues:
 *      On return, the value specifies the actual number of nondefault
 *      font variation values in the style object. This may be greater
 *      than the value you passed in the iVariationCount parameter. If
 *      you are uncertain of how much memory to allocate for this
 *      array, see the Discussion. can be NULL
 *
 *    oActualVariationCount:
 *      On return, the value specifies the actual number of nondefault
 *      font variation values in the style object. This may be greater
 *      than the value you passed in the iVariationCount parameter.
 *       can be NULL
 *
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function ATSUGetAllFontVariations( iStyle: ATSUStyle; iVariationCount: ItemCount; oVariationAxes: ATSUFontVariationAxisPtr; oFontVariationValues: ATSUFontVariationValuePtr; oActualVariationCount: ItemCountPtr ): OSStatus; external name '_ATSUGetAllFontVariations';


{
 *  ATSUClearFontVariations()
 *
 *  Summary:
 *    Restores default values to the specified font variation axes of a
 *    style object.
 *
 *  Discussion:
 *    The ATSUClearFontVariations function removes those font variation
 *    axis values identified by variation axis tags in the iAxis array
 *    and replaces them with their font-defined default values. You can
 *    remove unset font variation values from a style object without a
 *    function error. To restore default font features to a style
 *    object, call the function ATSUClearFontFeatures. To restore
 *    default style attributes, call ATSUClearAttributes. To restore
 *    all default settings to a style object (for font features,
 *    variations, and style attributes), call the function
 *    ATSUClearStyle.
 *
 *  Parameters:
 *
 *    iStyle:
 *      The style in which you wish to clear font variation settings.
 *
 *    iAxisCount:
 *      The number of font variation axes to restore to default
 *      settings. This value should correspond to the number of
 *      elements in the iAxis array. To restore default values to all
 *      the font variation axes in the style object, pass the constant
 *      kATSUClearAll in this parameter. If you pass kATSUClearAll the
 *      value in the iAxis parameter is ignored.
 *
 *    iAxis:
 *      An array of font variation axes. Each element in the array must
 *      contain a valid tag that corresponds to a font variation axis
 *      to restore to its default setting. You can obtain variation
 *      axis tags for a style object from the function
 *      ATSUGetAllFontVariations. You may pass NULL for this parameter
 *      if you are passing kATSUClearAll for the iAxisCount parameter. can be NULL
 *
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function ATSUClearFontVariations( iStyle: ATSUStyle; iAxisCount: ItemCount; iAxis: ATSUFontVariationAxisPtr ): OSStatus; external name '_ATSUClearFontVariations';


{ ---------------------------------------------------------------------------- }
{  Font ID's                                                                   }
{ ---------------------------------------------------------------------------- }
{
 *  ATSUFontCount()
 *
 *  Summary:
 *    Obtains the number of ATSUI-compatible fonts installed on a
 *    user's system.
 *
 *  Discussion:
 *    The ATSUFontCount function obtains the number of fonts on a
 *    user's system that are compatible with ATSUI. Incompatible fonts
 *    include those that cannot be used to represent Unicode, the
 *    missing-character glyph font, and fonts whose names begin with a
 *    period or a percent sign. You can use the count produced in the
 *    oFontCount parameter to determine the amount of memory to
 *    allocate for the oFontIDs array in the function ATSUGetFontIDs.
 *    It is important to note that the set of installed
 *    ATSUI-compatible fonts may change while your application is
 *    running. In Mac OS X, the set of installed fonts may change at
 *    any time. Although in Mac OS 9, fonts cannot be removed from the
 *    Fonts folder while an application other than the Finder is
 *    running, they can be removed from other locations, and it is
 *    possible for fonts to be added. Additionally, just because the
 *    number of fonts stays the same between two successive calls to
 *    ATSUFontCount , this does not mean that the font lists are the
 *    same. It is possible for a font to be added and another removed
 *    between two successive calls to ATSUFontCount , leaving the total
 *    number unchanged.
 *
 *  Parameters:
 *
 *    oFontCount:
 *      On return, the number of ATSUI-compatible fonts installed on a
 *      user's system.
 *
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function ATSUFontCount( var oFontCount: ItemCount ): OSStatus; external name '_ATSUFontCount';


{
 *  ATSUGetFontIDs()
 *
 *  Summary:
 *    Obtains a list of all the ATSUI-compatible fonts installed on the
 *    user's system.
 *
 *  Discussion:
 *    Use the function ATSUFontCount to determine how much memory to
 *    allocate before calling this function. Also see the discussion
 *    for the ATSUFontCount function.
 *
 *  Parameters:
 *
 *    oFontIDs:
 *      On return, the array contains unique identifiers for each of
 *      the ATSUI-compatible fonts installed on the user's system. You
 *      should allocate enough memory to contain an array the size of
 *      the count produced by the function ATSUFontCount.
 *
 *    iArraySize:
 *      The maximum number of fonts to obtain. Typically, this is
 *      equivalent to the number of ATSUFontID values for which you
 *      have allocated memory in the oFontIDs parameter.
 *
 *    oFontCount:
 *      On return, the value specifies the actual number of
 *      ATSUI-compatible fonts installed on the user's system. This may
 *      be greater than the value you specified in the iArraySize
 *      parameter. can be NULL
 *
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function ATSUGetFontIDs( oFontIDs: ATSUFontIDPtr; iArraySize: ItemCount; oFontCount: ItemCountPtr ): OSStatus; external name '_ATSUGetFontIDs';


{
 *  ATSUFONDtoFontID()
 *
 *  Summary:
 *    Finds the ATSUI font ID that corresponds to a font family number,
 *    if one exists.
 *
 *  Discussion:
 *    This function is not recommended. Instead, use the function
 *    FMGetFontFromFontFamilyInstance (see Fonts.h). FMFont values are
 *    equivalent to ATSUFontID values.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function ATSUFONDtoFontID( iFONDNumber: SInt16; iFONDStyle: Style; var oFontID: ATSUFontID ): OSStatus; external name '_ATSUFONDtoFontID';


{
 *  ATSUFontIDtoFOND()
 *
 *  Summary:
 *    Finds the font family number and style that correspond to an
 *    ATSUI font ID, if these exist.
 *
 *  Discussion:
 *    This function is not recommended. Instead, use the function
 *    FMGetFontFamilyInstanceFromFont (see Fonts.h). FMFont values are
 *    equivalent to ATSUFontID values.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function ATSUFontIDtoFOND( iFontID: ATSUFontID; var oFONDNumber: SInt16; var oFONDStyle: Style ): OSStatus; external name '_ATSUFontIDtoFOND';


{ ---------------------------------------------------------------------------- }
{  Font names                                                                  }
{ ---------------------------------------------------------------------------- }
{
 *  ATSUCountFontNames()
 *
 *  Summary:
 *    Obtains the number of font names that correspond to a given ATSUI
 *    font ID.
 *
 *  Discussion:
 *    This function obtains the number of font names defined in a font
 *    name table for a given ATSUI font ID. This number includes
 *    repetitions of the same name in different platforms, languages,
 *    and scripts; names of font features, variations, tracking
 *    settings, and instances for the font; and font names identified
 *    by name code constants. You can pass an index value based on this
 *    count to the function ATSUGetIndFontName to obtain a name string,
 *    name code, platform, script, and language for a given ATSUI font
 *    ID.
 *
 *  Parameters:
 *
 *    iFontID:
 *      The font for which you wish to obtain the font name count.
 *
 *    oFontNameCount:
 *      On return, the value specifies the number of entries in the
 *      font name table corresponding to the given ATSUI font ID.
 *
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function ATSUCountFontNames( iFontID: ATSUFontID; var oFontNameCount: ItemCount ): OSStatus; external name '_ATSUCountFontNames';


{
 *  ATSUGetIndFontName()
 *
 *  Summary:
 *    Obtains a name string, name code, platform, script, and language
 *    for the font that matches an ATSUI font ID and name table index
 *    value.
 *
 *  Discussion:
 *    Typically you use the ATSUGetIndFontName function by calling it
 *    twice, as follows: (1) Pass valid values for the iFontID,
 *    iFontNameIndex, and oActualNameLength parameters, 0 for the
 *    iMaximumNameLength parameter, and NULL for the other parameters.
 *    ATSUGetIndFontName returns the length of the font name string in
 *    the oActualNameLength parameter. (2) Allocate enough space for a
 *    buffer of the returned size, then call the function again,
 *    passing a valid pointer to the buffer in the oName parameter. On
 *    return, the buffer contains the font name string. To find a name
 *    string and index value for the first font in a name table that
 *    matches an ATSUI font ID and the specified font parameters, call
 *    the function ATSUFindFontName. To obtain an ATSUI font ID for the
 *    first font in a name table that matches the specified name
 *    string, name code, platform, script, and/or language, call the
 *    function ATSUFindFontFromName.
 *
 *  Parameters:
 *
 *    iFontID:
 *      The font for which to obtain information. Note that because
 *      Apple Type Services assigns ATSUFontID values systemwide at
 *      runtime, font IDs can change across system restarts.
 *
 *    iFontNameIndex:
 *      An index to the font for which to obtain information. Because
 *      this index must be 0-based, you should pass a value between 0
 *      and one less than the count produced by the function
 *      ATSUCountFontNames.
 *
 *    iMaximumNameLength:
 *      The maximum length of the font name string to obtain.
 *      Typically, this is equivalent to the size of the buffer that
 *      you have allocated in the oName parameter. To determine this
 *      length, see the Discussion.
 *
 *    oName:
 *      On return, the buffer contains the name string of the font
 *      matching the ATSUI font ID and name table index value being
 *      passed. If the buffer you allocate is not large enough to
 *      contain the name string, ATSUGetIndFontName produces a partial
 *      string. If you are unsure how much memory to allocate for this
 *      parameter, see the Discussion.
 *
 *    oActualNameLength:
 *      On return, the value specifies the actual length of the
 *      complete name string. This may be greater than the value passed
 *      in the iMaximumNameLength parameter. You should check this
 *      value to ensure that you have allocated sufficient memory and
 *      therefore obtained the complete name string for the font. can be NULL
 *
 *    oFontNameCode:
 *      On return, a value specifying the type of name returned (i.e.,
 *      full name, postscript name) of the font. See SFNTTypes.h for a
 *      list of possible values. can be NULL
 *
 *    oFontNamePlatform:
 *      On return, a value specifying the encoding of the font. See
 *      SFNTTypes.h for a list of possible values. can be NULL
 *
 *    oFontNameScript:
 *      On return, a value specifying the script of the font. See
 *      SFNTTypes.h for a list of possible values. can be NULL
 *
 *    oFontNameLanguage:
 *      On return, a value specifying the language of the font. See
 *      SFNTTypes.h for a list of possible values. can be NULL
 *
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function ATSUGetIndFontName( iFontID: ATSUFontID; iFontNameIndex: ItemCount; iMaximumNameLength: ByteCount; oName: Ptr; oActualNameLength: ByteCountPtr; oFontNameCode: FontNameCodePtr; oFontNamePlatform: FontPlatformCodePtr; oFontNameScript: FontScriptCodePtr; oFontNameLanguage: FontLanguageCodePtr ): OSStatus; external name '_ATSUGetIndFontName';


{
 *  ATSUFindFontName()
 *
 *  Summary:
 *    Obtains a name string and index value for the first font in a
 *    name table that matches the specified ATSUI font ID, name code,
 *    platform, script, and/or language.
 *
 *  Discussion:
 *    Typically you use the ATSUFindFontName function by calling it
 *    twice, as follows: (1) Pass NULL for the oName and oFontNameIndex
 *    parameters, 0 for the iMaximumNameLength parameter, and valid
 *    values for the other parameters. ATSUFindFontName returns the
 *    length of the font name string in the oActualNameLength
 *    parameter. (2) Allocate enough space for a buffer of the returned
 *    size, then call the function again, passing a valid pointer to
 *    the buffer in the oName parameter. On return, the buffer contains
 *    the font name string. To obtain an ATSUI font ID for the first
 *    font in a name table that matches the specified name string, name
 *    code, platform, script, and/or language, call the function
 *    ATSUFindFontFromName. To obtain the font name string, name code,
 *    platform, script, and language for the font that matches an ATSUI
 *    font ID and name table index, call the function
 *    ATSUGetIndFontName. Although they will each accept NULL on input
 *    individually, you must pass a vaild pointer to at least one of
 *    the three parameters oName, oActualNameLength, or oFontNameIndex,
 *    or ATSUFindFontName will return paramErr.
 *
 *  Parameters:
 *
 *    iFontID:
 *      The font for which to obtain a name string. Note that because
 *      Apple Type Services assigns ATSUFontID values systemwide at
 *      runtime, font IDs can change across system restarts.
 *
 *    iFontNameCode:
 *      A constant specifying the FontNameCode value of the font for
 *      which to obtain a name string. See the SFNTTypes.h header file
 *      for a definition of the FontNameCode type and a list of
 *      possible values.
 *
 *    iFontNamePlatform:
 *      A constant specifying the encoding of the font. See SFNTTypes.h
 *      for possible values to pass for this parameter. If you pass the
 *      kFontNoPlatformCode constant, ATSUFindFontName produces the
 *      first font in the name table matching the other specified
 *      parameters.
 *
 *    iFontNameScript:
 *      A constant specifying the script of the font. See SFNTTypes.h
 *      for possible values to pass for this parameter. If you pass the
 *      kFontNoScriptCode constant, ATSUFindFontName produces the first
 *      font in the name table matching the other specified parameters.
 *
 *    iFontNameLanguage:
 *      A constant specifying the language of the font you are
 *      searching for. See SFNTLayoutTypes.h for possible values to
 *      pass for this parameter.
 *
 *    iMaximumNameLength:
 *      The maximum size of string you want ATSUFindFontName to return.
 *      Typically, this value is equal to the size of the buffer you
 *      have allocated for the oName parameter. To determine this
 *      length, see the Discussion.
 *
 *    oName:
 *      On return, the name string of the first font in the font name
 *      table matching your specified parameters. If the buffer you
 *      allocate is not large enough, ATSUFindFontName produces a
 *      partial string. If you are unsure how much space to allocate
 *      for this parameter, see the Discussion. can be NULL
 *
 *    oActualNameLength:
 *      On return, specifies the actual length of the complete name
 *      string. This may be greater than the value passed in the
 *      iMaximumNameLength parameter. You should check this value to
 *      ensure that you have allocated sufficient memory and therefore
 *      obtained the complete name string for the font. can be NULL
 *
 *    oFontNameIndex:
 *      On return, the value provides a 0-based index to the font name
 *      in the font name table. can be NULL
 *
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function ATSUFindFontName( iFontID: ATSUFontID; iFontNameCode: FontNameCode; iFontNamePlatform: FontPlatformCode; iFontNameScript: FontScriptCode; iFontNameLanguage: FontLanguageCode; iMaximumNameLength: ByteCount; oName: Ptr; oActualNameLength: ByteCountPtr; oFontNameIndex: ItemCountPtr ): OSStatus; external name '_ATSUFindFontName';


{
 *  ATSUFindFontFromName()
 *
 *  Summary:
 *    Obtains an ATSUI font ID for the first font in a name table that
 *    matches the specified name string, name code, platform, script,
 *    and/or language.
 *
 *  Discussion:
 *    Because ATSUI cannot guarantee the uniqueness of names among
 *    installed fonts, ATSUFindFontFromName does not necessarily find
 *    the only font that matches these parameters. As a result, you may
 *    want to create a more sophisticated name-matching algorithm or
 *    guarantee the uniqueness of names among installed fonts.
 *
 *  Parameters:
 *
 *    iName:
 *      A pointer to a buffer containing the name string of the font
 *      for which to obtain an ATSUI font ID.
 *
 *    iNameLength:
 *      The length, in bytes, of the name string provided in the iName
 *      parameter.
 *
 *    iFontNameCode:
 *      A constant specifying the type of name to search for (i.e.,
 *      full name, postcript name). See SFNTTypes.h for a list possible
 *      values to pass for this parameter.
 *
 *    iFontNamePlatform:
 *      A constant specifying the encoding of the font you are
 *      searching for. See SFNTTypes.h for possible values to pass for
 *      this parameter. Pass kFontNoPlatformCode if you do not want to
 *      limit your search to a particular encoding.
 *
 *    iFontNameScript:
 *      A constant specifying the script of the font you are searching
 *      for. See SFNTTypes.h for possible values to pass for this
 *      parameter. Pass kFontNoScriptCode if you do not want to limit
 *      your search to a particular script.
 *
 *    iFontNameLanguage:
 *      A constant specifying the language of the font you are
 *      searching for. See SFNTTypes.h for possible values to pass for
 *      this parameter. Pass kFontNoLanguageCode if you do not want to
 *      limit your search to a particular language.
 *
 *    oFontID:
 *      On return, the value provides a unique identifier for the
 *      specified font. If no installed font matches the specified
 *      parameters, kATSUInvalidFontID is returned for this parameter.
 *
 *  Result:
 *    On success, noErr is returned. If the font cannot be found,
 *    kATSUInvalidFontErr is returned. See MacErrors.h for other
 *    possible error codes.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function ATSUFindFontFromName( iName: Ptr; iNameLength: ByteCount; iFontNameCode: FontNameCode; iFontNamePlatform: FontPlatformCode; iFontNameScript: FontScriptCode; iFontNameLanguage: FontLanguageCode; var oFontID: ATSUFontID ): OSStatus; external name '_ATSUFindFontFromName';


{ ---------------------------------------------------------------------------- }
{  Font features                                                               }
{ ---------------------------------------------------------------------------- }
{
 *  ATSUCountFontFeatureTypes()
 *
 *  Summary:
 *    Obtains the number of available feature types in a font.
 *
 *  Discussion:
 *    This function function obtains the total number of feature types
 *    defined for a font. You can use the count produced by
 *    ATSUCountFontFeatureTypes to determine how much memory to
 *    allocate for the oTypes array in the function
 *    ATSUGetFontFeatureTypes.
 *
 *  Parameters:
 *
 *    iFontID:
 *      The font for which to obtain a count of feature types.
 *
 *    oTypeCount:
 *      On return, the actual number of feature types defined for the
 *      font.
 *
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function ATSUCountFontFeatureTypes( iFontID: ATSUFontID; var oTypeCount: ItemCount ): OSStatus; external name '_ATSUCountFontFeatureTypes';


{
 *  ATSUCountFontFeatureSelectors()
 *
 *  Summary:
 *    Obtains the number of available feature selectors for a given
 *    feature type in a font.
 *
 *  Discussion:
 *    This function obtains the total number of feature selectors
 *    defined for a given feature type in the font. You can use the
 *    count produced by ATSUCountFontFeatureSelectors to determine how
 *    much memory to allocate for the oSelectors array in the function
 *    ATSUGetFontFeatureSelectors.
 *
 *  Parameters:
 *
 *    iFontID:
 *      The font for which to obtain feature selector information.
 *
 *    iType:
 *      A value specifying one of the font's supported feature types.
 *      To obtain the available feature types for a font, call the
 *      function ATSUGetFontFeatureTypes.
 *
 *    oSelectorCount:
 *      On return, specifies the actual number of feature selectors
 *      defined for the feature type by the font.
 *
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function ATSUCountFontFeatureSelectors( iFontID: ATSUFontID; iType: ATSUFontFeatureType; var oSelectorCount: ItemCount ): OSStatus; external name '_ATSUCountFontFeatureSelectors';


{
 *  ATSUGetFontFeatureTypes()
 *
 *  Summary:
 *    Obtains the available feature types of a font.
 *
 *  Discussion:
 *    A given font may not support all possible feature types and
 *    selectors. If you select features that are not available in a
 *    font, you won't see a change in the glyph's appearance. To
 *    determine the available features of a font, you can call the
 *    functions ATSUGetFontFeatureTypes and
 *    ATSUGetFontFeatureSelectors. The ATSUGetFontFeatureTypes function
 *    reads the font data table for the specified font and obtains its
 *    supported feature types. You can then use this information both
 *    to present the user a list of font features from which to select
 *    and to call such functions as ATSUSetFontFeatures with more
 *    accuracy.
 *
 *  Parameters:
 *
 *    iFontID:
 *      The font for which to obtain information about feature types.
 *
 *    iMaximumTypes:
 *      The maximum number of feature types to obtain for the font.
 *      Typically, this is equivalent to the number of elements in the
 *      oTypes array.
 *
 *    oTypes:
 *      A pointer to memory you have allocated for an array of
 *      ATSUFontFeatureType values.  You can call the function
 *      ATSUCountFontFeatureTypes to obtain the number of available
 *      feature types for a given font and thus determine the amount of
 *      memory to allocate. On return, the array contains constants
 *      identifying each type of feature that is defined for the font.
 *      The constants that represent font feature types are defined in
 *      the header file SFNTLayoutTypes.h and are described in the
 *      official ATSUI documentation, available on the Apple developer
 *      website. can be NULL
 *
 *    oActualTypeCount:
 *      On return, the actual number of feature types defined in the
 *      font. This may be greater than the value you specify in the
 *      iMaximumTypes parameter. can be NULL
 *
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function ATSUGetFontFeatureTypes( iFontID: ATSUFontID; iMaximumTypes: ItemCount; oTypes: ATSUFontFeatureTypePtr; oActualTypeCount: ItemCountPtr ): OSStatus; external name '_ATSUGetFontFeatureTypes';


{
 *  ATSUGetFontFeatureSelectors()
 *
 *  Summary:
 *    Obtains the available feature selectors for a given feature type
 *    in a font.
 *
 *  Discussion:
 *    A given font may not support all possible feature types and
 *    selectors. If you select features that are not available in a
 *    font, you won't see a change in the glyph's appearance. To
 *    determine the available features of a font, you can call the
 *    functions ATSUGetFontFeatureTypes and
 *    ATSUGetFontFeatureSelectors. The ATSUGetFontFeatureSelectors
 *    function reads the font data table for the specified font and
 *    obtains its supported feature selectors for the given feature
 *    types. You can then use this information both to present the user
 *    a list of font features from which to select and to call such
 *    functions as ATSUSetFontFeatures with more accuracy.
 *
 *  Parameters:
 *
 *    iFontID:
 *      The font for which to obtain feature selectors.
 *
 *    iType:
 *      An ATSUFontFeatureType value specifying one of the font's
 *      supported feature types. To obtain the available feature types
 *      for a font, call the function ATSUGetFontFeatureTypes.
 *
 *    iMaximumSelectors:
 *      An ItemCount value specifying the maximum number of feature
 *      selectors to obtain for the font's specified feature type.
 *      Typically, this is equivalent to the number of elements in the
 *      oSelectors array.
 *
 *    oSelectors:
 *      A pointer to memory you have allocated for an array of
 *      ATSUFontFeatureSelector values.  You can call the function
 *      ATSUCountFontFeatureSelectors to obtain the number of available
 *      feature selectors for a given font feature type and thus
 *      determine the amount of memory to allocate. On return, the
 *      array contains constants identifying each available feature
 *      selector for the given feature type. The constants that
 *      represent font feature selectors are defined in the header file
 *      SFNTLayoutTypes.h and are described in the official ATSUI
 *      documentation, available on the Apple developer website. can be NULL
 *
 *    oSelectorIsOnByDefault:
 *      A pointer to memory you have allocated for an array of Boolean
 *      values. The number of elements in this array should correspond
 *      to the number of elements in the oSelectors array. On return,
 *      the array contains Boolean values indicating whether the
 *      corresponding feature selector in the oSelectors array is on or
 *      off. If true, the feature selector is on by default; if false,
 *      off. can be NULL
 *
 *    oActualSelectorCount:
 *      On return, the value specifies the actual number of feature
 *      selectors defined for the given feature type. This value may be
 *      greater than the value you specify in the iMaximumSelectors
 *      parameter. can be NULL
 *
 *    oIsMutuallyExclusive:
 *      On return, the value indicates whether the feature selectors
 *      for the given feature type are exclusive or nonexclusive. If a
 *      feature type is exclusive you can choose only one of its
 *      available feature selectors at a time, such as whether to
 *      display numbers as proportional or fixed-width. If a feature
 *      type is nonexclusive, you can enable any number of feature
 *      selectors at once. If true , the feature type is exclusive and
 *      only one selector can be used at a time. can be NULL
 *
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function ATSUGetFontFeatureSelectors( iFontID: ATSUFontID; iType: ATSUFontFeatureType; iMaximumSelectors: ItemCount; oSelectors: ATSUFontFeatureSelectorPtr; oSelectorIsOnByDefault: BooleanPtr; oActualSelectorCount: ItemCountPtr; oIsMutuallyExclusive: BooleanPtr ): OSStatus; external name '_ATSUGetFontFeatureSelectors';


{
 *  ATSUGetFontFeatureNameCode()
 *
 *  Summary:
 *    btains the name code for a font's feature type or selector that
 *    matches an ASTUI font ID, feature type, and feature selector.
 *
 *  Discussion:
 *    This function obtains the name code for a font's feature type or
 *    selector that matches an ASTUI font ID, feature type and feature
 *    selector values. By default, ATSUGetFontFeatureNameCode function
 *    obtains the name code of a feature selector. To determine the
 *    name code of a feature type, pass the constant kATSUNoSelector in
 *    the iSelector parameter. You can use the function
 *    ATSUFindFontName to obtain the localized name string for the name
 *    code produced by ATSUGetFontFeatureNameCode.
 *
 *  Parameters:
 *
 *    iFontID:
 *      The font for which to obtain the name code for a feature type
 *      or selector.
 *
 *    iType:
 *      A constant identifying a valid feature type. To obtain the
 *      valid feature types for a font, call the function
 *      ATSUGetFontFeatureTypes.
 *
 *    iSelector:
 *      A constant identifying a valid feature selector that
 *      corresponds to the feature type passed in the iType parameter.
 *      If you pass the constant kATSUNoSelector, the name code
 *      produced by ATSUGetFontFeatureNameCode is that of the feature
 *      type, not the feature selector. To obtain the valid feature
 *      selectors for a font, call the function
 *      ATSUGetFontFeatureSelectors.
 *
 *    oNameCode:
 *      On return, the value contains the name code for the font
 *      feature selector or type. See the SFNTTypes.h header file for a
 *      definition of the FontNameCode type and a list of possible
 *      values.
 *
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function ATSUGetFontFeatureNameCode( iFontID: ATSUFontID; iType: ATSUFontFeatureType; iSelector: ATSUFontFeatureSelector; var oNameCode: FontNameCode ): OSStatus; external name '_ATSUGetFontFeatureNameCode';


{ ---------------------------------------------------------------------------- }
{  Font tracking value & names                                                 }
{ ---------------------------------------------------------------------------- }
{
 *  ATSUCountFontTracking()
 *
 *  Summary:
 *    Obtains the number of entries in the font tracking table that
 *    correspond to a given ATSUI font ID and glyph orientation.
 *
 *  Discussion:
 *    This function obtains the number of font tracking entries defined
 *    in a font tracking table for a given ATSUI font ID and glyph
 *    orientation. You can pass an index value based on this count to
 *    the function ATSUGetIndFontTracking to obtain the name code and
 *    tracking value of a font tracking.
 *
 *  Parameters:
 *
 *    iFontID:
 *      The font for which to obtain tracking table information.
 *
 *    iCharacterOrientation:
 *      A constant identifying the glyph orientation of the font
 *      tracking entries. See the definition of
 *      ATSUVerticalCharacterType for a list of possible values.
 *
 *    oTrackingCount:
 *      On return, the number of entries in the font tracking table
 *      corresponding to the given ATSUI font ID and glyph orientation.
 *
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.6 and later
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function ATSUCountFontTracking( iFontID: ATSUFontID; iCharacterOrientation: ATSUVerticalCharacterType; var oTrackingCount: ItemCount ): OSStatus; external name '_ATSUCountFontTracking';


{
 *  ATSUGetIndFontTracking()
 *
 *  Summary:
 *    Obtains the name code and tracking value for the font tracking
 *    that matches an ASTUI font ID, glyph orientation, and tracking
 *    table index.
 *
 *  Discussion:
 *    You can call the ATSUGetIndFontTracking function to obtain the
 *    name code and tracking value that matches the specified ATSUI
 *    font ID, glyph orientation, and tracking table index value. This
 *    information allows you to manipulate tracking settings for a
 *    style using this font via the kATSUTrackingTag attribute. You can
 *    use the function ATSUFindFontName to obtain the localized name
 *    string for the name code produced by ATSUGetIndFontTracking.
 *
 *  Parameters:
 *
 *    iFontID:
 *      The font for which to obtain tracking information.
 *
 *    iCharacterOrientation:
 *      A constant identifying the glyph orientation of the font
 *      tracking entries. See the definition of
 *      ATSUVerticalCharacterType for a list of possible values.
 *
 *    iTrackIndex:
 *      An index to the font tracking for which to obtain information.
 *      Because this index must be 0-based, you should pass a value
 *      between 0 and one less than the count produced by the function
 *      ATSUCountFontTracking.
 *
 *    oFontTrackingValue:
 *      On return, the value contains the font tracking value.
 *
 *    oNameCode:
 *      On return, the value contains the name code for the font
 *      tracking. See the SFNTTypes.h header file for a definition of
 *      the FontNameCode type and a list of possible values.
 *
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.6 and later
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function ATSUGetIndFontTracking( iFontID: ATSUFontID; iCharacterOrientation: ATSUVerticalCharacterType; iTrackIndex: ItemCount; var oFontTrackingValue: Fixed; var oNameCode: FontNameCode ): OSStatus; external name '_ATSUGetIndFontTracking';


{ ---------------------------------------------------------------------------- }
{  Font variations                                                             }
{ ---------------------------------------------------------------------------- }
{
 *  ATSUCountFontVariations()
 *
 *  Summary:
 *    Obtains the number of defined variation axes in a font.
 *
 *  Discussion:
 *    This function function obtains the total number of variation axes
 *    defined for a font. You can use the count produced by
 *    ATSUCountFontVariations to get information about a specific font
 *    variation axis from the function ATSUGetIndFontVariation.
 *
 *  Parameters:
 *
 *    iFontID:
 *      The font for which to obtain a count of variation axes.
 *
 *    oVariationCount:
 *      On return, a count of the number of variation axes defined for
 *      the font.
 *
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function ATSUCountFontVariations( iFontID: ATSUFontID; var oVariationCount: ItemCount ): OSStatus; external name '_ATSUCountFontVariations';


{
 *  ATSUGetIndFontVariation()
 *
 *  Summary:
 *    Obtains a variation axis and its value range for a font.
 *
 *  Discussion:
 *    By calling this function, you can obtain a variation axis and its
 *    maximum, minimum, and default values for a font. If you supply
 *    font variation axes and values to the function ATSUSetVariations,
 *    you can change the appearance of a style object's font
 *    accordingly. Note that while you may pass NULL for any of the
 *    output parameters, at least one must be non-NULL or paramErr will
 *    be returned.
 *
 *  Parameters:
 *
 *    iFontID:
 *      A font for which to obtain variation information for.
 *
 *    iVariationIndex:
 *      A value specifying an index into the array of variation axes
 *      for the font. This index identifies the font variation axis to
 *      examine. Because this index is zero-based, you must pass a
 *      value between 0 and one less than the value produced in the
 *      oVariationCount parameter of the function
 *      ATSUCountFontVariations.
 *
 *    oATSUFontVariationAxis:
 *      On return, a four-character code identifying the font variation
 *      axis corresponding to the specified index. can be NULL
 *
 *    oMinimumValue:
 *      On return, the variation axis minimum. can be NULL
 *
 *    oMaximumValue:
 *      On return, the variation axis maximum. can be NULL
 *
 *    oDefaultValue:
 *      On return, the variation axis default. can be NULL
 *
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function ATSUGetIndFontVariation( iFontID: ATSUFontID; iVariationIndex: ItemCount; oATSUFontVariationAxis: ATSUFontVariationAxisPtr; oMinimumValue: ATSUFontVariationValuePtr; oMaximumValue: ATSUFontVariationValuePtr; oDefaultValue: ATSUFontVariationValuePtr ): OSStatus; external name '_ATSUGetIndFontVariation';


{
 *  ATSUGetFontVariationNameCode()
 *
 *  Summary:
 *    Obtains the name code for the font variation that matches an
 *    ASTUI font ID and font variation axis.
 *
 *  Discussion:
 *    This function function obtains the name code for the font
 *    variation that matches an ASTUI font ID and font variation axis
 *    tag. You can use the function ATSUFindFontName to obtain the
 *    localized name string for the name code produced by
 *    ATSUGetFontVariationNameCode.
 *
 *  Parameters:
 *
 *    iFontID:
 *      The font for which to obtain a font variation name code.
 *
 *    iAxis:
 *      An ATSUFontVariationAxis value representing a valid variation
 *      axis tag. To obtain a valid variation axis tag for a font, you
 *      can call the functions ATSUGetIndFontVariation or
 *      ATSUGetFontInstance.
 *
 *    oNameCode:
 *      On return, the value contains the name code for the font
 *      variation. See the SFNTTypes.h header file for a definition of
 *      the FontNameCode type and a list of possible values.
 *
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function ATSUGetFontVariationNameCode( iFontID: ATSUFontID; iAxis: ATSUFontVariationAxis; var oNameCode: FontNameCode ): OSStatus; external name '_ATSUGetFontVariationNameCode';


{ ---------------------------------------------------------------------------- }
{  Font Instances                                                              }
{ ---------------------------------------------------------------------------- }
{
 *  ATSUCountFontInstances()
 *
 *  Summary:
 *    Obtains the number of defined font instances in a font.
 *
 *  Discussion:
 *    This function obtains the total number of font instances defined
 *    in a font. You can use an index value derived from this count to
 *    get information about a specific font instance by calling the
 *    function ATSUGetFontInstance.
 *
 *  Parameters:
 *
 *    iFontID:
 *      The font for which to obtain a count of defined instances.
 *
 *    oInstances:
 *      On return, the value specifies the number of font instances
 *      defined for the font.
 *
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function ATSUCountFontInstances( iFontID: ATSUFontID; var oInstances: ItemCount ): OSStatus; external name '_ATSUCountFontInstances';


{
 *  ATSUGetFontInstance()
 *
 *  Summary:
 *    Obtains the font variation axis values for a font instance.
 *
 *  Discussion:
 *    with a minimum value of 0.0, a default of 0.5, and a maximum of
 *    1.0. Additionally, the variation axis 'wdth' is also defined for
 *    the font, with a similar value range. The type designer can then
 *    choose to declare a font instance for a set of specific values
 *    within these axes, such as ÒDemiboldÓ for a value of 0.8 for the
 *    'wght' axis and 0.5 for the 'wdth' axis. By calling the function
 *    ATSUGetFontInstance , you can obtain the variation axis values
 *    for a given index into an array of font instances. Typically you
 *    use the function ATSUGetFontInstance by calling it twice, as
 *    follows: (1) Pass the ID of the font to examine in the iFont
 *    parameter, a valid pointer to an ItemCount value in the
 *    oActualVariationCount parameter, NULL for the oAxes and oValues
 *    parameters, and 0 for the other parameters. ATSUGetFontInstance
 *    returns the size to use for the oAxes and oValues arrays in the
 *    oActualVariationCount parameter. (2) Allocate enough space for
 *    arrays of the returned size, then call the ATSUGetFontInstance
 *    again, passing pointers to the arrays in the oAxes and oValues
 *    parameters. On return, the arrays contain the font variation axes
 *    and their corresponding values, respectively, for the font
 *    instance.
 *
 *  Parameters:
 *
 *    iFontID:
 *      The font for which to obtain instance information.
 *
 *    iFontInstanceIndex:
 *      An index into an array of instances for the font. This index
 *      identifies the font instance to examine. Because this index is
 *      zero-based, you must pass a value between 0 and one less than
 *      the value produced in the oInstances parameter of the function
 *      ATSUCountFontInstances.
 *
 *    iMaximumVariations:
 *      The maximum number of font variation axes to obtain for the
 *      font instance. Typically, this is equivalent to the number of
 *      ATSUFontVariationAxis and ATSUFontVariationValue values for
 *      which you have allocated memory in the oAxes and oValues
 *      parameters, respectively. To determine this value, see the
 *      Discussion.
 *
 *    oAxes:
 *      On return, the array contains tags identifying the font
 *      variation axes that constitute the font instance. If you are
 *      uncertain of how much memory to allocate for this array, see
 *      the Discussion. can be NULL
 *
 *    oValues:
 *      On return, the array contains the defined values for the font
 *      variation axes produced in the oAxes array. If you are
 *      uncertain of how much memory to allocate for this array, see
 *      the Discussion. can be NULL
 *
 *    oActualVariationCount:
 *      On return, the actual number of font variation axes that
 *      constitute the font instance. This may be greater than the
 *      value you passed in the iMaximumVariations parameter.
 *
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function ATSUGetFontInstance( iFontID: ATSUFontID; iFontInstanceIndex: ItemCount; iMaximumVariations: ItemCount; oAxes: ATSUFontVariationAxisPtr; oValues: ATSUFontVariationValuePtr; var oActualVariationCount: ItemCount ): OSStatus; external name '_ATSUGetFontInstance';


{
 *  ATSUGetFontInstanceNameCode()
 *
 *  Summary:
 *    Obtains the name code for the font instance that matches an ASTUI
 *    font ID and font instance index value.
 *
 *  Discussion:
 *    A font instance consists of a named set of values for each
 *    variation axis in a font. The ATSUGetFontInstanceNameCode
 *    function obtains the name code for the font instance that matches
 *    an ASTUI font ID and font instance index value. You can use the
 *    function ATSUFindFontName to obtain the localized name string for
 *    the name code produced by ATSUGetFontInstanceNameCode. You can
 *    obtain the font variation axis values for a font instance by
 *    calling the function ATSUGetFontInstance.
 *
 *  Parameters:
 *
 *    iFontID:
 *      The font for which to obtain a font instance name code.
 *
 *    iInstanceIndex:
 *      An index to the font instance for which to obtain a name code.
 *      Because this index must be 0-based, you should pass a value
 *      between 0 and one less than the count produced by the function
 *      ATSUCountFontInstances.
 *
 *    oNameCode:
 *      On return, the name code for the font instance. See the
 *      SFNTTypes.h header file for a definition of the FontNameCode
 *      type and a list of possible values.
 *
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function ATSUGetFontInstanceNameCode( iFontID: ATSUFontID; iInstanceIndex: ItemCount; var oNameCode: FontNameCode ): OSStatus; external name '_ATSUGetFontInstanceNameCode';
{unit ATSUnicodeGlyphs}
{$ALIGN MAC68K}






{ ---------------------------------------------------------------------------- }
{ ATSUI glyph metrics                                                          }
{ ---------------------------------------------------------------------------- }


{
 *  ATSUGlyphGetIdealMetrics()
 *
 *  Summary:
 *    Obtains resolution-independent font metric information for glyphs
 *    associated with a given style object.
 *
 *  Discussion:
 *    The advance width is the full horizontal width of the glyph as
 *    measured from its origin to the origin of the next glyph on the
 *    line, including the left-side and right-side bearings. For
 *    vertical text, the advance height is the sum of the top-side
 *    bearing, the bounding-box height, and the bottom-side bearing.
 *    You can call the ATSUGlyphGetIdealMetrics function to obtain an
 *    array of ATSGlyphIdealMetrics structures containing values for
 *    the specified glyphs' advance and side bearings.
 *    ATSUGlyphGetIdealMetrics can analyze both horizontal and vertical
 *    text, automatically producing the appropriate bearing values
 *    (oriented for width or height, respectively) for each. You should
 *    call ATSUGlyphGetIdealMetrics to obtain resolution-independent
 *    glyph metrics. To obtain device-adjusted (that is,
 *    resolution-dependent) glyph metrics, call the function
 *    ATSUGlyphGetScreenMetrics.
 *
 *  Parameters:
 *
 *    iATSUStyle:
 *      A style referring to a font you wish to obtain glyph metrics
 *      from.
 *
 *    iNumOfGlyphs:
 *      The number of glyph IDs you are passing in to be examined. This
 *      value should be equal to the size of the array you are passing
 *      in for the iGlyphIDs parameter.
 *
 *    iGlyphIDs:
 *      An array of glyph IDs referring to glyphs for which you wish to
 *      obtain metrics.
 *
 *    iInputOffset:
 *      A ByteOffset value specifying the offset in bytes between glyph
 *      IDs in the iGlyphIDs array.
 *
 *    oIdealMetrics:
 *      A pointer to memory you have allocated for an array of
 *      ATSGlyphIdealMetrics structures. On return, each structure
 *      contains advance and side-bearing values for a glyph. See
 *      ATSTypes.h for more information regarding the
 *      ATSGlyphIdealMetrics structure.
 *
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 9.1 and later
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function ATSUGlyphGetIdealMetrics( iATSUStyle: ATSUStyle; iNumOfGlyphs: ItemCount; iGlyphIDs: GlyphIDPtr; iInputOffset: ByteOffset; oIdealMetrics: ATSGlyphIdealMetricsPtr ): OSStatus; external name '_ATSUGlyphGetIdealMetrics';


{
 *  ATSUGlyphGetScreenMetrics()
 *
 *  Summary:
 *    Obtains device-adjusted font metric information for glyphs
 *    associated with a given style object.
 *
 *  Discussion:
 *    You can call the ATSUGlyphGetScreenMetrics function to obtain an
 *    array of ATSGlyphScreenMetrics structures containing values for
 *    the specified glyphs' advance and side bearings, top left,
 *    height, and width. You should call ATSUGlyphGetScreenMetrics to
 *    obtain device-adjusted (that is, resolution-dependent) glyph
 *    metrics. To obtain resolution-independent glyph metrics, call the
 *    function ATSUGlyphGetIdealMetrics.
 *
 *  Parameters:
 *
 *    iATSUStyle:
 *      A style referring to a font you wish to obtain glyph metrics
 *      from.
 *
 *    iNumOfGlyphs:
 *      The number of glyph IDs you are passing in to be examined. This
 *      value should be equal to the size of the array you are passing
 *      in for the iGlyphIDs parameter.
 *
 *    iGlyphIDs:
 *      An array of glyph IDs referring to glyphs for which you wish to
 *      obtain metrics.
 *
 *    iInputOffset:
 *      A ByteOffset value specifying the offset in bytes between glyph
 *      IDs in the iGlyphIDs array.
 *
 *    iForcingAntiAlias:
 *      A Boolean value indicating whether anti-aliasing is forced for
 *      the style object.
 *
 *    iAntiAliasSwitch:
 *      A Boolean value indicating whether anti-aliasing is currently
 *      on or off.
 *
 *    oScreenMetrics:
 *      A pointer to memory you have allocated for an array of
 *      ATSGlyphScreenMetrics structures. On return, each structure
 *      contains advance and side-bearing values for a glyph. See
 *      ATSTypes.h for more information regarding the
 *      ATSGlyphScreenMetrics structure.
 *
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 9.1 and later
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function ATSUGlyphGetScreenMetrics( iATSUStyle: ATSUStyle; iNumOfGlyphs: ItemCount; iGlyphIDs: GlyphIDPtr; iInputOffset: ByteOffset; iForcingAntiAlias: Boolean; iAntiAliasSwitch: Boolean; oScreenMetrics: ATSGlyphScreenMetricsPtr ): OSStatus; external name '_ATSUGlyphGetScreenMetrics';


{ ---------------------------------------------------------------------------- }
{ ATSUI glyph curve access functions and callbacks                             }
{ ---------------------------------------------------------------------------- }
{
 *  ATSUGetNativeCurveType()
 *
 *  Summary:
 *    Returns the native curve format for a specific font.
 *
 *  Discussion:
 *    Use this function to decide whether to call
 *    ATSUGlyphGetQuadraticPaths or ATSUGlyphGetCubicPaths. Both
 *    functions will return curves for all valid ATSUI fonts, but if
 *    the curve type you request is not the native curve type of the
 *    font, the curves you get back will be mathematically converted,
 *    rather than native font data. See the definition of ATSCurveType
 *    in ATSTypes.h for possible return values from this function.
 *
 *  Parameters:
 *
 *    iATSUStyle:
 *      A style referencing a font for which you wish to obtain the
 *      native curve type.
 *
 *    oCurveType:
 *      On return, a value indicating the native curve type of the font
 *      referenced by iATSUStyle. See the definition of ATSCurveType in
 *      ATSTypes.h for a list of possible return values for this
 *      parameter.
 *
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 9.1 and later
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function ATSUGetNativeCurveType( iATSUStyle: ATSUStyle; var oCurveType: ATSCurveType ): OSStatus; external name '_ATSUGetNativeCurveType';



{
 *  ATSQuadraticNewPathProcPtr
 *
 *  Discussion:
 *    A pointer to a client supplied callback function for handling
 *    glyph curve drawing operations. This callback handles operations
 *    to start a new drawing path.
 *
 *  Parameters:
 *
 *    callBackDataPtr:
 *      A pointer to any application specific data that may have been
 *      passed to the callbacks through the iCallbackDataPtr parameter
 *      of the ATSUGlyphGetQuadraticPaths function.
 *
 *  Result:
 *    Return status. Pass any errors you wish to propagate back to the
 *    original caller of ATSUGlyphGetQuadraticPaths through this return
 *    value. Note that any nonzero result from this callback will halt
 *    the curve drawing process.
 }
type ATSQuadraticNewPathProcPtr = function( callBackDataPtr: UnivPtr ): OSStatus;
// Beats me what this translates to.  If someone finds out they can tell me and we'll update it
// typedef STACK_UPP_TYPE(ATSQuadraticNewPathProcPtr)              ATSQuadraticNewPathUPP;
type ATSQuadraticNewPathUPP = Ptr;

{
 *  NewATSQuadraticNewPathUPP()
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Non-Carbon CFM:   available as macro/inline
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function NewATSQuadraticNewPathUPP( userRoutine: ATSQuadraticNewPathProcPtr ): ATSQuadraticNewPathUPP; external name '_NewATSQuadraticNewPathUPP';

{
 *  DisposeATSQuadraticNewPathUPP()
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Non-Carbon CFM:   available as macro/inline
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
procedure DisposeATSQuadraticNewPathUPP( userUPP: ATSQuadraticNewPathUPP ); external name '_DisposeATSQuadraticNewPathUPP';

{
 *  InvokeATSQuadraticNewPathUPP()
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Non-Carbon CFM:   available as macro/inline
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function InvokeATSQuadraticNewPathUPP( callBackDataPtr: UnivPtr; userUPP: ATSQuadraticNewPathUPP ): OSStatus; external name '_InvokeATSQuadraticNewPathUPP';


{
 *  ATSQuadraticLineProcPtr
 *
 *  Discussion:
 *    A pointer to a client supplied callback function for handling
 *    glyph curve drawing operations. This callback handles operations
 *    to draw straight lines.
 *
 *  Parameters:
 *
 *    pt1:
 *      The starting point of the line.
 *
 *    pt2:
 *      The end point of the line.
 *
 *    callBackDataPtr:
 *      A pointer to any application specific data that may have been
 *      passed to the callbacks through the iCallbackDataPtr parameter
 *      of the ATSUGlyphGetQuadraticPaths function.
 *
 *  Result:
 *    Return status. Pass any errors you wish to propagate back to the
 *    original caller of ATSUGlyphGetQuadraticPaths through this return
 *    value. Note that any nonzero result from this callback will halt
 *    the curve drawing process.
 }
type ATSQuadraticLineProcPtr = function( const (*var*) pt1, pt2: Float32Point; callBackDataPtr: UnivPtr ): OSStatus;
// Beats me what this translates to.  If someone finds out they can tell me and we'll update it
// typedef STACK_UPP_TYPE(ATSQuadraticLineProcPtr)                 ATSQuadraticLineUPP;
type ATSQuadraticLineUPP = Ptr;
{
 *  NewATSQuadraticLineUPP()
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Non-Carbon CFM:   available as macro/inline
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function NewATSQuadraticLineUPP( userRoutine: ATSQuadraticLineProcPtr ): ATSQuadraticLineUPP; external name '_NewATSQuadraticLineUPP';

{
 *  DisposeATSQuadraticLineUPP()
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Non-Carbon CFM:   available as macro/inline
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
procedure DisposeATSQuadraticLineUPP( userUPP: ATSQuadraticLineUPP ); external name '_DisposeATSQuadraticLineUPP';

{
 *  InvokeATSQuadraticLineUPP()
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Non-Carbon CFM:   available as macro/inline
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function InvokeATSQuadraticLineUPP( const (*var*) pt1, pt2: Float32Point; callBackDataPtr: UnivPtr; userUPP: ATSQuadraticLineUPP ): OSStatus; external name '_InvokeATSQuadraticLineUPP';


{
 *  ATSQuadraticCurveProcPtr
 *
 *  Discussion:
 *    A pointer to a client supplied callback function for handling
 *    glyph curve drawing operations. This callback handles operations
 *    to draw curves. The curve is a quadratic patch specified by a
 *    start point (pt1), and end point (pt2), and a single control
 *    point (controlPt).
 *
 *  Parameters:
 *
 *    pt1:
 *      The starting point of the curve.
 *
 *    controlPt:
 *      The off-curve control point.
 *
 *    pt2:
 *      The end point of the curve.
 *
 *    callBackDataPtr:
 *      A pointer to any application specific data that may have been
 *      passed to the callbacks through the iCallbackDataPtr parameter
 *      of the ATSUGlyphGetQuadraticPaths function.
 *
 *  Result:
 *    Return status. Pass any errors you wish to propagate back to the
 *    original caller of ATSUGlyphGetQuadraticPaths through this return
 *    value. Note that any nonzero result from this callback will halt
 *    the curve drawing process.
 }
type ATSQuadraticCurveProcPtr = function( const (*var*) pt1, controlPt, pt2: Float32Point; callBackDataPtr: UnivPtr ): OSStatus;
// Beats me what this translates to.  If someone finds out they can tell me and we'll update it
// typedef STACK_UPP_TYPE(ATSQuadraticCurveProcPtr)                ATSQuadraticCurveUPP;
type ATSQuadraticCurveUPP = Ptr;
{
 *  NewATSQuadraticCurveUPP()
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Non-Carbon CFM:   available as macro/inline
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function NewATSQuadraticCurveUPP( userRoutine: ATSQuadraticCurveProcPtr ): ATSQuadraticCurveUPP; external name '_NewATSQuadraticCurveUPP';

{
 *  DisposeATSQuadraticCurveUPP()
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Non-Carbon CFM:   available as macro/inline
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
procedure DisposeATSQuadraticCurveUPP( userUPP: ATSQuadraticCurveUPP ); external name '_DisposeATSQuadraticCurveUPP';

{
 *  InvokeATSQuadraticCurveUPP()
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Non-Carbon CFM:   available as macro/inline
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function InvokeATSQuadraticCurveUPP( const (*var*) pt1, controlPt, pt2: Float32Point; callBackDataPtr: UnivPtr; userUPP: ATSQuadraticCurveUPP ): OSStatus; external name '_InvokeATSQuadraticCurveUPP';


{
 *  ATSQuadraticClosePathProcPtr
 *
 *  Discussion:
 *    A pointer to a client supplied callback function for handling
 *    glyph curve drawing operations. This callback handles operations
 *    to close the current drawing path.
 *
 *  Parameters:
 *
 *    callBackDataPtr:
 *      A pointer to any application specific data that may have been
 *      passed to the callbacks through the iCallbackDataPtr parameter
 *      of the ATSUGlyphGetQuadraticPaths function.
 *
 *  Result:
 *    Return status. Pass any errors you wish to propagate back to the
 *    original caller of ATSUGlyphGetQuadraticPaths through this return
 *    value. Note that any nonzero result from this callback will halt
 *    the curve drawing process.
 }
type ATSQuadraticClosePathProcPtr = function( callBackDataPtr: UnivPtr ): OSStatus;
// Beats me what this translates to.  If someone finds out they can tell me and we'll update it
// typedef STACK_UPP_TYPE(ATSQuadraticClosePathProcPtr)            ATSQuadraticClosePathUPP;
type ATSQuadraticClosePathUPP = Ptr;
{
 *  NewATSQuadraticClosePathUPP()
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Non-Carbon CFM:   available as macro/inline
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function NewATSQuadraticClosePathUPP( userRoutine: ATSQuadraticClosePathProcPtr ): ATSQuadraticClosePathUPP; external name '_NewATSQuadraticClosePathUPP';

{
 *  DisposeATSQuadraticClosePathUPP()
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Non-Carbon CFM:   available as macro/inline
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
procedure DisposeATSQuadraticClosePathUPP( userUPP: ATSQuadraticClosePathUPP ); external name '_DisposeATSQuadraticClosePathUPP';

{
 *  InvokeATSQuadraticClosePathUPP()
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Non-Carbon CFM:   available as macro/inline
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function InvokeATSQuadraticClosePathUPP( callBackDataPtr: UnivPtr; userUPP: ATSQuadraticClosePathUPP ): OSStatus; external name '_InvokeATSQuadraticClosePathUPP';

{
 *  ATSUGlyphGetQuadraticPaths()
 *
 *  Summary:
 *    Uses a callback mechanism to obtain a set of Quadratic outlines
 *    for a specified glyph in a specified font.
 *
 *  Discussion:
 *    This function will allow you to use callbacks to obtain the exact
 *    outline of a specified glyph, in quadratic form. Although this
 *    function will always return results for any valid ATSUI font, you
 *    should first use the function ATSUGetNativeCurveType to determine
 *    the native format of the glyph you are interested in. Then,
 *    either call ATSUGlyphGetQuadraticPaths or ATSUGlyphGetCubicPaths
 *    based on the result. Otherwise, you may end up with curves that
 *    are mathematically converted from cubic to quadratic (or vice
 *    versa), instead of getting native font data. See the definitions
 *    of ATSQuadraticNewPathProcPtr, ATSQuadraticLineProcPtr,
 *    ATSQuadraticCurveProcPtr, and ATSQuadraticClosePathProcPtr for
 *    more information about setting up the callbacks.
 *
 *  Parameters:
 *
 *    iATSUStyle:
 *      A style referring to a font you wish to obtain a set of glyph
 *      outlines from.
 *
 *    iGlyphID:
 *      A ID number referring to the glyph for which you wish to obtain
 *      outline data. Use the ATSUI direct access functions in
 *      ATSUnicodeDirectAccess.h to obtain values to pass for this
 *      parameter.
 *
 *    iNewPathProc:
 *      A pointer to a callback function for quadratic new path
 *      operations. See the definition of ATSQuadraticNewPathProcPtr
 *      for more information about creating, disposing, and invoking
 *      this type of Universal Procedure Pointer.
 *
 *    iLineProc:
 *      A pointer to a callback function for quadratic LineTo
 *      operations. See the definition of ATSQuadraticLineProcPtr for
 *      more information about creating, disposing, and invoking this
 *      type of Universal Procedure Pointer.
 *
 *    iCurveProc:
 *      A pointer to a callback function for quadratic curve
 *      operations. See the definition of ATSQuadraticCurveProcPtr for
 *      more information about creating, disposing, and invoking this
 *      type of Universal Procedure Pointer.
 *
 *    iClosePathProc:
 *      A pointer to a callback function for quadratic close path
 *      operations. See the definition of ATSQuadraticClosePathProcPtr
 *      for more information about creating, disposing, and invoking
 *      this type of Universal Procedure Pointer.
 *
 *    iCallbackDataPtr:
 *      Any valid pointer. Any application specific data you wish to
 *      pass to your callbacks may be sent through this parameter.
 *
 *    oCallbackResult:
 *      On return, status returned by callback functions. If an error
 *      occurs, callbacks may communicate it through this parameter.
 *
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 9.1 and later
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function ATSUGlyphGetQuadraticPaths( iATSUStyle: ATSUStyle; iGlyphID: GlyphID; iNewPathProc: ATSQuadraticNewPathUPP; iLineProc: ATSQuadraticLineUPP; iCurveProc: ATSQuadraticCurveUPP; iClosePathProc: ATSQuadraticClosePathUPP; iCallbackDataPtr: UnivPtr; var oCallbackResult: OSStatus ): OSStatus; external name '_ATSUGlyphGetQuadraticPaths';



{
 *  ATSCubicMoveToProcPtr
 *
 *  Discussion:
 *    A pointer to a client supplied callback function for handling
 *    glyph curve drawing operations. This callback handles operations
 *    to move the current pen location.
 *
 *  Parameters:
 *
 *    pt:
 *      The point to which to move the current pen location.
 *
 *    callBackDataPtr:
 *      A pointer to any application specific data that may have been
 *      passed to the callbacks through the iCallbackDataPtr parameter
 *      of the ATSUGlyphGetCubicPaths function.
 *
 *  Result:
 *    Return status. Pass any errors you wish to propagate back to the
 *    original caller of ATSUGlyphGetCubicPaths through this return
 *    value. Note that any nonzero result from this callback will halt
 *    the curve drawing process.
 }
type ATSCubicMoveToProcPtr = function( const (*var*) pt: Float32Point; callBackDataPtr: UnivPtr ): OSStatus;
// Beats me what this translates to.  If someone finds out they can tell me and we'll update it
// typedef STACK_UPP_TYPE(ATSCubicMoveToProcPtr)                   ATSCubicMoveToUPP;
type ATSCubicMoveToUPP = Ptr;
{
 *  NewATSCubicMoveToUPP()
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Non-Carbon CFM:   available as macro/inline
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function NewATSCubicMoveToUPP( userRoutine: ATSCubicMoveToProcPtr ): ATSCubicMoveToUPP; external name '_NewATSCubicMoveToUPP';

{
 *  DisposeATSCubicMoveToUPP()
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Non-Carbon CFM:   available as macro/inline
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
procedure DisposeATSCubicMoveToUPP( userUPP: ATSCubicMoveToUPP ); external name '_DisposeATSCubicMoveToUPP';

{
 *  InvokeATSCubicMoveToUPP()
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Non-Carbon CFM:   available as macro/inline
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function InvokeATSCubicMoveToUPP( const (*var*) pt: Float32Point; callBackDataPtr: UnivPtr; userUPP: ATSCubicMoveToUPP ): OSStatus; external name '_InvokeATSCubicMoveToUPP';


{
 *  ATSCubicLineToProcPtr
 *
 *  Discussion:
 *    A pointer to a client supplied callback function for handling
 *    glyph curve drawing operations. This callback handles operations
 *    to draw straight lines.
 *
 *  Parameters:
 *
 *    pt:
 *      The end point of the line to be drawn. The starting point is
 *      whatever the current pen position is.
 *
 *    callBackDataPtr:
 *      A pointer to any application specific data that may have been
 *      passed to the callbacks through the iCallbackDataPtr parameter
 *      of the ATSUGlyphGetCubicPaths function.
 *
 *  Result:
 *    Return status. Pass any errors you wish to propagate back to the
 *    original caller of ATSUGlyphGetCubicPaths through this return
 *    value. Note that any nonzero result from this callback will halt
 *    the curve drawing process.
 }
type ATSCubicLineToProcPtr = function( const (*var*) pt: Float32Point; callBackDataPtr: UnivPtr ): OSStatus;
// Beats me what this translates to.  If someone finds out they can tell me and we'll update it
// typedef STACK_UPP_TYPE(ATSCubicLineToProcPtr)                   ATSCubicLineToUPP;
type ATSCubicLineToUPP = Ptr;
{
 *  NewATSCubicLineToUPP()
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Non-Carbon CFM:   available as macro/inline
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function NewATSCubicLineToUPP( userRoutine: ATSCubicLineToProcPtr ): ATSCubicLineToUPP; external name '_NewATSCubicLineToUPP';

{
 *  DisposeATSCubicLineToUPP()
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Non-Carbon CFM:   available as macro/inline
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
procedure DisposeATSCubicLineToUPP( userUPP: ATSCubicLineToUPP ); external name '_DisposeATSCubicLineToUPP';

{
 *  InvokeATSCubicLineToUPP()
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Non-Carbon CFM:   available as macro/inline
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function InvokeATSCubicLineToUPP( const (*var*) pt: Float32Point; callBackDataPtr: UnivPtr; userUPP: ATSCubicLineToUPP ): OSStatus; external name '_InvokeATSCubicLineToUPP';


{
 *  ATSCubicCurveToProcPtr
 *
 *  Discussion:
 *    A pointer to a client supplied callback function for handling
 *    glyph curve drawing operations. This callback handles operations
 *    to draw a curve. The curve is a Bezier patch defined by two
 *    off-curve control points (pt1 and pt2), and an endpoint (pt3).
 *    The starting point is whatever the current pen position is.
 *
 *  Parameters:
 *
 *    pt1:
 *      The first off-curve control point.
 *
 *    pt2:
 *      The second off-curve control point.
 *
 *    pt3:
 *      The end point of the curve.
 *
 *    callBackDataPtr:
 *      A pointer to any application specific data that may have been
 *      passed to the callbacks through the iCallbackDataPtr parameter
 *      of the ATSUGlyphGetCubicPaths function.
 *
 *  Result:
 *    Return status. Pass any errors you wish to propagate back to the
 *    original caller of ATSUGlyphGetCubicPaths through this return
 *    value. Note that any nonzero result from this callback will halt
 *    the curve drawing process.
 }
type ATSCubicCurveToProcPtr = function( const (*var*) pt, pt2, pt3: Float32Point; callBackDataPtr: UnivPtr ): OSStatus;
// Beats me what this translates to.  If someone finds out they can tell me and we'll update it
// typedef STACK_UPP_TYPE(ATSCubicCurveToProcPtr)                  ATSCubicCurveToUPP;
type ATSCubicCurveToUPP = Ptr;
{
 *  NewATSCubicCurveToUPP()
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Non-Carbon CFM:   available as macro/inline
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function NewATSCubicCurveToUPP( userRoutine: ATSCubicCurveToProcPtr ): ATSCubicCurveToUPP; external name '_NewATSCubicCurveToUPP';

{
 *  DisposeATSCubicCurveToUPP()
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Non-Carbon CFM:   available as macro/inline
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
procedure DisposeATSCubicCurveToUPP( userUPP: ATSCubicCurveToUPP ); external name '_DisposeATSCubicCurveToUPP';

{
 *  InvokeATSCubicCurveToUPP()
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Non-Carbon CFM:   available as macro/inline
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function InvokeATSCubicCurveToUPP( const (*var*) pt, pt2, pt3: Float32Point; callBackDataPtr: UnivPtr; userUPP: ATSCubicCurveToUPP ): OSStatus; external name '_InvokeATSCubicCurveToUPP';


{
 *  ATSCubicClosePathProcPtr
 *
 *  Discussion:
 *    A pointer to a client supplied callback function for handling
 *    glyph curve drawing operations. This callback handles operations
 *    to close the current drawing path.
 *
 *  Parameters:
 *
 *    callBackDataPtr:
 *      A pointer to any application specific data that may have been
 *      passed to the callbacks through the iCallbackDataPtr parameter
 *      of the ATSUGlyphGetCubicPaths function.
 *
 *  Result:
 *    Return status. Pass any errors you wish to propagate back to the
 *    original caller of ATSUGlyphGetCubicPaths through this return
 *    value. Note that any nonzero result from this callback will halt
 *    the curve drawing process.
 }
type ATSCubicClosePathProcPtr = function( callBackDataPtr: UnivPtr ): OSStatus;
// Beats me what this translates to.  If someone finds out they can tell me and we'll update it
// typedef STACK_UPP_TYPE(ATSCubicClosePathProcPtr)                ATSCubicClosePathUPP;
type ATSCubicClosePathUPP = Ptr;
{
 *  NewATSCubicClosePathUPP()
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Non-Carbon CFM:   available as macro/inline
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function NewATSCubicClosePathUPP( userRoutine: ATSCubicClosePathProcPtr ): ATSCubicClosePathUPP; external name '_NewATSCubicClosePathUPP';

{
 *  DisposeATSCubicClosePathUPP()
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Non-Carbon CFM:   available as macro/inline
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
procedure DisposeATSCubicClosePathUPP( userUPP: ATSCubicClosePathUPP ); external name '_DisposeATSCubicClosePathUPP';

{
 *  InvokeATSCubicClosePathUPP()
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Non-Carbon CFM:   available as macro/inline
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function InvokeATSCubicClosePathUPP( callBackDataPtr: UnivPtr; userUPP: ATSCubicClosePathUPP ): OSStatus; external name '_InvokeATSCubicClosePathUPP';

{
 *  ATSUGlyphGetCubicPaths()
 *
 *  Summary:
 *    Uses a callback mechanism to obtain a set of Cubic outlines for a
 *    specified glyph in a specified font.
 *
 *  Discussion:
 *    This function will allow you to use callbacks to obtain the exact
 *    outline of a specified glyph, in cubic form. Although this
 *    function will always return results for any valid ATSUI font, you
 *    should first use the function ATSUGetNativeCurveType to determine
 *    the native format of the glyph you are interested in. Then,
 *    either call ATSUGlyphGetQuadraticPaths or ATSUGlyphGetCubicPaths
 *    based on the result. Otherwise, you may end up with curves that
 *    are mathematically converted from quadratic to cubic (or vice
 *    versa), instead of getting native font data. See the definitions
 *    of ATSCubicMoveToProcPtr, ATSCubicLineToProcPtr,
 *    ATSCubicCurveToProcPtr, and ATSCubicClosePathProcPtr for more
 *    information about setting up the callbacks.
 *
 *  Parameters:
 *
 *    iATSUStyle:
 *      A style referring to a font you wish to obtain a set of glyph
 *      outlines from.
 *
 *    iGlyphID:
 *      A ID number referring to the glyph for which you wish to obtain
 *      outline data. Use the ATSUI direct access functions in
 *      ATSUnicodeDirectAccess.h to obtain values to pass for this
 *      parameter.
 *
 *    iMoveToProc:
 *      A pointer to a callback function for cubic MoveTo operations.
 *      See the definition of ATSCubicMoveToProcPtr for more
 *      information about creating, disposing, and invoking this type
 *      of Universal Procedure Pointer.
 *
 *    iLineToProc:
 *      A pointer to a callback function for cubic LineTo operations.
 *      See the definition of ATSCubicLineToProcPtr for more
 *      information about creating, disposing, and invoking this type
 *      of Universal Procedure Pointer.
 *
 *    iCurveToProc:
 *      A pointer to a callback function for cubic CurveTo operations.
 *      See the definition of ATSCubicCurveToProcPtr for more
 *      information about creating, disposing, and invoking this type
 *      of Universal Procedure Pointer.
 *
 *    iClosePathProc:
 *      A pointer to a callback function for cubic MoveTo operations.
 *      See the definition of ATSCubicClosePathProcPtr for more
 *      information about creating, disposing, and invoking this type
 *      of Universal Procedure Pointer.
 *
 *    iCallbackDataPtr:
 *      Any valid pointer. Any application specific data you wish to
 *      pass to your callbacks may be sent through this parameter. can be NULL
 *
 *    oCallbackResult:
 *      On return, status returned by callback functions. If an error
 *      occurs, callbacks may communicate it through this parameter.
 *
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 9.1 and later
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function ATSUGlyphGetCubicPaths( iATSUStyle: ATSUStyle; iGlyphID: GlyphID; iMoveToProc: ATSCubicMoveToUPP; iLineToProc: ATSCubicLineToUPP; iCurveToProc: ATSCubicCurveToUPP; iClosePathProc: ATSCubicClosePathUPP; iCallbackDataPtr: UnivPtr; var oCallbackResult: OSStatus ): OSStatus; external name '_ATSUGlyphGetCubicPaths';


{
 *  ATSUGlyphGetCurvePaths()
 *
 *  Summary:
 *    Obtains glyph curve data without the use of callbacks.
 *
 *  Discussion:
 *    This function will return glyph curve data in a single data
 *    structure rather than through the use of callbacks, but you must
 *    parse the data structure yourself. ATSUGlyphGetCubicPaths and
 *    ATSUGlyphGetQuadraticPaths will parse the glyph data for you and
 *    use the callbacks you provide them to give you access to the
 *    individual points on the curves. Typically you use the function
 *    ATSUGlyphGetCurvePaths by calling it twice, as follows: (1) Pass
 *    a valid style and glyphID into the iATSUStyle and iGlyphID
 *    parameters, respectively, 0 for the ioBufferSize parameter, and
 *    NULL for the oPaths parameter. ATSUGlyphGetCurvePaths returns the
 *    size to use for the oPaths array in the ioBufferSize parameter.
 *    (2) Allocate enough space an array of the returned size, then
 *    call the ATSUGlyphGetCurvePaths again, passing a pointer to the
 *    array in the oPaths parameter. On return, the array contains the
 *    glyph outline data.
 *
 *  Parameters:
 *
 *    iATSUStyle:
 *      A style referring to a font you wish to obtain a set of glyph
 *      outlines from.
 *
 *    iGlyphID:
 *      A ID number referring to the glyph for which you wish to obtain
 *      outline data. Use the ATSUI direct access functions in
 *      ATSUnicodeDirectAccess.h to obtain values to pass for this
 *      parameter.
 *
 *    ioBufferSize:
 *      On input, the size of the buffer you have allocated for the
 *      oPaths parameter. On return, the actual size of the data
 *      structure that has been copied into the oPaths parameter.
 *
 *    oPaths:
 *      On return, a data structure containing glyph outline
 *      information. See ATSTypes.h for a definition of this data
 *      structure. can be NULL
 *
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 9.1 and later
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function ATSUGlyphGetCurvePaths( iATSUStyle: ATSUStyle; iGlyphID: GlyphID; ioBufferSize: ByteCountPtr; oPaths: ATSUCurvePathsPtr ): OSStatus; external name '_ATSUGlyphGetCurvePaths';


{ Functions listed beyond this point are either deprecated or not recommended }

{ ---------------------------------------------------------------------------- }
{ ATSUI glyphInfo access (deprecated)                                          }
{ ---------------------------------------------------------------------------- }
{
 *  ATSUGetGlyphInfo()
 *
 *  Summary:
 *    Obtains a copy of the style and layout information for each glyph
 *    in a line.
 *
 *  Discussion:
 *    Please see ATSUnicodeDirectAccess.h for replacement functions.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 9.1 and later
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function ATSUGetGlyphInfo( iTextLayout: ATSUTextLayout; iLineStart: UniCharArrayOffset; iLineLength: UniCharCount; ioBufferSize: ByteCountPtr; oGlyphInfoPtr: ATSUGlyphInfoArrayPtr ): OSStatus; external name '_ATSUGetGlyphInfo';


{
 *  ATSUDrawGlyphInfo()
 *
 *  Summary:
 *    Draws glyphs at the specified location, based on style and layout
 *    information specified for each glyph.
 *
 *  Discussion:
 *    Please see ATSUnicodeDirectAccess.h for replacement functions.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 9.1 and later
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function ATSUDrawGlyphInfo( iGlyphInfoArray: ATSUGlyphInfoArrayPtr; iLocation: Float32Point ): OSStatus; external name '_ATSUDrawGlyphInfo';
{unit ATSUnicodeObjects}
{$ALIGN MAC68K}







{ ---------------------------------------------------------------------------- }
{  ATSUI basic style functions                                                 }
{ ---------------------------------------------------------------------------- }

{
 *  ATSUCreateStyle()
 *
 *  Summary:
 *    Creates an ATSUStyle object with default settings.
 *
 *  Discussion:
 *    ATSUStyle objects created by this function have a default set of
 *    values for all attributes. The attributes include settings such
 *    as font, point size, color and so on. You can change the
 *    attributes of a style object by calling the function
 *    ATSUSetAttributes. You can also change font features and
 *    variations set in an ATSUStyle by calling the functions
 *    ATSUSetFontFeatures and ATSUSetVariations, respectively.
 *    ATSUStyle objects are used by associating them with a run of
 *    characters in an ATSUTextLayout object. You can do this by
 *    calling functions such as ATSUSetRunStyle or
 *    ATSUCreateTextLayoutWithTextPtr. You are responsible for freeing
 *    memory assoicated with an ATSUStyle object by calling
 *    ATSUDisposeStyle.
 *
 *  Parameters:
 *
 *    oStyle:
 *      On return, a reference to an ATSUStyle object with default
 *      settings.
 *
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function ATSUCreateStyle( var oStyle: ATSUStyle ): OSStatus; external name '_ATSUCreateStyle';


{
 *  ATSUCreateAndCopyStyle()
 *
 *  Summary:
 *    Creates a new ATSUStyle object with the same attributes, font
 *    features, and font variation settings as the input style.
 *
 *  Discussion:
 *    All attributes, font features, and font variation settings of the
 *    input ATSUStyle object are copied over to a newly created
 *    ATSUStyle object. Note that reference constants are not copied.
 *    You are responsible for freeing memory assoicated with the
 *    returned ATSUStyle object by calling ATSUDisposeStyle.
 *
 *  Parameters:
 *
 *    iStyle:
 *      The ATSUStyle object you want to copy.
 *
 *    oStyle:
 *      On return, a newly created ATSUStyle object. This will be an
 *      exact copy of iStyle, except for the reference constant (if
 *      set).
 *
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function ATSUCreateAndCopyStyle( iStyle: ATSUStyle; var oStyle: ATSUStyle ): OSStatus; external name '_ATSUCreateAndCopyStyle';


{
 *  ATSUDisposeStyle()
 *
 *  Summary:
 *    Disposes of the memory associated with a style object.
 *
 *  Discussion:
 *    The ATSUDisposeStyle function frees the memory associated with
 *    the specified style object and its internal structures, including
 *    style run attributes. It does not dispose of the memory pointed
 *    to by application-defined style run attributes or reference
 *    constants. You are responsible for doing so. You should call this
 *    function after calling the function ATSUDisposeTextLayout to
 *    dispose of any text layout objects associated with the style
 *    object. For best performance, once you create a style object, you
 *    should keep it and use it as often as needed. You should dispose
 *    of the style object only when it is no longer needed in your
 *    application.
 *
 *  Parameters:
 *
 *    iStyle:
 *      The style you want to dispose of.
 *
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function ATSUDisposeStyle( iStyle: ATSUStyle ): OSStatus; external name '_ATSUDisposeStyle';


{
 *  ATSUSetStyleRefCon()
 *
 *  Summary:
 *    Sets a reference constant for an ATSUStyle object.
 *
 *  Discussion:
 *    Reference constants are any 32-bit value you wish to associate
 *    with an object. It can be a pointer to application-specific data,
 *    a SInt16 value, or anything you like. If you copy or clear a
 *    style object that contains a reference constant, the reference
 *    constant is neither copied nor removed. To obtain the reference
 *    constant for a particular ATSUStyle object after it has been set,
 *    use the function ATSUGetStyleRefCon.
 *
 *  Parameters:
 *
 *    iStyle:
 *      An ATSUStyle object you want to set the reference constant for.
 *
 *    iRefCon:
 *      Any arbitrary 32-bit value containing or referring to
 *      application-specific data.
 *
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function ATSUSetStyleRefCon( iStyle: ATSUStyle; iRefCon: UInt32 ): OSStatus; external name '_ATSUSetStyleRefCon';


{
 *  ATSUGetStyleRefCon()
 *
 *  Summary:
 *    Returns the reference constant for an ATSUStyle object.
 *
 *  Discussion:
 *    Together with ATSUSetStyleRefCon, this function provides a
 *    mechanism for keeping application-specific data associated with
 *    ATSUStyle objects. Note that if an ATSUStyle object is copied or
 *    cleared, its associated reference constant, if any, is not copied
 *    or cleared.
 *
 *  Parameters:
 *
 *    iStyle:
 *      The style object for which to obtain application-specific data.
 *
 *    oRefCon:
 *      On return, the reference constant for iStyle.
 *
 *  Result:
 *    On success, noErr is returned. If no reference constant is set in
 *    iStyle, paramErr is returned. See MacErrors.h for other possible
 *    error codes.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function ATSUGetStyleRefCon( iStyle: ATSUStyle; var oRefCon: UInt32 ): OSStatus; external name '_ATSUGetStyleRefCon';


{ ---------------------------------------------------------------------------- }
{  ATSUI style comparison                                                      }
{ ---------------------------------------------------------------------------- }
{
 *  ATSUCompareStyles()
 *
 *  Summary:
 *    Compares two ATSUStyleObjects.
 *
 *  Discussion:
 *    The ATSUCompareStyles function compares the contents of two style
 *    objects, including their style attributes, font features, and
 *    font variations. It does not consider reference constants or
 *    application-defined style attributes in the comparison. Note that
 *    order is important, as the ATSUStyleComparison constants that can
 *    be returned indicate "contains" vs. "contained by" based on which
 *    style is considered first in the comparsion.
 *
 *  Parameters:
 *
 *    iFirstStyle:
 *      The first style to be compared.
 *
 *    iSecondStyle:
 *      The second style to be compared.
 *
 *    oComparison:
 *      On return, the value contains the results of the comparison and
 *      indicates whether the two style objects are the same,
 *      different, or if one is a subset of the other. See the
 *      definition of the ATSUStyleComparison type for more information
 *      on possible values returned for this parameter.
 *
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function ATSUCompareStyles( iFirstStyle: ATSUStyle; iSecondStyle: ATSUStyle; var oComparison: ATSUStyleComparison ): OSStatus; external name '_ATSUCompareStyles';


{ ---------------------------------------------------------------------------- }
{  ATSUI style attribute manipulation                                          }
{ ---------------------------------------------------------------------------- }
{
 *  ATSUCopyAttributes()
 *
 *  Summary:
 *    Copies attributes from one style to another.
 *
 *  Discussion:
 *    There are three types of settings in a style: attributes, font
 *    features, and font variations. This function copies only the
 *    first. To copy all three types of settings, use the function
 *    ATSUCreateAndCopyStyle. Also note that this function does not
 *    copy reference constants.
 *
 *  Parameters:
 *
 *    iSourceStyle:
 *      The style whose attributes you are copying from.
 *
 *    iDestinationStyle:
 *      The style whose attributes you are copying to.
 *
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function ATSUCopyAttributes( iSourceStyle: ATSUStyle; iDestinationStyle: ATSUStyle ): OSStatus; external name '_ATSUCopyAttributes';


{
 *  ATSUOverwriteAttributes()
 *
 *  Summary:
 *    Copies to a destination style object the nondefault style
 *    attribute settings of a source style object.
 *
 *  Discussion:
 *    The ATSUOverwriteAttributes function copies all nondefault style
 *    attribute values from a source style object to a destination
 *    style object. The source object's nondefault values are applied
 *    to the destination object whether or not the destination object
 *    also has nondefault values for the copied attributes. All other
 *    settings in the destination style object are left unchanged.
 *    ATSUOverwriteAttributes does not copy the contents of memory
 *    referenced by pointers within custom style attributes or within
 *    reference constants. You are responsible for ensuring that this
 *    memory remains valid until both the source and destination style
 *    objects are disposed of. To create a style object that contains
 *    all the contents of another style object, call the function
 *    ATSUCreateAndCopyStyle. To copy all the style attributes
 *    (including any default settings) of a style object into an
 *    existing style object, call the function ATSUCopyAttributes. To
 *    copy style attributes that are set in the source but not in the
 *    destination style object, call the function
 *    ATSUUnderwriteAttributes.
 *
 *  Parameters:
 *
 *    iSourceStyle:
 *      An ATSUStyle value specifying the style object from which to
 *      copy nondefault style attributes.
 *
 *    iDestinationStyle:
 *      An ATSUStyle value specifying the style object containing the
 *      style attributes to be overwritten.
 *
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function ATSUOverwriteAttributes( iSourceStyle: ATSUStyle; iDestinationStyle: ATSUStyle ): OSStatus; external name '_ATSUOverwriteAttributes';


{
 *  ATSUUnderwriteAttributes()
 *
 *  Summary:
 *    Copies to a destination style object only those nondefault style
 *    attribute settings of a source style object that are at default
 *    settings in the destination object.
 *
 *  Discussion:
 *    The ATSUUnderwriteAttributes function copies to a destination
 *    style object only those nondefault style attribute values of a
 *    source style object that are not currently set in a destination
 *    style object. Note that the corresponding value in the
 *    destination object must not be set in order for a copied value to
 *    be applied. All other quantities in the destination style object
 *    are left unchanged. ATSUUnderwriteAttributes does not copy the
 *    contents of memory referenced by pointers within custom style
 *    attributes or within reference constants. You are responsible for
 *    ensuring that this memory remains valid until both the source and
 *    destination style objects are disposed of. To create a style
 *    object that contains all the contents of another style object,
 *    call the function ATSUCreateAndCopyStyle. To copy all the style
 *    attributes (including any default settings) of a style object
 *    into an existing style object, call the function
 *    ATSUCopyAttributes. To copy style attributes that are set in the
 *    source whether or not they are set in the destination style
 *    object, call the function ATSUOverwriteAttributes.
 *
 *  Parameters:
 *
 *    iSourceStyle:
 *      An ATSUStyle value specifying the style object from which to
 *      copy nondefault style attributes.
 *
 *    iDestinationStyle:
 *      An ATSUStyle value specifying the style object containing style
 *      attribute values to be set.
 *
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function ATSUUnderwriteAttributes( iSourceStyle: ATSUStyle; iDestinationStyle: ATSUStyle ): OSStatus; external name '_ATSUUnderwriteAttributes';


{ ---------------------------------------------------------------------------- }
{  Empty ATSUI styles                                                          }
{ ---------------------------------------------------------------------------- }
{
 *  ATSUClearStyle()
 *
 *  Summary:
 *    Restores default values to a style object.
 *
 *  Discussion:
 *    Clears a style object of all style attributes (including any
 *    application-defined attributes), font features, and font
 *    variations and returns these values to their default settings. To
 *    clear attributes, font features, or font variations individually,
 *    use the functions ATSUClearAttributes, ATSUClearFontVariations,
 *    or ATSUClearFontFeatures, respectively. Note that ATSUClearStyle
 *    does not affect Reference constants.
 *
 *  Parameters:
 *
 *    iStyle:
 *      The style to be cleared.
 *
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function ATSUClearStyle( iStyle: ATSUStyle ): OSStatus; external name '_ATSUClearStyle';


{
 *  ATSUStyleIsEmpty()
 *
 *  Summary:
 *    Indicates whether a style object contains only default values.
 *
 *  Discussion:
 *    You can call the ATSUStyleIsEmpty function to determine whether a
 *    style object contains only default values for style attributes,
 *    font features, and font variations. ATSUStyleIsEmpty does not
 *    consider reference constants in its evaluation.
 *
 *  Parameters:
 *
 *    iStyle:
 *      An ATSUStyle value specifying the style object to examine.
 *
 *    oIsClear:
 *      On return, the value is set to true if the style object
 *      contains only default values for style attributes, font
 *      features, and font variations. If false , the style object
 *      contains one or more nondefault values for style attributes,
 *      font features, or font variations. Reference constants do not
 *      affect this result.
 *
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function ATSUStyleIsEmpty( iStyle: ATSUStyle; var oIsClear: Boolean ): OSStatus; external name '_ATSUStyleIsEmpty';


{ ---------------------------------------------------------------------------- }
{  ATSUI style attribute getters and setters                                   }
{ ---------------------------------------------------------------------------- }
{
 *  ATSUCalculateBaselineDeltas()
 *
 *  Summary:
 *    Obtains the optimal baseline positions for glyphs in a style run.
 *
 *  Discussion:
 *    Depending on the writing system, a baseline may be above, below,
 *    or through the centers of glyphs. In general, a style run has a
 *    default baseline, to which all glyphs are visually aligned when
 *    the text is laid out. For example, in a run of Roman text, the
 *    default baseline is the Roman baseline, upon which glyphs sit
 *    (except for descenders, which extend below the baseline). You can
 *    call the ATSUCalculateBaselineDeltas function to obtain the
 *    distances from a specified baseline type to that of other
 *    baseline types for a given style object.
 *    ATSUCalculateBaselineDeltas takes into account font and text size
 *    when performing these calculations. ATSUI uses these distances to
 *    determine the cross-stream shifting to apply when aligning glyphs
 *    in a style run. You can use the resulting array to set or obtain
 *    the optimal baseline positions of glyphs in a style run. You can
 *    also set various baseline values to create special effects such
 *    as drop capitals. The functions ATSUSetLineControls and
 *    ATSUSetLayoutControls allow you to set baseline offset values at
 *    the line or layout level, respectively, using the
 *    kATSULineBaselineValuesTag control attribute tag.
 *
 *  Parameters:
 *
 *    iStyle:
 *      An ATSUStyle value specifying the style object to examine.
 *
 *    iBaselineClass:
 *      A BslnBaselineClass constant identifying the primary baseline
 *      from which to measure other baselines. See SFNTLayoutTypes.h
 *      for an enumeration of possible values. Pass the constant
 *      kBSLNNoBaselineOverride to use the standard baseline value from
 *      the current font.
 *
 *    oBaselineDeltas:
 *      On return, an array that contains baseline offsets, specifying
 *      distances measured in points, from the default baseline to each
 *      of the other baseline types in the style object. Positive
 *      values indicate baselines above the default baseline and
 *      negative values indicate baselines below it. See
 *      SFNTLayoutTypes.h for a description of the BslnBaselineRecord
 *      type.
 *
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function ATSUCalculateBaselineDeltas( iStyle: ATSUStyle; iBaselineClass: BslnBaselineClass; oBaselineDeltas: BslnBaselineRecord ): OSStatus; external name '_ATSUCalculateBaselineDeltas';


{
 *  ATSUSetAttributes()
 *
 *  Summary:
 *    Sets style attribute values in a style object.
 *
 *  Discussion:
 *    Style attributes are a collection of values and settings that
 *    specify information about a style such as font, point size, and
 *    color. To specify a style attribute, ATSUI uses a "triple"
 *    consisting of (1) an attribute tag, (2) a value for that tag, and
 *    (3) the size of the value. For a list of possible tags and their
 *    default values, see the ATSUI documentation, or the definition of
 *    ATSUAttributeTag elsewhere in this header file. When you call
 *    ATSUSetAttributes, any style attributes that you do not set
 *    retain their previous values. To set font features and font
 *    variations, call the functions ATSUSetFontFeatures and
 *    ATSUSetVariations, respectively.
 *
 *  Parameters:
 *
 *    iStyle:
 *      A style in which to set attributes.
 *
 *    iAttributeCount:
 *      An ItemCount value specifying the number of attributes to set.
 *      This value should correspond to the number of elements in the
 *      iTag, iValueSize, and iValue arrays.
 *
 *    iTag:
 *      An array of attribute tags. The number of elements in this
 *      array must not be less than iAttributeCount. Each element in
 *      the array must contain a valid style attribute tag (see the
 *      definition of ATSUAttributeTag for possible values).
 *
 *    iValueSize:
 *      An array of ByteCount values. The number of elements in this
 *      array must not be less than iAttributeCount. Each ByteCount
 *      value corresoponds to the size of an element referred to by a
 *      pointer in the iValue array.
 *
 *    iValue:
 *      An array of pointers of type ATSUAttributeValuePtr. Each
 *      pointer referrs to a value that corresponds to a tag specified
 *      by the iTag array. The size of the data referred to is
 *      determined by a corresponding element in the iValueSize array.
 *      The number of elements in this array must not be less than
 *      iAttributeCount.
 *
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function ATSUSetAttributes( iStyle: ATSUStyle; iAttributeCount: ItemCount; iTag: ATSUAttributeTagPtr; iValueSize: ByteCountPtr; iValue: ATSUAttributeValuePtrPtr ): OSStatus; external name '_ATSUSetAttributes';


{
 *  ATSUGetAttribute()
 *
 *  Summary:
 *    Obtains a single attribute value for a style object.
 *
 *  Discussion:
 *    The ATSUGetAttribute function obtains the value of a specified
 *    style attribute for a given style object. Before calling
 *    ATSUGetAttribute, you should call the function
 *    ATSUGetAllAttributes to obtain an array of nondefault style
 *    attribute tags and value sizes for the style object. You can then
 *    pass ATSUGetAttribute the tag and value size for the attribute
 *    value to obtain. This function may return kATSUNotSetErr for some
 *    attributes that have not been set to a non-default via a call to
 *    ATSUSetAttributes.
 *
 *  Parameters:
 *
 *    iStyle:
 *      The style object you with to retrieve an attribute value from.
 *
 *    iTag:
 *      The tag you wish to obtain the value of.
 *
 *    iExpectedValueSize:
 *      The size of the buffer pointed to by oValue.
 *
 *    oValue:
 *      On input, a buffer you have allocated to retain the value of
 *      the specified attribute. On return, the value of the requested
 *      attribute will be placed here. You may pass NULL for this
 *      parameter. can be NULL
 *
 *    oActualValueSize:
 *      On return, the actual number of bytes written to oValue is
 *      placed here. You may pass NULL for this parameter. can be NULL
 *
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function ATSUGetAttribute( iStyle: ATSUStyle; iTag: ATSUAttributeTag; iExpectedValueSize: ByteCount; oValue: ATSUAttributeValuePtr; oActualValueSize: ByteCountPtr ): OSStatus; external name '_ATSUGetAttribute';


{
 *  ATSUGetAllAttributes()
 *
 *  Summary:
 *    Obtains an array of style attribute tags and value sizes for a
 *    style object.
 *
 *  Discussion:
 *    This function returns information as to which attributes have had
 *    non-default values set in a particular ATSUStyle object. It will
 *    also return the size in bytes of the values of these attributes.
 *    Using this information, you can then call ATSUGetAttribute to
 *    obtain the value of a given attribute. Typically you use the
 *    function ATSUGetAllAttributes by calling it twice, as follows:
 *    (1) Pass a reference to the style object to examine in the iStyle
 *    parameter, a valid pointer to an ItemCount value in the
 *    oTagValuePairCount parameter, NULL for the oAttributeInfoArray
 *    parameter, and 0 for the iTagValuePairArraySize parameter.
 *    ATSUGetAllAttributes returns the size of the tag and value-size
 *    arrays in the oTagValuePairCount parameter. (2) Allocate enough
 *    space for an array of the returned size, then call the
 *    ATSUGetAllAttributes function again, passing a valid pointer in
 *    the oAttributeInfoArray parameter. On return, the pointer refers
 *    to an array of the style attribute tag and value-size pairs
 *    contained in the style object.
 *
 *  Parameters:
 *
 *    iStyle:
 *      The style object you wish to retrieve a list of attribute tags
 *      from.
 *
 *    oAttributeInfoArray:
 *      On return, an array of ATSUAttributeInfo structures. Each
 *      structure contains information about an attribute in iStyle
 *      that has a non-default value. You must allocate space for this
 *      array. If you are unsure how much space to allocate, you may
 *      pass NULL for this parameter and use the oTagValuePairCount
 *      parameter to determine how much space to allocate. can be NULL
 *
 *    iTagValuePairArraySize:
 *      The size of the array you allocated and are passing in for the
 *      oAttributeInfoArray parameter.
 *
 *    oTagValuePairCount:
 *      On return, the number of attributes whose information was
 *      stored in the oAttributeInfoArray parameter. can be NULL
 *
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function ATSUGetAllAttributes( iStyle: ATSUStyle; oAttributeInfoArray: ATSUAttributeInfoPtr; iTagValuePairArraySize: ItemCount; oTagValuePairCount: ItemCountPtr ): OSStatus; external name '_ATSUGetAllAttributes';


{
 *  ATSUClearAttributes()
 *
 *  Summary:
 *    Restores default values to the specified style attributes of a
 *    style object.
 *
 *  Discussion:
 *    Removes those style attribute values identified by the tag
 *    constants in the iTag array and replaces them with the default
 *    values. For a list of possible tags and their default values, see
 *    the ATSUI documentation, or the definition of ATSUAttributeTag
 *    elsewhere in this header file. If you specify that any currently
 *    unset attribute values be removed, ATSUClearAttributes does not
 *    return an error. Note this function only deals with attributes.
 *    To remove all previously set style attributes as well as font
 *    features and font variations from a style object, call the
 *    function ATSUClearStyle.
 *
 *  Parameters:
 *
 *    iStyle:
 *      A style whose attributes you want to clear.
 *
 *    iTagCount:
 *      The number of tags you are passing in via the iTag parameter.
 *      Pass kATSUClearAll to clear all attributes.
 *
 *    iTag:
 *      An array of ATSUAttributeTag indicating which attributes to
 *      clear. You may pass NULL for this parameter if you are passing
 *      kATSUClearAll for the iTagCount parameter. can be NULL
 *
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function ATSUClearAttributes( iStyle: ATSUStyle; iTagCount: ItemCount; iTag: ATSUAttributeTagPtr ): OSStatus; external name '_ATSUClearAttributes';


{ ---------------------------------------------------------------------------- }
{  ATSUI basic text layout functions                                           }
{ ---------------------------------------------------------------------------- }
{
 *  ATSUCreateTextLayout()
 *
 *  Summary:
 *    Creates an opaque text layout object containing only default text
 *    layout attributes.
 *
 *  Discussion:
 *    This function creates a empty text layout object that has no
 *    styles or text buffer associated with it. Most ATSUI functions
 *    that operate on text layout objects require that the objects be
 *    associated with style information and text. To associate style
 *    objects and text with an empty text layout object, you can call
 *    the functions ATSUSetRunStyle and ATSUSetTextPointerLocation .
 *    Or, to create a text layout object and associate style objects
 *    and text with it at the same time, you can call the function
 *    ATSUCreateTextLayoutWithTextPtr. To provide nondefault line or
 *    layout attributes for a text layout object, you can call the
 *    functions ATSUSetLineControls or ATSUSetLayoutControls . After
 *    setting text attributes, call ATSUDrawText to draw the text. Text
 *    layout objects are readily reusable and should be cached for
 *    later use, if possible. You can reuse a text layout object even
 *    if the text associated with it is altered. Call the functions
 *    ATSUSetTextPointerLocation, ATSUTextDeleted, or ATSUTextInserted
 *    to manage the altered text.
 *
 *  Parameters:
 *
 *    oTextLayout:
 *      On return, the value refers to an empty text layout object.
 *
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function ATSUCreateTextLayout( var oTextLayout: ATSUTextLayout ): OSStatus; external name '_ATSUCreateTextLayout';


{
 *  ATSUCreateAndCopyTextLayout()
 *
 *  Summary:
 *    Creates a copy of a text layout object.
 *
 *  Discussion:
 *    This function creates a copy of the source text layout object's
 *    style runs (including references to the associated text buffer
 *    and style objects), line attributes, layout attributes, and
 *    layout caches. ATSUCreateAndCopyTextLayout does not copy
 *    reference constants. To create a text layout object without
 *    copying a source object, you can the function
 *    ATSUCreateTextLayout or the function
 *    ATSUCreateTextLayoutWithTextPtr.
 *
 *  Parameters:
 *
 *    iTextLayout:
 *      The layout to be copied.
 *
 *    oTextLayout:
 *      On return, a reference to a layout object which is a copy of
 *      iTextLayout.
 *
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.6 and later
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function ATSUCreateAndCopyTextLayout( iTextLayout: ATSUTextLayout; var oTextLayout: ATSUTextLayout ): OSStatus; external name '_ATSUCreateAndCopyTextLayout';


{
 *  ATSUCreateTextLayoutWithTextPtr()
 *
 *  Summary:
 *    Creates an opaque text layout object containing default text
 *    layout attributes as well as associated text and text styles.
 *
 *  Discussion:
 *    This function creates a text layout object and associates the
 *    specified text buffer and style runs with it. All layout
 *    attributes are set to their default values. To provide nondefault
 *    line or layout attributes for a text layout object, you can call
 *    the functions ATSUSetLineControls or ATSUSetLayoutControls. After
 *    setting text attributes, call ATSUDrawText to draw the text.
 *    Because the only way that ATSUI interacts with text is via the
 *    memory references you associate with a text layout object, you
 *    are responsible for keeping these references updated through use
 *    of the functions ATSUTextInserted, ATSUTextDeleted,
 *    ATSUTextMoved, and ATSUSetTextPointerLocation. Note that, because
 *    ATSUI objects retain state information, doing superfluous calling
 *    can degrade performance. For example, you could call
 *    ATSUSetTextPointerLocation rather than ATSUTextInserted when the
 *    user inserts text, but there would be a performance penalty, as
 *    all the layout caches are flushed when you call
 *    ATSUSetTextPointerLocation , rather than just the affected ones.
 *    Text layout objects are readily reusable and should themselves be
 *    cached for later use, if possible. Text objects are thread-safe
 *    starting with ATSUI version 2.4.
 *
 *  Parameters:
 *
 *    iText:
 *      A text buffer containing UTF-16Ðencoded text. ATSUI associates
 *      this buffer with the new text layout object and analyzes the
 *      complete text of the buffer when obtaining the layout context
 *      for the current text range. Thus, for paragraph-format text, if
 *      you specify a buffer containing less than a complete paragraph,
 *      some of ATSUI's layout results are not guaranteed to be
 *      accurate. For example, with a buffer of less than a full
 *      paragraph, ATSUI can neither reliably obtain the context for
 *      bidirectional processing nor reliably generate accent
 *      attachments and ligature formations for Roman text.
 *
 *    iTextOffset:
 *      The offset from the beginning of the text buffer to the first
 *      character of the range to include in the layout. To indicate
 *      that the specified text range starts at the beginning of the
 *      text buffer, you can pass the constant kATSUFromTextBeginning.
 *      To specify the entire text buffer, pass kATSUFromTextBeginning
 *      in this parameter and kATSUToTextEnd in the iTextLength
 *      parameter. For best results, use one layout for each paragraph
 *      within the text buffer.
 *
 *    iTextLength:
 *      The length of the text range. Note that the sum of iTextOffset
 *      and iTextLength must be less than or equal to the value of the
 *      iTextTotalLength parameter. If you want the range of text to
 *      extend to the end of the text buffer, you can pass the constant
 *      kATSUToTextEnd. For best results, use one layout for each
 *      paragraph within the text buffer.
 *
 *    iTextTotalLength:
 *      The length of the entire text buffer referred to by iText. This
 *      value should be greater than or equal to the range of text
 *      defined by the iTextLength parameter.
 *
 *    iNumberOfRuns:
 *      The number of text style runs you want to define within the
 *      overall text range. The number of style objects and style run
 *      lengths passed in the iStyles and iRunLengths parameters,
 *      respectively, should be equal to the number of runs specified
 *      here.
 *
 *    iRunLengths:
 *      An array providing ATSUI with the lengths of each of the text's
 *      style runs. You can pass kATSUToTextEnd for the last style run
 *      length if you want the style run to extend to the end of the
 *      text range. If the sum of the style run lengths is less than
 *      the total length of the text range, the remaining characters
 *      are assigned to the last style run.
 *
 *    iStyles:
 *      An array of styles, each corresponding to a style run defined
 *      in iRunLengths. The same ATSUStyle object may be referred to
 *      more than once in this array. The number of elements in this
 *      array must be equal to the value specified by the iNumberOfRuns
 *      parameter.
 *
 *    oTextLayout:
 *      A valid pointer to an ATSUTextLayout value. On return, the
 *      value refers to the newly created text layout object.
 *
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function ATSUCreateTextLayoutWithTextPtr( iText: ConstUniCharArrayPtr; iTextOffset: UniCharArrayOffset; iTextLength: UniCharCount; iTextTotalLength: UniCharCount; iNumberOfRuns: ItemCount; iRunLengths: UniCharCountPtr; iStyles: ATSUStylePtr; var oTextLayout: ATSUTextLayout ): OSStatus; external name '_ATSUCreateTextLayoutWithTextPtr';


{
 *  ATSUClearLayoutCache()
 *
 *  Summary:
 *    Clears the layout cache of a line or an entire text layout object.
 *
 *  Discussion:
 *    The layout cache contains all the layout information ATSUI
 *    calculates and needs to draw a range of text in a text layout
 *    object. This includes caret positions, the memory locations of
 *    glyphs, and other information needed to lay out the glyphs. ATSUI
 *    uses information in the layout cache to avoid laying out the text
 *    again, thereby improving performance. When you clear the layout
 *    cache of a line or block of text, ATSUI takes longer to redraw a
 *    line, since it must perform the calculations that support glyph
 *    layout again. You should call the function ATSUClearLayoutCache
 *    when you need to decrease the amount of memory your application
 *    uses. This function reclaims memory at the cost of optimal
 *    performance. By default, the ATSUClearLayoutCache function
 *    removes the layout cache of a single line. To clear the layout
 *    cache for multiple lines, you should call ATSUClearLayoutCache
 *    for each line. To clear the layout cache of an entire text layout
 *    object, pass the constant kATSUFromTextBeginning in the
 *    iLineStart parameter. Note that ATSUClearLayoutCache does not
 *    produce a function error if lines do not have a layout cache. The
 *    ATSUClearLayoutCache function flushes the layout cache but does
 *    not alter previously set text layout attributes, soft line break
 *    positions, or the text memory location. If you do not want to
 *    retain these values, you should dispose of the text layout object
 *    by calling the ATSUDisposeTextLayout function.
 *
 *  Parameters:
 *
 *    iTextLayout:
 *      The layout for which to clear the layout caches.
 *
 *    iLineStart:
 *      The offset from the beginning of the text buffer to the
 *      beginning of the line for which to discard the layout cache. If
 *      the range of text spans multiple lines, you should call
 *      ATSUClearLayoutCache for each line, passing the offset
 *      corresponding to the beginning of the new line to draw with
 *      each call. To clear the layout cache of the entire text layout
 *      object, you can pass the constant kATSUFromTextBeginning.
 *
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.6 and later
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function ATSUClearLayoutCache( iTextLayout: ATSUTextLayout; iLineStart: UniCharArrayOffset ): OSStatus; external name '_ATSUClearLayoutCache';


{
 *  ATSUDisposeTextLayout()
 *
 *  Summary:
 *    Disposes of the memory associated with a text layout object.
 *
 *  Discussion:
 *    This function frees the memory associated with the specified text
 *    layout object and its internal structures, including line and
 *    layout control attributes, style runs, and soft line breaks.
 *    ATSUDisposeTextLayout does not dispose of any memory that may be
 *    allocated for the text buffer, style objects, or reference
 *    constants associated with the text layout object. You are
 *    responsible for doing so. For best performance, text layout
 *    objects are readily reusable and should be cached for later use,
 *    if possible. You can reuse a text layout object even if the text
 *    associated with it is altered. Call the functions
 *    ATSUSetTextPointerLocation, ATSUTextDeleted, or ATSUTextInserted
 *    to manage the altered text, rather than disposing of the text
 *    layout object and creating a new one.
 *
 *  Parameters:
 *
 *    iTextLayout:
 *      The layout object to dispose of.
 *
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function ATSUDisposeTextLayout( iTextLayout: ATSUTextLayout ): OSStatus; external name '_ATSUDisposeTextLayout';


{
 *  ATSUSetTextLayoutRefCon()
 *
 *  Summary:
 *    Sets application-specific data for a text layout object.
 *
 *  Discussion:
 *    This function associates a reference constant (that is,
 *    application-specific data) with a text layout object. You might
 *    typically use ATSUSetTextLayoutRefCon to track user preferences
 *    that can effect layout, for example. If you copy or clear a text
 *    layout object containing a reference constant, the reference
 *    constant is not copied or removed. When you dispose of a text
 *    layout object that contains a reference constant, you are
 *    responsible for freeing any memory allocated for the reference
 *    constant. Calling the function ATSUDisposeTextLayout does not do
 *    so.
 *
 *  Parameters:
 *
 *    iTextLayout:
 *      A layout for which you wish to set a reference constant.
 *
 *    iRefCon:
 *      Any arbitrary 32-bit value you wish to store in association
 *      with iTextLayout.
 *
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function ATSUSetTextLayoutRefCon( iTextLayout: ATSUTextLayout; iRefCon: UInt32 ): OSStatus; external name '_ATSUSetTextLayoutRefCon';


{
 *  ATSUGetTextLayoutRefCon()
 *
 *  Summary:
 *    Obtains application-specific data for a text layout object.
 *
 *  Discussion:
 *    This function obtains a reference constant (that is,
 *    application-specific data) associated with a text layout object.
 *    To associate a reference constant with a text layout object, call
 *    the function ATSUSetTextLayoutRefCon.
 *
 *  Parameters:
 *
 *    iTextLayout:
 *      A layout for which you wish to retreive the reference constant.
 *
 *    oRefCon:
 *      On return, the reference constant associated with iTextLayout.
 *
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function ATSUGetTextLayoutRefCon( iTextLayout: ATSUTextLayout; var oRefCon: UInt32 ): OSStatus; external name '_ATSUGetTextLayoutRefCon';


{ ---------------------------------------------------------------------------- }
{  ATSUI text buffer manipulation                                              }
{ ---------------------------------------------------------------------------- }
{
 *  ATSUSetTextPointerLocation()
 *
 *  Summary:
 *    Associates a text buffer with a text layout object or updates
 *    previously associated text.
 *
 *  Discussion:
 *    For ATSUI to render your text, you must associate the text with
 *    both a text layout object and style information. Some functions,
 *    such as ATSUCreateTextLayoutWithTextPtr, create a text layout
 *    object and associate text with it concurrently. However, if you
 *    use the function ATSUCreateTextLayout to create a text layout
 *    object, you must assign text to the object prior to attempting
 *    most ATSUI operations. You can use the function
 *    ATSUSetTextPointerLocation to associate text with a layout
 *    object. When you call this function, you are both assigning a
 *    text buffer to a text layout object and specifying the current
 *    text subrange within the buffer to include in the layout. If
 *    there is already text associated with a text layout object,
 *    calling ATSUSetTextPointerLocation overrides the previously
 *    associated text, as well as clearing the object's layout caches.
 *    You would typically only call this function for a text layout
 *    object with existing associated text if either (a) both the
 *    buffer itself is relocated and a subrange of the buffer's text is
 *    deleted or inserted or (b) when associating an entirely different
 *    buffer with a text layout object. Note that, because ATSUI
 *    objects retain state, doing superfluous calling can degrade
 *    performance. For example, you could call
 *    ATSUSetTextPointerLocation rather than ATSUTextInserted when the
 *    user simply inserts a subrange of text within a text buffer, but
 *    there would be a performance penalty, as all the layout caches
 *    are flushed by ATSUSetTextPointerLocation, rather than just the
 *    affected ones. Similarly, you should not call
 *    ATSUSetTextPointerLocation, when an entire text buffer associated
 *    with a text layout object is relocated, but no other changes have
 *    occurred that would affect the buffer's current subrange.
 *    Instead, you should call ATSUTextMoved, which is a more focused
 *    function and therefore more efficient. After associating text
 *    with a text layout object, use ATSUSetRunStyle to associate style
 *    information with the text. You can then call the function
 *    ATSUDrawText to display the text or a subrange of the text.
 *
 *  Parameters:
 *
 *    iTextLayout:
 *      The layout object for which you wish to associate a text buffer.
 *
 *    iText:
 *      A pointer to a buffer of Unicode text in UTF-16 format. This is
 *      the text that will be associated with iTextLayout.
 *
 *    iTextOffset:
 *      The starting offset of the subrange of the text buffer you wish
 *      to associate with iTextLayout. To indicate that the specified
 *      text range starts at the beginning of the text buffer, you can
 *      pass the constant kATSUFromTextBeginning . To specify the
 *      entire text buffer, pass kATSUFromTextBeginning in this
 *      parameter and kATSUToTextEnd in the iTextLength parameter.
 *
 *    iTextLength:
 *      The length of the subrage of the text buffer you wish to
 *      associate with iTextLayout. Note that the sum of iTextOffset
 *      and iTextLength must be less than or equal to the value of the
 *      iTextTotalLength parameter. If you want the range of text to
 *      extend to the end of the text buffer, you can pass the constant
 *      kATSUToTextEnd.
 *
 *    iTextTotalLength:
 *      The length of the entire text buffer. This value should be
 *      greater than or equal to the range of text defined by the
 *      iTextLength parameter.
 *
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function ATSUSetTextPointerLocation( iTextLayout: ATSUTextLayout; iText: ConstUniCharArrayPtr; iTextOffset: UniCharArrayOffset; iTextLength: UniCharCount; iTextTotalLength: UniCharCount ): OSStatus; external name '_ATSUSetTextPointerLocation';


{
 *  ATSUGetTextLocation()
 *
 *  Summary:
 *    Returns information about the Unicode text buffer associated with
 *    a layout.
 *
 *  Discussion:
 *    For a given layout, ATSUGetTextLocation will return information
 *    about the Unicode text buffer associated with it, including its
 *    memory location, its size, and whether it is stored in a handle.
 *    Note that since a layout may refer to a subrange within a text
 *    buffer, parameters defining this subrange are included. oOffset
 *    and oTextLength give information about the subrange, while oText
 *    and oTextTotalLength give information about the entire text
 *    buffer. You may pass NULL for any parameters you are not
 *    interested in. Only iTextLayout is required.
 *
 *  Parameters:
 *
 *    iTextLayout:
 *      A text layout whose text buffer you want information regarding.
 *
 *    oText:
 *      A pointer to data of any type. On return, the pointer is set to
 *      either a pointer or a handle that refers to the text buffer for
 *      the specified text layout object. can be NULL
 *
 *    oTextIsStoredInHandle:
 *      On return, the value is set to true if the text buffer referred
 *      to by the oText parameter is accessed by a handle; if false, a
 *      pointer. can be NULL
 *
 *    oOffset:
 *      On return, the offset from the beginning of the text buffer to
 *      the first character of the layout's current text range. can be NULL
 *
 *    oTextLength:
 *      On return, the value specifies the length of the layout's
 *      current text range. can be NULL
 *
 *    oTextTotalLength:
 *      On return, the total length of the text buffer. Note this is
 *      not necessarily the same as the length of the layout's current
 *      range. (A layout may refer to only a subrange within a text
 *      buffer.) can be NULL
 *
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function ATSUGetTextLocation( iTextLayout: ATSUTextLayout; oText: PtrPtr; oTextIsStoredInHandle: BooleanPtr; oOffset: UniCharArrayOffsetPtr; oTextLength: UniCharCountPtr; oTextTotalLength: UniCharCountPtr ): OSStatus; external name '_ATSUGetTextLocation';


{
 *  ATSUTextDeleted()
 *
 *  Summary:
 *    Informs ATSUI of the location and length of a text deletion.
 *
 *  Discussion:
 *    When you call the ATSUTextDeleted function to inform ATSUI of a
 *    text deletion, it shortens the style run(s) containing the
 *    deleted text by the amount of the deletion. If a style run
 *    corresponds entirely to a range of deleted text, that style run
 *    is removed. If the deletion point is between two style runs, the
 *    first style run is shortened (or removed). The ATSUTextDeleted
 *    function also shortens the total length of the text buffer
 *    containing the deleted text by the amount of the deletion. That
 *    is, it shifts the memory location of the text following the
 *    deleted text by iDeletedRangeLength .ATSUTextDeleted also removes
 *    any soft line breaks that fall within the deleted text and
 *    updates affected drawing caches. The ATSUTextDeleted function
 *    does not change the actual memory location of the affected text.
 *    You are responsible for deleting the corresponding text is from
 *    the text buffer. You are also responsible for calling the
 *    function ATSUDisposeStyle to dispose of the memory associated
 *    with any style runs that have been removed. Note that calling the
 *    function ATSUTextDeleted automatically removes previously-set
 *    soft line breaks if the line breaks are within the range of text
 *    that is deleted.
 *
 *  Parameters:
 *
 *    iTextLayout:
 *      The text layout containing the deleted text.
 *
 *    iDeletedRangeStart:
 *      The starting location of the deleted text. To specify a
 *      deletion point at the beginning of the text buffer, you can
 *      pass the constant kATSUFromTextBeginning. To specify that the
 *      entire text buffer has been deleted, pass
 *      kATSUFromTextBeginning in this parameter and kATSUToTextEnd in
 *      the iDeletedRangeLength parameter.
 *
 *    iDeletedRangeLength:
 *      The length of the deleted text. To specify a deletion length
 *      extending to the end of the text buffer, you can pass the
 *      constant kATSUToTextEnd.
 *
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function ATSUTextDeleted( iTextLayout: ATSUTextLayout; iDeletedRangeStart: UniCharArrayOffset; iDeletedRangeLength: UniCharCount ): OSStatus; external name '_ATSUTextDeleted';


{
 *  ATSUTextInserted()
 *
 *  Summary:
 *    Informs ATSUI of the location and length of a text insertion.
 *
 *  Discussion:
 *    When you call the ATSUTextInserted function to inform ATSUI of a
 *    text insertion, it extends the style run containing the insertion
 *    point by the amount of the inserted text. If the insertion point
 *    is between two style runs, the first style run is extended to
 *    include the new text. The ATSUTextInserted function also extends
 *    the total length of the text buffer containing the inserted text
 *    by the amount of the inserted text. That is, it shifts the memory
 *    location of the text following the inserted text by
 *    iInsertionLength. ATSUTextInserted then updates drawing caches.
 *    Note that the ATSUTextInserted function does not change the
 *    actual memory location of the inserted text. You are responsible
 *    for placing the inserted text into the text buffer at the
 *    appropriate location. The ATSUTextInserted function does not
 *    insert style runs or line breaks; to do so, call the functions
 *    ATSUSetRunStyle and ATSUSetSoftLineBreak, respectively. Break
 *    line operations should be redone after you call ATSUTextInserted.
 *
 *  Parameters:
 *
 *    iTextLayout:
 *      The text layout in which the text insertion is taking place.
 *
 *    iInsertionLocation:
 *      The offset corresponding to the beginning of the inserted text.
 *
 *    iInsertionLength:
 *      The length of the inserted text.
 *
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function ATSUTextInserted( iTextLayout: ATSUTextLayout; iInsertionLocation: UniCharArrayOffset; iInsertionLength: UniCharCount ): OSStatus; external name '_ATSUTextInserted';


{
 *  ATSUTextMoved()
 *
 *  Summary:
 *    Informs ATSUI of the new memory location of relocated text.
 *
 *  Discussion:
 *    You should call the ATSUTextMoved function when a range of text
 *    consisting of less than an entire text buffer has been moved. The
 *    ATSUTextMoved function informs ATSUI of the new memory location
 *    of the text. You are responsible for moving the text. The text
 *    buffer should remain otherwise unchanged.
 *
 *  Parameters:
 *
 *    iTextLayout:
 *      The text layout containing the moved text.
 *
 *    iNewLocation:
 *      The new memory location of the moved text.
 *
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function ATSUTextMoved( iTextLayout: ATSUTextLayout; iNewLocation: ConstUniCharArrayPtr ): OSStatus; external name '_ATSUTextMoved';


{ ---------------------------------------------------------------------------- }
{  ATSUI layout controls                                                       }
{ ---------------------------------------------------------------------------- }
{
 *  ATSUCopyLayoutControls()
 *
 *  Summary:
 *    Copies all layout control attribute settings from a source text
 *    layout object to a destination text layout object.
 *
 *  Discussion:
 *    This function copies all layout control attribute values to a
 *    destination text layout object from a source text layout object,
 *    including any default (unset) values in the source object. For a
 *    list of tags and their default values, see the definition of
 *    ATSUAttributeTag. Reference constants and the contents of memory
 *    referenced by pointers within custom layout attributes are not
 *    copied. You are responsible for ensuring that this memory remains
 *    valid until both the source and destination text layout objects
 *    are disposed. To copy line control attribute values from one text
 *    layout object to another, call the function ATSUCopyLineControls.
 *
 *  Parameters:
 *
 *    iSourceTextLayout:
 *      The text layout to copy layout controls from.
 *
 *    iDestTextLayout:
 *      The text layout to copy layout controls to.
 *
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function ATSUCopyLayoutControls( iSourceTextLayout: ATSUTextLayout; iDestTextLayout: ATSUTextLayout ): OSStatus; external name '_ATSUCopyLayoutControls';


{
 *  ATSUSetLayoutControls()
 *
 *  Summary:
 *    Sets layout control attribute values in a text layout object.
 *
 *  Discussion:
 *    When you use ATSUI to image your text, you can control the text's
 *    display and formatting at a number of different levels: layout,
 *    line, and run. The level affected by this function is the layout
 *    level, which is that of the entire text range associated with
 *    your text layout object. Attributes at this level affect the
 *    width of the text area from margin to margin, the alignment of
 *    the text, its justification, rotation, and direction, as well as
 *    other layout options. See ATSUSetLineControls for information
 *    about controling text and the line level. Similar to style
 *    attributes, you use a "triple" to specify a line or layout
 *    control attribute. That is, (1) an attribute tag, (2) the size
 *    (in bytes) of the attribute value, and (3) the value of the
 *    attribute it sets. Attribute tags are constants supplied by
 *    ATSUI. Attribute values may be a scalar, a structure, or a
 *    pointer. And as with style attributes, you can also create a
 *    custom attribute for a line or layout attribute for which ATSUI
 *    does not provide a tag. For a list of layout control tags defined
 *    by ATSUI and their default values, see the definition of
 *    ATSUAttributeTag.
 *
 *  Parameters:
 *
 *    iTextLayout:
 *      The text layout in which to set layout-level controls.
 *
 *    iAttributeCount:
 *      The number of attributes to set. This value should correspond
 *      to the number of elements in the iTag, iValueSize, and iValue
 *      arrays.
 *
 *    iTag:
 *      An array of attribute tags to set. For a list of layout control
 *      tags defined by ATSUI and their default values, see the
 *      definition of ATSUAttributeTag.
 *
 *    iValueSize:
 *      An array of values indicating the sizes of the values pointed
 *      to by the elements in the iValue array.
 *
 *    iValue:
 *      An array of attribute value pointers. Each value in the array
 *      must correspond to a tag in the iTag array and be a legal value
 *      for that tag.
 *
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function ATSUSetLayoutControls( iTextLayout: ATSUTextLayout; iAttributeCount: ItemCount; iTag: ATSUAttributeTagPtr; iValueSize: ByteCountPtr; iValue: ATSUAttributeValuePtrPtr ): OSStatus; external name '_ATSUSetLayoutControls';


{
 *  ATSUGetLayoutControl()
 *
 *  Summary:
 *    Obtains a single layout control attribute value for a text layout
 *    object.
 *
 *  Discussion:
 *    Before calling ATSUGetLayoutControl, you should call the function
 *    ATSUGetAllLayoutControls to obtain an array of nondefault layout
 *    control attribute tags and value sizes for the text layout
 *    object. You can then pass the tag and value size for the
 *    attribute value to obtain to ATSUGetLayoutControl. Typically you
 *    use the function ATSUGetLayoutControl by calling it twice, as
 *    follows: (1) Pass a reference to the text layout object to
 *    examine in the iTextLayout parameter, NULL for the oValue
 *    parameter, 0 for the iExpectedValueSize parameter.
 *    ATSUGetLayoutControl returns the actual size of the attribute
 *    value in the oActualValueSize parameter. (2) Allocate enough
 *    space for an array of the returned size, then call the
 *    ATSUGetLayoutControl function again, passing a valid pointer in
 *    the oValue parameter. On return, the pointer refers to the actual
 *    attribute value contained in the text layout object. For a list
 *    of layout control tags defined by ATSUI and their default values,
 *    see the definition of ATSUAttributeTag.
 *
 *  Parameters:
 *
 *    iTextLayout:
 *      The text layout for which you wish to obtain a single layout
 *      control value.
 *
 *    iTag:
 *      An attribute tag specifying the layout control value you wish
 *      to obtain. For a list of layout control tags defined by ATSUI
 *      and their default values, see the definition of
 *      ATSUAttributeTag.
 *
 *    iExpectedValueSize:
 *      The size in bytes of the buffer you have allocated for the
 *      oValue parameter.
 *
 *    oValue:
 *      On return, the value assocaited with the layout tag specified
 *      by the iTag parameter. can be NULL
 *
 *    oActualValueSize:
 *      On return, the value contains the actual size (in bytes) of the
 *      attribute value. You should examine this parameter if you are
 *      unsure of the size of the attribute value being obtained, as in
 *      the case of custom layout control attributes. can be NULL
 *
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function ATSUGetLayoutControl( iTextLayout: ATSUTextLayout; iTag: ATSUAttributeTag; iExpectedValueSize: ByteCount; oValue: ATSUAttributeValuePtr; oActualValueSize: ByteCountPtr ): OSStatus; external name '_ATSUGetLayoutControl';


{
 *  ATSUGetAllLayoutControls()
 *
 *  Summary:
 *    Obtains an array of non-default layout control attribute tags and
 *    value sizes for a text layout object.
 *
 *  Discussion:
 *    This function function obtains all nondefault layout control
 *    attribute tags and their values sizes for a text layout object.
 *    You can pass a tag and value size pair obtained from
 *    ATSUGetAllLayoutControls to the function ATSUGetLayoutControl to
 *    determine the corresponding attribute value. Typically you use
 *    the function ATSUGetAllLayoutControls by calling it twice, as
 *    follows: (1) Pass a reference to the text layout object to
 *    examine in the iTextLayout parameter, NULL for the
 *    oAttributeInfoArray parameter, a pointer to an ItemCount value in
 *    the oTagValuePairCount parameter, and 0 for the
 *    iTagValuePairArraySize parameter. ATSUGetAllLayoutControls
 *    returns the size of the tag and value size arrays in the
 *    oTagValuePairCount parameter. (2) Allocate enough space for an
 *    array of the returned size, then call the
 *    ATSUGetAllLayoutControls function again, passing a valid pointer
 *    in the oAttributeInfoArray parameter. On return, the pointer
 *    refers to an array of the layout control attribute tag and value
 *    size pairs contained in the text layout object.
 *
 *  Parameters:
 *
 *    iTextLayout:
 *      The layout for which you wish to obtain the set of non-default
 *      layout tags.
 *
 *    oAttributeInfoArray:
 *      On return, this array contains pairs of tags and value sizes
 *      for the object's layout control attributes that are not at
 *      default values. If you are uncertain of how much memory to
 *      allocate for this parameter, see the Discussion.
 *
 *    iTagValuePairArraySize:
 *      A value specifying the maximum number of tag and value size
 *      pairs to obtain for the text layout object. Typically, this is
 *      equivalent to the number of ATSUAttributeInfo structures for
 *      which you have allocated memory in the oAttributeInfoArray
 *      parameter. To determine this value, see the Discussion.
 *
 *    oTagValuePairCount:
 *      On return, the value specifies the actual number of
 *      ATSUAttributeInfo structures in the text layout object. This
 *      may be greater than the value you specified in the
 *      iTagValuePairArraySize parameter.
 *
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function ATSUGetAllLayoutControls( iTextLayout: ATSUTextLayout; oAttributeInfoArray: ATSUAttributeInfoPtr; iTagValuePairArraySize: ItemCount; var oTagValuePairCount: ItemCount ): OSStatus; external name '_ATSUGetAllLayoutControls';


{
 *  ATSUClearLayoutControls()
 *
 *  Summary:
 *    Restores default values to the specified layout control
 *    attributes of a text layout object.
 *
 *  Discussion:
 *    This function removes those layout control attribute values
 *    identified by the tag constants in the iTag array and replaces
 *    them with the default values. If you specify that any currently
 *    unset attribute values be removed, the function does not return
 *    an error. For a list of layout control tags defined by ATSUI and
 *    their default values, see the definition of ATSUAttributeTag.
 *
 *  Parameters:
 *
 *    iTextLayout:
 *      The text layout in which you wish to clear layout controls.
 *
 *    iTagCount:
 *      The number of tags you wish to clear. This value should
 *      correspond to the nuumber of elements in the iTag array. Pass
 *      kATSUClearAll for this parameter if you wish to clear all
 *      layout controls.
 *
 *    iTag:
 *      An array of layout control tags to be cleared. For a list of
 *      layout control tags defined by ATSUI and their default values,
 *      see the definition of ATSUAttributeTag. You may pass NULL for
 *      this parameter if you are passing kATSUClearAll for the
 *      iTagCount parameter. can be NULL
 *
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function ATSUClearLayoutControls( iTextLayout: ATSUTextLayout; iTagCount: ItemCount; iTag: ATSUAttributeTagPtr ): OSStatus; external name '_ATSUClearLayoutControls';


{ ---------------------------------------------------------------------------- }
{  ATSUI line controls                                                         }
{ ---------------------------------------------------------------------------- }
{
 *  ATSUCopyLineControls()
 *
 *  Summary:
 *    Copies line control attribute settings from a line in a source
 *    text layout object to a line in a destination text layout object.
 *
 *  Discussion:
 *    This function copies all line control attribute values to a line
 *    in a destination text layout object from a line in a source text
 *    layout object, including any default (unset) values in the source
 *    line. Unset line control attributes are assigned the default
 *    values. ATSUCopyLineControls does not copy the contents of memory
 *    referenced by pointers within custom line attributes or within
 *    reference constants. You are responsible for ensuring that this
 *    memory remains valid until the source text layout object is
 *    disposed.
 *
 *  Parameters:
 *
 *    iSourceTextLayout:
 *      The text layout object from which to copy line control
 *      attributes.
 *
 *    iSourceLineStart:
 *      The start of the line from which to copy line control
 *      attributes.
 *
 *    iDestTextLayout:
 *      The text layout object for which to set line control
 *      attributes. This can be the same text layout object passed in
 *      the iSourceTextLayout parameter if you want to copy line
 *      control attributes from one line to another within a text
 *      layout object.
 *
 *    iDestLineStart:
 *      The start of the line to which to copy line control attributes.
 *
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.6 and later
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function ATSUCopyLineControls( iSourceTextLayout: ATSUTextLayout; iSourceLineStart: UniCharArrayOffset; iDestTextLayout: ATSUTextLayout; iDestLineStart: UniCharArrayOffset ): OSStatus; external name '_ATSUCopyLineControls';


{
 *  ATSUSetLineControls()
 *
 *  Summary:
 *    Sets one or more line control values for a specified line in a
 *    text layout.
 *
 *  Discussion:
 *    When you use ATSUI to image your text, you can control the text's
 *    display and formatting at a number of different levels: layout,
 *    line, and run. The level affected by this function is the line
 *    level. These attributes are similar to those that you can apply
 *    on a full-layout basis, but each affects only an individual text
 *    line. Note that setting line control attributes overrides the
 *    corresponding layout-level settings. Also, from a performance
 *    standpoint, it is preferable to work from the layout level and
 *    not specify such controls line by line unless necessary. Lines
 *    are determined by soft breaks that may be set in your layout. You
 *    can specify a line by giving a starting offset into the text
 *    buffer. Attributes at this level affect the width of the text
 *    area from margin to margin, the alignment of the text, its
 *    justification, rotation, and direction, as well as other layout
 *    options. Similar to style attributes, you use a "triple" to
 *    specify a line or layout control attribute. That is, (1) an
 *    attribute tag, (2) the size (in bytes) of the attribute value,
 *    and (3) the value of the attribute it sets. Attribute tags are
 *    constants supplied by ATSUI. Attribute values may be a scalar, a
 *    structure, or a pointer. And as with style attributes, you can
 *    also create a custom attribute for a line or layout attribute for
 *    which ATSUI does not provide a tag. For a list of line control
 *    tags defined by ATSUI and their default values, see the
 *    definition of ATSUAttributeTag.
 *
 *  Parameters:
 *
 *    iTextLayout:
 *      The layout in which you wish to set line controls.
 *
 *    iLineStart:
 *      The starting offset of the line for which you wish to set
 *      controls.
 *
 *    iAttributeCount:
 *      The number of attributes to set. This value should correspond
 *      to the number of elements in the iTag, iValueSize, and iValue
 *      arrays.
 *
 *    iTag:
 *      An array of attribute tags to set. For a list of line control
 *      tags defined by ATSUI and their default values, see the
 *      definition of ATSUAttributeTag.
 *
 *    iValueSize:
 *      An array of values indicating the sizes of the values pointed
 *      to by the elements in the iValue array.
 *
 *    iValue:
 *      An array of attribute value pointers. Each value in the array
 *      must correspond to a tag in the iTag array and be a legal value
 *      for that tag.
 *
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.6 and later
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function ATSUSetLineControls( iTextLayout: ATSUTextLayout; iLineStart: UniCharArrayOffset; iAttributeCount: ItemCount; iTag: ATSUAttributeTagPtr; iValueSize: ByteCountPtr; iValue: ATSUAttributeValuePtrPtr ): OSStatus; external name '_ATSUSetLineControls';


{
 *  ATSUGetLineControl()
 *
 *  Summary:
 *    Obtains a single line control attribute value for a line in a
 *    text layout object.
 *
 *  Discussion:
 *    Before calling ATSUGetLineControl, you should call the function
 *    ATSUGetAllLineControls to obtain an array of nondefault line
 *    control attribute tags and value sizes for the line. You can then
 *    pass the tag and value size for the attribute value to obtain to
 *    ATSUGetLineControl. Typically you use the function
 *    ATSUGetLineControl by calling it twice, as follows: (1) Pass a
 *    reference to the text layout object to examine in the iTextLayout
 *    parameter, NULL for the oValue parameter, 0 for the
 *    iExpectedValueSize parameter. ATSUGetLineControl returns the
 *    actual size of the attribute value in the oActualValueSize
 *    parameter. (2) Allocate enough space for an array of the returned
 *    size, then call the ATSUGetLineControl function again, passing a
 *    valid pointer in the oValue parameter. On return, the pointer
 *    refers to the actual attribute value contained for the line in
 *    the text layout object.
 *
 *  Parameters:
 *
 *    iTextLayout:
 *      The text layout for which to obtain a line control value.
 *
 *    iLineStart:
 *      The start of the line for which to obtain a line control value.
 *
 *    iTag:
 *      A tag specifying the line control value to be obtained. For a
 *      list of line control tags defined by ATSUI and their default
 *      values, see the definition of ATSUAttributeTag.
 *
 *    iExpectedValueSize:
 *      The expected size (in bytes) of the value to obtain.
 *
 *    oValue:
 *      On return, the actual attribute value. If you are uncertain of
 *      how much memory to allocate, see the Discussion. can be NULL
 *
 *    oActualValueSize:
 *      On return, the value contains the actual size (in bytes) of the
 *      attribute value. You should examine this parameter if you are
 *      unsure of the size of the attribute value being obtained, as in
 *      the case of custom line control attributes. can be NULL
 *
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.6 and later
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function ATSUGetLineControl( iTextLayout: ATSUTextLayout; iLineStart: UniCharArrayOffset; iTag: ATSUAttributeTag; iExpectedValueSize: ByteCount; oValue: ATSUAttributeValuePtr; oActualValueSize: ByteCountPtr ): OSStatus; external name '_ATSUGetLineControl';


{
 *  ATSUGetAllLineControls()
 *
 *  Summary:
 *    Obtains an array of line control attribute tags and value sizes
 *    for a line in a text layout object.
 *
 *  Discussion:
 *    This function obtains all nondefault line control attribute tags
 *    and their values sizes for a line in a text layout object. You
 *    can pass a tag and value size pair obtained from
 *    ATSUGetAllLineControls to the function ATSUGetLineControl to
 *    determine the corresponding attribute value. Typically you use
 *    the function ATSUGetAllLineControls by calling it twice, as
 *    follows: (1) Pass a reference to the text layout object to
 *    examine in the iTextLayout parameter, the appropriate
 *    UniCharArrayOffset value in the iLineStart parameter, NULL for
 *    the oAttributeInfoArray parameter, a pointer to an ItemCount
 *    value in the oTagValuePairCount parameter, and 0 for the
 *    iTagValuePairArraySize parameter. ATSUGetAllLineControls returns
 *    the size of the tag and value size arrays in the
 *    oTagValuePairCount parameter. (2) Allocate enough space for an
 *    array of the returned size, then call the ATSUGetAllLineControls
 *    function again, passing a valid pointer in the
 *    oAttributeInfoArray parameter. On return, the pointer refers to
 *    an array of the line control attribute tag and value size pairs
 *    contained in the specified line. To obtain the nondefault layout
 *    control attribute tags and value sizes for a text layout object,
 *    call the function ATSUGetAllLayoutControls.
 *
 *  Parameters:
 *
 *    iTextLayout:
 *      The layout for which you wish to obtain line control
 *      information.
 *
 *    iLineStart:
 *      The beginning of the line for which you wish to obtain line
 *      control information.
 *
 *    oAttributeInfoArray:
 *      On return, this array contains pairs of tags and value sizes
 *      for the object's line control attributes that are not at
 *      default values. If you are uncertain of how much memory to
 *      allocate for this array, see the Discussion. can be NULL
 *
 *    iTagValuePairArraySize:
 *      The size of of the array you allocated for the
 *      oAttributeInfoArray parameter.
 *
 *    oTagValuePairCount:
 *      On return, the value specifies the actual number of
 *      ATSUAttributeInfo structures in the line. This may be greater
 *      than the value you specified in the iTagValuePairArraySize
 *      parameter. can be NULL
 *
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.6 and later
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function ATSUGetAllLineControls( iTextLayout: ATSUTextLayout; iLineStart: UniCharArrayOffset; oAttributeInfoArray: ATSUAttributeInfoPtr; iTagValuePairArraySize: ItemCount; oTagValuePairCount: ItemCountPtr ): OSStatus; external name '_ATSUGetAllLineControls';


{
 *  ATSUClearLineControls()
 *
 *  Summary:
 *    Restores default values to the specified line control attributes
 *    of a text layout object.
 *
 *  Discussion:
 *    This function removes those line control attribute values
 *    identified by the tag constants in the iTag array and replaces
 *    them with the default values. If you specify that any currently
 *    unset attribute values be removed, the function does not return
 *    an error. For a list of line control tags defined by ATSUI and
 *    their default values, see the definition of ATSUAttributeTag.
 *
 *  Parameters:
 *
 *    iTextLayout:
 *      The text layout in which you wish to clear line controls.
 *
 *    iLineStart:
 *      The start of the line in which to clear line controls.
 *
 *    iTagCount:
 *      The number of tags you wish to clear. This value should
 *      correspond to the nuumber of elements in the iTag array. Pass
 *      kATSUClearAll to clear all line controls.
 *
 *    iTag:
 *      An array of line control tags to be cleared. For a list of line
 *      control tags defined by ATSUI and their default values, see the
 *      definition of ATSUAttributeTag. You may pass NULL for this
 *      parameter if you are passing kATSUClearAll for the iTagCount
 *      parameter. can be NULL
 *
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.6 and later
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function ATSUClearLineControls( iTextLayout: ATSUTextLayout; iLineStart: UniCharArrayOffset; iTagCount: ItemCount; iTag: ATSUAttributeTagPtr ): OSStatus; external name '_ATSUClearLineControls';


{ ---------------------------------------------------------------------------- }
{  ATSUI style run processing                                                  }
{ ---------------------------------------------------------------------------- }
{
 *  ATSUSetRunStyle()
 *
 *  Summary:
 *    Defines a style run by associating style information with a run
 *    of text.
 *
 *  Discussion:
 *    A text run consists of one or more characters that are contiguous
 *    in memory. If you associate these characters with a distinct
 *    style, you define a style run. You can use the ATSUSetRunStyle
 *    function to define a style run, by associating a style object
 *    with a run of text in a text layout object. Each text run must be
 *    assigned a style object, which may or may not differ from other
 *    style objects assigned to other text runs in a given text layout
 *    object. After calling ATSUSetRunStyle, you can call the function
 *    ATSUDrawText to display the styled text. When you call
 *    ATSUDrawText, if you have not previously assigned styles to all
 *    the characters you request to be drawn, ATSUI automatically does
 *    so. Specifically, ATSUI extends the first style it locates
 *    immediately prior (in storage order) to the unstyled characters
 *    to include those unassigned characters. If the unstyled
 *    characters are at the beginning of the text stream, ATSUI finds
 *    the first style run in the stream and extends it backward to the
 *    first character. You should call ATSUSetRunStyle whenever you
 *    create a new text layout object without any associated styles, as
 *    by using the function ATSUCreateTextLayout. You should also call
 *    ATSUSetRunStyle to assign a style to a text run in response to a
 *    user action, such as when the user selects a run of text and
 *    changes the font. You do not need to call ATSUSetRunStyle when
 *    you change style attributes or text layout attributes. In such
 *    cases, ATSUI automatically updates the layout of the text as
 *    appropriate.
 *
 *  Parameters:
 *
 *    iTextLayout:
 *      The layout in which you wish to set the style run.
 *
 *    iStyle:
 *      The style to be assigned to the run of characters.
 *
 *    iRunStart:
 *      The start of the run of characters. To specify the beginning of
 *      the text buffer, pass kATSUFromTextBeginning for this parameter.
 *
 *    iRunLength:
 *      The end of the run of characters. To specify a run that
 *      continues to the end of the text buffer, pass kATSUToTextEnd
 *      for this parameter.
 *
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function ATSUSetRunStyle( iTextLayout: ATSUTextLayout; iStyle: ATSUStyle; iRunStart: UniCharArrayOffset; iRunLength: UniCharCount ): OSStatus; external name '_ATSUSetRunStyle';


{
 *  ATSUGetRunStyle()
 *
 *  Summary:
 *    Obtains style run information for a character offset in a run of
 *    text.
 *
 *  Discussion:
 *    You can use the ATSUGetRunStyle function to obtain the style
 *    object assigned to a given text offset. ATSUGetRunStyle also
 *    produces the encompassing text range that shares the style object
 *    with the offset. Note that the style object contains those
 *    previously set style attributes, font features, and font
 *    variations that are continuous for the range of text that
 *    includes the specified text offset. If you want to obtain all
 *    shared style information for a style run, including any unset
 *    attributes, call the function ATSUGetContinuousAttributes
 *    instead. If only one style run is set in the text layout object,
 *    and it does not cover the entire text layout object,
 *    ATSUGetRunStyle uses the style run information for the iOffset
 *    parameter to set the style run information for the remaining text.
 *
 *  Parameters:
 *
 *    iTextLayout:
 *      The layout for which to obtain style run information.
 *
 *    iOffset:
 *      The beginning character for which you want to obtain style run
 *      information.
 *
 *    oStyle:
 *      On return, the style object assigned to the range of text
 *      containing the character at iOffset. Note that if you pass an
 *      offset in the iOffset parameter that is at a style run
 *      boundary, ATSUGetRunStyle produces style run information for
 *      the following, not preceding, style run.
 *
 *    oRunStart:
 *      On return, the offset from the beginning of the text buffer to
 *      the first character of the style run containing the character
 *      at iOffset. Note that the entire style run does not necessarily
 *      share the same unset attribute values as the character at
 *      iOffset.
 *
 *    oRunLength:
 *      On return, the length of the style run containing the character
 *      at iOffset.
 *
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function ATSUGetRunStyle( iTextLayout: ATSUTextLayout; iOffset: UniCharArrayOffset; var oStyle: ATSUStyle; var oRunStart: UniCharArrayOffset; var oRunLength: UniCharCount ): OSStatus; external name '_ATSUGetRunStyle';


{
 *  ATSUGetContinuousAttributes()
 *
 *  Summary:
 *    Obtains the style attribute values that are continuous over a
 *    given text range.
 *
 *  Discussion:
 *    This function examines the specified text range to obtain the
 *    style attribute values (including those at default values) that
 *    remain consistent for the entire text range. You should call
 *    ATSUGetContinuousAttributes to determine the style information
 *    that remains constant over text that has been selected by the
 *    user.
 *
 *  Parameters:
 *
 *    iTextLayout:
 *      The layout for which you wish to obtain style run information.
 *
 *    iOffset:
 *      The starting character for which to examine style run
 *      attributes. To specify the beginning of the text buffer, pass
 *      kATSUFromTextBeginning for this parameter.
 *
 *    iLength:
 *      The length of the range of characters to examine. To specify a
 *      range that continues to the end of the text buffer, pass
 *      kATSUToTextEnd for this parameter.
 *
 *    oStyle:
 *      On return, a style object containing those attributes which are
 *      the same for the entire text range specified by the iOffset and
 *      iLength parameters.
 *
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function ATSUGetContinuousAttributes( iTextLayout: ATSUTextLayout; iOffset: UniCharArrayOffset; iLength: UniCharCount; oStyle: ATSUStyle ): OSStatus; external name '_ATSUGetContinuousAttributes';


{ ---------------------------------------------------------------------------- }
{  ATSUI tab support                                                           }
{ ---------------------------------------------------------------------------- }
{
 *  ATSUSetTabArray()
 *
 *  Summary:
 *    Sets a tab ruler for a text layout object.
 *
 *  Discussion:
 *    When a tab ruler is set for a text layout object, ATSUI
 *    automatically aligns text such that any tabs characters in the
 *    text are laid out to follow the tab ruler's specifications. If
 *    you want to use tabs in your text and you also want to use the
 *    function ATSUBatchBreakLines, then you must set tabs by calling
 *    the function ATSUSetTabArray. See the definition of ATSUTab for
 *    more information about setting up a tab ruler.
 *
 *  Parameters:
 *
 *    iTextLayout:
 *      The layout in which to set the tab array.
 *
 *    iTabs:
 *      An array of tabstops. See the definition of ATSUTab for more
 *      inforamation about specifying tabs.
 *
 *    iTabCount:
 *      The number of tab stops in the iTabs array.
 *
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in ApplicationServices.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
function ATSUSetTabArray( iTextLayout: ATSUTextLayout; iTabs: ATSUTabPtr; iTabCount: ItemCount ): OSStatus; external name '_ATSUSetTabArray';


{
 *  ATSUGetTabArray()
 *
 *  Summary:
 *    Retrieves the tab ruler associated with a text layout object.
 *
 *  Discussion:
 *    This function can be used to retrieve all the tabs that were
 *    previously set for a text layout object, using the function
 *    ATSUSetTabArray . All the returned tabs will be in order of
 *    position along the line.Typically you use the ATSUGetTabArray
 *    function by calling it twice, as follows: (1) Pass NULL for the
 *    oTabs parameter, 0 for the iMaxTabCount parameter, and valid
 *    values for the other parameters. The ATSUGetTabArray function
 *    returns the actual number of tabs in the oTabCount parameter. (2)
 *    Allocate enough space for a buffer of the returned size, then
 *    call the function again, passing a valid pointer to the buffer in
 *    the oTabs parameter. On return, the buffer contains the tab
 *    values in order of position along the line from left to right.
 *
 *  Parameters:
 *
 *    iTextLayout:
 *      The text layout for which to retrieve the tab ruler.
 *
 *    iMaxTabCount:
 *      The size of the array you have allocated for the oTabs
 *      parameter. If you are unsure what to pass for this parameter,
 *      see the Discussion.
 *
 *    oTabs:
 *      On return, an array of ATSUTab structures specifying the
 *      currently set tab ruler for this layout. can be NULL
 *
 *    oTabCount:
 *      On return, the number of tabs currently set in this layout.
 *      Note that this may be greater than the value you have passed
 *      for iMaxTabCount. can be NULL
 *
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in ApplicationServices.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
function ATSUGetTabArray( iTextLayout: ATSUTextLayout; iMaxTabCount: ItemCount; oTabs: ATSUTabPtr; oTabCount: ItemCountPtr ): OSStatus; external name '_ATSUGetTabArray';


{ ---------------------------------------------------------------------------- }
{ ATSUI font fallback object functions                                         }
{ ---------------------------------------------------------------------------- }
{
 *  ATSUCreateFontFallbacks()
 *
 *  Summary:
 *    Creates an opaque object that can be set to contain a font list
 *    and a font-search method.
 *
 *  Discussion:
 *    After using this fucntion to create an ATSUFontFallbacks object,
 *    you can then use ATSUSetObjFontFallbacks to set the fallback
 *    method for this object, and then use the
 *    kATSULineFontFallbacksTag to apply the object to a layout. You
 *    may then either call ATSUMatchFontsToText to manually perform
 *    font substitution, or call ATSUSetTransientFontMatching to
 *    perform automatic font subtitution.
 *
 *  Parameters:
 *
 *    oFontFallback:
 *      On return, a reference to a newly created ATSUFontFallbacks
 *      object. You are responsible for freeing this object with
 *      ATSUDisposeFontFallbacks.
 *
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *
 *  Availability:
 *    Mac OS X:         in version 10.1 and later in ApplicationServices.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.1 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER
function ATSUCreateFontFallbacks( var oFontFallback: ATSUFontFallbacks ): OSStatus; external name '_ATSUCreateFontFallbacks';


{
 *  ATSUDisposeFontFallbacks()
 *
 *  Summary:
 *    Disposes of an ATSUDisposeFontFallbacks object.
 *
 *  Discussion:
 *    This function will only dispose of the ATSUDisposeFontFallbacks
 *    itself. If you have allocated an array of ATSUFontIDs for use
 *    with this ATSUFontFallbacks object, you are responsible for
 *    freeing it separately.
 *
 *  Parameters:
 *
 *    iFontFallbacks:
 *      The ATSUFontFallbacks object to be disposed of.
 *
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *
 *  Availability:
 *    Mac OS X:         in version 10.1 and later in ApplicationServices.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.1 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER
function ATSUDisposeFontFallbacks( iFontFallbacks: ATSUFontFallbacks ): OSStatus; external name '_ATSUDisposeFontFallbacks';


{
 *  ATSUSetObjFontFallbacks()
 *
 *  Summary:
 *    Assigns a font-search method and a font list to a font fallback
 *    object.
 *
 *  Discussion:
 *    This function allows you to define the settings for a font
 *    fallback object. These settings determine the method ATSUI uses
 *    to perform font fallbacks, as well as the font search list, if
 *    one is needed. Not all fallback methods require a search list.
 *    See the definition of ATSUFontFallbackMethod for more infomation
 *    about the different font fallback methods. Once you have called
 *    this function, you typically will want to associate the font
 *    fallback object with a text layout using ATSUSetLayoutControls
 *    and the kATSULineFontFallbacksTag attribute.
 *
 *  Parameters:
 *
 *    iFontFallbacks:
 *      The fallback object for which you wish to set or change
 *      settings.
 *
 *    iFontFallbacksCount:
 *      The number of fonts contained in the iFonts array. Some font
 *      fallbacks methods do not require such a list. In such cases,
 *      you may pass zero for this paramter.
 *
 *    iFonts:
 *      A list of fonts for ATSUI to search through when performing
 *      fallbacks. Some font fallbacks methods do not require such a
 *      list. In such cases, you may pass NULL for this parameter. can be NUL
 *
 *    iFontFallbackMethod:
 *      The font fallback method for ATSUI to use. See the definition
 *      of ATSUFontFallbackMethod for a list of possible constants to
 *      pass in for this paramater. Note that some fallback modes
 *      require a list of fonts for ATSUI to search. In such cases, use
 *      the iFonts and iFontFallbacksCount parameters to specify this
 *      list.
 *
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *
 *  Availability:
 *    Mac OS X:         in version 10.1 and later in ApplicationServices.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.1 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER
function ATSUSetObjFontFallbacks( iFontFallbacks: ATSUFontFallbacks; iFontFallbacksCount: ItemCount; iFonts: ATSUFontIDPtr; iFontFallbackMethod: ATSUFontFallbackMethod ): OSStatus; external name '_ATSUSetObjFontFallbacks';


{
 *  ATSUGetObjFontFallbacks()
 *
 *  Summary:
 *    Returns information about the current settings in an
 *    ATSUFontFallbacks object.
 *
 *  Discussion:
 *    Information returned includes the font-search method, and the
 *    font search list, if one is set. Note that some font fallback
 *    modes do not have a client-specified search list. You must
 *    allocate space for this list.
 *
 *  Parameters:
 *
 *    iFontFallbacks:
 *      The font fallback object you want to know the current settings
 *      of.
 *
 *    iMaxFontFallbacksCount:
 *      For this parameter, pass in the size of the array you are
 *      passing in for the oFonts parameter.
 *
 *    oFonts:
 *      On input, a buffer you have allocated for storing the font
 *      search list. On return, ATSUGetObjFontFallbacks will populate
 *      the list up to iMaxFontFallbacksCount items. can be NUL
 *
 *    oFontFallbackMethod:
 *      On return, the font fallback method currently set for this
 *      object. See the definition of ATSUFontFallbackMethod for more
 *      information regarding the different font fallback modes.
 *
 *    oActualFallbacksCount:
 *      On return, the size of the font search list. You can use this
 *      parameter to determine how much space to allocate for the
 *      oFonts parameter. can be NUL
 *
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *
 *  Availability:
 *    Mac OS X:         in version 10.1 and later in ApplicationServices.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.1 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER
function ATSUGetObjFontFallbacks( iFontFallbacks: ATSUFontFallbacks; iMaxFontFallbacksCount: ItemCount; oFonts: ATSUFontIDPtr; var oFontFallbackMethod: ATSUFontFallbackMethod; oActualFallbacksCount: ItemCountPtr ): OSStatus; external name '_ATSUGetObjFontFallbacks';


{ ---------------------------------------------------------------------------- }
{  ATSUI font matching                                                         }
{ ---------------------------------------------------------------------------- }
{
 *  ATSUSetFontFallbacks()
 *
 *  Summary:
 *    Sets font fallback behavior on a global basis.
 *
 *  Discussion:
 *    Control of font fallback behavior on a global basis is no longer
 *    recommended. Object based font fallbacks are preferred. See the
 *    functions ATSUCreateFontFallbacks, ATSUDisposeFontFallbacks,
 *    ATSUSetObjFontFallbacks, and ATSUGetObjFontFallbacks, as well as
 *    the kATSULineFontFallbacksTag attribute for more information
 *    about object based font fallbacks.
 *
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.6 and later
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function ATSUSetFontFallbacks( iFontFallbacksCount: ItemCount; iFontIDs: ATSUFontIDPtr; iFontFallbackMethod: ATSUFontFallbackMethod ): OSStatus; external name '_ATSUSetFontFallbacks';


{
 *  ATSUGetFontFallbacks()
 *
 *  Summary:
 *    Gets the current global font fallback behavior.
 *
 *  Discussion:
 *    Control of font fallback behavior on a global basis is no longer
 *    recommended. Object based font fallbacks are preferred. See the
 *    functions ATSUCreateFontFallbacks, ATSUDisposeFontFallbacks,
 *    ATSUSetObjFontFallbacks, and ATSUGetObjFontFallbacks, as well as
 *    the kATSULineFontFallbacksTag attribute for more information
 *    about object based font fallbacks.
 *
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.6 and later
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function ATSUGetFontFallbacks( iMaxFontFallbacksCount: ItemCount; oFontIDs: ATSUFontIDPtr; var oFontFallbackMethod: ATSUFontFallbackMethod; var oActualFallbacksCount: ItemCount ): OSStatus; external name '_ATSUGetFontFallbacks';


{
 *  ATSUMatchFontsToText()
 *
 *  Summary:
 *    Examines a text range for characters that cannot be drawn with
 *    the current font and suggests a substitute font, if necessary.
 *
 *  Discussion:
 *    When you call the ATSUMatchFontsToText function, ATSUI scans the
 *    given range of text for characters that cannot be drawn with the
 *    currently assigned font. When ATSUI finds such a character, it
 *    identifies a substitute font for drawing the character. ATSUI
 *    then continues scanning the text range for subsequent characters
 *    that cannot be drawn, stopping when it finds a character that can
 *    be drawn with the currently assigned font, or finds a character
 *    that cannot be drawn with either the currently assigned font or
 *    the substitute font, or reaches the end of the text range you
 *    have specified. ATSUI's default behavior for finding a substitute
 *    font is to recommend the first valid font that it finds when
 *    scanning the fonts in the user's system. ATSUI first searches in
 *    the standard application fonts for various languages. If that
 *    fails, ATSUI searches through the remaining fonts on the system
 *    in the order in which the Font Manager returns the fonts. After
 *    ATSUI has searched all the fonts in the system, any unmatched
 *    text is drawn using the last-resort font. That is, missing glyphs
 *    are represented by and empty box to indicate to the user that a
 *    valid font for that character is not installed on their system.
 *    You can alter ATSUI's default search behavior by calling the
 *    function ATSUCreateFontFallbacks and defining your own font
 *    fallback settings for the text layout object. Because ATSUI does
 *    not necessarily completely scan the text range you specify with
 *    each call to ATSUMatchFontsToText, if ATSUI does find any
 *    characters that cannot be rendered with their current font, you
 *    should call ATSUMatchFontsToText again and update the input range
 *    to check that all the subsequent characters in the range can be
 *    drawn. For that reason, you should call ATSUMatchFontsToText from
 *    within a loop to assure that the entire range of text is checked.
 *    Note that calling ATSUMatchFontsToText does not cause the
 *    suggested font substitution to be performed. If you want ATSUI to
 *    perform font substitution automatically, you can call the
 *    function ATSUSetTransientFontMatching.
 *
 *  Parameters:
 *
 *    iTextLayout:
 *      The text layout object to examine.
 *
 *    iTextStart:
 *      The first character of the range to examine. To start at the
 *      beginning of the text buffer, pass the constant
 *      kATSUFromTextBeginning.
 *
 *    iTextLength:
 *      The length of the text range to examine. If you want the range
 *      of text to extend to the end of the text buffer, you can pass
 *      the constant kATSUToTextEnd.
 *
 *    oFontID:
 *      On return, the value provides a font ID for the suggested
 *      substitute font or kATSUInvalidFontID, if no substitute font is
 *      available.
 *
 *    oChangedOffset:
 *      On return, this value specifies the offset from the beginning
 *      of the text buffer to the first character that cannot be drawn
 *      with the current font.
 *
 *    oChangedLength:
 *      On return, this value specifies the length of the text range
 *      that cannot be drawn with the current font.
 *
 *  Result:
 *    The result code noErr indicates that all the characters in the
 *    given range can be rendered with their current font(s) and no
 *    font substitution is needed. If you receive either of the result
 *    codes kATSUFontsMatched or kATSUFontsNotMatched, you should
 *    update the input range and call ATSUMatchFontsToText again to
 *    ensure that all the characters in the range can be drawn. See
 *    MacErrors.h for other possible error codes.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function ATSUMatchFontsToText( iTextLayout: ATSUTextLayout; iTextStart: UniCharArrayOffset; iTextLength: UniCharCount; var oFontID: ATSUFontID; var oChangedOffset: UniCharArrayOffset; var oChangedLength: UniCharCount ): OSStatus; external name '_ATSUMatchFontsToText';


{
 *  ATSUSetTransientFontMatching()
 *
 *  Summary:
 *    Sets the current transient font matching state for a given layout.
 *
 *  Discussion:
 *    Transient font matching allows ATSUI to automatically substitute
 *    glyphs from other fonts if the specified styles do not contain
 *    glyphs for all the characters in the text. You can change the
 *    behavior of this font substitution by calling the function
 *    ATSUCreateFontFallbacks and defining your own font fallback
 *    settings for the text layout object.
 *
 *  Parameters:
 *
 *    iTextLayout:
 *      A layout for which to set the current transient font matching
 *      state.
 *
 *    iTransientFontMatching:
 *      A boolean value indicating if the current transient font
 *      matching state to set.
 *
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function ATSUSetTransientFontMatching( iTextLayout: ATSUTextLayout; iTransientFontMatching: Boolean ): OSStatus; external name '_ATSUSetTransientFontMatching';


{
 *  ATSUGetTransientFontMatching()
 *
 *  Summary:
 *    Obtains the current transient font matching state for a given
 *    layout.
 *
 *  Discussion:
 *    Transient font matching allows ATSUI to automatically substitute
 *    glyphs from other fonts if the specified styles do not contain
 *    glyphs for all the characters in the text. You can change the
 *    behavior of this font substitution by calling the function
 *    ATSUCreateFontFallbacks and defining your own font fallback
 *    settings for the text layout object.
 *
 *  Parameters:
 *
 *    iTextLayout:
 *      A layout for which to obtain the current transient font
 *      matching state.
 *
 *    oTransientFontMatching:
 *      On return, a boolean value indicating the current transient
 *      font matching state.
 *
 *  Result:
 *    On success, noErr is returned. See MacErrors.h for possible error
 *    codes.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function ATSUGetTransientFontMatching( iTextLayout: ATSUTextLayout; var oTransientFontMatching: Boolean ): OSStatus; external name '_ATSUGetTransientFontMatching';


{ Functions listed beyond this point are either deprecated or not recommended }

{ ---------------------------------------------------------------------------- }
{  Handle-based functions                                                      }
{ ---------------------------------------------------------------------------- }
{
 *  ATSUCreateTextLayoutWithTextHandle()
 *
 *  Discussion:
 *    This function is no longer recommended. Please use
 *    ATSUCreateTextLayoutWithTextPtr instead.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function ATSUCreateTextLayoutWithTextHandle( iText: UniCharArrayHandle; iTextOffset: UniCharArrayOffset; iTextLength: UniCharCount; iTextTotalLength: UniCharCount; iNumberOfRuns: ItemCount; iRunLengths: UniCharCountPtr; iStyles: ATSUStylePtr; var oTextLayout: ATSUTextLayout ): OSStatus; external name '_ATSUCreateTextLayoutWithTextHandle';


{
 *  ATSUSetTextHandleLocation()
 *
 *  Discussion:
 *    This function is no longer recommended. Please use
 *    ATSUSetTextPointerLocation instead.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function ATSUSetTextHandleLocation( iTextLayout: ATSUTextLayout; iText: UniCharArrayHandle; iTextOffset: UniCharArrayOffset; iTextLength: UniCharCount; iTextTotalLength: UniCharCount ): OSStatus; external name '_ATSUSetTextHandleLocation';


{ ---------------------------------------------------------------------------- }
{  ATSUI idle processing (deprecated)                                          }
{ ---------------------------------------------------------------------------- }
{
 *  ATSUIdle()
 *
 *  Summary:
 *    Performs background processing.
 *
 *  Discussion:
 *    Current versions of ATSUI do not implement background processing
 *    for text layout objects. In Mac OS X, the function ATSUIdle does
 *    nothing.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function ATSUIdle( iTextLayout: ATSUTextLayout ): OSStatus; external name '_ATSUIdle';


{ ---------------------------------------------------------------------------- }
{  ATSUI Memory allocation specification functions (not in Carbon)             }
{ ---------------------------------------------------------------------------- }
{
 *  ATSUCreateMemorySetting()
 *
 *  Discussion:
 *    ATSUI memory setting functions are not necessary on Mac OS X.
 *
 *  Availability:
 *    Mac OS X:         not available
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.6 and later
 }


{
 *  ATSUSetCurrentMemorySetting()
 *
 *  Discussion:
 *    ATSUI memory setting functions are not necessary on Mac OS X.
 *
 *  Availability:
 *    Mac OS X:         not available
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.6 and later
 }


{
 *  ATSUGetCurrentMemorySetting()
 *
 *  Discussion:
 *    ATSUI memory setting functions are not necessary on Mac OS X.
 *
 *  Availability:
 *    Mac OS X:         not available
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.6 and later
 }


{
 *  ATSUDisposeMemorySetting()
 *
 *  Discussion:
 *    ATSUI memory setting functions are not necessary on Mac OS X.
 *
 *  Availability:
 *    Mac OS X:         not available
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   in ATSUnicodeLib 8.6 and later
 }
{unit Controls}
{$ALIGN MAC68K}










{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}

{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{  ¥ Resource Types                                                                                    }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}

const
    kControlDefProcType         = $43444546 (* 'CDEF' *);
    kControlTemplateResourceType = $434E544C (* 'CNTL' *);
    kControlColorTableResourceType = $63637462 (* 'cctb' *);
    kControlDefProcResourceType = $43444546 (* 'CDEF' *);

    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {     ¥ Format of a ÔCNTLÕ resource                                                                         }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }

type
    ControlTemplatePtr = ^ControlTemplate;
    ControlTemplate = record
        controlRect:            Rect;
        controlValue:           SInt16;
        controlVisible:         boolean;
        fill:                   SInt8;
        controlMaximum:         SInt16;
        controlMinimum:         SInt16;
        controlDefProcID:       SInt16;
        controlReference:       SInt32;
        controlTitle:           Str255;
    end;

    ControlTemplateHandle               = ^ControlTemplatePtr;



{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{  ¥ ControlRef                                                                                        }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}

type
    ControlRef    = ^SInt32; { an opaque 32-bit type }
    ControlRefPtr = ^ControlRef;  { when a var xx:ControlRef parameter can be nil, it is changed to xx: ControlRefPtr }

    {  ControlHandle is obsolete. Use ControlRef. }
    ControlHandle                       = ControlRef;
    ControlPartCode                     = SInt16;
    ControlPartCodePtr                  = ^ControlPartCode; { when a var xx:ControlPartCode parameter can be nil, it is changed to xx: ControlPartCodePtr }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {    ¥ Control ActionProcPtr                                                                                }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    ControlActionProcPtr = procedure(theControl: ControlRef; partCode: ControlPartCode);

    ControlActionUPP = ^SInt32; { an opaque UPP }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {     ¥ ControlRecord                                                                                       }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }

    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {    ¥ Control ActionProcPtr : Epilogue                                                                     }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }

const
    uppControlActionProcInfo = $000002C0;
    {
     *  NewControlActionUPP()
     *
     *  Availability:
     *    Non-Carbon CFM:   available as macro/inline
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function NewControlActionUPP(userRoutine: ControlActionProcPtr): ControlActionUPP; external name '_NewControlActionUPP'; { old name was NewControlActionProc }
{
 *  DisposeControlActionUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeControlActionUPP(userUPP: ControlActionUPP); external name '_DisposeControlActionUPP';
{
 *  InvokeControlActionUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvokeControlActionUPP(theControl: ControlRef; partCode: ControlPartCode; userRoutine: ControlActionUPP); external name '_InvokeControlActionUPP'; { old name was CallControlActionProc }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{  ¥ Control Color Table                                                                               }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}

const
    cFrameColor                 = 0;
    cBodyColor                  = 1;
    cTextColor                  = 2;
    cThumbColor                 = 3;
    kNumberCtlCTabEntries       = 4;


type
    CtlCTabPtr = ^CtlCTab;
    CtlCTab = record
        ccSeed:                 SInt32;
        ccRider:                SInt16;
        ctSize:                 SInt16;
        ctTable:                array [0..3] of ColorSpec;
    end;

    CCTabPtr                            = ^CtlCTab;
    CCTabHandle                         = ^CCTabPtr;
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {     ¥ Auxiliary Control Record                                                                            }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }

    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {     ¥ Control Variants                                                                    }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    ControlVariant                      = SInt16;

const
    kControlNoVariant           = 0;                            {  No variant }
    kControlUsesOwningWindowsFontVariant = $08;                 {  Control uses owning windows font to display text }


    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {     ¥ Control Part Codes                                                                  }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {    Basic part codes   }
    kControlNoPart              = 0;
    kControlIndicatorPart       = 129;
    kControlDisabledPart        = 254;
    kControlInactivePart        = 255;

    {    Use this constant in Get/SetControlData when the data referred to is not           }
    {    specific to a part, but rather the entire control, e.g. the list handle of a       }
    {    list box control.                                                                  }
    kControlEntireControl       = 0;

    {     Meta-Parts                                                                            }
    {                                                                                           }
    {     If you haven't guessed from looking at other toolbox headers. We like the word        }
    {     'meta'. It's cool. So here's one more for you. A meta-part is a part used in a call   }
    {     to the GetControlRegion API. These parts are parts that might be defined by a         }
    {     control, but should not be returned from calls like TestControl, et al. They define   }
    {     a region of a control, presently the structure and the content region. The content    }
    {     region is only defined by controls that can embed other controls. It is the area      }
    {     that embedded content can live.                                                       }
    {                                                                                           }
    {     Along with these parts, you can also pass in normal part codes to get the regions     }
    {     of the parts. Not all controls fully support this at the time this was written.       }
    kControlStructureMetaPart   = -1;
    kControlContentMetaPart     = -2;

    {    focusing part codes    }
    kControlFocusNoPart         = 0;                            {  tells control to clear its focus }
    kControlFocusNextPart       = -1;                           {  tells control to focus on the next part }
    kControlFocusPrevPart       = -2;                           {  tells control to focus on the previous part }


type
    ControlFocusPart                    = SInt16;
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {     ¥ Control Collection Tags                                                                             }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {     These are standard tags that you will find in the initial data Collection that is passed in the       }
    {     'param' parameter to the initCntl message (Carbon only).                                              }
    {                                                                                                           }
    {     All tags at ID zero in a Control's Collection are reserved for Control Manager use.                   }
    {     Custom control definitions should use other IDs.                                                      }
    {                                                                                                           }
    {     Most of these tags are interpreted when you call CreateCustomControl; the Control Manager will        }
    {     put value in the right place before calling the Control Definition with the initialization message.   }

const
    kControlCollectionTagBounds = $626F756E (* 'boun' *);                       {  Rect - the bounding rectangle }
    kControlCollectionTagValue  = $76616C75 (* 'valu' *);                       {  SInt32 - the value }
    kControlCollectionTagMinimum = $6D696E20 (* 'min ' *);                      {  SInt32 - the minimum }
    kControlCollectionTagMaximum = $6D617820 (* 'max ' *);                      {  SInt32 - the maximum }
    kControlCollectionTagViewSize = $76696577 (* 'view' *);                     {  SInt32 - the view size }
    kControlCollectionTagVisibility = $76697369 (* 'visi' *);                   {  Boolean - the visible state }
    kControlCollectionTagRefCon = $72656663 (* 'refc' *);                       {  SInt32 - the refCon }
    kControlCollectionTagTitle  = $7469746C (* 'titl' *);                       {  arbitrarily sized character array - the title }
    kControlCollectionTagUnicodeTitle = $7574746C (* 'uttl' *);                 {  bytes as received via CFStringCreateExternalRepresentation }
    kControlCollectionTagIDSignature = $69647369 (* 'idsi' *);                  {  OSType - the ControlID signature }
    kControlCollectionTagIDID   = $69646964 (* 'idid' *);                       {  SInt32 - the ControlID id }
    kControlCollectionTagCommand = $636D6420 (* 'cmd ' *);                      {  UInt32 - the command }
    kControlCollectionTagVarCode = $76617263 (* 'varc' *);                      {  SInt16 - the variant }

    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {     ¥ Control Image Content                                                                               }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    kControlContentTextOnly     = 0;
    kControlNoContent           = 0;
    kControlContentIconSuiteRes = 1;
    kControlContentCIconRes     = 2;
    kControlContentPictRes      = 3;
    kControlContentICONRes      = 4;
    kControlContentIconSuiteHandle = 129;
    kControlContentCIconHandle  = 130;
    kControlContentPictHandle   = 131;
    kControlContentIconRef      = 132;
    kControlContentICON         = 133;
    kControlContentCGImageRef   = 134;


type
    ControlContentType                  = SInt16;
    ControlButtonContentInfoPtr = ^ControlButtonContentInfo;
    ControlButtonContentInfo = record
        contentType:            ControlContentType;
        case SInt16 of
        0: (
            resID:              SInt16;
            );
        1: (
            cIconHandle:        CIconHandle;
            );
        2: (
            iconSuite:          Handle;
            );
        3: (
            iconRef:            IconRef;
            );
        4: (
            picture:            PicHandle;
            );
        5: (
            ICONHandle:         Handle;
            );
        6: (
            imageRef:           CGImageRef;
            );
    end;

    ControlImageContentInfo             = ControlButtonContentInfo;
    ControlImageContentInfoPtr          = ^ControlImageContentInfo;
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {     ¥ Control Key Script Behavior                                                                         }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }

const
    kControlKeyScriptBehaviorAllowAnyScript = $616E7920 (* 'any ' *);           {  leaves the current keyboard alone and allows user to change the keyboard. }
    kControlKeyScriptBehaviorPrefersRoman = $70726D6E (* 'prmn' *);             {  switches the keyboard to roman, but allows them to change it as desired. }
    kControlKeyScriptBehaviorRequiresRoman = $72726D6E (* 'rrmn' *);            {  switches the keyboard to roman and prevents the user from changing it. }


type
    ControlKeyScriptBehavior            = UInt32;
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {     ¥ Control Font Style                                                                                  }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {       SPECIAL FONT USAGE NOTES: You can specify the font to use for many control types.
        The constants below are meta-font numbers which you can use to set a particular
        control's font usage. There are essentially two modes you can use: 1) default,
        which is essentially the same as it always has been, i.e. it uses the system font, unless
        directed to use the window font via a control variant. 2) you can specify to use
        the big or small system font in a generic manner. The Big system font is the font
        used in menus, etc. Chicago has filled that role for some time now. Small system
        font is currently Geneva 10. The meta-font number implies the size and style.

        NOTE:       Not all font attributes are used by all controls. Most, in fact, ignore
                    the fore and back color (Static Text is the only one that does, for
                    backwards compatibility). Also size, face, and addFontSize are ignored
                    when using the meta-font numbering.
        }
    {    Meta-font numbering - see note above   }

const
    kControlFontBigSystemFont   = -1;                           {  force to big system font }
    kControlFontSmallSystemFont = -2;                           {  force to small system font }
    kControlFontSmallBoldSystemFont = -3;                       {  force to small bold system font }
    kControlFontViewSystemFont  = -4;                           {  force to views system font (DataBrowser control only) }

    {    Add these masks together to set the flags field of a ControlFontStyleRec   }
    {    They specify which fields to apply to the text. It is important to make    }
    {    sure that you specify only the fields that you wish to set.                }
    kControlUseFontMask         = $0001;
    kControlUseFaceMask         = $0002;
    kControlUseSizeMask         = $0004;
    kControlUseForeColorMask    = $0008;
    kControlUseBackColorMask    = $0010;
    kControlUseModeMask         = $0020;
    kControlUseJustMask         = $0040;
    kControlUseAllMask          = $00FF;
    kControlAddFontSizeMask     = $0100;

    {    AddToMetaFont indicates that we want to start with a standard system       }
    {    font, but then we'd like to add the other attributes. Normally, the meta   }
    {    font ignores all other flags                                               }
    kControlAddToMetaFontMask   = $0200;                        {  Available in Appearance 1.1 or later }

    {    UseThemeFontID indicates that the font field of the ControlFontStyleRec    }
    {    should be interpreted as a ThemeFontID (see Appearance.h). In all other    }
    {    ways, specifying a ThemeFontID is just like using one of the control       }
    {    meta-fonts IDs.                                                            }
    kControlUseThemeFontIDMask  = $0080;                        {  Available in Mac OS X or later }


type
    ControlFontStyleRecPtr = ^ControlFontStyleRec;
    ControlFontStyleRec = record
        flags:                  SInt16;
        font:                   SInt16;
        size:                   SInt16;
        style:                  SInt16;
        mode:                   SInt16;
        just:                   SInt16;
        foreColor:              RGBColor;
        backColor:              RGBColor;
    end;

    ControlFontStylePtr                 = ^ControlFontStyleRec;
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {     ¥ Click Activation Results                                                                            }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {     These are for use with GetControlClickActivation. The enumerated values should be pretty              }
    {     self-explanatory, but just in case:                                                                   }
    {     ¥ Activate/DoNotActivate indicates whether or not to change the owning window's z-ordering before     }
    {         processing the click. If activation is requested, you may also want to immediately redraw the     }
    {         newly exposed portion of the window.                                                              }
    {     ¥ Ignore/Handle Click indicates whether or not to call an appropriate click handling API (like        }
    {         HandleControlClick) in respose to the event.                                                      }

const
    kDoNotActivateAndIgnoreClick = 0;                           {  probably never used. here for completeness. }
    kDoNotActivateAndHandleClick = 1;                           {  let the control handle the click while the window is still in the background. }
    kActivateAndIgnoreClick     = 2;                            {  control doesn't want to respond directly to the click, but window should still be brought forward. }
    kActivateAndHandleClick     = 3;                            {  control wants to respond to the click, but only after the window has been activated. }


type
    ClickActivationResult               = UInt32;
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {     ¥ Common data tags for Get/SetControlData                                                             }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }

    {
     *  Discussion:
     *    Get/SetControlData Common Tags
        }

const
    kControlFontStyleTag        = $666F6E74 (* 'font' *);
    kControlKeyFilterTag        = $666C7472 (* 'fltr' *);
    kControlKindTag             = $6B696E64 (* 'kind' *);
    kControlSizeTag             = $73697A65 (* 'size' *);

    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {     ¥ Control Feature Bits                                                                                }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
                                                                {  Control feature bits - returned by GetControlFeatures  }
    kControlSupportsGhosting    = $01;
    kControlSupportsEmbedding   = $02;
    kControlSupportsFocus       = $04;
    kControlWantsIdle           = $08;
    kControlWantsActivate       = $10;
    kControlHandlesTracking     = $20;
    kControlSupportsDataAccess  = $40;
    kControlHasSpecialBackground = $80;
    kControlGetsFocusOnClick    = $0100;
    kControlSupportsCalcBestRect = $0200;
    kControlSupportsLiveFeedback = $0400;
    kControlHasRadioBehavior    = $0800;                        {  Available in Appearance 1.0.1 or later }
    kControlSupportsDragAndDrop = $1000;                        {  Available in Carbon }
    kControlAutoToggles         = $4000;                        {  Available in Appearance 1.1 or later }
    kControlSupportsGetRegion   = $00020000;                    {  Available in Appearance 1.1 or later }
    kControlSupportsFlattening  = $00080000;                    {  Available in Carbon }
    kControlSupportsSetCursor   = $00100000;                    {  Available in Carbon }
    kControlSupportsContextualMenus = $00200000;                {  Available in Carbon }
    kControlSupportsClickActivation = $00400000;                {  Available in Carbon }
    kControlIdlesWithTimer      = $00800000;                    {  Available in Carbon - this bit indicates that the control animates automatically }

    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {     ¥ Control Messages                                                                                    }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    drawCntl                    = 0;
    testCntl                    = 1;
    calcCRgns                   = 2;
    initCntl                    = 3;                            {  Param is Collection, result is OSStatus }
    dispCntl                    = 4;
    posCntl                     = 5;
    thumbCntl                   = 6;
    dragCntl                    = 7;
    autoTrack                   = 8;
    calcCntlRgn                 = 10;
    calcThumbRgn                = 11;
    drawThumbOutline            = 12;
    kControlMsgDrawGhost        = 13;
    kControlMsgCalcBestRect     = 14;                           {  Calculate best fitting rectangle for control }
    kControlMsgHandleTracking   = 15;
    kControlMsgFocus            = 16;                           {  param indicates action. }
    kControlMsgKeyDown          = 17;
    kControlMsgIdle             = 18;
    kControlMsgGetFeatures      = 19;
    kControlMsgSetData          = 20;
    kControlMsgGetData          = 21;
    kControlMsgActivate         = 22;
    kControlMsgSetUpBackground  = 23;
    kControlMsgCalcValueFromPos = 26;
    kControlMsgTestNewMsgSupport = 27;                          {  See if this control supports new messaging }
    kControlMsgSubValueChanged  = 25;                           {  Available in Appearance 1.0.1 or later }
    kControlMsgSubControlAdded  = 28;                           {  Available in Appearance 1.0.1 or later }
    kControlMsgSubControlRemoved = 29;                          {  Available in Appearance 1.0.1 or later }
    kControlMsgApplyTextColor   = 30;                           {  Available in Appearance 1.1 or later }
    kControlMsgGetRegion        = 31;                           {  Available in Appearance 1.1 or later }
    kControlMsgFlatten          = 32;                           {  Available in Carbon. Param is Collection. }
    kControlMsgSetCursor        = 33;                           {  Available in Carbon. Param is ControlSetCursorRec }
    kControlMsgDragEnter        = 38;                           {  Available in Carbon. Param is DragRef, result is boolean indicating acceptibility of drag. }
    kControlMsgDragLeave        = 39;                           {  Available in Carbon. As above. }
    kControlMsgDragWithin       = 40;                           {  Available in Carbon. As above. }
    kControlMsgDragReceive      = 41;                           {  Available in Carbon. Param is DragRef, result is OSStatus indicating success/failure. }
    kControlMsgDisplayDebugInfo = 46;                           {  Available in Carbon on X. }
    kControlMsgContextualMenuClick = 47;                        {  Available in Carbon. Param is ControlContextualMenuClickRec }
    kControlMsgGetClickActivation = 48;                         {  Available in Carbon. Param is ControlClickActivationRec }


type
    ControlDefProcMessage               = SInt16;
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {     ¥ Control Sizes                                                                       }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }

    {
     *  Discussion:
     *    ControlSize values to be used in conjunction with SetControlData
     *    and the kControlSizeTag.
        }

const
    kControlSizeNormal          = 0;
    kControlSizeSmall           = 1;
    kControlSizeLarge           = 2;
    kControlSizeAuto            = $FFFF;


type
    ControlSize                         = UInt16;
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {     ¥ Constants for drawCntl message (passed in param)                                    }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }

const
    kDrawControlEntireControl   = 0;
    kDrawControlIndicatorOnly   = 129;

    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {     ¥ Constants for dragCntl message (passed in param)                                    }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    kDragControlEntireControl   = 0;
    kDragControlIndicator       = 1;

    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {     ¥ Drag Constraint Structure for thumbCntl message (passed in param)                   }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }

type
    IndicatorDragConstraintPtr = ^IndicatorDragConstraint;
    IndicatorDragConstraint = record
        limitRect:              Rect;
        slopRect:               Rect;
        axis:                   DragConstraint;
    end;

    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {     CDEF should return as result of kControlMsgTestNewMsgSupport                          }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }

const
    kControlSupportsNewMessages = $206F6B20 (* ' ok ' *);

    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {     This structure is passed into a CDEF when called with the kControlMsgHandleTracking   }
    {     message                                                                               }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }

type
    ControlTrackingRecPtr = ^ControlTrackingRec;
    ControlTrackingRec = record
        startPt:                Point;
        modifiers:              EventModifiers;
        action:                 ControlActionUPP;
    end;

    ControlTrackingPtr                  = ^ControlTrackingRec;
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {    This structure is passed into a CDEF when called with the kControlMsgKeyDown message   }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    ControlKeyDownRecPtr = ^ControlKeyDownRec;
    ControlKeyDownRec = record
        modifiers:              EventModifiers;
        keyCode:                SInt16;
        charCode:               SInt16;
    end;

    ControlKeyDownPtr                   = ^ControlKeyDownRec;
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {    This structure is passed into a CDEF when called with the kControlMsgGetData or        }
    {    kControlMsgSetData message                                                             }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    ControlDataAccessRecPtr = ^ControlDataAccessRec;
    ControlDataAccessRec = record
        tag:                    ResType;
        part:                   ResType;
        size:                   Size;
        dataPtr:                Ptr;
    end;

    ControlDataAccessPtr                = ^ControlDataAccessRec;
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {    This structure is passed into a CDEF when called with the kControlCalcBestRect msg     }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    ControlCalcSizeRecPtr = ^ControlCalcSizeRec;
    ControlCalcSizeRec = record
        height:                 SInt16;
        width:                  SInt16;
        baseLine:               SInt16;
    end;

    ControlCalcSizePtr                  = ^ControlCalcSizeRec;
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {    This structure is passed into a CDEF when called with the kControlMsgSetUpBackground   }
    {    message is sent                                                                        }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    ControlBackgroundRecPtr = ^ControlBackgroundRec;
    ControlBackgroundRec = record
        depth:                  SInt16;
        colorDevice:            boolean;
    end;

    ControlBackgroundPtr                = ^ControlBackgroundRec;
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {    This structure is passed into a CDEF when called with the kControlMsgApplyTextColor    }
    {    message is sent                                                                        }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    ControlApplyTextColorRecPtr = ^ControlApplyTextColorRec;
    ControlApplyTextColorRec = record
        depth:                  SInt16;
        colorDevice:            boolean;
        active:                 boolean;
    end;

    ControlApplyTextColorPtr            = ^ControlApplyTextColorRec;
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {    This structure is passed into a CDEF when called with the kControlMsgGetRegion         }
    {    message is sent                                                                        }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    ControlGetRegionRecPtr = ^ControlGetRegionRec;
    ControlGetRegionRec = record
        region:                 RgnHandle;
        part:                   ControlPartCode;
    end;

    ControlGetRegionPtr                 = ^ControlGetRegionRec;
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {    This structure is passed into a CDEF when the kControlMsgSetCursor message is sent     }
    {    Only sent on Carbon                                                                    }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    ControlSetCursorRecPtr = ^ControlSetCursorRec;
    ControlSetCursorRec = record
        localPoint:             Point;
        modifiers:              EventModifiers;
        cursorWasSet:           boolean;                                {  your CDEF must set this to true if you set the cursor, or false otherwise }
    end;

    ControlSetCursorPtr                 = ^ControlSetCursorRec;
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {    This structure is passed into a CDEF when the kControlMsgContextualMenuClick message   }
    {    is sent                                                                                }
    {    Only sent on Carbon                                                                    }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    ControlContextualMenuClickRecPtr = ^ControlContextualMenuClickRec;
    ControlContextualMenuClickRec = record
        localPoint:             Point;
        menuDisplayed:          boolean;                                {  your CDEF must set this to true if you displayed a menu, or false otherwise }
    end;

    ControlContextualMenuClickPtr       = ^ControlContextualMenuClickRec;
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {    This structure is passed into a CDEF when the kControlMsgGetClickActivation message    }
    {    is sent                                                                                }
    {    Only sent on Carbon                                                                    }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    ControlClickActivationRecPtr = ^ControlClickActivationRec;
    ControlClickActivationRec = record
        localPoint:             Point;
        modifiers:              EventModifiers;
        result:                 ClickActivationResult;                  {  your CDEF must pass the desired result back }
    end;

    ControlClickActivationPtr           = ^ControlClickActivationRec;
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {     ¥ ÔCDEFÕ entrypoint                                                                   }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    ControlDefProcPtr = function(varCode: SInt16; theControl: ControlRef; message: ControlDefProcMessage; param: SInt32): SInt32;

    ControlDefUPP = ^SInt32; { an opaque UPP }

const
    uppControlDefProcInfo = $00003BB0;
    {
     *  NewControlDefUPP()
     *
     *  Availability:
     *    Non-Carbon CFM:   available as macro/inline
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function NewControlDefUPP(userRoutine: ControlDefProcPtr): ControlDefUPP; external name '_NewControlDefUPP'; { old name was NewControlDefProc }
{
 *  DisposeControlDefUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeControlDefUPP(userUPP: ControlDefUPP); external name '_DisposeControlDefUPP';
{
 *  InvokeControlDefUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeControlDefUPP(varCode: SInt16; theControl: ControlRef; message: ControlDefProcMessage; param: SInt32; userRoutine: ControlDefUPP): SInt32; external name '_InvokeControlDefUPP'; { old name was CallControlDefProc }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{  Control Key Filter                                                                  }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{ Certain controls can have a keyfilter attached to them.                              }
{ Definition of a key filter for intercepting and possibly changing keystrokes         }
{ which are destined for a control.                                                    }
{ Key Filter Result Codes                                                          }
{ The filter proc should return one of the two constants below. If                 }
{ kKeyFilterBlockKey is returned, the key is blocked and never makes it to the     }
{ control. If kKeyFilterPassKey is returned, the control receives the keystroke.   }

const
    kControlKeyFilterBlockKey   = 0;
    kControlKeyFilterPassKey    = 1;


type
    ControlKeyFilterResult              = SInt16;
    ControlKeyFilterProcPtr = function(theControl: ControlRef; var keyCode: SInt16; var charCode: SInt16; var modifiers: EventModifiers): ControlKeyFilterResult;

    ControlKeyFilterUPP = ^SInt32; { an opaque UPP }

const
    uppControlKeyFilterProcInfo = $00003FE0;
    {
     *  NewControlKeyFilterUPP()
     *
     *  Availability:
     *    Non-Carbon CFM:   available as macro/inline
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function NewControlKeyFilterUPP(userRoutine: ControlKeyFilterProcPtr): ControlKeyFilterUPP; external name '_NewControlKeyFilterUPP'; { old name was NewControlKeyFilterProc }
{
 *  DisposeControlKeyFilterUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeControlKeyFilterUPP(userUPP: ControlKeyFilterUPP); external name '_DisposeControlKeyFilterUPP';
{
 *  InvokeControlKeyFilterUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeControlKeyFilterUPP(theControl: ControlRef; var keyCode: SInt16; var charCode: SInt16; var modifiers: EventModifiers; userRoutine: ControlKeyFilterUPP): ControlKeyFilterResult; external name '_InvokeControlKeyFilterUPP'; { old name was CallControlKeyFilterProc }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{  ¥ DragGrayRgn Constatns                                                             }
{                                                                                      }
{   For DragGrayRgnUPP used in TrackControl()                                          }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}

const
    noConstraint                = 0;
    hAxisOnly                   = 1;
    vAxisOnly                   = 2;

    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {     ¥ Control Creation/Deletion/Persistence                                               }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {     CreateCustomControl is only available as part of Carbon                               }
    kControlDefProcPtr          = 0;                            {  raw proc-ptr based access }
    kControlDefObjectClass      = 1;                            {  event-based definition (Mac OS X only) }


type
    ControlDefType                      = UInt32;
    ControlDefSpecPtr = ^ControlDefSpec;
    ControlDefSpec = record
        defType:                ControlDefType;
        case SInt16 of
        0: (
            defProc:            ControlDefUPP;
            );
        1: (
            classRef:           Ptr;
            );
    end;

    {
     *  CreateCustomControl()
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function CreateCustomControl(owningWindow: WindowRef; const (*var*) contBounds: Rect; const (*var*) def: ControlDefSpec; initData: Collection; var outControl: ControlRef): OSStatus; external name '_CreateCustomControl';

{
 *  NewControl()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewControl(owningWindow: WindowRef; const (*var*) boundsRect: Rect; const (*var*) controlTitle: Str255; initiallyVisible: boolean; initialValue: SInt16; minimumValue: SInt16; maximumValue: SInt16; procID: SInt16; controlReference: SInt32): ControlRef; external name '_NewControl';
{
 *  GetNewControl()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetNewControl(resourceID: SInt16; owningWindow: WindowRef): ControlRef; external name '_GetNewControl';
{
 *  DisposeControl()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeControl(theControl: ControlRef); external name '_DisposeControl';
{
 *  KillControls()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure KillControls(theWindow: WindowRef); external name '_KillControls';
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{  ¥ Control Definition Registration                                                   }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}

type
    ControlCNTLToCollectionProcPtr = function(const (*var*) bounds: Rect; value: SInt16; visible: boolean; max: SInt16; min: SInt16; procID: SInt16; refCon: SInt32; title: Str255; collection: Collection): OSStatus;

    ControlCNTLToCollectionUPP = ^SInt32; { an opaque UPP }

const
    uppControlCNTLToCollectionProcInfo = $00FEA6F0;
    {
     *  NewControlCNTLToCollectionUPP()
     *
     *  Availability:
     *    Non-Carbon CFM:   available as macro/inline
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function NewControlCNTLToCollectionUPP(userRoutine: ControlCNTLToCollectionProcPtr): ControlCNTLToCollectionUPP; external name '_NewControlCNTLToCollectionUPP'; { old name was NewControlCNTLToCollectionProc }
{
 *  DisposeControlCNTLToCollectionUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeControlCNTLToCollectionUPP(userUPP: ControlCNTLToCollectionUPP); external name '_DisposeControlCNTLToCollectionUPP';
{
 *  InvokeControlCNTLToCollectionUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeControlCNTLToCollectionUPP(const (*var*) bounds: Rect; value: SInt16; visible: boolean; max: SInt16; min: SInt16; procID: SInt16; refCon: SInt32; const (*var*) title: Str255; collection: Collection; userRoutine: ControlCNTLToCollectionUPP): OSStatus; external name '_InvokeControlCNTLToCollectionUPP'; { old name was CallControlCNTLToCollectionProc }
{
 *  RegisterControlDefinition()
 *
 *  Summary:
 *    Associates or dissociates a control definition with a virtual
 *    CDEF resource ID.
 *
 *  Discussion:
 *    In GetNewControl or NewControl on Carbon, the Control Manager
 *    needs to know how to map the procID to a ControlDefSpec. With
 *    RegisterControlDefinition, your application can inform the
 *    Control Manager which ControlDefSpec to call when it sees a
 *    request to use a 'CDEF' of a particular resource ID. Since custom
 *    control definitions receive their initialization data in a
 *    Collection passed in the 'param' parameter, you must also provide
 *    a procedure to convert the bounds, min, max, and other parameters
 *    to NewControl into a Collection. If you don't provide a
 *    conversion proc, your control will receive an empty collection
 *    when it is sent the initialization message. If you want the
 *    value, min, visibility, etc. to be given to the control, you must
 *    add the appropriate tagged data to the collection. See the
 *    Control Collection Tags above. If you want to unregister a
 *    ControlDefSpec that you have already registered, call
 *    RegisterControlDefinition with the same CDEF resource ID, but
 *    pass NULL for the inControlDef parameter. In this situation,
 *    inConversionProc is effectively ignored.
 *
 *  Parameters:
 *
 *    inCDEFResID:
 *      The virtual CDEF resource ID to which you'd like to associate
 *      or dissociate the control definition.
 *
 *    inControlDef:
 *      A pointer to a ControlDefSpec which represents the control
 *      definition you want to register, or NULL if you are attempting
 *      to unregister a control definition.
 *
 *    inConversionProc:
 *      The conversion proc which will translate the NewControl
 *      parameters into a Collection.
 *
 *  Result:
 *    An OSStatus code indicating success or failure.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function RegisterControlDefinition(inCDEFResID: SInt16; const (*var*) inControlDef: ControlDefSpec; inConversionProc: ControlCNTLToCollectionUPP): OSStatus; external name '_RegisterControlDefinition';



{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{  ¥ Control Visible State                                                             }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{
 *  HiliteControl()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure HiliteControl(theControl: ControlRef; hiliteState: ControlPartCode); external name '_HiliteControl';
{
 *  ShowControl()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure ShowControl(theControl: ControlRef); external name '_ShowControl';
{
 *  HideControl()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure HideControl(theControl: ControlRef); external name '_HideControl';
{  following state routines available only with Appearance 1.0 and later }
{
 *  IsControlActive()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function IsControlActive(inControl: ControlRef): boolean; external name '_IsControlActive';
{
 *  IsControlVisible()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function IsControlVisible(inControl: ControlRef): boolean; external name '_IsControlVisible';
{
 *  ActivateControl()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ActivateControl(inControl: ControlRef): OSErr; external name '_ActivateControl';
{
 *  DeactivateControl()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DeactivateControl(inControl: ControlRef): OSErr; external name '_DeactivateControl';
{
 *  SetControlVisibility()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetControlVisibility(inControl: ControlRef; inIsVisible: boolean; inDoDraw: boolean): OSErr; external name '_SetControlVisibility';
{  following state routines available only on Mac OS X and later }
{
 *  IsControlEnabled()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function IsControlEnabled(inControl: ControlRef): boolean; external name '_IsControlEnabled';

{
 *  EnableControl()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function EnableControl(inControl: ControlRef): OSStatus; external name '_EnableControl';

{
 *  DisableControl()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DisableControl(inControl: ControlRef): OSStatus; external name '_DisableControl';

{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{  ¥ Control Imaging                                                                   }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{
 *  DrawControls()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DrawControls(theWindow: WindowRef); external name '_DrawControls';
{
 *  Draw1Control()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure Draw1Control(theControl: ControlRef); external name '_Draw1Control';
{
 *  UpdateControls()
 *
 *  Summary:
 *    Redraws the controls that intersect a specified region in a
 *    window.
 *
 *  Parameters:
 *
 *    inWindow:
 *      The window whose controls to redraw.
 *
 *    inUpdateRegion:
 *      The region (in local coordinates) describing which controls to
 *      redraw. In Mac OS 10.1 and later, and in CarbonLib 1.5 and
 *      later, you may pass NULL for this parameter to redraw the
 *      controls intersecting the visible region of the window.
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure UpdateControls(inWindow: WindowRef; inUpdateRegion: RgnHandle); external name '_UpdateControls';
{  following imaging routines available only with Appearance 1.0 and later }
{
 *  GetBestControlRect()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetBestControlRect(inControl: ControlRef; var outRect: Rect; var outBaseLineOffset: SInt16): OSErr; external name '_GetBestControlRect';
{
 *  SetControlFontStyle()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetControlFontStyle(inControl: ControlRef; const (*var*) inStyle: ControlFontStyleRec): OSErr; external name '_SetControlFontStyle';
{
 *  DrawControlInCurrentPort()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DrawControlInCurrentPort(inControl: ControlRef); external name '_DrawControlInCurrentPort';
{
 *  SetUpControlBackground()
 *
 *  Summary:
 *    Applies the proper background color for the given control to the
 *    current port.
 *
 *  Discussion:
 *    An embedding-savvy control which erases before drawing must
 *    ensure that its background color properly matches the body color
 *    of any parent controls on top of which it draws. This routine
 *    asks the Control Manager to determine and apply the proper
 *    background color to the current port. If a ControlColorProc has
 *    been provided for the given control, the proc will be called to
 *    set up the background color. If no proc exists, or if the proc
 *    returns a value other than noErr, the Control Manager ascends the
 *    parent chain for the given control looking for a control which
 *    has a special background (see the kControlHasSpecialBackground
 *    feature bit). The first such parent is asked to set up the
 *    background color (see the kControlMsgSetUpBackground message). If
 *    no such parent exists, the Control Manager applies any ThemeBrush
 *    which has been associated with the owning window (see
 *    SetThemeWindowBackground). Available in Appearance 1.0 (Mac OS
 *    8), CarbonLib 1.0, Mac OS X, and later.
 *
 *  Parameters:
 *
 *    inControl:
 *      The ControlRef that wants to erase.
 *
 *    inDepth:
 *      A short SInt16 indicating the color depth of the device onto
 *      which drawing will take place.
 *
 *    inIsColorDevice:
 *      A Boolean indicating whether the draw device is a color device.
 *
 *  Result:
 *    An OSStatus code indicating success or failure. The most likely
 *    error is a controlHandleInvalidErr, resulting from a bad
 *    ControlRef. Any non-noErr result indicates that the color set up
 *    failed, and that the caller should probably give up its attempt
 *    to draw.
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetUpControlBackground(inControl: ControlRef; inDepth: SInt16; inIsColorDevice: boolean): OSErr; external name '_SetUpControlBackground';
{
 *  SetUpControlTextColor()
 *
 *  Summary:
 *    Applies the proper text color for the given control to the
 *    current port.
 *
 *  Discussion:
 *    An embedding-savvy control which draws text must ensure that its
 *    text color properly contrasts the background on which it draws.
 *    This routine asks the Control Manager to determine and apply the
 *    proper text color to the current port. If a ControlColorProc has
 *    been provided for the given control, the proc will be called to
 *    set up the text color. If no proc exists, or if the proc returns
 *    a value other than noErr, the Control Manager ascends the parent
 *    chain for the given control looking for a control which has a
 *    special background (see the kControlHasSpecialBackground feature
 *    bit). The first such parent is asked to set up the text color
 *    (see the kControlMsgApplyTextColor message). If no such parent
 *    exists, the Control Manager chooses a text color which contrasts
 *    any ThemeBrush which has been associated with the owning window
 *    (see SetThemeWindowBackground). Available in Appearance 1.1 (Mac
 *    OS 8.5), CarbonLib 1.0, Mac OS X, and later.
 *
 *  Parameters:
 *
 *    inControl:
 *      The ControlRef that wants to draw text.
 *
 *    inDepth:
 *      A short SInt16 indicating the color depth of the device onto
 *      which drawing will take place.
 *
 *    inIsColorDevice:
 *      A Boolean indicating whether the draw device is a color device.
 *
 *  Result:
 *    An OSStatus code indicating success or failure. The most likely
 *    error is a controlHandleInvalidErr, resulting from a bad
 *    ControlRef. Any non-noErr result indicates that the color set up
 *    failed, and that the caller should probably give up its attempt
 *    to draw.
 *
 *  Availability:
 *    Non-Carbon CFM:   in ControlsLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetUpControlTextColor(inControl: ControlRef; inDepth: SInt16; inIsColorDevice: boolean): OSErr; external name '_SetUpControlTextColor';



{
 *  ControlColorProcPtr
 *
 *  Discussion:
 *    Callback allowing clients to specify/override the background
 *    color and text color that a Control will use during drawing. Your
 *    procedure should make the color changes to the current port. See
 *    SetControlColorProc, SetUpControlBackground, and
 *    SetUpControlTextColor for more information. Available on Mac OS
 *    8.5, CarbonLib 1.1, Mac OS X, and later.
 *
 *  Parameters:
 *
 *    inControl:
 *      A reference to the Control for whom your proc is setting up
 *      colors.
 *
 *    inMessage:
 *      A ControlDefProcMessage indicating what sort of color your
 *      procedure should set up. It will be either
 *      kControlMsgApplyTextColor or kControlMsgSetUpBackground.
 *      kControlMsgApplyTextColor is a request to set up the
 *      appropriate text color (by setting the current port's
 *      foreground color, pen information, etc.).
 *      kControlMsgSetUpBackground is a request to set up the
 *      appropriate background color (the current port's background
 *      color, pattern, etc.).
 *
 *    inDrawDepth:
 *      A short SInt16 indicating the bit depth of the device into
 *      which the Control is drawing. The bit depth is typically passed
 *      in as a result of someone someone trying to draw properly
 *      across multiple monitors with different bit depths. If your
 *      procedure wants to handle proper color set up based on bit
 *      depth, it should use this parameter to help decide what color
 *      to apply.
 *
 *    inDrawInColor:
 *      A Boolean indicating whether or not the device that the Control
 *      is drawing into is a color device. The value is typically
 *      passed in as a result of someone trying to draw properly across
 *      multiple monitors which may or may not be color devices. If
 *      your procedure wants to handle proper color set up for both
 *      color and grayscale devices, it should use this parameter to
 *      help decide what color to apply.
 *
 *  Result:
 *    An OSStatus code indicating success or failure. Returning noErr
 *    is an indication that your proc completely handled the color set
 *    up. If you return any other value, the Control Manager will fall
 *    back to the normal color set up mechanism.
 }

type
    ControlColorProcPtr = function(inControl: ControlRef; inMessage: SInt16; inDrawDepth: SInt16; inDrawInColor: boolean): OSStatus;

    ControlColorUPP = ^SInt32; { an opaque UPP }

const
    uppControlColorProcInfo = $00001AF0;
    {
     *  NewControlColorUPP()
     *
     *  Availability:
     *    Non-Carbon CFM:   available as macro/inline
     *    CarbonLib:        in CarbonLib 1.1 and later
     *    Mac OS X:         in version 10.0 and later
        }
function NewControlColorUPP(userRoutine: ControlColorProcPtr): ControlColorUPP; external name '_NewControlColorUPP'; { old name was NewControlColorProc }
{
 *  DisposeControlColorUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeControlColorUPP(userUPP: ControlColorUPP); external name '_DisposeControlColorUPP';
{
 *  InvokeControlColorUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeControlColorUPP(inControl: ControlRef; inMessage: SInt16; inDrawDepth: SInt16; inDrawInColor: boolean; userRoutine: ControlColorUPP): OSStatus; external name '_InvokeControlColorUPP'; { old name was CallControlColorProc }
{
 *  SetControlColorProc()
 *
 *  Summary:
 *    Associates a ControlColorUPP with a given Control, thereby
 *    allowing you to bypass the embedding hierarchy-based color setup
 *    of SetUpControlBackground/SetUpControlTextColor and replace it
 *    with your own.
 *
 *  Discussion:
 *    Before an embedded Control can erase, it calls
 *    SetUpControlBackground to have its background color set up by any
 *    parent controls. Similarly, any Control which draws text calls
 *    SetUpControlTextColor to have the appropriate text color set up.
 *    This allows certain controls (such as Tabs and Placards) to offer
 *    special backgrounds and text colors for any child controls. By
 *    default, the SetUp routines only move up the Control Manager
 *    embedding hierarchy looking for a parent which has a special
 *    background. This is fine in a plain vanilla embedding case, but
 *    many application frameworks find it troublesome; if there are
 *    interesting views between two Controls in the embedding
 *    hierarchy, the framework needs to be in charge of the background
 *    and text colors, otherwise drawing defects will occur. You can
 *    only associate a single color proc with a given ControlRef.
 *    Available on Mac OS 8.5, CarbonLib 1.1, Mac OS X, and later.
 *
 *  Parameters:
 *
 *    inControl:
 *      The ControlRef with whom the color proc should be associated.
 *
 *    inProc:
 *      The color proc to associate with the ControlRef. If you pass
 *      NULL, the ControlRef will be dissociated from any previously
 *      installed color proc.
 *
 *  Result:
 *    An OSStatus code indicating success or failure. The most likely
 *    error is a controlHandleInvalidErr resulting from a bad
 *    ControlRef.
 *
 *  Availability:
 *    Non-Carbon CFM:   in ControlsLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetControlColorProc(inControl: ControlRef; inProc: ControlColorUPP): OSStatus; external name '_SetControlColorProc';


{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{  ¥ Control Mousing                                                                   }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{
    NOTE ON CONTROL ACTION PROCS

    When using the TrackControl() call when tracking an indicator, the actionProc parameter
    (type ControlActionUPP) should be replaced by a parameter of type DragGrayRgnUPP
    (see Quickdraw.h).

    If, however, you are using the live feedback variants of scroll bars or sliders, you
    must pass a ControlActionUPP in when tracking the indicator as well. This functionality
    is available in Appearance 1.0 or later.
}
{
 *  TrackControl()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TrackControl(theControl: ControlRef; startPoint: Point; actionProc: ControlActionUPP): ControlPartCode; external name '_TrackControl';
{
 *  DragControl()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DragControl(theControl: ControlRef; startPoint: Point; const (*var*) limitRect: Rect; const (*var*) slopRect: Rect; axis: DragConstraint); external name '_DragControl';
{
 *  TestControl()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TestControl(theControl: ControlRef; testPoint: Point): ControlPartCode; external name '_TestControl';
{
 *  FindControl()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FindControl(testPoint: Point; theWindow: WindowRef; var theControl: ControlRef): ControlPartCode; external name '_FindControl';
{ The following mousing routines available only with Appearance 1.0 and later  }
{                                                                              }
{ HandleControlClick is preferable to TrackControl when running under          }
{ Appearance 1.0 as you can pass in modifiers, which some of the new controls  }
{ use, such as edit text and list boxes.                                       }
{ NOTE: Passing NULL for the outPart parameter of FindControlUnderMouse is only}
{       supported in systems later than 10.1.x                                 }
{
 *  FindControlUnderMouse()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FindControlUnderMouse(inWhere: Point; inWindow: WindowRef; outPart: ControlPartCodePtr): ControlRef; external name '_FindControlUnderMouse';
{
 *  HandleControlClick()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function HandleControlClick(inControl: ControlRef; inWhere: Point; inModifiers: EventModifiers; inAction: ControlActionUPP): ControlPartCode; external name '_HandleControlClick';
{ Contextual Menu support in the Control Manager is only available on Carbon.  }
{ If the control didn't display a contextual menu (possibly because the point  }
{ was in a non-interesting part), the menuDisplayed output parameter will be   }
{ false. If the control did display a menu, menuDisplayed will be true.        }
{ This in on Carbon only                                                       }
{
 *  HandleControlContextualMenuClick()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ControlsLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function HandleControlContextualMenuClick(inControl: ControlRef; inWhere: Point; var menuDisplayed: boolean): OSStatus; external name '_HandleControlContextualMenuClick';

{ Some complex controls (like Data Browser) require proper sequencing of       }
{ window activation and click processing. In some cases, the control might     }
{ want the window to be left inactive yet still handle the click, or vice-     }
{ versa. The GetControlClickActivation routine lets a control client ask the   }
{ control how it wishes to behave for a particular click.                      }
{ This in on Carbon only.                                                      }
{
 *  GetControlClickActivation()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ControlsLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetControlClickActivation(inControl: ControlRef; inWhere: Point; inModifiers: EventModifiers; var outResult: ClickActivationResult): OSStatus; external name '_GetControlClickActivation';


{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{  ¥ Control Events (available only with Appearance 1.0 and later)                     }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{
 *  HandleControlKey()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function HandleControlKey(inControl: ControlRef; inKeyCode: SInt16; inCharCode: SInt16; inModifiers: EventModifiers): ControlPartCode; external name '_HandleControlKey';
{
 *  IdleControls()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure IdleControls(inWindow: WindowRef); external name '_IdleControls';
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{ ¥ Control Mouse Tracking (available with Carbon)                                     }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{ The HandleControlSetCursor routine requests that a given control set the cursor to   }
{ something appropriate based on the mouse location.                                   }
{ If the control didn't want to set the cursor (because the point was in a             }
{ non-interesting part), the cursorWasSet output parameter will be false. If the       }
{ control did set the cursor, cursorWasSet will be true.                               }
{ Carbon only.                                                                         }
{
 *  HandleControlSetCursor()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ControlsLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function HandleControlSetCursor(control: ControlRef; localPoint: Point; modifiers: EventModifiers; var cursorWasSet: boolean): OSStatus; external name '_HandleControlSetCursor';

{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{  ¥ Control Positioning                                                               }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{
 *  MoveControl()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure MoveControl(theControl: ControlRef; h: SInt16; v: SInt16); external name '_MoveControl';
{
 *  SizeControl()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SizeControl(theControl: ControlRef; w: SInt16; h: SInt16); external name '_SizeControl';
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{  ¥ Control Title                                                                     }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{
 *  SetControlTitle()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetControlTitle(theControl: ControlRef; const (*var*) title: Str255); external name '_SetControlTitle';
{
 *  GetControlTitle()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure GetControlTitle(theControl: ControlRef; var title: Str255); external name '_GetControlTitle';
{
 *  SetControlTitleWithCFString()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetControlTitleWithCFString(inControl: ControlRef; inString: CFStringRef): OSStatus; external name '_SetControlTitleWithCFString';

{
 *  CopyControlTitleAsCFString()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CopyControlTitleAsCFString(inControl: ControlRef; var outString: CFStringRef): OSStatus; external name '_CopyControlTitleAsCFString';

{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{  ¥ Control Value                                                                     }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{
 *  GetControlValue()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetControlValue(theControl: ControlRef): SInt16; external name '_GetControlValue';
{
 *  SetControlValue()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetControlValue(theControl: ControlRef; newValue: SInt16); external name '_SetControlValue';
{
 *  GetControlMinimum()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetControlMinimum(theControl: ControlRef): SInt16; external name '_GetControlMinimum';
{
 *  SetControlMinimum()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetControlMinimum(theControl: ControlRef; newMinimum: SInt16); external name '_SetControlMinimum';
{
 *  GetControlMaximum()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetControlMaximum(theControl: ControlRef): SInt16; external name '_GetControlMaximum';
{
 *  SetControlMaximum()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetControlMaximum(theControl: ControlRef; newMaximum: SInt16); external name '_SetControlMaximum';
{  proportional scrolling/32-bit value support is new with Appearance 1.1 }

{
 *  GetControlViewSize()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ControlsLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetControlViewSize(theControl: ControlRef): SInt32; external name '_GetControlViewSize';

{
 *  SetControlViewSize()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ControlsLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetControlViewSize(theControl: ControlRef; newViewSize: SInt32); external name '_SetControlViewSize';

{
 *  GetControl32BitValue()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ControlsLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetControl32BitValue(theControl: ControlRef): SInt32; external name '_GetControl32BitValue';

{
 *  SetControl32BitValue()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ControlsLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetControl32BitValue(theControl: ControlRef; newValue: SInt32); external name '_SetControl32BitValue';

{
 *  GetControl32BitMaximum()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ControlsLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetControl32BitMaximum(theControl: ControlRef): SInt32; external name '_GetControl32BitMaximum';

{
 *  SetControl32BitMaximum()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ControlsLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetControl32BitMaximum(theControl: ControlRef; newMaximum: SInt32); external name '_SetControl32BitMaximum';

{
 *  GetControl32BitMinimum()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ControlsLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetControl32BitMinimum(theControl: ControlRef): SInt32; external name '_GetControl32BitMinimum';

{
 *  SetControl32BitMinimum()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ControlsLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetControl32BitMinimum(theControl: ControlRef; newMinimum: SInt32); external name '_SetControl32BitMinimum';

{
    IsValidControlHandle will tell you if the handle you pass in belongs to a control
    the Control Manager knows about. It does not sanity check the data in the control.
}

{
 *  IsValidControlHandle()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ControlsLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function IsValidControlHandle(theControl: ControlRef): boolean; external name '_IsValidControlHandle';

{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{ ¥ Control IDs                                                                        }
{ Carbon only.                                                                         }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}

type
    ControlIDPtr = ^ControlID;
    ControlID = record
        signature:              OSType;
        id:                     SInt32;
    end;

    {
     *  SetControlID()
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function SetControlID(inControl: ControlRef; const (*var*) inID: ControlID): OSStatus; external name '_SetControlID';

{
 *  GetControlID()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetControlID(inControl: ControlRef; var outID: ControlID): OSStatus; external name '_GetControlID';

{
 *  GetControlByID()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetControlByID(inWindow: WindowRef; const (*var*) inID: ControlID; var outControl: ControlRef): OSStatus; external name '_GetControlByID';

{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{ ¥ Control Command IDs                                                                    }
{ Carbon only.                                                                         }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{
 *  SetControlCommandID()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetControlCommandID(inControl: ControlRef; inCommandID: UInt32): OSStatus; external name '_SetControlCommandID';

{
 *  GetControlCommandID()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetControlCommandID(inControl: ControlRef; var outCommandID: UInt32): OSStatus; external name '_GetControlCommandID';

{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{ ¥ Control Identification                                                             }
{ Carbon only.                                                                         }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}

type
    ControlKindPtr = ^ControlKind;
    ControlKind = record
        signature:              OSType;
        kind:                   OSType;
    end;


    {
     *  Discussion:
     *    Control signature kind
        }

const
    kControlKindSignatureApple  = $6170706C (* 'appl' *);

    {
     *  GetControlKind()
     *
     *  Summary:
     *    Returns the kind of the given control.
     *
     *  Discussion:
     *    GetControlKind allows you to query the kind of any control. This
     *    function is only available in Mac OS X.
     *
     *  Parameters:
     *
     *    inControl:
     *      The ControlRef to find the kind of.
     *
     *    outControlKind:
     *      On successful exit, this will contain the control signature and
     *      kind. See ControlDefinitions.h for the kinds of each system
     *      control.
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.5 and later
     *    Mac OS X:         in version 10.0 and later
        }
function GetControlKind(inControl: ControlRef; var outControlKind: ControlKind): OSStatus; external name '_GetControlKind';

{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{ ¥ Properties                                                                         }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}

const
    kControlPropertyPersistent  = $00000001;                    {  whether this property gets saved when flattening the control }

    {
     *  GetControlProperty()
     *
     *  Availability:
     *    Non-Carbon CFM:   in ControlsLib 8.5 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function GetControlProperty(control: ControlRef; propertyCreator: OSType; propertyTag: OSType; bufferSize: UInt32; actualSize: UInt32Ptr; propertyBuffer: UnivPtr): OSStatus; external name '_GetControlProperty';

{
 *  GetControlPropertySize()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ControlsLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetControlPropertySize(control: ControlRef; propertyCreator: OSType; propertyTag: OSType; var size: UInt32): OSStatus; external name '_GetControlPropertySize';

{
 *  SetControlProperty()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ControlsLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetControlProperty(control: ControlRef; propertyCreator: OSType; propertyTag: OSType; propertySize: UInt32; propertyData: UnivPtr): OSStatus; external name '_SetControlProperty';

{
 *  RemoveControlProperty()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ControlsLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function RemoveControlProperty(control: ControlRef; propertyCreator: OSType; propertyTag: OSType): OSStatus; external name '_RemoveControlProperty';

{
 *  GetControlPropertyAttributes()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetControlPropertyAttributes(control: ControlRef; propertyCreator: OSType; propertyTag: OSType; var attributes: UInt32): OSStatus; external name '_GetControlPropertyAttributes';

{
 *  ChangeControlPropertyAttributes()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ChangeControlPropertyAttributes(control: ControlRef; propertyCreator: OSType; propertyTag: OSType; attributesToSet: UInt32; attributesToClear: UInt32): OSStatus; external name '_ChangeControlPropertyAttributes';

{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{  ¥ Control Regions (Appearance 1.1 or later)                                         }
{                                                                                      }
{  See the discussion on meta-parts in this header for more information                }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{
 *  GetControlRegion()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ControlsLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetControlRegion(inControl: ControlRef; inPart: ControlPartCode; outRegion: RgnHandle): OSStatus; external name '_GetControlRegion';



{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{  ¥ Control Variant                                                                   }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{
 *  GetControlVariant()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetControlVariant(theControl: ControlRef): ControlVariant; external name '_GetControlVariant';
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{  ¥ Control Action                                                                    }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{
 *  SetControlAction()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetControlAction(theControl: ControlRef; actionProc: ControlActionUPP); external name '_SetControlAction';
{
 *  GetControlAction()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetControlAction(theControl: ControlRef): ControlActionUPP; external name '_GetControlAction';
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{ ¥ Control Accessors                                                                  }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{
 *  SetControlReference()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetControlReference(theControl: ControlRef; data: SInt32); external name '_SetControlReference';
{
 *  GetControlReference()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetControlReference(theControl: ControlRef): SInt32; external name '_GetControlReference';


{
 *  SendControlMessage()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SendControlMessage(inControl: ControlRef; inMessage: SInt16; inParam: UnivPtr): SInt32; external name '_SendControlMessage';
{
 *  DumpControlHierarchy()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DumpControlHierarchy(inWindow: WindowRef; const (*var*) inDumpFile: FSSpec): OSErr; external name '_DumpControlHierarchy';
{
 *  CreateRootControl()
 *
 *  Summary:
 *    Creates a new root control for a window.
 *
 *  Parameters:
 *
 *    inWindow:
 *      The window for which to create a root control.
 *
 *    outControl:
 *      On exit, contains the window's root control. In Mac OS 10.1 and
 *      CarbonLib 1.5 and later, this parameter may be NULL if you
 *      don't need the ControlRef.
 *
 *  Result:
 *    A result code indicating success or failure. errRootAlreadyExists
 *    is returned if the window already has a root control.
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CreateRootControl(inWindow: WindowRef; outControl: ControlRefPtr): OSErr; external name '_CreateRootControl';
{
 *  GetRootControl()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetRootControl(inWindow: WindowRef; var outControl: ControlRef): OSErr; external name '_GetRootControl';
{
 *  EmbedControl()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function EmbedControl(inControl: ControlRef; inContainer: ControlRef): OSErr; external name '_EmbedControl';
{
 *  AutoEmbedControl()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function AutoEmbedControl(inControl: ControlRef; inWindow: WindowRef): OSErr; external name '_AutoEmbedControl';
{
 *  GetSuperControl()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetSuperControl(inControl: ControlRef; var outParent: ControlRef): OSErr; external name '_GetSuperControl';
{
 *  CountSubControls()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CountSubControls(inControl: ControlRef; var outNumChildren: UInt16): OSErr; external name '_CountSubControls';
{
 *  GetIndexedSubControl()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetIndexedSubControl(inControl: ControlRef; inIndex: UInt16; var outSubControl: ControlRef): OSErr; external name '_GetIndexedSubControl';
{
 *  SetControlSupervisor()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetControlSupervisor(inControl: ControlRef; inBoss: ControlRef): OSErr; external name '_SetControlSupervisor';
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{  ¥ Keyboard Focus (available only with Appearance 1.0 and later)                     }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{
 *  GetKeyboardFocus()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetKeyboardFocus(inWindow: WindowRef; var outControl: ControlRef): OSErr; external name '_GetKeyboardFocus';
{
 *  SetKeyboardFocus()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetKeyboardFocus(inWindow: WindowRef; inControl: ControlRef; inPart: ControlFocusPart): OSErr; external name '_SetKeyboardFocus';
{
 *  AdvanceKeyboardFocus()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function AdvanceKeyboardFocus(inWindow: WindowRef): OSErr; external name '_AdvanceKeyboardFocus';
{
 *  ReverseKeyboardFocus()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ReverseKeyboardFocus(inWindow: WindowRef): OSErr; external name '_ReverseKeyboardFocus';
{
 *  ClearKeyboardFocus()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ClearKeyboardFocus(inWindow: WindowRef): OSErr; external name '_ClearKeyboardFocus';
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{  ¥ Control Data (available only with Appearance 1.0 and later)                       }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}

{
 *  GetControlFeatures()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetControlFeatures(inControl: ControlRef; var outFeatures: UInt32): OSErr; external name '_GetControlFeatures';
{
 *  SetControlData()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetControlData(inControl: ControlRef; inPart: ControlPartCode; inTagName: ResType; inSize: Size; inData: UnivPtr): OSErr; external name '_SetControlData';
{
 *  GetControlData()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetControlData(inControl: ControlRef; inPart: ControlPartCode; inTagName: ResType; inBufferSize: Size; inBuffer: UnivPtr; outActualSize: SizePtr): OSErr; external name '_GetControlData';
{
 *  GetControlDataSize()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetControlDataSize(inControl: ControlRef; inPart: ControlPartCode; inTagName: ResType; var outMaxSize: Size): OSErr; external name '_GetControlDataSize';
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{  ¥ Control Drag & Drop                                                               }
{      Carbon only.                                                                    }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}

{
 *  Discussion:
 *    DragTrackingMessage values for use with HandleControlDragTracking.
 }

const
    kDragTrackingEnterControl   = 2;
    kDragTrackingInControl      = 3;
    kDragTrackingLeaveControl   = 4;


    {
     *  HandleControlDragTracking()
     *
     *  Summary:
     *    Tells a control to respond visually to a drag.
     *
     *  Discussion:
     *    Call HandleControlDragTracking when a drag is above a control in
     *    your window and you want to give that control a chance to draw
     *    appropriately in response to the drag. Note that in order for a
     *    control to have any chance of responding to this API, you must
     *    enable the control's drag and drop support with
     *    SetControlDragTrackingEnabled.
     *
     *  Parameters:
     *
     *    inControl:
     *      The control the drag is over. Most controls won't track drags
     *      unless you enable drag tracking on it with
     *      SetControlDragTrackingEnabled.
     *
     *    inMessage:
     *      A drag message indicating the state of the drag above the
     *      control. The meaning of the value you pass in must be relative
     *      to the control, not the whole window. For when the drag first
     *      enters the control, you should pass kDragTrackingEnterControl.
     *      While the drag stays within the control, pass
     *      kDragTrackingInControl. When the drag leaves the control, pass
     *      kDragTrackingLeaveControl.
     *
     *    inDrag:
     *      The drag reference that is over the control.
     *
     *    outLikesDrag:
     *      On output, this will be a boolean indicating whether the
     *      control "likes" the drag. A control "likes" the drag if the
     *      data in the drag ref can be accepted by the control. If the
     *      control does not like the drag, don't bother calling
     *      HandleControlDragReceive if the user drops the dragged object
     *      onto the control.
     *
     *  Result:
     *    A result code indicating success or failure.
     *
     *  Availability:
     *    Non-Carbon CFM:   in ControlsLib 9.0 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function HandleControlDragTracking(inControl: ControlRef; inMessage: DragTrackingMessage; inDrag: DragReference; var outLikesDrag: boolean): OSStatus; external name '_HandleControlDragTracking';


{
 *  HandleControlDragReceive()
 *
 *  Summary:
 *    Tells a control to accept the data in drag reference.
 *
 *  Discussion:
 *    Call HandleControlDragReceive when the user dropped a drag on a
 *    control in your window. This gives the control the opportunity to
 *    pull any interesting data out of the drag and insert the data
 *    into itself. Note that in order for a control to have any chance
 *    of responding to this API, you must enable the control's drag and
 *    drop support with SetControlDragTrackingEnabled.
 *
 *  Parameters:
 *
 *    inControl:
 *      The control who should accept the data. Most controls won't
 *      accept drags unless you enable drag tracking on it with
 *      SetControlDragTrackingEnabled.
 *
 *    inDrag:
 *      The drag reference that was dropped on the control.
 *
 *  Result:
 *    A result code indicating success or failure.
 *
 *  Availability:
 *    Non-Carbon CFM:   in ControlsLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function HandleControlDragReceive(inControl: ControlRef; inDrag: DragReference): OSStatus; external name '_HandleControlDragReceive';


{
 *  SetControlDragTrackingEnabled()
 *
 *  Summary:
 *    Tells a control that it should track and receive drags.
 *
 *  Discussion:
 *    Call SetControlDragTrackingEnabled to turn enable a control's
 *    support for drag and drop. Controls won't track drags unless you
 *    first turn on drag and drop support with this API. Some controls
 *    don't support drag and drop at all; these controls won't track or
 *    receive drags even if you call this API with true.
 *
 *  Parameters:
 *
 *    inControl:
 *      The control whose drag tracking enabled state you'd like to set.
 *
 *    inTracks:
 *      A Boolean indicating whether you want this control to track and
 *      receive drags.
 *
 *  Result:
 *    A result code indicating success or failure.
 *
 *  Availability:
 *    Non-Carbon CFM:   in ControlsLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetControlDragTrackingEnabled(inControl: ControlRef; inTracks: boolean): OSStatus; external name '_SetControlDragTrackingEnabled';


{
 *  IsControlDragTrackingEnabled()
 *
 *  Summary:
 *    Tells you whether a control's drag track and receive support is
 *    enabled.
 *
 *  Discussion:
 *    Call IsControlDragTrackingEnabled to query a whether a control's
 *    drag and drop support is enabled. Some controls don't support
 *    drag and drop at all; these controls won't track or receive drags
 *    even if you call this API and see a true output value.
 *
 *  Parameters:
 *
 *    inControl:
 *      The control whose drag tracking enabled state you'd like to
 *      query.
 *
 *    outTracks:
 *      On output, this will contain a Boolean value whether the
 *      control's drag and drop support is enabled.
 *
 *  Result:
 *    A result code indicating success or failure.
 *
 *  Availability:
 *    Non-Carbon CFM:   in ControlsLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function IsControlDragTrackingEnabled(inControl: ControlRef; var outTracks: boolean): OSStatus; external name '_IsControlDragTrackingEnabled';


{
 *  SetAutomaticControlDragTrackingEnabledForWindow()
 *
 *  Summary:
 *    Enables or disables the Control Manager's automatic drag tracking
 *    for a given window.
 *
 *  Discussion:
 *    Call SetAutomaticControlDragTrackingEnabledForWindow to turn on
 *    or off the Control Manager's automatic drag tracking support for
 *    a given window. By default, your application code is responsible
 *    for installing drag tracking and receive handlers on a given
 *    window. The Control Manager, however, has support for
 *    automatically tracking and receiving drags over controls. The
 *    Control Manager will detect the control the drag is over and call
 *    HandleControlDragTracking and HandleControlDragReceive
 *    appropriately. By default, this automatic support is turned off.
 *    You can turn on this support by calling
 *    SetAutomaticControlDragTrackingEnabledForWindow with true. Note
 *    that earlier versions of system software incorrectly enable this
 *    support by default; do not rely on this buggy behavior. As of Mac
 *    OS 10.1.3, Mac OS 9.2, and CarbonLib 1.4, the buggy behavior is
 *    fixed, and you must call this routine with true to enable
 *    automatic drag tracking.
 *
 *  Parameters:
 *
 *    inWindow:
 *      The window for which you'd like to enable or disable the
 *      Control Manager's automatic drag tracking support.
 *
 *    inTracks:
 *      A Boolean value indicating whether you want to enable the
 *      Control Manager's automatic drag tracking support.
 *
 *  Result:
 *    A result code indicating success or failure.
 *
 *  Availability:
 *    Non-Carbon CFM:   in ControlsLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetAutomaticControlDragTrackingEnabledForWindow(inWindow: WindowRef; inTracks: boolean): OSStatus; external name '_SetAutomaticControlDragTrackingEnabledForWindow';


{
 *  IsAutomaticControlDragTrackingEnabledForWindow()
 *
 *  Summary:
 *    Tells you whether the Control Manager's automatic drag tracking
 *    is enabled for a given window.
 *
 *  Discussion:
 *    Call IsAutomaticControlDragTrackingEnabledForWindow to query the
 *    enabled state of the Control Manager's automatic drag tracking
 *    support for a given window. See the information on
 *    SetAutomaticControlDragTrackingEnabledForWindow for more details.
 *
 *  Parameters:
 *
 *    inWindow:
 *      The window whose Control Manager automatic drag tracking enable
 *      state you'd like to query.
 *
 *    outTracks:
 *      On output, this will contain a Boolean value whether the
 *      Control Manager's automatic drag tracking is enabled.
 *
 *  Result:
 *    A result code indicating success or failure.
 *
 *  Availability:
 *    Non-Carbon CFM:   in ControlsLib 9.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function IsAutomaticControlDragTrackingEnabledForWindow(inWindow: WindowRef; var outTracks: boolean): OSStatus; external name '_IsAutomaticControlDragTrackingEnabledForWindow';





{ Getters }
{
 *  GetControlBounds()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetControlBounds(control: ControlRef; var bounds: Rect): RectPtr; external name '_GetControlBounds';

{
 *  IsControlHilited()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function IsControlHilited(control: ControlRef): boolean; external name '_IsControlHilited';

{
 *  GetControlHilite()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetControlHilite(control: ControlRef): UInt16; external name '_GetControlHilite';

{
 *  GetControlOwner()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetControlOwner(control: ControlRef): WindowRef; external name '_GetControlOwner';

{
 *  GetControlDataHandle()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetControlDataHandle(control: ControlRef): Handle; external name '_GetControlDataHandle';

{
 *  GetControlPopupMenuHandle()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetControlPopupMenuHandle(control: ControlRef): MenuRef; external name '_GetControlPopupMenuHandle';

{
 *  GetControlPopupMenuID()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetControlPopupMenuID(control: ControlRef): SInt16; external name '_GetControlPopupMenuID';

{ Setters }
{
 *  SetControlDataHandle()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetControlDataHandle(control: ControlRef; dataHandle: Handle); external name '_SetControlDataHandle';

{
 *  SetControlBounds()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetControlBounds(control: ControlRef; const (*var*) bounds: Rect); external name '_SetControlBounds';

{
 *  SetControlPopupMenuHandle()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetControlPopupMenuHandle(control: ControlRef; popupMenu: MenuRef); external name '_SetControlPopupMenuHandle';

{
 *  SetControlPopupMenuID()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetControlPopupMenuID(control: ControlRef; menuID: SInt16); external name '_SetControlPopupMenuID';




{$ALIGN MAC68K}
{#POP}
{unit Dictionary}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN POWER}
{#LibExport+}

{
=============================================================================================
 Modern Dictionary Manager
=============================================================================================
}
{
    Dictionary information
}

const
    kDictionaryFileType         = $64696374 (* 'dict' *);
    kDCMDictionaryHeaderSignature = $64696374 (* 'dict' *);
    kDCMDictionaryHeaderVersion = 2;

    kDCMAnyFieldTag             = $2A2A2A2A (* '****' *);
    kDCMAnyFieldType            = $2A2A2A2A (* '****' *);

    {
        Contents of a Field Info Record (an AERecord)
        }
    keyDCMFieldTag              = $66746167 (* 'ftag' *);                       {  typeEnumeration  }
    keyDCMFieldType             = $66747970 (* 'ftyp' *);                       {  typeEnumeration  }
    keyDCMMaxRecordSize         = $6D72737A (* 'mrsz' *);                       {  typeMagnitude  }
    keyDCMFieldAttributes       = $66617472 (* 'fatr' *);
    keyDCMFieldDefaultData      = $66646566 (* 'fdef' *);
    keyDCMFieldName             = $666E616D (* 'fnam' *);                       {  typeChar  }
    keyDCMFieldFindMethods      = $66666E64 (* 'ffnd' *);                       {  typeAEList of typeDCMFindMethod  }

    {
        Special types for fields of a Field Info Record
        }
    typeDCMFieldAttributes      = $66617472 (* 'fatr' *);
    typeDCMFindMethod           = $666D7468 (* 'fmth' *);


    {
        Field attributes
        }
    kDCMIndexedFieldMask        = $00000001;
    kDCMRequiredFieldMask       = $00000002;
    kDCMIdentifyFieldMask       = $00000004;
    kDCMFixedSizeFieldMask      = $00000008;
    kDCMHiddenFieldMask         = $80000000;


type
    DCMFieldAttributes                  = OptionBits;
    {
        Standard dictionary properties
        }

const
    pDCMAccessMethod            = $616D7464 (* 'amtd' *);                       {  data type: typeChar ReadOnly  }
    pDCMPermission              = $7065726D (* 'perm' *);                       {  data type: typeUInt16  }
    pDCMListing                 = $6C697374 (* 'list' *);                       {  data type: typeUInt16  }
    pDCMMaintenance             = $6D746E63 (* 'mtnc' *);                       {  data type: typeUInt16  }
    pDCMLocale                  = $6C6F636C (* 'locl' *);                       {  data type: typeUInt32.  Optional; default = kLocaleIdentifierWildCard  }
    pDCMClass                   = $70636C73 (* 'pcls' *);                       {  data type: typeUInt16  }
    pDCMCopyright               = $696E666F (* 'info' *);                       {  data type: typeChar  }

    {
        pDCMPermission property constants
        }
    kDCMReadOnlyDictionary      = 0;
    kDCMReadWriteDictionary     = 1;

    {
        pDCMListing property constants
        }
    kDCMAllowListing            = 0;
    kDCMProhibitListing         = 1;

    {
        pDCMClass property constants
        }
    kDCMUserDictionaryClass     = 0;
    kDCMSpecificDictionaryClass = 1;
    kDCMBasicDictionaryClass    = 2;

    {
        Standard search method
        }
    kDCMFindMethodExactMatch    = $3D202020 (* '=   ' *);
    kDCMFindMethodBeginningMatch = $62677774 (* 'bgwt' *);
    kDCMFindMethodContainsMatch = $636F6E74 (* 'cont' *);
    kDCMFindMethodEndingMatch   = $656E6473 (* 'ends' *);
    kDCMFindMethodForwardTrie   = $66747269 (* 'ftri' *);                       {  used for morphological analysis }
    kDCMFindMethodBackwardTrie  = $62747269 (* 'btri' *);                       {  used for morphological analysis }


type
    DCMFindMethod                       = OSType;
    {
        AccessMethod features
        }

const
    kDCMCanUseFileDictionaryMask = $00000001;
    kDCMCanUseMemoryDictionaryMask = $00000002;
    kDCMCanStreamDictionaryMask = $00000004;
    kDCMCanHaveMultipleIndexMask = $00000008;
    kDCMCanModifyDictionaryMask = $00000010;
    kDCMCanCreateDictionaryMask = $00000020;
    kDCMCanAddDictionaryFieldMask = $00000040;
    kDCMCanUseTransactionMask   = $00000080;


type
    DCMAccessMethodFeature              = OptionBits;
    DCMUniqueID                         = UInt32;
    DCMObjectID    = ^SInt32; { an opaque 32-bit type }
    DCMObjectIDPtr = ^DCMObjectID;  { when a var xx:DCMObjectID parameter can be nil, it is changed to xx: DCMObjectIDPtr }
    DCMAccessMethodID                   = DCMObjectID;
    DCMDictionaryID                     = DCMObjectID;
    DCMObjectRef    = ^SInt32; { an opaque 32-bit type }
    DCMObjectRefPtr = ^DCMObjectRef;  { when a var xx:DCMObjectRef parameter can be nil, it is changed to xx: DCMObjectRefPtr }
    DCMDictionaryRef                    = DCMObjectRef;
    DCMDictionaryStreamRef              = DCMObjectRef;
    DCMObjectIterator    = ^SInt32; { an opaque 32-bit type }
    DCMObjectIteratorPtr = ^DCMObjectIterator;  { when a var xx:DCMObjectIterator parameter can be nil, it is changed to xx: DCMObjectIteratorPtr }
    DCMAccessMethodIterator             = DCMObjectIterator;
    DCMDictionaryIterator               = DCMObjectIterator;
    DCMFoundRecordIterator    = ^SInt32; { an opaque 32-bit type }
    DCMFoundRecordIteratorPtr = ^DCMFoundRecordIterator;  { when a var xx:DCMFoundRecordIterator parameter can be nil, it is changed to xx: DCMFoundRecordIteratorPtr }
    {
        Field specification declarations
        }
    DCMFieldTag                         = DescType;
    DCMFieldTagPtr                          = ^DCMFieldTag;
    DCMFieldType                        = DescType;
    {
        Dictionary header information
        }
    DCMDictionaryHeaderPtr = ^DCMDictionaryHeader;
    DCMDictionaryHeader = record
        headerSignature:        FourCharCode;
        headerVersion:          UInt32;
        headerSize:             ByteCount;
        accessMethod:           Str63;
    end;

    {
        Callback routines
        }
    DCMProgressFilterProcPtr = function(determinateProcess: boolean; percentageComplete: UInt16; callbackUD: UInt32): boolean;

    DCMProgressFilterUPP = ^SInt32; { an opaque UPP }

const
    uppDCMProgressFilterProcInfo = $00000E50;

{
    Library version
}
{
 *  DCMLibraryVersion()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DictionaryMgrLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DCMLibraryVersion: UInt32; external name '_DCMLibraryVersion';

{
    Create/delete dictionary
}
{
 *  DCMNewDictionary()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DictionaryMgrLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DCMNewDictionary(accessMethodID: DCMAccessMethodID; const (*var*) newDictionaryFile: FSSpec; scriptTag: ScriptCode; const (*var*) listOfFieldInfoRecords: AEDesc; invisible: boolean; recordCapacity: ItemCount; var newDictionary: DCMDictionaryID): OSStatus; external name '_DCMNewDictionary';

{
 *  DCMDeriveNewDictionary()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DictionaryMgrLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DCMDeriveNewDictionary(srcDictionary: DCMDictionaryID; const (*var*) newDictionaryFile: FSSpec; scriptTag: ScriptCode; invisible: boolean; recordCapacity: ItemCount; var newDictionary: DCMDictionaryID): OSStatus; external name '_DCMDeriveNewDictionary';

{
 *  DCMDeleteDictionary()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DictionaryMgrLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DCMDeleteDictionary(dictionaryID: DCMDictionaryID): OSStatus; external name '_DCMDeleteDictionary';

{
    Register dictionary
}
{
 *  DCMRegisterDictionaryFile()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DictionaryMgrLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DCMRegisterDictionaryFile(const (*var*) dictionaryFile: FSSpec; var dictionaryID: DCMDictionaryID): OSStatus; external name '_DCMRegisterDictionaryFile';

{
 *  DCMUnregisterDictionary()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DictionaryMgrLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DCMUnregisterDictionary(dictionaryID: DCMDictionaryID): OSStatus; external name '_DCMUnregisterDictionary';

{
    Open dictionary
}
{
 *  DCMOpenDictionary()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DictionaryMgrLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DCMOpenDictionary(dictionaryID: DCMDictionaryID; protectKeySize: ByteCount; protectKey: ConstLogicalAddress; var dictionaryRef: DCMDictionaryRef): OSStatus; external name '_DCMOpenDictionary';

{
 *  DCMCloseDictionary()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DictionaryMgrLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DCMCloseDictionary(dictionaryRef: DCMDictionaryRef): OSStatus; external name '_DCMCloseDictionary';

{
    Change access privilege
}
{
 *  DCMGetDictionaryWriteAccess()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DictionaryMgrLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DCMGetDictionaryWriteAccess(dictionaryRef: DCMDictionaryRef; timeOutDuration: Duration): OSStatus; external name '_DCMGetDictionaryWriteAccess';

{
 *  DCMReleaseDictionaryWriteAccess()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DictionaryMgrLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DCMReleaseDictionaryWriteAccess(dictionaryRef: DCMDictionaryRef; commitTransaction: boolean): OSStatus; external name '_DCMReleaseDictionaryWriteAccess';

{
    Find records
}
{
 *  DCMFindRecords()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DictionaryMgrLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DCMFindRecords(dictionaryRef: DCMDictionaryRef; keyFieldTag: DCMFieldTag; keySize: ByteCount; keyData: ConstLogicalAddress; findMethod: DCMFindMethod; preFetchedDataNum: ItemCount; preFetchedData: DCMFieldTagPtr; skipCount: ItemCount; maxRecordCount: ItemCount; var recordIterator: DCMFoundRecordIterator): OSStatus; external name '_DCMFindRecords';

{
 *  DCMCountRecordIterator()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DictionaryMgrLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DCMCountRecordIterator(recordIterator: DCMFoundRecordIterator): ItemCount; external name '_DCMCountRecordIterator';

{
 *  DCMIterateFoundRecord()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DictionaryMgrLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DCMIterateFoundRecord(recordIterator: DCMFoundRecordIterator; maxKeySize: ByteCount; var actualKeySize: ByteCount; keyData: LogicalAddress; var uniqueID: DCMUniqueID; var dataList: AEDesc): OSStatus; external name '_DCMIterateFoundRecord';

{
 *  DCMDisposeRecordIterator()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DictionaryMgrLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DCMDisposeRecordIterator(recordIterator: DCMFoundRecordIterator): OSStatus; external name '_DCMDisposeRecordIterator';

{
    Dump dictionary
}
{
 *  DCMCountRecord()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DictionaryMgrLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DCMCountRecord(dictionaryID: DCMDictionaryID; var count: ItemCount): OSStatus; external name '_DCMCountRecord';

{
 *  DCMGetRecordSequenceNumber()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DictionaryMgrLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DCMGetRecordSequenceNumber(dictionaryRef: DCMDictionaryRef; keyFieldTag: DCMFieldTag; keySize: ByteCount; keyData: ConstLogicalAddress; uniqueID: DCMUniqueID; var sequenceNum: ItemCount): OSStatus; external name '_DCMGetRecordSequenceNumber';

{
 *  DCMGetNthRecord()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DictionaryMgrLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DCMGetNthRecord(dictionaryRef: DCMDictionaryRef; keyFieldTag: DCMFieldTag; serialNum: ItemCount; maxKeySize: ByteCount; var keySize: ByteCount; keyData: LogicalAddress; var uniqueID: DCMUniqueID): OSStatus; external name '_DCMGetNthRecord';

{
 *  DCMGetNextRecord()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DictionaryMgrLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DCMGetNextRecord(dictionaryRef: DCMDictionaryRef; keyFieldTag: DCMFieldTag; keySize: ByteCount; keyData: ConstLogicalAddress; uniqueID: DCMUniqueID; maxKeySize: ByteCount; var nextKeySize: ByteCount; nextKeyData: LogicalAddress; var nextUniqueID: DCMUniqueID): OSStatus; external name '_DCMGetNextRecord';

{
 *  DCMGetPrevRecord()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DictionaryMgrLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DCMGetPrevRecord(dictionaryRef: DCMDictionaryRef; keyFieldTag: DCMFieldTag; keySize: ByteCount; keyData: ConstLogicalAddress; uniqueID: DCMUniqueID; maxKeySize: ByteCount; var prevKeySize: ByteCount; prevKeyData: LogicalAddress; var prevUniqueID: DCMUniqueID): OSStatus; external name '_DCMGetPrevRecord';

{
    Get field data
}
{
 *  DCMGetFieldData()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DictionaryMgrLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DCMGetFieldData(dictionaryRef: DCMDictionaryRef; keyFieldTag: DCMFieldTag; keySize: ByteCount; keyData: ConstLogicalAddress; uniqueID: DCMUniqueID; numOfData: ItemCount; dataTag: DCMFieldTagPtr; var dataList: AEDesc): OSStatus; external name '_DCMGetFieldData';

{
 *  DCMSetFieldData()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DictionaryMgrLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DCMSetFieldData(dictionaryRef: DCMDictionaryRef; keyFieldTag: DCMFieldTag; keySize: ByteCount; keyData: ConstLogicalAddress; uniqueID: DCMUniqueID; const (*var*) dataList: AEDesc): OSStatus; external name '_DCMSetFieldData';

{
    Add record
}
{
 *  DCMAddRecord()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DictionaryMgrLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DCMAddRecord(dictionaryRef: DCMDictionaryRef; keyFieldTag: DCMFieldTag; keySize: ByteCount; keyData: ConstLogicalAddress; checkOnly: boolean; const (*var*) dataList: AEDesc; var newUniqueID: DCMUniqueID): OSStatus; external name '_DCMAddRecord';

{
 *  DCMDeleteRecord()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DictionaryMgrLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DCMDeleteRecord(dictionaryRef: DCMDictionaryRef; keyFieldTag: DCMFieldTag; keySize: ByteCount; keyData: ConstLogicalAddress; uniqueID: DCMUniqueID): OSStatus; external name '_DCMDeleteRecord';

{
    Reorganize/compact dictionary
}
{
 *  DCMReorganizeDictionary()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DictionaryMgrLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DCMReorganizeDictionary(dictionaryID: DCMDictionaryID; extraCapacity: ItemCount; progressProc: DCMProgressFilterUPP; userData: UInt32): OSStatus; external name '_DCMReorganizeDictionary';

{
 *  DCMCompactDictionary()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DictionaryMgrLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DCMCompactDictionary(dictionaryID: DCMDictionaryID; progressProc: DCMProgressFilterUPP; userData: UInt32): OSStatus; external name '_DCMCompactDictionary';

{
    DictionaryID utilities
}
{
 *  DCMGetFileFromDictionaryID()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DictionaryMgrLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DCMGetFileFromDictionaryID(dictionaryID: DCMDictionaryID; var fileRef: FSSpec): OSStatus; external name '_DCMGetFileFromDictionaryID';

{
 *  DCMGetDictionaryIDFromFile()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DictionaryMgrLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DCMGetDictionaryIDFromFile(const (*var*) fileRef: FSSpec; var dictionaryID: DCMDictionaryID): OSStatus; external name '_DCMGetDictionaryIDFromFile';

{
 *  DCMGetDictionaryIDFromRef()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DictionaryMgrLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DCMGetDictionaryIDFromRef(dictionaryRef: DCMDictionaryRef): DCMDictionaryID; external name '_DCMGetDictionaryIDFromRef';

{
    Field information and manipulation
}
{
 *  DCMGetDictionaryFieldInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DictionaryMgrLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DCMGetDictionaryFieldInfo(dictionaryID: DCMDictionaryID; fieldTag: DCMFieldTag; var fieldInfoRecord: AEDesc): OSStatus; external name '_DCMGetDictionaryFieldInfo';

{
    Dictionary property
}
{
 *  DCMGetDictionaryProperty()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DictionaryMgrLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DCMGetDictionaryProperty(dictionaryID: DCMDictionaryID; propertyTag: DCMFieldTag; maxPropertySize: ByteCount; var actualSize: ByteCount; propertyValue: LogicalAddress): OSStatus; external name '_DCMGetDictionaryProperty';

{
 *  DCMSetDictionaryProperty()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DictionaryMgrLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DCMSetDictionaryProperty(dictionaryID: DCMDictionaryID; propertyTag: DCMFieldTag; propertySize: ByteCount; propertyValue: ConstLogicalAddress): OSStatus; external name '_DCMSetDictionaryProperty';

{
 *  DCMGetDictionaryPropertyList()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DictionaryMgrLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DCMGetDictionaryPropertyList(dictionaryID: DCMDictionaryID; maxPropertyNum: ItemCount; var numProperties: ItemCount; propertyTag: DCMFieldTagPtr): OSStatus; external name '_DCMGetDictionaryPropertyList';

{
    Seaarch dictionary
}
{
 *  DCMCreateDictionaryIterator()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DictionaryMgrLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DCMCreateDictionaryIterator(var dictionaryIterator: DCMDictionaryIterator): OSStatus; external name '_DCMCreateDictionaryIterator';

{
    Search AccessMethod
}
{
 *  DCMCreateAccessMethodIterator()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DictionaryMgrLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DCMCreateAccessMethodIterator(var accessMethodIterator: DCMAccessMethodIterator): OSStatus; external name '_DCMCreateAccessMethodIterator';

{
    Iterator Operation
}
{
 *  DCMCountObjectIterator()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DictionaryMgrLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DCMCountObjectIterator(iterator: DCMObjectIterator): ItemCount; external name '_DCMCountObjectIterator';

{
 *  DCMIterateObject()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DictionaryMgrLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DCMIterateObject(iterator: DCMObjectIterator; var objectID: DCMObjectID): OSStatus; external name '_DCMIterateObject';

{
 *  DCMResetObjectIterator()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DictionaryMgrLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DCMResetObjectIterator(iterator: DCMObjectIterator): OSStatus; external name '_DCMResetObjectIterator';

{
 *  DCMDisposeObjectIterator()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DictionaryMgrLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DCMDisposeObjectIterator(iterator: DCMObjectIterator): OSStatus; external name '_DCMDisposeObjectIterator';

{
    Get AccessMethod information
}
{
 *  DCMGetAccessMethodIDFromName()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DictionaryMgrLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DCMGetAccessMethodIDFromName(const (*var*) accessMethodName: Str63; var accessMethodID: DCMAccessMethodID): OSStatus; external name '_DCMGetAccessMethodIDFromName';

{
    Field Info Record routines
}
{
 *  DCMCreateFieldInfoRecord()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DictionaryMgrLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DCMCreateFieldInfoRecord(fieldTag: DescType; fieldType: DescType; maxRecordSize: ByteCount; fieldAttributes: DCMFieldAttributes; var fieldDefaultData: AEDesc; numberOfFindMethods: ItemCount; var findMethods: DCMFindMethod; var fieldInfoRecord: AEDesc): OSStatus; external name '_DCMCreateFieldInfoRecord';

{
 *  DCMGetFieldTagAndType()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DictionaryMgrLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DCMGetFieldTagAndType(const (*var*) fieldInfoRecord: AEDesc; var fieldTag: DCMFieldTag; var fieldType: DCMFieldType): OSStatus; external name '_DCMGetFieldTagAndType';

{
 *  DCMGetFieldMaxRecordSize()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DictionaryMgrLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DCMGetFieldMaxRecordSize(const (*var*) fieldInfoRecord: AEDesc; var maxRecordSize: ByteCount): OSStatus; external name '_DCMGetFieldMaxRecordSize';

{
 *  DCMGetFieldAttributes()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DictionaryMgrLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DCMGetFieldAttributes(const (*var*) fieldInfoRecord: AEDesc; var attributes: DCMFieldAttributes): OSStatus; external name '_DCMGetFieldAttributes';

{
 *  DCMGetFieldDefaultData()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DictionaryMgrLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DCMGetFieldDefaultData(const (*var*) fieldInfoRecord: AEDesc; desiredType: DescType; var fieldDefaultData: AEDesc): OSStatus; external name '_DCMGetFieldDefaultData';

{
 *  DCMGetFieldFindMethods()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DictionaryMgrLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DCMGetFieldFindMethods(const (*var*) fieldInfoRecord: AEDesc; findMethodsArrayMaxSize: ItemCount; var findMethods: DCMFindMethod; var actualNumberOfFindMethods: ItemCount): OSStatus; external name '_DCMGetFieldFindMethods';

{
    Check Dictionary Manager availability
}
{ Dictionary Manager is always available on OS X }

{
=============================================================================================
    Definitions for Japanese Analysis Module
=============================================================================================
}
{
    Default dictionary access method for Japanese analysis
}
{
    Data length limitations of Apple Japanese dictionaries
}

const
    kMaxYomiLengthInAppleJapaneseDictionary = 40;
    kMaxKanjiLengthInAppleJapaneseDictionary = 64;

    {
        Defined field tags of Apple Japanese dictionary
        }
    kDCMJapaneseYomiTag         = $796F6D69 (* 'yomi' *);
    kDCMJapaneseHyokiTag        = $68796F6B (* 'hyok' *);
    kDCMJapaneseHinshiTag       = $68696E73 (* 'hins' *);
    kDCMJapaneseWeightTag       = $68696E64 (* 'hind' *);
    kDCMJapanesePhoneticTag     = $68746F6E (* 'hton' *);
    kDCMJapaneseAccentTag       = $61636E74 (* 'acnt' *);
    kDCMJapaneseOnKunReadingTag = $4F6E4B6E (* 'OnKn' *);
    kDCMJapaneseFukugouInfoTag  = $66756B75 (* 'fuku' *);

    kDCMJapaneseYomiType        = $75747874 (* 'utxt' *);
    kDCMJapaneseHyokiType       = $75747874 (* 'utxt' *);
    kDCMJapaneseHinshiType      = $68696E73 (* 'hins' *);
    kDCMJapaneseWeightType      = $73686F72 (* 'shor' *);
    kDCMJapanesePhoneticType    = $75747874 (* 'utxt' *);
    kDCMJapaneseAccentType      = $62797465 (* 'byte' *);
    kDCMJapaneseOnKunReadingType = $75747874 (* 'utxt' *);
    kDCMJapaneseFukugouInfoType = $66756B75 (* 'fuku' *);


    {
    =============================================================================================
     System 7 Dictionary Manager
    =============================================================================================
        }
{$ALIGN MAC68K}
                                                                {  Dictionary data insertion modes  }
    kInsert                     = 0;                            {  Only insert the input entry if there is nothing in the dictionary that matches the key.  }
    kReplace                    = 1;                            {  Only replace the entries which match the key with the input entry.  }
    kInsertOrReplace            = 2;                            {  Insert the entry if there is nothing in the dictionary which matches the key, otherwise replaces the existing matched entries with the input entry.  }

    {    This Was InsertMode    }

type
    DictionaryDataInsertMode            = SInt16;

const
                                                                {  Key attribute constants  }
    kIsCaseSensitive            = $10;                          {  case sensitive = 16        }
    kIsNotDiacriticalSensitive  = $20;                          {  diac not sensitive = 32     }

                                                                {  Registered attribute type constants.    }
    kNoun                       = -1;
    kVerb                       = -2;
    kAdjective                  = -3;
    kAdverb                     = -4;

    {    This Was AttributeType     }

type
    DictionaryEntryAttribute            = SInt8;
    {    Dictionary information record  }
    DictionaryInformationPtr = ^DictionaryInformation;
    DictionaryInformation = record
        dictionaryFSSpec:       FSSpec;
        numberOfRecords:        SInt32;
        currentGarbageSize:     SInt32;
        script:                 ScriptCode;
        maximumKeyLength:       SInt16;
        keyAttributes:          SInt8;
    end;

    DictionaryAttributeTablePtr = ^DictionaryAttributeTable;
    DictionaryAttributeTable = packed record
        datSize:                UInt8;
        datTable:               array [0..0] of DictionaryEntryAttribute;
    end;


{$ALIGN MAC68K}
{#POP}
{unit HIToolbar}
{$ALIGN MAC68K}












{#PUSH}
{$ALIGN POWER}
{#LibExport+}

 type
    HIToolbarRef        = HIObjectRef;
    HIToolbarItemRef    = HIObjectRef;

{----------------------------------------------------------------------------------}
{ Config data keys used in HIToolbarSetItemsWithIdentifiers                        }
{----------------------------------------------------------------------------------}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kHIToolbarIdentifierKey CFSTRP('identifier')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kHIToolbarDataKey CFSTRP('data')}
{$endc}
{----------------------------------------------------------------------------------}
{ Standard Toolbox-provided item identifiers                                       }
{----------------------------------------------------------------------------------}

{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kHIToolbarSeparatorIdentifier CFSTRP('com.apple.hitoolbox.toolbar.separator')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kHIToolbarSpaceIdentifier CFSTRP('com.apple.hitoolbox.toolbar.space')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kHIToolbarFlexibleSpaceIdentifier CFSTRP('com.apple.hitoolbox.toolbar.flexiblespace')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kHIToolbarCustomizeIdentifier CFSTRP('com.apple.hitoolbox.toolbar.customize')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kHIToolbarPrintItemIdentifier CFSTRP('com.apple.hitoolbox.toolbar.print')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kHIToolbarFontsItemIdentifier CFSTRP('com.apple.hitoolbox.toolbar.fonts')}
{$endc}


{*
  *  Summary:
  *    Toolbar Display Mode
  }

const

  {
    * This indicates to use the default display mode. Currently, this is
    * defined as being both icon and label, but could change in the
    * future.
    }
  kHIToolbarDisplayModeDefault  = 0;

  {
    * This indicates to display the image as well as the label of the
    * toolbar items.
    }
  kHIToolbarDisplayModeIconAndLabel = 1;

  {
    * This indicates that only the image should be shown.
    }
  kHIToolbarDisplayModeIconOnly = 2;

  {
    * This indicates that only the label should be shown.
    }
  kHIToolbarDisplayModeLabelOnly = 3;

 type
    HIToolbarDisplayMode = UInt32;

{
  *  Summary:
  *    Toolbar Display Size
  }

const

  {
    * This indicates to use the default display size. Currently, this is
    * defined as using 32 x 32 icons ("normal" size).
    }
  kHIToolbarDisplaySizeDefault  = 0;

  {
    * This size uses a larger text and icon size.
    }
  kHIToolbarDisplaySizeNormal   = 1;

  {
    * This size uses a smaller text and icon size.
    }
  kHIToolbarDisplaySizeSmall    = 2;

 type
    HIToolbarDisplaySize = UInt32;

{
  *  Summary:
  *    Toolbar Attributes
  }


{GRP translation note: Attributes are passed to OptionBits (UInt32) type formal parameters. Therefore, hex
constants were used to ensure size and bit position are correct.}

const

  {
   * Pass this to indicate no attributes at all.
   }
  kHIToolbarNoAttributes        = 0;

  {
   * Pass this attribute to allow the toolbar to save its configuration
   * automatically to your application's preferences. You must make
   * sure to synchronize the prefs at some point to ensure it gets
   * written to disk. The toolbar will also read its config from the
   * prefs if this attribute is set.
   }
  kHIToolbarAutoSavesConfig     = (1 shl 0);

  {
   * This attribute indicates that the toolbar is configurable, i.e.
   * the user can drag items around and bring up the configuration
   * palette, etc.
   }
  kHIToolbarIsConfigurable      = (1 shl 1);
  kHIToolbarValidAttrs          = kHIToolbarAutoSavesConfig or kHIToolbarIsConfigurable;

{
  *  Summary:
  *    Toolbar Commands
  }

const

  {
    * Sending this to a window with a toolbar will cause the
    * configuration sheet to appear. You can set a menu item's command
    * to this command ID and it will be handled and updated
    * automatically for you.
    }
  kHICommandCustomizeToolbar    = $74636667 (* 'tcfg' *);

  {
    * This command causes a window's toolbar to be shown. You can set a
    * menu item's command to this ID and it will be handled and updated
    * automatically for you.
    }
  kHICommandShowToolbar         = $74627368 (* 'tbsh' *);

  {
    * This command causes a window's toolbar to be hidden. You can set a
    * menu item's command to this ID and it will be handled and updated
    * automatically for you.
    }
  kHICommandHideToolbar         = $74626864 (* 'tbhd' *);

  {
   * This command, when specified as a toolbar itemÕs command ID, will
   * cause a kEventToolbarItemPerformAction event to be generated when
   * the toolbar itemÕs menu item in the toolbar overflow menu is
   * selected. If the item has any other command ID, a
   * kEventCommandProcess event will be generated instead, containing
   * the itemÕs command ID.
   }
  kHIToolbarCommandPressAction  = $74627072 (* 'tbpr' *);

{
    kEventClassToolbar quick reference:

    kEventToolbarGetDefaultIdentifiers      = 1,
    kEventToolbarGetAllowedIdentifiers      = 2,
    kEventToolbarCreateItemWithIdentifier   = 3,
    kEventToolbarCreateItemFromDrag         = 4,
    kEventToolbarItemAdded                  = 5,
    kEventToolbarItemRemoved                = 6,
    kEventToolbarDisplayModeChanged         = 7,
    kEventToolbarDisplaySizeChanged         = 8,
    kEventToolbarLayoutChanged              = 9,
    kEventToolbarBeginMultiChange           = 12,
    kEventToolbarEndMultiChange             = 13
}
{ Toolbar event parameters and types}
const
  kEventParamToolbar            = $74626172 (* 'tbar' *); { typeHIToolbarRef}
  kEventParamToolbarItem        = $74626974 (* 'tbit' *); { typeHIToolbarItemRef}
  kEventParamToolbarItemIdentifier = $74626969 (* 'tbii' *); { typeCFStringRef}
  kEventParamToolbarItemConfigData = $74626964 (* 'tbid' *); { typeCFTypeRef}
  typeHIToolbarRef              = $74626172 (* 'tbar' *); { HIToolbarRef}
  typeHIToolbarItemRef          = $74626974 (* 'tbit' *); { HIToolbarItemRef}


{
 *  kEventClassToolbar / kEventToolbarGetDefaultIdentifiers
 *
 *  Summary:
 *    This event is sent to the delegate to get a list of all of the
 *    default item identifiers that should be created for a toolbar.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamToolbar (in, typeHIToolbarRef)
 *          The toolbar for which to retrieve identifiers.
 *
 *    --> kEventParamMutableArray (in, typeCFMutableArrayRef)
 *          A mutable array to fill in with the identifiers.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const
  kEventToolbarGetDefaultIdentifiers = 1;

{
 *  kEventClassToolbar / kEventToolbarGetAllowedIdentifiers
 *
 *  Summary:
 *    This event is sent to the delegate to get a list of all the items
 *    which could possibly be added to the toolbar. This is sent out
 *    when the configuration sheet is about to be displayed. You are
 *    passed a mutable array to fill in with the identifiers.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamToolbar (in, typeHIToolbarRef)
 *          The toolbar for which to retrieve identifiers.
 *
 *    --> kEventParamMutableArray (in, typeCFMutableArrayRef)
 *          A mutable array to fill in with the identifiers.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const
  kEventToolbarGetAllowedIdentifiers = 2;

{
 *  kEventClassToolbar / kEventToolbarCreateItemWithIdentifier
 *
 *  Summary:
 *    This event is sent to the delegate when we need to create an item
 *    from an identifier.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamToolbar (in, typeHIToolbarRef)
 *          The toolbar for which to create an item.
 *
 *    --> kEventParamToolbarItemIdentifier (in, typeCFStringRef)
 *          The toolbar item identifier.
 *
 *    --> kEventParamToolbarItemConfigData (in, typeCFTypeRef)
 *          The toolbar item configuration data. This parameter is
 *          optional and may not be present in all instances of this
 *          event.
 *
 *    <-- kEventParamToolbarItem (out, typeHIToolbarItemRef)
 *          On exit, contains the new toolbar item.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const
  kEventToolbarCreateItemWithIdentifier = 3;

{
 *  kEventClassToolbar / kEventToolbarCreateItemFromDrag
 *
 *  Summary:
 *    This event is sent to the delegate to when we need to create an
 *    item from a drag.
 *
 *  Discussion:
 *    This event allows you to be able to drag items into a toolbar
 *    that arenÕt normal toolbar items. You might use this to allow
 *    your toolbar to accept file system items, for example.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDragRef (in, typeDragRef)
 *          The DragRef with information about the drag.
 *
 *    <-- kEventParamToolbarItem (out, typeHIToolbarItemRef)
 *          On exit, contains the new toolbar item.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const
  kEventToolbarCreateItemFromDrag = 4;

{
 *  kEventClassToolbar / kEventToolbarItemAdded
 *
 *  Summary:
 *    Sent to interested parties when an item is added to the toolbar.
 *    The toolbar object sends this event to itself, so you'd need to
 *    install a handler on the toolbar to receive this event.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamToolbarItem (in, typeHIToolbarItemRef)
 *          The item that was just added.
 *
 *    --> kEventParamIndex (in, typeCFIndex)
 *          The index at which the item now exists.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const
  kEventToolbarItemAdded        = 5;

{
 *  kEventClassToolbar / kEventToolbarItemRemoved
 *
 *  Summary:
 *    Sent to interested parties when an item is removed from toolbar.
 *    It is called after the item has already been removed. The toolbar
 *    object sends this event to itself, so you'd need to install a
 *    handler on the toolbar to receive this event.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamToolbarItem (in, typeHIToolbarItemRef)
 *          The item that was just removed.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const
  kEventToolbarItemRemoved      = 6;

{
 *  kEventClassToolbar / kEventToolbarDisplayModeChanged
 *
 *  Summary:
 *    Sent to interested parties when an the display mode is changed
 *    for a toolbar. The toolbar object sends this event to itself, so
 *    you'd need to install a handler on the toolbar to receive this
 *    event.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const
  kEventToolbarDisplayModeChanged = 7;

{
 *  kEventClassToolbar / kEventToolbarDisplaySizeChanged
 *
 *  Summary:
 *    Sent to interested parties when an the display size is changed
 *    for a toolbar. The toolbar object sends this event to itself, so
 *    you'd need to install a handler on the toolbar to receive this
 *    event.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const
  kEventToolbarDisplaySizeChanged = 8;

{
 *  kEventClassToolbar / kEventToolbarLayoutChanged
 *
 *  Summary:
 *    Sent to interested parties when the layout of a toolbar changes
 *    (either an item has been moved, or the entire contents have been
 *    replaced). Basically it is sent for changes which would require a
 *    total resync with the current state of things. The toolbar object
 *    sends this event to itself, so you'd need to install a handler on
 *    the toolbar to receive this event.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const
  kEventToolbarLayoutChanged    = 9;

{
 *  kEventClassToolbar / kEventToolbarBeginMultiChange
 *
 *  Summary:
 *    Sent to interested parties when multiple attributes are going to
 *    be changed at once. For example, it is possible for the display
 *    mode and size to change at the same time. When this happens,
 *    instead of reacting two times (one for display mode changed and
 *    one for display size changed), you can listen to see if we are
 *    going to change multiple attributes and hold off on doing any
 *    relayout, etc. until the EndMultiChange event comes in. The
 *    toolbar object sends this event to itself, so you'd need to
 *    install a handler on the toolbar to receive this event.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const
  kEventToolbarBeginMultiChange = 12;

{
 *  kEventClassToolbar / kEventToolbarEndMultiChange
 *
 *  Summary:
 *    Sent to interested parties when the toolbar is done adjusting
 *    multiple attributes. See kEventToolbarBeginMultiChange for more
 *    information. The toolbar object sends this event to itself, so
 *    you'd need to install a handler on the toolbar to receive this
 *    event.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const
  kEventToolbarEndMultiChange   = 13;

{
    kEventClassToolbarItem quick reference:

    kEventToolbarItemImageChanged           = 1;
    kEventToolbarItemLabelChanged           = 2;
    kEventToolbarItemHelpTextChanged        = 3;
    kEventToolbarItemCommandIDChanged       = 4;
    kEventToolbarItemGetPersistentData      = 5;
    kEventToolbarItemCreateCustomView       = 6;
    kEventToolbarItemEnabledStateChanged    = 7;
    kEventToolbarItemPerformAction          = 8;
    kEventToolbarItemWouldAcceptDrop        = 10;
    kEventToolbarItemAcceptDrop             = 11

}
{
 *  kEventClassToolbarItem / kEventToolbarItemImageChanged
 *
 *  Summary:
 *    This event is sent to the item (itself) when the image changes.
 *    Any interested parties can install handlers on the toolbar item
 *    to receive notifications.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const
  kEventToolbarItemImageChanged = 1;

{
 *  kEventClassToolbarItem / kEventToolbarItemLabelChanged
 *
 *  Summary:
 *    This event is sent to the item (itself) when the label changes.
 *    Any interested parties can install handlers on the toolbar item
 *    to receive notifications.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const
  kEventToolbarItemLabelChanged = 2;

{
 *  kEventClassToolbarItem / kEventToolbarItemHelpTextChanged
 *
 *  Summary:
 *    This event is sent to the item (itself) when the help text
 *    changes. Any interested parties can install handlers on the
 *    toolbar item to receive notifications.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const
  kEventToolbarItemHelpTextChanged = 3;

{
 *  kEventClassToolbarItem / kEventToolbarItemCommandIDChanged
 *
 *  Summary:
 *    This event is sent to the item (itself) when the command ID
 *    changes. Any interested parties can install handlers on the
 *    toolbar item to receive notifications.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const
  kEventToolbarItemCommandIDChanged = 4;

{
 *  kEventClassToolbarItem / kEventToolbarItemGetPersistentData
 *
 *  Summary:
 *    This event is sent to the item (itself) when the toolbar is going
 *    to write out the configuration information for the item. Any
 *    custom items can listen for this event and add any extra
 *    information to what is written out into the config so that it can
 *    be reanimated later on from the same config data. Typically,
 *    you'd not need to handle this event.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    <-- kEventParamToolbarItemConfigData (out, typeCFTypeRef)
 *          On exit, contains configuration information for the item.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const
  kEventToolbarItemGetPersistentData = 5;

{
 *  kEventClassToolbarItem / kEventToolbarItemCreateCustomView
 *
 *  Summary:
 *    This event is sent to the toolbar item when it is time to create
 *    a view for it to display its contents. Implementors of custom
 *    toolbar items can install a handler for this event to create
 *    their own custom views for their items.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    <-- kEventParamControlRef (out, typeControlRef)
 *          On exit, contains the itemÕs custom view.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const
  kEventToolbarItemCreateCustomView = 6;

{
 *  kEventClassToolbarItem / kEventToolbarItemEnabledStateChanged
 *
 *  Summary:
 *    This event is sent to the item (itself) when the enabled state
 *    changes. Any interested parties can install handlers on the
 *    toolbar item to receive notifications.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const
  kEventToolbarItemEnabledStateChanged = 7;

{
 *  kEventClassToolbarItem / kEventToolbarItemPerformAction
 *
 *  Summary:
 *    This event is sent when a toolbar item is clicked. Subclasses of
 *    toolbar items can choose to do special actions by overriding this
 *    event. If this event is unhandled, the default action of sending
 *    a command event will occur.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const
  kEventToolbarItemPerformAction = 8;

{
 *  kEventClassToolbarItem / kEventToolbarItemWouldAcceptDrop
 *
 *  Summary:
 *    This event is sent when a drag enters a toolbar item. If the
 *    toolbar item wants to accept drags (like finder items can when
 *    they represent containers), simply respond to this event and
 *    return true in the kEventParamResult parameter. The toolbar item
 *    will hilite appropriately. If you are using a custom view, you do
 *    not need to respond to this, since you'll have full drag and drop
 *    capability via the view system. This is to support custom items
 *    which are using the standard view.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDragRef (in, typeDragRef)
 *          The drag to test for tastiness of flavors.
 *
 *    <-- kEventParamResult (out, typeBoolean)
 *          A boolean value representing whether the drag was something
 *          the item wants to accept (true) or not (false). If this
 *          parameter does not exist or is false, we do not consult any
 *          other parameters in this event.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const
  kEventToolbarItemWouldAcceptDrop = 10;

{
 *  kEventClassToolbarItem / kEventToolbarItemAcceptDrop
 *
 *  Summary:
 *    If you responded to kEventToolbarItemLikesDrag and returned true
 *    in the kEventParamResult parameter, and the user drops the drag
 *    onto your item, you will be called with this event.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDragRef (in, typeDragRef)
 *          The drag that was just dropped.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const
  kEventToolbarItemAcceptDrop   = 11;

{
    kEventClassToolbarItemView quick reference:

    kEventToolbarItemViewConfigForMode      = 3;
    kEventToolbarItemViewConfigForSize      = 4;
    kEventToolbarItemViewEnterConfigMode    = 5;
    kEventToolbarItemViewExitConfigMode     = 6
}
const
  kEventParamToolbarDisplayMode = $7462646D (* 'tbdm' *); { typeHIToolbarDisplayMode}
  kEventParamToolbarDisplaySize = $74626473 (* 'tbds' *); { typeHIToolbarDisplaySize}
  typeHIToolbarDisplayMode      = $7462646D (* 'tbdm' *); { HIToolbarDisplayMode}
  typeHIToolbarDisplaySize      = $74626473 (* 'tbds' *); { HIToolbarDisplaySize}

{
 *  kEventClassToolbarItemView / kEventToolbarItemViewConfigForMode
 *
 *  Summary:
 *    Notifies a toolbar item view that the toolbar's display mode has
 *    changed.
 *
 *  Discussion:
 *    Notifies a toolbar item view that the toolbar's display mode has
 *    changed. A custom toolbar item view can respond to this in any
 *    way it sees fit. Most times, responding to this is not necessary
 *    Ñ when the toolbar goes from icon to text only, for example, the
 *    view is automatically hidden, so there is not much to do. It is
 *    here for informational purposes only.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamToolbarDisplayMode (in, typeHIToolbarDisplayMode)
 *          The toolbar item view's new display mode.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const
  kEventToolbarItemViewConfigForMode = 3;

{
 *  kEventClassToolbarItemView / kEventToolbarItemViewConfigForSize
 *
 *  Summary:
 *    Notifies a toolbar item view that the toolbar's display size has
 *    changed.
 *
 *  Discussion:
 *    Notifies a toolbar item view that the toolbar's display size has
 *    changed. A custom toolbar item view can respond to this in any
 *    way it sees fit. Most times, responding to this is not necessary.
 *    However, some custom views might need to flush metrics caches
 *    when the display size changes.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamToolbarDisplaySize (in, typeHIToolbarDisplaySize)
 *          The toolbar item view's new display size.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const
  kEventToolbarItemViewConfigForSize = 4;

{
 *  kEventClassToolbarItemView / kEventToolbarItemViewEnterConfigMode
 *
 *  Summary:
 *    Notifies a toolbar item view that we've entered configure mode.
 *
 *  Discussion:
 *    Notifies a toolbar item view that we've entered configure mode. A
 *    custom toolbar item view can respond to this in any way it sees
 *    fit. For example, the space and flexible space mark themselves to
 *    draw a rectangle and merely invalidate so they get redrawn so you
 *    can see them during configure.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const
  kEventToolbarItemViewEnterConfigMode = 5;

{
 *  kEventClassToolbarItemView / kEventToolbarItemViewExitConfigMode
 *
 *  Summary:
 *    Notifies a toolbar item view that we've finished with configure
 *    mode.
 *
 *  Discussion:
 *    Notifies a toolbar item view that we're now out of configure
 *    mode. A custom toolbar item view can respond to this in any way
 *    it sees fit.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const
  kEventToolbarItemViewExitConfigMode = 6;


{
 *  Summary:
 *    Toolbar Item Attributes
 }
const

  {
   * Pass this to indicate no attributes at all.
   }
  kHIToolbarItemNoAttributes    = 0;

  {
   * This indicates that an item can have more than one instance of
   * itself in the toolbar. If this is not set, only one can be
   * present. By default, the determining factor for what determines if
   * two items are identical is the toolbar identifier. Subclasses of
   * HIToolbarItem can specify more elaborate equality.
   }
  kHIToolbarItemAllowDuplicates = (1 shl 0);

  {
   * This item can be rearranged, but it cannot be removed from the
   * Toolbar by the user.
   }
  kHIToolbarItemCantBeRemoved   = (1 shl 1);

  {
   * This item cannot be moved at all by the user. It is anchored to
   * the left of the toolbar. It is important that there not be any
   * unanchored items to the left of this item, else dragging items
   * around will be a bit wacky. It is up you you, the home viewer, to
   * make sure that anchored items are all on the left. This allows you
   * to do toolbars like the the one in the System Preferences app,
   * where the first couple of items are stuck in place.
   }
  kHIToolbarItemAnchoredLeft    = (1 shl 2);

  {
   * This indicates the item acts as a separator. This means two things
   * at present. First, it means that it automatically shows up as a
   * divider line in a menu representation of the toolbar, and second
   * it means the view that represents this item can draw in the full
   * top to bottom space that the toolbar item occupies in the toolbar.
   }
  kHIToolbarItemIsSeparator     = (1 shl 3);

  {
   * If this attribute bit is set, the command that gets sent out will
   * be directed at the user focus instead of at the window the toolbar
   * is attached to.
   }
  kHIToolbarItemSendCmdToUserFocus = (1 shl 4);

  {
   * If this attribute bit is set, clicking on the label of an item
   * does nothing. This attribute is ONLY considered when a custom view
   * is present. What it really does is make the toolbar item view dead
   * to clicks while still allowing clicks to be sent to the custom
   * view. When the toolbar is in text-only mode and this attribute is
   * set, it displays the label in a disabled (grayed) appearance. You
   * might want to change this attribute when switching between display
   * modes. For example, the view switcher in finder does not allow
   * clicks on the label when in icon and text mode, but it does
   * respond to clicks when in text only mode. To change this on the
   * fly, you should listen for kEventToolbarItemViewConfigForMode in
   * your custom view and adjust this attribute as you desire. This
   * attribute is available in Mac OS X 10.3 and later.
   }
  kHIToolbarItemLabelDisabled   = (1 shl 5);
  kHIToolbarItemValidAttrs      = kHIToolbarItemAllowDuplicates or kHIToolbarItemIsSeparator or kHIToolbarItemCantBeRemoved or kHIToolbarItemAnchoredLeft or kHIToolbarItemSendCmdToUserFocus or kHIToolbarItemLabelDisabled;
  kHIToolbarItemMutableAttrs    = kHIToolbarItemCantBeRemoved or kHIToolbarItemAnchoredLeft or kHIToolbarItemLabelDisabled;

{======================================================================================}
{ FUNCTIONS                                                                            }
{======================================================================================}

{
  *  HIToolbarCreate()
  *
  *  Discussion:
  *    Creates a toolbar. After creating a toolbar, one would normally
  *    attach it to a window using SetWindowToolbar, described in
  *    MacWindows.h. Since the toolbar is merely the model (as opposed
  *    to the view), there are no routines to hide/show it here. Please
  *    look to MacWindows.h for the routines ShowHideWindowToolbar and
  *    IsWindowToolbarVisible there for more information.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inIdentifier:
  *      The identifier of the toolbar. If you specify that the toolbar
  *      auto-saves its configuration, this identifier is used to mark
  *      the config info in your application's preferences. You must
  *      specify an identifier.
  *
  *    inAttributes:
  *      Any attributes you wish to specify.
  *
  *    outToolbar:
  *      The toolbar reference to your shiny new toolbar.
  *
  *  Result:
  *    An operating system result code.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIToolbarCreate(
    inIdentifier: CFStringRef;
    inAttributes: OptionBits;
    var outToolbar: HIToolbarRef): OSStatus; external name '_HIToolbarCreate';

{
  *  HIToolbarGetAttributes()
  *
  *  Discussion:
  *    Returns the attributes for the given toolbar.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inToolbar:
  *      The toolbar whose attributes you desire.
  *
  *    outAttributes:
  *      The attributes.
  *
  *  Result:
  *    An operating system result code.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIToolbarGetAttributes(
    inToolbar: HIToolbarRef;
    var outAttributes: OptionBits): OSStatus; external name '_HIToolbarGetAttributes';

{
  *  HIToolbarChangeAttributes()
  *
  *  Discussion:
  *    Changes the attributes of a toolbar.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inToolbar:
  *      The toolbar whose attributes you want to change.
  *
  *    inAttrsToSet:
  *      The attributes you wish to set/enable.
  *
  *    inAttrsToClear:
  *      The attributes you wish to clear/disable.
  *
  *  Result:
  *    An operating system result code.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIToolbarChangeAttributes(
    inToolbar: HIToolbarRef;
    inAttrsToSet: OptionBits;
    inAttrsToClear: OptionBits): OSStatus; external name '_HIToolbarChangeAttributes';

{
  *  HIToolbarGetDisplayMode()
  *
  *  Discussion:
  *    Returns the current display mode of a toolbar.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inToolbar:
  *      The toolbar whose display mode you wish to receive.
  *
  *    outDisplayMode:
  *      The display mode.
  *
  *  Result:
  *    An operating system result code.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIToolbarGetDisplayMode(
    inToolbar: HIToolbarRef;
    var outDisplayMode: HIToolbarDisplayMode): OSStatus; external name '_HIToolbarGetDisplayMode';

{
  *  HIToolbarSetDisplayMode()
  *
  *  Discussion:
  *    Sets the current display mode of a toolbar.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inToolbar:
  *      The toolbar whose display mode you wish to set.
  *
  *    inDisplayMode:
  *      The display mode. If the toolbar is visible, it will be redrawn.
  *
  *  Result:
  *    An operating system result code.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIToolbarSetDisplayMode(
    inToolbar: HIToolbarRef;
    inDisplayMode: HIToolbarDisplayMode): OSStatus; external name '_HIToolbarSetDisplayMode';

{
  *  HIToolbarGetDisplaySize()
  *
  *  Discussion:
  *    Gets the current display size of a toolbar.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inToolbar:
  *      The toolbar whose display size you wish to get.
  *
  *    outSize:
  *      The display size.
  *
  *  Result:
  *    An operating system result code.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIToolbarGetDisplaySize(
    inToolbar: HIToolbarRef;
    var outSize: HIToolbarDisplaySize): OSStatus; external name '_HIToolbarGetDisplaySize';

{
  *  HIToolbarSetDisplaySize()
  *
  *  Discussion:
  *    Sets the current display size of a toolbar.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inToolbar:
  *      The toolbar whose display size you wish to set.
  *
  *    inSize:
  *      The display size. If the toolbar is visible, it will be redrawn.
  *
  *  Result:
  *    An operating system result code.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIToolbarSetDisplaySize(
    inToolbar: HIToolbarRef;
    inSize: HIToolbarDisplaySize): OSStatus; external name '_HIToolbarSetDisplaySize';

{
  *  HIToolbarCopyIdentifier()
  *
  *  Discussion:
  *    Returns the identifier for a toolbar.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inToolbar:
  *      The toolbar whose identifier you wish to get.
  *
  *    outIdentifier:
  *      The identifier. You must release it when you are finished with
  *      it.
  *
  *  Result:
  *    An operating system result code.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIToolbarCopyIdentifier(
    inToolbar: HIToolbarRef;
    var outIdentifier: CFStringRef): OSStatus; external name '_HIToolbarCopyIdentifier';


{
 *  HIToolbarSetItemsWithIdentifiers()
 *
 *  Discussion:
 *    Allows you to set a toolbar's items all at once. The array
 *    contains either CFStringRefs of item identifiers, or a small
 *    CFDictionaryRef containing the identifier string, and the config
 *    data (if the item requires it). The key for the identifier string
 *    is kHIToolbarIdentifierKey and the key for the config data string
 *    is kHIToolbarDataKey.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inToolbar:
 *      The toolbar whose items you wish to set.
 *
 *    inArray:
 *      The array of toolbar items to create.
 *
 *  Result:
 *    An operating system result code.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
 *    Non-Carbon CFM:   not available
}

// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
  function HIToolbarSetItemsWithIdentifiers(
    inToolbar: HIToolbarRef;
    inArray: CFArrayRef): OSStatus; external name '_HIToolbarSetItemsWithIdentifiers';


{
  *  HIToolbarCopyItems()
  *
  *  Discussion:
  *    Returns the array of toolbar items for a toolbar.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inToolbar:
  *      The toolbar whose items you wish to receive.
  *
  *    outItems:
  *      The array of toolbar items owned by the toolbar. You must
  *      release the array when you are finished with it.
  *
  *  Result:
  *    An operating system result code.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIToolbarCopyItems(
    inToolbar: HIToolbarRef;
    var outItems: CFArrayRef): OSStatus; external name '_HIToolbarCopyItems';

{
  *  HIToolbarCreateItemWithIdentifier()
  *
  *  Discussion:
  *    Creates an item specified by a particular identifier. Using this
  *    function allows you to create any item a delegate supports by
  *    naming its identifier. It also allows you to create standard
  *    items supplied by the Toolbox, such as the separator item.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inToolbar:
  *      The toolbar you are adding to.
  *
  *    inIdentifier:
  *      The identifier of the item you wish to add.
  *
  *    inConfigData:
  *      Any config data required by the item to safely construct.
  *      Standard items do not require any extra data, so NULL can be
  *      passed.
  *
  *    outItem:
  *      The newly created toolbar item.
  *
  *  Result:
  *    An operating system result code.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIToolbarCreateItemWithIdentifier(
    inToolbar: HIToolbarRef;
    inIdentifier: CFStringRef;
    inConfigData: CFTypeRef;       { can be NULL }
    var outItem: HIToolbarItemRef): OSStatus; external name '_HIToolbarCreateItemWithIdentifier';


{
  *  HIToolbarInsertItemAtIndex()
  *
  *  Discussion:
  *    Inserts a toolbar item at a given index into a toolbar.
  *    Generally, you should always add items via identifier, and not
  *    with this routine.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inToolbar:
  *      The toolbar to receive the new item.
  *
  *    inItem:
  *      The item reference of the toolbar item you are adding.
  *
  *    inIndex:
  *      The index you wish to add the item at. This index is zero-based.
  *
  *  Result:
  *    An operating system result code.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIToolbarInsertItemAtIndex(
    inToolbar: HIToolbarRef;
    inItem: HIToolbarItemRef;
    inIndex: CFIndex): OSStatus; external name '_HIToolbarInsertItemAtIndex';


{
  *  HIToolbarAppendItem()
  *
  *  Discussion:
  *    Appends an item to the end of a toolbar. Generally, you should
  *    always add items via identifier, and not with this routine.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inToolbar:
  *      The toolbar to receive the new item.
  *
  *    inItem:
  *      The item reference of the toolbar item you are adding.
  *
  *  Result:
  *    An operating system result code.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIToolbarAppendItem(
    inToolbar: HIToolbarRef;
    inItem: HIToolbarItemRef): OSStatus; external name '_HIToolbarAppendItem';

{
  *  HIToolbarRemoveItemAtIndex()
  *
  *  Discussion:
  *    Removes an item at a given index from a toolbar.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inToolbar:
  *      The toolbar you are removing the item from.
  *
  *    inIndex:
  *      The index of the item to remove. This index is zero-based.
  *
  *  Result:
  *    An operating system result code.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIToolbarRemoveItemAtIndex(
    inToolbar: HIToolbarRef;
    inIndex: CFIndex): OSStatus; external name '_HIToolbarRemoveItemAtIndex';

{
  *  HIToolbarSetDelegate()
  *
  *  Discussion:
  *    Sets the delegate event target for a toolbar. This is necessary
  *    for a toolbar to work properly if it wants items of its own. The
  *    delegate is who is asked to create toolbar items. If the delegate
  *    does not respond, the toolbar will attempt to create a toolbar
  *    item, but it can only create the standard items defined at the
  *    top of this header.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inToolbar:
  *      The toolbar you are removing the item from.
  *
  *    inDelegate:
  *      The HIObjectRef to act as the delegate.
  *
  *  Result:
  *    An operating system result code.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIToolbarSetDelegate(
    inToolbar: HIToolbarRef;
    inDelegate: HIObjectRef): OSStatus; external name '_HIToolbarSetDelegate';

{
  *  HIToolbarGetDelegate()
  *
  *  Discussion:
  *    Returns the current delegate in use by a toolbar.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inToolbar:
  *      The toolbar you want the delegate from.
  *
  *  Result:
  *    An HIObjectRef.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIToolbarGetDelegate(inToolbar: HIToolbarRef): HIObjectRef; external name '_HIToolbarGetDelegate';

{==========================================================================}
{ HITOOLBARITEM                                                            }
{==========================================================================}
{ The HIObject class ID for the ToolbarItem class. }

{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kHIToolbarItemClassID CFSTRP('com.apple.hitoolbaritem')}
{$endc}



{ Required construction parameters

  You must pass these parameters in the initialization event if you are
  subclassing the toolbar item

       kEventParamToolbarItemIdentifier            typeCFStringRef
       kEventParamAttibutes                        typeUInt32              }


{
  *  HIToolbarItemCreate()
  *
  *  Discussion:
  *    Creates a toolbar item for use in a toolbar. Typically, you would
  *    create toolbar items in your delegate. When a toolbar needs to
  *    create an item with a given identifier, your delegate is asked to
  *    create it.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inIdentifier:
  *      The identifier of the item in question.
  *
  *    inOptions:
  *      Any options for the item.
  *
  *    outItem:
  *      The item you created.
  *
  *  Result:
  *    An operating system result code.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIToolbarItemCreate(
    inIdentifier: CFStringRef;
    inOptions: OptionBits;
    var outItem: HIToolbarItemRef): OSStatus; external name '_HIToolbarItemCreate';

{
  *  HIToolbarItemCopyIdentifier()
  *
  *  Discussion:
  *    Returns the identifier of the given item. The toolbar uses this
  *    identifier when writing the config information to the preferences
  *    (if set up for auto-config).
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inItem:
  *      The item in question.
  *
  *    outIdentifier:
  *      The identifier of the item. You should release this string when
  *      you are finished with it.
  *
  *  Result:
  *    An operating system result code.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIToolbarItemCopyIdentifier(
    inItem: HIToolbarItemRef;
    var outIdentifier: CFStringRef): OSStatus; external name '_HIToolbarItemCopyIdentifier';

{
  *  HIToolbarItemGetAttributes()
  *
  *  Discussion:
  *    Returns the attributes of the given item.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inItem:
  *      The item in question.
  *
  *    outAttributes:
  *      The attributes of the item.
  *
  *  Result:
  *    An operating system result code.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIToolbarItemGetAttributes(
    inItem: HIToolbarItemRef;
    var outAttributes: OptionBits): OSStatus; external name '_HIToolbarItemGetAttributes';

{
  *  HIToolbarItemChangeAttributes()
  *
  *  Discussion:
  *    Changes the attributes of a toolbar item. Only those attributes
  *    defined by the kHIToolbarItemChangeableAttrs can be passed into
  *    this API. All other options can only be specified at creation.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inItem:
  *      The item in question.
  *
  *    inAttrsToSet:
  *      The attributes to set on the item. This value can be
  *      kHIToolbarItemNoAttributes if you are only clearing attributes.
  *
  *    inAttrsToClear:
  *      The attributes to clear on the item. This value can be
  *      kHIToolbarItemNoAttributes if you are only setting attributes.
  *
  *  Result:
  *    An operating system result code.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIToolbarItemChangeAttributes(
    inItem: HIToolbarItemRef;
    inAttrsToSet: OptionBits;
    inAttrsToClear: OptionBits): OSStatus; external name '_HIToolbarItemChangeAttributes';

{
  *  HIToolbarItemSetLabel()
  *
  *  Discussion:
  *    Sets the label of a toolbar item. This is what the toolbar view
  *    will display underneath the image. It is also used in the
  *    configuration palette for configurable toolbars.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inItem:
  *      The item in question.
  *
  *    inLabel:
  *      The label. The toolbox will copy the string passed in.
  *
  *  Result:
  *    An operating system result code.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIToolbarItemSetLabel(
    inItem: HIToolbarItemRef;
    inLabel: CFStringRef): OSStatus; external name '_HIToolbarItemSetLabel';

{
  *  HIToolbarItemCopyLabel()
  *
  *  Discussion:
  *    Returns the label of a toolbar item.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inItem:
  *      The item in question.
  *
  *    outLabel:
  *      The label of the item. You should release this when you are
  *      finished with it.
  *
  *  Result:
  *    An operating system result code.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIToolbarItemCopyLabel(
    inItem: HIToolbarItemRef;
    var outLabel: CFStringRef): OSStatus; external name '_HIToolbarItemCopyLabel';

{
  *  HIToolbarItemSetHelpText()
  *
  *  Discussion:
  *    Sets the text used for help tags for a toolbar item.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inItem:
  *      The item in question.
  *
  *    inShortText:
  *      The short help text. This is what is displayed normally by the
  *      help tag system when the user hovers over the toolbar item with
  *      the mouse.
  *
  *    inLongText:
  *      The long help text. This is what is displayed by the help tag
  *      system when the user hovers over the toolbar item with the
  *      mouse and holds the command key down. This parameter is
  *      optional, you may pass NULL.
  *
  *  Result:
  *    An operating system result code.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIToolbarItemSetHelpText(
    inItem: HIToolbarItemRef;
    inShortText: CFStringRef;
    inLongText: CFStringRef): OSStatus; external name '_HIToolbarItemSetHelpText';        { can be NULL }

{
  *  HIToolbarItemCopyHelpText()
  *
  *  Discussion:
  *    Returns the text used for help tags for a toolbar item.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inItem:
  *      The item in question.
  *
  *    outShortText:
  *      The short help text. This is what is displayed normally by the
  *      help tag system when the user hovers over the toolbar item with
  *      the mouse. You should release this string when you are finished
  *      with it. If you do not wish to receive the short help text,
  *      pass NULL for this parameter.
  *
  *    outLongText:
  *      The long help text. This is what is displayed by the help tag
  *      system when the user hovers over the toolbar item with the
  *      mouse and holds the command key down. You should release this
  *      string when you are finished with it. If you do not wish to
  *      receive the long help text, pass NULL for this parameter.
  *
  *  Result:
  *    An operating system result code.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIToolbarItemCopyHelpText(
    inItem: HIToolbarItemRef;
    outShortText: CFStringRefPtr;       { can be NULL }
    outLongText: CFStringRefPtr): OSStatus; external name '_HIToolbarItemCopyHelpText';        { can be NULL }

{
  *  HIToolbarItemSetCommandID()
  *
  *  Discussion:
  *    Sets the command ID of a toolbar item. When an toolbar item is
  *    clicked, the default behavior is to send out the command assigned
  *    to the item. This API lets you set that command ID. The command
  *    is sent out via the ProcessHICommand API, so it uses Carbon
  *    Events.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inItem:
  *      The item in question.
  *
  *    inCommandID:
  *      The command ID.
  *
  *  Result:
  *    An operating system result code.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIToolbarItemSetCommandID(
    inItem: HIToolbarItemRef;
    inCommandID: MenuCommand): OSStatus; external name '_HIToolbarItemSetCommandID';

{
  *  HIToolbarItemGetCommandID()
  *
  *  Discussion:
  *    Gets the command ID of a toolbar item.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inItem:
  *      The item in question.
  *
  *    outCommandID:
  *      The command ID.
  *
  *  Result:
  *    An operating system result code.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIToolbarItemGetCommandID(
    inItem: HIToolbarItemRef;
    var outCommandID: MenuCommand): OSStatus; external name '_HIToolbarItemGetCommandID';

{
  *  HIToolbarItemSetIconRef()
  *
  *  Discussion:
  *    Sets the icon for a toolbar item.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inItem:
  *      The item in question.
  *
  *    inIcon:
  *      The icon ref. The toolbar will create an appropriate CGImageRef
  *      for the icon passed in. The icon can be released after this API
  *      is called.
  *
  *  Result:
  *    An operating system result code.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIToolbarItemSetIconRef(
    inItem: HIToolbarItemRef;
    inIcon: IconRef): OSStatus; external name '_HIToolbarItemSetIconRef';

{
  *  HIToolbarItemSetImage()
  *
  *  Discussion:
  *    Sets the image for a toolbar item. Currently, the image should be
  *    no higher than 32 pixels. This image is used both in the toolbar
  *    as well as the configuration sheet, if the toolbar is
  *    configurable.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inItem:
  *      The item in question.
  *
  *    inImage:
  *      The image. This image is retained by the toolbar item. You may
  *      release it after calling this API.
  *
  *  Result:
  *    An operating system result code.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIToolbarItemSetImage(
    inItem: HIToolbarItemRef;
    inImage: CGImageRef): OSStatus; external name '_HIToolbarItemSetImage';

{
  *  HIToolbarItemCopyImage()
  *
  *  Discussion:
  *    Returns the image for a toolbar item. This image is already
  *    retained by the time you receive it, so you can release it when
  *    you are done with it.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inItem:
  *      The item in question.
  *
  *    outImage:
  *      The retained image. You should release it when finished with it.
  *
  *  Result:
  *    An operating system result code.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIToolbarItemCopyImage(
    inItem: HIToolbarItemRef;
    var outImage: CGImageRef): OSStatus; external name '_HIToolbarItemCopyImage';

{
  *  HIToolbarItemSetMenu()
  *
  *  Discussion:
  *    Sets the submenu for a toolbar item. Normally, items do not have
  *    a submenu. You can attach one with this API. The submenu will, by
  *    default, show up both in the 'more items' indicator popup
  *    attached to the item name. It will also appear if the toolbar is
  *    in text only mode and the label is clicked. You should attach a
  *    Carbon Event handler to the menu to handle updating the menu
  *    items as appropriate before the menu is displayed.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inItem:
  *      The item in question.
  *
  *    inMenu:
  *      The menu. It is retained by the toolbar item, so you can safely
  *      release it after calling this API. On Mac OS X 10.3 and later,
  *      you can pass NULL for this parameter to remove and release any
  *      menu that might be attached.
  *
  *  Result:
  *    An operating system result code.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIToolbarItemSetMenu(
    inItem: HIToolbarItemRef;
    inMenu: MenuRef): OSStatus; external name '_HIToolbarItemSetMenu';    { can be NULL }

{
  *  HIToolbarItemCopyMenu()
  *
  *  Discussion:
  *    Gets the submenu for a toolbar item.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inItem:
  *      The item in question.
  *
  *    outMenu:
  *      The retained menu. You should release it when you are finished
  *      with it.
  *
  *  Result:
  *    An operating system result code.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIToolbarItemCopyMenu(
    inItem: HIToolbarItemRef;
    var outMenu: MenuRef): OSStatus; external name '_HIToolbarItemCopyMenu';

{
  *  HIToolbarItemGetToolbar()
  *
  *  Discussion:
  *    Gets the toolbar a toolbar item is attached to.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inItem:
  *      The item in question.
  *
  *  Result:
  *    The toolbar item reference of the toolbar this item is bound to,
  *    or NULL if this toolbar item is not attached to any toolbar.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIToolbarItemGetToolbar(inItem: HIToolbarItemRef): HIToolbarRef; external name '_HIToolbarItemGetToolbar';

{
  *  HIToolbarItemIsEnabled()
  *
  *  Discussion:
  *    Used to determine if a toolbar item is enabled.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inItem:
  *      The item in question.
  *
  *  Result:
  *    A boolean result.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIToolbarItemIsEnabled(inItem: HIToolbarItemRef): boolean; external name '_HIToolbarItemIsEnabled';

{
  *  HIToolbarItemSetEnabled()
  *
  *  Discussion:
  *    Enables or disables a toolbar item.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inItem:
  *      The item in question.
  *
  *    inEnabled:
  *      The new enabled state.
  *
  *  Result:
  *    An operating system result code.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIToolbarItemSetEnabled(
    inItem: HIToolbarItemRef;
    inEnabled: boolean): OSStatus; external name '_HIToolbarItemSetEnabled';

{
 *  HIToolbarItemConfigDataChanged()
 *
 *  Discussion:
 *    Informs the toolbar that the config data for a toolbar item has
 *    changed and should be written to the toolbar config prefs. This
 *    is used when a custom toolbar item has extra data (config data)
 *    that has changed (perhaps you've changed an alias that a toolbar
 *    item points to, for example). This function does nothing if the
 *    toolbar is not set to auto save its configuration.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inItem:
 *      The item whose information has changed.
 *
 *  Result:
 *    An operating system result code.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
 *    Non-Carbon CFM:   not available
}

// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
  function HIToolbarItemConfigDataChanged(inItem: HIToolbarItemRef): OSStatus; external name '_HIToolbarItemConfigDataChanged';

{$ALIGN MAC68K}
{#POP}
{unit HTMLRendering}
{$ALIGN MAC68K}








{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}


type
    HRReference    = ^SInt32; { an opaque 32-bit type }
    HRReferencePtr = ^HRReference;  { when a var xx:HRReference parameter can be nil, it is changed to xx: HRReferencePtr }
    {
     *  HRGetHTMLRenderingLibVersion()
     *
     *  Availability:
     *    Non-Carbon CFM:   in HTMLRenderingLib 1.0 and later
     *    CarbonLib:        in CarbonLib 1.1 and later
     *    Mac OS X:         in version 10.0 and later
        }
function HRGetHTMLRenderingLibVersion(var returnVers: NumVersion): OSStatus; external name '_HRGetHTMLRenderingLibVersion';



const
    kHRRendererHTML32Type       = $68743332 (* 'ht32' *);                       {  HTML 3.2  }


    {
     *  HRNewReference()
     *
     *  Availability:
     *    Non-Carbon CFM:   in HTMLRenderingLib 1.0 and later
     *    CarbonLib:        in CarbonLib 1.1 and later
     *    Mac OS X:         in version 10.0 and later
        }
function HRNewReference(var hrRef: HRReference; rendererType: OSType; grafPtr: GrafPtr): OSStatus; external name '_HRNewReference';

{
 *  HRNewReferenceInWindow()
 *
 *  Discussion:
 *    Use this API from  a Carbon App. All the contrrols created by the
 *    HTML renderer will be embedded in the root control of the window
 *    specified by the window ref.
 *
 *  Parameters:
 *
 *    hrRef:
 *      Pointer to the new reference created and returned by the
 *      renderer.
 *
 *    rendererType:
 *      Type of the renderer e.g. kHRRendererHTML32Type. Only this type
 *      is supported for now.
 *
 *    inWindowRef:
 *      Reference to the window for which rendering area will be
 *      specified.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 }
function HRNewReferenceInWindow(var hrRef: HRReference; rendererType: OSType; inWindowRef: WindowRef): OSStatus; external name '_HRNewReferenceInWindow';

{
 *  HRDisposeReference()
 *
 *  Availability:
 *    Non-Carbon CFM:   in HTMLRenderingLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function HRDisposeReference(hrRef: HRReference): OSStatus; external name '_HRDisposeReference';


{
 *  HRFreeMemory()
 *
 *  Availability:
 *    Non-Carbon CFM:   in HTMLRenderingLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function HRFreeMemory(inBytesNeeded: Size): SInt32; external name '_HRFreeMemory';


{ System level notifications }
{
 *  HRScreenConfigurationChanged()
 *
 *  Availability:
 *    Non-Carbon CFM:   in HTMLRenderingLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure HRScreenConfigurationChanged; external name '_HRScreenConfigurationChanged';

{
 *  HRIsHREvent()
 *
 *  Availability:
 *    Non-Carbon CFM:   in HTMLRenderingLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function HRIsHREvent(const (*var*) eventRecord: EventRecord): boolean; external name '_HRIsHREvent';


{ Drawing }
{
 *  HRSetGrafPtr()
 *
 *  Availability:
 *    Non-Carbon CFM:   in HTMLRenderingLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function HRSetGrafPtr(hrRef: HRReference; grafPtr: GrafPtr): OSStatus; external name '_HRSetGrafPtr';

{
 *  HRSetWindowRef()
 *
 *  Discussion:
 *    Use this API from  a Carbon App. All the contrrols created by the
 *    HTML renderer will be moved in the root control of the window
 *    specified by the window ref. All the drawing will now happen in
 *    the specified window.
 *
 *  Parameters:
 *
 *    hrRef:
 *      Reference to the renderer object.
 *
 *    windowRef:
 *      new Reference to the window to be attached to the above hrRef.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 }
function HRSetWindowRef(hrRef: HRReference; windowRef: WindowRef): OSStatus; external name '_HRSetWindowRef';

{
 *  HRSetEmbeddingControl()
 *
 *  Discussion:
 *    Use this API to tell the HTML Renderer to embed all the controls
 *    it has created so far and the new controls it creates after this
 *    call to be embedded in the given control. Useful if you wish to
 *    have an HTML displayed with in your dialog. e.g. Software Update
 *    needs this.
 *
 *  Parameters:
 *
 *    hrRef:
 *      Reference to the renderer object.
 *
 *    controlRef:
 *      all the future controls created by renderer are embeded in this
 *      controlRef.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 }
function HRSetEmbeddingControl(hrRef: HRReference; controlRef: ControlRef): OSStatus; external name '_HRSetEmbeddingControl';

{
 *  HRActivate()
 *
 *  Availability:
 *    Non-Carbon CFM:   in HTMLRenderingLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function HRActivate(hrRef: HRReference): OSStatus; external name '_HRActivate';

{
 *  HRDeactivate()
 *
 *  Availability:
 *    Non-Carbon CFM:   in HTMLRenderingLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function HRDeactivate(hrRef: HRReference): OSStatus; external name '_HRDeactivate';

{
 *  HRDraw()
 *
 *  Availability:
 *    Non-Carbon CFM:   in HTMLRenderingLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function HRDraw(hrRef: HRReference; updateRgnH: RgnHandle): OSStatus; external name '_HRDraw';

{
 *  HRDrawInPort()
 *
 *  Discussion:
 *    Use this API from  a Carbon App.  All the drawing will now happen
 *    in the specified port. This is the API you want to use to draw in
 *    an offscreen port, for example when printing. You could also use
 *    this API to draw in an on screen port.
 *
 *  Parameters:
 *
 *    hrRef:
 *      Reference to the renderer object.
 *
 *    updateRgnH:
 *      Region to be updated.
 *
 *    grafPtr:
 *      A graf pointer to render HTML into.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 }
function HRDrawInPort(hrRef: HRReference; updateRgnH: RgnHandle; grafPtr: CGrafPtr): OSStatus; external name '_HRDrawInPort';

{
 *  HRSetRenderingRect()
 *
 *  Availability:
 *    Non-Carbon CFM:   in HTMLRenderingLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function HRSetRenderingRect(hrRef: HRReference; const (*var*) renderingRect: Rect): OSStatus; external name '_HRSetRenderingRect';

{
 *  HRGetRenderedImageSize()
 *
 *  Availability:
 *    Non-Carbon CFM:   in HTMLRenderingLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function HRGetRenderedImageSize(hrRef: HRReference; var renderingSize: Point): OSStatus; external name '_HRGetRenderedImageSize';

{
 *  HRGetRenderedImageSize32()
 *
 *  Discussion:
 *    Use this API when the rendered image could have coordinates
 *    larger than what SInt16 can hold.
 *
 *  Parameters:
 *
 *    hrRef:
 *      Reference to the renderer object.
 *
 *    height:
 *      Height of the image is returned in this parameter.
 *
 *    width:
 *      Width of the image is returned in this parameter.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 }
function HRGetRenderedImageSize32(hrRef: HRReference; var height: UInt32; var width: UInt32): OSStatus; external name '_HRGetRenderedImageSize32';

{
 *  HRScrollToLocation()
 *
 *  Availability:
 *    Non-Carbon CFM:   in HTMLRenderingLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function HRScrollToLocation(hrRef: HRReference; var location: Point): OSStatus; external name '_HRScrollToLocation';

{
 *  HRScrollToImageLocation32()
 *
 *  Discussion:
 *    Use this API when specifying location to scroll to. Location is
 *    specified in image space.
 *
 *  Parameters:
 *
 *    hrRef:
 *      Reference to the renderer object.
 *
 *    h:
 *      Horizontal location.
 *
 *    v:
 *      Vertical location.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 }
function HRScrollToImageLocation32(hrRef: HRReference; h: SInt32; v: SInt32): OSStatus; external name '_HRScrollToImageLocation32';

{
 *  HRForceQuickdraw()
 *
 *  Availability:
 *    Non-Carbon CFM:   in HTMLRenderingLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function HRForceQuickdraw(hrRef: HRReference; forceQuickdraw: boolean): OSStatus; external name '_HRForceQuickdraw';


type
    HRScrollbarState            = SInt16;
const
    eHRScrollbarOn              = 0;
    eHRScrollbarOff             = 1;
    eHRScrollbarAuto            = 2;

    {
     *  HRSetScrollbarState()
     *
     *  Availability:
     *    Non-Carbon CFM:   in HTMLRenderingLib 1.0 and later
     *    CarbonLib:        in CarbonLib 1.1 and later
     *    Mac OS X:         in version 10.0 and later
        }
function HRSetScrollbarState(hrRef: HRReference; hScrollbarState: HRScrollbarState; vScrollbarState: HRScrollbarState): OSStatus; external name '_HRSetScrollbarState';

{
 *  HRSetDrawBorder()
 *
 *  Availability:
 *    Non-Carbon CFM:   in HTMLRenderingLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function HRSetDrawBorder(hrRef: HRReference; drawBorder: boolean): OSStatus; external name '_HRSetDrawBorder';

{
 *  HRSetGrowboxCutout()
 *
 *  Availability:
 *    Non-Carbon CFM:   in HTMLRenderingLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function HRSetGrowboxCutout(hrRef: HRReference; allowCutout: boolean): OSStatus; external name '_HRSetGrowboxCutout';

{ Navigation }
{
 *  HRGoToFile()
 *
 *  Availability:
 *    Non-Carbon CFM:   in HTMLRenderingLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function HRGoToFile(hrRef: HRReference; const (*var*) fsspec: FSSpec; addToHistory: boolean; forceRefresh: boolean): OSStatus; external name '_HRGoToFile';

{
 *  HRGoToURL()
 *
 *  Availability:
 *    Non-Carbon CFM:   in HTMLRenderingLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function HRGoToURL(hrRef: HRReference; url: ConstCStringPtr; addToHistory: boolean; forceRefresh: boolean): OSStatus; external name '_HRGoToURL';

{
 *  HRGoToAnchor()
 *
 *  Availability:
 *    Non-Carbon CFM:   in HTMLRenderingLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function HRGoToAnchor(hrRef: HRReference; anchorName: ConstCStringPtr): OSStatus; external name '_HRGoToAnchor';

{
 *  HRGoToPtr()
 *
 *  Availability:
 *    Non-Carbon CFM:   in HTMLRenderingLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function HRGoToPtr(hrRef: HRReference; buffer: CStringPtr; bufferSize: UInt32; addToHistory: boolean; forceRefresh: boolean): OSStatus; external name '_HRGoToPtr';

{
 *  HRGoToFSRef()
 *
 *  Discussion:
 *    Use these API from  a Carbon App instead of using HRGoToFile,
 *    HRGoToURL, HRGoToAnchor and HRGoToPtr. These APIs are same in
 *    behavior with their old counter parts. The only difference is
 *    that they take FSRef, CFURLRef, CFString, and CFData as
 *    parameters.
 *
 *  Parameters:
 *
 *    hrRef:
 *      Reference to the renderer object.
 *
 *    fref:
 *      Reference to HTML file that is be opened and rendered.
 *
 *    addToHistory:
 *      true if this file URL should be added to history.
 *
 *    forceRefresh:
 *      true if the rendering area should be refreshed.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 }
function HRGoToFSRef(hrRef: HRReference; const (*var*) fref: FSRef; addToHistory: boolean; forceRefresh: boolean): OSStatus; external name '_HRGoToFSRef';

{
 *  HRGoToCFURL()
 *
 *  Discussion:
 *    Use these API from  a Carbon App instead of using HRGoToFile,
 *    HRGoToURL, HRGoToAnchor and HRGoToPtr. These APIs are same in
 *    behavior with their old counter parts. The only difference is
 *    that they take FSRef, CFURLRef, CFString, and CFData as
 *    parameters.
 *
 *  Parameters:
 *
 *    hrRef:
 *      Reference to the renderer object.
 *
 *    url:
 *      Reference to url that is be rendered.
 *
 *    addToHistory:
 *      true if this URL should be added to history.
 *
 *    forceRefresh:
 *      true if the rendering area should be refreshed.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 }
function HRGoToCFURL(hrRef: HRReference; url: CFURLRef; addToHistory: boolean; forceRefresh: boolean): OSStatus; external name '_HRGoToCFURL';

{
 *  HRGoToAnchorCFString()
 *
 *  Discussion:
 *    Use these API from  a Carbon App instead of using HRGoToFile,
 *    HRGoToURL, HRGoToAnchor and HRGoToPtr. These APIs are same in
 *    behavior with their old counter parts. The only difference is
 *    that they take FSRef, CFURLRef, CFString, and CFData as
 *    parameters.
 *
 *  Parameters:
 *
 *    hrRef:
 *      Reference to the renderer object.
 *
 *    anchorName:
 *      Name of the anchor to be displayed.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 }
function HRGoToAnchorCFString(hrRef: HRReference; anchorName: CFStringRef): OSStatus; external name '_HRGoToAnchorCFString';

{
 *  HRGoToData()
 *
 *  Discussion:
 *    Use these API from  a Carbon App instead of using HRGoToFile,
 *    HRGoToURL, HRGoToAnchor and HRGoToPtr. These APIs are same in
 *    behavior with their old counter parts. The only difference is
 *    that they take FSRef, CFURLRef, CFString, and CFData as
 *    parameters.
 *
 *  Parameters:
 *
 *    hrRef:
 *      Reference to the renderer object.
 *
 *    data:
 *      Reference to data in the memory that is be rendered.
 *
 *    addToHistory:
 *      true if this file URL should be added to history.
 *
 *    forceRefresh:
 *      true if the rendering area should be refreshed.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 }
function HRGoToData(hrRef: HRReference; data: CFDataRef; addToHistory: boolean; forceRefresh: boolean): OSStatus; external name '_HRGoToData';

{ Accessors }
{ either file url or url of <base> tag }
{
 *  HRGetRootURL()
 *
 *  Availability:
 *    Non-Carbon CFM:   in HTMLRenderingLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function HRGetRootURL(hrRef: HRReference; rootURLH: Handle): OSStatus; external name '_HRGetRootURL';

{ url of <base> tag }
{
 *  HRGetBaseURL()
 *
 *  Availability:
 *    Non-Carbon CFM:   in HTMLRenderingLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function HRGetBaseURL(hrRef: HRReference; baseURLH: Handle): OSStatus; external name '_HRGetBaseURL';

{ file url }
{
 *  HRGetHTMLURL()
 *
 *  Availability:
 *    Non-Carbon CFM:   in HTMLRenderingLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function HRGetHTMLURL(hrRef: HRReference; HTMLURLH: Handle): OSStatus; external name '_HRGetHTMLURL';

{
 *  HRGetTitle()
 *
 *  Availability:
 *    Non-Carbon CFM:   in HTMLRenderingLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function HRGetTitle(hrRef: HRReference; title: StringPtr): OSStatus; external name '_HRGetTitle';

{
 *  HRGetHTMLFile()
 *
 *  Availability:
 *    Non-Carbon CFM:   in HTMLRenderingLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function HRGetHTMLFile(hrRef: HRReference; var fsspec: FSSpec): OSStatus; external name '_HRGetHTMLFile';


{
 *  HRGetRootURLAsCFString()
 *
 *  Discussion:
 *    Use these API from  a Carbon App instead of using HRGetRootURL,
 *    HRGetBaseURL, HRGetHTMLURL, HRGetTitle and HRGetHTMLFile. These
 *    APIs are same in behavior with their old counter parts. The only
 *    difference is that they take CFString, CFURLRef, and FSRef as
 *    parameters.
 *
 *  Parameters:
 *
 *    hrRef:
 *      Reference to the renderer object.
 *
 *    rootString:
 *      Get CFString equivalent for the root url.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 }
function HRGetRootURLAsCFString(hrRef: HRReference; var rootString: CFStringRef): OSStatus; external name '_HRGetRootURLAsCFString';

{
 *  HRGetBaseURLAsCFString()
 *
 *  Discussion:
 *    Use these API from  a Carbon App instead of using HRGetRootURL,
 *    HRGetBaseURL, HRGetHTMLURL, HRGetTitle and HRGetHTMLFile. These
 *    APIs are same in behavior with their old counter parts. The only
 *    difference is that they take CFString, CFURLRef, and FSRef as
 *    parameters.
 *
 *  Parameters:
 *
 *    hrRef:
 *      Reference to the renderer object.
 *
 *    baseString:
 *      Get CFString equivalent for the base url.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 }
function HRGetBaseURLAsCFString(hrRef: HRReference; var baseString: CFStringRef): OSStatus; external name '_HRGetBaseURLAsCFString';

{
 *  HRGetHTMLURLAsCFURL()
 *
 *  Discussion:
 *    Use these API from  a Carbon App instead of using HRGetRootURL,
 *    HRGetBaseURL, HRGetHTMLURL, HRGetTitle and HRGetHTMLFile. These
 *    APIs are same in behavior with their old counter parts. The only
 *    difference is that they take CFString, CFURLRef, and FSRef as
 *    parameters.
 *
 *  Parameters:
 *
 *    hrRef:
 *      Reference to the renderer object.
 *
 *    theURL:
 *      Get currently displayed HTML as a CFURL.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 }
function HRGetHTMLURLAsCFURL(hrRef: HRReference; var theURL: CFURLRef): OSStatus; external name '_HRGetHTMLURLAsCFURL';

{
 *  HRGetTitleAsCFString()
 *
 *  Discussion:
 *    Use these API from  a Carbon App instead of using HRGetRootURL,
 *    HRGetBaseURL, HRGetHTMLURL, HRGetTitle and HRGetHTMLFile. These
 *    APIs are same in behavior with their old counter parts. The only
 *    difference is that they take CFString, CFURLRef, and FSRef as
 *    parameters.
 *
 *  Parameters:
 *
 *    hrRef:
 *      Reference to the renderer object.
 *
 *    title:
 *      Get title of the currently displayed HTML as a CFString.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 }
function HRGetTitleAsCFString(hrRef: HRReference; var title: CFStringRef): OSStatus; external name '_HRGetTitleAsCFString';

{
 *  HRGetHTMLFileAsFSRef()
 *
 *  Discussion:
 *    Use these API from  a Carbon App instead of using HRGetRootURL,
 *    HRGetBaseURL, HRGetHTMLURL, HRGetTitle and HRGetHTMLFile. These
 *    APIs are same in behavior with their old counter parts. The only
 *    difference is that they take CFString, CFURLRef, and FSRef as
 *    parameters.
 *
 *  Parameters:
 *
 *    hrRef:
 *      Reference to the renderer object.
 *
 *    fref:
 *      Get currently displayed HTML as a FSRef.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 }
function HRGetHTMLFileAsFSRef(hrRef: HRReference; var fref: FSRef): OSStatus; external name '_HRGetHTMLFileAsFSRef';

{ Utilities }
{
 *  HRUtilCreateFullURL()
 *
 *  Availability:
 *    Non-Carbon CFM:   in HTMLRenderingLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function HRUtilCreateFullURL(rootURL: ConstCStringPtr; linkURL: ConstCStringPtr; fullURLH: Handle): OSStatus; external name '_HRUtilCreateFullURL';

{
 *  HRUtilGetFSSpecFromURL()
 *
 *  Availability:
 *    Non-Carbon CFM:   in HTMLRenderingLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function HRUtilGetFSSpecFromURL(rootURL: ConstCStringPtr; linkURL: ConstCStringPtr; var destSpec: FSSpec): OSStatus; external name '_HRUtilGetFSSpecFromURL';

{ urlHandle should be valid on input }
{
 *  HRUtilGetURLFromFSSpec()
 *
 *  Availability:
 *    Non-Carbon CFM:   in HTMLRenderingLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function HRUtilGetURLFromFSSpec(const (*var*) fsspec: FSSpec; urlHandle: Handle): OSStatus; external name '_HRUtilGetURLFromFSSpec';


{
 *  HRUtilCreateFullCFURL()
 *
 *  Discussion:
 *    Use these API from  a Carbon App instead of using
 *    HRUtilCreateFullURL, HRUtilGetFSSpecFromURL,
 *    HRUtilGetURLFromFSSpec. These APIs are same in behavior with
 *    their old counter parts. The only difference is that they take
 *    CFURLRef, and FSRef as parameters.
 *
 *  Parameters:
 *
 *    rootString:
 *      a CFString for the root.
 *
 *    linkString:
 *      a CFString for a partial link.
 *
 *    url:
 *      Fully qualified URL is returned after attaching a link string
 *      to the root.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 }
function HRUtilCreateFullCFURL(rootString: CFStringRef; linkString: CFStringRef; var url: CFURLRef): OSStatus; external name '_HRUtilCreateFullCFURL';

{
 *  HRUtilGetFSRefFromURL()
 *
 *  Discussion:
 *    Use these API from  a Carbon App instead of using
 *    HRUtilCreateFullURL, HRUtilGetFSSpecFromURL,
 *    HRUtilGetURLFromFSSpec. These APIs are same in behavior with
 *    their old counter parts. The only difference is that they take
 *    CFURLRef, and FSRef as parameters.
 *
 *  Parameters:
 *
 *    rootString:
 *      a CFString for the root.
 *
 *    linkString:
 *      a CFString for a partial link.
 *
 *    destRef:
 *      File reference is returned for the complete path created after
 *      attaching link string to the root. If File does not exist,
 *      fnfErr is returned as a function result.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 }
function HRUtilGetFSRefFromURL(rootString: CFStringRef; linkString: CFStringRef; var destRef: FSRef): OSStatus; external name '_HRUtilGetFSRefFromURL';

{
 *  HRUtilGetURLFromFSRef()
 *
 *  Discussion:
 *    Use these API from  a Carbon App instead of using
 *    HRUtilCreateFullURL, HRUtilGetFSSpecFromURL,
 *    HRUtilGetURLFromFSSpec. These APIs are same in behavior with
 *    their old counter parts. The only difference is that they take
 *    CFURLRef, and FSRef as parameters.
 *
 *  Parameters:
 *
 *    fileRef:
 *      Refernce to a file whose URL is desired.
 *
 *    url:
 *      a fully qualified URL is returned in this parameter. The
 *      returned URL gives the path of the file specified in the above
 *      parameter.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 }
function HRUtilGetURLFromFSRef(const (*var*) fileRef: FSRef; var url: CFURLRef): OSStatus; external name '_HRUtilGetURLFromFSRef';

{
    Visited links

    If you register a function here, it will be called to determine
    whether or not the given URL has been visited. It should return
    true if the URL has been visited.

    In addition to the URLs that the application may add to the list
    of visited links, it should also add URLs that the user clicks
    on. These URLs can be caught by the "add URL to history" callback
    below.
 }

type
    HRWasURLVisitedProcPtr = function(url: ConstCStringPtr; refCon: UnivPtr): boolean;

    HRWasURLVisitedUPP = ^SInt32; { an opaque UPP }
    {
     *  HRRegisterWasURLVisitedUPP()
     *
     *  Availability:
     *    Non-Carbon CFM:   in HTMLRenderingLib 1.0 and later
     *    CarbonLib:        in CarbonLib 1.1 and later
     *    Mac OS X:         in version 10.0 and later
        }
procedure HRRegisterWasURLVisitedUPP(inWasURLVisitedUPP: HRWasURLVisitedUPP; hrRef: HRReference; inRefCon: UnivPtr); external name '_HRRegisterWasURLVisitedUPP';

{
 *  HRUnregisterWasURLVisitedUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   in HTMLRenderingLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure HRUnregisterWasURLVisitedUPP(hrRef: HRReference); external name '_HRUnregisterWasURLVisitedUPP';

{
    Use these API from  a Carbon App instead of using HRRegisterWasURLVisitedUPP, HRUnregisterWasURLVisitedUPP.
    These APIs are same in behavior with their old counter parts. The only difference is that they take
    CFURLRef as parameters.

}

type
    HRWasCFURLVisitedProcPtr = function(url: CFURLRef; refCon: UnivPtr): boolean;

    HRWasCFURLVisitedUPP = ^SInt32; { an opaque UPP }
    {
     *  HRRegisterWasCFURLVisitedUPP()
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.3 and later
     *    Mac OS X:         in version 10.0 and later
        }
procedure HRRegisterWasCFURLVisitedUPP(inWasCFURLVisitedUPP: HRWasCFURLVisitedUPP; hrRef: HRReference; inRefCon: UnivPtr); external name '_HRRegisterWasCFURLVisitedUPP';

{
 *  HRUnregisterWasCFURLVisitedUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure HRUnregisterWasCFURLVisitedUPP(hrRef: HRReference); external name '_HRUnregisterWasCFURLVisitedUPP';


{
    New URL

    If you register a function here, it will be called every time
    the renderer is going to display a new URL. A few examples of how
    you might use this include...

        (a) maintaining a history of URLs
        (b) maintainging a list of visited links
        (c) setting a window title based on the new URL
}

type
    HRNewURLProcPtr = function(url: ConstCStringPtr; targetFrame: ConstCStringPtr; addToHistory: boolean; refCon: UnivPtr): OSStatus;

    HRNewURLUPP = ^SInt32; { an opaque UPP }
    {
     *  HRRegisterNewURLUPP()
     *
     *  Availability:
     *    Non-Carbon CFM:   in HTMLRenderingLib 1.0 and later
     *    CarbonLib:        in CarbonLib 1.1 and later
     *    Mac OS X:         in version 10.0 and later
        }
procedure HRRegisterNewURLUPP(inNewURLUPP: HRNewURLUPP; hrRef: HRReference; inRefCon: UnivPtr); external name '_HRRegisterNewURLUPP';

{
 *  HRUnregisterNewURLUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   in HTMLRenderingLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure HRUnregisterNewURLUPP(hrRef: HRReference); external name '_HRUnregisterNewURLUPP';


{
    Use these API from  a Carbon App instead of using HRRegisterNewURLUPP, HRUnregisterNewURLUPP.
    These APIs are same in behavior with their old counter parts. The only difference is that they take
    CFURLRef as parameters.
}

type
    HRNewCFURLProcPtr = function(url: CFURLRef; targetString: CFStringRef; addToHistory: boolean; refCon: UnivPtr): OSStatus;

    HRNewCFURLUPP = ^SInt32; { an opaque UPP }
    {
     *  HRRegisterNewCFURLUPP()
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.3 and later
     *    Mac OS X:         in version 10.0 and later
        }
procedure HRRegisterNewCFURLUPP(inURLUPP: HRNewCFURLUPP; hrRef: HRReference; inRefCon: UnivPtr); external name '_HRRegisterNewCFURLUPP';

{
 *  HRUnregisterNewCFURLUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure HRUnregisterNewCFURLUPP(hrRef: HRReference); external name '_HRUnregisterNewCFURLUPP';




{
    URL to FSSpec function

    If you register a function here, it will be called every time
    the renderer is going to locate a file. The function will be
    passed an enum indicating the type of file being asked for.
 }

type
    URLSourceType               = UInt16;
const
    kHRLookingForHTMLSource     = 1;
    kHRLookingForImage          = 2;
    kHRLookingForEmbedded       = 3;
    kHRLookingForImageMap       = 4;
    kHRLookingForFrame          = 5;


type
    HRURLToFSSpecProcPtr = function(rootURL: ConstCStringPtr; linkURL: ConstCStringPtr; var fsspec: FSSpec; urlSourceType: URLSourceType; refCon: UnivPtr): OSStatus;

    HRURLToFSSpecUPP = ^SInt32; { an opaque UPP }
    {
     *  HRRegisterURLToFSSpecUPP()
     *
     *  Availability:
     *    Non-Carbon CFM:   in HTMLRenderingLib 1.0 and later
     *    CarbonLib:        in CarbonLib 1.1 and later
     *    Mac OS X:         in version 10.0 and later
        }
procedure HRRegisterURLToFSSpecUPP(inURLToFSSpecUPP: HRURLToFSSpecUPP; hrRef: HRReference; inRefCon: UnivPtr); external name '_HRRegisterURLToFSSpecUPP';

{
 *  HRUnregisterURLToFSSpecUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   in HTMLRenderingLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure HRUnregisterURLToFSSpecUPP(hrRef: HRReference); external name '_HRUnregisterURLToFSSpecUPP';


{
    Use these API from  a Carbon App instead of using HRRegisterURLToFSSpecUPP, HRUnregisterURLToFSSpecUPP.
    These APIs are same in behavior with their old counter parts. The only difference is that they take
    FSRef as parameters.
}

type
    HRURLToFSRefProcPtr = function(rootString: CFStringRef; linkString: CFStringRef; var fref: FSRef; urlSourceType: URLSourceType; refCon: UnivPtr): OSStatus;

    HRURLToFSRefUPP = ^SInt32; { an opaque UPP }
    {
     *  HRRegisterURLToFSRefUPP()
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.3 and later
     *    Mac OS X:         in version 10.0 and later
        }
procedure HRRegisterURLToFSRefUPP(inURLToFSRefUPP: HRURLToFSRefUPP; hrRef: HRReference; inRefCon: UnivPtr); external name '_HRRegisterURLToFSRefUPP';

{
 *  HRUnregisterURLToFSRefUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure HRUnregisterURLToFSRefUPP(hrRef: HRReference); external name '_HRUnregisterURLToFSRefUPP';


const
    uppHRWasURLVisitedProcInfo = $000003D0;
    uppHRWasCFURLVisitedProcInfo = $000003D0;
    uppHRNewURLProcInfo = $000037F0;
    uppHRNewCFURLProcInfo = $000037F0;
    uppHRURLToFSSpecProcInfo = $0000EFF0;
    uppHRURLToFSRefProcInfo = $0000EFF0;
    {
     *  NewHRWasURLVisitedUPP()
     *
     *  Availability:
     *    Non-Carbon CFM:   available as macro/inline
     *    CarbonLib:        in CarbonLib 1.1 and later
     *    Mac OS X:         in version 10.0 and later
        }
function NewHRWasURLVisitedUPP(userRoutine: HRWasURLVisitedProcPtr): HRWasURLVisitedUPP; external name '_NewHRWasURLVisitedUPP'; { old name was NewHRWasURLVisitedProc }
{
 *  NewHRWasCFURLVisitedUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewHRWasCFURLVisitedUPP(userRoutine: HRWasCFURLVisitedProcPtr): HRWasCFURLVisitedUPP; external name '_NewHRWasCFURLVisitedUPP';
{
 *  NewHRNewURLUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewHRNewURLUPP(userRoutine: HRNewURLProcPtr): HRNewURLUPP; external name '_NewHRNewURLUPP'; { old name was NewHRNewURLProc }
{
 *  NewHRNewCFURLUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewHRNewCFURLUPP(userRoutine: HRNewCFURLProcPtr): HRNewCFURLUPP; external name '_NewHRNewCFURLUPP';
{
 *  NewHRURLToFSSpecUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewHRURLToFSSpecUPP(userRoutine: HRURLToFSSpecProcPtr): HRURLToFSSpecUPP; external name '_NewHRURLToFSSpecUPP'; { old name was NewHRURLToFSSpecProc }
{
 *  NewHRURLToFSRefUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewHRURLToFSRefUPP(userRoutine: HRURLToFSRefProcPtr): HRURLToFSRefUPP; external name '_NewHRURLToFSRefUPP';
{
 *  DisposeHRWasURLVisitedUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeHRWasURLVisitedUPP(userUPP: HRWasURLVisitedUPP); external name '_DisposeHRWasURLVisitedUPP';
{
 *  DisposeHRWasCFURLVisitedUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeHRWasCFURLVisitedUPP(userUPP: HRWasCFURLVisitedUPP); external name '_DisposeHRWasCFURLVisitedUPP';
{
 *  DisposeHRNewURLUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeHRNewURLUPP(userUPP: HRNewURLUPP); external name '_DisposeHRNewURLUPP';
{
 *  DisposeHRNewCFURLUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeHRNewCFURLUPP(userUPP: HRNewCFURLUPP); external name '_DisposeHRNewCFURLUPP';
{
 *  DisposeHRURLToFSSpecUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeHRURLToFSSpecUPP(userUPP: HRURLToFSSpecUPP); external name '_DisposeHRURLToFSSpecUPP';
{
 *  DisposeHRURLToFSRefUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeHRURLToFSRefUPP(userUPP: HRURLToFSRefUPP); external name '_DisposeHRURLToFSRefUPP';
{
 *  InvokeHRWasURLVisitedUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeHRWasURLVisitedUPP(url: ConstCStringPtr; refCon: UnivPtr; userRoutine: HRWasURLVisitedUPP): boolean; external name '_InvokeHRWasURLVisitedUPP'; { old name was CallHRWasURLVisitedProc }
{
 *  InvokeHRWasCFURLVisitedUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeHRWasCFURLVisitedUPP(url: CFURLRef; refCon: UnivPtr; userRoutine: HRWasCFURLVisitedUPP): boolean; external name '_InvokeHRWasCFURLVisitedUPP';
{
 *  InvokeHRNewURLUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeHRNewURLUPP(url: ConstCStringPtr; targetFrame: ConstCStringPtr; addToHistory: boolean; refCon: UnivPtr; userRoutine: HRNewURLUPP): OSStatus; external name '_InvokeHRNewURLUPP'; { old name was CallHRNewURLProc }
{
 *  InvokeHRNewCFURLUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeHRNewCFURLUPP(url: CFURLRef; targetString: CFStringRef; addToHistory: boolean; refCon: UnivPtr; userRoutine: HRNewCFURLUPP): OSStatus; external name '_InvokeHRNewCFURLUPP';
{
 *  InvokeHRURLToFSSpecUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeHRURLToFSSpecUPP(rootURL: ConstCStringPtr; linkURL: ConstCStringPtr; var fsspec: FSSpec; urlSourceType: URLSourceType; refCon: UnivPtr; userRoutine: HRURLToFSSpecUPP): OSStatus; external name '_InvokeHRURLToFSSpecUPP'; { old name was CallHRURLToFSSpecProc }
{
 *  InvokeHRURLToFSRefUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeHRURLToFSRefUPP(rootString: CFStringRef; linkString: CFStringRef; var fref: FSRef; urlSourceType: URLSourceType; refCon: UnivPtr; userRoutine: HRURLToFSRefUPP): OSStatus; external name '_InvokeHRURLToFSRefUPP';
{$ALIGN MAC68K}
{#POP}
{unit LanguageAnalysis}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN POWER}
{#LibExport+}


type
    LAEnvironmentRef    = ^SInt32; { an opaque 32-bit type }
    LAEnvironmentRefPtr = ^LAEnvironmentRef;  { when a var xx:LAEnvironmentRef parameter can be nil, it is changed to xx: LAEnvironmentRefPtr }
    LAContextRef    = ^SInt32; { an opaque 32-bit type }
    LAContextRefPtr = ^LAContextRef;  { when a var xx:LAContextRef parameter can be nil, it is changed to xx: LAContextRefPtr }
    LAPropertyKey                       = AEKeyword;
    LAPropertyType                      = DescType;
    {
        Data structure for high level API
        }
    LAMorphemeRecPtr = ^LAMorphemeRec;
    LAMorphemeRec = record
        sourceTextLength:       ByteCount;
        sourceTextPtr:          LogicalAddress;
        morphemeTextLength:     ByteCount;
        morphemeTextPtr:        LogicalAddress;
        partOfSpeech:           UInt32;
    end;

    LAMorphemesArrayPtr = ^LAMorphemesArray;
    LAMorphemesArray = record
        morphemesCount:         ItemCount;
        processedTextLength:    ByteCount;
        morphemesTextLength:    ByteCount;
        morphemes:              array [0..0] of LAMorphemeRec;
    end;


const
    kLAMorphemesArrayVersion    = 0;

    {
        Definitions for result path/bundle structure
        }

type
    LAMorphemeBundle                    = AERecord;
    LAMorphemeBundlePtr                 = ^LAMorphemeBundle;
    LAMorphemePath                      = AERecord;
    LAMorphemePathPtr                   = ^LAMorphemePath;
    LAMorpheme                          = AERecord;
    LAMorphemePtr                       = ^LAMorpheme;
    LAHomograph                         = AERecord;
    LAHomographPtr                      = ^LAHomograph;

const
    keyAELAMorphemeBundle       = $6C6D6662 (* 'lmfb' *);
    keyAELAMorphemePath         = $6C6D6670 (* 'lmfp' *);
    keyAELAMorpheme             = $6C6D666E (* 'lmfn' *);
    keyAELAHomograph            = $6C6D6668 (* 'lmfh' *);

    typeLAMorphemeBundle        = $7265636F (* 'reco' *);
    typeLAMorphemePath          = $7265636F (* 'reco' *);
    typeLAMorpheme              = $6C697374 (* 'list' *);
    typeLAHomograph             = $6C697374 (* 'list' *);

    {
        Definitions for morpheme/homograph information
        }
    keyAEMorphemePartOfSpeechCode = $6C616D63 (* 'lamc' *);
    keyAEMorphemeTextRange      = $6C616D74 (* 'lamt' *);

    typeAEMorphemePartOfSpeechCode = $6C616D63 (* 'lamc' *);
    typeAEMorphemeTextRange     = $6C616D74 (* 'lamt' *);


type
    MorphemePartOfSpeech                = UInt32;
    MorphemeTextRangePtr = ^MorphemeTextRange;
    MorphemeTextRange = record
        sourceOffset:           UInt32;
        length:                 UInt32;
    end;

    {
        Mask for High level API convert flags
        }

const
    kLAEndOfSourceTextMask      = $00000001;

    {
        Constants for leading/trailing path of analysis function
        }
    kLADefaultEdge              = 0;
    kLAFreeEdge                 = 1;
    kLAIncompleteEdge           = 2;

    {
        Constants for confirm and shift function
        }
    kLAAllMorphemes             = 0;


    {
        Library version
        }
    {
     *  LALibraryVersion()
     *
     *  Availability:
     *    Non-Carbon CFM:   in LanguageAnalysisLib 1.0 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function LALibraryVersion: UInt32; external name '_LALibraryVersion';

{
    High level API
}
{
 *  LATextToMorphemes()
 *
 *  Availability:
 *    Non-Carbon CFM:   in LanguageAnalysisLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function LATextToMorphemes(context: LAContextRef; preferedEncoding: TextEncoding; textLength: ByteCount; sourceText: ConstLogicalAddress; bufferSize: ByteCount; convertFlags: OptionBits; structureVersion: UInt32; var acceptedLength: ByteCount; resultBuffer: LAMorphemesArrayPtr): OSStatus; external name '_LATextToMorphemes';

{
    Handling Context
}
{
 *  LAOpenAnalysisContext()
 *
 *  Availability:
 *    Non-Carbon CFM:   in LanguageAnalysisLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function LAOpenAnalysisContext(environ: LAEnvironmentRef; var context: LAContextRef): OSStatus; external name '_LAOpenAnalysisContext';

{
 *  LACloseAnalysisContext()
 *
 *  Availability:
 *    Non-Carbon CFM:   in LanguageAnalysisLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function LACloseAnalysisContext(context: LAContextRef): OSStatus; external name '_LACloseAnalysisContext';

{
    Handling Environment
}
{
 *  LAGetEnvironmentList()
 *
 *  Availability:
 *    Non-Carbon CFM:   in LanguageAnalysisLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function LAGetEnvironmentList(maxCount: UInt32; var actualCount: UInt32; var environmentList: LAEnvironmentRef): OSStatus; external name '_LAGetEnvironmentList';

{
 *  LAGetEnvironmentName()
 *
 *  Availability:
 *    Non-Carbon CFM:   in LanguageAnalysisLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function LAGetEnvironmentName(environment: LAEnvironmentRef; var environmentName: Str63): OSStatus; external name '_LAGetEnvironmentName';

{
 *  LAGetEnvironmentRef()
 *
 *  Availability:
 *    Non-Carbon CFM:   in LanguageAnalysisLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function LAGetEnvironmentRef(const (*var*) targetEnvironmentName: Str63; var environment: LAEnvironmentRef): OSStatus; external name '_LAGetEnvironmentRef';

{
 *  LACreateCustomEnvironment()
 *
 *  Availability:
 *    Non-Carbon CFM:   in LanguageAnalysisLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function LACreateCustomEnvironment(baseEnvironment: LAEnvironmentRef; const (*var*) newEnvironmentName: Str63; persistent: boolean; var newEnvironment: LAEnvironmentRef): OSStatus; external name '_LACreateCustomEnvironment';

{
 *  LADeleteCustomEnvironment()
 *
 *  Availability:
 *    Non-Carbon CFM:   in LanguageAnalysisLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function LADeleteCustomEnvironment(environment: LAEnvironmentRef): OSStatus; external name '_LADeleteCustomEnvironment';

{
    Handling dictionries
}
{
 *  LAOpenDictionary()
 *
 *  Availability:
 *    Non-Carbon CFM:   in LanguageAnalysisLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function LAOpenDictionary(environ: LAEnvironmentRef; const (*var*) dictionary: FSSpec): OSStatus; external name '_LAOpenDictionary';

{
 *  LACloseDictionary()
 *
 *  Availability:
 *    Non-Carbon CFM:   in LanguageAnalysisLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function LACloseDictionary(environ: LAEnvironmentRef; const (*var*) dictionary: FSSpec): OSStatus; external name '_LACloseDictionary';

{
 *  LAListAvailableDictionaries()
 *
 *  Availability:
 *    Non-Carbon CFM:   in LanguageAnalysisLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function LAListAvailableDictionaries(environ: LAEnvironmentRef; maxCount: ItemCount; var actualCount: ItemCount; var dictionaryList: FSSpec; var opened: boolean): OSStatus; external name '_LAListAvailableDictionaries';

{
 *  LAAddNewWord()
 *
 *  Availability:
 *    Non-Carbon CFM:   in LanguageAnalysisLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function LAAddNewWord(environ: LAEnvironmentRef; const (*var*) dictionary: FSSpec; const (*var*) dataList: AEDesc): OSStatus; external name '_LAAddNewWord';

{
    Analyzing text
}
{
 *  LAMorphemeAnalysis()
 *
 *  Availability:
 *    Non-Carbon CFM:   in LanguageAnalysisLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function LAMorphemeAnalysis(context: LAContextRef; text: ConstUniCharArrayPtr; textLength: UniCharCount; var leadingPath: LAMorphemePath; var trailingPath: LAMorphemePath; pathCount: ItemCount; var result: LAMorphemeBundle): OSStatus; external name '_LAMorphemeAnalysis';

{
 *  LAContinuousMorphemeAnalysis()
 *
 *  Availability:
 *    Non-Carbon CFM:   in LanguageAnalysisLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function LAContinuousMorphemeAnalysis(context: LAContextRef; text: ConstUniCharArrayPtr; textLength: UniCharCount; incrementalText: boolean; var leadingPath: LAMorphemePath; var trailingPath: LAMorphemePath; var modified: boolean): OSStatus; external name '_LAContinuousMorphemeAnalysis';

{
 *  LAGetMorphemes()
 *
 *  Availability:
 *    Non-Carbon CFM:   in LanguageAnalysisLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function LAGetMorphemes(context: LAContextRef; var result: LAMorphemePath): OSStatus; external name '_LAGetMorphemes';

{
 *  LAShiftMorphemes()
 *
 *  Availability:
 *    Non-Carbon CFM:   in LanguageAnalysisLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function LAShiftMorphemes(context: LAContextRef; morphemeCount: ItemCount; var path: LAMorphemePath; var shiftedLength: UniCharCount): OSStatus; external name '_LAShiftMorphemes';

{
 *  LAResetAnalysis()
 *
 *  Availability:
 *    Non-Carbon CFM:   in LanguageAnalysisLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function LAResetAnalysis(context: LAContextRef): OSStatus; external name '_LAResetAnalysis';

{
    Check Language Analysis Manager availability
}
{ Language Analysis Manager is always available on OS X }

{
=============================================================================================
    Definitions for Japanese Analysis Module
=============================================================================================
}
{
    Names for default environments for Japanese analysis
}
{
    File cretor for dictionary of Apple Japanese access method
}

const
    kAppleJapaneseDictionarySignature = $6A6C616E (* 'jlan' *);

    {
        Engine limitations
        }
    kMaxInputLengthOfAppleJapaneseEngine = 200;

    {
        Definitions of information in the path/bundle
        }

type
    JapanesePartOfSpeech                = MorphemePartOfSpeech;
    HomographWeight                     = UInt16;
    HomographAccent                     = UInt8;
    {
        AE keywords and type definitions for morpheme/homograph information
        }

const
    keyAEHomographDicInfo       = $6C616864 (* 'lahd' *);
    keyAEHomographWeight        = $6C616877 (* 'lahw' *);
    keyAEHomographAccent        = $6C616861 (* 'laha' *);

    typeAEHomographDicInfo      = $6C616864 (* 'lahd' *);
    typeAEHomographWeight       = $73686F72 (* 'shor' *);
    typeAEHomographAccent       = $6C616861 (* 'laha' *);

    {
        Structure for dictionary information of homograph
        }

type
    HomographDicInfoRecPtr = ^HomographDicInfoRec;
    HomographDicInfoRec = record
        dictionaryID:           DCMDictionaryID;
        uniqueID:               DCMUniqueID;
    end;

    {
    =============================================================================================
        Definitions for Japanese part of speeches
    =============================================================================================
        }
    {
        Masks for part of speeches
        }

const
    kLASpeechRoughClassMask     = $0000F000;
    kLASpeechMediumClassMask    = $0000FF00;
    kLASpeechStrictClassMask    = $0000FFF0;
    kLASpeechKatsuyouMask       = $0000000F;


    {
        Part of speeches
        }
    kLASpeechMeishi             = $00000000;                    {  noun  }
    kLASpeechFutsuuMeishi       = $00000000;                    {  general noun  }
    kLASpeechJinmei             = $00000100;                    {  person name  }
    kLASpeechJinmeiSei          = $00000110;                    {  family name  }
    kLASpeechJinmeiMei          = $00000120;                    {  first name  }
    kLASpeechChimei             = $00000200;                    {  place name  }
    kLASpeechSetsubiChimei      = $00000210;                    {  place name with suffix  }
    kLASpeechSoshikimei         = $00000300;                    {  organization name  }
    kLASpeechKoyuuMeishi        = $00000400;                    {  proper noun  }
    kLASpeechSahenMeishi        = $00000500;                    {  special noun  }
    kLASpeechKeidouMeishi       = $00000600;                    {  special noun  }
    kLASpeechRentaishi          = $00001000;
    kLASpeechFukushi            = $00002000;                    {  adverb  }
    kLASpeechSetsuzokushi       = $00003000;                    {  conjunction  }
    kLASpeechKandoushi          = $00004000;
    kLASpeechDoushi             = $00005000;                    {  verb  }
    kLASpeechGodanDoushi        = $00005000;
    kLASpeechKagyouGodan        = $00005000;
    kLASpeechSagyouGodan        = $00005010;
    kLASpeechTagyouGodan        = $00005020;
    kLASpeechNagyouGodan        = $00005030;
    kLASpeechMagyouGodan        = $00005040;
    kLASpeechRagyouGodan        = $00005050;
    kLASpeechWagyouGodan        = $00005060;
    kLASpeechGagyouGodan        = $00005070;
    kLASpeechBagyouGodan        = $00005080;
    kLASpeechIchidanDoushi      = $00005100;
    kLASpeechKahenDoushi        = $00005200;
    kLASpeechSahenDoushi        = $00005300;
    kLASpeechZahenDoushi        = $00005400;
    kLASpeechKeiyoushi          = $00006000;                    {  adjective  }
    kLASpeechKeiyoudoushi       = $00007000;
    kLASpeechSettougo           = $00008000;                    {  prefix }
    kLASpeechSuujiSettougo      = $00008100;                    {  prefix for numbers  }
    kLASpeechSetsubigo          = $00009000;                    {  suffix  }
    kLASpeechJinmeiSetsubigo    = $00009100;                    {  suffix for person name  }
    kLASpeechChimeiSetsubigo    = $00009200;                    {  suffix for place name  }
    kLASpeechSoshikimeiSetsubigo = $00009300;                   {  suffix for organization name  }
    kLASpeechSuujiSetsubigo     = $00009400;                    {  suffix for numbers  }
    kLASpeechMuhinshi           = $0000A000;                    {  no category  }
    kLASpeechTankanji           = $0000A000;                    {  character  }
    kLASpeechKigou              = $0000A100;                    {  symbol  }
    kLASpeechKuten              = $0000A110;
    kLASpeechTouten             = $0000A120;
    kLASpeechSuushi             = $0000A200;                    {  numbers  }
    kLASpeechDokuritsugo        = $0000A300;
    kLASpeechSeiku              = $0000A400;
    kLASpeechJodoushi           = $0000B000;                    {  auxiliary verb  }
    kLASpeechJoshi              = $0000C000;                    {  postpositional particle  }


    {
        Conjugations
        }
    kLASpeechKatsuyouGokan      = $00000001;                    {  stem  }
    kLASpeechKatsuyouMizen      = $00000002;
    kLASpeechKatsuyouRenyou     = $00000003;
    kLASpeechKatsuyouSyuushi    = $00000004;
    kLASpeechKatsuyouRentai     = $00000005;
    kLASpeechKatsuyouKatei      = $00000006;
    kLASpeechKatsuyouMeirei     = $00000007;


{$ALIGN MAC68K}
{#POP}
{unit Lists}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}


type
    Cell                                = Point;
    CellPtr                             = ^Cell;
    ListBounds                          = Rect;
    ListBoundsPtr                       = ^ListBounds;
    DataArray                           = packed array [0..32000] of char;
    DataPtr                             = ^DataArray;
    DataHandle                          = ^DataPtr;
    ListSearchProcPtr = function(aPtr: Ptr; bPtr: Ptr; aLen: SInt16; bLen: SInt16): SInt16;

    ListClickLoopProcPtr = function: boolean;

    ListSearchUPP = ^SInt32; { an opaque UPP }
    ListClickLoopUPP = ^SInt32; { an opaque UPP }


type
    ListRecPtr = ^ListRec;
    ListRec = record
        rView:                  Rect;                                   {  in Carbon use Get/SetListViewBounds }
        port:                   GrafPtr;                                {  in Carbon use Get/SetListPort }
        indent:                 Point;                                  {  in Carbon use Get/SetListCellIndent }
        cellSize:               Point;                                  {  in Carbon use Get/SetListCellSize }
        visible:                ListBounds;                             {  in Carbon use GetListVisibleCells }
        vScroll:                ControlRef;                             {  in Carbon use GetListVerticalScrollBar }
        hScroll:                ControlRef;                             {  in Carbon use GetListHorizontalScrollBar }
        selFlags:               SInt8;                                  {  in Carbon use Get/SetListSelectionFlags }
        lActive:                boolean;                                {  in Carbon use LActivate, GetListActive }
        lReserved:              SInt8;                                  {  not supported in Carbon  }
        listFlags:              SInt8;                                  {  in Carbon use Get/SetListFlags  }
        clikTime:               SInt32;                             {  in Carbon use Get/SetListClickTime }
        clikLoc:                Point;                                  {  in Carbon use GetListClickLocation }
        mouseLoc:               Point;                                  {  in Carbon use GetListMouseLocation }
        lClickLoop:             ListClickLoopUPP;                       {  in Carbon use Get/SetListClickLoop }
        lastClick:              Cell;                                   {  in Carbon use SetListLastClick }
        refCon:                 SInt32;                             {  in Carbon use Get/SetListRefCon }
        listDefProc:            Handle;                                 {  not supported in Carbon  }
        userHandle:             Handle;                                 {  in Carbon use Get/SetListUserHandle }
        dataBounds:             ListBounds;                             {  in Carbon use GetListDataBounds }
        cells:                  DataHandle;                             {  in Carbon use LGet/SetCell }
        maxIndex:               SInt16;                             {  in Carbon use LGet/SetCell }
        cellArray:              array [0..0] of SInt16;             {  in Carbon use LGet/SetCell }
    end;

    ListPtr                             = ^ListRec;
    ListHandle                          = ^ListPtr;
    {  ListRef is obsolete.  Use ListHandle.  }
    ListRef                             = ListHandle;



const
                                                                {  ListRec.listFlags bits }
    lDrawingModeOffBit          = 3;
    lDoVAutoscrollBit           = 1;
    lDoHAutoscrollBit           = 0;

                                                                {  ListRec.listFlags masks }
    lDrawingModeOff             = 8;
    lDoVAutoscroll              = 2;
    lDoHAutoscroll              = 1;


                                                                {  ListRec.selFlags bits }
    lOnlyOneBit                 = 7;
    lExtendDragBit              = 6;
    lNoDisjointBit              = 5;
    lNoExtendBit                = 4;
    lNoRectBit                  = 3;
    lUseSenseBit                = 2;
    lNoNilHiliteBit             = 1;


                                                                {  ListRec.selFlags masks }
    lOnlyOne                    = -128;
    lExtendDrag                 = 64;
    lNoDisjoint                 = 32;
    lNoExtend                   = 16;
    lNoRect                     = 8;
    lUseSense                   = 4;
    lNoNilHilite                = 2;


                                                                {  LDEF messages }
    lInitMsg                    = 0;
    lDrawMsg                    = 1;
    lHiliteMsg                  = 2;
    lCloseMsg                   = 3;

    {
       StandardIconListCellDataRec is the cell data format for
       use with the standard icon list (kListDefStandardIconType).
    }

type
    StandardIconListCellDataRecPtr = ^StandardIconListCellDataRec;
    StandardIconListCellDataRec = record
        iconHandle:             Handle;
        font:                   SInt16;
        face:                   SInt16;
        size:                   SInt16;
        name:                   Str255;
    end;

    StandardIconListCellDataPtr         = ^StandardIconListCellDataRec;


    ListDefProcPtr = procedure(lMessage: SInt16; lSelect: boolean; var lRect: Rect; lCell: Cell; lDataOffset: SInt16; lDataLen: SInt16; lHandle: ListHandle);

    ListDefUPP = ^SInt32; { an opaque UPP }

const
    uppListSearchProcInfo = $00002BE0;
    uppListClickLoopProcInfo = $00000012;
    uppListDefProcInfo = $000EBD80;
    {
     *  NewListSearchUPP()
     *
     *  Availability:
     *    Non-Carbon CFM:   available as macro/inline
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function NewListSearchUPP(userRoutine: ListSearchProcPtr): ListSearchUPP; external name '_NewListSearchUPP'; { old name was NewListSearchProc }
{
 *  NewListClickLoopUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewListClickLoopUPP(userRoutine: ListClickLoopProcPtr): ListClickLoopUPP; external name '_NewListClickLoopUPP'; { old name was NewListClickLoopProc }
{
 *  NewListDefUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewListDefUPP(userRoutine: ListDefProcPtr): ListDefUPP; external name '_NewListDefUPP'; { old name was NewListDefProc }
{
 *  DisposeListSearchUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeListSearchUPP(userUPP: ListSearchUPP); external name '_DisposeListSearchUPP';
{
 *  DisposeListClickLoopUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeListClickLoopUPP(userUPP: ListClickLoopUPP); external name '_DisposeListClickLoopUPP';
{
 *  DisposeListDefUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeListDefUPP(userUPP: ListDefUPP); external name '_DisposeListDefUPP';
{
 *  InvokeListSearchUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeListSearchUPP(aPtr: Ptr; bPtr: Ptr; aLen: SInt16; bLen: SInt16; userRoutine: ListSearchUPP): SInt16; external name '_InvokeListSearchUPP'; { old name was CallListSearchProc }
{
 *  InvokeListClickLoopUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeListClickLoopUPP(userRoutine: ListClickLoopUPP): boolean; external name '_InvokeListClickLoopUPP'; { old name was CallListClickLoopProc }
{
 *  InvokeListDefUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvokeListDefUPP(lMessage: SInt16; lSelect: boolean; var lRect: Rect; lCell: Cell; lDataOffset: SInt16; lDataLen: SInt16; lHandle: ListHandle; userRoutine: ListDefUPP); external name '_InvokeListDefUPP'; { old name was CallListDefProc }
const
    kListDefProcPtr             = 0;
    kListDefUserProcType        = 0;
    kListDefStandardTextType    = 1;
    kListDefStandardIconType    = 2;


type
    ListDefType                         = UInt32;
    ListDefSpecPtr = ^ListDefSpec;
    ListDefSpec = record
        defType:                ListDefType;
        case SInt16 of
        0: (
            userProc:           ListDefUPP;
            );
    end;

    {
     *  CreateCustomList()
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function CreateCustomList(const (*var*) rView: Rect; const (*var*) dataBounds: ListBounds; cellSize: Point; const (*var*) theSpec: ListDefSpec; theWindow: WindowRef; drawIt: boolean; hasGrow: boolean; scrollHoriz: boolean; scrollVert: boolean; var outList: ListHandle): OSStatus; external name '_CreateCustomList';



{
 *  LNew()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function LNew(const (*var*) rView: Rect; const (*var*) dataBounds: ListBounds; cSize: Point; theProc: SInt16; theWindow: WindowRef; drawIt: boolean; hasGrow: boolean; scrollHoriz: boolean; scrollVert: boolean): ListHandle; external name '_LNew';
{
 *  LDispose()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure LDispose(lHandle: ListHandle); external name '_LDispose';
{
 *  LAddColumn()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function LAddColumn(count: SInt16; colNum: SInt16; lHandle: ListHandle): SInt16; external name '_LAddColumn';
{
 *  LAddRow()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function LAddRow(count: SInt16; rowNum: SInt16; lHandle: ListHandle): SInt16; external name '_LAddRow';
{
 *  LDelColumn()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure LDelColumn(count: SInt16; colNum: SInt16; lHandle: ListHandle); external name '_LDelColumn';
{
 *  LDelRow()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure LDelRow(count: SInt16; rowNum: SInt16; lHandle: ListHandle); external name '_LDelRow';
{
 *  LGetSelect()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function LGetSelect(next: boolean; var theCell: Cell; lHandle: ListHandle): boolean; external name '_LGetSelect';
{
 *  LLastClick()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function LLastClick(lHandle: ListHandle): Cell; external name '_LLastClick';
{
 *  LNextCell()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function LNextCell(hNext: boolean; vNext: boolean; var theCell: Cell; lHandle: ListHandle): boolean; external name '_LNextCell';
{
 *  LSearch()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function LSearch(dataPtr: UnivPtr; dataLen: SInt16; searchProc: ListSearchUPP; var theCell: Cell; lHandle: ListHandle): boolean; external name '_LSearch';
{
 *  LSize()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure LSize(listWidth: SInt16; listHeight: SInt16; lHandle: ListHandle); external name '_LSize';
{
 *  LSetDrawingMode()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure LSetDrawingMode(drawIt: boolean; lHandle: ListHandle); external name '_LSetDrawingMode';
{
 *  LScroll()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure LScroll(dCols: SInt16; dRows: SInt16; lHandle: ListHandle); external name '_LScroll';
{
 *  LAutoScroll()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure LAutoScroll(lHandle: ListHandle); external name '_LAutoScroll';
{
 *  LUpdate()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure LUpdate(theRgn: RgnHandle; lHandle: ListHandle); external name '_LUpdate';
{
 *  LActivate()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure LActivate(act: boolean; lHandle: ListHandle); external name '_LActivate';
{
 *  LCellSize()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure LCellSize(cSize: Point; lHandle: ListHandle); external name '_LCellSize';
{
 *  LClick()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function LClick(pt: Point; modifiers: EventModifiers; lHandle: ListHandle): boolean; external name '_LClick';
{
 *  LAddToCell()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure LAddToCell(dataPtr: UnivPtr; dataLen: SInt16; theCell: Cell; lHandle: ListHandle); external name '_LAddToCell';
{
 *  LClrCell()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure LClrCell(theCell: Cell; lHandle: ListHandle); external name '_LClrCell';
{
 *  LGetCell()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure LGetCell(dataPtr: UnivPtr; var dataLen: SInt16; theCell: Cell; lHandle: ListHandle); external name '_LGetCell';
{
 *  LRect()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure LRect(var cellRect: Rect; theCell: Cell; lHandle: ListHandle); external name '_LRect';
{
 *  LSetCell()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure LSetCell(dataPtr: UnivPtr; dataLen: SInt16; theCell: Cell; lHandle: ListHandle); external name '_LSetCell';
{
 *  LSetSelect()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure LSetSelect(setIt: boolean; theCell: Cell; lHandle: ListHandle); external name '_LSetSelect';
{
 *  LDraw()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure LDraw(theCell: Cell; lHandle: ListHandle); external name '_LDraw';
{
 *  LGetCellDataLocation()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure LGetCellDataLocation(var offset: SInt16; var len: SInt16; theCell: Cell; lHandle: ListHandle); external name '_LGetCellDataLocation';
{  Routines available in Carbon only }

{
 *  RegisterListDefinition()
 *
 *  Summary:
 *    Registers a binding between a resource ID and a list definition
 *    function.
 *
 *  Discussion:
 *    In the Mac OS 8.x List Manager, a 'ldes' resource can contain an
 *    embedded LDEF procID that is used by the List Manager as the
 *    resource ID of an 'LDEF' resource to measure and draw the list.
 *    Since LDEFs can no longer be packaged as code resources on
 *    Carbon, the procID can no longer refer directly to an LDEF
 *    resource. However, using RegisterListDefinition you can instead
 *    specify a UniversalProcPtr pointing to code in your application
 *    code fragment.
 *
 *  Parameters:
 *
 *    inResID:
 *      An LDEF proc ID, as used in a 'ldes' resource.
 *
 *    inDefSpec:
 *      Specifies the ListDefUPP that should be used for lists with the
 *      given LDEF procID.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.5 and later
 *    Mac OS X:         in version 10.0 and later
 }
function RegisterListDefinition(inResID: SInt16; inDefSpec: ListDefSpecPtr): OSStatus; external name '_RegisterListDefinition';




{ Getters }
{
 *  GetListViewBounds()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetListViewBounds(list: ListHandle; var view: Rect): RectPtr; external name '_GetListViewBounds';

{
 *  GetListPort()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetListPort(list: ListHandle): CGrafPtr; external name '_GetListPort';

{
 *  GetListCellIndent()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetListCellIndent(list: ListHandle; var indent: Point): PointPtr; external name '_GetListCellIndent';

{
 *  GetListCellSize()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetListCellSize(list: ListHandle; var size: Point): PointPtr; external name '_GetListCellSize';

{
 *  GetListVisibleCells()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetListVisibleCells(list: ListHandle; var visible: ListBounds): ListBoundsPtr; external name '_GetListVisibleCells';

{
 *  GetListVerticalScrollBar()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetListVerticalScrollBar(list: ListHandle): ControlRef; external name '_GetListVerticalScrollBar';

{
 *  GetListHorizontalScrollBar()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetListHorizontalScrollBar(list: ListHandle): ControlRef; external name '_GetListHorizontalScrollBar';

{
 *  GetListActive()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetListActive(list: ListHandle): boolean; external name '_GetListActive';

{
 *  GetListClickTime()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetListClickTime(list: ListHandle): SInt32; external name '_GetListClickTime';

{
 *  GetListClickLocation()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetListClickLocation(list: ListHandle; var click: Point): PointPtr; external name '_GetListClickLocation';

{
 *  GetListMouseLocation()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetListMouseLocation(list: ListHandle; var mouse: Point): PointPtr; external name '_GetListMouseLocation';

{
 *  GetListClickLoop()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetListClickLoop(list: ListHandle): ListClickLoopUPP; external name '_GetListClickLoop';

{
 *  GetListRefCon()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetListRefCon(list: ListHandle): SInt32; external name '_GetListRefCon';

{
 *  GetListDefinition()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetListDefinition(list: ListHandle): Handle; external name '_GetListDefinition';

{
 *  GetListUserHandle()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetListUserHandle(list: ListHandle): Handle; external name '_GetListUserHandle';

{
 *  GetListDataBounds()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetListDataBounds(list: ListHandle; var bounds: ListBounds): ListBoundsPtr; external name '_GetListDataBounds';

{
 *  GetListDataHandle()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetListDataHandle(list: ListHandle): DataHandle; external name '_GetListDataHandle';

{
 *  GetListFlags()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetListFlags(list: ListHandle): OptionBits; external name '_GetListFlags';

{
 *  GetListSelectionFlags()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetListSelectionFlags(list: ListHandle): OptionBits; external name '_GetListSelectionFlags';

{ Setters }
{
 *  SetListViewBounds()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetListViewBounds(list: ListHandle; const (*var*) view: Rect); external name '_SetListViewBounds';

{
 *  SetListPort()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetListPort(list: ListHandle; port: CGrafPtr); external name '_SetListPort';

{
 *  SetListCellIndent()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetListCellIndent(list: ListHandle; var indent: Point); external name '_SetListCellIndent';

{
 *  SetListClickTime()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetListClickTime(list: ListHandle; time: SInt32); external name '_SetListClickTime';

{
 *  SetListClickLoop()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetListClickLoop(list: ListHandle; clickLoop: ListClickLoopUPP); external name '_SetListClickLoop';

{
 *  SetListLastClick()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetListLastClick(list: ListHandle; var lastClick: Cell); external name '_SetListLastClick';

{
 *  SetListRefCon()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetListRefCon(list: ListHandle; refCon: SInt32); external name '_SetListRefCon';

{
 *  SetListUserHandle()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetListUserHandle(list: ListHandle; userHandle: Handle); external name '_SetListUserHandle';

{
 *  SetListFlags()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetListFlags(list: ListHandle; listFlags: OptionBits); external name '_SetListFlags';

{
 *  SetListSelectionFlags()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetListSelectionFlags(list: ListHandle; selectionFlags: OptionBits); external name '_SetListSelectionFlags';


{$ALIGN MAC68K}
{#POP}
{unit MacApplication}
{$ALIGN MAC68K}








{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}

{
 *  SetApplicationDockTileImage()
 *
 *  Discussion:
 *    Sets the image for the tile in the dock that represents your
 *    application while it is running. If you set the image, it will
 *    NOT revert back to its original image when your application
 *    terminates. You need to manually restore it before quitting.
 *
 *  Parameters:
 *
 *    inImage:
 *      The image you wish to have as your tile image.
 *
 *  Result:
 *    An operating system status code.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetApplicationDockTileImage(inImage: CGImageRef): OSStatus; external name '_SetApplicationDockTileImage';

{
 *  OverlayApplicationDockTileImage()
 *
 *  Discussion:
 *    Takes the image passed in and composites it on top of the current
 *    image of your application's dock tile. You might do this to put a
 *    standard badge over your application's icon to indicate something
 *    to the user.
 *
 *  Parameters:
 *
 *    inImage:
 *      The image you wish to overlay onto your tile image.
 *
 *  Result:
 *    An operating system status code.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OverlayApplicationDockTileImage(inImage: CGImageRef): OSStatus; external name '_OverlayApplicationDockTileImage';

{
 *  RestoreApplicationDockTileImage()
 *
 *  Discussion:
 *    Restores the tile for your appliation in the dock to its normal
 *    image (your application icon). You would use this if some overlay
 *    or change of the application icon needed to be removed.
 *
 *  Result:
 *    An operating system status code.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function RestoreApplicationDockTileImage: OSStatus; external name '_RestoreApplicationDockTileImage';

{
 *  BeginCGContextForApplicationDockTile()
 *
 *  Discussion:
 *    Creates and returns a CGContextRef. You can use this context to
 *    draw into your application's dock tile with Quartz. You **MUST**
 *    call EndCGContextForApplicationDockTile and NOT CGEndContext when
 *    using this API, as it locks your application's tile in the dock.
 *    If you call CGEndContext, the dock will never know you are done
 *    with the tile.
 *
 *  Result:
 *    An Quartz (Core Graphics) context reference.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function BeginCGContextForApplicationDockTile: CGContextRef; external name '_BeginCGContextForApplicationDockTile';

{
 *  EndCGContextForApplicationDockTile()
 *
 *  Discussion:
 *    Ends the CG context for your application tile and frees the lock
 *    on the application dock tile. You **MUST** call this routine and
 *    NOT CGEndContext when using BeginCGContextForApplicationDockTile,
 *    as it locks your application's tile in the dock. If you call
 *    CGEndContext, the dock will never know you are done with the tile.
 *
 *  Parameters:
 *
 *    inContext:
 *      The context to end. The context is invalid after this call and
 *      should no longer be used.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure EndCGContextForApplicationDockTile(inContext: CGContextRef); external name '_EndCGContextForApplicationDockTile';



{
 *  BeginQDContextForApplicationDockTile()
 *
 *  Discussion:
 *    Creates and returns a CGrafPtr for your application's tile in the
 *    dock. You can use this port to draw into your application's dock
 *    tile with Quickdraw. You **MUST** call
 *    EndQDContextForApplicationDockTile and NOT DisposePort when using
 *    this API, as it locks your application's tile in the dock. If you
 *    call DisposePort, the dock will never know you are done with the
 *    tile.
 *
 *  Result:
 *    A Quickdraw port reference.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function BeginQDContextForApplicationDockTile: CGrafPtr; external name '_BeginQDContextForApplicationDockTile';

{
 *  EndQDContextForApplicationDockTile()
 *
 *  Discussion:
 *    Disposes the Quickdraw port for your application tile and frees
 *    the lock on the application dock tile. You **MUST** call this
 *    routine and NOT DisposePort when using
 *    BeginQDContextForApplicationDockTile, else the dock will never
 *    know you are done with the tile.
 *
 *  Parameters:
 *
 *    inContext:
 *      The context to end. The context is invalid after this call and
 *      should no longer be used.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure EndQDContextForApplicationDockTile(inContext: CGrafPtr); external name '_EndQDContextForApplicationDockTile';


{
 *  SetApplicationDockTileMenu()
 *
 *  Summary:
 *    Sets the menu that is displayed by the application's dock tile.
 *
 *  Discussion:
 *    The Carbon Window Manager and the Dock will always automatically
 *    display a menu containing a list of the application's document
 *    windows. If the application wants to add other additional menu
 *    items, it can use the SetApplicationDockTileMenu API to provide
 *    those items. The items in the specified menu will be combined
 *    with the window title items. This API increments the refcount of
 *    the specified menu. Before the menu is actually displayed, it
 *    will receive kEventMenuPopulate, kEventMenuOpening, and
 *    kEventMenuEnableItems Carbon events, so any event handlers for
 *    these events may update the menu appropriately for the current
 *    state of the application. The application should set a command ID
 *    for each menu item in the dock tile menu, and when that item is
 *    chosen, a kEventCommandProcess Carbon event containing the item's
 *    command ID will be sent to the user focus target.
 *
 *  Parameters:
 *
 *    inMenu:
 *      The menu to display, or NULL to remove the current dock tile
 *      menu.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.1 and later
 *    Mac OS X:         in version 10.1 and later
 }
function SetApplicationDockTileMenu(inMenu: MenuRef): OSStatus; external name '_SetApplicationDockTileMenu';

{
 *  GetApplicationDockTileMenu()
 *
 *  Summary:
 *    Returns the menu that is displayed by the application's dock tile.
 *
 *  Result:
 *    The application's dock tile menu, or NULL if none.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.1 and later
 *    Mac OS X:         in version 10.1 and later
 }
function GetApplicationDockTileMenu: MenuRef; external name '_GetApplicationDockTileMenu';


{
 *  CreateCGImageFromPixMaps()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CreateCGImageFromPixMaps(inImage: PixMapHandle; inMask: PixMapHandle; var outImage: CGImageRef): OSStatus; external name '_CreateCGImageFromPixMaps';


{$ALIGN MAC68K}
{#POP}
{unit OSA}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}

{*************************************************************************
    Types and Constants
*************************************************************************}

{    The componenent manager type code for components that
        support the OSA interface defined here. }
{ 0x6f736120 }

const
    kOSAComponentType           = $6F736120 (* 'osa ' *);

    {    0x73637074     }
    kOSAGenericScriptingComponentSubtype = $73637074 (* 'scpt' *);

    {     Type of script document files.    }
    {    0x6f736173     }
    kOSAFileType                = $6F736173 (* 'osas' *);

    {
            Suite and event code of the RecordedText event.
            (See OSAStartRecording, below.)
            }
    {    0x61736372     }
    kOSASuite                   = $61736372 (* 'ascr' *);

    {    0x72656364     }
    kOSARecordedText            = $72656364 (* 'recd' *);

    {    Selector returns boolean   }
    {    0x6d6f6469     }
    kOSAScriptIsModified        = $6D6F6469 (* 'modi' *);

    {    Selector returns boolean   }
    {    0x63736372     }
    kOSAScriptIsTypeCompiledScript = $63736372 (* 'cscr' *);

    {    Selector returns boolean   }
    {    0x76616c75     }
    kOSAScriptIsTypeScriptValue = $76616C75 (* 'valu' *);

    {    Selector returns boolean   }
    {    0x636e7478     }
    kOSAScriptIsTypeScriptContext = $636E7478 (* 'cntx' *);

    {    Selector returns a DescType which may be passed to OSACoerceToDesc     }
    {    0x62657374     }
    kOSAScriptBestType          = $62657374 (* 'best' *);

    {
            This selector is used to determine whether a script has source
            associated with it that when given to OSAGetSource, the call will not
            fail.  The selector returns a boolean.
            }
    {    0x67737263     }
    kOSACanGetSource            = $67737263 (* 'gsrc' *);


    typeOSADialectInfo          = $6469666F (* 'difo' *);                       {   0x6469666f    }
    keyOSADialectName           = $646E616D (* 'dnam' *);                       {   0x646e616d    }
    keyOSADialectCode           = $64636F64 (* 'dcod' *);                       {   0x64636f64    }
    keyOSADialectLangCode       = $646C6364 (* 'dlcd' *);                       {   0x646c6364    }
    keyOSADialectScriptCode     = $64736364 (* 'dscd' *);                       {   0x64736364    }


type
    OSAError                            = ComponentResult;
    {    Under the Open Scripting Architecture all error results are longs  }
    OSAID                               = UInt32;
    {
            OSAIDs allow transparent manipulation of scripts associated with
            various scripting systems.
            }

const
    kOSANullScript              = 0;

    {    No -script constant.   }
    kOSANullMode                = 0;                            {  sounds better  }
    kOSAModeNull                = 0;                            {  tastes consistent  }

    {
            Some routines take flags that control their execution.  This constant
            declares default mode settings are used.
            }

type
    OSACreateAppleEventProcPtr = function(theAEEventClass: AEEventClass; theAEEventID: AEEventID; const (*var*) target: AEAddressDesc; returnID: SInt16; transactionID: SInt32; var result: AppleEvent; refCon: SInt32): OSErr;

    OSASendProcPtr = function(const (*var*) theAppleEvent: AppleEvent; var reply: AppleEvent; sendMode: AESendMode; sendPriority: AESendPriority; timeOutInTicks: SInt32; idleProc: AEIdleUPP; filterProc: AEFilterUPP; refCon: SInt32): OSErr;

    OSACreateAppleEventUPP = ^SInt32; { an opaque UPP }
    OSASendUPP = ^SInt32; { an opaque UPP }

const
    uppOSACreateAppleEventProcInfo = $000FEFE0;
    uppOSASendProcInfo = $003FEFE0;
    {
     *  NewOSACreateAppleEventUPP()
     *
     *  Availability:
     *    Non-Carbon CFM:   available as macro/inline
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function NewOSACreateAppleEventUPP(userRoutine: OSACreateAppleEventProcPtr): OSACreateAppleEventUPP; external name '_NewOSACreateAppleEventUPP'; { old name was NewOSACreateAppleEventProc }
{
 *  NewOSASendUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewOSASendUPP(userRoutine: OSASendProcPtr): OSASendUPP; external name '_NewOSASendUPP'; { old name was NewOSASendProc }
{
 *  DisposeOSACreateAppleEventUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeOSACreateAppleEventUPP(userUPP: OSACreateAppleEventUPP); external name '_DisposeOSACreateAppleEventUPP';
{
 *  DisposeOSASendUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeOSASendUPP(userUPP: OSASendUPP); external name '_DisposeOSASendUPP';
{
 *  InvokeOSACreateAppleEventUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeOSACreateAppleEventUPP(theAEEventClass: AEEventClass; theAEEventID: AEEventID; const (*var*) target: AEAddressDesc; returnID: SInt16; transactionID: SInt32; var result: AppleEvent; refCon: SInt32; userRoutine: OSACreateAppleEventUPP): OSErr; external name '_InvokeOSACreateAppleEventUPP'; { old name was CallOSACreateAppleEventProc }
{
 *  InvokeOSASendUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeOSASendUPP(const (*var*) theAppleEvent: AppleEvent; var reply: AppleEvent; sendMode: AESendMode; sendPriority: AESendPriority; timeOutInTicks: SInt32; idleProc: AEIdleUPP; filterProc: AEFilterUPP; refCon: SInt32; userRoutine: OSASendUPP): OSErr; external name '_InvokeOSASendUPP'; { old name was CallOSASendProc }
{*************************************************************************
    OSA Interface Descriptions
**************************************************************************
    The OSA Interface is broken down into a required interface, and several
    optional interfaces to support additional functionality.  A given scripting
    component may choose to support only some of the optional interfaces in
    addition to the basic interface.  The OSA Component Flags may be used to
    query the Component Manager to find a scripting component with a particular
    capability, or determine if a particular scripting component supports a
    particular capability.
*************************************************************************}
{ OSA Component Flags: }

const
    kOSASupportsCompiling       = $0002;
    kOSASupportsGetSource       = $0004;
    kOSASupportsAECoercion      = $0008;
    kOSASupportsAESending       = $0010;
    kOSASupportsRecording       = $0020;
    kOSASupportsConvenience     = $0040;
    kOSASupportsDialects        = $0080;
    kOSASupportsEventHandling   = $0100;

    {    Component Selectors:   }
    kOSASelectLoad              = $0001;
    kOSASelectStore             = $0002;
    kOSASelectExecute           = $0003;
    kOSASelectDisplay           = $0004;
    kOSASelectScriptError       = $0005;
    kOSASelectDispose           = $0006;
    kOSASelectSetScriptInfo     = $0007;
    kOSASelectGetScriptInfo     = $0008;
    kOSASelectSetActiveProc     = $0009;
    kOSASelectGetActiveProc     = $000A;

    {    Compiling:     }
    kOSASelectScriptingComponentName = $0102;
    kOSASelectCompile           = $0103;
    kOSASelectCopyID            = $0104;

    kOSASelectCopyScript        = $0105;

    {    GetSource:     }
    kOSASelectGetSource         = $0201;

    {    AECoercion:    }
    kOSASelectCoerceFromDesc    = $0301;
    kOSASelectCoerceToDesc      = $0302;

    {    AESending:     }
    kOSASelectSetSendProc       = $0401;
    kOSASelectGetSendProc       = $0402;
    kOSASelectSetCreateProc     = $0403;
    kOSASelectGetCreateProc     = $0404;
    kOSASelectSetDefaultTarget  = $0405;

    {    Recording:     }
    kOSASelectStartRecording    = $0501;
    kOSASelectStopRecording     = $0502;

    {    Convenience:   }
    kOSASelectLoadExecute       = $0601;
    kOSASelectCompileExecute    = $0602;
    kOSASelectDoScript          = $0603;

    {    Dialects:  }
    kOSASelectSetCurrentDialect = $0701;
    kOSASelectGetCurrentDialect = $0702;
    kOSASelectAvailableDialects = $0703;
    kOSASelectGetDialectInfo    = $0704;
    kOSASelectAvailableDialectCodeList = $0705;

    {    Event Handling:    }
    kOSASelectSetResumeDispatchProc = $0801;
    kOSASelectGetResumeDispatchProc = $0802;
    kOSASelectExecuteEvent      = $0803;
    kOSASelectDoEvent           = $0804;
    kOSASelectMakeContext       = $0805;

    {    Debugging  }
    kOSADebuggerCreateSession   = $0901;
    kOSADebuggerGetSessionState = $0902;
    kOSADebuggerSessionStep     = $0903;
    kOSADebuggerDisposeSession  = $0904;
    kOSADebuggerGetStatementRanges = $0905;
    kOSADebuggerGetBreakpoint   = $0910;
    kOSADebuggerSetBreakpoint   = $0911;
    kOSADebuggerGetDefaultBreakpoint = $0912;
    kOSADebuggerGetCurrentCallFrame = $0906;
    kOSADebuggerGetCallFrameState = $0907;
    kOSADebuggerGetVariable     = $0908;
    kOSADebuggerSetVariable     = $0909;
    kOSADebuggerGetPreviousCallFrame = $090A;
    kOSADebuggerDisposeCallFrame = $090B;
    kOSADebuggerCountVariables  = $090C;

    {    scripting component specific selectors are added beginning with this value     }
    kOSASelectComponentSpecificStart = $1001;


    {           Mode Flags:

        Warning: These should not conflict with the AESend mode flags in
        AppleEvents.h, because we may want to use them as OSA mode flags too.
        }

    {
            This mode flag may be passed to OSALoad, OSAStore or OSACompile to
            instruct the scripting component to not retain the "source" of an
            expression.  This will cause the OSAGetSource call to return the error
            errOSASourceNotAvailable if used.  However, some scripting components
            may not retain the source anyway.  This is mainly used when either space
            efficiency is desired, or a script is to be "locked" so that its
            implementation may not be viewed.
            }
    kOSAModePreventGetSource    = $00000001;

    {
            These mode flags may be passed to OSACompile, OSAExecute, OSALoadExecute
            OSACompileExecute, OSADoScript, OSAExecuteEvent, or OSADoEvent to
            indicate whether or not the script may interact with the user, switch
            layer or reconnect if necessary.  Any AppleEvents will be sent with the
            corresponding AESend mode supplied.
            }
    kOSAModeNeverInteract       = $00000010;
    kOSAModeCanInteract         = $00000020;
    kOSAModeAlwaysInteract      = $00000030;
    kOSAModeDontReconnect       = $00000080;

    {
            This mode flag may be passed to OSACompile, OSAExecute, OSALoadExecute
            OSACompileExecute, OSADoScript, OSAExecuteEvent, or OSADoEvent to
            indicate whether or not AppleEvents should be sent with the
            kAECanSwitchLayer mode flag sent or not. NOTE: This flag is exactly the
            opposite sense of the AppleEvent flag kAECanSwitchLayer.  This is to
            provide a more convenient default, i.e. not supplying any mode
            (kOSAModeNull) means to send events with kAECanSwitchLayer.  Supplying
            the kOSAModeCantSwitchLayer mode flag will cause AESend to be called
            without kAECanSwitchLayer.
            }
    kOSAModeCantSwitchLayer     = $00000040;

    {
            This mode flag may be passed to OSACompile, OSAExecute, OSALoadExecute
            OSACompileExecute, OSADoScript, OSAExecuteEvent, or OSADoEvent to
            indicate whether or not AppleEvents should be sent with the kAEDontRecord
            mode flag sent or not. NOTE: This flag is exactly the opposite sense of
            the AppleEvent flag kAEDontRecord.  This is to provide a more convenient
            default, i.e. not supplying any mode (kOSAModeNull) means to send events
            with kAEDontRecord.  Supplying the kOSAModeDoRecord mode flag will
            cause AESend to be called without kAEDontRecord.
            }
    kOSAModeDoRecord            = $00001000;

    {
            This is a mode flag for OSACompile that indicates that a context should
            be created as the result of compilation. All handler definitions are
            inserted into the new context, and variables are initialized by
            evaluating their initial values in a null context (i.e. they must be
            constant expressions).
            }
    kOSAModeCompileIntoContext  = $00000002;

    {
            This is a mode flag for OSACompile that indicates that the previous
            script ID (input to OSACompile) should be augmented with any new
            definitions in the sourceData rather than replaced with a new script.
            This means that the previous script ID must designate a context.
            The presence of this flag causes the kOSAModeCompileIntoContext flag
            to be implicitly used, causing any new definitions to be initialized
            in a null context.
            }
    kOSAModeAugmentContext      = $00000004;

    {
            This mode flag may be passed to OSADisplay or OSADoScript to indicate
            that output only need be human-readable, not re-compilable by OSACompile.
            If used, output may be arbitrarily "beautified", e.g. quotes may be left
            off of string values, long lists may have elipses, etc.
            }
    kOSAModeDisplayForHumans    = $00000008;

    {
            This mode flag may be passed to OSAStore in the case where the scriptID
            is a context.  This causes the context to be saved, but not the context's
            parent context.  When the stored context is loaded back in, the parent
            will be kOSANullScript.
            }
    kOSAModeDontStoreParent     = $00010000;

    {
            This mode flag may be passed to OSAExecuteEvent to cause the event to
            be dispatched to the direct object of the event. The direct object (or
            subject attribute if the direct object is a non-object specifier) will
            be resolved, and the resulting script object will be the recipient of
            the message. The context argument to OSAExecuteEvent will serve as the
            root of the lookup/resolution process.
            }
    kOSAModeDispatchToDirectObject = $00020000;

    {
            This mode flag may be passed to OSAExecuteEvent to indicate that
            components do not have to get the data of object specifier arguments.
            }
    kOSAModeDontGetDataForArguments = $00040000;

    {   *************************************************************************
        OSA Basic Scripting Interface
    **************************************************************************
        Scripting components must at least support the Basic Scripting interface.
    *************************************************************************   }
    {           Loading and Storing Scripts:

        These routines allow scripts to be loaded and stored in their internal
        (possibly compiled, non-text) representation.
        }

    {    Resource type for scripts  }
    kOSAScriptResourceType      = $73637074 (* 'scpt' *);

    {
            Default type given to OSAStore which creates "generic" loadable script
            data descriptors.
            }
    typeOSAGenericStorage       = $73637074 (* 'scpt' *);

    {
     *  OSALoad()
     *
     *  Availability:
     *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function OSALoad(scriptingComponent: ComponentInstance; const (*var*) scriptData: AEDesc; modeFlags: SInt32; var resultingScriptID: OSAID): OSAError; external name '_OSALoad';
{
        OSAComponentFunctionInline(kOSASelectLoad, 12);

        Errors:
            badComponentInstance        invalid scripting component instance
            errOSASystemError
            errOSABadStorageType:       scriptData not for this scripting component
            errOSACorruptData:          data seems to be corrupt
            errOSADataFormatObsolete    script data format is no longer supported
            errOSADataFormatTooNew      script data format is from a newer version

        ModeFlags:
            kOSAModePreventGetSource
    }
{
 *  OSAStore()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OSAStore(scriptingComponent: ComponentInstance; scriptID: OSAID; desiredType: DescType; modeFlags: SInt32; var resultingScriptData: AEDesc): OSAError; external name '_OSAStore';
{
        OSAComponentFunctionInline(kOSASelectStore, 16);

        Errors:
            badComponentInstance    invalid scripting component instance
            errOSASystemError
            errOSAInvalidID
            errOSABadStorageType:   desiredType not for this scripting component

        ModeFlags:
            kOSAModePreventGetSource
            kOSAModeDontStoreParent
    }
{ Executing Scripts: }
{
 *  OSAExecute()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OSAExecute(scriptingComponent: ComponentInstance; compiledScriptID: OSAID; contextID: OSAID; modeFlags: SInt32; var resultingScriptValueID: OSAID): OSAError; external name '_OSAExecute';
{
        OSAComponentFunctionInline(kOSASelectExecute, 16);
        This call runs a script.  The contextID represents the environment
        with which global variables in the script are resolved.  The constant
        kOSANullScript may be used for the contextID if the application wishes
        to not deal with context directly (a default one is associated with each
        scripting component instance).  The resultingScriptValueID is the
        result of evaluation, and contains a value which may be displayed using
        the OSAGetSource call.  The modeFlags convey scripting component
        specific information.

        Errors:
            badComponentInstance    invalid scripting component instance
            errOSASystemError
            errOSAInvalidID
            errOSAScriptError:      the executing script got an error

        ModeFlags:
            kOSAModeNeverInteract
            kOSAModeCanInteract
            kOSAModeAlwaysInteract
            kOSAModeCantSwitchLayer
            kOSAModeDontReconnect
            kOSAModeDoRecord
    }
{ Displaying results: }
{
 *  OSADisplay()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OSADisplay(scriptingComponent: ComponentInstance; scriptValueID: OSAID; desiredType: DescType; modeFlags: SInt32; var resultingText: AEDesc): OSAError; external name '_OSADisplay';
{
        OSAComponentFunctionInline(kOSASelectDisplay, 16);
        This call is used to convert results (script value IDs) into displayable
        text. The desiredType should be at least typeChar, and modeFlags are
        scripting system specific flags to control the formatting of the
        resulting text. This call differs from OSAGetSource in that (1) it
        always produces at least typeChar, (2) is only works on script values,
        (3) it may display it's output in non-compilable form (e.g. without
        string quotes, elipses inserted in long and/or circular lists, etc.) and
        (4) it is required by the basic scripting interface.

        Errors:
            badComponentInstance    invalid scripting component instance
            errOSASystemError
            errOSAInvalidID
            errAECoercionFail:      desiredType not supported by scripting component

        ModeFlags:
            kOSAModeDisplayForHumans
    }
{ Getting Error Information: }
{
 *  OSAScriptError()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OSAScriptError(scriptingComponent: ComponentInstance; selector: OSType; desiredType: DescType; var resultingErrorDescription: AEDesc): OSAError; external name '_OSAScriptError';
{
        OSAComponentFunctionInline(kOSASelectScriptError, 12);
        Whenever script execution returns errOSAExecutionError, this routine
        may be used to get information about that error.  The selector describes
        the type of information desired about the error (various selectors are
        listed below).  The desiredType indicates the data type of the result
        desired for that selector.

        Errors:
            badComponentInstance    invalid scripting component instance
            errOSASystemError
            errOSABadSelector:      selector not supported by scripting component
            errAECoercionFail:      desiredType not supported by scripting component
    }
{ OSAScriptError selectors: }
{
        This selector is used to determine the error number of a script error.
        These error numbers may be either system error numbers, or error numbers
        that are scripting component specific.
        Required desiredTypes:
            typeShortInteger
    }

const
    kOSAErrorNumber             = $6572726E (* 'errn' *);

    {
            This selector is used to determine the full error message associated
            with the error number.  It should include the name of the application
            which caused the error, as well as the specific error that occurred.
            This selector is sufficient for simple error reporting (but see
            kOSAErrorBriefMessage, below).
            Required desiredTypes:
                typeChar                    error message string
            }
    kOSAErrorMessage            = $65727273 (* 'errs' *);

    {
            This selector is used to determine a brief error message associated with
            the error number.  This message and should not mention the name of the
            application which caused the error, any partial results or offending
            object (see kOSAErrorApp, kOSAErrorPartialResult and
            kOSAErrorOffendingObject, below).
            Required desiredTypes:
                typeChar                    brief error message string
            }
    {     0x65727262    }
    kOSAErrorBriefMessage       = $65727262 (* 'errb' *);

    {
            This selector is used to determine which application actually got the
            error (if it was the result of an AESend), or the current application
            if ....
            Required desiredTypes:
                typeProcessSerialNumber     PSN of the errant application
                typeChar                    name of the errant application
            }
    {     0x65726170    }
    kOSAErrorApp                = $65726170 (* 'erap' *);

    {
            This selector is used to determine any partial result returned by an
            operation. If an AESend call failed, but a partial result was returned,
            then the partial result may be returned as an AEDesc.
            Required desiredTypes:
                typeBest                    AEDesc of any partial result
            }
    {     0x70746c72    }
    kOSAErrorPartialResult      = $70746C72 (* 'ptlr' *);

    {
            This selector is used to determine any object which caused the error
            that may have been indicated by an application.  The result is an
            AEDesc.
            Required desiredTypes:
                typeBest                    AEDesc of any offending object
            }
    {     0x65726f62    }
    kOSAErrorOffendingObject    = $65726F62 (* 'erob' *);

    {
            This selector is used to determine the type expected by a coercion
            operation if a type error occurred.
            }
    {     0x65727274    }
    kOSAErrorExpectedType       = $65727274 (* 'errt' *);

    {
            This selector is used to determine the source text range (start and
            end positions) of where the error occurred.
            Required desiredTypes:
                typeOSAErrorRange
            }
    {     0x65726e67    }
    kOSAErrorRange              = $65726E67 (* 'erng' *);

    {
            An AERecord type containing keyOSASourceStart and keyOSASourceEnd fields
            of type short.
            }
    {     0x65726e67    }
    typeOSAErrorRange           = $65726E67 (* 'erng' *);

    {    Field of a typeOSAErrorRange record of typeShortInteger    }
    {     0x73726373        }
    keyOSASourceStart           = $73726373 (* 'srcs' *);

    {    Field of a typeOSAErrorRange record of typeShortInteger    }
    {     0x73726365    }
    keyOSASourceEnd             = $73726365 (* 'srce' *);

    {    Disposing Script IDs:  }
    {
     *  OSADispose()
     *
     *  Availability:
     *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function OSADispose(scriptingComponent: ComponentInstance; scriptID: OSAID): OSAError; external name '_OSADispose';
{
        OSAComponentFunctionInline(kOSASelectDispose, 4);
        Disposes a script or context.

        Errors:
            badComponentInstance    invalid scripting component instance
            errOSASystemError
            errOSAInvalidID
    }
{ Getting and Setting Script Information: }
{
 *  OSASetScriptInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OSASetScriptInfo(scriptingComponent: ComponentInstance; scriptID: OSAID; selector: OSType; value: SInt32): OSAError; external name '_OSASetScriptInfo';
{
        OSAComponentFunctionInline(kOSASelectSetScriptInfo, 12);

        Errors:
            badComponentInstance    invalid scripting component instance
            errOSASystemError
            errOSAInvalidID
            errOSABadSelector:      selector not supported by scripting component
                                    or selector not for this scriptID
    }
{
 *  OSAGetScriptInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OSAGetScriptInfo(scriptingComponent: ComponentInstance; scriptID: OSAID; selector: OSType; var result: SInt32): OSAError; external name '_OSAGetScriptInfo';
{
        OSAComponentFunctionInline(kOSASelectGetScriptInfo, 12);

        Errors:
            badComponentInstance    invalid scripting component instance
            errOSASystemError
            errOSAInvalidID
            errOSABadSelector:      selector not supported by scripting component
                                    or selector not for this scriptID
    }
{ Manipulating the ActiveProc:

    Scripting systems will supply default values for these procedures if they
    are not set by the client:
}

type
    OSAActiveProcPtr = function(refCon: SInt32): OSErr;

    OSAActiveUPP = ^SInt32; { an opaque UPP }

const
    uppOSAActiveProcInfo = $000000E0;
    {
     *  NewOSAActiveUPP()
     *
     *  Availability:
     *    Non-Carbon CFM:   available as macro/inline
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function NewOSAActiveUPP(userRoutine: OSAActiveProcPtr): OSAActiveUPP; external name '_NewOSAActiveUPP'; { old name was NewOSAActiveProc }
{
 *  DisposeOSAActiveUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeOSAActiveUPP(userUPP: OSAActiveUPP); external name '_DisposeOSAActiveUPP';
{
 *  InvokeOSAActiveUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeOSAActiveUPP(refCon: SInt32; userRoutine: OSAActiveUPP): OSErr; external name '_InvokeOSAActiveUPP'; { old name was CallOSAActiveProc }
{
 *  OSASetActiveProc()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OSASetActiveProc(scriptingComponent: ComponentInstance; activeProc: OSAActiveUPP; refCon: SInt32): OSAError; external name '_OSASetActiveProc';
{
        OSAComponentFunctionInline(kOSASelectSetActiveProc, 8);
        If activeProc is nil, the default activeProc is used.

        Errors:
            badComponentInstance    invalid scripting component instance
            errOSASystemError
    }
{
 *  OSAGetActiveProc()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OSAGetActiveProc(scriptingComponent: ComponentInstance; var activeProc: OSAActiveUPP; var refCon: SInt32): OSAError; external name '_OSAGetActiveProc';
{
        OSAComponentFunctionInline(kOSASelectGetActiveProc, 8);

        Errors:
            badComponentInstance    invalid scripting component instance
            errOSASystemError
    }
{*************************************************************************
    OSA Optional Compiling Interface
**************************************************************************
    Scripting components that support the Compiling interface have the
    kOSASupportsCompiling bit set in it's ComponentDescription.
*************************************************************************}
{
 *  OSAScriptingComponentName()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OSAScriptingComponentName(scriptingComponent: ComponentInstance; var resultingScriptingComponentName: AEDesc): OSAError; external name '_OSAScriptingComponentName';
{
        OSAComponentFunctionInline(kOSASelectScriptingComponentName, 4);
        Given a scripting component, this routine returns the name of that
        scripting component in a type that is coercable to text (typeChar).
        The generic scripting component returns the name of the default
        scripting component.  This name should be sufficient to convey to the
        user the kind of script (syntax) he is expected to write.

        Errors:
            badComponentInstance    invalid scripting component instance
            errOSASystemError
    }
{
 *  OSACompile()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OSACompile(scriptingComponent: ComponentInstance; const (*var*) sourceData: AEDesc; modeFlags: SInt32; var previousAndResultingScriptID: OSAID): OSAError; external name '_OSACompile';
{
        OSAComponentFunctionInline(kOSASelectCompile, 12);
        Coerces input desc (possibly text) into a script's internal format.
        Once compiled, the script is ready to run.  The modeFlags convey
        scripting component specific information.  The previous script ID
        (result parameter) is made to refer to the newly compiled script,
        unless it was originally kOSANullScript.  In this case a new script
        ID is created and used.

        Errors:
            badComponentInstance    invalid scripting component instance
            errOSASystemError
            errAECoercionFail:      sourceData is not compilable
            errOSAScriptError:      sourceData was a bad script (syntax error)
            errOSAInvalidID:        previousAndResultingCompiledScriptID was not
                                    valid on input

        ModeFlags:
            kOSAModePreventGetSource
            kOSAModeCompileIntoContext
            kOSAModeAugmentContext
            kOSAModeNeverInteract
            kOSAModeCanInteract
            kOSAModeAlwaysInteract
            kOSAModeCantSwitchLayer
            kOSAModeDontReconnect
            kOSAModeDoRecord
    }
{
 *  OSACopyID()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OSACopyID(scriptingComponent: ComponentInstance; fromID: OSAID; var toID: OSAID): OSAError; external name '_OSACopyID';
{
        OSAComponentFunctionInline(kOSASelectCopyID, 8);
        If toID is a reference to kOSANullScript then it is updated to have a
        new scriptID value.  This call can be used to perform undo or revert
        operations on scripts.

        Errors:
            badComponentInstance    invalid scripting component instance
            errOSASystemError
            errOSAInvalidID
    }

{*************************************************************************
    OSA Optional GetSource Interface
**************************************************************************
    Scripting components that support the GetSource interface have the
    kOSASupportsGetSource bit set in their ComponentDescription.
*************************************************************************}
{
 *  OSAGetSource()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OSAGetSource(scriptingComponent: ComponentInstance; scriptID: OSAID; desiredType: DescType; var resultingSourceData: AEDesc): OSAError; external name '_OSAGetSource';
{
        OSAComponentFunctionInline(kOSASelectGetSource, 12);
        This routine causes a compiled script to be output in a form (possibly
        text) such that it is suitable to be passed back to OSACompile.

        Errors:
            badComponentInstance    invalid scripting component instance
            errOSASystemError
            errOSAInvalidID
            errOSASourceNotAvailable    can't get source for this scriptID
    }
{*************************************************************************
    OSA Optional AECoercion Interface
**************************************************************************
    Scripting components that support the AECoercion interface have the
    kOSASupportsAECoercion bit set in their ComponentDescription.
*************************************************************************}
{
 *  OSACoerceFromDesc()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OSACoerceFromDesc(scriptingComponent: ComponentInstance; const (*var*) scriptData: AEDesc; modeFlags: SInt32; var resultingScriptID: OSAID): OSAError; external name '_OSACoerceFromDesc';
{
        OSAComponentFunctionInline(kOSASelectCoerceFromDesc, 12);
        This routine causes script data to be coerced into a script value.
        If the scriptData is an AppleEvent, then the resultingScriptID is a
        compiled script ID (mode flags for OSACompile may be used in this case).
        Other scriptData descriptors create script value IDs.

        Errors:
            badComponentInstance    invalid scripting component instance
            errOSASystemError

        ModeFlags:
            kOSAModePreventGetSource
            kOSAModeCompileIntoContext
            kOSAModeNeverInteract
            kOSAModeCanInteract
            kOSAModeAlwaysInteract
            kOSAModeCantSwitchLayer
            kOSAModeDontReconnect
            kOSAModeDoRecord
    }
{
 *  OSACoerceToDesc()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OSACoerceToDesc(scriptingComponent: ComponentInstance; scriptID: OSAID; desiredType: DescType; modeFlags: SInt32; var result: AEDesc): OSAError; external name '_OSACoerceToDesc';
{
        OSAComponentFunctionInline(kOSASelectCoerceToDesc, 16);
        This routine causes a script value to be coerced into any desired form.
        If the scriptID denotes a compiled script, then it may be coerced to
        typeAppleEvent.

        Errors:
            badComponentInstance    invalid scripting component instance
            errOSASystemError
            errOSAInvalidID
    }
{*************************************************************************
    OSA Optional AESending Interface
**************************************************************************
    Scripting components that support the AESending interface have the
    kOSASupportsAESending bit set in their ComponentDescription.
*************************************************************************}
{
    Scripting systems will supply default values for these procedures if they
    are not set by the client:
}
{
 *  OSASetSendProc()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OSASetSendProc(scriptingComponent: ComponentInstance; sendProc: OSASendUPP; refCon: SInt32): OSAError; external name '_OSASetSendProc';
{
        OSAComponentFunctionInline(kOSASelectSetSendProc, 8);
        If sendProc is nil, the default sendProc is used.

        Errors:
            badComponentInstance    invalid scripting component instance
            errOSASystemError
    }
{
 *  OSAGetSendProc()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OSAGetSendProc(scriptingComponent: ComponentInstance; var sendProc: OSASendUPP; var refCon: SInt32): OSAError; external name '_OSAGetSendProc';
{
        OSAComponentFunctionInline(kOSASelectGetSendProc, 8);

        Errors:
            badComponentInstance    invalid scripting component instance
            errOSASystemError
    }
{
 *  OSASetCreateProc()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OSASetCreateProc(scriptingComponent: ComponentInstance; createProc: OSACreateAppleEventUPP; refCon: SInt32): OSAError; external name '_OSASetCreateProc';
{
        OSAComponentFunctionInline(kOSASelectSetCreateProc, 8);
        If createProc is nil, the default createProc is used.

        Errors:
            badComponentInstance    invalid scripting component instance
            errOSASystemError
    }
{
 *  OSAGetCreateProc()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OSAGetCreateProc(scriptingComponent: ComponentInstance; var createProc: OSACreateAppleEventUPP; var refCon: SInt32): OSAError; external name '_OSAGetCreateProc';
{
        OSAComponentFunctionInline(kOSASelectGetCreateProc, 8);

        Errors:
            badComponentInstance    invalid scripting component instance
            errOSASystemError
    }
{
 *  OSASetDefaultTarget()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OSASetDefaultTarget(scriptingComponent: ComponentInstance; const (*var*) target: AEAddressDesc): OSAError; external name '_OSASetDefaultTarget';
{
        OSAComponentFunctionInline(kOSASelectSetDefaultTarget, 4);
        This routine sets the default target application for AE sending.
        It also establishes the default target from which terminologies come.
        It is effectively like having an AppleScript "tell" statement around
        the entire program.  If this routine is not called, or if the target
        is a null AEDesc, then the current application is the default target.

        Errors:
            badComponentInstance    invalid scripting component instance
            errOSASystemError
    }
{*************************************************************************
    OSA Optional Recording Interface
**************************************************************************
    Scripting components that support the Recording interface have the
    kOSASupportsRecording bit set in their ComponentDescription.
*************************************************************************}
{
 *  OSAStartRecording()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OSAStartRecording(scriptingComponent: ComponentInstance; var compiledScriptToModifyID: OSAID): OSAError; external name '_OSAStartRecording';
{
        OSAComponentFunctionInline(kOSASelectStartRecording, 4);
        Starts recording.  If compiledScriptToModifyID is kOSANullScript, a
        new script ID is created and returned.  If the current application has
        a handler for the kOSARecordedText event, then kOSARecordedText events
        are sent to the application containing the text of each AppleEvent
        recorded.

        Errors:
            badComponentInstance    invalid scripting component instance
            errOSASystemError
            errOSAInvalidID
            errOSARecordingIsAlreadyOn
    }
{
 *  OSAStopRecording()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OSAStopRecording(scriptingComponent: ComponentInstance; compiledScriptID: OSAID): OSAError; external name '_OSAStopRecording';
{
        OSAComponentFunctionInline(kOSASelectStopRecording, 4);
        If compiledScriptID is not being recorded into or recording is not
        currently on, no error is returned.

        Errors:
            badComponentInstance    invalid scripting component instance
            errOSASystemError
            errOSAInvalidID
    }
{*************************************************************************
    OSA Optional Convenience Interface
**************************************************************************
    Scripting components that support the Convenience interface have the
    kOSASupportsConvenience bit set in their ComponentDescription.
*************************************************************************}
{
 *  OSALoadExecute()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OSALoadExecute(scriptingComponent: ComponentInstance; const (*var*) scriptData: AEDesc; contextID: OSAID; modeFlags: SInt32; var resultingScriptValueID: OSAID): OSAError; external name '_OSALoadExecute';
{
        OSAComponentFunctionInline(kOSASelectLoadExecute, 16);
        This routine is effectively equivalent to calling OSALoad followed by
        OSAExecute.  After execution, the compiled source is disposed.  Only the
        resulting value ID is retained.

        Errors:
            badComponentInstance        invalid scripting component instance
            errOSASystemError
            errOSABadStorageType:       scriptData not for this scripting component
            errOSACorruptData:          data seems to be corrupt
            errOSADataFormatObsolete    script data format is no longer supported
            errOSADataFormatTooNew      script data format is from a newer version
            errOSAInvalidID
            errOSAScriptError:          the executing script got an error

        ModeFlags:
            kOSAModeNeverInteract
            kOSAModeCanInteract
            kOSAModeAlwaysInteract
            kOSAModeCantSwitchLayer
            kOSAModeDontReconnect
            kOSAModeDoRecord
    }
{
 *  OSACompileExecute()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OSACompileExecute(scriptingComponent: ComponentInstance; const (*var*) sourceData: AEDesc; contextID: OSAID; modeFlags: SInt32; var resultingScriptValueID: OSAID): OSAError; external name '_OSACompileExecute';
{
        OSAComponentFunctionInline(kOSASelectCompileExecute, 16);
        This routine is effectively equivalent to calling OSACompile followed by
        OSAExecute.  After execution, the compiled source is disposed.  Only the
        resulting value ID is retained.

        Errors:
            badComponentInstance    invalid scripting component instance
            errOSASystemError
            errAECoercionFail:      sourceData is not compilable
            errOSAScriptError:      sourceData was a bad script (syntax error)
            errOSAInvalidID:        previousAndResultingCompiledScriptID was not
                                    valid on input
            errOSAScriptError:      the executing script got an error

        ModeFlags:
            kOSAModeNeverInteract
            kOSAModeCanInteract
            kOSAModeAlwaysInteract
            kOSAModeCantSwitchLayer
            kOSAModeDontReconnect
            kOSAModeDoRecord
    }
{
 *  OSADoScript()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OSADoScript(scriptingComponent: ComponentInstance; const (*var*) sourceData: AEDesc; contextID: OSAID; desiredType: DescType; modeFlags: SInt32; var resultingText: AEDesc): OSAError; external name '_OSADoScript';
{
        OSAComponentFunctionInline(kOSASelectDoScript, 20);
        This routine is effectively equivalent to calling OSACompile followed by
        OSAExecute and then OSADisplay.  After execution, the compiled source
        and the resulting value are is disposed.  Only the resultingText
        descriptor is retained.  If a script error occur during processing, the
        resultingText gets the error message of the error, and errOSAScriptError
        is returned.  OSAScriptError may still be used to extract more
        information about the particular error.

        Errors:
            badComponentInstance    invalid scripting component instance
            errOSASystemError
            errAECoercionFail:      sourceData is not compilable or
                                    desiredType not supported by scripting component
            errOSAScriptError:      sourceData was a bad script (syntax error)
            errOSAInvalidID:        previousAndResultingCompiledScriptID was not
                                    valid on input
            errOSAScriptError:      the executing script got an error

        ModeFlags:
            kOSAModeNeverInteract
            kOSAModeCanInteract
            kOSAModeAlwaysInteract
            kOSAModeCantSwitchLayer
            kOSAModeDontReconnect
            kOSAModeDoRecord
            kOSAModeDisplayForHumans
    }
{*************************************************************************
    OSA Optional Dialects Interface
**************************************************************************
    Scripting components that support the Dialects interface have the
    kOSASupportsDialects bit set in their ComponentDescription.
*************************************************************************}
{
    These calls allows an scripting component that supports different dialects
    to dynamically switch between those dialects.  Although this interface is
    specified, the particular dialect codes are scripting component dependent.
}
{
 *  OSASetCurrentDialect()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OSASetCurrentDialect(scriptingComponent: ComponentInstance; dialectCode: SInt16): OSAError; external name '_OSASetCurrentDialect';
{
        OSAComponentFunctionInline(kOSASelectSetCurrentDialect, 2);

        Errors:
            badComponentInstance    invalid scripting component instance
            errOSASystemError
            errOSANoSuchDialect:    invalid dialectCode
    }
{
 *  OSAGetCurrentDialect()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OSAGetCurrentDialect(scriptingComponent: ComponentInstance; var resultingDialectCode: SInt16): OSAError; external name '_OSAGetCurrentDialect';
{
        OSAComponentFunctionInline(kOSASelectGetCurrentDialect, 4);

        Errors:
            badComponentInstance    invalid scripting component instance
            errOSASystemError
    }
{
 *  OSAAvailableDialects()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OSAAvailableDialects(scriptingComponent: ComponentInstance; var resultingDialectInfoList: AEDesc): OSAError; external name '_OSAAvailableDialects';
{
        OSAComponentFunctionInline(kOSASelectAvailableDialects, 4);
        This call return an AEList containing information about each of the
        currently available dialects of a scripting component.  Each item
        is an AERecord of typeOSADialectInfo that contains at least the fields
        keyOSADialectName, keyOSADialectCode, KeyOSADialectLangCode and
        keyOSADialectScriptCode.

        Errors:
            badComponentInstance    invalid scripting component instance
            errOSASystemError
    }
{
 *  OSAGetDialectInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OSAGetDialectInfo(scriptingComponent: ComponentInstance; dialectCode: SInt16; selector: OSType; var resultingDialectInfo: AEDesc): OSAError; external name '_OSAGetDialectInfo';
{
        OSAComponentFunctionInline(kOSASelectGetDialectInfo, 10);
        This call gives information about the specified dialect of a scripting
        component. It returns an AEDesc whose type depends on the selector
        specified. Available selectors are the same as the field keys for a
        dialect info record. The type of AEDesc returned is the same as the
        type of the field that has same key as the selector.

        Errors:
            badComponentInstance    invalid scripting component instance
            errOSASystemError
            errOSABadSelector
            errOSANoSuchDialect:    invalid dialectCode
    }
{
 *  OSAAvailableDialectCodeList()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OSAAvailableDialectCodeList(scriptingComponent: ComponentInstance; var resultingDialectCodeList: AEDesc): OSAError; external name '_OSAAvailableDialectCodeList';
{
        OSAComponentFunctionInline(kOSASelectAvailableDialectCodeList, 4);
        This is alternative to OSAGetAvailableDialectCodeList. Use this call
        and  OSAGetDialectInfo to get information on dialects.
        This call return an AEList containing dialect code for each of the
        currently available dialects of a scripting component. Each dialect
        code is a short SInt16 of type typeShortInteger.

        Errors:
            badComponentInstance    invalid scripting component instance
            errOSASystemError

        Type of a dialect info record containing at least keyOSADialectName
        and keyOSADialectCode fields.

        keys for dialect info record, also used as selectors to OSAGetDialectInfo.

        Field of a typeOSADialectInfo record of typeChar.
        Field of a typeOSADialectInfo record of typeShortInteger.
        Field of a typeOSADialectInfo record of typeShortInteger.
        Field of a typeOSADialectInfo record of typeShortInteger.
    }
{*************************************************************************
    OSA Optional Event Handling Interface
**************************************************************************
    Scripting components that support the Event Handling interface have the
    kOSASupportsEventHandling bit set in their ComponentDescription.
*************************************************************************}
{
 *  OSASetResumeDispatchProc()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OSASetResumeDispatchProc(scriptingComponent: ComponentInstance; resumeDispatchProc: AEEventHandlerUPP; refCon: SInt32): OSAError; external name '_OSASetResumeDispatchProc';
{
        OSAComponentFunctionInline(kOSASelectSetResumeDispatchProc, 8);
        This function is used to set the ResumeDispatchProc that will be used
        by OSAExecuteEvent and OSADoEvent if either no event handler can be
        found in the context, or the context event hander "continues" control
        onward. The two constants kOSAUseStandardDispatch and kOSANoDispatch
        may also be passed to this routine indicating that the handler registered
        in the application with AEInstallEventHandler should be used, or no
        dispatch should occur, respectively.

        Errors:
            badComponentInstance    invalid scripting component instance
            errOSASystemError
    }

const
    kOSAUseStandardDispatch     = $FFFFFFFF;

    {
            Special ResumeDispatchProc constant which may be passed to
            OSASetResumeDispatchProc indicating that the handler registered
            in the application with AEInstallEventHandler should be used.

            NOTE:   Had to remove the cast (AEEventHandlerUPP).  The C compiler
                    doesn't allow pointer types to be assigned to an enum.  All
                    constants must be assigned as enums to translate properly to
                    Pascal.
            }
    kOSANoDispatch              = 0;

    {
            Special ResumeDispatchProc constant which may be passed to
            OSASetResumeDispatchProc indicating that no dispatch should occur.

            NOTE:   Had to remove the cast (AEEventHandlerUPP).  The C compiler
                    doesn't allow pointer types to be assigned to an enum.  All
                    constants must be assigned as enums to translate properly to
                    Pascal.
            }
    kOSADontUsePhac             = $0001;

    {
            Special refCon constant that may be given to OSASetResumeDispatchProc
            only when kOSAUseStandardDispatch is used as the ResumeDispatchProc.
            This causes the standard dispatch to be performed, except the phac
            handler is not called.  This is useful during tinkerability, when
            the phac handler is used to lookup a context associated with an event's
            direct parameter, and call OSAExecuteEvent or OSADoEvent.  Failure to
            bypass the phac handler would result in an infinite loop.
            }
    {
     *  OSAGetResumeDispatchProc()
     *
     *  Availability:
     *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function OSAGetResumeDispatchProc(scriptingComponent: ComponentInstance; var resumeDispatchProc: AEEventHandlerUPP; var refCon: SInt32): OSAError; external name '_OSAGetResumeDispatchProc';
{
        OSAComponentFunctionInline(kOSASelectGetResumeDispatchProc, 8);
        Returns the registered ResumeDispatchProc.  If no ResumeDispatchProc has
        been registered, then kOSAUseStandardDispatch (the default) is returned.

        Errors:
            badComponentInstance    invalid scripting component instance
            errOSASystemError
    }
{
 *  OSAExecuteEvent()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OSAExecuteEvent(scriptingComponent: ComponentInstance; const (*var*) theAppleEvent: AppleEvent; contextID: OSAID; modeFlags: SInt32; var resultingScriptValueID: OSAID): OSAError; external name '_OSAExecuteEvent';
{
        OSAComponentFunctionInline(kOSASelectExecuteEvent, 16);
        This call is similar to OSAExecute except the initial command to
        execute comes in the form of an AppleEvent.  If the contextID
        defines any event handlers for that event, they are used to process
        the event.  If no event handler can be found in the context
        errAEEventNotHandled is returned.  If an event handler is found and
        the hander "continues" control onward, the ResumeDispatchProc
        (registered with OSASetResumeDispatchProc, above) is called given the
        AppleEvent.  The result is returned as a scriptValueID.

        Errors:
            badComponentInstance    invalid scripting component instance
            errOSASystemError
            errOSAInvalidID
            errOSAScriptError:      the executing script got an error
            errAEEventNotHandled:   no handler for event in contextID

        ModeFlags:
            kOSAModeNeverInteract
            kOSAModeCanInteract
            kOSAModeAlwaysInteract
            kOSAModeCantSwitchLayer
            kOSAModeDontReconnect
            kOSAModeDoRecord
    }
{
 *  OSADoEvent()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OSADoEvent(scriptingComponent: ComponentInstance; const (*var*) theAppleEvent: AppleEvent; contextID: OSAID; modeFlags: SInt32; var reply: AppleEvent): OSAError; external name '_OSADoEvent';
{
        OSAComponentFunctionInline(kOSASelectDoEvent, 16);
        This call is similar to OSADoScript except the initial command to
        execute comes in the form of an AppleEvent, and the result is an
        AppleEvent reply record.  If the contextID defines any event handlers
        for that event, they are used to process the event.  If no event handler
        can be found in the context errAEEventNotHandled is returned.  If an
        event handler is found and the hander "continues" control onward, the
        ResumeDispatchProc (registered with OSASetResumeDispatchProc, above) is
        called given the AppleEvent.  The result is returned in the form of an
        AppleEvent reply descriptor. If at any time the script gets an error, or
        if the ResumeDispatchProc returns a reply event indicating an error,
        then the OSADoEvent call itself returns an error reply (i.e. OSADoEvent
        should never return errOSAScriptError).  Any error result returned by
        the ResumeDispatchProc will be returned by OSADoEvent.

        Errors:
            badComponentInstance    invalid scripting component instance
            errOSASystemError
            errOSAInvalidID
            errAEEventNotHandled:   no handler for event in contextID

        ModeFlags:
            kOSAModeNeverInteract
            kOSAModeCanInteract
            kOSAModeAlwaysInteract
            kOSAModeCantSwitchLayer
            kOSAModeDontReconnect
            kOSAModeDoRecord
    }
{
 *  OSAMakeContext()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OSAMakeContext(scriptingComponent: ComponentInstance; const (*var*) contextName: AEDesc; parentContext: OSAID; var resultingContextID: OSAID): OSAError; external name '_OSAMakeContext';
{
        OSAComponentFunctionInline(kOSASelectMakeContext, 12);
        Makes a new empty context which may be passed to OSAExecute or
        OSAExecuteEvent.  If contextName is typeNull, an unnamed context is
        created. If parentContext is kOSANullScript then the resulting context
        does not inherit bindings from any other context.

        Errors:
            badComponentInstance    invalid scripting component instance
            errOSASystemError
            errOSAInvalidID
            errAECoercionFail:      contextName is invalid
    }
{
 * Debugging API
 }
{
 * Types
 }

type
    OSADebugSessionRef                  = OSAID;
    OSADebugCallFrameRef                = OSAID;
    {
     * Constants
        }
    OSAProgramState             = UInt32;
const
    eNotStarted                 = 0;
    eRunnable                   = 1;
    eRunning                    = 2;
    eStopped                    = 3;
    eTerminated                 = 4;


type
    OSADebugStepKind            = UInt32;
const
    eStepOver                   = 0;
    eStepIn                     = 1;
    eStepOut                    = 2;
    eRun                        = 3;


type
    OSALocalOrGlobal            = UInt32;
const
    eLocal                      = 0;
    eGlobal                     = 1;
    eProperties                 = 2;

    {
     * Session Information
        }
    keyProgramState             = $64737073 (* 'dsps' *);

    {
     * Call Frame Information
        }

type
    StatementRangePtr = ^StatementRange;
    StatementRange = record
        startPos:               UInt32;
        endPos:                 UInt32;
    end;


const
    typeStatementRange          = $73726E67 (* 'srng' *);

    keyProcedureName            = $64666E6D (* 'dfnm' *);                       {  typeChar  }
    keyStatementRange           = $64667372 (* 'dfsr' *);                       {  typeStatementRange  }
    keyLocalsNames              = $64666C6E (* 'dfln' *);                       {  typeAEList of typeChar  }
    keyGlobalsNames             = $6466676E (* 'dfgn' *);                       {  typeAEList of typeChar  }
    keyParamsNames              = $6466706E (* 'dfpn' *);                       {  typeAEList of typeChar  }

    {
     * Sessions
        }
    {
     *  OSADebuggerCreateSession()
     *
     *  Availability:
     *    Non-Carbon CFM:   in AppleScriptLib 1.5 and later
     *    CarbonLib:        in CarbonLib 1.1 and later
     *    Mac OS X:         in version 10.0 and later
        }
function OSADebuggerCreateSession(scriptingComponent: ComponentInstance; inScript: OSAID; inContext: OSAID; var outSession: OSADebugSessionRef): OSAError; external name '_OSADebuggerCreateSession';
{
 *  OSADebuggerGetSessionState()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppleScriptLib 1.5 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OSADebuggerGetSessionState(scriptingComponent: ComponentInstance; inSession: OSADebugSessionRef; var outState: AERecord): OSAError; external name '_OSADebuggerGetSessionState';
{
 *  OSADebuggerSessionStep()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppleScriptLib 1.5 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OSADebuggerSessionStep(scriptingComponent: ComponentInstance; inSession: OSADebugSessionRef; inKind: OSADebugStepKind): OSAError; external name '_OSADebuggerSessionStep';
{
 *  OSADebuggerDisposeSession()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppleScriptLib 1.5 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OSADebuggerDisposeSession(scriptingComponent: ComponentInstance; inSession: OSADebugSessionRef): OSAError; external name '_OSADebuggerDisposeSession';
{
 *  OSADebuggerGetStatementRanges()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppleScriptLib 1.5 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OSADebuggerGetStatementRanges(scriptingComponent: ComponentInstance; inSession: OSADebugSessionRef; var outStatementRangeArray: AEDescList): OSAError; external name '_OSADebuggerGetStatementRanges';
{  Returns an array of StatementRange objects. }
{
 *  OSADebuggerGetBreakpoint()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppleScriptLib 1.5 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OSADebuggerGetBreakpoint(scriptingComponent: ComponentInstance; inSession: OSADebugSessionRef; inSrcOffset: UInt32; var outBreakpoint: OSAID): OSAError; external name '_OSADebuggerGetBreakpoint';
{
 *  OSADebuggerSetBreakpoint()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppleScriptLib 1.5 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OSADebuggerSetBreakpoint(scriptingComponent: ComponentInstance; inSession: OSADebugSessionRef; inSrcOffset: UInt32; inBreakpoint: OSAID): OSAError; external name '_OSADebuggerSetBreakpoint';
{
 *  OSADebuggerGetDefaultBreakpoint()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppleScriptLib 1.5 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OSADebuggerGetDefaultBreakpoint(scriptingComponent: ComponentInstance; inSession: OSADebugSessionRef; var outBreakpoint: OSAID): OSAError; external name '_OSADebuggerGetDefaultBreakpoint';
{
 * Call Frames
 }
{
 *  OSADebuggerGetCurrentCallFrame()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppleScriptLib 1.5 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OSADebuggerGetCurrentCallFrame(scriptingComponent: ComponentInstance; inSession: OSADebugSessionRef; var outCallFrame: OSADebugCallFrameRef): OSAError; external name '_OSADebuggerGetCurrentCallFrame';
{
 *  OSADebuggerGetCallFrameState()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppleScriptLib 1.5 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OSADebuggerGetCallFrameState(scriptingComponent: ComponentInstance; inCallFrame: OSADebugCallFrameRef; var outState: AERecord): OSAError; external name '_OSADebuggerGetCallFrameState';
{
 *  OSADebuggerGetVariable()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppleScriptLib 1.5 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OSADebuggerGetVariable(scriptingComponent: ComponentInstance; inCallFrame: OSADebugCallFrameRef; const (*var*) inVariableName: AEDesc; var outVariable: OSAID): OSAError; external name '_OSADebuggerGetVariable';
{
 *  OSADebuggerSetVariable()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppleScriptLib 1.5 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OSADebuggerSetVariable(scriptingComponent: ComponentInstance; inCallFrame: OSADebugCallFrameRef; const (*var*) inVariableName: AEDesc; inVariable: OSAID): OSAError; external name '_OSADebuggerSetVariable';
{
 *  OSADebuggerGetPreviousCallFrame()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppleScriptLib 1.5 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OSADebuggerGetPreviousCallFrame(scriptingComponent: ComponentInstance; inCurrentFrame: OSADebugCallFrameRef; var outPrevFrame: OSADebugCallFrameRef): OSAError; external name '_OSADebuggerGetPreviousCallFrame';
{
 *  OSADebuggerDisposeCallFrame()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppleScriptLib 1.5 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OSADebuggerDisposeCallFrame(scriptingComponent: ComponentInstance; inCallFrame: OSADebugCallFrameRef): OSAError; external name '_OSADebuggerDisposeCallFrame';
{
 *  OSADebuggerCountVariables()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppleScriptLib 1.5 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OSADebuggerCountVariables(scriptingComponent: ComponentInstance; inSession: OSADebugSessionRef; inCallFrame: OSADebugCallFrameRef; inWhichSet: OSALocalOrGlobal; var outVariableCount: SInt32): OSAError; external name '_OSADebuggerCountVariables';
{$ALIGN MAC68K}
{#POP}
{unit OSAGeneric}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}

{    NOTE:   This interface defines a "generic scripting component."
            The Generic Scripting Component allows automatic dispatch to a
            specific scripting component that conforms to the OSA interface.
            This component supports OSA, by calling AppleScript or some other
            scripting component.  Additionally it provides access to the default
            and the user-prefered scripting component.
}



const
                                                                {  Component version this header file describes  }
    kGenericComponentVersion    = $0100;

    kGSSSelectGetDefaultScriptingComponent = $1001;
    kGSSSelectSetDefaultScriptingComponent = $1002;
    kGSSSelectGetScriptingComponent = $1003;
    kGSSSelectGetScriptingComponentFromStored = $1004;
    kGSSSelectGenericToRealID   = $1005;
    kGSSSelectRealToGenericID   = $1006;
    kGSSSelectOutOfRange        = $1007;


type
    ScriptingComponentSelector          = OSType;
    GenericID                           = OSAID;
    {    get and set the default scripting component    }
    {
     *  OSAGetDefaultScriptingComponent()
     *
     *  Availability:
     *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function OSAGetDefaultScriptingComponent(genericScriptingComponent: ComponentInstance; var scriptingSubType: ScriptingComponentSelector): OSAError; external name '_OSAGetDefaultScriptingComponent';
{
 *  OSASetDefaultScriptingComponent()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OSASetDefaultScriptingComponent(genericScriptingComponent: ComponentInstance; scriptingSubType: ScriptingComponentSelector): OSAError; external name '_OSASetDefaultScriptingComponent';
{ get a scripting component instance from its subtype code }
{
 *  OSAGetScriptingComponent()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OSAGetScriptingComponent(genericScriptingComponent: ComponentInstance; scriptingSubType: ScriptingComponentSelector; var scriptingInstance: ComponentInstance): OSAError; external name '_OSAGetScriptingComponent';
{ get a scripting component selector (subType) from a stored script }
{
 *  OSAGetScriptingComponentFromStored()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OSAGetScriptingComponentFromStored(genericScriptingComponent: ComponentInstance; const (*var*) scriptData: AEDesc; var scriptingSubType: ScriptingComponentSelector): OSAError; external name '_OSAGetScriptingComponentFromStored';
{ get a real component instance and script id from a generic id }
{
 *  OSAGenericToRealID()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OSAGenericToRealID(genericScriptingComponent: ComponentInstance; var theScriptID: OSAID; var theExactComponent: ComponentInstance): OSAError; external name '_OSAGenericToRealID';
{ get a generic id from a real component instance and script id }
{
 *  OSARealToGenericID()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OSARealToGenericID(genericScriptingComponent: ComponentInstance; var theScriptID: OSAID; theExactComponent: ComponentInstance): OSAError; external name '_OSARealToGenericID';
{$ALIGN MAC68K}
{#POP}
{unit Appearance}
{$ALIGN MAC68K}







{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{ Appearance Manager constants, etc.                                               }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{ Appearance Manager Apple Events (1.1 and later)              }

{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}


const
    kAppearanceEventClass       = $61707072 (* 'appr' *);                       {  Event Class  }
    kAEAppearanceChanged        = $74686D65 (* 'thme' *);                       {  Appearance changed (e.g. platinum to hi-tech)  }
    kAESystemFontChanged        = $73797366 (* 'sysf' *);                       {  system font changed  }
    kAESmallSystemFontChanged   = $7373666E (* 'ssfn' *);                       {  small system font changed  }
    kAEViewsFontChanged         = $76666E74 (* 'vfnt' *);                       {  views font changed  }

    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {    Appearance Manager file types                                                      }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    kThemeDataFileType          = $74686D65 (* 'thme' *);                       {  file type for theme files  }
    kThemePlatinumFileType      = $706C746E (* 'pltn' *);                       {  file type for platinum appearance  }
    kThemeCustomThemesFileType  = $7363656E (* 'scen' *);                       {  file type for user themes  }
    kThemeSoundTrackFileType    = $74736E64 (* 'tsnd' *);

    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {    Appearance Manager Supported Themes                                                }
    {    Use CopyThemeIdentifier to get the current theme ID                                }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kThemeAppearancePlatinum CFSTRP('com.apple.theme.appearance.platinum')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kThemeAppearanceAqua CFSTRP('com.apple.theme.appearance.aqua')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kThemeAppearanceAquaBlue CFSTRP('com.apple.theme.appearance.aqua.blue')}
{$endc}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kThemeAppearanceAquaGraphite CFSTRP('com.apple.theme.appearance.aqua.graphite')}
{$endc}


{
 *  AppearancePartCode
 *
 *  Summary:
 *    These are part codes returned by a few of the hit testing
 *    Appearance APIs. Many of the Control Manager's ControlPartCodes
 *    are based on these part codes.
 }
type AppearancePartCode = SInt16;
const
  {
   * This represents the lack of a part. It will be returned when the
   * Appearance Manager's hit testing logic determines that the input
   * point is not in any part of the widget.
   }
  kAppearancePartMetaNone       = 0;

  {
   * This represents a widget which is not currently clickable because
   * it is disabled.
   }
  kAppearancePartMetaDisabled   = 254;

  {
   * This represents a widget which is inactive, presumably because it
   * is in a window that is inactive.
   }
  kAppearancePartMetaInactive   = 255;

  {
   * The part of a widget which indicates the widget's value. Scroll
   * bar thumbs and slider thumbs are the two main examples.
   }
  kAppearancePartIndicator      = 129;

  {
   * The part of a widget which moves its value visually upward. Scroll
   * bar up arrows are the main example.
   }
  kAppearancePartUpButton       = 20;

  {
   * The part of a widget which moves its value visually downward.
   * Scroll bar down arrows are the main example.
   }
  kAppearancePartDownButton     = 21;

  {
   * The part of a widget which moves its value visually leftward.
   * Scroll bar left arrows are the main example.
   }
  kAppearancePartLeftButton     = kAppearancePartUpButton;

  {
   * The part of a widget which moves its value visually rightward.
   * Scroll bar right arrows are the main example.
   }
  kAppearancePartRightButton    = kAppearancePartDownButton;

  {
   * The part of a widget which moves its value visually upward one
   * whole page. Scroll bar page up areas are the main example.
   }
  kAppearancePartPageUpArea     = 22;

  {
   * The part of a widget which moves its value visually downward one
   * whole page. Scroll bar page down areas are the main example.
   }
  kAppearancePartPageDownArea   = 23;

  {
   * The part of a widget which moves its value visually leftward one
   * whole page. Scroll bar page left areas are the main example.
   }
  kAppearancePartPageLeftArea   = kAppearancePartPageUpArea;

  {
   * The part of a widget which moves its value visually rightward one
   * whole page. Scroll bar page right areas are the main example.
   }
  kAppearancePartPageRightArea  = kAppearancePartPageDownArea;

{
 *  AppearanceRegionCode
 *
 *  Summary:
 *    These are region codes used by a few of window-related Appearance
 *    APIs. Many of the Window Manager's WindowRegionCodes are based on
 *    these region codes.
 }
type AppearanceRegionCode = UInt16;
const
  kAppearanceRegionTitleBar     = 0;
  kAppearanceRegionTitleText    = 1;
  kAppearanceRegionCloseBox     = 2;
  kAppearanceRegionZoomBox      = 3;
  kAppearanceRegionDrag         = 5;
  kAppearanceRegionGrow         = 6;
  kAppearanceRegionCollapseBox  = 7;
  kAppearanceRegionTitleProxyIcon = 8;  { Mac OS 8.5 forward }
  kAppearanceRegionStructure    = 32;
  kAppearanceRegionContent      = 33;    { Content area of the window; empty when the window is collapsed }

const
    kThemeBrushDialogBackgroundActive = 1;                      {  use with kModalWindowClass  }
    kThemeBrushDialogBackgroundInactive = 2;                    {  use with kModalWindowClass  }
    kThemeBrushAlertBackgroundActive = 3;                       {  use with kAlertWindowClass and kMovableAlertWindowClass  }
    kThemeBrushAlertBackgroundInactive = 4;                     {  use with kAlertWindowClass and kMovableAlertWindowClass  }
    kThemeBrushModelessDialogBackgroundActive = 5;              {  use with kDocumentWindowClass  }
    kThemeBrushModelessDialogBackgroundInactive = 6;            {  use with kDocumentWindowClass  }
    kThemeBrushUtilityWindowBackgroundActive = 7;               {  use with kFloatingWindowClass and kUtilityWindowClass  }
    kThemeBrushUtilityWindowBackgroundInactive = 8;             {  use with kFloatingWindowClass and kUtilityWindowClass  }
    kThemeBrushListViewSortColumnBackground = 9;                {  Finder list views  }
    kThemeBrushListViewBackground = 10;
    kThemeBrushIconLabelBackground = 11;
    kThemeBrushListViewSeparator = 12;
    kThemeBrushChasingArrows    = 13;
    kThemeBrushDragHilite       = 14;
    kThemeBrushDocumentWindowBackground = 15;                   {  use with kDocumentWindowClass  }
    kThemeBrushFinderWindowBackground = 16;

    {    Brushes introduced in Appearance 1.1 (Mac OS 8.5) and later    }
    kThemeBrushScrollBarDelimiterActive = 17;
    kThemeBrushScrollBarDelimiterInactive = 18;
    kThemeBrushFocusHighlight   = 19;
    kThemeBrushPopupArrowActive = 20;
    kThemeBrushPopupArrowPressed = 21;
    kThemeBrushPopupArrowInactive = 22;
    kThemeBrushAppleGuideCoachmark = 23;
    kThemeBrushIconLabelBackgroundSelected = 24;
    kThemeBrushStaticAreaFill   = 25;
    kThemeBrushActiveAreaFill   = 26;
    kThemeBrushButtonFrameActive = 27;
    kThemeBrushButtonFrameInactive = 28;
    kThemeBrushButtonFaceActive = 29;
    kThemeBrushButtonFaceInactive = 30;
    kThemeBrushButtonFacePressed = 31;
    kThemeBrushButtonActiveDarkShadow = 32;
    kThemeBrushButtonActiveDarkHighlight = 33;
    kThemeBrushButtonActiveLightShadow = 34;
    kThemeBrushButtonActiveLightHighlight = 35;
    kThemeBrushButtonInactiveDarkShadow = 36;
    kThemeBrushButtonInactiveDarkHighlight = 37;
    kThemeBrushButtonInactiveLightShadow = 38;
    kThemeBrushButtonInactiveLightHighlight = 39;
    kThemeBrushButtonPressedDarkShadow = 40;
    kThemeBrushButtonPressedDarkHighlight = 41;
    kThemeBrushButtonPressedLightShadow = 42;
    kThemeBrushButtonPressedLightHighlight = 43;
    kThemeBrushBevelActiveLight = 44;
    kThemeBrushBevelActiveDark  = 45;
    kThemeBrushBevelInactiveLight = 46;
    kThemeBrushBevelInactiveDark = 47;

    {    Brushes introduced in Appearance 1.1.1 (Mac OS 9.0) and later  }
    kThemeBrushNotificationWindowBackground = 48;

    {    Brushes introduced in Carbon   }
    kThemeBrushMovableModalBackground = 49;                     {  use with kMovableModalWindowClass; available in Mac OS X, and CarbonLib 1.3 and later  }
    kThemeBrushSheetBackgroundOpaque = 50;                      {  use with kSheetWindowClass and kSheetAlertWindowClass; available in Mac OS X, and CarbonLib 1.3 and later  }
    kThemeBrushDrawerBackground = 51;                           {  use with kDrawerWindowClass; available in Mac OS X, and CarbonLib 1.3 and later  }
    kThemeBrushToolbarBackground = 52;                          {  use with kToolbarWindowClass; available in Mac OS X, and CarbonLib 1.6 and later  }
    kThemeBrushSheetBackgroundTransparent = 53;                 {  use with kSheetWindowClass and kSheetAlertWindowClass; available in Mac OS X 10.1 and CarbonLib 1.6, and later  }
    kThemeBrushMenuBackground   = 54;                           {  available in Mac OS X 10.1 and CarbonLib 1.6, and later  }
    kThemeBrushMenuBackgroundSelected = 55;                     {  available in Mac OS X 10.1 and CarbonLib 1.6, and later  }

    {    Appearance X or later theme brush compatibility synonyms   }
    kThemeBrushSheetBackground  = kThemeBrushSheetBackgroundOpaque;

    {    These values are meta-brushes, specific colors that do not         }
    {    change from theme to theme. You can use them instead of using      }
    {    direct RGB values.                                                 }
    kThemeBrushBlack            = -1;
    kThemeBrushWhite            = -2;
    kThemeBrushPrimaryHighlightColor = -3;                      {  available in Mac OS 10.1 and CarbonLib 1.6, and later }
    kThemeBrushSecondaryHighlightColor = -4;                    {  available in Mac OS 10.1 and CarbonLib 1.6, and later }
    kThemeBrushAlternatePrimaryHighlightColor = -5;             {  available in Mac OS 10.2 and later }


type
    ThemeBrush                          = SInt16;

const
    kThemeTextColorDialogActive = 1;
    kThemeTextColorDialogInactive = 2;
    kThemeTextColorAlertActive  = 3;
    kThemeTextColorAlertInactive = 4;
    kThemeTextColorModelessDialogActive = 5;
    kThemeTextColorModelessDialogInactive = 6;
    kThemeTextColorWindowHeaderActive = 7;
    kThemeTextColorWindowHeaderInactive = 8;
    kThemeTextColorPlacardActive = 9;
    kThemeTextColorPlacardInactive = 10;
    kThemeTextColorPlacardPressed = 11;
    kThemeTextColorPushButtonActive = 12;
    kThemeTextColorPushButtonInactive = 13;
    kThemeTextColorPushButtonPressed = 14;
    kThemeTextColorBevelButtonActive = 15;
    kThemeTextColorBevelButtonInactive = 16;
    kThemeTextColorBevelButtonPressed = 17;
    kThemeTextColorPopupButtonActive = 18;
    kThemeTextColorPopupButtonInactive = 19;
    kThemeTextColorPopupButtonPressed = 20;
    kThemeTextColorIconLabel    = 21;
    kThemeTextColorListView     = 22;

    {    Text Colors available in Appearance 1.0.1 or later     }
    kThemeTextColorDocumentWindowTitleActive = 23;
    kThemeTextColorDocumentWindowTitleInactive = 24;
    kThemeTextColorMovableModalWindowTitleActive = 25;
    kThemeTextColorMovableModalWindowTitleInactive = 26;
    kThemeTextColorUtilityWindowTitleActive = 27;
    kThemeTextColorUtilityWindowTitleInactive = 28;
    kThemeTextColorPopupWindowTitleActive = 29;
    kThemeTextColorPopupWindowTitleInactive = 30;
    kThemeTextColorRootMenuActive = 31;
    kThemeTextColorRootMenuSelected = 32;
    kThemeTextColorRootMenuDisabled = 33;
    kThemeTextColorMenuItemActive = 34;
    kThemeTextColorMenuItemSelected = 35;
    kThemeTextColorMenuItemDisabled = 36;
    kThemeTextColorPopupLabelActive = 37;
    kThemeTextColorPopupLabelInactive = 38;


    {    Text colors available in Appearance 1.1 or later   }
    kThemeTextColorTabFrontActive = 39;
    kThemeTextColorTabNonFrontActive = 40;
    kThemeTextColorTabNonFrontPressed = 41;
    kThemeTextColorTabFrontInactive = 42;
    kThemeTextColorTabNonFrontInactive = 43;
    kThemeTextColorIconLabelSelected = 44;
    kThemeTextColorBevelButtonStickyActive = 45;
    kThemeTextColorBevelButtonStickyInactive = 46;

    {    Text colors available in Appearance 1.1.1 or later     }
    kThemeTextColorNotification = 47;


    {     Text colors only available later than OS X 10.1.3     }
    kThemeTextColorSystemDetail  = 48;

    {    These values are specific colors that do not change from               }
    {    theme to theme. You can use them instead of using direct RGB values.   }
    kThemeTextColorBlack        = -1;
    kThemeTextColorWhite        = -2;


type
    ThemeTextColor                      = SInt16;
    {    States to draw primitives: disabled, active, and pressed (hilited)     }

const
    kThemeStateInactive         = 0;
    kThemeStateActive           = 1;
    kThemeStatePressed          = 2;
    kThemeStateRollover         = 6;
    kThemeStateUnavailable      = 7;
    kThemeStateUnavailableInactive = 8;

    {    obsolete name  }
    kThemeStateDisabled         = 0;

    kThemeStatePressedUp        = 2;                            {  draw with up pressed     (increment/decrement buttons)  }
    kThemeStatePressedDown      = 3;                            {  draw with down pressed (increment/decrement buttons)  }


type
    ThemeDrawState                      = UInt32;
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {    Theme cursor selectors available in Appearance 1.1 or later                        }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }

const
    kThemeArrowCursor           = 0;
    kThemeCopyArrowCursor       = 1;
    kThemeAliasArrowCursor      = 2;
    kThemeContextualMenuArrowCursor = 3;
    kThemeIBeamCursor           = 4;
    kThemeCrossCursor           = 5;
    kThemePlusCursor            = 6;
    kThemeWatchCursor           = 7;                            {  Can Animate  }
    kThemeClosedHandCursor      = 8;
    kThemeOpenHandCursor        = 9;
    kThemePointingHandCursor    = 10;
    kThemeCountingUpHandCursor  = 11;                           {  Can Animate  }
    kThemeCountingDownHandCursor = 12;                          {  Can Animate  }
    kThemeCountingUpAndDownHandCursor = 13;                     {  Can Animate  }
    kThemeSpinningCursor        = 14;                           {  Can Animate  }
    kThemeResizeLeftCursor      = 15;
    kThemeResizeRightCursor     = 16;
    kThemeResizeLeftRightCursor = 17;
    kThemeNotAllowedCursor      = 18;   { available on Mac OS X 10.2 and later }

    {
     * Available in Mac OS X 10.3 or later.
     }
    kThemeResizeUpCursor          = 19;

    {
     * Available in Mac OS X 10.3 or later.
     }
    kThemeResizeDownCursor        = 20;

    {
     * Available in Mac OS X 10.3 or later.
     }
    kThemeResizeUpDownCursor      = 21;

    {
     * A special cursor to indicate that letting up the mouse will cause
     * a dragged item to go away. When the item goes away, a poof cloud
     * animation should occur. This cursor should be updated dynamically
     * dependeding on whether the mouse up action will remove the item.
     * Available in Mac OS X 10.3 or later.
     }
    kThemePoofCursor              = 22;


type
    ThemeCursor                         = UInt32;
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {    Theme menu bar drawing states                                                      }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }

const
    kThemeMenuBarNormal         = 0;
    kThemeMenuBarSelected       = 1;


type
    ThemeMenuBarState                   = UInt16;
    {    attributes     }

const
    kThemeMenuSquareMenuBar     = $01;

    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {    Theme menu drawing states                                                          }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    kThemeMenuActive            = 0;
    kThemeMenuSelected          = 1;
    kThemeMenuDisabled          = 3;


type
    ThemeMenuState                      = UInt16;
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {    MenuType: add kThemeMenuTypeInactive to menu type for DrawThemeMenuBackground if entire    }
    {    menu is inactive                                                                           }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }

const
    kThemeMenuTypePullDown      = 0;
    kThemeMenuTypePopUp         = 1;
    kThemeMenuTypeHierarchical  = 2;
    kThemeMenuTypeInactive      = $0100;


type
    ThemeMenuType                       = UInt16;

const
    kThemeMenuItemPlain         = 0;
    kThemeMenuItemHierarchical  = 1;                            {  item has hierarchical arrow }
    kThemeMenuItemScrollUpArrow = 2;                            {  for scrollable menus, indicates item is scroller }
    kThemeMenuItemScrollDownArrow = 3;
    kThemeMenuItemAtTop         = $0100;                        {  indicates item is being drawn at top of menu }
    kThemeMenuItemAtBottom      = $0200;                        {  indicates item is being drawn at bottom of menu }
    kThemeMenuItemHierBackground = $0400;                       {  item is within a hierarchical menu }
    kThemeMenuItemPopUpBackground = $0800;                      {  item is within a popped up menu }
    kThemeMenuItemHasIcon       = $8000;                        {  add into non-arrow type when icon present }
    kThemeMenuItemNoBackground  = $4000;                        {  don't draw the menu background while drawing this item (Mac OS X only) }


type
    ThemeMenuItemType                   = UInt16;
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {    Theme Backgrounds                                                                          }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }

const
    kThemeBackgroundTabPane     = 1;
    kThemeBackgroundPlacard     = 2;
    kThemeBackgroundWindowHeader = 3;
    kThemeBackgroundListViewWindowHeader = 4;
    kThemeBackgroundSecondaryGroupBox = 5;

    {
     * A special theme brush for drawing metal backgrounds. Currently,
     * this brush only works with HIThemeApplyBackground.
     }
    kThemeBackgroundMetal         = 6;


type
    ThemeBackgroundKind                 = UInt32;
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {    Theme Collection tags for Get/SetTheme                                                     }
    {                                                                                               }
    {     X ALERT: Please note that Get/SetTheme are severely neutered under Mac OS X at present.   }
    {              The first group of tags below are available to get under both 9 and X. The       }
    {              second group is 9 only. None of the tags can be used in SetTheme on X, as it     }
    {              is completely inert on X, and will return unimpErr.                              }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }

const
    kThemeNameTag               = $6E616D65 (* 'name' *);                       {  Str255 }
    kThemeVariantNameTag        = $7661726E (* 'varn' *);                       {  Str255 }
    kThemeVariantBaseTintTag    = $74696E74 (* 'tint' *);                       {  RGBColor (10.1 and later) }
    kThemeHighlightColorTag     = $68636F6C (* 'hcol' *);                       {  RGBColor }
    kThemeScrollBarArrowStyleTag = $73626172 (* 'sbar' *);                      {  ThemeScrollBarArrowStyle }
    kThemeScrollBarThumbStyleTag = $73627468 (* 'sbth' *);                      {  ThemeScrollBarThumbStyle }
    kThemeSoundsEnabledTag      = $736E6473 (* 'snds' *);                       {  Boolean }
    kThemeDblClickCollapseTag   = $636F6C6C (* 'coll' *);                       {  Boolean }

    kThemeAppearanceFileNameTag = $74686D65 (* 'thme' *);                       {  Str255 }
    kThemeSystemFontTag         = $6C677366 (* 'lgsf' *);                       {  Str255 }
    kThemeSmallSystemFontTag    = $736D7366 (* 'smsf' *);                       {  Str255 }
    kThemeViewsFontTag          = $76666E74 (* 'vfnt' *);                       {  Str255 }
    kThemeViewsFontSizeTag      = $7666737A (* 'vfsz' *);                       {  SInt16 }
    kThemeDesktopPatternNameTag = $7061746E (* 'patn' *);                       {  Str255 }
    kThemeDesktopPatternTag     = $70617474 (* 'patt' *);                       {  <variable-length data> (flattened pattern) }
    kThemeDesktopPictureNameTag = $64706E6D (* 'dpnm' *);                       {  Str255 }
    kThemeDesktopPictureAliasTag = $6470616C (* 'dpal' *);                      {  <alias handle> }
    kThemeDesktopPictureAlignmentTag = $6470616E (* 'dpan' *);                  {  UInt32 (see the Picture Alignments below) }
    kThemeHighlightColorNameTag = $68636E6D (* 'hcnm' *);                       {  Str255 }
    kThemeExamplePictureIDTag   = $65706963 (* 'epic' *);                       {  SInt16 }
    kThemeSoundTrackNameTag     = $736E6474 (* 'sndt' *);                       {  Str255 }
    kThemeSoundMaskTag          = $736D736B (* 'smsk' *);                       {  UInt32 }
    kThemeUserDefinedTag        = $75736572 (* 'user' *);                       {  Boolean (this should _always_ be true if present - used by Control Panel). }
    kThemeSmoothFontEnabledTag  = $736D6F6F (* 'smoo' *);                       {  Boolean }
    kThemeSmoothFontMinSizeTag  = $736D6F73 (* 'smos' *);                       {  UInt16 (must be >= 12 and <= 24) }

    {  Picture Aligmnents that might be reported in the data for kThemeDesktopPictureAlignmentTag }
    kTiledOnScreen              = 1;                            {  draws picture repeatedly }
    kCenterOnScreen             = 2;                            {  "actual size", shows pattern on sides or clips picture if necessary }
    kFitToScreen                = 3;                            {  shrinks if necessary }
    kFillScreen                 = 4;                            {  messes up aspect ratio if necessary }
    kUseBestGuess               = 5;                            {  heuristically determines the best way to display the picture based on picture and monitor sizes }

    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {    Theme Control Settings                                                                     }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    kThemeCheckBoxClassicX      = 0;                            {  check box with an 'X' }
    kThemeCheckBoxCheckMark     = 1;                            {  check box with a real check mark }


type
    ThemeCheckBoxStyle                  = UInt16;

const
    kThemeScrollBarArrowsSingle = 0;                            {  single arrow on each end }
    kThemeScrollBarArrowsLowerRight = 1;                        {  double arrows only on right or bottom }


type
    ThemeScrollBarArrowStyle            = UInt16;

const
    kThemeScrollBarThumbNormal  = 0;                            {  normal, classic thumb size }
    kThemeScrollBarThumbProportional = 1;                       {  proportional thumbs }


type
    ThemeScrollBarThumbStyle            = UInt16;
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {    Font constants                                                                             }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }

    {
     *  Summary:
     *    A ThemeFontID value is a virtual font ID which can be passed to
     *    one of the Appearance Manager's text-related routines. Within
     *    those routines, the ThemeFontID is mapped into the appropriate
     *    real font (or fonts), size, and style based on the system
     *    appearance (Platinum on Mac OS 9, Aqua on Mac OS X), the string
     *    to be rendered (if any), the language/ script that the app is
     *    running in, and possibly other factors. The ThemeFontIDs allow
     *    you to get the correct text appearance for the platform your app
     *    is currently running on.
        }

const

    {
     * The font used to draw most interface elements. If you can't find a
     * more appropriate font from the list below, you should use this
     * one. This font is suitable for drawing titles on most custom
     * widgets/buttons, as well as most static text in dialogs and
     * windows.
     }
    kThemeSystemFont            = 0;

    {
     * The font used to draw interface elements when space is at a
     * premium. It draws a slightly smaller font compared to
     * kThemeSystemFont.
     }
    kThemeSmallSystemFont       = 1;

    {
     * Identical to kThemeSmallSystemFont, except it draws bolded (or
     * otherwise emphasized in some fashion appropriate to your
     * application's language/script).
     }
    kThemeSmallEmphasizedSystemFont = 2;

    {
     * The font used to draw file and folder names in Finder windows or
     * other browsable lists.
     }
    kThemeViewsFont             = 3;                            {  The following ID's are only available with MacOS X or CarbonLib 1.3 and later }

    {
     * Identical to kThemeSystemFont, except it draws bolded (or
     * otherwise emphasized in some fashion appropriate to your
     * application's language/script). Only available on Mac OS X or
     * CarbonLib 1.3 or later.
     }
    kThemeEmphasizedSystemFont  = 4;

    {
     * An analog to the Script Manager's notion of the Application Font.
     * This font is a suitable default choice for your application's
     * document-style text editing areas. Only available on Mac OS X or
     * CarbonLib 1.3 or later.
     }
    kThemeApplicationFont       = 5;

    {
     * Generally smaller than kThemeSmallSystemFont, this font is
     * appropriate for drawing text labels next to image content that
     * reinforces the text's meaning (such as on a bevel button). Only
     * available on Mac OS X or CarbonLib 1.3 or later.
     }
    kThemeLabelFont             = 6;

    {
     * The font used to draw menu titles in the menu bar. Only available
     * on Mac OS X or CarbonLib 1.3 or later.
     }
    kThemeMenuTitleFont         = 100;

    {
     * The font used to draw menu items in the menus. Only available on
     * Mac OS X or CarbonLib 1.3 or later.
     }
    kThemeMenuItemFont          = 101;

    {
     * The font used to draw menu item marks in the menus. Only available
     * on Mac OS X or CarbonLib 1.3 or later.
     }
    kThemeMenuItemMarkFont      = 102;

    {
     * The font used to draw menu item command key equivalents in the
     * menus. Only available on Mac OS X or CarbonLib 1.3 or later.
     }
    kThemeMenuItemCmdKeyFont    = 103;

    {
     * The font used to draw text in most window title bars. Only
     * available on Mac OS X or CarbonLib 1.3 or later.
     }
    kThemeWindowTitleFont       = 104;

    {
     * The font used to draw text labels on push buttons. Only available
     * on Mac OS X or CarbonLib 1.3 or later.
     }
    kThemePushButtonFont        = 105;

    {
     * The font used to draw text in utility window title bars. Only
     * available on Mac OS X or CarbonLib 1.3 or later.
     }
    kThemeUtilityWindowTitleFont = 106;

    {
     * The font used to draw the first (and most important) message of an
     * alert window. Only available on Mac OS X or CarbonLib 1.3 or later.
     }
    kThemeAlertHeaderFont       = 107;
    kThemeSystemFontDetail        = 7;
    kThemeSystemFontDetailEmphasized = 8;

    {
     * The font used to draw the label of a toolbar item. Available in
     * Mac OS X 10.2 or later.
     }
    kThemeToolbarFont           = 108;

    {
     * Unlike the other ThemeFontIDs, this one doesn't map to a font
     * appropriate to your application's language or script. It maps
     * directly to the font, size, and style of the current Quickdraw
     * port. This allows you to get somewhat customized behavior out of
     * the APIs which take ThemeFontIDs. Note, however, that
     * kThemeCurrentPortFont does not (and will never) support all
     * Quickdraw styles on all platforms; in particular, outline and
     * shadow style are not supported on Mac OS X. Additionally,
     * kThemeCurrentPortFont is not (and will never be) completely
     * unicode savvy; use of kThemeCurrentPortFont may result in errors
     * having to do with the current port's font not being appropriate
     * for rendering or measuring all glyphs in a given unicode string.
     * Because of overhead associated with gathering Quickdraw font
     * information and converting it to the native font format on Mac OS
     * X, use of kThemeCurrentPortFont may slow down your text drawing
     * and measuring significantly compared to other ThemeFontIDs.
     * Instead of using kThemeCurrentPortFont, your application will
     * probably be better served by using one of the other ThemeFontIDs;
     * use kThemeCurrentPortFont only as a last resort. Only available on
     * Mac OS X or CarbonLib 1.3 or later.
     }
    kThemeCurrentPortFont       = 200;

    {
     * The appropriate system font for mini-sized controls. Available in
     * Mac OS X 10.3 or later.
     }
    kThemeMiniSystemFont          = 109;

    { This is the total of the PUBLIC ThemeFontIDs! }
    kPublicThemeFontCount         = 20;


type
    ThemeFontID                         = UInt16;
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {    Tab constants                                                                              }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }

const
    kThemeTabNonFront           = 0;
    kThemeTabNonFrontPressed    = 1;
    kThemeTabNonFrontInactive   = 2;
    kThemeTabFront              = 3;
    kThemeTabFrontInactive      = 4;
    kThemeTabNonFrontUnavailable = 5;
    kThemeTabFrontUnavailable   = 6;


type
    ThemeTabStyle                       = UInt16;

const
    kThemeTabNorth              = 0;
    kThemeTabSouth              = 1;
    kThemeTabEast               = 2;
    kThemeTabWest               = 3;


type
    ThemeTabDirection                   = UInt16;
    {    NOTE ON TAB HEIGHT                                                                         }
    {    Use the kThemeSmallTabHeightMax and kThemeLargeTabHeightMax when calculating the rects     }
    {    to draw tabs into. This height includes the tab frame overlap. Tabs that are not in the    }
    {    front are only drawn down to where they meet the frame, as if the height was just          }
    {    kThemeLargeTabHeight, for example, as opposed to the ...Max constant. Remember that for    }
    {    East and West tabs, the height referred to below is actually the width.                    }

    {
     *  Summary:
     *    Deprecated tab height and overlap constants.
     *
     *  Discussion:
     *    These constants have been deprecated in favor of theme metrics.
     *    Please do not use them anymore. These constants will be removed
     *    in the next major release of OS X.
     }

const
   {
    * Deprecated. Use kThemeMetricSmallTabHeight.
    }
    kThemeSmallTabHeight        = 16;                           {  amount small tabs protrude from frame. }

   {
    * Deprecated. Use kThemeMetricLargeTabHeight.
    }
    kThemeLargeTabHeight        = 21;                           {  amount large tabs protrude from frame. }

   {
    * Deprecated. Use kThemeMetricTabFrameOverlap.
    }
    kThemeTabPaneOverlap        = 3;                            {  amount tabs overlap frame. }

   {
    * Deprecated. Use kThemeMetricSmallTabHeight and
    * kThemeMetricSmallTabFrameOverlap.
    }
    kThemeSmallTabHeightMax     = 19;                           {  small tab height + overlap }

   {
    * Deprecated. Use metric kThemeMetricLargeTabHeight and
    * kThemeMetricTabFrameOverlap.
    }
    kThemeLargeTabHeightMax     = 24;                           {  large tab height + overlap }

    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {    Track kinds                                                                                }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    kThemeMediumScrollBar       = 0;
    kThemeSmallScrollBar        = 1;
    kThemeMediumSlider          = 2;
    kThemeMediumProgressBar     = 3;
    kThemeMediumIndeterminateBar = 4;
    kThemeRelevanceBar          = 5;
    kThemeSmallSlider           = 6;
    kThemeLargeProgressBar      = 7;
    kThemeLargeIndeterminateBar = 8;

   {
    *  Discussion:
    *    New TThemeTrackKinds on Mac OS X 10.3 and later. Not all of them
    *    are implemented.
    }

   {
    * Not implemented. Will return paramErr if used.
    }
    kThemeMiniScrollBar           = 9;

   {
    * A miniature version of the slider.
    }
    kThemeMiniSlider              = 10;

   {
    * Not implemented. Will return paramErr if used.
    }
    kThemeMiniProgressBar         = 11;

   {
    * Not implemented. Will return paramErr if used.
    }
    kThemeMiniIndeterminateBar    = 12;

type
    ThemeTrackKind                      = UInt16;
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {    Track enable states                                                                        }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }

const
                                                                {  track states  }
    kThemeTrackActive           = 0;
    kThemeTrackDisabled         = 1;
    kThemeTrackNothingToScroll  = 2;
    kThemeTrackInactive         = 3;


type
    ThemeTrackEnableState               = UInt8;
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {    Track pressed states                                                                       }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }

const
                                                                {  press states (ignored unless track is active)  }
    kThemeLeftOutsideArrowPressed = $01;
    kThemeLeftInsideArrowPressed = $02;
    kThemeLeftTrackPressed      = $04;
    kThemeThumbPressed          = $08;
    kThemeRightTrackPressed     = $10;
    kThemeRightInsideArrowPressed = $20;
    kThemeRightOutsideArrowPressed = $40;
    kThemeTopOutsideArrowPressed = kThemeLeftOutsideArrowPressed;
    kThemeTopInsideArrowPressed = kThemeLeftInsideArrowPressed;
    kThemeTopTrackPressed       = kThemeLeftTrackPressed;
    kThemeBottomTrackPressed    = kThemeRightTrackPressed;
    kThemeBottomInsideArrowPressed = kThemeRightInsideArrowPressed;
    kThemeBottomOutsideArrowPressed = kThemeRightOutsideArrowPressed;


type
    ThemeTrackPressState                = UInt8;
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {    Thumb directions                                                                           }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }

const
                                                                {  thumb direction  }
    kThemeThumbPlain            = 0;
    kThemeThumbUpward           = 1;
    kThemeThumbDownward         = 2;


type
    ThemeThumbDirection                 = UInt8;
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {    Track attributes                                                                           }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }

    {
     *  Discussion:
     *    Theme track attributes control the look of the track elements as
     *    drawn by the DrawThemeTrackFoo as well as the region returned by
     *    GetThemeTrackFoo.
        }

const

    {
     * The track is drawn horizontally.
     }
    kThemeTrackHorizontal       = $01;

    {
     * The track progresses from right to left.
     }
    kThemeTrackRightToLeft      = $02;

    {
     * The track's thumb should be drawn.
     }
    kThemeTrackShowThumb        = $04;

    {
     * The provided thumbRgn should be drawn opaque, not as a ghost.
     }
    kThemeTrackThumbRgnIsNotGhost = $08;

    {
     * The track scroll bar doesn't have arrows.  This attribute
     * currently has no effect
     }
    kThemeTrackNoScrollBarArrows = $10;

    {
     * The thumb has focus.  This attribute currently has effect only on
     * sliders.  Available only in Mac OS X after 10.1.
     }
    kThemeTrackHasFocus           = $20;


type
    ThemeTrackAttributes                = UInt16;
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {    Track info block                                                                           }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    ScrollBarTrackInfoPtr = ^ScrollBarTrackInfo;
    ScrollBarTrackInfo = record
        viewsize:               SInt32;                                 {  current view range size  }
        pressState:             SInt8;                                  {  pressed parts state  }
    end;

    SliderTrackInfoPtr = ^SliderTrackInfo;
    SliderTrackInfo = record
        thumbDir:               SInt8;                                  {  thumb direction  }
        pressState:             SInt8;                                  {  pressed parts state  }
    end;

    ProgressTrackInfoPtr = ^ProgressTrackInfo;
    ProgressTrackInfo = record
        phase:                  SInt8;                                  {  phase for indeterminate progress  }
    end;

    ThemeTrackDrawInfoPtr = ^ThemeTrackDrawInfo;
    ThemeTrackDrawInfo = record
        kind:                   ThemeTrackKind;                         {  what kind of track this info is for  }
        bounds:                 Rect;                                   {  track basis rectangle  }
        min:                    SInt32;                                 {  min track value  }
        max:                    SInt32;                                 {  max track value  }
        value:                  SInt32;                                 {  current thumb value  }
        reserved:               UInt32;
        attributes:             ThemeTrackAttributes;                   {  various track attributes  }
        enableState:            SInt8;                                  {  enable state  }
        filler1:                SInt8;
        case SInt16 of
        0: (
            scrollbar:          ScrollBarTrackInfo;
            );
        1: (
            slider:             SliderTrackInfo;
            );
        2: (
            progress:           ProgressTrackInfo;
            );
    end;

    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {    ThemeWindowAttributes                                                                      }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }

const
    kThemeWindowHasGrow         = $01;                          {  can the size of the window be changed by the user?  }
    kThemeWindowHasHorizontalZoom = $08;                        {  window can zoom only horizontally  }
    kThemeWindowHasVerticalZoom = $10;                          {  window can zoom only vertically  }
    kThemeWindowHasFullZoom     = $18;                          {  window zooms in all directions  }
    kThemeWindowHasCloseBox     = $20;                          {  window has a close box  }
    kThemeWindowHasCollapseBox  = $40;                          {  window has a collapse box  }
    kThemeWindowHasTitleText    = $80;                          {  window has a title/title icon  }
    kThemeWindowIsCollapsed     = $0100;                        {  window is in the collapsed state  }
    kThemeWindowHasDirty        = $0200;


type
    ThemeWindowAttributes               = UInt32;
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {    Window Types Supported by the Appearance Manager                                           }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }

const
    kThemeDocumentWindow        = 0;
    kThemeDialogWindow          = 1;
    kThemeMovableDialogWindow   = 2;
    kThemeAlertWindow           = 3;
    kThemeMovableAlertWindow    = 4;
    kThemePlainDialogWindow     = 5;
    kThemeShadowDialogWindow    = 6;
    kThemePopupWindow           = 7;
    kThemeUtilityWindow         = 8;
    kThemeUtilitySideWindow     = 9;
    kThemeSheetWindow           = 10;
    kThemeDrawerWindow          = 11;


type
    ThemeWindowType                     = UInt16;
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {    Window Widgets Supported by the Appearance Manager                                         }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }

const
    kThemeWidgetCloseBox        = 0;
    kThemeWidgetZoomBox         = 1;
    kThemeWidgetCollapseBox     = 2;
    kThemeWidgetDirtyCloseBox   = 6;


type
    ThemeTitleBarWidget                 = UInt16;
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {    Popup arrow orientations                                                                   }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }

const
    kThemeArrowLeft             = 0;
    kThemeArrowDown             = 1;
    kThemeArrowRight            = 2;
    kThemeArrowUp               = 3;


type
    ThemeArrowOrientation               = UInt16;
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {    Popup arrow sizes                                                                          }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }

const
    kThemeArrow3pt              = 0;
    kThemeArrow5pt              = 1;
    kThemeArrow7pt              = 2;
    kThemeArrow9pt              = 3;


type
    ThemePopupArrowSize                 = UInt16;
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {    Grow box directions                                                                        }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }

const
    kThemeGrowLeft              = $01;                          {  can grow to the left  }
    kThemeGrowRight             = $02;                          {  can grow to the right  }
    kThemeGrowUp                = $04;                          {  can grow up  }
    kThemeGrowDown              = $08;                          {  can grow down  }


type
    ThemeGrowDirection                  = UInt16;
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {    Button kinds                                                                               }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }

const

    {
     * Dynamically-sized push button kind. Prior to Mac OS X 10.3 all
     * push button sizes could be determined dynamically: either they
     * were smaller than normal size and therefore small or they were
     * normal size. This constant will never describe a mini push button,
     * regardless of associated bounds. Please use the explicitly-sized
     * kThemePushButton (Normal,Small,Mini) constants.
     }
    kThemePushButton            = 0;
    kThemeCheckBox              = 1;
    kThemeRadioButton           = 2;
    kThemeBevelButton           = 3;                            {  bevel button (obsolete)  }

    {
     * Popup button without text (no label). See ThemeButtonAdornment for
     * glyphs. The arrow button theme name is somewhat confusing. This is
     * the primitive used to draw the control known as the disclosure
     * button.
     }
    kThemeArrowButton           = 4;

    {
     * Dynamically-sized popup button kind. Prior to Mac OS X 10.3 all
     * popup button sizes could be determined dynamically: either they
     * were smaller than normal size and therefore small or they were
     * normal size. This constant will never describe a mini popup
     * button, regardless of associated bounds. Please use the
     * explicitly-sized kThemePopupButton (Normal,Small,Mini) constants.
     }
    kThemePopupButton           = 5;
    kThemeDisclosureButton      = 6;

    {
     * Increment/decrement buttons (no label). This is the primitive used
     * to draw the LittleArrows control.
     }
    kThemeIncDecButton          = 7;
    kThemeSmallBevelButton      = 8;                            {  small-shadow bevel button  }
    kThemeMediumBevelButton     = 3;                            {  med-shadow bevel button  }
    kThemeLargeBevelButton      = 9;                            {  large-shadow bevel button  }

    {
     * Sort button for top of a list. This is the theme primitive used to
     * draw the top of the columns in the data browser.
     }
    kThemeListHeaderButton      = 10;
    kThemeRoundButton           = 11;                           {  round button  }
    kThemeLargeRoundButton      = 12;                           {  large round button  }
    kThemeSmallCheckBox         = 13;                           {  small checkbox  }
    kThemeSmallRadioButton      = 14;                           {  small radio button  }
    kThemeRoundedBevelButton    = 15;                           {  rounded bevel button  }
    kThemeComboBox              = 16;
    kThemeComboBoxSmall         = 17;

{
 *  Discussion:
 *    New ThemeButtonKinds available on Mac OS X 10.3 and later.
 }
    kThemeComboBoxMini          = 18;
    kThemeMiniCheckBox          = 19;
    kThemeMiniRadioButton       = 20;

    {
     * This is the primitive used to draw the small variant of the
     * LittleArrows control.
     }
    kThemeIncDecButtonSmall     = 21;

    {
     * This is the primitive used to draw the mini variant of the
     * LittleArrows control.
     }
    kThemeIncDecButtonMini      = 22;

    {
     * The arrow button theme name is somewhat confusing. This is the
     * primitive used to draw the small variant of the control known as
     * the disclosure button.
     }
    kThemeArrowButtonSmall      = 23;

    {
     * The arrow button theme name is somewhat confusing. This is the
     * primitive used to draw the mini variant of the control known as
     * the disclosure button.
     }
    kThemeArrowButtonMini       = 24;

    {
     * Explicitly-sized normal push button kind. Prior to Mac OS X 10.3
     * all push button sizes could be determined dynamically: either they
     * were smaller than normal size and therefore small or they were
     * normal size. Using this constant, an explicitly-sized normal push
     * button can be specified.
     }
    kThemePushButtonNormal      = 25;

    {
     * Explicitly-sized small push button kind. Prior to Mac OS X 10.3
     * all push button sizes could be determined dynamically: either they
     * were smaller than normal size and therefore small or they were
     * normal size. Using this constant, an explicitly-sized small push
     * button can be specified.
     }
    kThemePushButtonSmall       = 26;

    {
     * Explicitly-sized mini push button kind. Prior to Mac OS X 10.3 all
     * push button sizes could be determined dynamically: either they
     * were smaller than normal size and therefore small or they were
     * normal size. Since a mini variant was introduced in Mac OS X 10.3,
     * smaller than normal size is can also mean mini. To avoid confusion
     * with existing code, the mini variant will never be implicitly
     * determined and must be explicity requested with the
     * kThemePushButtonMini constant.
     }
    kThemePushButtonMini        = 27;

    {
     * Explicitly-sized normal popup button kind. Prior to Mac OS X 10.3
     * all popup button sizes could be determined dynamically: either
     * they were smaller than normal size and therefore small or they
     * were normal size. Using this constant, an explicitly-sized normal
     * popup button can be specified.
     }
    kThemePopupButtonNormal     = 28;

    {
     * Explicitly-sized small popup button kind. Prior to Mac OS X 10.3
     * all popup button sizes could be determined dynamically: either
     * they were smaller than normal size and therefore small or they
     * were normal size. Using this constant, an explicitly-sized small
     * popup button can be specified.
     }
    kThemePopupButtonSmall      = 29;

    {
     * Explicitly-sized mini popup button kind. Prior to Mac OS X 10.3
     * all popup button sizes could be determined dynamically: either
     * they were smaller than normal size and therefore small or they
     * were normal size. Since a mini variant was introduced in Mac OS X
     * 10.3, smaller than normal size is can also mean mini. To avoid
     * confusion with existing code, the mini variant will never be
     * implicitly determined and must be explicity requested with the
     * kThemePopupButtonMini constant.
     }
    kThemePopupButtonMini       = 30;


{
 *  Discussion:
 *    These are legacy synonyms for previously defined
 *    ThemeButtonKinds. Please use the modern constant names.
 }
    kThemeNormalCheckBox        = kThemeCheckBox;
    kThemeNormalRadioButton     = kThemeRadioButton;


type
    ThemeButtonKind                     = UInt16;
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {    Common button values                                                                       }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }

const
    kThemeButtonOff             = 0;
    kThemeButtonOn              = 1;
    kThemeButtonMixed           = 2;
    kThemeDisclosureRight       = 0;
    kThemeDisclosureDown        = 1;
    kThemeDisclosureLeft        = 2;


type
    ThemeButtonValue                    = UInt16;
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {    Button adornment types                                                                     }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }

const
    kThemeAdornmentNone         = 0;
    kThemeAdornmentDefault      = $01;                          {  if set, draw default ornamentation ( for push button and generic well )  }
    kThemeAdornmentFocus        = $04;                          {  if set, draw focus  }
    kThemeAdornmentRightToLeft  = $10;                          {  if set, draw right to left label  }
    kThemeAdornmentDrawIndicatorOnly = $20;                     {  if set, don't draw or erase label ( radio, check, disclosure )  }
    kThemeAdornmentHeaderButtonLeftNeighborSelected = $40;      {  if set, draw the left border of the button as selected ( list header button only )  }
    kThemeAdornmentHeaderButtonRightNeighborSelected = $80;     {  if set, draw the right border of the button ( list header button only )  }
    kThemeAdornmentHeaderButtonSortUp = $0100;                  {  if set, draw the sort indicator pointing upward ( list header button only )  }
    kThemeAdornmentHeaderMenuButton = $0200;                    {  if set, draw as a header menu button ( list header button only )  }
    kThemeAdornmentHeaderButtonNoShadow = $0400;                {  if set, draw the non-shadow area of the button ( list header button only )  }
    kThemeAdornmentHeaderButtonShadowOnly = $0800;              {  if set, draw the only the shadow area of the button ( list header button only )  }
    kThemeAdornmentNoShadow     = $0400;                        {  old name  }
    kThemeAdornmentShadowOnly   = $0800;                        {  old name  }
    kThemeAdornmentArrowLeftArrow = $40;                        {  If set, draw a left arrow on the arrow button  }
    kThemeAdornmentArrowDownArrow = $80;                        {  If set, draw a down arrow on the arrow button  }
    kThemeAdornmentArrowDoubleArrow = $0100;                    {  If set, draw a double arrow on the arrow button  }
    kThemeAdornmentArrowUpArrow = $0200;                        {  If set, draw a up arrow on the arrow button  }


type
    ThemeButtonAdornment                = UInt16;
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {    Button drawing info block                                                                  }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    ThemeButtonDrawInfoPtr = ^ThemeButtonDrawInfo;
    ThemeButtonDrawInfo = record
        state:                  ThemeDrawState;
        value:                  ThemeButtonValue;
        adornment:              ThemeButtonAdornment;
    end;

    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {    Sound Support                                                                              }
    {                                                                                               }
    {     X ALERT: Please note that none of the theme sound APIs currently function on X.           }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {    Sound classes                                                                              }
    {                                                                                               }
    {    You can use the constants below to set what sounds are active using the SetTheme API.      }
    {    Use these with the kThemeSoundMask tag.                                                    }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }

const
    kThemeNoSounds              = 0;
    kThemeWindowSoundsMask      = $01;
    kThemeMenuSoundsMask        = $02;
    kThemeControlSoundsMask     = $04;
    kThemeFinderSoundsMask      = $08;


    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {    Drag Sounds                                                                                }
    {                                                                                               }
    {    Drag sounds are looped for the duration of the drag.                                       }
    {                                                                                               }
    {    Call BeginThemeDragSound at the start of the drag.                                         }
    {    Call EndThemeDragSound when the drag has finished.                                         }
    {                                                                                               }
    {    Note that in order to maintain a consistent user experience, only one drag sound may       }
    {    occur at a time.  The sound should be attached to a mouse action, start after the          }
    {    mouse goes down and stop when the mouse is released.                                       }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    kThemeDragSoundNone         = 0;
    kThemeDragSoundMoveWindow   = $776D6F76 (* 'wmov' *);
    kThemeDragSoundGrowWindow   = $7767726F (* 'wgro' *);
    kThemeDragSoundMoveUtilWindow = $756D6F76 (* 'umov' *);
    kThemeDragSoundGrowUtilWindow = $7567726F (* 'ugro' *);
    kThemeDragSoundMoveDialog   = $646D6F76 (* 'dmov' *);
    kThemeDragSoundMoveAlert    = $616D6F76 (* 'amov' *);
    kThemeDragSoundMoveIcon     = $696D6F76 (* 'imov' *);
    kThemeDragSoundSliderThumb  = $736C7468 (* 'slth' *);
    kThemeDragSoundSliderGhost  = $736C6768 (* 'slgh' *);
    kThemeDragSoundScrollBarThumb = $73627468 (* 'sbth' *);
    kThemeDragSoundScrollBarGhost = $73626768 (* 'sbgh' *);
    kThemeDragSoundScrollBarArrowDecreasing = $73626164 (* 'sbad' *);
    kThemeDragSoundScrollBarArrowIncreasing = $73626169 (* 'sbai' *);
    kThemeDragSoundDragging     = $64726167 (* 'drag' *);


type
    ThemeDragSoundKind                  = OSType;
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {    State-change sounds                                                        }
    {                                                                               }
    {    State-change sounds are played asynchonously as a one-shot.                }
    {                                                                               }
    {    Call PlayThemeSound to play the sound.  The sound will play                }
    {    asynchronously until complete, then stop automatically.                    }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }

const
    kThemeSoundNone             = 0;
    kThemeSoundMenuOpen         = $6D6E756F (* 'mnuo' *);                       {  menu sounds  }
    kThemeSoundMenuClose        = $6D6E7563 (* 'mnuc' *);
    kThemeSoundMenuItemHilite   = $6D6E7569 (* 'mnui' *);
    kThemeSoundMenuItemRelease  = $6D6E7573 (* 'mnus' *);
    kThemeSoundWindowClosePress = $77636C70 (* 'wclp' *);                       {  window sounds  }
    kThemeSoundWindowCloseEnter = $77636C65 (* 'wcle' *);
    kThemeSoundWindowCloseExit  = $77636C78 (* 'wclx' *);
    kThemeSoundWindowCloseRelease = $77636C72 (* 'wclr' *);
    kThemeSoundWindowZoomPress  = $777A6D70 (* 'wzmp' *);
    kThemeSoundWindowZoomEnter  = $777A6D65 (* 'wzme' *);
    kThemeSoundWindowZoomExit   = $777A6D78 (* 'wzmx' *);
    kThemeSoundWindowZoomRelease = $777A6D72 (* 'wzmr' *);
    kThemeSoundWindowCollapsePress = $77636F70 (* 'wcop' *);
    kThemeSoundWindowCollapseEnter = $77636F65 (* 'wcoe' *);
    kThemeSoundWindowCollapseExit = $77636F78 (* 'wcox' *);
    kThemeSoundWindowCollapseRelease = $77636F72 (* 'wcor' *);
    kThemeSoundWindowDragBoundary = $77646264 (* 'wdbd' *);
    kThemeSoundUtilWinClosePress = $75636C70 (* 'uclp' *);                      {  utility window sounds  }
    kThemeSoundUtilWinCloseEnter = $75636C65 (* 'ucle' *);
    kThemeSoundUtilWinCloseExit = $75636C78 (* 'uclx' *);
    kThemeSoundUtilWinCloseRelease = $75636C72 (* 'uclr' *);
    kThemeSoundUtilWinZoomPress = $757A6D70 (* 'uzmp' *);
    kThemeSoundUtilWinZoomEnter = $757A6D65 (* 'uzme' *);
    kThemeSoundUtilWinZoomExit  = $757A6D78 (* 'uzmx' *);
    kThemeSoundUtilWinZoomRelease = $757A6D72 (* 'uzmr' *);
    kThemeSoundUtilWinCollapsePress = $75636F70 (* 'ucop' *);
    kThemeSoundUtilWinCollapseEnter = $75636F65 (* 'ucoe' *);
    kThemeSoundUtilWinCollapseExit = $75636F78 (* 'ucox' *);
    kThemeSoundUtilWinCollapseRelease = $75636F72 (* 'ucor' *);
    kThemeSoundUtilWinDragBoundary = $75646264 (* 'udbd' *);
    kThemeSoundWindowOpen       = $776F706E (* 'wopn' *);                       {  window close and zoom action  }
    kThemeSoundWindowClose      = $77636C73 (* 'wcls' *);
    kThemeSoundWindowZoomIn     = $777A6D69 (* 'wzmi' *);
    kThemeSoundWindowZoomOut    = $777A6D6F (* 'wzmo' *);
    kThemeSoundWindowCollapseUp = $77636F6C (* 'wcol' *);
    kThemeSoundWindowCollapseDown = $77657870 (* 'wexp' *);
    kThemeSoundWindowActivate   = $77616374 (* 'wact' *);
    kThemeSoundUtilWindowOpen   = $756F706E (* 'uopn' *);
    kThemeSoundUtilWindowClose  = $75636C73 (* 'ucls' *);
    kThemeSoundUtilWindowZoomIn = $757A6D69 (* 'uzmi' *);
    kThemeSoundUtilWindowZoomOut = $757A6D6F (* 'uzmo' *);
    kThemeSoundUtilWindowCollapseUp = $75636F6C (* 'ucol' *);
    kThemeSoundUtilWindowCollapseDown = $75657870 (* 'uexp' *);
    kThemeSoundUtilWindowActivate = $75616374 (* 'uact' *);
    kThemeSoundDialogOpen       = $646F706E (* 'dopn' *);
    kThemeSoundDialogClose      = $646C6763 (* 'dlgc' *);
    kThemeSoundAlertOpen        = $616F706E (* 'aopn' *);
    kThemeSoundAlertClose       = $616C7463 (* 'altc' *);
    kThemeSoundPopupWindowOpen  = $70776F70 (* 'pwop' *);
    kThemeSoundPopupWindowClose = $7077636C (* 'pwcl' *);
    kThemeSoundButtonPress      = $62746E70 (* 'btnp' *);                       {  button  }
    kThemeSoundButtonEnter      = $62746E65 (* 'btne' *);
    kThemeSoundButtonExit       = $62746E78 (* 'btnx' *);
    kThemeSoundButtonRelease    = $62746E72 (* 'btnr' *);
    kThemeSoundDefaultButtonPress = $64627470 (* 'dbtp' *);                     {  default button  }
    kThemeSoundDefaultButtonEnter = $64627465 (* 'dbte' *);
    kThemeSoundDefaultButtonExit = $64627478 (* 'dbtx' *);
    kThemeSoundDefaultButtonRelease = $64627472 (* 'dbtr' *);
    kThemeSoundCancelButtonPress = $63627470 (* 'cbtp' *);                      {  cancel button  }
    kThemeSoundCancelButtonEnter = $63627465 (* 'cbte' *);
    kThemeSoundCancelButtonExit = $63627478 (* 'cbtx' *);
    kThemeSoundCancelButtonRelease = $63627472 (* 'cbtr' *);
    kThemeSoundCheckboxPress    = $63686B70 (* 'chkp' *);                       {  checkboxes  }
    kThemeSoundCheckboxEnter    = $63686B65 (* 'chke' *);
    kThemeSoundCheckboxExit     = $63686B78 (* 'chkx' *);
    kThemeSoundCheckboxRelease  = $63686B72 (* 'chkr' *);
    kThemeSoundRadioPress       = $72616470 (* 'radp' *);                       {  radio buttons  }
    kThemeSoundRadioEnter       = $72616465 (* 'rade' *);
    kThemeSoundRadioExit        = $72616478 (* 'radx' *);
    kThemeSoundRadioRelease     = $72616472 (* 'radr' *);
    kThemeSoundScrollArrowPress = $73626170 (* 'sbap' *);                       {  scroll bars  }
    kThemeSoundScrollArrowEnter = $73626165 (* 'sbae' *);
    kThemeSoundScrollArrowExit  = $73626178 (* 'sbax' *);
    kThemeSoundScrollArrowRelease = $73626172 (* 'sbar' *);
    kThemeSoundScrollEndOfTrack = $73627465 (* 'sbte' *);
    kThemeSoundScrollTrackPress = $73627470 (* 'sbtp' *);
    kThemeSoundSliderEndOfTrack = $736C7465 (* 'slte' *);                       {  sliders  }
    kThemeSoundSliderTrackPress = $736C7470 (* 'sltp' *);
    kThemeSoundBalloonOpen      = $626C6E6F (* 'blno' *);                       {  help balloons  }
    kThemeSoundBalloonClose     = $626C6E63 (* 'blnc' *);
    kThemeSoundBevelPress       = $62657670 (* 'bevp' *);                       {  Bevel buttons  }
    kThemeSoundBevelEnter       = $62657665 (* 'beve' *);
    kThemeSoundBevelExit        = $62657678 (* 'bevx' *);
    kThemeSoundBevelRelease     = $62657672 (* 'bevr' *);
    kThemeSoundLittleArrowUpPress = $6C617570 (* 'laup' *);                     {  Little Arrows  }
    kThemeSoundLittleArrowDnPress = $6C616470 (* 'ladp' *);
    kThemeSoundLittleArrowEnter = $6C617265 (* 'lare' *);
    kThemeSoundLittleArrowExit  = $6C617278 (* 'larx' *);
    kThemeSoundLittleArrowUpRelease = $6C617572 (* 'laur' *);
    kThemeSoundLittleArrowDnRelease = $6C616472 (* 'ladr' *);
    kThemeSoundPopupPress       = $706F7070 (* 'popp' *);                       {  Popup Buttons  }
    kThemeSoundPopupEnter       = $706F7065 (* 'pope' *);
    kThemeSoundPopupExit        = $706F7078 (* 'popx' *);
    kThemeSoundPopupRelease     = $706F7072 (* 'popr' *);
    kThemeSoundDisclosurePress  = $64736370 (* 'dscp' *);                       {  Disclosure Buttons  }
    kThemeSoundDisclosureEnter  = $64736365 (* 'dsce' *);
    kThemeSoundDisclosureExit   = $64736378 (* 'dscx' *);
    kThemeSoundDisclosureRelease = $64736372 (* 'dscr' *);
    kThemeSoundTabPressed       = $74616270 (* 'tabp' *);                       {  Tabs  }
    kThemeSoundTabEnter         = $74616265 (* 'tabe' *);
    kThemeSoundTabExit          = $74616278 (* 'tabx' *);
    kThemeSoundTabRelease       = $74616272 (* 'tabr' *);
    kThemeSoundDragTargetHilite = $64746869 (* 'dthi' *);                       {  drag manager  }
    kThemeSoundDragTargetUnhilite = $64747568 (* 'dtuh' *);
    kThemeSoundDragTargetDrop   = $64746472 (* 'dtdr' *);
    kThemeSoundEmptyTrash       = $66747273 (* 'ftrs' *);                       {  finder  }
    kThemeSoundSelectItem       = $6673656C (* 'fsel' *);
    kThemeSoundNewItem          = $666E6577 (* 'fnew' *);
    kThemeSoundReceiveDrop      = $66647270 (* 'fdrp' *);
    kThemeSoundCopyDone         = $66637064 (* 'fcpd' *);
    kThemeSoundResolveAlias     = $6672616C (* 'fral' *);
    kThemeSoundLaunchApp        = $666C6170 (* 'flap' *);
    kThemeSoundDiskInsert       = $64736B69 (* 'dski' *);
    kThemeSoundDiskEject        = $64736B65 (* 'dske' *);
    kThemeSoundFinderDragOnIcon = $66646F6E (* 'fdon' *);
    kThemeSoundFinderDragOffIcon = $66646F66 (* 'fdof' *);


type
    ThemeSoundKind                      = OSType;
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {    Window Metrics                                                                             }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {     Window metrics are used by the Appearance manager to fill in the blanks necessary to      }
    {     draw windows. If a value is not appropriate for the type of window, be sure to fill in    }
    {     the slot in the structure with zero.    For the popupTabOffset parameter, you can pass a  }
    {     real value based on the left edge of the window. This value might be interpreted in a     }
    {     different manner when depending on the value of the popupTabPosition field. The values    }
    {     you can pass into popupTabPosition are:                                                   }
    {                                                                                               }
    {     kThemePopupTabNormalPosition                                                              }
    {         Starts the tab left edge at the position indicated by the popupTabOffset field.       }
    {                                                                                               }
    {     kThemePopupTabCenterOnWindow                                                              }
    {         tells us to ignore the offset field and instead simply center the width of the        }
    {         handle on the window.                                                                 }
    {                                                                                               }
    {     kThemePopupTabCenterOnOffset                                                              }
    {         tells us to center the width of the handle around the value passed in offset.         }
    {                                                                                               }
    {     The Appearance Manager will try its best to accomodate the requested placement, but may   }
    {     move the handle slightly to make it fit correctly.                                        }
    {                                                                                               }

const
    kThemePopupTabNormalPosition = 0;
    kThemePopupTabCenterOnWindow = 1;
    kThemePopupTabCenterOnOffset = 2;


type
    ThemeWindowMetricsPtr = ^ThemeWindowMetrics;
    ThemeWindowMetrics = record
        metricSize:             UInt16;                                 {  should be always be sizeof( ThemeWindowMetrics ) }
        titleHeight:            SInt16;
        titleWidth:             SInt16;
        popupTabOffset:         SInt16;
        popupTabWidth:          SInt16;
        popupTabPosition:       UInt16;
    end;

    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {    Theme Metrics                                                                              }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }

    {
     *  Discussion:
     *    Theme metrics allow you to find out sizes of things in the
     *    current environment, such as how wide a scroll bar is, etc.
        }

const

    {
     * The width (or height if horizontal) of a scroll bar.
     }
    kThemeMetricScrollBarWidth  = 0;

    {
     * The width (or height if horizontal) of a small scroll bar.
     }
    kThemeMetricSmallScrollBarWidth = 1;

    {
     * The height of the non-label part of a check box control.
     }
    kThemeMetricCheckBoxHeight  = 2;

    {
     * The height of the non-label part of a radio button control.
     }
    kThemeMetricRadioButtonHeight = 3;

    {
     * The amount of white space surrounding the text Rect of the text
     * inside of an Edit Text control.  If you select all of the text in
     * an Edit Text control, you can see the white space. The metric is
     * the number of pixels, per side, that the text Rect is outset to
     * create the whitespace Rect.
     }
    kThemeMetricEditTextWhitespace = 4;

    {
     * The thickness of the Edit Text frame that surrounds the whitespace
     * Rect (that is surrounding the text Rect). The metric is the number
     * of pixels, per side, that the frame Rect is outset from the
     * whitespace Rect.
     }
    kThemeMetricEditTextFrameOutset = 5;

    {
     * The number of pixels that the list box frame is outset from the
     * content of the list box.
     }
    kThemeMetricListBoxFrameOutset = 6;

    {
     * This is a deprecated metric.  Don't use it.  It used to describe
     * how far the focus rect used to draw from a control, but control
     * focus drawing no longer uses this information to draw its focus.
     }
    kThemeMetricFocusRectOutset = 7;

    {
     * The thickness of the frame drawn by DrawThemeGenericWell.
     }
    kThemeMetricImageWellThickness = 8;

    {
     * The number of pixels a scrollbar should overlap (actually
     * underlap) any bounding box which surrounds it and scrollable
     * content. This also includes the window frame when a scrolbar is
     * along an edge of the window.
     }
    kThemeMetricScrollBarOverlap = 9;

    {
     * The height of the large tab of a tab control.
     }
    kThemeMetricLargeTabHeight  = 10;

    {
     * The width of the caps (end pieces) of the large tabs of a tab
     * control.
     }
    kThemeMetricLargeTabCapsWidth = 11;

    {
     * The amount to add to the tab height (kThemeMetricLargeTabHeight)
     * to find out the rectangle height to use with the various Tab
     * drawing primitives. This amount is also the amount that each tab
     * overlaps the tab pane.
     }
    kThemeMetricTabFrameOverlap = 12;

    {
     * If less than zero, this indicates that the text should be centered
     * on each tab. If greater than zero, the text should be justified
     * (according to the system script direction) and the amount is the
     * offset from the appropriate edge at which the text should start
     * drawing.
     }
    kThemeMetricTabIndentOrStyle = 13;

    {
     * The amount of space that every tab's drawing rectangle overlaps
     * the one on either side of it.
     }
    kThemeMetricTabOverlap      = 14;

    {
     * The height of the small tab of a tab control.  This includes the
     * pixels that overlap the tab pane and/or tab pane bar.
     }
    kThemeMetricSmallTabHeight  = 15;

    {
     * The width of the caps (end pieces) of the small tabs of a tab
     * control.
     }
    kThemeMetricSmallTabCapsWidth = 16;

    {
     * The height and the width of the push button control.
     }
    kThemeMetricPushButtonHeight = 19;

    {
     * The height of the list header field of the data browser control.
     }
    kThemeMetricListHeaderHeight = 20;

    {
     * The height of a disclosure triangle control.  This triangle is the
     * not the center of the disclosure button, but its own control.
     }
    kThemeMetricDisclosureTriangleHeight = 25;

    {
     * The width of a disclosure triangle control.
     }
    kThemeMetricDisclosureTriangleWidth = 26;

    {
     * The height of a little arrows control.
     }
    kThemeMetricLittleArrowsHeight = 27;

    {
     * The width of a little arrows control.
     }
    kThemeMetricLittleArrowsWidth = 28;

    {
     * The height of a popup button control.
     }
    kThemeMetricPopupButtonHeight = 30;

    {
     * The height of a small popup button control.
     }
    kThemeMetricSmallPopupButtonHeight = 31;

    {
     * The height of the large progress bar, not including its shadow.
     }
    kThemeMetricLargeProgressBarThickness = 32;

    {
     * This metric is not used.
     }
    kThemeMetricPullDownHeight  = 33;

    {
     * This metric is not used.
     }
    kThemeMetricSmallPullDownHeight = 34;

    {
     * The height of the window grow box control.
     }
    kThemeMetricResizeControlHeight = 38;

    {
     * The width of the window grow box control.
     }
    kThemeMetricSmallResizeControlHeight = 39;

    {
     * The height of the horizontal slider control.
     }
    kThemeMetricHSliderHeight   = 41;

    {
     * The height of the tick marks for a horizontal slider control.
     }
    kThemeMetricHSliderTickHeight = 42;

    {
     * The width of the vertical slider control.
     }
    kThemeMetricVSliderWidth    = 45;

    {
     * The width of the tick marks for a vertical slider control.
     }
    kThemeMetricVSliderTickWidth = 46;

    {
     * The height of the title bar widgets (grow, close, and zoom boxes)
     * for a document window.
     }
    kThemeMetricTitleBarControlsHeight = 49;

    {
     * The width of the non-label part of a check box control.
     }
    kThemeMetricCheckBoxWidth   = 50;

    {
     * The width of the non-label part of a radio button control.
     }
    kThemeMetricRadioButtonWidth = 52;

    {
     * The height of the normal bar, not including its shadow.
     }
    kThemeMetricNormalProgressBarThickness = 58;

    {
     * The number of pixels of shadow depth drawn below the progress bar.
     }
    kThemeMetricProgressBarShadowOutset = 59;

    {
     * The number of pixels of shadow depth drawn below the small
     * progress bar.
     }
    kThemeMetricSmallProgressBarShadowOutset = 60;

    {
     * The number of pixels that the content of a primary group box is
     * from the bounds of the control.
     }
    kThemeMetricPrimaryGroupBoxContentInset = 61;

    {
     * The number of pixels that the content of a secondary group box is
     * from the bounds of the control.
     }
    kThemeMetricSecondaryGroupBoxContentInset = 62;

    {
     * Width allocated to draw the mark character in a menu.
     }
    kThemeMetricMenuMarkColumnWidth = 63;

    {
     * Width allocated for the mark character in a menu item when the
     * menu has kMenuAttrExcludesMarkColumn.
     }
    kThemeMetricMenuExcludedMarkColumnWidth = 64;

    {
     * Indent into the interior of the mark column at which the mark
     * character is drawn.
     }
    kThemeMetricMenuMarkIndent  = 65;

    {
     * Whitespace at the leading edge of menu item text.
     }
    kThemeMetricMenuTextLeadingEdgeMargin = 66;

    {
     * Whitespace at the trailing edge of menu item text.
     }
    kThemeMetricMenuTextTrailingEdgeMargin = 67;

    {
     * Width per indent level (set by SetMenuItemIndent) of a menu item.
     }
    kThemeMetricMenuIndentWidth = 68;

    {
     * Whitespace at the trailing edge of a menu icon (if the item also
     * has text).
     }
    kThemeMetricMenuIconTrailingEdgeMargin = 69;

{
 *  Discussion:
 *    The following metrics are only available in OS X.
 }

    {
     * The height of a disclosure button.
     }
    kThemeMetricDisclosureButtonHeight = 17;

    {
     * The height and the width of the round button control.
     }
    kThemeMetricRoundButtonSize = 18;

    {
     * The height of the non-label part of a small check box control.
     }
    kThemeMetricSmallCheckBoxHeight = 21;

    {
     * The width of a disclosure button.
     }
    kThemeMetricDisclosureButtonWidth = 22;

    {
     * The height of a small disclosure button.
     }
    kThemeMetricSmallDisclosureButtonHeight = 23;

    {
     * The width of a small disclosure button.
     }
    kThemeMetricSmallDisclosureButtonWidth = 24;

    {
     * The height (or width if vertical) of a pane splitter.
     }
    kThemeMetricPaneSplitterHeight = 29;

    {
     * The height of the small push button control.
     }
    kThemeMetricSmallPushButtonHeight = 35;

    {
     * The height of the non-label part of a small radio button control.
     }
    kThemeMetricSmallRadioButtonHeight = 36;

    {
     * The height of the relevance indicator control.
     }
    kThemeMetricRelevanceIndicatorHeight = 37;

    {
     * The height and the width of the large round button control.
     }
    kThemeMetricLargeRoundButtonSize = 40;

    {
     * The height of the small, horizontal slider control.
     }
    kThemeMetricSmallHSliderHeight = 43;

    {
     * The height of the tick marks for a small, horizontal slider
     * control.
     }
    kThemeMetricSmallHSliderTickHeight = 44;

    {
     * The width of the small, vertical slider control.
     }
    kThemeMetricSmallVSliderWidth = 47;

    {
     * The width of the tick marks for a small, vertical slider control.
     }
    kThemeMetricSmallVSliderTickWidth = 48;

    {
     * The width of the non-label part of a small check box control.
     }
    kThemeMetricSmallCheckBoxWidth = 51;

    {
     * The width of the non-label part of a small radio button control.
     }
    kThemeMetricSmallRadioButtonWidth = 53;

    {
     * The minimum width of the thumb of a small, horizontal slider
     * control.
     }
    kThemeMetricSmallHSliderMinThumbWidth = 54;

    {
     * The minimum width of the thumb of a small, vertical slider control.
     }
    kThemeMetricSmallVSliderMinThumbHeight = 55;

    {
     * The offset of the tick marks from the appropriate side of a small
     * horizontal slider control.
     }
    kThemeMetricSmallHSliderTickOffset = 56;

    {
       * The offset of the tick marks from the appropriate side of a small
       * vertical slider control.
     }
    kThemeMetricSmallVSliderTickOffset = 57;

{
 *  Discussion:
 *    The following metrics are only available in Mac OS X 10.3 and
 *    later.
 }

    kThemeMetricComboBoxLargeBottomShadowOffset = 70;
    kThemeMetricComboBoxLargeRightShadowOffset = 71;
    kThemeMetricComboBoxSmallBottomShadowOffset = 72;
    kThemeMetricComboBoxSmallRightShadowOffset = 73;
    kThemeMetricComboBoxLargeDisclosureWidth = 74;
    kThemeMetricComboBoxSmallDisclosureWidth = 75;
    kThemeMetricRoundTextFieldContentInsetLeft = 76;
    kThemeMetricRoundTextFieldContentInsetRight = 77;
    kThemeMetricRoundTextFieldContentInsetBottom = 78;
    kThemeMetricRoundTextFieldContentInsetTop = 79;
    kThemeMetricRoundTextFieldContentHeight = 80;
    kThemeMetricComboBoxMiniBottomShadowOffset = 81;
    kThemeMetricComboBoxMiniDisclosureWidth = 82;
    kThemeMetricComboBoxMiniRightShadowOffset = 83;
    kThemeMetricLittleArrowsMiniHeight = 84;
    kThemeMetricLittleArrowsMiniWidth = 85;
    kThemeMetricLittleArrowsSmallHeight = 86;
    kThemeMetricLittleArrowsSmallWidth = 87;
    kThemeMetricMiniCheckBoxHeight = 88;
    kThemeMetricMiniCheckBoxWidth = 89;
    kThemeMetricMiniDisclosureButtonHeight = 90;
    kThemeMetricMiniDisclosureButtonWidth = 91;
    kThemeMetricMiniHSliderHeight = 92;
    kThemeMetricMiniHSliderMinThumbWidth = 93;
    kThemeMetricMiniHSliderTickHeight = 94;
    kThemeMetricMiniHSliderTickOffset = 95;
    kThemeMetricMiniPopupButtonHeight = 96;
    kThemeMetricMiniPullDownHeight = 97;
    kThemeMetricMiniPushButtonHeight = 98;
    kThemeMetricMiniRadioButtonHeight = 99;
    kThemeMetricMiniRadioButtonWidth = 100;
    kThemeMetricMiniTabCapsWidth  = 101;
    kThemeMetricMiniTabFrameOverlap = 102;
    kThemeMetricMiniTabHeight     = 103;
    kThemeMetricMiniTabOverlap    = 104;
    kThemeMetricMiniVSliderMinThumbHeight = 105;
    kThemeMetricMiniVSliderTickOffset = 106;
    kThemeMetricMiniVSliderTickWidth = 107;
    kThemeMetricMiniVSliderWidth  = 108;
    kThemeMetricRoundTextFieldContentInsetWithIconLeft = 109;
    kThemeMetricRoundTextFieldContentInsetWithIconRight = 110;
    kThemeMetricRoundTextFieldMiniContentHeight = 111;
    kThemeMetricRoundTextFieldMiniContentInsetBottom = 112;
    kThemeMetricRoundTextFieldMiniContentInsetLeft = 113;
    kThemeMetricRoundTextFieldMiniContentInsetRight = 114;
    kThemeMetricRoundTextFieldMiniContentInsetTop = 115;
    kThemeMetricRoundTextFieldMiniContentInsetWithIconLeft = 116;
    kThemeMetricRoundTextFieldMiniContentInsetWithIconRight = 117;
    kThemeMetricRoundTextFieldSmallContentHeight = 118;
    kThemeMetricRoundTextFieldSmallContentInsetBottom = 119;
    kThemeMetricRoundTextFieldSmallContentInsetLeft = 120;
    kThemeMetricRoundTextFieldSmallContentInsetRight = 121;
    kThemeMetricRoundTextFieldSmallContentInsetTop = 122;
    kThemeMetricRoundTextFieldSmallContentInsetWithIconLeft = 123;
    kThemeMetricRoundTextFieldSmallContentInsetWithIconRight = 124;
    kThemeMetricSmallTabFrameOverlap = 125;
    kThemeMetricSmallTabOverlap   = 126;

    {
     * The height of a small pane splitter. Should only be used in a
     * window with thick borders, like a metal window.
     }
    kThemeMetricSmallPaneSplitterHeight = 127;

type
    ThemeMetric                         = UInt32;
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {    Drawing State                                                                              }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    ThemeDrawingState    = ^SInt32; { an opaque 32-bit type }
    ThemeDrawingStatePtr = ^ThemeDrawingState;  { when a var xx:ThemeDrawingState parameter can be nil, it is changed to xx: ThemeDrawingStatePtr }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {    Callback procs                                                                             }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    ThemeTabTitleDrawProcPtr = procedure(const (*var*) bounds: Rect; style: ThemeTabStyle; direction: ThemeTabDirection; depth: SInt16; isColorDev: boolean; userData: UInt32);

    ThemeEraseProcPtr = procedure(const (*var*) bounds: Rect; eraseData: UInt32; depth: SInt16; isColorDev: boolean);

    ThemeButtonDrawProcPtr = procedure(const (*var*) bounds: Rect; kind: ThemeButtonKind; const (*var*) info: ThemeButtonDrawInfo; userData: UInt32; depth: SInt16; isColorDev: boolean);

    WindowTitleDrawingProcPtr = procedure(const (*var*) bounds: Rect; depth: SInt16; colorDevice: boolean; userData: UInt32);

    ThemeIteratorProcPtr = function(inFileName: Str255; resID: SInt16; inThemeSettings: Collection; inUserData: UnivPtr): boolean;

    ThemeTabTitleDrawUPP = ^SInt32; { an opaque UPP }
    ThemeEraseUPP = ^SInt32; { an opaque UPP }
    ThemeButtonDrawUPP = ^SInt32; { an opaque UPP }
    WindowTitleDrawingUPP = ^SInt32; { an opaque UPP }
    ThemeIteratorUPP = ^SInt32; { an opaque UPP }

const
    uppThemeTabTitleDrawProcInfo = $00036AC0;
    uppThemeEraseProcInfo = $00001BC0;
    uppThemeButtonDrawProcInfo = $0001BEC0;
    uppWindowTitleDrawingProcInfo = $000036C0;
    uppThemeIteratorProcInfo = $00003ED0;
    {
     *  NewThemeTabTitleDrawUPP()
     *
     *  Availability:
     *    Non-Carbon CFM:   available as macro/inline
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function NewThemeTabTitleDrawUPP(userRoutine: ThemeTabTitleDrawProcPtr): ThemeTabTitleDrawUPP; external name '_NewThemeTabTitleDrawUPP'; { old name was NewThemeTabTitleDrawProc }
{
 *  NewThemeEraseUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewThemeEraseUPP(userRoutine: ThemeEraseProcPtr): ThemeEraseUPP; external name '_NewThemeEraseUPP'; { old name was NewThemeEraseProc }
{
 *  NewThemeButtonDrawUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewThemeButtonDrawUPP(userRoutine: ThemeButtonDrawProcPtr): ThemeButtonDrawUPP; external name '_NewThemeButtonDrawUPP'; { old name was NewThemeButtonDrawProc }
{
 *  NewWindowTitleDrawingUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewWindowTitleDrawingUPP(userRoutine: WindowTitleDrawingProcPtr): WindowTitleDrawingUPP; external name '_NewWindowTitleDrawingUPP'; { old name was NewWindowTitleDrawingProc }
{
 *  NewThemeIteratorUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewThemeIteratorUPP(userRoutine: ThemeIteratorProcPtr): ThemeIteratorUPP; external name '_NewThemeIteratorUPP'; { old name was NewThemeIteratorProc }
{
 *  DisposeThemeTabTitleDrawUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeThemeTabTitleDrawUPP(userUPP: ThemeTabTitleDrawUPP); external name '_DisposeThemeTabTitleDrawUPP';
{
 *  DisposeThemeEraseUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeThemeEraseUPP(userUPP: ThemeEraseUPP); external name '_DisposeThemeEraseUPP';
{
 *  DisposeThemeButtonDrawUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeThemeButtonDrawUPP(userUPP: ThemeButtonDrawUPP); external name '_DisposeThemeButtonDrawUPP';
{
 *  DisposeWindowTitleDrawingUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeWindowTitleDrawingUPP(userUPP: WindowTitleDrawingUPP); external name '_DisposeWindowTitleDrawingUPP';
{
 *  DisposeThemeIteratorUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeThemeIteratorUPP(userUPP: ThemeIteratorUPP); external name '_DisposeThemeIteratorUPP';
{
 *  InvokeThemeTabTitleDrawUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvokeThemeTabTitleDrawUPP(const (*var*) bounds: Rect; style: ThemeTabStyle; direction: ThemeTabDirection; depth: SInt16; isColorDev: boolean; userData: UInt32; userRoutine: ThemeTabTitleDrawUPP); external name '_InvokeThemeTabTitleDrawUPP'; { old name was CallThemeTabTitleDrawProc }
{
 *  InvokeThemeEraseUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvokeThemeEraseUPP(const (*var*) bounds: Rect; eraseData: UInt32; depth: SInt16; isColorDev: boolean; userRoutine: ThemeEraseUPP); external name '_InvokeThemeEraseUPP'; { old name was CallThemeEraseProc }
{
 *  InvokeThemeButtonDrawUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvokeThemeButtonDrawUPP(const (*var*) bounds: Rect; kind: ThemeButtonKind; const (*var*) info: ThemeButtonDrawInfo; userData: UInt32; depth: SInt16; isColorDev: boolean; userRoutine: ThemeButtonDrawUPP); external name '_InvokeThemeButtonDrawUPP'; { old name was CallThemeButtonDrawProc }
{
 *  InvokeWindowTitleDrawingUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvokeWindowTitleDrawingUPP(const (*var*) bounds: Rect; depth: SInt16; colorDevice: boolean; userData: UInt32; userRoutine: WindowTitleDrawingUPP); external name '_InvokeWindowTitleDrawingUPP'; { old name was CallWindowTitleDrawingProc }
{
 *  InvokeThemeIteratorUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeThemeIteratorUPP(const (*var*) inFileName: Str255; resID: SInt16; inThemeSettings: Collection; inUserData: UnivPtr; userRoutine: ThemeIteratorUPP): boolean; external name '_InvokeThemeIteratorUPP'; { old name was CallThemeIteratorProc }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{ Menu Drawing callbacks                                                           }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}

type
    MenuTitleDrawingProcPtr = procedure(const (*var*) inBounds: Rect; inDepth: SInt16; inIsColorDevice: boolean; inUserData: SInt32);

    MenuItemDrawingProcPtr = procedure(const (*var*) inBounds: Rect; inDepth: SInt16; inIsColorDevice: boolean; inUserData: SInt32);

    MenuTitleDrawingUPP = ^SInt32; { an opaque UPP }
    MenuItemDrawingUPP = ^SInt32; { an opaque UPP }

const
    uppMenuTitleDrawingProcInfo = $000036C0;
    uppMenuItemDrawingProcInfo = $000036C0;
    {
     *  NewMenuTitleDrawingUPP()
     *
     *  Availability:
     *    Non-Carbon CFM:   available as macro/inline
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function NewMenuTitleDrawingUPP(userRoutine: MenuTitleDrawingProcPtr): MenuTitleDrawingUPP; external name '_NewMenuTitleDrawingUPP'; { old name was NewMenuTitleDrawingProc }
{
 *  NewMenuItemDrawingUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewMenuItemDrawingUPP(userRoutine: MenuItemDrawingProcPtr): MenuItemDrawingUPP; external name '_NewMenuItemDrawingUPP'; { old name was NewMenuItemDrawingProc }
{
 *  DisposeMenuTitleDrawingUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeMenuTitleDrawingUPP(userUPP: MenuTitleDrawingUPP); external name '_DisposeMenuTitleDrawingUPP';
{
 *  DisposeMenuItemDrawingUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeMenuItemDrawingUPP(userUPP: MenuItemDrawingUPP); external name '_DisposeMenuItemDrawingUPP';
{
 *  InvokeMenuTitleDrawingUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvokeMenuTitleDrawingUPP(const (*var*) inBounds: Rect; inDepth: SInt16; inIsColorDevice: boolean; inUserData: SInt32; userRoutine: MenuTitleDrawingUPP); external name '_InvokeMenuTitleDrawingUPP'; { old name was CallMenuTitleDrawingProc }
{
 *  InvokeMenuItemDrawingUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvokeMenuItemDrawingUPP(const (*var*) inBounds: Rect; inDepth: SInt16; inIsColorDevice: boolean; inUserData: SInt32; userRoutine: MenuItemDrawingUPP); external name '_InvokeMenuItemDrawingUPP'; { old name was CallMenuItemDrawingProc }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{  Appearance Manager APIs                                                         }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{ Registering Appearance-Savvy Applications }
{
 *  RegisterAppearanceClient()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function RegisterAppearanceClient: OSStatus; external name '_RegisterAppearanceClient';
{
 *  UnregisterAppearanceClient()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function UnregisterAppearanceClient: OSStatus; external name '_UnregisterAppearanceClient';
{
 *  IsAppearanceClient()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function IsAppearanceClient(const (*var*) process: ProcessSerialNumber): boolean; external name '_IsAppearanceClient';
{****************************************************************************
    NOTES ON THEME BRUSHES
    Theme brushes can be either colors or patterns, depending on the theme.
    Because of this, you should be prepared to handle the case where a brush
    is a pattern and save and restore the pnPixPat and bkPixPat fields of
    your GrafPorts when saving the fore and back colors. Also, since patterns
    in bkPixPat override the background color of the window, you should use
    BackPat to set your background pattern to a normal white pattern. This
    will ensure that you can use RGBBackColor to set your back color to white,
    call EraseRect and get the expected results.
****************************************************************************}

{
 *  SetThemePen()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetThemePen(inBrush: ThemeBrush; inDepth: SInt16; inIsColorDevice: boolean): OSStatus; external name '_SetThemePen';
{
 *  SetThemeBackground()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetThemeBackground(inBrush: ThemeBrush; inDepth: SInt16; inIsColorDevice: boolean): OSStatus; external name '_SetThemeBackground';
{
 *  SetThemeTextColor()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetThemeTextColor(inColor: ThemeTextColor; inDepth: SInt16; inIsColorDevice: boolean): OSStatus; external name '_SetThemeTextColor';
{ Window Placards, Headers and Frames }
{
 *  DrawThemeWindowHeader()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DrawThemeWindowHeader(const (*var*) inRect: Rect; inState: ThemeDrawState): OSStatus; external name '_DrawThemeWindowHeader';
{
 *  DrawThemeWindowListViewHeader()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DrawThemeWindowListViewHeader(const (*var*) inRect: Rect; inState: ThemeDrawState): OSStatus; external name '_DrawThemeWindowListViewHeader';
{
 *  DrawThemePlacard()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DrawThemePlacard(const (*var*) inRect: Rect; inState: ThemeDrawState): OSStatus; external name '_DrawThemePlacard';
{
 *  DrawThemeEditTextFrame()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DrawThemeEditTextFrame(const (*var*) inRect: Rect; inState: ThemeDrawState): OSStatus; external name '_DrawThemeEditTextFrame';
{
 *  DrawThemeListBoxFrame()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DrawThemeListBoxFrame(const (*var*) inRect: Rect; inState: ThemeDrawState): OSStatus; external name '_DrawThemeListBoxFrame';
{ Keyboard Focus Drawing }
{
 *  DrawThemeFocusRect()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DrawThemeFocusRect(const (*var*) inRect: Rect; inHasFocus: boolean): OSStatus; external name '_DrawThemeFocusRect';
{ Dialog Group Boxes and Separators }
{
 *  DrawThemePrimaryGroup()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DrawThemePrimaryGroup(const (*var*) inRect: Rect; inState: ThemeDrawState): OSStatus; external name '_DrawThemePrimaryGroup';
{
 *  DrawThemeSecondaryGroup()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DrawThemeSecondaryGroup(const (*var*) inRect: Rect; inState: ThemeDrawState): OSStatus; external name '_DrawThemeSecondaryGroup';
{
 *  DrawThemeSeparator()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DrawThemeSeparator(const (*var*) inRect: Rect; inState: ThemeDrawState): OSStatus; external name '_DrawThemeSeparator';
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ BEGIN APPEARANCE 1.0.1 ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{ The following Appearance Manager APIs are only available }
{ in Appearance 1.0.1 or later                             }
{
 *  DrawThemeModelessDialogFrame()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DrawThemeModelessDialogFrame(const (*var*) inRect: Rect; inState: ThemeDrawState): OSStatus; external name '_DrawThemeModelessDialogFrame';
{
 *  DrawThemeGenericWell()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DrawThemeGenericWell(const (*var*) inRect: Rect; inState: ThemeDrawState; inFillCenter: boolean): OSStatus; external name '_DrawThemeGenericWell';
{
 *  DrawThemeFocusRegion()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DrawThemeFocusRegion(inRegion: RgnHandle; inHasFocus: boolean): OSStatus; external name '_DrawThemeFocusRegion';
{
 *  IsThemeInColor()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function IsThemeInColor(inDepth: SInt16; inIsColorDevice: boolean): boolean; external name '_IsThemeInColor';
{ IMPORTANT: GetThemeAccentColors will only work in the platinum theme. Any other theme will }
{ most likely return an error }
{
 *  GetThemeAccentColors()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetThemeAccentColors(var outColors: CTabHandle): OSStatus; external name '_GetThemeAccentColors';
{
 *  DrawThemeMenuBarBackground()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DrawThemeMenuBarBackground(const (*var*) inBounds: Rect; inState: ThemeMenuBarState; inAttributes: UInt32): OSStatus; external name '_DrawThemeMenuBarBackground';
{
 *  DrawThemeMenuTitle()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DrawThemeMenuTitle(const (*var*) inMenuBarRect: Rect; const (*var*) inTitleRect: Rect; inState: ThemeMenuState; inAttributes: UInt32; inTitleProc: MenuTitleDrawingUPP; inTitleData: UInt32): OSStatus; external name '_DrawThemeMenuTitle';
{
 *  GetThemeMenuBarHeight()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetThemeMenuBarHeight(var outHeight: SInt16): OSStatus; external name '_GetThemeMenuBarHeight';
{
 *  DrawThemeMenuBackground()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DrawThemeMenuBackground(const (*var*) inMenuRect: Rect; inMenuType: ThemeMenuType): OSStatus; external name '_DrawThemeMenuBackground';
{
 *  GetThemeMenuBackgroundRegion()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetThemeMenuBackgroundRegion(const (*var*) inMenuRect: Rect; menuType: ThemeMenuType; region: RgnHandle): OSStatus; external name '_GetThemeMenuBackgroundRegion';
{
 *  DrawThemeMenuItem()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DrawThemeMenuItem(const (*var*) inMenuRect: Rect; const (*var*) inItemRect: Rect; inVirtualMenuTop: SInt16; inVirtualMenuBottom: SInt16; inState: ThemeMenuState; inItemType: ThemeMenuItemType; inDrawProc: MenuItemDrawingUPP; inUserData: UInt32): OSStatus; external name '_DrawThemeMenuItem';
{
 *  DrawThemeMenuSeparator()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DrawThemeMenuSeparator(const (*var*) inItemRect: Rect): OSStatus; external name '_DrawThemeMenuSeparator';
{
 *  GetThemeMenuSeparatorHeight()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetThemeMenuSeparatorHeight(var outHeight: SInt16): OSStatus; external name '_GetThemeMenuSeparatorHeight';
{
 *  GetThemeMenuItemExtra()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetThemeMenuItemExtra(inItemType: ThemeMenuItemType; var outHeight: SInt16; var outWidth: SInt16): OSStatus; external name '_GetThemeMenuItemExtra';
{
 *  GetThemeMenuTitleExtra()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetThemeMenuTitleExtra(var outWidth: SInt16; inIsSquished: boolean): OSStatus; external name '_GetThemeMenuTitleExtra';
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ BEGIN APPEARANCE 1.1 ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ THEME SWITCHING ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{                                                                                                  }
{  X ALERT: Please note that Get/SetTheme are severely neutered under Mac OS X at present.         }
{           See the note above regarding what collection tags are supported under X.               }

{
 *  GetTheme()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetTheme(ioCollection: Collection): OSStatus; external name '_GetTheme';

{
 *  SetTheme()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetTheme(ioCollection: Collection): OSStatus; external name '_SetTheme';

{
 *  IterateThemes()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function IterateThemes(inProc: ThemeIteratorUPP; inUserData: UnivPtr): OSStatus; external name '_IterateThemes';

{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ TABS ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{
 *  DrawThemeTabPane()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DrawThemeTabPane(const (*var*) inRect: Rect; inState: ThemeDrawState): OSStatus; external name '_DrawThemeTabPane';

{
 *  DrawThemeTab()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DrawThemeTab(const (*var*) inRect: Rect; inStyle: ThemeTabStyle; inDirection: ThemeTabDirection; labelProc: ThemeTabTitleDrawUPP; userData: UInt32): OSStatus; external name '_DrawThemeTab';

{
 *  GetThemeTabRegion()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetThemeTabRegion(const (*var*) inRect: Rect; inStyle: ThemeTabStyle; inDirection: ThemeTabDirection; ioRgn: RgnHandle): OSStatus; external name '_GetThemeTabRegion';

{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ CURSORS ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{
 *  SetThemeCursor()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetThemeCursor(inCursor: ThemeCursor): OSStatus; external name '_SetThemeCursor';

{
 *  SetAnimatedThemeCursor()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetAnimatedThemeCursor(inCursor: ThemeCursor; inAnimationStep: UInt32): OSStatus; external name '_SetAnimatedThemeCursor';

{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ CONTROL STYLE SETTINGS ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{
 *  GetThemeScrollBarThumbStyle()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetThemeScrollBarThumbStyle(var outStyle: ThemeScrollBarThumbStyle): OSStatus; external name '_GetThemeScrollBarThumbStyle';

{
 *  GetThemeScrollBarArrowStyle()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetThemeScrollBarArrowStyle(var outStyle: ThemeScrollBarArrowStyle): OSStatus; external name '_GetThemeScrollBarArrowStyle';

{
 *  GetThemeCheckBoxStyle()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetThemeCheckBoxStyle(var outStyle: ThemeCheckBoxStyle): OSStatus; external name '_GetThemeCheckBoxStyle';

{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ FONTS/TEXT ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{
 *  UseThemeFont()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function UseThemeFont(inFontID: ThemeFontID; inScript: ScriptCode): OSStatus; external name '_UseThemeFont';

{
 *  GetThemeFont()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetThemeFont(inFontID: ThemeFontID; inScript: ScriptCode; outFontName: StringPtr; var outFontSize: SInt16; var outStyle: Style): OSStatus; external name '_GetThemeFont';

{
 *  DrawThemeTextBox()
 *
 *  Summary:
 *    Draws text into the area you specify.
 *
 *  Discussion:
 *    DrawThemeTextBox allows you to draw theme-savvy (ie. Aqua-savvy
 *    on Mac OS X) text. It is unicode savvy (although only partially
 *    so under CarbonLib), and allows you to customize certain text
 *    rendering characteristics such as the font, wrapping behavior,
 *    and justification. The text is drawn into the CGContextRef you
 *    provide, or into the current Quickdraw port if no CGContextRef is
 *    provided. None of DrawThemeTextBox's parameters imply a color, so
 *    you must set up the desired text color separately before calling
 *    DrawThemeTextBox. If you provide a CGContextRef, its fill color
 *    will be used to draw the text. If you do not provide a
 *    CGContextRef, a color based on the current Quickdraw port's
 *    foreground color and the grayishTextOr mode (if set) will be used
 *    to draw the text.
 *
 *  Parameters:
 *
 *    inString:
 *      A CFStringRef containing the unicode characters you wish to
 *      render. You MUST NOT pass in a CFStringRef that was allocated
 *      with any of the "NoCopy" CFString creation APIs; a string
 *      created with a "NoCopy" API has transient storage which is
 *      incompatible with DrawThemeTextBox's caches.
 *
 *    inFontID:
 *      The ThemeFontID describing the font you'd like to render the
 *      text with. See the discussion of ThemeFontIDs elsewhere in this
 *      header.
 *
 *    inState:
 *      The ThemeDrawState describing the the state of the interface
 *      element you are drawing the text for. If, for example, you are
 *      drawing text for an inactive window, you would pass
 *      kThemeStateInactive. The ThemeDrawState is generally only used
 *      to determine the shadow characteristics for the text on Mac OS
 *      X. Note that the ThemeDrawState does NOT imply a color. It is
 *      NOT used as a mechanism for graying the text. If you wish to
 *      draw grayed text, you must set up the desired gray color and
 *      apply it to either the current Quickdraw port or the
 *      CGContextRef as appropriate.
 *
 *    inWrapToWidth:
 *      A Boolean indicating whether you want to draw multiple lines of
 *      text wrapped to a bounding box. False indicates that only one
 *      line of text should be drawn without any sort of wrapping.
 *
 *    inBoundingBox:
 *      The rectangle (in coordinates relative to the current Quickdraw
 *      port) describing the area to draw the text within. The first
 *      line of text will be top-justified to this rectangle. Wrapping
 *      (if desired) will happen at the horizontal extent of this
 *      rectangle. Regardless of the amount of text in your
 *      CFStringRef, all drawn text will be clipped to this rectangle.
 *
 *    inJust:
 *      The horizontal justification you would like for your text. You
 *      can use one of the standard justification constants from
 *      TextEdit.h.
 *
 *    inContext:
 *      The CGContextRef into which you would like to draw the text. On
 *      Mac OS X, all text drawing happens in CGContextRefs; if you
 *      pass NULL, a transient CGContextRef will be allocated and
 *      deallocated for use within the single API call. Relying on the
 *      system behavior if transiently createing CGContextRefs may
 *      result in performance problems. On Mac OS 9, the CGContextRef
 *      parameter is ignored.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DrawThemeTextBox(inString: CFStringRef; inFontID: ThemeFontID; inState: ThemeDrawState; inWrapToWidth: boolean; const (*var*) inBoundingBox: Rect; inJust: SInt16; inContext: UnivPtr): OSStatus; external name '_DrawThemeTextBox';

{
 *  TruncateThemeText()
 *
 *  Summary:
 *    Truncates text to fit within the width you specify.
 *
 *  Discussion:
 *    TruncateThemeText alters a unicode string to fit within a width
 *    that you specify. It is unicode savvy (although only partially so
 *    under CarbonLib), and makes its calculations (and any subsequent
 *    string alteration) based on the font and state you specify. If
 *    the string needs to be truncated, it will be reduced to the
 *    maximum number of characters which (with the addition of an
 *    ellipsis character) fits within the specified width.
 *
 *  Parameters:
 *
 *    inString:
 *      A CFMutableStringRef containing the unicode characters you wish
 *      to truncate. On output, inString may have been altered to fit
 *      within the specified width. You MUST NOT pass in a CFStringRef
 *      that was allocated with any of the "NoCopy" CFString creation
 *      APIs (see note in DrawThemeTextBox above).
 *
 *    inFontID:
 *      The ThemeFontID to use for text measurements. See the
 *      discussion of ThemeFontIDs elsewhere in this header.
 *
 *    inState:
 *      The ThemeDrawState which matches the state you will ultimately
 *      render the string width. This may affect text measurement
 *      during truncation, so you should be sure the value you pass to
 *      TruncateThemeText matches the value you will eventually use for
 *      drawing.
 *
 *    inPixelWidthLimit:
 *      The maximum width (in pixels) that the resulting truncated
 *      string may have.
 *
 *    inTruncWhere:
 *      A TruncCode indicating where you would like truncation to occur.
 *
 *    outTruncated:
 *      On output, this Boolean value indicates whether the string was
 *      truncated. True means the string was truncated. False means the
 *      string was not (and did not need to be) truncated.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TruncateThemeText(inString: CFMutableStringRef; inFontID: ThemeFontID; inState: ThemeDrawState; inPixelWidthLimit: SInt16; inTruncWhere: TruncCode; outTruncated: BooleanPtr): OSStatus; external name '_TruncateThemeText';

{
 *  GetThemeTextDimensions()
 *
 *  Summary:
 *    Tells you the height, width, and baseline for a string.
 *
 *  Discussion:
 *    GetThemeTextDimensions measures the given string using a font and
 *    state you specify. It always reports the actual height and
 *    baseline. It sometimes reports the actual width (see below). It
 *    can measure a string that wraps. It is unicode savvy (although
 *    only partially so under CarbonLib).
 *
 *  Parameters:
 *
 *    inString:
 *      A CFStringRef containing the unicode characters you wish to
 *      measure. You MUST NOT pass in a CFStringRef that was allocated
 *      with any of the "NoCopy" CFString creation APIs (see note in
 *      DrawThemeTextBox above).
 *
 *    inFontID:
 *      The ThemeFontID describing the font you'd like to measure the
 *      text with. See the discussion of ThemeFontIDs elsewhere in this
 *      header.
 *
 *    inState:
 *      The ThemeDrawState which matches the state you will ultimately
 *      render the string width. This may affect text measurement, so
 *      you should be sure the value you pass to TruncateThemeText
 *      matches the value you will eventually use for drawing.
 *
 *    inWrapToWidth:
 *      A Boolean indicating whether you want the measurements based on
 *      wrapping the text to a specific width. If you pass true, you
 *      must specify the desired width in ioBounds->h.
 *
 *    ioBounds:
 *      On output, ioBounds->v contains the height of the text. If you
 *      pass false to inWrapToWidth, ioBounds->h will contain the width
 *      of the text on output. If you pass true to inWrapToWidth,
 *      ioBounds->h must (on input) contain the desired width for
 *      wrapping; on output, ioBounds->h contains the same value you
 *      specified on input.
 *
 *    outBaseline:
 *      On output, outBaseline contains the offset (in Quickdraw space)
 *      from the bottom edge of the last line of text to the baseline
 *      of the first line of text. outBaseline will generally be a
 *      negative value.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetThemeTextDimensions(inString: CFStringRef; inFontID: ThemeFontID; inState: ThemeDrawState; inWrapToWidth: boolean; var ioBounds: Point; var outBaseline: SInt16): OSStatus; external name '_GetThemeTextDimensions';

{
 *  GetThemeTextShadowOutset()
 *
 *  Summary:
 *    Tells you the amount of space taken up by the shadow for a given
 *    font/state combination.
 *
 *  Discussion:
 *    GetThemeTextShadowOutset passes back the maximum amount of space
 *    the shadow will take up for text drawn in the specified font and
 *    state. While GetThemeTextDimensions tells you how much space is
 *    taken up by the character glyphs themselves, it does not
 *    incorporate the font/state shadow into its calculations. If you
 *    need to know how much total space including the shadow will be
 *    taken up, call GetThemeTextDimensions followed by
 *    GetThemeTextShadowOutset.
 *
 *  Parameters:
 *
 *    inFontID:
 *      The ThemeFontID describing the font you'd like the shadow
 *      characteristics of. Font and state both determine the amount of
 *      shadow that will be used on rendered text. See the discussion
 *      of ThemeFontIDs elsewhere in this header.
 *
 *    inState:
 *      The ThemeDrawState which matches the state you'd like the
 *      shadow characteristics of. Font and state both determine the
 *      amount of shadow that will be used on rendered text.
 *
 *    outOutset:
 *      On output, outOutset contains the amount of space the shadow
 *      will take up beyond each edge of the text bounding rectangle
 *      returned by GetThemeTextDimensions. The fields of outOutset
 *      will either be positive values or zero.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetThemeTextShadowOutset(inFontID: ThemeFontID; inState: ThemeDrawState; var outOutset: Rect): OSStatus; external name '_GetThemeTextShadowOutset';

{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ TRACKS ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{
 *  DrawThemeTrack()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DrawThemeTrack(const (*var*) drawInfo: ThemeTrackDrawInfo; rgnGhost: RgnHandle; eraseProc: ThemeEraseUPP; eraseData: UInt32): OSStatus; external name '_DrawThemeTrack';

{
 *  HitTestThemeTrack()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function HitTestThemeTrack(const (*var*) drawInfo: ThemeTrackDrawInfo; mousePoint: Point; var partHit: ControlPartCode): boolean; external name '_HitTestThemeTrack';

{
 *  GetThemeTrackBounds()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetThemeTrackBounds(const (*var*) drawInfo: ThemeTrackDrawInfo; var bounds: Rect): OSStatus; external name '_GetThemeTrackBounds';

{
 *  GetThemeTrackThumbRgn()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetThemeTrackThumbRgn(const (*var*) drawInfo: ThemeTrackDrawInfo; thumbRgn: RgnHandle): OSStatus; external name '_GetThemeTrackThumbRgn';

{
 *  GetThemeTrackDragRect()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetThemeTrackDragRect(const (*var*) drawInfo: ThemeTrackDrawInfo; var dragRect: Rect): OSStatus; external name '_GetThemeTrackDragRect';

{
 *  DrawThemeTrackTickMarks()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DrawThemeTrackTickMarks(const (*var*) drawInfo: ThemeTrackDrawInfo; numTicks: ItemCount; eraseProc: ThemeEraseUPP; eraseData: UInt32): OSStatus; external name '_DrawThemeTrackTickMarks';

{
 *  GetThemeTrackThumbPositionFromOffset()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetThemeTrackThumbPositionFromOffset(const (*var*) drawInfo: ThemeTrackDrawInfo; thumbOffset: Point; var relativePosition: SInt32): OSStatus; external name '_GetThemeTrackThumbPositionFromOffset';

{
 *  GetThemeTrackThumbPositionFromRegion()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetThemeTrackThumbPositionFromRegion(const (*var*) drawInfo: ThemeTrackDrawInfo; thumbRgn: RgnHandle; var relativePosition: SInt32): OSStatus; external name '_GetThemeTrackThumbPositionFromRegion';

{
 *  GetThemeTrackLiveValue()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetThemeTrackLiveValue(const (*var*) drawInfo: ThemeTrackDrawInfo; relativePosition: SInt32; var value: SInt32): OSStatus; external name '_GetThemeTrackLiveValue';

{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ SCROLLBAR ARROWS ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{
 *  DrawThemeScrollBarArrows()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DrawThemeScrollBarArrows(const (*var*) bounds: Rect; enableState: ByteParameter; pressState: ByteParameter; isHoriz: boolean; var trackBounds: Rect): OSStatus; external name '_DrawThemeScrollBarArrows';

{
 *  GetThemeScrollBarTrackRect()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetThemeScrollBarTrackRect(const (*var*) bounds: Rect; enableState: ByteParameter; pressState: ByteParameter; isHoriz: boolean; var trackBounds: Rect): OSStatus; external name '_GetThemeScrollBarTrackRect';

{
 *  HitTestThemeScrollBarArrows()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function HitTestThemeScrollBarArrows(const (*var*) scrollBarBounds: Rect; enableState: ByteParameter; pressState: ByteParameter; isHoriz: boolean; ptHit: Point; var trackBounds: Rect; var partcode: ControlPartCode): boolean; external name '_HitTestThemeScrollBarArrows';

{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ WINDOWS ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{
 *  GetThemeWindowRegion()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetThemeWindowRegion(flavor: ThemeWindowType; const (*var*) contRect: Rect; state: ThemeDrawState; const (*var*) metrics: ThemeWindowMetrics; attributes: ThemeWindowAttributes; winRegion: AppearanceRegionCode; rgn: RgnHandle): OSStatus; external name '_GetThemeWindowRegion';

{
 *  DrawThemeWindowFrame()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DrawThemeWindowFrame(flavor: ThemeWindowType; const (*var*) contRect: Rect; state: ThemeDrawState; const (*var*) metrics: ThemeWindowMetrics; attributes: ThemeWindowAttributes; titleProc: WindowTitleDrawingUPP; titleData: UInt32): OSStatus; external name '_DrawThemeWindowFrame';

{
 *  DrawThemeTitleBarWidget()
 *
 *  Summary:
 *    Draws the requested theme title bar widget.
 *
 *  Discussion:
 *    DrawThemeTitleBarWidget renders the requested theme title bar
 *    widget in the proper location of a window.  A common
 *    misconception when using this API is that the client must specify
 *    the exact location of the widget in the window. The widget will
 *    locate itself in the window based relative to the content rect
 *    passed in content rectangle -- the contRect parameter.  Another
 *    common problem is to ignore the window's attributes.  The
 *    attributes must be set up properly to describe the window for
 *    which the widget is to be drawn.
 *
 *  Parameters:
 *
 *    flavor:
 *      A valid ThemeWindowtype describing the type of theme window for
 *      which you would like to draw a widget.
 *
 *    contRect:
 *      A rectangle describing the window's content area.  The widget
 *      is drawn relative to the content rectangle of the window, so
 *      this parameter does not describe the actual widget bounds, it
 *      describes the window's content rectangle.
 *
 *    state:
 *      A valid ThemeDrawState which describes the state of the window
 *      for which the widget is to be drawn.
 *
 *    metrics:
 *      A pointer to a set of valid ThemeWindowMetrics.  At this time,
 *      none of the fields of the metrics are pertinent to the widgets,
 *      so the only important field is the metricSize field to mark the
 *      structure as valid.
 *
 *    attributes:
 *      A valid ThemeWindowAttributes set which describes the window
 *      for which the widget is to be drawn.
 *
 *    widget:
 *      A valid ThemeTitleBarWidget set which describes which widget to
 *      draw.
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DrawThemeTitleBarWidget(flavor: ThemeWindowType; const (*var*) contRect: Rect; state: ThemeDrawState; const (*var*) metrics: ThemeWindowMetrics; attributes: ThemeWindowAttributes; widget: ThemeTitleBarWidget): OSStatus; external name '_DrawThemeTitleBarWidget';

{
 *  GetThemeWindowRegionHit()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetThemeWindowRegionHit(flavor: ThemeWindowType; const (*var*) inContRect: Rect; state: ThemeDrawState; const (*var*) metrics: ThemeWindowMetrics; inAttributes: ThemeWindowAttributes; inPoint: Point; var outRegionHit: AppearanceRegionCode): boolean; external name '_GetThemeWindowRegionHit';

{
 *  DrawThemeScrollBarDelimiters()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DrawThemeScrollBarDelimiters(flavor: ThemeWindowType; const (*var*) inContRect: Rect; state: ThemeDrawState; attributes: ThemeWindowAttributes): OSStatus; external name '_DrawThemeScrollBarDelimiters';


{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ BUTTONS ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{
 *  DrawThemeButton()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DrawThemeButton(const (*var*) inBounds: Rect; inKind: ThemeButtonKind; const (*var*) inNewInfo: ThemeButtonDrawInfo; inPrevInfo: {Const}ThemeButtonDrawInfoPtr; inEraseProc: ThemeEraseUPP; inLabelProc: ThemeButtonDrawUPP; inUserData: UInt32): OSStatus; external name '_DrawThemeButton';

{
 *  GetThemeButtonRegion()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetThemeButtonRegion(const (*var*) inBounds: Rect; inKind: ThemeButtonKind; const (*var*) inNewInfo: ThemeButtonDrawInfo; outRegion: RgnHandle): OSStatus; external name '_GetThemeButtonRegion';

{
 *  GetThemeButtonContentBounds()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetThemeButtonContentBounds(const (*var*) inBounds: Rect; inKind: ThemeButtonKind; const (*var*) inDrawInfo: ThemeButtonDrawInfo; var outBounds: Rect): OSStatus; external name '_GetThemeButtonContentBounds';

{
 *  GetThemeButtonBackgroundBounds()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetThemeButtonBackgroundBounds(const (*var*) inBounds: Rect; inKind: ThemeButtonKind; const (*var*) inDrawInfo: ThemeButtonDrawInfo; var outBounds: Rect): OSStatus; external name '_GetThemeButtonBackgroundBounds';


{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ interface SOUNDS ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{                                                                                                  }
{  X ALERT: Please note that the sound APIs do not work on Mac OS X at present.                    }
{
 *  PlayThemeSound()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PlayThemeSound(kind: ThemeSoundKind): OSStatus; external name '_PlayThemeSound';
{
 *  BeginThemeDragSound()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function BeginThemeDragSound(kind: ThemeDragSoundKind): OSStatus; external name '_BeginThemeDragSound';
{
 *  EndThemeDragSound()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function EndThemeDragSound: OSStatus; external name '_EndThemeDragSound';
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ PRIMITIVES ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{
 *  DrawThemeTickMark()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DrawThemeTickMark(const (*var*) bounds: Rect; state: ThemeDrawState): OSStatus; external name '_DrawThemeTickMark';

{
 *  DrawThemeChasingArrows()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DrawThemeChasingArrows(const (*var*) bounds: Rect; index: UInt32; state: ThemeDrawState; eraseProc: ThemeEraseUPP; eraseData: UInt32): OSStatus; external name '_DrawThemeChasingArrows';

{
 *  DrawThemePopupArrow()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DrawThemePopupArrow(const (*var*) bounds: Rect; orientation: ThemeArrowOrientation; size: ThemePopupArrowSize; state: ThemeDrawState; eraseProc: ThemeEraseUPP; eraseData: UInt32): OSStatus; external name '_DrawThemePopupArrow';

{
 *  DrawThemeStandaloneGrowBox()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DrawThemeStandaloneGrowBox(origin: Point; growDirection: ThemeGrowDirection; isSmall: boolean; state: ThemeDrawState): OSStatus; external name '_DrawThemeStandaloneGrowBox';

{
 *  DrawThemeStandaloneNoGrowBox()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DrawThemeStandaloneNoGrowBox(origin: Point; growDirection: ThemeGrowDirection; isSmall: boolean; state: ThemeDrawState): OSStatus; external name '_DrawThemeStandaloneNoGrowBox';

{
 *  GetThemeStandaloneGrowBoxBounds()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetThemeStandaloneGrowBoxBounds(origin: Point; growDirection: ThemeGrowDirection; isSmall: boolean; var bounds: Rect): OSStatus; external name '_GetThemeStandaloneGrowBoxBounds';

{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ DRAWING STATE ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{ The following routines help you save and restore the drawing state in a theme-savvy manner. With }
{ these weapons in your arsenal, there is no grafport you cannot tame. Use ThemeGetDrawingState to }
{ get the current drawing settings for the current port. It will return an opaque object for you   }
{ to pass into SetThemeDrawingState later on. When you are finished with the state, call the       }
{ DisposeThemeDrawingState routine. You can alternatively pass true into the inDisposeNow          }
{ parameter of the SetThemeDrawingState routine.  You can use this routine to copy the drawing     }
{ state from one port to another as well.                                                          }
{                                                                                                  }
{ As of this writing (Mac OS 9.1 and Mac OS X), Get/SetThemeDrawingState will save and restore     }
{ this data in the port:                                                                           }
{                                                                                                  }
{      pen size                                                                                    }
{      pen location                                                                                }
{      pen mode                                                                                    }
{      pen Pattern and PixPat                                                                      }
{      background Pattern and PixPat                                                               }
{      RGB foreground and background colors                                                        }
{      text mode                                                                                   }
{      pattern origin                                                                              }
{                                                                                                  }
{ Get/SetThemeDrawingState may save and restore additional port state in the future, but you can   }
{ rely on them to always save at least this port state.                                            }
{
 *  NormalizeThemeDrawingState()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NormalizeThemeDrawingState: OSStatus; external name '_NormalizeThemeDrawingState';

{
 *  GetThemeDrawingState()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetThemeDrawingState(var outState: ThemeDrawingState): OSStatus; external name '_GetThemeDrawingState';

{
 *  SetThemeDrawingState()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetThemeDrawingState(inState: ThemeDrawingState; inDisposeNow: boolean): OSStatus; external name '_SetThemeDrawingState';

{
 *  DisposeThemeDrawingState()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DisposeThemeDrawingState(inState: ThemeDrawingState): OSStatus; external name '_DisposeThemeDrawingState';

{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ MISCELLANEOUS ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{ ApplyThemeBackground is used to set up the background for embedded controls  }
{ It is normally called by controls that are embedders. The standard controls  }
{ call this API to ensure a correct background for the current theme. You pass }
{ in the same rectangle you would if you were calling the drawing primitive.   }
{
 *  ApplyThemeBackground()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ApplyThemeBackground(inKind: ThemeBackgroundKind; const (*var*) bounds: Rect; inState: ThemeDrawState; inDepth: SInt16; inColorDev: boolean): OSStatus; external name '_ApplyThemeBackground';

{
 *  IsValidAppearanceFileType()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function IsValidAppearanceFileType(fileType: OSType): boolean; external name '_IsValidAppearanceFileType';

{
 *  GetThemeBrushAsColor()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetThemeBrushAsColor(inBrush: ThemeBrush; inDepth: SInt16; inColorDev: boolean; var outColor: RGBColor): OSStatus; external name '_GetThemeBrushAsColor';

{
 *  GetThemeTextColor()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetThemeTextColor(inColor: ThemeTextColor; inDepth: SInt16; inColorDev: boolean; var outColor: RGBColor): OSStatus; external name '_GetThemeTextColor';

{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ BEGIN CARBON ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{
 *  GetThemeMetric()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetThemeMetric(inMetric: ThemeMetric; var outMetric: SInt32): OSStatus; external name '_GetThemeMetric';

{
 *  GetTextAndEncodingFromCFString()
 *
 *  Summary:
 *    Converts the contents of a CFString to the one- or two-byte
 *    encoding that most accurately represents the original Unicode
 *    characters in the string.
 *
 *  Discussion:
 *    Because the Macintosh toolbox has had, until Carbon, little
 *    support for Unicode, you may often find that your applications
 *    need to translate a CFString (containing Unicode characters) back
 *    to a one- or two-byte encoding of the string in order to draw,
 *    measure, or otherwise use the text in the string.
 *    GetTextAndEncodingFromCFString is a utility that may be helpful
 *    to do this, in some circumstances. The Carbon toolbox uses this
 *    API itself when translating CFStrings to Pascal strings.
 *    GetTextAndEncodingFromCFString attempts to convert the Unicode
 *    characters in the string to the closest non-Unicode
 *    representation of the string. For example, a string containing
 *    only Unicode characters that are present in the MacRoman one-byte
 *    encoding will be translated to MacRoman, and
 *    kTextEncodingMacRoman will be returned as the encoding of the
 *    text. A string containing Unicode characters that are present in
 *    the MacJapanese two-byte encoding will be translated to
 *    MacJapanese (Shift-JIS), and kTextEncodingMacJapanese will be
 *    returned as the encoding of the text.
 *    GetTextAndEncodingFromCFString is designed to be used for simple
 *    strings which contain only text from a single language. It is not
 *    designed to translate strings with multiple runs of text from
 *    different languages, and will only return the first run of such a
 *    string; for example, if you pass it a string containing a run of
 *    Roman characters followed by a run of Japanese characters, it
 *    will only return the Roman characters in the output buffer. For
 *    more complex text translation, you should call the Unicode
 *    converter directly (see ConvertFromUnicodeToTextRun, which
 *    GetTextAndEncodingFromCFString uses internally).
 *
 *  Parameters:
 *
 *    inString:
 *      The string to convert.
 *
 *    outText:
 *      The output buffer in which to place the converted text.
 *
 *    inTextMaxLength:
 *      The length in bytes of the input buffer.
 *
 *    outTextLength:
 *      On exit, contains the length in bytes of the text that was
 *      placed into the output buffer.
 *
 *    outEncoding:
 *      On exit, contains the encoding of the text that was placed into
 *      the output buffer.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.2.5 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetTextAndEncodingFromCFString(inString: CFStringRef; outText: BytePtr; inTextMaxLength: ByteCount; var outTextLength: ByteCount; outEncoding: TextEncodingPtr): OSStatus; external name '_GetTextAndEncodingFromCFString';


{
 *  CopyThemeIdentifier()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.4 and later
 *    Mac OS X:         in version 10.1 and later
 }
function CopyThemeIdentifier(var outIdentifier: CFStringRef): OSStatus; external name '_CopyThemeIdentifier';

{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{ Obsolete symbolic names                                                                          }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{ Obsolete error codes - use the new ones, s'il vous plait / kudasai }

const
    appearanceBadBrushIndexErr  = -30560;                       {  pattern index invalid  }
    appearanceProcessRegisteredErr = -30561;
    appearanceProcessNotRegisteredErr = -30562;
    appearanceBadTextColorIndexErr = -30563;
    appearanceThemeHasNoAccents = -30564;
    appearanceBadCursorIndexErr = -30565;

    kThemeActiveDialogBackgroundBrush = 1;
    kThemeInactiveDialogBackgroundBrush = 2;
    kThemeActiveAlertBackgroundBrush = 3;
    kThemeInactiveAlertBackgroundBrush = 4;
    kThemeActiveModelessDialogBackgroundBrush = 5;
    kThemeInactiveModelessDialogBackgroundBrush = 6;
    kThemeActiveUtilityWindowBackgroundBrush = 7;
    kThemeInactiveUtilityWindowBackgroundBrush = 8;
    kThemeListViewSortColumnBackgroundBrush = 9;
    kThemeListViewBackgroundBrush = 10;
    kThemeIconLabelBackgroundBrush = 11;
    kThemeListViewSeparatorBrush = 12;
    kThemeChasingArrowsBrush    = 13;
    kThemeDragHiliteBrush       = 14;
    kThemeDocumentWindowBackgroundBrush = 15;
    kThemeFinderWindowBackgroundBrush = 16;

    kThemeActiveScrollBarDelimiterBrush = 17;
    kThemeInactiveScrollBarDelimiterBrush = 18;
    kThemeFocusHighlightBrush   = 19;
    kThemeActivePopupArrowBrush = 20;
    kThemePressedPopupArrowBrush = 21;
    kThemeInactivePopupArrowBrush = 22;
    kThemeAppleGuideCoachmarkBrush = 23;

    kThemeActiveDialogTextColor = 1;
    kThemeInactiveDialogTextColor = 2;
    kThemeActiveAlertTextColor  = 3;
    kThemeInactiveAlertTextColor = 4;
    kThemeActiveModelessDialogTextColor = 5;
    kThemeInactiveModelessDialogTextColor = 6;
    kThemeActiveWindowHeaderTextColor = 7;
    kThemeInactiveWindowHeaderTextColor = 8;
    kThemeActivePlacardTextColor = 9;
    kThemeInactivePlacardTextColor = 10;
    kThemePressedPlacardTextColor = 11;
    kThemeActivePushButtonTextColor = 12;
    kThemeInactivePushButtonTextColor = 13;
    kThemePressedPushButtonTextColor = 14;
    kThemeActiveBevelButtonTextColor = 15;
    kThemeInactiveBevelButtonTextColor = 16;
    kThemePressedBevelButtonTextColor = 17;
    kThemeActivePopupButtonTextColor = 18;
    kThemeInactivePopupButtonTextColor = 19;
    kThemePressedPopupButtonTextColor = 20;
    kThemeIconLabelTextColor    = 21;
    kThemeListViewTextColor     = 22;

    kThemeActiveDocumentWindowTitleTextColor = 23;
    kThemeInactiveDocumentWindowTitleTextColor = 24;
    kThemeActiveMovableModalWindowTitleTextColor = 25;
    kThemeInactiveMovableModalWindowTitleTextColor = 26;
    kThemeActiveUtilityWindowTitleTextColor = 27;
    kThemeInactiveUtilityWindowTitleTextColor = 28;
    kThemeActivePopupWindowTitleColor = 29;
    kThemeInactivePopupWindowTitleColor = 30;
    kThemeActiveRootMenuTextColor = 31;
    kThemeSelectedRootMenuTextColor = 32;
    kThemeDisabledRootMenuTextColor = 33;
    kThemeActiveMenuItemTextColor = 34;
    kThemeSelectedMenuItemTextColor = 35;
    kThemeDisabledMenuItemTextColor = 36;
    kThemeActivePopupLabelTextColor = 37;
    kThemeInactivePopupLabelTextColor = 38;

    kAEThemeSwitch              = $74686D65 (* 'thme' *);                       {  Event ID's: Theme Switched  }

    kThemeNoAdornment           = 0;
    kThemeDefaultAdornment      = $01;
    kThemeFocusAdornment        = $04;
    kThemeRightToLeftAdornment  = $10;
    kThemeDrawIndicatorOnly     = $20;

    kThemeBrushPassiveAreaFill  = 25;

    kThemeMetricCheckBoxGlyphHeight = 2;
    kThemeMetricRadioButtonGlyphHeight = 3;
    kThemeMetricDisclosureButtonSize = 17;
    kThemeMetricBestListHeaderHeight = 20;
    kThemeMetricSmallProgressBarThickness = 58;                 {  obsolete  }
    kThemeMetricProgressBarThickness = 32;                      {  obsolete  }

    kThemeScrollBar             = 0;
    kThemeSlider                = 2;
    kThemeProgressBar           = 3;
    kThemeIndeterminateBar      = 4;

{$ALIGN MAC68K}
{#POP}
{unit AppleScript}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}

{*************************************************************************
    Types and Constants
*************************************************************************}
{
    The specific type for the AppleScript instance of the
    Open Scripting Architecture type.
}

const
    typeAppleScript             = $61736372 (* 'ascr' *);
    kAppleScriptSubtype         = $61736372 (* 'ascr' *);
    typeASStorage               = $61736372 (* 'ascr' *);

    {   *************************************************************************
        Component Selectors
    *************************************************************************   }

    kASSelectInit               = $1001;
    kASSelectSetSourceStyles    = $1002;
    kASSelectGetSourceStyles    = $1003;
    kASSelectGetSourceStyleNames = $1004;


    {   *************************************************************************
        OSAGetScriptInfo Selectors
    *************************************************************************   }
    kASHasOpenHandler           = $68736F64 (* 'hsod' *);

    {
            This selector is used to query a context as to whether it contains
            a handler for the kAEOpenDocuments event. This allows "applets" to be
            distinguished from "droplets."  OSAGetScriptInfo returns false if
            there is no kAEOpenDocuments handler, and returns the error value
            errOSAInvalidAccess if the input is not a context.
            }
    {   *************************************************************************
        Initialization
    *************************************************************************   }
    {
     *  ASInit()
     *
     *  Availability:
     *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function ASInit(scriptingComponent: ComponentInstance; modeFlags: SInt32; minStackSize: SInt32; preferredStackSize: SInt32; maxStackSize: SInt32; minHeapSize: SInt32; preferredHeapSize: SInt32; maxHeapSize: SInt32): OSAError; external name '_ASInit';
{
        ComponentCallNow(kASSelectInit, 28);
        This call can be used to explicitly initialize AppleScript.  If it is
        not called, the a scripting size resource is looked for and used. If
        there is no scripting size resource, then the constants listed below
        are used.  If at any stage (the init call, the size resource, the
        defaults) any of these parameters are zero, then parameters from the
        next stage are used.  ModeFlags are not currently used.
        Errors:
        errOSASystemError       initialization failed
    }
{
    These values will be used if ASInit is not called explicitly, or if any
    of ASInit's parameters are zero:
}

const
    kASDefaultMinStackSize      = 4096;
    kASDefaultPreferredStackSize = 16384;
    kASDefaultMaxStackSize      = 16384;
    kASDefaultMinHeapSize       = 4096;
    kASDefaultPreferredHeapSize = 16384;
    kASDefaultMaxHeapSize       = 33554432;

    {   *************************************************************************
        Source Styles
    *************************************************************************   }
    {
     *  ASSetSourceStyles()
     *
     *  Availability:
     *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function ASSetSourceStyles(scriptingComponent: ComponentInstance; sourceStyles: STHandle): OSAError; external name '_ASSetSourceStyles';
{
        ComponentCallNow(kASSelectSetSourceStyles, 4);
        Errors:
        errOSASystemError       operation failed
    }
{
 *  ASGetSourceStyles()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ASGetSourceStyles(scriptingComponent: ComponentInstance; var resultingSourceStyles: STHandle): OSAError; external name '_ASGetSourceStyles';
{
        ComponentCallNow(kASSelectGetSourceStyles, 4);
        Errors:
        errOSASystemError       operation failed
    }
{
 *  ASGetSourceStyleNames()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ASGetSourceStyleNames(scriptingComponent: ComponentInstance; modeFlags: SInt32; var resultingSourceStyleNamesList: AEDescList): OSAError; external name '_ASGetSourceStyleNames';
{
        ComponentCallNow(kASSelectGetSourceStyleNames, 8);
        This call returns an AEList of styled text descriptors the names of the
        source styles in the current dialect.  The order of the names corresponds
        to the order of the source style constants, below.  The style of each
        name is the same as the styles returned by ASGetSourceStyles.

        Errors:
        errOSASystemError       operation failed
    }
{
    Elements of STHandle correspond to following categories of tokens, and
    accessed through following index constants:
}

const
    kASSourceStyleUncompiledText = 0;
    kASSourceStyleNormalText    = 1;
    kASSourceStyleLanguageKeyword = 2;
    kASSourceStyleApplicationKeyword = 3;
    kASSourceStyleComment       = 4;
    kASSourceStyleLiteral       = 5;
    kASSourceStyleUserSymbol    = 6;
    kASSourceStyleObjectSpecifier = 7;
    kASNumberOfSourceStyles     = 8;


{$ALIGN MAC68K}
{#POP}
{unit CarbonEvents}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}

{======================================================================================}
{  EVENT COMMON                                                                        }
{======================================================================================}



{
 *  Discussion:
 *    The following are all errors which can be returned from the
 *    routines contained in this file.
 }

const
    eventAlreadyPostedErr       = -9860;
    eventTargetBusyErr          = -9861;
    eventClassInvalidErr        = -9862;
    eventClassIncorrectErr      = -9864;
    eventHandlerAlreadyInstalledErr = -9866;
    eventInternalErr            = -9868;
    eventKindIncorrectErr       = -9869;
    eventParameterNotFoundErr   = -9870;
    eventNotHandledErr          = -9874;
    eventLoopTimedOutErr        = -9875;
    eventLoopQuitErr            = -9876;
    eventNotInQueueErr          = -9877;
    eventHotKeyExistsErr        = -9878;
    eventHotKeyInvalidErr       = -9879;

    {   ======================================================================================  }
    {     EVENT CORE                                                                            }
    {   ======================================================================================  }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {     ¥ Event Flags, options                                                                }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }

    {
     *  EventPriority
     *
     *  Discussion:
     *    These values define the relative priority of an event, and are
     *    used when posting events with PostEventToQueue. In general events
     *    are pulled from the queue in order of first posted to last
     *    posted. These priorities are a way to alter that when posting
     *    events. You can post a standard priority event and then a high
     *    priority event and the high priority event will be pulled from
     *    the queue first.
        }

type
    EventPriority               = SInt16;
const
    kEventPriorityLow           = 0;
    kEventPriorityStandard      = 1;
    kEventPriorityHigh          = 2;

    kEventLeaveInQueue          = false;
    kEventRemoveFromQueue       = true;

    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {    ¥ Event Times                                                                          }
    {                                                                                           }
    {    EventTime is in seconds since boot. Use the constants to make life easy.               }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }

type
    EventTime                           = Double;
    EventTimePtr                            = ^EventTime;
    EventTimeout                        = EventTime;
    EventTimeoutPtr                     = ^EventTimeout;
    EventTimerInterval                  = EventTime;
    EventTimerIntervalPtr                   = ^EventTimerInterval;

const
    kEventDurationSecond        = 1.0;
    kEventDurationMillisecond   = kEventDurationSecond/1000;
    kEventDurationMicrosecond   = kEventDurationSecond/1000000;
    kEventDurationNanosecond    = kEventDurationSecond/1000000000;
    kEventDurationMinute        = kEventDurationSecond*60;
    kEventDurationHour          = kEventDurationMinute*60;
    kEventDurationDay           = kEventDurationHour*24;
    kEventDurationNoWait        = 0.0;
    kEventDurationForever       = -1.0;


    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {    EventTypeSpec structure                                                                }
    {                                                                                           }
    {    This structure is used in many routines to pass a list of event types to a function.   }
    {    You typically would declare a const array of these types to pass in.                   }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }

    {
     *  EventTypeSpec
     *
     *  Discussion:
     *    This structure is used to specify an event. Typically, a static
     *    array of EventTypeSpecs are passed into functions such as
     *    InstallEventHandler, as well as routines such as
     *    FlushEventsMatchingListFromQueue.
        }

type
    EventTypeSpecPtr = ^EventTypeSpec;
    EventTypeSpec = record
        eventClass:             UInt32;
        eventKind:              UInt32;
    end;


    {
     *  Discussion:
     *    These are returned from calls to TrackMouseLocation and
     *    TrackMouseRegion. Those routines are designed as replacements to
     *    calls such as StillDown and WaitMouseUp. The advantage over those
     *    routines is that TrackMouseLocation and TrackMouseRegion will
     *    block if the user is not moving the mouse, whereas mouse tracking
     *    loops based on StillDown and WaitMouseUp will spin, chewing up
     *    valuable CPU time that could be better spent elsewhere. It is
     *    highly recommended that any tracking loops in your application
     *    stop using StillDown and WaitMouseUp and start using
     *    TrackMouseLocation/Region. See the notes on those routines for
     *    more information.
        }

const
    kTrackMouseLocationOptionDontConsumeMouseUp = $01;


type
    MouseTrackingResult         = UInt16;
const
    kMouseTrackingMouseDown     = 1;
    kMouseTrackingMouseUp       = 2;
    kMouseTrackingMouseExited   = 3;
    kMouseTrackingMouseEntered  = 4;
    kMouseTrackingMouseDragged  = 5;
    kMouseTrackingKeyModifiersChanged = 6;
    kMouseTrackingUserCancelled = 7;
    kMouseTrackingTimedOut      = 8;
    kMouseTrackingMouseMoved    = 9;


type
    EventParamName                      = OSType;
    EventParamNamePtr                       = ^EventParamName;
    EventParamType                      = OSType;
    EventParamTypePtr                       = ^EventParamType;
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {     ¥ EventLoop                                                                           }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }

    {
     *  EventLoopRef
     *
     *  Discussion:
     *    An EventLoopRef represents an 'event loop', which is the
     *    conceptual entity that you 'run' to fetch events from hardware
     *    and other sources and also fires timers that might be installed
     *    with InstallEventLoopTimer. The term 'run' is a bit of a
     *    misnomer, as the event loop's goal is to stay as blocked as
     *    possible to minimize CPU usage for the current application. The
     *    event loop is run implicitly thru APIs like ReceiveNextEvent,
     *    RunApplicationEventLoop, or even WaitNextEvent. It can also be
     *    run explicitly thru a call to RunCurrentEventLoop. Each
     *    preemptive thread can have an event loop. Cooperative threads
     *    share the main thread's event loop.
        }
    EventLoopRef    = ^SInt32; { an opaque 32-bit type }
    EventLoopRefPtr = ^EventLoopRef;  { when a var xx:EventLoopRef parameter can be nil, it is changed to xx: EventLoopRefPtr }
    {
     *  GetCurrentEventLoop()
     *
     *  Discussion:
     *    Returns the current event loop for the current thread. If the
     *    current thread is a cooperative thread, the main event loop is
     *    returned.
     *
     *  Result:
     *    An event loop reference.
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.1 and later
     *    Mac OS X:         in version 10.0 and later
        }
function GetCurrentEventLoop: EventLoopRef; external name '_GetCurrentEventLoop';

{
 *  GetMainEventLoop()
 *
 *  Discussion:
 *    Returns the event loop object for the main application thread.
 *
 *  Result:
 *    An event loop reference.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetMainEventLoop: EventLoopRef; external name '_GetMainEventLoop';


{
 *  RunCurrentEventLoop()
 *
 *  Discussion:
 *    This routine 'runs' the event loop, returning only if aborted or
 *    the timeout specified is reached. The event loop is mostly
 *    blocked while in this function, occasionally waking up to fire
 *    timers or pick up events. The typical use of this function is to
 *    cause the current thread to wait for some operation to complete,
 *    most likely on another thread of execution.
 *
 *  Parameters:
 *
 *    inTimeout:
 *      The time to wait until returning (can be kEventDurationForever).
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function RunCurrentEventLoop(inTimeout: EventTimeout): OSStatus; external name '_RunCurrentEventLoop';

{
 *  QuitEventLoop()
 *
 *  Discussion:
 *    Causes a specific event loop to terminate. Usage of this is
 *    similar to WakeUpProcess, in that it causes the eventloop
 *    specified to return immediately (as opposed to timing out).
 *    Typically this call is used in conjunction with
 *    RunCurrentEventLoop.
 *
 *  Parameters:
 *
 *    inEventLoop:
 *      The event loop to terminate.
 *
 *  Result:
 *    An operating system result code.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function QuitEventLoop(inEventLoop: EventLoopRef): OSStatus; external name '_QuitEventLoop';

{
 *  GetCFRunLoopFromEventLoop()
 *
 *  Discussion:
 *    Returns the corresponding CFRunLoopRef for the given EventLoop.
 *    This is not necessarily a one-to-one mapping, hence the need for
 *    this function. In Carbon, all cooperative threads use the same
 *    run loop under the covers, so using CFRunLoopGetCurrent might
 *    yield the wrong result. In general, you would only need to use
 *    this function if you wished to add your own sources to the run
 *    loop. If you don't know what I'm talking about, then you probably
 *    don't need to use this.
 *
 *  Parameters:
 *
 *    inEventLoop:
 *      The event loop to get the CFRunLoop for.
 *
 *  Result:
 *    The CFRunLoopRef for inEventLoop.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.1 and later
 *    Mac OS X:         in version 10.1 and later
 }
function GetCFRunLoopFromEventLoop(inEventLoop: EventLoopRef): CFTypeRef; external name '_GetCFRunLoopFromEventLoop';

{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{  ¥ Low-level event fetching                                                          }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{
 *  ReceiveNextEvent()
 *
 *  Discussion:
 *    This routine tries to fetch the next event of a specified type.
 *    If no events in the event queue match, this routine will run the
 *    current event loop until an event that matches arrives, or the
 *    timeout expires. Except for timers firing, your application is
 *    blocked waiting for events to arrive when inside this function.
 *
 *  Parameters:
 *
 *    inNumTypes:
 *      The number of event types we are waiting for (0 if any event
 *      should cause this routine to return).
 *
 *    inList:
 *      The list of event types we are waiting for (pass NULL if any
 *      event should cause this routine to return).
 *
 *    inTimeout:
 *      The time to wait (passing kEventDurationForever is preferred).
 *
 *    inPullEvent:
 *      Pass true for this parameter to actually remove the next
 *      matching event from the queue.
 *
 *    outEvent:
 *      The next event that matches the list passed in. If inPullEvent
 *      is true, the event is owned by you, and you will need to
 *      release it when done.
 *
 *  Result:
 *    A result indicating whether an event was received, the timeout
 *    expired, or the current event loop was quit.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ReceiveNextEvent(inNumTypes: UInt32; inList: EventTypeSpecPtr; inTimeout: EventTimeout; inPullEvent: boolean; var outEvent: EventRef): OSStatus; external name '_ReceiveNextEvent';

{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{  ¥ Core event lifetime APIs                                                          }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}

type
    EventAttributes             = UInt32;
const
    kEventAttributeNone         = 0;
    kEventAttributeUserEvent    = $01;

    {
     *  [Mac]CreateEvent()
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.1 and later
     *    Mac OS X:         in version 10.0 and later
        }
function CreateEvent(inAllocator: CFAllocatorRef; inClassID: UInt32; kind: UInt32; when: EventTime; flags: EventAttributes; var outEvent: EventRef): OSStatus; external name '_CreateEvent';

{
 *  CopyEvent()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CopyEvent(inOther: EventRef): EventRef; external name '_CopyEvent';

{
 *  RetainEvent()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function RetainEvent(inEvent: EventRef): EventRef; external name '_RetainEvent';

{
 *  GetEventRetainCount()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetEventRetainCount(inEvent: EventRef): UInt32; external name '_GetEventRetainCount';

{
 *  ReleaseEvent()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure ReleaseEvent(inEvent: EventRef); external name '_ReleaseEvent';

{
 *  SetEventParameter()
 *
 *  Discussion:
 *    Sets a piece of data for the given event.
 *
 *  Parameters:
 *
 *    inEvent:
 *      The event to set the data for.
 *
 *    inName:
 *      The symbolic name of the parameter.
 *
 *    inType:
 *      The symbolic type of the parameter.
 *
 *    inSize:
 *      The size of the parameter data.
 *
 *    inDataPtr:
 *      The pointer to the parameter data.
 *
 *  Result:
 *    An operating system result code.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetEventParameter(inEvent: EventRef; inName: EventParamName; inType: EventParamType; inSize: UInt32; inDataPtr: UnivPtr): OSStatus; external name '_SetEventParameter';


{
 *  GetEventParameter()
 *
 *  Discussion:
 *    Gets a piece of data from the given event, if it exists.
 *
 *  Parameters:
 *
 *    inEvent:
 *      The event to get the parameter from.
 *
 *    inName:
 *      The symbolic name of the parameter.
 *
 *    inDesiredType:
 *      The desired type of the parameter. At present we do not support
 *      coercion, so this parameter must be the actual type of data
 *      stored in the event, or an error will be returned.
 *
 *    outActualType:
 *      The actual type of the parameter, can be NULL if you are not
 *      interested in receiving this information.
 *
 *    inBufferSize:
 *      The size of the output buffer specified by ioBuffer.
 *
 *    outActualSize:
 *      The actual size of the data, or NULL if you don't want this
 *      information.
 *
 *    outData:
 *      The pointer to the buffer which will receive the parameter data.
 *
 *  Result:
 *    An operating system result code.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetEventParameter(inEvent: EventRef; inName: EventParamName; inDesiredType: EventParamType; outActualType: EventParamTypePtr; inBufferSize: UInt32; outActualSize: UInt32Ptr; outData: UnivPtr): OSStatus; external name '_GetEventParameter';


{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{  ¥ Getters for 'base-class' event info                                               }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{
 *  GetEventClass()
 *
 *  Discussion:
 *    Returns the class of the given event, such as mouse, keyboard,
 *    etc.
 *
 *  Parameters:
 *
 *    inEvent:
 *      The event in question.
 *
 *  Result:
 *    The class ID of the event.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetEventClass(inEvent: EventRef): UInt32; external name '_GetEventClass';

{
 *  GetEventKind()
 *
 *  Discussion:
 *    Returns the kind of the given event (mousedown, etc.). Event
 *    kinds overlap between event classes, e.g. kEventMouseDown and
 *    kEventAppActivated have the same value (1). The combination of
 *    class and kind is what determines an event signature.
 *
 *  Parameters:
 *
 *    inEvent:
 *      The event in question.
 *
 *  Result:
 *    The kind of the event.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetEventKind(inEvent: EventRef): UInt32; external name '_GetEventKind';

{
 *  GetEventTime()
 *
 *  Discussion:
 *    Returns the time the event specified occurred, specified in
 *    EventTime, which is a floating point number representing seconds
 *    since the last system startup.
 *
 *  Parameters:
 *
 *    inEvent:
 *      The event in question.
 *
 *  Result:
 *    The time the event occurred.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetEventTime(inEvent: EventRef): EventTime; external name '_GetEventTime';

{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{  ¥ Setters for 'base-class' event info                                               }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}

{
 *  SetEventTime()
 *
 *  Discussion:
 *    This routine allows you to set the time of a given event, if you
 *    so desire. In general, you would never use this routine, except
 *    for those special cases where you reuse an event from time to
 *    time instead of creating a new event each time.
 *
 *  Parameters:
 *
 *    inEvent:
 *      The event in question.
 *
 *    inTime:
 *      The new time.
 *
 *  Result:
 *    An operating system result code.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetEventTime(inEvent: EventRef; inTime: EventTime): OSStatus; external name '_SetEventTime';

{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{  ¥ Event Queue routines (posting, finding, flushing)                                 }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}


type
    EventQueueRef    = ^SInt32; { an opaque 32-bit type }
    EventQueueRefPtr = ^EventQueueRef;  { when a var xx:EventQueueRef parameter can be nil, it is changed to xx: EventQueueRefPtr }
    {
     *  GetCurrentEventQueue()
     *
     *  Discussion:
     *    Returns the current event queue for the current thread. If the
     *    current thread is a cooperative thread, the main event queue is
     *    returned.
     *
     *  Result:
     *    An event queue reference.
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.1 and later
     *    Mac OS X:         in version 10.0 and later
        }
function GetCurrentEventQueue: EventQueueRef; external name '_GetCurrentEventQueue';

{
 *  GetMainEventQueue()
 *
 *  Discussion:
 *    Returns the event queue object for the main application thread.
 *
 *  Result:
 *    An event queue reference.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetMainEventQueue: EventQueueRef; external name '_GetMainEventQueue';


{
 *  EventComparatorProcPtr
 *
 *  Discussion:
 *    Type of a callback function used by queue searches.
 *
 *  Parameters:
 *
 *    inEvent:
 *      The event to compare.
 *
 *    inCompareData:
 *      The data used to compare the event.
 *
 *  Result:
 *    A boolean value indicating whether the event matches (true) or
 *    not (false).
 }

type
    EventComparatorProcPtr = function(inEvent: EventRef; inCompareData: UnivPtr): boolean;

    EventComparatorUPP = ^SInt32; { an opaque UPP }

const
    uppEventComparatorProcInfo = $000003D0;
    {
     *  NewEventComparatorUPP()
     *
     *  Availability:
     *    Non-Carbon CFM:   available as macro/inline
     *    CarbonLib:        in CarbonLib 1.1 and later
     *    Mac OS X:         in version 10.0 and later
        }
function NewEventComparatorUPP(userRoutine: EventComparatorProcPtr): EventComparatorUPP; external name '_NewEventComparatorUPP'; { old name was NewEventComparatorProc }
{
 *  DisposeEventComparatorUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeEventComparatorUPP(userUPP: EventComparatorUPP); external name '_DisposeEventComparatorUPP';
{
 *  InvokeEventComparatorUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeEventComparatorUPP(inEvent: EventRef; inCompareData: UnivPtr; userRoutine: EventComparatorUPP): boolean; external name '_InvokeEventComparatorUPP'; { old name was CallEventComparatorProc }
{
 *  PostEventToQueue()
 *
 *  Discussion:
 *    Posts an event to the queue specified. This automatically wakes
 *    up the event loop of the thread the queue belongs to. After
 *    posting the event, you should release the event. The event queue
 *    retains it.
 *
 *  Parameters:
 *
 *    inQueue:
 *      The event queue to post the event onto.
 *
 *    inEvent:
 *      The event to post.
 *
 *    inPriority:
 *      The priority of the event.
 *
 *  Result:
 *    An operating system result code.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PostEventToQueue(inQueue: EventQueueRef; inEvent: EventRef; inPriority: EventPriority): OSStatus; external name '_PostEventToQueue';

{
 *  FlushEventsMatchingListFromQueue()
 *
 *  Discussion:
 *    Flushes events matching a specified list of classes and kinds
 *    from an event queue.
 *
 *  Parameters:
 *
 *    inQueue:
 *      The event queue to flush events from.
 *
 *    inNumTypes:
 *      The number of event kinds to flush.
 *
 *    inList:
 *      The list of event classes and kinds to flush from the queue.
 *
 *  Result:
 *    An operating system result code.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FlushEventsMatchingListFromQueue(inQueue: EventQueueRef; inNumTypes: UInt32; inList: EventTypeSpecPtr): OSStatus; external name '_FlushEventsMatchingListFromQueue';

{
 *  FlushSpecificEventsFromQueue()
 *
 *  Discussion:
 *    Flushes events that match a comparator function.
 *
 *  Parameters:
 *
 *    inQueue:
 *      The event queue to flush events from.
 *
 *    inComparator:
 *      The comparison function to invoke for each event in the queue.
 *
 *    inCompareData:
 *      The data you wish to pass to your comparison function.
 *
 *  Result:
 *    An operating system result code.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FlushSpecificEventsFromQueue(inQueue: EventQueueRef; inComparator: EventComparatorUPP; inCompareData: UnivPtr): OSStatus; external name '_FlushSpecificEventsFromQueue';

{
 *  FlushEventQueue()
 *
 *  Discussion:
 *    Flushes all events from an event queue.
 *
 *  Parameters:
 *
 *    inQueue:
 *      The event queue to flush.
 *
 *  Result:
 *    An operating system result code.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FlushEventQueue(inQueue: EventQueueRef): OSStatus; external name '_FlushEventQueue';

{
 *  FindSpecificEventInQueue()
 *
 *  Discussion:
 *    Returns the first event that matches a comparator function, or
 *    NULL if no events match.
 *
 *  Parameters:
 *
 *    inQueue:
 *      The event queue to search.
 *
 *    inComparator:
 *      The comparison function to invoke for each event in the queue.
 *
 *    inCompareData:
 *      The data you wish to pass to your comparison function.
 *
 *  Result:
 *    An event reference. The event is still in the queue when
 *    FindSpecificEventInQueue returns; you can remove it from the
 *    queue with RemoveEventFromQueue. The returned event does not need
 *    to be released by the caller.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FindSpecificEventInQueue(inQueue: EventQueueRef; inComparator: EventComparatorUPP; inCompareData: UnivPtr): EventRef; external name '_FindSpecificEventInQueue';

{
 *  GetNumEventsInQueue()
 *
 *  Discussion:
 *    Returns the number of events in an event queue.
 *
 *  Parameters:
 *
 *    inQueue:
 *      The event queue to query.
 *
 *  Result:
 *    The number of items in the queue.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetNumEventsInQueue(inQueue: EventQueueRef): UInt32; external name '_GetNumEventsInQueue';

{
 *  RemoveEventFromQueue()
 *
 *  Discussion:
 *    Removes the given event from the queue which it was posted. When
 *    you call this function, the event ownership is transferred to
 *    you, the caller, at no charge. You must release the event when
 *    you are through with it.
 *
 *  Parameters:
 *
 *    inQueue:
 *      The queue to remove the event from.
 *
 *    inEvent:
 *      The event to remove.
 *
 *  Result:
 *    An operating system result code.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function RemoveEventFromQueue(inQueue: EventQueueRef; inEvent: EventRef): OSStatus; external name '_RemoveEventFromQueue';

{
 *  IsEventInQueue()
 *
 *  Discussion:
 *    Returns true if the specified event is posted to a queue.
 *
 *  Parameters:
 *
 *    inQueue:
 *      The queue to check.
 *
 *    inEvent:
 *      The event in question.
 *
 *  Result:
 *    A boolean value.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function IsEventInQueue(inQueue: EventQueueRef; inEvent: EventRef): boolean; external name '_IsEventInQueue';

{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{  ¥ Helpful utilities                                                                 }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}

{
 *  GetCurrentEventTime()
 *
 *  Discussion:
 *    Returns the current time since last system startup in seconds.
 *
 *  Result:
 *    EventTime.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetCurrentEventTime: EventTime; external name '_GetCurrentEventTime';

{
 *  IsUserCancelEventRef()
 *
 *  Discussion:
 *    Tests the event given to see whether the event represents a 'user
 *    cancel' event. Currently this is defined to be either the escape
 *    key being pressed, or command-period being pressed.
 *
 *  Result:
 *    A boolean value indicating whether the event is a user cancel
 *    event.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function IsUserCancelEventRef(event: EventRef): boolean; external name '_IsUserCancelEventRef';

{
 *  TrackMouseLocation()
 *
 *  Discussion:
 *    Once entered, this routine waits for certain mouse events (move,
 *    mouse down, mouse up). When one of these events occurs, the
 *    function returns and tells the caller what happened and where the
 *    mouse is currently located. While there is no activity, the
 *    current event loop is run, effectively blocking the current
 *    thread (save for any timers that fire). This helps to minimize
 *    CPU usage when there is nothing going on.
 *
 *    On Mac OS X 10.1 and earlier, and CarbonLib 1.5 and earlier,
 *    TrackMouseLocation, TrackMouseLocationWithOptions, and
 *    TrackMouseRegion only support mouse-tracking when a mouse button
 *    is pressed. They cannot be used for mouse-tracking when no mouse
 *    button is pressed; if called when no button is pressed, they will
 *    simply block until a button is pressed and will not return when
 *    the mouse is moved. On Mac OS X after 10.1 and CarbonLib after
 *    1.5, TrackMouseLocation, TrackMouseLocationWithOptions, and
 *    TrackMouseRegion support mouse-tracking without a pressed mouse
 *    button; TrackMouseLocation and TrackMouseLocationWithOptions
 *    return kMouseTrackingMouseMoved if the mouse is moved while no
 *    button is pressed, and TrackMouseRegion returns
 *    kMouseTrackingMouseEntered/Exited if the mouse moves into or out
 *    of the specified region while no button is pressed.
 *
 *  Parameters:
 *
 *    inPort:
 *      The grafport to consider for mouse coordinates. You can pass
 *      NULL for this parameter to indicate the current port. The mouse
 *      location is returned in terms of local coordinates of this
 *      port. You can pass -1 for this parameter to indicate that the
 *      mouse location should be returned in global coordinates instead
 *      of local coordinates.
 *
 *    outPt:
 *      On exit, this parameter receives the mouse location from the
 *      last mouse event that caused this function to exit.
 *
 *    outResult:
 *      On exit, this parameter receives a value representing what kind
 *      of event was received that cause the function to exit, such as
 *      kMouseTrackingMouseUp.
 *
 *  Result:
 *    An operating system result code.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TrackMouseLocation(inPort: GrafPtr; var outPt: Point; var outResult: MouseTrackingResult): OSStatus; external name '_TrackMouseLocation';

{
 *  TrackMouseLocationWithOptions()
 *
 *  Discussion:
 *    This routine is largely identical to TrackMouseLocation. Please
 *    read the notes on that function as well.
 *    TrackMouseLocationWithOptions supports additional parameters for
 *    leaving mouse-up events in the event queue, specifying a timeout,
 *    and retrieving the current mouse position and keyboard modifiers.
 *
 *  Parameters:
 *
 *    inPort:
 *      The grafport to consider for mouse coordinates. You can pass
 *      NULL for this parameter to indicate the current port. The mouse
 *      location is returned in terms of local coordinates of this
 *      port. You can pass -1 for this parameter to indicate that the
 *      mouse location should be returned in global coordinates instead
 *      of local coordinates.
 *
 *    inOptions:
 *      The only option supported by this routine at present is
 *      kTrackMouseLocationOptionDontConsumeMouseUp, which indicates
 *      that the toolbox should leave mouse-up events in the queue. You
 *      may also pass zero for this parameter to get the default
 *      behavior, which is to remove mouse-up events from the queue
 *      before returning.
 *
 *    inTimeout:
 *      The amount of time to wait for an event. If no events arrive
 *      within this time, kMouseTrackingTimedOut is returned in
 *      outResult.
 *
 *    outPt:
 *      On exit, this parameter receives the mouse location from the
 *      last mouse event that caused this function to exit. If a
 *      timeout or key modifiers changed event caused this function to
 *      exit, the current mouse position at the time is returned.
 *
 *    outModifiers:
 *      On exit, this parameter receives the most recent state of the
 *      keyboard modifiers. If a timeout caused this function to exit,
 *      the current keyboard modifiers at the time are returned.
 *
 *    outResult:
 *      On exit, this parameter receives a value representing what kind
 *      of event was received that cause the function to exit, such as
 *      kMouseTrackingMouseUp.
 *
 *  Result:
 *    An operating system result code.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TrackMouseLocationWithOptions(inPort: GrafPtr; inOptions: OptionBits; inTimeout: EventTimeout; var outPt: Point; outModifiers: UInt32Ptr; var outResult: MouseTrackingResult): OSStatus; external name '_TrackMouseLocationWithOptions';

{
 *  TrackMouseRegion()
 *
 *  Discussion:
 *    This routine is largely identical to TrackMouseLocation. Please
 *    read the notes on that function as well. TrackMouseRegion differs
 *    from TrackMouseLocation by only returning when the mouse enters
 *    or exits a specified region that you pass in to the function, as
 *    opposed to whenever the mouse moves (it also returns for mouse
 *    up/down events). This is useful if you don't need to know
 *    intermediate mouse events, but rather just if the mouse enters or
 *    leaves an area.
 *
 *  Parameters:
 *
 *    inPort:
 *      The grafport to consider for mouse coordinates. You can pass
 *      NULL for this parameter to indicate the current port. You can
 *      pass -1 for this parameter to indicate that the mouse region
 *      should be interpreted in global coordinates instead of local
 *      coordinates.
 *
 *    inRegion:
 *      The region to consider. This should be in the coordinates of
 *      the port you passed to inPort, or global coordinates if you
 *      passed -1 for the inPort parameter.
 *
 *    ioWasInRgn:
 *      On entry, this parameter should be set to true if the mouse is
 *      currently inside the region passed in inRegion, or false if the
 *      mouse is currently outside the region. On exit, this parameter
 *      is updated to reflect the current reality; e.g. if the
 *      outResult parameter returns kMouseTrackingMouseExited,
 *      ioWasInRgn will be set to false when this function exits.
 *      Because it is updated from within, you should only need to set
 *      this yourself before the first call to this function in your
 *      tracking loop.
 *
 *    outResult:
 *      On exit, this parameter receives a value representing what kind
 *      of event was received that cause the function to exit, such as
 *      kMouseTrackingMouseEntered.
 *
 *  Result:
 *    An operating system result code.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TrackMouseRegion(inPort: GrafPtr; inRegion: RgnHandle; var ioWasInRgn: boolean; var outResult: MouseTrackingResult): OSStatus; external name '_TrackMouseRegion';

 {
 *  Summary:
 *    Mouse tracking info selectors for HIMouseTrackingGetParameters.
 }

   {
   * Requests the time and distance for determining ÒstickyÓ mouse
   * tracking. When the mouse is clicked on a menu title, the toolbox
   * will enter a sticky mouse-tracking mode depending on the time and
   * distance between the mouse-down event and the mouse-up event. In
   * this mode, the menu is tracked even though the mouse has already
   * been released.
   }
  const
    kMouseParamsSticky            = $73746963 (* 'stic' *);

 {
 *  HIMouseTrackingGetParameters()
 *
 *  Summary:
 *    Returns information about how mouse tracking loops should behave.
 *
 *  Discussion:
 *    Mouse tracking loops may use different timeouts and wander
 *    distances to determine their behavior. This API provides a
 *    generic service for requesting this information. Currently, the
 *    only supported selector is kMouseParamsSticky.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inSelector:
 *      Indicates which type of information should be returned.
 *
 *    outTime:
 *      If selector is kMouseParamsSticky, returns the maximum time
 *      between mouse-down and mouse-up. If the time between events is
 *      longer than this value, sticky mode should not be invoked. May
 *      be NULL if this information is not required.
 *
 *    outDistance:
 *      If selector is kMouseParamsSticky, returns the maximum distance
 *      between mouse-down and mouse-up. If the distance between events
 *      is longer than this value, sticky mode should not be invoked.
 *      May be NULL if this information is not required.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function HIMouseTrackingGetParameters( inSelector: OSType; outTime: EventTimePtr; outDistance: HISizePtr ): OSStatus; external name '_HIMouseTrackingGetParameters';


{
 *  ConvertEventRefToEventRecord()
 *
 *  Discussion:
 *    This is a convenience routine to help you if there are places in
 *    your application where you need an EventRecord and all you have
 *    is an EventRef. If the event can be converted, outEvent is filled
 *    in and the function returns true. If not, false is returned and
 *    outEvent will contain a nullEvent.
 *
 *  Parameters:
 *
 *    inEvent:
 *      The EventRef to convert into an EventRecord.
 *
 *    outEvent:
 *      The EventRecord to fill out.
 *
 *  Result:
 *    A boolean indicating if the conversion was successful (true) or
 *    not (false).
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ConvertEventRefToEventRecord(inEvent: EventRef; var outEvent: EventRecord): boolean; external name '_ConvertEventRefToEventRecord';

{
 *  IsEventInMask()
 *
 *  Discussion:
 *    This is a companion function for ConvertEventRefToEventRecord,
 *    and is provided as a convenience routine to help you if there are
 *    places in your application where you want to check an EventRef to
 *    see if it matches a classic EventMask bitfield. If the event
 *    matches, the function returns true.
 *
 *  Parameters:
 *
 *    inEvent:
 *      The EventRef to convert into an EventRecord.
 *
 *    inMask:
 *      The mask to consider.
 *
 *  Result:
 *    A boolean indicating if the event was considered to be in the
 *    mask provided.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function IsEventInMask(inEvent: EventRef; inMask: EventMask): boolean; external name '_IsEventInMask';

{
 *  GetLastUserEventTime()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetLastUserEventTime: EventTime; external name '_GetLastUserEventTime';

{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{  ¥ Mouse Coalescing                                                                  }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{
 *  IsMouseCoalescingEnabled()
 *
 *  Discussion:
 *    Returns true if mouse coalescing is current enabled. When
 *    enabled, we coalesce mouse moved and mouse dragged events. By
 *    default, coalescing is on, but you can use
 *    SetMouseCoalescingEnabled to disable it if you want finer-grained
 *    mouse movement events, which is useful for drawing with tablets.
 *
 *  Result:
 *    A boolean indicating if coalescing is enabled.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.1 and later
 *    Mac OS X:         in version 10.1 and later
 }
function IsMouseCoalescingEnabled: boolean; external name '_IsMouseCoalescingEnabled';

{
 *  SetMouseCoalescingEnabled()
 *
 *  Discussion:
 *    Allows you to set mouse move/drag event coalescing on or off. By
 *    default, coalescing is on, but you can use this function to
 *    disable it if you want finer-grained mouse movement events, which
 *    is useful for drawing with tablets.
 *
 *  Parameters:
 *
 *    inNewState:
 *      A boolean indicating if coalescing should be enabled (true) or
 *      disabled (false).
 *
 *    outOldState:
 *      A boolean which receives the prior state of mouse coalescing
 *      for restoration later. You can pass NULL for this parameter if
 *      you don't care.
 *
 *  Result:
 *    An operating system status result.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.1 and later
 *    Mac OS X:         in version 10.1 and later
 }
function SetMouseCoalescingEnabled(inNewState: boolean; outOldState: BooleanPtr): OSStatus; external name '_SetMouseCoalescingEnabled';


{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{  ¥ Timers                                                                            }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}

{
 *  EventLoopTimerRef
 *
 *  Discussion:
 *    An EventLoopTimerRef represents what we term a 'timer'. A timer
 *    is a function that is called either once or at regular intervals.
 *    It executes at task level and should not be confused with Time
 *    Manager Tasks or any other interrupt-level callback. This means
 *    you can call Toolbox routines, allocate memory and draw. When a
 *    timer 'fires', it calls a callback that you specify when the
 *    timer is installed. Timers in general have two uses - as a
 *    timeout mechanism and as a periodic task. An everyday example of
 *    using a timer for a timeout might be a light that goes out if no
 *    motion is detected in a room for 5 minutes. For this, you might
 *    install a timer which will fire in 5 minutes. If motion is
 *    detected, you would reset the timer fire time and let the clock
 *    start over. If no motion is detected for the full 5 minutes, the
 *    timer will fire and you could power off the light. A periodic
 *    timer is one that fires at regular intervals (say every second or
 *    so). You might use such a timer to blink the insertion point in
 *    your editor, etc. One advantage of timers is that you can install
 *    the timer right from the code that wants the time. For example,
 *    the standard Toolbox Edit Text control can install a timer to
 *    blink the cursor when it's active, meaning that IdleControls is a
 *    no-op for that control and doesn't need to be called. When the
 *    control is inactive, it removes its timer and doesn't waste CPU
 *    time in that state. NOTE: Currently, if you do decide to draw
 *    when your timer is called, be sure to save and restore the
 *    current port so that calling your timer doesn't inadvertently
 *    change the port out from under someone.
 }

type
    EventLoopTimerRef    = ^SInt32; { an opaque 32-bit type }
    EventLoopTimerRefPtr = ^EventLoopTimerRef;  { when a var xx:EventLoopTimerRef parameter can be nil, it is changed to xx: EventLoopTimerRefPtr }

    {
     *  EventLoopTimerProcPtr
     *
     *  Discussion:
     *    Called when a timer fires.
     *
     *  Parameters:
     *
     *    inTimer:
     *      The timer that fired.
     *
     *    inUserData:
     *      The data passed into InstallEventLoopTimer.
        }
    EventLoopTimerProcPtr = procedure(inTimer: EventLoopTimerRef; inUserData: UnivPtr);

    EventLoopTimerUPP = ^SInt32; { an opaque UPP }

const
    uppEventLoopTimerProcInfo = $000003C0;
    {
     *  NewEventLoopTimerUPP()
     *
     *  Availability:
     *    Non-Carbon CFM:   available as macro/inline
     *    CarbonLib:        in CarbonLib 1.1 and later
     *    Mac OS X:         in version 10.0 and later
        }
function NewEventLoopTimerUPP(userRoutine: EventLoopTimerProcPtr): EventLoopTimerUPP; external name '_NewEventLoopTimerUPP'; { old name was NewEventLoopTimerProc }
{
 *  DisposeEventLoopTimerUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeEventLoopTimerUPP(userUPP: EventLoopTimerUPP); external name '_DisposeEventLoopTimerUPP';
{
 *  InvokeEventLoopTimerUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvokeEventLoopTimerUPP(inTimer: EventLoopTimerRef; inUserData: UnivPtr; userRoutine: EventLoopTimerUPP); external name '_InvokeEventLoopTimerUPP'; { old name was CallEventLoopTimerProc }
{
 *  InstallEventLoopTimer()
 *
 *  Discussion:
 *    Installs a timer onto the event loop specified. The timer can
 *    either fire once or repeatedly at a specified interval depending
 *    on the parameters passed to this function.
 *
 *  Parameters:
 *
 *    inEventLoop:
 *      The event loop to add the timer.
 *
 *    inFireDelay:
 *      The delay before first firing this timer (can be 0, to request
 *      that the timer be fired as soon as control returns to your
 *      event loop). In Mac OS X and CarbonLib 1.5 and later, you may
 *      pass kEventDurationForever to stop the timer from firing at all
 *      until SetEventLoopTimerNextFireTime is used to start it; in
 *      earlier CarbonLibs, to achieve the same effect, just pass zero
 *      and then immediately call SetEventLoopTimerNextFireTime( timer,
 *      kEventDurationForever ) before returning control to your event
 *      loop.
 *
 *    inInterval:
 *      The timer interval (pass 0 for a one-shot timer, which executes
 *      once but does not repeat). In Mac OS X and CarbonLib 1.5 and
 *      later, you may also pass kEventDurationForever to create a
 *      one-shot timer.
 *
 *    inTimerProc:
 *      The routine to call when the timer fires.
 *
 *    inTimerData:
 *      Data to pass to the timer proc when called.
 *
 *    outTimer:
 *      A reference to the newly installed timer.
 *
 *  Result:
 *    An operating system status code.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InstallEventLoopTimer(inEventLoop: EventLoopRef; inFireDelay: EventTimerInterval; inInterval: EventTimerInterval; inTimerProc: EventLoopTimerUPP; inTimerData: UnivPtr; var outTimer: EventLoopTimerRef): OSStatus; external name '_InstallEventLoopTimer';


{
 *  RemoveEventLoopTimer()
 *
 *  Discussion:
 *    Removes a timer that was previously installed by a call to
 *    InstallEventLoopTimer. You call this function when you are done
 *    using a timer.
 *
 *  Parameters:
 *
 *    inTimer:
 *      The timer to remove.
 *
 *  Result:
 *    An operating system status code.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function RemoveEventLoopTimer(inTimer: EventLoopTimerRef): OSStatus; external name '_RemoveEventLoopTimer';

{
 *  SetEventLoopTimerNextFireTime()
 *
 *  Discussion:
 *    This routine is used to 'reset' a timer. It controls the next
 *    time the timer fires. This will override any interval you might
 *    have set. For example, if you have a timer that fires every
 *    second, and you call this function setting the next time to five
 *    seconds from now, the timer will sleep for five seconds, then
 *    fire. It will then resume its one-second interval after that. It
 *    is as if you removed the timer and reinstalled it with a new
 *    first-fire delay.
 *
 *  Parameters:
 *
 *    inTimer:
 *      The timer to adjust
 *
 *    inNextFire:
 *      The interval from the current time to wait until firing the
 *      timer again. You may pass kEventDurationForever to stop the
 *      timer from firing at all.
 *
 *  Result:
 *    An operating system status code.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetEventLoopTimerNextFireTime(inTimer: EventLoopTimerRef; inNextFire: EventTimerInterval): OSStatus; external name '_SetEventLoopTimerNextFireTime';

{======================================================================================}
{  EVENT CLASSES                                                                       }
{======================================================================================}

{
 *  Discussion:
 *    Event classes
 }

const
    kEventClassMouse              = $6D6F7573 (* 'mous' *); { Events related to the mouse (mouse down/up/moved). }
    kEventClassKeyboard           = $6B657962 (* 'keyb' *); { Events related to the keyboard. }
    kEventClassTextInput          = $74657874 (* 'text' *); { Events related to text input (by keyboard, or by input method). }
    kEventClassApplication        = $6170706C (* 'appl' *); { Application-level events (launch, quit, etc.). }
    kEventClassAppleEvent         = $65707063 (* 'eppc' *); { Apple Events. }
    kEventClassMenu               = $6D656E75 (* 'menu' *); { Events related to menus. }
    kEventClassWindow             = $77696E64 (* 'wind' *); { Events related to windows. }
    kEventClassControl            = $636E746C (* 'cntl' *); { Events related to controls. }
    kEventClassCommand            = $636D6473 (* 'cmds' *); { Events related to commands generated by menu items or controls. These events contain HICommand structures. }
    kEventClassTablet             = $74626C74 (* 'tblt' *); { Events related to tablets. }
    kEventClassVolume             = $766F6C20 (* 'vol ' *); { Events related to File Manager volumes. }
    kEventClassAppearance         = $6170706D (* 'appm' *); { Events related to the Appearance Manager. }
    kEventClassService            = $73657276 (* 'serv' *); { Events related to the Services Manager. }
    kEventClassToolbar            = $74626172 (* 'tbar' *); { Events related to toolbars. }
    kEventClassToolbarItem        = $74626974 (* 'tbit' *); { Events related to toolbar items. }
    kEventClassToolbarItemView    = $74626976 (* 'tbiv' *); { Events related to toolbar item views. }
    kEventClassAccessibility      = $61636365 (* 'acce' *); { Events related to application accessibility. }
    kEventClassSystem             = $6D616373 (* 'macs' *); { Events related to the system. }
    kEventClassInk                = $696E6B20 (* 'ink ' *); { Events related to Ink. }
    kEventClassTSMDocumentAccess  = $74646163 (* 'tdac' *); { Events related to Ink. }

    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {    Mouse Events                                                                           }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {    Mouse Events   }

    {
     *  Discussion:
     *    Mouse events (kEventClassMouse)
        }
    kEventMouseDown             = 1;
    kEventMouseUp               = 2;
    kEventMouseMoved            = 5;
    kEventMouseDragged          = 6;
    kEventMouseEntered            = 8;
    kEventMouseExited             = 9;
    kEventMouseWheelMoved       = 10;


type
    {
        Parameters for mouse events:

        kEventMouseDown
            -->     kEventParamMouseLocation    typeHIPoint
            -->     kEventParamKeyModifiers     typeUInt32
            -->     kEventParamMouseButton      typeMouseButton
            -->     kEventParamClickCount       typeUInt32
            -->     kEventParamMouseChord       typeUInt32  (Mac OS X only)
            -->     kEventParamTabletEventType  typeUInt32  (Mac OS X 10.1, CarbonLib 1.5, and later)
            -->     kEventParamTabletPointRec   typeTabletPointRec          (if kEventParamTabletEventType is kEventTabletPoint)
            -->     kEventParamTabletProximityRec typeTabletProximityRec    (if kEventParamTabletEventType is kEventTabletProximity)

        kEventMouseUp
            -->     kEventParamMouseLocation    typeHIPoint
            -->     kEventParamKeyModifiers     typeUInt32
            -->     kEventParamMouseButton      typeMouseButton
            -->     kEventParamClickCount       typeUInt32
            -->     kEventParamMouseChord       typeUInt32  (Mac OS X only)
            -->     kEventParamTabletEventType  typeUInt32  (Mac OS X 10.1, CarbonLib 1.5, and later)
            -->     kEventParamTabletPointRec   typeTabletPointRec          (if kEventParamTabletEventType is kEventTabletPoint)
            -->     kEventParamTabletProximityRec typeTabletProximityRec    (if kEventParamTabletEventType is kEventTabletProximity)

        kEventMouseMoved
            -->     kEventParamMouseLocation    typeHIPoint
            -->     kEventParamMouseDelta       typeHIPoint (Mac OS X only)
            -->     kEventParamKeyModifiers     typeUInt32
            -->     kEventParamTabletEventType  typeUInt32  (Mac OS X 10.1, CarbonLib 1.5, and later)
            -->     kEventParamTabletPointRec   typeTabletPointRec          (if kEventParamTabletEventType is kEventTabletPoint)
            -->     kEventParamTabletProximityRec typeTabletProximityRec    (if kEventParamTabletEventType is kEventTabletProximity)

        kEventMouseDragged
            -->     kEventParamMouseLocation    typeHIPoint
            -->     kEventParamMouseDelta       typeHIPoint (Mac OS X only)
            -->     kEventParamKeyModifiers     typeUInt32
            -->     kEventParamMouseButton      typeMouseButton
            -->     kEventParamMouseChord       typeUInt32  (Mac OS X only)
            -->     kEventParamTabletEventType  typeUInt32  (Mac OS X 10.1, CarbonLib 1.5, and later)
            -->     kEventParamTabletPointRec   typeTabletPointRec          (if kEventParamTabletEventType is kEventTabletPoint)
            -->     kEventParamTabletProximityRec typeTabletProximityRec    (if kEventParamTabletEventType is kEventTabletProximity)

        kEventMouseWheelMoved
            -->     kEventParamMouseLocation    typeHIPoint
            -->     kEventParamKeyModifiers     typeUInt32
            -->     kEventParamMouseWheelAxis   typeMouseWheelAxis
            -->     kEventParamMouseWheelDelta  typeLongInteger
        }

    {
     *  EventMouseButton
     *
        }
    EventMouseButton            = UInt16;
const
    kEventMouseButtonPrimary    = 1;
    kEventMouseButtonSecondary  = 2;
    kEventMouseButtonTertiary   = 3;



    {
     *  EventMouseWheelAxis
     *
        }

type
    EventMouseWheelAxis         = UInt16;
const
    kEventMouseWheelAxisX       = 0;
    kEventMouseWheelAxisY       = 1;


{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{ TSM Document Access Events                                                           }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{
    kEventClassTSMDocumentAccess quick reference:

    ** Text Access **
    kEventTSMDocumentAccessGetLength                        = 1,
    kEventTSMDocumentAccessGetSelectedRange                 = 2,
    kEventTSMDocumentAccessGetCharactersPtr                 = 3,
    kEventTSMDocumentAccessGetCharactersPtrForLargestBuffer = 4,
    kEventTSMDocumentAccessGetCharacters                    = 5,

    ** Text Attribute Access **
    kEventTSMDocumentAccessGetFont                          = 6,
    kEventTSMDocumentAccessGetGlyphInfo                     = 7

    ** Transaction control **
    kEventTSMDocumentAccessLockDocument                     = 8,
    kEventTSMDocumentAccessUnlockDocument                   = 9

    These events allow access to a document's content.  They are grouped in the following
    categories: text access, text attribute, and transaction related events.

    NOTE:  TSM dispatches events of the TSMDocumentAccess class only as Carbon events.  These
            are not converted for TSM clients that still install AppleEvent handlers for TSM events.
    NOTE:  Text Services dispatch these Carbon events through TSM's SendTextInputEvent API.
            Normally only used for TextInput class TSM events, but this SendTextInputEvent is a bit
            of a misnomer.  You should use it for TSMDocumentAccess class events as well.
}
{

    ** Document Access Text events **

    The following Text Access events are very similar in design to the CFString API.
    The entire document can be conceived as a flattened Unicode string, and the
    events in this interface can access any portion of it.  The GetSelectedRange() method
    allow a text service to obtain text near the insertion point (or selection), but access
    is by no means restricted to this vicinity.  Use the GetLength() method to obtain the
    size of the document.

    Supporting these events effectively provide hooks into the text engine, but it is
    understood that access to a document in this way is to be strictly Read-Only.  Where
    direct access to a document's content cannot be provided through a pointer, the requested
    text can be copied instead.  Situations where a pointer may not be available from the
    text engine include the following:

        -A pointer would require conversion of text in Mac encodings to Unicode
        -A pointer would require sparse Unicode text blocks to be flattened into a single
         buffer.

    The idea is to minimize copying and converting text encodings where possible.  The text
    service will typically begin by asking for a document pointer via
    kEventTSMDocumentAccessGetCharactersPtr.  If this fails, it will typically fallback to
    kEventTSMDocumentAccessGetCharactersPtrForLargestBuffer, specifying a location of interest.
    If this fails, it will fallback to kEventTSMDocumentAccessGetCharacters, specifying a range
    of interest.  Of course, when requesting small amounts of data such a few characters on either
    side of the insertion point, there is no obligation to optimize in this way.  It's valid to
    simply use kEventTSMDocumentAccessGetCharacters.

    The text engine is entirely free to deny a request for a text pointer for these or any other
    implementation specific reason.
}
{
 *  kEventClassTSMDocumentAccess / kEventTSMDocumentAccessGetLength
 *
 *  Summary:
 *    Returns the number of 16-bit Unicode characters in the document.
 *
 *  Discussion:
 *    This event is equivalent to calling CFStringGetLength() on the
 *    app's document.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamTSMDocAccessSendComponentInstance (in, typeComponentInstance)
 *          This parameter is provided by the input method originating
 *          the event. (Required parameter)
 *
 *    --> kEventParamTSMDocAccessSendRefCon (in, typeLongInteger)
 *          TSM's SendTextInputEvent, called by an input method,
 *          inserts this parameter before dispatching the event to the
 *          user focus.  (Required Parameter)
 *
 *    <-- kEventParamTSMDocAccessCharacterCount (out, typeCFIndex)
 *          The size of the document in UniChar. Required reply
 *          parameter.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const kEventTSMDocumentAccessGetLength = 1;

{
 *  kEventClassTSMDocumentAccess / kEventTSMDocumentAccessGetSelectedRange
 *
 *  Summary:
 *    Returns the selection range in the document.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamTSMDocAccessSendComponentInstance (in, typeComponentInstance)
 *          This parameter is provided by the input method originating
 *          the event. (Required parameter)
 *
 *    --> kEventParamTSMDocAccessSendRefCon (in, typeLongInteger)
 *          TSM's SendTextInputEvent, called by an input method,
 *          inserts this parameter before dispatching the event to the
 *          user focus.  (Required Parameter)
 *
 *    <-- kEventParamTSMDocAccessReplyCharacterRange (out, typeCFRange)
 *          The selection range as a CFRange in UniChar.  If the
 *          selection is empty, the range identifies the insertion
 *          point and the range will specify a length of 0. Required
 *          reply parameter.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const kEventTSMDocumentAccessGetSelectedRange = 2;

{
 *  kEventClassTSMDocumentAccess / kEventTSMDocumentAccessGetCharactersPtr
 *
 *  Summary:
 *    Returns a Unicode pointer to the entire document content.
 *
 *  Discussion:
 *    This event is equivalent to calling CFStringGetCharactersPtr() on
 *    the app's document treated as a CFString. Some text engines may
 *    not support this event for reasons that are implementation
 *    dependent. For example, a text engine's backing store may consist
 *    of legacy encoding runs.  It may also consist of unflattened
 *    Unicode, stored as a B-tree of text blocks.  For such reasons, a
 *    text engine may reject a request for a pointer to a flattened
 *    Unicode buffer. It is also understood that text access through
 *    this pointer is to be strictly READ-ONLY.  Any changes to the
 *    document should be made through TSM TextInput events, such as
 *    kEventTextInputUpdateActiveInputArea or
 *    kEventTextInputUnicodeText. NOTE:  This pointer is valid only
 *    during a transaction surrounded by document lock/unlock events,
 *    or until an event causes the document to change, such as
 *    dispatching kEventTextInputUpdateActiveInputArea or
 *    kEventTextInputUnicodeText events, whichever occurs first.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamTSMDocAccessSendComponentInstance (in, typeComponentInstance)
 *          This parameter is provided by the input method originating
 *          the event. (Required parameter)
 *
 *    --> kEventParamTSMDocAccessSendRefCon (in, typeLongInteger)
 *          TSM's SendTextInputEvent, called by an input method,
 *          inserts this parameter before dispatching the event to the
 *          user focus.  (Required Parameter)
 *
 *    <-- kEventParamTSMDocAccessReplyCharactersPtr (out, typePtr)
 *          The UniChar pointer to the document. Required reply
 *          parameter, if the event is supported.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const kEventTSMDocumentAccessGetCharactersPtr = 3;

{
 *  kEventClassTSMDocumentAccess / kEventTSMDocumentAccessGetCharactersPtrForLargestBuffer
 *
 *  Summary:
 *    Returns a Unicode pointer to a portion of the document.
 *
 *  Discussion:
 *    This event is similar to calling CFStringGetCharactersPtr() on a
 *    portion of the app's document treated as a CFString, except that
 *    the substring is determined by the text engine. Some text engines
 *    may keep text in unflattened Unicode, stored as a B-tree of text
 *    blocks, for example.  In some cases, especially near locations
 *    such as the insertion point, the text engine may have cached a
 *    good chunk of text to which it can readily provide a pointer. A
 *    text engine may reject a request for such a pointer. It is also
 *    understood that text access through this pointer is to be
 *    strictly READ-ONLY.  Any changes to the document should be made
 *    through TSM TextInput events, such as
 *    kEventTextInputUpdateActiveInputArea or
 *    kEventTextInputUnicodeText. NOTE:  This pointer is valid only
 *    during a transaction surrounded by document lock/unlock, or until
 *    an event causes the document to change, such as dispatching
 *    kEventTextInputUpdateActiveInputArea or
 *    kEventTextInputUnicodeText events.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamTSMDocAccessSendComponentInstance (in, typeComponentInstance)
 *          This parameter is provided by the input method originating
 *          the event. (Required parameter)
 *
 *    --> kEventParamTSMDocAccessSendRefCon (in, typeLongInteger)
 *          TSM's SendTextInputEvent, called by an input method,
 *          inserts this parameter before dispatching the event to the
 *          user focus.  (Required Parameter)
 *
 *    --> kEventParamTSMDocAccessSendCharacterIndex (in, typeCFIndex)
 *          The location in the document for which the caller would
 *          like a pointer to a buffer of text that includes that
 *          location.    This buffer could be available from a cache
 *          due to recent interaction near that location, such as the
 *          insertion point. Required parameter.
 *
 *    <-- kEventParamTSMDocAccessReplyCharactersPtr (out, typePtr)
 *          The UniChar pointer to a portion of the document text.
 *          Required reply parameter, if the event is handled.
 *
 *    <-- kEventParamTSMDocAccessReplyCharacterRange (out, typeCFRange)
 *          The document-relative range of text represented by the
 *          returned text pointer. Required reply parameter, if the
 *          event is handled.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const kEventTSMDocumentAccessGetCharactersPtrForLargestBuffer = 4;

{
 *  kEventClassTSMDocumentAccess / kEventTSMDocumentAccessGetCharacters
 *
 *  Summary:
 *    Fills caller provided buffer with Unicode characters in the
 *    specified range.
 *
 *  Discussion:
 *    This event is equivalent to calling CFStringGetCharacters() on
 *    the app's document treated as a CFString.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamTSMDocAccessSendComponentInstance (in, typeComponentInstance)
 *          This parameter is provided by the input method originating
 *          the event. (Required parameter)
 *
 *    --> kEventParamTSMDocAccessSendRefCon (in, typeLongInteger)
 *          TSM's SendTextInputEvent, called by an input method,
 *          inserts this parameter before dispatching the event to the
 *          user focus.  (Required Parameter)
 *
 *    --> kEventParamTSMDocAccessSendCharacterRange (in, typeCFRange)
 *          The range of text that should be copied into the buffer
 *          provided by the caller. Required parameter.
 *
 *    --> kEventParamTSMDocAccessSendCharactersPtr (in, typePtr)
 *          A buffer provided by the caller to contain the specified
 *          range of UniChars.  This buffer is identical in usage to
 *          that of CFStringGetCharacters(). Required parameter.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const kEventTSMDocumentAccessGetCharacters = 5;

{

    ** Document Access Attribute events **

    The following Text Attribute events define how a text service can obtain certain attributes
    at text locations throughout an application's document.

    Currently, the only attributes supported by these events are font (and font size)
    via kEventTSMDocumentAccessGetFont and glyphID/CID info via kEventTSMDocumentAccessGetGlyphInfo.

    Where these attributes span multiple characters, effective ranges (over which
    the attribute is constant) are returned by the text engine.
}

{
 *  Summary:
 *    Values used TSMDocAccessAttributes bit field
 *
 *  Discussion:
 *    The following bit assignments are used for TSMDocAccessAttributes
 *    parameters. This parameter is used to specify desired (optional)
 *    attributes in the kEventTSMDocumentAccessGetFont and
 *    kEventTSMDocumentAccessGetGlyphInfo events. They are specified in
 *    the kEventParamTSMDocAccessRequestedCharacterAttributes parameter.
 }
  {
   * Font size information is desired.  Used in
   * kEventTSMDocumentAccessGetFont event.
   }
  const kTSMDocAccessFontSizeAttributeBit = 0;

  {
   * Effective Range information is desired.  Used in
   * kEventTSMDocumentAccessGetFont and
   * kEventTSMDocumentAccessGetGlyphInfo events.
   }
  const kTSMDocAccessEffectiveRangeAttributeBit = 1;

type  TSMDocAccessAttributes = UInt32;
const
    kTSMDocAccessFontSizeAttribute = 1 shl kTSMDocAccessFontSizeAttributeBit;
  kTSMDocAccessEffectiveRangeAttribute = 1 shl kTSMDocAccessEffectiveRangeAttributeBit; { More attributes may be added in the future}


{
 *  kEventClassTSMDocumentAccess / kEventTSMDocumentAccessGetFont
 *
 *  Summary:
 *    Returns font, font size, and the range over which these
 *    attributes are constant.
 *
 *  Discussion:
 *    Where the font/font size attributes span multiple characters, an
 *    effective range (over which requested attributes are constant) is
 *    returned by the text engine.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamTSMDocAccessSendComponentInstance (in, typeComponentInstance)
 *          This parameter is provided by the input method originating
 *          the event. (Required parameter)
 *
 *    --> kEventParamTSMDocAccessSendRefCon (in, typeLongInteger)
 *          TSM's SendTextInputEvent, called by an input method,
 *          inserts this parameter before dispatching the event to the
 *          user focus.  (Required Parameter)
 *
 *    --> kEventParamTSMDocAccessSendCharacterIndex (in, typeCFIndex)
 *          The location in the document for which the caller would
 *          like font information. Required parameter.
 *
 *    --> kEventParamTSMDocAccessRequestedCharacterAttributes (in, typeUInt32)
 *          A TSMDocAccessAttributes bit field filled out with the
 *          attributes desired. Applicable values for this event are :
 *          kTSMDocAccessFontSizeAttribute which requests font size
 *          information through the
 *          kEventParamTSMDocAccessReplyFontSize parameter, and
 *          kTSMDocAccessEffectiveRangeAttribute which requests the
 *          text range over which font or font/size is constant.
 *          Required parameter.
 *
 *    <-- kEventParamTSMDocAccessReplyATSFont (out, typeATSFontRef)
 *          The ATSFontRef for the location specified  by the caller.
 *          Required reply parameter.
 *
 *    <-- kEventParamTSMDocAccessReplyFontSize (out, typeFloat)
 *          The font size for the requested location. Optional reply
 *          parameter. Return this information if
 *          kTSMDocAccessFontSizeAttribute is specified in the bit
 *          field passed as the
 *          kEventParamTSMDocAccessRequestedCharacterAttributes
 *          parameter.
 *
 *    --> kEventParamTSMDocAccessSendCharacterRange (in, typeCFRange)
 *          The maximum range of text the caller cares about.  This is
 *          used to "clip" the area of interest to the caller so the
 *          text engine doesn't need to process a style run all the way
 *          back to, say, the beginning of a line or a document, in
 *          order to return an effective range. Required parameter.
 *
 *    <-- kEventParamTSMDocAccessEffectiveRange (out, typeCFRange)
 *          The range of text over which both font and size are
 *          constant, within the bounds of the
 *          kEventParamTSMDocAccessSendCharacterRange parameter.
 *          Optional reply parameter. Return this information if
 *          kTSMDocAccessEffectiveRangeAttribute is specified in the
 *          bit field passed as the
 *          kEventParamTSMDocAccessRequestedCharacterAttributes
 *          parameter.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const kEventTSMDocumentAccessGetFont = 6;

{
 *  kEventClassTSMDocumentAccess / kEventTSMDocumentAccessGetGlyphInfo
 *
 *  Summary:
 *    Returns glyph info and the range covered by that glyph.
 *
 *  Discussion:
 *    Where a glyph spans multiple characters, the effective range,
 *    represented by the glyph, is returned by the app.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamTSMDocAccessSendComponentInstance (in, typeComponentInstance)
 *          This parameter is provided by the input method originating
 *          the event. (Required parameter)
 *
 *    --> kEventParamTSMDocAccessSendRefCon (in, typeLongInteger)
 *          TSM's SendTextInputEvent, called by an input method,
 *          inserts this parameter before dispatching the event to the
 *          user focus.  (Required Parameter)
 *
 *    --> kEventParamTSMDocAccessSendCharacterIndex (in, typeCFIndex)
 *          The location in the document for which the caller would
 *          like glyph information. Required parameter.
 *
 *    --> kEventParamTSMDocAccessRequestedCharacterAttributes (in, typeUInt32)
 *          A TSMDocAccessAttributes bit field filled out with the
 *          information desired. Applicable values for this event are :
 *          kTSMDocAccessEffectiveRangeAttribute which requests the
 *          text range represented by a glyph. Required parameter.
 *
 *    <-- kEventParamTSMDocAccessReplyATSUGlyphSelector (out, typeGlyphSelector)
 *          The glyph used to display the range of text returned in the
 *          kEventParamTSMDocAccessEffectiveRange parameter.  If the
 *          glyph used is the one that ATSUI would normally derive,
 *          this parameter can be omitted. Optional reply parameter.
 *
 *    <-- kEventParamTSMDocAccessEffectiveRange (out, typeCFRange)
 *          The range of text displayed as a glyph ID or CID. Optional
 *          reply parameter. Return this information if
 *          kTSMDocAccessEffectiveRangeAttribute is specified in the
 *          bit field passed as the
 *          kEventParamTSMDocAccessRequestedCharacterAttributes
 *          parameter.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const kEventTSMDocumentAccessGetGlyphInfo = 7;

{

    ** Document Access Lock/Unlock events **

}
{
 *  kEventClassTSMDocumentAccess / kEventTSMDocumentAccessLockDocument
 *
 *  Summary:
 *    Notifies the app that it should not change its document's text
 *    content (on its own) while a text service is involved in a
 *    transaction.  The app should not allow changes, for example, by
 *    its secondary threads.
 *
 *  Discussion:
 *    These events define how a text service can obtain access to a
 *    document in a way that ensures data integrity during its
 *    transaction.  The primary motivation of these events is to
 *    prevent the application from letting its secondary threads modify
 *    the document while a text service is busy servicing an event,
 *    such as a key event, or some user interaction with text service
 *    provided UI such as a menu selection. Also, while the document is
 *    locked, a text service is free to request pointer access to the
 *    document's text content (if this is supported by the app's text
 *    engine.) These lock-related events should be implemented using a
 *    ref counting scheme. Most apps will not support this kind of
 *    threading, so implementation of these events in the text engine
 *    will be optional.   In most text engines, the implementation of
 *    these events should be trivial, i.e. just maintain a simple
 *    semaphore.  TSM itself will implicitly lock/unlock around normal
 *    entry points into a text service, such as when it delivers key
 *    events to an input method, but there may be times when document
 *    changes can be driven by an input method without TSM involvement,
 *    such as the Carbon events involved when the user interacts with
 *    some UI.  In this case, the input method must manage locking, if
 *    the app supports it.  However, the logic in an input method
 *    should not have to care whether TSM is in the call chain or
 *    not... and TSM should not have to care whether an input method
 *    will do the right thing. This is why the lock mechanism needs to
 *    be some kind of refcounting scheme instead of a simple on/off
 *    mechanism. This document lock support is completely optional on
 *    the part of the text engine (if it is not threaded).  TSM will
 *    implicitly lock/unlock the document around delivery of events to
 *    input methods, if the app supports it.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamTSMDocAccessSendComponentInstance (in, typeComponentInstance)
 *          This parameter is provided by the input method originating
 *          the event. (Required parameter)
 *
 *    --> kEventParamTSMDocAccessSendRefCon (in, typeLongInteger)
 *          TSM's SendTextInputEvent, called by an input method,
 *          inserts this parameter before dispatching the event to the
 *          user focus.  (Required Parameter)
 *
 *    <-- kEventParamTSMDocAccessLockCount (out, typeCFIndex)
 *          The resulting refCount of locks on the document. Required
 *          reply parameter, if the event is handled.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const kEventTSMDocumentAccessLockDocument = 8;


{
 *  kEventClassTSMDocumentAccess / kEventTSMDocumentAccessUnlockDocument
 *
 *  Summary:
 *    Unlock the document so the app's text engine is free to initiate
 *    changes again.
 *
 *  Discussion:
 *    (see kEventTSMDocumentAccessLockDocument)
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamTSMDocAccessSendComponentInstance (in, typeComponentInstance)
 *          This parameter is provided by the input method originating
 *          the event. (Required parameter)
 *
 *    --> kEventParamTSMDocAccessSendRefCon (in, typeLongInteger)
 *          TSM's SendTextInputEvent, called by an input method,
 *          inserts this parameter before dispatching the event to the
 *          user focus.  (Required Parameter)
 *
 *    <-- kEventParamTSMDocAccessLockCount (out, typeCFIndex)
 *          The resulting refCount of locks on the document. Required
 *          reply parameter, if the event is handled.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const kEventTSMDocumentAccessUnlockDocument = 9;


{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{ Text Input Events                                                                    }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{
    kEventClassTextInput quick reference:

    kEventTextInputUpdateActiveInputArea    = 1,
    kEventTextInputUnicodeForKeyEvent       = 2,
    kEventTextInputOffsetToPos              = 3,
    kEventTextInputPosToOffset              = 4,
    kEventTextInputShowHideBottomWindow     = 5,
    kEventTextInputGetSelectedText          = 6,
    kEventTextInputUnicodeText              = 7

    The following TextInput events (UpdateActiveInputArea thru GetSelectedText) reimplement
    the AppleEvents defined in Inside Mac Text: Text Services Manager, and provide the benefits
    of Carbon Event targeting, dispatching, and propagation to applications that have formerly
    handled the TSM suite of AppleEvents.
    TextInput handlers may be installed on controls, windows, or the application event target
    (equivalent to AppleEvent-based handling). In all cases, if a given TextInput handler is
    not installed, TSM will convert that TextInput to an AppleEvent and redispatch via AESend
    to the current process, making adoption as gradual as is desired.
}
{
 *  kEventClassTextInput / kEventTextInputUpdateActiveInputArea
 *
 *  Summary:
 *    Tells the application/text engine to initiate/terminate or manage
 *    the content of an inline input session.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamTextInputSendComponentInstance (in, typeComponentInstance)
 *          This parameter is provided by the input method originating
 *          the event. (Required parameter)
 *
 *    --> kEventParamTextInputSendRefCon (in, typeLongInteger)
 *          TSM's SendTextInputEvent, called by an input method,
 *          inserts this parameter before dispatching the event to the
 *          user focus.  (Required Parameter)
 *
 *    --> kEventParamTextInputSendSLRec (in, typeIntlWritingCode)
 *          The ScriptLanguageRecord associated with the contents of an
 *          inline input session.  This parameter is normally provided
 *          by the input method originating the event.  TSM's
 *          SendTextInputEvent will construct this parameter, when
 *          missing, based on the input method component description.
 *          (Required Parameter)
 *
 *    --> kEventParamTextInputSendFixLen (in, typeLongInteger)
 *          This parameter indicates how much, if any, of the inline
 *          input session is being confirmed (or commited) to the
 *          application.  A value of -1 indicates the entire inline
 *          session is being confirmed.  A value of 0 indicates that
 *          none of the text is being confirmed (yet), although there
 *          may be some change to the contents of the inline input
 *          session.  This parameter is provided by the input method
 *          originating the event.  (Required Parameter)
 *
 *    --> kEventParamTextInputSendText (in, typeUnicodeText)
 *          The text to be added to the inline input session. The data
 *          type of this parameter actually depends on the TSMDocument
 *          type created via NewTSMDocument: it will be typeChar for
 *          kTextService documents, or typeUnicodeText for
 *          kUnicodeDocument documents.  (Required Parameter)
 *
 *    --> kEventParamTextInputSendUpdateRng (in, typeTextRangeArray)
 *          An array of text-range records (see TextRangeArray) that
 *          indicates how to update (a subrange of) the active input
 *          area (aka. inline input session).  The TextRange structures
 *          occur in pairs, the first of which identifies a subrange of
 *          the existing active input area (in the app's backing store,
 *          resulting from a previous UpdateActiveInputArea event) to
 *          be replaced by a new subrange of text, identified by the
 *          second TextRange in the pair.  The new text subrange is
 *          obtained from the contents of the
 *          kEventParamTextInputSendText parameter.  In general, the
 *          Nth array element, where N is even, specifies the range of
 *          old text to be updated and array element N+1 specifies the
 *          range of new text to replace the corresponding old text.
 *          The fHiliteStyle field of the TextRange records is ignored
 *          in this parameter. NOTE:  There are some "loose ends" in
 *          the TSM event protocol that were never clearly defined, but
 *          which have been introduced over the years by input methods
 *          themselves, probably through some trial and error.  The
 *          conventions regarding this optional parameter seem to be as
 *          follows: If the UpdateRng parameter is missing from the
 *          event, the input method is requesting that the entire
 *          contents of the existing inline input session (if there is
 *          one) is to be replaced "wholesale" by the new text
 *          contained in the kEventParamTextInputSendText parameter. If
 *          the UpdateRng parameter exists, but contains no ranges
 *          (i.e. fNumOfRanges == 0), this seems to be hint from the
 *          input method that no text in the active input area is
 *          changing.  It may be that the existing active input area is
 *          being confirmed "as is", or that the input method is
 *          modifying its highlite attributes in some way, due to some
 *          user action, such as changing the selected clause or
 *          highlited subrange of text in the active input area, or
 *          that the input method is changing the caret position in the
 *          active input area (if it uses the kCaretPosition hilite
 *          style). Depending on how your text engine draws hilite
 *          styles supported in the kEventParamTextInputSendHiliteRng
 *          parameter, you may or may not need to redraw the text
 *          itself, simply change the hilite. This parameter is
 *          optional and may not be present in all instances of this
 *          event.
 *
 *    --> kEventParamTextInputSendHiliteRng (in, typeTextRangeArray)
 *          An array of text-range records (see TextRangeArray) that
 *          specifies how various subranges of the active input area
 *          are to be highlited, and possibly specifies caret position
 *          within the active input area. NOTE:  The text offsets used
 *          in the HiliteRng parameter are relative to the beginning of
 *          the active input area AFTER all text has been updated (per
 *          the SendUpdateRng parameter) and any (subrange of) text has
 *          been confirmed.  Specifically, if the entire text is being
 *          confirmed, it is clear that any contents of this parameter
 *          should be ignored, especially non-zero values
 *          kCaretPosition. This parameter is optional and may not be
 *          present in all instances of this event.
 *
 *    --> kEventParamTextInputSendClauseRng (in, typeOffsetArray)
 *          An array of offsets (see OffsetArray) used by an input
 *          method to specify word or clause boundaries in the
 *          resulting active input area.  Offsets are relative to the
 *          start of the resulting active input area. This parameter is
 *          optional and may not be present in all instances of this
 *          event.
 *
 *    --> kEventParamTextInputSendPinRng (in, typeTextRange)
 *          A TextRange record that specifies a start offset and an end
 *          offset that should be scrolled into view if the text
 *          specified by these offsets is not already in view. The
 *          fHiliteStyle field of the TextRange records is ignored in
 *          this parameter. This parameter is optional and may not be
 *          present in all instances of this event.
 *
 *    --> kEventParamTextInputSendTextServiceEncoding (in, typeUInt32)
 *          The encoding associated with the text sent by an input
 *          method. On MacOS X, this parameter is not commonly used
 *          because all TSM input methods produce Unicode, but TSM will
 *          respect a Unicode encoding variant here, if specified. In
 *          CarbonLib, this parameter identifies the Mac encoding
 *          (usually an encoding variant) of the text produced by the
 *          input method on MacOS, where it is not a requirement that
 *          input methods be Unicode-savvy.  On this platform, TSM
 *          needs the information to convert text to Unicode from a Mac
 *          encoding variant which cannot be derived from the
 *          ScriptLanguage record associated with the input method
 *          component. This parameter is optional and may not be
 *          present in all instances of this event.
 *
 *    --> kEventParamTextInputSendTextServiceMacEncoding (in, typeUInt32)
 *          The Mac encoding (variant) associated with the text sent by
 *          an input method. On Mac OS X, this parameter is needed by
 *          TSM to convert input method produced Unicodes to a Mac
 *          encoding when the application that has focus is not
 *          Unicode-savvy in the TSM sense... i.e. the current
 *          TSMDocument is not of type kUnicodeDocument. This parameter
 *          can also be useful if a Unicode-savvy handler should need
 *          to convert from Unicode. This parameter is optional and may
 *          not be present in all instances of this event.
 *
 *    --> kEventParamTextInputSendGlyphInfoArray (in, typeGlyphInfoArray)
 *          A TSMGlyphInfoArray structure in which an input method can
 *          associate unencoded glyphs IDs and/or fonts with
 *          (sub)ranges of text it produces.  The array elements
 *          identify non-overlapping ranges of text and the glyph ID
 *          (character collection is 0) such as in an OpenType font, or
 *          the CID (collection is non-zero) such as in TrueType fonts.
 *           If the glyphID itself is 0, only the font specified is to
 *          be applied to the text range.  This is useful for
 *          characters in Unicode private use area, such as Windings,
 *          but note that this capability should be used with care
 *          because changing the font of an input text stream can lead
 *          to a confusing user interface. An input method will only
 *          include this parameter if the text engine has indicated it
 *          supports this feature via the
 *          kTSMDocumentSupportGlyphInfoPropertyTag TSMDocumentProperty
 *          tag. For more information, see the Glyph Access protocol
 *          described in TechNote TN20TT. This parameter is optional
 *          and may not be present in all instances of this event.
 *
 *    --> kEventParamTextInputSendReplaceRange (in, typeCFRange)
 *          The CFRange in the application's document that should be
 *          replaced by the contents of the inline input session
 *          defined by other parameters in this event.  The text
 *          service will have obtained and calculated this range by
 *          accessing the document's text via events of the
 *          TSMDocumentAccess class.  This CFRange parameter refers to
 *          text in flat Unicode space (UniChar) offsets, and its
 *          location is document relative, not relative to the
 *          insertion point or any inline session. A text service may
 *          include this parameter only if the text engine has
 *          indicated it supports this feature via the
 *          kTSMDocumentSupportDocumentAccessPropertyTag
 *          TSMDocumentProperty tag. This parameter is optional and may
 *          not be present in all instances of this event. NOTE:  This
 *          parameter is supported by the TSM Carbon event only, not by
 *          TSM's kUpdateActiveInputArea AppleEvent.  If a text engine
 *          developer wishes to support this parameter, it must
 *          implement a Carbon event handler for this event and set the
 *          kTSMDocumentSupportDocumentAccessPropertyTag property tag.
 *          NOTE:  Care must be exercised by the app when there is an
 *          active inline input session. A text service that sends an a
 *          UpdateActiveInputArea event specifying this parameter
 *          should not be the same text service that owns the inline
 *          input session, since the text engine would need to call
 *          FixTSMDocument().  This, in turn, would cause recursion
 *          through that same text service via FixTextService().
 *          However, the app should be prepared for recursion
 *          regardless of which text service owns the inline input
 *          session because it will call FixTSMDocument() to confirm
 *          the inline input session, and "somebody" will likely send
 *          an UpdateActiveInputArea event as a result. Therefore,
 *          document state obtained before the call to FixTSMDocument()
 *          may not be valid after this call completes.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        in CarbonLib 1.1 and later
 }
const kEventTextInputUpdateActiveInputArea = 1;

{
 *  kEventClassTextInput / kEventTextInputUnicodeForKeyEvent
 *
 *  Summary:
 *    Provides Unicode text input resulting from either a key event
 *    (TSM originates the event in this case) or from a
 *    kEventTextInputUnicodeText event produced by an input method,
 *    such as a Character Palette class input method, or a HandWriting
 *    input method.
 *
 *  Discussion:
 *    This is the primary event by which applications should receive
 *    text input on Mac OS X. Apple recommends that applications use
 *    this event rather than the kEventRawKeyDown event to handle text
 *    input.
 *
 *    A client need not be fully TSM-aware to process or receive this
 *    event. You can also get Mac encoding characters from the raw
 *    keyboard event contained in this event. If no UnicodeForKeyEvent
 *    handler is installed, and no kUnicodeNotFromInputMethod
 *    AppleEvent handler is installed (or the application has not
 *    created a Unicode TSMDocument), the Mac encoding charCodes (if
 *    these can be converted from the Unicodes) are provided to
 *    WaitNextEvent.
 *
 *    This event is generated automatically by TSM when a
 *    kEventRawKeyDown event is sent to the application event target.
 *    The typical keyboard event flow begins with a kEventRawKeyDown
 *    event posted to the event queue. This event is dequeued during
 *    WaitNextEvent or RunApplicationEventLoop, and sent to the event
 *    dispatcher target. If the keydown event reaches the application
 *    target, it is handled by TSM, which generates a
 *    kEventTextInputUnicodeForKeyEvent and sends it to the event
 *    dispatcher target. The event dispatcher will resend the event to
 *    the user focus target, which sends it to the focused control in
 *    the focused window.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamTextInputSendComponentInstance (in, typeComponentInstance)
 *          This parameter is provided by the input method originating
 *          the event. (Required parameter)
 *
 *    --> kEventParamTextInputSendRefCon (in, typeLongInteger)
 *          TSM's SendTextInputEvent, called by an input method,
 *          inserts this parameter before dispatching the event to the
 *          user focus.  (Required Parameter)
 *
 *    --> kEventParamTextInputSendSLRec (in, typeIntlWritingCode)
 *          The ScriptLanguageRecord associated with the text contained
 *          in the event. This parameter is normally provided by the
 *          input method originating the event.  TSM's
 *          SendTextInputEvent will construct this parameter from
 *          current script information as a result of a key event, or
 *          using input method provided information when TSM receives a
 *          kEventTextInputUnicodeText event.  (Required Parameter)
 *
 *    --> kEventParamTextInputSendText (in, typeUnicodeText)
 *          The Unicode characters that were entered by the user.
 *
 *    --> kEventParamTextInputSendKeyboardEvent (in, typeEventRef)
 *          This parameter is the original raw keyboard event that
 *          produced the text. It enables access to
 *          kEventParamKeyModifiers and kEventParamKeyCode parameters.
 *          Note that when contents of TSMÕs bottom-line input window
 *          are confirmed (i.e., during typing of Chinese, Korean, or
 *          Japanese), the raw keyboard eventÕs keyCode and modifiers
 *          are set to default values.
 *
 *          You can also extract from the RawKeyDown event either
 *          Unicodes or Mac encoding characters as follows:
 *
 *          kEventParamKeyUnicodes      typeUnicodeText
 *           kEventParamKeyMacCharCodes  typeChar (if available)
 *
 *          The kEventParamKeyUnicodes parameter of the raw keyboard
 *          event is identical to the TextInput eventÕs
 *          kEventParamTextInputSendText parameter.
 *
 *    --> kEventParamTextInputSendGlyphInfoArray (in, typeGlyphInfoArray)
 *          A TSMGlyphInfoArray structure in which an input method can
 *          associate unencoded glyphs IDs and/or fonts with
 *          (sub)ranges of text it produces.  The array elements
 *          identify non-overlapping ranges of text and the glyph ID
 *          (character collection is 0) such as in an OpenType font, or
 *          the CID (collection is non-zero) such as in TrueType fonts.
 *           If the glyphID itself is 0, only the font specified is to
 *          be applied to the text range.  This is useful for
 *          characters in Unicode private use area, such as Windings,
 *          but note that this capability should be used with care
 *          because changing the font of an input text stream can lead
 *          to a confusing user interface. For more information, see
 *          the Glyph Access protocol described in TechNote TN20TT.
 *          This parameter is optional and may not be present in all
 *          instances of this event.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        in CarbonLib 1.1 and later
 }
const kEventTextInputUnicodeForKeyEvent = 2;

{
 *  kEventClassTextInput / kEventTextInputOffsetToPos
 *
 *  Summary:
 *    Requests conversion from inline session text offset to global QD
 *    coordinate.
 *
 *  Discussion:
 *    This event is typically produced by an input method so that it
 *    can best position a palette near the text being edited by the
 *    user.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamTextInputSendComponentInstance (in, typeComponentInstance)
 *          This parameter is provided by the input method originating
 *          the event. (Required parameter)
 *
 *    --> kEventParamTextInputSendRefCon (in, typeLongInteger)
 *          TSM's SendTextInputEvent, called by an input method,
 *          inserts this parameter before dispatching the event to the
 *          user focus.  (Required Parameter)
 *
 *    --> kEventParamTextInputSendTextOffset (in, typeLongInteger)
 *          The text offset in an active input area for which the
 *          global position (in QD coordinates) is desired.  (Required
 *          Parameter) NOTE:  If no input area is active, the original
 *          definition of this parameter IM-Text 7-74 states that the
 *          offset is "relative to the start of the current text body".
 *           However, some applications have implemented the case
 *          offset = 0 relative to the insertion point, which makes
 *          some sense in that an input method is typically interested
 *          in interacting with the user at the insertion point and
 *          this allows an input method to display some UI (such as a
 *          translucent input mode indicator)  near the insertion point
 *          even before typing has taken place.  Input Methods usually
 *          have no reason to care about the on-screen position of the
 *          beginning of a text document.
 *
 *          However, new events in the TSM suite now allow an input
 *          method to obtain the insertion point as a document-relative
 *          offset in Unicode space, so the original definition of this
 *          parameter should hold... the text offset is to be
 *          considered relative to the beginning of the text document,
 *          especially when the app indicates it supports the TSM text
 *          Attribute events, specifically
 *          kEventTextInputGetInsertionPointAttributes.
 *
 *    --> kEventParamTextInputSendSLRec (in, typeIntlWritingCode)
 *          Specifies which glyph on either side of the supplied text
 *          offset that should be used to compute the on-screen
 *          position returned.  This value is similar to the
 *          leadingEdge parameter of the QuickDraw PixelToChar
 *          function.  If this parameter is true, the location of the
 *          character (or characters if the glyph is represented by
 *          multiple characters) at the specified text offset is
 *          returned.  If this parameter is false, the on-screen
 *          position returned should be the trailing edge of the glyph
 *          represented by the character (or characters) immediately
 *          preceding (in memory order) the supplied text offset. Note
 *          also that while the on-screen position for a given offset
 *          and leading/trailing edge value is affected by this
 *          parameter, it also affects what should be returned for the
 *          other optional parameters at style run boundaries, such as
 *          script and font information. This parameter is optional and
 *          may not be present in all instances of this event. The
 *          default value for this parameter is 'true'.
 *
 *    --> kEventParamTextInputSendLeadingEdge (in, typeBoolean)
 *          The position on screen (in QD coordinates) of the requested
 *          text offset and leading/trailing edge value.  (Required
 *          reply parameter)
 *
 *    <-- kEventParamTextInputReplyPoint (out, typeQDPoint)
 *          The ScriptLanguageRecord associated with the text at the
 *          offset specified in the event, either the
 *          ScriptLanguageRecord of the active input area if one
 *          exists, or of the text at the specified offset and
 *          specified leading/ trailing edge value.  At a script run
 *          boundary, such as where a Japanese text run ends, and a
 *          Roman begins, a leading edge value of 'true' should return
 *          the Roman script/language while a leading edge value of
 *          'false' should return the Japanese script/language. This
 *          parameter is optional and may not be returned to the caller.
 *
 *    <-- kEventParamTextInputReplySLRec (out, typeIntlWritingCode)
 *          The QD Font associated with the text at the offset
 *          specified in the event, either the QD Font of the active
 *          input area if one exists, or of the text at the specified
 *          offset and specified leading/ trailing edge value.  At a
 *          font run boundary, such as where a Japanese text run ends,
 *          and a Roman begins, a leading edge value of 'true' should
 *          return the font of the Roman text run while a leading edge
 *          value of 'false' should return the Japanese font. This
 *          parameter is optional and may not be returned to the caller.
 *
 *    <-- kEventParamTextInputReplyFont (out, typeLongInteger)
 *          The FMFont associated with the text at the offset specified
 *          in the event, either the FMFont of the active input area if
 *          one exists, or of the text at the specified offset and
 *          specified leading/ trailing edge value.  At a font run
 *          boundary, such as where a Japanese text run ends, and a
 *          Roman begins, a leading edge value of 'true' should return
 *          the font of the Roman text run while a leading edge value
 *          of 'false' should return the Japanese font. This parameter
 *          allows the handler to return an FMFont when a FMFontFamily
 *          or FOND would be inconvenient to compute. This parameter is
 *          optional and may not be returned to the caller.
 *
 *    <-- kEventParamTextInputReplyFMFont (out, typeUInt32)
 *          The point size associated with the text at the offset
 *          specified in the event, either the point size of the active
 *          input area if one exists, or of the text at the specified
 *          offset.  At a style run boundary where point size changes,
 *          the leadingEdge parameter determines which point size
 *          should be returned. This parameter is optional and may not
 *          be returned to the caller.
 *
 *    <-- kEventParamTextInputReplyPointSize (out, typeFixed)
 *          The line height associated with the text at the offset
 *          specified in the event, either the line height of the
 *          active input area if one exists, or of the text at the
 *          specified offset.  At a style run boundary where point size
 *          changes, the leadingEdge parameter determines which line
 *          height should be returned. This parameter is optional and
 *          may not be returned to the caller.
 *
 *    <-- kEventParamTextInputReplyLineHeight (out, typeShortInteger)
 *          The line ascent associated with the text at the offset
 *          specified in the event, either the line ascent of the
 *          active input area if one exists, or of the text at the
 *          specified offset.  At a style run boundary where point size
 *          changes, the leadingEdge parameter determines which line
 *          ascent should be returned. This parameter is optional and
 *          may not be returned to the caller.
 *
 *    <-- kEventParamTextInputReplyLineAscent (out, typeShortInteger)
 *          The orientation associated with the text at the offset
 *          specified in the event, either the orientation of the
 *          active input area if one exists, or of the text at the
 *          specified offset.  At a style run boundary where
 *          orientation changes, the leadingEdge parameter determines
 *          which orientation should be returned.  The value 90
 *          specifies a horizontal line direction and 180 specifies a
 *          vertical line direction. This parameter is optional and may
 *          not be returned to the caller.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        in CarbonLib 1.1 and later
 }
const kEventTextInputOffsetToPos    = 3;

{
 *  kEventClassTextInput / kEventTextInputPosToOffset
 *
 *  Summary:
 *    Requests conversion from global QD coordinate to inline session
 *    text offset.
 *
 *  Discussion:
 *    This event is typically produced by an input method to perform
 *    proper cursor management as the cursor moves over various
 *    subranges, or clauses of text (or the boundaries between these)
 *    in the inline input session.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamTextInputSendComponentInstance (in, typeComponentInstance)
 *          This parameter is provided by the input method originating
 *          the event. (Required parameter)
 *
 *    --> kEventParamTextInputSendRefCon (in, typeLongInteger)
 *          TSM's SendTextInputEvent, called by an input method,
 *          inserts this parameter before dispatching the event to the
 *          user focus.  (Required Parameter)
 *
 *    --> kEventParamTextInputSendCurrentPoint (in, typeQDPoint)
 *          The point (in QD coordinates) whose text offset in the
 *          active input area the input method method is requesting.
 *          (Required Parameter)
 *
 *    --> kEventParamTextInputSendDraggingMode (in, typeBoolean)
 *          A Boolean value that indicates whether the input method is
 *          currently tracking the mouse -- that is, whether the user
 *          is dragging the current selection. If it is TRUE, the
 *          application should pin the cursor to the limits of the
 *          active input area (to avoid highlighting beyond the limits
 *          of the active input area). This parameter is optional and
 *          may not be present in all instances of this event.
 *
 *    <-- kEventParamTextInputReplyRegionClass (out, typeLongInteger)
 *          The text offset corresponding to the supplied QD point. If
 *          the click is within the limits of the active input area,
 *          the offset is relative to the start of the active input
 *          area. Otherwise, the offset is relative to the start of the
 *          application's text body.  (Required reply parameter)
 *
 *    <-- kEventParamTextInputReplyTextOffset (out, typeLongInteger)
 *          The classification of the offset parameter.  The values
 *          kTSMOutsideOfBody and kTSMInsideOfBody means that the
 *          position is outside or inside of the text body,
 *          respectively.  A value of kTSMInsideOfActiveInputArea means
 *          that the position is inside of the active input area.
 *          (Required reply parameter)
 *
 *    <-- kEventParamTextInputReplyLeadingEdge (out, typeBoolean)
 *          Specifies whether the QD point supplied corresponds to the
 *          leading edge (true) or trailing edge (false) of a glyph.
 *          This value is similar to the leadingEdge parameter of the
 *          QuickDraw PixelToChar function. If the supplied point is on
 *          the leading edge of a glyph, this parameter contains the
 *          text offset of the character whose glyph is at the pixel
 *          location.  (If the glyph represents multiple characters, it
 *          returns the text offset of the first of these characters in
 *          memory.)  If the supplied point is on the trailing edge of
 *          a glyph, this parameter returns the text offset of the
 *          first character in memory following the character or
 *          characters represented by the glyph. This parameter is
 *          optional and may not be returned to the caller.
 *
 *    <-- kEventParamTextInputReplySLRec (out, typeIntlWritingCode)
 *          The ScriptLanguageRecord of the script run containing the
 *          character at the returned text offset and leading/trailing
 *          edge value. This parameter is optional and may not be
 *          returned to the caller.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        in CarbonLib 1.1 and later
 }
const kEventTextInputPosToOffset    = 4;

{
 *  kEventClassTextInput / kEventTextInputShowHideBottomWindow
 *
 *  Summary:
 *    Show or hide the bottom-line input window.
 *
 *  Discussion:
 *    This event is produced by input methods to control the Text
 *    Services Manager bottom-line input window, and is not normally
 *    handled by an application.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamTextInputSendComponentInstance (in, typeComponentInstance)
 *          This parameter is provided by the input method originating
 *          the event. (Required parameter)
 *
 *    --> kEventParamTextInputSendRefCon (in, typeLongInteger)
 *          TSM's SendTextInputEvent, called by an input method,
 *          inserts this parameter before dispatching the event to the
 *          user focus.  (Required Parameter)
 *
 *    --> kEventParamTextInputSendShowHide (in, typeBoolean)
 *          If true, the bottomline input window should be shown; if
 *          false, it should be hidden. This parameter is not needed if
 *          the input method is simply inquiring about the state of the
 *          input window. This parameter is optional and may not be
 *          present in all instances of this event.
 *
 *    <-- kEventParamTextInputReplyShowHide (out, typeBoolean)
 *          The current state of the input window: true if the window
 *          is shown; false if it is hidden. If the optional parameter
 *          kEventParamTextInputSendShowHide is included, this return
 *          parameter should show the state of the window before it was
 *          set to the state requested in the optional parameter. This
 *          parameter is optional and may not be returned to the caller.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        in CarbonLib 1.1 and later
 }
const kEventTextInputShowHideBottomWindow = 5;

{
 *  kEventClassTextInput / kEventTextInputGetSelectedText
 *
 *  Summary:
 *    Get the selected text (or the character before or after the
 *    insertion point, based on the leadingEdge parameter) from the
 *    applicationÕs text engine.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamTextInputSendComponentInstance (in, typeComponentInstance)
 *          This parameter is provided by the input method originating
 *          the event. (Required parameter)
 *
 *    --> kEventParamTextInputSendRefCon (in, typeLongInteger)
 *          TSM's SendTextInputEvent, called by an input method,
 *          inserts this parameter before dispatching the event to the
 *          user focus.  (Required Parameter)
 *
 *    --> kEventParamTextInputSendLeadingEdge (in, typeBoolean)
 *          If there is a non-empty selection, this parameter should be
 *          ignored.  When the current selection is empty, i.e. an
 *          insertion point, and this parameter is NOT supplied, no
 *          text should be returned. If the current selection is empty
 *          and this parameter is supplied, return the character (or
 *          characters) representing the glyph on the side of the
 *          insertion point indicated by this leadingEdge parameter.
 *          This value is similar to the leadingEdge parameter of the
 *          QuickDraw PixelToChar function.  If this parameter is true,
 *          the character (or characters) at the insertion point is
 *          returned.  If this parameter is false, the character (or
 *          characters) immediately preceding (in memory order) the
 *          insertion point should be returned. This parameter is
 *          optional and may not be present in all instances of this
 *          event. This parameter has no default value and no text
 *          should be returned when this parameter is ommited and there
 *          is no selected text.
 *
 *    --> kEventParamTextInputSendTextServiceEncoding (in, typeUInt32)
 *          The encoding associated with the text sent by an input
 *          method. On MacOS X, this parameter is not commonly used
 *          because all TSM input methods produce (and request)
 *          Unicode, but if specified, this may be a Unicode variant
 *          encoding. In CarbonLib on MacOS, this parameter identifies
 *          the Mac encoding (usually an encoding variant) of the text
 *          produced by the input method on MacOS, where it is not a
 *          requirement that input methods be Unicode-savvy.  On this
 *          platform, TSM needs the information to convert text to
 *          Unicode from a Mac encoding variant which cannot be derived
 *          from the ScriptLanguage record associated with the input
 *          method component. This parameter is optional and may not be
 *          present in all instances of this event.
 *
 *    <-- kEventParamTextInputReplyText (out, typeUnicodeText)
 *          The data type of this parameter actually depends on the
 *          TSMDocument type created via NewTSMDocument: it should be
 *          typeChar for kTextService documents, or typeUnicodeText for
 *          kUnicodeDocument documents. This parameter is optional and
 *          may not be returned to the caller.
 *
 *    <-- kEventParamTextInputReplySLRec (out, typeIntlWritingCode)
 *          The ScriptLanguageRecord of the script run containing the
 *          text being returned to an input method. This parameter is
 *          optional and may not be returned to the caller.
 *
 *    <-- kEventParamTextInputReplyMacEncoding (out, typeUInt32)
 *          The Mac encoding (variant) associated with the text
 *          returned to the input method. On Mac OS X, this parameter
 *          may needed by TSM to convert application produced text from
 *          a Mac encoding to Unicodes returned to the input method.
 *          This parameter is optional and may not be returned to the
 *          caller.
 *
 *    <-- kEventParamTextInputGlyphInfoArray (out, typeGlyphInfoArray)
 *          A TSMGlyphInfoArray structure in which the event handler
 *          can associate unencoded glyphs IDs and/or fonts with
 *          (sub)ranges of text it returns.  The array elements
 *          identify non-overlapping ranges of text and the glyph ID
 *          (character collection is 0) such as in an OpenType font, or
 *          the CID (collection is non-zero) such as in TrueType fonts.
 *           If the glyphID itself is 0, only the font specified is to
 *          be applied to the text range.  This is useful for
 *          characters in Unicode private use area. For more
 *          information, see the Glyph Access protocol described in
 *          TechNote TN20TT. This parameter is optional and may not be
 *          returned to the caller. NOTE:  This parameter should really
 *          have been kEventParamTextInputReplyGlyphInfoArray, which
 *          was introduced after glyphInfo support was added to this
 *          event, but we can't change it now without breaking binary
 *          compatibility.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        in CarbonLib 1.1 and later
 }
const kEventTextInputGetSelectedText = 6;

{
 *  kEventClassTextInput / kEventTextInputUnicodeText
 *
 *  Summary:
 *    Used by input methods to provide original input text to the Text
 *    Services Manager.
 *
 *  Discussion:
 *    This Unicode text event is produced only by input methods or
 *    other text services, and is delivered to TSM via
 *    SendTextInputEvent(). TSM never dispatches this event to the user
 *    focus, so application handlers should NOT install handlers for
 *    this event. Instead, TSM chains this event into any active
 *    keyboard input method in order to prevent interference with
 *    existing inline input sessions. The keyboard input method can
 *    either insert the text into the inline session, or it may confirm
 *    its session and return the UnicodeText event to TSM unhandled, in
 *    which case TSM will convert the event into a UnicodeForKey event
 *    (converting the Unicodes to Mac charCodes and synthesizing
 *    information where needed) and finally dispatch the resulting
 *    event to the user focus as usual.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamTextInputSendComponentInstance (in, typeComponentInstance)
 *          This parameter is provided by the input method originating
 *          the event. (Required parameter)
 *
 *    --> kEventParamTextInputSendSLRec (in, typeIntlWritingCode)
 *          The ScriptLanguageRecord associated with the text contained
 *          in the event. This parameter is provided by the input
 *          method originating the event. This parameter is optional
 *          and may not be present in all instances of this event.
 *
 *    --> kEventParamTextInputSendText (in, typeUnicodeText)
 *          The Unicode characters produced by an input method.
 *          (Required Parameter)
 *
 *    --> kEventParamTextInputSendTextServiceEncoding (in, typeUInt32)
 *          The encoding associated with the text sent by an input
 *          method. On MacOS X, this parameter is not commonly used
 *          because all TSM input methods produce (and request)
 *          Unicode, but if specified, this may be a Unicode variant
 *          encoding. This parameter is optional and may not be present
 *          in all instances of this event.
 *
 *    --> kEventParamTextInputSendTextServiceMacEncoding (in, typeUInt32)
 *          The Mac encoding (variant) associated with the text sent by
 *          an input method, should TSM or an event handler need to
 *          convert the Unicodes. This parameter is optional and may
 *          not be present in all instances of this event.
 *
 *    --> kEventParamTextInputSendGlyphInfoArray (in, typeGlyphInfoArray)
 *          A TSMGlyphInfoArray structure in which an input method can
 *          associate unencoded glyphs IDs and/or fonts with
 *          (sub)ranges of text it produces.  The array elements
 *          identify non-overlapping ranges of text and the glyph ID
 *          (character collection is 0) such as in an OpenType font, or
 *          the CID (collection is non-zero) such as in TrueType fonts.
 *           If the glyphID itself is 0, only the font specified is to
 *          be applied to the text range.  This is useful for
 *          characters in Unicode private use area, such as Windings,
 *          but note that this capability should be used with care
 *          because changing the font of an input text stream can lead
 *          to a confusing user interface. For more information, see
 *          the Glyph Access protocol described in TechNote TN20TT.
 *          This parameter is optional and may not be present in all
 *          instances of this event.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const kEventTextInputUnicodeText    = 7;



    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {    Raw Keyboard Events                                                                    }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }

    {
     *  Summary:
     *    Keyboard events (kEventClassKeyboard)
     *
     *  Discussion:
     *    These events are the lowest-level keyboard events.
        }
    kEventRawKeyDown            = 1;                            {  hardware-level events }
    kEventRawKeyRepeat          = 2;
    kEventRawKeyUp              = 3;
    kEventRawKeyModifiersChanged = 4;
    kEventHotKeyPressed         = 5;
    kEventHotKeyReleased        = 6;                            {  Mac OS X only }



    {
     *  Summary:
     *    Key modifier change event bits and masks
     *
     *  Discussion:
     *    From bit 8, cmdKeyBit, to bit 15, rightControlKeyBit, are
     *    compatible with Event Manager modifiers.
        }
    kEventKeyModifierNumLockBit = 16;                           {  Num Lock is on? (Mac OS X only) }
    kEventKeyModifierFnBit      = 17;                           {  Fn key is down? (Mac OS X only) }

    kEventKeyModifierNumLockMask = $00010000;
    kEventKeyModifierFnMask     = $00020000;

    {
        Parameters for keyboard events:

        kEventRawKeyDown
            -->     kEventParamKeyMacCharCodes  typeChar
            -->     kEventParamKeyCode          typeUInt32
            -->     kEventParamKeyModifiers     typeUInt32
            -->     kEventParamKeyboardType     typeUInt32

        kEventRawKeyRepeat
            -->     kEventParamKeyMacCharCodes  typeChar
            -->     kEventParamKeyCode          typeUInt32
            -->     kEventParamKeyModifiers     typeUInt32
            -->     kEventParamKeyboardType     typeUInt32

        kEventRawKeyUp
            -->     kEventParamKeyMacCharCodes  typeChar
            -->     kEventParamKeyCode          typeUInt32
            -->     kEventParamKeyModifiers     typeUInt32
            -->     kEventParamKeyboardType     typeUInt32

        kEventRawKeyModifiersChanged
            -->     kEventParamKeyModifiers     typeUInt32

        kEventHotKeyPressed
            -->     kEventParamDirectObject     typeEventHotKeyID

        kEventHotKeyReleased
            -->     kEventParamDirectObject     typeEventHotKeyID
        }

{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{ Application Events                                                                   }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{
    kEventClassApplication quick reference:

    %% please check CarbonEventsPriv.i for any events of class kEventClassApplication before
    %% adding values to this list...

    kEventAppActivated                      = 1,
    kEventAppDeactivated                    = 2,
    kEventAppQuit                           = 3,
    kEventAppLaunchNotification             = 4,
    kEventAppLaunched                       = 5,
    kEventAppTerminated                     = 6,
    kEventAppFrontSwitched                  = 7,

    kEventAppFocusMenuBar                   = 8,
    kEventAppFocusNextDocumentWindow        = 9,
    kEventAppFocusNextFloatingWindow        = 10,
    kEventAppFocusToolbar                   = 11,

    kEventAppGetDockTileMenu                = 20,

    kEventAppIsEventInInstantMouser         = 104,

    kEventAppHidden                         = 107,
    kEventAppShown                          = 108,
    kEventAppSystemUIModeChanged            = 109,
    kEventAppAvailableWindowBoundsChanged   = 110,
    kEventAppActiveWindowChanged            = 111

    %% Make sure to avoid overlap with the App Event IDs in CarbonEventsPriv.i!
}
{
 *  kEventClassApplication / kEventAppActivated
 *
 *  Summary:
 *    This application has been activated.
 *
 *  Discussion:
 *    This event is sent to all handlers registered for it.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamWindowRef (in, typeWindowRef)
 *          This parameter is present if a click on an application
 *          window was the cause of the app activation; it contains the
 *          window that was clicked. This parameter is not provided if
 *          the application was activated for some other reason.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        in CarbonLib 1.1 and later
 }
const kEventAppActivated            = 1;

{
 *  kEventClassApplication / kEventAppDeactivated
 *
 *  Summary:
 *    This application has been deactivated.
 *
 *  Discussion:
 *    This event is sent to all handlers registered for it.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        in CarbonLib 1.1 and later
 }
const kEventAppDeactivated          = 2;

{
 *  kEventClassApplication / kEventAppQuit
 *
 *  Summary:
 *    A request to quit. Sent by QuitApplicationEventLoop to the
 *    application target.
 *
 *  Discussion:
 *    The RunApplicationEventLoop API installs a default handler on the
 *    application target for this event while the event loop is
 *    running. The handler is removed before RunApplicationEventLoop
 *    returns.
 *
 *    The event handler installed by RunApplicationEventLoop will cause
 *    RunApplicationEventLoop to exit. Most applications will not need
 *    to handle this event; instead, an application should install an
 *    AppleEvent handler for the kAEQuitApplication event handler if it
 *    needs to check for unsaved documents or do other cleanup before
 *    quitting.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        in CarbonLib 1.1 and later
 }
const kEventAppQuit                 = 3;

{
 *  kEventClassApplication / kEventAppLaunchNotification
 *
 *  Summary:
 *    Notification that an asynchronous process launch has completed.
 *
 *  Discussion:
 *    This event is received when you use LaunchServices to launch a
 *    process asynchronously. Your application only receives this event
 *    for processes that you launch; it is not sent for process
 *    launches from other applications (such as the Finder).
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamProcessID (in, typeProcessSerialNumber)
 *          The ProcessSerialNumber of the process that was launched.
 *
 *    --> kEventParamLaunchRefCon (in, typeUInt32)
 *          Contains the value in the asyncRefCon field of the LSLaunch
 *          structure that was used to launch the process.
 *
 *    --> kEventParamLaunchErr (in, typeOSStatus)
 *          A result code indicating success or failure of the launch.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const kEventAppLaunchNotification   = 4;

{
 *  kEventClassApplication / kEventAppLaunched
 *
 *  Summary:
 *    Another app was launched.
 *
 *  Discussion:
 *    This event is sent to all handlers registered for it.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamProcessID (in, typeProcessSerialNumber)
 *          The ProcessSerialNumber of the process that was launched.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        in CarbonLib 1.3.1 and later
 }
const kEventAppLaunched             = 5;

{
 *  kEventClassApplication / kEventAppTerminated
 *
 *  Summary:
 *    Another app terminated.
 *
 *  Discussion:
 *    This event is sent to all handlers registered for it.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamProcessID (in, typeProcessSerialNumber)
 *          The ProcessSerialNumber of the process that terminated.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        in CarbonLib 1.3.1 and later
 }
const kEventAppTerminated           = 6;

{
 *  kEventClassApplication / kEventAppFrontSwitched
 *
 *  Summary:
 *    The front (active) application has changed.
 *
 *  Discussion:
 *    This event is sent to all handlers registered for it.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamProcessID (in, typeProcessSerialNumber)
 *          The ProcessSerialNumber of the process that became
 *          frontmost.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        in CarbonLib 1.3.1 and later
 }
const kEventAppFrontSwitched        = 7;

{
 *  kEventClassApplication / kEventAppHidden
 *
 *  Summary:
 *    The current application has been hidden.
 *
 *  Discussion:
 *    This event is sent to all handlers registered for it.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const kEventAppHidden               = 107;

{
 *  kEventClassApplication / kEventAppShown
 *
 *  Summary:
 *    The current application has been shown.
 *
 *  Discussion:
 *    This event is sent to all handlers registered for it.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const kEventAppShown                = 108;

{
 *  kEventClassApplication / kEventAppSystemUIModeChanged
 *
 *  Summary:
 *    The system UI mode of the frontmost application has changed.
 *
 *  Discussion:
 *    This event is sent to all handlers registered for it.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamSystemUIMode (in, typeUInt32)
 *          The new system UI mode. Contains a kUIMode constant from
 *          MacApplication.h.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const kEventAppSystemUIModeChanged  = 109;


{
   * Indicates that a deviceÕs available window positioning bounds have
   * changed because of a change in Dock position or size.
   }
const  kAvailBoundsChangedForDock    = 1 shl 0;

  {
   * Indicates that a deviceÕs available window positioning bounds have
   * changed because of a change in display configuration.
   }
const  kAvailBoundsChangedForDisplay = 1 shl 1;

{
 *  kEventClassApplication / kEventAppAvailableWindowBoundsChanged
 *
 *  Summary:
 *    The available window positioning bounds have changed.
 *
 *  Discussion:
 *    This event is sent to all handlers registered for it.
 *
 *    This event is currently sent in two circumstances: when the Dock
 *    has changed position or size, and when the display configuration
 *    has changed. A separate copy of this event is sent to each
 *    affected GDevice.
 *
 *    All applications have a default handler installed on the
 *    application target that responds to this event by sending
 *    kEventWindowConstrain events to each window on the specified
 *    device. It is not possible to prevent this handler from running,
 *    since this event is sent to all registered handlers. However,
 *    applications that would like to do their own window layout may
 *    install a handler for this event, and also set the
 *    kWindowNoConstrainAttribute on their windows, which will cause
 *    the basic window handler to ignore kEventWindowConstrain. An
 *    application may also install its own kEventWindowConstrain
 *    handler and selectively return a value other than
 *    eventNotHandledErr, which will prevent the event from being sent
 *    to the basic window handler.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamGDevice (in, typeGDHandle)
 *          The device whose available positioning bounds have changed.
 *
 *    --> kEventParamReason (in, typeUInt32)
 *          The reasons why the available positioning bounds have
 *          changed. This parameter contains one or more of the
 *          kAvailBoundsChangedFor constants.
 *
 *    --> kEventParamTransactionID (in, typeUInt32)
 *          An integer which is the same for all instances of this
 *          event that are produced by the same configuration change.
 *          For example, if multiple displays are attached, then this
 *          event is sent once for each display after a display
 *          configuration change; however, the transaction ID parameter
 *          will the same for each event, so a handler for this event
 *          can choose to ignore all but the first event by correlating
 *          the the transaction IDs.
 *
 *    --> kEventParamPreviousDockRect (in, typeHIRect)
 *          The DockÕs previous bounds, in global coordinates. This
 *          parameter is optional and may not be present in all
 *          instances of this event. It is present in events with a
 *          kEventParamReason parameter containing
 *          kAvailBoundsChangedForDock.
 *
 *    --> kEventParamPreviousDockDevice (in, typeGDHandle)
 *          The GDevice on which the Dock was previously positioned.
 *          This parameter is optional and may not be present in all
 *          instances of this event. It is present in events with a
 *          kEventParamReason parameter containing
 *          kAvailBoundsChangedForDock.
 *
 *    --> kEventParamCurrentDockRect (in, typeHIRect)
 *          The DockÕs current bounds, in global coordinates. This
 *          parameter is optional and may not be present in all
 *          instances of this event. It is present in events with a
 *          kEventParamReason parameter containing
 *          kAvailBoundsChangedForDock.
 *
 *    --> kEventParamCurrentDockDevice (in, typeGDHandle)
 *          The GDevice on which the Dock is currently positioned. This
 *          parameter is optional and may not be present in all
 *          instances of this event. It is present in events with a
 *          kEventParamReason parameter containing
 *          kAvailBoundsChangedForDock.
 *
 *    --> kEventParamRgnHandle (in, typeQDRgnHandle)
 *          The GrayRgn before the configuration change. This parameter
 *          is optional and may not be present in all instances of this
 *          event. It is present in events with a kEventParamReason
 *          parameter containing kAvailBoundsChangedForDisplay. To get
 *          the GrayRgn after the configuration change, just call the
 *          GetGrayRgn API.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const kEventAppAvailableWindowBoundsChanged = 110;

{
 *  kEventClassApplication / kEventAppActiveWindowChanged
 *
 *  Summary:
 *    Notification that the active window in the current process has
 *    changed.
 *
 *  Discussion:
 *    The Window Manager internally tracks the active window, which is
 *    the window that is returned by ActiveNonFloatingWindow. When
 *    SelectWindow is called on a window, that window is made the new
 *    active window. At that time, the Window Manager also posts a
 *    kEventAppActiveWindowChanged event to the main event
 *    queue.
 *
 *    The ActivateWindow API also causes this event to be
 *    posted.
 *
 *    If more than one window is activated sequentially before the
 *    event loop is run, only a single kEventAppActiveWindowChanged
 *    event will be left in the event queue, its PreviousActiveWindow
 *    parameter will be the window that was originally active, and its
 *    CurrentActiveWindow parameter will be the window that was finally
 *    active.
 *
 *    This event only reports changes to the current process. It does
 *    not report activation changes in other processes.
 *    <BR> This event is sent to all handlers registered for it.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamPreviousWindow (in, typeWindowRef)
 *          The window that was previously active.
 *
 *    --> kEventParamCurrentWindow (in, typeWindowRef)
 *          The window that is now active.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const kEventAppActiveWindowChanged  = 111;

{
 *  kEventClassApplication / kEventAppGetDockTileMenu
 *
 *  Summary:
 *    A request for a menu to be displayed by the applicationÕs dock
 *    tile.
 *
 *  Discussion:
 *    This event has a default handler on the application target. The
 *    default handler will return the menu, if any, that was provided
 *    by the SetApplicationDockTileMenu API. The sender of this event
 *    will release the menu after the Dock has displayed it, so if you
 *    return a permanently allocated MenuRef, you should call
 *    RetainMenu on it before returning from your event handler. For
 *    most applications, it will be easier to use the
 *    SetApplicationDockTileMenu API directly rather than installing a
 *    handler for this event.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    <-- kEventParamMenuRef (out, typeMenuRef)
 *          A MenuRef to be displayed in the Dock is returned by the
 *          handler in this parameter.
 *
 *  Availability:
 *    Mac OS X:         in version 10.1 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const kEventAppGetDockTileMenu      = 20;

{
 *  kEventClassApplication / kEventAppFocusMenuBar
 *
 *  Summary:
 *    The user has requested keyboard focus on the menubar.
 *
 *  Discussion:
 *    This event is handled automatically by the default application
 *    event handler. A handler for this event should switch the
 *    keyboard focus to the menubar. Applications may install handlers
 *    for this event to track keyboard focus, but should not prevent
 *    the event from being handled by the default application handler.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamKeyModifiers (in, typeUInt32)
 *          The keyboard modifiers that were pressed when the user
 *          requested a focus switch.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const kEventAppFocusMenuBar         = 8;

{
 *  kEventClassApplication / kEventAppFocusNextDocumentWindow
 *
 *  Summary:
 *    The user has requested keyboard focus on a document window.
 *
 *  Discussion:
 *    This event is handled automatically by the default application
 *    event handler. A handler for this event should cycle to the next
 *    (or previous, if the shift key is down) document window, or if
 *    there are no more windows to activate in the applicationÕs window
 *    list, to the next or previous document window in the next or
 *    previous process. User focus (see SetUserFocusWindow) should be
 *    applied to the new front document window. If something other than
 *    a document window has the focus at the time you receive this
 *    event, the frontmost document window should be given the user
 *    focus instead, and no z-order change should be made.
 *    Additionally, the keyboard focus should be moved to the main
 *    control in the newly focused window if no keyboard focus exists
 *    within the window.
 *
 *    A handler for this event should never override it entirely; if
 *    necessary, it should only check if the user focus is somewhere
 *    other than a document window, and if so, set the focus on the
 *    active document window. If the focus is already on a document
 *    window, a handler for this event should always return
 *    eventNotHandledErr so that the default handler can rotate to the
 *    next window across all processes.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamKeyModifiers (in, typeUInt32)
 *          The keyboard modifiers that were pressed when the user
 *          requested a focus switch.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const kEventAppFocusNextDocumentWindow = 9;

{
 *  kEventClassApplication / kEventAppFocusNextFloatingWindow
 *
 *  Summary:
 *    The user has requested keyboard focus on a floating window.
 *
 *  Discussion:
 *    This event is handled automatically by the default application
 *    event handler. A handler for this event should cycle to the next
 *    (or previous, if the shift key is down) floating window in the
 *    application. User focus (see SetUserFocusWindow) should be
 *    applied to the new front floating window. If something other than
 *    a floating window has the focus at the time you receive this
 *    event, the frontmost floating window should be given the user
 *    focus instead, and no z-order change should be made.
 *    Additionally, the keyboard focus should be moved to the main
 *    control in the newly focused window if no keyboard focus exists
 *    within the window. The default handler sends a
 *    kEventCommandProcess event containing
 *    kHICommandRotateFloatingWindowsForward/Backward when it detects
 *    that floating windows should be cycled.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamKeyModifiers (in, typeUInt32)
 *          The keyboard modifiers that were pressed when the user
 *          requested a focus switch.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const kEventAppFocusNextFloatingWindow = 10;

{
 *  kEventClassApplication / kEventAppFocusToolbar
 *
 *  Summary:
 *    The user has requested keyboard focus on the toolbar in the
 *    focused window.
 *
 *  Discussion:
 *    For windows that use the standard HIToolbar control, this event
 *    is handled automatically by the default application event
 *    handler. A handler for this event should put focus on the first
 *    control in the toolbar in the focused window, if a toolbar is
 *    present.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamKeyModifiers (in, typeUInt32)
 *          The keyboard modifiers that were pressed when the user
 *          requested a focus switch.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const kEventAppFocusToolbar         = 11;

{
 *  kEventClassApplication / kEventAppIsEventInInstantMouser
 *
 *  Summary:
 *    Sent when the system needs to determine if the given event's
 *    global mouse location is over an "instant mousing" area. An
 *    instant mousing area is an area where a mouse down should not
 *    generate ink, but should only be interpreted as a click.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamEventRef (in, typeEventRef)
 *          The Event to check.
 *
 *    <-- kEventParamIsInInstantMouser (out, typeBoolean)
 *          True if event was in an "instant mousing" area, false
 *          otherwise.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const kEventAppIsEventInInstantMouser = 104;

    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {     Apple Events                                                                          }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }

    {
     *  Summary:
     *    Apple events (kEventClassAppleEvent)
        }
    kEventAppleEvent            = 1;


    {
        Parameters for Apple events:

        kEventAppleEvent
            -->     kEventParamAEEventClass     typeType        // the eventClass of the Apple event
            -->     kEventParamAEEventID        typeType        // the eventID of the Apple event
        }


{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{  Window Events                                                                       }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{
    kEventClassWindow quick reference:

    -- window refresh events --

    kEventWindowUpdate                  = 1,
    kEventWindowDrawContent             = 2,

    -- window activation events --

    kEventWindowActivated               = 5,
    kEventWindowDeactivated             = 6,
    kEventWindowGetClickActivation      = 7,

    -- window state change events --

    kEventWindowShowing                 = 22,
    kEventWindowHiding                  = 23,
    kEventWindowShown                   = 24,
    kEventWindowHidden                  = 25,
    kEventWindowCollapsing              = 86,
    kEventWindowCollapsed               = 67,
    kEventWindowExpanding               = 87,
    kEventWindowExpanded                = 70,
    kEventWindowZoomed                  = 76,
    kEventWindowBoundsChanging          = 26,
    kEventWindowBoundsChanged           = 27,
    kEventWindowResizeStarted           = 28,
    kEventWindowResizeCompleted         = 29,
    kEventWindowDragStarted             = 30,
    kEventWindowDragCompleted           = 31,
    kEventWindowClosed                  = 73,
    kEventWindowTransitionStarted       = 88,
    kEventWindowTransitionCompleted     = 89,

    -- window click events --

    kEventWindowClickDragRgn            = 32,
    kEventWindowClickResizeRgn          = 33,
    kEventWindowClickCollapseRgn        = 34,
    kEventWindowClickCloseRgn           = 35,
    kEventWindowClickZoomRgn            = 36,
    kEventWindowClickContentRgn         = 37,
    kEventWindowClickProxyIconRgn       = 38,
    kEventWindowClickToolbarButtonRgn   = 41,
    kEventWindowClickStructureRgn       = 42,

    -- window cursor change events --

    kEventWindowCursorChange            = 40,

    -- window action events --

    kEventWindowCollapse                = 66,
%%  kEventWindowCollapsed               = 67,
    kEventWindowCollapseAll             = 68,
    kEventWindowExpand                  = 69,
%%  kEventWindowExpanded                = 70,
    kEventWindowExpandAll               = 71,
    kEventWindowClose                   = 72,
%%  kEventWindowClosed                  = 73,
    kEventWindowCloseAll                = 74,
    kEventWindowZoom                    = 75,
%%  kEventWindowZoomed                  = 76,
    kEventWindowZoomAll                 = 77,
    kEventWindowContextualMenuSelect    = 78,
    kEventWindowPathSelect              = 79,
    kEventWindowGetIdealSize            = 80,
    kEventWindowGetMinimumSize          = 81,
    kEventWindowGetMaximumSize          = 82,
    kEventWindowConstrain               = 83,
    kEventWindowHandleContentClick      = 85,
%%  kEventWindowCollapsing              = 86,
%%  kEventWindowExpanding               = 87,
%%  kEventWindowTransitionStarted       = 88,
%%  kEventWindowTransitionCompleted     = 89,
    kEventWindowGetDockTileMenu         = 90,
%%  kEventWindowHandleActivate          = 91,
%%  kEventWindowHandleDeactivate        = 92,
    kEventWindowProxyBeginDrag          = 128,
    kEventWindowProxyEndDrag            = 129,
    kEventWindowToolbarSwitchMode       = 150,

    -- window focus events --

    kEventWindowFocusAcquired           = 200,
    kEventWindowFocusRelinquish         = 201,
    kEventWindowFocusContent            = 202,
    kEventWindowFocusToolbar            = 203,

    -- drawer events --

    kEventWindowDrawerOpening           = 220,
    kEventWindowDrawerOpened            = 221,
    kEventWindowDrawerClosing           = 222,
    kEventWindowDrawerClosed            = 223,

    -- window definition events --

    kEventWindowDrawFrame               = 1000,
    kEventWindowDrawPart                = 1001,
    kEventWindowGetRegion               = 1002,
    kEventWindowHitTest                 = 1003,
    kEventWindowInit                    = 1004,
    kEventWindowDispose                 = 1005,
    kEventWindowDragHilite              = 1006,
    kEventWindowModified                = 1007,
    kEventWindowSetupProxyDragImage     = 1008,
    kEventWindowStateChanged            = 1009,
    kEventWindowMeasureTitle            = 1010,
    kEventWindowDrawGrowBox             = 1011,
    kEventWindowGetGrowImageRegion      = 1012,
    kEventWindowPaint                   = 1013

    On window handlers:

    All windows have a handler installed called the Òbasic window handler.Ó This handler provides certain
    basic services for all windows; for example, it handles clicks in the collapse and toolbar buttons,
    since these buttons were handled automatically for WaitNextEvent-based applications in the classic
    Mac OS toolbox, and so are still be handled automatically in Carbon by the basic window handler. The
    basic window handler also implements the HICommands that are sent by the standard window menu to minimize,
    maximize, or zoom a window (kHICommandMinimize/Maximize/ZoomWindow), and the window-class events that are
    generated by those commands (kEventWindowCollapse/Expand/Zoom).

    When the window is created with, or has added, the kWindowStandardHandlerAttribute, the window also has
    installed the Òstandard window handler.Ó The standard handler provides much more advanced behavior than
    the basic window handler; a window using the standard handler generally requires no other extra handlers
    to move, resize, redraw, or track user clicks in controls. Applications will generally add extra handlers
    to respond to command events generated by controls in the window.
}
{
 *  kEventClassWindow / kEventWindowUpdate
 *
 *  Summary:
 *    The lowest-level window update event.
 *
 *  Discussion:
 *    Posted to the event queue for any window that needs updating
 *    regardless of whether the window has the standard handler
 *    installed. The standard window handler responds to this event by
 *    calling BeginUpdate and SetPort, sending a
 *    kEventWindowDrawContent event, and calling EndUpdate. An
 *    application handler for this event that does not call through to
 *    the standard handler must itself call BeginUpdate and
 *    EndUpdate.
 *
 *    If all handlers for this event return eventNotHandledErr, and the
 *    application is calling WaitNextEvent or GetNextEvent, then a
 *    kEventWindowUpdate event will be returned as a classic updateEvt.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeWindowRef)
 *          The window that requires updating.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        in CarbonLib 1.1 and later
 }
const kEventWindowUpdate            = 1;

{
 *  kEventClassWindow / kEventWindowDrawContent
 *
 *  Summary:
 *    A request to update a windowÕs content.
 *
 *  Discussion:
 *    This event is sent by the standard window handler when it
 *    receives a kEventWindowUpdate event. BeginUpdate, SetPort, and
 *    EndUpdate are called for you; your handler only needs to draw
 *    into the current port.
 *
 *    Regardless of whether the window uses the standard window event
 *    handler, you will also receive this event right before a window
 *    is made visible, to allow you to draw the windowÕs initial
 *    contents; you can implement this event to avoid flicker when the
 *    window is first shown.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeWindowRef)
 *          The window that requires updating.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        in CarbonLib 1.1 and later
 }
const kEventWindowDrawContent       = 2;

{
 *  kEventClassWindow / kEventWindowActivated
 *
 *  Summary:
 *    Notification that a window has been activated.
 *
 *  Discussion:
 *    This event is sent to all handlers registered for it. It is sent
 *    to any window that is activated, regardless of whether the window
 *    has the standard handler installed. The standard window event
 *    handler responds to this event by calling ActivateControl on the
 *    windowÕs root control.
 *
 *    If all handlers for this event return eventNotHandledErr, then
 *    the Window Manager posts the event to the event queue, where it
 *    will later be returned from WaitNextEvent as a classic
 *    activateEvt. If any handler returns an error code other than
 *    eventNotHandledErr, then the event will not be posted to the
 *    event queue.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeWindowRef)
 *          The window that is now active.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        in CarbonLib 1.1 and later
 }
const kEventWindowActivated         = 5;

{
 *  kEventClassWindow / kEventWindowDeactivated
 *
 *  Summary:
 *    Notification that a window has been deactivated.
 *
 *  Discussion:
 *    This event is sent to all handlers registered for it. It is sent
 *    to any window that is deactivated, regardless of whether the
 *    window has the standard handler installed. The standard window
 *    event handler responds to this event by calling DeactivateControl
 *    on the windowÕs root control.
 *
 *    If all handlers for this event return eventNotHandledErr, then
 *    the Window Manager posts the event to the event queue, where it
 *    will later be returned from WaitNextEvent as a classic
 *    activateEvt. If any handler returns an error code other than
 *    eventNotHandledErr, then the event will not be posted to the
 *    event queue.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeWindowRef)
 *          The window that is now inactive.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        in CarbonLib 1.1 and later
 }
const kEventWindowDeactivated       = 6;

{
 *  kEventClassWindow / kEventWindowGetClickActivation
 *
 *  Summary:
 *    Sent when a click occurs in a inactive window. Allows the window
 *    to determine whether the window should be activated and whether
 *    the click should be handled.
 *
 *  Discussion:
 *    This event is sent to a window when a click occurs in the window
 *    while it is inactive. A handler for this event can determine
 *    whether the window is activated and whether the click is handled
 *    or ignored by setting the kEventParamClickActivation parameter to
 *    one of the ClickActivationResult constants in Controls.h.
 *
 *
 *    For windows which use the standard window event handler, this
 *    event is sent regardless of whether the windowÕs process is
 *    active or inactive; for windows that do not use the standard
 *    window event handler, this event is only sent to windows in
 *    inactive processes. This event is never sent to
 *    kUtilityWindowClass windows, since they are never inactive.
 *
 *
 *    The default behavior is to bring the window forward and ignore
 *    the click (in other words, return kActivateAndIgnoreClick),
 *    unless the click falls on the window widgets in the window
 *    structure, in which case kDoNotActivateAndHandleClick is usually
 *    returned. You have the option of overriding the behavior to
 *    support click-thru or select-and-click.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeWindowRef)
 *          The window that was clicked.
 *
 *    --> kEventParamMouseLocation (in, typeQDPoint)
 *          The location of the click, in global coordinates.
 *
 *    --> kEventParamKeyModifiers (in, typeUInt32)
 *          The keyboard modifiers that were pressed when the mouse was
 *          clicked.
 *
 *    --> kEventParamWindowPartCode (in, typeWindowPartCode)
 *          The window part that was clicked. Available in Mac OS X
 *          10.3 and later.
 *
 *    --> kEventParamWindowDefPart (in, typeWindowDefPartCode)
 *          The window part that was clicked. This is really a window
 *          part code, not a window def part code, despite the
 *          parameter name; this parameter is available in all versions
 *          of Mac OS X and CarbonLib 1.1 and later, but use
 *          kEventParamWindowPartCode when available instead for
 *          clarity.
 *
 *    --> kEventParamControlRef (in, typeControlRef)
 *          The control that was clicked. Only present if the click was
 *          on a control.
 *
 *    <-- kEventParamClickActivation (out, typeClickActivationResult)
 *          On exit, indicates how the click should be handled. Should
 *          be set a ClickActivationResult constant from Controls.h.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        in CarbonLib 1.1 and later
 }
const kEventWindowGetClickActivation = 7;


{
 *  Summary:
 *    Window bounds change event attributes
 *
 *  Discussion:
 *    When the toolbox sends out a kEventWindowBoundsChanging or
 *    kEventWindowBoundsChanged event, it also sends along a parameter
 *    containing attributes of the event. These attributes can be used
 *    to determine what aspect of the window changed (origin, size, or
 *    both), and whether or not some user action is driving the change
 *    (drag or resize).
 }
const
   {
   * The bounds is changing because the user is dragging the window
   * around.
   }
  kWindowBoundsChangeUserDrag   = (1 shl 0);

  {
   * The bounds is changing because the user is resizing the window.
   }
  kWindowBoundsChangeUserResize = (1 shl 1);

  {
   * The dimensions of the window (width and height) are changing.
   }
  kWindowBoundsChangeSizeChanged = (1 shl 2);

  {
   * The top left corner (origin) is changing.
   }
  kWindowBoundsChangeOriginChanged = (1 shl 3);

  {
   * The bounds is changing because ZoomWindow or ZoomWindowIdeal was
   * called. Note that this flag does not imply any user interaction;
   * if the application calls ZoomWindow itself without user request,
   * this flag will still be set. Available in Mac OS X 10.2 and
   * CarbonLib 1.6, and later.
   }
  kWindowBoundsChangeZoom       = (1 shl 4);

{
 *  kEventClassWindow / kEventWindowShowing
 *
 *  Summary:
 *    Notification that a window is being shown.
 *
 *  Discussion:
 *    This event is sent to all handlers registered for it.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeWindowRef)
 *          The window being shown.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        in CarbonLib 1.1 and later
 }
const kEventWindowShowing           = 22;

{
 *  kEventClassWindow / kEventWindowHiding
 *
 *  Summary:
 *    Notification that a window is being hidden.
 *
 *  Discussion:
 *    This event is sent to all handlers registered for it.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeWindowRef)
 *          The window being hidden.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        in CarbonLib 1.1 and later
 }
const kEventWindowHiding            = 23;

{
 *  kEventClassWindow / kEventWindowShown
 *
 *  Summary:
 *    Notification that a window has been shown.
 *
 *  Discussion:
 *    This event is sent to all handlers registered for it.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeWindowRef)
 *          The window that was shown.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        in CarbonLib 1.1 and later
 }
const kEventWindowShown             = 24;

{
 *  kEventClassWindow / kEventWindowHidden
 *
 *  Summary:
 *    Notification that a window has been hidden.
 *
 *  Discussion:
 *    This event is sent to all handlers registered for it. Prior to
 *    Mac OS X 10.2 and CarbonLib 1.6, kEventWindowClosed and
 *    kEventWindowHidden were sent in that order by the Window Manager
 *    to a window being destroyed. This was problematic if you had a
 *    Hidden handler which used data that was destroyed by the Closed
 *    handler. The Window Manager in Mac OS X 10.2 and CarbonLib 1.6
 *    and later now sends these events in the reverse order:
 *    kEventWindowHidden first, followed by kEventWindowClosed. The
 *    last event sent to a window remains kEventWindowDispose.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeWindowRef)
 *          The window that was hidden.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        in CarbonLib 1.1 and later
 }
const kEventWindowHidden            = 25;

{
 *  kEventClassWindow / kEventWindowCollapsing
 *
 *  Summary:
 *    Notification that a window is about to collapse.
 *
 *  Discussion:
 *    This event is sent to all handlers registered for it.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeWindowRef)
 *          The window being collapsed.
 *
 *  Availability:
 *    Mac OS X:         in version 10.1 and later in Carbon.framework
 *    CarbonLib:        in CarbonLib 1.6 and later
 }
const kEventWindowCollapsing        = 86;

{
 *  kEventClassWindow / kEventWindowCollapsed
 *
 *  Summary:
 *    Notification that a window has successfully collapsed.
 *
 *  Discussion:
 *    This event is sent to all handlers registered for it.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeWindowRef)
 *          The window that was collapsed.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        in CarbonLib 1.1 and later
 }
const kEventWindowCollapsed         = 67;

{
 *  kEventClassWindow / kEventWindowExpanding
 *
 *  Summary:
 *    Notification that a window is about to expand.
 *
 *  Discussion:
 *    This event is sent to all handlers registered for it.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeWindowRef)
 *          The window being expanded.
 *
 *  Availability:
 *    Mac OS X:         in version 10.1 and later in Carbon.framework
 *    CarbonLib:        in CarbonLib 1.6 and later
 }
const kEventWindowExpanding         = 87;

{
 *  kEventClassWindow / kEventWindowExpanded
 *
 *  Summary:
 *    Notification that a window has successfully expanded.
 *
 *  Discussion:
 *    This event is sent to all handlers registered for it.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeWindowRef)
 *          The window that was expanded.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        in CarbonLib 1.1 and later
 }
const kEventWindowExpanded          = 70;

{
 *  kEventClassWindow / kEventWindowZoomed
 *
 *  Summary:
 *    Notification that a window has been successfully zoomed.
 *
 *  Discussion:
 *    This event is sent to all handlers registered for it. In
 *    CarbonLib 1.1 through CarbonLib 1.4, and Mac OS X 10.0 and 10.1,
 *    this event is only sent by the standard window event handler
 *    after handling kEventWindowZoom; starting with CarbonLib 1.5 and
 *    Mac OS X 10.2, this event is sent by ZoomWindow and
 *    ZoomWindowIdeal.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeWindowRef)
 *          The window that was zoomed.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        in CarbonLib 1.1 and later
 }
const kEventWindowZoomed            = 76;

{
 *  kEventClassWindow / kEventWindowBoundsChanging
 *
 *  Summary:
 *    Notification that a windowÕs bounds are about to be changed.
 *
 *  Discussion:
 *    Sent during DragWindow or ResizeWindow, before the window is
 *    actually moved or resized, and also during programmatic
 *    bounds-changing APIs such as SetWindowBounds and ZoomWindow. An
 *    event handler may alter the kEventParamCurrentBounds parameter in
 *    the event to change the eventual location of the window. You may
 *    change the size, origin, or both of the windowÕs bounds. Do not,
 *    however, call SizeWindow or SetWindowBounds yourself from inside
 *    a handler for this event.
 *
 *    In Mac OS X 10.1 and later, kEventWindowBoundsChanging is sent
 *    before all changes to a windowÕs bounds, regardless of whether
 *    the change is initiated by the user or by a direct call to a
 *    Window Manager API. Applications may intercept the event and
 *    modify the bounds. When the event is sent because of a direct
 *    call to the Window Manager, the
 *    kWindowBoundsChangeUserDrag/Resize attribute bits will not be set.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeWindowRef)
 *          The window being shown.
 *
 *    --> kEventParamAttributes (in, typeUInt32)
 *          The bounds-changing attributes indicating whether the
 *          window is being resized, moved, or both.
 *
 *    --> kEventParamOriginalBounds (in, typeQDRectangle)
 *          The windowÕs original bounds before the window resize or
 *          drag began.
 *
 *    --> kEventParamPreviousBounds (in, typeQDRectangle)
 *          The windowÕs bounds before the current bounds change.
 *
 *    <-> kEventParamCurrentBounds (in/out, typeQDRectangle)
 *          On entry, the windowÕs proposed new bounds; on exit, the
 *          bounds that are desired by the event handler.
 *
 *  Result:
 *    Return noErr to indicate that the Window Manager should use the
 *    kEventParamCurrentBounds parameter as the windowÕs new bounds.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        in CarbonLib 1.1 and later
 }
const kEventWindowBoundsChanging    = 26;

{
 *  kEventClassWindow / kEventWindowBoundsChanged
 *
 *  Summary:
 *    Notification that a windowÕs bounds have been changed.
 *
 *  Discussion:
 *    This event is sent to all handlers registered for it. Do not call
 *    SizeWindow or SetWindowBounds from inside a handler for this
 *    event; if you need to enforce a certain window bounds, install a
 *    kEventWindowBoundsChanging handler instead.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeWindowRef)
 *          The window whose bounds were changed.
 *
 *    --> kEventParamAttributes (in, typeUInt32)
 *          The bounds-changing attributes indicating whether the
 *          window was resized, moved, or both.
 *
 *    --> kEventParamOriginalBounds (in, typeQDRectangle)
 *          The windowÕs original bounds before the window resize or
 *          drag began.
 *
 *    --> kEventParamPreviousBounds (in, typeQDRectangle)
 *          The windowÕs bounds before the current bounds change.
 *
 *    --> kEventParamCurrentBounds (in, typeQDRectangle)
 *          The windowÕs new bounds.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        in CarbonLib 1.1 and later
 }
const kEventWindowBoundsChanged     = 27;

{
 *  kEventClassWindow / kEventWindowResizeStarted
 *
 *  Summary:
 *    Notification that the user has just started to resize a window.
 *
 *  Discussion:
 *    This event is sent to all handlers registered for it.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeWindowRef)
 *          The window being resized.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        in CarbonLib 1.1 and later
 }
const kEventWindowResizeStarted     = 28;

{
 *  kEventClassWindow / kEventWindowResizeCompleted
 *
 *  Summary:
 *    Notification that the user has just finished resizing a window.
 *
 *  Discussion:
 *    This event is sent to all handlers registered for it.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeWindowRef)
 *          The window that was resized.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        in CarbonLib 1.1 and later
 }
const kEventWindowResizeCompleted   = 29;

{
 *  kEventClassWindow / kEventWindowDragStarted
 *
 *  Summary:
 *    Notification that the user has just started to drag a window.
 *
 *  Discussion:
 *    This event is sent to all handlers registered for it.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeWindowRef)
 *          The window being dragged.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        in CarbonLib 1.1 and later
 }
const kEventWindowDragStarted       = 30;

{
 *  kEventClassWindow / kEventWindowDragCompleted
 *
 *  Summary:
 *    Notification that the user has just finished dragging a window.
 *
 *  Discussion:
 *    This event is sent to all handlers registered for it.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeWindowRef)
 *          The window that was dragged.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        in CarbonLib 1.1 and later
 }
const kEventWindowDragCompleted     = 31;

{
 *  kEventClassWindow / kEventWindowClosed
 *
 *  Summary:
 *    Notification that a window is being destroyed.
 *
 *  Discussion:
 *    This event is sent to all handlers registered for it. Prior to
 *    Mac OS X 10.2 and CarbonLib 1.6, kEventWindowClosed and
 *    kEventWindowHidden were sent in that order by the Window Manager
 *    to a window being destroyed. This was problematic if you had a
 *    Hidden handler which used data that was destroyed by the Closed
 *    handler. The Window Manager in Mac OS X 10.2 and CarbonLib 1.6
 *    and later now sends these events in the reverse order:
 *    kEventWindowHidden first, followed by kEventWindowClosed. The
 *    last event sent to a window remains kEventWindowDispose.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeWindowRef)
 *          The window being destroyed.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        in CarbonLib 1.1 and later
 }
const kEventWindowClosed            = 73;

{
 *  kEventClassWindow / kEventWindowTransitionStarted
 *
 *  Summary:
 *    Notification that a window transition has started.
 *
 *  Discussion:
 *    This event is sent to all handlers registered for it. It is sent
 *    by the TransitionWindow, TransitionWindowAndParent, and
 *    TransitionWindowWithOptions APIs just before the first frame of
 *    the transition animation.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeWindowRef)
 *          The window that will be transitioning.
 *
 *    --> kEventParamUserData (in, typeVoidPtr)
 *          The user data that was specified in the
 *          TransitionWindowOptions.userData field. If no user data was
 *          specified, this parameter will still be present, but its
 *          value will be NULL.
 *
 *    --> kEventParamWindowTransitionAction (in, typeWindowTransitionAction)
 *          The transition action that is starting.
 *
 *    --> kEventParamWindowTransitionEffect (in, typeWindowTransitionEffect)
 *          The transition effect that is starting.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const kEventWindowTransitionStarted = 88;

{
 *  kEventClassWindow / kEventWindowTransitionCompleted
 *
 *  Summary:
 *    Notification that a window transition has completed.
 *
 *  Discussion:
 *    This event is sent to all handlers registered for it. It is sent
 *    by the TransitionWindow, TransitionWindowAndParent, and
 *    TransitionWindowWithOptions APIs just after the last frame of the
 *    transition animation.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeWindowRef)
 *          The window that was transitioning.
 *
 *    --> kEventParamUserData (in, typeVoidPtr)
 *          The user data that was specified in the
 *          TransitionWindowOptions.userData field. If no user data was
 *          specified, this parameter will still be present, but its
 *          value will be NULL.
 *
 *    --> kEventParamWindowTransitionAction (in, typeWindowTransitionAction)
 *          The transition action that has completed.
 *
 *    --> kEventParamWindowTransitionEffect (in, typeWindowTransitionEffect)
 *          The transition effect that has completed.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const kEventWindowTransitionCompleted = 89;

{
 *  kEventClassWindow / kEventWindowClickDragRgn
 *
 *  Summary:
 *    Sent when the mouse is clicked in the drag region.
 *
 *  Discussion:
 *    The standard window handler responds to this event by checking if
 *    the click is a window path-select click; if so, it sends
 *    kEventWindowPathSelect to allow customization of the path-select
 *    menu, and then calls WindowPathSelect. If the click is not a
 *    path-select click, the standard window handler calls DragWindow.
 *    Note that this event is not sent for composited windows; the
 *    window frame view handles the mouse-down event directly. To
 *    intercept a drag region click in a composited window, install a
 *    kEventControlClick handler on the windowÕs root view.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeWindowRef)
 *          The window that was clicked.
 *
 *    --> kEventParamMouseLocation (in, typeHIPoint)
 *          The mouse location, in global coordinates.
 *
 *    --> kEventParamWindowRef (in, typeWindowRef)
 *          The window under the mouse. Available in Mac OS X 10.1 and
 *          later.
 *
 *    --> kEventParamWindowMouseLocation (in, typeHIPoint)
 *          The window-relative position of the mouse in the window
 *          given in the kEventParamWindowRef parameter. 0,0 is at the
 *          top left of the structure of the window. Available in Mac
 *          OS X 10.1 and later.
 *
 *    --> kEventParamWindowPartCode (in, typeWindowPartCode)
 *          The part code the mouse location hit in the window. This
 *          parameter only exists if the windowRef parameter exists.
 *          This saves you the trouble of calling FindWindow, which is
 *          expensive on Mac OS X as it needs to call the Window
 *          Server. Available in Mac OS X 10.3 and later.
 *
 *    --> kEventParamKeyModifiers (in, typeUInt32)
 *          The keyboard modifiers that were pressed when the event was
 *          generated.
 *
 *    --> kEventParamMouseButton (in, typeMouseButton)
 *          Which mouse button was pressed.
 *
 *    --> kEventParamClickCount (in, typeUInt32)
 *          Whether this is a single click, double click, etc.
 *
 *    --> kEventParamMouseChord (in, typeUInt32)
 *          Which other mouse buttons were pressed when the event was
 *          generated. Available on Mac OS X only.
 *
 *    --> kEventParamTabletEventType (in, typeUInt32)
 *          The type of tablet event which generated this mouse event;
 *          contains either kEventTabletPoint or kEventTabletProximity.
 *          Only present if the event was generated from a tablet.
 *          Available in Mac OS X 10.1 and CarbonLib 1.5, and later.
 *
 *    --> kEventParamTabletPointRec (in, typeTabletPointRec)
 *          Further information about the tablet event which generated
 *          this mouse event. Present if the the
 *          kEventParamTabletEventType parameter contains
 *          kEventTabletPoint. Available on Mac OS X 10.1 and CarbonLib
 *          1.5, and later.
 *
 *    --> kEventParamTabletProximityRec (in, typeTabletProximityRec)
 *          Further information about the tablet event which generated
 *          this mouse event. Present if the the
 *          kEventParamTabletEventType parameter contains
 *          kEventTabletProximity. Available on Mac OS X 10.1 and
 *          CarbonLib 1.5, and later.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        in CarbonLib 1.1 and later
 }
const kEventWindowClickDragRgn      = 32;

{
 *  kEventClassWindow / kEventWindowClickResizeRgn
 *
 *  Summary:
 *    Sent when the mouse is clicked in the resize area.
 *
 *  Discussion:
 *    The standard window handler responds to this event by calling
 *    ResizeWindow. Note that this event is not sent for composited
 *    windows; the window resize view handles the mouse-down event
 *    directly. To intercept a resize region click in a composited
 *    window, install a kEventControlClick handler on the windowÕs
 *    resize view.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeWindowRef)
 *          The window that was clicked.
 *
 *    --> kEventParamMouseLocation (in, typeHIPoint)
 *          The mouse location, in global coordinates.
 *
 *    --> kEventParamWindowRef (in, typeWindowRef)
 *          The window under the mouse. Available in Mac OS X 10.1 and
 *          later.
 *
 *    --> kEventParamWindowMouseLocation (in, typeHIPoint)
 *          The window-relative position of the mouse in the window
 *          given in the kEventParamWindowRef parameter. 0,0 is at the
 *          top left of the structure of the window. Available in Mac
 *          OS X 10.1 and later.
 *
 *    --> kEventParamWindowPartCode (in, typeWindowPartCode)
 *          The part code the mouse location hit in the window. This
 *          parameter only exists if the windowRef parameter exists.
 *          This saves you the trouble of calling FindWindow, which is
 *          expensive on Mac OS X as it needs to call the Window
 *          Server. Available in Mac OS X 10.3 and later.
 *
 *    --> kEventParamKeyModifiers (in, typeUInt32)
 *          The keyboard modifiers that were pressed when the event was
 *          generated.
 *
 *    --> kEventParamMouseButton (in, typeMouseButton)
 *          Which mouse button was pressed.
 *
 *    --> kEventParamClickCount (in, typeUInt32)
 *          Whether this is a single click, double click, etc.
 *
 *    --> kEventParamMouseChord (in, typeUInt32)
 *          Which other mouse buttons were pressed when the event was
 *          generated. Available on Mac OS X only.
 *
 *    --> kEventParamTabletEventType (in, typeUInt32)
 *          The type of tablet event which generated this mouse event;
 *          contains either kEventTabletPoint or kEventTabletProximity.
 *          Only present if the event was generated from a tablet.
 *          Available in Mac OS X 10.1 and CarbonLib 1.5, and later.
 *
 *    --> kEventParamTabletPointRec (in, typeTabletPointRec)
 *          Further information about the tablet event which generated
 *          this mouse event. Present if the the
 *          kEventParamTabletEventType parameter contains
 *          kEventTabletPoint. Available on Mac OS X 10.1 and CarbonLib
 *          1.5, and later.
 *
 *    --> kEventParamTabletProximityRec (in, typeTabletProximityRec)
 *          Further information about the tablet event which generated
 *          this mouse event. Present if the the
 *          kEventParamTabletEventType parameter contains
 *          kEventTabletProximity. Available on Mac OS X 10.1 and
 *          CarbonLib 1.5, and later.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        in CarbonLib 1.1 and later
 }
const kEventWindowClickResizeRgn    = 33;

{
 *  kEventClassWindow / kEventWindowClickCollapseRgn
 *
 *  Summary:
 *    Sent when the mouse is clicked in the collapse button.
 *
 *  Discussion:
 *    For all windows, the basic window handler responds to this event
 *    by tracking the click in the collapse button. If the mouse is
 *    released while still in the button, the basic window handler
 *    generates one of the kEventWindowCollapse,
 *    kEventWindowCollapseAll, kEventWindowExpand, or
 *    kEventWindowExpandAll events, depending on the windowÕs original
 *    collapse state and whether the option key was pressed. Note that
 *    this event is not sent for composited windows; the window
 *    collapse button view handles the mouse-down event directly. To
 *    intercept a collapse region click in a composited window, install
 *    a kEventControlClick handler on the windowÕs collapse button view.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeWindowRef)
 *          The window that was clicked.
 *
 *    --> kEventParamMouseLocation (in, typeHIPoint)
 *          The mouse location, in global coordinates.
 *
 *    --> kEventParamWindowRef (in, typeWindowRef)
 *          The window under the mouse. Available in Mac OS X 10.1 and
 *          later.
 *
 *    --> kEventParamWindowMouseLocation (in, typeHIPoint)
 *          The window-relative position of the mouse in the window
 *          given in the kEventParamWindowRef parameter. 0,0 is at the
 *          top left of the structure of the window. Available in Mac
 *          OS X 10.1 and later.
 *
 *    --> kEventParamWindowPartCode (in, typeWindowPartCode)
 *          The part code the mouse location hit in the window. This
 *          parameter only exists if the windowRef parameter exists.
 *          This saves you the trouble of calling FindWindow, which is
 *          expensive on Mac OS X as it needs to call the Window
 *          Server. Available in Mac OS X 10.3 and later.
 *
 *    --> kEventParamKeyModifiers (in, typeUInt32)
 *          The keyboard modifiers that were pressed when the event was
 *          generated.
 *
 *    --> kEventParamMouseButton (in, typeMouseButton)
 *          Which mouse button was pressed.
 *
 *    --> kEventParamClickCount (in, typeUInt32)
 *          Whether this is a single click, double click, etc.
 *
 *    --> kEventParamMouseChord (in, typeUInt32)
 *          Which other mouse buttons were pressed when the event was
 *          generated. Available on Mac OS X only.
 *
 *    --> kEventParamTabletEventType (in, typeUInt32)
 *          The type of tablet event which generated this mouse event;
 *          contains either kEventTabletPoint or kEventTabletProximity.
 *          Only present if the event was generated from a tablet.
 *          Available in Mac OS X 10.1 and CarbonLib 1.5, and later.
 *
 *    --> kEventParamTabletPointRec (in, typeTabletPointRec)
 *          Further information about the tablet event which generated
 *          this mouse event. Present if the the
 *          kEventParamTabletEventType parameter contains
 *          kEventTabletPoint. Available on Mac OS X 10.1 and CarbonLib
 *          1.5, and later.
 *
 *    --> kEventParamTabletProximityRec (in, typeTabletProximityRec)
 *          Further information about the tablet event which generated
 *          this mouse event. Present if the the
 *          kEventParamTabletEventType parameter contains
 *          kEventTabletProximity. Available on Mac OS X 10.1 and
 *          CarbonLib 1.5, and later.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        in CarbonLib 1.1 and later
 }
const kEventWindowClickCollapseRgn  = 34;

{
 *  kEventClassWindow / kEventWindowClickCloseRgn
 *
 *  Summary:
 *    Sent when the mouse is clicked in the close button.
 *
 *  Discussion:
 *    The standard window handler responds to this event by tracking
 *    the click in the close button. If the mouse is released while
 *    still in the button, the standard window handler generates one of
 *    the kEventWindowClose or kEventWindowCloseAll events, depending
 *    on whether the option key was pressed. Note that this event is
 *    not sent for composited windows; the window close button view
 *    handles the mouse-down event directly. To intercept a close
 *    region click in a composited window, install a kEventControlClick
 *    handler on the windowÕs close button view.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeWindowRef)
 *          The window that was clicked.
 *
 *    --> kEventParamMouseLocation (in, typeHIPoint)
 *          The mouse location, in global coordinates.
 *
 *    --> kEventParamWindowRef (in, typeWindowRef)
 *          The window under the mouse. Available in Mac OS X 10.1 and
 *          later.
 *
 *    --> kEventParamWindowMouseLocation (in, typeHIPoint)
 *          The window-relative position of the mouse in the window
 *          given in the kEventParamWindowRef parameter. 0,0 is at the
 *          top left of the structure of the window. Available in Mac
 *          OS X 10.1 and later.
 *
 *    --> kEventParamWindowPartCode (in, typeWindowPartCode)
 *          The part code the mouse location hit in the window. This
 *          parameter only exists if the windowRef parameter exists.
 *          This saves you the trouble of calling FindWindow, which is
 *          expensive on Mac OS X as it needs to call the Window
 *          Server. Available in Mac OS X 10.3 and later.
 *
 *    --> kEventParamKeyModifiers (in, typeUInt32)
 *          The keyboard modifiers that were pressed when the event was
 *          generated.
 *
 *    --> kEventParamMouseButton (in, typeMouseButton)
 *          Which mouse button was pressed.
 *
 *    --> kEventParamClickCount (in, typeUInt32)
 *          Whether this is a single click, double click, etc.
 *
 *    --> kEventParamMouseChord (in, typeUInt32)
 *          Which other mouse buttons were pressed when the event was
 *          generated. Available on Mac OS X only.
 *
 *    --> kEventParamTabletEventType (in, typeUInt32)
 *          The type of tablet event which generated this mouse event;
 *          contains either kEventTabletPoint or kEventTabletProximity.
 *          Only present if the event was generated from a tablet.
 *          Available in Mac OS X 10.1 and CarbonLib 1.5, and later.
 *
 *    --> kEventParamTabletPointRec (in, typeTabletPointRec)
 *          Further information about the tablet event which generated
 *          this mouse event. Present if the the
 *          kEventParamTabletEventType parameter contains
 *          kEventTabletPoint. Available on Mac OS X 10.1 and CarbonLib
 *          1.5, and later.
 *
 *    --> kEventParamTabletProximityRec (in, typeTabletProximityRec)
 *          Further information about the tablet event which generated
 *          this mouse event. Present if the the
 *          kEventParamTabletEventType parameter contains
 *          kEventTabletProximity. Available on Mac OS X 10.1 and
 *          CarbonLib 1.5, and later.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        in CarbonLib 1.1 and later
 }
const kEventWindowClickCloseRgn     = 35;

{
 *  kEventClassWindow / kEventWindowClickZoomRgn
 *
 *  Summary:
 *    Sent when the mouse is clicked in the zoom button.
 *
 *  Discussion:
 *    The standard window handler responds to this event by tracking
 *    the click in the zoom button. If the mouse is released while
 *    still in the button, the standard window handler generates one of
 *    the kEventWindowZoom or kEventWindowZoomAll events, depending on
 *    whether the option key was pressed. Note that this event is not
 *    sent for composited windows; the window zoom button view handles
 *    the mouse-down event directly. To intercept a zoom region click
 *    in a composited window, install a kEventControlClick handler on
 *    the windowÕs zoom region view.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeWindowRef)
 *          The window that was clicked.
 *
 *    --> kEventParamMouseLocation (in, typeHIPoint)
 *          The mouse location, in global coordinates.
 *
 *    --> kEventParamWindowRef (in, typeWindowRef)
 *          The window under the mouse. Available in Mac OS X 10.1 and
 *          later.
 *
 *    --> kEventParamWindowMouseLocation (in, typeHIPoint)
 *          The window-relative position of the mouse in the window
 *          given in the kEventParamWindowRef parameter. 0,0 is at the
 *          top left of the structure of the window. Available in Mac
 *          OS X 10.1 and later.
 *
 *    --> kEventParamWindowPartCode (in, typeWindowPartCode)
 *          The part code the mouse location hit in the window. This
 *          parameter only exists if the windowRef parameter exists.
 *          This saves you the trouble of calling FindWindow, which is
 *          expensive on Mac OS X as it needs to call the Window
 *          Server. Available in Mac OS X 10.3 and later.
 *
 *    --> kEventParamKeyModifiers (in, typeUInt32)
 *          The keyboard modifiers that were pressed when the event was
 *          generated.
 *
 *    --> kEventParamMouseButton (in, typeMouseButton)
 *          Which mouse button was pressed.
 *
 *    --> kEventParamClickCount (in, typeUInt32)
 *          Whether this is a single click, double click, etc.
 *
 *    --> kEventParamMouseChord (in, typeUInt32)
 *          Which other mouse buttons were pressed when the event was
 *          generated. Available on Mac OS X only.
 *
 *    --> kEventParamTabletEventType (in, typeUInt32)
 *          The type of tablet event which generated this mouse event;
 *          contains either kEventTabletPoint or kEventTabletProximity.
 *          Only present if the event was generated from a tablet.
 *          Available in Mac OS X 10.1 and CarbonLib 1.5, and later.
 *
 *    --> kEventParamTabletPointRec (in, typeTabletPointRec)
 *          Further information about the tablet event which generated
 *          this mouse event. Present if the the
 *          kEventParamTabletEventType parameter contains
 *          kEventTabletPoint. Available on Mac OS X 10.1 and CarbonLib
 *          1.5, and later.
 *
 *    --> kEventParamTabletProximityRec (in, typeTabletProximityRec)
 *          Further information about the tablet event which generated
 *          this mouse event. Present if the the
 *          kEventParamTabletEventType parameter contains
 *          kEventTabletProximity. Available on Mac OS X 10.1 and
 *          CarbonLib 1.5, and later.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        in CarbonLib 1.1 and later
 }
const kEventWindowClickZoomRgn      = 36;

{
 *  kEventClassWindow / kEventWindowClickContentRgn
 *
 *  Summary:
 *    Sent when the mouse is clicked in the content region.
 *
 *  Discussion:
 *    The standard window handler responds to this event by checking if
 *    the click should display a contextual menu; if so, and if the
 *    click was in an enabled control, it calls
 *    HandleControlContextualMenuSelect. If the click was not in a
 *    control, or if the control does not display a contextual menu,
 *    the standard window handler sends a
 *    kEventWindowContextualMenuSelect event to the window.
 *
 *    If the click was not a contextual menu click, then the standard
 *    window handler uses HIViewGetViewForMouseEvent to determine the
 *    HIView containing the click. If a view is found, the standard
 *    window handler calls HIViewClick, which will generate a
 *    kEventControlClick event.
 *
 *    If no view is found that contains the click, or if the containing
 *    view does not handle the click, then the standard window handler
 *    sends a kEventWindowHandleContentClick event.
 *
 *    Note that this event is not sent for composited windows; all
 *    mouse-downs in a composited window are handled by a view, and
 *    there is no Ócontent regionÓ in a composited window. To intercept
 *    a content region click in a composited window, install a
 *    kEventControlClick handler on the windowÕs content view, or
 *    provide your own HIView subclass.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeWindowRef)
 *          The window that was clicked.
 *
 *    --> kEventParamMouseLocation (in, typeHIPoint)
 *          The mouse location, in global coordinates.
 *
 *    --> kEventParamWindowRef (in, typeWindowRef)
 *          The window under the mouse. Available in Mac OS X 10.1 and
 *          later.
 *
 *    --> kEventParamWindowMouseLocation (in, typeHIPoint)
 *          The window-relative position of the mouse in the window
 *          given in the kEventParamWindowRef parameter. 0,0 is at the
 *          top left of the structure of the window. Available in Mac
 *          OS X 10.1 and later.
 *
 *    --> kEventParamWindowPartCode (in, typeWindowPartCode)
 *          The part code the mouse location hit in the window. This
 *          parameter only exists if the windowRef parameter exists.
 *          This saves you the trouble of calling FindWindow, which is
 *          expensive on Mac OS X as it needs to call the Window
 *          Server. Available in Mac OS X 10.3 and later.
 *
 *    --> kEventParamKeyModifiers (in, typeUInt32)
 *          The keyboard modifiers that were pressed when the event was
 *          generated.
 *
 *    --> kEventParamMouseButton (in, typeMouseButton)
 *          Which mouse button was pressed.
 *
 *    --> kEventParamClickCount (in, typeUInt32)
 *          Whether this is a single click, double click, etc.
 *
 *    --> kEventParamMouseChord (in, typeUInt32)
 *          Which other mouse buttons were pressed when the event was
 *          generated. Available on Mac OS X only.
 *
 *    --> kEventParamTabletEventType (in, typeUInt32)
 *          The type of tablet event which generated this mouse event;
 *          contains either kEventTabletPoint or kEventTabletProximity.
 *          Only present if the event was generated from a tablet.
 *          Available in Mac OS X 10.1 and CarbonLib 1.5, and later.
 *
 *    --> kEventParamTabletPointRec (in, typeTabletPointRec)
 *          Further information about the tablet event which generated
 *          this mouse event. Present if the the
 *          kEventParamTabletEventType parameter contains
 *          kEventTabletPoint. Available on Mac OS X 10.1 and CarbonLib
 *          1.5, and later.
 *
 *    --> kEventParamTabletProximityRec (in, typeTabletProximityRec)
 *          Further information about the tablet event which generated
 *          this mouse event. Present if the the
 *          kEventParamTabletEventType parameter contains
 *          kEventTabletProximity. Available on Mac OS X 10.1 and
 *          CarbonLib 1.5, and later.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        in CarbonLib 1.1 and later
 }
const kEventWindowClickContentRgn   = 37;

{
 *  kEventClassWindow / kEventWindowClickProxyIconRgn
 *
 *  Summary:
 *    Sent when the mouse is clicked in the proxy icon.
 *
 *  Discussion:
 *    The standard window handler responds to this event by handling
 *    proxy icon dragging. It first sends a kEventWindowProxyBeginDrag
 *    event to allow customization of the DragRef, and then calls
 *    TrackWindowProxyFromExistingDrag. Finally, the standard window
 *    handler sends a kEventWindowProxyEndDrag event. Note that this
 *    event is not sent for composited windows; the window title view
 *    handles the mouse-down event directly. To intercept a proxy icon
 *    region click in a composited window, install a kEventControlClick
 *    handler on the windowÕs title view.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeWindowRef)
 *          The window that was clicked.
 *
 *    --> kEventParamMouseLocation (in, typeHIPoint)
 *          The mouse location, in global coordinates.
 *
 *    --> kEventParamWindowRef (in, typeWindowRef)
 *          The window under the mouse. Available in Mac OS X 10.1 and
 *          later.
 *
 *    --> kEventParamWindowMouseLocation (in, typeHIPoint)
 *          The window-relative position of the mouse in the window
 *          given in the kEventParamWindowRef parameter. 0,0 is at the
 *          top left of the structure of the window. Available in Mac
 *          OS X 10.1 and later.
 *
 *    --> kEventParamWindowPartCode (in, typeWindowPartCode)
 *          The part code the mouse location hit in the window. This
 *          parameter only exists if the windowRef parameter exists.
 *          This saves you the trouble of calling FindWindow, which is
 *          expensive on Mac OS X as it needs to call the Window
 *          Server. Available in Mac OS X 10.3 and later.
 *
 *    --> kEventParamKeyModifiers (in, typeUInt32)
 *          The keyboard modifiers that were pressed when the event was
 *          generated.
 *
 *    --> kEventParamMouseButton (in, typeMouseButton)
 *          Which mouse button was pressed.
 *
 *    --> kEventParamClickCount (in, typeUInt32)
 *          Whether this is a single click, double click, etc.
 *
 *    --> kEventParamMouseChord (in, typeUInt32)
 *          Which other mouse buttons were pressed when the event was
 *          generated. Available on Mac OS X only.
 *
 *    --> kEventParamTabletEventType (in, typeUInt32)
 *          The type of tablet event which generated this mouse event;
 *          contains either kEventTabletPoint or kEventTabletProximity.
 *          Only present if the event was generated from a tablet.
 *          Available in Mac OS X 10.1 and CarbonLib 1.5, and later.
 *
 *    --> kEventParamTabletPointRec (in, typeTabletPointRec)
 *          Further information about the tablet event which generated
 *          this mouse event. Present if the the
 *          kEventParamTabletEventType parameter contains
 *          kEventTabletPoint. Available on Mac OS X 10.1 and CarbonLib
 *          1.5, and later.
 *
 *    --> kEventParamTabletProximityRec (in, typeTabletProximityRec)
 *          Further information about the tablet event which generated
 *          this mouse event. Present if the the
 *          kEventParamTabletEventType parameter contains
 *          kEventTabletProximity. Available on Mac OS X 10.1 and
 *          CarbonLib 1.5, and later.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        in CarbonLib 1.1 and later
 }
const kEventWindowClickProxyIconRgn = 38;

{
 *  kEventClassWindow / kEventWindowClickToolbarButtonRgn
 *
 *  Summary:
 *    Sent when the mouse is clicked in the toolbar button.
 *
 *  Discussion:
 *    For all windows, the basic window handler responds to this event
 *    by tracking the click in the toolbar button. If the mouse is
 *    released while still in the button, the basic window handler
 *    sends a kEventWindowToolbarSwitchMode event. Note that this event
 *    is not sent for composited windows; the window toolbar button
 *    view handles the mouse-down event directly. To intercept a
 *    toolbar button region click in a composited window, install a
 *    kEventControlClick handler on the windowÕs toolbar button view.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeWindowRef)
 *          The window that was clicked.
 *
 *    --> kEventParamMouseLocation (in, typeHIPoint)
 *          The mouse location, in global coordinates.
 *
 *    --> kEventParamWindowRef (in, typeWindowRef)
 *          The window under the mouse. Available in Mac OS X 10.1 and
 *          later.
 *
 *    --> kEventParamWindowMouseLocation (in, typeHIPoint)
 *          The window-relative position of the mouse in the window
 *          given in the kEventParamWindowRef parameter. 0,0 is at the
 *          top left of the structure of the window. Available in Mac
 *          OS X 10.1 and later.
 *
 *    --> kEventParamWindowPartCode (in, typeWindowPartCode)
 *          The part code the mouse location hit in the window. This
 *          parameter only exists if the windowRef parameter exists.
 *          This saves you the trouble of calling FindWindow, which is
 *          expensive on Mac OS X as it needs to call the Window
 *          Server. Available in Mac OS X 10.3 and later.
 *
 *    --> kEventParamKeyModifiers (in, typeUInt32)
 *          The keyboard modifiers that were pressed when the event was
 *          generated.
 *
 *    --> kEventParamMouseButton (in, typeMouseButton)
 *          Which mouse button was pressed.
 *
 *    --> kEventParamClickCount (in, typeUInt32)
 *          Whether this is a single click, double click, etc.
 *
 *    --> kEventParamMouseChord (in, typeUInt32)
 *          Which other mouse buttons were pressed when the event was
 *          generated. Available on Mac OS X only.
 *
 *    --> kEventParamTabletEventType (in, typeUInt32)
 *          The type of tablet event which generated this mouse event;
 *          contains either kEventTabletPoint or kEventTabletProximity.
 *          Only present if the event was generated from a tablet.
 *          Available in Mac OS X 10.1 and CarbonLib 1.5, and later.
 *
 *    --> kEventParamTabletPointRec (in, typeTabletPointRec)
 *          Further information about the tablet event which generated
 *          this mouse event. Present if the the
 *          kEventParamTabletEventType parameter contains
 *          kEventTabletPoint. Available on Mac OS X 10.1 and CarbonLib
 *          1.5, and later.
 *
 *    --> kEventParamTabletProximityRec (in, typeTabletProximityRec)
 *          Further information about the tablet event which generated
 *          this mouse event. Present if the the
 *          kEventParamTabletEventType parameter contains
 *          kEventTabletProximity. Available on Mac OS X 10.1 and
 *          CarbonLib 1.5, and later.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const kEventWindowClickToolbarButtonRgn = 41;

{
 *  kEventClassWindow / kEventWindowClickStructureRgn
 *
 *  Summary:
 *    Sent when the mouse is clicked in some part of the window
 *    structure other than the window widgets, drag region, or resize
 *    region.
 *
 *  Discussion:
 *    The standard window handler responds to this event by calling
 *    HIViewGetViewForMouseEvent to determine the HIView containing the
 *    click. If a view is found, the standard window handler calls
 *    HIViewClick, which will generate a kEventControlClick event. Note
 *    that this event is not sent for composited windows; all parts of
 *    the window frame are built from views, and the mouse will never
 *    land outside of a view.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeWindowRef)
 *          The window that was clicked.
 *
 *    --> kEventParamMouseLocation (in, typeHIPoint)
 *          The mouse location, in global coordinates.
 *
 *    --> kEventParamWindowRef (in, typeWindowRef)
 *          The window under the mouse. Available in Mac OS X 10.1 and
 *          later.
 *
 *    --> kEventParamWindowMouseLocation (in, typeHIPoint)
 *          The window-relative position of the mouse in the window
 *          given in the kEventParamWindowRef parameter. 0,0 is at the
 *          top left of the structure of the window. Available in Mac
 *          OS X 10.1 and later.
 *
 *    --> kEventParamWindowPartCode (in, typeWindowPartCode)
 *          The part code the mouse location hit in the window. This
 *          parameter only exists if the windowRef parameter exists.
 *          This saves you the trouble of calling FindWindow, which is
 *          expensive on Mac OS X as it needs to call the Window
 *          Server. Available in Mac OS X 10.3 and later.
 *
 *    --> kEventParamKeyModifiers (in, typeUInt32)
 *          The keyboard modifiers that were pressed when the event was
 *          generated.
 *
 *    --> kEventParamMouseButton (in, typeMouseButton)
 *          Which mouse button was pressed.
 *
 *    --> kEventParamClickCount (in, typeUInt32)
 *          Whether this is a single click, double click, etc.
 *
 *    --> kEventParamMouseChord (in, typeUInt32)
 *          Which other mouse buttons were pressed when the event was
 *          generated. Available on Mac OS X only.
 *
 *    --> kEventParamTabletEventType (in, typeUInt32)
 *          The type of tablet event which generated this mouse event;
 *          contains either kEventTabletPoint or kEventTabletProximity.
 *          Only present if the event was generated from a tablet.
 *          Available in Mac OS X 10.1 and CarbonLib 1.5, and later.
 *
 *    --> kEventParamTabletPointRec (in, typeTabletPointRec)
 *          Further information about the tablet event which generated
 *          this mouse event. Present if the the
 *          kEventParamTabletEventType parameter contains
 *          kEventTabletPoint. Available on Mac OS X 10.1 and CarbonLib
 *          1.5, and later.
 *
 *    --> kEventParamTabletProximityRec (in, typeTabletProximityRec)
 *          Further information about the tablet event which generated
 *          this mouse event. Present if the the
 *          kEventParamTabletEventType parameter contains
 *          kEventTabletProximity. Available on Mac OS X 10.1 and
 *          CarbonLib 1.5, and later.
 *
 *  Availability:
 *    Mac OS X:         in version 10.1 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const kEventWindowClickStructureRgn = 42;


{
 *  kEventClassWindow / kEventWindowCursorChange
 *
 *  Summary:
 *    Sent when the mouse is moving over the content region of a window.
 *
 *  Discussion:
 *    This event is used to manage ownership of the cursor. You should
 *    only change the cursor if you receive this event; otherwise,
 *    someone else needed to adjust the cursor and handled the event
 *    (e.g., a TSM Input Method when the mouse is over an inline input
 *    region). This event is only sent to the window itself; it is not
 *    propagated to controls in the window.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeWindowRef)
 *          The window under the mouse.
 *
 *    --> kEventParamMouseLocation (in, typeQDPoint)
 *          The mouse location in global coordinates.
 *
 *    --> kEventParamKeyModifiers (in, typeUInt32)
 *          The current keyboard modifiers.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        in CarbonLib 1.5 and later
 }
const kEventWindowCursorChange      = 40;

{
 *  kEventClassWindow / kEventWindowCollapse
 *
 *  Summary:
 *    A request to collapse a window.
 *
 *  Discussion:
 *    For all windows, the basic window handler responds to this event
 *    by calling CollapseWindow, passing true for the collapse
 *    parameter, which sends kEventWindowCollapsing and
 *    kEventWindowCollapsed events. This event is generated by the
 *    standard window handler in response to a click in a windowÕs
 *    collapse button. It is also generated by the basic window handler
 *    when Minimize or Collapse is selected from the standard window
 *    menu.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeWindowRef)
 *          The window that should collapse.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        in CarbonLib 1.1 and later
 }
const kEventWindowCollapse          = 66;

{
 *  kEventClassWindow / kEventWindowCollapseAll
 *
 *  Summary:
 *    A request to collapse all windows.
 *
 *  Discussion:
 *    For all windows, the basic window handler responds to this event
 *    by calling CollapseAllWindows, passing true for the collapse
 *    parameter. CollapseAllWindows simply calls CollapseWindow on each
 *    window; it does not send a kEventWindowCollapse to each window.
 *    This event is generated by the standard window handler in
 *    response to an option-click in a windowÕs collapse button. It is
 *    also generated by the basic window handler when Minimize All or
 *    Collapse All is selected from the standard window menu.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeWindowRef)
 *          The window whose collapse button was clicked.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        in CarbonLib 1.1 and later
 }
const kEventWindowCollapseAll       = 68;

{
 *  kEventClassWindow / kEventWindowExpand
 *
 *  Summary:
 *    A request to expand a window.
 *
 *  Discussion:
 *    For all windows, the basic window handler responds to this event
 *    by calling CollapseWindow, passing false for the collapse
 *    parameter, which sends kEventWindowExpanding and
 *    kEventWindowExpanded events. This event is generated by the
 *    standard window handler in responds to a click in a collapsed
 *    windowÕs collapse button. It is also generated by the basic
 *    window handler when Uncollapse is selected from from the standard
 *    window menu provided by CarbonLib.
 *
 *    Note that you will not receive this event on Mac OS X before a
 *    window is expanded from the Dock, since minimized windows in the
 *    dock donÕt uses collapse buttons to unminimize. However, you will
 *    still receive kEventWindowExpanding and kEventWindowExpanded in
 *    that case. You will receive this event on Mac OS 8 and 9 using
 *    CarbonLib since collapsed windows do have a collapse button there.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeWindowRef)
 *          The window that should expand.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        in CarbonLib 1.1 and later
 }
const kEventWindowExpand            = 69;

{
 *  kEventClassWindow / kEventWindowExpandAll
 *
 *  Summary:
 *    A request to expand all windows.
 *
 *  Discussion:
 *    For all windows, the basic window handler responds to this event
 *    by calling CollapseAllWindows, passing false for the collapse
 *    parameter. On Mac OS X 10.3 and later, CollapseAllWindows sends a
 *    kEventWindowExpand event to each window; on earlier version of
 *    Mac OS X, and in CarbonLib, it simply calls CollapseWindow on
 *    each window. This event is generated by the standard window
 *    handler in response to an option-click in a windowÕs collapse
 *    button. It is also generated by the basic window handler when
 *    Uncollapse All is selected from the standard window menu provided
 *    by CarbonLib.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeWindowRef)
 *          The window whose collapse button was clicked.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        in CarbonLib 1.1 and later
 }
const kEventWindowExpandAll         = 71;

{
 *  kEventClassWindow / kEventWindowClose
 *
 *  Summary:
 *    A request to close a window.
 *
 *  Discussion:
 *    The standard window handler responds to this event by calling
 *    DisposeWindow. This event is generated by the standard window
 *    handler in response to a click in a windowÕs close button. On Mac
 *    OS X 10.3 and later, it is also generated when the Close menu
 *    item is selected from the Dock menu of a minimized window.
 *
 *
 *    Your application would typically intercept this event to check if
 *    the windowÕs document is dirty, and display a Save Changes alert
 *    if so.
 *
 *    In order to support closing minimized windows from the Dock, your
 *    application must provide an event hander for this event,
 *    installed on the windowÕs event target, even if your application
 *    does not use the standard window handler or otherwise use Carbon
 *    events.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeWindowRef)
 *          The window that should close.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        in CarbonLib 1.1 and later
 }
const kEventWindowClose             = 72;

{
 *  kEventClassWindow / kEventWindowCloseAll
 *
 *  Summary:
 *    A request to close all windows.
 *
 *  Discussion:
 *    The standard window handler responds to this event by sending a
 *    kEventWindowClose event to all visible windows of the same window
 *    class as the target window. This event is generated by the
 *    standard window handler in response to an option-click in a
 *    windowÕs close button.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeWindowRef)
 *          The window whose close button was clicked.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        in CarbonLib 1.1 and later
 }
const kEventWindowCloseAll          = 74;

{
 *  kEventClassWindow / kEventWindowZoom
 *
 *  Summary:
 *    A request to zoom a window.
 *
 *  Discussion:
 *    For all windows, the basic window handler responds to this event
 *    by sending a kEventWindowIdealSize event to get the windowÕs
 *    ideal size, and then calling ZoomWindowIdeal. This event is
 *    generated by the standard window handler in response to a click
 *    in the windowÕs zoom button. It is also generated by the basic
 *    window handler when Zoom is selected from the standard window
 *    menu.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeWindowRef)
 *          The window that should zoom.
 *
 *    --> kEventParamWindowPartCode (in, typeWindowPartCode)
 *          The part code (inZoomIn or inZoomOut) that should be passed
 *          to ZoomWindow or ZoomWindowIdeal. This parameter is
 *          optional and may not be present in all instances of this
 *          event. If present, the event handler should determine if
 *          the window is already in the requested state (i.e., if the
 *          part code is inZoomOut and the window is already in the
 *          standard state), and if so, the event handler should not
 *          zoom the window at all. If this parameter is not present,
 *          the event handler should zoom the window based on its
 *          current state. This parameter is available in Mac OS X 10.3
 *          and later.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        in CarbonLib 1.1 and later
 }
const kEventWindowZoom              = 75;

{
 *  kEventClassWindow / kEventWindowZoomAll
 *
 *  Summary:
 *    A request to zoom all windows.
 *
 *  Discussion:
 *    The standard window handler responds to this event by zooming all
 *    visible windows of the same window class as the target window. On
 *    Mac OS X 10.3 and later, it causes each window to zoom by sending
 *    a kEventWindowZoom event to the window; on earlier versions of
 *    Mac OS X, and in CarbonLib, it simply calls ZoomWindowIdeal on
 *    each window. This event is generated by the standard window
 *    handler in response to an option-click on a windowÕs zoom button.
 *
 *
 *    After zooming all of the windows, if the windows are being zoomed
 *    out and the window class of the target window is
 *    kDocumentWindowClass, the windows are cascaded by sending a
 *    kEventCommandProcess event with the kHICommandArrangeInFront
 *    command to the target window.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeWindowRef)
 *          The window whose zoom button was clicked.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        in CarbonLib 1.1 and later
 }
const kEventWindowZoomAll           = 77;

{
 *  kEventClassWindow / kEventWindowContextualMenuSelect
 *
 *  Summary:
 *    A request to display a contextual menu.
 *
 *  Discussion:
 *    This event is generated by the standard window handler in
 *    response to a contextual menu click in the content area of a
 *    window. In response to such an event, the standard window handler
 *    first checks if the click is on a control, and if so, calls
 *    HandleControlContextualMenuClick. If the click was not on a
 *    control, or if HandleControlContextualMenuClick returned that it
 *    did not handle the click, then the standard window handler sends
 *    kEventWindowContextualMenuSelect to allow the application to
 *    provide its own customized contextual menu. The standard window
 *    handler does not respond to this event itself.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeWindowRef)
 *          The window that should collapse.
 *
 *    --> kEventParamMouseLocation (in, typeHIPoint)
 *          The mouse location, in global coordinates.
 *
 *    --> kEventParamWindowRef (in, typeWindowRef)
 *          The window under the mouse. Available in Mac OS X 10.1 and
 *          later.
 *
 *    --> kEventParamWindowMouseLocation (in, typeHIPoint)
 *          The window-relative position of the mouse in the window
 *          given in the kEventParamWindowRef parameter. 0,0 is at the
 *          top left of the structure of the window. Available in Mac
 *          OS X 10.1 and later.
 *
 *    --> kEventParamWindowPartCode (in, typeWindowPartCode)
 *          The part code the mouse location hit in the window. This
 *          parameter only exists if the windowRef parameter exists.
 *          This saves you the trouble of calling FindWindow, which is
 *          expensive on Mac OS X as it needs to call the Window
 *          Server. Available in Mac OS X 10.3 and later.
 *
 *    --> kEventParamKeyModifiers (in, typeUInt32)
 *          The keyboard modifiers that were pressed when the event was
 *          generated.
 *
 *    --> kEventParamMouseButton (in, typeMouseButton)
 *          Which mouse button was pressed.
 *
 *    --> kEventParamClickCount (in, typeUInt32)
 *          Whether this is a single click, double click, etc.
 *
 *    --> kEventParamMouseChord (in, typeUInt32)
 *          Which other mouse buttons were pressed when the event was
 *          generated. Available on Mac OS X only.
 *
 *    --> kEventParamTabletEventType (in, typeUInt32)
 *          The type of tablet event which generated this mouse event;
 *          contains either kEventTabletPoint or kEventTabletProximity.
 *          Only present if the event was generated from a tablet.
 *          Available in Mac OS X 10.1 and CarbonLib 1.5, and later.
 *
 *    --> kEventParamTabletPointRec (in, typeTabletPointRec)
 *          Further information about the tablet event which generated
 *          this mouse event. Present if the the
 *          kEventParamTabletEventType parameter contains
 *          kEventTabletPoint. Available on Mac OS X 10.1 and CarbonLib
 *          1.5, and later.
 *
 *    --> kEventParamTabletProximityRec (in, typeTabletProximityRec)
 *          Further information about the tablet event which generated
 *          this mouse event. Present if the the
 *          kEventParamTabletEventType parameter contains
 *          kEventTabletProximity. Available on Mac OS X 10.1 and
 *          CarbonLib 1.5, and later.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        in CarbonLib 1.1 and later
 }
const kEventWindowContextualMenuSelect = 78;

{
 *  kEventClassWindow / kEventWindowPathSelect
 *
 *  Summary:
 *    Allows customization of the path-selection popup menu displayed
 *    over a windowÕs title.
 *
 *  Discussion:
 *    This event is generated by the standard window handler in
 *    response to a click in a windowÕs drag region. In response to
 *    such an event, the standard window handler first calls
 *    IsWindowPathSelectEvent to determine if the click should cause a
 *    path-selection popup menu to be displayed. If so, and if the
 *    window is also hilited and has a proxy icon, the standard window
 *    handler sends a kEventWindowPathSelect event to the window.
 *
 *
 *    A handler for this event should put a MenuRef into the event and
 *    return noErr to cause the menu to be displayed as the path
 *    selection popup menu. The menu will not be released by the
 *    standard window handler.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeWindowRef)
 *          The window that will display the path-selection popup menu.
 *
 *    <-- kEventParamMenuRef (out, typeMenuRef)
 *          On exit, contains the menu that should be displayed.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        in CarbonLib 1.1 and later
 }
const kEventWindowPathSelect        = 79;

{
 *  kEventClassWindow / kEventWindowGetIdealSize
 *
 *  Summary:
 *    A request for the ideal size of a windowÕs content region, for
 *    use during window zooming.
 *
 *  Discussion:
 *    This event is generated by the basic window handler in response
 *    to kEventWindowZoom. The basic window handler sends this event to
 *    the window to get the windowÕs ideal size, and passes the
 *    resulting size to ZoomWindowIdeal.
 *
 *    This event is not handled by either the basic or standard window
 *    handlers. If no handler responds to this event, the basic window
 *    handler uses an ideal size based on the size of the monitor on
 *    which the window is located.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeWindowRef)
 *          The window being zoomed.
 *
 *    <-- kEventParamDimensions (out, typeQDPoint)
 *          On exit, contains the windowÕs ideal size.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        in CarbonLib 1.1 and later
 }
const kEventWindowGetIdealSize      = 80;

{
 *  kEventClassWindow / kEventWindowGetMinimumSize
 *
 *  Summary:
 *    A request for the minimum size of a windowÕs content region, for
 *    use during window resizing.
 *
 *  Discussion:
 *    This event is generated by the standard window handler before
 *    resizing a window. On Mac OS X 10.2 and later, the basic window
 *    handler responds to this event by calling GetWindowResizeLimits
 *    and returning the minimum size in the event; on earlier versions
 *    of Mac OS X and CarbonLib, this event is not handled by the basic
 *    or standard window handlers.
 *
 *    On Mac OS X 10.2 and CarbonLib 1.6 and later, this event is also
 *    generated by ResizeWindow and GrowWindow if the sizeConstraints
 *    parameter is NULL.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeWindowRef)
 *          The window being resized.
 *
 *    <-- kEventParamDimensions (out, typeQDPoint)
 *          On exit, contains the windowÕs minimum size.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        in CarbonLib 1.1 and later
 }
const kEventWindowGetMinimumSize    = 81;

{
 *  kEventClassWindow / kEventWindowGetMaximumSize
 *
 *  Summary:
 *    A request for the maximum size of a windowÕs content region, for
 *    use during window resizing.
 *
 *  Discussion:
 *    This event is generated by the standard window handler before
 *    resizing a window. On Mac OS X 10.2 and later, the basic window
 *    handler responds to this event by calling GetWindowResizeLimits
 *    and returning the maximum size in the event; on earlier versions
 *    of Mac OS X and CarbonLib, this event is not handled by the basic
 *    or standard window handlers.
 *
 *    On Mac OS X 10.2 and CarbonLib 1.6 and later, this event is also
 *    generated by ResizeWindow and GrowWindow if the sizeConstraints
 *    parameter is NULL.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeWindowRef)
 *          The window being resized.
 *
 *    <-- kEventParamDimensions (out, typeQDPoint)
 *          On exit, contains the windowÕs minimum size.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        in CarbonLib 1.1 and later
 }
const kEventWindowGetMaximumSize    = 82;

{
 *  kEventClassWindow / kEventWindowConstrain
 *
 *  Summary:
 *    Requests that a windowÕs position be constrained to the available
 *    window positioning bounds.
 *
 *  Discussion:
 *    The basic window handler responds to this event by calling
 *    ConstrainWindowToScreen. This event is generated in two
 *    situations: changes in graphics device configuration, and changes
 *    to Dock size. In either case, a window which was previously
 *    visible onscreen may become obscured or be totally offscreen, and
 *    should be repositioned back inside the available window
 *    positioning bounds.
 *
 *    The behavior of the basic window handler may be customized by
 *    modifying the parameters to the event and then allowing the event
 *    to pass through to the basic handler, or an application may
 *    choose to override the event entirely and perform its own window
 *    constraining.
 *
 *    Applications may also use the
 *    kEventAppAvailableWindowBoundsChanged event to be notified of
 *    changes to a deviceÕs available bounds.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeWindowRef)
 *          The window being constrained.
 *
 *    --> kEventParamAvailableBounds (in, typeQDRectangle)
 *          The reasons why the window is being constrained. This
 *          parameter contains one or more of the
 *          kAvailBoundsChangedFor constants. This parameter is
 *          available only on Mac OS X 10.3 and later.
 *
 *    --> kEventParamAttributes (in, typeUInt32)
 *          An integer which is the same for all instances of this
 *          event that are produced by the same configuration change.
 *          For example, if multiple displays are attached, then this
 *          event is sent once for each window on each affected display
 *          after a display configuration change; however, the
 *          transaction ID parameter will the same for each event, so a
 *          handler for this event can correlate events by observing
 *          the transaction ID. This parameter is available only on Mac
 *          OS X 10.3 and later.
 *
 *    --> kEventParamWindowRegionCode (in, typeWindowRegionCode)
 *          The available window positioning bounds in which the window
 *          should be positioned. Event handlers may change the value
 *          in this parameter and then return eventNotHandledErr to
 *          allow the basic window handler to constrain the window to
 *          the new bounding rect.
 *
 *          This parameter is used by the basic window handler on Mac
 *          OS X 10.1 and later; on earlier versions of Mac OS X, the
 *          basic window handler always constrains the window to the
 *          rect returned by GetAvailableWindowPositioningBounds for
 *          the windowÕs device.
 *
 *    --> kEventParamRgnHandle (in, typeQDRgnHandle)
 *          Window constraint options that should be passed to
 *          ConstrainWindowToScreen. This parameter is optional and may
 *          not be present in all instances of this event. If present,
 *          this parameter should be formed from constants in the
 *          WindowConstrainOptions enumeration.
 *
 *          This parameter is used by the basic window handler on Mac
 *          OS X 10.2 and later; on earlier versions of Mac OS X, or if
 *          this parameter is missing, the basic window handler passes
 *          kWindowConstrainMoveRegardlessOfFit to
 *          ConstrainWindowToScreen in Mac OS X 10.0, and
 *          kWindowConstrainMoveRegardlessOfFit |
 *          kWindowConstrainAllowPartial in Mac OS 10.1 and later.
 *
 *    --> kEventParamPreviousDockRect (in, typeHIRect)
 *          A WindowRegionCode that should be passed to
 *          ConstrainWindowToScreen. This parameter is optional and may
 *          not be present in all instances of this event.
 *
 *          This parameter is used by the basic window handler on Mac
 *          OS X 10.2 and later. On earlier versions of Mac OS X, or if
 *          this parameter is missing, the basic window handler passes
 *          kWindowDragRgn to ConstrainWindowToScreen.
 *
 *    --> kEventParamPreviousDockDevice (in, typeGDHandle)
 *          The GrayRgn before a graphics device configuration change.
 *          This parameter is optional and may not be present in all
 *          instances of this event. It is present in events generated
 *          on Mac OS X 10.2 and later.
 *
 *          An event handler may compare this region with the current
 *          GrayRgn to more intelligently determine whether the window
 *          should be constrained to the current GrayRgn. The basic
 *          window handler in Mac OS X 10.2 will not constrain windows
 *          that were not onscreen before the device configuration
 *          change.
 *
 *    --> kEventParamCurrentDockRect (in, typeHIRect)
 *          The Dock bounding rect before a Dock size change. This
 *          parameter is optional and may not be present in all
 *          instances of this event. It is present in events in events
 *          generated on Mac OS X 10.2 and later.
 *
 *    --> kEventParamCurrentDockDevice (in, typeGDHandle)
 *          The GDevice on which the Dock was previously positioned.
 *          This parameter is optional and may not be present in all
 *          instances of this event. It is present in events generated
 *          on Mac OS X 10.3 and later.
 *
 *    --> kEventParamTabletEventType (in, typeUInt32)
 *          The Dock bounding rect after a Dock size change. This
 *          parameter is optional and may not be present in all
 *          instances of this event. It is present in events in events
 *          generated on Mac OS X 10.2 and later.
 *
 *    --> kEventParamTabletPointRec (in, typeTabletPointRec)
 *          The GDevice on which the Dock is currently positioned. This
 *          parameter is optional and may not be present in all
 *          instances of this event. It is present in events generated
 *          on Mac OS X 10.3 and later.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        in CarbonLib 1.5 and later
 }
const kEventWindowConstrain         = 83;

{
 *  kEventClassWindow / kEventWindowProxyBeginDrag
 *
 *  Summary:
 *    Notification that a proxy icon drag is beginning.
 *
 *  Discussion:
 *    This event includes the DragRef that will be used for the proxy
 *    icon drag. An application handler may attach its own data to the
 *    DragRef as appropriate for the document content.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeWindowRef)
 *          The window whose proxy icon is being dragged.
 *
 *    --> kEventParamDragRef (in, typeDragRef)
 *          The DragRef that will be used for the proxy icon drag.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        in CarbonLib 1.1 and later
 }
const kEventWindowProxyBeginDrag    = 128;

{
 *  kEventClassWindow / kEventWindowProxyEndDrag
 *
 *  Summary:
 *    Notification that a proxy icon drag has ended.
 *
 *  Discussion:
 *    This event is sent regardless of whether the drag completed
 *    successfully, or was canceled by the user.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeWindowRef)
 *          The window whose proxy icon is being dragged.
 *
 *    --> kEventParamDragRef (in, typeDragRef)
 *          The DragRef that was used for the proxy icon drag.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        in CarbonLib 1.1 and later
 }
const kEventWindowProxyEndDrag      = 129;

{
 *  kEventClassWindow / kEventWindowHandleContentClick
 *
 *  Summary:
 *    The mouse has been clicked in the content region of a window, but
 *    the click is not a contextual menu invocation or a click on a
 *    control.
 *
 *  Discussion:
 *    This event is generated by the standard window handler in
 *    response to a kEventWindowClickContentRgn event. An application
 *    may handle this event by checking if the mouse click was on a
 *    portion of its own user interface, and responding appropriately
 *    if so.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeWindowRef)
 *          The window that was clicked.
 *
 *    --> kEventParamMouseLocation (in, typeHIPoint)
 *          The mouse location, in global coordinates.
 *
 *    --> kEventParamWindowRef (in, typeWindowRef)
 *          The window under the mouse. Available in Mac OS X 10.1 and
 *          later.
 *
 *    --> kEventParamWindowMouseLocation (in, typeHIPoint)
 *          The window-relative position of the mouse in the window
 *          given in the kEventParamWindowRef parameter. 0,0 is at the
 *          top left of the structure of the window. Available in Mac
 *          OS X 10.1 and later.
 *
 *    --> kEventParamWindowPartCode (in, typeWindowPartCode)
 *          The part code the mouse location hit in the window. This
 *          parameter only exists if the windowRef parameter exists.
 *          This saves you the trouble of calling FindWindow, which is
 *          expensive on Mac OS X as it needs to call the Window
 *          Server. Available in Mac OS X 10.3 and later.
 *
 *    --> kEventParamKeyModifiers (in, typeUInt32)
 *          The keyboard modifiers that were pressed when the event was
 *          generated.
 *
 *    --> kEventParamMouseButton (in, typeMouseButton)
 *          Which mouse button was pressed.
 *
 *    --> kEventParamClickCount (in, typeUInt32)
 *          Whether this is a single click, double click, etc.
 *
 *    --> kEventParamMouseChord (in, typeUInt32)
 *          Which other mouse buttons were pressed when the event was
 *          generated. Available on Mac OS X only.
 *
 *    --> kEventParamTabletEventType (in, typeUInt32)
 *          The type of tablet event which generated this mouse event;
 *          contains either kEventTabletPoint or kEventTabletProximity.
 *          Only present if the event was generated from a tablet.
 *          Available in Mac OS X 10.1 and CarbonLib 1.5, and later.
 *
 *    --> kEventParamTabletPointRec (in, typeTabletPointRec)
 *          Further information about the tablet event which generated
 *          this mouse event. Present if the the
 *          kEventParamTabletEventType parameter contains
 *          kEventTabletPoint. Available on Mac OS X 10.1 and CarbonLib
 *          1.5, and later.
 *
 *    --> kEventParamTabletProximityRec (in, typeTabletProximityRec)
 *          Further information about the tablet event which generated
 *          this mouse event. Present if the the
 *          kEventParamTabletEventType parameter contains
 *          kEventTabletProximity. Available on Mac OS X 10.1 and
 *          CarbonLib 1.5, and later.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        in CarbonLib 1.3.1 and later
 }
const kEventWindowHandleContentClick = 85;

{
 *  kEventClassWindow / kEventWindowGetDockTileMenu
 *
 *  Summary:
 *    A request for a menu to be displayed by a windowÕs dock tile.
 *
 *  Discussion:
 *    The basic window handler responds to this event by returning the
 *    menu, if any, that was provided by the SetWindowDockTileMenu API.
 *    For most applications, it will be easier to use the
 *    SetWindowDockTileMenu API directly rather than installing a
 *    handler for this event.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeWindowRef)
 *          The window that should collapse.
 *
 *    <-- kEventParamMenuRef (out, typeMenuRef)
 *          On exit, contains the menu that should be displayed for the
 *          windowÕs Dock tile. The sender of this event will release
 *          the menu after the Dock has displayed it, so if you return
 *          a permanently allocated MenuRef, you should call RetainMenu
 *          on it before returning from your event handler.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const kEventWindowGetDockTileMenu   = 90;

{
 *  kEventClassWindow / kEventWindowToolbarSwitchMode
 *
 *  Summary:
 *    A request that the windowÕs toolbar change its display mode.
 *
 *  Discussion:
 *    For all windows, the basic window handler responds to this event
 *    by changing the display mode of the windowÕs HIToolbar, if any.
 *    If the application uses its own custom toolbar implementation, it
 *    should handle this event itself and respond appropriately. This
 *    event is generated by the basic window handler in response to a
 *    click in the windowÕs toolbar button.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeWindowRef)
 *          The window whose toolbar button was clicked.
 *
 *    --> kEventParamMouseLocation (in, typeHIPoint)
 *          The mouse location, in global coordinates.
 *
 *    --> kEventParamWindowRef (in, typeWindowRef)
 *          The window under the mouse. Available in Mac OS X 10.1 and
 *          later.
 *
 *    --> kEventParamWindowMouseLocation (in, typeHIPoint)
 *          The window-relative position of the mouse in the window
 *          given in the kEventParamWindowRef parameter. 0,0 is at the
 *          top left of the structure of the window. Available in Mac
 *          OS X 10.1 and later.
 *
 *    --> kEventParamWindowPartCode (in, typeWindowPartCode)
 *          The part code the mouse location hit in the window. This
 *          parameter only exists if the windowRef parameter exists.
 *          This saves you the trouble of calling FindWindow, which is
 *          expensive on Mac OS X as it needs to call the Window
 *          Server. Available in Mac OS X 10.3 and later.
 *
 *    --> kEventParamKeyModifiers (in, typeUInt32)
 *          The keyboard modifiers that were pressed when the event was
 *          generated.
 *
 *    --> kEventParamMouseButton (in, typeMouseButton)
 *          Which mouse button was pressed.
 *
 *    --> kEventParamClickCount (in, typeUInt32)
 *          Whether this is a single click, double click, etc.
 *
 *    --> kEventParamMouseChord (in, typeUInt32)
 *          Which other mouse buttons were pressed when the event was
 *          generated. Available on Mac OS X only.
 *
 *    --> kEventParamTabletEventType (in, typeUInt32)
 *          The type of tablet event which generated this mouse event;
 *          contains either kEventTabletPoint or kEventTabletProximity.
 *          Only present if the event was generated from a tablet.
 *          Available in Mac OS X 10.1 and CarbonLib 1.5, and later.
 *
 *    --> kEventParamTabletPointRec (in, typeTabletPointRec)
 *          Further information about the tablet event which generated
 *          this mouse event. Present if the the
 *          kEventParamTabletEventType parameter contains
 *          kEventTabletPoint. Available on Mac OS X 10.1 and CarbonLib
 *          1.5, and later.
 *
 *    --> kEventParamTabletProximityRec (in, typeTabletProximityRec)
 *          Further information about the tablet event which generated
 *          this mouse event. Present if the the
 *          kEventParamTabletEventType parameter contains
 *          kEventTabletProximity. Available on Mac OS X 10.1 and
 *          CarbonLib 1.5, and later.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const kEventWindowToolbarSwitchMode = 150;

{
 *  kEventClassWindow / kEventWindowFocusAcquired
 *
 *  Summary:
 *    Notification that the user (or some other action) has caused the
 *    focus to shift to your window.
 *
 *  Discussion:
 *    This event is sent to all handlers registered for it.
 *
 *    The standard window handler responds to this event by calling
 *    SetKeyboardFocus to focus on the first control in the window. An
 *    application handler may choose to set the focus to custom
 *    application content instead.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeWindowRef)
 *          The window that is gaining focus.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        in CarbonLib 1.1 and later
 }
const kEventWindowFocusAcquired     = 200;

{
 *  kEventClassWindow / kEventWindowFocusRelinquish
 *
 *  Summary:
 *    Notification that a window has lost user focus.
 *
 *  Discussion:
 *    This event is sent to all handlers registered for it.
 *
 *    The basic window handler responds to this event by clearing the
 *    the current keyboard focus, if the windowÕs activation scope is
 *    kWindowActivationScopeIndependent. An application handler should
 *    remove the focus from custom application content and ensure that
 *    the content is redrawn without the focus highlight.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeWindowRef)
 *          The window that is losing focus.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        in CarbonLib 1.1 and later
 }
const kEventWindowFocusRelinquish   = 201;

{
 *  kEventClassWindow / kEventWindowFocusContent
 *
 *  Summary:
 *    A request to set the focus to the content area of a window.
 *
 *  Discussion:
 *    If the content area of your window is not already focused, you
 *    should set the focus to the main part/control/view of the window.
 *    If the content area of your window is already focused, do
 *    nothing. The standard window handler responds to this event by
 *    calling HIViewAdvanceFocus on the windowÕs root control, if the
 *    focus is not already contained within the content root.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeWindowRef)
 *          The window whose content should be focused.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const kEventWindowFocusContent      = 202;

{
 *  kEventClassWindow / kEventWindowFocusToolbar
 *
 *  Summary:
 *    A request to set the focus to the toolbar of a window.
 *
 *  Discussion:
 *    If your windowÕs toolbar is not already focused, you should set
 *    the focus to the first item in the toolbar. If your windowÕs
 *    toolbar is already focused, do nothing. The basic window handler
 *    responds to this event by calling HIViewAdvanceFocus on the
 *    toolbar control, if the focus is not already contained within the
 *    toolbar.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeWindowRef)
 *          The window whose toolbar should be focused.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const kEventWindowFocusToolbar      = 203;

{
 *  kEventClassWindow / kEventWindowDrawerOpening
 *
 *  Summary:
 *    Notification that a drawer is opening.
 *
 *  Discussion:
 *    This event is sent to all handlers registered for it. This event
 *    is sent to the drawer and its parent window when the drawer
 *    begins opening.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeWindowRef)
 *          The drawer that is opening.
 *
 *  Result:
 *    An event handler for this event may return userCanceledErr if the
 *    drawer should not open. Any other return value is ignored and
 *    will still allow the drawer to open.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const kEventWindowDrawerOpening     = 220;

{
 *  kEventClassWindow / kEventWindowDrawerOpened
 *
 *  Summary:
 *    Notification that a drawer is open.
 *
 *  Discussion:
 *    This event is sent to all handlers registered for it. This event
 *    is sent to the drawer and its parent window when the drawer is
 *    fully open.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeWindowRef)
 *          The drawer that opened.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const kEventWindowDrawerOpened      = 221;

{
 *  kEventClassWindow / kEventWindowDrawerClosing
 *
 *  Summary:
 *    Notification that a drawer is closing.
 *
 *  Discussion:
 *    This event is sent to all handlers registered for it. This event
 *    is sent to the drawer and its parent window when the drawer
 *    begins closing.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeWindowRef)
 *          The drawer that is opening.
 *
 *  Result:
 *    An event handler for this event may return userCanceledErr if the
 *    drawer should not close. Any other return value is ignored and
 *    will still allow the drawer to close.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const kEventWindowDrawerClosing     = 222;

{
 *  kEventClassWindow / kEventWindowDrawerClosed
 *
 *  Summary:
 *    Notification that a drawer is closed.
 *
 *  Discussion:
 *    This event is sent to all handlers registered for it. This event
 *    is sent to the drawer and its parent window when the drawer is
 *    fully closed.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeWindowRef)
 *          The drawer that closed.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const kEventWindowDrawerClosed      = 223;

{
 *  kEventClassWindow / kEventWindowDrawFrame
 *
 *  Summary:
 *    Sent by the Window Manager when itÕs time to draw a windowÕs
 *    structure.
 *
 *  Discussion:
 *    This is the replacement to the old wDraw defProc message (though
 *    it is a special case of the 0 part code indicating to draw the
 *    entire window frame).
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeWindowRef)
 *          The window to draw.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        in CarbonLib 1.1 and later
 }
const kEventWindowDrawFrame         = 1000;

{
 *  kEventClassWindow / kEventWindowDrawPart
 *
 *  Summary:
 *    Sent by the Window Manager when itÕs time to draw a specific part
 *    of a windowÕs structure, such as the close button.
 *
 *  Discussion:
 *    This is typically sent during window widget tracking.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeWindowRef)
 *          The window to draw.
 *
 *    --> kEventParamWindowDefPart (in, typeWindowDefPartCode)
 *          The part to draw.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        in CarbonLib 1.1 and later
 }
const kEventWindowDrawPart          = 1001;

{
 *  kEventClassWindow / kEventWindowGetRegion
 *
 *  Summary:
 *    Sent by the Window Manager when it needs to get a specific region
 *    from a window, or when the GetWindowRegion API is called.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeWindowRef)
 *          The window whose region to return.
 *
 *    --> kEventParamWindowRegionCode (in, typeWindowRegionCode)
 *          The region to return.
 *
 *    --> kEventParamRgnHandle (in, typeQDRgnHandle)
 *          On entry, contains a valid but empty RgnHandle; you should
 *          place the window region in this RgnHandle.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        in CarbonLib 1.1 and later
 }
const kEventWindowGetRegion         = 1002;

{
 *  kEventClassWindow / kEventWindowHitTest
 *
 *  Summary:
 *    Sent when the Window Manager needs to determine what part of a
 *    window would be 'hit' with a given mouse location in global
 *    coordinates.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeWindowRef)
 *          The window to hit-test.
 *
 *    --> kEventParamMouseLocation (in, typeQDPoint)
 *          The mouse location.
 *
 *    <-- kEventParamWindowDefPart (out, typeWindowDefPartCode)
 *          On exit, contains the window part that was hit.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        in CarbonLib 1.1 and later
 }
const kEventWindowHitTest           = 1003;

{
 *  kEventClassWindow / kEventWindowInit
 *
 *  Summary:
 *    Sent by the Window Manager when the window is being created. This
 *    is a hook to allow your window definition to do any
 *    initialization you might need to do.
 *
 *  Discussion:
 *    This event can be sent more than once to a window if the window
 *    definition function for the window is changed; see the note under
 *    kEventWindowDispose.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeWindowRef)
 *          The window being created.
 *
 *    <-- kEventParamWindowFeatures (out, typeUInt32)
 *          On exit, your event handler should store the window
 *          features in this parameter.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        in CarbonLib 1.1 and later
 }
const kEventWindowInit              = 1004;

{
 *  kEventClassWindow / kEventWindowDispose
 *
 *  Summary:
 *    Sent by the Window Manager to notify the window definition that
 *    it should dispose of any private data structures attached to the
 *    window.
 *
 *  Discussion:
 *    Note that this event does not directly correspond with
 *    destruction of the window; the Window Manager occasionally needs
 *    to change the window definition of a window (for example, when
 *    ChangeWindowAttributes is used to change the visual appearance of
 *    a window), and in that case, the window will receive a
 *    kEventWindowDispose followed by a kEventWindowInit so that the
 *    old and new window definitions can disconnect and connect to the
 *    window. If you need to know when a window is really being
 *    destroyed, install a handler for kEventWindowClosed.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeWindowRef)
 *          The window being destroyed.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        in CarbonLib 1.1 and later
 }
const kEventWindowDispose           = 1005;

{
 *  kEventClassWindow / kEventWindowDragHilite
 *
 *  Summary:
 *    Sent by the Window Manager when it is time to draw/erase any drag
 *    hilite in the window structure.
 *
 *  Discussion:
 *    This is typically sent from within HiliteWindowFrameForDrag.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeWindowRef)
 *          The window being hilited.
 *
 *    --> kEventParamWindowDragHiliteFlag (in, typeBoolean)
 *          Whether to draw (true) or erase (false) the hilite.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        in CarbonLib 1.1 and later
 }
const kEventWindowDragHilite        = 1006;

{
 *  kEventClassWindow / kEventWindowModified
 *
 *  Summary:
 *    Sent by the Window Manager when it is time to redraw window
 *    structure to account for a change in the document modified state.
 *
 *  Discussion:
 *    This is typically sent from within SetWindowModified.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeWindowRef)
 *          The window that was modified.
 *
 *    --> kEventParamWindowModifiedFlag (in, typeBoolean)
 *          The new modified state.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        in CarbonLib 1.1 and later
 }
const kEventWindowModified          = 1007;

{
 *  kEventClassWindow / kEventWindowSetupProxyDragImage
 *
 *  Summary:
 *    Sent by the Window Manager when it is time to generate a drag
 *    image for the window proxy.
 *
 *  Discussion:
 *    This is typically sent from within BeginWindowProxyDrag.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeWindowRef)
 *          The window whose proxy is being dragged.
 *
 *    <-- kEventParamWindowProxyGWorldPtr (out, typeGWorldPtr)
 *          On exit, contains a GWorld you allocate which contains the
 *          drag image.
 *
 *    --> kEventParamWindowProxyImageRgn (in, typeQDRgnHandle)
 *          The region you modify to contain the clip region for the
 *          GWorld.
 *
 *    --> kEventParamWindowProxyOutlineRgn (in, typeQDRgnHandle)
 *          The region you modify to contain the drag outline used when
 *          the GWorld cannot be used.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        in CarbonLib 1.1 and later
 }
const kEventWindowSetupProxyDragImage = 1008;

{
 *  kEventClassWindow / kEventWindowStateChanged
 *
 *  Summary:
 *    Sent by the Window Manager when a particular window state changes.
 *
 *  Discussion:
 *    See the state-change flags in MacWindows.h.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeWindowRef)
 *          The window whose state was changed.
 *
 *    --> kEventParamWindowStateChangedFlags (in, typeUInt32)
 *          The state change flags
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        in CarbonLib 1.1 and later
 }
const kEventWindowStateChanged      = 1009;

{
 *  kEventClassWindow / kEventWindowMeasureTitle
 *
 *  Summary:
 *    Sent when the Window Manager needs to know how much space the
 *    windowÕs title area takes up.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeWindowRef)
 *          The window whose title to measure.
 *
 *    <-- kEventParamWindowTitleFullWidth (out, typeSInt16)
 *          On exit, contains the length of the whole title area.
 *
 *    <-- kEventParamWindowTitleTextWidth (out, typeSInt16)
 *          On exit, contains the length just the title text.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        in CarbonLib 1.1 and later
 }
const kEventWindowMeasureTitle      = 1010;

{
 *  kEventClassWindow / kEventWindowDrawGrowBox
 *
 *  Summary:
 *    When the DrawGrowIcon API is called, this event is sent to the
 *    window to tell it to draw the grow box.
 *
 *  Discussion:
 *    This is a compatibility event harkening back to the old days
 *    before Mac OS 8. Not very useful these days. This is only really
 *    needed for windows that do not have the grow box integrated into
 *    the window frame. Scroll bar delimiter lines are also drawn.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeWindowRef)
 *          The window whose grow box to draw.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        in CarbonLib 1.1 and later
 }
const kEventWindowDrawGrowBox       = 1011;

{
 *  kEventClassWindow / kEventWindowGetGrowImageRegion
 *
 *  Summary:
 *    This is a special way for a window to override the standard
 *    resize outline for windows that do not do live resizing.
 *
 *  Discussion:
 *    As the user resizes the window, this event is sent with the
 *    current size the user has chosen expressed as a rectangle. You
 *    should calculate your window outline and modify the
 *    kEventParamRgnHandle parameter to reflect your desired outline.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeWindowRef)
 *          The window whose grow image to return.
 *
 *    --> kEventParamWindowGrowRect (in, typeQDRectangle)
 *          The windowÕs global port bounds.
 *
 *    --> kEventParamRgnHandle (in, typeQDRgnHandle)
 *          The region to modify.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        in CarbonLib 1.1 and later
 }
const kEventWindowGetGrowImageRegion = 1012;

{
 *  kEventClassWindow / kEventWindowPaint
 *
 *  Summary:
 *    When the Window Manager needs to paint a window (e.g, when a
 *    window is first displayed), the kEventWindowPaint event is sent
 *    to allow the window to control all aspect of painting, including
 *    the window frame.
 *
 *  Discussion:
 *    If a window does not respond to this event, the Window Manager
 *    ends up sending kEventWindowDrawFrame and then erasing the window
 *    to the window content color as usual. This is mostly used for
 *    specialty windows, such as help tags or appliance apps might have.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeWindowRef)
 *          The window to paint.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const kEventWindowPaint             = 1013;

{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{  Menu Events                                                                         }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{
    kEventClassMenu quick reference:

    kEventMenuBeginTracking         = 1,
    kEventMenuEndTracking           = 2,
    kEventMenuChangeTrackingMode    = 3,
    kEventMenuOpening               = 4,
    kEventMenuClosed                = 5,
    kEventMenuTargetItem            = 6,
    kEventMenuMatchKey              = 7,
    kEventMenuEnableItems           = 8,
    kEventMenuPopulate              = 9,

    kEventMenuMeasureItemWidth      = 100,
    kEventMenuMeasureItemHeight     = 101,
    kEventMenuDrawItem              = 102,
    kEventMenuDrawItemContent       = 103,

    kEventMenuDispose               = 1001,
    kEventMenuCalculateSize         = 1004,

    -- menu content view events --

    kEventMenuCreateFrameView       = 1005,
    kEventMenuGetFrameBounds        = 1006,
    kEventMenuBecomeScrollable      = 1007,
    kEventMenuCeaseToBeScrollable   = 1008,

    -- menu bar visibility events --

    kEventMenuBarShown              = 2000,
    kEventMenuBarHidden             = 2001
}

{
 *  Discussion:
 *    Menu context flags indicate the context or usage of a
 *    menu-related Carbon event.
 }
const { menu location}

  {
   * Indicates that this menu is inserted in the menubar, or is a
   * (directly or indirectly) a submenu of a menu that is inserted in
   * the menubar.
   }
  kMenuContextMenuBar           = 1 shl 0; { menu type}

  {
   * Indicates that this menu is a pull-down menu inserted in the
   * menubar.
   }
  kMenuContextPullDown          = 1 shl 8;

  {
   * Indicates that this menu is a popup menu being displayed by
   * PopUpMenuSelect.
   }
  kMenuContextPopUp             = 1 shl 9;

  {
   * Indicates that this menu is a submenu of some other pull-down or
   * popup menu.
   }
  kMenuContextSubmenu           = 1 shl 10; { menu usage}

  {
   * Indicates that this Carbon event has been sent during a menubar
   * tracking session.
   }
  kMenuContextMenuBarTracking   = 1 shl 16;

  {
   * Indicates that this Carbon event has been sent during a popup menu
   * tracking session.
   }
  kMenuContextPopUpTracking     = 1 shl 17;

  {
   * Indicates that this Carbon event has been sent during command key
   * matching.
   }
  kMenuContextKeyMatching       = 1 shl 18;

  {
   * Indicates that this Carbon event has been sent at idle time to
   * update the enabled state of the menus. Available on Mac OS X 10.1
   * and later, and in CarbonLib 1.5 and later; on earlier releases,
   * the kMenuContextKeyMatching flag is set when an event is sent
   * during menu enabling.
   }
  kMenuContextMenuEnabling      = 1 shl 19;

  {
   * Indicates that this Carbon event has been sent during during a
   * search for a menu item command ID by the
   * CountMenuItemsWithCommandID or GetIndMenuItemWithCommandID APIs.
   * Available on Mac OS X 10.2 and CarbonLib 1.6.
   }
  kMenuContextCommandIDSearch   = 1 shl 20;


{
 *  Summary:
 *    Menu direction
 }
const {
   * Indicates that the menu should be placed to the right of its
   * parent.
   }
  kHIMenuRightDirection         = 0;

  {
   * Indicates that the menu should be placed to the left of its parent.
   }
  kHIMenuLeftDirection          = 1;

  {
   * Indicates that the menu should be centered on its parent.
   }
  kHIMenuCenterDirection        = 2;

{
 *  kEventClassMenu / kEventMenuBeginTracking
 *
 *  Summary:
 *    The user has begun tracking the menubar or a pop-up menu.
 *
 *  Discussion:
 *    This event is sent to all handlers registered for it. It is sent
 *    first to the menu specified in the direct object parameter, if
 *    any, and then to the user focus target.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeMenuRef)
 *          The root of the menu hierarchy being tracked. If tracking a
 *          popup menu, this parameter is the popup; if tracking the
 *          menubar, this parameter is the root menu on Mac OS X, but
 *          is NULL in CarbonLib.
 *
 *    --> kEventParamCurrentMenuTrackingMode (in, typeMenuTrackingMode)
 *          Indicates whether the user is tracking the menus using the
 *          mouse or the keyboard. Contains either
 *          kMenuTrackingModeMouse or kMenuTrackingModeKeyboard.
 *
 *    --> kEventParamMenuContext (in, typeUInt32)
 *          Menu context flags indicating what type of menu is being
 *          tracked. This parameter is available on Mac OS X 10.1 and
 *          later, and CarbonLib 1.5 and later.
 *
 *  Result:
 *    The handler may return userCanceledErr to stop menu tracking.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        in CarbonLib 1.1 and later
 }
const kEventMenuBeginTracking       = 1;

{
 *  kEventClassMenu / kEventMenuEndTracking
 *
 *  Summary:
 *    The user has finished tracking the menubar or a popup menu
 *
 *  Discussion:
 *    This event is sent to all handlers registered for it. It is sent
 *    first to the menu specified in the direct object parameter, if
 *    any, and then to the user focus target.
 *
 *    In Mac OS X 10.3 and later, when a menu tracking session ends,
 *    the Menu Manager now sends kEventMenuEndTracking to every menu
 *    that was opened during the session, in addition to the root menu.
 *    This is done to allow menus with dynamic content to remove that
 *    content at the end of menu tracking; for example, a menu
 *    containing many IconRefs might wish to load the IconRefs
 *    dynamically in response to a kEventMenuPopulate, and remove them
 *    in response to kEventMenuEndTracking, to avoid the memory
 *    overhead of keeping the IconRef data in memory while the menu is
 *    not being displayed.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeMenuRef)
 *          The root of the menu hierarchy being tracked. If tracking a
 *          popup menu, this parameter is the popup; if tracking the
 *          menubar, this parameter is the root menu on Mac OS X, but
 *          is NULL in CarbonLib.
 *
 *    --> kEventParamMenuContext (in, typeUInt32)
 *          Menu context flags indicating what type of menu was being
 *          tracked. This parameter is available on Mac OS X 10.1 and
 *          later, and CarbonLib 1.5 and later.
 *
 *    --> kEventParamMenuDismissed (in, typeUInt32)
 *          Contains an indication of why menu tracking ended; this
 *          will be one of the kHIMenuDismissedBy constants in Menus.h.
 *          This parameter is available on Mac OS X 10.3 and later.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        in CarbonLib 1.1 and later
 }
const kEventMenuEndTracking         = 2;

{
 *  kEventClassMenu / kEventMenuChangeTrackingMode
 *
 *  Summary:
 *    The user has switched from selecting a menu with the mouse to
 *    selecting with the keyboard, or from selecting with the keyboard
 *    to selecting with the mouse.
 *
 *  Discussion:
 *    This event is sent to all handlers registered for it. It is sent
 *    first to the menu specified in the direct object parameter, and
 *    then to the user focus target.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeMenuRef)
 *          The root of the menu hierarchy being tracked. If tracking a
 *          popup menu, this parameter is the popup; if tracking the
 *          menubar, this parameter is the root menu.
 *
 *    --> kEventParamCurrentMenuTrackingMode (in, typeMenuTrackingMode)
 *          Indicates whether the user was previously tracking the
 *          menus using the mouse or the keyboard. Contains either
 *          kMenuTrackingModeMouse or kMenuTrackingModeKeyboard.
 *
 *    --> kEventParamNewMenuTrackingMode (in, typeMenuTrackingMode)
 *          Indicates whether the user is now tracking the menus using
 *          the mouse or the keyboard. Contains either
 *          kMenuTrackingModeMouse or kMenuTrackingModeKeyboard.
 *
 *    --> kEventParamMenuContext (in, typeUInt32)
 *          Menu context flags indicating what type of menu is being
 *          tracked.
 *
 *  Availability:
 *    Mac OS X:         in version 10.1 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const kEventMenuChangeTrackingMode  = 3;

{
 *  kEventClassMenu / kEventMenuOpening
 *
 *  Summary:
 *    A menu is opening.
 *
 *  Discussion:
 *    This event is sent to all handlers registered for it. It is sent
 *    each time that the menu is opened (i.e., more than once during a
 *    given tracking session if the user opens the menu multiple
 *    times). It is sent before the menu is actually drawn, so you can
 *    update the menu contents (including making changes that will
 *    alter the menu size) and the new contents will be drawn correctly.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeMenuRef)
 *          The menu being opened.
 *
 *    --> kEventParamMenuFirstOpen (in, typeBoolean)
 *          Whether this is the first time this menu has been opened
 *          during this menu tracking session.
 *
 *    --> kEventParamMenuContext (in, typeUInt32)
 *          The context in which this menu is opening. Available on Mac
 *          OS X and CarbonLib 1.5 and later.
 *
 *  Result:
 *    On Mac OS X, the handler may return userCanceledErr to prevent
 *    this menu from opening
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        in CarbonLib 1.1 and later
 }
const kEventMenuOpening             = 4;

{
 *  kEventClassMenu / kEventMenuClosed
 *
 *  Summary:
 *    A menu has been closed.
 *
 *  Discussion:
 *    This event is sent to all handlers registered for it. It is sent
 *    after the menu is hidden.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeMenuRef)
 *          The menu being closed.
 *
 *    --> kEventParamMenuContext (in, typeUInt32)
 *          The context in which this menu is closing. Available on Mac
 *          OS X 10.1 and later, and CarbonLib 1.5 and later.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        in CarbonLib 1.1 and later
 }
const kEventMenuClosed              = 5;

{
 *  kEventClassMenu / kEventMenuTargetItem
 *
 *  Summary:
 *    The mouse is moving over a particular menu item.
 *
 *  Discussion:
 *    This event is sent to all handlers registered for it. It is sent
 *    for both enabled and disabled items.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeMenuRef)
 *          The menu being tracked.
 *
 *    --> kEventParamMenuItemIndex (in, typeMenuItemIndex)
 *          The menu item under the mouse.
 *
 *    --> kEventParamMenuCommand (in, typeMenuCommand)
 *          The command ID associated with this menu item.
 *
 *    --> kEventParamMenuContext (in, typeUInt32)
 *          The context in which this menu being tracked. Available on
 *          Mac OS X 10.1 and later, and CarbonLib 1.5 and later.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        in CarbonLib 1.1 and later
 }
const kEventMenuTargetItem          = 6;


{
 *  kEventClassMenu / kEventMenuMatchKey
 *
 *  Summary:
 *    A menu is about to be examined for items that match a command key
 *    event.
 *
 *  Discussion:
 *    A handler for this event may perform its own command key matching
 *    and override the Menu ManagerÕs default matching algorithms.
 *    Returning noErr from your handler indicates that you have found a
 *    match. The handler for this event should not examine submenus of
 *    this menu for a match; a separate event will be sent for each
 *    submenu.
 *
 *    Handlers for this event must be installed directly on the menu
 *    containing the item to be matched. To improve performance of
 *    command key matching, the Menu Manager only sends this event if
 *    the menu itself has a handler; if a handler for this event is
 *    installed on any other event target, it will not receive the
 *    event. <BR><BR> This event is sent after kEventMenuEnableItems.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeMenuRef)
 *          The menu being searched for a command key match.
 *
 *    --> kEventParamEventRef (in, typeEventRef)
 *          The keyboard input event that should be checked for a
 *          match. Currently this event is always kEventRawKeyDown, but
 *          in the future it may be kEventTextInputUnicodeForKeyEvent.
 *          When called from IsMenuKeyEvent, this parameter contains
 *          the EventRef that was passed to IsMenuKeyEvent; when called
 *          from MenuKey or MenuEvent, this parameter contains an event
 *          created from the information passed to MenuKey or
 *          MenuEvent. Note that in the MenuKey case, no virtual
 *          keycode (kEventParamKeyCode) or key modifiers
 *          (kEventParamKeyModifiers) will be available.
 *
 *    --> kEventParamMenuEventOptions (in, typeMenuEventOptions)
 *          Options from the MenuEventOptions enum that control how the
 *          menu should be searched for a command key. This parameter
 *          contains the options that were passed to IsMenuKeyEvent, or
 *          0 if called from MenuKey or MenuEvent. The only option that
 *          your handler will need to obey is
 *          kMenuEventIncludeDisabledItems; other options are
 *          irrelevant for an event handler.
 *
 *    --> kEventParamMenuContext (in, typeUInt32)
 *          The context in which this menu is being searched for a
 *          command key. Available on Mac OS X 10.1 and later, and
 *          CarbonLib 1.5 and later.
 *
 *    <-- kEventParamMenuItemIndex (out, typeMenuItemIndex)
 *          On exit, contains the menu item index that matched the
 *          event.
 *
 *  Result:
 *    If your handler finds a match, it should set the
 *    kEventParamMenuItemIndex parameter to contain the item index of
 *    the matching item, and return noErr. If it does not find a match,
 *    it should return menuItemNotFoundErr. Any other return value will
 *    cause the Menu Manager to use its default command key matching
 *    algorithm for this menu.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        in CarbonLib 1.1 and later
 }
const kEventMenuMatchKey            = 7;


{
 *  kEventClassMenu / kEventMenuEnableItems
 *
 *  Summary:
 *    A request that the items in the menu be properly enabled or
 *    disabled according to the current state of the application.
 *
 *  Discussion:
 *    This event is sent from inside MenuKey, MenuEvent, and
 *    IsMenuKeyEvent before those APIs examine the menu for an item
 *    that matches a keyboard event. It is also sent during menu
 *    tracking before a menu is first made visible; it is sent
 *    immediately after kEventMenuOpening, once per menu per menu
 *    tracking session. It is also sent to the top-level menus in the
 *    menubar when the application is idle after user input has
 *    occurred, to allow the menu titles to be enabled or disabled
 *    appropriately according to the current user focus. You can
 *    distinquish between all these cases by examining the contents of
 *    the kEventParamMenuContext parameter.
 *
 *    If you install an event handler for kEventCommandProcess, you
 *    should also install a handler for either kEventMenuEnableItems or
 *    kEventCommandUpdateStatus. This is necessary because the Carbon
 *    event system will attempt to match command keys against the
 *    available menus before returning the keyboard event to your
 *    application via WaitNextEvent. If you have menu command event
 *    handlers installed for your menu items, your handlers will be
 *    called without your ever receiving the keyboard event or calling
 *    MenuKey/MenuEvent/IsMenuKeyEvent yourself. Therefore, you have no
 *    opportunity to enable your menu items properly other than from a
 *    kEventMenuEnableItems or kEventCommandUpdateStatus handler.
 *     It is not necessary to handle this event if you do not install
 *    kEventCommandProcess handlers for your menu items; in that case,
 *    the command key event will be returned from WaitNextEvent or
 *    ReceiveNextEvent as normal, and you can set up your menus before
 *    calling MenuKey/MenuEvent/ IsMenuKeyEvent.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeMenuRef)
 *          The menu being enabled.
 *
 *    --> kEventParamEnableMenuForKeyEvent (in, typeBoolean)
 *          Indicates whether this menu should be enabled for key event
 *          matching (true) or because the menu itself is about to
 *          become visible (false). If true, only the item enable
 *          state, command key, command key modifiers, and (optionally)
 *          the command key glyph need to be correct. If false, the
 *          entire menu item contents must be correct. This may be
 *          useful if you have custom menu content that is expensive to
 *          prepare.
 *
 *    --> kEventParamMenuContext (in, typeUInt32)
 *          The context in which this menu is being enabled. Available
 *          on Mac OS X and CarbonLib 1.3.1 and later.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        in CarbonLib 1.1 and later
 }
const kEventMenuEnableItems         = 8;


{
 *  kEventClassMenu / kEventMenuPopulate
 *
 *  Summary:
 *    kEventMenuPopulate is intended to be handled by applications that
 *    dynamically create their menu contents just-in-time before the
 *    menu is displayed. A handler for this event can add items to tbe
 *    menu that will be displayed or searched for a command key.
 *
 *  Discussion:
 *    This event is sent to all handlers registered for it. Previously,
 *    kEventMenuOpening was recommended for the purpose of dynamically
 *    updating menu content. kEventMenuPopulate is now recommended
 *    because it will be sent by the Menu Manager before it searches a
 *    menu for a matching command key, to allow a handler to
 *    dynamically add menu items that may have command key equivalents
 *    to the menu; kEventMenuOpening is only sent before the menu is
 *    displayed. kEventMenuPopulate is also sent just before
 *    kEventMenuOpening as a menu is being displayed. Finally,
 *    kEventMenuPopulate is only sent once per menu tracking session
 *    for a given menu, even if that menu is closed and opened multiple
 *    times by the user; kEventMenuOpening is sent each time that the
 *    menu is displayed.
 *
 *    You can distinguish the command-key case from the
 *    menu-being-displayed case by examining the contents of the
 *    kEventParamMenuContext parameter; the kMenuContextKeyMatching
 *    flag will be set if the event is sent during command key
 *    matching, and either the kMenuContextMenuBarTracking or
 *    kMenuContextPopUpTracking flags will be sent if the event is sent
 *    before actual display of the menu.
 *
 *    In Mac OS X 10.2 and CarbonLib 1.6, kEventMenuPopulate is also
 *    sent to menus before the menu is searched for a command ID by the
 *    CountMenuItemsWithCommandID and GetIndMenuItemWithCommandID APIs.
 *    You can distinguish this case by checking for the
 *    kMenuContextCommandIDSearch flag in the kEventParamMenuContext
 *    parameter. In this case, the event also includes a
 *    kEventParamMenuCommand parameter with the command ID being
 *    searched for as the event parameter data.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeMenuRef)
 *          The menu to be populated.
 *
 *    --> kEventParamMenuContext (in, typeUInt32)
 *          The context in which this menu is being populated.
 *
 *    --> kEventParamMenuCommand (in, typeMenuCommand)
 *          If this event is sent by CountMenuItemsWithCommandID or
 *          GetIndMenuItemWithCommandID, this parameter contains the
 *          command ID for which the API is searching. Available on Mac
 *          OS X 10.2 and CarbonLib 1.6.
 *
 *  Availability:
 *    Mac OS X:         in version 10.1 and later in Carbon.framework
 *    CarbonLib:        in CarbonLib 1.5 and later
 }
const kEventMenuPopulate            = 9;


{
 *  kEventClassMenu / kEventMenuDispose
 *
 *  Summary:
 *    Sent when a menu is being destroyed.
 *
 *  Discussion:
 *    This event is sent to all handlers registered for it.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeMenuRef)
 *          The menu being destroyed.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        in CarbonLib 1.1 and later
 }
const kEventMenuDispose             = 1001;

{
 *  kEventClassMenu / kEventMenuMeasureItemWidth
 *
 *  Summary:
 *    Requests measurement of the width of a menu item.
 *
 *  Discussion:
 *    Sent by the standard menu definition when a menu item has the
 *    kMenuItemAttrCustomDraw attribute. Handlers for this event should
 *    be installed directly on the menu. A handler for this event may
 *    respond by providing a customized width for the menu item. If no
 *    handler is installed, the standard menu definition provides a
 *    default handler that will return the standard width for the item.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeMenuRef)
 *          The menu that is being measured.
 *
 *    --> kEventParamMenuItemIndex (in, typeMenuItemIndex)
 *          The menu item that is being measured.
 *
 *    <-- kEventParamMenuItemWidth (out, typeShortInteger)
 *          On exit, contains the menu item width.
 *
 *  Availability:
 *    Mac OS X:         in version 10.1 and later in Carbon.framework
 *    CarbonLib:        in CarbonLib 1.5 and later
 }
const kEventMenuMeasureItemWidth    = 100;


{
 *  kEventClassMenu / kEventMenuMeasureItemHeight
 *
 *  Summary:
 *    Requests measurement of the height of a menu item.
 *
 *  Discussion:
 *    Sent by the standard menu definition when a menu item has the
 *    kMenuItemAttrCustomDraw attribute. Handlers for this event should
 *    be installed directly on the menu. A handler for this event may
 *    respond by providing a customized height for the menu item. If no
 *    handler is installed, the standard menu definition provides a
 *    default handler that will return the standard height for the item.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeMenuRef)
 *          The menu that is being measured.
 *
 *    --> kEventParamMenuItemIndex (in, typeMenuItemIndex)
 *          The menu item that is being measured.
 *
 *    <-- kEventParamMenuItemHeight (out, typeShortInteger)
 *          On exit, contains the menu item height.
 *
 *  Availability:
 *    Mac OS X:         in version 10.1 and later in Carbon.framework
 *    CarbonLib:        in CarbonLib 1.5 and later
 }
const kEventMenuMeasureItemHeight   = 101;


{
 *  kEventClassMenu / kEventMenuDrawItem
 *
 *  Summary:
 *    Requests drawing of an entire menu item, including its background.
 *
 *  Discussion:
 *    Sent by the standard menu definition when a menu item has the
 *    kMenuItemAttrCustomDraw attribute. Handlers for this event should
 *    be installed directly on the menu. A handler for this event may
 *    respond by completely overriding the drawing of the menu item.
 *    The item should be drawn into the current port if using
 *    QuickDraw, or into the provided CGContextRef if using
 *    CoreGraphics. If no handler is installed, the standard menu
 *    definition provides a default handler that calls
 *    DrawThemeMenuItem to draw the menu item background and content.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeMenuRef)
 *          The menu being drawn.
 *
 *    --> kEventParamCurrentBounds (in, typeQDRectangle)
 *          The bounds of the menu, in global coordinates
 *
 *    --> kEventParamMenuItemIndex (in, typeMenuItemIndex)
 *          The menu item being drawn.
 *
 *    --> kEventParamMenuItemBounds (in, typeQDRectangle)
 *          The bounds of the menu item, in local coordinates of the
 *          current port.
 *
 *    --> kEventParamMenuVirtualTop (in, typeLongInteger)
 *          The virtual top coordinate of the menu, in global
 *          coordinates.
 *
 *    --> kEventParamMenuVirtualBottom (in, typeLongInteger)
 *          The virtual bottom coordinate of the menu, in global
 *          coordinates.
 *
 *    --> kEventParamMenuDrawState (in, typeThemeMenuState)
 *          The ThemeMenuState of the menu.
 *
 *    --> kEventParamMenuItemType (in, typeThemeMenuItemType)
 *          The type of menu item.
 *
 *    --> kEventParamCGContextRef (in, typeCGContextRef)
 *          The CG context in which the menu should be drawn.
 *
 *    <-- kEventParamMenuMarkBounds (out, typeQDRectangle)
 *          On exit, contains the bounds of the menu item mark
 *          character. Not present if the >                       item
 *          has no mark. Added to the event by the standard menu
 *          definitionÕs handler, if the event is allowed to pass
 *          through.
 *
 *    <-- kEventParamMenuIconBounds (out, typeQDRectangle)
 *          On exit, contains the bounds of the menu item icon. Not
 *          present if the item has no icon. Added to the event by the
 *          standard menu definitionÕs handler, if the event is allowed
 *          to pass through.
 *
 *    <-- kEventParamMenuTextBounds (out, typeQDRectangle)
 *          On exit, contains the bounds of the menu itemÕs text. Added
 *          to the event by the standard menu definitionÕs handler, if
 *          the event is allowed to pass through.
 *
 *    <-- kEventParamMenuTextBaseline (out, typeShortInteger)
 *          On exit, contains the baseline of the menu itemÕs text.
 *          Added to the event by the standard menu definitionÕs
 *          handler, if the event is allowed to pass through.
 *
 *    <-- kEventParamMenuCommandKeyBounds (out, typeQDRectangle)
 *          On exit, contains the bounds of the menu item command key.
 *          Not present if the item has no command key. Added to the
 *          event by the standard menu definitionÕs handler, if the
 *          event is allowed to pass through.
 *
 *  Availability:
 *    Mac OS X:         in version 10.1 and later in Carbon.framework
 *    CarbonLib:        in CarbonLib 1.5 and later
 }
const kEventMenuDrawItem            = 102;


{
 *  kEventClassMenu / kEventMenuDrawItemContent
 *
 *  Summary:
 *    Requests drawing of a menu itemÕs content: its text, command key,
 *    icon, etc.
 *
 *  Discussion:
 *    Sent by the standard menu definition when a menu item has the
 *    kMenuItemAttrCustomDraw attribute. Handlers for this event should
 *    be installed directly on the menu. A handler for this event may
 *    respond by overriding the drawing of the menu item content: the
 *    mark character, icon, text, and command key information. At the
 *    time when this event is sent, the background of the menu item has
 *    already been drawn using the standard system appearance, and if
 *    the item is selected, the background is drawn with a hilite. The
 *    item should be drawn into the current port if using QuickDraw, or
 *    into the provided CGContextRef if using CoreGraphics. If no
 *    handler is installed, the standard menu definition provides a
 *    default handler that draws the standard menu item content. The
 *    standard handler also adds event parameters to the event
 *    indicating the bounding boxes of the different portions of the
 *    menu item content (mark, icon, text, and command keys), and an
 *    event parameter with the baseline of the menu item text; this
 *    allows handlers to use CallNextEventHandler to call through to
 *    the standard system handler, and then modify the system
 *    appearance by drawing on top of the standard content.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeMenuRef)
 *          The menu being drawn.
 *
 *    --> kEventParamMenuItemIndex (in, typeMenuItemIndex)
 *          The menu item being drawn.
 *
 *    --> kEventParamMenuItemBounds (in, typeQDRectangle)
 *          The bounds of the menu item, in local coordinates of the
 *          current port.
 *
 *    --> kEventParamDeviceDepth (in, typeShortInteger)
 *          The bit depth of the GDevice on which the menu is being
 *          drawn.
 *
 *    --> kEventParamDeviceColor (in, typeBoolean)
 *          Whether the GDevice on which the menu is being drawn is in
 *          black&white or color mode.
 *
 *    --> kEventParamCGContextRef (in, typeCGContextRef)
 *          The CG context in which the menu should be drawn.
 *
 *    <-- kEventParamMenuMarkBounds (out, typeQDRectangle)
 *          On exit, contains the bounds of the menu item mark
 *          character. Not present if the item has no mark. Added to
 *          the event by the standard menu definitionÕs handler, if the
 *          event is allowed to pass through.
 *
 *    <-- kEventParamMenuIconBounds (out, typeQDRectangle)
 *          On exit, contains the bounds of the menu item icon. Not
 *          present if the item has no icon. Added to the event by the
 *          standard menu definitionÕs handler, if the event is allowed
 *          to pass through.
 *
 *    <-- kEventParamMenuTextBounds (out, typeQDRectangle)
 *          On exit, contains the bounds of the menu itemÕs text. Added
 *          to the event by the standard menu definitionÕs handler, if
 *          the event is allowed to pass through.
 *
 *    <-- kEventParamMenuTextBaseline (out, typeShortInteger)
 *          On exit, contains the baseline of the menu itemÕs text.
 *          Added to the event by the standard menu definitionÕs
 *          handler, if the event is allowed to pass through.
 *
 *    <-- kEventParamMenuCommandKeyBounds (out, typeQDRectangle)
 *          On exit, contains the bounds of the menu item command key.
 *          Not present if the item has no command key. Added to the
 *          event by the standard menu definitionÕs handler, if the
 *          event is allowed to pass through.
 *
 *  Availability:
 *    Mac OS X:         in version 10.1 and later in Carbon.framework
 *    CarbonLib:        in CarbonLib 1.5 and later
 }
const kEventMenuDrawItemContent     = 103;

{
 *  kEventClassMenu / kEventMenuCalculateSize
 *
 *  Summary:
 *    Requests that a menu calculate its total size.
 *
 *  Discussion:
 *    Sent by CalcMenuSize to request that the menu calculate its size.
 *    The Menu Manager provides a default handler for all menus that
 *    calls the menu's MDEF or menu content view to determine the menu
 *    size. Applications will typically not need to handle this event;
 *    a custom menu definition or menu content view should use
 *    kMenuSizeMsg or kEventControlGetOptimalBounds to calculate its
 *    size.
 *
 *    Note that if the menu uses an MDEF, the MDEF will set the menu's
 *    width and height in response to kMenuSizeMsg. The default handler
 *    for this event saves the old width and height before calling the
 *    MDEF and restores them afterwards. CalcMenuSize will set the
 *    final menu width and height based on the dimensions returned from
 *    this event; applications may override this event to customize the
 *    width or height of a menu by modifying the kEventParamDimensions
 *    parameter.
 *
 *    This event is sent only to the menu, and is not propagated past
 *    it.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeMenuRef)
 *          The menu being measured.
 *
 *    --> kEventParamControlRef (in, typeControlRef)
 *          If the menu uses a content view, this parameter contains
 *          the HIViewRef that should calculate the menu's size. This
 *          parameter will not be present if the menu uses an MDEF.
 *
 *    --> kEventParamGDevice (in, typeGDHandle)
 *          If the menu uses an MDEF, this parameter contains the
 *          GDevice on which the menu will be displayed. This parameter
 *          will not be present if the menu uses a content view.
 *
 *    --> kEventParamAvailableBounds (in, typeQDRectangle)
 *          If the menu uses an MDEF, this parameter contains a
 *          bounding rect in global coordinates inside of which the
 *          menu should be displayed. This parameter is optional and
 *          may not be present in all instances of this event; if not
 *          present, the GDevice's bounds should be used instead. This
 *          parameter will not be present if the menu uses a content
 *          view.
 *
 *    <-- kEventParamDimensions (out, typeHISize)
 *          On exit, contains the menu's size.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const kEventMenuCalculateSize       = 1004;

{
 *  kEventClassMenu / kEventMenuCreateFrameView
 *
 *  Summary:
 *    Requests that a menu content view create the HIView that will
 *    used to draw the menu window frame.
 *
 *  Discussion:
 *    The HIMenuView class provides a default handler for this event
 *    that creates an instance of the standard menu window frame view.
 *
 *
 *    This event is sent only to the menu content view, and is not
 *    propagated past the view.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamEventRef (in, typeEventRef)
 *          The initialization event that should be used to create the
 *          view. A handler for this event may add its own parameters
 *          to this event.
 *
 *    --> kEventParamMenuType (in, typeThemeMenuType)
 *          The type of menu frame (pull-down, popup, or hierarchical)
 *          that is needed.
 *
 *    <-- kEventParamMenuFrameView (out, typeControlRef)
 *          On exit, contains the newly created menu frame view.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const kEventMenuCreateFrameView     = 1005;

{
 *  kEventClassMenu / kEventMenuGetFrameBounds
 *
 *  Summary:
 *    Requests that a menu content view calculate the bounding rect, in
 *    global coordinates, of the menu window frame that should contain
 *    the menu.
 *
 *  Discussion:
 *    This event is sent by the Menu Manager before displaying
 *    pull-down, popup, and hierarchical menus. It provides an
 *    opportunity for the menu content view to determine the position
 *    of the menu frame based on the position of the menu title, parent
 *    menu item, or popup menu location.
 *
 *    The HIMenuView class provides a default handler for this event
 *    that calculates an appropriate location based on the bounds of
 *    the menu, the available screen space, and the frame metrics of
 *    the menu window content view.
 *
 *    This event is sent only to the menu content view, and is not
 *    propagated past the view.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamMenuType (in, typeThemeMenuType)
 *          The type of menu (pull-down, popup, or hierarchical) that
 *          is being displayed.
 *
 *    --> kEventParamMenuIsPopup (in, typeBoolean)
 *          Whether this menu originated from a popup menu. Primarily
 *          useful to distinguish between hierarchical menus that are
 *          submenus of pull-down menus, and hierarchical menus that
 *          are submenus of popup menus.
 *
 *    --> kEventParamMenuFrameView (in, typeControlRef)
 *          The menu window frame view.
 *
 *    --> kEventParamMenuDirection (in, typeMenuDirection)
 *          The suggested direction (left or right) which the view
 *          should attempt to use when positioning the menu window. For
 *          pull-down menus, this will typically be
 *          kHIMenuRightDirection; for hierarchical menus, it will be
 *          the same direction as the parent menu.
 *
 *    --> kEventParamMenuItemBounds (in, typeHIRect)
 *          The bounds, in global coordinates, of the parent menu title
 *          (for pull-down menus), the parent menu item (for
 *          hierarchical menus), or the popup location (for popup
 *          menus).
 *
 *    --> kEventParamGDevice (in, typeGDHandle)
 *          The GDevice on which the menu should be displayed.
 *
 *    --> kEventParamAvailableBounds (in, typeHIRect)
 *          The available bounds, in global coordinates, inside which
 *          the menu should be displayed. The menu should not extend
 *          outside of these bounds.
 *
 *    --> kEventParamParentMenu (in, typeMenuRef)
 *          Only available when kEventParamMenuType is
 *          kThemeMenuTypeHierarchical. The parent menu of this menu.
 *
 *    --> kEventParamParentMenuItem (in, typeMenuItemIndex)
 *          Only available when kEventParamMenuType is
 *          kThemeMenuTypeHierarchical. The parent menu item of this
 *          menu.
 *
 *    --> kEventParamMenuPopupItem (in, typeMenuItemIndex)
 *          Only available when kEventParamMenuType is
 *          kThemeMenuTypePopUp. The item in the menu that should be
 *          positioned at the popup location, or zero if no item should
 *          be positioned there.
 *
 *    <-- kEventParamBounds (out, typeHIRect)
 *          On exit, contains the bounding rect, in global coordinates,
 *          of the menu window. The handler should add this parameter
 *          to the event.
 *
 *    <-- kEventParamOrigin (out, typeHIPoint)
 *          On exit, contains the origin to which the menu content view
 *          should be scrolled before the menu is displayed.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const kEventMenuGetFrameBounds      = 1006;

{
 *  kEventClassMenu / kEventMenuBecomeScrollable
 *
 *  Summary:
 *    Requests that a menu content view prepare to be scrollable, by
 *    installing the appropriate event handlers, timers, etc.
 *
 *  Discussion:
 *    This event is sent by the Menu Manager when a menu becomes the
 *    most recently opened menu in the menu hierarchy. It is an
 *    indication that this menu content view is now a candidate for
 *    scrolling.
 *
 *    The Menu Manager provides a default handler for this event that
 *    installs event handlers to provide automatic scrolling behavior
 *    for HIView-based menus.
 *
 *    If a menu content view does not wish to use the Menu Manager's
 *    default scrolling support, it can override this event and return
 *    noErr to prevent the event from being propagated to the Menu
 *    Manager's default handler.
 *
 *    This event is sent only to the menu content view, and is not
 *    propagated past the view.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const kEventMenuBecomeScrollable    = 1007;

{
 *  kEventClassMenu / kEventMenuCeaseToBeScrollable
 *
 *  Summary:
 *    Requests that a menu content view cease to be scrollable.
 *
 *  Discussion:
 *    This event is sent by the Menu Manager when a menu ceases to be
 *    the most recently opened menu. This occurs when the menu is
 *    closed, or when a submenu of the most recently opened menu is
 *    opened. It is an indication that this menu content view is no
 *    longer a candidate for scrolling.
 *
 *    The Menu Manager provides a default handler for this event that
 *    removes event handlers installed in response to
 *    kEventMenuBecomeScrollable.
 *
 *    This event is sent only to the menu content view, and is not
 *    propagated past the view.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const kEventMenuCeaseToBeScrollable = 1008;

{
 *  kEventClassMenu / kEventMenuBarShown
 *
 *  Summary:
 *    Notification that the menubar in the frontmost process has been
 *    shown.
 *
 *  Discussion:
 *    This event is sent to all handlers registered for it. This event
 *    will be sent to registered handlers in all processes when the
 *    front process shows its menubar. This event is sent only to the
 *    application target.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const kEventMenuBarShown            = 2000;

{
 *  kEventClassMenu / kEventMenuBarHidden
 *
 *  Summary:
 *    Notification that the menubar in the frontmost process has been
 *    hidden.
 *
 *  Discussion:
 *    This event is sent to all handlers registered for it. This event
 *    will be sent to registered handlers in all processes when the
 *    front process hides its menubar. This event is sent only to the
 *    application target.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const kEventMenuBarHidden           = 2001;

{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{  Command Events                                                                      }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{
    kEventClassCommand quick reference:

    kEventCommandProcess        = 1,
    kEventCommandUpdateStatus   = 2
}
{
 *  kEventClassCommand / kEventCommandProcess
 *
 *  Summary:
 *    A command has been invoked and the application should handle it.
 *
 *  Discussion:
 *    This event is sent when the user chooses a menu item or clicks a
 *    control. Any menu item selection, from either the menubar, a
 *    popup or contextual menu, or a popup or bevel button control,
 *    will cause this event to be sent; if the menu item does not have
 *    a command ID, the commandID field of the HICommand parameter will
 *    be zero, but the event will still contain a valid MenuRef and
 *    MenuItemIndex. Controls will send this event only if the control
 *    has a non-zero command ID set with SetControlCommandID.
 *
 *    Some senders of this event will also include the modifier keys
 *    that were pressed by the user when the command was invoked, but
 *    this parameter is optional and may not be present in all
 *    instances of this event.
 *
 *    When a command event is sent from a menu, a MenuContext parameter
 *    will be included on Mac OS X 10.2 and CarbonLib 1.6, indicating
 *    whether the command was sent from a menu in the menubar
 *    (kMenuContextMenuBar will be set) or from a popup menu
 *    (kMenuContextMenuBar will not be set). The MenuContext parameter
 *    also indicates whether the event was sent by a selection of a
 *    menu item with the mouse (kMenuContextMenuBarTracking or
 *    kMenuContextPopUpTracking will be set), or by a command key press
 *    (kMenuContextKeyMatching will be set). If you need to determine
 *    the source of a command event on a Carbon release prior to Mac OS
 *    X 10.2 or CarbonLib 1.6, we recommend installing a
 *    kEventMenuEnableItems handler on each menu and caching the
 *    MenuContext parameter in the EnableItems event in a menu
 *    property; when you receive the CommandProcess event, look up the
 *    cached MenuContext.
 *
 *    It is essential that your event handler for this event return
 *    eventNotHandledErr for any command events that you do not handle,
 *    especially for commands that are sent from menus attached to
 *    popup or bevel button controls; if, for example, you return noErr
 *    for command events sent in response to a menu selection from a
 *    popup button, the Menu Manager will return zero from
 *    PopUpMenuSelect, and the popup button control will not know that
 *    an item was selected from the popup menu and will not redraw with
 *    the new selection.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeHICommand)
 *          The command to be handled.
 *
 *    --> kEventParamKeyModifiers (in, typeUInt32)
 *          The keyboard modifiers that were pressed when the command
 *          was invoked by the user. This parameter is optional and may
 *          not be present in all instances of this event.
 *
 *    --> kEventParamMenuContext (in, typeUInt32)
 *          If the command was contained in a menu, information about
 *          the menu. This parameter is optional and may not be present
 *          in all instances of this event. Available in Mac OS X 10.2
 *          and CarbonLib 1.6, and later.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        in CarbonLib 1.1 and later
 }
const kEventCommandProcess          = 1;

{
 *  kEventClassCommand / kEventCommandUpdateStatus
 *
 *  Summary:
 *    A command-generating user interface element requires updating.
 *
 *  Discussion:
 *    When you receive this event, you should update the necessary UI
 *    elements in your application to reflect the current status of the
 *    command. For example, if the command has the kHICommandFromMenu
 *    bit set, you should update the menu item state, menu item text,
 *    and so on, to reflect the current reality in your application. If
 *    the menu item is the "Undo" item, and the last editing change to
 *    the document was a Cut operation, then you might set the text to
 *    "Undo Cut" and enable the menu item.
 *
 *    Currently, this event is only sent for menu items; it is not used
 *    to update the status of controls.
 *
 *    Note that when responding to this event, you should only update
 *    the status of the single user interface element (a menu item, for
 *    example) described by the HICommand structure; you should not
 *    update the status of the entire menu or of all menus in the
 *    menubar. You will receive a separate UpdateStatus event for each
 *    menu item in a menu, and each item should be updated
 *    individually. When updating a menu item, you should generally not
 *    use Enable/DisableMenuCommand; these APIs search the entire menu
 *    hierarchy for the command ID. Instead, just call
 *    Enable/DisableMenuItem directly, passing the menu and menu item
 *    index that are provided to you in the HICommand structure.
 *
 *
 *    You may wish to optimize your handling of the UpdateStatus event
 *    by examining the MenuContext parameter to the event. This
 *    parameter indicates the context in which the command requires
 *    updating. For example, if the menu context parameter has the
 *    kMenuContextKeyMatching bit set, you know that the update request
 *    is being sent in while search for a menu item that matches a
 *    command key. This knowledge can help you avoid unnecessary work;
 *    if your menu item for this command has no command key, for
 *    example, you can ignore this event when the KeyMatching bit is
 *    set because your menu item will never match a command key
 *    anyways, regardless of whether it is enabled or disabled.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeHICommand)
 *          The command to be updated.
 *
 *    --> kEventParamMenuContext (in, typeUInt32)
 *          If the command was contained in a menu, information about
 *          the menu and the context of the command updating request.
 *          This parameter is optional and may not be present in all
 *          instances of this event.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        in CarbonLib 1.1 and later
 }
const kEventCommandUpdateStatus     = 2;

{ HI Commands }

{
 *  Summary:
 *    Common command IDs
 }
const
    {
   * The OK button in a dialog or alert.
   }
  kHICommandOK                  = $6F6B2020 (* 'ok  ' *);

  {
   * The Cancel button in a dialog or alert.
   }
  kHICommandCancel              = $6E6F7421 (* 'not!' *);

  {
   * The application should quit.
   }
  kHICommandQuit                = $71756974 (* 'quit' *);

  {
   * The last editing operation should be undone.
   }
  kHICommandUndo                = $756E646F (* 'undo' *);

  {
   * The last editing operation should be redone.
   }
  kHICommandRedo                = $7265646F (* 'redo' *);

  {
   * The selected items should be cut.
   }
  kHICommandCut                 = $63757420 (* 'cut ' *);

  {
   * The selected items should be copied.
   }
  kHICommandCopy                = $636F7079 (* 'copy' *);

  {
   * The contents of the clipboard should be pasted.
   }
  kHICommandPaste               = $70617374 (* 'past' *);

  {
   * The selected items should be deleted.
   }
  kHICommandClear               = $636C6561 (* 'clea' *);

  {
   * All items in the active window should be selected.
   }
  kHICommandSelectAll           = $73616C6C (* 'sall' *);

  {
   * The application should be hidden. The Menu Manager will respond to
   * this command automatically; your application does not need to
   * handle it.
   }
  kHICommandHide                = $68696465 (* 'hide' *);

  {
   * Other applications should be hidden. The Menu Manager will respond
   * to this command automatically; your application does not need to
   * handle it.
   }
  kHICommandHideOthers          = $6869646F (* 'hido' *);

  {
   * All applications should become visible. The Menu Manager will
   * respond to this command automatically; your application does not
   * need to handle it.
   }
  kHICommandShowAll             = $7368616C (* 'shal' *);

  {
   * The Preferences menu item has been selected.
   }
  kHICommandPreferences         = $70726566 (* 'pref' *);

  {
   * The active window should be zoomed in or out. The Window Manager
   * will respond to this event automatically; your application does
   * not need to handle it, but you may want to install a Carbon event
   * handler for kEventWindowGetIdealSize to return the ideal size for
   * your document windows.
   }
  kHICommandZoomWindow          = $7A6F6F6D (* 'zoom' *);

  {
   * The active window should be minimized. The Window Manager will
   * respond to this event automatically; your application does not
   * need to handle it.
   }
  kHICommandMinimizeWindow      = $6D696E69 (* 'mini' *);

  {
   * All collapsable windows should be minimized. The Window Manager
   * will respond to this event automatically; your application does
   * not need to handle it.
   }
  kHICommandMinimizeAll         = $6D696E61 (* 'mina' *);

  {
   * The active window should be maximized. Only sent on Mac OS 9. The
   * Window Manager will respond to this event automatically; your
   * application does not need to handle it.
   }
  kHICommandMaximizeWindow      = $6D617869 (* 'maxi' *);

  {
   * All collapsable windows should be maximized. The Window Manager
   * will respond to this event automatically; your application does
   * not need to handle it.
   }
  kHICommandMaximizeAll         = $6D617861 (* 'maxa' *);

  {
   * All document-class windows should be arranged in a stack. The
   * Window Manager will respond to this event automatically; your
   * application does not need to handle it.
   }
  kHICommandArrangeInFront      = $66726E74 (* 'frnt' *);

  {
   * All windows of this application should be brought in front of
   * windows from other applications. Only sent on Mac OS X. The Window
   * Manager will respond to this event automatically; your application
   * does not need to handle it.
   }
  kHICommandBringAllToFront     = $62667274 (* 'bfrt' *);

  {
   * This command ID is used as a placeholder to mark the separator
   * item dividing the Zoom/Minimize/Maximize/Arrange menu items in the
   * standard Window menu from the menu items listing the visible
   * windows. If you need to add your own menu items to the standard
   * Window menu before the window list section, you can look for the
   * menu item with this command ID using GetIndMenuItemWithCommandID,
   * and insert your menu items before the item with this ID.
   }
  kHICommandWindowListSeparator = $776C6476 (* 'wldv' *);

  {
   * This command ID is used as a placeholder to mark the end of the
   * window list section of the standard Window menu. If you need to
   * add your own menu items to the standard Window menu after the
   * window list section, you can look for the menu item with this
   * command ID using GetIndMenuItemWithCommandID, and insert your
   * items after the item with this ID.
   }
  kHICommandWindowListTerminator = $776C7374 (* 'wlst' *);

  {
   * A window in the standard Window menu has been selected and should
   * be activated. In Mac OS X 10.3, this command is also sent by the
   * toolbox whenever it needs to activate a window in your
   * application; for example, it is used when a window is selected
   * from the application's Dock menu, and when a window that uses the
   * standard window event handler is clicked. The Window Manager will
   * respond to this event automatically; your application does not
   * need to handle it.
   }
  kHICommandSelectWindow        = $7377696E (* 'swin' *);

  {
   * The Rotate Windows hotkey (cmd-~ by default) has been pressed, and
   * non-floating windows should be rotated so that the window after
   * the active window is activated. The Window Manager will respond to
   * this event automatically; your application does not need to handle
   * it.
   }
  kHICommandRotateWindowsForward = $726F7477 (* 'rotw' *);

  {
   * The Rotate Windows hotkey (cmd-~ by default) has been pressed, and
   * non-floating windows should be rotated so that the window before
   * the active window is activated. The Window Manager will respond to
   * this event automatically; your application does not need to handle
   * it.
   }
  kHICommandRotateWindowsBackward = $726F7462 (* 'rotb' *);

  {
   * The floating window focus hotkey (ctl-F6 by default) has been
   * pressed, and floating windows should be rotated so that the window
   * after the focused window is activated. The Window Manager will
   * respond to this event automatically; your application does not
   * need to handle it.
   }
  kHICommandRotateFloatingWindowsForward = $72746677 (* 'rtfw' *);

  {
   * The floating window focus hotkey (ctl-F6 by default) has been
   * pressed, and floating windows should be rotated so that the window
   * before the focused window is activated. The Window Manager will
   * respond to this event automatically; your application does not
   * need to handle it.
   }
  kHICommandRotateFloatingWindowsBackward = $72746662 (* 'rtfb' *);

  {
   * The About menu item has been selected.
   }
  kHICommandAbout               = $61626F75 (* 'abou' *);

  {
   * A new document or item should be created.
   }
  kHICommandNew                 = $6E657720 (* 'new ' *);

  {
   * The user wants to open an existing document.
   }
  kHICommandOpen                = $6F70656E (* 'open' *);

  {
   * The active window should be closed.
   }
  kHICommandClose               = $636C6F73 (* 'clos' *);

  {
   * The active document should be saved.
   }
  kHICommandSave                = $73617665 (* 'save' *);

  {
   * The user wants to save the active document under a new name.
   }
  kHICommandSaveAs              = $73766173 (* 'svas' *);

  {
   * The contents of the active document should be reverted to the last
   * saved version.
   }
  kHICommandRevert              = $72767274 (* 'rvrt' *);

  {
   * The active window should be printed.
   }
  kHICommandPrint               = $70726E74 (* 'prnt' *);

  {
   * The user wants to configure the current page margins, formatting,
   * and print options.
   }
  kHICommandPageSetup           = $70616765 (* 'page' *);

  {
   * The applicationÕs help book should be displayed. Used by the Help
   * Manager when it adds the "<AppName> Help" menu item to the Help
   * menu. The Help Manager will respond to this event automatically;
   * your application does not need to handle it.
   }
  kHICommandAppHelp             = $61686C70 (* 'ahlp' *);

  {
   * The character palette needs to be shown. Events with this command
   * ID are only generated in Mac OS X 10.3 and later. The toolbox will
   * respond to this event automatically; your application does not
   * need to handle it.
   }
  kHICommandShowCharacterPalette = $63687270 (* 'chrp' *);


{
 *  Summary:
 *    Values for the attributes field of the HICommand and
 *    HICommandExtended structures.
 *
 *  Discussion:
 *    These bit masks are mutually exclusive; only one should be set at
 *    any given time. Some HICommand and HICommandExtended structures
 *    will have an attributes value of zero; in this case, there is no
 *    information available about the source of the command.
 }
const
    {
   * Indicates that the command originates from a menu item. The
   * HICommand.menu and HICommandExtended.source.menu fields are valid.
   }
  kHICommandFromMenu            = (1 shl 0);

  {
   * Indicates that the command originates from a control. The
   * HICommandExtended.source.control field is valid.
   }
  kHICommandFromControl         = (1 shl 1);

  {
   * Indicates that the command originates from a window. The
   * HICommandExtended.source.window field is valid.
   }
  kHICommandFromWindow          = (1 shl 2);

type
    HICommandPtr = ^HICommand;
    HICommand = record
        attributes:             UInt32;
        commandID:              UInt32;
        menuRef:                MenuRef;
        menuItemIndex:          MenuItemIndex;
    end;

    HICommandExtendedPtr = ^HICommandExtended;
    HICommandExtended = record
        attributes:             UInt32;
        commandID:              UInt32;
        case SInt16 of
        0: (
            control:            ControlRef;
            );
        1: (
            window:             WindowRef;
            );
        2: (
            menuRef:            MenuRef;
            menuItemIndex:      MenuItemIndex;
           );
    end;

{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{  Control Events                                                                      }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{
    kEventClassControl quick reference:

    // lifespan
    kEventControlInitialize                     = 1000,
    kEventControlDispose                        = 1001,
    kEventControlGetOptimalBounds               = 1003,
    kEventControlDefInitialize                  = kEventControlInitialize,
    kEventControlDefDispose                     = kEventControlDispose,

    // event handling
    kEventControlHit                            = 1,
    kEventControlSimulateHit                    = 2,
    kEventControlHitTest                        = 3,
    kEventControlDraw                           = 4,
    kEventControlApplyBackground                = 5,
    kEventControlApplyTextColor                 = 6,
    kEventControlSetFocusPart                   = 7,
    kEventControlGetFocusPart                   = 8,
    kEventControlActivate                       = 9,
    kEventControlDeactivate                     = 10,
    kEventControlSetCursor                      = 11,
    kEventControlContextualMenuClick            = 12,
    kEventControlClick                          = 13,
    kEventControlGetNextFocusCandidate          = 14,
    kEventControlGetAutoToggleValue             = 15,
    kEventControlInterceptSubviewClick          = 16,
    kEventControlGetClickActivation             = 17,
    kEventControlDragEnter                      = 18,
    kEventControlDragWithin                     = 19,
    kEventControlDragLeave                      = 20,
    kEventControlDragReceive                    = 21,
    kEventControlInvalidateForSizeChange        = 22,
%   kEventControlTrackingAreaEntered            = 23,   // in private header
%   kEventControlTrackingAreaExited             = 24,   // in private header

    // tracking
    kEventControlTrack                          = 51,
    kEventControlGetScrollToHereStartPoint      = 52,
    kEventControlGetIndicatorDragConstraint     = 53,
    kEventControlIndicatorMoved                 = 54,
    kEventControlGhostingFinished               = 55,
    kEventControlGetActionProcPart              = 56,

    // accessors
    kEventControlGetPartRegion                  = 101,
    kEventControlGetPartBounds                  = 102,
    kEventControlSetData                        = 103,
    kEventControlGetData                        = 104,
    kEventControlGetSizeConstraints             = 105,
    kEventControlGetFrameMetrics                = 106,

    // notification
    %% NOTE: some values in this range may already be taken. Look for kEventControl in ControlsPriv.i
    kEventControlValueFieldChanged              = 151,
    kEventControlAddedSubControl                = 152,
    kEventControlRemovingSubControl             = 153,
    kEventControlBoundsChanged                  = 154,
    kEventControlVisibilityChanged              = 157,
    kEventControlTitleChanged                   = 158,
    kEventControlOwningWindowChanged            = 159,
    kEventControlHiliteChanged                  = 160,
    kEventControlEnabledStateChanged            = 161,
    kEventControlLayoutInfoChanged              = 162,

    // miscellaneous
    kEventControlArbitraryMessage               = 201
}

{
 *  kEventClassControl / kEventControlClick
 *
 *  Summary:
 *    A mouse down event occurred over a control.
 *
 *  Discussion:
 *    This event is sent when a non-contextual-menu click occurs over a
 *    control; a contextual menu click generates
 *    kEventControlContextualMenuClick instead.
 *
 *    The handler of this event is responsible for two things: first,
 *    the handler must set the keyboard focus to the control if the
 *    control takes focus on clicks; look for the
 *    kControlGetsFocusOnClick feature bit and call an API such as
 *    SetKeyboardFocus. Second, the handler must call one of the
 *    control tracking APIs: HIViewClick, HandleControlClick, or
 *    TrackControl. The standard window handler does both of these
 *    things.
 *
 *    Warning: Beware of handling kEventControlClick events! This is
 *    usually NOT the event you really want to handle.
 *    kEventControlClick is a request to "please click this control,"
 *    not "allow a control definition to track the mouse." If you are
 *    implementing or overriding a control definitionÕs or HIViewÕs
 *    support for tracking the mouse, you should handle
 *    kEventControlTrack instead.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeControlRef)
 *          The control that was clicked.
 *
 *    --> kEventParamMouseLocation (in, typeHIPoint)
 *          The mouse location, in global coordinates.
 *
 *    --> kEventParamWindowRef (in, typeWindowRef)
 *          The window under the mouse.
 *
 *    --> kEventParamWindowMouseLocation (in, typeHIPoint)
 *          The window-relative position of the mouse in the window
 *          given in the kEventParamWindowRef parameter. 0,0 is at the
 *          top left of the structure of the window.
 *
 *    --> kEventParamWindowPartCode (in, typeWindowPartCode)
 *          The part code the mouse location hit in the window. This
 *          parameter only exists if the windowRef parameter exists.
 *          This saves you the trouble of calling FindWindow, which is
 *          expensive on Mac OS X as it needs to call the Window
 *          Server. Available in Mac OS X 10.3 and later.
 *
 *    --> kEventParamKeyModifiers (in, typeUInt32)
 *          The keyboard modifiers that were pressed when the event was
 *          generated.
 *
 *    --> kEventParamMouseButton (in, typeMouseButton)
 *          Which mouse button was pressed.
 *
 *    --> kEventParamClickCount (in, typeUInt32)
 *          Whether this is a single click, double click, etc.
 *
 *    --> kEventParamMouseChord (in, typeUInt32)
 *          Which other mouse buttons were pressed when the event was
 *          generated. Available on Mac OS X only.
 *
 *    --> kEventParamTabletEventType (in, typeUInt32)
 *          The type of tablet event which generated this mouse event;
 *          contains either kEventTabletPoint or kEventTabletProximity.
 *          Only present if the event was generated from a tablet.
 *
 *    --> kEventParamTabletPointRec (in, typeTabletPointRec)
 *          Further information about the tablet event which generated
 *          this mouse event. Present if the the
 *          kEventParamTabletEventType parameter contains
 *          kEventTabletPoint.
 *
 *    --> kEventParamTabletProximityRec (in, typeTabletProximityRec)
 *          Further information about the tablet event which generated
 *          this mouse event. Present if the the
 *          kEventParamTabletEventType parameter contains
 *          kEventTabletProximity.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        in CarbonLib 1.3.1 and later
 }
const kEventControlClick            = 13;

{
 *  kEventClassControl / kEventControlHit
 *
 *  Summary:
 *    Sent by TrackControl and HandleControlClick after handling a
 *    click in a control.
 *
 *  Discussion:
 *    This event indicates that a control has been manipulated by the
 *    user and that the user released the mouse button over some part
 *    of the control. It is sent automatically by the Control Manager
 *    when the control tracking code returns a non-zero part
 *    code.
 *
 *    You might want to handle this event in a custom control
 *    definition if your control definition has special behavior after
 *    the control has been tracked. You can also handle this event in
 *    application code, to be notified after a control has been
 *    tracked; however, from the application level, it is generally
 *    preferred to provide a command ID for the control and handle
 *    kEventCommandProcess instead of kEventControlHit. Handling
 *    kEventCommandProcess is more generic and allows the same code to
 *    handle events from both controls and menu items.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeControlRef)
 *          The control that was tracked.
 *
 *    --> kEventParamControlPart (in, typeControlPartCode)
 *          The control part that the mouse was over when it was
 *          released.
 *
 *    --> kEventParamKeyModifiers (in, typeUInt32)
 *          The keyboard modifiers that were pressed when the mouse was
 *          released.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        in CarbonLib 1.1 and later
 }
const kEventControlHit              = 1;

{
 *  kEventClassControl / kEventControlInitialize
 *
 *  Summary:
 *    Allows the control to initialize private data.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeControlRef)
 *          The control that is being created.
 *
 *    --> kEventParamInitCollection (in, typeCollection)
 *          Initialization data supplied to CreateCustomControl.
 *
 *    <-- kEventParamControlFeatures (out, typeUInt32)
 *          On exit, your event handler should supply the control
 *          features flags. NOTE: On Mac OS X 10.3 and later, this is
 *          deprecated in favor of using the HIViewChangeFeatures API.
 *          Instead of supplying this parameter, just call
 *          HIViewChangeFeatures. Also, this parameter can only be used
 *          to supply features for the original kControlFoo features,
 *          not the new kHIViewFoo features.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const kEventControlInitialize       = 1000;

{
 *  kEventClassControl / kEventControlDispose
 *
 *  Summary:
 *    Allows the control to dispose of private data.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeControlRef)
 *          The control that is being destroyed.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const kEventControlDispose          = 1001;

{
 *  kEventClassControl / kEventControlGetOptimalBounds
 *
 *  Summary:
 *    Allows the control to report its best size and its text baseline
 *    based on its current settings.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeControlRef)
 *          The control whose optimal bounds to return.
 *
 *    <-- kEventParamControlOptimalBounds (out, typeHIRect)
 *          On exit, contains the controlÕs optimal bounds.
 *
 *    <-- kEventParamControlOptimalBaselineOffset (out, typeShortInteger)
 *          On exit, contains the controlÕs optimal baseline offset:
 *          the distance from the top of the controlÕs optimal bounds
 *          to the baseline of the control text, if any. This parameter
 *          is optional and does not need to be provided if it doesnÕt
 *          apply for your control.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const kEventControlGetOptimalBounds = 1003;

{
 *  kEventClassControl / kEventControlSimulateHit
 *
 *  Summary:
 *    Sent when your control should simulate a click in response to
 *    some other action, such as a return key for a default button.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeControlRef)
 *          The control for which a hit should be simulated.
 *
 *    --> kEventParamKeyModifiers (in, typeUInt32)
 *          The keyboard modifiers that should be used for the
 *          simulated hit.
 *
 *    <-> kEventParamControlPart (in/out, typeControlPartCode)
 *          On entry, contains the part code for which the control
 *          should simulate a hit. On exit, the control may modify this
 *          parameter to reflect the same sort of part code that it
 *          would pass back while handling kEventControlTrack.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const kEventControlSimulateHit      = 2;

{
 *  kEventClassControl / kEventControlHitTest
 *
 *  Summary:
 *    Sent when someone wants to find out what part of your control is
 *    at a given point in local coordinates.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeControlRef)
 *          The control to hit-test.
 *
 *    --> kEventParamMouseLocation (in, typeQDPoint)
 *          The point to hit-test. For controls in non-compositing
 *          windows, this coordinate is in local coordinates of the
 *          owning window; for controls in compositing windows, this
 *          coordinate is in view-local coordinates.
 *
 *    <-- kEventParamControlPart (out, typeControlPartCode)
 *          On exit, contains the part code of the control part that
 *          was hit, or kControlNoPart if no part was hit.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const kEventControlHitTest          = 3;

{
 *  kEventClassControl / kEventControlDraw
 *
 *  Summary:
 *    Sent when your control should draw itself. The event can
 *    optionally contain a port in which to draw and a part to
 *    constrain drawing to.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeControlRef)
 *          The control to be drawn.
 *
 *    --> kEventParamControlPart (in, typeControlPartCode)
 *          The control part code to draw. This parameter is optional
 *          and may not be present in all instances of this event. Draw
 *          the entire control if the parameter is not present.
 *
 *    --> kEventParamGrafPort (in, typeGrafPtr)
 *          The GrafPort into which to draw the control. This parameter
 *          is optional and may not be present in all instances of this
 *          event. Draw into the current port if the parameter is not
 *          present.
 *
 *    --> kEventParamRgnHandle (in, typeQDRgnHandle)
 *          A region describing the area that needs to be redrawn; you
 *          may constrain your drawing to this region. This parameter
 *          is only provided on Mac OS X 10.2 and later, and only in
 *          certain situations in compositing mode (when the view is
 *          visible, etc). Draw the entire control if the parameter is
 *          not present.
 *
 *    --> kEventParamCGContextRef (in, typeCGContextRef)
 *          The CGContext into which to draw the control. This
 *          parameter is only provided on Mac OS X 10.2 and later, and
 *          only when the owning window uses compositing mode. The
 *          context is already transformed and clipped appropriately
 *          for view-local drawing. If this parameter is present, you
 *          should always use it; this will be extremely important to
 *          allow printing of controls. If this parameter is not
 *          present (prior to Mac OS X 10.2, or in a non-compositing
 *          window), and you want to draw with CoreGraphics, you can
 *          create your own CGContext with QDBeginCGContext.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const kEventControlDraw             = 4;

{
 *  kEventClassControl / kEventControlApplyBackground
 *
 *  Summary:
 *    Sent when your control should apply its background color or
 *    pattern to the specified port so that subcontrols of this control
 *    can properly erase.
 *
 *  Discussion:
 *    This event is used for non-composited control drawing. When an
 *    embedded control in a non-composited window draws, it first
 *    erases its bounding rect. Before calling EraseRect or EraseRgn,
 *    the control calls SetUpControlBackground, which sends this event
 *    to parent controls of the embedded control that have the
 *    kControlHasSpecialBackground feature flag. An embedding control
 *    may respond to this event by setting the background color or
 *    pattern of the specified GrafPort; this color or pattern will
 *    then be used by the embedded control when it erases its
 *    bounds.
 *
 *    Note that an embedding control should not actually draw its
 *    background in response to this event; doing so would not have any
 *    effect, because the embedded control will erase any drawing
 *    shortly anyways.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeControlRef)
 *          The control which should apply a background color or
 *          pattern.
 *
 *    --> kEventParamControlSubControl (in, typeControlRef)
 *          The subcontrol that is about to draw.
 *
 *    --> kEventParamControlDrawDepth (in, typeShortInteger)
 *          The bit depth of the GDevice on which the subcontrol will
 *          be drawn.
 *
 *    --> kEventParamControlDrawInColor (in, typeBoolean)
 *          Whether the GDevice on which the subcontrol will be drawn
 *          is in color or black & white.
 *
 *    --> kEventParamGrafPort (in, typeGrafPtr)
 *          The port to which the background color or pattern should be
 *          applied. This parameter is optional and may not be present
 *          in all instances of this event. Apply the background to the
 *          current port if this parameter is not present.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const kEventControlApplyBackground  = 5;

{
 *  kEventClassControl / kEventControlApplyTextColor
 *
 *  Summary:
 *    Sent when your control should apply a color or pattern to the
 *    specified port and context so a subcontrol can draw text which
 *    looks appropriate for your controlÕs background.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeControlRef)
 *          The control which should apply a text color.
 *
 *    --> kEventParamControlSubControl (in, typeControlRef)
 *          The subcontrol that is about to draw.
 *
 *    --> kEventParamControlDrawDepth (in, typeShortInteger)
 *          The bit depth of the GDevice on which the subcontrol will
 *          be drawn.
 *
 *    --> kEventParamControlDrawInColor (in, typeBoolean)
 *          Whether the GDevice on which the subcontrol will be drawn
 *          is in color or black & white.
 *
 *    --> kEventParamCGContextRef (in, typeCGContextRef)
 *          The CGContext to which the text color should be applied.
 *          This parameter is optional and may not be present in all
 *          instances of this event.
 *
 *    --> kEventParamGrafPort (in, typeGrafPtr)
 *          The GrafPort to which the text color should be applied.
 *          This parameter is optional and may not be present in all
 *          instances of this event. Apply to the current port if this
 *          parameter is not present.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const kEventControlApplyTextColor   = 6;

{
 *  kEventClassControl / kEventControlGetNextFocusCandidate
 *
 *  Summary:
 *    Sent so that a given control can customize the focus order of its
 *    subcontrols.
 *
 *  Discussion:
 *    The recipient will receive a start subcontrol in the
 *    kEventParamStartControl parameter and a focusing direction in the
 *    kEventParamControlPart parameter. You must only pass back
 *    subcontrols of yourself (or NULL) when receiving this event; if
 *    you do otherwise, the Control ManagerÕs behavior is undefined.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeControlRef)
 *          The control which should customize the focus order.
 *
 *    --> kEventParamControlPart (in, typeControlPartCode)
 *          A focusing meta-part code, either kControlFocusNextPart or
 *          kControlFocusPrevPart.
 *
 *    --> kEventParamStartControl (in, typeControlRef)
 *          On exit, should contain the next or previous subcontrol; if
 *          there is no next subcontrol in the given focusing
 *          direction, the recipient must either exclude the
 *          kEventParamNextControl parameter or set it to NULL
 *
 *    <-- kEventParamNextControl (out, typeControlRef)
 *          The starting point from which to search for the next or
 *          previous control. This parameter is optional and may not be
 *          present in all instances of this event. Find the first
 *          subcontrol in the appropriate focusing direction if this
 *          parameter is not present or if it contains NULL.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const kEventControlGetNextFocusCandidate = 14;

{
 *  kEventClassControl / kEventControlGetAutoToggleValue
 *
 *  Summary:
 *    This event is sent when the Control Manager is about to
 *    autotoggle a control. You can specify the toggled value to use
 *    based on the current value of your control.
 *
 *  Discussion:
 *    The Control Manager provides default behavior for this event. If
 *    the event is not handled by a control, the default handler
 *    automatically provides this mapping: if the controlÕs value is 1,
 *    the toggled value is 0. If the controlÕs value is any other
 *    value, the toggled value is 1.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeControlRef)
 *          The control that is being toggled.
 *
 *    --> kEventParamControlPart (in, typeControlPartCode)
 *          The control part that is being toggled.
 *
 *    <-- kEventParamControlValue (out, typeLongInteger)
 *          On exit, contains the new control value.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const kEventControlGetAutoToggleValue = 15;

{
 *  kEventClassControl / kEventControlInterceptSubviewClick
 *
 *  Summary:
 *    This is sent when the HIViewGetViewForMouseEvent API is called,
 *    to allow embedding controls to intercept clicks in the their
 *    embedded controls.
 *
 *  Discussion:
 *    The Control Manager sends this event before descending into any
 *    subviews. Controls can override this to intercept clicks which
 *    would normally be destined for their children. For example, the
 *    HIToolbar control intercepts cmd-clicks to handle dragging its
 *    children. To accomplish this, it overrides this event, looking
 *    for the command key modifier. When the command key is pressed,
 *    the view just returns noErr as the result from its event handler.
 *    This tells the Control Manager to stop descending and return the
 *    view that it called as the mouse event destination.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeControlRef)
 *          The control containing the mouse.
 *
 *    --> kEventParamEventRef (in, typeEventRef)
 *          The mouse-down event to intercept.
 *
 *  Result:
 *    An operating system result code. Return noErr to indicate that
 *    this view intercepted the click, or eventNotHandledErr to allow
 *    subviews of this view to take the click.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const kEventControlInterceptSubviewClick = 16;

{
 *  kEventClassControl / kEventControlGetClickActivation
 *
 *  Summary:
 *    Sent when a click occurs in a inactive window. Allows the control
 *    to determine whether the window should be activated and whether
 *    the click should be handled.
 *
 *  Discussion:
 *    This is very much like the window class version of this event.
 *    The difference is that the mouse location is view- or
 *    port-relative. This event is actually a copy of the mouse down
 *    event, and so it has all the parameters that such an event would
 *    have (modifiers, button number, etc.).
 *
 *    When handling a click, this event is sent first, and is sent only
 *    to the control that was clicked; it is not propagated to the
 *    embedder of the clicked control. If the event is not handled,
 *    then a kEventWindowGetClickActivation event is sent to the window
 *    that was clicked.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeControlRef)
 *          The control that was clicked.
 *
 *    <-- kEventParamClickActivation (out, typeClickActivationResult)
 *          On exit, indicates how the click should be handled. Should
 *          be set a ClickActivationResult constant from Controls.h.
 *
 *    --> kEventParamMouseLocation (in, typeHIPoint)
 *          The mouse location, in view-local coordinates if the
 *          controlÕs owning window is composited, or port-local
 *          coordinates if not.
 *
 *    --> kEventParamWindowRef (in, typeWindowRef)
 *          The window under the mouse.
 *
 *    --> kEventParamWindowMouseLocation (in, typeHIPoint)
 *          The window-relative position of the mouse in the window
 *          given in the kEventParamWindowRef parameter. 0,0 is at the
 *          top left of the structure of the window.
 *
 *    --> kEventParamWindowPartCode (in, typeWindowPartCode)
 *          The part code the mouse location hit in the window. This
 *          parameter only exists if the windowRef parameter exists.
 *          This saves you the trouble of calling FindWindow, which is
 *          expensive on Mac OS X as it needs to call the Window
 *          Server. Available in Mac OS X 10.3 and later.
 *
 *    --> kEventParamKeyModifiers (in, typeUInt32)
 *          The keyboard modifiers that were pressed when the event was
 *          generated.
 *
 *    --> kEventParamMouseButton (in, typeMouseButton)
 *          Which mouse button was pressed.
 *
 *    --> kEventParamClickCount (in, typeUInt32)
 *          Whether this is a single click, double click, etc.
 *
 *    --> kEventParamMouseChord (in, typeUInt32)
 *          Which other mouse buttons were pressed when the event was
 *          generated. Available on Mac OS X only.
 *
 *    --> kEventParamTabletEventType (in, typeUInt32)
 *          The type of tablet event which generated this mouse event;
 *          contains either kEventTabletPoint or kEventTabletProximity.
 *          Only present if the event was generated from a tablet.
 *
 *    --> kEventParamTabletPointRec (in, typeTabletPointRec)
 *          Further information about the tablet event which generated
 *          this mouse event. Present if the the
 *          kEventParamTabletEventType parameter contains
 *          kEventTabletPoint.
 *
 *    --> kEventParamTabletProximityRec (in, typeTabletProximityRec)
 *          Further information about the tablet event which generated
 *          this mouse event. Present if the the
 *          kEventParamTabletEventType parameter contains
 *          kEventTabletProximity.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const kEventControlGetClickActivation = 17;

{
 *  kEventClassControl / kEventControlDragEnter
 *
 *  Summary:
 *    A drag has entered your control.
 *
 *  Discussion:
 *    If you at all wish to handle the drag, you must return true in
 *    the kEventParamControlWouldAcceptDrop parameter from your event
 *    handler in response to this event. If you return
 *    eventNotHandledErr, do not supply a
 *    kEventParamControlWouldAcceptDrop parameter, or set its value to
 *    false, you will not receive 'within' or 'leave' messages, nor
 *    will you be eligible to receive the drop. This is done to try to
 *    be as efficient as possible when sending events during the drag
 *    operation.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeControlRef)
 *          The control that is the drag target.
 *
 *    --> kEventParamDragRef (in, typeDragRef)
 *          The DragRef for the drag.
 *
 *    <-- kEventParamControlWouldAcceptDrop (out, typeBoolean)
 *          The control would accept the drop. Return true in this
 *          parameter if your view wants to track and possibly receive
 *          this drag.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const kEventControlDragEnter        = 18;

{
 *  kEventClassControl / kEventControlDragWithin
 *
 *  Summary:
 *    A drag has moved with your airspace (but not on any subcontrol).
 *
 *  Discussion:
 *    Your control will typically respond to this event by drawing its
 *    drag highlight. If the user moves into a subcontrol, it becomes
 *    the target of the drag and your control will not receive 'within'
 *    messages any longer.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeControlRef)
 *          The control that is the drag target.
 *
 *    --> kEventParamDragRef (in, typeDragRef)
 *          The DragRef for the drag.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const kEventControlDragWithin       = 19;

{
 *  kEventClassControl / kEventControlDragLeave
 *
 *  Summary:
 *    A drag is leaving your view.
 *
 *  Discussion:
 *    Your control will typically respond to this event by removing its
 *    drag highlight.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeControlRef)
 *          The control that is the drag target.
 *
 *    --> kEventParamDragRef (in, typeDragRef)
 *          The DragRef for the drag.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const kEventControlDragLeave        = 20;

{
 *  kEventClassControl / kEventControlDragReceive
 *
 *  Summary:
 *    Congratulations, you are the lucky recipient of a drag. Enjoy it.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeControlRef)
 *          The control that is the drag target.
 *
 *    --> kEventParamDragRef (in, typeDragRef)
 *          The DragRef for the drag.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const kEventControlDragReceive      = 21;

{
 *  kEventClassControl / kEventControlSetFocusPart
 *
 *  Summary:
 *    Sent when your control is gaining, losing, or changing the focus.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeControlRef)
 *          The control that is gaining, losing, or changing focus.
 *
 *    --> kEventParamControlFocusEverything (in, typeBoolean)
 *          Indicates whether to allowing focusing on a part that
 *          doesnÕt accept general keyboard input, such as a push
 *          button, or if only traditionally focusable parts such as
 *          edit fields and list boxes should be allowed to gain focus.
 *          This parameter is optional and may not be present in all
 *          instances of this event. Restrict focus to traditionally
 *          focusable parts if this parameter is not present.
 *
 *    <-> kEventParamControlPart (in/out, typeControlPartCode)
 *          On entry, a part code that may be either an actual control
 *          part or a control focus meta-part. This parameter may be
 *          one of kControlFocusNoPart (if the control is losing
 *          focus), kControlFocusNextPart (if the next part in the
 *          control should be focused), kControlFocusPrevPart (if the
 *          previous part in the control should be focused), or an
 *          actual control part (if that specific part should be
 *          focused). On exit, your event handler should store the
 *          actual part code that was focused into this parameter. Your
 *          control must always allow the focus to be removed (when
 *          this parameter is kControlFocusNoPart on entry).
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const kEventControlSetFocusPart     = 7;

{
 *  kEventClassControl / kEventControlGetFocusPart
 *
 *  Summary:
 *    Sent when your the Control Manager wants to know what part of
 *    your control is currently focused. Set the kEventParamControlPart
 *    param to your currently focused part.
 *
 *  Discussion:
 *    The Control Manager provides default behavior for this event. If
 *    the event is not handled by a control, the default handler
 *    returns the part of the control that was most recently focused.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeControlRef)
 *          The control for which to get the current focus.
 *
 *    <-- kEventParamControlPart (out, typeControlPartCode)
 *          On exit, contains the current focus for this control.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const kEventControlGetFocusPart     = 8;

{
 *  kEventClassControl / kEventControlActivate
 *
 *  Summary:
 *    Sent when your control becomes active as a result of a call to
 *    ActivateControl.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeControlRef)
 *          The control that was activated.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const kEventControlActivate         = 9;

{
 *  kEventClassControl / kEventControlDeactivate
 *
 *  Summary:
 *    Sent when your control becomes inactive as a result of a call to
 *    DeactivateControl.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeControlRef)
 *          The control that was deactivated.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const kEventControlDeactivate       = 10;

{
 *  kEventClassControl / kEventControlSetCursor
 *
 *  Summary:
 *    Sent when your control is asked to change the cursor as a result
 *    of a call to HandleControlSetCursor.
 *
 *  Discussion:
 *    Note that the standard window event handler does not call
 *    HandleControlSetCursor, and therefore, your control will not
 *    ordinarily receive this event. Your host application must call
 *    HandleControlSetCursor itself in order for your control to
 *    receive this event. On Mac OS X 10.2 and later, we recommend
 *    using mouse tracking regions in your control to be notified when
 *    to change the cursor, rather than using this event.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeControlRef)
 *          The control that should set the cursor.
 *
 *    --> kEventParamMouseLocation (in, typeQDPoint)
 *          The mouse location, in view-local coordinates if the
 *          controlÕs owning window is composited, or port-local
 *          coordinates if not.
 *
 *    --> kEventParamKeyModifiers (in, typeUInt32)
 *          The current keyboard modifiers.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const kEventControlSetCursor        = 11;

{
 *  kEventClassControl / kEventControlContextualMenuClick
 *
 *  Summary:
 *    Sent when your control is asked to display a contextual menu as a
 *    result of a call to HandleControlContextualMenuClick.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeControlRef)
 *          The control that was clicked.
 *
 *    --> kEventParamMouseLocation (in, typeQDPoint)
 *          The mouse location, in view-local coordinates if the
 *          controlÕs owning window is composited, or port-local
 *          coordinates if not.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const kEventControlContextualMenuClick = 12;

{
 *  kEventClassControl / kEventControlTrack
 *
 *  Summary:
 *    Sent to allow a control definition to track the mouse in response
 *    to a call to HIViewClick, HandleControlClick, etc.
 *
 *  Discussion:
 *    In fact, this event is actually sent from within HIViewClick and
 *    HandleControlClick. The default handling of this event is the
 *    Control ManagerÕs normal tracking logic; this is good enough for
 *    simple controls (such as push buttons) and controls with simple
 *    indicators (such as scroll bars and sliders). You should only
 *    need to handle or override this event if you are trying to do
 *    more complex tracking, such as displaying a menu in the middle of
 *    tracking.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeControlRef)
 *          The control to track.
 *
 *    --> kEventParamMouseLocation (in, typeQDPoint)
 *          The mouse location, in view-local coordinates if the
 *          controlÕs owning window is composited, or port-local
 *          coordinates if not.
 *
 *    <-> kEventParamKeyModifiers (in/out, typeUInt32)
 *          The current keyboard modifiers. On exit, the event handler
 *          may update this parameter with the modifiers that were
 *          pressed when tracking ended; these modifiers will be
 *          included in the kEventCommandProcess event that is sent by
 *          the Control Manager.
 *
 *    --> kEventParamControlAction (in, typeControlActionUPP)
 *          The control action proc that should be called by the
 *          control during tracking.
 *
 *    <-- kEventParamControlPart (out, typeControlPartCode)
 *          On exit, contains the part code of the control part that
 *          was selected when tracking ended, or kControlNoPart if no
 *          part was selected. If the part code is non-zero, the
 *          Control Manager will automatically send kEventControlHit
 *          and kEventCommandProcess events.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const kEventControlTrack            = 51;

{
 *  kEventClassControl / kEventControlGetScrollToHereStartPoint
 *
 *  Summary:
 *    Sent so your control can support Scroll To Here behavior during
 *    tracking.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeControlRef)
 *          The control for which to retrieve the Scroll To Here point.
 *
 *    <-> kEventParamMouseLocation (in/out, typeQDPoint)
 *          On entry, a point in view-local coordinates if the
 *          controlÕs owning window is composited, or port-local
 *          coordinates if not, which provides the location at which
 *          the user clicked to request Scroll To Here behavior. On
 *          exit, this parameter should contain the mouse location in
 *          view-local or port-local coordinates where a click would
 *          have needed to be to cause your indicator to be dragged to
 *          the incoming mouse location.
 *
 *    --> kEventParamKeyModifiers (in, typeUInt32)
 *          The current keyboard modifiers.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const kEventControlGetScrollToHereStartPoint = 52;

{
 *  kEventClassControl / kEventControlGetIndicatorDragConstraint
 *
 *  Summary:
 *    Sent so your control can constrain the movement of its indicator
 *    during tracking.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeControlRef)
 *          The control that is being tracked.
 *
 *    --> kEventParamMouseLocation (in, typeQDPoint)
 *          The mouse location, in view-local coordinates if the
 *          controlÕs owning window is composited, or port-local
 *          coordinates if not.
 *
 *    --> kEventParamKeyModifiers (in, typeUInt32)
 *          The current keyboard modifiers.
 *
 *    <-- kEventParamControlIndicatorDragConstraint (out, typeIndicatorDragConstraint)
 *          On exit, contains an IndicatorDragConstraint structure.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const kEventControlGetIndicatorDragConstraint = 53;

{
 *  kEventClassControl / kEventControlIndicatorMoved
 *
 *  Summary:
 *    Sent during live-tracking of the indicator so your control can
 *    update its value based on the new indicator position. During
 *    non-live tracking, this event lets you redraw the indicator ghost
 *    at the appropriate place.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeControlRef)
 *          The control that is being tracked.
 *
 *    --> kEventParamDirectObject (in, typeControlRef)
 *          The new indicator region.
 *
 *    --> kEventParamControlIndicatorRegion (in, typeQDRgnHandle)
 *          Indicates whether the control is using non-live-tracking
 *          (true) or live tracking (false).
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const kEventControlIndicatorMoved   = 54;

{
 *  kEventClassControl / kEventControlGhostingFinished
 *
 *  Summary:
 *    Sent at the end of non-live indicator tracking so your control
 *    can update its value based on the final ghost location.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeControlRef)
 *          The control that was being tracked.
 *
 *    --> kEventParamControlIndicatorOffset (in, typeQDPoint)
 *          The final offset of the indicator.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const kEventControlGhostingFinished = 55;

{
 *  kEventClassControl / kEventControlGetActionProcPart
 *
 *  Summary:
 *    Sent during tracking so your control can alter the part that is
 *    passed to its action proc based on modifier keys, etc.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeControlRef)
 *          The control being tracked.
 *
 *    --> kEventParamKeyModifiers (in, typeUInt32)
 *          The current keyboard modifiers.
 *
 *    <-> kEventParamControlPart (in/out, typeControlPartCode)
 *          On entry, the proposed control part that will be sent to
 *          the action proc. Your handler may modify this parameter
 *          based on its own criteria (which modifier keys are pressed,
 *          for example).
 *
 *    <-- kEventParamControlPartAutoRepeats (out, typeBoolean)
 *          On output, a flag to the standard control tracking loop in
 *          the Control Manager indicating whether to autorepeat when
 *          the user presses and holds on certain parts of your custom
 *          control. The autorepeat timing curve is the same as that
 *          used for the buttons/page areas of scroll bars. This
 *          parameter is observed by the Control Manager in Mac OS X
 *          10.2 and later.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const kEventControlGetActionProcPart = 56;

{
 *  kEventClassControl / kEventControlGetPartRegion
 *
 *  Summary:
 *    Sent by the GetControlRegion API when a client wants to get a
 *    particular region of your control.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeControlRef)
 *          The control whose region to return.
 *
 *    --> kEventParamControlPart (in, typeControlPartCode)
 *          The control part code whose region to return.
 *
 *    --> kEventParamControlRegion (in, typeQDRgnHandle)
 *          A pre-allocated RgnHandle. Your handler should get the
 *          RgnHandle from the event and set the region contents
 *          appropriately.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const kEventControlGetPartRegion    = 101;

{
 *  kEventClassControl / kEventControlGetPartBounds
 *
 *  Summary:
 *    Sent when a client wants to get a particular rectangle of your
 *    control when it may be more efficient than asking for a region.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeControlRef)
 *          The control whose bounds to return.
 *
 *    --> kEventParamControlPart (in, typeControlPartCode)
 *          The control part whose bounds to return.
 *
 *    <-- kEventParamControlPartBounds (out, typeHIRect)
 *          On exit, contains the bounds of the specified part.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const kEventControlGetPartBounds    = 102;

{
 *  kEventClassControl / kEventControlSetData
 *
 *  Summary:
 *    Sent by the SetControlData API when a client wants to change an
 *    arbitrary setting of your control.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeControlRef)
 *          The control for which to set data.
 *
 *    --> kEventParamControlPart (in, typeControlPartCode)
 *          The control part for which to set data.
 *
 *    --> kEventParamControlDataTag (in, typeEnumeration)
 *          The type of data to set.
 *
 *    --> kEventParamControlDataBuffer (in, typePtr)
 *          A pointer to the data.
 *
 *    --> kEventParamControlDataBufferSize (in, typeLongInteger)
 *          The size of the data.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const kEventControlSetData          = 103;

{
 *  kEventClassControl / kEventControlGetData
 *
 *  Summary:
 *    Sent by the GetControlData API when a client wants to get an
 *    arbitrary setting of your control.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeControlRef)
 *          The control from which to get data.
 *
 *    --> kEventParamControlPart (in, typeControlPartCode)
 *          The control part for which to get data.
 *
 *    --> kEventParamControlDataTag (in, typeEnumeration)
 *          The type of data to get.
 *
 *    --> kEventParamControlDataBuffer (in, typePtr)
 *          A buffer in which to write the data.
 *
 *    <-> kEventParamControlDataBufferSize (in/out, typeLongInteger)
 *          On entry, the size of the data buffer. On exit, the amount
 *          of data that was available.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const kEventControlGetData          = 104;

{
 *  kEventClassControl / kEventControlGetSizeConstraints
 *
 *  Summary:
 *    Sent by the HIViewGetSizeConstraints API to allow your custom
 *    control/view to specify its minimum and maximum size.
 *
 *  Discussion:
 *    This is different from the optimal size event above. The optimal
 *    size might be larger than a viewÕs minimum size. A parent view
 *    can use this information to help it lay out subviews. The toolbar
 *    control uses this information to help lay out toolbar items, for
 *    example.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeControlRef)
 *          The control for which to get size constraints.
 *
 *    <-- kEventParamMinimumSize (out, typeHISize)
 *          On exit, contains the controlÕs minimum size.
 *
 *    <-- kEventParamMaximumSize (out, typeHISize)
 *          On exit, contains the controlÕs maximum size.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const kEventControlGetSizeConstraints = 105;

{
 *  kEventClassControl / kEventControlGetFrameMetrics
 *
 *  Summary:
 *    Sent when a control client needs to determine the width of the
 *    controlÕs structure region.
 *
 *  Discussion:
 *    This event is not sent automatically by the Control Manager at
 *    any time, but may be sent by control clients during various
 *    layout operations. For example, the Window Manager will send this
 *    event to a window frame HIView to determine the window structure
 *    widths, and the Menu Manager will send this event to a menu
 *    content view to determine the content structure widths.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeControlRef)
 *          The control for which to get frame metrics.
 *
 *    <-- kEventParamControlFrameMetrics (out, typeControlFrameMetrics)
 *          On exit, contains the controlÕs frame metrics.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const kEventControlGetFrameMetrics  = 106;

{
 *  kEventClassControl / kEventControlValueFieldChanged
 *
 *  Summary:
 *    Sent when your controlÕs value, min, max, or view size has
 *    changed. Useful so other entities can watch for changes to your
 *    controlÕs value.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeControlRef)
 *          The control whose value, min, max, or view size has changed.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const kEventControlValueFieldChanged = 151;

{
 *  kEventClassControl / kEventControlAddedSubControl
 *
 *  Summary:
 *    Sent when a control was embedded within your control.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeControlRef)
 *          The control that gained a new subcontrol.
 *
 *    --> kEventParamControlSubControl (in, typeControlRef)
 *          The subcontrol that was added.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const kEventControlAddedSubControl  = 152;

{
 *  kEventClassControl / kEventControlRemovingSubControl
 *
 *  Summary:
 *    Sent when one of your child controls will be removed from your
 *    control.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeControlRef)
 *          The control that will be losing a subcontrol.
 *
 *    --> kEventParamControlSubControl (in, typeControlRef)
 *          The subcontrol that will be removed.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const kEventControlRemovingSubControl = 153;

{
 *  kEventClassControl / kEventControlBoundsChanged
 *
 *  Summary:
 *    Sent when your controlÕs bounding rectangle has changed.
 *
 *  Discussion:
 *    If you want to generate an efficient invalid region in response
 *    to a size change, you need to handle
 *    kEventControlInvalidateForSizeChange.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeControlRef)
 *          The control whose bounds have change.
 *
 *    --> kEventParamAttributes (in, typeUInt32)
 *          Flags indicating how the bounds changed, including
 *          kControlBoundsChangeSizeChanged and
 *          kControlBoundsChangePositionChanged.
 *
 *    --> kEventParamOriginalBounds (in, typeQDRectangle)
 *          The controlÕs bounds before the change.
 *
 *    --> kEventParamPreviousBounds (in, typeQDRectangle)
 *          The controlÕs bounds before the change.
 *
 *    --> kEventParamCurrentBounds (in, typeQDRectangle)
 *          The controlÕs new bounds.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const kEventControlBoundsChanged    = 154;

{
 *  kEventClassControl / kEventControlInvalidateForSizeChange
 *
 *  Summary:
 *    Sent when a control's size changes so it can invalidate the area
 *    of itself that needs to be redrawn.
 *
 *  Discussion:
 *    Handle this event by calling HIViewSetNeedsDisplayInRegion with a
 *    region that properly reflects the area of your control that needs
 *    to be redrawn after a size change. The default handler for this
 *    event will invalidate the entire control.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeControlRef)
 *          The control whose size has changed.
 *
 *    --> kEventParamOriginalBounds (in, typeQDRectangle)
 *          The controlÕs bounds before the change.
 *
 *    --> kEventParamCurrentBounds (in, typeQDRectangle)
 *          The controlÕs new bounds.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const kEventControlInvalidateForSizeChange = 22;

{
 *  kEventClassControl / kEventControlVisibilityChanged
 *
 *  Summary:
 *    Sent when a control is hidden or shown. This is here to support
 *    custom views/controls which need to update information when the
 *    visibility changes.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeControlRef)
 *          The control whose visibility has changed.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const kEventControlVisibilityChanged = 157;

{
 *  kEventClassControl / kEventControlOwningWindowChanged
 *
 *  Summary:
 *    Sent when your controlÕs owning window has changed. Useful to
 *    udpate any dependencies that your control has on its owning
 *    window.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeControlRef)
 *          The control whose owning window has changed.
 *
 *    --> kEventParamAttributes (in, typeUInt32)
 *          Currently unused.
 *
 *    --> kEventParamControlOriginalOwningWindow (in, typeWindowRef)
 *          The controlÕs original owning window.
 *
 *    --> kEventParamControlCurrentOwningWindow (in, typeWindowRef)
 *          The controlÕs new owning window.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const kEventControlOwningWindowChanged = 159;

{
 *  kEventClassControl / kEventControlTitleChanged
 *
 *  Summary:
 *    Sent when the title of your control changes.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeControlRef)
 *          The control whose title has changed.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const kEventControlTitleChanged     = 158;

{
 *  kEventClassControl / kEventControlHiliteChanged
 *
 *  Summary:
 *    Sent when the hilite state changes in a control. This is here to
 *    support custom views/controls which need to update information
 *    when the hilite state changes.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeControlRef)
 *          The control whose hilite has changed.
 *
 *    --> kEventParamControlPreviousPart (in, typeControlPartCode)
 *          The previously hilited part.
 *
 *    --> kEventParamControlCurrentPart (in, typeControlPartCode)
 *          The newly hilited part.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const kEventControlHiliteChanged    = 160;

{
 *  kEventClassControl / kEventControlEnabledStateChanged
 *
 *  Summary:
 *    Sent when the enabled state changes in a control. This is here to
 *    support custom views/controls which need to update information
 *    when the enabled state changes.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeControlRef)
 *          The control whose enabled state has changed.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const kEventControlEnabledStateChanged = 161;

{
 *  kEventClassControl / kEventControlLayoutInfoChanged
 *
 *  Summary:
 *    Sent when the layout info changes in a control.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeControlRef)
 *          The control whose enabled state has changed.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const kEventControlLayoutInfoChanged = 162;

{
 *  kEventClassControl / kEventControlArbitraryMessage
 *
 *  Summary:
 *    Sent by the SendControlMessage API when someone is trying to send
 *    an old-style CDEF message to your control.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeControlRef)
 *          The control that is receiving the message.
 *
 *    --> kEventParamControlMessage (in, typeShortInteger)
 *          The message.
 *
 *    --> kEventParamControlParam (in, typeLongInteger)
 *          The inParam parameter from SendControlMessage.
 *
 *    <-- kEventParamControlResult (out, typeLongInteger)
 *          On exit, contains the result that should be returned from
 *          SendControlMessage.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const kEventControlArbitraryMessage = 201;


{
 *  Summary:
 *    Control bounds change event attributes
 *
 *  Discussion:
 *    When the toolbox sends out a kEventControlBoundsChanged event, it
 *    also sends along a parameter containing attributes of the event.
 *    These attributes can be used to determine what aspect of the
 *    control changed (position, size, or both).
 }
const
    {
   * The dimensions of the control (width and height) changed.
   }
  kControlBoundsChangeSizeChanged = (1 shl 2);

  {
   * The top left corner (position) changed.
   }
  kControlBoundsChangePositionChanged = (1 shl 3);



{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{  Tablet Events (and tablet data in mouse events)                                     }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{
    kEventClassTablet quick reference:

    kEventTabletPoint                   = 1,
    kEventTabletProximity               = 2,
}
{
 *  kEventClassTablet / kEventTabletPoint
 *
 *  Summary:
 *    Indicates that the pen has moved on or near a tablet.
 *
 *  Discussion:
 *    Same as deprecated kEventTabletPointer.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamTabletPointRec (in, typeTabletPointRec)
 *          Tablet information for the event.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const kEventTabletPoint             = 1;

{
 *  kEventClassTablet / kEventTabletProximity
 *
 *  Summary:
 *    Indicates that the pen has entered or exited proximity of a
 *    tablet.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamTabletProximityRec (in, typeTabletProximityRec)
 *          Tablet information for the event.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const kEventTabletProximity         = 2;



type
    TabletPointRecPtr = ^TabletPointRec;
    TabletPointRec = record
        absX:                   SInt32;                                 {  absolute x coordinate in tablet space at full tablet resolution  }
        absY:                   SInt32;                                 {  absolute y coordinate in tablet space at full tablet resolution  }
        absZ:                   SInt32;                                 {  absolute z coordinate in tablet space at full tablet resolution  }
        buttons:                UInt16;                                 {  one bit per button - bit 0 is first button - 1 = closed  }
        pressure:               UInt16;                                 {  scaled pressure value; MAXPRESSURE=(2^16)-1, MINPRESSURE=0  }
        tiltX:                  SInt16;                                 {  scaled tilt x value; range is -((2^15)-1) to (2^15)-1 (-32767 to 32767)  }
        tiltY:                  SInt16;                                 {  scaled tilt y value; range is -((2^15)-1) to (2^15)-1 (-32767 to 32767)  }
        rotation:               UInt16;                                 {  Fixed-point representation of device rotation in a 10.6 format  }
        tangentialPressure:     SInt16;                                 {  tangential pressure on the device; range same as tilt  }
        deviceID:               UInt16;                                 {  system-assigned unique device ID - matches to deviceID field in proximity event  }
        vendor1:                SInt16;                                 {  vendor-defined signed 16-bit SInt16  }
        vendor2:                SInt16;                                 {  vendor-defined signed 16-bit SInt16  }
        vendor3:                SInt16;                                 {  vendor-defined signed 16-bit SInt16  }
    end;

    TabletPointerRec                    = TabletPointRec;
    TabletPointerRecPtr                 = ^TabletPointerRec;
    TabletProximityRecPtr = ^TabletProximityRec;
    TabletProximityRec = record
        vendorID:               UInt16;                                 {  vendor-defined ID - typically will be USB vendor ID  }
        tabletID:               UInt16;                                 {  vendor-defined tablet ID - typically will be USB product ID for the tablet  }
        pointerID:              UInt16;                                 {  vendor-defined ID of the specific pointing device  }
        deviceID:               UInt16;                                 {  system-assigned unique device ID - matches to deviceID field in tablet event  }
        systemTabletID:         UInt16;                                 {  system-assigned unique tablet ID  }
        vendorPointerType:      UInt16;                                 {  vendor-defined pointer type  }
        pointerSerialNumber:    UInt32;                                 {  vendor-defined serial number of the specific pointing device  }
        uniqueID:               UInt64;                                 {  vendor-defined unique ID for this pointer  }
        capabilityMask:         UInt32;                                 {  mask representing the capabilities of the device  }
        pointerType:            SInt8;                                  {  type of pointing device - enum to be defined  }
        enterProximity:         SInt8;                                  {  non-zero = entering; zero = leaving  }
    end;

    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {    Volume Events                                                                          }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }

    {
     *  Summary:
     *    Volume events (kEventClassVolume)
        }

const
    kEventVolumeMounted         = 1;                            {  new volume mounted }
    kEventVolumeUnmounted       = 2;                            {  volume has been ejected or unmounted }

    {
        Parameters for volume events:

        kEventVolumeMounted
            -->     kEventParamDirectObject     typeFSVolumeRefNum

        kEventVolumeUnmounted
            -->     kEventParamDirectObject     typeFSVolumeRefNum
        }

    {  types for volume events }

    typeFSVolumeRefNum          = $766F6C6E (* 'voln' *);                       {  FSVolumeRefNum }

    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {    Appearance Events                                                                      }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {    Appearance Events  }

    {
     *  Discussion:
     *    Appearance events (kEventClassAppearance)
        }
    kEventAppearanceScrollBarVariantChanged = 1;

    {
        Parameters for appearance events:

        kEventAppearanceScrollBarVariantChanged
            -->     kEventParamNewScrollBarVariant      typeShortInteger
        }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {     Services Events                                                                       }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }

    {
     *  Summary:
     *    Services events (kEventClassService)
     *
     *  Discussion:
     *    Services are a feature by which applications can communicate with
     *    one another to request and provide services. This communication
     *    happens through the Scrap Manager. When an event is sent that
     *    requires communication for processing or servicing a request, you
     *    will need to use the scrap that is given in the
     *    kEventParamScrapRef parameter of the event in order to
     *    communicate. When your app requests a service, it is usually
     *    acting on data that is currently selected or in focus. Therefore
     *    all of the Services events are sent to the UserFocus event
     *    target.
     *    Service events are available on Mac OS X 10.1 and later.
        }
    kEventServiceCopy           = 1;
    kEventServicePaste          = 2;
    kEventServiceGetTypes       = 3;
    kEventServicePerform        = 4;

    {
        Parameters for service events:

        kEventServiceCopy
            -->     kEventParamScrapRef                 typeScrapRef

        kEventServicePaste
            -->     kEventParamScrapRef                 typeScrapRef

        kEventServiceGetTypes
            -->     kEventParamServiceCopyTypes         typeCFMutableArrayRef of CFStringRefs
            -->     kEventParamServicePasteTypes        typeCFMutableArrayRef of CFStringRefs

        kEventServicePerform
            -->     kEventParamScrapRef                 typeScrapRef
            -->     kEventParamServiceMessageName       typeCFStringRef
            -->     kEventParamServiceUserData          typeCFStringRef
        }
    {
     *  CreateTypeStringWithOSType()
     *
     *  Discussion:
     *    This routine is used to convert an OSType to a CFStringRef that
     *    Services will understand.
     *
     *  Parameters:
     *
     *    inType:
     *      The OSType that needs to be converted to a CFString.
     *
     *  Result:
     *    A CFStringRef that contains the string that corresponds to the
     *    given OSType. This follows CoreFoundation semantics in that it
     *    will return NULL for failure, and because it is a "Create"
     *    function you will need to CFRelease() this string when it is no
     *    longer needed.
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.1 and later
     *    Mac OS X:         in version 10.1 and later
        }
function CreateTypeStringWithOSType(inType: OSType): CFStringRef; external name '_CreateTypeStringWithOSType';


{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{  Accessibility Events                                                                }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{
    kEventClassAccessibility quick reference:

    kEventAccessibleGetChildAtPoint                     =   1,
    kEventAccessibleGetFocusedChild                     =   2,

    kEventAccessibleGetAllAttributeNames                =   21,
    kEventAccessibleGetAllParameterizedAttributeNames   =   25,
    kEventAccessibleGetNamedAttribute                   =   22,
    kEventAccessibleSetNamedAttribute                   =   23,
    kEventAccessibleIsNamedAttributeSettable            =   24,

    kEventAccessibleGetAllActionNames                   =   41,
    kEventAccessiblePerformNamedAction                  =   42,
    kEventAccessibleGetNamedActionDescription           =   44
}
{
 *  kEventClassAccessibility / kEventAccessibleGetChildAtPoint
 *
 *  Summary:
 *    Finds the child of an accessible object at a given point.
 *
 *  Discussion:
 *    The kEventParamMouseLocation parameter will contain a global
 *    point. Your handler for this event should find the child of
 *    yourself which is underneath that point and return it in the
 *    kEventParamAccessibleChild parameter.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamAccessibleObject (in, typeCFTypeRef)
 *          The accessible object, in the form of an AXUIElementRef.
 *
 *    --> kEventParamMouseLocation (in, typeHIPoint)
 *          The location in global coordinates.
 *
 *    <-- kEventParamAccessibleChild (out, typeCFTypeRef)
 *          On exit, contains the child of the accessible object at the
 *          specified point, in the form of an AXUIElementRef. If there
 *          is no child at the given point, you should still return
 *          noErr, but leave the parameter empty (do not call
 *          SetEventParameter). Only return immediate children; do not
 *          return grandchildren of yourself.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const kEventAccessibleGetChildAtPoint = 1;

{
 *  kEventClassAccessibility / kEventAccessibleGetFocusedChild
 *
 *  Summary:
 *    Finds the focused child of an accessible object.
 *
 *  Discussion:
 *    Your handler for this event should find the child of itself which
 *    is part of the focus chain and return it in the
 *    kEventParamAccessibleChild parameter.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamAccessibleObject (in, typeCFTypeRef)
 *          The accessible object, in the form of an AXUIElementRef.
 *
 *    <-- kEventParamAccessibleChild (out, typeCFTypeRef)
 *          On exit, contains the focused child of the accessible
 *          object, in the form of an AXUIElementRef. If there is no
 *          child in the focus chain, you should still return noErr,
 *          but leave the parameter empty (do not call
 *          SetEventParameter). Only return immediate children; do not
 *          return grandchildren of yourself.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const kEventAccessibleGetFocusedChild = 2;

{
 *  kEventClassAccessibility / kEventAccessibleGetAllAttributeNames
 *
 *  Summary:
 *    Returns the attributes supported by an accessible object. You
 *    must only return the names of your regular (non-parameterized)
 *    attributes via this event. If you support parameterized
 *    attributes, you must return them via the new
 *    kEventAccessibleGetAllParameterizedAttributeNames event.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamAccessibleObject (in, typeCFTypeRef)
 *          The accessible object, in the form of an AXUIElementRef.
 *
 *    <-> kEventParamAccessibleAttributeNames (in/out, typeCFMutableArrayRef)
 *          Add each of the regular (non-parameterized) attribute names
 *          supported by the accessible object to this array, as
 *          CFStringRefs.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const kEventAccessibleGetAllAttributeNames = 21;

{
 *  kEventClassAccessibility / kEventAccessibleGetAllParameterizedAttributeNames
 *
 *  Summary:
 *    Returns the parameterized attributes supported by an accessible
 *    object. You must not return the names of your regular
 *    (non-parameterized) attributes via this event. If you support
 *    regular attributes, you must return them via the original
 *    kEventAccessibleGetAllAttributeNames event. Parameterized
 *    attributes are introduced in Mac OS X 10.3.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamAccessibleObject (in, typeCFTypeRef)
 *          The accessible object, in the form of an AXUIElementRef.
 *
 *    <-> kEventParamAccessibleAttributeNames (in/out, typeCFMutableArrayRef)
 *          Add each of the parameterized attribute names supported by
 *          the accessible object to this array, as CFStringRefs.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const kEventAccessibleGetAllParameterizedAttributeNames = 25;

{
 *  kEventClassAccessibility / kEventAccessibleGetNamedAttribute
 *
 *  Summary:
 *    Returns the value of an attribute of an accessible object.
 *
 *  Discussion:
 *    The kEventParamAccessibleAttributeName parameter will contain an
 *    attribute name in the form of a CFStringRef. If you support the
 *    named attribute, return the attributeÕs value in the
 *    kEventParamAccessibleAttributeValue parameter.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamAccessibleObject (in, typeCFTypeRef)
 *          The accessible object, in the form of an AXUIElementRef.
 *
 *    --> kEventParamAccessibleAttributeName (in, typeCFStringRef)
 *          The name of the requested attribute.
 *
 *    --> kEventParamAccessibleAttributeParameter (in, typeCFTypeRef)
 *          This parameter is optional and will only exist if your
 *          accessible object is being asked for the value of a
 *          parameterized attribute. When present, this event parameter
 *          will contain a CFTypeRef describing the parameters of the
 *          request. Parameterized attributes are introduced in Mac OS
 *          X 10.3.
 *
 *    <-- kEventParamAccessibleAttributeValue (out, typeCFTypeRef)
 *          On exit, contains the attribute's value. The type of this
 *          parameter varies according to the attribute; it might
 *          typically be typeCFStringRef (for a textual attribute),
 *          typeBoolean (for a boolean attribute), or typeSInt32 (for
 *          an integer-valued attribute).
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const kEventAccessibleGetNamedAttribute = 22;

{
 *  kEventClassAccessibility / kEventAccessibleSetNamedAttribute
 *
 *  Summary:
 *    Sets the value of an attribute of an accessible object.
 *
 *  Discussion:
 *    The kEventParamAccessibleAttributeName parameter will contain an
 *    attribute name in the form of a CFStringRef. The
 *    kEventParamAccessibleAttributeValue parameter will contain data
 *    in an arbitrary format. If you support the named attribute, set
 *    the named attributeÕs value to the data provided in the event.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamAccessibleObject (in, typeCFTypeRef)
 *          The accessible object, in the form of an AXUIElementRef.
 *
 *    --> kEventParamAccessibleAttributeName (in, typeCFStringRef)
 *          The name of the requested attribute.
 *
 *    --> kEventParamAccessibleAttributeValue (in, typeCFTypeRef)
 *          The new value of the attribute. The type of this parameter
 *          varies according to the attribute; it might typically be
 *          typeCFStringRef (for a textual attribute), typeBoolean (for
 *          a boolean attribute), or typeSInt32 (for an integer-valued
 *          attribute).
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const kEventAccessibleSetNamedAttribute = 23;

{
 *  kEventClassAccessibility / kEventAccessibleIsNamedAttributeSettable
 *
 *  Summary:
 *    Determines whether an attribute of an accessible object can be
 *    modified.
 *
 *  Discussion:
 *    The kEventParamAccessibleAttributeName parameter will contain an
 *    attribute name in the form of a CFStringRef. If you support the
 *    named attribute, set the kEventParamAccessibleAttributeSettable
 *    parameter to a Boolean indicating whether the named attribute can
 *    have its value changed via the kEventAccessibleSetNamedAttribute
 *    event.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamAccessibleObject (in, typeCFTypeRef)
 *          The accessible object, in the form of an AXUIElementRef.
 *
 *    --> kEventParamAccessibleAttributeName (in, typeCFStringRef)
 *          The name of the requested attribute.
 *
 *    <-- kEventParamAccessibleAttributeSettable (out, typeBoolean)
 *          On exit, indicates whether the attribute may be modified.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const kEventAccessibleIsNamedAttributeSettable = 24;

{
 *  kEventClassAccessibility / kEventAccessibleGetAllActionNames
 *
 *  Summary:
 *    Returns the actions supported by an accessible object.
 *
 *  Discussion:
 *    The kEventParamAccessibleActionNames parameter will contain a
 *    CFMutableArrayRef. Add each of the action names you support to
 *    this array in the form of a CFStringRef.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamAccessibleObject (in, typeCFTypeRef)
 *          The accessible object, in the form of an AXUIElementRef.
 *
 *    <-> kEventParamAccessibleActionNames (in/out, typeCFMutableArrayRef)
 *          Add each of the actions supported by the accessible object
 *          to this array, as CFStringRefs.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const kEventAccessibleGetAllActionNames = 41;

{
 *  kEventClassAccessibility / kEventAccessiblePerformNamedAction
 *
 *  Summary:
 *    Requests that a specific action be performed by an accessible
 *    object.
 *
 *  Discussion:
 *    The kEventParamAccessibleActionName parameter will contain an
 *    attribute name in the form of a CFStringRef. If you support the
 *    named action, perform the action. There are times, however, when
 *    performing an action causes an accessible object to call a
 *    routine which may not return immediately, such as StandardAlert
 *    or PopUpMenuSelect. You should only call such routines when you
 *    receive an action request that was queued; if you call such a
 *    routine when processing an event that was directly dispatched,
 *    you will probably cause the assistive app to receive a timeout
 *    error. On Mac OS X 10.3 and later, the
 *    kEventParamAccessibilityEventQueued parameter will indicate
 *    whether the event was queued. If so, process the request
 *    normally. If not, you can request that the event be posted to the
 *    queue and sent to you later by returning
 *    eventDeferAccessibilityEventErr from your handler. On Mac OS X
 *    10.2, the parameter will not exist, the event will always be
 *    directly dispatched, and there is no way to request that it be
 *    posted to the queue; in this case, you should perform the action
 *    even if it will cause the assistive app to receive a timeout
 *    error.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamAccessibleObject (in, typeCFTypeRef)
 *          The accessible object, in the form of an AXUIElementRef.
 *
 *    --> kEventParamAccessibleActionName (in, typeCFStringRef)
 *          The name of the requested action.
 *
 *    --> kEventParamAccessibilityEventQueued (in, typeBoolean)
 *          An indication of whether this event was delivered to you
 *          via the main event queue. This parameter only exists on Mac
 *          OS X 10.3 and later. See the discussion for more details.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const kEventAccessiblePerformNamedAction = 42;

{
 *  kEventClassAccessibility / kEventAccessibleGetNamedActionDescription
 *
 *  Summary:
 *    Returns a human-language description of an action supported by an
 *    accessible object.
 *
 *  Discussion:
 *    The kEventParamAccessibleActionName parameter will contain an
 *    attribute name in the form of a CFStringRef. The
 *    kEventParamAccessibleActionDescription parameter will contain a
 *    CFMutableStringRef. If you support the named action, alter the
 *    mutable string to contain a textual description of the actionÕs
 *    significance.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamAccessibleObject (in, typeCFTypeRef)
 *          The accessible object, in the form of an AXUIElementRef.
 *
 *    --> kEventParamAccessibleActionName (in, typeCFStringRef)
 *          The name of the requested action.
 *
 *    <-> kEventParamAccessibleActionDescription (in/out, typeCFMutableStringRef)
 *          If you support the action, set the contents of this string
 *          to contain a description of the action.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const kEventAccessibleGetNamedActionDescription = 44;

{
 *  AXUIElementCreateWithHIObjectAndIdentifier()
 *
 *  Discussion:
 *    This routine creates an AXUIElementRef to represent an accessible
 *    object for a Carbon application. A Carbon accessible object is
 *    comprised of an HIObjectRef and a 64-bit identifier. The
 *    resulting AXUIElementRef is a CFTypeRef, and must be managed as
 *    such.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inHIObject:
 *      The HIObjectRef of the accessible object.
 *
 *    inIdentifier:
 *      The 64-bit identifier of the accessible object.
 *
 *  Result:
 *    An AXUIElementRef that represents the Carbon accessible object
 *    identified by the given HIObjectRef and 64-bit identifier. This
 *    follows CoreFoundation semantics in that it will return NULL for
 *    failure, and because it is a "Create" function you will need to
 *    CFRelease() this AXUIElementRef when it is no longer needed.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
function AXUIElementCreateWithHIObjectAndIdentifier( inHIObject: HIObjectRef; inIdentifier: UInt64 ): AXUIElementRef; external name '_AXUIElementCreateWithHIObjectAndIdentifier';


{
 *  AXUIElementGetHIObject()
 *
 *  Discussion:
 *    If the incoming AXUIElementRef is a Carbon accessible object,
 *    this routine will return the HIObjectRef of the accessible object.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inUIElement:
 *      The AXUIElementRef of whom you'd like to get the HIObjectRef.
 *
 *  Result:
 *    The HIObjectRef of the AXUIElementRef. If the incoming
 *    AXUIElementRef is not a Carbon accessible object, this routine
 *    will return NULL.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
function AXUIElementGetHIObject( inUIElement: AXUIElementRef ): HIObjectRef; external name '_AXUIElementGetHIObject';


{
 *  AXUIElementGetIdentifier()
 *
 *  Discussion:
 *    If the incoming AXUIElementRef is a Carbon accessible object,
 *    this routine will pass back the 64-bit identifier of the
 *    accessible object.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inUIElement:
 *      The AXUIElementRef of whom you'd like to get the 64-bit
 *      identifier.
 *
 *    outIdentifier:
 *      The 64-bit identifier of the AXUIElementRef. If the incoming
 *      AXUIElementRef is not a Carbon accessible object, this routine
 *      will pass back zero. Note that zero is often a legal value for
 *      Carbon accessible object, so do not assume that the accessible
 *      object is not a Carbon accessible object just because you get a
 *      result of zero.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
procedure AXUIElementGetIdentifier( inUIElement: AXUIElementRef; var outIdentifier: UInt64 ); external name '_AXUIElementGetIdentifier';


{
 *  AXNotificationHIObjectNotify()
 *
 *  Discussion:
 *    Posts a notification for the given pseudo-AXUIElementRef. Though
 *    an actual AXUIElementRef is not actually passed in to this
 *    function, its component parts are. This saves the implementation
 *    the hassle of dismantling the AXUIElementRef into its component
 *    parts.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inNotification:
 *      The notification name string.
 *
 *    inHIObject:
 *      The HIObjectRef component of the AXUIElementRef to whom the
 *      notification applies.
 *
 *    inIdentifier:
 *      The 64-bit identifier component of the AXUIElementRef to whom
 *      the notification applies.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
procedure AXNotificationHIObjectNotify( inNotification: CFStringRef; inHIObject: HIObjectRef; inIdentifier: UInt64 ); external name '_AXNotificationHIObjectNotify';


{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{  System Events                                                                       }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{
    kEventClassSystem quick reference:

    kEventSystemTimeDateChanged         = 2,
    kEventSystemUserSessionActivated    = 10,
    kEventSystemUserSessionDeactivated  = 11

    %% Make sure to avoid overlap with the System Event IDs in CarbonEventsPriv.i!
}
{
 *  kEventClassSystem / kEventSystemTimeDateChanged
 *
 *  Summary:
 *    The system time and/or date has changed via the preferences panel.
 *
 *  Discussion:
 *    This event is sent to all handlers registered for it.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const kEventSystemTimeDateChanged   = 2;

{
 *  kEventClassSystem / kEventSystemUserSessionActivated
 *
 *  Summary:
 *    The current user login session has been activated.
 *
 *  Discussion:
 *    This event is sent to all handlers registered for it. It is sent
 *    when the Fast User Switching feature of Mac OS X 10.3 is used to
 *    activate the login session in which the current application is
 *    running.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const kEventSystemUserSessionActivated = 10;

{
 *  kEventClassSystem / kEventSystemUserSessionDeactivated
 *
 *  Summary:
 *    The current user login session has been deactivated.
 *
 *  Discussion:
 *    This event is sent to all handlers registered for it. It is sent
 *    when the Fast User Switching feature of Mac OS X 10.3 is used to
 *    switch to another user's login session.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const kEventSystemUserSessionDeactivated = 11;



{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{ Parameter names and types                                                            }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}

const
    kEventParamDirectObject     = $2D2D2D2D (* '----' *);                       {  type varies depending on event }


    {
        }
    kEventParamPostTarget       = $70747267 (* 'ptrg' *);                       {  typeEventTargetRef }
    typeEventTargetRef          = $65747267 (* 'etrg' *);                       {  EventTargetRef }

    {  Generic toolbox parameters and types }

    kEventParamWindowRef        = $77696E64 (* 'wind' *);                       {  typeWindowRef }
    kEventParamGrafPort         = $67726166 (* 'graf' *);                       {  typeGrafPtr }
    kEventParamDragRef          = $64726167 (* 'drag' *);                       {  typeDragRef }
    kEventParamMenuRef          = $6D656E75 (* 'menu' *);                       {  typeMenuRef }
    kEventParamEventRef         = $65766E74 (* 'evnt' *);                       {  typeEventRef }
    kEventParamControlRef       = $6374726C (* 'ctrl' *);                       {  typeControlRef }
    kEventParamRgnHandle        = $72676E68 (* 'rgnh' *);                       {  typeQDRgnHandle }
    kEventParamEnabled          = $656E6162 (* 'enab' *);                       {  typeBoolean }
  kEventParamBounds             = $626F756E (* 'boun' *); { typeQDRectangle }
    kEventParamDimensions       = $64696D73 (* 'dims' *);                       {  typeQDPoint }
    kEventParamAvailableBounds  = $61766C62 (* 'avlb' *);                       {  typeQDRectangle }
    kEventParamAEEventID        = $65767469 (* 'evti' *);                       {  typeType }
    kEventParamAEEventClass     = $6576636C (* 'evcl' *);                       {  typeType }
    kEventParamCGContextRef     = $636E7478 (* 'cntx' *);                       {  typeCGContextRef }
    kEventParamDeviceDepth      = $64657664 (* 'devd' *);                       {  typeShortInteger }
    kEventParamDeviceColor      = $64657663 (* 'devc' *);                       {  typeBoolean }
    kEventParamMutableArray       = $6D617272 (* 'marr' *);             { typeCFMutableArrayRef }
    kEventParamResult             = $616E7372 (* 'ansr' *);                     { any type - depends on event like direct object }
    kEventParamMinimumSize        = $6D6E737A (* 'mnsz' *);             { typeHISize }
    kEventParamMaximumSize        = $6D78737A (* 'mxsz' *);             { typeHISize }
  kEventParamReason             = $7768793F (* 'why?' *);               { typeUInt32 }
  kEventParamTransactionID      = $74726E73 (* 'trns' *);               { typeUInt32 }
  kEventParamGDevice            = $67646576 (* 'gdev' *);               { typeGDHandle }
  kEventParamIndex              = $696E6478 (* 'indx' *);               { typeCFIndex }
  kEventParamUserData           = $75737264 (* 'usrd' *);               { typeVoidPtr }
    typeWindowRef               = $77696E64 (* 'wind' *);                       {  WindowRef }
    typeGrafPtr                 = $67726166 (* 'graf' *);                       {  CGrafPtr }
    typeGWorldPtr               = $67776C64 (* 'gwld' *);                       {  GWorldPtr }
    typeDragRef                 = $64726167 (* 'drag' *);                       {  DragRef }
    typeMenuRef                 = $6D656E75 (* 'menu' *);                       {  MenuRef }
    typeControlRef              = $6374726C (* 'ctrl' *);                       {  ControlRef }
    typeCollection              = $636C746E (* 'cltn' *);                       {  Collection }
    typeQDRgnHandle             = $72676E68 (* 'rgnh' *);                       {  RgnHandle }
    typeOSStatus                = $6F737374 (* 'osst' *);                       {  OSStatus }
    typeCFStringRef             = $63667374 (* 'cfst' *);                       {  CFStringRef }
    typeCFMutableStringRef        = $63666D73 (* 'cfms' *);                 { CFMutableStringRef }
    typeCFIndex                 = $63666978 (* 'cfix' *);                       {  CFIndex }
    typeCFTypeRef               = $63667479 (* 'cfty' *);                       {  CFTypeRef }
    typeCGContextRef            = $636E7478 (* 'cntx' *);                       {  CGContextRef }
    typeHIPoint                 = $68697074 (* 'hipt' *);                       {  HIPoint }
    typeHISize                  = $6869737A (* 'hisz' *);                       {  HISize }
    typeHIRect                  = $68697263 (* 'hirc' *);                       {  HIRect }
    typeVoidPtr = $766F6964 (* 'void' *);                                       { void * (used for hiobject fun) }
    typeGDHandle = $67646576 (* 'gdev' *);                                      { GDHandle }

    {  Mouse event parameters and types }

    kEventParamMouseLocation    = $6D6C6F63 (* 'mloc' *);                       {  typeQDPoint }
    kEventParamWindowMouseLocation  = $776D6F75 (* 'wmou' *);                       {  typeHIPoint (Mac OS X 10.1 or later) }
    kEventParamMouseButton      = $6D62746E (* 'mbtn' *);                       {  typeMouseButton }
    kEventParamClickCount       = $63636E74 (* 'ccnt' *);                       {  typeUInt32 }
    kEventParamMouseWheelAxis   = $6D776178 (* 'mwax' *);                       {  typeMouseWheelAxis }
    kEventParamMouseWheelDelta  = $6D77646C (* 'mwdl' *);                       {  typeSInt32 }
    kEventParamMouseDelta       = $6D647461 (* 'mdta' *);                       {  typeQDPoint }
    kEventParamMouseChord       = $63686F72 (* 'chor' *);                       {  typeUInt32 }
    kEventParamTabletEventType  = $74626C74 (* 'tblt' *);                       {  typeUInt32 }
    kEventParamMouseTrackingRef = $6D747266 (* 'mtrf' *);                       {  typeMouseTrackingRef }
    typeMouseButton             = $6D62746E (* 'mbtn' *);                       {  EventMouseButton }
    typeMouseWheelAxis          = $6D776178 (* 'mwax' *);                       {  EventMouseWheelAxis }
    typeMouseTrackingRef            = $6D747266 (* 'mtrf' *);                       {  MouseTrackingRef }

    {  Keyboard event parameter and types }

    kEventParamKeyCode          = $6B636F64 (* 'kcod' *);                       {  typeUInt32 }
    kEventParamKeyMacCharCodes  = $6B636872 (* 'kchr' *);                       {  typeChar }
    kEventParamKeyModifiers     = $6B6D6F64 (* 'kmod' *);                       {  typeUInt32 }
    kEventParamKeyUnicodes      = $6B756E69 (* 'kuni' *);                       {  typeUnicodeText }
    kEventParamKeyboardType     = $6B626474 (* 'kbdt' *);                       {  typeUInt32 }
    typeEventHotKeyID           = $686B6964 (* 'hkid' *);                       {  EventHotKeyID }

    {  General TSM event parameters }
    kEventParamTSMSendRefCon            = $74737263 (* 'tsrc' *);                       {  typeLongInteger }
    kEventParamTSMSendComponentInstance         = $74736369 (* 'tsci' *);                       {  typeComponentInstance }

    {  TextInput event parameters }

    kEventParamTextInputSendRefCon = $74737263 (* 'tsrc' *);                    {     typeLongInteger }
    kEventParamTextInputSendComponentInstance = $74736369 (* 'tsci' *);         {     typeComponentInstance }
    kEventParamTextInputSendSLRec = $7473736C (* 'tssl' *);                     {     typeIntlWritingCode }
    kEventParamTextInputReplySLRec = $7472736C (* 'trsl' *);                    {     typeIntlWritingCode }
    kEventParamTextInputSendText = $74737478 (* 'tstx' *);                      {     typeUnicodeText (if TSMDocument is Unicode), otherwise typeChar }
    kEventParamTextInputReplyText = $74727478 (* 'trtx' *);                     {     typeUnicodeText (if TSMDocument is Unicode), otherwise typeChar }
    kEventParamTextInputSendUpdateRng = $74737570 (* 'tsup' *);                 {     typeTextRangeArray }
    kEventParamTextInputSendHiliteRng = $74736869 (* 'tshi' *);                 {     typeTextRangeArray }
    kEventParamTextInputSendClauseRng = $7473636C (* 'tscl' *);                 {     typeOffsetArray }
    kEventParamTextInputSendPinRng = $7473706E (* 'tspn' *);                    {     typeTextRange }
    kEventParamTextInputSendFixLen = $74736678 (* 'tsfx' *);                    {     typeLongInteger }
    kEventParamTextInputSendLeadingEdge = $74736C65 (* 'tsle' *);               {     typeBoolean }
    kEventParamTextInputReplyLeadingEdge = $74726C65 (* 'trle' *);              {     typeBoolean }
    kEventParamTextInputSendTextOffset = $7473746F (* 'tsto' *);                {     typeLongInteger }
    kEventParamTextInputReplyTextOffset = $7472746F (* 'trto' *);               {     typeLongInteger }
    kEventParamTextInputReplyRegionClass = $74727267 (* 'trrg' *);              {     typeLongInteger }
    kEventParamTextInputSendCurrentPoint = $74736370 (* 'tscp' *);              {     typeQDPoint }
    kEventParamTextInputSendDraggingMode = $7473646D (* 'tsdm' *);              {     typeBoolean }
    kEventParamTextInputReplyPoint = $74727074 (* 'trpt' *);                    {     typeQDPoint }
    kEventParamTextInputReplyFont = $74726674 (* 'trft' *);                     {     typeLongInteger }
    kEventParamTextInputReplyFMFont = $7472666D (* 'trfm' *);                   {     typeUInt32 }
    kEventParamTextInputReplyPointSize = $7472707A (* 'trpz' *);                {     typeFixed }
    kEventParamTextInputReplyLineHeight = $74726C68 (* 'trlh' *);               {     typeShortInteger }
    kEventParamTextInputReplyLineAscent = $74726C61 (* 'trla' *);               {     typeShortInteger }
    kEventParamTextInputReplyTextAngle = $74727461 (* 'trta' *);                {     typeFixed }
    kEventParamTextInputSendShowHide = $74737368 (* 'tssh' *);                  {     typeBoolean }
    kEventParamTextInputReplyShowHide = $74727368 (* 'trsh' *);                 {     typeBoolean }
    kEventParamTextInputSendKeyboardEvent = $74736B65 (* 'tske' *);             {     typeEventRef }
    kEventParamTextInputSendTextServiceEncoding = $74737365 (* 'tsse' *);       {     typeUInt32 }
    kEventParamTextInputSendTextServiceMacEncoding = $7473736D (* 'tssm' *);    {     typeUInt32 }

    kEventParamTextInputReplyMacEncoding = $74726D65 (* 'trme' *);  {     typeUInt32 }
    kEventParamTextInputGlyphInfoArray = $676C7068 (* 'glph' *);    {     typeGlyphInfoArray }
    kEventParamTextInputSendGlyphInfoArray = kEventParamTextInputGlyphInfoArray;
    kEventParamTextInputReplyGlyphInfoArray = $72677068 (* 'rgph' *);   {     typeGlyphInfoArray }
    kEventParamTextInputSendReplaceRange = $74737270 (* 'tsrp' *);  {     typeCFRange }

    {  CTSMDocumentAccess event parameters and typeses }

  kEventParamTSMDocAccessSendRefCon = kEventParamTSMSendRefCon; { typeLongInteger }
  kEventParamTSMDocAccessSendComponentInstance = kEventParamTSMSendComponentInstance; { typeComponentInstance }
  kEventParamTSMDocAccessCharacterCount = $74646374 (* 'tdct' *); { typeCFIndex }
  kEventParamTSMDocAccessReplyCharacterRange = $74647272 (* 'tdrr' *); { typeCFRange }
  kEventParamTSMDocAccessReplyCharactersPtr = $74647270 (* 'tdrp' *); { typePtr }
  kEventParamTSMDocAccessSendCharacterIndex = $74647369 (* 'tdsi' *); { typeCFIndex }
  kEventParamTSMDocAccessSendCharacterRange = $74647372 (* 'tdsr' *); { typeCFRange }
  kEventParamTSMDocAccessSendCharactersPtr = $74647370 (* 'tdsp' *); { typePtr }
  kEventParamTSMDocAccessRequestedCharacterAttributes = $74646361 (* 'tdca' *); { typeUInt32 }
  kEventParamTSMDocAccessReplyATSFont = $74646166 (* 'tdaf' *); { typeATSFontRef }
  kEventParamTSMDocAccessReplyFontSize = $74647273 (* 'tdrs' *); { typeFloat }
  kEventParamTSMDocAccessEffectiveRange = $74646572 (* 'tder' *); { typeRange }
  kEventParamTSMDocAccessReplyATSUGlyphSelector = $74647267 (* 'tdrg' *); { typeGlyphSelector }
  kEventParamTSMDocAccessLockCount = $74646C63 (* 'tdlc' *); { typeCFIndex }
  typeATSFontRef                = $61747366 (* 'atsf' *); { ATSFontRef }
  typeGlyphSelector             = $676C6673 (* 'glfs' *); { ATSUGlyphSelector }


    {  Command event parameters and types }

    kEventParamHICommand        = $68636D64 (* 'hcmd' *);                       {  typeHICommand }
    typeHICommand               = $68636D64 (* 'hcmd' *);                       {  HICommand }

    {  Window event parameters and types }

    kEventParamWindowFeatures   = $77667472 (* 'wftr' *);                       {  typeUInt32 }
    kEventParamWindowDefPart    = $77647063 (* 'wdpc' *);                       {  typeWindowDefPartCode }
  kEventParamWindowPartCode     = $77706172 (* 'wpar' *); { typeWindowPartCode }
    kEventParamCurrentBounds    = $63726374 (* 'crct' *);                       {  typeQDRectangle }
    kEventParamOriginalBounds   = $6F726374 (* 'orct' *);                       {  typeQDRectangle }
    kEventParamPreviousBounds   = $70726374 (* 'prct' *);                       {  typeQDRectangle }
    kEventParamClickActivation  = $636C6163 (* 'clac' *);                       {  typeClickActivationResult }
    kEventParamWindowRegionCode = $77736870 (* 'wshp' *);                       {  typeWindowRegionCode }
    kEventParamWindowDragHiliteFlag = $77646866 (* 'wdhf' *);                   {  typeBoolean }
    kEventParamWindowModifiedFlag = $776D6666 (* 'wmff' *);                     {  typeBoolean }
    kEventParamWindowProxyGWorldPtr = $77706777 (* 'wpgw' *);                   {  typeGWorldPtr }
    kEventParamWindowProxyImageRgn = $77706972 (* 'wpir' *);                    {  typeQDRgnHandle }
    kEventParamWindowProxyOutlineRgn = $77706F72 (* 'wpor' *);                  {  typeQDRgnHandle }
    kEventParamWindowStateChangedFlags = $77736366 (* 'wscf' *);                {  typeUInt32  }
    kEventParamWindowTitleFullWidth = $77746677 (* 'wtfw' *);                   {  typeSInt16 }
    kEventParamWindowTitleTextWidth = $77747477 (* 'wttw' *);                   {  typeSInt16 }
    kEventParamWindowGrowRect   = $67726374 (* 'grct' *);                       {  typeQDRectangle }
    kEventParamAttributes       = $61747472 (* 'attr' *);                       {  typeUInt32 }
    kEventParamDockChangedReason = $64637273 (* 'dcrs' *);                      {  typeUInt32 }
    kEventParamPreviousDockRect = $70647263 (* 'pdrc' *);                       {  typeHIRect }
  kEventParamPreviousDockDevice = $70646764 (* 'pdgd' *); { typeGDHandle }
    kEventParamCurrentDockRect  = $63647263 (* 'cdrc' *);                       {  typeHIRect }
  kEventParamCurrentDockDevice  = $63646764 (* 'cdgd' *); { typeGDHandle }
  kEventParamWindowTransitionAction = $77746163 (* 'wtac' *); { typeWindowTransitionAction }
  kEventParamWindowTransitionEffect = $77746566 (* 'wtef' *); { typeWindowTransitionEffect }
    typeWindowRegionCode        = $77736870 (* 'wshp' *);                       {  WindowRegionCode }
    typeWindowDefPartCode       = $77647074 (* 'wdpt' *);                       {  WindowDefPartCode }
  typeWindowPartCode            = $77706172 (* 'wpar' *); { WindowPartCode }
    typeClickActivationResult   = $636C6163 (* 'clac' *);                       {  ClickActivationResult }
  typeWindowTransitionAction    = $77746163 (* 'wtac' *); { WindowTransitionAction }
  typeWindowTransitionEffect    = $77746566 (* 'wtef' *); { WindowTransitionEffect }

    {  Control event parameters and types }

    kEventParamControlPart      = $63707274 (* 'cprt' *);                       {  typeControlPartCode }
    kEventParamInitCollection   = $69636F6C (* 'icol' *);                       {  typeCollection }
    kEventParamControlMessage   = $636D7367 (* 'cmsg' *);                       {  typeShortInteger }
    kEventParamControlParam     = $6370726D (* 'cprm' *);                       {  typeLongInteger }
    kEventParamControlResult    = $6372736C (* 'crsl' *);                       {  typeLongInteger }
    kEventParamControlRegion    = $6372676E (* 'crgn' *);                       {  typeQDRgnHandle }
    kEventParamControlAction    = $63617570 (* 'caup' *);                       {  typeControlActionUPP }
    kEventParamControlIndicatorDragConstraint = $63696463 (* 'cidc' *);         {  typeIndicatorDragConstraint }
    kEventParamControlIndicatorRegion = $6369726E (* 'cirn' *);                 {  typeQDRgnHandle }
    kEventParamControlIsGhosting = $63677374 (* 'cgst' *);                      {  typeBoolean }
    kEventParamControlIndicatorOffset = $63696F66 (* 'ciof' *);                 {  typeQDPoint }
    kEventParamControlClickActivationResult = $63636172 (* 'ccar' *);           {  typeClickActivationResult }
    kEventParamControlSubControl = $63737562 (* 'csub' *);                      {  typeControlRef }
    kEventParamControlOptimalBounds = $636F626E (* 'cobn' *);                   {  typeQDRectangle }
    kEventParamControlOptimalBaselineOffset = $636F626F (* 'cobo' *);           {  typeShortInteger }
    kEventParamControlDataTag   = $63647467 (* 'cdtg' *);                       {  typeEnumeration }
    kEventParamControlDataBuffer = $63646266 (* 'cdbf' *);                      {  typePtr }
    kEventParamControlDataBufferSize = $63646273 (* 'cdbs' *);                  {  typeLongInteger }
    kEventParamControlDrawDepth = $63646470 (* 'cddp' *);                       {  typeShortInteger }
    kEventParamControlDrawInColor = $63646963 (* 'cdic' *);                     {  typeBoolean }
    kEventParamControlFeatures  = $63667472 (* 'cftr' *);                       {  typeUInt32 }
    kEventParamControlPartBounds = $63706264 (* 'cpbd' *);                      {  typeQDRectangle }
    kEventParamControlOriginalOwningWindow = $636F6F77 (* 'coow' *);            {  typeWindowRef }
    kEventParamControlCurrentOwningWindow = $63636F77 (* 'ccow' *);             {  typeWindowRef }
    kEventParamControlFocusEverything = $63666576 (* 'cfev' *);             { typeBoolean }
    kEventParamNextControl        = $636E7863 (* 'cnxc' *);                             { typeControlRef }
    kEventParamStartControl       = $63737463 (* 'cstc' *);                         { typeControlRef }
    kEventParamControlSubview     = $63737677 (* 'csvw' *);                     { typeControlRef }
    kEventParamControlPreviousPart = $636F7063 (* 'copc' *);                    { typeControlPartCode }
    kEventParamControlCurrentPart = $636E7063 (* 'cnpc' *);                     { typeControlPartCode }
    kEventParamControlInvalRgn    = $63697672 (* 'civr' *);                     { typeQDRgnHandle }
    kEventParamControlValue       = $6376616C (* 'cval' *);                         { typeLongInteger }
  kEventParamControlHit         = $63686974 (* 'chit' *); { typeBoolean }
  kEventParamControlPartAutoRepeats = $63617572 (* 'caur' *); { typeBoolean }
  kEventParamControlFrameMetrics = $63666D74 (* 'cfmt' *); { typeControlFrameMetrics }
  kEventParamControlWouldAcceptDrop = $636C6467 (* 'cldg' *); { typeBoolean }
    kEventParamControlLikesDrag = $636C6467 (* 'cldg' *);               { typeBoolean }
    typeControlActionUPP        = $63617570 (* 'caup' *);                       {  ControlActionUPP }
    typeIndicatorDragConstraint = $63696463 (* 'cidc' *);                       {  IndicatorDragConstraint }
    typeControlPartCode         = $63707274 (* 'cprt' *);                       {  ControlPartCode }
  typeControlFrameMetrics       = $63696E73 (* 'cins' *); { HIViewFrameMetrics }

    {  Menu event parameters and types }

    kEventParamCurrentMenuTrackingMode = $636D746D (* 'cmtm' *);                {  typeMenuTrackingMode }
    kEventParamNewMenuTrackingMode = $6E6D746D (* 'nmtm' *);                    {  typeMenuTrackingMode }
    kEventParamMenuFirstOpen    = $3173746F (* '1sto' *);                       {  typeBoolean }
    kEventParamMenuItemIndex    = $6974656D (* 'item' *);                       {  typeMenuItemIndex }
    kEventParamMenuCommand      = $6D636D64 (* 'mcmd' *);                       {  typeMenuCommand }
    kEventParamEnableMenuForKeyEvent = $666F726B (* 'fork' *);                  {  typeBoolean }
    kEventParamMenuEventOptions = $6D656F70 (* 'meop' *);                       {  typeMenuEventOptions }
    kEventParamMenuContext      = $6D637478 (* 'mctx' *);                       {  typeUInt32 }
  kEventParamMenuDismissed      = $6D646973 (* 'mdis' *); { typeUInt32 }
    kEventParamMenuItemBounds   = $6D697462 (* 'mitb' *);                       {  typeQDRectangle }
    kEventParamMenuMarkBounds   = $6D6D6B62 (* 'mmkb' *);                       {  typeQDRectangle }
    kEventParamMenuIconBounds   = $6D696362 (* 'micb' *);                       {  typeQDRectangle }
    kEventParamMenuTextBounds   = $6D747862 (* 'mtxb' *);                       {  typeQDRectangle }
    kEventParamMenuTextBaseline = $6D74626C (* 'mtbl' *);                       {  typeShortInteger }
    kEventParamMenuCommandKeyBounds = $6D636D62 (* 'mcmb' *);                   {  typeQDRectangle }
    kEventParamMenuVirtualTop   = $6D767274 (* 'mvrt' *);                       {  typeLongInteger }
    kEventParamMenuVirtualBottom = $6D767262 (* 'mvrb' *);                      {  typeLongInteger }
    kEventParamMenuDrawState    = $6D647273 (* 'mdrs' *);                       {  typeThemeDrawState }
    kEventParamMenuItemType     = $6D697470 (* 'mitp' *);                       {  typeThemeMenuItemType }
    kEventParamMenuItemWidth    = $6D697477 (* 'mitw' *);                       {  typeShortInteger }
    kEventParamMenuItemHeight   = $6D697468 (* 'mith' *);                       {  typeShortInteger }
    kEventParamMenuFrameView      = $6D667276 (* 'mfrv' *); { typeControlRef }
    kEventParamMenuType           = $6D747970 (* 'mtyp' *); { typeThemeMenuType }
    kEventParamMenuIsPopup        = $6D706F70 (* 'mpop' *); { typeBoolean }
    kEventParamMenuDirection      = $6D646972 (* 'mdir' *); { typeMenuDirection }
    kEventParamParentMenu         = $6D70726D (* 'mprm' *); { typeMenuRef }
    kEventParamParentMenuItem     = $6D707269 (* 'mpri' *); { typeMenuItemIndex }
    kEventParamMenuPopupItem      = $6D706974 (* 'mpit' *); { typeMenuItemIndex }
    typeMenuItemIndex           = $6D696478 (* 'midx' *);                       {  MenuItemIndex }
    typeMenuCommand             = $6D636D64 (* 'mcmd' *);                       {  MenuCommand }
    typeMenuTrackingMode        = $6D746D64 (* 'mtmd' *);                       {  MenuTrackingMode }
    typeMenuEventOptions        = $6D656F70 (* 'meop' *);                       {  MenuEventOptions }
    typeThemeMenuState          = $746D6E73 (* 'tmns' *);                       {  ThemeMenuState }
    typeThemeMenuItemType       = $746D6974 (* 'tmit' *);                       {  ThemeMenuItemType }
    typeMenuDirection             = $6D646972 (* 'mdir' *); { UInt32 }
    typeThemeMenuType             = $746D7479 (* 'tmty' *); { ThemeMenuType }

    {  Application event parameters }

    kEventParamProcessID        = $70736E20 (* 'psn ' *);                       {  typeProcessSerialNumber }
    kEventParamLaunchRefCon     = $6C726566 (* 'lref' *);                       {  typeUInt32 }
    kEventParamLaunchErr        = $65727220 (* 'err ' *);                       {  typeOSStatus }
  kEventParamSystemUIMode       = $75696D64 (* 'uimd' *); { typeUInt32 }
  kEventParamIsInInstantMouser  = $696D6F75 (* 'imou' *); { typeBoolean }
  kEventParamPreviousWindow     = $70727677 (* 'prvw' *); { typeWindowRef }
  kEventParamCurrentWindow      = $63757277 (* 'curw' *); { typeWindowRef }

    {  Tablet event parameters and types }

    kEventParamTabletPointRec   = $74627263 (* 'tbrc' *);                       {  typeTabletPointRec }
    kEventParamTabletProximityRec = $74627078 (* 'tbpx' *);                     {  typeTabletProximityRec }
    typeTabletPointRec          = $74627263 (* 'tbrc' *);                       {  kEventParamTabletPointRec }
    typeTabletProximityRec      = $74627078 (* 'tbpx' *);                       {  kEventParamTabletProximityRec }
    kEventParamTabletPointerRec = $74627263 (* 'tbrc' *);                       {  typeTabletPointerRec      -- deprecated, for compatibility only }
    typeTabletPointerRec        = $74627263 (* 'tbrc' *);                       {  kEventParamTabletPointerRec    -- deprecated, for compatibility only }

    {  Appearance event parameters }

    kEventParamNewScrollBarVariant = $6E736276 (* 'nsbv' *);                    {  typeShortInteger }

    {  Service event parameters }

  kEventParamPasteboardRef      = $70627264 (* 'pbrd' *); { typePasteboardRef }
    kEventParamScrapRef         = $73637270 (* 'scrp' *);                       {     typeScrapRef }
    kEventParamServiceCopyTypes = $73767364 (* 'svsd' *);                       {     typeCFMutableArrayRef }
    kEventParamServicePasteTypes = $73767074 (* 'svpt' *);                      {     typeCFMutableArrayRef }
    kEventParamServiceMessageName = $73766D67 (* 'svmg' *);                     {     typeCFStringRef }
    kEventParamServiceUserData  = $73767564 (* 'svud' *);                       {     typeCFStringRef }
  typePasteboardRef             = $70627264 (* 'pbrd' *); { PasteboardRef }
    typeScrapRef                = $73637270 (* 'scrp' *);                       {     ScrapRef }
    typeCFMutableArrayRef       = $63666D61 (* 'cfma' *);                       {     CFMutableArrayRef }

    {  Accessibility event parameters }

  kEventParamAccessibleObject   = $616F626A (* 'aobj' *); { typeCFTypeRef with an AXUIElementRef }
  kEventParamAccessibleChild    = $6163686C (* 'achl' *); { typeCFTypeRef with an AXUIElementRef }
  kEventParamAccessibleAttributeName = $61746E6D (* 'atnm' *); { typeCFStringRef }
  kEventParamAccessibleAttributeNames = $61746E73 (* 'atns' *); { typeCFMutableArrayRef of CFStringRefs }
  kEventParamAccessibleAttributeValue = $6174766C (* 'atvl' *); { variable }
  kEventParamAccessibleAttributeSettable = $61747374 (* 'atst' *); { typeBoolean }
  kEventParamAccessibleAttributeParameter = $61747061 (* 'atpa' *); { typeCFTypeRef }
  kEventParamAccessibleActionName = $61636E6D (* 'acnm' *); { typeCFStringRef }
  kEventParamAccessibleActionNames = $61636E73 (* 'acns' *); { typeCFMutableArrayRef of CFStringRefs }
  kEventParamAccessibleActionDescription = $61636473 (* 'acds' *); { typeCFMutableStringRef }
  kEventParamAccessibilityEventQueued = $61657175 (* 'aequ' *); { typeBoolean }

    {  Text field event type }

  typeCFRange                   = $6366726E (* 'cfrn' *); { CFRange }

    {   ======================================================================================  }
    {     EVENT HANDLERS                                                                        }
    {   ======================================================================================  }


type
    EventHandlerRef    = ^SInt32; { an opaque 32-bit type }
    EventHandlerRefPtr = ^EventHandlerRef;  { when a var xx:EventHandlerRef parameter can be nil, it is changed to xx: EventHandlerRefPtr }
    EventHandlerCallRef    = ^SInt32; { an opaque 32-bit type }
    EventHandlerCallRefPtr = ^EventHandlerCallRef;  { when a var xx:EventHandlerCallRef parameter can be nil, it is changed to xx: EventHandlerCallRefPtr }

    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {     ¥ EventHandler specification                                                          }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }

    {
     *  EventHandlerProcPtr
     *
     *  Discussion:
     *    Callback for receiving events sent to a target this callback is
     *    installed on.
     *
     *  Parameters:
     *
     *    inHandlerCallRef:
     *      A reference to the current handler call chain. This is sent to
     *      your handler so that you can call CallNextEventHandler if you
     *      need to.
     *
     *    inEvent:
     *      The Event.
     *
     *    inUserData:
     *      The app-specified data you passed in a call to
     *      InstallEventHandler.
     *
     *  Result:
     *    An operating system result code. Returning noErr indicates you
     *    handled the event. Returning eventNotHandledErr indicates you did
     *    not handle the event and perhaps the toolbox should take other
     *    action.
        }
    EventHandlerProcPtr = function(inHandlerCallRef: EventHandlerCallRef; inEvent: EventRef; inUserData: UnivPtr): OSStatus;

    EventHandlerUPP = ^SInt32; { an opaque UPP }

const
    uppEventHandlerProcInfo = $00000FF0;
    {
     *  NewEventHandlerUPP()
     *
     *  Availability:
     *    Non-Carbon CFM:   available as macro/inline
     *    CarbonLib:        in CarbonLib 1.1 and later
     *    Mac OS X:         in version 10.0 and later
        }
function NewEventHandlerUPP(userRoutine: EventHandlerProcPtr): EventHandlerUPP; external name '_NewEventHandlerUPP'; { old name was NewEventHandlerProc }
{
 *  DisposeEventHandlerUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeEventHandlerUPP(userUPP: EventHandlerUPP); external name '_DisposeEventHandlerUPP';
{
 *  InvokeEventHandlerUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeEventHandlerUPP(inHandlerCallRef: EventHandlerCallRef; inEvent: EventRef; inUserData: UnivPtr; userRoutine: EventHandlerUPP): OSStatus; external name '_InvokeEventHandlerUPP'; { old name was CallEventHandlerProc }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{  ¥ Installing Event Handlers                                                         }
{                                                                                      }
{ Use these routines to install event handlers for a specific toolbox object. You may  }
{ pass zero for inNumTypes and NULL for inList if you need to be in a situation where  }
{ you know you will be receiving events, but not exactly which ones at the time you    }
{ are installing the handler. Later, your application can call the Add/Remove routines }
{ listed below this section.                                                           }
{                                                                                      }
{ You can only install a specific handler once. The combination of inHandler and       }
{ inUserData is considered the 'signature' of a handler. Any attempt to install a new  }
{ handler with the same proc and user data as an already-installed handler will result }
{ in eventHandlerAlreadyInstalledErr. Installing the same proc and user data on a      }
{ different object is legal.                                                           }
{                                                                                      }
{ Upon successful completion of this routine, you are returned an EventHandlerRef,     }
{ which you can use in various other calls, and is passed to your event handler. You   }
{ use it to extract information about the handler, such as the target (window, etc.)   }
{ if you have the same handler installed for different objects and need to perform     }
{ actions on the current target (say, call a window manager function).                 }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}

type
    EventTargetRef    = ^SInt32; { an opaque 32-bit type }
    EventTargetRefPtr = ^EventTargetRef;  { when a var xx:EventTargetRef parameter can be nil, it is changed to xx: EventTargetRefPtr }
    {
     *  GetWindowEventTarget()
     *
     *  Discussion:
     *    Returns the EventTargetRef for the specified window. Once you
     *    obtain this reference, you can send events to the target and
     *    install an event handler on it.
     *
     *  Parameters:
     *
     *    inWindow:
     *      The window to return the target for.
     *
     *  Result:
     *    An EventTargetRef.
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.1 and later
     *    Mac OS X:         in version 10.0 and later
        }
function GetWindowEventTarget(inWindow: WindowRef): EventTargetRef; external name '_GetWindowEventTarget';

{
 *  GetControlEventTarget()
 *
 *  Discussion:
 *    Returns the EventTargetRef for the specified control. Once you
 *    obtain this reference, you can send events to the target and
 *    install event handler on it.
 *
 *  Parameters:
 *
 *    inControl:
 *      The control to return the target for.
 *
 *  Result:
 *    An EventTargetRef.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetControlEventTarget(inControl: ControlRef): EventTargetRef; external name '_GetControlEventTarget';

{
 *  GetMenuEventTarget()
 *
 *  Discussion:
 *    Returns the EventTargetRef for the specified menu. Once you
 *    obtain this reference, you can send events to the target and
 *    install event handler on it.
 *
 *  Parameters:
 *
 *    inMenu:
 *      The menu to return the target for.
 *
 *  Result:
 *    An EventTargetRef.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetMenuEventTarget(inMenu: MenuRef): EventTargetRef; external name '_GetMenuEventTarget';

{
 *  GetApplicationEventTarget()
 *
 *  Discussion:
 *    Returns the EventTargetRef for the application. Once you obtain
 *    this reference, you can send events to the target and install
 *    event handler on it.
 *
 *  Result:
 *    An EventTargetRef.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetApplicationEventTarget: EventTargetRef; external name '_GetApplicationEventTarget';

{
 *  GetUserFocusEventTarget()
 *
 *  Discussion:
 *    Returns the EventTargetRef for the current user focus at the time
 *    of the call. Keyboard events are always sent to this target.
 *
 *  Result:
 *    An EventTargetRef.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetUserFocusEventTarget: EventTargetRef; external name '_GetUserFocusEventTarget';

{
 *  GetEventDispatcherTarget()
 *
 *  Discussion:
 *    Returns the EventTargetRef for the standard toolbox dispatcher.
 *    You typically would never need to use this, but there are some
 *    exotic apps that need to pick events off the event queue and call
 *    the dispatcher themselves. This allows you to do just that
 *    instead of calling RunApplicationEventLoop to handle it all.
 *
 *  Result:
 *    An EventTargetRef.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetEventDispatcherTarget: EventTargetRef; external name '_GetEventDispatcherTarget';

{
 *  GetEventMonitorTarget()
 *
 *  Summary:
 *    Returns the event monitor target.
 *
 *  Discussion:
 *    The event monitor target is a special event target used to
 *    monitor user input events across all processes. When an event
 *    handler is installed on the event monitor target, the Carbon
 *    Event Manager examines the EventTypeSpec for user input event
 *    types, such as mouse-down, mouse-up, key-down, and so forth. It
 *    then requests that the WindowServer make copies of any of these
 *    events that are sent to any process, and deliver them to the
 *    current process also. These events are queued into the main
 *    threadÕs event queue, and during normal event dispatching are
 *    sent directly to the event handlers installed on the event
 *    monitor target. Monitored events are not sent through the normal
 *    event dispatching path for the current process; they will pass
 *    through the event dispatcher target, and will then be sent
 *    directly to the event monitor target.
 *
 *    Handlers installed on the event monitor target will only receive
 *    events when the current application is inactive. When the current
 *    application is active, all event flow occurs through the event
 *    dispatcher target, and no events are sent to the event monitor
 *    target.
 *
 *    Currently, the event monitor supports the following event kinds:
 *    kEventRawKeyDown, kEventRawKeyUp, kEventRawKeyRepeat,
 *    kEventRawKeyModifiersChanged, kEventMouseDown, kEventMouseUp,
 *    kEventMouseMoved, kEventMouseDragged, kEventMouseWheelMoved,
 *    kEventTabletPoint, and kEventTabletProximity.
 *
 *    Note that both Carbon and Cocoa password edit text controls
 *    enable a secure input mode while the focus is on the control,
 *    which prevents keyboard events from being passed to other
 *    applications. This prevents the monitoring event target from
 *    being used to sniff password keystrokes.
 *
 *    For added security, GetEventMonitorTarget requires that "Enable
 *    access for assistive devices" be checked in the Universal Access
 *    preference pane in order to monitor RawKeyDown, RawKeyUp, and
 *    RawKeyRepeat events. If this control is not checked, you can
 *    still install handlers for these events on the event monitor
 *    target, but no events of these types will be sent to your
 *    handler. Administrator privileges are required to enable this
 *    feature.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Result:
 *    An EventTargetRef.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function GetEventMonitorTarget: EventTargetRef; external name '_GetEventMonitorTarget';




{
 *  InstallEventHandler()
 *
 *  Discussion:
 *    Installs an event handler on a specified target. Your handler
 *    proc will be called with the events you registered with when an
 *    event of the corresponding type and class are send to the target
 *    you are installing your handler on.
 *
 *  Parameters:
 *
 *    inTarget:
 *      The target to register your handler with.
 *
 *    inHandler:
 *      A pointer to your handler function.
 *
 *    inNumTypes:
 *      The number of events you are registering for.
 *
 *    inList:
 *      A pointer to an array of EventTypeSpec entries representing the
 *      events you are interested in.
 *
 *    inUserData:
 *      The value passed in this parameter is passed on to your event
 *      handler proc when it is called.
 *
 *    outRef:
 *      Receives an EventHandlerRef, which you can use later to remove
 *      the handler. You can pass null if you don't want the reference
 *      - when the target is disposed, the handler will be disposed as
 *      well.
 *
 *  Result:
 *    An operating system result code.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InstallEventHandler(inTarget: EventTargetRef; inHandler: EventHandlerUPP; inNumTypes: UInt32; inList: EventTypeSpecPtr; inUserData: UnivPtr; outRef: EventHandlerRefPtr): OSStatus; external name '_InstallEventHandler';

{
 *  InstallStandardEventHandler()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InstallStandardEventHandler(inTarget: EventTargetRef): OSStatus; external name '_InstallStandardEventHandler';

{
 *  RemoveEventHandler()
 *
 *  Discussion:
 *    Removes an event handler from the target it was bound to.
 *
 *  Parameters:
 *
 *    inHandlerRef:
 *      The handler ref to remove (returned in a call to
 *      InstallEventHandler). After you call this function, the handler
 *      ref is considered to be invalid and can no longer be used.
 *
 *  Result:
 *    An operating system result code.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function RemoveEventHandler(inHandlerRef: EventHandlerRef): OSStatus; external name '_RemoveEventHandler';

{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{  ¥ Adjusting set of event types after a handler is created                           }
{                                                                                      }
{ After installing a handler with the routine above, you can adjust the event type     }
{ list telling the toolbox what events to send to that handler by calling the two      }
{ routines below. If you add an event type twice for the same handler, your handler    }
{ will only be called once, but it will take two RemoveEventType calls to stop your    }
{ handler from being called with that event type. In other words, the install count    }
{ for each event type is maintained by the toolbox. This might allow you, for example  }
{ to have subclasses of a window object register for types without caring if the base  }
{ class has already registered for that type. When the subclass removes its types, it  }
{ can successfully do so without affecting the base class's reception of its event     }
{ types, yielding eternal bliss.                                                       }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}

{
 *  AddEventTypesToHandler()
 *
 *  Discussion:
 *    Adds additional events to an event handler that has already been
 *    installed.
 *
 *  Parameters:
 *
 *    inHandlerRef:
 *      The event handler to add the additional events to.
 *
 *    inNumTypes:
 *      The number of events to add.
 *
 *    inList:
 *      A pointer to an array of EventTypeSpec entries.
 *
 *  Result:
 *    An operating system result code.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function AddEventTypesToHandler(inHandlerRef: EventHandlerRef; inNumTypes: UInt32; inList: EventTypeSpecPtr): OSStatus; external name '_AddEventTypesToHandler';

{
 *  RemoveEventTypesFromHandler()
 *
 *  Discussion:
 *    Removes events from an event handler that has already been
 *    installed.
 *
 *  Parameters:
 *
 *    inHandlerRef:
 *      The event handler to remove the events from.
 *
 *    inNumTypes:
 *      The number of events to remove.
 *
 *    inList:
 *      A pointer to an array of EventTypeSpec entries.
 *
 *  Result:
 *    An operating system status code.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function RemoveEventTypesFromHandler(inHandlerRef: EventHandlerRef; inNumTypes: UInt32; inList: EventTypeSpecPtr): OSStatus; external name '_RemoveEventTypesFromHandler';

{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{  ¥ Explicit Propogation                                                              }
{                                                                                      }
{  CallNextEventHandler can be used to call thru to all handlers below the current     }
{  handler being called. You pass the EventHandlerCallRef passed to your EventHandler  }
{  into this call so that we know how to properly forward the event. The result of     }
{  this function should normally be the result of your own handler that you called     }
{  this API from. The typical use of this routine would be to allow the toolbox to do  }
{  its standard processing and then follow up with some type of embellishment.         }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}

{
 *  CallNextEventHandler()
 *
 *  Discussion:
 *    Calls thru to the event handlers below you in the event handler
 *    stack of the target to which your handler is bound. You might use
 *    this to call thru to the default toolbox handling in order to
 *    post-process the event. You can only call this routine from
 *    within an event handler.
 *
 *  Parameters:
 *
 *    inCallRef:
 *      The event handler call ref passed into your event handler.
 *
 *    inEvent:
 *      The event to pass thru.
 *
 *  Result:
 *    An operating system result code.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CallNextEventHandler(inCallRef: EventHandlerCallRef; inEvent: EventRef): OSStatus; external name '_CallNextEventHandler';


{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{  ¥ Sending Events                                                                    }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{
 *  SendEventToEventTarget()
 *
 *  Discussion:
 *    Sends an event to the specified event target.
 *
 *  Parameters:
 *
 *    inEvent:
 *      The event to send.
 *
 *    inTarget:
 *      The target to send it to.
 *
 *  Result:
 *    An operating system result code.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SendEventToEventTarget(inEvent: EventRef; inTarget: EventTargetRef): OSStatus; external name '_SendEventToEventTarget';

{======================================================================================}
{  EVENT-BASED OBJECT CLASSES                                                          }
{                                                                                      }
{  Here it is - the replacement for classic defprocs. This is also a convenient way    }
{  to create toolbox objects (windows, etc.) that have a specific behavior without     }
{  installing handlers on each instance of the object. With a toolbox object class,    }
{  you register your class, then use special creation routines to create objects of    }
{  that class. The event handlers are automatically installed and ready to go.         }
{======================================================================================}


type
    ToolboxObjectClassRef    = ^SInt32; { an opaque 32-bit type }
    ToolboxObjectClassRefPtr = ^ToolboxObjectClassRef;  { when a var xx:ToolboxObjectClassRef parameter can be nil, it is changed to xx: ToolboxObjectClassRefPtr }

    {
     *  RegisterToolboxObjectClass()
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.1 and later
     *    Mac OS X:         in version 10.0 and later
        }
function RegisterToolboxObjectClass(inClassID: CFStringRef; inBaseClass: ToolboxObjectClassRef; inNumEvents: UInt32; inEventList: EventTypeSpecPtr; inEventHandler: EventHandlerUPP; inEventHandlerData: UnivPtr; var outClassRef: ToolboxObjectClassRef): OSStatus; external name '_RegisterToolboxObjectClass';

{
 *  UnregisterToolboxObjectClass()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function UnregisterToolboxObjectClass(inClassRef: ToolboxObjectClassRef): OSStatus; external name '_UnregisterToolboxObjectClass';

{======================================================================================}
{  ¥ Command Routines                                                                  }
{======================================================================================}

{
 *  ProcessHICommand()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ProcessHICommand(const (*var*) inCommand: HICommand): OSStatus; external name '_ProcessHICommand';

{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{  ¥ Event Loop Routines                                                               }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}

{
 *  RunApplicationEventLoop()
 *
 *  Discussion:
 *    This routine is used as the main event loop for a Carbon
 *    Event-based application. Once entered, this function waits for
 *    events to arrive and dispatches them to your event handlers
 *    automatically.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure RunApplicationEventLoop; external name '_RunApplicationEventLoop';

{
 *  QuitApplicationEventLoop()
 *
 *  Discussion:
 *    This routine is used to quit the RunApplicationEventLoop
 *    function. Typically, your application doesn't need to call this.
 *    If your application has the Quit menu item tagged with the
 *    kHICommandQuit Menu Command ID, the toolbox will automatically
 *    call this for your application, automatically terminating your
 *    event loop. If your application wants to do pre-processing before
 *    the event loop exits, it should intercept either the
 *    kHICommandQuit menu command, or the kEventApplicationQuit event.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure QuitApplicationEventLoop; external name '_QuitApplicationEventLoop';

{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{  ¥ Event Modality routines                                                           }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}

{
 *  RunAppModalLoopForWindow()
 *
 *  Discussion:
 *    This routine is used as a replacement to ModalDialog to drive a
 *    Carbon Event-based modal dialog. Once called, this routine will
 *    not exit until QuitAppModalLoopForWindow is called. Calls to
 *    RunAppModalLoopForWindow can be nested, as long as each call is
 *    made on a different window. In Mac OS X 10.0.x,
 *    RunAppModalLoopForWindow will fail to re-enable the menubar
 *    before exiting if you dispose of the window during the modal loop
 *    (for example, from a Carbon event handler). You can work around
 *    this bug by retaining the window before calling
 *    RunAppModalLoopForWindow, and releasing it afterwards.
 *
 *  Parameters:
 *
 *    inWindow:
 *      The window you wish to behave modally.
 *
 *  Result:
 *    An operating system status code.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 }
function RunAppModalLoopForWindow(inWindow: WindowRef): OSStatus; external name '_RunAppModalLoopForWindow';

{
 *  QuitAppModalLoopForWindow()
 *
 *  Discussion:
 *    This routine is used to quit a currently running call to
 *    RunAppModalLoopForWindow, i.e. it terminates a modal loop.
 *    Typically this would be called from a handler you have installed
 *    on the modal window in question when the user clicks the
 *    appropriate button, etc.
 *
 *  Parameters:
 *
 *    inWindow:
 *      The window for which to quit the modal state.
 *
 *  Result:
 *    An operating system status code.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 }
function QuitAppModalLoopForWindow(inWindow: WindowRef): OSStatus; external name '_QuitAppModalLoopForWindow';

{
 *  BeginAppModalStateForWindow()
 *
 *  Discussion:
 *    This routine is a lower level routine than
 *    RunAppModalLoopForWindow. It can be used if you wish to enter an
 *    app modal state for a window, but need to control the event loop
 *    yourself for whatever reason. In most cases, you would use
 *    RunAppModalLoopForWindow. Once you begin your app modal state,
 *    the menu bar will disable and prepare for the modal situation.
 *    The window must be visible when calling
 *    BeginAppModalStateForWindow; otherwise, windowWrongStateErr is
 *    returned. Calls to BeginAppModalStateForWindow can be nested, as
 *    long as each call is made on a different window. In Mac OS 10.0.x
 *    and CarbonLib 1.3.1, BeginAppModalStateForWindow can only be
 *    called on a window once; future calls will return an error. This
 *    bug is fixed in Mac OS 10.1 and CarbonLib 1.4.
 *
 *  Parameters:
 *
 *    inWindow:
 *      The window you wish to behave modally.
 *
 *  Result:
 *    An operating system status code.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 }
function BeginAppModalStateForWindow(inWindow: WindowRef): OSStatus; external name '_BeginAppModalStateForWindow';

{
 *  EndAppModalStateForWindow()
 *
 *  Discussion:
 *    This routine ends an app modal state started with
 *    BeginAppModalStateForWindow.
 *
 *  Parameters:
 *
 *    inWindow:
 *      The window you wish to stop acting as app modal.
 *
 *  Result:
 *    An operating system status code.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 }
function EndAppModalStateForWindow(inWindow: WindowRef): OSStatus; external name '_EndAppModalStateForWindow';


{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{  ¥ User Focus                                                                        }
{                                                                                      }
{ The 'user focus' is where keyboard input goes. We also use the term 'key' applied    }
{ to windows to mean this. The user focus window is normally the active non-floating   }
{ window or dialog. It is possible to make a floater get the focus, however, by calling}
{ SetUserFocusWindow. After that call, the event model will automatically route key    }
{ input to the active keyboard focus of that window, if any. Passing kUserFocusAuto    }
{ into the window parameter tells the toolbox to pick what it considers to be the best }
{ candidate for focus. You should call this to restore focus, rather than getting the  }
{ focus, setting it to a special window, and then restoring to the saved focus. There  }
{ are cases, however, when you might want to restore to an explicit window, but the    }
{ typical usage should just be to restore to the kUserFocusAuto focus.                 }
{                                                                                      }
{ Keep in mind that setting the focus will only last until you restore focus, or the   }
{ user starts clicking in other windows. When that happens, the toolbox will auto-     }
{ redirect the user focus to a newly selected window.                                  }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{  pick the most appropriate window for focus }

const
    kUserFocusAuto              = -1;
    {
     *  SetUserFocusWindow()
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.1 and later
     *    Mac OS X:         in version 10.0 and later
        }
function SetUserFocusWindow(inWindow: WindowRef): OSStatus; external name '_SetUserFocusWindow';

{
 *  GetUserFocusWindow()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetUserFocusWindow: WindowRef; external name '_GetUserFocusWindow';


{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{  ¥ Default/Cancel buttons                                                            }
{                                                                                      }
{ In our quest to eliminate the need for dialogs when using the new event model, we    }
{ have added the following routines which add dialog-like button control to normal     }
{ windows. With these routines, you can set the default and cancel buttons for a       }
{ window; these work just like the corresponding concepts in dialogs, and when         }
{ present, the standard toolbox handlers will handle keyboard input mapping to these   }
{ buttons. This means that pressing return or enter will 'press' the default button    }
{ and escape or command-period will 'press' the cancel button.                         }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}

{
 *  SetWindowDefaultButton()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetWindowDefaultButton(inWindow: WindowRef; inControl: ControlRef): OSStatus; external name '_SetWindowDefaultButton';

{
 *  SetWindowCancelButton()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetWindowCancelButton(inWindow: WindowRef; inControl: ControlRef): OSStatus; external name '_SetWindowCancelButton';

{
 *  GetWindowDefaultButton()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetWindowDefaultButton(inWindow: WindowRef; var outControl: ControlRef): OSStatus; external name '_GetWindowDefaultButton';

{
 *  GetWindowCancelButton()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetWindowCancelButton(inWindow: WindowRef; var outControl: ControlRef): OSStatus; external name '_GetWindowCancelButton';


{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{  ¥ Global HotKey API                                                                 }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}

type
    EventHotKeyIDPtr = ^EventHotKeyID;
    EventHotKeyID = record
        signature:              OSType;
        id:                     UInt32;
    end;

    EventHotKeyRef    = ^SInt32; { an opaque 32-bit type }
    EventHotKeyRefPtr = ^EventHotKeyRef;  { when a var xx:EventHotKeyRef parameter can be nil, it is changed to xx: EventHotKeyRefPtr }
    {
     *  RegisterEventHotKey()
     *
     *  Discussion:
     *    Registers a global hot key based on the virtual key code and
     *    modifiers you pass in. Only one such combination can exist for
     *    the current application, i.e. multiple entities in the same
     *    application cannot register for the same hot key combination. The
     *    same hot key can, however, be registered by multiple
     *    applications. This means that multiple applications can
     *    potentially be notified when a particular hot key is requested.
     *    This might not necessarily be desirable, but it is how it works
     *    at present.
     *
     *  Parameters:
     *
     *    inHotKeyCode:
     *      The virtual key code of the key to watch
     *
     *    inHotKeyModifiers:
     *      The keyboard modifiers to look for. There must be a modifier
     *      specified, or this function will return paramErr.
     *
     *    inHotKeyID:
     *      The application-specified hot key ID. You will receive this in
     *      the kEventHotKeyPressed event as the direct object parameter.
     *
     *    inTarget:
     *      The target to notify when the hot key is pressed.
     *
     *    inOptions:
     *      Currently unused. Pass 0 or face the consequences.
     *
     *    outRef:
     *      The EventHotKeyRef that represents your new, shiny hot key. You
     *      need this if you later wish to unregister it.
     *
     *  Result:
     *    An operating system status code.
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.3 and later
     *    Mac OS X:         in version 10.0 and later
        }
function RegisterEventHotKey(inHotKeyCode: UInt32; inHotKeyModifiers: UInt32; inHotKeyID: EventHotKeyID; inTarget: EventTargetRef; inOptions: OptionBits; var outRef: EventHotKeyRef): OSStatus; external name '_RegisterEventHotKey';

{
 *  UnregisterEventHotKey()
 *
 *  Discussion:
 *    Unregisters a global hot key that was previously registered with
 *    the RegisterEventHotKey API. You do not need to unregister a hot
 *    key when your application terminates, the system will take care
 *    of that for you. This would be used if the user changes a hot key
 *    for something in your application - you would unregister the
 *    previous key and register your new key.
 *
 *  Parameters:
 *
 *    inHotKey:
 *      The EventHotKeyRef to unregister.
 *
 *  Result:
 *    An operating system status code.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 }
function UnregisterEventHotKey(inHotKey: EventHotKeyRef): OSStatus; external name '_UnregisterEventHotKey';

{
 *  kHISymbolicHotKeyCode
 *
 *  Discussion:
 *    A CFDictionaryRef key in a dictionary returned by
 *    CopySymbolicHotKeys. The value for this key is the virtual
 *    keycode of the hotkey, represented as a CFNumber.
 }
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kHISymbolicHotKeyCode CFSTRP('kHISymbolicHotKeyCode')}
{$endc}

{
 *  kHISymbolicHotKeyModifiers
 *
 *  Discussion:
 *    A CFDictionaryRef key in a dictionary returned by
 *    CopySymbolicHotKeys. The value for this key is the keyboard
 *    modifiers of the hotkey, represented as a CFNumber.
 }
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kHISymbolicHotKeyModifiers CFSTRP('kHISymbolicHotKeyModifiers')}
{$endc}

{
 *  kHISymbolicHotKeyEnabled
 *
 *  Discussion:
 *    A CFDictionaryRef key in a dictionary returned by
 *    CopySymbolicHotKeys. The value for this key is the enable state
 *    of the hotkey, represented as a CFBoolean.
 }
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kHISymbolicHotKeyEnabled CFSTRP('kHISymbolicHotKeyEnabled')}
{$endc}
{
 *  CopySymbolicHotKeys()
 *
 *  Summary:
 *    Returns an array of CFDictionaryRefs containing information about
 *    the system-wide symbolic hotkeys that are defined in the Keyboard
 *    preferences pane.
 *
 *  Discussion:
 *    The hotkey info returned by this API describes the system-wide
 *    hotkeys such as the Screen Capture, Universal Access, and
 *    Keyboard Navigation keys. It does not include customized
 *    application-specific command keys.
 *
 *    Each array entry is a CFDictionaryRef, and each dictionary
 *    contains information about a single hotkey. There is currently no
 *    way to determine which hotkey in the Keyboards preference pane
 *    corresponds to a specific dictionary. Each dictionary contains
 *    the following keys: kHISymbolicHotKeyCode,
 *    kHISymbolicHotKeyModifiers, and kHISymbolicHotKeyEnabled. The
 *    array must be released by the caller; the dictionaries do not
 *    need to be released (they will be auto-released when the array is
 *    released).
 *
 *    Note that this API will require O(number of hotkeys) to run, and
 *    the number of hotkeys will increase in the future, so do not call
 *    this API unnecessarily or in highly performance-sensitive code.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    outHotKeyArray:
 *      On exit, contains an array of the values of all symbolic hot
 *      keys.
 *
 *  Result:
 *    An operating system result code; currently, noErr and memFullErr
 *    may be returned.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function CopySymbolicHotKeys( var outHotKeyArray: CFArrayRef ): OSStatus; external name '_CopySymbolicHotKeys';



{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{  ¥ MouseTrackingRegions                                                              }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}

{
 *  MouseTrackingRef
 *
 *  Discussion:
 *    A MouseTrackingRef is an object that controls the generation of
 *    mouse-enter and mouse-exit events. When the user moves the mouse
 *    into a tracking region, a kEventClassMouse/kEventMouseEntered
 *    event is sent to the app. When the user moves the mouse out of a
 *    tracking region, an event of type
 *    kEventClassMouse/kEventMouseExited is sent. Mouse tracking
 *    regions are uniquely identified within the scope of a window by a
 *    MouseTrackingRegionID which is a client signature/id pair. The
 *    client signature is the usual DTS-registered creator OSType.
 *    Mouse tracking regions can overlap, but are not exclusive. Mouse
 *    motion events are generated for each of the tracking areas
 *    intersected by the mouse. Mouse tracking regions are initially
 *    enabled. You can explicitly disable a mouse tracking area to
 *    prevent mouse-enter/exit events from being generated. Unlike
 *    global mouse-moved events, mouse-enter and mouse-exit events are
 *    generated while your app is in the background. If this is not
 *    considered desirable, disable the tracking areas while the
 *    application is in the background. MouseTrackingRefs become
 *    invalid when the window that they are bound to is disposed of.
 }
type MouseTrackingRef = ^UInt32; // Opaque


{
 *  MouseTrackingOptions
 *
 *  Discussion:
 *    These values define how the userÕs region is handled by the Mouse
 *    Tracking Region API. They define the behavior throughout the life
 *    of the Mouse Tracking Region. For example, if a region is created
 *    with the option of kMouseTrackingOptionsGlobalClip then all
 *    operations on this region will be interpreted in global
 *    coordinates and will be clipped to the owning windowÕs structure.
 }
type MouseTrackingOptions = UInt32;
const
    {
   * The region is expected in local coordinates and mouse movement
   * tracking is clipped to the owning windowÕs content region.
   }
  kMouseTrackingOptionsLocalClip = 0;

  {
   * The region is expected in global coordinates and mouse movement
   * tracking is clipped to the owning windowÕs structure region.
   }
  kMouseTrackingOptionsGlobalClip = 1;

  {
   * Standard options. The region will be handled in local coordinates
   * and remain clipped against the windows content region.
   }
  kMouseTrackingOptionsStandard = kMouseTrackingOptionsLocalClip;

type MouseTrackingRegionID = record
    signature: OSType;
    id: SInt32;
  end;

{ Creation}

{
 *  CreateMouseTrackingRegion()
 *
 *  Discussion:
 *    Creates a mouse tracking region and installs it into the window
 *    system.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inWindow:
 *      The window that will contain the created region.
 *
 *    inRegion:
 *      The region for which you will receive entered/exit events.
 *
 *    inClip:
 *      A region to clip inRegion against (can be NULL).
 *
 *    inOptions:
 *      The options which define whether inRegion is given in global or
 *      local coordinates.
 *
 *    inID:
 *      The signature/id pair which uniquely defines this region.
 *
 *    inRefCon:
 *      Any user defined value.
 *
 *    inTargetToNotify:
 *      The event target that should receive kEventMouseEntered/Exited
 *      events for this tracking region. If NULL, the windowÕs event
 *      target receives these events.
 *
 *    outTrackingRef:
 *      A reference to the newly created mouse tracking region.
 *
 *  Result:
 *    An operating system status code.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
function CreateMouseTrackingRegion( inWindow: WindowRef; inRegion: RgnHandle; inClip: RgnHandle; inOptions: MouseTrackingOptions; inID: MouseTrackingRegionID; inRefCon: UnivPtr; inTargetToNotify: EventTargetRef; var outTrackingRef: MouseTrackingRef ): OSStatus; external name '_CreateMouseTrackingRegion';



{
 *  RetainMouseTrackingRegion()
 *
 *  Discussion:
 *    Retains the MouseTrackingRef.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inMouseRef:
 *      A valid MouseTrackingRef to retain.
 *
 *  Result:
 *    An operating system status code.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
function RetainMouseTrackingRegion( inMouseRef: MouseTrackingRef ): OSStatus; external name '_RetainMouseTrackingRegion';



{
 *  ReleaseMouseTrackingRegion()
 *
 *  Discussion:
 *    Releases the MouseTrackingRef. Since mouse tracking regions are
 *    bound to a window, they are automatically released when the
 *    window is disposed of.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inMouseRef:
 *      A valid MouseTrackingRef to release.
 *
 *  Result:
 *    An operating system status code.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
function ReleaseMouseTrackingRegion( inMouseRef: MouseTrackingRef ): OSStatus; external name '_ReleaseMouseTrackingRegion';



{
 *  ChangeMouseTrackingRegion()
 *
 *  Discussion:
 *    Changes the MouseTrackingRefs region and optionally, its clip.
 *    This will not change the enabled state or options of the region.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inMouseRef:
 *      A valid MouseTrackingRef to modify.
 *
 *    inRegion:
 *      The region to set as the mouse tracking region.
 *
 *    inClip:
 *      An optional clip to clip inRegion against (may be NULL).
 *
 *  Result:
 *    An operating system status code.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
function ChangeMouseTrackingRegion( inMouseRef: MouseTrackingRef; inRegion: RgnHandle; inClip: RgnHandle ): OSStatus; external name '_ChangeMouseTrackingRegion';



{
 *  ClipMouseTrackingRegion()
 *
 *  Discussion:
 *    Adjust the region to clip the MouseTrackingRef against. This can
 *    be used in the case where a window is resized or when a
 *    previously obscured region becomes exposed.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inMouseRef:
 *      A valid MouseTrackingRef to adjust.
 *
 *    inRegion:
 *      A new region to clip inMouseRef against (can be NULL). If NULL,
 *      standard clipping will be provided.
 *
 *  Result:
 *    An operating system status code.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
function ClipMouseTrackingRegion( inMouseRef: MouseTrackingRef; inRegion: RgnHandle ): OSStatus; external name '_ClipMouseTrackingRegion';


{ Accessors}

{
 *  GetMouseTrackingRegionID()
 *
 *  Discussion:
 *    Retrieves the MouseTrackingRegionID of the given
 *    MouseTrackingRef. Can be used to determine if the region belongs
 *    to your app, and if so, which region it is.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inMouseRef:
 *      A valid MouseTrackingRef from which to obtain the
 *      MouseTrackingRegionID.
 *
 *    outID:
 *      Receives the MouseTrackingRegionID.
 *
 *  Result:
 *    An operating system status code.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
function GetMouseTrackingRegionID( inMouseRef: MouseTrackingRef; var outID: MouseTrackingRegionID ): OSStatus; external name '_GetMouseTrackingRegionID';



{
 *  GetMouseTrackingRegionRefCon()
 *
 *  Discussion:
 *    Retrieves the RefCon from the given mouse tracking region.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inMouseRef:
 *      A valid MouseTrackingRef from which to obtain the refcon.
 *
 *    outRefCon:
 *      Receives the refcon.
 *
 *  Result:
 *    An operating system status code.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
function GetMouseTrackingRegionRefCon( inMouseRef: MouseTrackingRef; var outRefCon: UnivPtr ): OSStatus; external name '_GetMouseTrackingRegionRefCon';



{ Geometry}

{
 *  MoveMouseTrackingRegion()
 *
 *  Discussion:
 *    Moves the given mouse tracking region by the specified delta. It
 *    can also optionally reclip the region, such as if the region is
 *    scrolled within a pane.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inMouseRef:
 *      A valid MouseTrackingRef to move.
 *
 *    deltaH:
 *      The horizontal delta to move the MouseTrackingRef.
 *
 *    deltaV:
 *      The vertical delta to move the MouseTrackingRef.
 *
 *    inClip:
 *      A region to optionally clip against (can be NULL).
 *
 *  Result:
 *    An operating system status code.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
function MoveMouseTrackingRegion( inMouseRef: MouseTrackingRef; deltaH: SInt16; deltaV: SInt16; inClip: RgnHandle ): OSStatus; external name '_MoveMouseTrackingRegion';



{ Enable/disable}

{
 *  SetMouseTrackingRegionEnabled()
 *
 *  Discussion:
 *    Set the enabled state of the mouse tracking region
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inMouseRef:
 *      A valid MouseTrackingRef to modify.
 *
 *    inEnabled:
 *      Indicate whether this region should be enabled (true) or
 *      disabled (false).
 *
 *  Result:
 *    An operating system status code.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
function SetMouseTrackingRegionEnabled( inMouseRef: MouseTrackingRef; inEnabled: Boolean ): OSStatus; external name '_SetMouseTrackingRegionEnabled';



{

   Namespace operators
}

{
 *  ClipWindowMouseTrackingRegions()
 *
 *  Discussion:
 *    Bulk clip operation to modify the region that all mouse tracking
 *    regions with the given signature will be clipped against.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inWindow:
 *      The window that contains the regions with the given signature
 *      that you are interested in updating.
 *
 *    inSignature:
 *      The signature of the mouse tracking regions that will be
 *      reclipped.
 *
 *    inClip:
 *      The region to clip all of the regions against (can be NULL). If
 *      NULL, standard clipping will be provided.
 *
 *  Result:
 *    An operating system status code.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
function ClipWindowMouseTrackingRegions( inWindow: WindowRef; inSignature: OSType; inClip: RgnHandle ): OSStatus; external name '_ClipWindowMouseTrackingRegions';



{
 *  MoveWindowMouseTrackingRegions()
 *
 *  Discussion:
 *    Bulk move operation to move all regions with the given signature
 *    the specified delta. An optional clip can be provided to reclip
 *    the regions against, such as in the case of the regions are being
 *    scrolled within a pane.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inWindow:
 *      The window that contains the regions with the given signature
 *      that you are interested in moving.
 *
 *    inSignature:
 *      The signature of the mouse tracking regions that will be moved.
 *
 *    deltaH:
 *      The horizontal delta to move all of the regions.
 *
 *    deltaV:
 *      The vertical delta to move all of the regions.
 *
 *    inClip:
 *      An optional clipping region to clip against (can be NULL). If
 *      NULL, standard clipping will be provided.
 *
 *  Result:
 *    An operating system status code.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
function MoveWindowMouseTrackingRegions( inWindow: WindowRef; inSignature: OSType; deltaH: SInt16; deltaV: SInt16; inClip: RgnHandle ): OSStatus; external name '_MoveWindowMouseTrackingRegions';



{
 *  SetWindowMouseTrackingRegionsEnabled()
 *
 *  Discussion:
 *    Bulk set the enabled state of the mouse tracking regions of the
 *    given signature belonging to the given window.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inWindow:
 *      The window which contains the mouse tracking regions that you
 *      are interested in modifying.
 *
 *    inSignature:
 *      The signature of the mouse tracking regions whose enabled state
 *      you wish to modify.
 *
 *    inEnabled:
 *      Indicates whether the regions should be enabled (true) or
 *      disabled (false).
 *
 *  Result:
 *    An operating system status code.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
function SetWindowMouseTrackingRegionsEnabled( inWindow: WindowRef; inSignature: OSType; inEnabled: Boolean ): OSStatus; external name '_SetWindowMouseTrackingRegionsEnabled';



{
 *  ReleaseWindowMouseTrackingRegions()
 *
 *  Discussion:
 *    Bulk release the mouse tracking regions with the given signature.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inWindow:
 *      The window to which the regions to be released belong.
 *
 *    inSignature:
 *      The signature of the regions to be released.
 *
 *  Result:
 *    An operating system status code.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
function ReleaseWindowMouseTrackingRegions( inWindow: WindowRef; inSignature: OSType ): OSStatus; external name '_ReleaseWindowMouseTrackingRegions';




{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{  Ink Events                                                                          }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
const
    kEventParamInkTextRef         = $69777264 (* 'iwrd' *); { typePtr }
  kEventParamInkKeyboardShortcut = $696B6264 (* 'ikbd' *); { typeBoolean }
  kEventParamInkGestureKind     = $676B6E64 (* 'gknd' *); { typeUInt32 }
  kEventParamInkGestureBounds   = $67626E64 (* 'gbnd' *); { typeHIRect }
  kEventParamInkGestureHotspot  = $67686F74 (* 'ghot' *); { typeHIPoint }



{
 *  kEventClassInk / kEventInkPoint
 *
 *  Summary:
 *    A mouse event will be handled as an Ink point and used for
 *    recognition.
 *
 *  Discussion:
 *    The Ink manager has determined that the mouse event in
 *    kEventParamEventRef should be used for recognition.  If the
 *    application handles the event and returns noErr, then the Ink
 *    Manager does nothing further with the mouse event.  If the
 *    application returns any other value (including
 *    eventNotHandledErr), the point will be processed normally by the
 *    Ink Manager.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamEventRef (in, typeEventRef)
 *          The mouse event being handled.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const kEventInkPoint                = 10;


{
 *  kEventClassInk / kEventInkGesture
 *
 *  Summary:
 *    An Ink gesture has been generated.
 *
 *  Discussion:
 *    This Ink event is sent when the Ink Manager has recognized the
 *    current ink phrase as one of the known system gestures.
 *    Applications can install a handler for these events, to provide
 *    targeted gestures and support for context-dependent (tentative)
 *    gestures.  Applications should return noErr if they handled the
 *    gesture.  If the gesture was context-dependent and does not apply
 *    to the current situation, then return eventNotHandledErr.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamInkGestureKind (in, typeUInt32)
 *          Kind of gesture.
 *
 *    --> kEventParamInkGestureBounds (in, typeHIRect)
 *          Bounds of the gesture in global coordinates.
 *
 *    --> kEventParamInkGestureHotspot (in, typeHIPoint)
 *          Hotspot for the gesture in global coordinates.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const kEventInkGesture              = 11;



{
 *  kEventClassInk / kEventInkText
 *
 *  Summary:
 *    A recognized word from the Ink Manager.
 *
 *  Discussion:
 *    The Ink Manager has recognized a word.  kEventParamInkTextRef
 *    contains the InkTextRef with all of the information about the
 *    word.  See Ink.h for more information.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamInkTextRef (in, typePtr)
 *          The InkTextRef containing the data for the recognized word.
 *
 *    --> kEventParamInkKeyboardShortcut (in, typeBoolean)
 *          Is this likely a keyboard shortcut? (Command or Control key
 *          is held down and the top-choice alternate text is a single
 *          character.)
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const kEventInkText                 = 12;


(*
 *  CopyEventAs()
 *
 *  Summary:
 *    Copies an existing event, allowing you to change the class and
 *    kind of the event.
 *
 *  Discussion:
 *    CopyEventAs may be useful during event flow and transformation.
 *    For example, this API is used when upgrading a raw mouse down to
 *    a window click event, to ensure that the window click event has
 *    exactly the same parameters as the original mouse down event.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inAllocator:
 *      The CFAllocator to use to allocate the event data. You can pass
 *      NULL or kCFAllocatorDefault to use the standard allocator.
 *
 *    inOther:
 *      The original event to copy.
 *
 *    inEventClass:
 *      The new event class for the copy of the event.
 *
 *    inEventKind:
 *      The new event kind for the copy of the event.
 *
 *  Result:
 *    The newly created event, or NULL if either the input event was
 *    NULL or the memory for the event could not be allocated.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
 *    Non-Carbon CFM:   not available
 *)

 // AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER;
 function CopyEventAs( inAllocator: CFAllocatorRef; (* can be NULL *) inOther: EventRef; inEventClass: UInt32; inEventKind: UInt32 ): EventRef; external name '_CopyEventAs';

  (*
   * Currently, the only value you can pass to
   * AcquireFirstMatchingEventInQueue in its inOptions parameter.
   *)
const  kEventQueueOptionsNone        = 0;

(*
 *  AcquireFirstMatchingEventInQueue()
 *
 *  Discussion:
 *    Returns the first event that matches the list of event classes
 *    and kinds passed in. This call does not call the event loop, and
 *    hence no timers will fire nor will any window flushing occur when
 *    this API is called. New events will be pulled from the window
 *    server, however. Overall this API should have better performance
 *    characteristics than the older EventAvail API.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inQueue:
 *      The queue to check.
 *
 *    inNumTypes:
 *      The number of event kinds to search for. You may pass zero for
 *      this parameter if you also pass NULL for inList.
 *
 *    inList:
 *      The list of event classes and kinds to search for in the queue.
 *      You may pass NULL for this parameter if you also pass zero for
 *      inNumTypes. This effectively matches ANY event in the queue,
 *      and will merely return the first event in the queue.
 *
 *    inOptions:
 *      Currently, you must pass kEventQueueOptionsNone for this
 *      parameter.
 *
 *  Result:
 *    An event reference, or NULL if no events match the list passed.
 *    The event returned has had its refcount incremented (i.e. it has
 *    been retained). As a result, you must release this value
 *    (assuming it's non-NULL). The event is not removed from the queue
 *    by this API; you should call RemoveEventFromQueue if necessary.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
 *    Non-Carbon CFM:   not available
 *)
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function AcquireFirstMatchingEventInQueue( inQueue: EventQueueRef; inNumTypes: UInt32; const inList: EventTypeSpec; inOptions: OptionBits ): EventRef; external name '_AcquireFirstMatchingEventInQueue';


(*ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ*)
(*  Queue-synchronized event state                                                      *)
(*ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ*)
(*
 *  GetCurrentEvent()
 *
 *  Summary:
 *    Returns the user input event currently being handled.
 *
 *  Discussion:
 *    When an event with kEventAttributeUserEvent is dispatched by the
 *    event dispatcher target, it is recorded internally by the Event
 *    Manager. At any time during the handling of that event,
 *    GetCurrentEvent may be used to retrieve the original EventRef.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Result:
 *    The user input (mouse or keyboard) event currently being handled.
 *    May be NULL if no event is currently being handled, or if the
 *    current event was not a user input event. The returned event is
 *    not retained, and its lifetime should be considered to be no
 *    longer than the current function; if you need to keep the event
 *    alive past that time, you should retain it.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
 *    Non-Carbon CFM:   not available
 *)
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
function GetCurrentEvent: EventRef; external name '_GetCurrentEvent';


(*
 *  GetCurrentEventButtonState()
 *
 *  Summary:
 *    Returns the current queue-synchronized mouse button state on the
 *    primary input device.
 *
 *  Discussion:
 *    At any point in the handling of user input, there are two
 *    different mouse button states: the queue-synchronized state and
 *    the hardware state. The hardware state reflects the actual
 *    current state of the mouse attached to the user's machine. The
 *    queue-synchronized state reflects the state according to the
 *    events that have been processed at that point by the application.
 *    These two states may be different if there are unprocessed events
 *    in the event queue, or if events are being artificially
 *    introduced into the event queue from an outside source.
 *    GetCurrentEventButtonState returns the queue-synchronized button
 *    state. It is generally better to use this API than to use the
 *    Button function or the GetCurrentButtonState function (which
 *    return the hardware state). This gives a more consistent user
 *    experience when the user input queue is being remoted controlled
 *    or manipulated via non-hardware event sources such as speech or
 *    AppleEvents; using GetCurrentEventButtonState is also much faster
 *    than using Button or GetCurrentButtonState.
 *
 *    Note that GetCurrentEventButtonState only returns a valid button
 *    state if your application is the active application. If your
 *    application is not active, then user input events are not flowing
 *    through the event dispatcher and the queue-synchronized state is
 *    not updated.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Result:
 *    The queue-synchronized state of the mouse buttons. Bit zero
 *    indicates the state of the primary button, bit one the state of
 *    the secondary button, and so on.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
 *    Non-Carbon CFM:   not available
 *)
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
function GetCurrentEventButtonState: UInt32; external name '_GetCurrentEventButtonState';

(*
 *  GetCurrentEventKeyModifiers()
 *
 *  Summary:
 *    Returns the current queue-synchronized keyboard modifier state.
 *
 *  Discussion:
 *    At any point in the handling of user input, there are two
 *    different keyboard modifier states: the queue-synchronized state
 *    and the hardware state. The hardware state reflects the actual
 *    current state of the keyboard attached to the user's machine. The
 *    queue-synchronized state reflects the state according to the
 *    events that have been processed at that point by the application.
 *    These two states may be different if there are unprocessed events
 *    in the event queue, or if events are being artificially
 *    introduced into the event queue from an outside source.
 *    GetCurrentEventKeyModifiers returns the queue-synchronized
 *    modifier state. It is generally better to use this API than to
 *    use the GetCurrentKeyModifiers API (which returns the hardware
 *    state). This gives a more consistent user experience when the
 *    user input queue is being remoted controlled or manipulated via
 *    non-hardware event sources such as speech or AppleEvents; using
 *    GetCurrentEventKeyModifiers is also much faster than using
 *    EventAvail(0, &eventRecord) or GetCurrentKeyModifiers.
 *
 *    Note that GetCurrentEventKeyModifiers only returns a valid
 *    modifier state if your application is the active application. If
 *    your application is not active, then user input events are not
 *    flowing through the event dispatcher and the queue-synchronized
 *    state is not updated.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Result:
 *    The queue-synchronized state of the keyboard modifiers. The
 *    format of the return value is the same as the modifiers field of
 *    an EventRecord (but only includes keyboard modifiers and not the
 *    other modifier flags included in an EventRecord).
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
 *    Non-Carbon CFM:   not available
 *)
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
function GetCurrentEventKeyModifiers: UInt32; external name '_GetCurrentEventKeyModifiers';

(*ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ*)
(*  Multiple-button support                                                             *)
(*ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ*)
(*
 *  GetCurrentButtonState()
 *
 *  Summary:
 *    Returns the current hardware mouse button state on the primary
 *    input device.
 *
 *  Discussion:
 *    In most cases, you should not use GetCurrentButtonState, but
 *    should use the GetCurrentEventButtonState function instead.
 *    GetCurrentEventButtonState is much faster than
 *    GetCurrentButtonState because it returns the locally cached
 *    button state; GetCurrentButtonState must get the mouse button
 *    state from the window server, which is slower. Using
 *    GetCurrentButtonState also can prevent your application from
 *    being operated by remote posting of events, since the hardware
 *    input device is not actually changing state in that case. Most
 *    commonly, you might need to use GetCurrentButtonState when your
 *    application is not the active application (as determined by the
 *    Process Manager function GetFrontProcess). In that case, the
 *    cached button state returned by GetCurrentEventButtonState is not
 *    valid because mouse button events are not flowing to your
 *    application, and you must use GetCurrentButtonState to determine
 *    the current hardware state.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Result:
 *    The state of the mouse buttons on the mouse hardware. Bit zero
 *    indicates the state of the primary button, bit one the state of
 *    the secondary button, and so on.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
 *    Non-Carbon CFM:   not available
 *)
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
function GetCurrentButtonState: UInt32; external name '_GetCurrentButtonState';

(*
 *  Discussion:
 *    Event Loop Idle Timer Messages
 *)
  (*
   * The user has gone idle (not touched an input device) for the
   * duration specified in your idle timer. This is the first message
   * you will receive. Start your engines!
   *)
const  kEventLoopIdleTimerStarted    = 1;

  (*
   * If you specified an interval on your idle timer, your idle timer
   * proc will be called with this message, letting you know it is
   * merely firing at the interval specified. You will receive this
   * message for the first time at the specified interval after you
   * receive kEventLoopIdleTimerStarted. If you did not specify an
   * interval, this message is not sent.
   *)
const   kEventLoopIdleTimerIdling     = 2;

  (*
   * The user is back! Stop everything! This is your cue to stop any
   * processing if you need to.
   *)
const  kEventLoopIdleTimerStopped    = 3;

type EventLoopIdleTimerMessage = UInt16;

(*
 *  EventLoopIdleTimerProcPtr
 *
 *  Discussion:
 *    Called when an idle timer fires.
 *
 *  Parameters:
 *
 *    inTimer:
 *      The timer that fired.
 *
 *    inState:
 *      The current state of the timer.
 *
 *    inUserData:
 *      The data passed into InstallEventLoopTimer.
 *)
type EventLoopIdleTimerProcPtr = procedure( inTimer: EventLoopTimerRef; inStat: EventLoopIdleTimerMessage; inUserData: UnivPtr );

type EventLoopIdleTimerUPP = ^UInt32;

(*
 *  NewEventLoopIdleTimerUPP()
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
 *    Non-Carbon CFM:   available as macro/inline
 *)
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
function NewEventLoopIdleTimerUPP( userRoutine: EventLoopIdleTimerProcPtr ): EventLoopIdleTimerUPP; external name '_NewEventLoopIdleTimerUPP';

(*
 *  DisposeEventLoopIdleTimerUPP()
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
 *    Non-Carbon CFM:   available as macro/inline
 *)
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
procedure DisposeEventLoopIdleTimerUPP( userUPP: EventLoopIdleTimerUPP ); external name '_DisposeEventLoopIdleTimerUPP';

(*
 *  InvokeEventLoopIdleTimerUPP()
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
 *    Non-Carbon CFM:   available as macro/inline
 *)
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
procedure InvokeEventLoopIdleTimerUPP( inTimer: EventLoopTimerRef; inState: EventLoopIdleTimerMessage; inUserData: UnivPtr; userUPP: EventLoopIdleTimerUPP ); external name '_InvokeEventLoopIdleTimerUPP';

(*
 *  InstallEventLoopIdleTimer()
 *
 *  Discussion:
 *    Installs a timer onto the event loop specified. Idle timers are
 *    only called when there is no user activity occuring in the
 *    application. This means that the user is not actively
 *    clicking/typing, and is also not in the middle of tracking a
 *    control, menu, or window. TrackMouseLocation actually disables
 *    all idle timers automatically for you.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inEventLoop:
 *      The event loop to add the timer.
 *
 *    inDelay:
 *      The delay before firing this timer after a user input event has
 *      come in. For example, if you want to start your timer 2 seconds
 *      after the user stops typing, etc. you would pass 2.0 into this
 *      parameter. Each time the user types a key (or whatever), this
 *      timer is reset. If we are considered to be idle when an idle
 *      timer is installed, the first time it fires will be inDelay
 *      seconds from the time it is installed. So if you installed it
 *      in the middle of control tracking, say, it wouldn't fire until
 *      the user stopped tracking. But if you installed it at app
 *      startup and the user hasn't typed/clicked, it would fire in
 *      inDelay seconds.
 *
 *    inInterval:
 *      The timer interval (pass 0 for a one-shot timer, which executes
 *      once but does not repeat). You may also pass
 *      kEventDurationForever to create a one-shot timer.
 *
 *    inTimerProc:
 *      The routine to call when the timer fires.
 *
 *    inTimerData:
 *      Data to pass to the timer proc when called.
 *
 *    outTimer:
 *      A reference to the newly installed timer.
 *
 *  Result:
 *    An operating system status code.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
 *    Non-Carbon CFM:   not available
 *)
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
function InstallEventLoopIdleTimer( inEventLoop: EventLoopRef; inDelay: EventTimerInterval; inInterval: EventTimerInterval; inTimerProc: EventLoopIdleTimerUPP; inTimerData: UnivPtr; var outTimer: EventLoopTimerRef ): OSStatus; external name '_InstallEventLoopIdleTimer';

(*
 *  Discussion:
 *    EventTarget Send Options
 *)

  (*
   * The event should be sent to the target given only, and should not
   * propagate to any other target. CallNextEventHandler will do
   * nothing in a handler which has received an event sent in this
   * manner.
   *)
const  kEventTargetDontPropagate     = (1 shl 0);

  (*
   * The event is a notification-style event, and should be received by
   * all handlers. The result is usually meaningless when sent in this
   * manner, though we do maintain the strongest result code while the
   * event falls through each handler. This means that if the first
   * handler to receive the event returned noErr, and the next returned
   * eventNotHandledErr, the result returned would actually be noErr.
   * No handler can stop this event from propagating, i.e. the result
   * code does not alter event flow.
   *)
const  kEventTargetSendToAllHandlers = (1 shl 1);


(*
 *  SendEventToEventTargetWithOptions()
 *
 *  Discussion:
 *    Sends an event to the specified event target, optionally
 *    controlling how the event propagates. See the discussion of the
 *    event send options above for more detail.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inEvent:
 *      The event to send.
 *
 *    inTarget:
 *      The target to send it to.
 *
 *    inOptions:
 *      The options to modify the send behavior. Passing zero for this
 *      makes it behave just like SendEventToEventTarget.
 *
 *  Result:
 *    An operating system result code.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
 *    Non-Carbon CFM:   not available
 *)
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
function SendEventToEventTargetWithOptions( inEvent: EventRef; inTarget: EventTargetRef; inOptions: OptionBits ): OSStatus; external name '_SendEventToEventTargetWithOptions';

(*ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ*)
(*  ¥ Secure Event Input                                                                *)
(*ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ*)
(*
 *  EnableSecureEventInput()
 *
 *  Summary:
 *    Enables secure event input mode.
 *
 *  Discussion:
 *    When secure event input is enabled, keyboard input will only go
 *    to the application with keyboard focus, and will not be echoed to
 *    other applications that might be using the event monitor target
 *    to watch keyboard input. The EditText and EditUnicodeText
 *    controls automatically enter secure input mode when a password
 *    control has the focus; if your application implements its own
 *    password entry, you should enable secure event input while the
 *    user is entering text.
 *
 *    This API maintains a count of the number of times that it has
 *    been called. Secure event input is not disabled until
 *    DisableSecureEventInput has been called the same number of
 *    times.
 *
 *    Be sure to disable secure event input if your application becomes
 *    inactive. If your application crashes, secure event input will
 *    automatically be disabled if no other application has enabled it.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
 *    Non-Carbon CFM:   not available
 *)
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function EnableSecureEventInput: OSStatus; external name '_EnableSecureEventInput';


(*
 *  DisableSecureEventInput()
 *
 *  Summary:
 *    Disables secure event input mode.
 *
 *  Discussion:
 *    When secure event input is enabled, keyboard input will only go
 *    to the application with keyboard focus, and will not be echoed to
 *    other applications that might be using the event monitor target
 *    to watch keyboard input. The EditText and EditUnicodeText
 *    controls automatically enter secure input mode when a password
 *    control has the focus; if your application implements its own
 *    password entry, you should enable secure event input while the
 *    user is entering text.
 *
 *    The EnableSecureEventInput API maintains a count of the number of
 *    times that it has been called. Secure event input is not disabled
 *    until this API has been called the same number of times.
 *
 *    Be sure to disable secure event input if your application becomes
 *    inactive. If your application crashes, secure event input will
 *    automatically be disabled if no other application has enabled it.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
 *    Non-Carbon CFM:   not available
 *)
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function DisableSecureEventInput: OSStatus; external name '_DisableSecureEventInput';

(*
 *  IsSecureEventInputEnabled()
 *
 *  Summary:
 *    Indicates whether secure event input is currently enabled.
 *
 *  Discussion:
 *    This API returns whether secure event input is enabled by any
 *    process, not just the current process. Secure event input may be
 *    disabled in the current process but enabled in some other
 *    process; in that case, this API will return true.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
 *    Non-Carbon CFM:   not available
 *)
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function IsSecureEventInputEnabled: Boolean; external name '_IsSecureEventInputEnabled';


{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{ Obsolete constant names - use the new ones. Will be removed.                         }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
const kEventWindowDefDrawFrame      = kEventWindowDrawFrame;
  kEventWindowDefDrawPart       = kEventWindowDrawPart;
  kEventWindowDefGetRegion      = kEventWindowGetRegion;
  kEventWindowDefHitTest        = kEventWindowHitTest;
  kEventWindowDefInit           = kEventWindowInit;
  kEventWindowDefDispose        = kEventWindowDispose;
  kEventWindowDefDragHilite     = kEventWindowDragHilite;
  kEventWindowDefModified       = kEventWindowModified;
  kEventWindowDefSetupProxyDragImage = kEventWindowSetupProxyDragImage;
  kEventWindowDefStateChanged   = kEventWindowStateChanged;
  kEventWindowDefMeasureTitle   = kEventWindowMeasureTitle;
  kEventWindowDefDrawGrowBox    = kEventWindowDrawGrowBox;
  kEventWindowDefGetGrowImageRegion = kEventWindowGetGrowImageRegion;


const kEventClassEPPC               = kEventClassAppleEvent;
  kEventHighLevelEvent          = kEventAppleEvent;

const kEventUpdateActiveInputArea   = kEventTextInputUpdateActiveInputArea;
  kEventUnicodeForKeyEvent      = kEventTextInputUnicodeForKeyEvent;
  kEventOffsetToPos             = kEventTextInputOffsetToPos;
  kEventPosToOffset             = kEventTextInputPosToOffset;
  kEventShowHideBottomWindow    = kEventTextInputShowHideBottomWindow;
  kEventGetSelectedText         = kEventTextInputGetSelectedText;

const kEventProcessCommand          = kEventCommandProcess;
  kEventTabletPointer           = kEventTabletPoint;

{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{ Obsolete typedefs. Will be removed eventually.                                       }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}

type EventClassID = UInt32;
type EventClass = UInt32;
type EventType = UInt32;
{ OBSOLETE CONSTANTS}


const kMouseTrackingMousePressed    = kMouseTrackingMouseDown;
  kMouseTrackingMouseReleased   = kMouseTrackingMouseUp;

const kEventControlGetSubviewForMouseEvent = kEventControlInterceptSubviewClick;

{$ALIGN MAC68K}
{#POP}
{unit FinderRegistry}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}


{
  //////////////////////////////////////
   Finder Suite
  //////////////////////////////////////
}

{
   The old Finder Event suite was 'FNDR'
   The new suite is 'fndr'
}

const
    kAEFinderSuite              = $666E6472 (* 'fndr' *);

    {
      //////////////////////////////////////
       Finder Events
      //////////////////////////////////////
    }
    kAECleanUp                  = $66636C75 (* 'fclu' *);
    kAEEject                    = $656A6374 (* 'ejct' *);
    kAEEmpty                    = $656D7074 (* 'empt' *);
    kAEErase                    = $66657261 (* 'fera' *);
    kAEGestalt                  = $6773746C (* 'gstl' *);
    kAEPutAway                  = $70747779 (* 'ptwy' *);
    kAERebuildDesktopDB         = $72646462 (* 'rddb' *);
    kAESync                     = $66757064 (* 'fupd' *);
    kAEInterceptOpen            = $666F706E (* 'fopn' *);

    {  "Sort" from the database suite: }
    kAEDatabaseSuite            = $44415441 (* 'DATA' *);
    kAESort                     = $534F5254 (* 'SORT' *);

    {
      ////////////////////////////////////////////////////////////////////////
       Classes
       Note: all classes are defined up front so that the property definitions
       can reference classes.
      ////////////////////////////////////////////////////////////////////////
    }

    cInternalFinderObject       = $6F626A20 (* 'obj ' *);                       {  cReference - used to distinguish objects used inside the Finder only }

    {
       Main Finder class definitions
       Indentation implies object model hierarchy
    }
                                                                {  We do not use class cItem from AERegistry.r. Instead our class Item is a cObject }
                                                                {          cItem                        = 'citm',   // defined in AERegistry.r }
                                                                {           cFile                    = 'file',  // defined in AERegistry.r }
    cAliasFile                  = $616C6961 (* 'alia' *);
    cApplicationFile            = $61707066 (* 'appf' *);
    cControlPanelFile           = $63636476 (* 'ccdv' *);
    cDeskAccessoryFile          = $64616669 (* 'dafi' *);
    cDocumentFile               = $646F6366 (* 'docf' *);
    cFontFile                   = $666E7466 (* 'fntf' *);
    cSoundFile                  = $736E6466 (* 'sndf' *);
    cClippingFile               = $636C7066 (* 'clpf' *);
    cContainer                  = $63746E72 (* 'ctnr' *);
    cDesktop                    = $6364736B (* 'cdsk' *);
    cSharableContainer          = $73637472 (* 'sctr' *);
    cDisk                       = $63646973 (* 'cdis' *);
    cFolder                     = $63666F6C (* 'cfol' *);
    cSuitcase                   = $73746373 (* 'stcs' *);
    cAccessorySuitcase          = $64737574 (* 'dsut' *);
    cFontSuitcase               = $66737574 (* 'fsut' *);
    cTrash                      = $63747273 (* 'ctrs' *);
    cDesktopPrinter             = $64736B70 (* 'dskp' *);
    cPackage                    = $7061636B (* 'pack' *);
    cContentSpace               = $64776E64 (* 'dwnd' *);                       {           cWindow                    = 'cwin',       // defined in AERegistry.r }
    cContainerWindow            = $63776E64 (* 'cwnd' *);
    cInfoWindow                 = $69776E64 (* 'iwnd' *);
    cSharingWindow              = $73776E64 (* 'swnd' *);
    cStatusWindow               = $71776E64 (* 'qwnd' *);
    cClippingWindow             = $6C776E64 (* 'lwnd' *);
    cPreferencesWindow          = $70776E64 (* 'pwnd' *);
    cDTPWindow                  = $64747077 (* 'dtpw' *);
    cProcess                    = $70726373 (* 'prcs' *);
    cAccessoryProcess           = $70636461 (* 'pcda' *);
    cApplicationProcess         = $70636170 (* 'pcap' *);
    cGroup                      = $73677270 (* 'sgrp' *);
    cUser                       = $63757365 (* 'cuse' *);                       {          cApplication                  = 'capp',     // defined in AERegistry.r }
    cSharingPrivileges          = $70726976 (* 'priv' *);
    cPreferences                = $63707266 (* 'cprf' *);
    cLabel                      = $636C626C (* 'clbl' *);
    cSound                      = $736E6420 (* 'snd ' *);
    cAliasList                  = $616C7374 (* 'alst' *);
    cSpecialFolders             = $7370666C (* 'spfl' *);                       {  For use by viewer search engines: }
    cOnlineDisk                 = $636F6473 (* 'cods' *);
    cOnlineLocalDisk            = $636C6473 (* 'clds' *);
    cOnlineRemoteDisk           = $63726473 (* 'crds' *);                       {  Miscellaneous class definitions }
    cEntireContents             = $65637473 (* 'ects' *);
    cIconFamily                 = $6966616D (* 'ifam' *);


    {
      //////////////////////////////////////
       Properties
      //////////////////////////////////////
    }

    {  Properties of class cItem (really cObject) }
                                                                {     pBounds                        = 'pbnd',       // defined in AERegistry.r }
    pComment                    = $636F6D74 (* 'comt' *);
    pContainer                  = $63746E72 (* 'ctnr' *);
    pContentSpace               = $64776E64 (* 'dwnd' *);
    pCreationDateOld            = $63727464 (* 'crtd' *);                       {  to support pre-Finder 8 scripts }
    pCreationDate               = $61736364 (* 'ascd' *);                       {  from File Commands OSAX }
    pDescription                = $64736372 (* 'dscr' *);
    pDisk                       = $63646973 (* 'cdis' *);
    pFolderOld                  = $63666F6C (* 'cfol' *);                       {  to support pre-Finder 8 scripts }
    pFolder                     = $61736472 (* 'asdr' *);                       {  from File Commands OSAX }
    pIconBitmap                 = $69696D67 (* 'iimg' *);                       {     pID                           = 'ID  ',        // defined in AERegistry.r }
    pInfoWindow                 = $69776E64 (* 'iwnd' *);
    pKind                       = $6B696E64 (* 'kind' *);
    pLabelIndex                 = $6C616269 (* 'labi' *);
    pModificationDateOld        = $6D6F6464 (* 'modd' *);                       {  to support pre-Finder 8 scripts }
    pModificationDate           = $61736D6F (* 'asmo' *);                       {  from File Commands OSAX }
                                                                {     pName                      = 'pnam',         // defined in AERegistry.r }
    pPhysicalSize               = $70687973 (* 'phys' *);
    pPosition                   = $706F736E (* 'posn' *);
    pIsSelected                 = $6973736C (* 'issl' *);
    pSize                       = $7074737A (* 'ptsz' *);                       {  pPointSize defined in AERegistry.r }
    pWindow                     = $6377696E (* 'cwin' *);
    pPreferencesWindow          = $70776E64 (* 'pwnd' *);


    {  Properties of class cFile (subclass of cItem) }
    pFileCreator                = $66637274 (* 'fcrt' *);
    pFileType                   = $61737479 (* 'asty' *);                       {  from File Commands OSAX }
    pFileTypeOld                = $66697470 (* 'fitp' *);                       {  to support pre-Finder 8 scripts }
    pIsLocked                   = $61736C6B (* 'aslk' *);                       {  from File Commands OSAX }
    pIsLockedOld                = $69736C6B (* 'islk' *);                       {  to support pre-Finder 8 scripts }
                                                                {     pIsStationeryPad               = 'pspd',         // defined in AERegistry.r                 }
                                                                {     pVersion                    = 'vers',       // defined in AERegistry.r }
    pProductVersion             = $76657232 (* 'ver2' *);


    {  Properties of class cAliasFile (subclass of cFile) }
    pOriginalItem               = $6F726967 (* 'orig' *);

    {  Properties of class cApplicationFile (subclass of cFile) }
    pMinAppPartition            = $6D707274 (* 'mprt' *);
    pAppPartition               = $61707074 (* 'appt' *);
    pSuggestedAppPartition      = $73707274 (* 'sprt' *);
    pIsScriptable               = $69736162 (* 'isab' *);

    {  Properties of class cURLFile (subclass of cFile) }
    pInternetLocation           = $696C6F63 (* 'iloc' *);

    {  Properties of class cSoundFile (subclass of cFile) }
    pSound                      = $736E6420 (* 'snd ' *);


    {
       Properties of class cControlPanel (Views CP only) (subclass of cFile)
       Note: the other view-like preference settings are not available in the Views
       control panel. These properties are only offered here for backward compatability.
       To set the full range of Finder Preferences, use the Preferences object.
    }
    pShowFolderSize             = $7366737A (* 'sfsz' *);                       {  Moved to a per-folder basis in Finder 8.0 HIS }
    pShowComment                = $73636F6D (* 'scom' *);                       {  Moved to a per-folder basis in Finder 8.0 HIS }
    pShowDate                   = $73646174 (* 'sdat' *);                       {  Moved to a per-folder basis in Finder 8.0 HIS }
    pShowCreationDate           = $73636461 (* 'scda' *);                       {  Moved to a per-folder basis in Finder 8.0 HIS }
    pShowKind                   = $736B6E64 (* 'sknd' *);                       {  Moved to a per-folder basis in Finder 8.0 HIS }
    pShowLabel                  = $736C626C (* 'slbl' *);                       {  Moved to a per-folder basis in Finder 8.0 HIS }
    pShowSize                   = $7373697A (* 'ssiz' *);                       {  Moved to a per-folder basis in Finder 8.0 HIS }
    pShowVersion                = $73767273 (* 'svrs' *);                       {  Moved to a per-folder basis in Finder 8.0 HIS }
    pSortDirection              = $736F7264 (* 'sord' *);
    pShowDiskInfo               = $7364696E (* 'sdin' *);                       {  Always on in Finder 8.0 HIS }
    pListViewIconSize           = $6C766973 (* 'lvis' *);                       {  Moved to a per-folder basis in Finder 8.0 HIS }
    pGridIcons                  = $66677264 (* 'fgrd' *);                       {  Moved to a per-folder basis in Finder 8.0 HIS }
    pStaggerIcons               = $66737467 (* 'fstg' *);                       {  No longer part of the Finder 8.0 HIS }
    pViewFont                   = $76666E74 (* 'vfnt' *);
    pViewFontSize               = $7666737A (* 'vfsz' *);

    {  Properties of class cContainer (subclass of cItem) }
    pCompletelyExpanded         = $70657863 (* 'pexc' *);
    pContainerWindow            = $63776E64 (* 'cwnd' *);
    pEntireContents             = $65637473 (* 'ects' *);
    pExpandable                 = $70657861 (* 'pexa' *);
    pExpanded                   = $70657870 (* 'pexp' *);
    pPreviousView               = $73766577 (* 'svew' *);                       {     pSelection                    = 'sele',       // defined in AERegistry.r }
    pView                       = $70766577 (* 'pvew' *);
    pIconSize                   = $6C766973 (* 'lvis' *);                       {  defined above }
    pKeepArranged               = $61727267 (* 'arrg' *);                       {  OBSOLETE in Finder 9 or later }
    pKeepArrangedBy             = $61726279 (* 'arby' *);                       {  OBSOLETE in Finder 9 or later }

    {  Properties of class cDesktop (subclass of cContainer) }
    pStartupDisk                = $7364736B (* 'sdsk' *);
    pTrash                      = $74727368 (* 'trsh' *);

    {  Properties of class cSharableContainer (subclass of cContainer) }
    pOwner                      = $736F776E (* 'sown' *);
    pOwnerPrivileges            = $6F776E72 (* 'ownr' *);
    pGroup                      = $73677270 (* 'sgrp' *);
    pGroupPrivileges            = $67707072 (* 'gppr' *);
    pGuestPrivileges            = $67737470 (* 'gstp' *);
    pArePrivilegesInherited     = $69707276 (* 'iprv' *);
    pExported                   = $73657870 (* 'sexp' *);
    pMounted                    = $736D6F75 (* 'smou' *);
    pSharingProtection          = $7370726F (* 'spro' *);
    pSharing                    = $73686172 (* 'shar' *);
    pSharingWindow              = $73776E64 (* 'swnd' *);

    {  Properties of class cDisk (subclass of cSharableContainer) }
    pCapacity                   = $63617061 (* 'capa' *);
    pEjectable                  = $6973656A (* 'isej' *);
    pFreeSpace                  = $66727370 (* 'frsp' *);
    pLocal                      = $69737276 (* 'isrv' *);
    pIsStartup                  = $69737464 (* 'istd' *);

    {  Properties of class cTrash (subclass of cSharableContainer) }
    pWarnOnEmpty                = $7761726E (* 'warn' *);

    {  Properties of class cWindow (subclass of cContentSpace) }
                                                                {     pBounds                        = 'pbnd',   // defined in AERegistry.r }
                                                                {     pHasCloseBox                = 'hclb',     // defined in AERegistry.r }
                                                                {     pIsFloating                    = 'isfl',     // defined in AERegistry.r }
                                                                {     pIndex                     = 'pidx',     // defined in AERegistry.r }
                                                                {     pIsModal                    = 'pmod',   // defined in AERegistry.r }
                                                                {     pPosition                    = 'posn',     // defined above }
                                                                {     pIsResizable                = 'prsz',     // defined in AERegistry.r }
                                                                {     pHasTitleBar                = 'ptit',     // defined in AERegistry.r }
                                                                {     pVisible                    = 'pvis',   // defined in AERegistry.r }
                                                                {     pIsZoomable                    = 'iszm',     // defined in AERegistry.r }
                                                                {     pIsZoomed                    = 'pzum',     // defined in AERegistry.r }
    pIsZoomedFull               = $7A756D66 (* 'zumf' *);
    pIsPopup                    = $64727772 (* 'drwr' *);
    pIsPulledOpen               = $70756C6C (* 'pull' *);                       {  only applies to popup windows }
    pIsCollapsed                = $77736864 (* 'wshd' *);                       {  only applies to normal windows }

    {  Properties of class cContainerWindow (subclass of cWindow) }
    pObject                     = $636F626A (* 'cobj' *);

    {  Properties of class cSharingWindow (subclass of cWindow) }
    pSharableContainer          = $73637472 (* 'sctr' *);

    {  Properties of class cInfoWindow (subclass of cWindow) }
    pInfoPanel                  = $70616E6C (* 'panl' *);


    {  Properties of networking support }
    pFileShareOn                = $66736872 (* 'fshr' *);
    pFileShareStartingUp        = $66737570 (* 'fsup' *);
    pProgramLinkingOn           = $69616320 (* 'iac ' *);

    {  Properties of class cPreferencesWindow (subclass of cWindow) }
                                                                {     pShowFolderSize                   = 'sfsz',         // defined above for Views CP }
                                                                {     pShowComment                = 'scom',      // defined above for Views CP }
    pShowModificationDate       = $73646174 (* 'sdat' *);                       {  pShowDate defined above for Views CP }
                                                                {     pShowKind                    = 'sknd',        // defined above for Views CP }
                                                                {     pShowLabel                    = 'slbl',         // defined above for Views CP }
                                                                {     pShowSize                    = 'ssiz',        // defined above for Views CP }
                                                                {     pShowVersion                = 'svrs',      // defined above for Views CP }
                                                                {     pShowCreationDate             = 'scda',      // Removed from Finder 8.0 HIS }
                                                                {     pShowFileType                 = 'sfty',       // Removed from Finder 8.0 HIS }
                                                                {     pShowFileCreator               = 'sfcr',         // Removed from Finder 8.0 HIS }
                                                                {     pListViewIconSize             = 'lvis',      // defined above for Views CP }
                                                                {     pGridIcons                    = 'fgrd',         // defined above for Views CP }
                                                                {     pStaggerIcons                 = 'fstg',       // defined above for Views CP }
                                                                {     pViewFont                    = 'vfnt',        // defined above for Views CP }
                                                                {     pViewFontSize                 = 'vfsz',       // defined above for Views CP }
    pUseRelativeDate            = $75726474 (* 'urdt' *);                       {  Moved to a per-folder basis in Finder 8.0 HIS }
    pDelayBeforeSpringing       = $64656C61 (* 'dela' *);
    pSpringOpenFolders          = $73707267 (* 'sprg' *);
    pUseShortMenus              = $75736D65 (* 'usme' *);
    pUseWideGrid                = $75737767 (* 'uswg' *);
    pLabel1                     = $6C626C31 (* 'lbl1' *);
    pLabel2                     = $6C626C32 (* 'lbl2' *);
    pLabel3                     = $6C626C33 (* 'lbl3' *);
    pLabel4                     = $6C626C34 (* 'lbl4' *);
    pLabel5                     = $6C626C35 (* 'lbl5' *);
    pLabel6                     = $6C626C36 (* 'lbl6' *);
    pLabel7                     = $6C626C37 (* 'lbl7' *);
    pDefaultIconViewIconSize    = $6969737A (* 'iisz' *);
    pDefaultButtonViewIconSize  = $6269737A (* 'bisz' *);
    pDefaultListViewIconSize    = $6C69737A (* 'lisz' *);                       {  old use of this name is now pIconSize }
    pIconViewArrangement        = $69617272 (* 'iarr' *);
    pButtonViewArrangement      = $62617272 (* 'barr' *);

    {
       The next bunch are the various arrangements that make up
       enumArrangement
    }
    pNoArrangement              = $6E617272 (* 'narr' *);
    pSnapToGridArrangement      = $67726461 (* 'grda' *);
    pByNameArrangement          = $6E616D61 (* 'nama' *);
    pByModificationDateArrangement = $6D647461 (* 'mdta' *);
    pByCreationDateArrangement  = $63647461 (* 'cdta' *);
    pBySizeArrangement          = $73697A61 (* 'siza' *);
    pByKindArrangement          = $6B696E61 (* 'kina' *);
    pByLabelArrangement         = $6C616261 (* 'laba' *);

    {   #define pObject                                 cObject         // defined above }

    {  Properties of class cProcess (subclass of cObject) }
                                                                {     pName                      = 'pnam',         // defined in AERegistry.r }
    pFile                       = $66696C65 (* 'file' *);                       {     pCreatorType                = 'fcrt',      // defined above }
                                                                {     pFileType                    = 'asty',        // defined above }
                                                                {     pIsFrontProcess                   = 'pisf',         // defined in AERegistry.r }
                                                                {     pAppPartition                 = 'appt',       // defined above }
    pPartitionSpaceUsed         = $70757364 (* 'pusd' *);                       {     pIsScriptable                 = 'isab',       // defined in AERegistry.r }
                                                                {     pVisible                    = 'pvis'      // defined in AERegistry.r }
    pLocalAndRemoteEvents       = $72657674 (* 'revt' *);
    pHasScriptingTerminology    = $68736372 (* 'hscr' *);

    {  Properties of class cAccessoryProcess (subclass of cProcess) }
    pDeskAccessoryFile          = $64616669 (* 'dafi' *);

    {  Properties of class cApplicationProcess (subclass of cProcess) }
    pApplicationFile            = $61707066 (* 'appf' *);

    {
       Properties of class cGroup (subclass of cObject)
      enum (
        pBounds
        pIconBitmap
        pLabelIndex
        pName
        pPosition
        pWindow                                 = cWindow           // defined above
      );
    }

    {  Properties of class cUser (subclass of cObject) }
                                                                {     pBounds }
                                                                {     pIconBitmap }
                                                                {     pLabelIndex }
                                                                {     pName }
                                                                {     pPosition }
                                                                {     pWindow                        = cWindow,        // defined above }
    pCanConnect                 = $63636F6E (* 'ccon' *);
    pCanChangePassword          = $63637077 (* 'ccpw' *);
    pCanDoProgramLinking        = $63696163 (* 'ciac' *);
    pIsOwner                    = $69736F77 (* 'isow' *);
    pARADialIn                  = $61726164 (* 'arad' *);
    pShouldCallBack             = $63616C62 (* 'calb' *);
    pCallBackNumber             = $63626E6D (* 'cbnm' *);

    {
       Properties of class cApplication (subclass of cObject)
       NOTE: properties for the special folders must match their respective kXXXFolderType constants
    }
    pAboutMacintosh             = $61626278 (* 'abbx' *);
    pAppleMenuItemsFolder       = $616D6E75 (* 'amnu' *);                       {  kAppleMenuFolderType }
                                                                {     pClipboard                    = 'pcli',         // defined in AERegistry.r }
    pControlPanelsFolder        = $6374726C (* 'ctrl' *);                       {  kControlPanelFolderType }
    pDesktop                    = $6465736B (* 'desk' *);                       {  kDesktopFolderType }
    pExtensionsFolder           = $6578746E (* 'extn' *);                       {  kExtensionFolderType }
                                                                {     pFileShareOn                = 'fshr',      // defined above }
    pFinderPreferences          = $70667270 (* 'pfrp' *);
    pFontsFolder                = $666F6E74 (* 'font' *);
    pFontsFolderPreAllegro      = $66666E74 (* 'ffnt' *);                       {  DO NOT USE THIS - FOR BACKWARDS COMPAT ONLY }
                                                                {     pIsFrontProcess                   = 'pisf',         // defined in AERegistry.r }
                                                                {     pInsertionLoc                 = 'pins',       // defined in AERegistry.r }
    pLargestFreeBlock           = $6D667265 (* 'mfre' *);
    pPreferencesFolder          = $70726566 (* 'pref' *);                       {  kPreferencesFolderType }
                                                                {     pProductVersion                   = 'ver2',         // defined above }
                                                                {     pUserSelection                  = 'pusl',        // defined in AERegistry.r }
                                                                {     pFileShareStartingUp             = 'fsup',        // defined above }
    pShortCuts                  = $73637574 (* 'scut' *);
    pShutdownFolder             = $73686466 (* 'shdf' *);
    pStartupItemsFolder         = $73747274 (* 'strt' *);                       {  kStartupFolderType }
    pSystemFolder               = $6D616373 (* 'macs' *);                       {  kSystemFolderType }
    pTemporaryFolder            = $74656D70 (* 'temp' *);                       {  kTemporaryFolderType }
                                                                {     pVersion                    = 'vers',       // defined in AERegistry.r }
    pViewPreferences            = $70767770 (* 'pvwp' *);                       {     pVisible                    = 'pvis',       // defined in AERegistry.r }
    pStartingUp                 = $6177616B (* 'awak' *);                       {  private property to tell whether the Finder is fully up and running }

    {  Properties of class cSharingPrivileges (subclass of cObject) }
    pSeeFiles                   = $70727672 (* 'prvr' *);
    pSeeFolders                 = $70727673 (* 'prvs' *);
    pMakeChanges                = $70727677 (* 'prvw' *);

    {
       Properties of class cPreferences (subclass of cObject)
      enum (
        pShowFolderSize                         = 'sfsz',           // defined above for Views CP
        pShowComment                            = 'scom',           // defined above for Views CP
        pShowModificationDate                   = pShowDate,            // pShowDate defined above for Views CP
        pShowKind                               = 'sknd',           // defined above for Views CP
        pShowLabel                              = 'slbl',           // defined above for Views CP
        pShowSize                               = 'ssiz',           // defined above for Views CP
        pShowVersion                            = 'svrs',           // defined above for Views CP
        pShowCreationDate                       = 'scda',           // defined in cPreferencesWindow
        pShowFileType                           = 'sfty',           // defined in cPreferencesWindow
        pShowFileCreator                        = 'sfcr',           // defined in cPreferencesWindow
        pListViewIconSize                       = 'lvis',           // defined above for Views CP
        pGridIcons                              = 'fgrd',           // defined above for Views CP
        pStaggerIcons                           = 'fstg',           // defined above for Views CP
        pViewFont                               = 'vfnt',           // defined above for Views CP
        pViewFontSize                           = 'vfsz',           // defined above for Views CP
        pUseRelativeDate                        = 'urdt',           // defined in cPreferencesWindow
        pDelayBeforeSpringing                   = 'dela',           // defined in cPreferencesWindow
        pShowMacOSFolder                        = 'sosf',           // defined in cPreferencesWindow
        pUseShortMenus                          = 'usme',           // defined in cPreferencesWindow
        pUseCustomNewMenu                       = 'ucnm',           // defined in cPreferencesWindow
        pShowDesktopInBackground                = 'sdtb',           // defined in cPreferencesWindow
        pActivateDesktopOnClick                 = 'adtc',           // defined in cPreferencesWindow
        pLabel1                                 = 'lbl1',           // defined in cPreferencesWindow
        pLabel2                                 = 'lbl2',           // defined in cPreferencesWindow
        pLabel3                                 = 'lbl3',           // defined in cPreferencesWindow
        pLabel4                                 = 'lbl4',           // defined in cPreferencesWindow
        pLabel5                                 = 'lbl5',           // defined in cPreferencesWindow
        pLabel6                                 = 'lbl6',           // defined in cPreferencesWindow
        pLabel7                                 = 'lbl7',           // defined in cPreferencesWindow
        pWindow                                 = cWindow           // defined above
      );
    }

    {
       Properties of class cLabel (subclass of cObject)
      enum (
        pName                                   = 'pnam',           // defined in AERegistry.r
        pColor                                  = 'colr',           // defined in AERegistry.r
      );
    }

    {  Misc Properties }
    pSmallIcon                  = $736D6963 (* 'smic' *);
    pSmallButton                = $736D6275 (* 'smbu' *);
    pLargeButton                = $6C676275 (* 'lgbu' *);
    pGrid                       = $67726964 (* 'grid' *);

    {
      //////////////////////////////////////
       Enumerations defined by the Finder
      //////////////////////////////////////
    }

    enumViewBy                  = $76776279 (* 'vwby' *);
    enumGestalt                 = $6773656E (* 'gsen' *);
    enumConflicts               = $63666C63 (* 'cflc' *);
    enumExistingItems           = $65787369 (* 'exsi' *);
    enumOlderItems              = $6F6C6472 (* 'oldr' *);

    enumDate                    = $656E6461 (* 'enda' *);
    enumAnyDate                 = $616E7964 (* 'anyd' *);
    enumToday                   = $74646179 (* 'tday' *);
    enumYesterday               = $79646179 (* 'yday' *);
    enumThisWeek                = $7477656B (* 'twek' *);
    enumLastWeek                = $6C77656B (* 'lwek' *);
    enumThisMonth               = $746D6F6E (* 'tmon' *);
    enumLastMonth               = $6C6D6F6E (* 'lmon' *);
    enumThisYear                = $74796572 (* 'tyer' *);
    enumLastYear                = $6C796572 (* 'lyer' *);
    enumBeforeDate              = $62666474 (* 'bfdt' *);
    enumAfterDate               = $61666474 (* 'afdt' *);
    enumBetweenDate             = $62746474 (* 'btdt' *);
    enumOnDate                  = $6F6E6474 (* 'ondt' *);

    enumAllDocuments            = $616C6C64 (* 'alld' *);
    enumFolders                 = $666F6C64 (* 'fold' *);
    enumAliases                 = $616C6961 (* 'alia' *);
    enumStationery              = $73746174 (* 'stat' *);

    enumWhere                   = $77686572 (* 'wher' *);
    enumAllLocalDisks           = $616C646B (* 'aldk' *);
    enumAllRemoteDisks          = $6172646B (* 'ardk' *);
    enumAllDisks                = $616C6C64 (* 'alld' *);
    enumAllOpenFolders          = $616F666F (* 'aofo' *);


    enumIconSize                = $6973697A (* 'isiz' *);
    enumSmallIconSize           = $736D6963 (* 'smic' *);
    enumMiniIconSize            = $6D696963 (* 'miic' *);
    enumLargeIconSize           = $6C676963 (* 'lgic' *);

    enumSortDirection           = $736F6472 (* 'sodr' *);
    enumSortDirectionNormal     = $736E726D (* 'snrm' *);
    enumSortDirectionReverse    = $73727673 (* 'srvs' *);

    enumArrangement             = $65617272 (* 'earr' *);

    {  Get Info Window panel enumeration }
    enumInfoWindowPanel         = $69706E6C (* 'ipnl' *);
    enumGeneralPanel            = $67706E6C (* 'gpnl' *);
    enumSharingPanel            = $73706E6C (* 'spnl' *);
    enumStatusNConfigPanel      = $73636E6C (* 'scnl' *);
    enumFontsPanel              = $66706E6C (* 'fpnl' *);
    enumMemoryPanel             = $6D706E6C (* 'mpnl' *);


    {  Preferences panel enumeration }
    enumPrefsWindowPanel        = $70706C65 (* 'pple' *);
    enumPrefsGeneralPanel       = $70676E70 (* 'pgnp' *);
    enumPrefsLabelPanel         = $706C6270 (* 'plbp' *);
    enumPrefsIconViewPanel      = $70697670 (* 'pivp' *);
    enumPrefsButtonViewPanel    = $70627670 (* 'pbvp' *);
    enumPrefsListViewPanel      = $706C7670 (* 'plvp' *);

    {
      //////////////////////////////////////
       Types defined by the Finder
      //////////////////////////////////////
    }

    typeIconFamily              = $6966616D (* 'ifam' *);                       {  An AEList of typeIconAndMask, type8BitIcon, & c. }
    typeIconAndMask             = $49434E23 (* 'ICN#' *);
    type8BitMask                = $6C386D6B (* 'l8mk' *);
    type32BitIcon               = $696C3332 (* 'il32' *);
    type8BitIcon                = $69636C38 (* 'icl8' *);
    type4BitIcon                = $69636C34 (* 'icl4' *);
    typeSmallIconAndMask        = $69637323 (* 'ics#' *);
    typeSmall8BitMask           = $73386D6B (* 's8mk' *);
    typeSmall32BitIcon          = $69733332 (* 'is32' *);
    typeSmall8BitIcon           = $69637338 (* 'ics8' *);
    typeSmall4BitIcon           = $69637334 (* 'ics4' *);
    typeRelativeTime            = $7274696D (* 'rtim' *);
    typeConceptualTime          = $74696D63 (* 'timc' *);

    {
      //////////////////////////////////////
       Keywords defined by the Finder
      //////////////////////////////////////
    }

    keyIconAndMask              = $49434E23 (* 'ICN#' *);
    key32BitIcon                = $696C3332 (* 'il32' *);
    key8BitIcon                 = $69636C38 (* 'icl8' *);
    key4BitIcon                 = $69636C34 (* 'icl4' *);
    key8BitMask                 = $6C386D6B (* 'l8mk' *);
    keySmallIconAndMask         = $69637323 (* 'ics#' *);
    keySmall8BitIcon            = $69637338 (* 'ics8' *);
    keySmall4BitIcon            = $69637334 (* 'ics4' *);
    keySmall32BitIcon           = $69733332 (* 'is32' *);
    keySmall8BitMask            = $73386D6B (* 's8mk' *);
    keyMini1BitMask             = $69636D23 (* 'icm#' *);
    keyMini4BitIcon             = $69636D34 (* 'icm4' *);
    keyMini8BitIcon             = $69636D38 (* 'icm8' *);
    keyAEUsing                  = $7573696E (* 'usin' *);
    keyAEReplacing              = $616C7270 (* 'alrp' *);
    keyAENoAutoRouting          = $726F7574 (* 'rout' *);
    keyLocalPositionList        = $6D76706C (* 'mvpl' *);
    keyGlobalPositionList       = $6D767067 (* 'mvpg' *);
    keyRedirectedDocumentList   = $6670646C (* 'fpdl' *);

    {
      //////////////////////////////////////
       New prepositions used by the Finder
      //////////////////////////////////////
    }

    keyASPrepositionHas         = $68617320 (* 'has ' *);
    keyAll                      = $6B79616C (* 'kyal' *);
    keyOldFinderItems           = $6673656C (* 'fsel' *);

    {
      //////////////////////////////////////
       New key forms used by the Finder
      //////////////////////////////////////
    }

    formAlias                   = $616C6973 (* 'alis' *);
    formCreator                 = $66637274 (* 'fcrt' *);


    {
      //////////////////////////////////////
       Finder error codes
      //////////////////////////////////////
    }

    errFinderIsBusy             = -15260;
    errFinderWindowNotOpen      = -15261;
    errFinderCannotPutAway      = -15262;
    errFinderWindowMustBeIconView = -15263;                     {  RequireWindowInIconView }
    errFinderWindowMustBeListView = -15264;                     {  RequireWindowInListView }
    errFinderCantMoveToDestination = -15265;
    errFinderCantMoveSource     = -15266;
    errFinderCantOverwrite      = -15267;
    errFinderIncestuousMove     = -15268;                       {  Could just use errFinderCantMoveSource }
    errFinderCantMoveToAncestor = -15269;                       {  Could also use errFinderCantMoveSource }
    errFinderCantUseTrashedItems = -15270;
    errFinderItemAlreadyInDest  = -15271;                       {  Move from folder A to folder A }
    errFinderUnknownUser        = -15272;                       {  Includes unknown group }
    errFinderSharePointsCantInherit = -15273;
    errFinderWindowWrongType    = -15274;
    errFinderPropertyNowWindowBased = -15275;
    errFinderAppFolderProtected = -15276;                       {  used by General controls when folder protection is on }
    errFinderSysFolderProtected = -15277;                       {  used by General controls when folder protection is on }
    errFinderBoundsWrong        = -15278;
    errAEValueOutOfRange        = -15279;
    errFinderPropertyDoesNotApply = -15280;
    errFinderFileSharingMustBeOn = -15281;
    errFinderMustBeActive       = -15282;
    errFinderVolumeNotFound     = -15283;                       {  more descriptive than what we get with nsvErr }
    errFinderLockedItemsInTrash = -15284;                       {  there are some locked items in the trash }
    errFinderOnlyLockedItemsInTrash = -15285;                   {  all the items (except folders) in the trash are locked }
    errFinderProgramLinkingMustBeOn = -15286;
    errFinderWindowMustBeButtonView = -15287;
    errFinderBadPackageContents = -15288;                       {  something is wrong within the package    }
    errFinderUnsupportedInsidePackages = -15289;                {  operation cannot be used on items within a package      }
    errFinderCorruptOpenFolderList = -15290;                    {  was -15276 in Finder 8.6 and earlier, but that conflicted with General Controls }
    errFinderNoInvisibleFiles   = -15291;                       {  was -15277 in Finder 8.6 and earlier, but that conflicted with General Controls }
    errFinderCantDeleteImmediately = -15292;                    {  cannot delete immediately via scripting }
    errFinderLastReserved       = -15379;

{$ALIGN MAC68K}
{#POP}
{unit HIObject}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN POWER}
{#LibExport+}


{
  *  HIObject
  *
  *  Discussion:
  *    HIObject is the HIToolbox's base class for various objects. Over
  *    time, all of our common objects (controls, windows, menus, etc.)
  *    will be derived from HIObject. Code which is external to
  *    HIToolbox can also create its own subclasses of our objects using
  *    the routines contained in this file. There are also polymorphic
  *    functions one can use on any HIObject for getting the class ID,
  *    etc.
  *
  *    HIObjects are actually CF types under the hood. This means that
  *    they can be put into CF collections and retain/release can be
  *    called on them.
  *
  *    An HIObject is essentially a very basic building-block object
  *    which contains an event target. You can create these objects to
  *    use as your own Carbon Event receptors in your application, or
  *    you can subclass existing Toolbox object to suit your needs.
  *
  *
  *    You register your subclasses with HIObjectRegisterSubclass,
  *    passing your class ID, the parent class, and an event handler.
  *    You also pass a list of events the handler is interested in.
  *
  *
  *    To create an object of your subclass, you call HIObjectCreate,
  *    passing the class ref you registered, as well as an
  *    initialization event.
  *
  *    Construction is two-phase: first the basic construction of the
  *    object is done, then initialization is performed. The toolbox
  *    sends construction events bottom-up, as you would expect in C++
  *    or the like. Here is the list of what goes on to create an
  *    objct:
  *
  *    1)  The Toolbox creates the base HIObject
  *
  *    2)  It then installs the event handler you specified when you
  *    registered your subclass. Your handler must listen for
  *    kEventHIObjectConstruct and kEventHIObjectDestruct events. If it
  *    does not, the class cannot be registered (you will get a
  *    paramErr).
  *
  *    3)  Next, the Toolbox _directly_ calls your handler with an
  *    kEventHIObjectConstruct event. When called like this, you are not
  *    really being called in the context of a handler stack, so you
  *    cannot do things like CallNextEventHandler. The userData
  *    parameter is what you specified when you registered the class.
  *    Typically, during construction you will allocate memory yourself
  *    to store your own instance data; this allocation might be as
  *    simple as calling malloc or NewPtr, or it might involve creating
  *    your own C++ object. In the construct event, you are passed the
  *    base HIObjectRef of the object being created. Typically you would
  *    store this HIObjectRef in your own instance data for later use.
  *    When handling this construct event, you should be sure to use
  *    SetEventParameter to set the kEventParamHIObjectInstance
  *    parameter in the construction event with your own instance data.
  *    You must use typeVoidPtr as the type.
  *
  *    4)  The Toolbox looks for your instance of typeVoidPtr after you
  *    handle the construct event. It then takes that data and stores it
  *    off with the object and also sets the user data of the event
  *    handler it installed to be this instance data. This means that
  *    following the construct event, all calls to your event handler
  *    will have the instance data you returned to us.
  *
  *    5)  Once construction has completed successfully, we will send
  *    your object the initialize event passed into HIObjectCreate. At
  *    this point, all events are now sent to your object using standard
  *    Carbon Events mechanisms (it is only the construct event which is
  *    special). When we send the initialization event to your subclass,
  *    you should pass the event to your superclass before proceeding.
  *    You do this with CallNextEventHandler. Once back from that call,
  *    you should verify that the result is noErr, indicating that the
  *    superclass did in fact initialize properly. If it did not, your
  *    should return the error that CallNextEventHandler returned from
  *    your handler as well. The object will be destroyed by the
  *    Toolbox. Your object should be able to be destroyed in a
  *    partially initialized state such as this. This stage is optional,
  *    i.e. an object does not need to respond to the initialize event
  *    unless it is expecting certain parameters to be passed to it at
  *    creation time. This is where those parameters can be fetched.
  *
  *
  *    6)  Once initialization is successful, the HIObjectRef is
  *    returned to the caller of HIObjectCreate. From there, you can
  *    have all sorts of cool fun.
  *
  *    When someone has called HIObjectRelease enough such that the
  *    refcount of the object drops to zero, the object is destroyed.
  *    The Toolbox will send a kEventHIObjectDestruct event to your
  *    object. DO NOT CALL CALLNEXTEVENTHANDLER. You will be setting
  *    yourself up for some hurt. Just clean up and return from your
  *    handler.
  }

{ The declarations for HIObjectClassRef, HIObjectClassRefPtr, and HIObjectRef
have been moved to HIObjectCore. See HIObjectCore.p[.pas] for reason.
}

{
  *  Discussion:
  *    HIObject errors
  }

const

  {
    * You are trying to register a class ID that already exists.
    }
  hiObjectClassExistsErr        = -22080;

  {
    * You are trying to unregister a class which has instances which
    * still exist. You must destroy them first, before they destroy you!
    }
  hiObjectClassHasInstancesErr  = -22081;
  hiObjectClassHasSubclassesErr = -22082;

  {
    * You are trying to create an HIObject class that is defined as
    * being abstract. You must subclass it instead. Oh yes. Don't make
    * us say it twice!
    }
  hiObjectClassIsAbstractErr    = -22083;




const

  {
    * The event class for HIObject events
    }
  kEventClassHIObject           = $68696F62 (* 'hiob' *);

  kEventParamHIObjectInstance   = $68696F69 (* 'hioi' *);
  kEventParamHIArchive          = $68696163 (* 'hiac' *); // typeCFTypeRef
  typeHIObjectRef               = $68696F62 (* 'hiob' *);

{
    kEventClassHIObject quick reference:

    These are the events for base class functionality of HIObjects. You should only need to be
    aware of these if you are implementing a subclass of HIObject.

    kEventHIObjectConstruct         = 1,
    kEventHIObjectInitialize        = 2,
    kEventHIObjectDestruct          = 3,
    kEventHIObjectIsEqual           = 4,
    kEventHIObjectPrintDebugInfo    = 5
}

{
 *  kEventClassHIObject / kEventHIObjectConstruct
 *
 *  Summary:
 *    Your object is being constructed. You should allocate instance
 *    data for your object.
 *
 *  Discussion:
 *    When your event handler is called with this event, it is being
 *    called directly and not through the normal event dispatching
 *    mechanism. This means that the EventHandlerCallRef passed to your
 *    handler will be NULL and CallNextEventHandler will not work. You
 *    are passed the actual HIObjectRef of your base class for you to
 *    record in your instance data.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    <-> kEventParamHIObjectInstance (in/out, typeHIObjectRef)
 *          On entry, this parameter is typeHIObjectRef, and is the
 *          HIObjectRef of your instanceÕs base class. Typically you
 *          will read this parameter from the event and store it in
 *          your instance data so that when your instance needs to call
 *          HIObject APIs, it can use this HIObjectRef.
 *
 *          On exit, this parameter is typeVoidPtr, and should be a
 *          pointer to your instance data that you have written into
 *          the event with SetEventParameter. After your event handler
 *          returns, the toolbox reads your instance data pointer from
 *          the event, installs the event handlers that were passed to
 *          HIObjectRegisterSubclass on the new object, and uses the
 *          instance data pointer as the refcon for those event
 *          handlers. This allows your event handlers to retrieve your
 *          instance data pointer from the refcon.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available
}

   kEventHIObjectConstruct       = 1;

{
 *  kEventClassHIObject / kEventHIObjectInitialize
 *
 *  Summary:
 *    Your object is being initialized. You should read initialization
 *    data from the event and store it into your instance data.
 *
 *  Discussion:
 *    Your handler should pass this event on to the superclass first
 *    before handling this event. This is done by calling
 *    CallNextEventHandler with the event. When that function returns,
 *    you should make sure the result is noErr. If not, you should NOT
 *    continue to initialize your class.
 *
 *    Assuming that CallNextEventHandler returned noErr, you may then
 *    proceed to read initialization data from the event parameters, if
 *    any. For example, you might be create an object that includes a
 *    string as part of its instance data. The caller of HIObjectCreate
 *    would create an EventRef and add a string to the event using a
 *    parameter name and type defined by your object. In your objectÕs
 *    kEventHIObjectInitialize event handler, you would read the string
 *    from the event parameter and store it into your instance
 *    data.
 *
 *    The parameters of this event, therefore, contain the union of all
 *    parameters needed by all base classes of this object to properly
 *    construct themselves.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available
}

  kEventHIObjectInitialize      = 2;

{
 *  kEventClassHIObject / kEventHIObjectDestruct
 *
 *  Summary:
 *    Your object is being destroyed. This is your chance to dispose of
 *    anything you might have allocated for your objectÕs instance data.
 *
 *  Discussion:
 *    Do NOT call through with CallNextEventHandler, as you will
 *    disrupt the fabric of space-time. An HIObject is destroyed in
 *    most-derived to least-derived order, and if you call through,
 *    your base class can be destroyed before you destroy your own
 *    data, which can cause undefined results.
 *
 *    Note that the refcon of your event handler for this event will be
 *    the instance data pointer allocated and returned by your
 *    kEventHIObjectConstruct handler in the
 *    kEventParamHIObjectInstance parameter.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available
}

  kEventHIObjectDestruct        = 3;

{
 *  kEventClassHIObject / kEventHIObjectIsEqual
 *
 *  Summary:
 *    HIObjectIsEqual has been called, and you are being asked to
 *    determine if your object is equivalent to the one being passed to
 *    your handler.
 *
 *  Discussion:
 *    The base HIObject class handles this event by comparing the
 *    HIObjectRef values for pointer equality. Your subclass may choose
 *    to also compare the contents of the HIObject instance data.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeHIObjectRef)
 *          The object to which your object should be compared.
 *
 *    <-- kEventParamResult (out, typeBoolean)
 *          If your object is equivalent to the direct object, you
 *          should return true in this parameter; otherwise, return
 *          false.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available
}

  kEventHIObjectIsEqual         = 4;

{
 *  kEventClassHIObject / kEventHIObjectPrintDebugInfo
 *
 *  Summary:
 *    HIObjectPrintDebugInfo has been called, and you are being asked
 *    to print your information to stdout.
 *
 *  Discussion:
 *    This event is sent to all handlers registered for it. You should
 *    NOT call CallNextEventHandler.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available
}

  kEventHIObjectPrintDebugInfo  = 5;

{
 *  kEventClassHIObject / kEventHIObjectEncode
 *
 *  Summary:
 *    Your object is being requested to encode itself into an archive.
 *
 *  Discussion:
 *    Your handler should pass this event on to the superclass first
 *    before handling this event. This is done by calling
 *    CallNextEventHandler with the event. When that function returns,
 *    you should make sure the result is noErr. If not, you should NOT
 *    continue to initialize your class.
 *
 *    HIArchiveEncodeHIObject has been called on your HIObject. At this
 *    point all relevant long term data should be encoded to the
 *    HIArchive provided.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamHIArchive (in, typeCFTypeRef)
 *          The HIArchive reference into which the HIObject should be
 *          compiled.
 *
 *  Availability:
 *    Mac OS X:         in version 10.4 and later in Carbon.framework
 *    CarbonLib:        not available
 }
    kEventHIObjectEncode          = 6;


{
  *  HIObjectRegisterSubclass()
  *
  *  Discussion:
  *    Registers a class with the Toolbox for creation later.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inClassID:
  *      The class ID of your class. It should be unique. We recommend
  *      using Java-style com.company.foo naming conventions to avoid
  *      collisions.
  *
  *    inBaseClassID:
  *      The class ID of the class you derive from. Passing NULL
  *      indicates you wish to subclass HIObject (the base class)
  *      directly.
  *
  *    inOptions:
  *      Any special options for your class. Currently you must pass 0
  *      for this parameter.
  *
  *    inConstructProc:
  *      The construction proc for this subclass. You pass the address
  *      of an event handler into this parameter. This handler is called
  *      directly, rather than through the normal event dispatching
  *      mechanism. This means that the EventHandlerCallRef passed in
  *      will be NULL, and you cannot use it for calls like
  *      CallNextEventHandler. Other than that, you should return a
  *      result as usual. After your object is constructed, this proc
  *      will be installed as the event handler for the remaining events
  *      specified in the inEventList parameter. You may pass NULL to
  *      create an "abstract class" that cannot be instantiated, but can
  *      still be used as a base class for subclasses; if you pass NULL,
  *      HIObjectCreate on the class ID will return
  *      hiObjectClassIsAbstractErr.
  *
  *    inNumEvents:
  *      The number of events you are installing.
  *
  *    inEventList:
  *      The events your handler wishes to receive. You must handle the
  *      kEventHIObjectConstruct and kEventHIObjectDestruct event. If
  *      these events are not specified, an error is returned.
  *
  *    inConstructData:
  *      Pass any info you want passed into your event handler here. For
  *      a C++ hierarchy based on HIObjects, you might actually pass a
  *      static method to construct your object here, and the base class
  *      event handler to do construction as your event handler.
  *
  *    outClassRef:
  *      The newly created class reference. Pass NULL if you don't care.
  *
  *  Result:
  *    An operating system result code.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIObjectRegisterSubclass(
    inClassID: CFStringRef;
    inBaseClassID: CFStringRef;
    inOptions: OptionBits;
    inConstructProc: EventHandlerUPP;                      { can be NULL }
    inNumEvents: UInt32;
    inEventList: EventTypeSpecPtr;
    inConstructData: UnivPtr;
    outClassRef: HIObjectClassRefPtr): OSStatus; external name '_HIObjectRegisterSubclass';           { can be NULL }

{
  *  HIObjectUnregisterClass()
  *
  *  Discussion:
  *    Unregisters a previously registered subclass of HIObject. You
  *    will receive an error if there are subclasses of your class or
  *    instances of it which still exist. All instances and subclasses
  *    must be disposed of and unregistered first.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inClassRef:
  *      The class ref of the class of object you wish to unregister.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIObjectUnregisterClass(inClassRef: HIObjectClassRef): OSStatus; external name '_HIObjectUnregisterClass';


{
  *  HIObjectCreate()
  *
  *  Discussion:
  *    Creates an object derived from HIObject.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inClassID:
  *      The class ID of the class of object you wish to instantiate.
  *
  *    inConstructData:
  *      If your class (or any class you derive from) accepts creation
  *      parameters, you need to pass an event into this parameter. The
  *      class must be kEventClassHIObject, and the kind should be
  *      kEventHIObjectInitialize. Any other parameters should be added
  *      as necessary. Specific subclasses of HIObject which require
  *      initialization parameters will specify those parameters in the
  *      appropriate headers.
  *
  *    outObject:
  *      The instance of the object you create.
  *
  *  Result:
  *    An operating system result code. A return value of
  *    hiObjectClassIsAbstractErr indicates that the inConstructProc
  *    parameter to HIObjectRegisterSubclass was NULL; instances of such
  *    a class may not be created, only subclassed.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIObjectCreate(
    inClassID: CFStringRef;
    inConstructData: EventRef;
    var outObject: HIObjectRef): OSStatus; external name '_HIObjectCreate';

{
  *  HIObjectGetEventTarget()
  *
  *  Discussion:
  *    Returns the event target of an HIObjectRef.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inObject:
  *      The object whose target you want.
  *
  *  Result:
  *    An EventTargetRef.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIObjectGetEventTarget(inObject: HIObjectRef): EventTargetRef; external name '_HIObjectGetEventTarget';

{
  *  HIObjectPrintDebugInfo()
  *
  *  Discussion:
  *    Prints the internal information of an HIObject for debugging
  *    purposes. It outputs the info to stdout.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inObject:
  *      The object to inspect.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  procedure HIObjectPrintDebugInfo(inObject: HIObjectRef); external name '_HIObjectPrintDebugInfo';

{
  *  HIObjectCopyClassID()
  *
  *  Discussion:
  *    Returns the class ID of a given HIObject.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inObject:
  *      The object whose class ID you are interested in.
  *
  *  Result:
  *    A CFStringRef containing the object's class ID.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIObjectCopyClassID(inObject: HIObjectRef): CFStringRef; external name '_HIObjectCopyClassID';

{
  *  HIObjectIsOfClass()
  *
  *  Discussion:
  *    Returns whether or not an object is of a certain class. You can
  *    us this to see whether or not an object you have derives from an
  *    expected superclass.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inObject:
  *      The object whose class ID you wish to check.
  *
  *    inObjectClassID:
  *      The class ID in question.
  *
  *  Result:
  *    A Boolean result indicating whether or not the object is of the
  *    class specified.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIObjectIsOfClass(
    inObject: HIObjectRef;
    inObjectClassID: CFStringRef): boolean; external name '_HIObjectIsOfClass';

{
  *  HIObjectDynamicCast()
  *
  *  Discussion:
  *    Returns the instance data for a specific class of an HIObject.
  *    The instance data returned is the same instance data the class's
  *    construction event handler returns in the instance data
  *    parameter. This is stored off with the class reference so that it
  *    can be fetched later for use by this function. It allows your
  *    subclass to easily get at the data it created, if your subclass
  *    needs that data outside of an event handler. (Inside an event
  *    handler, your subclass can get at its instance data via the
  *    userData parameter to the event handler.)
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inObject:
  *      The object whose class ID you wish to check.
  *
  *    inClassID:
  *      The class ID to get the instance data for.
  *
  *  Result:
  *    A void * result which contains the instance data for the object,
  *    or NULL if the object is not an instance of the class.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIObjectDynamicCast(
    inObject: HIObjectRef;
    inClassID: CFStringRef): Ptr; external name '_HIObjectDynamicCast';

{
  *  HIObjectCreateFromBundle()
  *
  *  Discussion:
  *    Returns the HIObject for the given bundle. A bundle can be
  *    designed to communicate with an app through an HIObject. The
  *    bundle must be designed to create an HIObject and have a defined
  *    suite of CarbonEvents that clients can use to communicate with
  *    the bundle's HIObject. Given a CFBundleRef, this API will tell
  *    the bundle to create the HIObject and return it to the caller.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inBundle:
  *      The bundle that you wish to communicate with.
  *
  *    outObject:
  *      The HIObject associated with the bundle.
  *
  *  Result:
  *    An operating system result code. If the bundle's HIObject
  *    creation function cannot be found, cfragNoSymbolErr will be
  *    returned.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIObjectCreateFromBundle(
    inBundle: CFBundleRef;
    var outObject: HIObjectRef): OSStatus; external name '_HIObjectCreateFromBundle';

{
  *  HIObjectIsAccessibilityIgnored()
  *
  *  Discussion:
  *    Reports whether or not the given HIObject is marked as ignored
  *    for accessibility.
  *
  *    See the discussion of HIObjectSetAccessibilityIgnored for details
  *    on what it means to be accessibility ignored.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inObject:
  *      The object whose accessibility ignored state you wish to query.
  *
  *  Result:
  *    A Boolean value indicating whether or not the HIObject is ignored
  *    for accessibility.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIObjectIsAccessibilityIgnored(inObject: HIObjectRef): boolean; external name '_HIObjectIsAccessibilityIgnored';

{
  *  HIObjectSetAccessibilityIgnored()
  *
  *  Discussion:
  *    Marks an HIObject as ignored (or not) for the purposes of the
  *    accessibility APIs.
  *
  *    An HIObject that is ignored for accessibility will never be shown
  *    to an assistive application that uses the accessibility APIs to
  *    examine an interface. Your application's accessibility
  *    implementation can (and should) still report an ignored HIObject
  *    as usual. Carbon's accessibility engine will automatically prune
  *    any ignored HIObjects out of the data that is shown to an
  *    assistive application.
  *    By default, an HIObject is *not* accessibility ignored.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inObject:
  *      The object whose accessibility ignored state you wish to change.
  *
  *    inIgnored:
  *      A Boolean value indicating whether or not to ignore the object.
  *
  *  Result:
  *    An OSStatus signifying success or failure.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIObjectSetAccessibilityIgnored(
    inObject: HIObjectRef;
    inIgnored: boolean): OSStatus; external name '_HIObjectSetAccessibilityIgnored';

{
 *  HIObjectSetAuxiliaryAccessibilityAttribute()
 *
 *  Summary:
 *    Associates an additional accessibility attribute with a UIElement
 *    that is used to represent a given HIObject or a part thereof.
 *
 *  Discussion:
 *    This routine lets your application provide the name of and data
 *    for an accessibility attribute that you want to add to the
 *    UIElement used to represent a given HIObject-identifier pair.
 *    Normally, accessibility attributes can only be supplied
 *    dynamically via Carbon Events, but this routine allows you to
 *    supply them statically.
 *
 *    When an accessibility attribute Carbon Event is handled by the
 *    HIObject with a given identifier, the toolbox automatically
 *    supplies the names and/or values of any auxiliary attributes
 *    associated with that HIObject- identifier pair.
 *
 *    This routine is particularly useful for supplying values for the
 *    kAXDescriptionAttribute, kAXTitleUIElementAttribute,
 *    kAXServesAsTitleUIElementAttribute, kAXLinkedUIElementsAttribute
 *    and other attributes whose value is specific to the layout and
 *    usage of your application.
 *
 *    This routine only allows you to associate attributes whose values
 *    never change. If you need to supply attributes whose values are
 *    determined dynamically or whose values are settable, you must
 *    install the normal accessibility Carbon Event handlers.
 *
 *    The auxiliary attribute store is consulted during the HIObject's
 *    default handling of the accessibility attribute Carbon Events.
 *    This means that any programmatic handling of a given
 *    accessibility attribute will have a chance to override or block
 *    the consultation of the store. The general rule is that if the
 *    toolbox or a Carbon Event handler can provide the attribute value
 *    some other way, the store will not be consulted.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inHIObject:
 *      The HIObjectRef part of the object-identifier pair to which the
 *      attribute data is associated.
 *
 *    inIdentifier:
 *      The 64-bit identifier part of the object-identifier pair to
 *      which the attribute data is associated. When you want to
 *      associate the attribute data to the HIObject as a whole -- such
 *      as when you want to give a description attribute to a push
 *      button -- you should pass zero in this parameter.
 *
 *    inAttributeName:
 *      A CFStringRef of the name of the attribute you wish to
 *      associate with the object-identifier pair. This string will be
 *      retained before adding it to the auxiliary attribute store.
 *
 *    inAttributeData:
 *      A CFTypeRef with the data to be supplied as the attribute's
 *      value. This data will be retained before adding it to the
 *      auxiliary attribute store; you may release inAttributeData
 *      after you have called this routine. The inAttributeData
 *      parameter may also be NULL, which indicates that the named
 *      auxiliary attribute should no longer be associated with the
 *      object-identifier pair; any named attribute data previously
 *      associated with the object-identifier pair will be released.
 *
 *  Result:
 *    An OSStatus result code. The function will return noErr if it was
 *    able to associate the attribute data with the HIObjectRef. If the
 *    HIObjectRef is invalid, paramErr will be returned. Other results
 *    may be returned in other situations.
 *
 *  Availability:
 *    Mac OS X:         in version 10.4 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.4 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER
function HIObjectSetAuxiliaryAccessibilityAttribute( inHIObject: HIObjectRef; inIdentifier: UInt64; inAttributeName: CFStringRef; inAttributeData: CFTypeRef  { can be NULL } ): OSStatus; external name '_HIObjectSetAuxiliaryAccessibilityAttribute';


{
 *  HIObjectOverrideAccessibilityContainment()
 *
 *  Summary:
 *    Allows you to override the AXUIElementRefs that an HIObject would
 *    normally supply as the values of its AXParent, AXWindow, and
 *    AXTopLevelUIElement attributes.
 *
 *  Discussion:
 *    This routine allows you to change the parent that an HIObject
 *    would normally supply in the accessibility hierarchy. For
 *    instance, a popup control could call this routine on its menu so
 *    that the menu returned the popup control as the menu's parent;
 *    normally the menu would return the application as its parent.
 *    Optionally, this routine also allows you to change the window and
 *    top-level element that an HIObject would normally supply.
 *
 *    If the input HIObject is a standard toolbox construct like an
 *    HIView or a Menu, the input HIObject will not be added as an
 *    accessibility child of its normal parent. In all other cases, it
 *    is the client's responsibility to ensure that the input HIObject
 *    is not added as an accessibility child of its normal parent.
 *
 *    If the desired AXUIElementRef parent represents an HIView, a
 *    Menu, or a Window, the input HIObject will be automatically added
 *    as an accessibility child of the specified parent. In all other
 *    cases, it is the client's responsibility to manually add the
 *    input HIObject as a child of the specified parent. To represent
 *    an HIView, a Menu, or a Window, an AXUIElementRef must contain
 *    the appropriate HIObjectRef as well as an identifier value of
 *    zero.
 *
 *    Similar rules don't have to apply for the handling of the window
 *    and top-level element attributes because those attributes don't
 *    represent two-way relationships.
 *
 *    A containment override is not necessarily supported by every type
 *    of HIObject. Currently, it is supported by HIViews, Menus, and
 *    Windows.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inHIObject:
 *      The HIObjectRef whose parent attribute you want to override.
 *
 *    inDesiredParent:
 *      The AXUIElementRef that you wish the HIObject to return as the
 *      value of its AXParent attribute. This routine makes a copy of
 *      the AXUIElementRef; you must release inDesiredParent after you
 *      have called this routine. Passing NULL indicates that you want
 *      the HIObject to revert to its normal, un-overridden behavior.
 *
 *    inDesiredWindow:
 *      The AXUIElementRef that you wish the HIObject to return as the
 *      value of its AXWindow attribute. This routine makes a copy of
 *      the AXUIElementRef; you must release inDesiredWindow after you
 *      have called this routine. Passing NULL indicates that you want
 *      the HIObject to report its normal window, if any.
 *
 *    inDesiredTopLevelUIElement:
 *      The AXUIElementRef that you wish the HIObject to return as the
 *      value of its AXTopLevelUIElement attribute. This routine makes
 *      a copy of the AXUIElementRef; you must release
 *      inDesiredTopLevelUIElement after you have called this routine.
 *      Passing NULL indicates that you want the HIObject to report its
 *      normal top-level element, if any.
 *
 *  Result:
 *    An OSStatus result code. If the HIObjectRef is invalid, this
 *    routine will return paramErr.
 *
 *  Availability:
 *    Mac OS X:         in version 10.4 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.4 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER
function HIObjectOverrideAccessibilityContainment( inHIObject: HIObjectRef; inDesiredParent: AXUIElementRef; inDesiredWindow: AXUIElementRef; inDesiredTopLevelUIElement: AXUIElementRef ): OSStatus; external name '_HIObjectOverrideAccessibilityContainment';


{
 *  HIObjectIsArchivingIgnored()
 *
 *  Discussion:
 *    Reports whether or not the given HIObject is marked as ignored
 *    for archiving.
 *    See the discussion of HIObjectSetArchivingIgnored for details on
 *    what it means to be archiving ignored.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inObject:
 *      The object whose archiving ignored state you wish to query.
 *
 *  Result:
 *    A Boolean value indicating whether or not the HIObject is ignored
 *    for archiving.
 *
 *  Availability:
 *    Mac OS X:         in version 10.4 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.4 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER
function HIObjectIsArchivingIgnored( inObject: HIObjectRef ): Boolean; external name '_HIObjectIsArchivingIgnored';


{
 *  HIObjectSetArchivingIgnored()
 *
 *  Discussion:
 *    Marks an HIObject as ignored (or not) for the purposes of the
 *    archiving APIs.
 *    An HIObject that is ignored for archiving will never be requested
 *    to encode itself into an archive. This is a statement that the
 *    HIObject does not handle the archiving protocol.
 *    By default, an HIObject *is* archiving ignored.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inObject:
 *      The object whose archiving ignored state you wish to change.
 *
 *    inIgnored:
 *      A Boolean value indicating whether or not to ignore the object.
 *
 *  Result:
 *    An OSStatus signifying success or failure.
 *
 *  Availability:
 *    Mac OS X:         in version 10.4 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.4 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER
function HIObjectSetArchivingIgnored( inObject: HIObjectRef; inIgnored: Boolean ): OSStatus; external name '_HIObjectSetArchivingIgnored';



{
   Standard custom archive data dictionary keys describing custom initialize event parameters.
   Each keyed value is an array of OSTypes represented by CFStrings. Use UTCreateStringForOSType
   and UTGetOSTypeFromString in UTType.h for CFStringRef <-> OSType conversion.
}
{
 *  kHIObjectCustomDataParameterNamesKey
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Availability:
 *    Mac OS X:         in version 10.4 and later in Carbon.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER
var kHIObjectCustomDataParameterNamesKey: CFStringRef; external name '_kHIObjectCustomDataParameterNamesKey'; (* attribute const *)
{
 *  kHIObjectCustomDataParameterTypesKey
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Availability:
 *    Mac OS X:         in version 10.4 and later in Carbon.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER
var kHIObjectCustomDataParameterTypesKey: CFStringRef; external name '_kHIObjectCustomDataParameterTypesKey'; (* attribute const *)
{
 *  kHIObjectCustomDataParameterValuesKey
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Availability:
 *    Mac OS X:         in version 10.4 and later in Carbon.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER
var kHIObjectCustomDataParameterValuesKey: CFStringRef; external name '_kHIObjectCustomDataParameterValuesKey'; (* attribute const *)

{
   Standard custom archive data dictionary keys defining a class and superclass for clients who do
   not implement the object's true class. Each keyed value is a CFStringRef based HIObject class ID.
}
{
 *  kHIObjectCustomDataClassIDKey
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Availability:
 *    Mac OS X:         in version 10.4 and later in Carbon.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER
var kHIObjectCustomDataClassIDKey: CFStringRef; external name '_kHIObjectCustomDataClassIDKey'; (* attribute const *)
{
 *  kHIObjectCustomDataSuperClassIDKey
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Availability:
 *    Mac OS X:         in version 10.4 and later in Carbon.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER
var kHIObjectCustomDataSuperClassIDKey: CFStringRef; external name '_kHIObjectCustomDataSuperClassIDKey'; (* attribute const *)

{
   Standard custom archive data dictionary key for ProcPointer based CDEFs.  The key value is a
   CFString based SInt16. Use CFStringGetIntValue in CFString.h for CFStringRef <-> SInt16 conversion.
}
{
 *  kHIObjectCustomDataCDEFProcIDKey
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Availability:
 *    Mac OS X:         in version 10.4 and later in Carbon.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER
var kHIObjectCustomDataCDEFProcIDKey: CFStringRef; external name '_kHIObjectCustomDataCDEFProcIDKey'; (* attribute const *)

{
 *  HIObjectCopyCustomArchiveData()
 *
 *  Discussion:
 *    Copies the custom archive data associated with an HIObject that
 *    has been read from or will be written to an archive. Useful for
 *    an archive editor that has read a custom object from an archive
 *    and would like to edit its custom data.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inObject:
 *      The object whose custom archive data you wish to retrieve.
 *
 *    outCustomData:
 *      On return, a CFDictionaryRef containing the custom data. The
 *      client is responsible for releasing the dictionary. NULL will
 *      be returned if there is no custom archive data available.
 *
 *  Result:
 *    An OSStatus signifying success or failure.
 *
 *  Availability:
 *    Mac OS X:         in version 10.4 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.4 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER
function HIObjectCopyCustomArchiveData( inObject: HIObjectRef; var outCustomData: CFDictionaryRef ): OSStatus; external name '_HIObjectCopyCustomArchiveData';


{
 *  HIObjectSetCustomArchiveData()
 *
 *  Discussion:
 *    Retrieves the custom archive data associated with an HIObject
 *    that has been read from or will be written to an archive. Useful
 *    for an archive editor that has edited a custom object's custom
 *    data and would like it to be written to an archive with the
 *    object.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inObject:
 *      The object whose custom archive data you wish to change.
 *
 *    inCustomData:
 *      A CFDictionaryRef containing the custom archive data you would
 *      like to associate with the object. Setting custom data will
 *      replace any existing custom data. Passing NULL will clear the
 *      custom archive data. The dictionary's keys and values must use
 *      CFType callbacks for archiving purposes.
 *
 *  Result:
 *    An OSStatus signifying success or failure.
 *
 *  Availability:
 *    Mac OS X:         in version 10.4 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.4 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER
function HIObjectSetCustomArchiveData( inObject: HIObjectRef; inCustomData: CFDictionaryRef  { can be NULL }  ): OSStatus; external name '_HIObjectSetCustomArchiveData';



{$ALIGN MAC68K}
{#POP}
{unit HIShape}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN POWER}
{#LibExport+}


{*
  *  HIShape
  *
  *  Discussion:
  *    HIShape is an abstract shape object for use with some of the
  *    HIToolbox APIs. It is designed as a replacement for RgnHandles
  *    (though it is currently implemented in terms of them at the time
  *    of this writing). This abstraction will allow us to avoid using
  *    QD types in our APIs, particularly in HIView.
  *
  *    One of the biggest benefits of HIShape is that we have mutable
  *    and immutable variants. This means that immutable shapes can be
  *    created and passed around and 'copied' very quickly, since they
  *    are actually refcounted when copied. This avoids needing to do
  *    the handle-to-handle copies that occur right now with
  *    RgnHandle-based APIs.
  }

 type
   HIShapeRef            = ^SInt32; { an opaque 32-bit type }
   HIMutableShapeRef     = ^SInt32; { an opaque 32-bit type }


{
  *  HIShapeGetTypeID()
  *
  *  Discussion:
  *    Returns the CF type ID for the HIShape class.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Result:
  *    A CF type ID.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIShapeGetTypeID: CFTypeID; external name '_HIShapeGetTypeID';




{======================================================================================}
{  IMMUTABLE FUNCTIONS                                                                 }
{======================================================================================}
{
  *  HIShapeCreateWithQDRgn()
  *
  *  Discussion:
  *    Creates an immutable shape based on an existing Quickdraw region
  *    handle.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inRgn:
  *      The Quickdraw region from which to create the HIShape.
  *
  *  Result:
  *    An immutable HIShape reference.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIShapeCreateWithQDRgn(inRgn: RgnHandle): HIShapeRef; external name '_HIShapeCreateWithQDRgn';

{
  *  HIShapeCreateWithRect()
  *
  *  Discussion:
  *    Creates an immutable, rectangular shape based on a given
  *    rectangle.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inRect:
  *      The HIRect from which to create the resulting shape.
  *
  *  Result:
  *    An immutable HIShape reference.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIShapeCreateWithRect( const (*var*) inRect: HIRect ): HIShapeRef; external name '_HIShapeCreateWithRect';

{
  *  HIShapeCreateCopy()
  *
  *  Discussion:
  *    Creates an immutable copy of a mutable or immutable HIShape.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inShape:
  *      The existing HIShapeRef you wish to copy.
  *
  *  Result:
  *    An immutable HIShape reference.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIShapeCreateCopy(inShape: HIShapeRef): HIShapeRef; external name '_HIShapeCreateCopy';

{
  *  HIShapeCreateIntersection()
  *
  *  Discussion:
  *    Creates a new immutable shape which is the intersection of two
  *    others.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inShape1:
  *      An existing HIShapeRef.
  *
  *    inShape2:
  *      An existing HIShapeRef.
  *
  *  Result:
  *    A new immutable HIShapeRef.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIShapeCreateIntersection(
    inShape1: HIShapeRef;
    inShape2: HIShapeRef): HIShapeRef; external name '_HIShapeCreateIntersection';

{
  *  HIShapeCreateDifference()
  *
  *  Discussion:
  *    Creates a new immutable shape which is the difference of two
  *    others. The second shape is subtracted from the first.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inShape1:
  *      An existing HIShapeRef.
  *
  *    inShape2:
  *      An existing HIShapeRef.
  *
  *  Result:
  *    A new immutable HIShapeRef.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIShapeCreateDifference(
    inShape1: HIShapeRef;
    inShape2: HIShapeRef): HIShapeRef; external name '_HIShapeCreateDifference';

{
  *  HIShapeCreateUnion()
  *
  *  Discussion:
  *    Creates a new immutable shape which is the union of two others.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inShape1:
  *      An existing HIShapeRef.
  *
  *    inShape2:
  *      An existing HIShapeRef.
  *
  *  Result:
  *    A new immutable HIShapeRef.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIShapeCreateUnion(
    inShape1: HIShapeRef;
    inShape2: HIShapeRef): HIShapeRef; external name '_HIShapeCreateUnion';

{
  *  HIShapeIsEmpty()
  *
  *  Discussion:
  *    Returns true if the given HIShapeRef is empty, i.e. its area is
  *    empty.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inShape:
  *      The existing HIShapeRef you wish to test.
  *
  *  Result:
  *    A boolean result.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIShapeIsEmpty(inShape: HIShapeRef): boolean; external name '_HIShapeIsEmpty';

{
  *  HIShapeIsRectangular()
  *
  *  Discussion:
  *    Returns true if the given HIShapeRef is rectangular.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inShape:
  *      The existing HIShapeRef you wish to test.
  *
  *  Result:
  *    A boolean result.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIShapeIsRectangular(inShape: HIShapeRef): boolean; external name '_HIShapeIsRectangular';

{
  *  HIShapeContainsPoint()
  *
  *  Discussion:
  *    Returns true if the given HIShapeRef contains the point passed in.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inShape:
  *      An existing HIShapeRef.
  *
  *    inPoint:
  *      The point to check.
  *
  *  Result:
  *    A boolean result.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIShapeContainsPoint(
    inShape: HIShapeRef;
    const (*var*) inPoint: HIPoint): boolean; external name '_HIShapeContainsPoint';

{
  *  HIShapeGetBounds()
  *
  *  Discussion:
  *    Returns the bounding rectangle of a given HIShapeRef.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inShape:
  *      An existing HIShapeRef.
  *
  *    outRect:
  *      Receives the bounding rectangle.
  *
  *  Result:
  *    A pointer to the rectangle you passed in, for convenience.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIShapeGetBounds(
    inShape: HIShapeRef;
    var outRect: HIRect): HIRectPtr; external name '_HIShapeGetBounds';

{
  *  HIShapeGetAsQDRgn()
  *
  *  Discussion:
  *    Changes a given Quickdraw region handle to have the same shape as
  *    a given HIShapeRef. Essentially you are converting an HIShapeRef
  *    into a RgnHandle. This conversion may lose fidelity depending on
  *    how the shape was created originally.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inShape:
  *      An existing HIShapeRef.
  *
  *    outRgn:
  *      An existing region to change.
  *
  *  Result:
  *    An operating system status code.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIShapeGetAsQDRgn(
    inShape: HIShapeRef;
    outRgn: RgnHandle): OSStatus; external name '_HIShapeGetAsQDRgn';

{
  *  HIShapeReplacePathInCGContext()
  *
  *  Discussion:
  *    Given an HIShapeRef and a CGContextRef, make the current path in
  *    the context represent the shape. You might use this to clip to a
  *    shape, for example. You could call this function and then
  *    immediately call CGContextClip.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inShape:
  *      An existing HIShapeRef.
  *
  *    inContext:
  *      The context to apply the shape to.
  *
  *  Result:
  *    An operating system status code.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIShapeReplacePathInCGContext(
    inShape: HIShapeRef;
    inContext: CGContextRef): OSStatus; external name '_HIShapeReplacePathInCGContext';

{
  *  HIShapeSetQDClip()
  *
  *  Discussion:
  *    Given an HIShapeRef and a Quickdraw port, set the current clip in
  *    the port to the shape.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inShape:
  *      An existing HIShapeRef.
  *
  *    inPort:
  *      The port to set the clip for.
  *
  *  Result:
  *    An operating system status code.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIShapeSetQDClip(
    inShape: HIShapeRef;
    inPort: CGrafPtr): OSStatus; external name '_HIShapeSetQDClip';



{======================================================================================}
{  MUTABLE FUNCTIONS                                                                   }
{======================================================================================}
{
  *  HIShapeCreateMutable()
  *
  *  Discussion:
  *    Creates a new, mutable, empty shape.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Result:
  *    A mutable shape reference.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIShapeCreateMutable: HIMutableShapeRef; external name '_HIShapeCreateMutable';

{
  *  HIShapeCreateMutableCopy()
  *
  *  Discussion:
  *    Given an existing HIShapeRef, creates a new mutable copy.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inOrig:
  *      The shape to copy.
  *
  *  Result:
  *    A mutable shape reference.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIShapeCreateMutableCopy(inOrig: HIShapeRef): HIMutableShapeRef; external name '_HIShapeCreateMutableCopy';

{
  *  HIShapeSetEmpty()
  *
  *  Discussion:
  *    Sets a mutable shape to be an empty shape.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inShape:
  *      The shape to empty.
  *
  *  Result:
  *    An operating system status code.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIShapeSetEmpty(inShape: HIMutableShapeRef): OSStatus; external name '_HIShapeSetEmpty';

{
  *  HIShapeIntersect()
  *
  *  Discussion:
  *    Takes two shapes and sets a third to be their intersection.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inShape1:
  *      The first shape.
  *
  *    inShape2:
  *      The second shape.
  *
  *    outResult:
  *      The shape to receive the result of the intersection. This can
  *      be one of the source shapes.
  *
  *  Result:
  *    An operating system status code.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIShapeIntersect(
    inShape1: HIShapeRef;
    inShape2: HIShapeRef;
    outResult: HIMutableShapeRef): OSStatus; external name '_HIShapeIntersect';

{
  *  HIShapeDifference()
  *
  *  Discussion:
  *    Takes two shapes and sets a third to be their difference. The
  *    second shape is subtracted from the first.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inShape1:
  *      The first shape.
  *
  *    inShape2:
  *      The second shape.
  *
  *    outResult:
  *      The shape to receive the result of the intersection. This can
  *      be one of the source shapes.
  *
  *  Result:
  *    An operating system status code.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIShapeDifference(
    inShape1: HIShapeRef;
    inShape2: HIShapeRef;
    outResult: HIMutableShapeRef): OSStatus; external name '_HIShapeDifference';

{
  *  HIShapeUnion()
  *
  *  Discussion:
  *    Takes two shapes and sets a third to be their union.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inShape1:
  *      The first shape.
  *
  *    inShape2:
  *      The second shape.
  *
  *    outResult:
  *      The shape to receive the result of the union. This can be one
  *      of the source shapes.
  *
  *  Result:
  *    An operating system status code.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIShapeUnion(
    inShape1: HIShapeRef;
    inShape2: HIShapeRef;
    outResult: HIMutableShapeRef): OSStatus; external name '_HIShapeUnion';

{
  *  HIShapeOffset()
  *
  *  Discussion:
  *    Offsets a shape by some delta.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inShape:
  *      The shape to offset.
  *
  *    inDX:
  *      The delta to move the shape on the X axis.
  *
  *    inDY:
  *      The delta to move the shape on the Y axis.
  *
  *  Result:
  *    An operating system status code.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIShapeOffset(
    inShape: HIMutableShapeRef;
    inDX: Float32;
    inDY: Float32): OSStatus; external name '_HIShapeOffset';


{$ALIGN MAC68K}
{#POP}
{unit HIView}
{$ALIGN MAC68K}










{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}



 type
    HIViewRef       = ControlRef;
    HIViewID        = ControlID;
    HIViewPartCode  = ControlPartCode;
    HIViewImageContentType = ControlContentType;
    HIViewImageContentInfo = ControlImageContentInfo;

{
  *  kHIViewWindowContentID
  *
  *  Discussion:
  *    The standard view ID for the content view of a window.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

{GRP translation note: kHIViewWindowContentID is really a C language external constant exported from
 CarbonLib (Carbon.framework).  Treating it as an externally declared variable works as long as it
 used as a READ ONLY variable.  CodeWarrior Pascal has no capability for enforcing READ ONLY usage
 so it is up to the programmer to obey the READ ONLY rule.  GPC does enforce READ ONLY usage with the
 attribute (const).}

{WARNING: The CFM CarbonLib export for kHIViewWindowContentID is broken.  For CFM CodeWarrior Pascal,
 some workarounds are:

 1.  Use CFBundle loading and CFBundleGetDataPointerForName to obtain the correct data.

 2.  For composting windows, the correct data can be obtained with code similar to:

    ignoreResult := GetRootControl(theWind, theContentRoot);
    ignoreResult := GetControlID(theContentRoot, theContentControlID);

    The correct data for kHIViewWindowContentID is in theContentControlID.
 }

var kHIViewWindowContentID: HIViewID; external name '_kHIViewWindowContentID'; (* attribute const *) {READ ONLY - don't ever try to modify.}

{
  *  kHIViewWindowGrowBoxID
  *
  *  Discussion:
  *    The standard view ID for the grow box view of a window. Not all
  *    windows have grow boxes, so be aware that you might not find this
  *    view if you look for it.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

{GRP translation note: kHIViewWindowGrowBoxID is really a C language external constant exported from
 CarbonLib (Carbon.framework).  Treating it as an externally declared variable works as long as it
 used as a READ ONLY variable.  CodeWarrior Pascal has no capability for enforcing READ ONLY usage
 so it is up to the programmer to obey the READ ONLY rule.  GPC does enforce READ ONLY usage with the
 attribute (const).}

var kHIViewWindowGrowBoxID: HIViewID; external name '_kHIViewWindowGrowBoxID'; (* attribute const *) {READ ONLY - don't ever try to modify.}

{
  *  Discussion:
  *    HIViewZOrderOp
  }

const

{
    * Indicates we wish to order a view above another view.
    }
  kHIViewZOrderAbove            = 1;

{
    * Indicates we wish to order a view below another view.
    }
  kHIViewZOrderBelow            = 2;

type
  HIViewZOrderOp = UInt32;

{
 *  HIViewFrameMetrics
 *
 *  Summary:
 *    Describes the offsets from the structure to the content area of a
 *    view; for example, the top metric is the difference between the
 *    vertical coordinate of the top edge of the viewÕs structure
 *    region and the vertical coordinate of the top edge of the viewÕs
 *    content region. This structure is returned by a view in response
 *    to a kEventControlGetFrameMetrics event.
}

HIViewFrameMetrics = record

    {
    * Height of the top of the structure area.
    }
                top: Float32;

    {
    * Width of the left of the structure area.
    }
                left: Float32;

    {
    * Height of the bottom of the structure area.
    }
                bottom: Float32;

    {
    * Width of the right of the structure area.
    }
                right: Float32;
 end;


{==============================================================================}
{  CONTROL ATTRIBUTES                                                          }
{==============================================================================}


{
  *  Summary:
  *    View attributes are generally determined by clients of the view;
  *    the view itself should observe the attributes and behave
  *    accordingly.
  *
  *  Discussion:
  *    View Attributes
  }


{GRP translation note: Attributes are passed to OptionBits (UInt32) type formal parameters. Therefore, hex
constants were used to ensure size and bit position are correct.}

const

{
    * When set, the control will send the command it generates to the
    * user focus and propagate as it would naturally from there. The
    * default is to send the command to itself and then to its parent
    * and so forth.
    }
  kHIViewSendCommandToUserFocus = $00000001; {(1 << 0)}

{
 *  Summary:
 *    View feature flags are generally determined by the view itself,
 *    and are not typically changed by clients of the view.
 *
 *  Discussion:
 *    View Features
 }
const
  {
   * This view supports using the ghosting protocol when live tracking
   * is not enabled.
   }
  kHIViewSupportsGhosting       = 1 shl 0;

  {
   * This view allows subviews to be embedded within it.
   }
  kHIViewAllowsSubviews         = 1 shl 1;

  {
   * If this view is clicked, the keyboard focus should be set to this
   * view automatically. This is primarily used for edit text controls.
   }
  kHIViewGetsFocusOnClick       = 1 shl 8;

  {
   * This view supports the live feedback protocol. Necessary to
   * implement live scroll bar tracking. Clients of a view should never
   * disable this.
   }
  kHIViewSupportsLiveFeedback   = 1 shl 10;

  {
   * This view can be put into a radio group. Radio buttons and bevel
   * buttons report this behavior.
   }
  kHIViewSupportsRadioBehavior  = 1 shl 11;

  {
   * This view supports the auto-toggle protocol and should at the very
   * least auto- toggle from off to on and back. The view can support a
   * carbon event for more advanced auto-toggling of its value. The tab
   * view supports this, for example, so that when a tab is clicked its
   * value changes automatically.
   }
  kHIViewAutoToggles            = 1 shl 14;

  {
   * This is merely informational. Turning it off would not necessarily
   * disable any timer a view might be using, but it could obey this
   * bit if it so desired.
   }
  kHIViewIdlesWithTimer         = 1 shl 23;

  {
   * This tells the control manager that the up button part increases
   * the value of the control instead of decreasing it. For example,
   * the Little Arrows (Spinner) control increase its value when the up
   * button is pressed. Scroll bars, on the other hand, decrease the
   * value when their up buttons are pressed.
   }
  kHIViewInvertsUpDownValueMeaning = 1 shl 24;

  {
   * This is an optimization for determining a view's opaque region.
   * When set, the view system just uses the view's structure region,
   * and can usually avoid having to call the view at all.
   }
  kHIViewIsOpaque               = 1 shl 25;

  {
   * This is an optimization for determining what gets invalidated when
   * views are dirtied. For example, on a metal window, the content
   * view is actually fully transparent, so invalidating it doesn't
   * really help things. By telling the control manager that the view
   * is transparent and does not do any drawing, we can avoid trying to
   * invalidate it and instead invalidate views behind it.
   }
  kHIViewDoesNotDraw            = 1 shl 27;

  {
   * Indicates to the Control Manager that this view doesn't use the
   * special part codes for indicator, inactive, and disabled.
   * Available in Mac OS X 10.3 and later.
   }
  kHIViewDoesNotUseSpecialParts = 1 shl 28;

  {
   * This is an optimization for determining the clickable region of a
   * window (used for metal windows, for example, when doing async
   * window dragging). The presence of this bit tells us not to bother
   * asking the control for the clickable region. A view like the
   * visual separator would set this bit. It's typicially used in
   * conjunction with the kHIViewDoesNotDraw bit.
   }
  kHIViewIgnoresClicks          = 1 shl 29;
  kHIViewValidFeaturesForPanther = $3B804D03;


type HIViewFeatures = UInt64;
{==============================================================================}
{  ERROR CODES                                                                 }
{==============================================================================}

{
 *  Discussion:
 *    View/Control Error Codes
 }
const
  {
   * This value will be returned from an HIView API or a Control
   * Manager API when an action that is only supported on a compositing
   * window is attempted on a non-compositing window. This doesn't
   * necessarily mean that the API is only callable for compositing
   * windows; sometimes the legality of the action is based on other
   * parameters of the API. See HIViewAddSubview for one particular use
   * of this error code.
   }
  errNeedsCompositedWindow      = -30598;


{==============================================================================}
{  HIOBJECT SUPPORT                                                            }
{                                                                              }
{   Setting Initial Bounds                                                     }
{                                                                              }
{   When creating a view using HIObjectCreate, you can set the initial bounds  }
{   automatically by passing in an initialization event into HIObjectCreate    }
{   with a kEventParamBounds parameter as typeHIRect or typeQDRectangle.       }
{==============================================================================}
{ The HIObject class ID for the HIView class. }

{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kHIViewClassID CFSTRP('com.apple.hiview')}
{$endc}


{==============================================================================}
{  EMBEDDING                                                                   }
{==============================================================================}
{
  *  HIViewGetRoot()
  *
  *  Discussion:
  *    Returns the root view for a window.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inWindow:
  *      The window to get the root for.
  *
  *  Result:
  *    The root view for the window, or NULL if an invalid window is
  *    passed.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIViewGetRoot(inWindow: WindowRef): HIViewRef; external name '_HIViewGetRoot';

{
  *  HIViewAddSubview()
  *
  *  Discussion:
  *    Adds a subview to the given parent. The new subview is added to
  *    the front of the list of subviews (i.e it is made topmost).
  *
  *    The subview being added is not retained by the new parent view.
  *    Do not release the view after adding it, or it will cease to
  *    exist.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inParent:
  *      The view which will receive the new subview.
  *
  *    inNewChild:
  *      The subview being added.
  *
  *  Result:
  *    An operating system result code.
  *    errNeedsCompositedWindow will be returned when you try to embed
  *    into the content view in a non-compositing window; you can only
  *    embed into the content view in compositing windows.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIViewAddSubview(
    inParent: HIViewRef;
    inNewChild: HIViewRef): OSStatus; external name '_HIViewAddSubview';

{
  *  HIViewRemoveFromSuperview()
  *
  *  Discussion:
  *    Removes a view from its parent.
  *    The subview being removed from the parent is not released and
  *    still exists.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inView:
  *      The view to remove.
  *
  *  Result:
  *    An operating system result code.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIViewRemoveFromSuperview(inView: HIViewRef): OSStatus; external name '_HIViewRemoveFromSuperview';

{
  *  HIViewGetSuperview()
  *
  *  Discussion:
  *    Returns a view's parent view.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inView:
  *      The view whose parent you are interested in getting.
  *
  *  Result:
  *    An HIView reference, or NULL if this view has no parent or is
  *    invalid.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIViewGetSuperview(inView: HIViewRef): HIViewRef; external name '_HIViewGetSuperview';

{
  *  HIViewGetFirstSubview()
  *
  *  Discussion:
  *    Returns the first subview of a container. The first subview is
  *    the topmost subview in z-order.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inView:
  *      The view whose subview you are fetching.
  *
  *  Result:
  *    An HIView reference, or NULL if this view has no subviews or is
  *    invalid.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIViewGetFirstSubview(inView: HIViewRef): HIViewRef; external name '_HIViewGetFirstSubview';

{
  *  HIViewGetLastSubview()
  *
  *  Discussion:
  *    Returns the last subview of a container. The last subview is the
  *    bottommost subview in z-order.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inView:
  *      The view whose subview you are fetching.
  *
  *  Result:
  *    An HIView reference, or NULL if this view has no subviews or is
  *    invalid.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIViewGetLastSubview(inView: HIViewRef): HIViewRef; external name '_HIViewGetLastSubview';

{
  *  HIViewGetNextView()
  *
  *  Discussion:
  *    Returns the next view after the one given, in z-order.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inView:
  *      The view to use as reference.
  *
  *  Result:
  *    An HIView reference, or NULL if this view has no view behind it
  *    or is invalid.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIViewGetNextView(inView: HIViewRef): HIViewRef; external name '_HIViewGetNextView';

{
  *  HIViewGetPreviousView()
  *
  *  Discussion:
  *    Returns the previous view before the one given, in z-order.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inView:
  *      The view to use as reference.
  *
  *  Result:
  *    An HIView reference, or NULL if this view has no view in front of
  *    it or is invalid.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIViewGetPreviousView(inView: HIViewRef): HIViewRef; external name '_HIViewGetPreviousView';

{
  *  HIViewSetZOrder()
  *
  *  Discussion:
  *    Allows you to change the front-to-back ordering of sibling views.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inView:
  *      The view whose Z-order you wish to change.
  *
  *    inOp:
  *      Indicates to order inView above or below inOther.
  *
  *    inOther:
  *      Another optional view to use as a reference. You can pass NULL
  *      to mean an absolute position. For example, passing
  *      kHIViewZOrderAbove and NULL will move a view to the front of
  *      all of its siblings. Likewise, passing kHIViewZOrderBelow and
  *      NULL will move it to the back.
  *
  *  Result:
  *    An operating system result code.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIViewSetZOrder(
    inView: HIViewRef;
    inOp: HIViewZOrderOp;
    inOther: HIViewRef): OSStatus; external name '_HIViewSetZOrder';       { can be NULL }

{==============================================================================}
{  VISIBILITY                                                                  }
{==============================================================================}
{
  *  HIViewSetVisible()
  *
  *  Discussion:
  *    Hides or shows a view. Marks the area the view will occupy or
  *    used to occupy as needing to be redrawn later.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inView:
  *      The view to hide or show.
  *
  *    inVisible:
  *      A boolean value which indicates whether you wish to hide the
  *      view (false) or show the view (true).
  *
  *  Result:
  *    An operating system result code.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIViewSetVisible(
    inView: HIViewRef;
    inVisible: boolean): OSStatus; external name '_HIViewSetVisible';

{
  *  HIViewIsVisible()
  *
  *  Discussion:
  *    Returns whether a view is visible.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inView:
  *      The view whose visibility you wish to determine.
  *
  *  Result:
  *    A boolean value indicating whether the view is visible (true) or
  *    hidden (false).
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIViewIsVisible(inView: HIViewRef): boolean; external name '_HIViewIsVisible';


{==============================================================================}
{  POSITIONING                                                                 }
{==============================================================================}

{
  *  HIViewGetBounds()
  *
  *  Discussion:
  *    Returns the local bounds of a view. The local bounds are the
  *    coordinate system that is completely view-relative. A view's top
  *    left coordinate starts out at 0, 0. Most operations are done in
  *    these local coordinates. Moving a view is done via the frame
  *    instead.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inView:
  *      The view whose bounds you wish to determine.
  *
  *    outRect:
  *      The local bounds of the view.
  *
  *  Result:
  *    An operating system result code.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIViewGetBounds(
    inView: HIViewRef;
    var outRect: HIRect): OSStatus; external name '_HIViewGetBounds';

{
  *  HIViewGetFrame()
  *
  *  Discussion:
  *    Returns the frame of a view. The frame is the bounds of a view
  *    relative to its parent's local coordinate system.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inView:
  *      The view whose frame you wish to determine.
  *
  *    outRect:
  *      The frame of the view.
  *
  *  Result:
  *    An operating system result code.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIViewGetFrame(
    inView: HIViewRef;
    var outRect: HIRect): OSStatus; external name '_HIViewGetFrame';

{
  *  HIViewSetFrame()
  *
  *  Discussion:
  *    Sets the frame of a view. This effectively moves the view within
  *    its parent. It also marks the view (and anything that was exposed
  *    behind it) to be redrawn.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inView:
  *      The view whose frame you wish to change.
  *
  *    inRect:
  *      The new frame of the view.
  *
  *  Result:
  *    An operating system result code.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIViewSetFrame(
    inView: HIViewRef;
    const (*var*) inRect: HIRect): OSStatus; external name '_HIViewSetFrame';


{
  *  HIViewMoveBy()
  *
  *  Discussion:
  *    Moves a view by a certain distance, relative to its current
  *    location. This affects a view's frame, but not its bounds.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inView:
  *      The view you wish to move.
  *
  *    inDX:
  *      The horizontal distance to move the view. Negative values move
  *      the view to the left, positive values to the right.
  *
  *    inDY:
  *      The vertical distance to move the view. Negative values move
  *      the view upward, positive values downward.
  *
  *  Result:
  *    An operating system result code.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIViewMoveBy(
    inView: HIViewRef;
    inDX: Float32;
    inDY: Float32): OSStatus; external name '_HIViewMoveBy';

{
  *  HIViewPlaceInSuperviewAt()
  *
  *  Discussion:
  *    Places a view at an absolute location within its parent. This
  *    affects the view's frame, but not its bounds.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inView:
  *      The view you wish to position.
  *
  *    inX:
  *      The absolute horizontal coordinate at which to position the
  *      view.
  *
  *    inY:
  *      The absolute vertical coordinate at which to position the view.
  *
  *  Result:
  *    An operating system result code.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIViewPlaceInSuperviewAt(
    inView: HIViewRef;
    inX: Float32;
    inY: Float32): OSStatus; external name '_HIViewPlaceInSuperviewAt';


{
  *  HIViewReshapeStructure()
  *
  *  Discussion:
  *    This is for use by custom views. If a view decides that its
  *    structure will change shape, it should call this. This tells the
  *    Toolbox to recalc things and invalidate as appropriate. You might
  *    use this when gaining/losing a focus ring, for example.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inView:
  *      The view to reshape and invalidate.
  *
  *  Result:
  *    An operating system result code.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIViewReshapeStructure(inView: HIViewRef): OSStatus; external name '_HIViewReshapeStructure';

{
 *  HIViewRegionChanged()
 *
 *  Discussion:
 *    Allows a view to tell the view system that a region of itself has
 *    changed. The view system might choose to react in some way. For
 *    example, if a view's clickable region has changed, this can be
 *    called to tell the Toolbox to resync the region it uses for async
 *    window dragging, if enabled. Likewise, if a view's opaque region
 *    changes, we can adjust the window's opaque shape as well. When
 *    views are moved, resizes, this stuff is taken care of for you. So
 *    this only need be called when there's a change in your view that
 *    occurs outside of those times.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inView:
 *      The view to deal with.
 *
 *    inRegionCode:
 *      The region that was changed. This can only be the structure
 *      opaque, and clickable regions at present.
 *
 *  Result:
 *    An operating system status code.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
 *    Non-Carbon CFM:   not available
}

// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
  function HIViewRegionChanged(
  inView: HIViewRef;
  inRegionCode: ControlPartCode): OSStatus; external name '_HIViewRegionChanged';



{==============================================================================}
{  HIT TESTING/EVENT HANDLING                                                  }
{==============================================================================}
{
  *  HIViewGetViewForMouseEvent()
  *
  *  Discussion:
  *    Returns the appropriate view to handle a mouse event. This is a
  *    little higher-level than GetDeep/ShallowSubviewHit. This routine
  *    will find the deepest view that should handle the mouse event,
  *    but along the way, it sends Carbon Events to each view asking it
  *    to return the appropriate subview. This allows parent views to
  *    catch clicks on their subviews. This is the recommended function
  *    to use before processing mouse events. Using one of the more
  *    primitive functions may result in an undefined behavior. In
  *    general we recommend the use of the Standard Window Handler
  *    instead of calling this function yourself.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inView:
  *      The view to start from. You should pass the window's root view.
  *
  *    inEvent:
  *      The mouse event in question.
  *
  *    outView:
  *      The view that the mouse event should be sent to.
  *
  *  Result:
  *    An operating system result code.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIViewGetViewForMouseEvent(
    inView: HIViewRef;
    inEvent: EventRef;
    var outView: HIViewRef): OSStatus; external name '_HIViewGetViewForMouseEvent';

{
  *  HIViewClick()
  *
  *  Discussion:
  *    After a successful call to HIViewGetViewForMouseEvent for a mouse
  *    down event, you should call this function to have the view handle
  *    the click. In general we recommend the use of the Standard Window
  *    Handler instead of calling this function yourself.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inView:
  *      The view to handle the event.
  *
  *    inEvent:
  *      The mouse event to handle.
  *
  *  Result:
  *    An operating system result code.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIViewClick(
    inView: HIViewRef;
    inEvent: EventRef): OSStatus; external name '_HIViewClick';

{
  *  HIViewSimulateClick()
  *
  *  Discussion:
  *    This function is used to simulate a mouse click on a given view.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inView:
  *      The view to test the part hit.
  *
  *    inPartToClick:
  *      The part the view should consider to be clicked.
  *
  *    inModifiers:
  *      The modifiers the view can consider for its click action.
  *
  *    outPartClicked:
  *      The part that was hit, can be kControlNoPart if no action
  *      occurred.
  *
  *  Result:
  *    An operating system result code.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIViewSimulateClick(
    inView: HIViewRef;
    inPartToClick: HIViewPartCode;
    inModifiers: UInt32;
    var outPartClicked: ControlPartCode): OSStatus; external name '_HIViewSimulateClick';

{
  *  HIViewGetPartHit()
  *
  *  Discussion:
  *    Given a view, and a view-relative point, this function returns
  *    the part code hit as determined by the view.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inView:
  *      The view to test the part hit.
  *
  *    inPoint:
  *      The view-relative point to use.
  *
  *    outPart:
  *      The part hit by inPoint.
  *
  *  Result:
  *    An operating system result code.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIViewGetPartHit(
    inView: HIViewRef;
    const (*var*) inPoint: HIPoint;
    var outPart: HIViewPartCode): OSStatus; external name '_HIViewGetPartHit';

{
  *  HIViewGetSubviewHit()
  *
  *  Discussion:
  *    Returns the child of the given view hit by the point passed in.
  *    This is more primitive than using HIViewGetViewForMouseEvent, and
  *    should be used only in non-event-handling cases.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inView:
  *      The view you wish to position.
  *
  *    inPoint:
  *      The mouse coordinate to use. This is passed in the local
  *      coordinate system of inView.
  *
  *    inDeep:
  *      Pass true to find the deepest child hit, false to go only one
  *      level deep (just check direct children of inView).
  *
  *    outView:
  *      The view hit by inPoint, or NULL if no subview was hit.
  *
  *  Result:
  *    An operating system result code.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIViewGetSubviewHit(
    inView: HIViewRef;
    const (*var*) inPoint: HIPoint;
    inDeep: boolean;
    var outView: HIViewRef): OSStatus; external name '_HIViewGetSubviewHit';

{==============================================================================}
{  DISPLAY                                                                     }
{==============================================================================}
{
  *  HIViewGetNeedsDisplay()
  *
  *  Discussion:
  *    Returns true if the view passed in or any subview of it requires
  *    redrawing (i.e. part of it has been invalidated).
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inView:
  *      The view to inspect.
  *
  *  Result:
  *    A boolean result code.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIViewGetNeedsDisplay(inView: HIViewRef): boolean; external name '_HIViewGetNeedsDisplay';

{
  *  HIViewSetNeedsDisplay()
  *
  *  Discussion:
  *    Marks a view as needing to be completely redrawn, or completely
  *    valid. If the view is not visible, or is obscured completely by
  *    other views, no action is taken.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inView:
  *      The view to mark dirty.
  *
  *    inNeedsDisplay:
  *      A boolean which indicates whether inView needs to be redrawn or
  *      not.
  *
  *  Result:
  *    An operating system result code.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIViewSetNeedsDisplay(
    inView: HIViewRef;
    inNeedsDisplay: boolean): OSStatus; external name '_HIViewSetNeedsDisplay';


{
  *  HIViewSetNeedsDisplayInRegion()
  *
  *  Discussion:
  *    Marks a portion of a view as needing to be redrawn, or valid. If
  *    the view is not visible, or is obscured completely by other
  *    views, no action is taken. The region passed is effectively
  *    intersected with the view's visible region.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inView:
  *      The view to mark dirty.
  *
  *    inRgn:
  *      The region to mark dirty or clean.
  *
  *    inNeedsDisplay:
  *      A boolean which indicates whether or not inRgn should be added
  *      to the display region or removed from it.
  *
  *  Result:
  *    An operating system result code.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIViewSetNeedsDisplayInRegion(
    inView: HIViewRef;
    inRgn: RgnHandle;
    inNeedsDisplay: boolean): OSStatus; external name '_HIViewSetNeedsDisplayInRegion';

{
 *  HIViewRender()
 *
 *  Discussion:
 *    Renders the invalid portions of a view (as marked with
 *    HIViewSetNeedsDisplay[InRegion] immediately. Normally, these
 *    areas are redraw at event loop time, but there might be
 *    situations where you need an immediate draw. Use this sparingly,
 *    as it does cause a fully composited draw for the area of the
 *    control. Calling this for several views at a particular level of
 *    a hierarchy can be costsly.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inView:
 *      The view to draw.
 *
 *  Result:
 *    An operating system result code.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
 *    Non-Carbon CFM:   not available
}

// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
  function HIViewRender(inView: HIViewRef): OSStatus; external name '_HIViewRender';


{
  *  HIViewFlashDirtyArea()
  *
  *  Discussion:
  *    Debugging aid. Flashes the region which would be redrawn at the
  *    next draw time for an entire window.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inWindow:
  *      The window to flash the dirty region for.
  *
  *  Result:
  *    An operating system result code.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIViewFlashDirtyArea(inWindow: WindowRef): OSStatus; external name '_HIViewFlashDirtyArea';

{
  *  HIViewGetSizeConstraints()
  *
  *  Discussion:
  *    Return the minimum and maximum size for a control. A control must
  *    respond to this protocol to get meaningful results. These sizes
  *    can be used to help autoposition subviews, for example.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inView:
  *      The view to inspect.
  *
  *    outMinSize:
  *      The minimum size the view can be. May be NULL if you don't need
  *      this information.
  *
  *    outMaxSize:
  *      The maximum size the view can be. May be NULL if you don't need
  *      this information.
  *
  *  Result:
  *    An operating system result code.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIViewGetSizeConstraints(
    inView: HIViewRef;
    outMinSize: HISizePtr;             { can be NULL }
    outMaxSize: HISizePtr): OSStatus; external name '_HIViewGetSizeConstraints';  { can be NULL }



{==============================================================================}
{  COORDINATE SYSTEM CONVERSION                                                }
{==============================================================================}
{
  *  HIViewConvertPoint()
  *
  *  Discussion:
  *    Converts a point from one view to another. Both views must have a
  *    common ancestor, i.e. they must both be in the same window.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    ioPoint:
  *      The point to convert.
  *
  *    inSourceView:
  *      The view whose coordinate system ioPoint is starting out in.
  *      You can pass NULL to indicate that ioPoint is a window-relative
  *      point.
  *
  *    inDestView:
  *      The view whose coordinate system ioPoint should end up in. You
  *      can pass NULL to indicate that ioPoint is a window-relative
  *      point.
  *
  *  Result:
  *    An operating system result code.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIViewConvertPoint(
    var ioPoint: HIPoint;
    inSourceView: HIViewRef;
    inDestView: HIViewRef): OSStatus; external name '_HIViewConvertPoint';

{
  *  HIViewConvertRect()
  *
  *  Discussion:
  *    Converts a rectangle from one view to another. Both views must
  *    have a common ancestor, i.e. they must both be in the same window.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    ioRect:
  *      The rectangle to convert.
  *
  *    inSourceView:
  *      The view whose coordinate system ioRect is starting out in. You
  *      can pass NULL to indicate that ioRect is a window-relative
  *      rectangle.
  *
  *    inDestView:
  *      The view whose coordinate system ioRect should end up in. You
  *      can pass NULL to indicate that ioRect is a window-relative
  *      rectangle.
  *
  *  Result:
  *    An operating system result code.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIViewConvertRect(
    var ioRect: HIRect;
    inSourceView: HIViewRef;
    inDestView: HIViewRef): OSStatus; external name '_HIViewConvertRect';

{
  *  HIViewConvertRegion()
  *
  *  Discussion:
  *    Converts a region from one view to another. Both views must have
  *    a common ancestor, i.e. they must both be in the same window.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    ioRgn:
  *      The region to convert.
  *
  *    inSourceView:
  *      The view whose coordinate system ioRgn is starting out in. You
  *      can pass NULL to indicate that ioRgn is a window-relative
  *      region.
  *
  *    inDestView:
  *      The view whose coordinate system ioRgn should end up in. You
  *      can pass NULL to indicate that ioRgn is a window-relative
  *      region.
  *
  *  Result:
  *    An operating system result code.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIViewConvertRegion(
    ioRgn: RgnHandle;
    inSourceView: HIViewRef;
    inDestView: HIViewRef): OSStatus; external name '_HIViewConvertRegion';


{
  *  HIViewSetDrawingEnabled()
  *
  *  Discussion:
  *    Turns control drawing on or off. You can use this to ensure that
  *    no drawing occurs wrt to the control. Even Draw1Control will not
  *    draw! HIViewSetNeedsDisplay is also rendered useless when drawing
  *    is off.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inView:
  *      The view to enable or disable drawing for.
  *
  *    inEnabled:
  *      A boolean value indicating whether drawing should be on (true)
  *      or off (false).
  *
  *  Result:
  *    An operating system result code.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIViewSetDrawingEnabled(
    inView: HIViewRef;
    inEnabled: boolean): OSStatus; external name '_HIViewSetDrawingEnabled';

{
  *  HIViewIsDrawingEnabled()
  *
  *  Discussion:
  *    Determines if drawing is currently enabled for a control.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inView:
  *      The view to get the drawing state for.
  *
  *  Result:
  *    A boolean value indicating whether drawing is on (true) or off
  *    (false).
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIViewIsDrawingEnabled(inView: HIViewRef): boolean; external name '_HIViewIsDrawingEnabled';


{
  *  HIViewScrollRect()
  *
  *  Discussion:
  *    Scrolls a view's contents, or a portion thereof. This will
  *    actually blit the contents of the view as appropriate to scroll,
  *    and then invalidate those portions which need to be redrawn. Be
  *    warned that this is a raw bit scroll. Anything that might overlap
  *    the target view will get thrashed as well.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inView:
  *      The view to scroll.
  *
  *    inRect:
  *      The rect to scroll. Pass NULL to mean the entire view. The rect
  *      passed cannot be bigger than the view's bounds. It must be in
  *      the local coordinate system of the view.
  *
  *    inDX:
  *      The horizontal distance to scroll. Positive values shift to the
  *      right, negative values shift to the left.
  *
  *    inDY:
  *      The vertical distance to scroll. Positive values shift
  *      downward, negative values shift upward.
  *
  *  Result:
  *    An operating system result code.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIViewScrollRect(
    inView: HIViewRef;
    inRect: HIRectPtr;       { can be NULL }
    inDX: Float32;
    inDY: Float32): OSStatus; external name '_HIViewScrollRect';

{
  *  HIViewSetBoundsOrigin()
  *
  *  Discussion:
  *    This API sets the origin of the view. This effectively also moves
  *    all subcontrols of a view as well. This call will NOT invalidate
  *    the view. This is because you might want to move the contents
  *    with HIViewScrollRect instead of redrawing the complete content.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inView:
  *      The view whose origin you wish to adjust.
  *
  *    inX:
  *      The X coordinate.
  *
  *    inY:
  *      The Y coordinate.
  *
  *  Result:
  *    An operating system result code.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIViewSetBoundsOrigin(
    inView: HIViewRef;
    inX: Float32;
    inY: Float32): OSStatus; external name '_HIViewSetBoundsOrigin';


{==============================================================================}
{  KEYBOARD FOCUS                                                              }
{==============================================================================}
{
  *  HIViewAdvanceFocus()
  *
  *  Discussion:
  *    Advances the focus to the next most appropriate view. Unless
  *    overriden in some fashion (either by overriding certain carbon
  *    events or using the HIViewSetNextFocus API), the Toolbox will use
  *    a spacially determinant method of focusing, attempting to focus
  *    left to right, top to bottom in a window, taking groups of
  *    controls into account.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inRootForFocus:
  *      The subtree to manipulate. The focus will never leave
  *      inRootToFocus. Typically you would pass the content of the
  *      window, or the root. If focused on the toolbar, for example,
  *      the focus is limited to the toolbar only. In this case, the
  *      Toolbox passes the toolbar view in as the focus root for
  *      example.
  *
  *    inModifiers:
  *      The EventModifiers of the keyboard event that ultimately caused
  *      the call to HIViewAdvanceFocus. These modifiers are used to
  *      determine the focus direction as well as other alternate
  *      focusing behaviors.
  *
  *  Result:
  *    An operating system result code.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIViewAdvanceFocus(
    inRootForFocus: HIViewRef;
    inModifiers: EventModifiers): OSStatus; external name '_HIViewAdvanceFocus';

{
  *  HIViewGetFocusPart()
  *
  *  Discussion:
  *    Returns the currently focused part of the given view.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inView:
  *      The view to inquire about.
  *
  *    outFocusPart:
  *      The part currently focused.
  *
  *  Result:
  *    An operating system result code.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIViewGetFocusPart(
    inView: HIViewRef;
    var outFocusPart: HIViewPartCode): OSStatus; external name '_HIViewGetFocusPart';

{
  *  HIViewSubtreeContainsFocus()
  *
  *  Discussion:
  *    Given a view, this function checks to see if it or any of its
  *    children currently are the keyboard focus. If so, true is
  *    returned as the function result.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inSubtreeStart:
  *      The view to start searching at.
  *
  *  Result:
  *    A boolean result.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIViewSubtreeContainsFocus(inSubtreeStart: HIViewRef): boolean; external name '_HIViewSubtreeContainsFocus';

{
  *  HIViewSetNextFocus()
  *
  *  Discussion:
  *    This function hard-wires the next sibling view to shift focus to
  *    whenever the keyboard focus is advanced.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inView:
  *      The view to set the next focus view for. This parameter and the
  *      inNextFocus parameter must both have the same parent view.
  *
  *    inNextFocus:
  *      The view to set focus to next. This parameter and the inView
  *      parameter must both have the same parent view. Pass NULL to
  *      tell the view system to use the default rules.
  *
  *  Result:
  *    An operating system result code.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIViewSetNextFocus(
    inView: HIViewRef;
    inNextFocus: HIViewRef): OSStatus; external name '_HIViewSetNextFocus';       { can be NULL }

{
  *  HIViewSetFirstSubViewFocus()
  *
  *  Discussion:
  *    This function hard-wires the first subview to shift focus to
  *    whenever the keyboard focus is advanced and the container view is
  *    entered.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inParent:
  *      The parent view.
  *
  *    inSubView:
  *      The first child which should receive focus. Pass NULL to tell
  *      the view system to use the default rules.
  *
  *  Result:
  *    An operating system result code.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIViewSetFirstSubViewFocus(
    inParent: HIViewRef;
    inSubView: HIViewRef): OSStatus; external name '_HIViewSetFirstSubViewFocus';       { can be NULL }

{==============================================================================}
{  LAYOUT                                                                      }
{                                                                              }
{  Mac OS X 10.3 provides a layout engine for HIViews that allows applications }
{  to specify the layout relationships between multiple views. The layout      }
{  engine will automatically reposition and resize views that have layout      }
{  information when necessary.                                                 }
{==============================================================================}

{
 *  Summary:
 *    Since horizontal and vertical bindings are very similar in
 *    application, except along different axes, the binding kinds have
 *    been abstracted to minimum and maximum. Synonyms have been
 *    provided for convenience. You are encouraged to use them.
 *
 *  Discussion:
 *    HIBindingKind constants.
 }
const
  {
   * No binding is to occur.
   }
  kHILayoutBindNone             = 0;

  {
   * Bind to the minimum of the axis.
   }
  kHILayoutBindMin              = 1;

  {
   * Bind to the maximum of the axis.
   }
  kHILayoutBindMax              = 2;
  kHILayoutBindLeft             = kHILayoutBindMin;
  kHILayoutBindRight            = kHILayoutBindMax;

  {
   * Synonyms for convenience and clarity.
   }
  kHILayoutBindTop              = kHILayoutBindMin;
  kHILayoutBindBottom           = kHILayoutBindMax;

type HIBindingKind = UInt16;

{
 *  HISideBinding
 *
 *  Summary:
 *    A binding for a side of an HIView.
 *
 *  Discussion:
 *    A side binding is entirely related to the change of the parent's
 *    position or size (but only as the size affects the maximum edge
 *    position). A side binding doesn't mean "move to where my
 *    relative's side is" but rather "move as my relative's side has
 *    moved".
 }
type HISideBinding = record

  {
   * An HIViewRef to the view to which this side is bound. Can be NULL,
   * indicating that the the side is bound to its parent view.
   }
  toView: HIViewRef;                 { NULL means parent}

  {
   * An HIBindingKind indicating the bind kind.
   }
  kind: HIBindingKind;

  {
   * Not currently used. Must be set to 0.
   }
  offset: Float32;
end;
{
    const HISideBinding kHISideNoBinding = ( NULL, kHILayoutBindNone );
}

{
 *  HIBinding
 *
 *  Summary:
 *    A set of Top, Left, Bottom, and Right bindings for an HIView.
 }
type HIBinding = record
  {
   * The top side bindings.
   }
  top: HISideBinding;

  {
   * The left side bindings.
   }
  left: HISideBinding;

  {
   * The bottom side bindings.
   }
  bottom: HISideBinding;

  {
   * The right side bindings.
   }
  right: HISideBinding;
end;
{
    const HIBinding kHINoBinding = ( kHISideNoBinding, kHISideNoBinding, kHISideNoBinding, kHISideNoBinding );
}

{
 *  Discussion:
 *    HIScaleKind constants.
 }
const
  {
   * The scale is determined from the axis size.
   }
  kHILayoutScaleAbsolute        = 0;


type HIScaleKind = UInt16;

{
 *  HIAxisScale
 *
 *  Summary:
 *    A scale description for an axis of an HIView.
 }
type HIAxisScale = record
  {
   * An HIViewRef to the view to which this axis is scaled. Can be
   * NULL, indicating that the the axis is scaled relative to its
   * parent view.
   }
  toView: HIViewRef;                 { NULL means parent}

  {
   * An HIScaleKind describing the type of scaling to be applied.
   * Currently, this field can't be anything other than
   * kScalingAbsolute.
   }
  kind: HIScaleKind;

  {
   * A float indicating how much to scale the HIView. 0 indicates no
   * scaling. A value of 1 indicates that the view is to always have
   * the same axial size.
   }
  ratio: Float32;
end;

{
 *  HIScaling
 *
 *  Summary:
 *    A set of scaling descriptions for the axes of an HIView.
 }
type HIScaling = record
  {
   * An HIAxisScale describing the horizontal scaling for an HIView.
   }
  x: HIAxisScale;
  y: HIAxisScale;
end;

{
 *  Summary:
 *    Since horizontal and vertical positions are very similar in
 *    application, except along different axes, the position kinds have
 *    been abstracted to minimum and maximum. Synonyms have been
 *    provided for convenience. You are encouraged to use them.
 *
 *  Discussion:
 *    HIPositionKind constants.
 }
const
  {
   * No positioning is to occur.
   }
  kHILayoutPositionNone         = 0;

  {
   * Centered positioning will occur. The view will be centered
   * relative to the specified view.
   }
  kHILayoutPositionCenter       = 1;

  {
   * Minimum positioning will occur. The view will be left or top
   * aligned relative to the specified view.
   }
  kHILayoutPositionMin          = 2;

  {
   * Maximum positioning will occur. The view will be right or bottom
   * aligned relative to the specified view.
   }
  kHILayoutPositionMax          = 3;

  {
   * Synonyms for convenience and clarity.
   }
  kHILayoutPositionLeft         = kHILayoutPositionMin;
  kHILayoutPositionRight        = kHILayoutPositionMax;
  kHILayoutPositionTop          = kHILayoutPositionMin;
  kHILayoutPositionBottom       = kHILayoutPositionMax;

type HIPositionKind = UInt16;

{
 *  HIAxisPosition
 *
 *  Summary:
 *    An axial position description for an HIView.
 }
type HIAxisPosition = record
  {
   * An HIViewRef to the view relative to which a view will be
   * positioned. Can be NULL, indicating that the the view is
   * positioned relative to its parent view.
   }
  toView: HIViewRef;                 { NULL means parent}

  {
   * An HIPositionKind indicating the kind of positioning to apply.
   }
  kind: HIPositionKind;

  {
   * After the position kind has been applied, the origin component
   * that corresponds to the positioning axis is offet by this value.
   * (ex: Left aligned + 10 ).
   }
  offset: Float32;
end;

{
 *  HIPositioning
 *
 *  Summary:
 *    A positioning description for an HIView.
 }
type HIPositioning = record
  {
   * An HIAxisPosition describing the horizontal positioning for an
   * HIView.
   }
  x: HIAxisPosition;
  y: HIAxisPosition;
end;

{
 *  HILayoutInfo
 *
 *  Summary:
 *    A layout description for an HIView.
 *
 *  Discussion:
 *    The different layout transformations are applied sequentially to
 *    the HIView. First, the bindings are applied. Note that the
 *    bindings are applied recursively to a container's HIViews. This
 *    requires care on your part, especially when applying
 *    inter-relational bindings. Then the scaling (which could
 *    potentially override some of the previously applied bindings).
 *    Then the positioning (which could potentially override some of
 *    the previously applied bindings).
 }
type HILayoutInfo = record
  {
   * The version of the structure. The current version is
   * kHILayoutInfoVersionZero.
   }
  version: UInt32;

  {
   * An HIBinding structure describing the kinds of bindings to apply
   * to the sides of an HIView.
   }
  binding: HIBinding;

  {
   * An HIScaling structure describing the axial scaling to apply to an
   * HIView.
   }
  scale: HIScaling;

  {
   * An HIPositioning structure positioning to apply to an HIView.
   }
  position: HIPositioning;
end;

const
  kHILayoutInfoVersionZero      = 0;


{
const HILayoutInfo kHILayoutInfoNone = (
    kHILayoutInfoVersionZero,
    kHINoBinding,
    ( ( NULL, 0.0 ), ( NULL, 0.0 ) ),
    ( ( NULL, kHILayoutPositionNone ), ( NULL, kHILayoutPositionNone ) )
);

}
{
 *  HIViewGetLayoutInfo()
 *
 *  Summary:
 *    Get the layout info of an HIView.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inView:
 *      The HIView whose layout info is to be retreived.
 *
 *    outLayoutInfo:
 *      A pointer to an HILayoutInfo record into which to copy the
 *      layout info of the HIView. The version field of this record
 *      must be valid or the call will fail.
 *
 *  Result:
 *    An operating system status code.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function HIViewGetLayoutInfo( inView: HIViewRef; var outLayoutInfo: HILayoutInfo ): OSStatus; external name '_HIViewGetLayoutInfo';


{
 *  HIViewSetLayoutInfo()
 *
 *  Summary:
 *    Set the layout info of an HIView.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inView:
 *      The HIView whose layout info is to be retreived.
 *
 *    inLayoutInfo:
 *      A pointer to an HILayoutInfo record from which to copy the
 *      layout info for the HIView.
 *
 *  Result:
 *    An operating system status code.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function HIViewSetLayoutInfo( inView: HIViewRef; const (*var*) inLayoutInfo: HILayoutInfo ): OSStatus; external name '_HIViewSetLayoutInfo';


{
 *  HIViewSuspendLayout()
 *
 *  Summary:
 *    Suspends all layout handling for this layout and its children.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inView:
 *      The HIView whose layout handling is to be suspended.
 *
 *  Result:
 *    An operating system status code.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function HIViewSuspendLayout( inView: HIViewRef ): OSStatus; external name '_HIViewSuspendLayout';


{
 *  HIViewResumeLayout()
 *
 *  Summary:
 *    Resumes all layout handling for this layout and its children.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inView:
 *      The HIView whose layout handling is to be resumed.
 *
 *  Result:
 *    An operating system status code.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function HIViewResumeLayout( inView: HIViewRef ): OSStatus; external name '_HIViewResumeLayout';


{
 *  HIViewIsLayoutActive()
 *
 *  Summary:
 *    Tests the view to determine if layout is active or suspended.
 *    Note that this test does not determine whether or not the view
 *    has a valid layout, only whether or not the layout engine is
 *    active for the view.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inView:
 *      The HIView whose layout handling is to be tested.
 *
 *  Result:
 *    True if the view would respond to any linked relative's changes,
 *    otherwise false.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function HIViewIsLayoutActive( inView: HIViewRef ): Boolean; external name '_HIViewIsLayoutActive';


{
 *  HIViewApplyLayout()
 *
 *  Summary:
 *    Applies the current layout into to the specified view. Side
 *    bindings have no effect, but positioning and scaling will occur,
 *    in that order.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inView:
 *      The HIView whose layout info is to be applied.
 *
 *  Result:
 *    An operating system status code.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function HIViewApplyLayout( inView: HIViewRef ): OSStatus; external name '_HIViewApplyLayout';

{==============================================================================}
{  MISCELLANEOUS                                                               }
{==============================================================================}
{
 *  HIViewGetWindow()
 *
 *  Discussion:
 *    Returns a reference to the window a given view is bound to. If
 *    the view reference passed is invalid, or the view is not embedded
 *    into any window, NULL is returned.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inView:
 *      The view to query.
 *
 *  Result:
 *    A window reference.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
 *    Non-Carbon CFM:   not available
}
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
  function HIViewGetWindow(inView: HIViewRef): WindowRef; external name '_HIViewGetWindow';


{
  *  HIViewFindByID()
  *
  *  Discussion:
  *    Allows you to find a particular view by its ID. Currently, this
  *    call uses the ControlID type as its IDs.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inStartView:
  *      The view to start searching at.
  *
  *    inID:
  *      The ID of the view you are looking for.
  *
  *    outControl:
  *      Receives the control if found.
  *
  *  Result:
  *    An operating system result code.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIViewFindByID(
    inStartView: HIViewRef;
    inID: HIViewID;
    var outControl: HIViewRef): OSStatus; external name '_HIViewFindByID';


{
  *  HIViewGetAttributes()
  *
  *  Discussion:
  *    Allows you to get the attributes of a view.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inView:
  *      The view to inspect.
  *
  *    outAttrs:
  *      The attributes of the view.
  *
  *  Result:
  *    An operating system result code.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIViewGetAttributes(
    inView: HIViewRef;
    var outAttrs: OptionBits): OSStatus; external name '_HIViewGetAttributes';


{
  *  HIViewChangeAttributes()
  *
  *  Discussion:
  *    Allows you to change the attributes of a view. You can
  *    simultaneously set and clear attributes.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inView:
  *      The view to muck with.
  *
  *    inAttrsToSet:
  *      The attributes you wish to set.
  *
  *    inAttrsToClear:
  *      The attributes you wish to clear.
  *
  *  Result:
  *    An operating system result code.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIViewChangeAttributes(
    inView: HIViewRef;
    inAttrsToSet: OptionBits;
    inAttrsToClear: OptionBits): OSStatus; external name '_HIViewChangeAttributes';


{
  *  HIViewCreateOffscreenImage()
  *
  *  Discussion:
  *    Creates an CGImageRef for the view passed in. The view and any
  *    children it has are rendered in the resultant image.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inView:
  *      The view you wish to create an image of.
  *
  *    inOptions:
  *      Options. Currently you must pass 0.
  *
  *    outFrame:
  *      The frame of the view within the resultant image. It is in the
  *      coordinate system of the image, where 0,0 is the top left
  *      corner of the image. This is so you can know exactly where the
  *      control lives in the image when the control draws outside its
  *      bounds for things such as shadows.
  *
  *    outImage:
  *      The image of the view, including anything that would be drawn
  *      outside the view's frame.
  *
  *  Result:
  *    An operating system status code.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIViewCreateOffscreenImage(
    inView: HIViewRef;
    inOptions: OptionBits;
    outFrame: HIRectPtr;        { can be NULL }
    var outImage: CGImageRef): OSStatus; external name '_HIViewCreateOffscreenImage';


{
  *  HIViewDrawCGImage()
  *
  *  Discussion:
  *    Draws an image in the right direction for an HIView. This is
  *    functionally the same as CGContextDrawImage, but it flips the
  *    context appropriately so that the image is drawn correctly.
  *    Because HIViews have their origin at the top, left, you are
  *    really drawing upside-down, so if you were to use the CG image
  *    drawing, you'd see what I mean! This call attempts to insulate
  *    you from that fact.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inContext:
  *      The context to draw in.
  *
  *    inBounds:
  *      The bounds to draw the image into.
  *
  *    inImage:
  *      The image to draw.
  *
  *  Result:
  *    An operating system status code.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIViewDrawCGImage(
    inContext: CGContextRef;
    const (*var*) inBounds: HIRect;
    inImage: CGImageRef): OSStatus; external name '_HIViewDrawCGImage';

{
 *  HIViewGetFeatures()
 *
 *  Discussion:
 *    Returns the features for the current view. This only returns
 *    feature bits for the HIView space. Older Control Manager features
 *    such as kControlSupportsDataAccess are not returned.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inView:
 *      The view to query
 *
 *    outFeatures:
 *      On output, the features for the view.
 *
 *  Result:
 *    An operating system status code.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
 *    Non-Carbon CFM:   not available
}
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
  function HIViewGetFeatures(
  inView: HIViewRef;
  var outFeatures: HIViewFeatures): OSStatus; external name '_HIViewGetFeatures';


{
 *  HIViewChangeFeatures()
 *
 *  Discussion:
 *    Allows you to change a view's features on the fly. Typically,
 *    this is up to the view itself to control. For example, it might
 *    decide that under some situations it is opaque and other others
 *    it is transparent. In general entities outside of the view itself
 *    should not call this function. The only exception might be UI
 *    building tools, where it would want to make sure a view always
 *    responds to clicks, for example, so it could override mouse
 *    tracking to drag items around.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inView:
 *      The view to change
 *
 *    inFeaturesToSet:
 *      The features to enable
 *
 *    inFeaturesToClear:
 *      The features to disable
 *
 *  Result:
 *    An operating system status code.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
 *    Non-Carbon CFM:   not available
}
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
  function HIViewChangeFeatures(
  inView: HIViewRef;
  inFeaturesToSet: HIViewFeatures;
  inFeaturesToClear: HIViewFeatures): OSStatus; external name '_HIViewChangeFeatures';


{==============================================================================}
{  HIGrowBoxView                                                               }
{                                                                              }
{  The grow box view is a new view starting in Mac OS 10.2. It can be used in  }
{  both the new compositing mode, as well as the traditional control manager   }
{  mode. Like all new HIFoo views, this view is created invisibly. You must    }
{  show the view after creation if you want to, like, see it and stuff.        }
{==============================================================================}


{ The HIObject class ID for the HIGrowBoxView class. }

{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kHIGrowBoxViewClassID CFSTRP('com.apple.higrowboxview')}
{$endc}


{ Currently there is no direct creation API for the grow box, so you must use
  HIObjectCreate if you wish to create one directly. Normally, a window will
  create one for you, so you should generally never need to do this.           }


{
  *  HIGrowBoxViewSetTransparent()
  *
  *  Discussion:
  *    Sets a grow box view as transparent, meaning it will draw the
  *    grow box lines over any content below it. When not transparent,
  *    it's an opaque white square with the grow lines.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inGrowBoxView:
  *      The grow box view reference.
  *
  *    inTransparent:
  *      Pass true to make the grow view use its transparent look, false
  *      to give it the opaque look.
  *
  *  Result:
  *    An operating system result code.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIGrowBoxViewSetTransparent(
    inGrowBoxView: HIViewRef;
    inTransparent: boolean): OSStatus; external name '_HIGrowBoxViewSetTransparent';

{
  *  HIGrowBoxViewIsTransparent()
  *
  *  Discussion:
  *    Returns true if a grow box view is set to be transparent.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inGrowBoxView:
  *      The grow box view reference.
  *
  *  Result:
  *    A boolean result.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIGrowBoxViewIsTransparent(inGrowBoxView: HIViewRef): boolean; external name '_HIGrowBoxViewIsTransparent';


{==============================================================================}
{  HIScrollView                                                                }
{                                                                              }
{  The scroll view is a new view starting in Mac OS 10.2. It can be used in    }
{  the new compositing mode ONLY due to the nature of how it works. Like all   }
{  new HIFoo views, this view is created invisibly. You must show the view     }
{  after creation if you want to, like, see it and stuff.                      }
{==============================================================================}

{  The HIObject class ID for the HIScrollView class. }
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kHIScrollViewClassID CFSTRP('com.apple.HIScrollView')}
{$endc}

const
  kEventClassScrollable         = $7363726C (* 'scrl' *);


const

{
 *  kEventClassScrollable / kEventScrollableGetInfo
 *
 *  Summary:
 *    Requests information from an HIScrollViewÕs scrollable view about
 *    its size and origin.
 *
 *  Discussion:
 *    This event is sent by an HIScrollView to its scrollable view to
 *    determine the current size and origin of the scrollable view. A
 *    scrollable view must implement this event in order to scroll
 *    properly inside an HIScrollView.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    <-- kEventParamImageSize (out, typeHISize)
 *          On exit, contains the size of the entire scrollable view.
 *
 *    <-- kEventParamViewSize (out, typeHISize)
 *          On exit, contains the amount of the scrollable view that is
 *          visible.
 *
 *    <-- kEventParamLineSize (out, typeHISize)
 *          On exit, contains the amount that should be scrolled in
 *          response to a single click on a scrollbar arrow.
 *
 *    <-- kEventParamOrigin (out, typeHIPoint)
 *          On exit, contains the scrollable viewÕs current origin (the
 *          view-relative coordinate that is drawn at the top left
 *          corner of its frame). These coordinates should always be
 *          greater than or equal to zero. They should be less than or
 *          equal to the viewÕs image size minus its view size.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available
}

  kEventScrollableGetInfo       = 1;

{
 *  kEventClassScrollable / kEventScrollableInfoChanged
 *
 *  Summary:
 *    Notification that the size or origin of an HIScrollViewÕs
 *    scrollable view has changed.
 *
 *  Discussion:
 *    This event is not sent by HIScrollView itself; rather, it may be
 *    sent to an instance of HIScrollView to notify the scroll view
 *    that the size or origin of its scrollable view have changed. The
 *    HIScrollView responds to this event by sending a
 *    kEventScrollableGetInfo to its scrollable view. It then updates
 *    the scroll bars appropriately to reflect the new reality of the
 *    scrollable view. It does NOT move the origin of the scrollable
 *    view at all. It is just a notification to allow the scroll view
 *    to sync up with its scrollable view.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available
}

  kEventScrollableInfoChanged   = 2;

{
 *  kEventClassScrollable / kEventScrollableScrollTo
 *
 *  Summary:
 *    Requests that an HIScrollViewÕs scrollable view should scroll to
 *    a particular origin.
 *
 *  Discussion:
 *    This event is sent by an HIScrollView to its scrollable view to
 *    request that the scrollable view update its current origin and
 *    redraw. Typically, a scrollable view will record its current
 *    origin in its own instance data; it should update the origin in
 *    response to this event. A scrollable view should also use either
 *    HIViewScrollRect to scroll its content, or HIViewSetNeedsDisplay
 *    to cause itself to redraw using the new origin point. A
 *    scrollable view must implement this event in order to scroll
 *    properly inside an HIScrollView.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamOrigin (in, typeHIPoint)
 *          The new origin for the scrollable view. The origin
 *          coordinates will vary from (0,0) to scrollable viewÕs image
 *          size minus its view size.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available
}

  kEventScrollableScrollTo      = 10;


const
  kEventParamImageSize          = $696D737A (* 'imsz' *); { type HISize}
  kEventParamViewSize           = $7677737A (* 'vwsz' *); { type HISize}
  kEventParamLineSize           = $6C6E737A (* 'lnsz' *); { type HISize}
  kEventParamOrigin             = $6F72676E (* 'orgn' *); { type HIPoint}


{
  *  Discussion:
  *    HIScrollView options
  }


{GRP translation note: Options are passed to OptionBits (UInt32) type formal parameters. Therefore, hex
constants were used to ensure size and bit position are correct.}

const

{
    * This indicates that a vertical scroll bar is desired.
    }
  kHIScrollViewOptionsVertScroll = $00000001; {(1 << 0)}

{
    * This indicates that a horizontal scroll bar is desired.
    }
  kHIScrollViewOptionsHorizScroll = $00000002; {(1 << 1)}

{
    * This indicates that space for a grow box should be taken into
    * account when layout out scroll bars. If both the horizontal and
    * vertical scroll bars are requested, this attribute is assumed.
    }
  kHIScrollViewOptionsAllowGrow = $00000004; {(1 << 2)}
  kHIScrollViewValidOptions     = $00000007; {(kHIScrollViewOptionsVertScroll | kHIScrollViewOptionsHorizScroll | kHIScrollViewOptionsAllowGrow)}


{
 *  HIScrollViewAction
 *
 *  Summary:
 *    HIScrollView navigation actions. See HIScrollViewNavigate for
 *    more information.
 }
type HIScrollViewAction = UInt32;
const
  {
   * The scroll view should move to the top of the content.
   }
  kHIScrollViewScrollToTop      = (1 shl 0);

  {
   * The scroll view should move to the bottom of the content.
   }
  kHIScrollViewScrollToBottom   = (1 shl 1);

  {
   * The scroll view should move to the left of the content.
   }
  kHIScrollViewScrollToLeft     = (1 shl 2);

  {
   * The scroll view should move to the right of the content.
   }
  kHIScrollViewScrollToRight    = (1 shl 3);

  {
   * The scroll view should page up.
   }
  kHIScrollViewPageUp           = (1 shl 4);

  {
   * The scroll view should page down.
   }
  kHIScrollViewPageDown         = (1 shl 5);

  {
   * The scroll view should page left.
   }
  kHIScrollViewPageLeft         = (1 shl 6);

  {
   * The scroll view should page right.
   }
  kHIScrollViewPageRight        = (1 shl 7);


{
  *  HIScrollViewCreate()
  *
  *  Discussion:
  *    Creates a scroll view. This view has 3 parts, essentially. It can
  *    have one or two scroll bars (horizontal/vertical), and a view to
  *    be scrolled. The view to be scrolled is merely added via
  *    HIViewAddSubview. The scroll view will automatically connect it
  *    up appropriately. **** THIS MAY CHANGE
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inOptions:
  *      Options for our scroll view. You must specify either a
  *      horizontal or a vertical scroll bar. If neither is passed, an
  *      error is returned.
  *
  *    outView:
  *      The new scroll view.
  *
  *  Result:
  *    An operating system result code.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIScrollViewCreate(
    inOptions: OptionBits;
    var outView: HIViewRef): OSStatus; external name '_HIScrollViewCreate';


{
  *  HIScrollViewSetScrollBarAutoHide()
  *
  *  Discussion:
  *    Sets a scroll view's scroll bars to auto-hide when the entire
  *    scrollable view it is managing can be fully displayed in its
  *    bounds. This is similar to the behavior you see in the Preview
  *    application.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inView:
  *      The view to affect.
  *
  *    inAutoHide:
  *      The new auto-hide setting (true == auto-hide).
  *
  *  Result:
  *    An operating system result code.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIScrollViewSetScrollBarAutoHide(
    inView: HIViewRef;
    inAutoHide: boolean): OSStatus; external name '_HIScrollViewSetScrollBarAutoHide';

{
  *  HIScrollViewGetScrollBarAutoHide()
  *
  *  Discussion:
  *    Gets a scroll view's current scroll bar auto-hide setting.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inView:
  *      The view to examine.
  *
  *  Result:
  *    A boolean result.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIScrollViewGetScrollBarAutoHide(inView: HIViewRef): boolean; external name '_HIScrollViewGetScrollBarAutoHide';

{
 *  HIScrollViewNavigate()
 *
 *  Discussion:
 *    Allows you to programmatically change what portion of a scroll
 *    view's target you are seeing. For example, you can move to the
 *    beginning or end of a document. You can also page up, down, left
 *    and right. In general, you should not call this from embedded
 *    content (i.e. the scrollable view inside the scroll view). For
 *    those cases, you should instead position yourself appropriately
 *    and tell the scroll view you changed via the
 *    kEventScrollableInfoChanged carbon event. This routine merely is
 *    a programmatic way to scroll as one would by hand using the
 *    scroll bars.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inView:
 *      The scroll view to affect.
 *
 *    inAction:
 *      The action to take.
 *
 *  Result:
 *    A operating system status code.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
}
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
  function HIScrollViewNavigate(
    inView: HIViewRef;
    inAction: HIScrollViewAction): OSStatus; external name '_HIScrollViewNavigate';


{
 *  HIScrollViewCanNavigate()
 *
 *  Discussion:
 *    Allows you to tell whether it is currently possible to navigate
 *    somehow in a scroll view. For example, if a scroll view is
 *    already at the top of the scrollable content, it is not possible
 *    to navigate upward, so home and page up actions would not be
 *    possible. You might use this function to help you update the
 *    state of menu items or the like.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inView:
 *      The view to examine.
 *
 *    inAction:
 *      The action to test.
 *
 *  Result:
 *    A boolean result.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
}
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
  function HIScrollViewCanNavigate(
    inView: HIViewRef;
    inAction: HIScrollViewAction): Boolean; external name '_HIScrollViewCanNavigate';


{==============================================================================}
{  HIImageView                                                                 }
{                                                                              }
{  The image view is a new view starting in Mac OS 10.2. It can be used in     }
{  both the new compositing mode, as well as the traditional control manager   }
{  mode. Like all new HIFoo views, this view is created invisible.             }
{  You must show the view after creation if you want to, like, see it.         }
{==============================================================================}

{  The HIObject class ID for the HIImageView class. }
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kHIImageViewClassID CFSTRP('com.apple.HIImageView')}
{$endc}

{
  *  HIImageViewCreate()
  *
  *  Discussion:
  *    Creates an image view. The view responds to the scrollable
  *    interface and can be used in a scrolling view. You can pass an
  *    image initially, or set one later.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inImage:
  *      An initial image, or NULL. You can set the image later via
  *      SetControlData.
  *
  *    outControl:
  *      The new image view.
  *
  *  Result:
  *    An operating system result code.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIImageViewCreate(
    inImage: CGImageRef;          { can be NULL }
    var outControl: ControlRef): OSStatus; external name '_HIImageViewCreate';


const
  kHIImageViewImageTag          = $696D6167 (* 'imag' *); { CGImageRef (THIS TAG IS GOING AWAY!!! USE THE APIS BELOW!)}


{
  *  HIImageViewSetOpaque()
  *
  *  Discussion:
  *    Allows you to set whether an image view should be treated as
  *    opaque. If this is set to true, the image view can make certain
  *    optimizations for compositing and scrolling. The alpha-related
  *    image view APIs are rendered useless if opacity it set to true.
  *    An image view, when created, is transparent by default.
  *
  *    NOTE: In Mac OS X 10.2, this control was documented as being
  *    opaque by default, but the implementation did not enforce that.
  *    So in Mac OS X 10.3 and beyond, the control is transparent by
  *    default, and you can make it opaque by calling
  *    HIImageViewSetOpaque.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inView:
  *      The image view to affect.
  *
  *    inOpaque:
  *      The new opacity setting. Pass true to indicate you want the
  *      image to be treated as opaque.
  *
  *  Result:
  *    An operating system result code.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIImageViewSetOpaque(
    inView: HIViewRef;
    inOpaque: boolean): OSStatus; external name '_HIImageViewSetOpaque';

{
  *  HIImageViewIsOpaque()
  *
  *  Discussion:
  *    Allows you to determine whether an image view is opaque or not.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inView:
  *      The image view to query.
  *
  *  Result:
  *    A boolean result, where true indicates the image view is opaque.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIImageViewIsOpaque(inView: HIViewRef): boolean; external name '_HIImageViewIsOpaque';

{
  *  HIImageViewSetAlpha()
  *
  *  Discussion:
  *    Allows you to set the alpha for an image, making it more or less
  *    transparent. An alpha of 1.0 is fully opaque, and 0.0 is fully
  *    transparent. The default alpha for an image is 1.0.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inView:
  *      The image view to affect.
  *
  *    inAlpha:
  *      The new alpha value.
  *
  *  Result:
  *    An operating system result code.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIImageViewSetAlpha(
    inView: HIViewRef;
    inAlpha: Float32): OSStatus; external name '_HIImageViewSetAlpha';

{
  *  HIImageViewGetAlpha()
  *
  *  Discussion:
  *    Allows you to get the alpha for an image. An alpha of 1.0 is
  *    fully opaque, and 0.0 is fully transparent.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inView:
  *      The image view to query.
  *
  *  Result:
  *    A floating point number representing the alpha from 0.0 through
  *    1.0.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIImageViewGetAlpha(inView: HIViewRef): Float32; external name '_HIImageViewGetAlpha';

{
  *  HIImageViewSetScaleToFit()
  *
  *  Discussion:
  *    Normally an image view will clip to the view's bounds. Using this
  *    API, you can instead tell the image view to size the image to fit
  *    into the view bounds specified.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inView:
  *      The image view to affect.
  *
  *    inScaleToFit:
  *      A boolean indicating whether the image should be scaled to fit
  *      the view bounds (true) or merely clip to the view bounds
  *      (false).
  *
  *  Result:
  *    An operating system status code.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIImageViewSetScaleToFit(
    inView: HIViewRef;
    inScaleToFit: boolean): OSStatus; external name '_HIImageViewSetScaleToFit';

{
  *  HIImageViewGetScaleToFit()
  *
  *  Discussion:
  *    Returns whether or not an image view will scale the image it
  *    displays to the view bounds or merely clip to the view bounds. A
  *    true result means it scales.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inView:
  *      The image view to query.
  *
  *  Result:
  *    A boolean result.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIImageViewGetScaleToFit(inView: HIViewRef): boolean; external name '_HIImageViewGetScaleToFit';

{
  *  HIImageViewSetImage()
  *
  *  Discussion:
  *    Sets the image to display in an image view. The image passed in
  *    is retained by the view, so you may release the image after
  *    calling this API if you no longer need to reference it.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inView:
  *      The image view to affect.
  *
  *    inImage:
  *      The image to set.
  *
  *  Result:
  *    An operating system status code.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIImageViewSetImage(
    inView: HIViewRef;
    inImage: CGImageRef): OSStatus; external name '_HIImageViewSetImage';       { can be NULL }

{
  *  HIImageViewCopyImage()
  *
  *  Discussion:
  *    Gets the image for an image view. If there is no image set on the
  *    view, or the view ref is invalid, NULL is returned. The image is
  *    retained, so you should take care to release it when you are
  *    finished with it.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inView:
  *      The image view to query.
  *
  *  Result:
  *    A CoreGraphics (Quartz) image ref.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIImageViewCopyImage(inView: HIViewRef): CGImageRef; external name '_HIImageViewCopyImage';

{==============================================================================}
{ HIComboBox                                                                   }
{                                                                              }
{ The combo box is a new view starting in Mac OS 10.2. It can be used in       }
{ both the new compositing mode, as well as the traditional control manager    }
{ mode. Like all new HIFoo views, this view is created invisible. You must     }
{ show the view after creation if you want to, like, see it and stuff.         }
{==============================================================================}

{ The HIObject class ID for the HIComboBox class. }
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kHIComboBoxClassID CFSTRP('com.apple.HIComboBox')}
{$endc}

{
  *  Summary:
  *    ComboBox attributes
  }


{GRP translation note: Attributes are passed to OptionBits (UInt32) type formal parameters. Therefore, hex
constants were used to ensure size and bit position are correct.}

const

{
    * A constant with value zero; the lack of any attributes.
    }
  kHIComboBoxNoAttributes       = $00000000;

{
    * The control will attempt to auto complete the text the user is
    * typing with an item in the ComboBox list that is the closest
    * appropriate match.
    }
  kHIComboBoxAutoCompletionAttribute = $00000001; {(1L << 0)}

{
    * The control will disclose the ComboBox list after the user enters
    * text.
    }
  kHIComboBoxAutoDisclosureAttribute = $00000002; {(1L << 1)}

{
    * The items in the ComboBox list will be automatically sorted in
    * alphabetical order.
    }
  kHIComboBoxAutoSortAttribute  = $00000004; {(1L << 2)}

{
    * The ComboBox list will be automatically sized to fit the Human
    * Interface Guidelines.
    }
  kHIComboBoxAutoSizeListAttribute = $00000008; {(1L << 3)}

{
    * The minimum set of ComboBox attributes commonly used.
    }
  kHIComboBoxStandardAttributes = $0000000B; {(kHIComboBoxAutoCompletionAttribute | kHIComboBoxAutoDisclosureAttribute | kHIComboBoxAutoSizeListAttribute)}


{ ControlKind}

const
  kControlKindHIComboBox        = $63626278 (* 'cbbx' *);

{ ComboBox Part codes}

const
  kHIComboBoxEditTextPart       = 5;
  kHIComboBoxDisclosurePart     = 28;

{
    The ComboBox view supports these tags previously defined for the EditUnicodeText control.
    These tags are available through Get/SetControlData with a ControlPartCode of kHIComboBoxEditTextPart:

        kControlFontStyleTag
        kControlEditTextFixedTextTag
        kControlEditTextTextTag
        kControlEditTextKeyFilterTag
        kControlEditTextValidationProcTag
        kControlEditUnicodeTextPostUpdateProcTag
        kControlEditTextSelectionTag
        kControlEditTextKeyScriptBehaviorTag
        kControlEditTextCharCount
        kControlEditTextCFStringTag
}


{
  *  Discussion:
  *    ComboBox ControlData tags available with Mac OS X 10.2 and later.
  }

const

{
    * Extract the contents of the ComboBox list as a CFArray. The
    * CFArray will be retained: if you get the array, you own it and
    * will be required to release it; if you set it the toolbox makes a
    * copy of it and you are free to release your reference.
    }
  kHIComboBoxListTag            = $63626C73 (* 'cbls' *); { CFArrayRef; bumps the refCount on get/retains on set}

{
    * The width of the ComboBox list. This can be customized. This
    * disables the autosize attribute.
    }
  kHIComboBoxListPixelWidthTag  = $63626C77 (* 'cblw' *); { UInt32 }

{
    * The height of the ComboBox list. This can be customized. This
    * disables the autosize attribute.
    }
  kHIComboBoxListPixelHeightTag = $63626C68 (* 'cblh' *); { UInt32}

{
    * The number of visible items in the list. This can be customized.
    * This disables the autosize attribute.
    }
  kHIComboBoxNumVisibleItemsTag = $63626E69 (* 'cbni' *); { UInt32}


{
  *  HIComboBoxCreate()
  *
  *  Summary:
  *    Creates a combo box control. The new control is initially
  *    invisible.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    boundsRect:
  *      The bounding box of the control.
  *
  *    text:
  *      The default text in the editable portion of the control. Can be
  *      NULL.
  *
  *    style:
  *      The font style of the both editable text and the text in the
  *      disclosure list. Can be NULL.
  *
  *    list:
  *      The default values available in the disclosure list. Can be
  *      NULL.
  *
  *    inAttributes:
  *      The default attributes of the combo box.
  *
  *    outComboBox:
  *      On exit, contains the new control.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIComboBoxCreate(
    const (*var*) boundsRect: HIRect;
    text: CFStringRef;               { can be NULL }
    style: ControlFontStyleRecPtr;   { can be NULL }
    list: CFArrayRef;                { can be NULL }
    inAttributes: OptionBits;
    var outComboBox: HIViewRef): OSStatus; external name '_HIComboBoxCreate';

{
  *  HIComboBoxGetItemCount()
  *
  *  Summary:
  *    Get the number of items in the combo box disclosure list.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inComboBox:
  *      The combo box.
  *
  *  Result:
  *    The number of items in the combo box disclosure list.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIComboBoxGetItemCount(inComboBox: HIViewRef): ItemCount; external name '_HIComboBoxGetItemCount';

{
  *  HIComboBoxInsertTextItemAtIndex()
  *
  *  Summary:
  *    Inserts a CFString in the disclosure list
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inComboBox:
  *      The combo box whose disclosure list the text will be inserted
  *      in.
  *
  *    inIndex:
  *      The index that the text should be inserted in. If the index
  *      does not fall within the number of items in the combo box list,
  *      it will be appended to the end of the list.
  *
  *    inText:
  *      The text item to be inserted in the combo box disclosure list.
  *
  *  Result:
  *    An operating system status code.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIComboBoxInsertTextItemAtIndex(
    inComboBox: HIViewRef;
    inIndex: CFIndex;
    inText: CFStringRef): OSStatus; external name '_HIComboBoxInsertTextItemAtIndex';

{
  *  HIComboBoxAppendTextItem()
  *
  *  Summary:
  *    Appends a text item to the combo box disclosure list.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inComboBox:
  *      The combo box whose disclosure list the text will be appended
  *      to.
  *
  *    inText:
  *      The text item to be appended to the combo box disclosure list.
  *
  *    outIndex:
  *      On exit, the index of the new item. Can be NULL if the caller
  *      does not require this information.
  *
  *  Result:
  *    An operating system status code.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIComboBoxAppendTextItem(
    inComboBox: HIViewRef;
    inText: CFStringRef;
    outIndex: CFIndexPtr): OSStatus; external name '_HIComboBoxAppendTextItem';         { can be NULL }

{
  *  HIComboBoxCopyTextItemAtIndex()
  *
  *  Summary:
  *    Copy the text from the combo box disclosure list
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inComboBox:
  *      The combo box that contains the text item you would like to
  *      copy.
  *
  *    inIndex:
  *      The index of the text item. Will return paramErr if the index
  *      is out of bounds of the combo box list.
  *
  *    outString:
  *      A copy of the string at the given index. Remember this is now
  *      your copy that you will need to release.
  *
  *  Result:
  *    An operating system status code.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIComboBoxCopyTextItemAtIndex(
    inComboBox: HIViewRef;
    inIndex: CFIndex;
    var outString: CFStringRef): OSStatus; external name '_HIComboBoxCopyTextItemAtIndex';

{
  *  HIComboBoxRemoveItemAtIndex()
  *
  *  Summary:
  *    Remove an item from a combo box disclosure list.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inComboBox:
  *      The combo box that contains the disclosure list that you would
  *      like to remove an item from.
  *
  *    inIndex:
  *      The index of the item to remove.
  *
  *  Result:
  *    An operating system status code.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIComboBoxRemoveItemAtIndex(
    inComboBox: HIViewRef;
    inIndex: CFIndex): OSStatus; external name '_HIComboBoxRemoveItemAtIndex';

{
  *  HIComboBoxChangeAttributes()
  *
  *  Summary:
  *    Change the attributes of a combo box
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inComboBox:
  *      The combo box whose attributes you would like to change.
  *
  *    inAttributesToSet:
  *      The attributes to set.
  *
  *    inAttributesToClear:
  *      The attributes to clear.
  *
  *  Result:
  *    An operating system status code.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIComboBoxChangeAttributes(
    inComboBox: HIViewRef;
    inAttributesToSet: OptionBits;
    inAttributesToClear: OptionBits): OSStatus; external name '_HIComboBoxChangeAttributes';

{
  *  HIComboBoxGetAttributes()
  *
  *  Summary:
  *    Get the attributes of a combo box.
  *
  *  Mac OS X threading:
  *    Not thread safe
  *
  *  Parameters:
  *
  *    inComboBox:
  *      The combo box whose attributes you would like to obtain.
  *
  *    outAttributes:
  *      The attributes of the combo box.
  *
  *  Result:
  *    An operating system status code.
  *
  *  Availability:
  *    Mac OS X:         in version 10.2 and later in Carbon.framework
  *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  *    Non-Carbon CFM:   not available
  }

  function HIComboBoxGetAttributes(
    inComboBox: HIViewRef;
    var outAttributes: OptionBits): OSStatus; external name '_HIComboBoxGetAttributes';

{==============================================================================}
{  HISearchField                                                               }
{                                                                              }
{  HISearchField is a new view available in Mac OS X 10.3.                     }
{  This view is designed to be used for applications that provide searching    }
{  functionality. Visually, it is a standard text field optionally adorned     }
{  with a search icon on the left and/or a cancel image on the right.          }
{  When the user has accepted the text by pressing the return or enter key     }
{  a Carbon Event of kEventClassTextField / kEventTextAccepted will be sent    }
{  to the control. This will be the indication that the search should begin.   }
{  This control will also respond to all the standard control tags that are    }
{  used by the EditUnicodeText control.                                        }
{==============================================================================}
{ The HIObject class ID for the HISearchField class. }
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kHISearchFieldClassID CFSTRP('com.apple.HISearchField')}
{$endc}
{ ControlKind}
const
  kControlKindHISearchField     = $73726664 (* 'srfd' *);

{ HISearchField part codes}
const
  kControlSearchFieldCancelPart = 30;
  kControlSearchFieldMenuPart   = 31;

{
 *  Summary:
 *    HISearchField attributes
 }
const
  {
   * A constant with value zero; the lack of any attributes.
   }
  kHISearchFieldNoAttributes    = 0;

  {
   * This view contains the cancel icon in the text field.
   }
  kHISearchFieldAttributesCancel = (1 shl 0);

{ Event Classes}
const
  kEventClassSearchField        = $73726664 (* 'srfd' *);

{
 *  kEventClassSearchField / kEventSearchFieldCancelClicked
 *
 *  Summary:
 *    Notification that the cancel icon has been depressed.
 *
 *  Discussion:
 *    This event is sent by the HISearchField view if the cancel icon
 *    is enabled (attribute of kHISearchFieldAtttributesCancel), and
 *    the cancel has been clicked.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeControlRef)
 *          The HISearchField that has sent the notification.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const
  kEventSearchFieldCancelClicked = 1;

{
 *  HISearchFieldCreate()
 *
 *  Summary:
 *    Creates a search field control. The new control is initially
 *    invisible.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inBounds:
 *      The initial bounds of the view. If this parameter is NULL, the
 *      view defaults to have empty bounds ( 0, 0, 0, 0 ).
 *
 *    inAttributes:
 *      The initial attributes of the search field. Indicates whether
 *      the field should contain the cancel icon.
 *
 *    inSearchMenu:
 *      The menu to be associated with this search field. If
 *      inSearchMenu is non-NULL, it will be retained by the search
 *      field and the search icon will be enabled in the left side of
 *      the text field. If this parameter is NULL, the view will not
 *      display the search icon in the left portion of the text field.
 *      You are expected to install handlers on this menu to handle the
 *      visual appearance of the menu (for example, to draw check marks
 *      or enable items when the menu receives the
 *      kEventMenuEnableItems Carbon Event), and to keep track of what
 *      action should be performed by associating HICommands with each
 *      menu item and installing a handler for the (
 *      kEventClassCommand, kEventCommandProcess ) Carbon Event.
 *
 *    inDescriptiveText:
 *      The text to be displayed in the text field when the field does
 *      not have focus and contains no user entered text. This is meant
 *      to be an indication of what the search criteria is. For
 *      example, you may wish to identify to the user that the search
 *      will cover the "Subject" or "Contents" of a selected range of
 *      items. If inDescriptiveText is non-NULL it will be retained by
 *      the search field.
 *
 *    outRef:
 *      On exit, contains the new view.
 *
 *  Result:
 *    An operating system status code.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function HISearchFieldCreate( inBounds: HIRectPtr; inAttributes: OptionBits; inSearchMenu: MenuRef; inDescriptiveText: CFStringRef; var outRef: HIViewRef ): OSStatus; external name '_HISearchFieldCreate';


{
 *  HISearchFieldSetSearchMenu()
 *
 *  Summary:
 *    Set the search menu associated with the view.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inSearchField:
 *      The search field to associate the search menu with.
 *
 *    inSearchMenu:
 *      The menu to associate with the search field. If there is
 *      already a menu associated with the search field, that menu will
 *      be released. If inSearchMenu is non-NULL, it will be retained
 *      by the search field and the search icon will be enabled in the
 *      left side of the text field. You are expected to install
 *      handlers on this menu to handle the visual appearance of the
 *      menu (for example, to draw check marks or enable items when the
 *      menu receives the kEventMenuEnableItems Carbon Event), and to
 *      keep track of what action should be performed by associating
 *      HICommands with each menu item and installing a handler for the
 *      ( kEventClassCommand, kEventCommandProcess ) Carbon Event. If
 *      inSearchMenu is NULL, the search icon will be removed from the
 *      left side of the text field and no menu will be associated with
 *      this field.
 *
 *  Result:
 *    An operating system status code.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function HISearchFieldSetSearchMenu( inSearchField: HIViewRef; inSearchMenu: MenuRef ): OSStatus; external name '_HISearchFieldSetSearchMenu';


{
 *  HISearchFieldGetSearchMenu()
 *
 *  Summary:
 *    Get the menu that is associated with the search field
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inSearchField:
 *      The search field you wish to retrieve the search menu from.
 *
 *    outSearchMenu:
 *      On exit, will contain the menu that is associated with search
 *      field. The menu will _not_ be retained on output and this
 *      parameter cannot be NULL.
 *
 *  Result:
 *    An operating system status code.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function HISearchFieldGetSearchMenu( inSearchField: HIViewRef; var outSearchMenu: MenuRef ): OSStatus; external name '_HISearchFieldGetSearchMenu';


{
 *  HISearchFieldChangeAttributes()
 *
 *  Summary:
 *    Set the attributes for the given search field.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inSearchField:
 *      The search field to change the attributes of.
 *
 *    inAttributesToSet:
 *      The attributes to set.
 *
 *    inAttributesToClear:
 *      The attributes to clear.
 *
 *  Result:
 *    An operating system status code.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function HISearchFieldChangeAttributes( inSearchField: HIViewRef; inAttributesToSet: OptionBits; inAttributesToClear: OptionBits ): OSStatus; external name '_HISearchFieldChangeAttributes';


{
 *  HISearchFieldGetAttributes()
 *
 *  Summary:
 *    Returns the attributes of the search field.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inSearchField:
 *      The search field to get the attributes of.
 *
 *    outAttributes:
 *      On exit, will contain the attributes of the search field. This
 *      parameter cannot be NULL.
 *
 *  Result:
 *    An operating system status code.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function HISearchFieldGetAttributes( inSearchField: HIViewRef; var outAttributes: OptionBits ): OSStatus; external name '_HISearchFieldGetAttributes';


{
 *  HISearchFieldSetDescriptiveText()
 *
 *  Summary:
 *    Set the description of the search action of the search field.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inSearchField:
 *      The search field to change the description of.
 *
 *    inDescription:
 *      The new description for the search field. If the search field
 *      contains a description, it will be released. If inDescription
 *      is non-NULL, it will be retained by the search field. If it is
 *      NULL, no description will be associated with the search field.
 *
 *  Result:
 *    An operating system status code.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function HISearchFieldSetDescriptiveText( inSearchField: HIViewRef; inDescription: CFStringRef ): OSStatus; external name '_HISearchFieldSetDescriptiveText';


{
 *  HISearchFieldCopyDescriptiveText()
 *
 *  Summary:
 *    Get the description that is associated with the search field.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inSearchField:
 *      The search field you wish to retrieve the description from.
 *
 *    outDescription:
 *      On exit, will contain the description that is associated with
 *      the search field. This parameter cannot be NULL. If there is no
 *      description associated with the search field, outDescription
 *      will be set to NULL. If there is a description, a CFStringRef
 *      will be created that contains the contents of the description.
 *      You posess ownership of this string and will need to release it
 *      when you no longer need it.
 *
 *  Result:
 *    An operating system status code.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function HISearchFieldCopyDescriptiveText( inSearchField: HIViewRef; var outDescription: CFStringRef ): OSStatus; external name '_HISearchFieldCopyDescriptiveText';


{==============================================================================}
{  Text field events                                                           }
{                                                                              }
{  A text field is the part of some controls that you can enter text into.     }
{  A text field is common to the EditText, EditUnicodeText, ComboBox, and      }
{  HISearchField views. The kEventClassTextField event allows you to receive   }
{  notifications when the text has been accepted by the user. For example, you }
{  can install a handler for a kEventClassTextField / kEventTextAccepted event }
{  on a HISearchField view to receive a notification that the user has         }
{  initiated a search by hitting the return or enter key.                      }
{==============================================================================}
{
    kEventClassTextField quick reference:

    kEventTextAccepted              = 1
}
const
  kEventClassTextField          = $74786664 (* 'txfd' *);

{
 *  kEventClassTextField / kEventTextAccepted
 *
 *  Summary:
 *    Notification that the text in a control's editable text field has
 *    been accepted.
 *
 *  Discussion:
 *    This event is sent as a notification when the text contained in a
 *    control's editable text field has been accepted by the user. Text
 *    is accepted when the user presses return or enter on the keyboard
 *    or when the text has changed in the field and the field loses
 *    focus. This event is sent to the control containing the text
 *    field only, it will not propagate. It is sent to all handlers
 *    installed on the control containing the text field.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    --> kEventParamDirectObject (in, typeControlRef)
 *          The editable text field that has sent the notification.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available
 }
const
  kEventTextAccepted            = 1;

{==============================================================================}
{  HIMenuView                                                                  }
{                                                                              }
{  HIMenuView and HIStandardMenuView are new views available in Mac OS X 10.3. }
{  HIMenuView is intended for use as a base class for custom menu item views;  }
{  it does not draw or handle events itself, but provides useful functionality }
{  that all menu views need to implement. HIStandardMenuView is the standard   }
{  HIView used by the Menu Manager to draw menu item content, beginning with   }
{  Mac OS X 10.3. It can also be subclassed by custom menu item views.         }
{  Both of these views are meant to be used only in compositing windows.       }
{                                                                              }
{  Because HIMenuView and HIStandardMenuView are not typically created         }
{  directly by applications, no API is provided to create instances of these   }
{  views. If you need to create an instance of either view, you can use        }
{  HIObjectCreate.                                                             }
{==============================================================================}

{ the HIObject class ID for the HIMenuView class}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kHIMenuViewClassID CFSTRP('com.apple.HIMenuView')}
{$endc}
{ the HIObject class ID for the standard menu HIView class}
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kHIStandardMenuViewClassID CFSTRP('com.apple.HIStandardMenuView')}
{$endc}
{
    The kEventHIObjectInitialize event for HIMenuView and HIStandardMenuView is expected to contain
    the following parameters. Be sure to include these parameters in the init event if you create an
    instance of these views with HIObjectCreate.

    --> kEventParamMenuRef (in, typeMenuRef)
            The menu that the view should draw.
}
{
 *  kHIViewMenuContentID
 *
 *  Summary:
 *    The HIViewID for the menu content view. The Menu Manager assigns
 *    this view ID to all menu content views.
 *
 *  Availability:
 *    Mac OS X:         not available
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
var kHIViewMenuContentID: HIViewID; external name '_kHIViewMenuContentID'; (* attribute const *)
{
 *  HIMenuViewGetMenu()
 *
 *  Summary:
 *    Returns the MenuRef that is associated with an HIView that is a
 *    subclass of HIMenuView.
 *
 *  Discussion:
 *    An HIMenuView subclass might use this API to determine the menu
 *    that it should draw.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inView:
 *      The view whose menu to return.
 *
 *  Result:
 *    The MenuRef associated with the HIView, or NULL if an HIView is
 *    passed that is not a subclass of HIMenuView.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function HIMenuViewGetMenu( inView: HIViewRef ): MenuRef; external name '_HIMenuViewGetMenu';


{
 *  HIMenuGetContentView()
 *
 *  Summary:
 *    Returns the HIViewRef that will be used to draw menu content for
 *    this menu, if any.
 *
 *  Discussion:
 *    If the content view has not yet been created, the Menu Manager
 *    will create the content view using the view class ID and
 *    initialization event associated with the menu. Note that the menu
 *    content view is not the same as the window content view; the menu
 *    content view is embedded inside the window content view. If the
 *    menu uses an MDEF instead of an HIView to draw its content, noErr
 *    is returned but the output HIViewRef is set to NULL.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inMenu:
 *      The menu.
 *
 *    inMenuType:
 *      The type of menu for which the menu content view should be
 *      returned. The same MenuRef may have multiple content views,
 *      depending on the menu type being displayed.
 *
 *    outView:
 *      On exit, contains the view. May be set to NULL if the menu does
 *      not use an HIView to draw its content. The caller should not
 *      release this view.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function HIMenuGetContentView( inMenu: MenuRef; inMenuType: ThemeMenuType; var outView: HIViewRef ): OSStatus; external name '_HIMenuGetContentView';



{==============================================================================}
{  HISegmentedView                                                             }
{                                                                              }
{  HISegmentedView is a new view available in Mac OS X 10.3.                   }
{  Examples of the segmented view are the Finder's icon/column/list view       }
{  switcher, and the back/forward buttons in Open panels.                      }
{  The segmented view operates as a group of buttons, each of which can be     }
{  configured with different behaviors and content.                            }
{==============================================================================}
{ The HIObject class ID for the HISegmentedView class. }
{$ifc USE_CFSTR_CONSTANT_MACROS}
{$definec kHISegmentedViewClassID CFSTRP('com.apple.HISegmentedView')}
{$endc}
const
  kHISegmentedViewKind          = $73676D74 (* 'sgmt' *);

{
 *  HISegmentedViewCreate()
 *
 *  Summary:
 *    Creates a segmented view. This is the type of view you would use
 *    to implement the icon/column/list view switcher as seen in the
 *    Finder. After creating a segmented view, you need to set the
 *    number of segments via HISegmentedViewSetSegmentCount. Each
 *    segment can be configured independently with via the other
 *    HISegmentedView APIs. Changing the number of segments and
 *    configuring each segment will change the appearance of the
 *    segmented view. After you configure the view, you may want to
 *    call GetBestControlRect on the view and resize it so the content
 *    will fit optimally. The value of the whole segmented view
 *    corresponds to the index of the currently selected segment with
 *    the radio behavior. If you set the value of the whole segmented
 *    view to n via SetControl32BitValue, every radio-behavior segment
 *    will have its value set to zero except for the segment at index
 *    n; if segment n also has the radio behavior, it will have its
 *    value set to one. When a radio-behavior segment is clicked, the
 *    value of the whole segmented view will be set to the segment's
 *    index. The segmented view works in both compositing and
 *    non-compositing modes.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inBounds:
 *      The bounds of the view to be created. Can be NULL, in which
 *      case the view is created with CGRectZero bounds.
 *
 *    outRef:
 *      A valid pointer to an HIViewRef. On successful completion of
 *      this routine, the destination HIViewRef will be filled with the
 *      HIViewRef of the newly created view.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function HISegmentedViewCreate( inBounds: HIRectPtr; var outRef: HIViewRef ): OSStatus; external name '_HISegmentedViewCreate';


{
 *  HISegmentedViewSetSegmentCount()
 *
 *  Summary:
 *    Sets the number of segments for the segmented view. Any previous
 *    segments beyond the new count will have their content released.
 *    All new segments beyond the previous count be initialized with
 *    the most basic settings possible: Momentary, no attributes, zero
 *    value, enabled, no command, no label, no content, and
 *    auto-calculated content width. You should configure any new
 *    segments to match your needs.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inSegmentedView:
 *      The segmented view for which the content is to be set.
 *
 *    inSegmentCount:
 *      A positive SInt16 indicating how many segments the view is to
 *      have.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function HISegmentedViewSetSegmentCount( inSegmentedView: HIViewRef; inSegmentCount: UInt32 ): OSStatus; external name '_HISegmentedViewSetSegmentCount';


{
 *  HISegmentedViewGetSegmentCount()
 *
 *  Summary:
 *    Get the number of segments in the segmented view.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inSegmentedView:
 *      The segmented view for which the content is to be set.
 *
 *  Result:
 *    A UInt32 indicating the number of segments in the segmented view.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function HISegmentedViewGetSegmentCount( inSegmentedView: HIViewRef ): UInt32; external name '_HISegmentedViewGetSegmentCount';



{
 *  Summary:
 *    HISegmentBehavior constants
 }
const
  {
   * Pops back up after being pressed, just like a push button.
   }
  kHISegmentBehaviorMomentary   = 1;

  {
   * Stays pressed until another segment with the radio behavior is
   * pressed. This makes the segment behave like a radio button. After
   * this segment is clicked, the segmented view's value will be
   * changed to this segment's one-based index.
   }
  kHISegmentBehaviorRadio       = 2;

  {
   * Like a check box. When clicked, it toggles back and forth between
   * checked and unchecked states.
   }
  kHISegmentBehaviorToggles     = 3;

  {
   * After being pressed, this type of segment stays pressed until you
   * programatically unpress it.
   }
  kHISegmentBehaviorSticky      = 4;



type HISegmentBehavior = UInt32;
{
 *  HISegmentedViewSetSegmentBehavior()
 *
 *  Summary:
 *    Changes the behavior of an individual segment of a segmented
 *    view. By default, a segment has the kHISegmentBehaviorMomentary
 *    behavior.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inSegmentedView:
 *      The segmented view which owns the segment whose behavior you
 *      want to change.
 *
 *    inSegmentIndexOneBased:
 *      The one-based index of the segment whose behavior you want to
 *      change. This must be a non-zero value that is no higher than
 *      the segmented view's current segment count.
 *
 *    inBehavior:
 *      A HISegmentBehavior describing the behavior you wish the
 *      segment to have.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function HISegmentedViewSetSegmentBehavior( inSegmentedView: HIViewRef; inSegmentIndexOneBased: UInt32; inBehavior: HISegmentBehavior ): OSStatus; external name '_HISegmentedViewSetSegmentBehavior';


{
 *  HISegmentedViewGetSegmentBehavior()
 *
 *  Summary:
 *    Returns the behavior of an individual segment of a segmented view.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inSegmentedView:
 *      The segmented view which owns the segment being queried.
 *
 *    inSegmentIndexOneBased:
 *      The one-based index of the segment whose behavior you desire.
 *      This must be a non-zero value that is no higher than the
 *      segmented view's current segment count.
 *
 *  Result:
 *    A HISegmentBehavior describing the behavior of the given segment.
 *    If you pass an illegal segment index, the result is undefined.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function HISegmentedViewGetSegmentBehavior( inSegmentedView: HIViewRef; inSegmentIndexOneBased: UInt32 ): HISegmentBehavior; external name '_HISegmentedViewGetSegmentBehavior';



{
 *  Summary:
 *    HISegmentedView segment attributes
 *
 *  Discussion:
 *    These attribute bits are for use with
 *    HISegmentedViewChangeSegmentAttributes and
 *    HISegmentedViewGetSegmentAttributes.
 }
const
  {
   * Pass this to indicate no attributes at all.
   }
  kHISegmentNoAttributes        = 0;

  {
   * If this attribute bit is set, the command that gets sent out when
   * the segment is clicked will be directed at the user focus instead
   * of up the segmented view's containment hierarchy.
   }
  kHISegmentSendCmdToUserFocus  = (1 shl 0);

{
 *  HISegmentedViewChangeSegmentAttributes()
 *
 *  Summary:
 *    Changes the attributes of an individual segment of a segmented
 *    view. By default, a segment has no attribute bits set.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inSegmentedView:
 *      The segmented view which owns the segment whose attributes you
 *      want to change.
 *
 *    inSegmentIndexOneBased:
 *      The one-based index of the segment whose attributes you want to
 *      change. This must be a non-zero value that is no higher than
 *      the segmented view's current segment count.
 *
 *    inAttributesToSet:
 *      The attribute bits you wish to set/enable for the segment.
 *
 *    inAttributesToClear:
 *      The attribute bits you wish to clear/disable for the segment.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function HISegmentedViewChangeSegmentAttributes( inSegmentedView: HIViewRef; inSegmentIndexOneBased: UInt32; inAttributesToSet: OptionBits; inAttributesToClear: OptionBits ): OSStatus; external name '_HISegmentedViewChangeSegmentAttributes';


{
 *  HISegmentedViewGetSegmentAttributes()
 *
 *  Summary:
 *    Returns the attributes of an individual segment of a segmented
 *    view.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inSegmentedView:
 *      The segmented view which owns the segment being queried.
 *
 *    inSegmentIndexOneBased:
 *      The one-based index of the segment whose attributes you desire.
 *      This must be a non-zero value that is no higher than the
 *      segmented view's current segment count.
 *
 *  Result:
 *    The attribute bits that are set/enabled for the given segment. If
 *    you pass an illegal segment index, the result is undefined.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function HISegmentedViewGetSegmentAttributes( inSegmentedView: HIViewRef; inSegmentIndexOneBased: UInt32 ): OptionBits; external name '_HISegmentedViewGetSegmentAttributes';


{
 *  HISegmentedViewSetSegmentValue()
 *
 *  Summary:
 *    Change the value of an individual segment of a segmented view.
 *    This is only meaningful for segments with the sticky, toggles, or
 *    radio behaviors. If you set the value of momentary segments to
 *    something other than zero, the behavior is undefined.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inSegmentedView:
 *      The segmented view which owns the segment whose value you want
 *      to change.
 *
 *    inSegmentIndexOneBased:
 *      The one-based index of the segment whose value you want to
 *      change. This must be a non-zero value that is no higher than
 *      the segmented view's current segment count.
 *
 *    inValue:
 *      The value you wish the segment to have. Zero means
 *      unpressed/unselected and one means pressed/selected. Other
 *      values will result in undefined behavior.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function HISegmentedViewSetSegmentValue( inSegmentedView: HIViewRef; inSegmentIndexOneBased: UInt32; inValue: SInt32 ): OSStatus; external name '_HISegmentedViewSetSegmentValue';


{
 *  HISegmentedViewGetSegmentValue()
 *
 *  Summary:
 *    Determine the value of an individual segment of a segmented view.
 *    This is only meaningful for segments with the sticky, toggles, or
 *    radio behaviors. The value of a momentary segment is undefined.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inSegmentedView:
 *      The segmented view which owns the segment being queried.
 *
 *    inSegmentIndexOneBased:
 *      The one-based index of the segment whose value you desire. This
 *      must be a non-zero value that is no higher than the segmented
 *      view's current segment count.
 *
 *  Result:
 *    A SInt32 indicating the value of the given segment. If you pass
 *    an illegal segment index, the result is undefined.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function HISegmentedViewGetSegmentValue( inSegmentedView: HIViewRef; inSegmentIndexOneBased: UInt32 ): SInt32; external name '_HISegmentedViewGetSegmentValue';


{
 *  HISegmentedViewSetSegmentEnabled()
 *
 *  Summary:
 *    Enable or disable an individual segment of a segmented view.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inSegmentedView:
 *      The segmented view which owns the segment to enable or disable.
 *
 *    inSegmentIndexOneBased:
 *      The one-based index of the segment to disable or enable. This
 *      must be a non-zero value that is no higher than the segmented
 *      view's current segment count.
 *
 *    inEnabled:
 *      A Boolean indicating whether the segment is to become enabled
 *      or disabled.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function HISegmentedViewSetSegmentEnabled( inSegmentedView: HIViewRef; inSegmentIndexOneBased: UInt32; inEnabled: Boolean ): OSStatus; external name '_HISegmentedViewSetSegmentEnabled';


{
 *  HISegmentedViewIsSegmentEnabled()
 *
 *  Summary:
 *    Test an individual segment of a segmented view to see if it is
 *    enabled or disabled.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inSegmentedView:
 *      The segmented view which owns the segment being queried.
 *
 *    inSegmentIndexOneBased:
 *      The one-based index of the segment to test. This must be a
 *      non-zero value that is no higher than the segmented view's
 *      current segment count.
 *
 *  Result:
 *    True if the segment is enabled or false if the segment is
 *    disabled. If you pass an illegal segment index, the result is
 *    undefined.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function HISegmentedViewIsSegmentEnabled( inSegmentedView: HIViewRef; inSegmentIndexOneBased: UInt32 ): Boolean; external name '_HISegmentedViewIsSegmentEnabled';


{
 *  HISegmentedViewSetSegmentCommand()
 *
 *  Summary:
 *    Set the command ID for the given segment. By default, the command
 *    is zero. If you set any non-zero command ID, the segmented view
 *    will send an HICommand whenever the segment is clicked. By
 *    default, the command is sent to the segmented view and up the
 *    containment hierarchy. You can request that the command start at
 *    the user focus instead by turning on the
 *    kHISegmentSendCmdToUserFocus attribute for the segment.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inSegmentedView:
 *      The segmented view which owns the segment whose command you
 *      wish to set.
 *
 *    inSegmentIndexOneBased:
 *      The one-based index of the segment whose command you wish to
 *      set. This must be a non-zero value that is no higher than the
 *      segmented view's current segment count.
 *
 *    inCommand:
 *      The command ID you wish to associate with the segment. A value
 *      of zero signifies "no command".
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function HISegmentedViewSetSegmentCommand( inSegmentedView: HIViewRef; inSegmentIndexOneBased: UInt32; inCommand: UInt32 ): OSStatus; external name '_HISegmentedViewSetSegmentCommand';


{
 *  HISegmentedViewGetSegmentCommand()
 *
 *  Summary:
 *    Get the command ID associated with the given segment.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inSegmentedView:
 *      The segmented view which owns the segment being queried.
 *
 *    inSegmentIndexOneBased:
 *      The one-based index of the segment to query. This must be a
 *      non-zero value that is no higher than the segmented view's
 *      current segment count.
 *
 *  Result:
 *    Returns the command ID associated with the segment. If you pass
 *    an illegal segment index, the result is undefined.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function HISegmentedViewGetSegmentCommand( inSegmentedView: HIViewRef; inSegmentIndexOneBased: UInt32 ): UInt32; external name '_HISegmentedViewGetSegmentCommand';


{
 *  HISegmentedViewSetSegmentLabel()
 *
 *  Summary:
 *    Set the label string for the given segment. By default, a segment
 *    has no label string.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inSegmentedView:
 *      The segmented view which owns the segment whose label you wish
 *      to set.
 *
 *    inSegmentIndexOneBased:
 *      The one-based index of the segment whose label you wish to set.
 *      This must be a non-zero value that is no higher than the
 *      segmented view's current segment count.
 *
 *    inLabel:
 *      A CFStringRef with the text of the label. The segmented view
 *      will copy the string passed in. You may pass NULL or an empty
 *      CFStringRef if you wish to eliminate the label from the segment.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function HISegmentedViewSetSegmentLabel( inSegmentedView: HIViewRef; inSegmentIndexOneBased: UInt32; inLabel: CFStringRef ): OSStatus; external name '_HISegmentedViewSetSegmentLabel';


{
 *  HISegmentedViewCopySegmentLabel()
 *
 *  Summary:
 *    Get the label associated with the given segment.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inSegmentedView:
 *      The segmented view which owns the segment being queried.
 *
 *    inSegmentIndexOneBased:
 *      The one-based index of the segment to query. This must be a
 *      non-zero value that is no higher than the segmented view's
 *      current segment count.
 *
 *    outLabel:
 *      On exit, outLabel will be a copy of the label associated with
 *      the segment; you must release this string. If there is no label
 *      associated with the segment, outLabel will be set to NULL.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function HISegmentedViewCopySegmentLabel( inSegmentedView: HIViewRef; inSegmentIndexOneBased: UInt32; var outLabel: CFStringRef ): OSStatus; external name '_HISegmentedViewCopySegmentLabel';


{
 *  HISegmentedViewSetSegmentContentWidth()
 *
 *  Summary:
 *    Sets whether you want the segment to automatically calculate its
 *    own width or whether you want to determine the segment's width
 *    manually. The content width is the horizontal area taken up by a
 *    segment's label and/or image.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inSegmentedView:
 *      The segmented view which owns the segment whose content width
 *      you wish to set.
 *
 *    inSegmentIndexOneBased:
 *      The one-based index of the segment whose content width you wish
 *      to set. This must be a non-zero value that is no higher than
 *      the segmented view's current segment count.
 *
 *    inAutoCalculateWidth:
 *      A Boolean indicating whether you want the segment to calculate
 *      its own width. If you pass true, the inWidth parameter is
 *      ignored.
 *
 *    inWidth:
 *      If you passed false in inAutoCalculateWidth, this parameter
 *      specifies the width you want to manually associate with the
 *      segment. If you pass a negative width, the behavior is
 *      undefined.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function HISegmentedViewSetSegmentContentWidth( inSegmentedView: HIViewRef; inSegmentIndexOneBased: UInt32; inAutoCalculateWidth: Boolean; inWidth: Float32 ): OSStatus; external name '_HISegmentedViewSetSegmentContentWidth';


{
 *  HISegmentedViewGetSegmentContentWidth()
 *
 *  Summary:
 *    Get the content width of the given segment. This also optionall
 *    passes back a Boolean indicating whether the width was
 *    automatically calculated. The content width is the horizontal
 *    area taken up by a segment's label and/or image.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inSegmentedView:
 *      The segmented view which owns the segment being queried.
 *
 *    inSegmentIndexOneBased:
 *      The one-based index of the segment to query. This must be a
 *      non-zero value that is no higher than the segmented view's
 *      current segment count.
 *
 *    outAutoCalculated:
 *      On exit, this is a Boolean indicating whether the width was
 *      automatically calculated. You may pass NULL if you don't need
 *      this information.
 *
 *  Result:
 *    Returns the width of the content for the given segment. If you
 *    pass an illegal segment index, the result is undefined.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function HISegmentedViewGetSegmentContentWidth( inSegmentedView: HIViewRef; inSegmentIndexOneBased: UInt32; outAutoCalculated: BooleanPtr ): Float32; external name '_HISegmentedViewGetSegmentContentWidth';


{
 *  HISegmentedViewSetSegmentImage()
 *
 *  Summary:
 *    Sets or clears the image associated with a given segment.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inSegmentedView:
 *      The segmented view which owns the segment whose image you wish
 *      to set.
 *
 *    inSegmentIndexOneBased:
 *      The one-based index of the segment whose image you wish to set.
 *      This must be a non-zero value that is no higher than the
 *      segmented view's current segment count.
 *
 *    inImage:
 *      An HIViewImageContentInfo structure with the image information
 *      for the given segment. Segments only support three types of
 *      image content: kControlNoContent (no image),
 *      kControlContentIconRef, and kControlContentCGImageRef.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function HISegmentedViewSetSegmentImage( inSegmentedView: HIViewRef; inSegmentIndexOneBased: UInt32; const (*var*) inImage: HIViewImageContentInfo ): OSStatus; external name '_HISegmentedViewSetSegmentImage';


{
 *  HISegmentedViewGetSegmentImageContentType()
 *
 *  Summary:
 *    Get the type of image content drawn by the given segment. You
 *    will need to call this before calling
 *    HISegmentedViewCopySegmentImage so you know what type of image
 *    content to request from the latter API.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inSegmentedView:
 *      The segmented view which owns the segment being queried.
 *
 *    inSegmentIndexOneBased:
 *      The one-based index of the segment to query. This must be a
 *      non-zero value that is no higher than the segmented view's
 *      current segment count.
 *
 *  Result:
 *    Returns the image content type of the image drawn by the given
 *    segment. If you pass an illegal segment index, the result is
 *    undefined.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function HISegmentedViewGetSegmentImageContentType( inSegmentedView: HIViewRef; inSegmentIndexOneBased: UInt32 ): HIViewImageContentType; external name '_HISegmentedViewGetSegmentImageContentType';


{
 *  HISegmentedViewCopySegmentImage()
 *
 *  Summary:
 *    Gives you a copy of the image (if any) drawn by the given
 *    segment. You are responsible for releasing any image passed back
 *    by this function. You request the image by asking for a
 *    particular type of image. If the segment isn't using the
 *    requested type of image, an error will be returned. If you wish
 *    to know the actual type of image displayed by the segment, you
 *    can call HISegmentedViewGetSegmentImageContentType.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inSegmentedView:
 *      The segmented view which owns the segment being queried.
 *
 *    inSegmentIndexOneBased:
 *      The one-based index of the segment to query. This must be a
 *      non-zero value that is no higher than the segmented view's
 *      current segment count.
 *
 *    ioImage:
 *      On entry, you must fill out the contentType field of this
 *      structure with the type of image you desire. On exit, if that
 *      type of image is used by the segment, the appropriate field of
 *      the union will be filled in with a copy of the image. You are
 *      responsible for releasing the image.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function HISegmentedViewCopySegmentImage( inSegmentedView: HIViewRef; inSegmentIndexOneBased: UInt32; var ioImage: HIViewImageContentInfo ): OSStatus; external name '_HISegmentedViewCopySegmentImage';

{$ALIGN MAC68K}
{#POP}
{unit MacWindows}
{$ALIGN MAC68K}








{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}

{                                                                                                      }
{ Current documentation for the Mac OS Window Manager is available on the web:                         }
{  <http://developer.apple.com/techpubs/macos8/HumanInterfaceToolbox/WindowManager/windowmanager.html> }
{                                                                                                      }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{ ¥ HIWindowRef                                                                        }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
type
    HIWindowRef = WindowRef;
    HIWindowRefPtr = ^HIWindowRef;
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{ ¥ Property Types                                                                     }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}

type
    PropertyCreator                     = OSType;
    PropertyTag                         = OSType;
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {    ¥ Window Classes                                                                       }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }

{
 *  WindowClass
 *
 *  Summary:
 *    The types of windows provided by the Window Manager.
 *
 *  Discussion:
 *    The class of a window determines several aspects of the window:
 *    its appearance, its initial window attributes, its initial window
 *    group, and its initial modality. All of these except for the
 *    window's appearance may be changed later using other Window
 *    Manager APIs.
 }
type
    WindowClass = UInt32;
const
  {
   * An alert window is used when the application needs the user's
   * attention immediately. On Mac OS 9 and earlier, a visible alert
   * window will prevent the user from switching to any other
   * application. Use kThemeBrushAlertBackgroundActive to draw the
   * background of alert windows. Alert windows are initially placed in
   * the modal window group, given a modality of
   * kWindowModalityAppModal, and given an activation scope of
   * kWindowActivationScopeAll. Available in Mac OS 8.5 and later.
   }
  kAlertWindowClass             = 1;

  {
   * Similar to kAlertWindowClass, but provides a window that is
   * movable and that allows switching to other applications. Generally
   * you should use this window class rather than kAlertWindowClass.
   * Use kThemeBrushAlertBackgroundActive to draw the background of
   * movable alert windows. Movable alert windows are initially placed
   * in the modal window group, given a modality of
   * kWindowModalityAppModal, and given an activation scope of
   * kWindowActivationScopeAll. Available in Mac OS 8.5 and later.
   }
  kMovableAlertWindowClass      = 2;

  {
   * A modal window is used to display a dialog (but not an alert; use
   * kAlertWindowClass for alerts). On Mac OS 9 and earlier, a visible
   * modal window will prevent the user from switching to any other
   * application. Use kThemeBrushDialogBackgroundActive to draw the
   * background of modal windows. Modal windows are initially placed in
   * the modal window group, given a modality of
   * kWindowModalityAppModal, and given an activation scope of
   * kWindowActivationScopeAll. Available in Mac OS 8.5 and later.
   }
  kModalWindowClass             = 3;

  {
   * Similar to kModalWindowClass, but provides a window that is
   * movable and that allows switching to other applications. Generally
   * you should use this window class rather than kModalWindowClass. If
   * you are using CarbonLib 1.3 or later, or Mac OS X, use
   * kThemeBrushMovableModalBackground to draw the background of
   * movable modal windows; on earlier versions of CarbonLib, or for
   * non-Carbon programming, use kThemeBrushDialogBackgroundActive.
   * Movable modal windows are initially placed in the modal window
   * group, given a modality of kWindowModalityAppModal, and given an
   * activation scope of kWindowActivationScopeAll. Available in Mac OS
   * 8.5 and later.
   }
  kMovableModalWindowClass      = 4;

  {
   * A floating window is layered above all application windows except
   * for alert and modal windows. It is commonly used for palette
   * windows, inspectors, and other accessory (non-document) windows.
   * Use kThemeBrushUtilityWindowBackgroundActive or
   * kThemeBrushDocumentWindowBackground to draw the background of
   * floating windows. Floating windows are initially placed in the
   * floating window group, given a modality of kWindowModalityNone,
   * and given an activation scope of
   * kWindowActivationScopeIndependent. Available in Mac OS 8.6 and
   * later.
   }
  kFloatingWindowClass          = 5;

  {
   * A document window is used for normal application document windows.
   * Use kThemeBrushDocumentWindowBackground or your own custom drawing
   * to draw the background of a document window. Document windows are
   * initially placed in the document window group, given a modality of
   * kWindowModalityNone, and given an activation scope of
   * kWindowActivationScopeAll. Available in Mac OS 8.5 and later.
   }
  kDocumentWindowClass          = 6;

  {
   * A utility window is similar to a floating window, but it floats
   * above the windows of all applications rather than just above the
   * windows of the application that creates it. Use
   * kThemeBrushUtilityWindowBackgroundActive or
   * kThemeBrushDocumentWindowBackground to draw the background of
   * utility windows. Utility windows are initially placed in the
   * utility window group, given a modality of kWindowModalityNone, and
   * given an activation scope of kWindowActivationScopeIndependent.
   * Available in CarbonLib 1.1 and later, and in Mac OS X.
   }
  kUtilityWindowClass           = 8;

  {
   * A help window is used to display help tags. It has no window
   * frame. Typically you should use the Help Manager to display help
   * tags, rather than creating a help tag window yourself. Help
   * windows are initially placed in the help window group, given a
   * modality of kWindowModalityNone, and given an activation scope of
   * kWindowActivationScopeNone. Available in CarbonLib 1.1 and later,
   * and in Mac OS X.
   }
  kHelpWindowClass              = 10;

  {
   * A sheet window is used to display a dialog that is attached
   * directly to its parent window, rather than being a independent
   * window. A sheet dialog only prevents interaction with its parent
   * window; the user may still interact with other windows in the same
   * application. Use kThemeBrushSheetBackgroundOpaque to draw an
   * opaque background for sheet windows, or
   * kThemeBrushSheetBackgroundTransparent to draw a transparent
   * background (the transparent brush is only available in Mac OS X
   * 10.1 and later). Sheet windows are initially placed in the
   * document window group, given a modality of kWindowModalityNone,
   * and given an activation scope of kWindowActivationScopeAll.
   * Available in CarbonLib 1.3 and later, and in Mac OS X; in
   * CarbonLib, a sheet window is actually a movable-modal window,
   * which blocks user interaction with all windows of the application.
   }
  kSheetWindowClass             = 11;

  {
   * A toolbar window is used to display a palette of controls. It is
   * similar to a floating window, and like a floating window is
   * layered above all application windows except for alert and modal
   * windows, but is layered beneath floating windows. Use
   * kThemeBrushToolbarBackground to draw the background of a toolbar
   * window in Mac OS X or later; CarbonLib does not currently support
   * kThemeBrushToolbarBackground. Floating windows are initially
   * placed in the toolbar window group, given a modality of
   * kWindowModalityNone, and given an activation scope of
   * kWindowActivationScopeNone. Available in CarbonLib 1.1 and later,
   * and Mac OS X.
   }
  kToolbarWindowClass           = 12;

  {
   * A plain window has a single-pixel window frame.
   * kThemeBrushDocumentWindowBackground,
   * kThemeBrushDialogBackgroundActive, and application-specific custom
   * drawing are all commonly used to draw the background of a plain
   * window. Plain windows are initially placed in the document window
   * group, given a modality of kWindowModalityNone, and given an
   * activation scope of kWindowActivationScopeAll. Available in
   * CarbonLib 1.2.5 and later, and Mac OS X.
   }
  kPlainWindowClass             = 13;

  {
   * An overlay window is a completely transparent window positioned
   * above all other windows. Overlay windows are intended as a
   * replacement for the pre-Carbon practice of drawing directly into
   * the window manager port; by creating a full-screen overlay window
   * and drawing into it, you can draw over any window in any
   * application without disturbing the contents of the windows
   * underneath your drawing. After creating an overlay window, you
   * should use CGContextClearRect to clear the overlay window's alpha
   * channel to zero; this ensures the initial transparancy of the
   * window. You must use CoreGraphics to draw into an overlay window
   * to preserve the transparency of the window. Overlay windows are
   * initially placed in the overlay window group, given a modality of
   * kWindowModalityNone, and given an activation scope of
   * kWindowActivationScopeNone. Available in Mac OS X.
   }
  kOverlayWindowClass           = 14;

  {
   * A sheet alert window is similar to a sheet window, but is intended
   * to display an alert rather than a dialog. On Mac OS X, the
   * appearance of a sheet window and a sheet alert window is currently
   * identical, but in CarbonLib a sheet alert window has a different
   * appearance from a sheet window. Use
   * kThemeBrushSheetBackgroundOpaque to draw an opaque background for
   * sheet alert windows, or kThemeBrushSheetBackgroundTransparent to
   * draw a transparent background (the transparent brush is only
   * available in Mac OS X 10.1 and later). Sheet alert windows are
   * initially placed in the document window group, given a modality of
   * kWindowModalityNone, and given an activation scope of
   * kWindowActivationScopeAll. Available in CarbonLib 1.3 and later,
   * and in Mac OS X 10.1 and later; in CarbonLib, a sheet alert window
   * is actually a movable alert window, which blocks user interaction
   * with all windows of the application.
   }
  kSheetAlertWindowClass        = 15;

  {
   * A alternate plain window is similar to a plain window but has a
   * solid black shadow on its right and bottom sides. It is rarely
   * used in modern Mac OS applications.
   * kThemeBrushDocumentWindowBackground,
   * kThemeBrushDialogBackgroundActive, and application-specific custom
   * drawing are all commonly used to draw the background of an
   * alternate plain window. Alternate plain windows are initially
   * placed in the document window group, given a modality of
   * kWindowModalityNone, and given an activation scope of
   * kWindowActivationScopeAll. Available in CarbonLib 1.3 and later,
   * and Mac OS X 10.1 and later.
   }
  kAltPlainWindowClass          = 16;

  {
   * A simple window is the simplest possible window; it has no window
   * frame and its entire content is drawn by the application. Use any
   * theme brush or your own custom drawing to draw the background of a
   * simple window. Simple windows are initially placed in the document
   * window group, given a modality of kWindowModalityNone, and given
   * an activation scope of kWindowActivationScopeAll. Available in
   * CarbonLib 1.5 and later, and Mac OS X 10.1 and later.
   }
  kSimpleWindowClass            = 18;

  {
   * A drawer window is used when implementing a drawer user interface,
   * in which the drawer window slides out from underneath a document
   * window. Use kThemeBrushDrawerBackground or
   * kThemeBrushDocumentWindowBackground to draw the background of
   * drawer windows. Drawer windows are initially placed in the
   * document window group, given a modality of kWindowModalityNone,
   * and given an activation scope of kWindowActivationScopeAll. Drawer
   * windows should always be created using the Compositing window
   * attribute. Available in Mac OS X 10.2 or later.
   }
  kDrawerWindowClass            = 20;

  {
   * Not an actual window class, but a meta-constant that is used with
   * GetFrontWindowOfClass, FindWindowOfClass, and GetNextWindowOfClass
   * to indicate that there should be no restriction on the class of
   * the returned window. Also used with GetWindowGroupOfClass to get
   * the root window group.
   }
  kAllWindowClasses             = $FFFFFFFF;


{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{ ¥ Window Attributes                                                                  }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}

type
    WindowAttributes = UInt32;

{
 *  Summary:
 *    Window attributes
 }
const
  {
   * A constant with value zero; the lack of any attributes.
   }
  kWindowNoAttributes           = 0;

  {
   * This window has a close box. Available for windows of
   * kDocumentWindowClass, kFloatingWindowClass, and
   * kUtilityWindowClass.
   }
  kWindowCloseBoxAttribute      = (1 shl 0);

  {
   * This window changes width when zooming. Available for windows of
   * kDocumentWindowClass, kFloatingWindowClass, and
   * kUtilityWindowClass.
   }
  kWindowHorizontalZoomAttribute = (1 shl 1);

  {
   * This window changes height when zooming. Available for windows of
   * kDocumentWindowClass, kFloatingWindowClass, and
   * kUtilityWindowClass.
   }
  kWindowVerticalZoomAttribute  = (1 shl 2);

  {
   * This window changes both width and height when zooming. Available
   * for windows of kDocumentWindowClass, kFloatingWindowClass, and
   * kUtilityWindowClass.
   }
  kWindowFullZoomAttribute      = (kWindowVerticalZoomAttribute or kWindowHorizontalZoomAttribute);

  {
   * This window has a collapse box. Available for windows of
   * kDocumentWindowClass and, on Mac OS 9, kFloatingWindowClass and
   * kUtilityWindowClass; not available for windows of
   * kFloatingWindowClass or kUtilityWindowClass on Mac OS X.
   }
  kWindowCollapseBoxAttribute   = (1 shl 3);

  {
   * This window can be resized. Available for windows of
   * kDocumentWindowClass, kMovableModalWindowClass,
   * kFloatingWindowClass, kUtilityWindowClass, and kSheetWindowClass.
   }
  kWindowResizableAttribute     = (1 shl 4);

  {
   * This window has a vertical titlebar on the side of the window.
   * Available for windows of kFloatingWindowClass and
   * kUtilityWindowClass.
   }
  kWindowSideTitlebarAttribute  = (1 shl 5);

  {
   * This window has a toolbar button. Available for windows of
   * kDocumentWindowClass on Mac OS X.
   }
  kWindowToolbarButtonAttribute = (1 shl 6);

  {
   * This window uses the Metal appearance. Available for document
   * windows on Mac OS X 10.2 and later, and for floating windows on
   * Mac OS X 10.3 and later. Drawers can also be metal, but
   * dynamically adjust their appearance based on their parent window's
   * appearance; it is not necessary to specify this attribute for a
   * metal drawer.
   }
  kWindowMetalAttribute         = (1 shl 8);

  {
   * This window does not participate in window cycling invoked by
   * cmd-~ or the "Focus on Window" hotkey defined in the Keyboards
   * preference pane. Available for all windows on Mac OS X 10.2 and
   * later.
   }
  kWindowDoesNotCycleAttribute  = (1 shl 15);

  {
   * This window receives no update events. Available for all windows.
   }
  kWindowNoUpdatesAttribute     = (1 shl 16);

  {
   * This window receives no activate events. Available for all windows.
   }
  kWindowNoActivatesAttribute   = (1 shl 17);

  {
   * This window receives mouse events even for areas of the window
   * that are transparent (have an alpha channel component of zero).
   * Available for windows of kOverlayWindowClass on Mac OS X 10.0 and
   * 10.1, and available for all windows on Mac OS X 10.2 and later.
   }
  kWindowOpaqueForEventsAttribute = (1 shl 18);

  {
   * This window uses composited drawing. This means that the entire
   * window is comprised of HIViews, and can be treated thusly. This
   * attribute must be specified at window creation, and cannot be
   * changed later with ChangeWindowAttributes. Available on Mac OS X
   * 10.2 and later.
   }
  kWindowCompositingAttribute   = (1 shl 19);

  {
   * This window has no shadow. Available for all windows on Mac OS X.
   * This attribute is automatically given to windows of
   * kOverlayWindowClass.
   }
  kWindowNoShadowAttribute      = (1 shl 21);

  {
   * This window is automatically hidden on suspend and shown on
   * resume. Available for all windows. This attribute is automatically
   * given to windows of kFloatingWindowClass, kHelpWindowClass, and
   * kToolbarWindowClass.
   }
  kWindowHideOnSuspendAttribute = (1 shl 24);

  {
   * This window is marked so that the window server will drag the
   * window automatically. Your application should not call DragWindow
   * for this window, else it would confuse the heck out of the drag
   * (it would fight with the window server for control). This is
   * available on Mac OS X 10.3 or later.
   }
  kWindowAsyncDragAttribute     = (1 shl 23);

  {
   * This window has the standard Carbon window event handler
   * installed. Available for all windows.
   }
  kWindowStandardHandlerAttribute = (1 shl 25);

  {
   * This window is automatically hidden during fullscreen mode (when
   * the menubar is invisible) and shown afterwards. Available for all
   * windows. This attribute is automatically given to windows of
   * kUtilityWindowClass.
   }
  kWindowHideOnFullScreenAttribute = (1 shl 26);

  {
   * This window is added to the standard Window menu. Available for
   * windows of kDocumentWindowClass. This attribute is automatically
   * given to windows of kDocumentWindowClass.
   }
  kWindowInWindowMenuAttribute  = (1 shl 27);

  {
   * This window supports live resizing. Available for all windows on
   * Mac OS X.
   }
  kWindowLiveResizeAttribute    = (1 shl 28);

  {
   * This window never receives mouse events, even in areas that are
   * opaque. Instead, clicks on the window will be passed through to
   * windows beneath it. Available for all windows on Mac OS X 10.2 and
   * later.
   }
  kWindowIgnoreClicksAttribute  = (1 shl 29);

  {
   * This window will not be repositioned by the default
   * kEventWindowConstrain handler in response to changes in monitor
   * size, Dock position, and so on. Available for all windows on Mac
   * OS X 10.1 and later, and CarbonLib 1.6 and later.
   }
  kWindowNoConstrainAttribute   = (1 shl 31);

  {
   * The minimum set of window attributes commonly used by document
   * windows.
   }
  kWindowStandardDocumentAttributes = (kWindowCloseBoxAttribute or kWindowFullZoomAttribute or kWindowCollapseBoxAttribute or kWindowResizableAttribute);

  {
   * The minimum set of window attributes commonly used by floating
   * windows.
   }
  kWindowStandardFloatingAttributes = (kWindowCloseBoxAttribute or kWindowCollapseBoxAttribute);



    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {    ¥ Window Definition Type                                                               }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    kWindowDefProcType          = $57444546 (* 'WDEF' *);

    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {    ¥ Mac OS 7.5 Window Definition Resource IDs                                            }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    kStandardWindowDefinition   = 0;                            {  for document windows and dialogs }
    kRoundWindowDefinition      = 1;                            {  old da-style window }
    kFloatingWindowDefinition   = 124;                          {  for floating windows }

    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {    ¥ Variant Codes                                                                        }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
                                                                {  for use with kStandardWindowDefinition  }
    kDocumentWindowVariantCode  = 0;
    kModalDialogVariantCode     = 1;
    kPlainDialogVariantCode     = 2;
    kShadowDialogVariantCode    = 3;
    kMovableModalDialogVariantCode = 5;
    kAlertVariantCode           = 7;
    kMovableAlertVariantCode    = 9;                            {  for use with kFloatingWindowDefinition  }
    kSideFloaterVariantCode     = 8;


    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {    ¥ DefProc IDs                                                                          }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
                                                                {  classic ids  }
    documentProc                = 0;
    dBoxProc                    = 1;
    plainDBox                   = 2;
    altDBoxProc                 = 3;
    noGrowDocProc               = 4;
    movableDBoxProc             = 5;
    zoomDocProc                 = 8;
    zoomNoGrow                  = 12;                           {  floating window defproc ids  }
    floatProc                   = 1985;
    floatGrowProc               = 1987;
    floatZoomProc               = 1989;
    floatZoomGrowProc           = 1991;
    floatSideProc               = 1993;
    floatSideGrowProc           = 1995;
    floatSideZoomProc           = 1997;
    floatSideZoomGrowProc       = 1999;


                                                                {  Resource IDs for theme-savvy window defprocs  }
    kWindowDocumentDefProcResID = 64;
    kWindowDialogDefProcResID   = 65;
    kWindowUtilityDefProcResID  = 66;
    kWindowUtilitySideTitleDefProcResID = 67;
    kWindowSheetDefProcResID    = 68;
    kWindowSimpleDefProcResID   = 69;
    kWindowSheetAlertDefProcResID = 70;

                                                                {  Proc IDs for theme-savvy windows  }
    kWindowDocumentProc         = 1024;
    kWindowGrowDocumentProc     = 1025;
    kWindowVertZoomDocumentProc = 1026;
    kWindowVertZoomGrowDocumentProc = 1027;
    kWindowHorizZoomDocumentProc = 1028;
    kWindowHorizZoomGrowDocumentProc = 1029;
    kWindowFullZoomDocumentProc = 1030;
    kWindowFullZoomGrowDocumentProc = 1031;


                                                                {  Proc IDs for theme-savvy dialogs  }
    kWindowPlainDialogProc      = 1040;
    kWindowShadowDialogProc     = 1041;
    kWindowModalDialogProc      = 1042;
    kWindowMovableModalDialogProc = 1043;
    kWindowAlertProc            = 1044;
    kWindowMovableAlertProc     = 1045;


                                                                {  procIDs available from Mac OS 8.1 (Appearance 1.0.1) forward  }
    kWindowMovableModalGrowProc = 1046;


                                                                {  Proc IDs for top title bar theme-savvy floating windows  }
    kWindowFloatProc            = 1057;
    kWindowFloatGrowProc        = 1059;
    kWindowFloatVertZoomProc    = 1061;
    kWindowFloatVertZoomGrowProc = 1063;
    kWindowFloatHorizZoomProc   = 1065;
    kWindowFloatHorizZoomGrowProc = 1067;
    kWindowFloatFullZoomProc    = 1069;
    kWindowFloatFullZoomGrowProc = 1071;


                                                                {  Proc IDs for side title bar theme-savvy floating windows  }
    kWindowFloatSideProc        = 1073;
    kWindowFloatSideGrowProc    = 1075;
    kWindowFloatSideVertZoomProc = 1077;
    kWindowFloatSideVertZoomGrowProc = 1079;
    kWindowFloatSideHorizZoomProc = 1081;
    kWindowFloatSideHorizZoomGrowProc = 1083;
    kWindowFloatSideFullZoomProc = 1085;
    kWindowFloatSideFullZoomGrowProc = 1087;


                                                                {  Proc IDs for sheet windows  }
    kWindowSheetProc            = 1088;                         {  available in Mac OS X and CarbonLib 1.3  }
    kWindowSheetAlertProc       = 1120;                         {  available in Mac OS X after 1.0, and CarbonLib 1.3  }



    {
     *  Discussion:
     *    Window defproc IDs for simple windows
        }
                                                                {  Proc IDs for simple windows  }
    kWindowSimpleProc           = 1104;
    kWindowSimpleFrameProc      = 1105;


    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {    ¥ System 7 Window Positioning Constants                                                }
    {                                                                                           }
    {    Passed into StandardAlert and used in ÔWINDÕ, ÔDLOGÕ, and ÔALRTÕ templates             }
    {    StandardAlert uses zero to specify the default position. Other calls use zero to       }
    {    specify Òno positionÓ.  Do not pass these constants to RepositionWindow.  Do not       }
    {    store these constants in the BasicWindowDescription of a ÔwindÕ resource.              }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }

    kWindowNoPosition           = $0000;
    kWindowDefaultPosition      = $0000;                        {  used by StandardAlert }
    kWindowCenterMainScreen     = $280A;
    kWindowAlertPositionMainScreen = $300A;
    kWindowStaggerMainScreen    = $380A;
    kWindowCenterParentWindow   = $A80A;
    kWindowAlertPositionParentWindow = $B00A;
    kWindowStaggerParentWindow  = $B80A;
    kWindowCenterParentWindowScreen = $680A;
    kWindowAlertPositionParentWindowScreen = $700A;
    kWindowStaggerParentWindowScreen = $780A;


    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {    ¥ Window Positioning Methods                                                           }
    {                                                                                           }
    {    Positioning methods passed to RepositionWindow.                                        }
    {    Do not use them in WIND, ALRT, DLOG templates.                                         }
    {    Do not confuse these constants with the constants above                                }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }

    {
     *  WindowPositionMethod
     *
     *  Summary:
     *    Positioning methods usable with RepositionWindow.
     *
     *  Discussion:
     *    These constants are for use solely with the RepositionWindow API.
     *    They should not be used in 'WIND', 'ALRT', or 'DLOG' resources.
        }

type
    WindowPositionMethod        = UInt32;
const
    kWindowCenterOnMainScreen   = 1;
    kWindowCenterOnParentWindow = 2;
    kWindowCenterOnParentWindowScreen = 3;
    kWindowCascadeOnMainScreen  = 4;
    kWindowCascadeOnParentWindow = 5;
    kWindowCascadeOnParentWindowScreen = 6;
    kWindowCascadeStartAtParentWindowScreen = 10;
    kWindowAlertPositionOnMainScreen = 7;
    kWindowAlertPositionOnParentWindow = 8;
    kWindowAlertPositionOnParentWindowScreen = 9;


    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {    ¥ GetWindowRegion Types                                                                }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }

type
    WindowRegionCode                    = UInt16;

const
                                                                {  Region values to pass into GetWindowRegion & GetWindowBounds. All regions are reported in global coordinates.  }
    kWindowTitleBarRgn          = 0;
    kWindowTitleTextRgn         = 1;
    kWindowCloseBoxRgn          = 2;
    kWindowZoomBoxRgn           = 3;
    kWindowDragRgn              = 5;
    kWindowGrowRgn              = 6;
    kWindowCollapseBoxRgn       = 7;
    kWindowTitleProxyIconRgn    = 8;                            {  Mac OS 8.5 forward }
    kWindowStructureRgn         = 32;
    kWindowContentRgn           = 33;                           {  Content area of the window; empty when the window is collapsed }
    kWindowUpdateRgn            = 34;                           {  Carbon forward }
    kWindowOpaqueRgn            = 35;                           {  Mac OS X: Area of window considered to be opaque. Only valid for windows with alpha channels. }
    kWindowGlobalPortRgn        = 40;                           {  Carbon forward - bounds of the windowÕs port in global coordinates; not affected by CollapseWindow }

    {  GetWindowRegionRec - a pointer to this is passed in WDEF param for kWindowMsgGetRegion }

type
    GetWindowRegionRecPtr = ^GetWindowRegionRec;
    GetWindowRegionRec = record
        winRgn:                 RgnHandle;
        regionCode:             WindowRegionCode;
    end;

    GetWindowRegionPtr                  = ^GetWindowRegionRec;
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {    ¥ WDEF Message Types                                                                   }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {
       SetupWindowProxyDragImageRec - setup the proxy icon drag image
       Both regions are allocated and disposed by the Window Manager.
       The GWorld is disposed of by the Window Manager, but the WDEF must allocate
       it.  See Technote on Drag Manager 1.1 additions for more information and sample code for
       setting up drag images.
    }

    SetupWindowProxyDragImageRecPtr = ^SetupWindowProxyDragImageRec;
    SetupWindowProxyDragImageRec = record
        imageGWorld:            GWorldPtr;                              {  locked GWorld containing the drag image - output - can be NULL }
        imageRgn:               RgnHandle;                              {  image clip region, contains the portion of the image which gets blitted to screen - preallocated output - if imageGWorld is NULL, this is ignored }
        outlineRgn:             RgnHandle;                              {  the outline region used on shallow monitors - preallocated output - must always be non-empty }
    end;

    {  MeasureWindowTitleRec - a pointer to this is passed in WDEF param for kWindowMsgMeasureTitle }
    MeasureWindowTitleRecPtr = ^MeasureWindowTitleRec;
    MeasureWindowTitleRec = record
                                                                        {  output parameters (filled in by the WDEF) }
        fullTitleWidth:         SInt16;                                 {  text + proxy icon width }
        titleTextWidth:         SInt16;                                 {  text width }
    end;

    {
       GetGrowImageRegionRec - generate a region to be xored during GrowWindow and ResizeWindow.
       This is passed along with a kWindowMsgGetGrowImageRegion message. On input, the growRect
       parameter is the window's new bounds in global coordinates. The growImageRegion parameter
       will be allocated and disposed automatically; the window definition should alter the
       region appropriately.
    }
    GetGrowImageRegionRecPtr = ^GetGrowImageRegionRec;
    GetGrowImageRegionRec = record
        growRect:               Rect;
        growImageRegion:        RgnHandle;
    end;

    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {    ¥ Standard Window Kinds                                                                }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }

const
    dialogKind                  = 2;
    userKind                    = 8;
    kDialogWindowKind           = 2;
    kApplicationWindowKind      = 8;


    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {    ¥ FindWindow Result Codes                                                              }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }

type
    WindowPartCode              = SInt16;
    WindowPartCodePtr           = ^WindowPartCode; { when a VAR xx: WindowPartCode parameter can be nil, it is changed to xx: WindowPartCodePtr }
const
    inDesk                      = 0;
    inNoWindow                  = 0;
    inMenuBar                   = 1;
    inSysWindow                 = 2;
    inContent                   = 3;
    inDrag                      = 4;
    inGrow                      = 5;
    inGoAway                    = 6;
    inZoomIn                    = 7;
    inZoomOut                   = 8;
    inCollapseBox               = 11;                           {  Mac OS 8.0 forward }
    inProxyIcon                 = 12;                           {  Mac OS 8.5 forward }
    inToolbarButton             = 13;                           {  Mac OS X forward }
    inStructure                 = 15;                           {  Mac OS X 10.1 forward }

    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {    ¥ Window Definition Hit Test Result Codes                                              }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }

type
    WindowDefPartCode           = SInt16;
const
    wNoHit                      = 0;
    wInContent                  = 1;
    wInDrag                     = 2;
    wInGrow                     = 3;
    wInGoAway                   = 4;
    wInZoomIn                   = 5;
    wInZoomOut                  = 6;
    wInCollapseBox              = 9;                            {  Mac OS 8.0 forward }
    wInProxyIcon                = 10;                           {  Mac OS 8.5 forward }
    wInToolbarButton            = 11;                           {  Mac OS X forward }
    wInStructure                = 13;                           {  Mac OS X 10.1 forward }

    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {    ¥ Window Definition Messages                                                           }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }

    kWindowMsgDraw              = 0;
    kWindowMsgHitTest           = 1;
    kWindowMsgCalculateShape    = 2;
    kWindowMsgInitialize        = 3;
    kWindowMsgCleanUp           = 4;
    kWindowMsgDrawGrowOutline   = 5;
    kWindowMsgDrawGrowBox       = 6;

    {  Messages available from Mac OS 8.0 forward }
    kWindowMsgGetFeatures       = 7;
    kWindowMsgGetRegion         = 8;

    {  Messages available from Mac OS 8.5 forward }
    kWindowMsgDragHilite        = 9;                            {  parameter boolean indicating on or off }
    kWindowMsgModified          = 10;                           {  parameter boolean indicating saved (false) or modified (true) }
    kWindowMsgDrawInCurrentPort = 11;                           {  same as kWindowMsgDraw, but must draw in current port }
    kWindowMsgSetupProxyDragImage = 12;                         {  parameter pointer to SetupWindowProxyDragImageRec }
    kWindowMsgStateChanged      = 13;                           {  something about the window's state has changed }
    kWindowMsgMeasureTitle      = 14;                           {  measure and return the ideal title width }

    {  Messages only available in Carbon }
    kWindowMsgGetGrowImageRegion = 19;                          {  get region to xor during grow/resize. parameter pointer to GetGrowImageRegionRec. }

    {  old names }
    wDraw                       = 0;
    wHit                        = 1;
    wCalcRgns                   = 2;
    wNew                        = 3;
    wDispose                    = 4;
    wGrow                       = 5;
    wDrawGIcon                  = 6;

    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {    ¥ State-changed Flags for kWindowMsgStateChanged                                       }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    kWindowStateTitleChanged    = $01;


    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {    ¥ Window Feature Bits                                                                  }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    kWindowCanGrow              = $01;
    kWindowCanZoom              = $02;
    kWindowCanCollapse          = $04;
    kWindowIsModal              = $08;
    kWindowCanGetWindowRegion   = $10;
    kWindowIsAlert              = $20;
    kWindowHasTitleBar          = $40;

    {  Feature bits available from Mac OS 8.5 forward }
    kWindowSupportsDragHilite   = $80;                          {  window definition supports kWindowMsgDragHilite }
    kWindowSupportsModifiedBit  = $0100;                        {  window definition supports kWindowMsgModified }
    kWindowCanDrawInCurrentPort = $0200;                        {  window definition supports kWindowMsgDrawInCurrentPort }
    kWindowCanSetupProxyDragImage = $0400;                      {  window definition supports kWindowMsgSetupProxyDragImage }
    kWindowCanMeasureTitle      = $0800;                        {  window definition supports kWindowMsgMeasureTitle }
    kWindowWantsDisposeAtProcessDeath = $1000;                  {  window definition wants a Dispose message for windows still extant during ExitToShell }
    kWindowSupportsGetGrowImageRegion = $2000;                  {  window definition will calculate the grow image region manually. }
    kWindowDefSupportsColorGrafPort = $40000002;

    {  Feature bits for post MacOS 10.0 }
    kWindowIsOpaque             = $4000;                        {  Window doesn't need an alpha channel. Saves memory. }

    {
       THIS CONSTANT IS GOING AWAY. IT IS NAMED INCORRECTLY. USE THE GETGROWIMAGE CONSTANT ABOVE INSTEAD.
       DO YOU HEAR ME! AM I YELLING LOUD ENOUGH?!
    }
    kWindowSupportsSetGrowImageRegion = $2000;

    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {    ¥ Desktop Pattern Resource ID                                                          }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    deskPatID                   = 16;



    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {    ¥ Window Color Part Codes                                                              }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    wContentColor               = 0;
    wFrameColor                 = 1;
    wTextColor                  = 2;
    wHiliteColor                = 3;
    wTitleBarColor              = 4;


    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {     ¥ Region Dragging Constants                                                           }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }

    kMouseUpOutOfSlop           = $80008000;


    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {    ¥ Window Color Table                                                                   }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }

type
    WinCTabPtr = ^WinCTab;
    WinCTab = record
        wCSeed:                 SInt32;                             {  reserved  }
        wCReserved:             SInt16;                             {  reserved  }
        ctSize:                 SInt16;                             {  usually 4 for windows  }
        ctTable:                array [0..4] of ColorSpec;
    end;

    WCTabPtr                            = ^WinCTab;
    WCTabHandle                         = ^WCTabPtr;
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {    ¥ WindowRecord                                                                         }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }

    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {    ¥ Color WindowRecord                                                                   }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }

    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {    ¥ AuxWinHandle                                                                         }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }

    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {     ¥ BasicWindowDescription                                                              }
    {                                                                                           }
    {     Contains statically-sized basic attributes of the window, for storage in a            }
    {     collection item.                                                                      }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {  constants for the version field }

const
    kWindowDefinitionVersionOne = 1;
    kWindowDefinitionVersionTwo = 2;

    {  constants for the stateflags bit field  }
    kWindowIsCollapsedState     = $01;


type
    BasicWindowDescriptionPtr = ^BasicWindowDescription;
    BasicWindowDescription = record
        descriptionSize:        UInt32;                                 {  sizeof(BasicWindowDescription) }
        windowContentRect:      Rect;                                   {  location on screen }
        windowZoomRect:         Rect;                                   {  location on screen when zoomed out }
        windowRefCon:           UInt32;                                 {  the refcon - __avoid saving stale pointers here__   }
        windowStateFlags:       UInt32;                                 {  window state bit flags }
        windowPositionMethod:   WindowPositionMethod;                   {  method last used by RepositionWindow to position the window (if any) }
        windowDefinitionVersion: UInt32;
        case SInt16 of
        0: (
            windowDefProc:      SInt16;                                 {  defProc and variant }
            windowHasCloseBox:  boolean;
           );
        1: (
            windowClass:        WindowClass;                            {  the class }
            windowAttributes:   WindowAttributes;                       {  the attributes }
           );
    end;

    {   the window manager stores the default collection items using these IDs }

const
    kStoredWindowSystemTag      = $6170706C (* 'appl' *);                       {  Only Apple collection items will be of this tag }
    kStoredBasicWindowDescriptionID = $73626173 (* 'sbas' *);                   {  BasicWindowDescription }
    kStoredWindowPascalTitleID  = $73323535 (* 's255' *);                       {  pascal title string }
    kStoredWindowTitleCFStringID    = $63667374 (* 'cfst' *);                       {  CFString title string }

    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {    ¥ Window Class Ordering                                                                }
    {                                                                                           }
    {     Special cases for the ÒbehindÓ parameter in window creation calls.                    }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    kFirstWindowOfClass         = -1;
    kLastWindowOfClass          = 0;

    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {    ¥ Zoom Information Handle                                                              }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }

type
    WStateDataPtr = ^WStateData;
    WStateData = record
        userState:              Rect;                                   { user zoom state }
        stdState:               Rect;                                   { standard zoom state }
    end;

    WStateDataHandle                    = ^WStateDataPtr;
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {    ¥ MixedMode & ProcPtrs                                                                 }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    WindowDefProcPtr = function(varCode: SInt16; window: WindowRef; message: SInt16; param: SInt32): SInt32;

    DeskHookProcPtr = procedure(mouseClick: boolean; var theEvent: EventRecord);

    WindowPaintProcPtr = function(device: GDHandle; qdContext: GrafPtr; window: WindowRef; inClientPaintRgn: RgnHandle; outSystemPaintRgn: RgnHandle; refCon: UnivPtr): OSStatus;

    WindowDefUPP = ^SInt32; { an opaque UPP }
    DeskHookUPP = ^SInt32; { an opaque UPP }
    WindowPaintUPP = ^SInt32; { an opaque UPP }

const
    uppWindowDefProcInfo = $00003BB0;
    uppDeskHookProcInfo = $00130802;
    uppWindowPaintProcInfo = $0003FFF0;
    {
     *  NewWindowDefUPP()
     *
     *  Availability:
     *    Non-Carbon CFM:   available as macro/inline
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function NewWindowDefUPP(userRoutine: WindowDefProcPtr): WindowDefUPP; external name '_NewWindowDefUPP'; { old name was NewWindowDefProc }

{
 *  NewWindowPaintUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewWindowPaintUPP(userRoutine: WindowPaintProcPtr): WindowPaintUPP; external name '_NewWindowPaintUPP'; { old name was NewWindowPaintProc }
{
 *  DisposeWindowDefUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeWindowDefUPP(userUPP: WindowDefUPP); external name '_DisposeWindowDefUPP';

{
 *  DisposeWindowPaintUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeWindowPaintUPP(userUPP: WindowPaintUPP); external name '_DisposeWindowPaintUPP';
{
 *  InvokeWindowDefUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeWindowDefUPP(varCode: SInt16; window: WindowRef; message: SInt16; param: SInt32; userRoutine: WindowDefUPP): SInt32; external name '_InvokeWindowDefUPP'; { old name was CallWindowDefProc }

{
 *  InvokeWindowPaintUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeWindowPaintUPP(device: GDHandle; qdContext: GrafPtr; window: WindowRef; inClientPaintRgn: RgnHandle; outSystemPaintRgn: RgnHandle; refCon: UnivPtr; userRoutine: WindowPaintUPP): OSStatus; external name '_InvokeWindowPaintUPP'; { old name was CallWindowPaintProc }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{ ¥ Window Definition Spec.  Used in Carbon to specify the code that defines a window. }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}

const
    kWindowDefProcPtr           = 0;                            {  raw proc-ptr based access }
    kWindowDefObjectClass       = 1;                            {  event-based definition (Carbon 1.1 or later) }
    kWindowDefProcID            = 2;                            {  explicit proc ID; overrides the window class default proc ID }
  kWindowDefHIView              = 3;     { this window uses a view as its frame, not a WDEF }


type
    WindowDefType                       = UInt32;
    WindowDefSpecPtr = ^WindowDefSpec;
    WindowDefSpec = record
        defType:                WindowDefType;
        case SInt16 of
        0: (
            defProc:            WindowDefUPP;
            );
        1: (
            classRef:           Ptr;
            );
        2: (
            procID:             SInt16;
            );
    end;

    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {    ¥ Window Creation & Persistence                                                        }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {
     *  GetNewCWindow()
     *
     *  Availability:
     *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function GetNewCWindow(windowID: SInt16; wStorage: UnivPtr; behind: WindowRef): WindowRef; external name '_GetNewCWindow';
{
 *  NewWindow()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewWindow(wStorage: UnivPtr; const (*var*) boundsRect: Rect; const (*var*) title: Str255; visible: boolean; theProc: SInt16; behind: WindowRef; goAwayFlag: boolean; refCon: SInt32): WindowRef; external name '_NewWindow';
{
 *  GetNewWindow()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetNewWindow(windowID: SInt16; wStorage: UnivPtr; behind: WindowRef): WindowRef; external name '_GetNewWindow';
{
 *  NewCWindow()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewCWindow(wStorage: UnivPtr; const (*var*) boundsRect: Rect; const (*var*) title: Str255; visible: boolean; procID: SInt16; behind: WindowRef; goAwayFlag: boolean; refCon: SInt32): WindowRef; external name '_NewCWindow';
{
 *  DisposeWindow()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeWindow(window: WindowRef); external name '_DisposeWindow';

{
 *  CreateNewWindow()
 *
 *  Availability:
 *    Non-Carbon CFM:   in WindowsLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CreateNewWindow(windowClass: WindowClass; attributes: WindowAttributes; const (*var*) contentBounds: Rect; var outWindow: WindowRef): OSStatus; external name '_CreateNewWindow';

{  Routines available from Mac OS 8.5 forward }

{  Create a window from a ÔwindÕ resource }
{
 *  CreateWindowFromResource()
 *
 *  Availability:
 *    Non-Carbon CFM:   in WindowsLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CreateWindowFromResource(resID: SInt16; var outWindow: WindowRef): OSStatus; external name '_CreateWindowFromResource';

{  window persistence }
{
 *  StoreWindowIntoCollection()
 *
 *  Availability:
 *    Non-Carbon CFM:   in WindowsLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function StoreWindowIntoCollection(window: WindowRef; collection: Collection): OSStatus; external name '_StoreWindowIntoCollection';

{
 *  CreateWindowFromCollection()
 *
 *  Availability:
 *    Non-Carbon CFM:   in WindowsLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CreateWindowFromCollection(collection: Collection; var outWindow: WindowRef): OSStatus; external name '_CreateWindowFromCollection';

{  window refcounting }
{
 *  GetWindowOwnerCount()
 *
 *  Availability:
 *    Non-Carbon CFM:   in WindowsLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetWindowOwnerCount(window: WindowRef; var outCount: UInt32): OSStatus; external name '_GetWindowOwnerCount';

{
 *  CloneWindow()
 *
 *  Availability:
 *    Non-Carbon CFM:   in WindowsLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CloneWindow(window: WindowRef): OSStatus; external name '_CloneWindow';

{
 *  GetWindowRetainCount()
 *
 *  Summary:
 *    Returns the retain count of a window.
 *
 *  Discussion:
 *    This API is equivalent to GetWindowOwnerCount. For consistency
 *    with CoreFoundation and Carbon Events, it is preferred over
 *    GetWindowOwnerCount. Both APIs will continue to be supported.
 *
 *  Parameters:
 *
 *    inWindow:
 *      The window whose retain count to retrieve.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetWindowRetainCount(inWindow: WindowRef): ItemCount; external name '_GetWindowRetainCount';

{
 *  RetainWindow()
 *
 *  Summary:
 *    Increments the retain count of a window.
 *
 *  Discussion:
 *    This API is equivalent to CloneWindow. For consistency with
 *    CoreFoundation and Carbon Events, it is preferred over
 *    CloneWindow. Both APIs will continue to be supported.
 *
 *  Parameters:
 *
 *    inWindow:
 *      The window whose retain count to increment.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function RetainWindow(inWindow: WindowRef): OSStatus; external name '_RetainWindow';

{
 *  ReleaseWindow()
 *
 *  Summary:
 *    Decrements the retain count of a window, and destroys the window
 *    if the retain count falls to zero.
 *
 *  Discussion:
 *    This API is equivalent to DisposeWindow. For consistency with
 *    CoreFoundation and Carbon Events, it is preferred over
 *    DisposeWindow. Both APIs will continue to be supported.
 *
 *  Parameters:
 *
 *    inWindow:
 *      The window whose retain count to decrement.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ReleaseWindow(inWindow: WindowRef): OSStatus; external name '_ReleaseWindow';


{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{ ¥ Custom Windows                                                                     }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{  Routines available from Mac OS 8.1 forward when linking to CarbonLib 1.0 forward }

{
 *  CreateCustomWindow()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CreateCustomWindow(const (*var*) def: WindowDefSpec; windowClass: WindowClass; attributes: WindowAttributes; const (*var*) contentBounds: Rect; var outWindow: WindowRef): OSStatus; external name '_CreateCustomWindow';

{
 *  ReshapeCustomWindow()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ReshapeCustomWindow(window: WindowRef): OSStatus; external name '_ReshapeCustomWindow';

{
 *  RegisterWindowDefinition()
 *
 *  Summary:
 *    Registers or unregisters a binding between a resource ID and a
 *    window definition function.
 *
 *  Discussion:
 *    In the Mac OS 8.x Window Manager, a 'WIND' resource can contain
 *    an embedded WDEF procID that is used by the Window Manager as the
 *    resource ID of an 'WDEF' resource to lay out and draw the window.
 *    The 'WDEF' resource is loaded by the Window Manager when you load
 *    the menu with GetNewWindow. Since WDEFs can no longer be packaged
 *    as code resources on Carbon, the procID can no longer refer
 *    directly to a WDEF resource. However, using
 *    RegisterWindowDefinition you can instead specify a
 *    UniversalProcPtr pointing to code in your application code
 *    fragment. RegisterWindowDefinition is available when linking to
 *    CarbonLib 1.1 forward.
 *
 *  Parameters:
 *
 *    inResID:
 *      A WDEF proc ID, as used in a 'WIND' resource.
 *
 *    inDefSpec:
 *      Specifies the WindowDefUPP that should be used for windows with
 *      the given WDEF proc ID. Passing NULL allows you to unregister
 *      the window definition that had been associated with the given
 *      WDEF proc ID.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function RegisterWindowDefinition(inResID: SInt16; const (*var*) inDefSpec: WindowDefSpec): OSStatus; external name '_RegisterWindowDefinition';


{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{ ¥ Window part tracking                                                               }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{
   Routines available from Mac OS 8.5 forward
        (or from Mac OS 8.6 forward when linking to CarbonLib 1.1 forward)
}


{
 *  GetWindowWidgetHilite()
 *
 *  Availability:
 *    Non-Carbon CFM:   in WindowsLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetWindowWidgetHilite(inWindow: WindowRef; var outHilite: WindowDefPartCode): OSStatus; external name '_GetWindowWidgetHilite';


{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{ ¥ Window Metainformation Accessors                                                   }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{
 *  IsValidWindowClass()
 *
 *  Summary:
 *    Indicates whether a window class is supported by the Window
 *    Manager.
 *
 *  Parameters:
 *
 *    inClass:
 *      The window class.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.5 and later
 *    Mac OS X:         in version 10.1 and later
 }
function IsValidWindowClass(inClass: WindowClass): boolean; external name '_IsValidWindowClass';

{
 *  GetAvailableWindowAttributes()
 *
 *  Summary:
 *    Returns the window attributes that are valid for a window class.
 *
 *  Discussion:
 *    This API is useful because some window classes support different
 *    attributes on different platforms (for example, floating windows
 *    can have collapse boxes on 9, but not on X), and the Window
 *    Manager will return an error if you attempt to create a window
 *    with attributes that aren't supported for the requested window
 *    class. You can use this API to remove attributes that are not
 *    supported by the current platform before calling CreateNewWindow.
 *
 *  Parameters:
 *
 *    inClass:
 *      The window class.
 *
 *  Result:
 *    The window attributes that are supported for the specified window
 *    class.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.5 and later
 *    Mac OS X:         in version 10.1 and later
 }
function GetAvailableWindowAttributes(inClass: WindowClass): WindowAttributes; external name '_GetAvailableWindowAttributes';

{
   Routines available from Mac OS 8.5 forward
   or from Mac OS 8.1 forward when linking to CarbonLib 1.0 forward
}
{
 *  GetWindowClass()
 *
 *  Availability:
 *    Non-Carbon CFM:   in WindowsLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetWindowClass(window: WindowRef; var outClass: WindowClass): OSStatus; external name '_GetWindowClass';

{
 *  GetWindowAttributes()
 *
 *  Availability:
 *    Non-Carbon CFM:   in WindowsLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetWindowAttributes(window: WindowRef; var outAttributes: WindowAttributes): OSStatus; external name '_GetWindowAttributes';

{
   Routines available from Mac OS 9.0 forward
   or from Mac OS 8.1 forward when linking to CarbonLib 1.0 forward
}
{
 *  ChangeWindowAttributes()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ChangeWindowAttributes(window: WindowRef; setTheseAttributes: WindowAttributes; clearTheseAttributes: WindowAttributes): OSStatus; external name '_ChangeWindowAttributes';

{
    WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
    WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING

    SetWindowClass will disappear in the near future. Instead of SetWindowClass,
    you should use SetWindowGroup to move a window into the group of the desired
    class. This API is very dangerous in that is actually does change the class
    of the window, but class was meant to be an immutable property of the window.
    At the very least, this API will be modified to only change the layer of the
    window to match the layer that the specified class normally lives in. Consider
    yourself warned!

    WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
    WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
}
{
 *  SetWindowClass()
 *
 *  Summary:
 *    Changes the window class of a window.
 *
 *  Discussion:
 *    SetWindowClass changes the class of a window. It also changes the
 *    window's z-order so that it is grouped with other windows of the
 *    same class. It does not change the visual appearance of the
 *    window. In CarbonLib, SetWindowClass may not be used to change a
 *    non-utility window to have utility window class, or to make a
 *    utility window have non-utility class. SetWindowClass is
 *    available from CarbonLib 1.1 forward.
 *
 *  Parameters:
 *
 *    inWindow:
 *      The window whose class to change.
 *
 *    inWindowClass:
 *      The new window class.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetWindowClass(inWindow: WindowRef; inWindowClass: WindowClass): OSStatus; external name '_SetWindowClass';

{
 *  HIWindowChangeClass()
 *
 *  Summary:
 *    Changes the window look and feel of an existing window on the fly.
 *
 *  Discussion:
 *    HIWindowChangeClass changes the class of a window. Unlike
 *    SetWindowClass, this call effectively changes the look and
 *    behavior of the window all at once. Because SetWindowClass
 *    already existed and had certain behaviour, we could not change it
 *    to behave the way HIWindowChangeClass does.
 *
 *    This function can convert a window between document, floating,
 *    utility, and movable modal window classes only. It cannot change
 *    a window into a plain window, for example.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inWindow:
 *      The window whose class to change.
 *
 *    inWindowClass:
 *      The new window class.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function HIWindowChangeClass( inWindow: HIWindowRef; inWindowClass: WindowClass ): OSStatus; external name '_HIWindowChangeClass';

{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{  ¥ Window Flushing                                                                   }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{
 *  HIWindowFlush()
 *
 *  Summary:
 *    Flushes any dirty areas a window might have.
 *
 *  Discussion:
 *    This routine allows you to manually flush dirty areas of a window
 *    to the screen. In the past, one would use QDFlushPortBuffer, but
 *    as we move away from grafports, that type of stuff doesn't make
 *    much sense these days. This is the preferred routine to flush
 *    window buffers in Mac OS X 10.3 and beyond.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inWindow:
 *      The window to flush.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function HIWindowFlush( inWindow: HIWindowRef ): OSStatus; external name '_HIWindowFlush';

{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{  ¥ Window Modality                                                                   }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}

{
 *  WindowModality
 *
 }

type
    WindowModality              = UInt32;
const
    kWindowModalityNone         = 0;
    kWindowModalitySystemModal  = 1;
    kWindowModalityAppModal     = 2;
    kWindowModalityWindowModal  = 3;


    {
     *  SetWindowModality()
     *
     *  Summary:
     *    Sets the modality of a window.
     *
     *  Discussion:
     *    The modality of a window is used by the Carbon event manager to
     *    automatically determine appropriate event handling.
     *
     *  Parameters:
     *
     *    inWindow:
     *      The window whose modality to set.
     *
     *    inModalKind:
     *      The new modality for the window.
     *
     *    inUnavailableWindow:
     *      If the window is becoming window-modal, this parameter
     *      specifies the window to which the inWindow parameter is modal.
     *      The unavailableWindow will not be available while inWindow is
     *      in window-modal state.
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.1 and later
     *    Mac OS X:         in version 10.0 and later
        }
function SetWindowModality(inWindow: WindowRef; inModalKind: WindowModality; inUnavailableWindow: WindowRef): OSStatus; external name '_SetWindowModality';

{
 *  GetWindowModality()
 *
 *  Summary:
 *    Retrieves the modality of a window.
 *
 *  Parameters:
 *
 *    inWindow:
 *      The window whose modality to retrieve.
 *
 *    outModalKind:
 *      On exit, contains the modality of the window.
 *
 *    outUnavailableWindow:
 *      On exit, ifÊthe window is window-modal, contains the target
 *      window of the specified window's modality.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetWindowModality(inWindow: WindowRef; var outModalKind: WindowModality; outUnavailableWindow: WindowRefPtr): OSStatus; external name '_GetWindowModality';

{
 *  HIWindowIsDocumentModalTarget()
 *
 *  Summary:
 *    Determines if a window is currently the target window of another
 *    document modal window, such as a sheet.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inWindow:
 *      The window in question.
 *
 *    outOwner:
 *      If inWindow is the target of a document modal window, outOwner
 *      is set to the document modal window on exit. If this function
 *      does not return true, outOwner is undefined. You may pass NULL
 *      if you don't want the owner's window ref.
 *
 *  Result:
 *    A boolean result. A true result indicates that inWindow is
 *    currently the target of a document modal window.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function HIWindowIsDocumentModalTarget( inWindow: HIWindowRef; outOwner: HIWindowRefPtr ): Boolean; external name '_HIWindowIsDocumentModalTarget';

{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{ ¥ Floating Windows                                                                   }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{
   Routines available from Mac OS 8.6 forward
   or from Mac OS 8.1 forward when linking to CarbonLib 1.0 forward
}

{
 *  ShowFloatingWindows()
 *
 *  Availability:
 *    Non-Carbon CFM:   in WindowsLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ShowFloatingWindows: OSStatus; external name '_ShowFloatingWindows';

{
 *  HideFloatingWindows()
 *
 *  Availability:
 *    Non-Carbon CFM:   in WindowsLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function HideFloatingWindows: OSStatus; external name '_HideFloatingWindows';

{
 *  AreFloatingWindowsVisible()
 *
 *  Availability:
 *    Non-Carbon CFM:   in WindowsLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function AreFloatingWindowsVisible: boolean; external name '_AreFloatingWindowsVisible';


{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{ ¥ Window Groups                                                                      }
{                                                                                      }
{ The Window Group API allows the creation and management of groups of windows,        }
{ allowing control of the z-order, activation, and positioning of the windows.         }
{ Internally to the Window Manager, each of the standard window tiers (document,       }
{ toolbar, floating, modal, utility, help, and overlay) is implemented as a window     }
{ group; you can access the window group for a class with GetWindowGroupOfClass.       }
{ You can create your own window groups, if you would like your windows to float,      }
{ for example, above the floating window layer but below the modal layer. It is        }
{ also possible to create more complex hierarchical arrangements of window groups.     }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}

type
    WindowGroupRef    = ^SInt32; { an opaque 32-bit type }
    WindowGroupRefPtr = ^WindowGroupRef;  { when a var xx:WindowGroupRef parameter can be nil, it is changed to xx: WindowGroupRefPtr }
    {  may be passed as the "behindWindow" parameter to NewCWindow and SendBehind }

const
    kFirstWindowOfGroup         = -1;
    kLastWindowOfGroup          = nil;
    {  may be passed as the "behindGroup" parameter to SendWindowGroupBehind }
    kFirstWindowGroup           = -1;
    kLastWindowGroup            = nil;

    {
     *  WindowGroupAttributes
     *
     *  Summary:
     *    These are attributes that may be applied to a window group.
        }

type
    WindowGroupAttributes       = UInt32;
const
    kWindowGroupAttrSelectAsLayer = $01;
    kWindowGroupAttrMoveTogether = $02;
    kWindowGroupAttrLayerTogether = $04;
    kWindowGroupAttrSharedActivation = $08;
    kWindowGroupAttrHideOnCollapse = $10;


    {
     *  WindowActivationScope
     *
     *  Discussion:
     *    Every window has a WindowActivationScope. It defines how windows
     *    are activated by the Window Manager with respect to other windows
     *    in the windowÕs group and in the current process.
        }

type
    WindowActivationScope       = UInt32;
const
    kWindowActivationScopeNone  = 0;
    kWindowActivationScopeIndependent = 1;
    kWindowActivationScopeAll   = 2;


    {
     *  Summary:
     *    These are constants that can be used for the inNextGroup
     *    parameter to GetSiblingWindowGroup.
        }
    kNextWindowGroup            = true;
    kPreviousWindowGroup        = false;


    {
     *  WindowGroupContentOptions
     *
     *  Discussion:
     *    Window group contents options are used to control what group
     *    content is counted or returned by the CountWindowGroupContents
     *    and GetWindowGroupContents APIs.
        }

type
    WindowGroupContentOptions   = UInt32;
const
    kWindowGroupContentsReturnWindows = $01;
    kWindowGroupContentsRecurse = $02;
    kWindowGroupContentsVisible = $04;


    {   ----------------------------------------------------------------------------------  }
    {     ¥ Group creation, destruction, and refcounting                                    }
    {   ----------------------------------------------------------------------------------  }
    {
     *  CreateWindowGroup()
     *
     *  Summary:
     *    Creates a new window group.
     *
     *  Parameters:
     *
     *    inAttributes:
     *      Attributes for the new window group.
     *
     *    outGroup:
     *      On exit, contains the new window group.
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function CreateWindowGroup(inAttributes: WindowGroupAttributes; var outGroup: WindowGroupRef): OSStatus; external name '_CreateWindowGroup';

{
 *  RetainWindowGroup()
 *
 *  Summary:
 *    Increments the refcount of a window group.
 *
 *  Parameters:
 *
 *    inGroup:
 *      The group whose refcount to increment.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.4 and later
 *    Mac OS X:         in version 10.0 and later
 }
function RetainWindowGroup(inGroup: WindowGroupRef): OSStatus; external name '_RetainWindowGroup';

{
 *  ReleaseWindowGroup()
 *
 *  Summary:
 *    Releases a refcount on a window group. If the refcount goes to
 *    zero, the group is destroyed, and a refcount is released from all
 *    contained objects.
 *
 *  Parameters:
 *
 *    inGroup:
 *      The group whose refcount to decrement.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.4 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ReleaseWindowGroup(inGroup: WindowGroupRef): OSStatus; external name '_ReleaseWindowGroup';

{
 *  GetWindowGroupRetainCount()
 *
 *  Summary:
 *    Returns the refcount of a window group.
 *
 *  Parameters:
 *
 *    inGroup:
 *      The group whose refcount to return.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.4 and later
 *    Mac OS X:         in version 10.1 and later
 }
function GetWindowGroupRetainCount(inGroup: WindowGroupRef): ItemCount; external name '_GetWindowGroupRetainCount';

{
 *  GetWindowGroupOfClass()
 *
 *  Summary:
 *    Gets the window group in which windows of a given class are
 *    placed.
 *
 *  Discussion:
 *    The Window Manager uses window groups internally to manage the
 *    ordering of windows of different classes. In some cases, multiple
 *    classes are placed within the same group; for example, windows
 *    from all of the modal and alert window classes are placed into
 *    the same modal window group. The refcount of the group returned
 *    by this API is not incremented, and the caller does not need to
 *    release the reference.
 *
 *  Parameters:
 *
 *    windowClass:
 *      The class whose window group to retrieve. You may pass
 *      kAllWindowClasses to retrieve the root window group.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.4 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetWindowGroupOfClass(windowClass: WindowClass): WindowGroupRef; external name '_GetWindowGroupOfClass';


{----------------------------------------------------------------------------------}
{  ¥ÊGroup name, attributes, and level                                             }
{----------------------------------------------------------------------------------}
{
 *  SetWindowGroupName()
 *
 *  Summary:
 *    Sets the name of a window group.
 *
 *  Discussion:
 *    The name of a window group is never displayed to the user.
 *    However, it is displayed by debugging functions such as
 *    DebugPrintWindowGroup. This can be very useful when debugging the
 *    structure of your window groups.
 *
 *  Parameters:
 *
 *    inGroup:
 *      The group whose name to set.
 *
 *    inName:
 *      The name of the group.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetWindowGroupName(inGroup: WindowGroupRef; inName: CFStringRef): OSStatus; external name '_SetWindowGroupName';

{
 *  CopyWindowGroupName()
 *
 *  Summary:
 *    Returns a copy of the name of a window group.
 *
 *  Parameters:
 *
 *    inGroup:
 *      The group whose name to retrieve.
 *
 *    outName:
 *      On exit, contains the name of the group. It is the caller's
 *      responsibility to release the name.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CopyWindowGroupName(inGroup: WindowGroupRef; var outName: CFStringRef): OSStatus; external name '_CopyWindowGroupName';

{
 *  GetWindowGroupAttributes()
 *
 *  Summary:
 *    Retrieves the attributes of a window group.
 *
 *  Parameters:
 *
 *    inGroup:
 *      The group whose attributes to retrieve.
 *
 *    outAttributes:
 *      On exit, the groupÕs attributes.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetWindowGroupAttributes(inGroup: WindowGroupRef; var outAttributes: WindowGroupAttributes): OSStatus; external name '_GetWindowGroupAttributes';

{
 *  ChangeWindowGroupAttributes()
 *
 *  Summary:
 *    Changes the attributes of a window group.
 *
 *  Parameters:
 *
 *    inGroup:
 *      The group whose attributes to change.
 *
 *    setTheseAttributes:
 *      The attributes to set.
 *
 *    clearTheseAttributes:
 *      The attributes to clear.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ChangeWindowGroupAttributes(inGroup: WindowGroupRef; setTheseAttributes: WindowGroupAttributes; clearTheseAttributes: WindowGroupAttributes): OSStatus; external name '_ChangeWindowGroupAttributes';

{
 *  SetWindowGroupLevel()
 *
 *  Summary:
 *    Sets the CoreGraphics window group level of windows in a group.
 *
 *  Discussion:
 *    CoreGraphics windows (used to implement all windows in Carbon and
 *    Cocoa applications on Mac OS X) are divided into layers specified
 *    by a window level. Standard window levels are listed in
 *    <CoreGraphics/CGWindowLevel.h>. By default, a new window group
 *    has a window level of kCGNormalWindowLevel. When a window is
 *    placed into a window group, its window level is determined by the
 *    window level of its "base group". This is the containing group
 *    that is a child of the root group. For example, if group A is a
 *    child of the root group, and group B is a child of group A, and
 *    window C is in group B, then window C's base group is group A,
 *    and group A's window level determines the level of window C.
 *    SetWindowGroupLevel only allows changing the window level of
 *    groups that are children of the root group. It returns paramErr
 *    for other groups, since a group that is not a child of the root
 *    group is not a base group and changing its level has no effect.
 *    Changing the level of a group also changes the level of all
 *    windows currently contained by the group.
 *
 *  Parameters:
 *
 *    inGroup:
 *      The window group whose level to change.
 *
 *    inLevel:
 *      The new level for the windows in this group.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetWindowGroupLevel(inGroup: WindowGroupRef; inLevel: SInt32): OSStatus; external name '_SetWindowGroupLevel';

{
 *  GetWindowGroupLevel()
 *
 *  Summary:
 *    Gets the CoreGraphics window group level of windows in a group.
 *
 *  Parameters:
 *
 *    inGroup:
 *      The window group whose level to return.
 *
 *    outLevel:
 *      On exit, contains the window level of the windows in this group.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetWindowGroupLevel(inGroup: WindowGroupRef; var outLevel: SInt32): OSStatus; external name '_GetWindowGroupLevel';


{----------------------------------------------------------------------------------}
{  ¥ÊGroup z-ordering                                                              }
{----------------------------------------------------------------------------------}
{
 *  SendWindowGroupBehind()
 *
 *  Summary:
 *    Changes the z-order of a group, if the group does not have the
 *    kWindowGroupAttributeLayerTogether attribute set.
 *
 *  Discussion:
 *    SendWindowGroupBehind currently requires that the group being
 *    moved and the behindGroup have the same parent group.
 *
 *  Parameters:
 *
 *    inGroup:
 *      The group whose z-order to change.
 *
 *    behindGroup:
 *      The group behind which to position the specified group.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SendWindowGroupBehind(inGroup: WindowGroupRef; behindGroup: WindowGroupRef): OSStatus; external name '_SendWindowGroupBehind';

{----------------------------------------------------------------------------------}
{  ¥ÊGroup containment hierarchy manipulation                                      }
{----------------------------------------------------------------------------------}
{
 *  GetWindowGroup()
 *
 *  Summary:
 *    Gets the window group that contains a window.
 *
 *  Discussion:
 *    The refcount of the group returned by this API is not
 *    incremented, and the caller does not need to release the
 *    reference.
 *
 *  Parameters:
 *
 *    inWindow:
 *      The window whose containing group to retrieve.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.4 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetWindowGroup(inWindow: WindowRef): WindowGroupRef; external name '_GetWindowGroup';

{
 *  SetWindowGroup()
 *
 *  Summary:
 *    Sets the window group that contains a window.
 *
 *  Discussion:
 *    The windowÕs z-order relative to windows in the current process
 *    may also be changed by this API. If the new window group is
 *    z-ordered above the windowÕs current group, the window will be
 *    placed at the end of the new group. If the new window group is
 *    z-ordered below the windowÕs current group, the window will be
 *    placed at the top of the new group. You may not place a window
 *    directly into the root group.
 *
 *  Parameters:
 *
 *    inWindow:
 *      The window whose group to change.
 *
 *    inNewGroup:
 *      The new containing group.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.4 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetWindowGroup(inWindow: WindowRef; inNewGroup: WindowGroupRef): OSStatus; external name '_SetWindowGroup';

{
 *  IsWindowContainedInGroup()
 *
 *  Summary:
 *    Indicates whether a window is contained within a group or any of
 *    its subgroups.
 *
 *  Parameters:
 *
 *    inWindow:
 *      The window whose containment to examine.
 *
 *    inGroup:
 *      The group that might contain the window.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.4 and later
 *    Mac OS X:         in version 10.0 and later
 }
function IsWindowContainedInGroup(inWindow: WindowRef; inGroup: WindowGroupRef): boolean; external name '_IsWindowContainedInGroup';

{
 *  GetWindowGroupParent()
 *
 *  Summary:
 *    Gets the window group that contains a group.
 *
 *  Parameters:
 *
 *    inGroup:
 *      The group whose containing group to retrieve.
 *
 *    outGroup:
 *      On exit, the containing window group of the group. The groupÕs
 *      refcount is not incremented by this API, and the caller does
 *      not need to release the reference.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetWindowGroupParent(inGroup: WindowGroupRef): WindowGroupRef; external name '_GetWindowGroupParent';

{
 *  SetWindowGroupParent()
 *
 *  Summary:
 *    Sets the window group that contains a group.
 *
 *  Discussion:
 *    SetWindowGroupParent currently requires that the group have no
 *    windows in it.
 *
 *  Parameters:
 *
 *    inGroup:
 *      The group whose containing group to change.
 *
 *    inNewGroup:
 *      The new containing group.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetWindowGroupParent(inGroup: WindowGroupRef; inNewGroup: WindowGroupRef): OSStatus; external name '_SetWindowGroupParent';

{
 *  GetWindowGroupSibling()
 *
 *  Summary:
 *    Returns the next or previous group of a window group.
 *
 *  Parameters:
 *
 *    inGroup:
 *      The group whose sibling to return.
 *
 *    inNextGroup:
 *      True to return the next sibling, false to return the previous
 *      sibling.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetWindowGroupSibling(inGroup: WindowGroupRef; inNextGroup: boolean): WindowGroupRef; external name '_GetWindowGroupSibling';

{
 *  GetWindowGroupOwner()
 *
 *  Summary:
 *    Returns the window that owns a window group, or NULL if none.
 *
 *  Discussion:
 *    A window may own one or more window groups. The windows in an
 *    owned window group will always be z-ordered above the owner
 *    window. Whenever the owner window changes z-order, the windows in
 *    the groups owned by the window will be moved also.
 *
 *  Parameters:
 *
 *    inGroup:
 *      The group whose owner to retrieve.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetWindowGroupOwner(inGroup: WindowGroupRef): WindowRef; external name '_GetWindowGroupOwner';

{
 *  SetWindowGroupOwner()
 *
 *  Summary:
 *    Sets the window that owns a window group.
 *
 *  Discussion:
 *    The group and the window must have the same parent group.
 *    SetWindowGroupOwner currently requires that the group have no
 *    windows in it.
 *
 *  Parameters:
 *
 *    inGroup:
 *      The group whose owner to set.
 *
 *    inWindow:
 *      The group's new owner.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetWindowGroupOwner(inGroup: WindowGroupRef; inWindow: WindowRef): OSStatus; external name '_SetWindowGroupOwner';


{----------------------------------------------------------------------------------}
{  ¥ Inspection of group contents                                                  }
{----------------------------------------------------------------------------------}

{
 *  CountWindowGroupContents()
 *
 *  Summary:
 *    Counts the windows or groups contained in a group.
 *
 *  Parameters:
 *
 *    inGroup:
 *      The group whose contents to count.
 *
 *    inOptions:
 *      Specifies how to count the groupÕs contents.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.4 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CountWindowGroupContents(inGroup: WindowGroupRef; inOptions: WindowGroupContentOptions): ItemCount; external name '_CountWindowGroupContents';

{
 *  GetWindowGroupContents()
 *
 *  Summary:
 *    Retrieves the windows or groups contained in a group.
 *
 *  Discussion:
 *    The windows or groups returned by this API will be placed into
 *    the output buffer in z-order, from highest to lowest.
 *
 *  Parameters:
 *
 *    inGroup:
 *      The group whose contents to retrieve.
 *
 *    inOptions:
 *      Specifies which content to retrieve.
 *
 *    inAllowedItems:
 *      The number of items that will fit in the output buffer.
 *
 *    outNumItems:
 *      On exit, the number of items that were returned. May be NULL.
 *
 *    outItems:
 *      On entry, points to enough memory to hold inAllowedSize
 *      WindowRefs or WindowGroupRefs. On exit, contains *outNumItems
 *      WindowRefs or WindowGroupRefs.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.4 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetWindowGroupContents(inGroup: WindowGroupRef; inOptions: WindowGroupContentOptions; inAllowedItems: ItemCount; outNumItems: ItemCountPtr; var outItems: UnivPtr): OSStatus; external name '_GetWindowGroupContents';

{
 *  GetIndexedWindow()
 *
 *  Summary:
 *    Retrieves a specified window from a group.
 *
 *  Discussion:
 *    GetIndexedWindow is provided as an easier way to get a particular
 *    window from a group than using GetWindowGroupContents. If you
 *    only need to retrieve, say, the last window in a group, it is
 *    easier and more efficient to use GetIndexedWindow. If you need to
 *    retrieve all the windows in a group, it is more efficient to use
 *    GetWindowGroupContents.
 *
 *  Parameters:
 *
 *    inGroup:
 *      The group containing the window to retrieve.
 *
 *    inIndex:
 *      The index of the window. This parameter may range from 1 to
 *      CountWindowGroupContents( inGroup,
 *      kWindowGroupContentsReturnWindows | inOptions );
 *
 *    inOptions:
 *      Indicates how to locate the specified window.
 *      kWindowGroupContentsReturnWindows is implied by this API and
 *      does not need to be explicitly specified.
 *
 *    outWindow:
 *      On exit, the window at the specified index.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.4 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetIndexedWindow(inGroup: WindowGroupRef; inIndex: UInt32; inOptions: WindowGroupContentOptions; var outWindow: WindowRef): OSStatus; external name '_GetIndexedWindow';

{
 *  GetWindowIndex()
 *
 *  Summary:
 *    Retrieves the z-order index of a window inside a group.
 *
 *  Discussion:
 *    The z-order index of a window is its relative position in z-order
 *    inside a group. The index ranges from 1 to the number of windows
 *    in the group.
 *
 *  Parameters:
 *
 *    inWindow:
 *      The window whose z-order index to retrieve.
 *
 *    inStartGroup:
 *      The group on which to base the z-order index. This should be
 *      either the containing group of the window, or NULL. If NULL,
 *      this API returns the z-order index of the window across the
 *      entire process.
 *
 *    inOptions:
 *      Indicates how to enumerate the specified window.
 *      kWindowGroupContentsReturnWindows is implied by this API and
 *      does not need to be explicitly specified.
 *
 *    outIndex:
 *      On exit, contains the windowÕs z-order index.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.4 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetWindowIndex(inWindow: WindowRef; inStartGroup: WindowGroupRef; inOptions: WindowGroupContentOptions; var outIndex: UInt32): OSStatus; external name '_GetWindowIndex';


{----------------------------------------------------------------------------------}
{  ¥ÊWindow activation                                                             }
{----------------------------------------------------------------------------------}
{
 *  ActiveNonFloatingWindow()
 *
 *  Summary:
 *    Returns the window, among all windows with activation scope of
 *    kWindowActivationScopeAll, that is considered active.
 *
 *  Discussion:
 *    The Mac OS 8.5 Window Manager introduced the
 *    FrontNonFloatingWindow API, which was designed to return the
 *    window that should be considered active by the application. With
 *    the advent of window groups, it is now possible to have a window
 *    that looks active (is highlighted, and accepts keyboard input)
 *    but to have other non-floating windows grouped above the active
 *    window. The ActiveNonFloatingWindow API returns the active window
 *    regardless of where it is positioned in the z-order. Most code
 *    that currently uses FrontNonFloatingWindow or
 *    GetFrontWindowOfClass(kDocumentClass) to get the active window
 *    should use ActiveNonFloatingWindow instead.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.4 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ActiveNonFloatingWindow: WindowRef; external name '_ActiveNonFloatingWindow';

{
 *  IsWindowActive()
 *
 *  Summary:
 *    Indicates whether a window is active.
 *
 *  Discussion:
 *    The active state of a window is simply determined by whether its
 *    window frame is drawn using an active appearance. This does not
 *    indicate whether the window has keyboard focus. To get the window
 *    with keyboard focus, use GetUserFocusWindow().
 *
 *  Parameters:
 *
 *    inWindow:
 *      The window whose active state to retrieve.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.4 and later
 *    Mac OS X:         in version 10.0 and later
 }
function IsWindowActive(inWindow: WindowRef): boolean; external name '_IsWindowActive';

{
 *  ActivateWindow()
 *
 *  Summary:
 *    Activates or deactivates a window.
 *
 *  Discussion:
 *    Window activation consists of two steps: hiliting the window
 *    frame and sending an activate event to the window. ActivateWindow
 *    handles both of these steps and also updates internal Window
 *    Manager state. If you just need to hilite the window frame, you
 *    may use HiliteWindow. If you need to send an activate event, you
 *    should always use ActivateWindow rather than creating and sending
 *    the event yourself.
 *
 *  Parameters:
 *
 *    inWindow:
 *      The window to activate or deactivate.
 *
 *    inActivate:
 *      Whether to activate or deactivate the window.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.4 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ActivateWindow(inWindow: WindowRef; inActivate: boolean): OSStatus; external name '_ActivateWindow';

{
 *  GetWindowActivationScope()
 *
 *  Summary:
 *    Retrieves a windowÕs activation scope.
 *
 *  Parameters:
 *
 *    inWindow:
 *      The window whose activation scope to retrieve.
 *
 *    outScope:
 *      On exit, the windowÕs activation scope.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.4 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetWindowActivationScope(inWindow: WindowRef; var outScope: WindowActivationScope): OSStatus; external name '_GetWindowActivationScope';

{
 *  SetWindowActivationScope()
 *
 *  Summary:
 *    Sets a windowÕs activation scope.
 *
 *  Parameters:
 *
 *    inWindow:
 *      The window whose activation scope to set.
 *
 *    inScope:
 *      The new activation scope.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.4 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetWindowActivationScope(inWindow: WindowRef; inScope: WindowActivationScope): OSStatus; external name '_SetWindowActivationScope';


{----------------------------------------------------------------------------------}
{  ¥ÊDebugging Utilities                                                           }
{----------------------------------------------------------------------------------}
{
 *  DebugPrintWindowGroup()
 *
 *  Summary:
 *    Prints the contents of a window group to stdout.
 *
 *  Parameters:
 *
 *    inGroup:
 *      The group whose contents to print.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DebugPrintWindowGroup(inGroup: WindowGroupRef); external name '_DebugPrintWindowGroup';

{
 *  DebugPrintAllWindowGroups()
 *
 *  Summary:
 *    Prints the full window group hierarchy, starting at the root
 *    group.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DebugPrintAllWindowGroups; external name '_DebugPrintAllWindowGroups';

{----------------------------------------------------------------------------------}
{  ¥ÊThemeBrush and ThemeTextColor support                                         }
{----------------------------------------------------------------------------------}
{
 *  SetThemeWindowBackground()
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function SetThemeWindowBackground( inWindow: WindowRef; inBrush: ThemeBrush; inUpdate: Boolean ): OSStatus; external name '_SetThemeWindowBackground';


{
 *  SetThemeTextColorForWindow()
 *
 *  Summary:
 *    Sets a text color which contrasts with a theme brush.
 *
 *  Discussion:
 *    SetThemeTextColorForWindow sets a text color in the specified
 *    window's port which contrasts with the specified brush and also
 *    matches the inActive parameter. Only a subset of the theme
 *    brushes have theme text colors: currently (as of Mac OS 9 and Mac
 *    OS X 10.1), the Alert, Dialog, ModelessDialog, and Notification
 *    brushes have corresponding text colors. For any other brush,
 *    SetThemeTextColorForWindow returns themeNoAppropriateBrushErr and
 *    does not modify the text color.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inWindow:
 *      The window whose text color to change.
 *
 *    inActive:
 *      Whether the text color should indicate an active or inactive
 *      state.
 *
 *    inDepth:
 *      The bit depth of the window's port.
 *
 *    inColorDev:
 *      Whether the window's port is color or black&white.
 *
 *  Result:
 *    An operating system result code, including
 *    themeNoAppropriateBrushErr if the specified theme brush does not
 *    have a corresponding theme text color.
 *
 *  Availability:
 *    Mac OS X:         in version 10.0 and later in Carbon.framework
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Non-Carbon CFM:   in AppearanceLib 1.1 and later
 }
// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
function SetThemeTextColorForWindow( inWindow: WindowRef; inActive: Boolean; inDepth: SInt16; inColorDev: Boolean ): OSStatus; external name '_SetThemeTextColorForWindow';

{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{ ¥ Background Image                                                                   }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{  SetWinColor is not available in Carbon. }

{
 *  SetWindowContentColor()
 *
 *  Availability:
 *    Non-Carbon CFM:   in WindowsLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetWindowContentColor(window: WindowRef; const (*var*) color: RGBColor): OSStatus; external name '_SetWindowContentColor';

{
 *  GetWindowContentColor()
 *
 *  Availability:
 *    Non-Carbon CFM:   in WindowsLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetWindowContentColor(window: WindowRef; var color: RGBColor): OSStatus; external name '_GetWindowContentColor';

{  Routines available from Mac OS 8.5 forward }
{
 *  GetWindowContentPattern()
 *
 *  Availability:
 *    Non-Carbon CFM:   in WindowsLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetWindowContentPattern(window: WindowRef; outPixPat: PixPatHandle): OSStatus; external name '_GetWindowContentPattern';

{
 *  SetWindowContentPattern()
 *
 *  Availability:
 *    Non-Carbon CFM:   in WindowsLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetWindowContentPattern(window: WindowRef; pixPat: PixPatHandle): OSStatus; external name '_SetWindowContentPattern';

{  Routines available from Mac OS 9.0 forward }

type
    WindowPaintProcOptions              = OptionBits;

const
    kWindowPaintProcOptionsNone = 0;

    {
     *  InstallWindowContentPaintProc()
     *
     *  Availability:
     *    Non-Carbon CFM:   in WindowsLib 9.0 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function InstallWindowContentPaintProc(window: WindowRef; paintProc: WindowPaintUPP; options: WindowPaintProcOptions; refCon: UnivPtr): OSStatus; external name '_InstallWindowContentPaintProc';

{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{ ¥ Scrolling Routines                                                                 }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}

type
    ScrollWindowOptions         = UInt32;
const
    kScrollWindowNoOptions      = 0;
    kScrollWindowInvalidate     = $00000001;                    {  add the exposed area to the windowÕs update region }
    kScrollWindowEraseToPortBackground = $00000002;             {  erase the exposed area using the background color/pattern of the windowÕs grafport }


    {  Routines available from Mac OS 8.1 forward when linking to CarbonLib 1.0 forward }

    {
     *  ScrollWindowRect()
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function ScrollWindowRect(inWindow: WindowRef; const (*var*) inScrollRect: Rect; inHPixels: SInt16; inVPixels: SInt16; inOptions: ScrollWindowOptions; outExposedRgn: RgnHandle): OSStatus; external name '_ScrollWindowRect';

{
 *  ScrollWindowRegion()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ScrollWindowRegion(inWindow: WindowRef; inScrollRgn: RgnHandle; inHPixels: SInt16; inVPixels: SInt16; inOptions: ScrollWindowOptions; outExposedRgn: RgnHandle): OSStatus; external name '_ScrollWindowRegion';



{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{ ¥ Low-Level Region & Painting Routines                                               }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{
 *  ClipAbove()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure ClipAbove(window: WindowRef); external name '_ClipAbove';
{  SaveOld/DrawNew are not available in Carbon.  Use ReshapeCustomWindow instead. }

{
 *  PaintOne()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure PaintOne(window: WindowRef; clobberedRgn: RgnHandle); external name '_PaintOne';
{
 *  PaintBehind()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure PaintBehind(startWindow: WindowRef; clobberedRgn: RgnHandle); external name '_PaintBehind';
{
 *  CalcVis()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CalcVis(window: WindowRef); external name '_CalcVis';
{
 *  CalcVisBehind()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure CalcVisBehind(startWindow: WindowRef; clobberedRgn: RgnHandle); external name '_CalcVisBehind';
{
 *  CheckUpdate()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CheckUpdate(var theEvent: EventRecord): boolean; external name '_CheckUpdate';
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{ ¥ Window List                                                                        }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{
 *  [Mac]FindWindow()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FindWindow(thePoint: Point; var window: WindowRef): WindowPartCode; external name '_FindWindow';
{
 *  FrontWindow()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FrontWindow: WindowRef; external name '_FrontWindow';
{
 *  BringToFront()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure BringToFront(window: WindowRef); external name '_BringToFront';
{
 *  SendBehind()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SendBehind(window: WindowRef; behindWindow: WindowRef); external name '_SendBehind';
{
 *  SelectWindow()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SelectWindow(window: WindowRef); external name '_SelectWindow';
{
   Routines available from Mac OS 8.6 forward
   or from Mac OS 8.1 forward when linking to CarbonLib 1.0 forward
}

{
 *  FrontNonFloatingWindow()
 *
 *  Availability:
 *    Non-Carbon CFM:   in WindowsLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FrontNonFloatingWindow: WindowRef; external name '_FrontNonFloatingWindow';

{  Routines available from Mac OS 8.1 forward when linking to CarbonLib 1.0 forward }

{
 *  GetNextWindowOfClass()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetNextWindowOfClass(inWindow: WindowRef; inWindowClass: WindowClass; mustBeVisible: boolean): WindowRef; external name '_GetNextWindowOfClass';

{
 *  GetFrontWindowOfClass()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetFrontWindowOfClass(inWindowClass: WindowClass; mustBeVisible: boolean): WindowRef; external name '_GetFrontWindowOfClass';

{
 *  FindWindowOfClass()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FindWindowOfClass(const (*var*) where: Point; inWindowClass: WindowClass; var outWindow: WindowRef; outWindowPart: WindowPartCodePtr): OSStatus; external name '_FindWindowOfClass';


{
 *  Summary:
 *    Options for the CreateStandardWindowMenu API.
 }

const
    kWindowMenuIncludeRotate    = $01;

    {
     *  CreateStandardWindowMenu()
     *
     *  Discussion:
     *    Creates a standard Window menu for your application. You can call
     *    this to create a window menu for your application. Once you have
     *    the menu, you need to insert it in your menu bar (typically at
     *    the end of your menu list) with a call to InsertMenu. To register
     *    a window to be tracked by this menu, you either create your
     *    window with CreateNewWindow, passing the
     *    kWindowInWindowMenuAttribute, or you can use
     *    ChangeWindowAttributes after the window is created. The Toolbox
     *    takes care of acting on the standard items such as zoom and
     *    minimize, as well as bringing selected windows to the front. All
     *    you need to do is install it and register your windows and the
     *    Toolbox does the rest.
     *
     *  Parameters:
     *
     *    inOptions:
     *      Requests optional behavior of the standard window menu. Mac OS
     *      X after 10.1 supports the kWindowMenuIncludeRotate option; in
     *      earlier versions of Mac OS X, and in CarbonLib, you must pass
     *      zero for this parameter.
     *
     *    outMenu:
     *      Receives a new menu reference which contains the standard
     *      window menu items and commands.
     *
     *  Result:
     *    An operating system status code.
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.1 and later
     *    Mac OS X:         in version 10.0 and later
        }
function CreateStandardWindowMenu(inOptions: OptionBits; var outMenu: MenuRef): OSStatus; external name '_CreateStandardWindowMenu';

{
 *  SetWindowAlternateTitle()
 *
 *  Discussion:
 *    This API sets an alternate title for a window. The alternate
 *    title overrides what is displayed in the Window menu. If you do
 *    not set an alternate title, the normal window title is used. You
 *    would normally use this if the window title was not expressive
 *    enough to be used in the Window menu (or similar text-only
 *    situation).
 *
 *  Parameters:
 *
 *    inWindow:
 *      The window to set the alternate title.
 *
 *    inTitle:
 *      The alternate title for the window. Passing NULL for this
 *      parameter will remove any alternate title that might be present.
 *
 *  Result:
 *    An operating system status code.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetWindowAlternateTitle(inWindow: WindowRef; inTitle: CFStringRef): OSStatus; external name '_SetWindowAlternateTitle';

{
 *  CopyWindowAlternateTitle()
 *
 *  Discussion:
 *    This API gets the alternate title for a window. See the
 *    discussion of SetWindowAlternateTitle for more info.
 *
 *  Parameters:
 *
 *    inWindow:
 *      The window to get the alternate title from.
 *
 *    outTitle:
 *      Receives the alternate title for the window. If the window does
 *      not have an alternate title, NULL will be returned in outTitle.
 *
 *  Result:
 *    An operating system status code.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CopyWindowAlternateTitle(inWindow: WindowRef; var outTitle: CFStringRef): OSStatus; external name '_CopyWindowAlternateTitle';

{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{ ¥ Misc Low-Level stuff                                                               }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}

{
 *  IsValidWindowPtr()
 *
 *  Availability:
 *    Non-Carbon CFM:   in WindowsLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function IsValidWindowPtr(possibleWindow: WindowRef): boolean; external name '_IsValidWindowPtr';

{
   Routines available from Mac OS 8.6 forward
   InitFloatingWindows is not available in Carbon;
   window ordering is always active for Carbon clients
}

{
 *  HiliteWindow()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure HiliteWindow(window: WindowRef; fHilite: boolean); external name '_HiliteWindow';
{
 *  SetWRefCon()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetWRefCon(window: WindowRef; data: SInt32); external name '_SetWRefCon';
{
 *  GetWRefCon()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetWRefCon(window: WindowRef): SInt32; external name '_GetWRefCon';
{
 *  SetWindowPic()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetWindowPic(window: WindowRef; pic: PicHandle); external name '_SetWindowPic';
{
 *  GetWindowPic()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetWindowPic(window: WindowRef): PicHandle; external name '_GetWindowPic';
{
 *  GetWVariant()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetWVariant(window: WindowRef): SInt16; external name '_GetWVariant';
{  Routines available from Mac OS 8.0 (Appearance 1.0) forward }
{
 *  GetWindowFeatures()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetWindowFeatures(window: WindowRef; var outFeatures: UInt32): OSStatus; external name '_GetWindowFeatures';
{
 *  GetWindowRegion()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetWindowRegion(window: WindowRef; inRegionCode: WindowRegionCode; ioWinRgn: RgnHandle): OSStatus; external name '_GetWindowRegion';
{
 *  GetWindowStructureWidths()
 *
 *  Availability:
 *    Non-Carbon CFM:   in WindowsLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetWindowStructureWidths(inWindow: WindowRef; var outRect: Rect): OSStatus; external name '_GetWindowStructureWidths';

{
 *  HIWindowChangeFeatures()
 *
 *  Summary:
 *    Changes the window features on the fly.
 *
 *  Discussion:
 *    HIWindowChangeFeatures changes the features of a window. This
 *    should only be used by custom window definitions.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inWindow:
 *      The window to modify.
 *
 *    inSetThese:
 *      The feature bits to set.
 *
 *    inClearThese:
 *      The feature bits to clear.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function HIWindowChangeFeatures( inWindow: WindowRef; inSetThese: UInt64; inClearThese: UInt64 ): OSStatus; external name '_HIWindowChangeFeatures';

{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{ ¥ Update Events                                                                      }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{
   These aren't present in Carbon. Please use the InvalWindowRect, etc. routines
   below instead.
}

{
 *  BeginUpdate()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure BeginUpdate(window: WindowRef); external name '_BeginUpdate';
{
 *  EndUpdate()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure EndUpdate(window: WindowRef); external name '_EndUpdate';
{
   Routines available from Mac OS 8.5 forward
   or from Mac OS 8.1 forward when linking to CarbonLib 1.0 forward
}

{
 *  InvalWindowRgn()
 *
 *  Availability:
 *    Non-Carbon CFM:   in WindowsLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvalWindowRgn(window: WindowRef; region: RgnHandle): OSStatus; external name '_InvalWindowRgn';

{
 *  InvalWindowRect()
 *
 *  Availability:
 *    Non-Carbon CFM:   in WindowsLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvalWindowRect(window: WindowRef; const (*var*) bounds: Rect): OSStatus; external name '_InvalWindowRect';

{
 *  ValidWindowRgn()
 *
 *  Availability:
 *    Non-Carbon CFM:   in WindowsLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ValidWindowRgn(window: WindowRef; region: RgnHandle): OSStatus; external name '_ValidWindowRgn';

{
 *  ValidWindowRect()
 *
 *  Availability:
 *    Non-Carbon CFM:   in WindowsLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ValidWindowRect(window: WindowRef; const (*var*) bounds: Rect): OSStatus; external name '_ValidWindowRect';


{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{ ¥ DrawGrowIcon                                                                       }
{                                                                                      }
{  DrawGrowIcon is deprecated from Mac OS 8.0 forward.  Theme-savvy window defprocs    }
{  include the grow box in the window frame.                                           }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{
 *  DrawGrowIcon()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DrawGrowIcon(window: WindowRef); external name '_DrawGrowIcon';
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{ ¥ Window Titles                                                                      }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{
 *  SetWTitle()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetWTitle(window: WindowRef; const (*var*) title: Str255); external name '_SetWTitle';
{
 *  GetWTitle()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure GetWTitle(window: WindowRef; var title: Str255); external name '_GetWTitle';
{
 *  SetWindowTitleWithCFString()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetWindowTitleWithCFString(inWindow: WindowRef; inString: CFStringRef): OSStatus; external name '_SetWindowTitleWithCFString';

{
 *  CopyWindowTitleAsCFString()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CopyWindowTitleAsCFString(inWindow: WindowRef; var outString: CFStringRef): OSStatus; external name '_CopyWindowTitleAsCFString';


{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{ ¥ Window Proxies                                                                     }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{  Routines available from Mac OS 8.5 forward }

{
 *  SetWindowProxyFSSpec()
 *
 *  Availability:
 *    Non-Carbon CFM:   in WindowsLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetWindowProxyFSSpec(window: WindowRef; const (*var*) inFile: FSSpec): OSStatus; external name '_SetWindowProxyFSSpec';

{
 *  GetWindowProxyFSSpec()
 *
 *  Availability:
 *    Non-Carbon CFM:   in WindowsLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetWindowProxyFSSpec(window: WindowRef; var outFile: FSSpec): OSStatus; external name '_GetWindowProxyFSSpec';

{
 *  SetWindowProxyAlias()
 *
 *  Summary:
 *    Sets the proxy icon for a window based on an AliasHandle.
 *
 *  Parameters:
 *
 *    inWindow:
 *      The window whose proxy icon to set.
 *
 *    inAlias:
 *      The alias that specifies the proxy icon. The Window Manager
 *      copies the alias data; the caller may dispose of the alias
 *      after SetWindowProxyAlias returns.
 *
 *  Availability:
 *    Non-Carbon CFM:   in WindowsLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetWindowProxyAlias(inWindow: WindowRef; inAlias: AliasHandle): OSStatus; external name '_SetWindowProxyAlias';

{
 *  GetWindowProxyAlias()
 *
 *  Availability:
 *    Non-Carbon CFM:   in WindowsLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetWindowProxyAlias(window: WindowRef; var alias: AliasHandle): OSStatus; external name '_GetWindowProxyAlias';

{
 *  SetWindowProxyCreatorAndType()
 *
 *  Availability:
 *    Non-Carbon CFM:   in WindowsLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetWindowProxyCreatorAndType(window: WindowRef; fileCreator: OSType; fileType: OSType; vRefNum: SInt16): OSStatus; external name '_SetWindowProxyCreatorAndType';

{
 *  GetWindowProxyIcon()
 *
 *  Availability:
 *    Non-Carbon CFM:   in WindowsLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetWindowProxyIcon(window: WindowRef; var outIcon: IconRef): OSStatus; external name '_GetWindowProxyIcon';

{
 *  SetWindowProxyIcon()
 *
 *  Availability:
 *    Non-Carbon CFM:   in WindowsLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetWindowProxyIcon(window: WindowRef; icon: IconRef): OSStatus; external name '_SetWindowProxyIcon';

{
 *  RemoveWindowProxy()
 *
 *  Availability:
 *    Non-Carbon CFM:   in WindowsLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function RemoveWindowProxy(window: WindowRef): OSStatus; external name '_RemoveWindowProxy';

{
 *  BeginWindowProxyDrag()
 *
 *  Availability:
 *    Non-Carbon CFM:   in WindowsLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function BeginWindowProxyDrag(window: WindowRef; var outNewDrag: DragReference; outDragOutlineRgn: RgnHandle): OSStatus; external name '_BeginWindowProxyDrag';

{
 *  EndWindowProxyDrag()
 *
 *  Availability:
 *    Non-Carbon CFM:   in WindowsLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function EndWindowProxyDrag(window: WindowRef; theDrag: DragReference): OSStatus; external name '_EndWindowProxyDrag';

{
 *  TrackWindowProxyFromExistingDrag()
 *
 *  Availability:
 *    Non-Carbon CFM:   in WindowsLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TrackWindowProxyFromExistingDrag(window: WindowRef; startPt: Point; drag: DragReference; inDragOutlineRgn: RgnHandle): OSStatus; external name '_TrackWindowProxyFromExistingDrag';

{
 *  TrackWindowProxyDrag()
 *
 *  Availability:
 *    Non-Carbon CFM:   in WindowsLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TrackWindowProxyDrag(window: WindowRef; startPt: Point): OSStatus; external name '_TrackWindowProxyDrag';

{
 *  IsWindowModified()
 *
 *  Availability:
 *    Non-Carbon CFM:   in WindowsLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function IsWindowModified(window: WindowRef): boolean; external name '_IsWindowModified';

{
 *  SetWindowModified()
 *
 *  Availability:
 *    Non-Carbon CFM:   in WindowsLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetWindowModified(window: WindowRef; modified: boolean): OSStatus; external name '_SetWindowModified';

{
 *  IsWindowPathSelectClick()
 *
 *  Availability:
 *    Non-Carbon CFM:   in WindowsLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function IsWindowPathSelectClick(window: WindowRef; const (*var*) event: EventRecord): boolean; external name '_IsWindowPathSelectClick';

{
 *  WindowPathSelect()
 *
 *  Availability:
 *    Non-Carbon CFM:   in WindowsLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function WindowPathSelect(window: WindowRef; menu: MenuRef; var outMenuResult: SInt32): OSStatus; external name '_WindowPathSelect';

{
 *  IsWindowPathSelectEvent()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function IsWindowPathSelectEvent(window: WindowRef; inEvent: EventRef): boolean; external name '_IsWindowPathSelectEvent';


{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{  ¥ HiliteWindowFrameForDrag                                                          }
{                                                                                      }
{  If you call ShowDragHilite and HideDragHilite, you donÕt need to use this routine.  }
{  If you implement custom drag hiliting, you should call HiliteWindowFrameForDrag     }
{  when the drag is tracking inside a window with drag-hilited content.                }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{  Routines available from Mac OS 8.5 forward }

{
 *  HiliteWindowFrameForDrag()
 *
 *  Availability:
 *    Non-Carbon CFM:   in WindowsLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function HiliteWindowFrameForDrag(window: WindowRef; hilited: boolean): OSStatus; external name '_HiliteWindowFrameForDrag';
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{ ¥ Window Transitions                                                                 }
{                                                                                      }
{  TransitionWindow displays a window with accompanying animation and sound.           }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}

{
 *  WindowTransitionEffect
 *
 *  Summary:
 *    Visual effects that are provided by TransitionWindow
 }
type
    WindowTransitionEffect = UInt32;
const
  {
   * Finder-like zoom rectangles. Use with TransitionWindow and Show or
   * Hide transition actions
   }
  kWindowZoomTransitionEffect   = 1;

  {
   * Zoom in/out from parent. Use with TransitionWindowAndParent and
   * Show or Hide transition actions. Available in Mac OS X, and in
   * CarbonLib 1.5 and later.
   }
  kWindowSheetTransitionEffect  = 2;

  {
   * Slide the window into its new position. Use with TransitionWindow
   * and Move or Resize transition actions. Available in Mac OS X, and
   * in CarbonLib 1.5 and later.
   }
  kWindowSlideTransitionEffect  = 3;

  {
   * Fade the window into or out of visibility. Use with the Show or
   * Hide transition actions. Available in Mac OS X 10.3 and later.
   }
  kWindowFadeTransitionEffect   = 4;

  {
   * Use the Genie effect that the Dock uses to minimize or maximize a
   * window to show or hide the window. Use with the Show or Hide
   * transition actions. Available in Mac OS X 10.3 and later.
   }
  kWindowGenieTransitionEffect  = 5;


{
 *  WindowTransitionAction
 *
 *  Summary:
 *    Modifications to window state that are provided by
 *    TransitionWindow
 }
type
    WindowTransitionAction = UInt32;
const

  {
   * Shows the window. Use with the Zoom, Sheet, Fade, or Genie
   * transition effects. For the Zoom, Sheet, and Genie effects, the
   * inRect parameter is the global coordinates from which to start the
   * animation; if inRect is NULL, the animation begins at the center
   * of the window. The Fade effect does not use the inRect parameter.
   }
  kWindowShowTransitionAction   = 1;

  {
   * Hides the window. Use with the Zoom, Sheet, Fade, or Genie
   * transition effects. For the Zoom, Sheet, and Genie effects, the
   * inRect parameter is the global coordinates at which to end the
   * animation; if inRect is NULL, the animation ends at the center of
   * the window. The Fade effect does not use the inRect parameter.
   }
  kWindowHideTransitionAction   = 2;

  {
   * Moves the window. Use with the Slide transition effect. The inRect
   * parameter is the global coordinates of the window's new structure
   * bounds; inRect must be non-NULL. Available in Mac OS X, and in
   * CarbonLib 1.5 and later.
   }
  kWindowMoveTransitionAction   = 3;

  {
   * Resizes the window. Use with the Slide transition effect. The
   * inRect parameter is the global coordinates of the window's new
   * structure bounds; inRect must be non-NULL. Available in Mac OS X,
   * and in CarbonLib 1.5 and later.
   }
  kWindowResizeTransitionAction = 4;

    {
     *  TransitionWindow()
     *
     *  Summary:
     *    Shows, hides, moves, or resizes a window with appropriate
     *    animation and sound.
     *
     *  Parameters:
     *
     *    inWindow:
     *      The window on which to act.
     *
     *    inEffect:
     *      The type of visual effect to use. TransitionWindow supports the
     *      Zoom and Slide transition effects. The Slide effect is
     *      supported on Mac OS X and in CarbonLib 1.5 and later.
     *
     *    inAction:
     *      The action to take on the window. TransitionWindow supports the
     *      Show, Hide, Move, and Resize actions. The Move and Resize
     *      actions are supported on Mac OS X and in CarbonLib 1.5 and
     *      later.
     *
     *    inRect:
     *      A screen rect in global coordinates. The interpretation of the
     *      rect is dependent on the transition action; see the
     *      documentation for each action for details. May be NULL for some
     *      transition actions.
     *
     *  Availability:
     *    Non-Carbon CFM:   in WindowsLib 8.5 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function TransitionWindow(inWindow: WindowRef; inEffect: WindowTransitionEffect; inAction: WindowTransitionAction; inRect: {Const}RectPtr): OSStatus; external name '_TransitionWindow';

{
 *  TransitionWindowAndParent()
 *
 *  Summary:
 *    Shows or hides a window, potentially also moving a second window,
 *    with appropriate animation and sound.
 *
 *  Parameters:
 *
 *    inWindow:
 *      The window on which to act.
 *
 *    inParentWindow:
 *      The window to which the primary window is related.
 *
 *    inEffect:
 *      The type of visual effect to use. TransitionWindowAndParent
 *      supports the Sheet transition effect.
 *
 *    inAction:
 *      The action to take on the window. TransitionWindowAndParent
 *      supports the Show and Hide actions.
 *
 *    inRect:
 *      A screen rect in global coordinates. The interpretation of the
 *      rect is dependent on the transition action; see the
 *      documentation for each action for details. May be NULL for some
 *      transition actions.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.5 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TransitionWindowAndParent(inWindow: WindowRef; inParentWindow: WindowRef; inEffect: WindowTransitionEffect; inAction: WindowTransitionAction; inRect: {Const}RectPtr): OSStatus; external name '_TransitionWindowAndParent';

{
 *  TransitionWindowOptions
 *
 *  Summary:
 *    Extensible parameter block for the TransitionWindowWithOptions
 *    API.
 }
type TransitionWindowOptions = record

  {
   * The structure version. You must put 0 in this field.
   }
  version: UInt32;

  {
   * The duration of the fade, in seconds. For use with the Sheet,
   * Slide, Fade, and Genie transition effects; ignored for other
   * effects. You may pass 0 to use the default duration. The effect is
   * not guaranteed to last precisely this long, but should be a close
   * approximation.
   }
  duration: EventTime;

  {
   * For use with kWindowSheetTransitionEffect. This is the parent
   * window of the sheet.
   }
  window: WindowRef;

  {
   * This value will be sent as the kEventParamUserData parameter for
   * the kEventWindowTransitionStarted and
   * kEventWindowTransitionCompleted events.
   }
  userData: Ptr;
end;
TransitionWindowOptionsPtr = ^TransitionWindowOptions;

{
 *  TransitionWindowWithOptions()
 *
 *  Summary:
 *    Transitions a window from one state to another with appropriate
 *    animation and sound.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inWindow:
 *      The window that should be transitioned.
 *
 *    inEffect:
 *      The type of visual effect to use.
 *
 *    inAction:
 *      The action to take on the window.
 *
 *    inBounds:
 *      A screen rect in global coordinates. The interpretation of the
 *      rect is dependent on the transition action; see the
 *      documentation for each action for details. May be NULL for some
 *      transition actions.
 *
 *    inAsync:
 *      Whether the transition should run synchronously or
 *      asynchronously. If inAsync is true, TransitionWindow will
 *      return immediately, and the transition will run using an event
 *      loop timer. You must run your event loop for the transition to
 *      occur. If inAsync is false, TransitionWindow will block until
 *      the transition is completed. In either case, the
 *      kEventWindowTransitionStarted and
 *      kEventWindowTransitionCompleted Carbon events will be sent to
 *      the transitioning window at the start and end of the transition.
 *
 *    inOptions:
 *      Extra options that are required for some transitions. This
 *      parameter may be NULL if the specific transition effect does
 *      not require extra information.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function TransitionWindowWithOptions( inWindow: WindowRef; inEffect: WindowTransitionEffect; inAction: WindowTransitionAction; inBounds: HIRectPtr; inAsync: Boolean; inOptions: TransitionWindowOptionsPtr ): OSStatus; external name '_TransitionWindowWithOptions';

{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{ ¥ Window Positioning                                                                 }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}

{
 *  [Mac]MoveWindow()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure MoveWindow(window: WindowRef; hGlobal: SInt16; vGlobal: SInt16; front: boolean); external name '_MoveWindow';
{
 *  SizeWindow()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SizeWindow(window: WindowRef; w: SInt16; h: SInt16; fUpdate: boolean); external name '_SizeWindow';
{ Note: bBox can only be NULL when linking to CarbonLib 1.0 forward }
{
 *  GrowWindow()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GrowWindow(window: WindowRef; startPt: Point; bBox: {Const}RectPtr): SInt32; external name '_GrowWindow';
{ Note: boundsRect can only be NULL when linking to CarbonLib 1.0 forward }
{
 *  DragWindow()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DragWindow(window: WindowRef; startPt: Point; boundsRect: {Const}RectPtr); external name '_DragWindow';
{
 *  ZoomWindow()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure ZoomWindow(window: WindowRef; partCode: WindowPartCode; front: boolean); external name '_ZoomWindow';
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{ ¥ Window Collapsing/Expanding                                                        }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{  Routines available from Mac OS 8.0 (Appearance 1.0) forward }
{
 *  IsWindowCollapsable()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function IsWindowCollapsable(window: WindowRef): boolean; external name '_IsWindowCollapsable';
{
 *  IsWindowCollapsed()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function IsWindowCollapsed(window: WindowRef): boolean; external name '_IsWindowCollapsed';
{
 *  CollapseWindow()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CollapseWindow(window: WindowRef; collapse: boolean): OSStatus; external name '_CollapseWindow';
{
 *  CollapseAllWindows()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CollapseAllWindows(collapse: boolean): OSStatus; external name '_CollapseAllWindows';
{  Routines available on Mac OS X }

{
 *  CreateQDContextForCollapsedWindowDockTile()
 *
 *  Discussion:
 *    Creates and returns a CGrafPtr for a collapsed window's tile in
 *    the dock. You can use this port to draw into your window's dock
 *    tile with Quickdraw. You **MUST** call
 *    ReleaseQDContextForCollapsedWindowDockTile and NOT DisposePort
 *    when using this API, as it maintains more state than just the
 *    port. If you call DisposePort, you may leak system resources.
 *
 *  Parameters:
 *
 *    inWindow:
 *      The window to create the dock tile port for. If this window is
 *      not collapsed, an error is returned.
 *
 *    outContext:
 *      The Quickdraw port for you to use to draw into. If you wish to
 *      use CoreGraphics (Quartz) drawing, call CreateCGContextForPort
 *      with this port to obtain a CGContext.
 *
 *  Result:
 *    An operating system result code.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CreateQDContextForCollapsedWindowDockTile(inWindow: WindowRef; var outContext: CGrafPtr): OSStatus; external name '_CreateQDContextForCollapsedWindowDockTile';

{
 *  ReleaseQDContextForCollapsedWindowDockTile()
 *
 *  Discussion:
 *    Releases a port and other state created by the
 *    CreateQDContextForCollapsedWindowDockTile API. You MUST call this
 *    instead of DisposePort directly, or you may leak system resources.
 *
 *  Parameters:
 *
 *    inWindow:
 *      The window you created the port for. If this window is not
 *      collapsed, an error is returned.
 *
 *    inContext:
 *      The Quickdraw context to dispose.
 *
 *  Result:
 *    An operating system result code.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ReleaseQDContextForCollapsedWindowDockTile(inWindow: WindowRef; inContext: CGrafPtr): OSStatus; external name '_ReleaseQDContextForCollapsedWindowDockTile';

{
 *  UpdateCollapsedWindowDockTile()
 *
 *  Discussion:
 *    Automatically updates the image of a particular window in the
 *    dock to the current contents of the window. Use this for periodic
 *    updates, etc. Do not use this for animation purposes, if you want
 *    animation, use the above create/release drawing context APIs.
 *
 *  Parameters:
 *
 *    inWindow:
 *      The window to update the dock tile for. If this window is not
 *      collapsed, an error is returned.
 *
 *  Result:
 *    An operating system result code.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function UpdateCollapsedWindowDockTile(inWindow: WindowRef): OSStatus; external name '_UpdateCollapsedWindowDockTile';

{
 *  SetWindowDockTileMenu()
 *
 *  Summary:
 *    Sets the menu that is displayed by a window's dock tile.
 *
 *  Discussion:
 *    When a window's dock tile menu is right-clicked or
 *    control-clicked, the Dock will always automatically display a
 *    menu containing a Close menu item that closes the window. If the
 *    application wants to add other additional menu items, it can use
 *    the SetWindowDockTileMenu API to provide those items. The items
 *    in the specified menu will be combined with the standard items
 *    provided by the Dock.
 *
 *    Before the menu is actually displayed, it will receive
 *    kEventMenuPopulate, kEventMenuOpening, and kEventMenuEnableItems
 *    Carbon events, so any event handlers for these events may update
 *    the menu appropriately for the current state of the
 *    application.
 *
 *    The application should set a command ID for each menu item in the
 *    dock tile menu, and when that item is chosen, a
 *    kEventCommandProcess Carbon event containing the item's command
 *    ID will be sent to the window's event target (and from there to
 *    the application, if the window does not handle the
 *    event).
 *
 *    This API increments the refcount of the specified menu.
 *
 *    The toolbox provides a default handler for the
 *    kEventWindowGetDockTileMenu event that returns the menu specified
 *    by the SetWindowDockTileMenu API.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inWindow:
 *      The window for which to set the dock tile menu.
 *
 *    inMenu:
 *      The menu to display, or NULL to remove the current dock tile
 *      menu.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
function SetWindowDockTileMenu( inWindow: WindowRef; inMenu: MenuRef ): OSStatus; external name '_SetWindowDockTileMenu';


{
 *  GetWindowDockTileMenu()
 *
 *  Summary:
 *    Returns the menu that is displayed by a window's dock tile.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Result:
 *    The application's dock tile menu, or NULL if none.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
function GetWindowDockTileMenu( inWindow: WindowRef ): MenuRef; external name '_GetWindowDockTileMenu';

{
   Routines available from Mac OS 8.5 forward
   or from Mac OS 8.1 forward when linking to CarbonLib 1.0 forward
}

{
 *  GetWindowBounds()
 *
 *  Availability:
 *    Non-Carbon CFM:   in WindowsLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetWindowBounds(window: WindowRef; regionCode: WindowRegionCode; var globalBounds: Rect): OSStatus; external name '_GetWindowBounds';

{
 *  SetWindowResizeLimits()
 *
 *  Summary:
 *    Sets the minimum and maximum content sizes for a window.
 *
 *  Discussion:
 *    The minimum and maximum sizes are obeyed by ResizeWindow and
 *    GrowWindow. The default Carbon event handler installed for all
 *    windows will return these sizes in response to
 *    kEventWindowGetMinimumSize and kEventWindowGetMaximumSize events.
 *    When a window is first created, its minimum and maximum sizes are
 *    set to reasonable values (which may change from one system
 *    release to the next).
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inWindow:
 *      The window whose minimum and maximum sizes to set.
 *
 *    inMinLimits:
 *      The new minimum size for the content region of the window. Pass
 *      NULL if you don't want to set a minimum size.
 *
 *    inMaxLimits:
 *      The new maximum size for the content region of the window. Pass
 *      NULL if you don't want to set a maximum size.
 *
 *  Result:
 *    An operating system result code.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
function SetWindowResizeLimits( inWindow: WindowRef; inMinLimits: HISizePtr; inMaxLimits: HISizePtr ): OSStatus; external name '_SetWindowResizeLimits';


{
 *  GetWindowResizeLimits()
 *
 *  Summary:
 *    Returns the minimum and maximum content sizes for a window.
 *
 *  Discussion:
 *    GetWindowResizeLimits returns the minimum and maximum sizes that
 *    were set by SetWindowResizeLimits. Note that it does not send
 *    kEventWindowGetMinimumSize or kEventWindowGetMaximumSize Carbon
 *    events to get these sizes; it simply retrieves the sizes from the
 *    WindowRef. It is entirely possible (and quite likely) that a
 *    given window will have event handlers for the
 *    kEventWindowGetMinimum/MaximumSize events that will modify or
 *    override the sizes in the WindowRef; therefore, to accurately
 *    determine the desired minimum and maximum sizes, you should send
 *    kEventWindowGetMinimum/MaximumSize Carbon events rather than
 *    using this API.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inWindow:
 *      The window whose minimum and maximum sizes to retrieve.
 *
 *    outMinLimits:
 *      On exit, contains the minimum size of the window's content
 *      region. Pass NULL if you don't want this information.
 *
 *    outMaxLimits:
 *      On exit, contains the maximum size of the window's content
 *      region. Pass NULL if you don't want this information.
 *
 *  Result:
 *    An operating system result code.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
function GetWindowResizeLimits( inWindow: WindowRef; outMinLimits: HISizePtr; outMaxLimits: HISizePtr ): OSStatus; external name '_GetWindowResizeLimits';

{
 *  ResizeWindow()
 *
 *  Summary:
 *    Handles all user interaction while a window is being resized.
 *
 *  Discussion:
 *    The ResizeWindow function moves either an outline of the window's
 *    edges (on Mac OS 9.x and earlier) or the actual window (on Mac OS
 *    X) around the screen, following the userÕs cursor movements, and
 *    handles all user interaction until the mouse button is released.
 *    Unlike the GrowWindow API, there is no need to follow this call
 *    with a call to the function SizeWindow, because once the mouse
 *    button is released, ResizeWindow resizes the window if the user
 *    has changed the window size. Once the resizing is complete,
 *    ResizeWindow draws the window in the new size. Your application
 *    should call the ResizeWindow function instead of the earlier
 *    Window Manager APIs SizeWindow and GrowWindow. Some windows may
 *    allow themselves to be resized from any corner or edge, not just
 *    the bottom right, and as a result, when the user resizes the
 *    window, the window may move on the screen and not merely change
 *    size. ResizeWindow informs your application of the new window
 *    bounds, so that your application can respond to any changes in
 *    the windowÕs position.
 *
 *  Parameters:
 *
 *    inWindow:
 *      The window to be resized.
 *
 *    inStartPoint:
 *      The point, in global coordinates, at which the original
 *      mouse-down occurred.
 *
 *    inSizeConstraints:
 *      The limits on the vertical and horizontal measurements of the
 *      content rectangle, in pixels. Although this parameter is typed
 *      as a Rect, the four numbers in the structure represent limits,
 *      not screen coordinates. The top, left, bottom, and right fields
 *      of the structure specify the minimum vertical measurement
 *      (top), the minimum horizontal measurement (left), the maximum
 *      vertical measurement (bottom), and the maximum horizontal
 *      measurement (right). The minimum dimensions should be large
 *      enough to allow a manageable rectangle; 64 pixels on a side is
 *      typical. The maximum dimensions can be no greater than 32,767.
 *      You can pass NULL to allow the user to resize the window to any
 *      size that is contained onscreen.
 *
 *    outNewContentRect:
 *      On exit, the structure contains the new dimensions of the
 *      windowÕs content region, in global coordinates. On Mac OS 9.x
 *      and earlier, you must pass a non-NULL value in this parameter;
 *      in Carbon, you may pass NULL if you do not need the windowÕs
 *      new dimensions.
 *
 *  Result:
 *    Returns true if the window changed size, or false if not.
 *
 *  Availability:
 *    Non-Carbon CFM:   in WindowsLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ResizeWindow(inWindow: WindowRef; inStartPoint: Point; inSizeConstraints: {Const}RectPtr; outNewContentRect: RectPtr): boolean; external name '_ResizeWindow';


{
   Routines available from Mac OS 8.5 forward,
   or from Mac OS 8.1 forward when linking to CarbonLib 1.0.2 forward
}

{
 *  SetWindowBounds()
 *
 *  Availability:
 *    Non-Carbon CFM:   in WindowsLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetWindowBounds(window: WindowRef; regionCode: WindowRegionCode; const (*var*) globalBounds: Rect): OSStatus; external name '_SetWindowBounds';

{  Routines available from Mac OS 8.5 forward }

{
 *  RepositionWindow()
 *
 *  Availability:
 *    Non-Carbon CFM:   in WindowsLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function RepositionWindow(window: WindowRef; parentWindow: WindowRef; method: WindowPositionMethod): OSStatus; external name '_RepositionWindow';

{
 *  MoveWindowStructure()
 *
 *  Availability:
 *    Non-Carbon CFM:   in WindowsLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function MoveWindowStructure(window: WindowRef; hGlobal: SInt16; vGlobal: SInt16): OSStatus; external name '_MoveWindowStructure';

{
   Routines available from Mac OS 8.5 forward,
   or from Mac OS 8.6 forward when linking to CarbonLib 1.1 forward
}

{  Routines available from Mac OS 8.5 forward }

{
 *  IsWindowInStandardState()
 *
 *  Summary:
 *    Determines whether a window is currently zoomed in to the user
 *    state or zoomed out to the standard state.
 *
 *  Discussion:
 *    IsWindowInStandardState compares the windowÕs current dimensions
 *    to those given by the inIdealSize parameter to determine if the
 *    window is currently in its standard (zoomed-out) state. Your
 *    application may use IsWindowInStandardState to decide whether a
 *    userÕs click of the zoom box is a request to zoom in to the user
 *    state or out to the standard state. Your application may also use
 *    IsWindowInStandardState to determine the size and position of the
 *    standard state that the Window Manager would calculate for a
 *    window, given a specified ideal size; this value is returned in
 *    the outIdealStandardState parameter.
 *
 *  Parameters:
 *
 *    inWindow:
 *      The window for which to determine the zoom state.
 *
 *    inIdealSize:
 *      The ideal width and height of the windowÕs content region,
 *      regardless of the actual screen device dimensions. If you set
 *      idealSize to NULL, IsWindowInStandardState examines the
 *      dimensions stored in the stdState field of the WStateData
 *      structure attached to the window.
 *
 *    outIdealStandardState:
 *      On exit, contains the global coordinates for the content region
 *      of the window in its standard state, based on the data supplied
 *      in the inIdealSize parameter. You may pass NULL if you do not
 *      need this information.
 *
 *  Result:
 *    Returns true if the window is currently in its standard
 *    (zoomed-out) state, or false if the window is a non-zoomed-out
 *    state.
 *
 *  Availability:
 *    Non-Carbon CFM:   in WindowsLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function IsWindowInStandardState(inWindow: WindowRef; inIdealSize: {Const}PointPtr; outIdealStandardState: RectPtr): boolean; external name '_IsWindowInStandardState';

{
 *  ZoomWindowIdeal()
 *
 *  Summary:
 *    Zooms a window in accordance with human interface guidelines.
 *
 *  Discussion:
 *    Applications should use the ZoomWindowIdeal API instead of the
 *    older ZoomWindow API. When your application calls
 *    ZoomWindowIdeal, it automatically conforms to the human interface
 *    guidelines for determining a windowÕs standard state: the window
 *    is moved as little as possible when switching between user and
 *    standard states, the window is zoomed to the screen that contains
 *    the largest portion of the window, and the window is positioned
 *    in its zoomed-out size to avoid the Dock on Mac OS X. The
 *    ZoomWindowIdeal API calculates a windowÕs ideal standard state
 *    and updates a windowÕs ideal user state independently of the
 *    WStateData structure. Previously, the window definition function
 *    was responsible for updating the user state, but because it
 *    relies upon the WStateData structure, the window definition
 *    function is unaware of the ideal standard state and can no longer
 *    track the windowÕs zoom state reliably. The Window Manager
 *    provides the GetWindowIdealUserState and SetWindowIdealUserState
 *    APIs to access a window's current ideal user state, previously
 *    recorded by ZoomWindowIdeal.
 *
 *  Parameters:
 *
 *    inWindow:
 *      The window to be zoomed.
 *
 *    inPartCode:
 *      The direction of the zoom, either inZoomIn or inZoomOut. The
 *      value passed in this parameter should generally be determined
 *      by calling IsWindowInStandardState; if IsWindowInStandardState
 *      returns true, pass inZoomIn, otherwise pass inZoomOut.
 *
 *    ioIdealSize:
 *      When you specify inZoomIn in the inPartCode parameter, this
 *      parameter is unused on entry; you pass a pointer to a Point
 *      structure, but do not fill the structure with data. On exit,
 *      the Point contains the new height and width of the windowÕs
 *      content region, and ZoomWindowIdeal restores the previous ideal
 *      user state. When you specify inZoomOut in the inPartCode
 *      parameter, you pass the ideal height and width of the windowÕs
 *      content region in the Point structure. On return, the Point
 *      contains the new height and width of the windowÕs content
 *      region; ZoomWindowIdeal saves the current user state of the
 *      window and zooms the window to its ideal size for the standard
 *      state.
 *
 *  Result:
 *    An operating system result code.
 *
 *  Availability:
 *    Non-Carbon CFM:   in WindowsLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ZoomWindowIdeal(inWindow: WindowRef; inPartCode: WindowPartCode; var ioIdealSize: Point): OSStatus; external name '_ZoomWindowIdeal';

{
 *  GetWindowIdealUserState()
 *
 *  Summary:
 *    Returns the bounds of a windowÕs content region in its user
 *    (zoomed-in) state.
 *
 *  Discussion:
 *    Traditionally, the user (zoomed-in) state of a window has been
 *    stored in the WStateData structure attached to a window. This
 *    field is updated by the window definition when the user clicks on
 *    the zoom box and the window definition determines that the window
 *    is currently not zoomed out. When determining whether the window
 *    is zoomed out, however, the window definition can only look at
 *    the standard state stored in the WStateData field. With the
 *    introduction of the ZoomWindowIdeal API, there is a new basis for
 *    determining whether a window is zoomed out: the windowÕs ideal
 *    size. The window definition does not have access to the windowÕs
 *    ideal size, and therefore cannot accurately determine whether a
 *    window that is zoomed with ZoomWindowIdeal is in its user state
 *    or standard state; therefore, the user state that the window
 *    definition stores in the WStateData is also unreliable. The
 *    ZoomWindowIdeal API therefore stores the windowÕs user state
 *    before zooming out in a new location, which is accessed using the
 *    GetWindowIdealUserState API. The GetWindowIdealUserState API
 *    returns the windowÕs user state most recently recorded by
 *    ZoomWindowIdeal.
 *
 *  Parameters:
 *
 *    inWindow:
 *      The window whose ideal user state you wish to retrieve.
 *
 *    outUserState:
 *      On exit, contains the global coordinates of the windowÕs
 *      content region when zoomed in. On Mac OS X 10.1 and earlier,
 *      and CarbonLib 1.5 and earlier, the windowÕs ideal user state is
 *      an empty rect with coordinates (0,0,0,0) if the window has
 *      never been zoomed out; you should check for an empty rect and
 *      use GetWindowBounds with the kWindowContentRgn selector to
 *      determine the windowÕs current content region. On later
 *      versions of Mac OS X and CarbonLib, GetWindowIdealUserState
 *      automatically returns the windowÕs current content bounds if
 *      the window has not yet been zoomed.
 *
 *  Result:
 *    An operating system result code.
 *
 *  Availability:
 *    Non-Carbon CFM:   in WindowsLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetWindowIdealUserState(inWindow: WindowRef; var outUserState: Rect): OSStatus; external name '_GetWindowIdealUserState';

{
 *  SetWindowIdealUserState()
 *
 *  Summary:
 *    Sets the bounds of a windowÕs content region in its user
 *    (zoomed-in) state.
 *
 *  Discussion:
 *    The windowÕs ideal user state is used by the ZoomWindowIdeal API
 *    when zooming in. The ideal user state is ignored by the
 *    ZoomWindow API.
 *
 *  Parameters:
 *
 *    inWindow:
 *      The window whose ideal user state to set.
 *
 *    inUserState:
 *      The global coordinates of the windowÕs content region in its
 *      ideal user state.
 *
 *  Result:
 *    An operating system result code.
 *
 *  Availability:
 *    Non-Carbon CFM:   in WindowsLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetWindowIdealUserState(inWindow: WindowRef; const (*var*) inUserState: Rect): OSStatus; external name '_SetWindowIdealUserState';

{  Routines available in CarbonLib 1.1 and later }

{
 *  GetWindowGreatestAreaDevice()
 *
 *  Summary:
 *    Returns the graphics device with the greatest area of
 *    intersection with a specified window region.
 *
 *  Parameters:
 *
 *    inWindow:
 *      The window to compare against.
 *
 *    inRegion:
 *      The window region to compare against.
 *
 *    outGreatestDevice:
 *      On exit, the graphics device with the greatest intersection.
 *      May be NULL.
 *
 *    outGreatestDeviceRect:
 *      On exit, the bounds of the graphics device with the greatest
 *      intersection. May be NULL. If the device with the greatest
 *      intersection also contains the menu bar, the device rect will
 *      exclude the menu bar area.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetWindowGreatestAreaDevice(inWindow: WindowRef; inRegion: WindowRegionCode; outGreatestDevice: GDHandlePtr; outGreatestDeviceRect: RectPtr): OSStatus; external name '_GetWindowGreatestAreaDevice';


{
 *  WindowConstrainOptions
 *
 }

type
    WindowConstrainOptions      = UInt32;
const
    kWindowConstrainMayResize   = $00000001;
    kWindowConstrainMoveRegardlessOfFit = $00000002;
    kWindowConstrainAllowPartial = $00000004;
    kWindowConstrainCalcOnly    = $00000008;
    kWindowConstrainUseTransitionWindow = $00000010;
    kWindowConstrainStandardOptions = $00000002;

    {
     *  ConstrainWindowToScreen()
     *
     *  Summary:
     *    Moves and resizes a window so that it's contained entirely on a
     *    single screen.
     *
     *  Parameters:
     *
     *    inWindowRef:
     *      The window to constrain.
     *
     *    inRegionCode:
     *      The window region to constrain.
     *
     *    inOptions:
     *      Flags controlling how the window is constrained.
     *
     *    inScreenRect:
     *      A rectangle, in global coordinates, in which to constrain the
     *      window. May be NULL. If NULL, the window is constrained to the
     *      screen with the greatest intersection with the specified window
     *      region.
     *
     *    outStructure:
     *      On exit, contains the new structure bounds of the window, in
     *      global coordinates. May be NULL.
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.1 and later
     *    Mac OS X:         in version 10.0 and later
        }
function ConstrainWindowToScreen(inWindowRef: WindowRef; inRegionCode: WindowRegionCode; inOptions: WindowConstrainOptions; inScreenRect: {Const}RectPtr; outStructure: RectPtr): OSStatus; external name '_ConstrainWindowToScreen';

{
 *  GetAvailableWindowPositioningBounds()
 *
 *  Summary:
 *    Returns the available window positioning bounds on the given
 *    screen (i.e., the screen rect minus the MenuBar and Dock if
 *    located on that screen).
 *
 *  Parameters:
 *
 *    inDevice:
 *      The device for which to find the available bounds.
 *
 *    outAvailableRect:
 *      On exit, contains the available bounds for the given device.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetAvailableWindowPositioningBounds(inDevice: GDHandle; var outAvailableRect: Rect): OSStatus; external name '_GetAvailableWindowPositioningBounds';


{
 *  GetAvailableWindowPositioningRegion()
 *
 *  Summary:
 *    Returns the available window positioning region on the given
 *    screen (i.e., the screen rect minus the MenuBar and Dock if
 *    located on that screen).
 *
 *  Discussion:
 *    GetAvailableWindowPositionRegion differs from
 *    GetAvailableWindowPositioningBounds in that the Bounds API
 *    removes the entire area that may theoretically be covered by the
 *    Dock, even if the the Dock does not currently reach from edge to
 *    edge of the device on which it is positioned. The Region API
 *    includes the area at the sides of the Dock that is not covered by
 *    the Dock in the available region.
 *
 *  Parameters:
 *
 *    inDevice:
 *      The device for which to find the available bounds.
 *
 *    ioRgn:
 *      On entry, contains a preallocated RgnHandle. On exit, the
 *      RgnHandle has been modified to contain the available region for
 *      the given device.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
 *    Mac OS X:         in version 10.2 and later
 }
function GetAvailableWindowPositioningRegion(inDevice: GDHandle; ioRgn: RgnHandle): OSStatus; external name '_GetAvailableWindowPositioningRegion';


{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{ ¥ Window Visibility                                                                  }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{
 *  HideWindow()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure HideWindow(window: WindowRef); external name '_HideWindow';
{
 *  [Mac]ShowWindow()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure ShowWindow(window: WindowRef); external name '_ShowWindow';
{
 *  ShowHide()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure ShowHide(window: WindowRef; showFlag: boolean); external name '_ShowHide';
{
 *  [Mac]IsWindowVisible()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later or as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function IsWindowVisible(window: WindowRef): boolean; external name '_IsWindowVisible';

{
  ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
    ¥ÊLatent window visibility
  ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
}


{
 *  WindowLatentVisibility
 *
 *  Summary:
 *    Reasons why a window is currently invisible when ordinarily it
 *    would be visible.
 }

type
    WindowLatentVisibility      = UInt32;
    WindowLatentVisibilityPtr   = ^WindowLatentVisibility; { when a VAR xx: WindowLatentVisibility parameter can be nil, it is changed to xx: WindowLatentVisibilityPtr }
const
    kWindowLatentVisibleFloater = $01;
    kWindowLatentVisibleSuspend = $02;
    kWindowLatentVisibleFullScreen = $04;
    kWindowLatentVisibleAppHidden = $08;
    kWindowLatentVisibleCollapsedOwner = $10;
    kWindowLatentVisibleCollapsedGroup = $20;

    {
     *  IsWindowLatentVisible()
     *
     *  Summary:
     *    Indicates whether a window is visible onscreen and also whether
     *    it is latently visible but not currently onscreen.
     *
     *  Discussion:
     *    All windows are either onscreen or offscreen. A window that is
     *    offscreen may still be latently visible; this occurs, for
     *    example, when a floating window is hidden as an application is
     *    suspended. The floating window is not visible onscreen, but it is
     *    latently visible and is only hidden due to the suspended state of
     *    the application; when the application becomes active again, the
     *    floating window will be placed back onscreen.
     *    IsWindowLatentVisible may be used to determine both the window's
     *    onscreen/offscreen status and its latent visibility (if the
     *    window is offscreen).
     *
     *  Parameters:
     *
     *    inWindow:
     *      The window whose visibility to return.
     *
     *    outLatentVisible:
     *      If the window is onscreen, the latent visibility is zero. If
     *      the window is offscreen, this parameter is used to return the
     *      latent visibility flags of the window. If any of the flags are
     *      set, then the window is latently visible.
     *
     *  Result:
     *    Indicates whether the window is currently onscreen.
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.5 and later
     *    Mac OS X:         in version 10.1 and later
        }
function IsWindowLatentVisible(inWindow: WindowRef; outLatentVisible: WindowLatentVisibilityPtr): boolean; external name '_IsWindowLatentVisible';


{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{
    ¥ Sheets

    Sheets are a new user interface object in Mac OS X. A sheet is a modal alert or dialog,
    but unlike a traditional alert or dialog window (which is visually separate from the
    frontmost document window), a sheet appears to be attached to its parent window; it
    moves and z-orders simultaneously with its parent. Furthermore, sheets on Mac OS X
    use a new type of modality called window modality. A traditional alert or dialog is
    app-modal; it prevents user interaction with all other windows in the current application.
    A sheet is window-modal; it only prevents user interaction with its parent window, and
    events continue to flow to other windows in the application.

    ¥ Sheet Event Handling

    Implementing a sheet window in your application generally requires some modifications
    to your event-handling code. A traditional app-modal window is implemented using a modal
    event loop; your application starts a new event loop (either by processing events itself,
    or by calling ModalDialog), which does not return back to your application's main event
    loop until the app-modal window has closed.

    Starting a new event loop doesn't work with sheets, because typically the modal event loop
    will only handle events destined for the sheet, and not events for other windows, but
    a sheet only blocks events for its parent window, and your application must still handle
    events for the rest of its windows as normal. Therefore, you will usually not use a modal
    event loop to handle events in a sheet. Rather, you will show the sheet window, and then
    return directly back to your main event loop. The Carbon Event Manager automatically
    prevents events in the sheet's parent window from reaching it; events in your application's
    other windows are still returned to you via WaitNextEvent or your application's Carbon
    event handlers, where you can process them as normal.

    You have several choices for handling events in the sheet itself. A sheet is, at the most
    basic level, simply another window in your application, and you can use any of the standard
    event-handling APIs to receive events in the sheet. For example, you can:

        -   receive events in the sheet via WaitNextEvent, and handle them directly in your
            main event loop

        -   create the sheet using Dialog Manager APIs, and use IsDialogEvent and DialogSelect
            to handle events in the sheet

        -   install Carbon event handlers on the sheet, and respond to events in your handlers

    Which approach you choose is up to you.

    ¥ Sheets in CarbonLib

    The sheet window class, sheet WDEF procIDs, and ShowSheetWindow, HideSheetWindow, and
    GetSheetWindowParent APIs are implemented in CarbonLib starting with version 1.3. However,
    since Mac OS 8 and 9 do not traditionally support a window-modal user interface, sheet
    windows are displayed as app-modal windows by CarbonLib. From your application's perspective,
    event handling for a sheet in CarbonLib is the same as event handling for a sheet on X;
    ShowSheetWindow still returns immediately, and your application should still return back
    to its main event loop and be prepared to handle events in other windows. On CarbonLib,
    your application will simply never receive an user input in any of your other windows;
    since the sheet has application modality, the Carbon Event Manager will discard events
    in any windows other than the sheet.

    ¥ÊCreating a Sheet

    A sheet is just a normal window with a special window class: kSheetWindowClass or
    kSheetAlertWindowClass. As such, it can be created in any of the ways you might create
    a window: NewWindow, NewCWindow, CreateNewWindow, GetNewWindow, GetNewCWindow,
    CreateWindowFromCollection, CreateWindowFromResource, CreateWindowFromNib, NewDialog,
    NewColorDialog, NewFeaturesDialog, or GetNewDialog.

    The Window Manager defines two window classes and two WDEF procIDs for sheets:

        -   kSheetWindowClass and kSheetAlertWindowClass
        -   kWindowSheetProc and kWindowSheetAlertProc

    The window classes may be used with CreateNewWindow, CreateWindowFromCollection, and
    CreateWindowFromResource; the WDEF procIDs may be used with NewWindow, NewCWindow, NewDialog,
    NewColorDialog, NewFeaturesDialog, and in 'WDEF' and 'DLOG' resources.

    The first release of Mac OS X only supports kSheetWindowClass and kWindowSheetProc;
    it does not support kSheetAlertWindowClass or kWindowSheetAlertProc. The latter window
    class and procID were added in CarbonLib 1.3 and will be added to a future version of
    Mac OS X. A new window class and procID were necessary for CarbonLib support because
    sheets can be used for both alerts ("Do you want to save changes before closing this
    window?") and dialogs (a Navigation Services PutFile dialog). On Mac OS X, sheet windows
    have the same appearance when used for either an alert or a dialog, but on Mac OS 8 and 9,
    alert windows have a different appearance from dialog windows. Two separate window classes
    are necessary for CarbonLib to know whether to display a sheet using a movable alert or a
    movable dialog window. Therefore, it is recommended that you use kSheetAlertWindowClass when
    creating a sheet window that will be used to display an alert, although this is not required.

    ¥ Displaying a Sheet

    A sheet is made visible by calling the ShowSheetWindow API. This API shows the sheet,
    using whatever visual effects are appropriate for the platform, and then returns immediately.
    On Mac OS X, it creates a window group and places the sheet and its parent window into the
    group; it also marks the sheet as window-modal. On CarbonLib, it marks the sheet as app-modal
    but does not create a window group.

    On Mac OS X, before the sheet window is actually made visible, ShowSheetWindow sends a
    kEventWindowDrawContent event to the sheet window, asking it to draw its content into the
    window's offscreen buffer. The sheet must handle this event, or its content area will be
    blank after the sheet becomes visible.

    In some cases, this handler is automatically provided for you:

        -   If you create your sheet window using the Dialog Manager, the Dialog Manager
            automatically installs a handler for this event that calls DrawDialog, so you
            don't need to install the handler yourself.

        -   If you install the standard Carbon window event handler on your sheet window
            (using kWindowStandardHandlerAttribute or InstallStandardEventHandler), the
            standard handler automatically handles this event and calls DrawControls.

    Typically, your event handling code (whether it uses WaitNextEvent, the Dialog Manager,
    or Carbon event handlers) will receive and respond to events in the sheet until the
    user does something that should cause the sheet to close. This might be clicking in an
    OK or Cancel button, for example. At that time, your event handling code should call
    HideSheetWindow. The sheet window will hide, but will not be destroyed, so you can use
    it again later if you want.
}
{
 *  ShowSheetWindow()
 *
 *  Summary:
 *    Shows a sheet window using appropriate visual effects.
 *
 *  Discussion:
 *    ShowSheetWindow is implemented in both CarbonLib 1.3 and Mac OS
 *    X. Since Mac OS 9 does not use a window-modal user interface for
 *    alerts and dialogs, ShowSheetWindow in CarbonLib does not bind
 *    the sheet to the parent window in the same way that it does on
 *    Mac OS X; instead, it shows the sheet like a standard
 *    movable-modal dialog window. Sheet windows must use the window
 *    classes kSheetWindowClass or kSheetAlertWindowClass to get the
 *    right appearance on both platforms.
 *
 *  Parameters:
 *
 *    inSheet:
 *      The sheet window to show.
 *
 *    inParentWindow:
 *      The sheet's parent window.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ShowSheetWindow(inSheet: WindowRef; inParentWindow: WindowRef): OSStatus; external name '_ShowSheetWindow';

{
 *  HideSheetWindow()
 *
 *  Summary:
 *    Hides a sheet window using appropriate visual effects.
 *
 *  Parameters:
 *
 *    inSheet:
 *      The sheet window to hide.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 }
function HideSheetWindow(inSheet: WindowRef): OSStatus; external name '_HideSheetWindow';

{
 *  DetachSheetWindow()
 *
 *  Summary:
 *    Detaches a sheet window from its parent window without affecting
 *    the visibility or position of the sheet or its parent.
 *
 *  Discussion:
 *    This API may be useful if you want to hide a sheet window without
 *    an animation effect. To do that, use DetachSheetWindow to detach
 *    the sheet from the parent, and then use HideWindow to hide the
 *    sheet, or DisposeWindow to destroy the sheet.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inSheet:
 *      The sheet to detach.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function DetachSheetWindow( inSheet: WindowRef ): OSStatus; external name '_DetachSheetWindow';

{
 *  GetSheetWindowParent()
 *
 *  Summary:
 *    Returns the parent window of a sheet.
 *
 *  Parameters:
 *
 *    inSheet:
 *      The sheet window whose parent to retrieve.
 *
 *    outParentWindow:
 *      On exit, contains the parent window of the sheet.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetSheetWindowParent(inSheet: WindowRef; var outParentWindow: WindowRef): OSStatus; external name '_GetSheetWindowParent';

{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{
    ¥ Drawers

    Drawers are supported in Carbon by Mac OS X 10.2 and later. To create and use a drawer:

        -   Create a window using kDrawerWindowClass. You must also use compositing mode with
            drawers; this mode is enabled by passing kWindowCompositingAttribute to CreateNewWindow.

        -   Either install the standard window event handler on the drawer window, or use
            your own Carbon event or WaitNextEvent code to handle user interaction with the
            drawer. If you do not use the standard window event handler, you should call
            ResizeWindow in response to clicks on the grow region of the drawer if you want
            the drawer to be resizable.

        -   Set the drawer's parent window with the SetDrawerParent function. The parent is
            the window on which the drawer will open.

        -   Optionally, install a Carbon event handler on the drawer or the drawer's parent
            window for the kEventWindowDrawerOpening/Opened/Closing/Closed events, to be notified
            when the drawer has started or finished opening or closing.

        -   Optionally, set the drawer's preferred edge on the parent window with the
            SetDrawerPreferredEdge function. If you do not set a preferred edge, the drawer
            opens on the parent's left side on a left-to-right system, or on the parent's right
            side on a right-to-left system.

        -   Optionally, set the drawer's offsets with the SetDrawerOffsets function. The offsets
            control the amount of inset between the edge of the parent's content area and the edge
            of the drawer's structure. If you do not set any offsets, the drawer's edges are flush
            with the edges of the parent's content.

        -   Optionally, set the drawer's minimum and maximum sizes with the SetWindowResizeLimits
            function. Or, install a Carbon event handler on the drawer to handle the kEventWindow-
            GetMinimumSize and kEventWindowGetMaximumSize events. The drawer's minimum and maximum
            sizes control how small or large it will resize together with the parent. If you do not
            set resize limits, the drawer will be capable of resizing to default small and large
            limits.

        -   Call ToggleDrawer to open or close the drawer, or use OpenDrawer or CloseDrawer if
            you require more control over how the drawer opens or closes.
}

{
 *  Summary:
 *    Indicates the parent window edge on which a drawer will be shown.
 }
const
  {
   * This constant is typically used with the OpenDrawer API; it
   * indicates that the drawer should be opened on whatever edge of the
   * parent window has previously been set as the drawer's preferred
   * edge.
   }
  kWindowEdgeDefault            = 0;

  {
   * The drawer should open on the top edge of the parent window.
   }
  kWindowEdgeTop                = 1 shl 0;

  {
   * The drawer should open on the left edge of the parent window.
   }
  kWindowEdgeLeft               = 1 shl 1;

  {
   * The drawer should open on the bottom edge of the parent window.
   }
  kWindowEdgeBottom             = 1 shl 2;

  {
   * The drawer should open on the right edge of the parent window.
   }
  kWindowEdgeRight              = 1 shl 3;


{
 *  Summary:
 *    Indicates the current state of a drawer window.
 }
const

  {
   * The drawer is opening, but is not yet fully open.
   }
  kWindowDrawerOpening          = 1;

  {
   * The drawer is fully open.
   }
  kWindowDrawerOpen             = 2;

  {
   * The drawer is closing, but is not yet fully closed.
   }
  kWindowDrawerClosing          = 3;

  {
   * The drawer is fully closed.
   }
  kWindowDrawerClosed           = 4;


type WindowDrawerState = UInt32;

{
 *  GetDrawerPreferredEdge()
 *
 *  Summary:
 *    Returns the preferred parent window edge of a drawer.
 *
 *  Discussion:
 *    Drawers start out with a preferred parent window edge of
 *    kWindowEdgeDefault. On left-to-right systems, the default edge is
 *    the left edge of the parent window; on right-to-left systems, the
 *    default edge is the right edge. You can set the preferred edge
 *    with SetDrawerPreferredEdge. If there's not enough room on the
 *    preferred edge, the drawer will automatically switch to the
 *    opposite edge.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inDrawerWindow:
 *      The drawer window whose preferred edge to retrieve.
 *
 *  Result:
 *    The preferred edge of the drawer window.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
function GetDrawerPreferredEdge( inDrawerWindow: WindowRef ): OptionBits; external name '_GetDrawerPreferredEdge';


{
 *  SetDrawerPreferredEdge()
 *
 *  Summary:
 *    Sets the preferred parent window edge of a drawer.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inDrawerWindow:
 *      The drawer window whose preferred edge to set.
 *
 *    inEdge:
 *      The preferred edge of the drawer window. Note that although the
 *      WindowEdge enumeration has values appropriate for a bitfield,
 *      the current implementation does not support receiving more than
 *      one edge bit in this parameter. You can also pass
 *      kWindowEdgeDefault to allow the Window Manager to pick an edge.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
function SetDrawerPreferredEdge( inDrawerWindow: WindowRef; inEdge: OptionBits ): OSStatus; external name '_SetDrawerPreferredEdge';


{
 *  GetDrawerCurrentEdge()
 *
 *  Summary:
 *    Returns the current parent window edge on which a drawer is
 *    displayed.
 *
 *  Discussion:
 *    If the drawer window is currently visible, this API returns the
 *    parent window edge on which the drawer is displayed. If the
 *    drawer is not visible, this API determines on which edge of the
 *    parent window the drawer should be displayed, given the current
 *    size of the drawer, position of the parent, and preferred edge
 *    for the drawer.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inDrawerWindow:
 *      The drawer window whose current edge to retrieve.
 *
 *  Result:
 *    The current edge of the drawer window.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
function GetDrawerCurrentEdge( inDrawerWindow: WindowRef ): OptionBits; external name '_GetDrawerCurrentEdge';


{
 *  GetDrawerState()
 *
 *  Summary:
 *    Returns the current state of a drawer: opening, open, closing, or
 *    closed.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inDrawerWindow:
 *      The drawer window whose state to retrieve.
 *
 *  Result:
 *    The current state of the drawer window.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
function GetDrawerState( inDrawerWindow: WindowRef ): WindowDrawerState; external name '_GetDrawerState';


{
 *  GetDrawerParent()
 *
 *  Summary:
 *    Returns the parent window of a drawer.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inDrawerWindow:
 *      The drawer window whose parent window to retrieve.
 *
 *  Result:
 *    The drawer's parent window, or NULL if the drawer has no assigned
 *    parent.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
function GetDrawerParent( inDrawerWindow: WindowRef ): WindowRef; external name '_GetDrawerParent';


{
 *  SetDrawerParent()
 *
 *  Summary:
 *    Sets the parent window of a drawer.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inDrawerWindow:
 *      The drawer window whose parent window to set.
 *
 *    inParent:
 *      The drawer's new parent window, or NULL if the drawer should
 *      have no parent.
 *
 *  Result:
 *    An operating system result code.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
function SetDrawerParent( inDrawerWindow: WindowRef; inParent: WindowRef ): OSStatus; external name '_SetDrawerParent';



{
 *  kWindowOffsetUnchanged
 *
 *  Discussion:
 *    Pass this value to SetDrawerOffsets to indicate that an existing
 *    offset should not be changed.
 }
const kWindowOffsetUnchanged = -1.0;
{
 *  SetDrawerOffsets()
 *
 *  Summary:
 *    Sets the offsets from the beginning and end of the parent window
 *    to the beginning and end of the drawer window.
 *
 *  Discussion:
 *    The drawer offsets control the positioning of the drawer relative
 *    to its parent window. When a drawer is first created, its offsets
 *    are zero. When a drawer is positioned, it is initially given a
 *    height or width equal to the height or width of the content area
 *    of the parent to which it is attached. If a drawer is opening on
 *    the left side of its parent, for example, the drawer's height
 *    will be the height of the parent's content area. In this case,
 *    the top side of the drawer window is called the leading edge of
 *    the drawer, and the bottom side of the drawer window is called
 *    the trailing edge of the drawer. The drawer's size is then
 *    adjusted by the leading and trailing offsets. The leading edge of
 *    the drawer is moved inward by an amount equal to the leading
 *    offset, and the trailing edge is moved inward by an amount equal
 *    to the trailing offset. For example, if the leading and trailing
 *    offsets are five and fifteen, then the top edge of a left-opening
 *    drawer will be five pixels inside the top edge of the parent
 *    window's content area, and the bottom edge of the drawer will be
 *    fifteen pixels inside the bottom edge of the parent's content
 *    area.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inDrawerWindow:
 *      The drawer window whose offsets to change.
 *
 *    inLeadingOffset:
 *      The new leading offset, in pixels. Pass kWindowOffsetUnchanged
 *      if you don't want to change the leading offset.
 *
 *    inTrailingOffset:
 *      The new trailing offset, in pixels. Pass kWindowOffsetUnchanged
 *      if you don't want to change the trailing offset.
 *
 *  Result:
 *    An operating system result code.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
function SetDrawerOffsets( inDrawerWindow: WindowRef; inLeadingOffset: Float32; inTrailingOffset: Float32 ): OSStatus; external name '_SetDrawerOffsets';


{
 *  GetDrawerOffsets()
 *
 *  Summary:
 *    Returns the offsets from the beginning and end of the parent
 *    window to the beginning and end of the drawer window.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inDrawerWindow:
 *      The drawer window whose offsets to retrieve.
 *
 *    outLeadingOffset:
 *      On exit, contains the drawer's leading offset. Pass NULL if you
 *      don't need this information returned.
 *
 *    outTrailingOffset:
 *      On exit, contains the drawer's trailing offset. Pass NULL if
 *      you don't need this information returned.
 *
 *  Result:
 *    An operating system result code.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
function GetDrawerOffsets( inDrawerWindow: WindowRef; outLeadingOffset: Float32Ptr; outTrailingOffset: Float32Ptr ): OSStatus; external name '_GetDrawerOffsets';


{
 *  ToggleDrawer()
 *
 *  Summary:
 *    Toggles a drawer from open to closed, or vice versa.
 *
 *  Discussion:
 *    ToggleDrawer opens the drawer if it is closed, opening, or
 *    closing. If the drawer is open, it closes the drawer.
 *
 *    ToggleDrawer attemps to open the drawer on its preferred edge,
 *    but if there is not enough room on that edge, it will try the
 *    opposite edge instead. If there is insufficient room on either
 *    edge, the drawer will open on the preferred edge but may extend
 *    offscreen, under the Dock, or under the menubar.
 *
 *    The opening or closing of the drawer is performed asynchronously;
 *    ToggleDrawer installs an event loop timer that opens or closes
 *    the drawer after ToggleDrawer returns to the caller. Therefore,
 *    the caller must be running its event loop for the drawer to open
 *    or close. To open or close the drawer synchronously, use the
 *    OpenDrawer or CloseDrawer APIs.
 *
 *    ToggleDrawer retains the drawer window while the drawer is
 *    opening or closing, and releases it when the drawer is fully
 *    opened or closed.
 *
 *    ToggleDrawer sends the kEventWindowDrawerOpening,
 *    kEventWindowDrawerOpened, kEventWindowDrawerClosing, and
 *    kEventWindowDrawerClosed events as the drawer opens or closes.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inDrawerWindow:
 *      The drawer window to open or close.
 *
 *  Result:
 *    An operating system result code.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
function ToggleDrawer( inDrawerWindow: WindowRef ): OSStatus; external name '_ToggleDrawer';


{
 *  OpenDrawer()
 *
 *  Summary:
 *    Opens a drawer on a specified parent window edge.
 *
 *  Discussion:
 *    OpenDrawer may open the drawer either synchronously or
 *    asynchronously, depending on the value of the inAsync parameter.
 *    If inAsync is true, OpenDrawer installs an event loop timer that
 *    opens the drawer after OpenDrawer returns to the caller;
 *    therefore, the caller must be running its event loop for the
 *    drawer to open. If inAsync is false, OpenDrawer opens the drawer
 *    completely before returning to the caller.
 *
 *    OpenDrawer retains the drawer window while the drawer is opening,
 *    and releases it when the drawer is fully open.
 *
 *    OpenDrawer sends the kEventWindowDrawerOpening event to the
 *    drawer, the drawer's parent, and the application before opening
 *    the drawer. If an event handler for this event returns
 *    userCanceledErr, OpenDrawer will return immediately without
 *    opening the drawer. OpenDrawer sends the kEventWindowDrawerOpened
 *    event to the drawer, the drawer's parent, and the application
 *    after the drawer has finished opening.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inDrawerWindow:
 *      The drawer window to open.
 *
 *    inEdge:
 *      The parent window edge on which to open the drawer. Pass
 *      kWindowEdgeDefault to use the drawer's preferred edge. If there
 *      is not enough room on the preferred edge, OpenDrawer will try
 *      the opposite edge instead. If there is insufficient room on
 *      either edge, the drawer will open on the preferred edge but may
 *      extend offscreen, under the Dock, or under the menubar.
 *
 *    inAsync:
 *      Whether to open the drawer synchronously (the drawer is
 *      entirely opened before the function call returns) or
 *      asynchronously (the drawer opens using an event loop timer
 *      after the function call returns).
 *
 *  Result:
 *    An operating system result code.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
function OpenDrawer( inDrawerWindow: WindowRef; inEdge: OptionBits; inAsync: Boolean ): OSStatus; external name '_OpenDrawer';


{
 *  CloseDrawer()
 *
 *  Summary:
 *    Closes a drawer.
 *
 *  Discussion:
 *    CloseDrawer may close the drawer either synchronously or
 *    asynchronously, depending on the value of the inAsync parameter.
 *    If inAsync is true, CloseDrawer installs an event loop timer that
 *    closes the drawer after CloseDrawer returns to the caller;
 *    therefore, the caller must be running its event loop for the
 *    drawer to close. If inAsync is false, CloseDrawer closes the
 *    drawer completely before returning to the caller.
 *
 *    CloseDrawer retains the drawer window while the drawer is
 *    closing, and releases it when the drawer is fully closed.
 *
 *    CloseDrawer sends the kEventWindowDrawerClosing event to the
 *    drawer, the drawer's parent, and the application before closing
 *    the drawer. If an event handler for this event returns
 *    userCanceledErr, CloseDrawer will return immediately without
 *    closing the drawer. CloseDrawer sends the
 *    kEventWindowDrawerClosed event to the drawer, the drawer's
 *    parent, and the application after the drawer has finished closing.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inDrawerWindow:
 *      The drawer window to close.
 *
 *    inAsync:
 *      Whether to close the drawer synchronously (the drawer is
 *      entirely closed before the function call returns) or
 *      asynchronously (the drawer closes using an event loop timer
 *      after the function call returns).
 *
 *  Result:
 *    An operating system result code.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
function CloseDrawer( inDrawerWindow: WindowRef; inAsync: Boolean ): OSStatus; external name '_CloseDrawer';

{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{ ¥ Disabling Screen Redraw                                                            }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{
   disable and enable screen updates for changes to the current applicationÕs windows
   (OS X only for now)
}

{
 *  DisableScreenUpdates()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DisableScreenUpdates: OSStatus; external name '_DisableScreenUpdates';

{
 *  EnableScreenUpdates()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function EnableScreenUpdates: OSStatus; external name '_EnableScreenUpdates';

{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{ ¥ Window Toolbars                                                                    }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
// #define _SetWindowToolbar SetWindowToolbar
{
 *  SetWindowToolbar()
 *
 *  Discussion:
 *    Sets the toolbar for a window. If any other toolbar is currently
 *    bound to the window, it is released. This API does NOT add the
 *    toolbar button to the window, your application must set the
 *    attribute itself.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inWindow:
 *      The window to add the toolbar to.
 *
 *    inToolbar:
 *      The toolbar to add.
 *
 *  Result:
 *    An operating system result code.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
function SetWindowToolbar( inWindow: WindowRef; inToolbar: HIToolbarRef ): OSStatus; external name '_SetWindowToolbar';


// #define _GetWindowToolbar GetWindowToolbar
{
 *  GetWindowToolbar()
 *
 *  Discussion:
 *    Gets the toolbar of a window, if any.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inWindow:
 *      The window to add the toolbar to.
 *
 *    outToolbar:
 *      The toolbar. You do not own the toolbar reference returned by
 *      this function. Do not release it! It is possible for the
 *      toolbar returned to be NULL, indicating there is no toolbar
 *      associated with this window. ¥¥¥ NOTE: May need to change the
 *      release strategy here.
 *
 *  Result:
 *    An operating system result code.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
function GetWindowToolbar( inWindow: WindowRef; var outToolbar: HIToolbarRef ): OSStatus; external name '_GetWindowToolbar';


// #define _ShowHideWindowToolbar ShowHideWindowToolbar
{
 *  ShowHideWindowToolbar()
 *
 *  Discussion:
 *    Shows or hides a window's toolbar. Optionally, you can ask for
 *    the transition to be animated or not. Typically, you would not
 *    need to call this other than to set up your window accordingly.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inWindow:
 *      The window to show or hide the toolbar for.
 *
 *    inShow:
 *      Pass true to show the toolbar, false to hide it.
 *
 *    inAnimate:
 *      Pass true to animate the transition, false to do it quickly and
 *      without fanfare.
 *
 *  Result:
 *    An operating system result code.
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
function ShowHideWindowToolbar( inWindow: WindowRef; inShow: Boolean; inAnimate: Boolean ): OSStatus; external name '_ShowHideWindowToolbar';


// #define _IsWindowToolbarVisible IsWindowToolbarVisible
{
 *  IsWindowToolbarVisible()
 *
 *  Discussion:
 *    Returns whether the toolbar (if any) attached to a window is
 *    visible. If the window has no toolbar, false is returned.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inWindow:
 *      The window test the toolbar visiblity for.
 *
 *  Result:
 *    A boolean result indicating whether the toolbar is visible (true)
 *    or not (false).
 *
 *  Availability:
 *    Mac OS X:         in version 10.2 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
function IsWindowToolbarVisible( inWindow: WindowRef ): Boolean; external name '_IsWindowToolbarVisible';

{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{ ¥ Window Transparency                                                                }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{
 *  SetWindowAlpha()
 *
 *  Discussion:
 *    Alters the overall alpha of a window, making the entire window
 *    (including window frame) either more or less transparent. The
 *    alpha is expressed as a floating point value from 0.0 (completely
 *    transparent) to 1.0 (completely opaque).
 *
 *  Parameters:
 *
 *    inWindow:
 *      The window whose alpha to modify.
 *
 *    inAlpha:
 *      The new alpha value.
 *
 *  Result:
 *    An operating system result code.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
 *    Mac OS X:         in version 10.2 and later
 }
function SetWindowAlpha(inWindow: WindowRef; inAlpha: Single): OSStatus; external name '_SetWindowAlpha';


{
 *  GetWindowAlpha()
 *
 *  Discussion:
 *    Returns the current overall alpha value for a window. The alpha
 *    is expressed as a floating point value from 0.0 (completely
 *    transparent) to 1.0 (completely opaque).
 *
 *  Parameters:
 *
 *    inWindow:
 *      The window whose alpha to return.
 *
 *    outAlpha:
 *      On exit, contains the window's current alpha value.
 *
 *  Result:
 *    An operating system result code.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
 *    Mac OS X:         in version 10.2 and later
 }
function GetWindowAlpha(inWindow: WindowRef; var outAlpha: Single): OSStatus; external name '_GetWindowAlpha';

{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{ ¥ Window Properties                                                                  }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{
   Routines available from Mac OS 8.5 forward
   or from Mac OS 8.1 forward when linking to CarbonLib 1.0 forward
}

{
 *  GetWindowProperty()
 *
 *  Availability:
 *    Non-Carbon CFM:   in WindowsLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetWindowProperty(window: WindowRef; propertyCreator: PropertyCreator; propertyTag: PropertyTag; bufferSize: UInt32; actualSize: UInt32Ptr; propertyBuffer: UnivPtr): OSStatus; external name '_GetWindowProperty';

{
 *  GetWindowPropertySize()
 *
 *  Availability:
 *    Non-Carbon CFM:   in WindowsLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetWindowPropertySize(window: WindowRef; creator: PropertyCreator; tag: PropertyTag; var size: UInt32): OSStatus; external name '_GetWindowPropertySize';

{
 *  SetWindowProperty()
 *
 *  Availability:
 *    Non-Carbon CFM:   in WindowsLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetWindowProperty(window: WindowRef; propertyCreator: PropertyCreator; propertyTag: PropertyTag; propertySize: UInt32; propertyBuffer: UnivPtr): OSStatus; external name '_SetWindowProperty';

{
 *  RemoveWindowProperty()
 *
 *  Availability:
 *    Non-Carbon CFM:   in WindowsLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function RemoveWindowProperty(window: WindowRef; propertyCreator: PropertyCreator; propertyTag: PropertyTag): OSStatus; external name '_RemoveWindowProperty';


{  Routines available from Mac OS 8.1 forward when linking to CarbonLib 1.0 forward }


const
    kWindowPropertyPersistent   = $00000001;                    {  whether this property gets saved when flattening the window  }

    {
     *  GetWindowPropertyAttributes()
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function GetWindowPropertyAttributes(window: WindowRef; propertyCreator: OSType; propertyTag: OSType; var attributes: UInt32): OSStatus; external name '_GetWindowPropertyAttributes';

{
 *  ChangeWindowPropertyAttributes()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ChangeWindowPropertyAttributes(window: WindowRef; propertyCreator: OSType; propertyTag: OSType; attributesToSet: UInt32; attributesToClear: UInt32): OSStatus; external name '_ChangeWindowPropertyAttributes';

{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{ ¥ Utilities                                                                          }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{
 *  PinRect()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PinRect(const (*var*) theRect: Rect; thePt: Point): SInt32; external name '_PinRect';
{
 *  GetGrayRgn()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetGrayRgn: RgnHandle; external name '_GetGrayRgn';
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{ ¥ Window Part Tracking                                                               }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{
 *  TrackBox()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TrackBox(window: WindowRef; thePt: Point; partCode: WindowPartCode): boolean; external name '_TrackBox';
{
 *  TrackGoAway()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TrackGoAway(window: WindowRef; thePt: Point): boolean; external name '_TrackGoAway';
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{ ¥ Region Dragging                                                                    }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{
 *  DragGrayRgn()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DragGrayRgn(theRgn: RgnHandle; startPt: Point; const (*var*) limitRect: Rect; const (*var*) slopRect: Rect; axis: SInt16; actionProc: DragGrayRgnUPP): SInt32; external name '_DragGrayRgn';
{
 *  DragTheRgn()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DragTheRgn(theRgn: RgnHandle; startPt: Point; const (*var*) limitRect: Rect; const (*var*) slopRect: Rect; axis: SInt16; actionProc: DragGrayRgnUPP): SInt32; external name '_DragTheRgn';
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{  ¥ GetAuxWin                                                                         }
{                                                                                      }
{  GetAuxWin is not available in Carbon                                                }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}

{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{ ¥ Window Accessors                                                                   }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}


{
 *  GetWindowList()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0.2 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetWindowList: WindowRef; external name '_GetWindowList';


{
 *  GetWindowPort()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later or as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetWindowPort(window: WindowRef): CGrafPtr; external name '_GetWindowPort';

{
 *  GetWindowStructurePort()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.5 and later
 *    Mac OS X:         in version 10.1 and later
 }
function GetWindowStructurePort(inWindow: WindowRef): CGrafPtr; external name '_GetWindowStructurePort';


{
 *  GetWindowKind()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later or as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetWindowKind(window: WindowRef): SInt16; external name '_GetWindowKind';


{
 *  IsWindowHilited()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later or as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function IsWindowHilited(window: WindowRef): boolean; external name '_IsWindowHilited';


{
 *  IsWindowUpdatePending()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later or as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function IsWindowUpdatePending(window: WindowRef): boolean; external name '_IsWindowUpdatePending';


{
 *  [Mac]GetNextWindow()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0.2 and later or as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetNextWindow(window: WindowRef): WindowRef; external name '_GetNextWindow';

{
 *  GetPreviousWindow()
 *
 *  Summary:
 *    Returns the window above a given window in the window list.
 *
 *  Parameters:
 *
 *    inWindow:
 *      The window above this window is returned.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.6 and later
 *    Mac OS X:         in version 10.2 and later
 }
function GetPreviousWindow(inWindow: WindowRef): WindowRef; external name '_GetPreviousWindow';


{
 *  GetWindowStandardState()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later or as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetWindowStandardState(window: WindowRef; var rect: Rect): RectPtr; external name '_GetWindowStandardState';


{
 *  GetWindowUserState()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later or as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetWindowUserState(window: WindowRef; var rect: Rect): RectPtr; external name '_GetWindowUserState';


{
 *  SetWindowKind()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later or as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetWindowKind(window: WindowRef; kind: SInt16); external name '_SetWindowKind';


{
 *  SetWindowStandardState()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later or as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetWindowStandardState(window: WindowRef; const (*var*) rect: Rect); external name '_SetWindowStandardState';



{
 *  SetWindowUserState()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later or as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetWindowUserState(window: WindowRef; const (*var*) rect: Rect); external name '_SetWindowUserState';


{
 *  SetPortWindowPort()
 *
 *  Discussion:
 *    set the current QuickDraw port to the port associated with the
 *    window
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later or as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetPortWindowPort(window: WindowRef); external name '_SetPortWindowPort';



{
 *  GetWindowPortBounds()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later or as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetWindowPortBounds(window: WindowRef; var bounds: Rect): RectPtr; external name '_GetWindowPortBounds';


{
 *  GetWindowFromPort()
 *
 *  Discussion:
 *    Needed to Ôcast upÕ to a WindowRef from a GrafPtr
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later or as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetWindowFromPort(port: CGrafPtr): WindowRef; external name '_GetWindowFromPort';





{  old accessors }



const
    kWindowGroupAttrSelectable  = $01;
    kWindowGroupAttrPositionFixed = $02;
    kWindowGroupAttrZOrderFixed = $04;









{$ALIGN MAC68K}
{#POP}
{unit Navigation}
{$ALIGN MAC68K}







{#I+}


{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}


type
    NavAskSaveChangesAction     = UInt32;
const
                                                                {  input action codes for NavAskSaveChanges()  }
    kNavSaveChangesClosingDocument = 1;
    kNavSaveChangesQuittingApplication = 2;
    kNavSaveChangesOther        = 0;



type
    NavAskSaveChangesResult     = UInt32;
const
                                                                {  result codes for NavAskSaveChanges()  }
    kNavAskSaveChangesSave      = 1;
    kNavAskSaveChangesCancel    = 2;
    kNavAskSaveChangesDontSave  = 3;



type
    NavAskDiscardChangesResult  = UInt32;
const
                                                                {  result codes for NavAskDiscardChanges()  }
    kNavAskDiscardChanges       = 1;
    kNavAskDiscardChangesCancel = 2;



type
    NavFilterModes              = SInt16;
const
                                                                {  which elements are being filtered for objects:  }
    kNavFilteringBrowserList    = 0;
    kNavFilteringFavorites      = 1;
    kNavFilteringRecents        = 2;
    kNavFilteringShortCutVolumes = 3;
    kNavFilteringLocationPopup  = 4;                            {  for v1.1 or greater  }


    kNavFileOrFolderVersion     = 1;


type
    NavFileOrFolderInfoPtr = ^NavFileOrFolderInfo;
    NavFileOrFolderInfo = record
        version:                UInt16;
        isFolder:               boolean;
        visible:                boolean;
        creationDate:           UInt32;
        modificationDate:       UInt32;
        case SInt16 of
        0: (
            locked:             boolean;                                {  file is locked  }
            resourceOpen:       boolean;                                {  resource fork is opened  }
            dataOpen:           boolean;                                {  data fork is opened  }
            reserved1:          boolean;
            dataSize:           UInt32;                                 {  size of the data fork  }
            resourceSize:       UInt32;                                 {  size of the resource fork  }
            finderInfo:         FInfo;                                  {  more file info:  }
            finderXInfo:        FXInfo;
           );
        1: (
            shareable:          boolean;
            sharePoint:         boolean;
            mounted:            boolean;
            readable:           boolean;
            writeable:          boolean;
            reserved2:          boolean;
            numberOfFiles:      UInt32;
            finderDInfo:        DInfo;
            finderDXInfo:       DXInfo;
            folderType:         OSType;                                 {  package type, For struct version >= 1  }
            folderCreator:      OSType;                                 {  package creator, For struct version >= 1  }
            reserved3:          packed array [0..205] of char;
           );
    end;

    NavEventDataInfoPtr = ^NavEventDataInfo;
    NavEventDataInfo = record
        case SInt16 of
        0: (
            event:              EventRecordPtr;                         {  for event processing  }
            );
        1: (
            param:              Ptr;                                    {  points to event specific data  }
            );
    end;

    NavEventDataPtr = ^NavEventData;
    NavEventData = record
        eventDataParms:         NavEventDataInfo;                       {  the event data  }
        itemHit:                SInt16;                                 {  the dialog item number, for v1.1 or greater  }
    end;


    {
     *  NavDialogRef
     *
     *  Summary:
     *    Opaque Navigation Services dialog identifier
     *
     *  Discussion:
     *    A NavDialogRef is an opaque reference to an instance of a
     *    Navigation Services dialog. A new NavDialogRef is returned from
     *    any of the NavCreate*Dialog functions and is later disposed with
     *    the NavDialogDispose function. NavDialogRef is the new name for
     *    the NavContext type, and thus when a client's event proc is
     *    called, the value of the NavCBRec.context field is the same as
     *    the NavDialogRef returned from the corresponding
     *    NavCreate*Dialog. A NavDialogRef is distinct from, and is not
     *    interchangable with, a Dialog Manager DialogRef.
        }
    NavDialogRef    = ^SInt32; { an opaque 32-bit type }
    NavDialogRefPtr = ^NavDialogRef;  { when a var xx:NavDialogRef parameter can be nil, it is changed to xx: NavDialogRefPtr }


    {
     *  NavUserAction
     *
     *  Summary:
     *    Indicates an action taken by the user
     *
     *  Discussion:
     *    When the user clicks a button at the bottom of a Nav Services
     *    dialog (or makes an equivalent mouse or key gesture), a
     *    kNavCBUserAction event is sent to the client's event proc
     *    indicating which action was taken. Often, the action also
     *    dismisses the dialog. User action events are only generated when
     *    using dialogs created from a NavCreate*Dialog function. In the
     *    special case of a modeless GetFile dialog (supported only on Mac
     *    OS X), the user can option-click on the open button to keep the
     *    dialog from being dismissed, but the kNavCBUserAction event is
     *    sent so the client can get the reply record and open the selected
     *    files.
        }
    NavUserAction               = UInt32;
const
    kNavUserActionNone          = 0;
    kNavUserActionCancel        = 1;
    kNavUserActionOpen          = 2;
    kNavUserActionSaveAs        = 3;
    kNavUserActionChoose        = 4;
    kNavUserActionNewFolder     = 5;
    kNavUserActionSaveChanges   = 6;
    kNavUserActionDontSaveChanges = 7;
    kNavUserActionDiscardChanges = 8;
    kNavUserActionReviewDocuments = 9;
    kNavUserActionDiscardDocuments = 10;


    kNavCBRecVersion            = 1;


    {
     *  NavCBRec
     *
     *  Summary:
     *    A structure passed to event and preview callbacks
     *
     *  Discussion:
     *    The NavCBRec structure is passed to the client's event proc or
     *    custom preview proc. It provides information that is specific to
     *    each event type. New for Carbon: the userAction field.
        }

type
    NavCBRecPtr = ^NavCBRec;
    NavCBRec = record
        version:                UInt16;
        context:                NavDialogRef;
        window:                 WindowRef;
        customRect:             Rect;
        previewRect:            Rect;
        eventData:              NavEventData;
        userAction:             NavUserAction;
        reserved:               packed array [0..217] of char;
    end;


    {
     *  NavEventCallbackMessage
     *
     *  Summary:
     *    Identifies the message type being sent to the client's event proc
        }
    NavEventCallbackMessage     = SInt32;
const
    kNavCBEvent                 = 0;
    kNavCBCustomize             = 1;
    kNavCBStart                 = 2;
    kNavCBTerminate             = 3;
    kNavCBAdjustRect            = 4;
    kNavCBNewLocation           = 5;
    kNavCBShowDesktop           = 6;
    kNavCBSelectEntry           = 7;
    kNavCBPopupMenuSelect       = 8;
    kNavCBAccept                = 9;
    kNavCBCancel                = 10;
    kNavCBAdjustPreview         = 11;
    kNavCBUserAction            = 12;
    kNavCBOpenSelection         = $80000000;



type
    NavCallBackUserData                 = Ptr;
    {    for events and customization:  }
    NavEventProcPtr = procedure(callBackSelector: NavEventCallbackMessage; callBackParms: NavCBRecPtr; callBackUD: UnivPtr);

    {    for preview support:   }
    NavPreviewProcPtr = function(callBackParms: NavCBRecPtr; callBackUD: UnivPtr): boolean;

    {    filtering callback information:    }
    NavObjectFilterProcPtr = function(var theItem: AEDesc; info: UnivPtr; callBackUD: UnivPtr; filterMode: NavFilterModes): boolean;

    NavEventUPP = ^SInt32; { an opaque UPP }
    NavPreviewUPP = ^SInt32; { an opaque UPP }
    NavObjectFilterUPP = ^SInt32; { an opaque UPP }

const
    uppNavEventProcInfo = $00000FC0;
    uppNavPreviewProcInfo = $000003D0;
    uppNavObjectFilterProcInfo = $00002FD0;
    {
     *  NewNavEventUPP()
     *
     *  Availability:
     *    Non-Carbon CFM:   available as macro/inline
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function NewNavEventUPP(userRoutine: NavEventProcPtr): NavEventUPP; external name '_NewNavEventUPP'; { old name was NewNavEventProc }
{
 *  NewNavPreviewUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewNavPreviewUPP(userRoutine: NavPreviewProcPtr): NavPreviewUPP; external name '_NewNavPreviewUPP'; { old name was NewNavPreviewProc }
{
 *  NewNavObjectFilterUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewNavObjectFilterUPP(userRoutine: NavObjectFilterProcPtr): NavObjectFilterUPP; external name '_NewNavObjectFilterUPP'; { old name was NewNavObjectFilterProc }
{
 *  DisposeNavEventUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeNavEventUPP(userUPP: NavEventUPP); external name '_DisposeNavEventUPP';
{
 *  DisposeNavPreviewUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeNavPreviewUPP(userUPP: NavPreviewUPP); external name '_DisposeNavPreviewUPP';
{
 *  DisposeNavObjectFilterUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeNavObjectFilterUPP(userUPP: NavObjectFilterUPP); external name '_DisposeNavObjectFilterUPP';
{
 *  InvokeNavEventUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvokeNavEventUPP(callBackSelector: NavEventCallbackMessage; callBackParms: NavCBRecPtr; callBackUD: UnivPtr; userRoutine: NavEventUPP); external name '_InvokeNavEventUPP'; { old name was CallNavEventProc }
{
 *  InvokeNavPreviewUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeNavPreviewUPP(callBackParms: NavCBRecPtr; callBackUD: UnivPtr; userRoutine: NavPreviewUPP): boolean; external name '_InvokeNavPreviewUPP'; { old name was CallNavPreviewProc }
{
 *  InvokeNavObjectFilterUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeNavObjectFilterUPP(var theItem: AEDesc; info: UnivPtr; callBackUD: UnivPtr; filterMode: NavFilterModes; userRoutine: NavObjectFilterUPP): boolean; external name '_InvokeNavObjectFilterUPP'; { old name was CallNavObjectFilterProc }
type
    NavCustomControlMessage     = SInt32;
const
    kNavCtlShowDesktop          = 0;                            {     show desktop,           parms = nil  }
    kNavCtlSortBy               = 1;                            {     sort key field,       parms->NavSortKeyField  }
    kNavCtlSortOrder            = 2;                            {     sort order,              parms->NavSortOrder  }
    kNavCtlScrollHome           = 3;                            {     scroll list home,       parms = nil  }
    kNavCtlScrollEnd            = 4;                            {     scroll list end,      parms = nil  }
    kNavCtlPageUp               = 5;                            {     page list up,          parms = nil  }
    kNavCtlPageDown             = 6;                            {     page list down,          parms = nil  }
    kNavCtlGetLocation          = 7;                            {     get current location,   parms<-AEDesc*  }
    kNavCtlSetLocation          = 8;                            {     set current location,   parms->AEDesc*  }
    kNavCtlGetSelection         = 9;                            {     get current selection,     parms<-AEDescList*  }
    kNavCtlSetSelection         = 10;                           {     set current selection,     parms->AEDescList*  }
    kNavCtlShowSelection        = 11;                           {     make selection visible,       parms = nil  }
    kNavCtlOpenSelection        = 12;                           {     open view of selection,       parms = nil  }
    kNavCtlEjectVolume          = 13;                           {     eject volume,          parms->vRefNum  }
    kNavCtlNewFolder            = 14;                           {     create a new folder,     parms->StringPtr  }
    kNavCtlCancel               = 15;                           {     cancel dialog,          parms = nil  }
    kNavCtlAccept               = 16;                           {     accept dialog default,     parms = nil  }
    kNavCtlIsPreviewShowing     = 17;                           {     query preview status,   parms<-Boolean  }
    kNavCtlAddControl           = 18;                           {   add one control to dialog,    parms->ControlHandle  }
    kNavCtlAddControlList       = 19;                           {     add control list to dialog,    parms->Handle (DITL rsrc)  }
    kNavCtlGetFirstControlID    = 20;                           {     get 1st control ID,         parms<-UInt16  }
    kNavCtlSelectCustomType     = 21;                           {     select a custom menu item  parms->NavMenuItemSpec*  }
    kNavCtlSelectAllType        = 22;                           {   select an "All" menu item parms->SInt16  }
    kNavCtlGetEditFileName      = 23;                           {     get save dlog's file name  parms<-StringPtr  }
    kNavCtlSetEditFileName      = 24;                           {     set save dlog's file name  parms->StringPtr  }
    kNavCtlSelectEditFileName   = 25;                           {     select save dlog file name parms->ControlEditTextSelectionRec*, v1.1 or greater  }
    kNavCtlBrowserSelectAll     = 26;                           {   re-scan the browser list  parms = nil, v2.0 or greater  }
    kNavCtlGotoParent           = 27;                           {   navigate to parent         parms = nil, v2.0 or greater  }
    kNavCtlSetActionState       = 28;                           {   restrict navigation      parms->NavActionState (flags), v2.0 or greater  }
    kNavCtlBrowserRedraw        = 29;                           {   rescan browser list      parms = nil, v2.0 or greater  }
    kNavCtlTerminate            = 30;                           {   terminate/dismiss dialog  parms = nil, v2.0 or greater  }


type
    NavActionState              = UInt32;
const
    kNavNormalState             = $00000000;                    {  normal/default state  }
    kNavDontOpenState           = $00000001;                    {  disallow opening files/folders  }
    kNavDontSaveState           = $00000002;                    {  disallow saving files  }
    kNavDontChooseState         = $00000004;                    {  disallow choosing objects  }
    kNavDontNewFolderState      = $00000010;                    {  disallow creating new folders  }


type
    NavPopupMenuItem            = UInt16;
const
    kNavAllKnownFiles           = 0;
    kNavAllReadableFiles        = 1;
    kNavAllFiles                = 2;


type
    NavSortKeyField             = UInt16;
const
    kNavSortNameField           = 0;
    kNavSortDateField           = 1;



type
    NavSortOrder                = UInt16;
const
    kNavSortAscending           = 0;
    kNavSortDescending          = 1;



type
    NavDialogOptionFlags        = UInt32;
const
    kNavDefaultNavDlogOptions   = $000000E4;                    {  use defaults for all the options  }
    kNavNoTypePopup             = $00000001;                    {  don't show file type/extension popup on Open/Save  }
    kNavDontAutoTranslate       = $00000002;                    {  don't automatically translate on Open  }
    kNavDontAddTranslateItems   = $00000004;                    {  don't add translation choices on Open/Save  }
    kNavAllFilesInPopup         = $00000010;                    {  "All Files" menu item in the type popup on Open  }
    kNavAllowStationery         = $00000020;                    {  allow saving of stationery files  }
    kNavAllowPreviews           = $00000040;                    {  allow preview to show  }
    kNavAllowMultipleFiles      = $00000080;                    {  allow multiple items to be selected  }
    kNavAllowInvisibleFiles     = $00000100;                    {  allow invisible items to be shown  }
    kNavDontResolveAliases      = $00000200;                    {  don't resolve aliases  }
    kNavSelectDefaultLocation   = $00000400;                    {  make the default location the browser selection  }
    kNavSelectAllReadableItem   = $00000800;                    {  make the dialog select "All Readable Documents" on open  }
    kNavSupportPackages         = $00001000;                    {  recognize file system packages, v2.0 or greater  }
    kNavAllowOpenPackages       = $00002000;                    {  allow opening of packages, v2.0 or greater  }
    kNavDontAddRecents          = $00004000;                    {  don't add chosen objects to the recents list, v2.0 or greater  }
    kNavDontUseCustomFrame      = $00008000;                    {  don't draw the custom area bevel frame, v2.0 or greater  }
    kNavDontConfirmReplacement  = $00010000;                    {  don't show the "Replace File?" alert on save conflict, v3.0 or greater  }
    kNavPreserveSaveFileExtension = $00020000;                  {  extension in default file name is preserved and initially hidden, v3.1 or greater  }


type
    NavTranslationOptions       = UInt32;
const
    kNavTranslateInPlace        = 0;                            {     translate in place, replacing translation source file (default for Save)  }
    kNavTranslateCopy           = 1;                            {     translate to a copy of the source file (default for Open)  }


    kNavMenuItemSpecVersion     = 0;


type
    NavMenuItemSpecPtr = ^NavMenuItemSpec;
    NavMenuItemSpec = record
        version:                UInt16;
        menuCreator:            OSType;
        menuType:               OSType;
        menuItemName:           Str255;
        reserved:               packed array [0..244] of char;
    end;

    NavMenuItemSpecArray                = array [0..0] of NavMenuItemSpec;
    NavMenuItemSpecArrayPtr             = ^NavMenuItemSpecArray;
    NavMenuItemSpecArrayHandle          = ^NavMenuItemSpecArrayPtr;
    NavMenuItemSpecHandle               = NavMenuItemSpecArrayHandle;

const
    kNavGenericSignature        = $2A2A2A2A (* '****' *);


type
    NavTypeListPtr = ^NavTypeList;
    NavTypeList = record
        componentSignature:     OSType;
        reserved:               SInt16;
        osTypeCount:            SInt16;
        osType:                 array [0..0] of OSType;
    end;

    NavTypeListHandle                   = ^NavTypeListPtr;

const
    kNavDialogOptionsVersion    = 0;


type
    NavDialogOptionsPtr = ^NavDialogOptions;
    NavDialogOptions = record
        version:                UInt16;
        dialogOptionFlags:      NavDialogOptionFlags;                   {  option flags for affecting the dialog's behavior  }
        location:               Point;                                  {  top-left location of the dialog, or (-1,-1) for default position  }
        clientName:             Str255;
        windowTitle:            Str255;
        actionButtonLabel:      Str255;                                 {  label of the default button (or null string for default)  }
        cancelButtonLabel:      Str255;                                 {  label of the cancel button (or null string for default)  }
        savedFileName:          Str255;                                 {  default name for text box in NavPutFile (or null string for default)  }
        message:                Str255;                                 {  custom message prompt (or null string for default)  }
        preferenceKey:          UInt32;                                 {  a key for to managing preferences for using multiple utility dialogs  }
        popupExtension:         NavMenuItemSpecArrayHandle;             {  extended popup menu items, an array of NavMenuItemSpecs  }
        reserved:               packed array [0..493] of char;
    end;


const
    kNavReplyRecordVersion      = 2;


    {
     *  NavReplyRecord
     *
     *  Summary:
     *    A structure describing the results of a Nav Services dialog
     *
     *  Discussion:
     *    A reply record is the result of a Nav Services file dialog. Using
     *    the older API, which is always modal, the client passes the
     *    address of a reply record when invoking the dialog. In the Carbon
     *    API, dialogs may also be window modal or modeless, so the client
     *    requests the reply record by calling NavDialogGetReply when a
     *    kNavCBUserAction event is received. Either way, a reply record
     *    should be disposed of using NavDisposeReply.
        }

type
    NavReplyRecordPtr = ^NavReplyRecord;
    NavReplyRecord = record
        version:                UInt16;
        validRecord:            boolean;
        replacing:              boolean;
        isStationery:           boolean;
        translationNeeded:      boolean;
        selection:              AEDescList;
        keyScript:              ScriptCode;
        fileTranslation:        FileTranslationSpecArrayHandle;
        reserved1:              UInt32;
        saveFileName:           CFStringRef;
        saveFileExtensionHidden: boolean;
        reserved2:              SInt8;
        reserved:               packed array [0..224] of char;
    end;

    {
     *  NavLoad()
     *
     *  Availability:
     *    Non-Carbon CFM:   in NavigationLib 1.0 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         not available
        }
function NavLoad: OSErr; external name '_NavLoad';

{
 *  NavUnload()
 *
 *  Availability:
 *    Non-Carbon CFM:   in NavigationLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         not available
 }
function NavUnload: OSErr; external name '_NavUnload';

{
 *  NavLibraryVersion()
 *
 *  Availability:
 *    Non-Carbon CFM:   in NavigationLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NavLibraryVersion: UInt32; external name '_NavLibraryVersion';

{
 *  NavGetDefaultDialogOptions()
 *
 *  Availability:
 *    Non-Carbon CFM:   in NavigationLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NavGetDefaultDialogOptions(var dialogOptions: NavDialogOptions): OSErr; external name '_NavGetDefaultDialogOptions';


{
 *  NavGetFile()
 *
 *  Availability:
 *    Non-Carbon CFM:   in NavigationLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NavGetFile(defaultLocation: AEDescPtr; var reply: NavReplyRecord; dialogOptions: NavDialogOptionsPtr; eventProc: NavEventUPP; previewProc: NavPreviewUPP; filterProc: NavObjectFilterUPP; typeList: NavTypeListHandle; callBackUD: UnivPtr): OSErr; external name '_NavGetFile';

{
 *  NavPutFile()
 *
 *  Availability:
 *    Non-Carbon CFM:   in NavigationLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NavPutFile(defaultLocation: AEDescPtr; var reply: NavReplyRecord; dialogOptions: NavDialogOptionsPtr; eventProc: NavEventUPP; fileType: OSType; fileCreator: OSType; callBackUD: UnivPtr): OSErr; external name '_NavPutFile';

{
 *  NavAskSaveChanges()
 *
 *  Availability:
 *    Non-Carbon CFM:   in NavigationLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NavAskSaveChanges(var dialogOptions: NavDialogOptions; action: NavAskSaveChangesAction; var reply: NavAskSaveChangesResult; eventProc: NavEventUPP; callBackUD: UnivPtr): OSErr; external name '_NavAskSaveChanges';

{
 *  NavCustomAskSaveChanges()
 *
 *  Availability:
 *    Non-Carbon CFM:   in NavigationLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NavCustomAskSaveChanges(var dialogOptions: NavDialogOptions; var reply: NavAskSaveChangesResult; eventProc: NavEventUPP; callBackUD: UnivPtr): OSErr; external name '_NavCustomAskSaveChanges';

{
 *  NavAskDiscardChanges()
 *
 *  Availability:
 *    Non-Carbon CFM:   in NavigationLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NavAskDiscardChanges(var dialogOptions: NavDialogOptions; var reply: NavAskDiscardChangesResult; eventProc: NavEventUPP; callBackUD: UnivPtr): OSErr; external name '_NavAskDiscardChanges';

{
 *  NavChooseFile()
 *
 *  Availability:
 *    Non-Carbon CFM:   in NavigationLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NavChooseFile(defaultLocation: AEDescPtr; var reply: NavReplyRecord; dialogOptions: NavDialogOptionsPtr; eventProc: NavEventUPP; previewProc: NavPreviewUPP; filterProc: NavObjectFilterUPP; typeList: NavTypeListHandle; callBackUD: UnivPtr): OSErr; external name '_NavChooseFile';

{
 *  NavChooseFolder()
 *
 *  Availability:
 *    Non-Carbon CFM:   in NavigationLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NavChooseFolder(defaultLocation: AEDescPtr; var reply: NavReplyRecord; dialogOptions: NavDialogOptionsPtr; eventProc: NavEventUPP; filterProc: NavObjectFilterUPP; callBackUD: UnivPtr): OSErr; external name '_NavChooseFolder';

{
 *  NavChooseVolume()
 *
 *  Availability:
 *    Non-Carbon CFM:   in NavigationLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NavChooseVolume(defaultSelection: AEDescPtr; var reply: NavReplyRecord; dialogOptions: NavDialogOptionsPtr; eventProc: NavEventUPP; filterProc: NavObjectFilterUPP; callBackUD: UnivPtr): OSErr; external name '_NavChooseVolume';

{
 *  NavChooseObject()
 *
 *  Availability:
 *    Non-Carbon CFM:   in NavigationLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NavChooseObject(defaultLocation: AEDescPtr; var reply: NavReplyRecord; dialogOptions: NavDialogOptionsPtr; eventProc: NavEventUPP; filterProc: NavObjectFilterUPP; callBackUD: UnivPtr): OSErr; external name '_NavChooseObject';

{
 *  NavNewFolder()
 *
 *  Availability:
 *    Non-Carbon CFM:   in NavigationLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NavNewFolder(defaultLocation: AEDescPtr; var reply: NavReplyRecord; dialogOptions: NavDialogOptionsPtr; eventProc: NavEventUPP; callBackUD: UnivPtr): OSErr; external name '_NavNewFolder';

{
 *  NavTranslateFile()
 *
 *  Availability:
 *    Non-Carbon CFM:   in NavigationLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NavTranslateFile(var reply: NavReplyRecord; howToTranslate: NavTranslationOptions): OSErr; external name '_NavTranslateFile';

{
 *  NavCompleteSave()
 *
 *  Availability:
 *    Non-Carbon CFM:   in NavigationLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NavCompleteSave(var reply: NavReplyRecord; howToTranslate: NavTranslationOptions): OSErr; external name '_NavCompleteSave';

{
 *  NavCustomControl()
 *
 *  Availability:
 *    Non-Carbon CFM:   in NavigationLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NavCustomControl(dialog: NavDialogRef; selector: NavCustomControlMessage; parms: UnivPtr): OSErr; external name '_NavCustomControl';

{
 *  NavCreatePreview()
 *
 *  Availability:
 *    Non-Carbon CFM:   in NavigationLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NavCreatePreview(var theObject: AEDesc; previewDataType: OSType; previewData: UnivPtr; previewDataSize: Size): OSErr; external name '_NavCreatePreview';

{
 *  NavDisposeReply()
 *
 *  Availability:
 *    Non-Carbon CFM:   in NavigationLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NavDisposeReply(var reply: NavReplyRecord): OSErr; external name '_NavDisposeReply';

{
 *  NavServicesCanRun()
 *
 *  Availability:
 *    Non-Carbon CFM:   in NavigationLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         not available
 }
function NavServicesCanRun: boolean; external name '_NavServicesCanRun';


{ Navigation is always available on OS X }

{ Carbon API }
{ Includes support for Unicode and long file names (where available). }


const
    kNavDialogCreationOptionsVersion = 0;



    {
     *  NavDialogCreationOptions
     *
     *  Summary:
     *    Options used to control the appearance and operation of a Nav
     *    Services dialog
     *
     *  Discussion:
     *    NavDialogCreationOptions is a preferred replacement for
     *    NavDialogOptions. The new structure uses CFStrings in place of
     *    Pascal strings, and adds fields for setting the dialog modality
     *    and the parent window (for sheet dialogs). A
     *    NavDialogCreationOptions structure can be initialized using
     *    NavDialogGetDefaultCreationOptions. Each of the NavCreate*Dialog
     *    functions accepts a pointer to the client's
     *    NavDialogCreationOptions structure.
        }

type
    NavDialogCreationOptionsPtr = ^NavDialogCreationOptions;
    NavDialogCreationOptions = record
        version:                UInt16;
        optionFlags:            NavDialogOptionFlags;
        location:               Point;
        clientName:             CFStringRef;
        windowTitle:            CFStringRef;
        actionButtonLabel:      CFStringRef;
        cancelButtonLabel:      CFStringRef;
        saveFileName:           CFStringRef;
        message:                CFStringRef;
        preferenceKey:          UInt32;
        popupExtension:         CFArrayRef;
        modality:               WindowModality;
        parentWindow:           WindowRef;
        reserved:               packed array [0..15] of char;
    end;

    {
     *  NavGetDefaultDialogCreationOptions()
     *
     *  Summary:
     *    Initialize the input structure to default values
     *
     *  Discussion:
     *    Provided as a convenience to obtain the preferred default options
     *    for use in creating any Nav Services dialog.
     *
     *  Parameters:
     *
     *    outOptions:
     *      A pointer to the client-allocated options structure to
     *      initialize
     *
     *  Result:
     *    A status code
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.1 and later
     *    Mac OS X:         in version 10.0 and later
        }
function NavGetDefaultDialogCreationOptions(var outOptions: NavDialogCreationOptions): OSStatus; external name '_NavGetDefaultDialogCreationOptions';


{
 *  NavCreateGetFileDialog()
 *
 *  Summary:
 *    Create a GetFile dialog
 *
 *  Discussion:
 *    Use this function to create a dialog designed for opening
 *    document files. This function replaces NavGetFile, allowing new
 *    window modalities, and adding Unicode support. Upon successful
 *    creation, the dialog is not visible. Present and run the dialog
 *    with NavDialogRun. After the dialog is complete, dispose of it
 *    with NavDialogDispose.
 *
 *  Parameters:
 *
 *    inOptions:
 *      Options controlling the appearance and behavior of the dialog
 *
 *    inTypeList:
 *      A creator signature and list of file types to show in the
 *      dialog file browser. If NULL, show all files.
 *
 *    inEventProc:
 *      The UPP for the client's event callack, or NULL for no event
 *      callback
 *
 *    inPreviewProc:
 *      The UPP for the client's custom file preview callback, or NULL
 *      for standard previews
 *
 *    inFilterProc:
 *      The UPP for the client's custom filter callback, or NULL for no
 *      custom file filtering
 *
 *    inClientData:
 *      A client-defined context value passed to all callback functions
 *
 *    outDialog:
 *      Upon successful completion, a reference to the created dialog
 *
 *  Result:
 *    A status code
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NavCreateGetFileDialog(inOptions: {Const}NavDialogCreationOptionsPtr; inTypeList: NavTypeListHandle; inEventProc: NavEventUPP; inPreviewProc: NavPreviewUPP; inFilterProc: NavObjectFilterUPP; inClientData: UnivPtr; var outDialog: NavDialogRef): OSStatus; external name '_NavCreateGetFileDialog';


{
 *  NavCreatePutFileDialog()
 *
 *  Summary:
 *    Create a PutFile dialog
 *
 *  Discussion:
 *    Use this function to create a dialog designed for setting the
 *    name and location of a document file prior to saving. This
 *    function replaces NavPutFile, allowing new window modalities, and
 *    adding Unicode support. Upon successful creation, the dialog is
 *    not visible. Present and run the dialog with NavDialogRun. After
 *    the dialog is complete, dispose of it with NavDialogDispose.
 *
 *  Parameters:
 *
 *    inOptions:
 *      Options controlling the appearance and behavior of the dialog
 *
 *    inFileType:
 *      The type of the file to be saved. This parameter is used in
 *      conjunction with the inFileCreator parameter to look up the
 *      kind string for the Format popup menu, and to drive the
 *      identification of translation options.
 *
 *    inFileCreator:
 *      The creator signature of the file to be saved (see inFileType
 *      parameter)
 *
 *    inEventProc:
 *      The UPP for the client's event callack, or NULL for no event
 *      callback
 *
 *    inClientData:
 *      A client-defined context value passed to all callback functions
 *
 *    outDialog:
 *      Upon successful completion, a reference to the created dialog
 *
 *  Result:
 *    A status code
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NavCreatePutFileDialog(inOptions: {Const}NavDialogCreationOptionsPtr; inFileType: OSType; inFileCreator: OSType; inEventProc: NavEventUPP; inClientData: UnivPtr; var outDialog: NavDialogRef): OSStatus; external name '_NavCreatePutFileDialog';


{
 *  NavCreateAskReviewDocumentsDialog()
 *
 *  Summary:
 *    Create an AskReviewDocumentsDialog dialog
 *
 *  Discussion:
 *    Use this function to create a dialog which tells the user how
 *    many unsaved documents there are, and asks the user to start
 *    reviewing the documents, don't save any documents, or cancel.
 *    This dialog is appropriate to use when an application is quitting
 *    and there is more than one unsaved document. It is supported only
 *    on Mac OS X because the HI guidelines for earlier versions of Mac
 *    OS do not include this dialog as part of the application quit
 *    sequence. Upon successful creation, the dialog is not visible.
 *    Present and run the dialog with NavDialogRun. After the dialog is
 *    complete, dispose of it with NavDialogDispose. Upon dismissal of
 *    the dialog, this dialog's user action will be set to one of the
 *    following: kNavUserActionReviewDocuments,
 *    kNavUserActionDiscardDocuments, or kNavUserActionCancel.
 *
 *  Parameters:
 *
 *    inOptions:
 *      Options controlling the appearance and behavior of the dialog
 *
 *    inDocumentCount:
 *      Indicates the number of documents needing review. This number
 *      appears in the text presented to the user. If for any reason
 *      the total number of unsaved documents is unknown, specify 0,
 *      and an ambiguous message will appear. Do not specifiy 1, since
 *      the HI guidelines call for this alert only when there is more
 *      than one document to be reviewed.
 *
 *    inEventProc:
 *      The UPP for the client's event callack, or NULL for no event
 *      callback
 *
 *    inClientData:
 *      A client-defined context value passed to all callback functions
 *
 *    outDialog:
 *      Upon successful completion, a reference to the created dialog
 *
 *  Result:
 *    A status code
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.1 and later
 *    Mac OS X:         in version 10.1 and later
 }
function NavCreateAskReviewDocumentsDialog(const (*var*) inOptions: NavDialogCreationOptions; inDocumentCount: UInt32; inEventProc: NavEventUPP; inClientData: UnivPtr; var outDialog: NavDialogRef): OSStatus; external name '_NavCreateAskReviewDocumentsDialog';


{
 *  NavCreateAskSaveChangesDialog()
 *
 *  Summary:
 *    Create an AskSaveChanges dialog
 *
 *  Discussion:
 *    Use this function to create a dialog which asks the user to save,
 *    don't save or cancel closing a document with unsaved changes.
 *    This function replaces NavAskSaveChanges and
 *    NavCustomAskSaveChanges, allowing new window modalities, and
 *    adding Unicode support. Upon successful creation, the dialog is
 *    not visible. Present and run the dialog with NavDialogRun. After
 *    the dialog is complete, dispose of it with NavDialogDispose. To
 *    provide a customized message for the alert, specify an non-NULL
 *    message value in the options structure.
 *
 *  Parameters:
 *
 *    inOptions:
 *      Options controlling the appearance and behavior of the dialog
 *
 *    inAction:
 *      Indicates this usage context for this dialog: closing a
 *      document or quitting an application. This setting affects the
 *      message text displayed to the user.
 *
 *    inEventProc:
 *      The UPP for the client's event callack, or NULL for no event
 *      callback
 *
 *    inClientData:
 *      A client-defined context value passed to all callback functions
 *
 *    outDialog:
 *      Upon successful completion, a reference to the created dialog
 *
 *  Result:
 *    A status code
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NavCreateAskSaveChangesDialog(const (*var*) inOptions: NavDialogCreationOptions; inAction: NavAskSaveChangesAction; inEventProc: NavEventUPP; inClientData: UnivPtr; var outDialog: NavDialogRef): OSStatus; external name '_NavCreateAskSaveChangesDialog';


{
 *  NavCreateAskDiscardChangesDialog()
 *
 *  Summary:
 *    Create an AskDiscardChanges dialog
 *
 *  Discussion:
 *    Use this function to create a dialog which asks the user to
 *    discard changes to a document or cancel. This is most often use
 *    when the user wants to revert a a document to the last saved
 *    revision. This function replaces NavAskDiscardChanges, allowing
 *    new window modalities, and adding Unicode support. Upon
 *    successful creation, the dialog is not visible. Present and run
 *    the dialog with NavDialogRun. After the dialog is complete,
 *    dispose of it with NavDialogDispose.
 *
 *  Parameters:
 *
 *    inOptions:
 *      Options controlling the appearance and behavior of the dialog
 *
 *    inEventProc:
 *      The UPP for the client's event callack, or NULL for no event
 *      callback
 *
 *    inClientData:
 *      A client-defined context value passed to all callback functions
 *
 *    outDialog:
 *      Upon successful completion, a reference to the created dialog
 *
 *  Result:
 *    A status code
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NavCreateAskDiscardChangesDialog(const (*var*) inOptions: NavDialogCreationOptions; inEventProc: NavEventUPP; inClientData: UnivPtr; var outDialog: NavDialogRef): OSStatus; external name '_NavCreateAskDiscardChangesDialog';


{
 *  NavCreateChooseFileDialog()
 *
 *  Summary:
 *    Create a ChooseFile dialog
 *
 *  Discussion:
 *    Use this function to create a dialog designed for selecting one
 *    file as the target of an operation. A ChooseFile dialog is a
 *    simple version a GetFile dialog. This function replaces
 *    NavChooseFile, allowing new window modalities, and adding Unicode
 *    support. Upon successful creation, the dialog is not visible.
 *    Present and run the dialog with NavDialogRun. After the dialog is
 *    complete, dispose of it with NavDialogDispose.
 *
 *  Parameters:
 *
 *    inOptions:
 *      Options controlling the appearance and behavior of the dialog
 *
 *    inTypeList:
 *      A creator signature and list of file types to show in the
 *      dialog file browser. If NULL, show all files.
 *
 *    inEventProc:
 *      The UPP for the client's event callack, or NULL for no event
 *      callback
 *
 *    inPreviewProc:
 *      The UPP for the client's custom file preview callback, or NULL
 *      for standard previews
 *
 *    inFilterProc:
 *      The UPP for the client's custom filter callback, or NULL for no
 *      custom file filtering
 *
 *    inClientData:
 *      A client-defined context value passed to all callback functions
 *
 *    outDialog:
 *      Upon successful completion, a reference to the created dialog
 *
 *  Result:
 *    A status code
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NavCreateChooseFileDialog(inOptions: {Const}NavDialogCreationOptionsPtr; inTypeList: NavTypeListHandle; inEventProc: NavEventUPP; inPreviewProc: NavPreviewUPP; inFilterProc: NavObjectFilterUPP; inClientData: UnivPtr; var outDialog: NavDialogRef): OSStatus; external name '_NavCreateChooseFileDialog';


{
 *  NavCreateChooseFolderDialog()
 *
 *  Summary:
 *    Create a ChooseFolder dialog
 *
 *  Discussion:
 *    Use this function to create a dialog designed for selecting a
 *    folder as the target of an operation. This function replaces
 *    NavChooseFolder, allowing new window modalities, and adding
 *    Unicode support. Upon successful creation, the dialog is not
 *    visible. Present and run the dialog with NavDialogRun. After the
 *    dialog is complete, dispose of it with NavDialogDispose.
 *
 *  Parameters:
 *
 *    inOptions:
 *      Options controlling the appearance and behavior of the dialog
 *
 *    inEventProc:
 *      The UPP for the client's event callack, or NULL for no event
 *      callback
 *
 *    inFilterProc:
 *      The UPP for the client's custom filter callback, or NULL for no
 *      custom file filtering
 *
 *    inClientData:
 *      A client-defined context value passed to all callback functions
 *
 *    outDialog:
 *      Upon successful completion, a reference to the created dialog
 *
 *  Result:
 *    A status code
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NavCreateChooseFolderDialog(inOptions: {Const}NavDialogCreationOptionsPtr; inEventProc: NavEventUPP; inFilterProc: NavObjectFilterUPP; inClientData: UnivPtr; var outDialog: NavDialogRef): OSStatus; external name '_NavCreateChooseFolderDialog';


{
 *  NavCreateChooseVolumeDialog()
 *
 *  Summary:
 *    Create a ChooseVolume dialog
 *
 *  Discussion:
 *    Use this function to create a dialog designed for selecting a
 *    volume as the target of an operation. This function replaces
 *    NavChooseVolume, allowing new window modalities, and adding
 *    Unicode support. Upon successful creation, the dialog is not
 *    visible. Present and run the dialog with NavDialogRun. After the
 *    dialog is complete, dispose of it with NavDialogDispose.
 *
 *  Parameters:
 *
 *    inOptions:
 *      Options controlling the appearance and behavior of the dialog
 *
 *    inEventProc:
 *      The UPP for the client's event callack, or NULL for no event
 *      callback
 *
 *    inFilterProc:
 *      The UPP for the client's custom filter callback, or NULL for no
 *      custom file filtering
 *
 *    inClientData:
 *      A client-defined context value passed to all callback functions
 *
 *    outDialog:
 *      Upon successful completion, a reference to the created dialog
 *
 *  Result:
 *    A status code
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NavCreateChooseVolumeDialog(inOptions: {Const}NavDialogCreationOptionsPtr; inEventProc: NavEventUPP; inFilterProc: NavObjectFilterUPP; inClientData: UnivPtr; var outDialog: NavDialogRef): OSStatus; external name '_NavCreateChooseVolumeDialog';


{
 *  NavCreateChooseObjectDialog()
 *
 *  Summary:
 *    Create a ChooseObject dialog
 *
 *  Discussion:
 *    Use this function to create a dialog designed for selecting a
 *    file, folder, or volume as the target of an operation. This
 *    function replaces NavChooseObject, allowing new window
 *    modalities, and adding Unicode support. Upon successful creation,
 *    the dialog is not visible. Present and run the dialog with
 *    NavDialogRun. After the dialog is complete, dispose of it with
 *    NavDialogDispose.
 *
 *  Parameters:
 *
 *    inOptions:
 *      Options controlling the appearance and behavior of the dialog
 *
 *    inEventProc:
 *      The UPP for the client's event callack, or NULL for no event
 *      callback
 *
 *    inPreviewProc:
 *      The UPP for the client's custom file preview callback, or NULL
 *      for standard previews
 *
 *    inFilterProc:
 *      The UPP for the client's custom filter callback, or NULL for no
 *      custom file filtering
 *
 *    inClientData:
 *      A client-defined context value passed to all callback functions
 *
 *    outDialog:
 *      Upon successful completion, a reference to the created dialog
 *
 *  Result:
 *    A status code
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NavCreateChooseObjectDialog(inOptions: {Const}NavDialogCreationOptionsPtr; inEventProc: NavEventUPP; inPreviewProc: NavPreviewUPP; inFilterProc: NavObjectFilterUPP; inClientData: UnivPtr; var outDialog: NavDialogRef): OSStatus; external name '_NavCreateChooseObjectDialog';


{
 *  NavCreateNewFolderDialog()
 *
 *  Summary:
 *    Create a NewFolder dialog
 *
 *  Discussion:
 *    Use this function to create a dialog designed for creating a new
 *    folder. Nav Services creates the folder as specified by the user
 *    and returns a reference to the folder in the selection field of
 *    the reply record. This function replaces NavNewFolder, allowing
 *    new window modalities, and adding Unicode support. Upon
 *    successful creation, the dialog is not visible. Present and run
 *    the dialog with NavDialogRun. After the dialog is complete,
 *    dispose of it with NavDialogDispose.
 *
 *  Parameters:
 *
 *    inOptions:
 *      Options controlling the appearance and behavior of the dialog
 *
 *    inEventProc:
 *      The UPP for the client's event callack, or NULL for no event
 *      callback
 *
 *    inClientData:
 *      A client-defined context value passed to all callback functions
 *
 *    outDialog:
 *      Upon successful completion, a reference to the created dialog
 *
 *  Result:
 *    A status code
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NavCreateNewFolderDialog(inOptions: {Const}NavDialogCreationOptionsPtr; inEventProc: NavEventUPP; inClientData: UnivPtr; var outDialog: NavDialogRef): OSStatus; external name '_NavCreateNewFolderDialog';


{
 *  NavDialogRun()
 *
 *  Summary:
 *    Show and run a Nav Services dialog
 *
 *  Discussion:
 *    After a dialog is created with a NavCreate*Dialog function, the
 *    client can modify the dialog target folder or save file name
 *    using NavCustomControl with the appropriate selectors. The dialog
 *    is presented to the user by calling NavDialogRun. If the dialog
 *    is system modal or application modal (kWindowModalitySystemModal,
 *    kWindowModalityAppModal), NavDialogRun does not return until the
 *    dialog has been dismissed. If the dialog is modeless or window
 *    modal (kWindowModalityNone, kWindowModalityWindowModal),
 *    NavDialogRun shows the dialog and returns immediately. In order
 *    to know when the dialog has been dismissed, the client must watch
 *    for the kNavCBUserAction event sent to the client event proc.
 *    Note that on Mac OS 9 and earlier, all dialogs are modal, even if
 *    a modeless or window modal dialog is requested. However, the
 *    kNavCBUserAction event is still sent to the event proc, so it's
 *    possible to use a single programming model on OS 9 and OS X
 *    provided the client assumes NavDialogRun returns immediately
 *    after showing the dialog.
 *
 *  Parameters:
 *
 *    inDialog:
 *      The dialog to run
 *
 *  Result:
 *    A status code
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NavDialogRun(inDialog: NavDialogRef): OSStatus; external name '_NavDialogRun';


{
 *  NavDialogDispose()
 *
 *  Summary:
 *    Dispose of a Nav Services dialog
 *
 *  Discussion:
 *    Call this function when completely finished with a Nav Services
 *    dialog. After calling NavDialogDispose, the dialog reference is
 *    no longer valid. NavDialogDispose is safe to call from within a
 *    callback to the client's Nav Services event proc.
 *
 *  Parameters:
 *
 *    inDialog:
 *      The dialog to dispose
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure NavDialogDispose(inDialog: NavDialogRef); external name '_NavDialogDispose';


{
 *  NavDialogGetWindow()
 *
 *  Summary:
 *    Return the window in which a Nav Services dialog appears
 *
 *  Discussion:
 *    Note that a valid NavDialogRef may not have a window until
 *    NavDialogRun has been called. If no window exists for the dialog,
 *    NavDialogGetWindow returns NULL.
 *
 *  Parameters:
 *
 *    inDialog:
 *      Which dialog
 *
 *  Result:
 *    The window reference
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NavDialogGetWindow(inDialog: NavDialogRef): WindowRef; external name '_NavDialogGetWindow';


{
 *  NavDialogGetUserAction()
 *
 *  Summary:
 *    Return the current user action taken by the user
 *
 *  Discussion:
 *    A user action occurs when the user dismisses the dialog or
 *    otherwise does something generating a reply record that the
 *    client needs to act upon. If the user has not taken such an
 *    action, NavDialogGetUserAction returns kNavUserActionNone. If the
 *    dialog is terminated using the NavCustomControl selector
 *    kNavCtlTerminate, the final user action is kNavUserActionNone.
 *    For file dialogs, if the final user action is not
 *    kNavUserActionCancel, then there is a valid reply record which
 *    can be obtained with NavDialogGetReply. Although the user action
 *    is sent to the client event proc as a kNavCBUserAction event,
 *    this function is provided as a convenience for clients of modal
 *    dialogs who may find it easier to get the user action immediately
 *    after NavDialogRun returns.
 *
 *  Parameters:
 *
 *    inDialog:
 *      Which dialog
 *
 *  Result:
 *    The user action
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NavDialogGetUserAction(inDialog: NavDialogRef): NavUserAction; external name '_NavDialogGetUserAction';


{
 *  NavDialogGetReply()
 *
 *  Summary:
 *    Fill in the provided reply record with the results of a user
 *    action such as kNavUserActionOpen, kNavUserActionSaveAs, or
 *    kNavUserActionChoose.
 *
 *  Discussion:
 *    Call this function when a file dialog receives a user action
 *    other that implies an item or items to open, save, etc. Upon
 *    successful completion, the reply record describes the item(s)
 *    that the client needs to act upon. The reply record should later
 *    be disposed of with NavDisposeReply.
 *
 *  Parameters:
 *
 *    inDialog:
 *      Which dialog
 *
 *    outReply:
 *      A pointer to the client-allocated reply record to be filled in
 *
 *  Result:
 *    A status code
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NavDialogGetReply(inDialog: NavDialogRef; var outReply: NavReplyRecord): OSStatus; external name '_NavDialogGetReply';


{
 *  NavDialogGetSaveFileName()
 *
 *  Summary:
 *    Return the current value of the file name to be saved in a
 *    PutFile dialog
 *
 *  Discussion:
 *    This function can be called at any time on a valid PutFile dialog
 *    to obtain the current value of the save file name. This function
 *    is a Unicode-based replacement for the kNavCtlGetEditFileName
 *    NavCustomControl selector. On Mac OS X, the full file name is
 *    returned, including any extenison that may be hidden from the
 *    user.
 *
 *  Parameters:
 *
 *    inPutFileDialog:
 *      Which dialog
 *
 *  Result:
 *    The save file name as a CFStringRef. The string is immutable. The
 *    client should retain the string if the reference is to be held
 *    beyond the life of the dialog (standard CF retain/release
 *    semantics).
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NavDialogGetSaveFileName(inPutFileDialog: NavDialogRef): CFStringRef; external name '_NavDialogGetSaveFileName';


{
 *  NavDialogSetSaveFileName()
 *
 *  Summary:
 *    Set the current value of the file name to be saved in a PutFile
 *    dialog
 *
 *  Discussion:
 *    This function can be called at any time to set the current save
 *    file name. Use it to set an initial name before calling
 *    NavDialogRun or to change the file name dynamically while a
 *    dialog is running. This function is a Unicode-based replacement
 *    for the kNavCtlSetEditFileName NavCustomControl selector.
 *
 *  Parameters:
 *
 *    inPutFileDialog:
 *      Which PutFile dialog
 *
 *    inFileName:
 *      The file name to use
 *
 *  Result:
 *    A status code
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NavDialogSetSaveFileName(inPutFileDialog: NavDialogRef; inFileName: CFStringRef): OSStatus; external name '_NavDialogSetSaveFileName';


{
 *  NavDialogGetSaveFileExtensionHidden()
 *
 *  Summary:
 *    Get the current state of the extension hiding in a PutFile dialog
 *
 *  Discussion:
 *    This function can be called at any time to determine if a PutFile
 *    dialog is hiding the file extesion (if any) of the file to be
 *    saved.
 *
 *  Parameters:
 *
 *    inPutFileDialog:
 *      Which PutFile dialog
 *
 *  Result:
 *    True if the extension is hidden, false if the extension is
 *    visible or there is no extension.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.1 and later
 *    Mac OS X:         in version 10.1 and later
 }
function NavDialogGetSaveFileExtensionHidden(inPutFileDialog: NavDialogRef): boolean; external name '_NavDialogGetSaveFileExtensionHidden';


{
 *  NavDialogSetSaveFileExtensionHidden()
 *
 *  Summary:
 *    Set the current state of the extension hiding in a PutFile dialog
 *
 *  Discussion:
 *    This function can be called at any time to hide or show the
 *    extension of the file to be saved in a PutFile dialog. If the
 *    current file name has no extension, then hiding the extension has
 *    no effect.
 *
 *  Parameters:
 *
 *    inPutFileDialog:
 *      Which PutFile dialog
 *
 *    inHidden:
 *      The new value for the hidden extension state
 *
 *  Result:
 *    A status code
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.1 and later
 *    Mac OS X:         in version 10.1 and later
 }
function NavDialogSetSaveFileExtensionHidden(inPutFileDialog: NavDialogRef; inHidden: boolean): OSStatus; external name '_NavDialogSetSaveFileExtensionHidden';

{$ALIGN MAC68K}
{#POP}
{unit QTML}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}



type
    QTMLMutex    = ^SInt32; { an opaque 32-bit type }
    QTMLMutexPtr = ^QTMLMutex;  { when a var xx:QTMLMutex parameter can be nil, it is changed to xx: QTMLMutexPtr }
    QTMLSyncVar    = ^SInt32; { an opaque 32-bit type }
    QTMLSyncVarPtr = ^QTMLSyncVar;  { when a var xx:QTMLSyncVar parameter can be nil, it is changed to xx: QTMLSyncVarPtr }

const
    kInitializeQTMLNoSoundFlag  = $00000001;                    {  flag for requesting no sound when calling InitializeQTML }
    kInitializeQTMLUseGDIFlag   = $00000002;                    {  flag for requesting GDI when calling InitializeQTML }
    kInitializeQTMLDisableDirectSound = $00000004;              {  disables QTML's use of DirectSound }
    kInitializeQTMLUseExclusiveFullScreenModeFlag = $00000008;  {  later than QTML 3.0: qtml starts up in exclusive full screen mode }
    kInitializeQTMLDisableDDClippers = $00000010;               {  flag for requesting QTML not to use DirectDraw clipper objects; QTML 5.0 and later }

    kQTMLHandlePortEvents       = $00000001;                    {  flag for requesting requesting QTML to handle events }
    kQTMLNoIdleEvents           = $00000002;                    {  flag for requesting requesting QTML not to send Idle Events }


const
    kFullNativePath             = 0;
    kFileNameOnly               = $01;
    kDirectoryPathOnly          = $02;
    kUFSFullPathName            = $04;
    kTryVDIMask                 = $08;                          {     Used in NativePathNameToFSSpec to specify to search VDI mountpoints }
    kFullPathSpecifiedMask      = $10;                          {     the passed in name is a fully qualified full path }


const
    kErrorIfFileNotFound        = $80000000;


{$ALIGN MAC68K}
{#POP}
{unit TextServices}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}


const
    kTextService                = $74737663 (* 'tsvc' *);                       {  component type for the component description  }
    kInputMethodService         = $696E706D (* 'inpm' *);                       {  component subtype for the component description  }
    kTSMVersion                 = $0150;                        {  Version of the Text Services Manager is 1.5  }

    kUnicodeDocument            = $75646F63 (* 'udoc' *);                       {  TSM Document type for Unicode-savvy application  }
    kUnicodeTextService         = $75747376 (* 'utsv' *);                       {  Component type for Unicode Text Service  }

    {  Language and Script constants }
    kUnknownLanguage            = $FFFF;
    kUnknownScript              = $FFFF;
    kNeutralScript              = $FFFF;


                                                                {  Component Flags in ComponentDescription  }
    bTakeActiveEvent            = 15;                           {  bit set if the component takes active event  }
    bHandleAERecording          = 16;                           {  bit set if the component takes care of recording Apple Events <new in vers2.0>  }
    bScriptMask                 = $00007F00;                    {  bit 8 - 14  }
    bLanguageMask               = $000000FF;                    {  bit 0 - 7   }
    bScriptLanguageMask         = $00007FFF;                    {  bit 0 - 14   }

                                                                {  Typing method property constants for Input Methods  }
    kIMJaTypingMethodProperty   = $6A747970 (* 'jtyp' *);                       {  Typing method property for Japanese input methods }
    kIMJaTypingMethodRoman      = $726F6D61 (* 'roma' *);                       {  Roman typing }
    kIMJaTypingMethodKana       = $6B616E61 (* 'kana' *);                       {  Kana typing }

                                                                {  Low level routines which are dispatched directly to the Component Manager  }
    kCMGetScriptLangSupport     = $0001;                        {  Component Manager call selector 1  }
    kCMInitiateTextService      = $0002;                        {  Component Manager call selector 2  }
    kCMTerminateTextService     = $0003;                        {  Component Manager call selector 3  }
    kCMActivateTextService      = $0004;                        {  Component Manager call selector 4  }
    kCMDeactivateTextService    = $0005;                        {  Component Manager call selector 5  }
    kCMTextServiceEvent         = $0006;                        {  Component Manager call selector 6  }
    kCMGetTextServiceMenu       = $0007;                        {  Component Manager call selector 7  }
    kCMTextServiceMenuSelect    = $0008;                        {  Component Manager call selector 8  }
    kCMFixTextService           = $0009;                        {  Component Manager call selector 9  }
    kCMSetTextServiceCursor     = $000A;                        {  Component Manager call selector 10  }
    kCMHidePaletteWindows       = $000B;                        {  Component Manager call selector 11  }
    kCMGetTextServiceProperty   = $000C;                        {  Component Manager call selector 12  }
    kCMSetTextServiceProperty   = $000D;                        {  Component Manager call selector 13  }

                                                                {  New low level routines which are dispatched directly to the Component Manager  }
    kCMUCTextServiceEvent       = $000E;                        {  Component Manager call selector 14  }



    {    New opaque definitions for types   }

type
    TSMDocumentID    = ^SInt32; { an opaque 32-bit type }
    TSMDocumentIDPtr = ^TSMDocumentID;  { when a var xx:TSMDocumentID parameter can be nil, it is changed to xx: TSMDocumentIDPtr }
    InterfaceTypeList                   = array [0..0] of OSType;

    {    Text Service Info List     }
    TextServiceInfoPtr = ^TextServiceInfo;
    TextServiceInfo = record
        fComponent:             Component;
        fItemName:              Str255;
    end;

    TextServiceListPtr = ^TextServiceList;
    TextServiceList = record
        fTextServiceCount:      SInt16;                             {  number of entries in the 'fServices' array  }
        fServices:              array [0..0] of TextServiceInfo;        {  Note: array of 'TextServiceInfo' records follows  }
    end;

    TextServiceListHandle               = ^TextServiceListPtr;
    ScriptLanguageRecordPtr = ^ScriptLanguageRecord;
    ScriptLanguageRecord = record
        fScript:                ScriptCode;
        fLanguage:              LangCode;
    end;

    ScriptLanguageSupportPtr = ^ScriptLanguageSupport;
    ScriptLanguageSupport = record
        fScriptLanguageCount:   SInt16;                             {  number of entries in the 'fScriptLanguageArray' array  }
        fScriptLanguageArray:   array [0..0] of ScriptLanguageRecord;   {  Note: array of 'ScriptLanguageRecord' records follows  }
    end;

    ScriptLanguageSupportHandle         = ^ScriptLanguageSupportPtr;
    {    High level TSM Doucment routines   }
    {
     *  NewTSMDocument()
     *
     *  Availability:
     *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function NewTSMDocument(numOfInterface: SInt16; var supportedInterfaceTypes: InterfaceTypeList; var idocID: TSMDocumentID; refcon: SInt32): OSErr; external name '_NewTSMDocument';
{
 *  DeleteTSMDocument()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DeleteTSMDocument(idocID: TSMDocumentID): OSErr; external name '_DeleteTSMDocument';
{
 *  ActivateTSMDocument()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ActivateTSMDocument(idocID: TSMDocumentID): OSErr; external name '_ActivateTSMDocument';
{
 *  DeactivateTSMDocument()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DeactivateTSMDocument(idocID: TSMDocumentID): OSErr; external name '_DeactivateTSMDocument';
{
 *  FixTSMDocument()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FixTSMDocument(idocID: TSMDocumentID): OSErr; external name '_FixTSMDocument';
{
 *  GetServiceList()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetServiceList(numOfInterface: SInt16; var supportedInterfaceTypes: OSType; var serviceInfo: TextServiceListHandle; var seedValue: SInt32): OSErr; external name '_GetServiceList';
{
 *  OpenTextService()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OpenTextService(idocID: TSMDocumentID; aComponent: Component; var aComponentInstance: ComponentInstance): OSErr; external name '_OpenTextService';
{
 *  CloseTextService()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CloseTextService(idocID: TSMDocumentID; aComponentInstance: ComponentInstance): OSErr; external name '_CloseTextService';
{
 *  SendAEFromTSMComponent()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SendAEFromTSMComponent(const (*var*) theAppleEvent: AppleEvent; var reply: AppleEvent; sendMode: AESendMode; sendPriority: AESendPriority; timeOutInTicks: SInt32; idleProc: AEIdleUPP; filterProc: AEFilterUPP): OSErr; external name '_SendAEFromTSMComponent';
{
 *  SendTextInputEvent()
 *
 *  Discussion:
 *    This API replaces SendAEFromTSMComponent on Mac OS X only. Input
 *    Methods on Mac OS X are Carbon Event based instead of AppleEvent
 *    based.  The Carbon TextInput events which they generate are
 *    provided to TSM for dispatching via this API.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib N.e.v.e.r and later
 *    Mac OS X:         in version 10.0 and later
 }
function SendTextInputEvent(inEvent: EventRef): OSStatus; external name '_SendTextInputEvent';

{
 *  SetDefaultInputMethod()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetDefaultInputMethod(ts: Component; var slRecordPtr: ScriptLanguageRecord): OSErr; external name '_SetDefaultInputMethod';
{
 *  GetDefaultInputMethod()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetDefaultInputMethod(var ts: Component; var slRecordPtr: ScriptLanguageRecord): OSErr; external name '_GetDefaultInputMethod';
{
 *  SetTextServiceLanguage()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetTextServiceLanguage(var slRecordPtr: ScriptLanguageRecord): OSErr; external name '_SetTextServiceLanguage';
{
 *  GetTextServiceLanguage()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetTextServiceLanguage(var slRecordPtr: ScriptLanguageRecord): OSErr; external name '_GetTextServiceLanguage';
{
 *  UseInputWindow()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function UseInputWindow(idocID: TSMDocumentID; useWindow: boolean): OSErr; external name '_UseInputWindow';
{
 *  TSMSetInlineInputRegion()
 *
 *  Discussion:
 *    Tell TSM about the region occupied by an inline input session. If
 *    the location of certain mouse events (clicks, mouse moved) occur
 *    within the specified inline input region, TSM will forward these
 *    events to the current Input Method so that it can interact with
 *    the user. Note: If you do not specify this information, TSM will
 *    need to intercept mouse events in the entire content region as
 *    the default, when an input method is active, in order to ensure
 *    that input methods can manage user interaction properly.
 *
 *  Parameters:
 *
 *    inTSMDocument:
 *      The document.
 *
 *    inWindow:
 *      The window that contains the inline input session. You can pass
 *      NULL for this parameter to indicate the user focus window.
 *
 *    inRegion:
 *      The region occupied by the current inline input region. This
 *      should be in the coordinates of the port associated with the
 *      window you passed to inPort. It will need to be recomputed when
 *      the text content of the inline input session content changes
 *      (i.e. due to Update Active Input Area events) and when the
 *      region moves for other reasons, such as window resized,
 *      scrolling, etc. If you pass a NULL region for this parameter,
 *      TSM will default to intercept mouse events in the focus
 *      window's content region.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TSMSetInlineInputRegion(inTSMDocument: TSMDocumentID; inWindow: WindowRef; inRegion: RgnHandle): OSStatus; external name '_TSMSetInlineInputRegion';


{ Following calls from Classic event loops not needed for Carbon clients. }

{
 *  GetScriptLanguageSupport()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetScriptLanguageSupport(ts: ComponentInstance; var scriptHdl: ScriptLanguageSupportHandle): ComponentResult; external name '_GetScriptLanguageSupport';
{
 *  InitiateTextService()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InitiateTextService(ts: ComponentInstance): ComponentResult; external name '_InitiateTextService';
{
 *  TerminateTextService()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TerminateTextService(ts: ComponentInstance): ComponentResult; external name '_TerminateTextService';
{
 *  ActivateTextService()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ActivateTextService(ts: ComponentInstance): ComponentResult; external name '_ActivateTextService';
{
 *  DeactivateTextService()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DeactivateTextService(ts: ComponentInstance): ComponentResult; external name '_DeactivateTextService';
{
 *  GetTextServiceMenu()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetTextServiceMenu(ts: ComponentInstance; var serviceMenu: MenuRef): ComponentResult; external name '_GetTextServiceMenu';
{ New Text Service call in Carbon. }
{ Note: Only Raw Key and Mouse-flavored events are passed to Text Services on MacOS X. }
{
 *  TextServiceEventRef()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TextServiceEventRef(ts: ComponentInstance; event: EventRef): ComponentResult; external name '_TextServiceEventRef';

{
 *  FixTextService()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FixTextService(ts: ComponentInstance): ComponentResult; external name '_FixTextService';
{
 *  HidePaletteWindows()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function HidePaletteWindows(ts: ComponentInstance): ComponentResult; external name '_HidePaletteWindows';
{
 *  GetTextServiceProperty()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetTextServiceProperty(ts: ComponentInstance; propertySelector: OSType; var result: SInt32): ComponentResult; external name '_GetTextServiceProperty';
{
 *  SetTextServiceProperty()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetTextServiceProperty(ts: ComponentInstance; propertySelector: OSType; value: SInt32): ComponentResult; external name '_SetTextServiceProperty';
{ Get the active TSMDocument in the current application context.       }
{ If TSM has enabled bottom line input mode because no TSMDocument     }
{ is active, NULL will be returned.                                    }
{
 *  TSMGetActiveDocument()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TSMGetActiveDocument: TSMDocumentID; external name '_TSMGetActiveDocument';


{$ALIGN MAC68K}
{#POP}
{unit ASDebugging}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}

{*************************************************************************
    Mode Flags
*************************************************************************}
{    This mode flag can be passed to OSASetProperty or OSASetHandler
    and will prevent properties or handlers from being defined in a context
    that doesn't already have bindings for them. An error is returned if
    a current binding doesn't already exist.
}

const
    kOSAModeDontDefine          = $0001;

    {   *************************************************************************
        Component Selectors
    *************************************************************************   }
    kASSelectSetPropertyObsolete = $1101;
    kASSelectGetPropertyObsolete = $1102;
    kASSelectSetHandlerObsolete = $1103;
    kASSelectGetHandlerObsolete = $1104;
    kASSelectGetAppTerminologyObsolete = $1105;
    kASSelectSetProperty        = $1106;
    kASSelectGetProperty        = $1107;
    kASSelectSetHandler         = $1108;
    kASSelectGetHandler         = $1109;
    kASSelectGetAppTerminology  = $110A;
    kASSelectGetSysTerminology  = $110B;
    kASSelectGetPropertyNames   = $110C;
    kASSelectGetHandlerNames    = $110D;

    {   *************************************************************************
        Context Accessors
    *************************************************************************   }
    {
     *  OSASetProperty()
     *
     *  Availability:
     *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function OSASetProperty(scriptingComponent: ComponentInstance; modeFlags: SInt32; contextID: OSAID; const (*var*) variableName: AEDesc; scriptValueID: OSAID): OSAError; external name '_OSASetProperty';
{
 *  OSAGetProperty()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OSAGetProperty(scriptingComponent: ComponentInstance; modeFlags: SInt32; contextID: OSAID; const (*var*) variableName: AEDesc; var resultingScriptValueID: OSAID): OSAError; external name '_OSAGetProperty';
{
 *  OSAGetPropertyNames()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OSAGetPropertyNames(scriptingComponent: ComponentInstance; modeFlags: SInt32; contextID: OSAID; var resultingPropertyNames: AEDescList): OSAError; external name '_OSAGetPropertyNames';
{
 *  OSASetHandler()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OSASetHandler(scriptingComponent: ComponentInstance; modeFlags: SInt32; contextID: OSAID; const (*var*) handlerName: AEDesc; compiledScriptID: OSAID): OSAError; external name '_OSASetHandler';
{
 *  OSAGetHandler()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OSAGetHandler(scriptingComponent: ComponentInstance; modeFlags: SInt32; contextID: OSAID; const (*var*) handlerName: AEDesc; var resultingCompiledScriptID: OSAID): OSAError; external name '_OSAGetHandler';
{
 *  OSAGetHandlerNames()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OSAGetHandlerNames(scriptingComponent: ComponentInstance; modeFlags: SInt32; contextID: OSAID; var resultingHandlerNames: AEDescList): OSAError; external name '_OSAGetHandlerNames';
{
 *  OSAGetAppTerminology()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OSAGetAppTerminology(scriptingComponent: ComponentInstance; modeFlags: SInt32; var fileSpec: FSSpec; terminologyID: SInt16; var didLaunch: boolean; var terminologyList: AEDesc): OSAError; external name '_OSAGetAppTerminology';
{ Errors:
       errOSASystemError        operation failed
    }
{
 *  OSAGetSysTerminology()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OSAGetSysTerminology(scriptingComponent: ComponentInstance; modeFlags: SInt32; terminologyID: SInt16; var terminologyList: AEDesc): OSAError; external name '_OSAGetSysTerminology';
{ Errors:
       errOSASystemError        operation failed
    }
{ Notes on terminology ID

    A terminology ID is derived from script code and language code
    as follows;

        terminologyID = ((scriptCode & 0x7F) << 8) | (langCode & 0xFF)
}
{*************************************************************************
    Obsolete versions provided for backward compatibility:
}
{
 *  ASSetProperty()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ASSetProperty(scriptingComponent: ComponentInstance; contextID: OSAID; const (*var*) variableName: AEDesc; scriptValueID: OSAID): OSAError; external name '_ASSetProperty';
{
 *  ASGetProperty()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ASGetProperty(scriptingComponent: ComponentInstance; contextID: OSAID; const (*var*) variableName: AEDesc; var resultingScriptValueID: OSAID): OSAError; external name '_ASGetProperty';
{
 *  ASSetHandler()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ASSetHandler(scriptingComponent: ComponentInstance; contextID: OSAID; const (*var*) handlerName: AEDesc; compiledScriptID: OSAID): OSAError; external name '_ASSetHandler';
{
 *  ASGetHandler()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ASGetHandler(scriptingComponent: ComponentInstance; contextID: OSAID; const (*var*) handlerName: AEDesc; var resultingCompiledScriptID: OSAID): OSAError; external name '_ASGetHandler';
{
 *  ASGetAppTerminology()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ASGetAppTerminology(scriptingComponent: ComponentInstance; var fileSpec: FSSpec; terminologID: SInt16; var didLaunch: boolean; var terminologyList: AEDesc): OSAError; external name '_ASGetAppTerminology';
{ Errors:
        errOSASystemError       operation failed
    }
{************************************************************************}


{$ALIGN MAC68K}
{#POP}
{unit Dialogs}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}


const
                                                                {  new, more standard names for dialog item types }
    kControlDialogItem          = 4;
    kButtonDialogItem           = 4;
    kCheckBoxDialogItem         = 5;
    kRadioButtonDialogItem      = 6;
    kResourceControlDialogItem  = 7;
    kStaticTextDialogItem       = 8;
    kEditTextDialogItem         = 16;
    kIconDialogItem             = 32;
    kPictureDialogItem          = 64;
    kUserDialogItem             = 0;
    kHelpDialogItem             = 1;
    kItemDisableBit             = 128;

                                                                {  old names for dialog item types }
    ctrlItem                    = 4;
    btnCtrl                     = 0;
    chkCtrl                     = 1;
    radCtrl                     = 2;
    resCtrl                     = 3;
    statText                    = 8;
    editText                    = 16;
    iconItem                    = 32;
    picItem                     = 64;
    userItem                    = 0;
    itemDisable                 = 128;

                                                                {  standard dialog item numbers }
    kStdOkItemIndex             = 1;
    kStdCancelItemIndex         = 2;                            {  old names }
    ok                          = 1;
    cancel                      = 2;

                                                                {  standard icon resource id's     }
    kStopIcon                   = 0;
    kNoteIcon                   = 1;
    kCautionIcon                = 2;                            {  old names }
    stopIcon                    = 0;
    noteIcon                    = 1;
    cautionIcon                 = 2;





    {     Dialog Item List Manipulation Constants   }

type
    DITLMethod                          = SInt16;

const
    overlayDITL                 = 0;
    appendDITLRight             = 1;
    appendDITLBottom            = 2;


type
    StageList                           = SInt16;
    {  DialogPtr is obsolete. Use DialogRef instead. }
    DialogRef                           = DialogPtr;

    DialogTemplatePtr = ^DialogTemplate;
    DialogTemplate = record
        boundsRect:             Rect;
        procID:                 SInt16;
        visible:                boolean;
        filler1:                boolean;
        goAwayFlag:             boolean;
        filler2:                boolean;
        refCon:                 SInt32;
        itemsID:                SInt16;
        title:                  Str255;
    end;

    DialogTPtr                          = ^DialogTemplate;
    DialogTHndl                         = ^DialogTPtr;
    AlertTemplatePtr = ^AlertTemplate;
    AlertTemplate = record
        boundsRect:             Rect;
        itemsID:                SInt16;
        stages:                 StageList;
    end;

    AlertTPtr                           = ^AlertTemplate;
    AlertTHndl                          = ^AlertTPtr;
    {    new type abstractions for the dialog manager   }
    DialogItemIndexZeroBased            = SInt16;
    DialogItemIndex                     = SInt16;
    DialogItemType                      = SInt16;
    {    dialog manager callbacks   }
    SoundProcPtr = procedure(soundNumber: SInt16);

    ModalFilterProcPtr = function(theDialog: DialogRef; var theEvent: EventRecord; var itemHit: DialogItemIndex): boolean;

    {    ModalFilterYDProcPtr was previously in StandardFile.h  }
    ModalFilterYDProcPtr = function(theDialog: DialogRef; var theEvent: EventRecord; var itemHit: SInt16; yourDataPtr: UnivPtr): boolean;

    UserItemProcPtr = procedure(theDialog: DialogRef; itemNo: DialogItemIndex);

    SoundUPP = ^SInt32; { an opaque UPP }
    ModalFilterUPP = ^SInt32; { an opaque UPP }
    ModalFilterYDUPP = ^SInt32; { an opaque UPP }
    UserItemUPP = ^SInt32; { an opaque UPP }

const
    uppSoundProcInfo = $00000080;
    uppModalFilterProcInfo = $00000FD0;
    uppModalFilterYDProcInfo = $00003FD0;
    uppUserItemProcInfo = $000002C0;

{
 *  NewModalFilterUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewModalFilterUPP(userRoutine: ModalFilterProcPtr): ModalFilterUPP; external name '_NewModalFilterUPP'; { old name was NewModalFilterProc }
{
 *  NewModalFilterYDUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewModalFilterYDUPP(userRoutine: ModalFilterYDProcPtr): ModalFilterYDUPP; external name '_NewModalFilterYDUPP'; { old name was NewModalFilterYDProc }
{
 *  NewUserItemUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewUserItemUPP(userRoutine: UserItemProcPtr): UserItemUPP; external name '_NewUserItemUPP'; { old name was NewUserItemProc }

{
 *  DisposeModalFilterUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeModalFilterUPP(userUPP: ModalFilterUPP); external name '_DisposeModalFilterUPP';
{
 *  DisposeModalFilterYDUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeModalFilterYDUPP(userUPP: ModalFilterYDUPP); external name '_DisposeModalFilterYDUPP';
{
 *  DisposeUserItemUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeUserItemUPP(userUPP: UserItemUPP); external name '_DisposeUserItemUPP';

{
 *  InvokeModalFilterUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeModalFilterUPP(theDialog: DialogRef; var theEvent: EventRecord; var itemHit: DialogItemIndex; userRoutine: ModalFilterUPP): boolean; external name '_InvokeModalFilterUPP'; { old name was CallModalFilterProc }
{
 *  InvokeModalFilterYDUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeModalFilterYDUPP(theDialog: DialogRef; var theEvent: EventRecord; var itemHit: SInt16; yourDataPtr: UnivPtr; userRoutine: ModalFilterYDUPP): boolean; external name '_InvokeModalFilterYDUPP'; { old name was CallModalFilterYDProc }
{
 *  InvokeUserItemUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvokeUserItemUPP(theDialog: DialogRef; itemNo: DialogItemIndex; userRoutine: UserItemUPP); external name '_InvokeUserItemUPP'; { old name was CallUserItemProc }

{
  ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
    ¥ Following types are valid with Appearance 1.0 and later
  ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
}

const
                                                                {  Alert types to pass into StandardAlert  }
    kAlertStopAlert             = 0;
    kAlertNoteAlert             = 1;
    kAlertCautionAlert          = 2;
    kAlertPlainAlert            = 3;


type
    AlertType                           = SInt16;

const
    kAlertDefaultOKText         = -1;                           {  "OK" }
    kAlertDefaultCancelText     = -1;                           {  "Cancel" }
    kAlertDefaultOtherText      = -1;                           {  "Don't Save" }

    {    StandardAlert alert button numbers     }
    kAlertStdAlertOKButton      = 1;
    kAlertStdAlertCancelButton  = 2;
    kAlertStdAlertOtherButton   = 3;
    kAlertStdAlertHelpButton    = 4;

                                                                {  Dialog Flags for use in NewFeaturesDialog or dlgx resource  }
    kDialogFlagsUseThemeBackground = $01;
    kDialogFlagsUseControlHierarchy = $02;
    kDialogFlagsHandleMovableModal = $04;
    kDialogFlagsUseThemeControls = $08;

                                                                {  Alert Flags for use in alrx resource  }
    kAlertFlagsUseThemeBackground = $01;
    kAlertFlagsUseControlHierarchy = $02;
    kAlertFlagsAlertIsMovable   = $04;
    kAlertFlagsUseThemeControls = $08;

    {    For dftb resource  }
    kDialogFontNoFontStyle      = 0;
    kDialogFontUseFontMask      = $0001;
    kDialogFontUseFaceMask      = $0002;
    kDialogFontUseSizeMask      = $0004;
    kDialogFontUseForeColorMask = $0008;
    kDialogFontUseBackColorMask = $0010;
    kDialogFontUseModeMask      = $0020;
    kDialogFontUseJustMask      = $0040;
    kDialogFontUseAllMask       = $00FF;
    kDialogFontAddFontSizeMask  = $0100;
    kDialogFontUseFontNameMask  = $0200;
    kDialogFontAddToMetaFontMask = $0400;

    {    Also for dftb resource. This one is available in Mac OS X or later.    }
    {    It corresponds directly to kControlUseThemeFontIDMask from Controls.h.     }
    kDialogFontUseThemeFontIDMask = $0080;


type
    AlertStdAlertParamRecPtr = ^AlertStdAlertParamRec;
    AlertStdAlertParamRec = record
        movable:                boolean;                                {  Make alert movable modal  }
        helpButton:             boolean;                                {  Is there a help button?  }
        filterProc:             ModalFilterUPP;                         {  Event filter  }
        defaultText:            ConstStringPtr;                         {  Text for button in OK position  }
        cancelText:             ConstStringPtr;                         {  Text for button in cancel position  }
        otherText:              ConstStringPtr;                         {  Text for button in left position  }
        defaultButton:          SInt16;                                 {  Which button behaves as the default  }
        cancelButton:           SInt16;                                 {  Which one behaves as cancel (can be 0)  }
        position:               UInt16;                                 {  Position (kWindowDefaultPosition in this case  }
                                                                        {  equals kWindowAlertPositionParentWindowScreen)  }
    end;

    AlertStdAlertParamPtr               = ^AlertStdAlertParamRec;

const
    kHICommandOther             = $6F746872 (* 'othr' *);                       {  sent by standard sheet dialogs when the "other" button is pressed  }

    kStdCFStringAlertVersionOne = 1;                            {  current version of AlertStdCFStringAlertParamRec  }


    {
     *  Summary:
     *    Flags to CreateStandardAlert that are specified in the
     *    AlertStdCFStringAlertParamRec.flags field.
        }
    kStdAlertDoNotDisposeSheet  = $01;
    kStdAlertDoNotAnimateOnDefault = $02;
    kStdAlertDoNotAnimateOnCancel = $04;
    kStdAlertDoNotAnimateOnOther = $08;


type
    AlertStdCFStringAlertParamRecPtr = ^AlertStdCFStringAlertParamRec;
    AlertStdCFStringAlertParamRec = record
        version:                UInt32;                                 {  kStdCFStringAlertVersionOne  }
        movable:                boolean;                                {  Make alert movable modal  }
        helpButton:             boolean;                                {  Is there a help button?  }
        defaultText:            CFStringRef;                            {  Text for button in OK position  }
        cancelText:             CFStringRef;                            {  Text for button in cancel position  }
        otherText:              CFStringRef;                            {  Text for button in left position  }
        defaultButton:          SInt16;                                 {  Which button behaves as the default  }
        cancelButton:           SInt16;                                 {  Which one behaves as cancel (can be 0)  }
        position:               UInt16;                                 {  Position (kWindowDefaultPosition in this case  }
                                                                        {  equals kWindowAlertPositionParentWindowScreen)  }
        flags:                  OptionBits;                             {  Options for the behavior of the alert or sheet  }
    end;

    AlertStdCFStringAlertParamPtr       = ^AlertStdCFStringAlertParamRec;
    {  ÑÑÑ end Appearance 1.0 or later stuff }


    {
        NOTE: Code running under MultiFinder or System 7.0 or newer
        should always pass NULL to InitDialogs.
        }

{
 *  NewDialog()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewDialog(dStorage: UnivPtr; const (*var*) boundsRect: Rect; const (*var*) title: Str255; visible: boolean; procID: SInt16; behind: WindowRef; goAwayFlag: boolean; refCon: SInt32; items: Handle): DialogRef; external name '_NewDialog';
{
 *  GetNewDialog()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetNewDialog(dialogID: SInt16; dStorage: UnivPtr; behind: WindowRef): DialogRef; external name '_GetNewDialog';
{
 *  NewColorDialog()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewColorDialog(dStorage: UnivPtr; const (*var*) boundsRect: Rect; const (*var*) title: Str255; visible: boolean; procID: SInt16; behind: WindowRef; goAwayFlag: boolean; refCon: SInt32; items: Handle): DialogRef; external name '_NewColorDialog';

{
 *  DisposeDialog()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeDialog(theDialog: DialogRef); external name '_DisposeDialog';
{
 *  ModalDialog()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure ModalDialog(modalFilter: ModalFilterUPP; var itemHit: DialogItemIndex); external name '_ModalDialog';
{
 *  IsDialogEvent()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function IsDialogEvent(const (*var*) theEvent: EventRecord): boolean; external name '_IsDialogEvent';
{
 *  DialogSelect()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DialogSelect(const (*var*) theEvent: EventRecord; var theDialog: DialogRef; var itemHit: DialogItemIndex): boolean; external name '_DialogSelect';
{
 *  DrawDialog()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DrawDialog(theDialog: DialogRef); external name '_DrawDialog';
{
 *  UpdateDialog()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure UpdateDialog(theDialog: DialogRef; updateRgn: RgnHandle); external name '_UpdateDialog';
{
 *  HideDialogItem()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure HideDialogItem(theDialog: DialogRef; itemNo: DialogItemIndex); external name '_HideDialogItem';
{
 *  ShowDialogItem()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure ShowDialogItem(theDialog: DialogRef; itemNo: DialogItemIndex); external name '_ShowDialogItem';
{
 *  FindDialogItem()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function FindDialogItem(theDialog: DialogRef; thePt: Point): DialogItemIndexZeroBased; external name '_FindDialogItem';
{
 *  DialogCut()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DialogCut(theDialog: DialogRef); external name '_DialogCut';

{
 *  DialogPaste()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DialogPaste(theDialog: DialogRef); external name '_DialogPaste';

{
 *  DialogCopy()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DialogCopy(theDialog: DialogRef); external name '_DialogCopy';

{
 *  DialogDelete()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DialogDelete(theDialog: DialogRef); external name '_DialogDelete';

{
 *  Alert()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function Alert(alertID: SInt16; modalFilter: ModalFilterUPP): DialogItemIndex; external name '_Alert';
{
 *  StopAlert()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function StopAlert(alertID: SInt16; modalFilter: ModalFilterUPP): DialogItemIndex; external name '_StopAlert';
{
 *  NoteAlert()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NoteAlert(alertID: SInt16; modalFilter: ModalFilterUPP): DialogItemIndex; external name '_NoteAlert';
{
 *  CautionAlert()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CautionAlert(alertID: SInt16; modalFilter: ModalFilterUPP): DialogItemIndex; external name '_CautionAlert';
{
 *  GetDialogItem()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure GetDialogItem(theDialog: DialogRef; itemNo: DialogItemIndex; var itemType: DialogItemType; var item: Handle; var box: Rect); external name '_GetDialogItem';
{
 *  SetDialogItem()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetDialogItem(theDialog: DialogRef; itemNo: DialogItemIndex; itemType: DialogItemType; item: Handle; const (*var*) box: Rect); external name '_SetDialogItem';
{
 *  ParamText()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure ParamText(const (*var*) param0: Str255; const (*var*) param1: Str255; const (*var*) param2: Str255; const (*var*) param3: Str255); external name '_ParamText';
{
 *  SelectDialogItemText()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SelectDialogItemText(theDialog: DialogRef; itemNo: DialogItemIndex; strtSel: SInt16; endSel: SInt16); external name '_SelectDialogItemText';
{
 *  GetDialogItemText()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure GetDialogItemText(item: Handle; var text: Str255); external name '_GetDialogItemText';
{
 *  SetDialogItemText()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetDialogItemText(item: Handle; const (*var*) text: Str255); external name '_SetDialogItemText';
{
 *  GetAlertStage()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetAlertStage: SInt16; external name '_GetAlertStage';
{
 *  SetDialogFont()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetDialogFont(fontNum: SInt16); external name '_SetDialogFont';
{
 *  ResetAlertStage()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure ResetAlertStage; external name '_ResetAlertStage';
{  APIs in Carbon }
{
 *  GetParamText()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure GetParamText(param0: StringPtr; param1: StringPtr; param2: StringPtr; param3: StringPtr); external name '_GetParamText';


{
 *  AppendDITL()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure AppendDITL(theDialog: DialogRef; theHandle: Handle; method: DITLMethod); external name '_AppendDITL';

{
 *  CountDITL()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CountDITL(theDialog: DialogRef): DialogItemIndex; external name '_CountDITL';

{
 *  ShortenDITL()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure ShortenDITL(theDialog: DialogRef; numberItems: DialogItemIndex); external name '_ShortenDITL';

{
 *  InsertDialogItem()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InsertDialogItem(theDialog: DialogRef; afterItem: DialogItemIndex; itemType: DialogItemType; itemHandle: Handle; const (*var*) box: Rect): OSStatus; external name '_InsertDialogItem';

{
 *  RemoveDialogItems()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function RemoveDialogItems(theDialog: DialogRef; itemNo: DialogItemIndex; amountToRemove: DialogItemIndex; disposeItemData: boolean): OSStatus; external name '_RemoveDialogItems';

{
 *  StdFilterProc()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function StdFilterProc(theDialog: DialogRef; var event: EventRecord; var itemHit: DialogItemIndex): boolean; external name '_StdFilterProc';

{
 *  GetStdFilterProc()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetStdFilterProc(var theProc: ModalFilterUPP): OSErr; external name '_GetStdFilterProc';
{
 *  SetDialogDefaultItem()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetDialogDefaultItem(theDialog: DialogRef; newItem: DialogItemIndex): OSErr; external name '_SetDialogDefaultItem';
{
 *  SetDialogCancelItem()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetDialogCancelItem(theDialog: DialogRef; newItem: DialogItemIndex): OSErr; external name '_SetDialogCancelItem';
{
 *  SetDialogTracksCursor()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetDialogTracksCursor(theDialog: DialogRef; tracks: boolean): OSErr; external name '_SetDialogTracksCursor';
{
  ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
    ¥ Appearance Dialog Routines (available only with Appearance 1.0 and later)
  ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
}

{
 *  NewFeaturesDialog()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewFeaturesDialog(inStorage: UnivPtr; const (*var*) inBoundsRect: Rect; const (*var*) inTitle: Str255; inIsVisible: boolean; inProcID: SInt16; inBehind: WindowRef; inGoAwayFlag: boolean; inRefCon: SInt32; inItemListHandle: Handle; inFlags: UInt32): DialogRef; external name '_NewFeaturesDialog';
{
 *  AutoSizeDialog()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function AutoSizeDialog(inDialog: DialogRef): OSErr; external name '_AutoSizeDialog';
{
    Regarding StandardAlert and constness:
    Even though the inAlertParam parameter is marked const here, there was
    a chance Dialog Manager would modify it on versions of Mac OS prior to 9.
}
{
 *  StandardAlert()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function StandardAlert(inAlertType: AlertType; const (*var*) inError: Str255; const (*var*) inExplanation: Str255; inAlertParam: {Const}AlertStdAlertParamRecPtr; var outItemHit: SInt16): OSErr; external name '_StandardAlert';
{  CFString-based StandardAlert and StandardSheet APIs are only available on Mac OS X and later }

{
 *  GetStandardAlertDefaultParams()
 *
 *  Summary:
 *    Fills out an AlertStdCFStringAlertParamRec with default values: -
 *      not movable -   no help button -   default button with title
 *    kAlertDefaultOKText, meaning "OK" -   no cancel or other buttons
 *
 *  Parameters:
 *
 *    param:
 *      The parameter block to initialize.
 *
 *    version:
 *      The parameter block version; pass kStdCFStringAlertVersionOne.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetStandardAlertDefaultParams(param: AlertStdCFStringAlertParamPtr; version: UInt32): OSStatus; external name '_GetStandardAlertDefaultParams';

{
 *  CreateStandardAlert()
 *
 *  Summary:
 *    Creates an alert containing standard elements and using standard
 *    formatting rules.
 *
 *  Discussion:
 *    CreateStandardAlert should be used in conjunction with
 *    RunStandardAlert. After CreateStandardAlert returns, the alert is
 *    still invisible. RunStandardAlert will show the alert and run a
 *    modal dialog loop to process events in the alert. The strings
 *    passed to this API in the error, explanation, and
 *    AlertStdCFStringAlertParamRec button title parameters will all be
 *    retained during the creation of the alert, and released when the
 *    alert is disposed by RunStandardAlert. There is no net change to
 *    the refcount of these strings across CreateStandardAlert and
 *    RunStandardAlert.
 *
 *  Parameters:
 *
 *    alertType:
 *      The type of alert to create.
 *
 *    error:
 *      The error string to display. CreateStandardAlert increments the
 *      refcount on this string, so you may release it after
 *      CreateStandardAlert returns if you don't need it later.
 *
 *    explanation:
 *      The explanation string to display. May be NULL or empty to
 *      display no explanation. CreateStandardAlert increments the
 *      refcount on this string, so you may release it after
 *      CreateStandardAlert returns if you don't need it later.
 *
 *    param:
 *      The parameter block describing how to create the alert. May be
 *      NULL. CreateStandardAlert increments the refcount on the button
 *      title strings in the parameter block, so you may release them
 *      after CreateStandardAlert returns if you don't need them later.
 *
 *    outAlert:
 *      On exit, contains the new alert.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CreateStandardAlert(alertType: AlertType; error: CFStringRef; explanation: CFStringRef; param: {Const}AlertStdCFStringAlertParamRecPtr; var outAlert: DialogRef): OSStatus; external name '_CreateStandardAlert';

{
 *  RunStandardAlert()
 *
 *  Summary:
 *    Shows, runs, and destroys a standard alert using a modal dialog
 *    loop.
 *
 *  Discussion:
 *    RunStandardAlert displays and runs an alert created by
 *    CreateStandardAlert. It handles all user interaction with the
 *    alert. After the user has dismissed the alert, RunStandardAlert
 *    destroys the alert dialog; the DialogRef will be invalid after
 *    RunStandardAlert returns.
 *
 *  Parameters:
 *
 *    inAlert:
 *      The alert to display.
 *
 *    filterProc:
 *      An event filter function for handling events that do not apply
 *      to the alert. May be NULL.
 *
 *    outItemHit:
 *      On exit, contains the item index of the button that was pressed
 *      to close the alert.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function RunStandardAlert(inAlert: DialogRef; filterProc: ModalFilterUPP; var outItemHit: DialogItemIndex): OSStatus; external name '_RunStandardAlert';

{
 *  CreateStandardSheet()
 *
 *  Summary:
 *    Creates an alert containing standard elements and using standard
 *    formatting rules, and prepares it to be displayed as a sheet.
 *
 *  Discussion:
 *    CreateStandardSheet should be used in conjunction with
 *    ShowSheetWindow. After CreateStandardSheet returns, the alert is
 *    still invisible. ShowSheetWindow will show the alert and then
 *    return. Events in the sheet are handled asynchronously; the
 *    application should be prepared for the sheet window to be part of
 *    its windowlist while running its own event loop. When a button in
 *    the sheet is pressed, the EventTargetRef passed to
 *    CreateStandardSheet will receive a command event with one of the
 *    command IDs kHICommandOK, kHICommandCancel, or kHICommandOther.
 *    The sheet is closed before the command is sent. The strings
 *    passed to this API in the error, explanation, and
 *    AlertStdCFStringAlertParamRec button title parameters will all be
 *    retained during the creation of the sheet, and released when the
 *    sheet is disposed. There is no net change to the refcount of
 *    these strings across CreateStandardSheet and sheet destruction.
 *
 *  Parameters:
 *
 *    alertType:
 *      The type of alert to create.
 *
 *    error:
 *      The error string to display. CreateStandardSheet increments the
 *      refcount on this string, so you may release it after
 *      CreateStandardSheet returns if you don't need it later.
 *
 *    explanation:
 *      The explanation string to display. May be NULL or empty to
 *      display no explanation. CreateStandardSheet increments the
 *      refcount on this string, so you may release it after
 *      CreateStandardSheet returns if you don't need it later.
 *
 *    param:
 *      The parameter block describing how to create the alert. May be
 *      NULL. CreateStandardSheet increments the refcount on the button
 *      title strings in the parameter block, so you may release them
 *      after CreateStandardSheet returns if you don't need them later.
 *
 *    notifyTarget:
 *      The event target to be notified when the sheet is closed. The
 *      caller should install an event handler on this target for the
 *      [kEventClassCommand, kEventProcessCommand] event.
 *
 *    outSheet:
 *      On exit, contains the new alert.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CreateStandardSheet(alertType: AlertType; error: CFStringRef; explanation: CFStringRef; param: {Const}AlertStdCFStringAlertParamRecPtr; notifyTarget: EventTargetRef; var outSheet: DialogRef): OSStatus; external name '_CreateStandardSheet';

{
 *  CloseStandardSheet()
 *
 *  Summary:
 *    Closes a standard sheet dialog and releases the dialog data
 *    structures.
 *
 *  Discussion:
 *    CloseStandardSheet is meant to be used when you need to remove a
 *    sheet because of a higher-priority request to close the sheet's
 *    document window. For example, you might have a Save Changes sheet
 *    open on a document window. Meanwhile, the user drags the document
 *    into the trash. When your application sees that the document has
 *    been moved to the trash, it knows that it should close the
 *    document window, but first it needs to close the sheet.
 *    CloseStandardSheet should not be used by your Carbon event
 *    handler in response to a click in one of the sheet buttons; the
 *    Dialog Manager will close the sheet automatically in that case.
 *    If kStdAlertDoNotDisposeSheet was specified when the sheet was
 *    created, the sheet dialog will be hidden but not released, and
 *    you can reuse the sheet later.
 *
 *  Parameters:
 *
 *    inSheet:
 *      The sheet to close.
 *
 *    inResultCommand:
 *      This command, if not zero, will be sent to the EventTarget
 *      specified when the sheet was created.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CloseStandardSheet(inSheet: DialogRef; inResultCommand: UInt32): OSStatus; external name '_CloseStandardSheet';

{
 *  GetDialogItemAsControl()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetDialogItemAsControl(inDialog: DialogRef; inItemNo: SInt16; var outControl: ControlRef): OSErr; external name '_GetDialogItemAsControl';
{
 *  MoveDialogItem()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function MoveDialogItem(inDialog: DialogRef; inItemNo: SInt16; inHoriz: SInt16; inVert: SInt16): OSErr; external name '_MoveDialogItem';
{
 *  SizeDialogItem()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SizeDialogItem(inDialog: DialogRef; inItemNo: SInt16; inWidth: SInt16; inHeight: SInt16): OSErr; external name '_SizeDialogItem';
{
 *  AppendDialogItemList()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DialogsLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function AppendDialogItemList(dialog: DialogRef; ditlID: SInt16; method: DITLMethod): OSErr; external name '_AppendDialogItemList';
{
  ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
    ¥ Dialog Routines available only with Appearance 1.1 (Mac OS 8.5) and later
  ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
}

{
 *  SetDialogTimeout()
 *
 *  Summary:
 *    Sets the timeout for a modal dialog.
 *
 *  Discussion:
 *    SetDialogTimeout sets the delay after which a dialog will be
 *    automatically dismissed. When SetDialogTimeout is called, the
 *    Dialog Manager takes the current time, adds the timeout to it,
 *    and stores the result as the time to dismiss the dialog. If the
 *    dismissal time is reached, the dialog is automatically closed and
 *    the specified dialog item index is returned from ModalDialog in
 *    the itemHit parameter. If the user moves the mouse or presses a
 *    key, the dismissal time is reset by adding the original timeout
 *    to the time of the event. Only the ModalDialog API observes the
 *    timeout value; if you are handling events in a modeless dialog or
 *    sheet using IsDialogEvent and DialogSelect, the timeout will be
 *    ignored.
 *
 *  Parameters:
 *
 *    inDialog:
 *      The dialog on which to set a timeout.
 *
 *    inButtonToPress:
 *      The dialog item index that should be returned from ModalDialog
 *      when the timeout expires.
 *
 *    inSecondsToWait:
 *      The time to wait before dismissing the dialog, in seconds.
 *
 *  Result:
 *    An operating system result code.
 *
 *  Availability:
 *    Non-Carbon CFM:   in DialogsLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetDialogTimeout(inDialog: DialogRef; inButtonToPress: SInt16; inSecondsToWait: UInt32): OSStatus; external name '_SetDialogTimeout';

{
 *  GetDialogTimeout()
 *
 *  Summary:
 *    Retrieves the timeout for a modal dialog.
 *
 *  Parameters:
 *
 *    inDialog:
 *      The dialog from which to retrieve the timeout.
 *
 *    outButtonToPress:
 *      On exit, contains the dialog item index that should be returned
 *      from ModalDialog when the dialog is dismissed. May be NULL if
 *      you do not need this information.
 *
 *    outSecondsToWait:
 *      On exit, contains the time to wait before dismissing the
 *      dialog, in seconds. May be NULL if you do not need this
 *      information.
 *
 *    outSecondsRemaining:
 *      On exit, contains the time until the dialog is dismissed, in
 *      seconds. May be NULL if you do not need this information.
 *
 *  Result:
 *    An operating system result code. Returns dialogNoTimeoutErr if no
 *    timeout has been set for this dialog.
 *
 *  Availability:
 *    Non-Carbon CFM:   in DialogsLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetDialogTimeout(inDialog: DialogRef; outButtonToPress: SInt16Ptr; outSecondsToWait: UInt32Ptr; outSecondsRemaining: UInt32Ptr): OSStatus; external name '_GetDialogTimeout';

{
 *  SetModalDialogEventMask()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DialogsLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetModalDialogEventMask(inDialog: DialogRef; inMask: EventMask): OSStatus; external name '_SetModalDialogEventMask';

{
 *  GetModalDialogEventMask()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DialogsLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetModalDialogEventMask(inDialog: DialogRef; var outMask: EventMask): OSStatus; external name '_GetModalDialogEventMask';



{
  ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
    ¥ Accessor functions
  ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
}


{
 *  GetDialogWindow()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later or as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetDialogWindow(dialog: DialogRef): WindowRef; external name '_GetDialogWindow';


{
 *  GetDialogTextEditHandle()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later or as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetDialogTextEditHandle(dialog: DialogRef): TEHandle; external name '_GetDialogTextEditHandle';


{
 *  GetDialogDefaultItem()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later or as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetDialogDefaultItem(dialog: DialogRef): SInt16; external name '_GetDialogDefaultItem';


{
 *  GetDialogCancelItem()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later or as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetDialogCancelItem(dialog: DialogRef): SInt16; external name '_GetDialogCancelItem';


{
 *  GetDialogKeyboardFocusItem()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later or as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetDialogKeyboardFocusItem(dialog: DialogRef): SInt16; external name '_GetDialogKeyboardFocusItem';


{
 *  SetPortDialogPort()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later or as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetPortDialogPort(dialog: DialogRef); external name '_SetPortDialogPort';


{
 *  GetDialogPort()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later or as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetDialogPort(dialog: DialogRef): CGrafPtr; external name '_GetDialogPort';


{
 *  GetDialogFromWindow()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later or as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetDialogFromWindow(window: WindowRef): DialogRef; external name '_GetDialogFromWindow';















{$ALIGN MAC68K}
{#POP}
{unit HITheme}
{$ALIGN MAC68K}






{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}

{ -------------------------------------------------------------------------- }
{  HIThemeOrientation information                                            }
{ -------------------------------------------------------------------------- }

const

  {
   * The passed context has an origin at the top left. This is the
   * default of a context passed to you by HIToolbox.
   }
  kHIThemeOrientationNormal     = 0;

  {
   * The passed context has an origin at the bottom left. This is the
   * default for a context you create.
   }
  kHIThemeOrientationInverted   = 1;

type HIThemeOrientation = UInt32;
{ -------------------------------------------------------------------------- }
{  Splitter types                                                            }
{ -------------------------------------------------------------------------- }

const

  {
   * Draw the splitter with its normal appearance.
   }
  kHIThemeSplitterAdornmentNone = 0;

  {
   * Draw the splitter with its metal appearance.
   }
  kHIThemeSplitterAdornmentMetal = 1;

type HIThemeSplitterAdornment = UInt32;
{ -------------------------------------------------------------------------- }
{  Window Grow Box                                                           }
{ -------------------------------------------------------------------------- }

const

  {
   * The grow box corner for a window that has no scroll bars.
   }
  kHIThemeGrowBoxKindNormal     = 0;

  {
   * The grow box corner for a window that has no grow box. This sounds
   * paradoxical, but this type of grow box, formerly known as the
   * "NoGrowBox" is used to fill in the corner left blank by the
   * intersection of a horizontal and a vertical scroll bar.
   }
  kHIThemeGrowBoxKindNone       = 1;

type HIThemeGrowBoxKind = UInt32;

const

  {
   * Draw the grow box for normal windows.
   }
  kHIThemeGrowBoxSizeNormal     = 0;

  {
   * Draw the smaller grow box for utility or floating windows.
   }
  kHIThemeGrowBoxSizeSmall      = 1;

type HIThemeGrowBoxSize = UInt32;
{ -------------------------------------------------------------------------- }
{  Tab Drawing size                                                          }
{ -------------------------------------------------------------------------- }

const

  {
   * No tab adornments are to be drawn.
   }
  kHIThemeTabAdornmentNone      = 0;

  {
   * A focus ring is to be drawn around the tab.
   }
  kHIThemeTabAdornmentFocus     = (1 shl 2); { to match button focus adornment }

type HIThemeTabAdornment = UInt32;

{
 *  Summary:
 *    These values are similar to kControlSize constants for
 *    convenience.
 }
const

  {
   * The tabs are normal (large) sized.
   }
  kHIThemeTabSizeNormal         = 0;

  {
   * The tabs are drawn as the small variant.
   }
  kHIThemeTabSizeSmall          = 1;

  {
   * The tabs are drawn as the mini variant.
   }
  kHIThemeTabSizeMini           = 3;

type HIThemeTabSize = UInt32;

const

  {
   * The group box is drawn with the primary variant.
   }
  kHIThemeGroupBoxKindPrimary   = 0;

  {
   * The group box is drawn with the secondary variant.
   }
  kHIThemeGroupBoxKindSecondary = 1;

  {
   * The group box is drawn with the primary variant. This group box
   * draws opaque. This does not match the Mac OS X 10.3 appearance
   * 100%, as the boxes should be transparent, but draws this way for
   * the sake of compatibility. Please update to use the newer
   * transparent variant.
   }
  kHIThemeGroupBoxKindPrimaryOpaque = 3;

  {
   * The group box is drawn with the secondary variant. This group box
   * draws opaque. This does not match the Mac OS X 10.3 appearance
   * 100%, as the boxes should be transparent, but draws this way for
   * the sake of compatibility. Please update to use the newer
   * transparent variant.
   }
  kHIThemeGroupBoxKindSecondaryOpaque = 4;

type HIThemeGroupBoxKind = UInt32;

const

  {
   * A header drawn above window content that has no top border of its
   * own. (i.e. the same as the status bar in an icon view Finder
   * window).
   }
  kHIThemeHeaderKindWindow      = 0;

  {
   * A header drawn above window content that has a top border of its
   * own. (i.e. the same as the status bar in an list view Finder
   * window).
   }
  kHIThemeHeaderKindList        = 1;

type HIThemeHeaderKind = UInt32;

const

  {
   * The default sized square text field (like Edit Text).
   }
  kHIThemeFrameTextFieldSquare  = 0;
  kHIThemeFrameListBox          = 1;

type HIThemeFrameKind = UInt32;

const

  {
   * Indicates that a menu title should be drawn in a condensed
   * appearance. This constant is used in the
   * HIThemeMenuTitleDrawInfo.attributes field.
   }
  kHIThemeMenuTitleDrawCondensed = 1 shl 0;

{ -------------------------------------------------------------------------- }
{  DrawInfo                                                                  }
{ -------------------------------------------------------------------------- }

{
 *  HIScrollBarTrackInfo
 *
 *  Summary:
 *    Drawing parameters passed to scroll bar drawing and measuring
 *    theme APIs.
 *
 *  Discussion:
 *    New in Mac OS X 10.3.
 }
type
    HIScrollBarTrackInfo = record

  {
   * The version of this data structure.  Currently, it is always 0.
   }
        version: UInt32;

  {
   * The ThemeTrackEnableState for the scroll bar to be drawn.
   }
        enableState: ThemeTrackEnableState;

  {
   * The ThemeTrackPressState for the scroll bar to be drawn.
   }
        pressState: ThemeTrackPressState;

  {
   * The view range size.
   }
        viewsize: Float32;
    end;
    HIScrollBarTrackInfoPtr = ^HIScrollBarTrackInfo;

{
 *  HIThemeTrackDrawInfo
 *
 *  Summary:
 *    Drawing parameters passed to track drawing and measuring theme
 *    APIs.
 *
 *  Discussion:
 *    New in Mac OS X 10.3, but based on legacy TrackDrawInfo.
 }
type
    HIThemeTrackDrawInfo = record

  {
   * The version of this data structure.  Currently, it is always 0.
   }
        version: UInt32;                { current version is 0 }

  {
   * The ThemeTrackKind of the track being drawn or measured.
   }
        kind: ThemeTrackKind;                   { what kind of track this info is for }

  {
   * An HIRect describing the bounds of the button being drawn or
   * measured.
   }
        bounds: HIRect;                 { track basis rectangle }

  {
   * The minimum allowable value for the track being drawn or measured.
   }
        min: SInt32;                    { min track value }

  {
   * The maximum allowable value for the track being drawn or measured.
   }
        max: SInt32;                    { max track value }

  {
   * The value for the track being drawn or measured.
   }
        value: SInt32;                  { current thumb value }

  {
   * Leave this reserved field set to 0.
   }
        reserved: UInt32;


  {
   * A set of ThemeTrackAttributes for the track to be drawn or
   * measured.
   }
        attributes: ThemeTrackAttributes;           { various track attributes }

  {
   * A ThemeTrackEnableState describing the state of the track to be
   * drawn or measured.
   }
        enableState: ThemeTrackEnableState;         { enable state }

  {
   * Leave this reserved field set to 0.
   }
        filler1: UInt8;

    case SInt16 of
        0: (
            scrollbar: ScrollBarTrackInfo;
           );
        1: (
            slider: SliderTrackInfo;
            );
        2: (
            progress: ProgressTrackInfo;
            );
    end;
    HIThemeTrackDrawInfoPtr = ^HIThemeTrackDrawInfo;

{
 *  HIThemeAnimationTimeInfo
 *
 *  Summary:
 *    Time parameters passed to button drawing and measuring theme APIs.
 *
 *  Discussion:
 *    New in Mac OS X 10.3.
 }
type
    HIThemeAnimationTimeInfo = record

  {
   * The CFAbsoluteTime of the beginning of the animation of the
   * button.  This only applies to buttons that animate -- currently
   * only kThemePushButton.  All other buttons will ignore this field.
   * If there is to be no animation, set this field to 0.
   }
        start: CFAbsoluteTime;

  {
   * The CFAbsoluteTime of the current animation frame of the button.
   * This only applies to buttons that animate -- currently only
   * kThemePushButton.  All other buttons will ignore this field.  If
   * there is to be no animation, set this field to 0.
   }
        current: CFAbsoluteTime;
    end;
    HIThemeAnimationTimeInfoPtr = ^HIThemeAnimationTimeInfo;

{
 *  HIThemeAnimationFrameInfo
 *
 *  Summary:
 *    Frame parameters passed to button drawing and measuring theme
 *    APIs.
 *
 *  Discussion:
 *    New in Mac OS X 10.3.
 }
type
    HIThemeAnimationFrameInfo = record

  {
   * The index of the frame of the animation to draw. If the index is
   * greater that the maximum number of animation frames, it will be
   * modded to calculate which frame to draw.
   }
        index: UInt32;
    end;
    HIThemeAnimationFrameInfoPtr = ^HIThemeAnimationFrameInfo;

{
 *  HIThemeButtonDrawInfo
 *
 *  Summary:
 *    Drawing parameters passed to button drawing and measuring theme
 *    APIs.
 *
 *  Discussion:
 *    New in Mac OS X 10.3.
 }
type
    HIThemeButtonDrawInfo = record

  {
   * The version of this data structure.  Currently, it is always 0.
   }
        version: UInt32;

  {
   * The ThemeDrawState of the button being drawn or measured.
   }
        state: ThemeDrawState;

  {
   * A ThemeButtonKind indicating the type of button to be drawn.
   }
        kind: ThemeButtonKind;

  {
   * The ThemeButtonValue of the button being drawn or measured.
   }
        value: ThemeButtonValue;

  {
   * The ThemeButtonAdornment(s) with which the button is being drawn
   * or measured.
   }
        adornment: ThemeButtonAdornment;
    case SInt16 of
        0: (
                time: HIThemeAnimationTimeInfo;
           );
        1: (
                frame: HIThemeAnimationFrameInfo;
            );
    end;
    HIThemeButtonDrawInfoPtr = ^HIThemeButtonDrawInfo;

{
 *  HIThemeSplitterDrawInfo
 *
 *  Summary:
 *    Drawing parameters passed to splitter drawing and measuring theme
 *    APIs.
 *
 *  Discussion:
 *    New in Mac OS X 10.3.
 }
type
    HIThemeSplitterDrawInfo = record

  {
   * The version of this data structure.  Currently, it is always 0.
   }
        version: UInt32;

  {
   * The ThemeDrawState of the splitter being drawn or measured.
   }
        state: ThemeDrawState;

  {
   * The HIThemeSplitterAdornments of the splitter being drawn or
   * measured.
   }
        adornment: HIThemeSplitterAdornment;
    end;
    HIThemeSplitterDrawInfoPtr = ^HIThemeSplitterDrawInfo;

{
 *  HIThemeTabDrawInfo
 *
 *  Summary:
 *    Drawing parameters passed to tab drawing and measuring theme APIs.
 *
 *  Discussion:
 *    New in Mac OS X 10.3.
 }
type
    HIThemeTabDrawInfo = record

  {
   * The version of this data structure.  Currently, it is always 0.
   }
        version: UInt32;

  {
   * A ThemeTabStyle describing the style of the tab to be drawn.
   }
        style: ThemeTabStyle;

  {
   * A ThemeTabDirection describing the side on which the tab is being
   * drawn.
   }
        direction: ThemeTabDirection;

  {
   * An HIThemeTabSize indicating what size of tab to draw.
   }
        size: HIThemeTabSize;

  {
   * An HIThemeTabAdornment describing any additional adornments that
   * are to be drawn on the tab.
   }
        adornment: HIThemeTabAdornment;             { various tab attributes }
    end;
    HIThemeTabDrawInfoPtr = ^HIThemeTabDrawInfo;

{
 *  HIThemeMenuDrawInfo
 *
 *  Summary:
 *    Drawing parameters passed to menu drawing and measuring theme
 *    APIs.
 *
 *  Discussion:
 *    New in Mac OS X 10.3.
 }
type
    HIThemeMenuDrawInfo = record

  {
   * The version of this data structure.  Currently, it is always 0.
   }
        version: UInt32;

  {
   * A ThemeMenuType indicating which type of menu is to be drawn.
   }
        menuType: ThemeMenuType;
    end;
    HIThemeMenuDrawInfoPtr = ^HIThemeMenuDrawInfo;

{
 *  HIThemeMenuItemDrawInfo
 *
 *  Summary:
 *    Drawing parameters passed to menu item drawing and measuring
 *    theme APIs.
 *
 *  Discussion:
 *    New in Mac OS X 10.3.
 }
type
    HIThemeMenuItemDrawInfo = record

  {
   * The version of this data structure.  Currently, it is always 0.
   }
        version: UInt32;

  {
   * A ThemeMenuItemType indicating what type of menu item is to be
   * drawn.
   }
        itemType: ThemeMenuItemType;

  {
   * The ThemeMenuState of the menu item to be drawn.
   }
        state: ThemeMenuState;
    end;
    HIThemeMenuItemDrawInfoPtr = ^HIThemeMenuItemDrawInfo;

{
 *  HIThemeFrameDrawInfo
 *
 *  Summary:
 *    Drawing parameters passed to frame drawing and measuring theme
 *    APIs.
 *
 *  Discussion:
 *    New in Mac OS X 10.3.
 }
type
    HIThemeFrameDrawInfo = record

  {
   * The version of this data structure.  Currently, it is always 0.
   }
        version: UInt32;

  {
   * The HIThemeFrameKind of the frame to be drawn.
   }
        kind: HIThemeFrameKind;

  {
   * The ThemeDrawState of the frame to be drawn.
   }
        state: ThemeDrawState;

  {
   * A Boolean indicating whether the frame is to be drawn with focus
   * or without.
   }
        isFocused: Boolean;
    end;
    HIThemeFrameDrawInfoPtr = ^HIThemeFrameDrawInfo;

{
 *  HIThemeGroupBoxDrawInfo
 *
 *  Summary:
 *    Drawing parameters passed to group box drawing and measuring
 *    theme APIs.
 *
 *  Discussion:
 *    New in Mac OS X 10.3.
 }
type
    HIThemeGroupBoxDrawInfo = record

  {
   * The version of this data structure.  Currently, it is always 0.
   }
        version: UInt32;

  {
   * The ThemeDrawState for the group box to be drawn.
   }
        state: ThemeDrawState;

  {
   * An HIThemeGroupBoxKind indicating which type of group box is to be
   * drawn.
   }
        kind: HIThemeGroupBoxKind;
    end;
    HIThemeGroupBoxDrawInfoPtr = ^HIThemeGroupBoxDrawInfo;

{
 *  HIThemeGrabberDrawInfo
 *
 *  Summary:
 *    Drawing parameters passed to grabber drawing and measuring theme
 *    APIs.
 *
 *  Discussion:
 *    New in Mac OS X 10.3.
 }
type
    HIThemeGrabberDrawInfo = record

  {
   * The version of this data structure.  Currently, it is always 0.
   }
        version: UInt32;

  {
   * The ThemeDrawState for the grabber to be drawn.
   }
        state: ThemeDrawState;
    end;
    HIThemeGrabberDrawInfoPtr = ^HIThemeGrabberDrawInfo;

{
 *  HIThemePlacardDrawInfo
 *
 *  Summary:
 *    Drawing parameters passed to placard drawing and measuring theme
 *    APIs.
 *
 *  Discussion:
 *    New in Mac OS X 10.3.
 }
type
    HIThemePlacardDrawInfo = record

  {
   * The version of this data structure.  Currently, it is always 0.
   }
        version: UInt32;

  {
   * The ThemeDrawState for the placard to be drawn.
   }
        state: ThemeDrawState;
    end;
    HIThemePlacardDrawInfoPtr = ^HIThemePlacardDrawInfo;

{
 *  HIThemeHeaderDrawInfo
 *
 *  Summary:
 *    Drawing parameters passed to header drawing and measuring theme
 *    APIs.
 *
 *  Discussion:
 *    New in Mac OS X 10.3.
 }
type
    HIThemeHeaderDrawInfo = record

  {
   * The version of this data structure.  Currently, it is always 0.
   }
        version: UInt32;

  {
   * The ThemeDrawState for the header to be drawn.
   }
        state: ThemeDrawState;

  {
   * The HIThemeHeaderKind for the header to be drawn.
   }
        kind: HIThemeHeaderKind;
    end;
    HIThemeHeaderDrawInfoPtr = ^HIThemeHeaderDrawInfo;

{
 *  HIThemeMenuBarDrawInfo
 *
 *  Summary:
 *    Drawing parameters passed to HIThemeDrawMenuBarBackground.
 *
 *  Discussion:
 *    New in Mac OS X 10.3.
 }
type
    HIThemeMenuBarDrawInfo = record

  {
   * The version of this data structure.  Currently, it is always 0.
   }
        version: UInt32;

  {
   * The ThemeMenuBarState for the menu bar to be drawn.
   }
        state: ThemeMenuBarState;

  {
   * The attributes of the menu bar to be drawn.
   }
        attributes: UInt32;
    end;
    HIThemeMenuBarDrawInfoPtr = ^HIThemeMenuBarDrawInfo;

{
 *  HIThemeMenuTitleDrawInfo
 *
 *  Summary:
 *    Drawing parameters passed to HIThemeDrawMenuTitle.
 *
 *  Discussion:
 *    New in Mac OS X 10.3.
 }
type
    HIThemeMenuTitleDrawInfo = record

  {
   * The version of this data structure.  Currently, it is always 0.
   }
        version: UInt32;

  {
   * The ThemeMenuState for the menu title to be drawn.
   }
        state: ThemeMenuState;

  {
   * The attributes of the menu title to be drawn. Must be either 0 or
   * kHIThemeMenuTitleDrawCondensed.
   }
        attributes: UInt32;

  {
   * The border space between the menu title rect and the menu title
   * text when the menu title spacing is being condensed. This field is
   * only observed by the Appearance Manager when the attributes field
   * contains kHIThemeMenuTitleDrawCondensed. The valid values for this
   * field range from the value returned by GetThemeMenuTitleExtra(
   * &extra, false ) to the value returned by GetThemeMenuTitleExtra(
   * &extra, true ). You may pass 0 in this field to use the minimum
   * condensed title extra.
   }
        condensedTitleExtra: Float32;
    end;
    HIThemeMenuTitleDrawInfoPtr = ^HIThemeMenuTitleDrawInfo;

{
 *  HIThemeTabPaneDrawInfo
 *
 *  Summary:
 *    Drawing parameters passed to tab pane drawing and measuring theme
 *    APIs.
 *
 *  Discussion:
 *    New in Mac OS X 10.3.
 }
type
    HIThemeTabPaneDrawInfo = record

  {
   * The version of this data structure.  Currently, it is always 0.
   }
        version: UInt32;

  {
   * The ThemeDrawState for the tab pane to be drawn.
   }
        state: ThemeDrawState;

  {
   * A ThemeTabDirection describing on which side of the pane the tabs
   * will be drawn.
   }
        direction: ThemeTabDirection;

  {
   * An HIThemeTabSize indicating what size of tab pane to draw.
   }
        size: HIThemeTabSize;
    end;
    HIThemeTabPaneDrawInfoPtr = ^HIThemeTabPaneDrawInfo;

{
 *  HIThemeTickMarkDrawInfo
 *
 *  Summary:
 *    Drawing parameters passed to tick mark drawing and measuring
 *    theme APIs.
 *
 *  Discussion:
 *    New in Mac OS X 10.3.
 }
type
    HIThemeTickMarkDrawInfo = record

  {
   * The version of this data structure.  Currently, it is always 0.
   }
        version: UInt32;

  {
   * The ThemeDrawState for the tick mark to be drawn.
   }
        state: ThemeDrawState;
    end;
    HIThemeTickMarkDrawInfoPtr = ^HIThemeTickMarkDrawInfo;

{
 *  HIThemeWindowDrawInfo
 *
 *  Summary:
 *    Drawing parameters passed to window drawing and measuring theme
 *    APIs.
 *
 *  Discussion:
 *    New in Mac OS X 10.3, but based on legacy ThemeWindowMetrics.
 }
type
    HIThemeWindowDrawInfo = record

  {
   * The version of this data structure.  Currently, it is always 0.
   }
        version: UInt32;

  {
   * A ThemeDrawState which describes the state of the window to be
   * drawn.
   }
        state: ThemeDrawState;

  {
   * A ThemeWindowType specifying the type of window to be drawn.
   }
        windowType: ThemeWindowType;

  {
   * The ThemeWindowAttributes describing the window to be drawn.
   }
        attributes: ThemeWindowAttributes;

  {
   * The height of the title of the window.
   }
        titleHeight: Float32;

  {
   * The width of the title of the window.
   }
        titleWidth: Float32;
    end;
    HIThemeWindowDrawInfoPtr = ^HIThemeWindowDrawInfo;

{
 *  HIThemeWindowWidgetDrawInfo
 *
 *  Summary:
 *    Drawing parameters passed to window widget drawing and measuring
 *    theme APIs.
 *
 *  Discussion:
 *    New in Mac OS X 10.3, but based on legacy ThemeWindowMetrics.
 }
type
    HIThemeWindowWidgetDrawInfo = record

  {
   * The version of this data structure.  Currently, it is always 0.
   }
        version: UInt32;

  {
   * A ThemeDrawState which describes the state of the widget to be
   * drawn.
   }
        widgetState: ThemeDrawState;

  {
   * A ThemeTitleBarWidget specifying the type of window widget to be
   * drawn.
   }
        widgetType: ThemeTitleBarWidget;

  {
   * A ThemeDrawState which describes the state of the window for which
   * the widget is to be drawn.
   }
        windowState: ThemeDrawState;

  {
   * A ThemeWindowType specifying the type of window to be drawn.
   }
        windowType: ThemeWindowType;

  {
   * The ThemeWindowAttributes describing the window to be drawn.
   }
        attributes: ThemeWindowAttributes;

  {
   * The height of the title of the window.
   }
        titleHeight: Float32;

  {
   * The width of the title of the window.
   }
        titleWidth: Float32;
    end;
    HIThemeWindowWidgetDrawInfoPtr = ^HIThemeWindowWidgetDrawInfo;

{
 *  HIThemeSeparatorDrawInfo
 *
 *  Summary:
 *    Drawing parameters passed to separator drawing and measuring
 *    theme APIs.
 *
 *  Discussion:
 *    New in Mac OS X 10.3.
 }
type
    HIThemeSeparatorDrawInfo = record

  {
   * The version of this data structure.  Currently, it is always 0.
   }
        version: UInt32;

  {
   * The ThemeDrawState for the separator to be drawn.
   }
        state: ThemeDrawState;
    end;
    HIThemeSeparatorDrawInfoPtr = ^HIThemeSeparatorDrawInfo;

{
 *  HIThemeScrollBarDelimitersDrawInfo
 *
 *  Summary:
 *    Drawing parameters passed to separator drawing and measuring
 *    theme APIs.
 *
 *  Discussion:
 *    New in Mac OS X 10.3.
 }
type
    HIThemeScrollBarDelimitersDrawInfo = record

  {
   * The version of this data structure.  Currently, it is always 0.
   }
        version: UInt32;

  {
   * The ThemeDrawState for the separator to be drawn.
   }
        state: ThemeDrawState;

  {
   * A ThemeWindowType specifying the type of window for which to draw
   * the delimiters.
   }
        windowType: ThemeWindowType;

  {
   * The ThemeWindowAttributes of the window for which the scroll bar
   * delimters are to be drawn.
   }
        attributes: ThemeWindowAttributes;
    end;
    HIThemeScrollBarDelimitersDrawInfoPtr = ^HIThemeScrollBarDelimitersDrawInfo;

{
 *  HIThemeChasingArrowsDrawInfo
 *
 *  Summary:
 *    Drawing parameters passed to chasing arrows drawing and measuring
 *    theme APIs.
 *
 *  Discussion:
 *    New in Mac OS X 10.3.
 }
type
    HIThemeChasingArrowsDrawInfo = record

  {
   * The version of this data structure.  Currently, it is always 0.
   }
        version: UInt32;

  {
   * The ThemeDrawState for the chasing arrows to be drawn.
   }
        state: ThemeDrawState;

  {
   * A UInt32 used to calculate which frame of the chasing arrow
   * animation is to be drawn.
   }
        index: UInt32;
    end;
    HIThemeChasingArrowsDrawInfoPtr = ^HIThemeChasingArrowsDrawInfo;

{
 *  HIThemePopupArrowDrawInfo
 *
 *  Summary:
 *    Drawing parameters passed to popup arrow drawing and measuring
 *    theme APIs.
 *
 *  Discussion:
 *    New in Mac OS X 10.3.
 }
type
    HIThemePopupArrowDrawInfo = record

  {
   * The version of this data structure.  Currently, it is always 0.
   }
        version: UInt32;

  {
   * The ThemeDrawState for the popup arrow to be drawn.
   }
        state: ThemeDrawState;

  {
   * A ThemeArrowOrientation for the orientation of the popup arrow to
   * be drawn.
   }
        orientation: ThemeArrowOrientation;

  {
   * A ThemePopupArrowSize for the size of the popup arrow to be drawn.
   }
        size: ThemePopupArrowSize;
    end;
    HIThemePopupArrowDrawInfoPtr = ^HIThemePopupArrowDrawInfo;

{
 *  HIThemeGrowBoxDrawInfo
 *
 *  Summary:
 *    Drawing parameters passed to grow box drawing and measuring theme
 *    APIs.
 *
 *  Discussion:
 *    New in Mac OS X 10.3.
 }
type
    HIThemeGrowBoxDrawInfo = record

  {
   * The version of this data structure.  Currently, it is always 0.
   }
        version: UInt32;

  {
   * The ThemeDrawState for the grow box to be drawn.
   }
        state: ThemeDrawState;

  {
   * A ThemeGrowBoxKind indicating in which kind of grow box to draw.
   }
        kind: HIThemeGrowBoxKind;

  {
   * A ThemeGrowDirection indicating in which direction the window will
   * grow.
   }
        direction: ThemeGrowDirection;

  {
   * An HIThemeGrowBoxSize describing the size of the grow box to draw.
   }
        size: HIThemeGrowBoxSize;
    end;
    HIThemeGrowBoxDrawInfoPtr = ^HIThemeGrowBoxDrawInfo;

{
 *  HIThemeBackgroundDrawInfo
 *
 *  Discussion:
 *    New in Mac OS X 10.3, but based on legacy TrackDrawInfo.
 }
type
    HIThemeBackgroundDrawInfo = record

  {
   * The version of this data structure.  Currently, it is always 0.
   }
        version: UInt32;

  {
   * The ThemeDrawState of the background to be drawn. Currently,
   * HIThemeDrawBackground backgrounds do not have state, so this field
   * has no meaning. Set it to kThemeStateActive.
   }
        state: ThemeDrawState;

  {
   * The ThemeBackgroundKind with which to fill the background.
   }
        kind: ThemeBackgroundKind;
    end;
    HIThemeBackgroundDrawInfoPtr = ^HIThemeBackgroundDrawInfo;

{ -------------------------------------------------------------------------- }
{  Buttons                                                                   }
{ -------------------------------------------------------------------------- }
{
 *  HIThemeDrawButton()
 *
 *  Summary:
 *    Draw a themed button.
 *
 *  Discussion:
 *    This generic button drawing theme primitive draws not just a push
 *    button, but all of the kinds of buttons described by
 *    ThemeButtonKind.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inBounds:
 *      The HIRect in which to draw.  Note that this API may draw
 *      outside of its bounds.
 *
 *    inDrawInfo:
 *      An HIThemeButtonDrawInfo describing the button that will be
 *      drawn.
 *
 *    inContext:
 *      The CG context in which the drawing is to be done.
 *
 *    inOrientation:
 *      An HIThemeOrientation that describes the orientation of the
 *      passed in context.
 *
 *    outLabelRect:
 *      A pointer to an HIRect into which to put the bounds of the
 *      label rect.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function HIThemeDrawButton( const inBounds: HIRect; const inDrawInfo: HIThemeButtonDrawInfo; inContext: CGContextRef; inOrientation: HIThemeOrientation; outLabelRect: HIRectPtr ): OSStatus; external name '_HIThemeDrawButton';


{
 *  HIThemeGetButtonShape()
 *
 *  Summary:
 *    Get a shape of a themed button.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inBounds:
 *      The HIRect in which to draw.
 *
 *    inDrawInfo:
 *      An HIThemeButtonDrawInfo describing the button that will be
 *      drawn.
 *
 *    outShape:
 *      A pointer to an HIShapeRef which will be set to the shape of
 *      the button. Needs to be released by caller.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function HIThemeGetButtonShape( const inBounds: HIRect; const inDrawInfo: HIThemeButtonDrawInfo; var outShape: HIShapeRef ): OSStatus; external name '_HIThemeGetButtonShape';


{
 *  HIThemeGetButtonContentBounds()
 *
 *  Summary:
 *    Get the bounds of a themed button's content.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inBounds:
 *      An HIRect indicating where the button is to be drawn.
 *
 *    inDrawInfo:
 *      An HIThemeButtonDrawInfo describing the button that will be
 *      drawn.
 *
 *    outBounds:
 *      A pointer to an HIRect in which will be returned the rectangle
 *      of the button content bounds.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function HIThemeGetButtonContentBounds( const inBounds: HIRect; const inDrawInfo: HIThemeButtonDrawInfo; var outBounds: HIRect ): OSStatus; external name '_HIThemeGetButtonContentBounds';


{
 *  HIThemeGetButtonBackgroundBounds()
 *
 *  Summary:
 *    Get the bounds of the background of a themed button.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inBounds:
 *      An HIRect indicating where the button is to be drawn.
 *
 *    inDrawInfo:
 *      An HIThemeButtonDrawInfo describing the button that will be
 *      drawn.
 *
 *    outBounds:
 *      A pointer to an HIRect in which will be returned the rectangle
 *      of the button background bounds.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function HIThemeGetButtonBackgroundBounds( const inBounds: HIRect; const inDrawInfo: HIThemeButtonDrawInfo; var outBounds: HIRect ): OSStatus; external name '_HIThemeGetButtonBackgroundBounds';


{
 *  HIThemeDrawChasingArrows()
 *
 *  Summary:
 *    Draw themed chasing arrows.
 *
 *  Discussion:
 *    Draw a frame from the chasing arrows animation.  The animation
 *    frame is based on a modulo value calculated from the index.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inBounds:
 *      An HIRect indicating where the chasing arrows are to be drawn.
 *
 *    inDrawInfo:
 *      An HIThemeChasingArrowsDrawInfo describing the chasing arrows
 *      to be drawn or measured.
 *
 *    inContext:
 *      The CG context in which the drawing is to be done.
 *
 *    inOrientation:
 *      An HIThemeOrientation that describes the orientation of the
 *      passed in context.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function HIThemeDrawChasingArrows( const inBounds: HIRect; const inDrawInfo: HIThemeChasingArrowsDrawInfo; inContext: CGContextRef; inOrientation: HIThemeOrientation ): OSStatus; external name '_HIThemeDrawChasingArrows';


{
 *  HIThemeDrawPopupArrow()
 *
 *  Summary:
 *    Draws a themed popup arrow.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inBounds:
 *      The HIRect in which to draw.
 *
 *    inDrawInfo:
 *      An HIThemePopupArrowDrawInfo describing the popup arrow to be
 *      drawn or measured.
 *
 *    inContext:
 *      The CG context in which the drawing is to be done.
 *
 *    inOrientation:
 *      An HIThemeOrientation that describes the orientation of the
 *      passed in context.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function HIThemeDrawPopupArrow( const inBounds: HIRect; const inDrawInfo: HIThemePopupArrowDrawInfo; inContext: CGContextRef; inOrientation: HIThemeOrientation ): OSStatus; external name '_HIThemeDrawPopupArrow';


{ -------------------------------------------------------------------------- }
{  Menus                                                                     }
{ -------------------------------------------------------------------------- }
{
 *  HIThemeDrawMenuBarBackground()
 *
 *  Summary:
 *    Draws the menu bar background for a given area.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inBounds:
 *      The HIRect in which to draw.
 *
 *    inDrawInfo:
 *      The HIThemeMenuBarDrawInfo of the menu bar to be drawn.
 *
 *    inContext:
 *      The CG context in which the drawing is to be done.
 *
 *    inOrientation:
 *      An HIThemeOrientation that describes the orientation of the
 *      passed in context.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function HIThemeDrawMenuBarBackground( const inBounds: HIRect; const inDrawInfo: HIThemeMenuBarDrawInfo; inContext: CGContextRef; inOrientation: HIThemeOrientation ): OSStatus; external name '_HIThemeDrawMenuBarBackground';


{
 *  HIThemeDrawMenuTitle()
 *
 *  Summary:
 *    Draws the menu title background for a menu.
 *
 *  Discussion:
 *    This API draws the background of a menu title. It does not draw
 *    the menu title text; it is the caller's responsibility to draw
 *    the text after this API has returned. The text should be drawn
 *    into the bounds returned in the outLabelRect parameter; the
 *    caller should ensure that the text is not drawn outside of those
 *    bounds, either by truncating or clipping the text.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inMenuBarRect:
 *      An HIRect indicating the bounds of the whole menu bar for which
 *      the menu title is to be drawn.
 *
 *    inTitleRect:
 *      An HIRect for the bounds of the menu title to be drawn.
 *
 *    inDrawInfo:
 *      The HIThemeMenuTitleDrawInfo of the menu title to be drawn.
 *
 *    inContext:
 *      The CG context in which the drawing is to be done.
 *
 *    inOrientation:
 *      An HIThemeOrientation that describes the orientation of the
 *      passed in context.
 *
 *    outLabelRect:
 *      On exit, contains the bounds in which the menu title text
 *      should be drawn. May be NULL if you don't need this information.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function HIThemeDrawMenuTitle( const inMenuBarRect: HIRect; const inTitleRect: HIRect; const inDrawInfo: HIThemeMenuTitleDrawInfo; inContext: CGContextRef; inOrientation: HIThemeOrientation; outLabelRect: HIRectPtr ): OSStatus; external name '_HIThemeDrawMenuTitle';


{
 *  HIThemeDrawMenuBackground()
 *
 *  Summary:
 *    Draws the theme menu background in a rectangle.  This API may
 *    draw outside of the specified rectangle.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inMenuRect:
 *      An HIRect indicating the bounds of the whole menu for which the
 *      background is to be drawn.
 *
 *    inMenuDrawInfo:
 *      An HIThemeMenuDrawInfo describing the menu to be drawn.
 *
 *    inContext:
 *      The CG context in which the drawing is to be done.
 *
 *    inOrientation:
 *      An HIThemeOrientation that describes the orientation of the
 *      passed in context.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function HIThemeDrawMenuBackground( const inMenuRect: HIRect; const inMenuDrawInfo: HIThemeMenuDrawInfo; inContext: CGContextRef; inOrientation: HIThemeOrientation ): OSStatus; external name '_HIThemeDrawMenuBackground';


{
 *  HIThemeDrawMenuItem()
 *
 *  Summary:
 *    Draws a themed menu item.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inMenuRect:
 *      An HIRect indicating the bounds of the whole menu for which the
 *      menu item is to be drawn.
 *
 *    inItemRect:
 *      An HIRect for the bounds of the menu item to be drawn.
 *
 *    inItemDrawInfo:
 *      An HIThemeMenuItemDrawInfo describing the drawing
 *      characteristics of the menu item to be drawn.
 *
 *    inContext:
 *      The CG context in which the drawing is to be done.
 *
 *    inOrientation:
 *      An HIThemeOrientation that describes the orientation of the
 *      passed in context.
 *
 *    outContentRect:
 *      An HIRect that will be filled with the rectangle describing
 *      where the menu item content is to be drawn.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function HIThemeDrawMenuItem( const inMenuRect: HIRect; const inItemRect: HIRect; const inItemDrawInfo: HIThemeMenuItemDrawInfo; inContext: CGContextRef; inOrientation: HIThemeOrientation; var outContentRect: HIRect ): OSStatus; external name '_HIThemeDrawMenuItem';


{
 *  HIThemeDrawMenuSeparator()
 *
 *  Summary:
 *    Draws a themed menu separator.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inMenuRect:
 *      An HIRect indicating the bounds of the whole menu for which the
 *      menu separator is to be drawn.
 *
 *    inItemRect:
 *      An HIRect for the bounds of the menu separator to be drawn.
 *
 *    inItemDrawInfo:
 *      An HIThemeMenuItemDrawInfo describing the drawing
 *      characteristics of the menu item to be drawn.
 *
 *    inContext:
 *      The CG context in which the drawing is to be done.
 *
 *    inOrientation:
 *      An HIThemeOrientation that describes the orientation of the
 *      passed in context.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function HIThemeDrawMenuSeparator( const inMenuRect: HIRect; const inItemRect: HIRect; const inItemDrawInfo: HIThemeMenuItemDrawInfo; inContext: CGContextRef; inOrientation: HIThemeOrientation ): OSStatus; external name '_HIThemeDrawMenuSeparator';


{
 *  HIThemeGetMenuBackgroundShape()
 *
 *  Summary:
 *    Gets the shape of the background for a themed menu.
 *
 *  Discussion:
 *    This shape can extend outside of the bounds of the specified
 *    rectangle.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inMenuRect:
 *      An HIRect indicating the bounds of the menu for which the menu
 *      background is to be drawn.
 *
 *    inMenuDrawInfo:
 *      An HIThemeMenuDrawInfo describing the menu to be measured.
 *
 *    outShape:
 *      A valid HIShape that will be cleared and filled with the shape
 *      of the menu background.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function HIThemeGetMenuBackgroundShape( const inMenuRect: HIRect; const inMenuDrawInfo: HIThemeMenuDrawInfo; var outShape: HIShapeRef ): OSStatus; external name '_HIThemeGetMenuBackgroundShape';


{ -------------------------------------------------------------------------- }
{  Tabs                                                                      }
{ -------------------------------------------------------------------------- }
{
 *  HIThemeDrawTabPane()
 *
 *  Summary:
 *    Draws a themed tab pane.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inRect:
 *      The HIRect in which to draw the pane.
 *
 *    inDrawInfo:
 *      The HIThemeTabPaneDrawInfo of the tab pane to be drawn.
 *
 *    inContext:
 *      The CG context in which the drawing is to be done.
 *
 *    inOrientation:
 *      An HIThemeOrientation that describes the orientation of the
 *      passed in context.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function HIThemeDrawTabPane( const inRect: HIRect; const inDrawInfo: HIThemeTabPaneDrawInfo; inContext: CGContextRef; inOrientation: HIThemeOrientation ): OSStatus; external name '_HIThemeDrawTabPane';


{
 *  HIThemeDrawTab()
 *
 *  Summary:
 *    Draw a themed tab.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inRect:
 *      The HIRect in which to draw.
 *
 *    inDrawInfo:
 *      An HIThemeTabDrawInfo describing the tab to be drawn.
 *
 *    inContext:
 *      The CG context in which the drawing is to be done.
 *
 *    inOrientation:
 *      An HIThemeOrientation that describes the orientation of the
 *      passed in context.
 *
 *    outLabelRect:
 *      An HIRect into which to put the bounds of the label rect.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function HIThemeDrawTab( const inRect: HIRect; const inDrawInfo: HIThemeTabDrawInfo; inContext: CGContextRef; inOrientation: HIThemeOrientation; outLabelRect: HIRectPtr ): OSStatus; external name '_HIThemeDrawTab';


{
 *  HIThemeGetTabPaneDrawShape()
 *
 *  Summary:
 *    Gets the shape of the draw area relative to the full bounds of
 *    the tab+pane.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inRect:
 *      The HIRect for which to get the shape.
 *
 *    inDirection:
 *      A ThemeTabDirection describing on which side of the pane the
 *      tabs will be drawn.
 *
 *    inTabSize:
 *      An HIThemeTabSize indicating what size of tab pane to draw.
 *
 *    outShape:
 *      A pointer to an HIShapeRef which will be set to the shape of
 *      the draw area. Needs to be released by caller.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function HIThemeGetTabPaneDrawShape( const inRect: HIRect; inDirection: ThemeTabDirection; inTabSize: HIThemeTabSize; var outShape: HIShapeRef ): OSStatus; external name '_HIThemeGetTabPaneDrawShape';


{
 *  HIThemeGetTabPaneContentShape()
 *
 *  Summary:
 *    Gets the shape of the content area relative to the full bounds of
 *    the tab+pane.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inRect:
 *      The HIRect for which to get the shape.
 *
 *    inDirection:
 *      A ThemeTabDirection describing on which side of the pane the
 *      tabs will be drawn.
 *
 *    inTabSize:
 *      An HIThemeTabSize indicating what size of tab pane to draw.
 *
 *    outShape:
 *      A pointer to an HIShapeRef which will be set to the shape of
 *      the draw content. Needs to be released by caller.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function HIThemeGetTabPaneContentShape( const inRect: HIRect; inDirection: ThemeTabDirection; inTabSize: HIThemeTabSize; var outShape: HIShapeRef ): OSStatus; external name '_HIThemeGetTabPaneContentShape';


{
 *  HIThemeGetTabDrawShape()
 *
 *  Summary:
 *    Gets the shape of the tab drawing area relative to the full
 *    bounds of the tab+pane.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inRect:
 *      The HIRect for which to get the shape.
 *
 *    inDrawInfo:
 *      An HIThemeTabDrawInfo describing the tab that will be drawn.
 *
 *    outShape:
 *      A pointer to an HIShapeRef which will be set to the shape of
 *      the tab drawing area. Needs to be released by caller.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function HIThemeGetTabDrawShape( const inRect: HIRect; const inDrawInfo: HIThemeTabDrawInfo; var outShape: HIShapeRef ): OSStatus; external name '_HIThemeGetTabDrawShape';


{
 *  HIThemeGetTabShape()
 *
 *  Summary:
 *    Gets the shape for a themed tab.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inRect:
 *      An HIRect indicating the entire tabs area for which the tab
 *      shape is to be retrieved.
 *
 *    inDrawInfo:
 *      An HIThemeTabDrawInfo describing the tab that will be drawn.
 *
 *    outShape:
 *      A pointer to an HIShapeRef which will be set to the shape of
 *      the tab. Needs to be released by caller.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function HIThemeGetTabShape( const inRect: HIRect; const inDrawInfo: HIThemeTabDrawInfo; var outShape: HIShapeRef ): OSStatus; external name '_HIThemeGetTabShape';


{ -------------------------------------------------------------------------- }
{  Text                                                                      }
{ -------------------------------------------------------------------------- }

const

  {
   * Don't truncate the measured or drawn text.
   }
  kHIThemeTextTruncationNone    = 0;

  {
   * During measure or draw, if the text will not fit within the
   * available bounds, truncate the text in the middle of the last
   * visible line.
   }
  kHIThemeTextTruncationMiddle  = 1;

  {
   * During measure or draw, if the text will not fit within the
   * available bounds, truncate the text at the end of the last visible
   * line.
   }
  kHIThemeTextTruncationEnd     = 2;

type HIThemeTextTruncation = UInt32;

const

  {
   * The text will be drawn flush with the left side of the bounding
   * box.
   }
  kHIThemeTextHorizontalFlushLeft = 0;

  {
   * The text will be centered within the bounding box.
   }
  kHIThemeTextHorizontalFlushCenter = 1;

  {
   * The text will be drawn flush with the right side of the bounding
   * box.
   }
  kHIThemeTextHorizontalFlushRight = 2;

type HIThemeTextHorizontalFlush = UInt32;

const

  {
   * Draw the text vertically flush with the top of the box
   }
  kHIThemeTextVerticalFlushTop  = 0;

  {
   * Vertically center the text
   }
  kHIThemeTextVerticalFlushCenter = 1;

  {
   * Draw the text vertically flush with the bottom of the box
   }
  kHIThemeTextVerticalFlushBottom = 2;

type HIThemeTextVerticalFlush = UInt32;

const
  kHIThemeTextBoxOptionNone     = 0;
  kHIThemeTextBoxOptionStronglyVertical = (1 shl 1);

type HIThemeTextBoxOptions = OptionBits;
const
  kHIThemeTextInfoVersionZero   = 0;


{
 *  HIThemeTextInfo
 *
 *  Summary:
 *    Drawing parameters passed to text drawing and measuring theme
 *    APIs.
 *
 *  Discussion:
 *    New in Mac OS X 10.3, this structure is used for measuring and
 *    drawing text with the HIThemeGetTextDimensions and
 *    HIThemeDrawTextBox APIs. If truncationPosition is
 *    kHIThemeTextTruncationNone, the other fields with the truncation
 *    prefix are ignored.
 }
type
    HIThemeTextInfo = record

  {
   * The version of this data structure. Currently, it is always 0.
   }
        version: UInt32;                { current version is 0 }

  {
   * The theme draw state in which to draw the string.
   }
        state: ThemeDrawState;

  {
   * The font in which to draw the string.
   }
        fontID: ThemeFontID;

  {
   * The horizontal flushness of the text. One of the
   * kHIThemeTextHorizontalFlush[Left/Center/Right] constants. When
   * this structure is used for HIThemeGetTextDimensions, this field
   * has no effect on the returned dimensions. However, providing the
   * same flushness that will be used with a subsequent draw will
   * trigger a performance optimization.
   }
        horizontalFlushness: HIThemeTextHorizontalFlush; { kHIThemeTextHorizontalFlush[Left/Center/Right] }

  {
   * The vertical flushness of the text. One of the
   * kHIThemeTextVerticalFlush[Top/Center/Bottom] constants. When this
   * paramblock is used for HIThemeGetTextDimensions, this field has no
   * effect on the returned dimensions. However, providing the same
   * flushness that will be used with a subsequent draw will trigger a
   * performance optimization.
   }
        verticalFlushness: HIThemeTextVerticalFlush; { kHIThemeTextVerticalFlush[Top/Center/Bottom] }

  {
   * Currently, the only option available is for strongly vertical text
   * with the kThemeTextBoxOptionStronglyVertical option bit.
   }
        options: HIThemeTextBoxOptions;             { includes kHIThemeTextBoxOptionStronglyVertical }

  {
   * Specifies where truncation should occur. If this field is
   * kHIThemeTruncationNone, no truncation will occur, and all fields
   * with the truncation prefix will be ignored.
   }
        truncationPosition: HIThemeTextTruncation;  { kHIThemeTextTruncation[None/Middle/End], If none the following field is ignored }

  {
   * The maximum number of lines to measure or draw before truncation
   * occurs. Ignored if truncationPosition is kHIThemeTruncationNone.
   }
        truncationMaxLines: UInt32;     { the maximum number of lines before truncation occurs }

  {
   * On output, if the text has been truncated, this is set to true. If
   * the text fit completely within the parameters specified and the
   * text was not truncated, this is set to false.
   }
        truncationHappened: Boolean;     { on output, whether truncation needed to happen }

    end;
    HIThemeTextInfoPtr = ^HIThemeTextInfo;
{
 *  HIThemeGetTextDimensions()
 *
 *  Summary:
 *    Get text dimensions of a string
 *
 *  Discussion:
 *    This allows you to get various dimension characteristics of a
 *    string bound to certain criteria that you specify. It allows you
 *    to get the absolute bounds of a string laid out in a single line,
 *    or the bounds of a string constrained to a given width.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inString:
 *      The string to measure.
 *
 *    inWidth:
 *      The width to constrain the text before wrapping. If inWidth is
 *      0, the text will not wrap and will be laid out as a single
 *      line. If inWidth is not 0, the text will wrap at the given
 *      width and the measurements will be returned from the multi line
 *      layout.
 *
 *    inTextInfo:
 *      The HIThemeTextInfo parameter block specifying additional
 *      options for flushness and truncation. The truncationHappened
 *      field is the only field that will be written to by this API
 *      (and the reason for inTextInfo not being const).
 *
 *    outWidth:
 *      On output, will contain the width of the string. This width may
 *      be smaller than the constrain inWidth parameter if the text has
 *      wrapped. It will return the true bounding width of the layout.
 *      Can be NULL.
 *
 *    outHeight:
 *      On output, will contain the height of the string. Can be NULL.
 *
 *    outBaseline:
 *      On output, will contain the baseline of the string. This is the
 *      delta from the top of the text to the baseline of the first
 *      line. Can be NULL.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function HIThemeGetTextDimensions( inString: CFStringRef; inWidth: Float32; var inTextInfo: HIThemeTextInfo; outWidth: Float32Ptr; outHeight: Float32Ptr; outBaseline: Float32Ptr ): OSStatus; external name '_HIThemeGetTextDimensions';


{
 *  HIThemeDrawTextBox()
 *
 *  Summary:
 *    Draw the string into the given bounding box
 *
 *  Discussion:
 *    Draw the string into the bounding box given. You can specify
 *    options such as truncation and justification as well as
 *    determining whether the text was truncated when it was drawn.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inString:
 *      The string to draw.
 *
 *    inBounds:
 *      The HIRect that bounds where the text is to be drawn
 *
 *    inTextInfo:
 *      The HIThemeTextInfo parameter block specifying additional
 *      options for truncation and flushness. You can control the
 *      number of lines drawn by specifying a truncation of
 *      kHIThemeTextTruncationMiddle or kHIThemeTextTruncationEnd for
 *      the truncationPosition field and then specifying a maximum
 *      number of lines to draw before truncation occurs in the
 *      truncationMaxLines field. The truncationHappened field is the
 *      only field that will be written to by this API (and the reason
 *      for inTextInfo not being const).
 *
 *    inContext:
 *      The CGContextRef into which to draw the text.
 *
 *    inOrientation:
 *      An HIThemeOrientation that describes the orientation of the
 *      passed in context.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function HIThemeDrawTextBox( inString: CFStringRef; const inBounds: HIRect; var inTextInfo: HIThemeTextInfo; inContext: CGContextRef; inOrientation: HIThemeOrientation ): OSStatus; external name '_HIThemeDrawTextBox';


{ -------------------------------------------------------------------------- }
{  Tracks                                                                    }
{ -------------------------------------------------------------------------- }
{
 *  HIThemeDrawTrack()
 *
 *  Summary:
 *    Draw a themed track item.
 *
 *  Discussion:
 *    Used to draw any tracked element including sliders and scroll
 *    bars.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inDrawInfo:
 *      An HIThemeTrackDrawInfo describing the track that will be drawn.
 *
 *    inGhostRect:
 *      An HIRect describing the location of the ghost indicator to be
 *      drawn. Generally, this should be NULL and the control using
 *      this primitive should support live feeback.
 *
 *    inContext:
 *      The CG context in which the drawing is to be done.
 *
 *    inOrientation:
 *      An HIThemeOrientation that describes the orientation of the
 *      passed in context.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function HIThemeDrawTrack( const inDrawInfo: HIThemeTrackDrawInfo; inGhostRect: HIRectPtr; inContext: CGContextRef; inOrientation: HIThemeOrientation ): OSStatus; external name '_HIThemeDrawTrack';


{
 *  HIThemeDrawTrackTickMarks()
 *
 *  Summary:
 *    Draws the tick marks for a slider track.
 *
 *  Discussion:
 *    This primitive only draws evenly distributed tick marks.
 *    Internally, it calls HIThemeDrawTickMark to do the actual tick
 *    mark drawing, and any custom (non-even distribution) drawing of
 *    tick marks should be done with HIThemeDrawTickMark.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inDrawInfo:
 *      An HIThemeTrackDrawInfo describing the track tick marks that
 *      will be drawn.
 *
 *    inNumTicks:
 *      A value indicating the number of tick marks to be drawn.
 *
 *    inContext:
 *      The CG context in which the drawing is to be done.
 *
 *    inOrientation:
 *      An HIThemeOrientation that describes the orientation of the
 *      passed in context.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function HIThemeDrawTrackTickMarks( const inDrawInfo: HIThemeTrackDrawInfo; inNumTicks: ItemCount; inContext: CGContextRef; inOrientation: HIThemeOrientation ): OSStatus; external name '_HIThemeDrawTrackTickMarks';


{
 *  HIThemeDrawTickMark()
 *
 *  Summary:
 *    Draws a single tick mark.
 *
 *  Discussion:
 *    This primitive draws a single tick mark and can be used to draw
 *    custom tick marks that are not easily drawn by
 *    HIThemeDrawTrackTickMarks, which only draws evenly distributed
 *    tick marks.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inBounds:
 *      The HIRect in which to draw.
 *
 *    inDrawInfo:
 *      The HIThemeTickMarkDrawInfo of the tick mark to be drawn.
 *
 *    inContext:
 *      The CG context in which the drawing is to be done.
 *
 *    inOrientation:
 *      An HIThemeOrientation that describes the orientation of the
 *      passed in context.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function HIThemeDrawTickMark( const inBounds: HIRect; const inDrawInfo: HIThemeTickMarkDrawInfo; inContext: CGContextRef; inOrientation: HIThemeOrientation ): OSStatus; external name '_HIThemeDrawTickMark';


{
 *  HIThemeGetTrackThumbShape()
 *
 *  Summary:
 *    Get the thumb shape of a themed track.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inDrawInfo:
 *      An HIThemeTrackDrawInfo describing the track to be measured.
 *
 *    outThumbShape:
 *      A pointer to an HIShapeRef which will be set to the shape of
 *      the themed track's thumb. Needs to be released by caller.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function HIThemeGetTrackThumbShape( const inDrawInfo: HIThemeTrackDrawInfo; var outThumbShape: HIShapeRef ): OSStatus; external name '_HIThemeGetTrackThumbShape';


{
 *  HIThemeHitTestTrack()
 *
 *  Summary:
 *    Hit test the themed track.
 *
 *  Discussion:
 *    Returns true if the track was hit and fills in outPartHit.
 *    Otherwise, returns false.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inDrawInfo:
 *      An HIThemeTabDrawInfo describing the tab that will be drawn.
 *
 *    inMousePoint:
 *      An HIPoint which will be location basis for the test.
 *
 *    outPartHit:
 *      A pointer to a ControlPartCode that will be filled with the
 *      part hit by the incoming point.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function HIThemeHitTestTrack( const inDrawInfo: HIThemeTrackDrawInfo; const inMousePoint: HIPoint; var outPartHit: ControlPartCode ): Boolean; external name '_HIThemeHitTestTrack';


{
 *  HIThemeGetTrackBounds()
 *
 *  Summary:
 *    Gets the track bounds of a themed track.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inDrawInfo:
 *      An HIThemeTrackDrawInfo describing the tab that will be drawn.
 *
 *    outBounds:
 *      A pointer to an HIRect in which will be returned the rectangle
 *      of the track bounds.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function HIThemeGetTrackBounds( const inDrawInfo: HIThemeTrackDrawInfo; var outBounds: HIRect ): OSStatus; external name '_HIThemeGetTrackBounds';


{
 *  HIThemeGetTrackPartBounds()
 *
 *  Summary:
 *    Returns measurements for the bounds of the a track part,
 *    according to the specifics of that track as specified in the
 *    incoming draw info record.
 *
 *  Discussion:
 *    HIThemeGetTrackPartBounds allows you to get the boundaries of
 *    individual pieces of a track's theme layout.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inDrawInfo:
 *      An HIThemeTrackDrawInfo describing the track to be measured.
 *
 *    inPartCode:
 *      A ControlPartCode describing which part to measure.  A list of
 *      available ControlPartCodes can be retrieved using
 *      HIThemeGetTrackPartBounds.
 *
 *    outPartBounds:
 *      The bounds of the specified part relative to the start
 *      rectangle specified in inDrawInfo.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function HIThemeGetTrackPartBounds( const inDrawInfo: HIThemeTrackDrawInfo; inPartCode: ControlPartCode; var outPartBounds: HIRect ): OSStatus; external name '_HIThemeGetTrackPartBounds';


{
 *  HIThemeGetTrackParts()
 *
 *  Summary:
 *    Counts the number of parts that make up a track.  Optionally
 *    returns an array of ControlPartCodes that describe each of the
 *    counted parts.
 *
 *  Discussion:
 *    HIThemeGetTrackParts allows you to count the number of parts that
 *    make up a track.  This is useful if you need to iterate through
 *    the parts of a track and get information about them, i.e. using
 *    HIThemeGetTrackPartBounds.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inDrawInfo:
 *      An HIThemeTrackDrawInfo describing the track to be measured.
 *
 *    outNumberOfParts:
 *      A pointer to a UInt32 in which to return the number of counted
 *      parts.
 *
 *    inMaxParts:
 *      The maximum number of ControlPartCodes that can be copied into
 *      the supplied ioPartsBuffer.  This value is ignored if
 *      ioPartsBuffer is NULL.
 *
 *    ioPartsBuffer:
 *      An pointer to an array into which HIThemeGetTrackPartBounds
 *      will copy ControlPartCodes that describe each of the counted
 *      parts.  This pointer can be NULL if you are just counting parts.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function HIThemeGetTrackParts( const inDrawInfo: HIThemeTrackDrawInfo; var outNumberOfParts: UInt32; inMaxParts: UInt32; ioPartsBuffer: ControlPartCodePtr ): OSStatus; external name '_HIThemeGetTrackParts';


{
 *  HIThemeGetTrackDragRect()
 *
 *  Summary:
 *    Get the rectangle of the drag area of a themed track.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inDrawInfo:
 *      An HIThemeTrackDrawInfo describing the track to be measured.
 *
 *    outDragRect:
 *      A pointer to an HIRect in which will be returned the rectangle
 *      of the drag area of the track.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function HIThemeGetTrackDragRect( const inDrawInfo: HIThemeTrackDrawInfo; var outDragRect: HIRect ): OSStatus; external name '_HIThemeGetTrackDragRect';


{
 *  HIThemeGetTrackThumbPositionFromOffset()
 *
 *  Summary:
 *    Get the track's relative thumb position based on the offset.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inDrawInfo:
 *      An HIThemeTrackDrawInfo describing the track to be measured.
 *
 *    inThumbOffset:
 *      An HIPoint describing the position of the thumb as an offset
 *      from the track bounds.
 *
 *    outRelativePosition:
 *      On output, the track-relative position calculated from the
 *      thumb offset.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function HIThemeGetTrackThumbPositionFromOffset( const inDrawInfo: HIThemeTrackDrawInfo; const inThumbOffset: HIPoint; var outRelativePosition: Float32 ): OSStatus; external name '_HIThemeGetTrackThumbPositionFromOffset';


{
 *  HIThemeGetTrackThumbPositionFromBounds()
 *
 *  Summary:
 *    Get the themed track thumb position from its bounds.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inDrawInfo:
 *      A pointer to an HIThemeTrackDrawInfo describing the track to be
 *      measured.
 *
 *    inThumbBounds:
 *      The bounds of the thumb from which the postion is to be
 *      calculated.
 *
 *    outRelativePosition:
 *      On output, the track-relative position calculated from the
 *      thumb location.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function HIThemeGetTrackThumbPositionFromBounds( const inDrawInfo: HIThemeTrackDrawInfo; const inThumbBounds: HIRect; var outRelativePosition: Float32 ): OSStatus; external name '_HIThemeGetTrackThumbPositionFromBounds';


{
 *  HIThemeGetTrackLiveValue()
 *
 *  Summary:
 *    Get the themed track live value.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inDrawInfo:
 *      An HIThemeTrackDrawInfo describing the track to be measured.
 *
 *    inRelativePosition:
 *      An HIPoint describing the position of the thumb as an offset
 *      from the track bounds.
 *
 *    outValue:
 *      On output, the track value as calculated from the relative
 *      postion of the thumb.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function HIThemeGetTrackLiveValue( const inDrawInfo: HIThemeTrackDrawInfo; inRelativePosition: Float32; var outValue: SInt32 ): OSStatus; external name '_HIThemeGetTrackLiveValue';


{
 *  HIThemeGetScrollBarTrackRect()
 *
 *  Summary:
 *    Gets the rectangle of the tracking area of a themed scroll bar.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inBounds:
 *      An HIRect indicating the area in which the scroll bar will be
 *      drawn.
 *
 *    inTrackInfo:
 *      An HIScrollBarTrackInfo for the scroll bar to be drawn.
 *      Currently, only the pressState and enableState fields are used.
 *
 *    inIsHoriz:
 *      A Boolean where true means that the scroll bar is to be
 *      horizontal and false means that the scroll bar is to be
 *      vertical.
 *
 *    outTrackBounds:
 *      A pointer to an HIRect in which will be returned the rectangle
 *      of the track area of the scroll bar.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function HIThemeGetScrollBarTrackRect( const inBounds: HIRect; const inTrackInfo: HIScrollBarTrackInfo; inIsHoriz: Boolean; var outTrackBounds: HIRect ): OSStatus; external name '_HIThemeGetScrollBarTrackRect';


{
 *  HIThemeHitTestScrollBarArrows()
 *
 *  Summary:
 *    Hit test the theme scroll bar arrows to determine where the hit
 *    occurred.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inScrollBarBounds:
 *      An HIRect indicating the bounds of the scroll bar that will be
 *      hit tested.
 *
 *    inTrackInfo:
 *      An HIScrollBarTrackInfo for the scroll bar to be drawn.
 *      Currently, only the version, pressState and enableState fields
 *      are used.
 *
 *    inIsHoriz:
 *      A Boolean where true means that the scroll bar is to be
 *      horizontal and false means that the scroll bar is to be
 *      vertical.
 *
 *    inPtHit:
 *      An HIPoint indicating where the control was hit and which will
 *      be used for hit testing.
 *
 *    outTrackBounds:
 *      A pointer to an HIRect in which will be returned the rectangle
 *      of the track area of the scroll bar.  Can be NULL.
 *
 *    outPartCode:
 *      A pointer to a ControlPartCode in which the part code of the
 *      hit part will be returned.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function HIThemeHitTestScrollBarArrows( const inScrollBarBounds: HIRect; const inTrackInfo: HIScrollBarTrackInfo; inIsHoriz: Boolean; const inPtHit: HIPoint; outTrackBounds: HIRectPtr; var outPartCode: ControlPartCode ): Boolean; external name '_HIThemeHitTestScrollBarArrows';


{
 *  HIThemeDrawScrollBarDelimiters()
 *
 *  Summary:
 *    Draw themed scroll bar delimiters.
 *
 *  Discussion:
 *    Draws the grow lines delimiting the scroll bar areas.  Does not
 *    draw the size box.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inContRect:
 *      An HIRect indicating the rectangle of the content area of the
 *      window to be drawn.
 *
 *    inDrawInfo:
 *      The HIThemeScrollBarDelimitersDrawInfo of the delimiters to be
 *      drawn.
 *
 *    inContext:
 *      The CG context in which the drawing is to be done.
 *
 *    inOrientation:
 *      An HIThemeOrientation that describes the orientation of the
 *      passed in context.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function HIThemeDrawScrollBarDelimiters( const inContRect: HIRect; const inDrawInfo: HIThemeScrollBarDelimitersDrawInfo; inContext: CGContextRef; inOrientation: HIThemeOrientation ): OSStatus; external name '_HIThemeDrawScrollBarDelimiters';


{ -------------------------------------------------------------------------- }
{  Windows                                                                   }
{ -------------------------------------------------------------------------- }
{
 *  HIThemeDrawWindowFrame()
 *
 *  Summary:
 *    Draws a themed window frame.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inContRect:
 *      An HIRect indicating the rectangle of the content area of the
 *      window to be drawn.
 *
 *    inDrawInfo:
 *      The HIThemeWindowDrawInfo of the window frame to be drawn.
 *
 *    inContext:
 *      The CG context in which the drawing is to be done.
 *
 *    inOrientation:
 *      An HIThemeOrientation that describes the orientation of the
 *      passed in context.
 *
 *    outTitleRect:
 *      A pointer to an HIRect into which to put the bounds of the
 *      title rect.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function HIThemeDrawWindowFrame( const inContRect: HIRect; const inDrawInfo: HIThemeWindowDrawInfo; inContext: CGContextRef; inOrientation: HIThemeOrientation; outTitleRect: HIRectPtr ): OSStatus; external name '_HIThemeDrawWindowFrame';


{
 *  HIThemeDrawTitleBarWidget()
 *
 *  Summary:
 *    Draws the requested theme title bar widget.
 *
 *  Discussion:
 *    HIThemeDrawTitleBarWidget renders the requested theme title bar
 *    widget in the proper location of a window.  A common
 *    misconception when using this API is that the client must specify
 *    the exact location of the widget in the window. The widget will
 *    locate itself in the window based relative to the content rect
 *    passed in content rectangle -- the contRect parameter.  Another
 *    common problem is to ignore the window's attributes.  The
 *    attributes must be set up properly to describe the window for
 *    which the widget is to be drawn.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inContRect:
 *      A rectangle describing the window's content area.  The widget
 *      is drawn relative to the content rectangle of the window, so
 *      this parameter does not describe the actual widget bounds, it
 *      describes the window's content rectangle.
 *
 *    inDrawInfo:
 *      The HIThemeWindowWidgetDrawInfo of the window widget to be
 *      drawn.
 *
 *    inContext:
 *      The CG context in which the drawing is to be done.
 *
 *    inOrientation:
 *      An HIThemeOrientation that describes the orientation of the
 *      passed in context.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function HIThemeDrawTitleBarWidget( const inContRect: HIRect; const inDrawInfo: HIThemeWindowWidgetDrawInfo; inContext: CGContextRef; inOrientation: HIThemeOrientation ): OSStatus; external name '_HIThemeDrawTitleBarWidget';


{
 *  HIThemeDrawGrowBox()
 *
 *  Summary:
 *    Draws a theme grow box.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inOrigin:
 *      The origin from which to draw the grow box.
 *
 *    inDrawInfo:
 *      An HIThemeGrowBoxDrawInfo describing the grow box to be drawn
 *      or measured.
 *
 *    inContext:
 *      The CG context in which the drawing is to be done.
 *
 *    inOrientation:
 *      An HIThemeOrientation that describes the orientation of the
 *      passed in context.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function HIThemeDrawGrowBox( const inOrigin: HIPoint; const inDrawInfo: HIThemeGrowBoxDrawInfo; inContext: CGContextRef; inOrientation: HIThemeOrientation ): OSStatus; external name '_HIThemeDrawGrowBox';


{
 *  HIThemeGetGrowBoxBounds()
 *
 *  Summary:
 *    Gets the bounds for a grow box.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inOrigin:
 *      The origin from which to draw the grow box.
 *
 *    inDrawInfo:
 *      An HIThemeGrowBoxDrawInfo describing the grow box to be drawn
 *      or measured. The state field is ignored.
 *
 *    outBounds:
 *      A pointer to an HIRect in which will be returned the rectangle
 *      of the standalone grow box bounds.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function HIThemeGetGrowBoxBounds( const inOrigin: HIPoint; const inDrawInfo: HIThemeGrowBoxDrawInfo; var outBounds: HIRect ): OSStatus; external name '_HIThemeGetGrowBoxBounds';


{
 *  HIThemeGetWindowShape()
 *
 *  Summary:
 *    Obtains the specified window shape.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inContRect:
 *      An HIRect indicating the rectangle of the content area of the
 *      window to be drawn.
 *
 *    inDrawInfo:
 *      The HIThemeWindowDrawInfo of the window frame to be measured.
 *
 *    inWinRegion:
 *      A WindowRegionCode indicating the desired region for which to
 *      return the shape.
 *
 *    outShape:
 *      A pointer to an HIShapeRef which will be set to the shape of
 *      the requested window region. Needs to be released by caller.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function HIThemeGetWindowShape( const inContRect: HIRect; const inDrawInfo: HIThemeWindowDrawInfo; inWinRegion: WindowRegionCode; var outShape: HIShapeRef ): OSStatus; external name '_HIThemeGetWindowShape';


{
 *  HIThemeGetWindowRegionHit()
 *
 *  Summary:
 *    Get the window region hit in a themed window.
 *
 *  Discussion:
 *    Not that this call does not return a region, but a region code.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inContRect:
 *      An HIRect indicating the rectangle of the content area of the
 *      window to be drawn.
 *
 *    inDrawInfo:
 *      The HIThemeWindowDrawInfo of the window frame to be measured.
 *
 *    inPoint:
 *      An HIPoint against which the test will occur.
 *
 *    outRegionHit:
 *      The output WindowRegionCode of hit window region.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function HIThemeGetWindowRegionHit( const inContRect: HIRect; const inDrawInfo: HIThemeWindowDrawInfo; const inPoint: HIPoint; var outRegionHit: WindowRegionCode ): Boolean; external name '_HIThemeGetWindowRegionHit';


{ -------------------------------------------------------------------------- }
{  Miscellaneous                                                             }
{ -------------------------------------------------------------------------- }
{
 *  HIThemeDrawFrame()
 *
 *  Summary:
 *    Draws a variety of frames frame.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inRect:
 *      The HIRect in which to draw.
 *
 *    inDrawInfo:
 *      An HIThemeFrameDrawInfo describing the frame to be drawn or
 *      measured.
 *
 *    inContext:
 *      The CG context in which the drawing is to be done.
 *
 *    inOrientation:
 *      An HIThemeOrientation that describes the orientation of the
 *      passed in context.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function HIThemeDrawFrame( const inRect: HIRect; const inDrawInfo: HIThemeFrameDrawInfo; inContext: CGContextRef; inOrientation: HIThemeOrientation ): OSStatus; external name '_HIThemeDrawFrame';


{
 *  HIThemeDrawGroupBox()
 *
 *  Summary:
 *    Draws a themed primary group box.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inRect:
 *      The HIRect in which to draw.
 *
 *    inDrawInfo:
 *      An HIThemeGroupBoxDrawInfo describing the group box to be drawn
 *      or measured.
 *
 *    inContext:
 *      The CG context in which the drawing is to be done.
 *
 *    inOrientation:
 *      An HIThemeOrientation that describes the orientation of the
 *      passed in context.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function HIThemeDrawGroupBox( const inRect: HIRect; const inDrawInfo: HIThemeGroupBoxDrawInfo; inContext: CGContextRef; inOrientation: HIThemeOrientation ): OSStatus; external name '_HIThemeDrawGroupBox';


{
 *  HIThemeDrawGenericWell()
 *
 *  Summary:
 *    Draws a themed generic well.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inRect:
 *      The HIRect in which to draw.
 *
 *    inDrawInfo:
 *      An HIThemeButtonDrawInfo that describes attributes of the well
 *      to be drawn.
 *
 *    inContext:
 *      The CG context in which the drawing is to be done.
 *
 *    inOrientation:
 *      An HIThemeOrientation that describes the orientation of the
 *      passed in context.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function HIThemeDrawGenericWell( const inRect: HIRect; const inDrawInfo: HIThemeButtonDrawInfo; inContext: CGContextRef; inOrientation: HIThemeOrientation ): OSStatus; external name '_HIThemeDrawGenericWell';


{
 *  HIThemeDrawPaneSplitter()
 *
 *  Summary:
 *    Draws a themed pane splitter.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inRect:
 *      The HIRect in which to draw.
 *
 *    inDrawInfo:
 *      The HIThemeSplitterDrawInfo of the pane splitter to be drawn.
 *
 *    inContext:
 *      The CG context in which the drawing is to be done.
 *
 *    inOrientation:
 *      An HIThemeOrientation that describes the orientation of the
 *      passed in context.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function HIThemeDrawPaneSplitter( const inRect: HIRect; const inDrawInfo: HIThemeSplitterDrawInfo; inContext: CGContextRef; inOrientation: HIThemeOrientation ): OSStatus; external name '_HIThemeDrawPaneSplitter';


{
 *  HIThemeDrawGrabber()
 *
 *  Summary:
 *    Draws a themed grabber.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inRect:
 *      The HIRect in which to draw.
 *
 *    inDrawInfo:
 *      The HIThemeGrabberDrawInfo of the grabber to be drawn.
 *
 *    inContext:
 *      The CG context in which the drawing is to be done.
 *
 *    inOrientation:
 *      An HIThemeOrientation that describes the orientation of the
 *      passed in context.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function HIThemeDrawGrabber( const inRect: HIRect; const inDrawInfo: HIThemeGrabberDrawInfo; inContext: CGContextRef; inOrientation: HIThemeOrientation ): OSStatus; external name '_HIThemeDrawGrabber';


{
 *  HIThemeDrawPlacard()
 *
 *  Summary:
 *    Draws a themed placard.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inRect:
 *      The HIRect in which to draw.
 *
 *    inDrawInfo:
 *      The HIThemePlacardDrawInfo of the placard to be drawn.
 *
 *    inContext:
 *      The CG context in which the drawing is to be done.
 *
 *    inOrientation:
 *      An HIThemeOrientation that describes the orientation of the
 *      passed in context.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function HIThemeDrawPlacard( const inRect: HIRect; const inDrawInfo: HIThemePlacardDrawInfo; inContext: CGContextRef; inOrientation: HIThemeOrientation ): OSStatus; external name '_HIThemeDrawPlacard';


{
 *  HIThemeDrawHeader()
 *
 *  Summary:
 *    Draws a themed window header in the specified rectangle.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inRect:
 *      The HIRect in which to draw.
 *
 *    inDrawInfo:
 *      The HIThemeHeaderDrawInfo of the window frame to be drawn.
 *
 *    inContext:
 *      The CG context in which the drawing is to be done.
 *
 *    inOrientation:
 *      An HIThemeOrientation that describes the orientation of the
 *      passed in context.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function HIThemeDrawHeader( const inRect: HIRect; const inDrawInfo: HIThemeHeaderDrawInfo; inContext: CGContextRef; inOrientation: HIThemeOrientation ): OSStatus; external name '_HIThemeDrawHeader';


{
 *  HIThemeDrawFocusRect()
 *
 *  Summary:
 *    Draws a themed focus rectangle in the specified rectangle.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inRect:
 *      The HIRect in which to draw.
 *
 *    inHasFocus:
 *      A Boolean indicating whether there is to be focus or not.  If
 *      there is no focus, the focus area will be erased instead of
 *      drawn.
 *
 *    inContext:
 *      The CG context in which the drawing is to be done.
 *
 *    inOrientation:
 *      An HIThemeOrientation that describes the orientation of the
 *      passed in context.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function HIThemeDrawFocusRect( const inRect: HIRect; inHasFocus: Boolean; inContext: CGContextRef; inOrientation: HIThemeOrientation ): OSStatus; external name '_HIThemeDrawFocusRect';


{
 *  HIThemeDrawSeparator()
 *
 *  Summary:
 *    Draw a themed separator element.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inRect:
 *      The HIRect in which to draw.
 *
 *    inDrawInfo:
 *      The HIThemeSeparatorDrawInfo of the window frame to be drawn.
 *
 *    inContext:
 *      The CG context in which the drawing is to be done.
 *
 *    inOrientation:
 *      An HIThemeOrientation that describes the orientation of the
 *      passed in context.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function HIThemeDrawSeparator( const inRect: HIRect; const inDrawInfo: HIThemeSeparatorDrawInfo; inContext: CGContextRef; inOrientation: HIThemeOrientation ): OSStatus; external name '_HIThemeDrawSeparator';


{
 *  HIThemeApplyBackground()
 *
 *  Summary:
 *    Apply a themed background to a rectangle.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inBounds:
 *      An HIRect for the background.
 *
 *    inDrawInfo:
 *      An HIThemeBackgroundDrawInfo describing the background to be
 *      drawn.
 *
 *    inContext:
 *      The CG context in which the drawing is to be done.
 *
 *    inOrientation:
 *      An HIThemeOrientation that describes the orientation of the
 *      passed in context.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function HIThemeApplyBackground( const inBounds: HIRect; const inDrawInfo: HIThemeBackgroundDrawInfo; inContext: CGContextRef; inOrientation: HIThemeOrientation ): OSStatus; external name '_HIThemeApplyBackground';


{
 *  HIThemeDrawBackground()
 *
 *  Summary:
 *    Draw a themed background for a rectangle.
 *
 *  Mac OS X threading:
 *    Not thread safe
 *
 *  Parameters:
 *
 *    inBounds:
 *      An HIRect indicating the bounds to fill with the background.
 *      For background that need pattern continuity, such as
 *      kThemeBackgroundMetal, this rectangle is the full bounds of the
 *      rectangle for which the filling is to occur. If drawing a
 *      sub-rectangle of that background, set the clip and draw the
 *      full rectangle. This routine has been optimized to not perform
 *      calculations on the non-clip part of the drawing bounds.
 *      CURRENTLY, THIS API ONLY WORKS WITH kThemeBackgroundMetal.
 *
 *    inDrawInfo:
 *      An HIThemeBackgroundDrawInfo describing the background to be
 *      drawn.
 *
 *    inContext:
 *      The CG context in which the drawing is to be done.
 *
 *    inOrientation:
 *      An HIThemeOrientation that describes the orientation of the
 *      passed in context.
 *
 *  Availability:
 *    Mac OS X:         in version 10.3 and later in Carbon.framework
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
 *    Non-Carbon CFM:   not available
 }
// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
function HIThemeDrawBackground( const inBounds: HIRect; const inDrawInfo: HIThemeBackgroundDrawInfo; inContext: CGContextRef; inOrientation: HIThemeOrientation ): OSStatus; external name '_HIThemeDrawBackground';
{unit ImageCompression}
{$ALIGN MAC68K}








{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}


type
    MatrixRecordPtr = ^MatrixRecord;
    MatrixRecord = record
        matrix:                 array [0..2,0..2] of Fixed;
    end;


const
    kRawCodecType               = $72617720 (* 'raw ' *);
    kCinepakCodecType           = $63766964 (* 'cvid' *);
    kGraphicsCodecType          = $736D6320 (* 'smc ' *);
    kAnimationCodecType         = $726C6520 (* 'rle ' *);
    kVideoCodecType             = $72707A61 (* 'rpza' *);
    kComponentVideoCodecType    = $79757632 (* 'yuv2' *);
    kJPEGCodecType              = $6A706567 (* 'jpeg' *);
    kMotionJPEGACodecType       = $6D6A7061 (* 'mjpa' *);
    kMotionJPEGBCodecType       = $6D6A7062 (* 'mjpb' *);
    kSGICodecType               = $2E534749 (* '.SGI' *);
    kPlanarRGBCodecType         = $38425053 (* '8BPS' *);
    kMacPaintCodecType          = $504E5447 (* 'PNTG' *);
    kGIFCodecType               = $67696620 (* 'gif ' *);
    kPhotoCDCodecType           = $6B706364 (* 'kpcd' *);
    kQuickDrawGXCodecType       = $71646778 (* 'qdgx' *);
    kAVRJPEGCodecType           = $61767220 (* 'avr ' *);
    kOpenDMLJPEGCodecType       = $646D6231 (* 'dmb1' *);
    kBMPCodecType               = $57524C45 (* 'WRLE' *);
    kWindowsRawCodecType        = $57524157 (* 'WRAW' *);
    kVectorCodecType            = $70617468 (* 'path' *);
    kQuickDrawCodecType         = $71647277 (* 'qdrw' *);
    kWaterRippleCodecType       = $7269706C (* 'ripl' *);
    kFireCodecType              = $66697265 (* 'fire' *);
    kCloudCodecType             = $636C6F75 (* 'clou' *);
    kH261CodecType              = $68323631 (* 'h261' *);
    kH263CodecType              = $68323633 (* 'h263' *);
    kDVCNTSCCodecType           = $64766320 (* 'dvc ' *);                       {  DV - NTSC and DVCPRO NTSC (available in QuickTime 6.0 or later) }
                                                                {  NOTE: kDVCProNTSCCodecType is deprecated.   }
                                                                {  Use kDVCNTSCCodecType instead -- as far as the codecs are concerned,  }
                                                                {  the two data formats are identical. }
    kDVCPALCodecType            = $64766370 (* 'dvcp' *);
    kDVCProPALCodecType         = $64767070 (* 'dvpp' *);                       {  available in QuickTime 6.0 or later }
    kBaseCodecType              = $62617365 (* 'base' *);
    kFLCCodecType               = $666C6963 (* 'flic' *);
    kTargaCodecType             = $74676120 (* 'tga ' *);
    kPNGCodecType               = $706E6720 (* 'png ' *);
    kTIFFCodecType              = $74696666 (* 'tiff' *);                       {     NOTE: despite what might seem obvious from the two constants }
                                                                {     below and their names, they really are correct. 'yuvu' really  }
                                                                {     does mean signed, and 'yuvs' really does mean unsigned. Really.  }
    kComponentVideoSigned       = $79757675 (* 'yuvu' *);
    kComponentVideoUnsigned     = $79757673 (* 'yuvs' *);
    kCMYKCodecType              = $636D796B (* 'cmyk' *);
    kMicrosoftVideo1CodecType   = $6D737663 (* 'msvc' *);
    kSorensonCodecType          = $53565131 (* 'SVQ1' *);
    kSorenson3CodecType         = $53565133 (* 'SVQ3' *);                       {  available in QuickTime 5 and later }
    kIndeo4CodecType            = $49563431 (* 'IV41' *);
    kMPEG4VisualCodecType       = $6D703476 (* 'mp4v' *);
    k64ARGBCodecType            = $62363461 (* 'b64a' *);
    k48RGBCodecType             = $62343872 (* 'b48r' *);
    k32AlphaGrayCodecType       = $62333261 (* 'b32a' *);
    k16GrayCodecType            = $62313667 (* 'b16g' *);
    kMpegYUV420CodecType        = $6D797576 (* 'myuv' *);
    kYUV420CodecType            = $79343230 (* 'y420' *);
    kSorensonYUV9CodecType      = $73797639 (* 'syv9' *);
    k422YpCbCr8CodecType        = $32767579 (* '2vuy' *);                       {  Component Y'CbCr 8-bit 4:2:2   }
    k444YpCbCr8CodecType        = $76333038 (* 'v308' *);                       {  Component Y'CbCr 8-bit 4:4:4   }
    k4444YpCbCrA8CodecType      = $76343038 (* 'v408' *);                       {  Component Y'CbCrA 8-bit 4:4:4:4  }
    k422YpCbCr16CodecType       = $76323136 (* 'v216' *);                       {  Component Y'CbCr 10,12,14,16-bit 4:2:2 }
    k422YpCbCr10CodecType       = $76323130 (* 'v210' *);                       {  Component Y'CbCr 10-bit 4:2:2  }
    k444YpCbCr10CodecType       = $76343130 (* 'v410' *);                       {  Component Y'CbCr 10-bit 4:4:4  }
    k4444YpCbCrA8RCodecType     = $72343038 (* 'r408' *);                       {  Component Y'CbCrA 8-bit 4:4:4:4, rendering format. full range alpha, zero biased yuv }


    {    one source effects     }
    kBlurImageFilterType        = $626C7572 (* 'blur' *);
    kSharpenImageFilterType     = $73687270 (* 'shrp' *);
    kEdgeDetectImageFilterType  = $65646765 (* 'edge' *);
    kEmbossImageFilterType      = $656D6273 (* 'embs' *);
    kConvolveImageFilterType    = $67656E6B (* 'genk' *);
    kAlphaGainImageFilterType   = $6761696E (* 'gain' *);
    kRGBColorBalanceImageFilterType = $72676262 (* 'rgbb' *);
    kHSLColorBalanceImageFilterType = $68736C62 (* 'hslb' *);
    kColorSyncImageFilterType   = $73796E63 (* 'sync' *);
    kFilmNoiseImageFilterType   = $666D6E73 (* 'fmns' *);
    kSolarizeImageFilterType    = $736F6C72 (* 'solr' *);
    kColorTintImageFilterType   = $74696E74 (* 'tint' *);
    kLensFlareImageFilterType   = $6C656E73 (* 'lens' *);
    kBrightnessContrastImageFilterType = $6272636F (* 'brco' *);

    {    two source effects     }
    kAlphaCompositorTransitionType = $626C6E64 (* 'blnd' *);
    kCrossFadeTransitionType    = $64736C76 (* 'dslv' *);
    kChannelCompositeEffectType = $6368616E (* 'chan' *);
    kChromaKeyTransitionType    = $636B6579 (* 'ckey' *);
    kImplodeTransitionType      = $6D706C6F (* 'mplo' *);
    kExplodeTransitionType      = $78706C6F (* 'xplo' *);
    kGradientTransitionType     = $6D617474 (* 'matt' *);
    kPushTransitionType         = $70757368 (* 'push' *);
    kSlideTransitionType        = $736C6964 (* 'slid' *);
    kWipeTransitionType         = $736D7074 (* 'smpt' *);
    kIrisTransitionType         = $736D7032 (* 'smp2' *);
    kRadialTransitionType       = $736D7033 (* 'smp3' *);
    kMatrixTransitionType       = $736D7034 (* 'smp4' *);
    kZoomTransitionType         = $7A6F6F6D (* 'zoom' *);

    {    three source effects   }
    kTravellingMatteEffectType  = $74726176 (* 'trav' *);


    {    Supported by QTNewGWorld in QuickTime 4.0 and later    }
    kCMYKPixelFormat            = $636D796B (* 'cmyk' *);                       {  CMYK, 8-bit  }
    k64ARGBPixelFormat          = $62363461 (* 'b64a' *);                       {  ARGB, 16-bit big-endian samples  }
    k48RGBPixelFormat           = $62343872 (* 'b48r' *);                       {  RGB, 16-bit big-endian samples  }
    k32AlphaGrayPixelFormat     = $62333261 (* 'b32a' *);                       {  AlphaGray, 16-bit big-endian samples  }
    k16GrayPixelFormat          = $62313667 (* 'b16g' *);                       {  Grayscale, 16-bit big-endian samples  }
    k422YpCbCr8PixelFormat      = $32767579 (* '2vuy' *);                       {  Component Y'CbCr 8-bit 4:2:2, ordered Cb Y'0 Cr Y'1  }

    {    Supported by QTNewGWorld in QuickTime 4.1.2 and later  }
    k4444YpCbCrA8PixelFormat    = $76343038 (* 'v408' *);                       {  Component Y'CbCrA 8-bit 4:4:4:4, ordered Cb Y' Cr A  }
    k4444YpCbCrA8RPixelFormat   = $72343038 (* 'r408' *);                       {  Component Y'CbCrA 8-bit 4:4:4:4, rendering format. full range alpha, zero biased yuv, ordered A Y' Cb Cr  }

    {    Supported by QTNewGWorld in QuickTime 6.0 and later    }
    kYUV420PixelFormat          = $79343230 (* 'y420' *);                       {  Planar Component Y'CbCr 8-bit 4:2:0.  PixMap baseAddr points to a big-endian PlanarPixmapInfoYUV420 struct; see ImageCodec.i.  }


    {    These are the bits that are set in the Component flags, and also in the codecInfo struct.  }
    codecInfoDoes1              = $00000001;                    {  codec can work with 1-bit pixels  }
    codecInfoDoes2              = $00000002;                    {  codec can work with 2-bit pixels  }
    codecInfoDoes4              = $00000004;                    {  codec can work with 4-bit pixels  }
    codecInfoDoes8              = $00000008;                    {  codec can work with 8-bit pixels  }
    codecInfoDoes16             = $00000010;                    {  codec can work with 16-bit pixels  }
    codecInfoDoes32             = $00000020;                    {  codec can work with 32-bit pixels  }
    codecInfoDoesDither         = $00000040;                    {  codec can do ditherMode  }
    codecInfoDoesStretch        = $00000080;                    {  codec can stretch to arbitrary sizes  }
    codecInfoDoesShrink         = $00000100;                    {  codec can shrink to arbitrary sizes  }
    codecInfoDoesMask           = $00000200;                    {  codec can mask to clipping regions  }
    codecInfoDoesTemporal       = $00000400;                    {  codec can handle temporal redundancy  }
    codecInfoDoesDouble         = $00000800;                    {  codec can stretch to double size exactly  }
    codecInfoDoesQuad           = $00001000;                    {  codec can stretch to quadruple size exactly  }
    codecInfoDoesHalf           = $00002000;                    {  codec can shrink to half size  }
    codecInfoDoesQuarter        = $00004000;                    {  codec can shrink to quarter size  }
    codecInfoDoesRotate         = $00008000;                    {  codec can rotate on decompress  }
    codecInfoDoesHorizFlip      = $00010000;                    {  codec can flip horizontally on decompress  }
    codecInfoDoesVertFlip       = $00020000;                    {  codec can flip vertically on decompress  }
    codecInfoHasEffectParameterList = $00040000;                {  codec implements get effects parameter list call, once was codecInfoDoesSkew  }
    codecInfoDoesBlend          = $00080000;                    {  codec can blend on decompress  }
    codecInfoDoesWarp           = $00100000;                    {  codec can warp arbitrarily on decompress  }
    codecInfoDoesRecompress     = $00200000;                    {  codec can recompress image without accumulating errors  }
    codecInfoDoesSpool          = $00400000;                    {  codec can spool image data  }
    codecInfoDoesRateConstrain  = $00800000;                    {  codec can data rate constrain  }


    codecInfoDepth1             = $00000001;                    {  compressed data at 1 bpp depth available  }
    codecInfoDepth2             = $00000002;                    {  compressed data at 2 bpp depth available  }
    codecInfoDepth4             = $00000004;                    {  compressed data at 4 bpp depth available  }
    codecInfoDepth8             = $00000008;                    {  compressed data at 8 bpp depth available  }
    codecInfoDepth16            = $00000010;                    {  compressed data at 16 bpp depth available  }
    codecInfoDepth32            = $00000020;                    {  compressed data at 32 bpp depth available  }
    codecInfoDepth24            = $00000040;                    {  compressed data at 24 bpp depth available  }
    codecInfoDepth33            = $00000080;                    {  compressed data at 1 bpp monochrome depth  available  }
    codecInfoDepth34            = $00000100;                    {  compressed data at 2 bpp grayscale depth available  }
    codecInfoDepth36            = $00000200;                    {  compressed data at 4 bpp grayscale depth available  }
    codecInfoDepth40            = $00000400;                    {  compressed data at 8 bpp grayscale depth available  }
    codecInfoStoresClut         = $00000800;                    {  compressed data can have custom cluts  }
    codecInfoDoesLossless       = $00001000;                    {  compressed data can be stored in lossless format  }
    codecInfoSequenceSensitive  = $00002000;                    {  compressed data is sensitive to out of sequence decoding  }


    {  input sequence flags }
    codecFlagUseImageBuffer     = $00000001;                    {  decompress }
    codecFlagUseScreenBuffer    = $00000002;                    {  decompress }
    codecFlagUpdatePrevious     = $00000004;                    {  compress }
    codecFlagNoScreenUpdate     = $00000008;                    {  decompress }
    codecFlagWasCompressed      = $00000010;                    {  compress }
    codecFlagDontOffscreen      = $00000020;                    {  decompress }
    codecFlagUpdatePreviousComp = $00000040;                    {  compress }
    codecFlagForceKeyFrame      = $00000080;                    {  compress }
    codecFlagOnlyScreenUpdate   = $00000100;                    {  decompress }
    codecFlagLiveGrab           = $00000200;                    {  compress }
    codecFlagDiffFrame          = $00000200;                    {  decompress }
    codecFlagDontUseNewImageBuffer = $00000400;                 {  decompress }
    codecFlagInterlaceUpdate    = $00000800;                    {  decompress }
    codecFlagCatchUpDiff        = $00001000;                    {  decompress }
    codecFlagSupportDisable     = $00002000;                    {  decompress }
    codecFlagReenable           = $00004000;                    {  decompress }


    {  output sequence flags }
    codecFlagOutUpdateOnNextIdle = $00000200;
    codecFlagOutUpdateOnDataSourceChange = $00000400;
    codecFlagSequenceSensitive  = $00000800;
    codecFlagOutUpdateOnTimeChange = $00001000;
    codecFlagImageBufferNotSourceImage = $00002000;
    codecFlagUsedNewImageBuffer = $00004000;
    codecFlagUsedImageBuffer    = $00008000;



                                                                {  The minimum data size for spooling in or out data  }
    codecMinimumDataSize        = 32768;



    compressorComponentType     = $696D636F (* 'imco' *);                       {  the type for "Components" which compress images  }
    decompressorComponentType   = $696D6463 (* 'imdc' *);                       {  the type for "Components" which decompress images  }


type
    CompressorComponent                 = Component;
    DecompressorComponent               = Component;
    CodecComponent                      = Component;

const
    anyCodec                    = 0;                            {  take first working codec of given type  }
    bestSpeedCodec              = -1;                           {  take fastest codec of given type  }
    bestFidelityCodec           = -2;                           {  take codec which is most accurate  }
    bestCompressionCodec        = -3;                           {  take codec of given type that is most accurate  }


type
    CodecType                           = OSType;
    CodecFlags                          = UInt16;
    CodecQ                              = UInt32;

const
    codecLosslessQuality        = $00000400;
    codecMaxQuality             = $000003FF;
    codecMinQuality             = $00000000;
    codecLowQuality             = $00000100;
    codecNormalQuality          = $00000200;
    codecHighQuality            = $00000300;

    codecLockBitsShieldCursor   = $01;                          {  shield cursor  }

    codecCompletionSource       = $01;                          {  asynchronous codec is done with source data  }
    codecCompletionDest         = $02;                          {  asynchronous codec is done with destination data  }
    codecCompletionDontUnshield = $04;                          {  on dest complete don't unshield cursor  }
    codecCompletionWentOffscreen = $08;                         {  codec used offscreen buffer  }
    codecCompletionUnlockBits   = $10;                          {  on dest complete, call ICMSequenceUnlockBits  }
    codecCompletionForceChainFlush = $20;                       {  ICM needs to flush the whole chain  }
    codecCompletionDropped      = $40;                          {  codec decided to drop this frame  }

    codecProgressOpen           = 0;
    codecProgressUpdatePercent  = 1;
    codecProgressClose          = 2;


type
    ICMDataProcPtr = function(var dataP: Ptr; bytesNeeded: SInt32; refcon: SInt32): OSErr;

    ICMFlushProcPtr = function(data: Ptr; bytesAdded: SInt32; refcon: SInt32): OSErr;

    ICMCompletionProcPtr = procedure(result: OSErr; flags: SInt16; refcon: SInt32);

    ICMProgressProcPtr = function(message: SInt16; completeness: Fixed; refcon: SInt32): OSErr;

    StdPixProcPtr = procedure(var src: PixMap; var srcRect: Rect; var matrix: MatrixRecord; mode: SInt16; mask: RgnHandle; var matte: PixMap; var matteRect: Rect; flags: SInt16);

    QDPixProcPtr = procedure(var src: PixMap; var srcRect: Rect; var matrix: MatrixRecord; mode: SInt16; mask: RgnHandle; var matte: PixMap; var matteRect: Rect; flags: SInt16);

    ICMAlignmentProcPtr = procedure(var rp: Rect; refcon: SInt32);

    ICMCursorShieldedProcPtr = procedure(const (*var*) r: Rect; refcon: UnivPtr; flags: SInt32);

    ICMMemoryDisposedProcPtr = procedure(memoryBlock: Ptr; refcon: UnivPtr);

    ICMCursorNotify                     = Ptr;
    ICMConvertDataFormatProcPtr = function(refCon: UnivPtr; flags: SInt32; desiredFormat: Handle; sourceDataFormat: Handle; srcData: UnivPtr; srcDataSize: SInt32; var dstData: UnivPtr; var dstDataSize: SInt32): OSErr;

    ICMDataUPP = ^SInt32; { an opaque UPP }
    ICMFlushUPP = ^SInt32; { an opaque UPP }
    ICMCompletionUPP = ^SInt32; { an opaque UPP }
    ICMProgressUPP = ^SInt32; { an opaque UPP }
    StdPixUPP = ^SInt32; { an opaque UPP }
    QDPixUPP = ^SInt32; { an opaque UPP }
    ICMAlignmentUPP = ^SInt32; { an opaque UPP }
    ICMCursorShieldedUPP = ^SInt32; { an opaque UPP }
    ICMMemoryDisposedUPP = ^SInt32; { an opaque UPP }
    ICMConvertDataFormatUPP = ^SInt32; { an opaque UPP }
    ImageSequence                       = SInt32;
    ImageSequenceDataSource             = SInt32;
    ImageTranscodeSequence              = SInt32;
    ImageFieldSequence                  = SInt32;
    ICMProgressProcRecordPtr = ^ICMProgressProcRecord;
    ICMProgressProcRecord = record
        progressProc:           ICMProgressUPP;
        progressRefCon:         SInt32;
    end;

    ICMCompletionProcRecordPtr = ^ICMCompletionProcRecord;
    ICMCompletionProcRecord = record
        completionProc:         ICMCompletionUPP;
        completionRefCon:       SInt32;
    end;

    ICMDataProcRecordPtr = ^ICMDataProcRecord;
    ICMDataProcRecord = record
        dataProc:               ICMDataUPP;
        dataRefCon:             SInt32;
    end;

    ICMFlushProcRecordPtr = ^ICMFlushProcRecord;
    ICMFlushProcRecord = record
        flushProc:              ICMFlushUPP;
        flushRefCon:            SInt32;
    end;

    ICMAlignmentProcRecordPtr = ^ICMAlignmentProcRecord;
    ICMAlignmentProcRecord = record
        alignmentProc:          ICMAlignmentUPP;
        alignmentRefCon:        SInt32;
    end;

    DataRateParamsPtr = ^DataRateParams;
    DataRateParams = record
        dataRate:               SInt32;
        dataOverrun:            SInt32;
        frameDuration:          SInt32;
        keyFrameRate:           SInt32;
        minSpatialQuality:      CodecQ;
        minTemporalQuality:     CodecQ;
    end;

    ImageDescriptionPtr = ^ImageDescription;
    ImageDescription = packed record
        idSize:                 SInt32;                             {  total size of ImageDescription including extra data ( CLUTs and other per sequence data )  }
        cType:                  CodecType;                              {  what kind of codec compressed this data  }
        resvd1:                 SInt32;                             {  reserved for Apple use  }
        resvd2:                 SInt16;                             {  reserved for Apple use  }
        dataRefIndex:           SInt16;                             {  set to zero   }
        version:                SInt16;                             {  which version is this data  }
        revisionLevel:          SInt16;                             {  what version of that codec did this  }
        vendor:                 SInt32;                             {  whose  codec compressed this data  }
        temporalQuality:        CodecQ;                                 {  what was the temporal quality factor   }
        spatialQuality:         CodecQ;                                 {  what was the spatial quality factor  }
        width:                  SInt16;                             {  how many pixels wide is this data  }
        height:                 SInt16;                             {  how many pixels high is this data  }
        hRes:                   Fixed;                                  {  horizontal resolution  }
        vRes:                   Fixed;                                  {  vertical resolution  }
        dataSize:               SInt32;                             {  if known, the size of data for this image descriptor  }
        frameCount:             SInt16;                             {  number of frames this description applies to  }
        name:                   Str31;                                  {  name of codec ( in case not installed )   }
        depth:                  SInt16;                             {  what depth is this data (1-32) or ( 33-40 grayscale )  }
        clutID:                 SInt16;                             {  clut id or if 0 clut follows  or -1 if no clut  }
    end;

    ImageDescriptionHandle              = ^ImageDescriptionPtr;
    CodecInfoPtr = ^CodecInfo;
    CodecInfo = packed record
        typeName:               Str31;                                  {  name of the codec type i.e.: 'Apple Image Compression'  }
        version:                SInt16;                             {  version of the codec data that this codec knows about  }
        revisionLevel:          SInt16;                             {  revision level of this codec i.e: 0x00010001 (1.0.1)  }
        vendor:                 SInt32;                             {  Maker of this codec i.e: 'appl'  }
        decompressFlags:        SInt32;                             {  codecInfo flags for decompression capabilities  }
        compressFlags:          SInt32;                             {  codecInfo flags for compression capabilities  }
        formatFlags:            SInt32;                             {  codecInfo flags for compression format details  }
        compressionAccuracy:    UInt8;                                  {  measure (1-255) of accuracy of this codec for compress (0 if unknown)  }
        decompressionAccuracy:  UInt8;                                  {  measure (1-255) of accuracy of this codec for decompress (0 if unknown)  }
        compressionSpeed:       UInt16;                                 {  ( millisecs for compressing 320x240 on base mac II) (0 if unknown)   }
        decompressionSpeed:     UInt16;                                 {  ( millisecs for decompressing 320x240 on mac II)(0 if unknown)   }
        compressionLevel:       UInt8;                                  {  measure (1-255) of compression level of this codec (0 if unknown)   }
        resvd:                  UInt8;                                  {  pad  }
        minimumHeight:          SInt16;                             {  minimum height of image (block size)  }
        minimumWidth:           SInt16;                             {  minimum width of image (block size)  }
        decompressPipelineLatency: SInt16;                              {  in milliseconds ( for asynchronous codecs )  }
        compressPipelineLatency: SInt16;                                {  in milliseconds ( for asynchronous codecs )  }
        privateData:            SInt32;
    end;

    CodecNameSpecPtr = ^CodecNameSpec;
    CodecNameSpec = record
        codec:                  CodecComponent;
        cType:                  CodecType;
        typeName:               Str31;
        name:                   Handle;
    end;

    CodecNameSpecListPtr = ^CodecNameSpecList;
    CodecNameSpecList = record
        count:                  SInt16;
        list:                   array [0..0] of CodecNameSpec;
    end;


const
    defaultDither               = 0;
    forceDither                 = 1;
    suppressDither              = 2;
    useColorMatching            = 4;

    callStdBits                 = 1;
    callOldBits                 = 2;
    noDefaultOpcodes            = 4;

    graphicsModeStraightAlpha   = 256;
    graphicsModePreWhiteAlpha   = 257;
    graphicsModePreBlackAlpha   = 258;
    graphicsModeComposition     = 259;
    graphicsModeStraightAlphaBlend = 260;
    graphicsModePreMulColorAlpha = 261;

    evenField1ToEvenFieldOut    = $01;
    evenField1ToOddFieldOut     = $02;
    oddField1ToEvenFieldOut     = $04;
    oddField1ToOddFieldOut      = $08;
    evenField2ToEvenFieldOut    = $10;
    evenField2ToOddFieldOut     = $20;
    oddField2ToEvenFieldOut     = $40;
    oddField2ToOddFieldOut      = $80;

    icmFrameTimeHasVirtualStartTimeAndDuration = $01;


type
    ICMFrameTimeRecordPtr = ^ICMFrameTimeRecord;
    ICMFrameTimeRecord = record
        value:                  wide;                                   {  frame time }
        scale:                  SInt32;                             {  timescale of value/duration fields }
        base:                   Ptr;                                    {  timebase }
        duration:               SInt32;                             {  duration frame is to be displayed (0 if unknown) }
        rate:                   Fixed;                                  {  rate of timebase relative to wall-time }
        recordSize:             SInt32;                             {  total number of bytes in ICMFrameTimeRecord }
        frameNumber:            SInt32;                             {  number of frame, zero if not known }
        flags:                  SInt32;
        virtualStartTime:       wide;                                   {  conceptual start time }
        virtualDuration:        SInt32;                             {  conceptual duration }
    end;

    ICMFrameTimePtr                     = ^ICMFrameTimeRecord;
{$setc __QTUUID__ := 1}
    {  QuickTime flavor of universally unique identifier (uuid) }
    QTUUIDPtr = ^QTUUID;
    QTUUID = record
        data1:                  UInt32;
        data2:                  UInt16;
        data3:                  UInt16;
        data4:                  packed array [0..7] of UInt8;
    end;

    QTMediaContextID                    = QTUUID;
    QTMediaContextIDPtr                 = ^QTMediaContextID;


const
    uppICMDataProcInfo = $00000FE0;
    uppICMFlushProcInfo = $00000FE0;
    uppICMCompletionProcInfo = $00000E80;
    uppICMProgressProcInfo = $00000FA0;
    uppStdPixProcInfo = $002FEFC0;
    uppQDPixProcInfo = $002FEFC0;
    uppICMAlignmentProcInfo = $000003C0;
    uppICMCursorShieldedProcInfo = $00000FC0;
    uppICMMemoryDisposedProcInfo = $000003C0;
    uppICMConvertDataFormatProcInfo = $003FFFE0;
    {
     *  NewICMDataUPP()
     *
     *  Availability:
     *    Non-Carbon CFM:   available as macro/inline
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function NewICMDataUPP(userRoutine: ICMDataProcPtr): ICMDataUPP; external name '_NewICMDataUPP'; { old name was NewICMDataProc }
{
 *  NewICMFlushUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewICMFlushUPP(userRoutine: ICMFlushProcPtr): ICMFlushUPP; external name '_NewICMFlushUPP'; { old name was NewICMFlushProc }
{
 *  NewICMCompletionUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewICMCompletionUPP(userRoutine: ICMCompletionProcPtr): ICMCompletionUPP; external name '_NewICMCompletionUPP'; { old name was NewICMCompletionProc }
{
 *  NewICMProgressUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewICMProgressUPP(userRoutine: ICMProgressProcPtr): ICMProgressUPP; external name '_NewICMProgressUPP'; { old name was NewICMProgressProc }
{
 *  NewStdPixUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewStdPixUPP(userRoutine: StdPixProcPtr): StdPixUPP; external name '_NewStdPixUPP'; { old name was NewStdPixProc }
{
 *  NewQDPixUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewQDPixUPP(userRoutine: QDPixProcPtr): QDPixUPP; external name '_NewQDPixUPP'; { old name was NewQDPixProc }
{
 *  NewICMAlignmentUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewICMAlignmentUPP(userRoutine: ICMAlignmentProcPtr): ICMAlignmentUPP; external name '_NewICMAlignmentUPP'; { old name was NewICMAlignmentProc }
{
 *  NewICMCursorShieldedUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewICMCursorShieldedUPP(userRoutine: ICMCursorShieldedProcPtr): ICMCursorShieldedUPP; external name '_NewICMCursorShieldedUPP'; { old name was NewICMCursorShieldedProc }
{
 *  NewICMMemoryDisposedUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewICMMemoryDisposedUPP(userRoutine: ICMMemoryDisposedProcPtr): ICMMemoryDisposedUPP; external name '_NewICMMemoryDisposedUPP'; { old name was NewICMMemoryDisposedProc }
{
 *  NewICMConvertDataFormatUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewICMConvertDataFormatUPP(userRoutine: ICMConvertDataFormatProcPtr): ICMConvertDataFormatUPP; external name '_NewICMConvertDataFormatUPP'; { old name was NewICMConvertDataFormatProc }
{
 *  DisposeICMDataUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeICMDataUPP(userUPP: ICMDataUPP); external name '_DisposeICMDataUPP';
{
 *  DisposeICMFlushUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeICMFlushUPP(userUPP: ICMFlushUPP); external name '_DisposeICMFlushUPP';
{
 *  DisposeICMCompletionUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeICMCompletionUPP(userUPP: ICMCompletionUPP); external name '_DisposeICMCompletionUPP';
{
 *  DisposeICMProgressUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeICMProgressUPP(userUPP: ICMProgressUPP); external name '_DisposeICMProgressUPP';
{
 *  DisposeStdPixUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeStdPixUPP(userUPP: StdPixUPP); external name '_DisposeStdPixUPP';
{
 *  DisposeQDPixUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeQDPixUPP(userUPP: QDPixUPP); external name '_DisposeQDPixUPP';
{
 *  DisposeICMAlignmentUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeICMAlignmentUPP(userUPP: ICMAlignmentUPP); external name '_DisposeICMAlignmentUPP';
{
 *  DisposeICMCursorShieldedUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeICMCursorShieldedUPP(userUPP: ICMCursorShieldedUPP); external name '_DisposeICMCursorShieldedUPP';
{
 *  DisposeICMMemoryDisposedUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeICMMemoryDisposedUPP(userUPP: ICMMemoryDisposedUPP); external name '_DisposeICMMemoryDisposedUPP';
{
 *  DisposeICMConvertDataFormatUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeICMConvertDataFormatUPP(userUPP: ICMConvertDataFormatUPP); external name '_DisposeICMConvertDataFormatUPP';
{
 *  InvokeICMDataUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeICMDataUPP(var dataP: Ptr; bytesNeeded: SInt32; refcon: SInt32; userRoutine: ICMDataUPP): OSErr; external name '_InvokeICMDataUPP'; { old name was CallICMDataProc }
{
 *  InvokeICMFlushUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeICMFlushUPP(data: Ptr; bytesAdded: SInt32; refcon: SInt32; userRoutine: ICMFlushUPP): OSErr; external name '_InvokeICMFlushUPP'; { old name was CallICMFlushProc }
{
 *  InvokeICMCompletionUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvokeICMCompletionUPP(result: OSErr; flags: SInt16; refcon: SInt32; userRoutine: ICMCompletionUPP); external name '_InvokeICMCompletionUPP'; { old name was CallICMCompletionProc }
{
 *  InvokeICMProgressUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeICMProgressUPP(message: SInt16; completeness: Fixed; refcon: SInt32; userRoutine: ICMProgressUPP): OSErr; external name '_InvokeICMProgressUPP'; { old name was CallICMProgressProc }
{
 *  InvokeStdPixUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvokeStdPixUPP(var src: PixMap; var srcRect: Rect; var matrix: MatrixRecord; mode: SInt16; mask: RgnHandle; var matte: PixMap; var matteRect: Rect; flags: SInt16; userRoutine: StdPixUPP); external name '_InvokeStdPixUPP'; { old name was CallStdPixProc }
{
 *  InvokeQDPixUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvokeQDPixUPP(var src: PixMap; var srcRect: Rect; var matrix: MatrixRecord; mode: SInt16; mask: RgnHandle; var matte: PixMap; var matteRect: Rect; flags: SInt16; userRoutine: QDPixUPP); external name '_InvokeQDPixUPP'; { old name was CallQDPixProc }
{
 *  InvokeICMAlignmentUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvokeICMAlignmentUPP(var rp: Rect; refcon: SInt32; userRoutine: ICMAlignmentUPP); external name '_InvokeICMAlignmentUPP'; { old name was CallICMAlignmentProc }
{
 *  InvokeICMCursorShieldedUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvokeICMCursorShieldedUPP(const (*var*) r: Rect; refcon: UnivPtr; flags: SInt32; userRoutine: ICMCursorShieldedUPP); external name '_InvokeICMCursorShieldedUPP'; { old name was CallICMCursorShieldedProc }
{
 *  InvokeICMMemoryDisposedUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvokeICMMemoryDisposedUPP(memoryBlock: Ptr; refcon: UnivPtr; userRoutine: ICMMemoryDisposedUPP); external name '_InvokeICMMemoryDisposedUPP'; { old name was CallICMMemoryDisposedProc }
{
 *  InvokeICMConvertDataFormatUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeICMConvertDataFormatUPP(refCon: UnivPtr; flags: SInt32; desiredFormat: Handle; sourceDataFormat: Handle; srcData: UnivPtr; srcDataSize: SInt32; var dstData: UnivPtr; var dstDataSize: SInt32; userRoutine: ICMConvertDataFormatUPP): OSErr; external name '_InvokeICMConvertDataFormatUPP'; { old name was CallICMConvertDataFormatProc }
{
 *  CodecManagerVersion()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function CodecManagerVersion(var version: SInt32): OSErr; external name '_CodecManagerVersion';
{
 *  GetCodecNameList()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetCodecNameList(var list: CodecNameSpecListPtr; showAll: SInt16): OSErr; external name '_GetCodecNameList';
{
 *  DisposeCodecNameList()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function DisposeCodecNameList(list: CodecNameSpecListPtr): OSErr; external name '_DisposeCodecNameList';
{
 *  GetCodecInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetCodecInfo(var info: CodecInfo; cType: CodecType; codec: CodecComponent): OSErr; external name '_GetCodecInfo';
{
 *  GetMaxCompressionSize()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetMaxCompressionSize(src: PixMapHandle; const (*var*) srcRect: Rect; colorDepth: SInt16; quality: CodecQ; cType: CodecType; codec: CompressorComponent; var size: SInt32): OSErr; external name '_GetMaxCompressionSize';
{
 *  GetCSequenceMaxCompressionSize()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetCSequenceMaxCompressionSize(seqID: ImageSequence; src: PixMapHandle; var size: SInt32): OSErr; external name '_GetCSequenceMaxCompressionSize';
{
 *  GetCompressionTime()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetCompressionTime(src: PixMapHandle; const (*var*) srcRect: Rect; colorDepth: SInt16; cType: CodecType; codec: CompressorComponent; var spatialQuality: CodecQ; var temporalQuality: CodecQ; var compressTime: UInt32): OSErr; external name '_GetCompressionTime';
{
 *  CompressImage()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function CompressImage(src: PixMapHandle; const (*var*) srcRect: Rect; quality: CodecQ; cType: CodecType; desc: ImageDescriptionHandle; data: Ptr): OSErr; external name '_CompressImage';
{
 *  FCompressImage()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function FCompressImage(src: PixMapHandle; const (*var*) srcRect: Rect; colorDepth: SInt16; quality: CodecQ; cType: CodecType; codec: CompressorComponent; ctable: CTabHandle; flags: CodecFlags; bufferSize: SInt32; flushProc: ICMFlushProcRecordPtr; progressProc: ICMProgressProcRecordPtr; desc: ImageDescriptionHandle; data: Ptr): OSErr; external name '_FCompressImage';
{
 *  DecompressImage()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function DecompressImage(data: Ptr; desc: ImageDescriptionHandle; dst: PixMapHandle; const (*var*) srcRect: Rect; const (*var*) dstRect: Rect; mode: SInt16; mask: RgnHandle): OSErr; external name '_DecompressImage';
{
 *  FDecompressImage()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function FDecompressImage(data: Ptr; desc: ImageDescriptionHandle; dst: PixMapHandle; const (*var*) srcRect: Rect; matrix: MatrixRecordPtr; mode: SInt16; mask: RgnHandle; matte: PixMapHandle; const (*var*) matteRect: Rect; accuracy: CodecQ; codec: DecompressorComponent; bufferSize: SInt32; dataProc: ICMDataProcRecordPtr; progressProc: ICMProgressProcRecordPtr): OSErr; external name '_FDecompressImage';
{
 *  CompressSequenceBegin()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function CompressSequenceBegin(var seqID: ImageSequence; src: PixMapHandle; prev: PixMapHandle; const (*var*) srcRect: Rect; const (*var*) prevRect: Rect; colorDepth: SInt16; cType: CodecType; codec: CompressorComponent; spatialQuality: CodecQ; temporalQuality: CodecQ; keyFrameRate: SInt32; ctable: CTabHandle; flags: CodecFlags; desc: ImageDescriptionHandle): OSErr; external name '_CompressSequenceBegin';
{
 *  CompressSequenceFrame()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function CompressSequenceFrame(seqID: ImageSequence; src: PixMapHandle; const (*var*) srcRect: Rect; flags: CodecFlags; data: Ptr; var dataSize: SInt32; var similarity: UInt8; asyncCompletionProc: ICMCompletionProcRecordPtr): OSErr; external name '_CompressSequenceFrame';
{
 *  DecompressSequenceBegin()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function DecompressSequenceBegin(var seqID: ImageSequence; desc: ImageDescriptionHandle; port: CGrafPtr; gdh: GDHandle; const (*var*) srcRect: Rect; matrix: MatrixRecordPtr; mode: SInt16; mask: RgnHandle; flags: CodecFlags; accuracy: CodecQ; codec: DecompressorComponent): OSErr; external name '_DecompressSequenceBegin';
{
 *  DecompressSequenceBeginS()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function DecompressSequenceBeginS(var seqID: ImageSequence; desc: ImageDescriptionHandle; data: Ptr; dataSize: SInt32; port: CGrafPtr; gdh: GDHandle; const (*var*) srcRect: Rect; matrix: MatrixRecordPtr; mode: SInt16; mask: RgnHandle; flags: CodecFlags; accuracy: CodecQ; codec: DecompressorComponent): OSErr; external name '_DecompressSequenceBeginS';
{
 *  DecompressSequenceFrame()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function DecompressSequenceFrame(seqID: ImageSequence; data: Ptr; inFlags: CodecFlags; var outFlags: CodecFlags; asyncCompletionProc: ICMCompletionProcRecordPtr): OSErr; external name '_DecompressSequenceFrame';
{
 *  DecompressSequenceFrameS()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function DecompressSequenceFrameS(seqID: ImageSequence; data: Ptr; dataSize: SInt32; inFlags: CodecFlags; var outFlags: CodecFlags; asyncCompletionProc: ICMCompletionProcRecordPtr): OSErr; external name '_DecompressSequenceFrameS';
{
 *  DecompressSequenceFrameWhen()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function DecompressSequenceFrameWhen(seqID: ImageSequence; data: Ptr; dataSize: SInt32; inFlags: CodecFlags; var outFlags: CodecFlags; asyncCompletionProc: ICMCompletionProcRecordPtr; const (*var*) frameTime: ICMFrameTimeRecord): OSErr; external name '_DecompressSequenceFrameWhen';
{
 *  CDSequenceFlush()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function CDSequenceFlush(seqID: ImageSequence): OSErr; external name '_CDSequenceFlush';
{
 *  SetDSequenceMatrix()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SetDSequenceMatrix(seqID: ImageSequence; matrix: MatrixRecordPtr): OSErr; external name '_SetDSequenceMatrix';
{
 *  GetDSequenceMatrix()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function GetDSequenceMatrix(seqID: ImageSequence; matrix: MatrixRecordPtr): OSErr; external name '_GetDSequenceMatrix';
{
 *  SetDSequenceMatte()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SetDSequenceMatte(seqID: ImageSequence; matte: PixMapHandle; const (*var*) matteRect: Rect): OSErr; external name '_SetDSequenceMatte';
{
 *  SetDSequenceMask()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SetDSequenceMask(seqID: ImageSequence; mask: RgnHandle): OSErr; external name '_SetDSequenceMask';
{
 *  SetDSequenceTransferMode()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SetDSequenceTransferMode(seqID: ImageSequence; mode: SInt16; const (*var*) opColor: RGBColor): OSErr; external name '_SetDSequenceTransferMode';
{
 *  SetDSequenceDataProc()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SetDSequenceDataProc(seqID: ImageSequence; dataProc: ICMDataProcRecordPtr; bufferSize: SInt32): OSErr; external name '_SetDSequenceDataProc';
{
 *  SetDSequenceAccuracy()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SetDSequenceAccuracy(seqID: ImageSequence; accuracy: CodecQ): OSErr; external name '_SetDSequenceAccuracy';
{
 *  SetDSequenceSrcRect()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SetDSequenceSrcRect(seqID: ImageSequence; const (*var*) srcRect: Rect): OSErr; external name '_SetDSequenceSrcRect';
{
 *  SetDSequenceFlags()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function SetDSequenceFlags(seqID: ImageSequence; flags: SInt32; flagsMask: SInt32): OSErr; external name '_SetDSequenceFlags';
const
    codecDSequenceDisableOverlaySurface = $00000020;
    codecDSequenceSingleField   = $00000040;
    codecDSequenceBidirectionalPrediction = $00000080;
    codecDSequenceFlushInsteadOfDirtying = $00000100;
    codecDSequenceEnableSubPixelPositioning = $00000200;


type
    CodecComponentPtr                   = ^CodecComponent;
    CodecComponentHandle                = ^CodecComponentPtr;
    {  selectors for ICMSequenceGet/SetInfo }

const
    kICMSequenceTaskWeight      = $74776569 (* 'twei' *);                       {  data is pointer to UInt32 }
    kICMSequenceTaskName        = $746E616D (* 'tnam' *);                       {  data is pointer to OSType }
    kICMSequenceUserPreferredCodecs = $70756E74 (* 'punt' *);                   {  data is pointer to CodecComponentHandle }

    {
     *  ICMSequenceGetInfo()
     *
     *  Availability:
     *    Non-Carbon CFM:   in QuickTimeLib 5.0 and later
     *    CarbonLib:        in CarbonLib 1.3 and later
     *    Mac OS X:         in version 10.0 and later
     *    Windows:          in qtmlClient.lib 5.0 and later
        }
function ICMSequenceGetInfo(seqID: ImageSequence; which: OSType; data: UnivPtr): OSErr; external name '_ICMSequenceGetInfo';
{
 *  ICMSequenceSetInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 5.0 and later
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 5.0 and later
 }
function ICMSequenceSetInfo(seqID: ImageSequence; which: OSType; data: UnivPtr; dataSize: Size): OSErr; external name '_ICMSequenceSetInfo';
{
 *  GetDSequenceImageBuffer()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetDSequenceImageBuffer(seqID: ImageSequence; var gworld: GWorldPtr): OSErr; external name '_GetDSequenceImageBuffer';
{
 *  GetDSequenceScreenBuffer()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetDSequenceScreenBuffer(seqID: ImageSequence; var gworld: GWorldPtr): OSErr; external name '_GetDSequenceScreenBuffer';
{
 *  SetCSequenceQuality()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SetCSequenceQuality(seqID: ImageSequence; spatialQuality: CodecQ; temporalQuality: CodecQ): OSErr; external name '_SetCSequenceQuality';
{
 *  SetCSequencePrev()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SetCSequencePrev(seqID: ImageSequence; prev: PixMapHandle; const (*var*) prevRect: Rect): OSErr; external name '_SetCSequencePrev';
{
 *  SetCSequenceFlushProc()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SetCSequenceFlushProc(seqID: ImageSequence; flushProc: ICMFlushProcRecordPtr; bufferSize: SInt32): OSErr; external name '_SetCSequenceFlushProc';
{
 *  SetCSequenceKeyFrameRate()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SetCSequenceKeyFrameRate(seqID: ImageSequence; keyFrameRate: SInt32): OSErr; external name '_SetCSequenceKeyFrameRate';
{
 *  GetCSequenceKeyFrameRate()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetCSequenceKeyFrameRate(seqID: ImageSequence; var keyFrameRate: SInt32): OSErr; external name '_GetCSequenceKeyFrameRate';
{
 *  GetCSequencePrevBuffer()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetCSequencePrevBuffer(seqID: ImageSequence; var gworld: GWorldPtr): OSErr; external name '_GetCSequencePrevBuffer';
{
 *  CDSequenceBusy()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function CDSequenceBusy(seqID: ImageSequence): OSErr; external name '_CDSequenceBusy';
{
 *  CDSequenceEnd()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function CDSequenceEnd(seqID: ImageSequence): OSErr; external name '_CDSequenceEnd';
{
 *  CDSequenceEquivalentImageDescription()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function CDSequenceEquivalentImageDescription(seqID: ImageSequence; newDesc: ImageDescriptionHandle; var equivalent: boolean): OSErr; external name '_CDSequenceEquivalentImageDescription';
{
 *  CDSequenceEquivalentImageDescriptionS()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 5.0 and later
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 5.0 and later
 }
function CDSequenceEquivalentImageDescriptionS(seqID: ImageSequence; newDesc: ImageDescriptionHandle; var equivalent: boolean; var canSwitch: boolean): OSErr; external name '_CDSequenceEquivalentImageDescriptionS';
{
 *  ReplaceDSequenceImageDescription()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 5.0 and later
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 5.0 and later
 }
function ReplaceDSequenceImageDescription(seqID: ImageSequence; newDesc: ImageDescriptionHandle): OSErr; external name '_ReplaceDSequenceImageDescription';
{
 *  GetCompressedImageSize()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetCompressedImageSize(desc: ImageDescriptionHandle; data: Ptr; bufferSize: SInt32; dataProc: ICMDataProcRecordPtr; var dataSize: SInt32): OSErr; external name '_GetCompressedImageSize';
{
 *  GetSimilarity()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetSimilarity(src: PixMapHandle; const (*var*) srcRect: Rect; desc: ImageDescriptionHandle; data: Ptr; var similarity: Fixed): OSErr; external name '_GetSimilarity';
const
    kImageDescriptionSampleFormat = $6964666D (* 'idfm' *);                     {  image description extension describing sample format }
    kImageDescriptionClassicAtomFormat = $61746F6D (* 'atom' *);                {  sample contains classic atom structure (ie, GX codec and Curve codec) }
    kImageDescriptionQTAtomFormat = $71746174 (* 'qtat' *);                     {  sample contains QT atom structure }
    kImageDescriptionEffectDataFormat = $66786174 (* 'fxat' *);                 {  sample describes an effect (as QTAtoms) }
    kImageDescriptionPrivateDataFormat = $70726976 (* 'priv' *);                {  sample is in a private codec specific format }
    kImageDescriptionAlternateCodec = $73756273 (* 'subs' *);                   {  image description extension containing the OSType of a substitute codec should the main codec not be available }
    kImageDescriptionColorSpace = $63737063 (* 'cspc' *);                       {  image description extension containing an OSType naming the native pixel format of an image (only used for pixel formats not supported by classic Color QuickDraw) }

    {
     *  GetImageDescriptionCTable()
     *
     *  Availability:
     *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
     *    Windows:          in qtmlClient.lib 3.0 and later
        }
function GetImageDescriptionCTable(desc: ImageDescriptionHandle; var ctable: CTabHandle): OSErr; external name '_GetImageDescriptionCTable';
{
 *  SetImageDescriptionCTable()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SetImageDescriptionCTable(desc: ImageDescriptionHandle; ctable: CTabHandle): OSErr; external name '_SetImageDescriptionCTable';
{
 *  GetImageDescriptionExtension()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetImageDescriptionExtension(desc: ImageDescriptionHandle; var extension: Handle; idType: SInt32; index: SInt32): OSErr; external name '_GetImageDescriptionExtension';
{
 *  AddImageDescriptionExtension()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function AddImageDescriptionExtension(desc: ImageDescriptionHandle; extension: Handle; idType: SInt32): OSErr; external name '_AddImageDescriptionExtension';
{
 *  RemoveImageDescriptionExtension()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function RemoveImageDescriptionExtension(desc: ImageDescriptionHandle; idType: SInt32; index: SInt32): OSErr; external name '_RemoveImageDescriptionExtension';
{
 *  CountImageDescriptionExtensionType()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function CountImageDescriptionExtensionType(desc: ImageDescriptionHandle; idType: SInt32; var count: SInt32): OSErr; external name '_CountImageDescriptionExtensionType';
{
 *  GetNextImageDescriptionExtensionType()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetNextImageDescriptionExtensionType(desc: ImageDescriptionHandle; var idType: SInt32): OSErr; external name '_GetNextImageDescriptionExtensionType';
{
 *  FindCodec()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function FindCodec(cType: CodecType; specCodec: CodecComponent; var compressor: CompressorComponent; var decompressor: DecompressorComponent): OSErr; external name '_FindCodec';
{
 *  CompressPicture()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function CompressPicture(srcPicture: PicHandle; dstPicture: PicHandle; quality: CodecQ; cType: CodecType): OSErr; external name '_CompressPicture';
{
 *  FCompressPicture()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function FCompressPicture(srcPicture: PicHandle; dstPicture: PicHandle; colorDepth: SInt16; ctable: CTabHandle; quality: CodecQ; doDither: SInt16; compressAgain: SInt16; progressProc: ICMProgressProcRecordPtr; cType: CodecType; codec: CompressorComponent): OSErr; external name '_FCompressPicture';
{
 *  CompressPictureFile()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function CompressPictureFile(srcRefNum: SInt16; dstRefNum: SInt16; quality: CodecQ; cType: CodecType): OSErr; external name '_CompressPictureFile';
{
 *  FCompressPictureFile()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function FCompressPictureFile(srcRefNum: SInt16; dstRefNum: SInt16; colorDepth: SInt16; ctable: CTabHandle; quality: CodecQ; doDither: SInt16; compressAgain: SInt16; progressProc: ICMProgressProcRecordPtr; cType: CodecType; codec: CompressorComponent): OSErr; external name '_FCompressPictureFile';
{
 *  GetPictureFileHeader()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetPictureFileHeader(refNum: SInt16; var frame: Rect; var header: OpenCPicParams): OSErr; external name '_GetPictureFileHeader';
{
 *  DrawPictureFile()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function DrawPictureFile(refNum: SInt16; const (*var*) frame: Rect; progressProc: ICMProgressProcRecordPtr): OSErr; external name '_DrawPictureFile';
{
 *  DrawTrimmedPicture()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function DrawTrimmedPicture(srcPicture: PicHandle; const (*var*) frame: Rect; trimMask: RgnHandle; doDither: SInt16; progressProc: ICMProgressProcRecordPtr): OSErr; external name '_DrawTrimmedPicture';
{
 *  DrawTrimmedPictureFile()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function DrawTrimmedPictureFile(srcRefnum: SInt16; const (*var*) frame: Rect; trimMask: RgnHandle; doDither: SInt16; progressProc: ICMProgressProcRecordPtr): OSErr; external name '_DrawTrimmedPictureFile';
{
 *  MakeThumbnailFromPicture()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MakeThumbnailFromPicture(picture: PicHandle; colorDepth: SInt16; thumbnail: PicHandle; progressProc: ICMProgressProcRecordPtr): OSErr; external name '_MakeThumbnailFromPicture';
{
 *  MakeThumbnailFromPictureFile()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MakeThumbnailFromPictureFile(refNum: SInt16; colorDepth: SInt16; thumbnail: PicHandle; progressProc: ICMProgressProcRecordPtr): OSErr; external name '_MakeThumbnailFromPictureFile';
{
 *  MakeThumbnailFromPixMap()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MakeThumbnailFromPixMap(src: PixMapHandle; const (*var*) srcRect: Rect; colorDepth: SInt16; thumbnail: PicHandle; progressProc: ICMProgressProcRecordPtr): OSErr; external name '_MakeThumbnailFromPixMap';
{
 *  TrimImage()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function TrimImage(desc: ImageDescriptionHandle; inData: Ptr; inBufferSize: SInt32; dataProc: ICMDataProcRecordPtr; outData: Ptr; outBufferSize: SInt32; flushProc: ICMFlushProcRecordPtr; var trimRect: Rect; progressProc: ICMProgressProcRecordPtr): OSErr; external name '_TrimImage';
{
 *  ConvertImage()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function ConvertImage(srcDD: ImageDescriptionHandle; srcData: Ptr; colorDepth: SInt16; ctable: CTabHandle; accuracy: CodecQ; quality: CodecQ; cType: CodecType; codec: CodecComponent; dstDD: ImageDescriptionHandle; dstData: Ptr): OSErr; external name '_ConvertImage';
{
 *  GetCompressedPixMapInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetCompressedPixMapInfo(pix: PixMapPtr; var desc: ImageDescriptionHandle; var data: Ptr; var bufferSize: SInt32; var dataProc: ICMDataProcRecord; var progressProc: ICMProgressProcRecord): OSErr; external name '_GetCompressedPixMapInfo';
{
 *  SetCompressedPixMapInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SetCompressedPixMapInfo(pix: PixMapPtr; desc: ImageDescriptionHandle; data: Ptr; bufferSize: SInt32; dataProc: ICMDataProcRecordPtr; progressProc: ICMProgressProcRecordPtr): OSErr; external name '_SetCompressedPixMapInfo';
{
 *  StdPix()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure StdPix(src: PixMapPtr; const (*var*) srcRect: Rect; matrix: MatrixRecordPtr; mode: SInt16; mask: RgnHandle; matte: PixMapPtr; const (*var*) matteRect: Rect; flags: SInt16); external name '_StdPix';
{
 *  TransformRgn()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function TransformRgn(matrix: MatrixRecordPtr; rgn: RgnHandle): OSErr; external name '_TransformRgn';
{**********
    preview stuff
**********}

{
 *  MakeFilePreview()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MakeFilePreview(resRefNum: SInt16; progress: ICMProgressProcRecordPtr): OSErr; external name '_MakeFilePreview';
{
 *  AddFilePreview()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function AddFilePreview(resRefNum: SInt16; previewType: OSType; previewData: Handle): OSErr; external name '_AddFilePreview';
const
    sfpItemPreviewAreaUser      = 11;
    sfpItemPreviewStaticText    = 12;
    sfpItemPreviewDividerUser   = 13;
    sfpItemCreatePreviewButton  = 14;
    sfpItemShowPreviewButton    = 15;


type
    PreviewResourceRecordPtr = ^PreviewResourceRecord;
    PreviewResourceRecord = record
        modDate:                UInt32;
        version:                SInt16;
        resType:                OSType;
        resID:                  SInt16;
    end;

    PreviewResourcePtr                  = ^PreviewResourceRecord;
    PreviewResource                     = ^PreviewResourcePtr;
    {
     *  AlignScreenRect()
     *
     *  Availability:
     *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
     *    Windows:          in qtmlClient.lib 3.0 and later
        }
procedure AlignScreenRect(var rp: Rect; alignmentProc: ICMAlignmentProcRecordPtr); external name '_AlignScreenRect';
{
 *  AlignWindow()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure AlignWindow(wp: WindowRef; front: boolean; const (*var*) alignmentRect: Rect; alignmentProc: ICMAlignmentProcRecordPtr); external name '_AlignWindow';
{
 *  DragAlignedWindow()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure DragAlignedWindow(wp: WindowRef; startPt: Point; var boundsRect: Rect; var alignmentRect: Rect; alignmentProc: ICMAlignmentProcRecordPtr); external name '_DragAlignedWindow';
{
 *  DragAlignedGrayRgn()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function DragAlignedGrayRgn(theRgn: RgnHandle; startPt: Point; var boundsRect: Rect; var slopRect: Rect; axis: SInt16; actionProc: UniversalProcPtr; var alignmentRect: Rect; alignmentProc: ICMAlignmentProcRecordPtr): SInt32; external name '_DragAlignedGrayRgn';
{
 *  SetCSequenceDataRateParams()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SetCSequenceDataRateParams(seqID: ImageSequence; params: DataRateParamsPtr): OSErr; external name '_SetCSequenceDataRateParams';
{
 *  SetCSequenceFrameNumber()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SetCSequenceFrameNumber(seqID: ImageSequence; frameNumber: SInt32): OSErr; external name '_SetCSequenceFrameNumber';
{
 *  SetCSequencePreferredPacketSize()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SetCSequencePreferredPacketSize(seqID: ImageSequence; preferredPacketSizeInBytes: SInt32): OSErr; external name '_SetCSequencePreferredPacketSize';
{
 *  NewImageGWorld()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function NewImageGWorld(var gworld: GWorldPtr; idh: ImageDescriptionHandle; flags: GWorldFlags): OSErr; external name '_NewImageGWorld';
{
 *  GetCSequenceDataRateParams()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetCSequenceDataRateParams(seqID: ImageSequence; params: DataRateParamsPtr): OSErr; external name '_GetCSequenceDataRateParams';
{
 *  GetCSequenceFrameNumber()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetCSequenceFrameNumber(seqID: ImageSequence; var frameNumber: SInt32): OSErr; external name '_GetCSequenceFrameNumber';
{
 *  GetBestDeviceRect()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetBestDeviceRect(var gdh: GDHandle; var rp: Rect): OSErr; external name '_GetBestDeviceRect';
{
 *  SetSequenceProgressProc()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SetSequenceProgressProc(seqID: ImageSequence; var progressProc: ICMProgressProcRecord): OSErr; external name '_SetSequenceProgressProc';
{
 *  GDHasScale()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GDHasScale(gdh: GDHandle; depth: SInt16; var scale: Fixed): OSErr; external name '_GDHasScale';
{
 *  GDGetScale()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GDGetScale(gdh: GDHandle; var scale: Fixed; var flags: SInt16): OSErr; external name '_GDGetScale';
{
 *  GDSetScale()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GDSetScale(gdh: GDHandle; scale: Fixed; flags: SInt16): OSErr; external name '_GDSetScale';
{
 *  ICMShieldSequenceCursor()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function ICMShieldSequenceCursor(seqID: ImageSequence): OSErr; external name '_ICMShieldSequenceCursor';
{
 *  ICMDecompressComplete()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure ICMDecompressComplete(seqID: ImageSequence; err: OSErr; flag: SInt16; completionRtn: ICMCompletionProcRecordPtr); external name '_ICMDecompressComplete';
{
 *  ICMDecompressCompleteS()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function ICMDecompressCompleteS(seqID: ImageSequence; err: OSErr; flag: SInt16; completionRtn: ICMCompletionProcRecordPtr): OSErr; external name '_ICMDecompressCompleteS';
{
 *  ICMSequenceLockBits()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function ICMSequenceLockBits(seqID: ImageSequence; dst: PixMapPtr; flags: SInt32): OSErr; external name '_ICMSequenceLockBits';
{
 *  ICMSequenceUnlockBits()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function ICMSequenceUnlockBits(seqID: ImageSequence; flags: SInt32): OSErr; external name '_ICMSequenceUnlockBits';
const
    kICMPixelFormatIsPlanarMask = $0F;                          {  these bits in formatFlags indicate how many planes there are; they're 0 if chunky }
    kICMPixelFormatIsIndexed    = $00000010;
    kICMPixelFormatIsSupportedByQD = $00000020;
    kICMPixelFormatIsMonochrome = $00000040;
    kICMPixelFormatHasAlphaChannel = $00000080;


type
    ICMPixelFormatInfoPtr = ^ICMPixelFormatInfo;
    ICMPixelFormatInfo = record
        size:                   SInt32;                             {  caller MUST fill this in with sizeof(ICMPixelFormatInfo) before calling ICMGet/SetPixelFormatInfo }
        formatFlags:            UInt32;
        bitsPerPixel:           array [0..13] of SInt16;                {  list each plane's bits per pixel separately if planar }
                                                                        {  new field for QuickTime 4.1 }
        defaultGammaLevel:      Fixed;
                                                                        {  new fields for QuickTime 6.0 }
        horizontalSubsampling:  array [0..13] of SInt16;                {  per plane; use 1 if plane is not subsampled }
        verticalSubsampling:    array [0..13] of SInt16;                {  per plane; use 1 if plane is not subsampled }
    end;

    {    IMPORTANT: Fill in theInfo->size with sizeof(ICMPixelFormatInfo) before calling ICMGetPixelFormatInfo  }
    {
     *  ICMGetPixelFormatInfo()
     *
     *  Availability:
     *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
     *    Windows:          in qtmlClient.lib 3.0 and later
        }
function ICMGetPixelFormatInfo(PixelFormat: OSType; theInfo: ICMPixelFormatInfoPtr): OSErr; external name '_ICMGetPixelFormatInfo';
{ IMPORTANT: Fill in theInfo->size with sizeof(ICMPixelFormatInfo) before calling ICMSetPixelFormatInfo }
{
 *  ICMSetPixelFormatInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function ICMSetPixelFormatInfo(PixelFormat: OSType; theInfo: ICMPixelFormatInfoPtr): OSErr; external name '_ICMSetPixelFormatInfo';
const
    kICMGetChainUltimateParent  = 0;
    kICMGetChainParent          = 1;
    kICMGetChainChild           = 2;
    kICMGetChainUltimateChild   = 3;

    {
     *  ICMSequenceGetChainMember()
     *
     *  Availability:
     *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
     *    Windows:          in qtmlClient.lib 3.0 and later
        }
function ICMSequenceGetChainMember(seqID: ImageSequence; var retSeqID: ImageSequence; flags: SInt32): OSErr; external name '_ICMSequenceGetChainMember';
{
 *  SetDSequenceTimeCode()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SetDSequenceTimeCode(seqID: ImageSequence; timeCodeFormat: UnivPtr; timeCodeTime: UnivPtr): OSErr; external name '_SetDSequenceTimeCode';
{
 *  CDSequenceNewMemory()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function CDSequenceNewMemory(seqID: ImageSequence; var data: Ptr; dataSize: Size; dataUse: SInt32; memoryGoneProc: ICMMemoryDisposedUPP; refCon: UnivPtr): OSErr; external name '_CDSequenceNewMemory';
{
 *  CDSequenceDisposeMemory()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function CDSequenceDisposeMemory(seqID: ImageSequence; data: Ptr): OSErr; external name '_CDSequenceDisposeMemory';
{
 *  CDSequenceNewDataSource()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function CDSequenceNewDataSource(seqID: ImageSequence; var sourceID: ImageSequenceDataSource; sourceType: OSType; sourceInputNumber: SInt32; dataDescription: Handle; transferProc: ICMConvertDataFormatUPP; refCon: UnivPtr): OSErr; external name '_CDSequenceNewDataSource';
{
 *  CDSequenceDisposeDataSource()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function CDSequenceDisposeDataSource(sourceID: ImageSequenceDataSource): OSErr; external name '_CDSequenceDisposeDataSource';
{
 *  CDSequenceSetSourceData()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function CDSequenceSetSourceData(sourceID: ImageSequenceDataSource; data: UnivPtr; dataSize: SInt32): OSErr; external name '_CDSequenceSetSourceData';
{
 *  CDSequenceChangedSourceData()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function CDSequenceChangedSourceData(sourceID: ImageSequenceDataSource): OSErr; external name '_CDSequenceChangedSourceData';
{
 *  CDSequenceSetSourceDataQueue()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function CDSequenceSetSourceDataQueue(sourceID: ImageSequenceDataSource; dataQueue: QHdrPtr): OSErr; external name '_CDSequenceSetSourceDataQueue';
{
 *  CDSequenceGetDataSource()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function CDSequenceGetDataSource(seqID: ImageSequence; var sourceID: ImageSequenceDataSource; sourceType: OSType; sourceInputNumber: SInt32): OSErr; external name '_CDSequenceGetDataSource';
{
 *  PtInDSequenceData()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function PtInDSequenceData(seqID: ImageSequence; data: UnivPtr; dataSize: Size; where: Point; var hit: boolean): OSErr; external name '_PtInDSequenceData';
{
 *  HitTestDSequenceData()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function HitTestDSequenceData(seqID: ImageSequence; data: UnivPtr; dataSize: Size; where: Point; var hit: SInt32; hitFlags: SInt32): OSErr; external name '_HitTestDSequenceData';
{
 *  GetGraphicsImporterForFile()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetGraphicsImporterForFile(const (*var*) theFile: FSSpec; var gi: ComponentInstance): OSErr; external name '_GetGraphicsImporterForFile';
{
 *  GetGraphicsImporterForDataRef()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetGraphicsImporterForDataRef(dataRef: Handle; dataRefType: OSType; var gi: ComponentInstance): OSErr; external name '_GetGraphicsImporterForDataRef';
const
    kDontUseValidateToFindGraphicsImporter = $00000001;

    {
     *  GetGraphicsImporterForFileWithFlags()
     *
     *  Availability:
     *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
     *    CarbonLib:        in CarbonLib 1.1 and later
     *    Mac OS X:         in version 10.0 and later
     *    Windows:          in qtmlClient.lib 3.0 and later
        }
function GetGraphicsImporterForFileWithFlags(const (*var*) theFile: FSSpec; var gi: ComponentInstance; flags: SInt32): OSErr; external name '_GetGraphicsImporterForFileWithFlags';
{
 *  GetGraphicsImporterForDataRefWithFlags()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetGraphicsImporterForDataRefWithFlags(dataRef: Handle; dataRefType: OSType; var gi: ComponentInstance; flags: SInt32): OSErr; external name '_GetGraphicsImporterForDataRefWithFlags';
{
 *  QTGetFileNameExtension()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function QTGetFileNameExtension(const (*var*) fileName: StrFileName; fileType: OSType; var extension: OSType): OSErr; external name '_QTGetFileNameExtension';
{
 *  ImageTranscodeSequenceBegin()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function ImageTranscodeSequenceBegin(var its: ImageTranscodeSequence; srcDesc: ImageDescriptionHandle; destType: OSType; var dstDesc: ImageDescriptionHandle; data: UnivPtr; dataSize: SInt32): OSErr; external name '_ImageTranscodeSequenceBegin';
{
 *  ImageTranscodeSequenceEnd()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function ImageTranscodeSequenceEnd(its: ImageTranscodeSequence): OSErr; external name '_ImageTranscodeSequenceEnd';
{
 *  ImageTranscodeFrame()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function ImageTranscodeFrame(its: ImageTranscodeSequence; srcData: UnivPtr; srcDataSize: SInt32; var dstData: UnivPtr; var dstDataSize: SInt32): OSErr; external name '_ImageTranscodeFrame';
{
 *  ImageTranscodeDisposeFrameData()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function ImageTranscodeDisposeFrameData(its: ImageTranscodeSequence; dstData: UnivPtr): OSErr; external name '_ImageTranscodeDisposeFrameData';
{
 *  CDSequenceInvalidate()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function CDSequenceInvalidate(seqID: ImageSequence; invalRgn: RgnHandle): OSErr; external name '_CDSequenceInvalidate';
{
 *  CDSequenceSetTimeBase()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function CDSequenceSetTimeBase(seqID: ImageSequence; base: UnivPtr): OSErr; external name '_CDSequenceSetTimeBase';
{
 *  ImageFieldSequenceBegin()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function ImageFieldSequenceBegin(var ifs: ImageFieldSequence; desc1: ImageDescriptionHandle; desc2: ImageDescriptionHandle; descOut: ImageDescriptionHandle): OSErr; external name '_ImageFieldSequenceBegin';
{
 *  ImageFieldSequenceExtractCombine()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function ImageFieldSequenceExtractCombine(ifs: ImageFieldSequence; fieldFlags: SInt32; data1: UnivPtr; dataSize1: SInt32; data2: UnivPtr; dataSize2: SInt32; outputData: UnivPtr; var outDataSize: SInt32): OSErr; external name '_ImageFieldSequenceExtractCombine';
{
 *  ImageFieldSequenceEnd()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function ImageFieldSequenceEnd(ifs: ImageFieldSequence): OSErr; external name '_ImageFieldSequenceEnd';
const
    kICMTempThenAppMemory       = $00001000;
    kICMAppThenTempMemory       = $00002000;

    {
     *  QTNewGWorld()
     *
     *  Availability:
     *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
     *    Windows:          in qtmlClient.lib 3.0 and later
        }
function QTNewGWorld(var offscreenGWorld: GWorldPtr; PixelFormat: OSType; const (*var*) boundsRect: Rect; cTable: CTabHandle; aGDevice: GDHandle; flags: GWorldFlags): OSErr; external name '_QTNewGWorld';
{
 *  QTNewGWorldFromPtr()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function QTNewGWorldFromPtr(var gw: GWorldPtr; pixelFormat: OSType; const (*var*) boundsRect: Rect; cTable: CTabHandle; aGDevice: GDHandle; flags: GWorldFlags; baseAddr: UnivPtr; rowBytes: SInt32): OSErr; external name '_QTNewGWorldFromPtr';
{
 *  QTUpdateGWorld()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function QTUpdateGWorld(var offscreenGWorld: GWorldPtr; PixelFormat: OSType; const (*var*) boundsRect: Rect; cTable: CTabHandle; aGDevice: GDHandle; flags: GWorldFlags): GWorldFlags; external name '_QTUpdateGWorld';
{
 *  MakeImageDescriptionForPixMap()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MakeImageDescriptionForPixMap(pixmap: PixMapHandle; var idh: ImageDescriptionHandle): OSErr; external name '_MakeImageDescriptionForPixMap';
{
 *  MakeImageDescriptionForEffect()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function MakeImageDescriptionForEffect(effectType: OSType; var idh: ImageDescriptionHandle): OSErr; external name '_MakeImageDescriptionForEffect';
{
 *  QTGetPixelSize()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function QTGetPixelSize(PixelFormat: OSType): SInt16; external name '_QTGetPixelSize';
{
 *  QTGetPixelFormatDepthForImageDescription()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 6.0 and later
 *    CarbonLib:        in CarbonLib 1.6 and later
 *    Mac OS X:         in version 10.2 and later
 *    Windows:          in qtmlClient.lib 6.0 and later
 }
function QTGetPixelFormatDepthForImageDescription(PixelFormat: OSType): SInt16; external name '_QTGetPixelFormatDepthForImageDescription';
{
 *  QTGetPixMapPtrRowBytes()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function QTGetPixMapPtrRowBytes(pm: PixMapPtr): SInt32; external name '_QTGetPixMapPtrRowBytes';
{
 *  QTGetPixMapHandleRowBytes()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function QTGetPixMapHandleRowBytes(pm: PixMapHandle): SInt32; external name '_QTGetPixMapHandleRowBytes';
{
 *  QTSetPixMapPtrRowBytes()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function QTSetPixMapPtrRowBytes(pm: PixMapPtr; rowBytes: SInt32): OSErr; external name '_QTSetPixMapPtrRowBytes';
{
 *  QTSetPixMapHandleRowBytes()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function QTSetPixMapHandleRowBytes(pm: PixMapHandle; rowBytes: SInt32): OSErr; external name '_QTSetPixMapHandleRowBytes';
const
    kQTUsePlatformDefaultGammaLevel = 0;                        {  When decompressing into this PixMap, gamma-correct to the platform's standard gamma.  }
    kQTUseSourceGammaLevel      = -1;                           {  When decompressing into this PixMap, don't perform gamma-correction.  }
    kQTCCIR601VideoGammaLevel   = $00023333;                    {  2.2, standard television video gamma. }

    {
     *  QTGetPixMapPtrGammaLevel()
     *
     *  Availability:
     *    Non-Carbon CFM:   in QuickTimeLib 5.0 and later
     *    CarbonLib:        in CarbonLib 1.3 and later
     *    Mac OS X:         in version 10.0 and later
     *    Windows:          in qtmlClient.lib 5.0 and later
        }
function QTGetPixMapPtrGammaLevel(pm: PixMapPtr): Fixed; external name '_QTGetPixMapPtrGammaLevel';
{
 *  QTSetPixMapPtrGammaLevel()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 5.0 and later
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 5.0 and later
 }
function QTSetPixMapPtrGammaLevel(pm: PixMapPtr; gammaLevel: Fixed): OSErr; external name '_QTSetPixMapPtrGammaLevel';
{
 *  QTGetPixMapHandleGammaLevel()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 5.0 and later
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 5.0 and later
 }
function QTGetPixMapHandleGammaLevel(pm: PixMapHandle): Fixed; external name '_QTGetPixMapHandleGammaLevel';
{
 *  QTSetPixMapHandleGammaLevel()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 5.0 and later
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 5.0 and later
 }
function QTSetPixMapHandleGammaLevel(pm: PixMapHandle; gammaLevel: Fixed): OSErr; external name '_QTSetPixMapHandleGammaLevel';
{
 *  QTGetPixMapPtrRequestedGammaLevel()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 5.0 and later
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 5.0 and later
 }
function QTGetPixMapPtrRequestedGammaLevel(pm: PixMapPtr): Fixed; external name '_QTGetPixMapPtrRequestedGammaLevel';
{
 *  QTSetPixMapPtrRequestedGammaLevel()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 5.0 and later
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 5.0 and later
 }
function QTSetPixMapPtrRequestedGammaLevel(pm: PixMapPtr; requestedGammaLevel: Fixed): OSErr; external name '_QTSetPixMapPtrRequestedGammaLevel';
{
 *  QTGetPixMapHandleRequestedGammaLevel()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 5.0 and later
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 5.0 and later
 }
function QTGetPixMapHandleRequestedGammaLevel(pm: PixMapHandle): Fixed; external name '_QTGetPixMapHandleRequestedGammaLevel';
{
 *  QTSetPixMapHandleRequestedGammaLevel()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 5.0 and later
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 5.0 and later
 }
function QTSetPixMapHandleRequestedGammaLevel(pm: PixMapHandle; requestedGammaLevel: Fixed): OSErr; external name '_QTSetPixMapHandleRequestedGammaLevel';
{
 *  QuadToQuadMatrix()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
 {
QA 1227: This call takes four initial points (FixedPoint), four final points (FixedPoint), and defines a matrix that will map between them.
 }
type
    FixedPoint4 = array[0..3] of FixedPoint;
function QuadToQuadMatrix(const (*var*) source: FixedPoint4; const (*var*) dest: FixedPoint4; var map: MatrixRecord): OSErr; external name '_QuadToQuadMatrix';
const
    identityMatrixType          = $00;                          {  result if matrix is identity  }
    translateMatrixType         = $01;                          {  result if matrix translates  }
    scaleMatrixType             = $02;                          {  result if matrix scales  }
    scaleTranslateMatrixType    = $03;                          {  result if matrix scales and translates  }
    linearMatrixType            = $04;                          {  result if matrix is general 2 x 2  }
    linearTranslateMatrixType   = $05;                          {  result if matrix is general 2 x 2 and translates  }
    perspectiveMatrixType       = $06;                          {  result if matrix is general 3 x 3  }


type
    MatrixFlags                         = UInt16;
    {
     *  GetMatrixType()
     *
     *  Availability:
     *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
     *    Windows:          in qtmlClient.lib 3.0 and later
        }
function GetMatrixType(const (*var*) m: MatrixRecord): SInt16; external name '_GetMatrixType';
{
 *  CopyMatrix()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure CopyMatrix(const (*var*) m1: MatrixRecord; var m2: MatrixRecord); external name '_CopyMatrix';
{
 *  EqualMatrix()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function EqualMatrix(const (*var*) m1: MatrixRecord; const (*var*) m2: MatrixRecord): boolean; external name '_EqualMatrix';
{
 *  SetIdentityMatrix()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure SetIdentityMatrix(var matrix: MatrixRecord); external name '_SetIdentityMatrix';
{
 *  TranslateMatrix()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure TranslateMatrix(var m: MatrixRecord; deltaH: Fixed; deltaV: Fixed); external name '_TranslateMatrix';
{
 *  RotateMatrix()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure RotateMatrix(var m: MatrixRecord; degrees: Fixed; aboutX: Fixed; aboutY: Fixed); external name '_RotateMatrix';
{
 *  ScaleMatrix()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure ScaleMatrix(var m: MatrixRecord; scaleX: Fixed; scaleY: Fixed; aboutX: Fixed; aboutY: Fixed); external name '_ScaleMatrix';
{
 *  SkewMatrix()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure SkewMatrix(var m: MatrixRecord; skewX: Fixed; skewY: Fixed; aboutX: Fixed; aboutY: Fixed); external name '_SkewMatrix';
{
 *  TransformFixedPoints()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function TransformFixedPoints(const (*var*) m: MatrixRecord; var fpt: FixedPoint; count: SInt32): OSErr; external name '_TransformFixedPoints';
{
 *  TransformPoints()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function TransformPoints(const (*var*) mp: MatrixRecord; var pt1: Point; count: SInt32): OSErr; external name '_TransformPoints';
{
 *  TransformFixedRect()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function TransformFixedRect(const (*var*) m: MatrixRecord; var fr: FixedRect; var fpp: FixedPoint): boolean; external name '_TransformFixedRect';
{
 *  TransformRect()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function TransformRect(const (*var*) m: MatrixRecord; var r: Rect; var fpp: FixedPoint): boolean; external name '_TransformRect';
{
 *  InverseMatrix()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function InverseMatrix(const (*var*) m: MatrixRecord; var im: MatrixRecord): boolean; external name '_InverseMatrix';
{
 *  ConcatMatrix()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure ConcatMatrix(const (*var*) a: MatrixRecord; var b: MatrixRecord); external name '_ConcatMatrix';
{
 *  RectMatrix()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure RectMatrix(var matrix: MatrixRecord; const (*var*) srcRect: Rect; const (*var*) dstRect: Rect); external name '_RectMatrix';
{
 *  MapMatrix()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure MapMatrix(var matrix: MatrixRecord; const (*var*) fromRect: Rect; const (*var*) toRect: Rect); external name '_MapMatrix';
{
 *  CompAdd()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure CompAdd(var src: wide; var dst: wide); external name '_CompAdd';
{
 *  CompSub()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure CompSub(var src: wide; var dst: wide); external name '_CompSub';
{
 *  CompNeg()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure CompNeg(var dst: wide); external name '_CompNeg';
{
 *  CompShift()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure CompShift(var src: wide; shift: SInt16); external name '_CompShift';
{
 *  CompMul()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure CompMul(src1: SInt32; src2: SInt32; var dst: wide); external name '_CompMul';
{
 *  CompDiv()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function CompDiv(var numerator: wide; denominator: SInt32; var remainder: SInt32): SInt32; external name '_CompDiv';
{
 *  CompFixMul()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure CompFixMul(var compSrc: wide; fixSrc: Fixed; var compDst: wide); external name '_CompFixMul';
{
 *  CompMulDiv()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure CompMulDiv(var co: wide; mul: SInt32; divisor: SInt32); external name '_CompMulDiv';
{
 *  CompMulDivTrunc()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure CompMulDivTrunc(var co: wide; mul: SInt32; divisor: SInt32; var remainder: SInt32); external name '_CompMulDivTrunc';
{
 *  CompCompare()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function CompCompare(const (*var*) a: wide; const (*var*) minusb: wide): SInt32; external name '_CompCompare';
{
 *  CompSquareRoot()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function CompSquareRoot(const (*var*) src: wide): UInt32; external name '_CompSquareRoot';
{
 *  FixMulDiv()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function FixMulDiv(src: Fixed; mul: Fixed; divisor: Fixed): Fixed; external name '_FixMulDiv';
{
 *  UnsignedFixMulDiv()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function UnsignedFixMulDiv(src: Fixed; mul: Fixed; divisor: Fixed): Fixed; external name '_UnsignedFixMulDiv';
{
 *  FracSinCos()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function FracSinCos(degree: Fixed; var cosOut: Fract): Fract; external name '_FracSinCos';
{
 *  FixExp2()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function FixExp2(src: Fixed): Fixed; external name '_FixExp2';
{
 *  FixLog2()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function FixLog2(src: Fixed): Fixed; external name '_FixLog2';
{
 *  FixPow()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function FixPow(base: Fixed; exp: Fixed): Fixed; external name '_FixPow';
type
    GraphicsImportComponent             = ComponentInstance;

const
    GraphicsImporterComponentType = $67726970 (* 'grip' *);

    graphicsImporterUsesImageDecompressor = $00800000;

    quickTimeImageFileImageDescriptionAtom = $69647363 (* 'idsc' *);
    quickTimeImageFileImageDataAtom = $69646174 (* 'idat' *);
    quickTimeImageFileMetaDataAtom = $6D657461 (* 'meta' *);
    quickTimeImageFileColorSyncProfileAtom = $69696363 (* 'iicc' *);

    graphicsImporterDrawsAllPixels = 0;
    graphicsImporterDoesntDrawAllPixels = 1;
    graphicsImporterDontKnowIfDrawAllPixels = 2;

    {    Flags for GraphicsImportSetFlags   }
    kGraphicsImporterDontDoGammaCorrection = $00000001;
    kGraphicsImporterTrustResolutionFromFile = $00000002;
    kGraphicsImporterEnableSubPixelPositioning = $00000004;

    kGraphicsExportGroup        = $6578706F (* 'expo' *);
    kGraphicsExportFileType     = $66747970 (* 'ftyp' *);
    kGraphicsExportMIMEType     = $6D696D65 (* 'mime' *);
    kGraphicsExportExtension    = $65787420 (* 'ext ' *);
    kGraphicsExportDescription  = $64657363 (* 'desc' *);

    {    User data types for layers of Photoshop files  }
    kQTPhotoshopLayerMode       = $6C6D6F64 (* 'lmod' *);                       {  OSType  }
    kQTPhotoshopLayerOpacity    = $6C6F7061 (* 'lopa' *);                       {  UInt8, 0 = transparent .. 255 = opaque  }
    kQTPhotoshopLayerClipping   = $6C636C70 (* 'lclp' *);                       {  UInt8, 0 = base, 1 = non-base  }
    kQTPhotoshopLayerFlags      = $6C666C67 (* 'lflg' *);                       {  UInt8  }
    kQTPhotoshopLayerName       = $A96C6E6D (* '©lnm' *);                       {  Text  }
    kQTPhotoshopLayerUnicodeName = $6C756E69 (* 'luni' *);                      {  Unicode characters, not terminated  }

    {    User data returned by graphics importers to suggest intended use for indexed images    }
    kQTIndexedImageType         = $6E74683F (* 'nth?' *);                       {  1 or more OSTypes, such as the following values:  }
    kQTIndexedImageIsThumbnail  = $6E3D7468 (* 'n=th' *);                       {  The image at this index is a thumbnail.  }
    kQTIndexedImageIsLayer      = $6E3D6C79 (* 'n=ly' *);                       {  The image at this index is a layer.  }
    kQTIndexedImageIsPage       = $6E3D7067 (* 'n=pg' *);                       {  The image at this index is a page.  }
    kQTIndexedImageIsMultiResolution = $6E3D7273 (* 'n=rs' *);                  {  The image at this index is one of several identical images at different resolutions.  }

    {    Other user data types returned by graphics importers   }
    kQTTIFFUserDataPrefix       = $74690000;                    {  Added to some tag values in TIFF IFDs to generate user data codes.  (0x7469 is 'ti'.)  }
                                                                {  For example, YCbCrPositioning is tag 0x0213, so its user data code is 0x74690213.  }
    kQTTIFFExifUserDataPrefix   = $65780000;                    {  Added to tag values in Exif IFDs to generate user data codes.  (0x6578 is 'ex'.)  }
                                                                {  For example, DateTimeOriginal is tag 0x9003, so its user data code is 0x65789003.  }
    kQTTIFFExifGPSUserDataPrefix = $67700000;                   {  Added to tag values in Exif GPS IFDs to generate user data codes.  (0x6770 is 'gp'.)  }
                                                                {  For example, GPSAltitude is tag 0x0006, so its user data code is 0x6770006.  }
    kQTAlphaMode                = $616C6D6F (* 'almo' *);                       {  UInt32; eg, graphicsModeStraightAlpha or graphicsModePreBlackAlpha  }
    kQTAlphaModePreMulColor     = $616C6D70 (* 'almp' *);                       {  RGBColor; used if kQTAlphaMode is graphicsModePreMulColorAlpha  }
    kUserDataIPTC               = $69707463 (* 'iptc' *);

    {    Found in TIFF and Exif JPEG files  }
    kQTTIFFUserDataOrientation  = $74690112;                    {  1 SHORT  }
    kQTTIFFUserDataTransferFunction = $7469012D;                {  n SHORTs  }
    kQTTIFFUserDataWhitePoint   = $7469013E;                    {  2 RATIONALs  }
    kQTTIFFUserDataPrimaryChromaticities = $7469013F;           {  6 RATIONALs  }
    kQTTIFFUserDataTransferRange = $74690156;                   {  6 SHORTs  }
    kQTTIFFUserDataYCbCrPositioning = $74690213;                {  1 SHORT  }
    kQTTIFFUserDataReferenceBlackWhite = $74690214;             {  n LONGs  }

    {    Found in GeoTIFF files; defined in the GeoTIFF 1.0 spec    }
    kQTTIFFUserDataModelPixelScale = $7469830E;                 {  3 DOUBLEs  }
    kQTTIFFUserDataModelTransformation = $746985D8;             {  16 DOUBLEs  }
    kQTTIFFUserDataModelTiepoint = $74698482;                   {  n DOUBLEs  }
    kQTTIFFUserDataGeoKeyDirectory = $746987AF;                 {  n SHORTs  }
    kQTTIFFUserDataGeoDoubleParams = $746987B0;                 {  n DOUBLEs  }
    kQTTIFFUserDataGeoAsciiParams = $746987B1;                  {  n ASCIIs  }
    kQTTIFFUserDataIntergraphMatrix = $74698480;                {  16 or 17 DOUBLEs  }

    {    Found in Exif TIFF and Exif JPEG files; defined in the Exif 2.1 spec   }
    kQTExifUserDataExifVersion  = $65789000;                    {  4 bytes (import only)  }
    kQTExifUserDataFlashPixVersion = $6578A000;                 {  4 bytes  }
    kQTExifUserDataColorSpace   = $6578A001;                    {  1 SHORT  }
    kQTExifUserDataComponentsConfiguration = $65789101;         {  4 bytes  }
    kQTExifUserDataCompressedBitsPerPixel = $65789102;          {  1 RATIONAL  }
    kQTExifUserDataPixelXDimension = $6578A002;                 {  1 SHORT or LONG  }
    kQTExifUserDataPixelYDimension = $6578A003;                 {  1 SHORT or LONG  }
    kQTExifUserDataMakerNote    = $6578927C;                    {  n bytes  }
    kQTExifUserDataUserComment  = $6578928C;                    {  n bytes  }
    kQTExifUserDataRelatedSoundFile = $6578A004;                {  13 ASCIIs }
    kQTExifUserDataDateTimeOriginal = $65789003;                {  20 ASCIIs  }
    kQTExifUserDataDateTimeDigitized = $65789004;               {  20 ASCIIs  }
    kQTExifUserDataSubSecTime   = $65789290;                    {  n ASCIIs  }
    kQTExifUserDataSubSecTimeOriginal = $65789291;              {  n ASCIIs  }
    kQTExifUserDataSubSecTimeDigitized = $65789292;             {  n ASCIIs  }
    kQTExifUserDataExposureTime = $6578829A;                    {  1 RATIONAL  }
    kQTExifUserDataFNumber      = $6578829D;                    {  1 RATIONAL  }
    kQTExifUserDataExposureProgram = $65788822;                 {  1 SHORT  }
    kQTExifUserDataSpectralSensitivity = $65788824;             {  n ASCIIs  }
    kQTExifUserDataISOSpeedRatings = $65788827;                 {  n SHORTs  }
    kQTExifUserDataShutterSpeedValue = $65789201;               {  1 SIGNED RATIONAL  }
    kQTExifUserDataApertureValue = $65789202;                   {  1 RATIONAL  }
    kQTExifUserDataBrightnessValue = $65789203;                 {  1 SIGNED RATIONAL  }
    kQTExifUserDataExposureBiasValue = $65789204;               {  1 SIGNED RATIONAL  }
    kQTExifUserDataMaxApertureValue = $65789205;                {  1 RATIONAL  }
    kQTExifUserDataSubjectDistance = $65789206;                 {  1 RATIONAL  }
    kQTExifUserDataMeteringMode = $65789207;                    {  1 SHORT  }
    kQTExifUserDataLightSource  = $65789208;                    {  1 SHORT  }
    kQTExifUserDataFlash        = $65789209;                    {  1 SHORT  }
    kQTExifUserDataFocalLength  = $6578920A;                    {  1 RATIONAL  }
    kQTExifUserDataFlashEnergy  = $6578A20B;                    {  1 RATIONAL  }
    kQTExifUserDataFocalPlaneXResolution = $6578A20E;           {  1 RATIONAL  }
    kQTExifUserDataFocalPlaneYResolution = $6578A20F;           {  1 RATIONAL  }
    kQTExifUserDataFocalPlaneResolutionUnit = $6578A210;        {  1 SHORT  }
    kQTExifUserDataSubjectLocation = $6578A214;                 {  1 SHORT  }
    kQTExifUserDataExposureIndex = $6578A215;                   {  1 RATIONAL  }
    kQTExifUserDataSensingMethod = $6578A217;                   {  1 SHORT  }
    kQTExifUserDataFileSource   = $6578A300;                    {  1 UNDEFINED  }
    kQTExifUserDataSceneType    = $6578A301;                    {  1 UNDEFINED  }

    {    Found in some Exif TIFF and Exif JPEG files; defined in the Exif 2.1 spec  }
    kQTExifUserDataGPSVersionID = $06770000;                    {  4 BYTEs  }
    kQTExifUserDataGPSLatitudeRef = $06770001;                  {  2 ASCIIs }
    kQTExifUserDataGPSLatitude  = $06770002;                    {  3 RATIONALs  }
    kQTExifUserDataGPSLongitudeRef = $06770003;                 {  2 ASCIIs  }
    kQTExifUserDataGPSLongitude = $06770004;                    {  3 RATIONALs  }
    kQTExifUserDataGPSAltitudeRef = $06770005;                  {  1 BYTE  }
    kQTExifUserDataGPSAltitude  = $06770006;                    {  1 RATIONAL  }
    kQTExifUserDataGPSTimeStamp = $06770007;                    {  3 RATIONALs  }
    kQTExifUserDataGPSSatellites = $06770008;                   {  n ASCIIs  }
    kQTExifUserDataGPSStatus    = $06770009;                    {  2 ASCIIs  }
    kQTExifUserDataGPSMeasureMode = $0677000A;                  {  2 ASCIIs  }
    kQTExifUserDataGPSDOP       = $0677000B;                    {  1 RATIONAL  }
    kQTExifUserDataGPSSpeedRef  = $0677000C;                    {  2 ASCIIs  }
    kQTExifUserDataGPSSpeed     = $0677000D;                    {  1 RATIONAL  }
    kQTExifUserDataGPSTrackRef  = $0677000E;                    {  2 ASCIIs  }
    kQTExifUserDataGPSTrack     = $0677000F;                    {  1 RATIONAL  }
    kQTExifUserDataGPSImgDirectionRef = $06770010;              {  2 ASCIIs  }
    kQTExifUserDataGPSImgDirection = $06770011;                 {  1 RATIONAL  }
    kQTExifUserDataGPSMapDatum  = $06770012;                    {  n ASCII  }
    kQTExifUserDataGPSDestLatitudeRef = $06770013;              {  2 ASCIIs  }
    kQTExifUserDataGPSDestLatitude = $06770014;                 {  3 RATIONALs  }
    kQTExifUserDataGPSDestLongitudeRef = $06770015;             {  2 ASCIIs  }
    kQTExifUserDataGPSDestLongitude = $06770016;                {  3 RATIONALs  }
    kQTExifUserDataGPSDestBearingRef = $06770017;               {  2 ASCIIs  }
    kQTExifUserDataGPSDestBearing = $06770018;                  {  1 RATIONAL  }
    kQTExifUserDataGPSDestDistanceRef = $06770019;              {  2 ASCIIs  }
    kQTExifUserDataGPSDestDistance = $0677001A;                 {  1 RATIONAL  }


    {   * These are GraphicsImport procedures * }
    {
     *  GraphicsImportSetDataReference()
     *
     *  Availability:
     *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
     *    Windows:          in qtmlClient.lib 3.0 and later
        }
function GraphicsImportSetDataReference(ci: GraphicsImportComponent; dataRef: Handle; dataReType: OSType): ComponentResult; external name '_GraphicsImportSetDataReference';
{
 *  GraphicsImportGetDataReference()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GraphicsImportGetDataReference(ci: GraphicsImportComponent; var dataRef: Handle; var dataReType: OSType): ComponentResult; external name '_GraphicsImportGetDataReference';
{
 *  GraphicsImportSetDataFile()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GraphicsImportSetDataFile(ci: GraphicsImportComponent; const (*var*) theFile: FSSpec): ComponentResult; external name '_GraphicsImportSetDataFile';
{
 *  GraphicsImportGetDataFile()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GraphicsImportGetDataFile(ci: GraphicsImportComponent; var theFile: FSSpec): ComponentResult; external name '_GraphicsImportGetDataFile';
{
 *  GraphicsImportSetDataHandle()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GraphicsImportSetDataHandle(ci: GraphicsImportComponent; h: Handle): ComponentResult; external name '_GraphicsImportSetDataHandle';
{
 *  GraphicsImportGetDataHandle()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GraphicsImportGetDataHandle(ci: GraphicsImportComponent; var h: Handle): ComponentResult; external name '_GraphicsImportGetDataHandle';
{
 *  GraphicsImportGetImageDescription()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GraphicsImportGetImageDescription(ci: GraphicsImportComponent; var desc: ImageDescriptionHandle): ComponentResult; external name '_GraphicsImportGetImageDescription';
{
 *  GraphicsImportGetDataOffsetAndSize()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GraphicsImportGetDataOffsetAndSize(ci: GraphicsImportComponent; var offset: UInt32; var size: UInt32): ComponentResult; external name '_GraphicsImportGetDataOffsetAndSize';
{
 *  GraphicsImportReadData()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GraphicsImportReadData(ci: GraphicsImportComponent; dataPtr: UnivPtr; dataOffset: UInt32; dataSize: UInt32): ComponentResult; external name '_GraphicsImportReadData';
{
 *  GraphicsImportSetClip()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GraphicsImportSetClip(ci: GraphicsImportComponent; clipRgn: RgnHandle): ComponentResult; external name '_GraphicsImportSetClip';
{
 *  GraphicsImportGetClip()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GraphicsImportGetClip(ci: GraphicsImportComponent; var clipRgn: RgnHandle): ComponentResult; external name '_GraphicsImportGetClip';
{
 *  GraphicsImportSetSourceRect()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GraphicsImportSetSourceRect(ci: GraphicsImportComponent; const (*var*) sourceRect: Rect): ComponentResult; external name '_GraphicsImportSetSourceRect';
{
 *  GraphicsImportGetSourceRect()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GraphicsImportGetSourceRect(ci: GraphicsImportComponent; var sourceRect: Rect): ComponentResult; external name '_GraphicsImportGetSourceRect';
{
 *  GraphicsImportGetNaturalBounds()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GraphicsImportGetNaturalBounds(ci: GraphicsImportComponent; var naturalBounds: Rect): ComponentResult; external name '_GraphicsImportGetNaturalBounds';
{
 *  GraphicsImportDraw()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GraphicsImportDraw(ci: GraphicsImportComponent): ComponentResult; external name '_GraphicsImportDraw';
{
 *  GraphicsImportSetGWorld()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GraphicsImportSetGWorld(ci: GraphicsImportComponent; port: CGrafPtr; gd: GDHandle): ComponentResult; external name '_GraphicsImportSetGWorld';
{
 *  GraphicsImportGetGWorld()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GraphicsImportGetGWorld(ci: GraphicsImportComponent; var port: CGrafPtr; var gd: GDHandle): ComponentResult; external name '_GraphicsImportGetGWorld';
{
 *  GraphicsImportSetMatrix()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GraphicsImportSetMatrix(ci: GraphicsImportComponent; const (*var*) matrix: MatrixRecord): ComponentResult; external name '_GraphicsImportSetMatrix';
{
 *  GraphicsImportGetMatrix()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GraphicsImportGetMatrix(ci: GraphicsImportComponent; var matrix: MatrixRecord): ComponentResult; external name '_GraphicsImportGetMatrix';
{
 *  GraphicsImportSetBoundsRect()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GraphicsImportSetBoundsRect(ci: GraphicsImportComponent; const (*var*) bounds: Rect): ComponentResult; external name '_GraphicsImportSetBoundsRect';
{
 *  GraphicsImportGetBoundsRect()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GraphicsImportGetBoundsRect(ci: GraphicsImportComponent; var bounds: Rect): ComponentResult; external name '_GraphicsImportGetBoundsRect';
{
 *  GraphicsImportSaveAsPicture()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GraphicsImportSaveAsPicture(ci: GraphicsImportComponent; const (*var*) fss: FSSpec; scriptTag: ScriptCode): ComponentResult; external name '_GraphicsImportSaveAsPicture';
{
 *  GraphicsImportSetGraphicsMode()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GraphicsImportSetGraphicsMode(ci: GraphicsImportComponent; graphicsMode: SInt32; const (*var*) opColor: RGBColor): ComponentResult; external name '_GraphicsImportSetGraphicsMode';
{
 *  GraphicsImportGetGraphicsMode()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GraphicsImportGetGraphicsMode(ci: GraphicsImportComponent; var graphicsMode: SInt32; var opColor: RGBColor): ComponentResult; external name '_GraphicsImportGetGraphicsMode';
{
 *  GraphicsImportSetQuality()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GraphicsImportSetQuality(ci: GraphicsImportComponent; quality: CodecQ): ComponentResult; external name '_GraphicsImportSetQuality';
{
 *  GraphicsImportGetQuality()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GraphicsImportGetQuality(ci: GraphicsImportComponent; var quality: CodecQ): ComponentResult; external name '_GraphicsImportGetQuality';
{
 *  GraphicsImportSaveAsQuickTimeImageFile()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GraphicsImportSaveAsQuickTimeImageFile(ci: GraphicsImportComponent; const (*var*) fss: FSSpec; scriptTag: ScriptCode): ComponentResult; external name '_GraphicsImportSaveAsQuickTimeImageFile';
{
 *  GraphicsImportSetDataReferenceOffsetAndLimit()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GraphicsImportSetDataReferenceOffsetAndLimit(ci: GraphicsImportComponent; offset: UInt32; limit: UInt32): ComponentResult; external name '_GraphicsImportSetDataReferenceOffsetAndLimit';
{
 *  GraphicsImportGetDataReferenceOffsetAndLimit()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GraphicsImportGetDataReferenceOffsetAndLimit(ci: GraphicsImportComponent; var offset: UInt32; var limit: UInt32): ComponentResult; external name '_GraphicsImportGetDataReferenceOffsetAndLimit';
{
 *  GraphicsImportGetAliasedDataReference()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GraphicsImportGetAliasedDataReference(ci: GraphicsImportComponent; var dataRef: Handle; var dataRefType: OSType): ComponentResult; external name '_GraphicsImportGetAliasedDataReference';
{
 *  GraphicsImportValidate()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GraphicsImportValidate(ci: GraphicsImportComponent; var valid: boolean): ComponentResult; external name '_GraphicsImportValidate';
{
 *  GraphicsImportGetMetaData()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GraphicsImportGetMetaData(ci: GraphicsImportComponent; userData: UnivPtr): ComponentResult; external name '_GraphicsImportGetMetaData';
{
 *  GraphicsImportGetMIMETypeList()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GraphicsImportGetMIMETypeList(ci: GraphicsImportComponent; qtAtomContainerPtr: UnivPtr): ComponentResult; external name '_GraphicsImportGetMIMETypeList';
{
 *  GraphicsImportDoesDrawAllPixels()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GraphicsImportDoesDrawAllPixels(ci: GraphicsImportComponent; var drawsAllPixels: SInt16): ComponentResult; external name '_GraphicsImportDoesDrawAllPixels';
{
 *  GraphicsImportGetAsPicture()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GraphicsImportGetAsPicture(ci: GraphicsImportComponent; var picture: PicHandle): ComponentResult; external name '_GraphicsImportGetAsPicture';
{
 *  GraphicsImportExportImageFile()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GraphicsImportExportImageFile(ci: GraphicsImportComponent; fileType: OSType; fileCreator: OSType; const (*var*) fss: FSSpec; scriptTag: ScriptCode): ComponentResult; external name '_GraphicsImportExportImageFile';
{
 *  GraphicsImportGetExportImageTypeList()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GraphicsImportGetExportImageTypeList(ci: GraphicsImportComponent; qtAtomContainerPtr: UnivPtr): ComponentResult; external name '_GraphicsImportGetExportImageTypeList';
{
 *  GraphicsImportDoExportImageFileDialog()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GraphicsImportDoExportImageFileDialog(ci: GraphicsImportComponent; const (*var*) inDefaultSpec: FSSpec; prompt: StringPtr; filterProc: ModalFilterYDUPP; var outExportedType: OSType; var outExportedSpec: FSSpec; var outScriptTag: ScriptCode): ComponentResult; external name '_GraphicsImportDoExportImageFileDialog';
{
 *  GraphicsImportGetExportSettingsAsAtomContainer()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GraphicsImportGetExportSettingsAsAtomContainer(ci: GraphicsImportComponent; qtAtomContainerPtr: UnivPtr): ComponentResult; external name '_GraphicsImportGetExportSettingsAsAtomContainer';
{
 *  GraphicsImportSetExportSettingsFromAtomContainer()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GraphicsImportSetExportSettingsFromAtomContainer(ci: GraphicsImportComponent; qtAtomContainer: UnivPtr): ComponentResult; external name '_GraphicsImportSetExportSettingsFromAtomContainer';
{
 *  GraphicsImportSetProgressProc()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GraphicsImportSetProgressProc(ci: GraphicsImportComponent; progressProc: ICMProgressProcRecordPtr): ComponentResult; external name '_GraphicsImportSetProgressProc';
{
 *  GraphicsImportGetProgressProc()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GraphicsImportGetProgressProc(ci: GraphicsImportComponent; progressProc: ICMProgressProcRecordPtr): ComponentResult; external name '_GraphicsImportGetProgressProc';
{
 *  GraphicsImportGetImageCount()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function GraphicsImportGetImageCount(ci: GraphicsImportComponent; var imageCount: UInt32): ComponentResult; external name '_GraphicsImportGetImageCount';
{
 *  GraphicsImportSetImageIndex()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function GraphicsImportSetImageIndex(ci: GraphicsImportComponent; imageIndex: UInt32): ComponentResult; external name '_GraphicsImportSetImageIndex';
{
 *  GraphicsImportGetImageIndex()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function GraphicsImportGetImageIndex(ci: GraphicsImportComponent; var imageIndex: UInt32): ComponentResult; external name '_GraphicsImportGetImageIndex';
{
 *  GraphicsImportGetDataOffsetAndSize64()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function GraphicsImportGetDataOffsetAndSize64(ci: GraphicsImportComponent; var offset: wide; var size: wide): ComponentResult; external name '_GraphicsImportGetDataOffsetAndSize64';
{
 *  GraphicsImportReadData64()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function GraphicsImportReadData64(ci: GraphicsImportComponent; dataPtr: UnivPtr; const (*var*) dataOffset: wide; dataSize: UInt32): ComponentResult; external name '_GraphicsImportReadData64';
{
 *  GraphicsImportSetDataReferenceOffsetAndLimit64()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function GraphicsImportSetDataReferenceOffsetAndLimit64(ci: GraphicsImportComponent; const (*var*) offset: wide; const (*var*) limit: wide): ComponentResult; external name '_GraphicsImportSetDataReferenceOffsetAndLimit64';
{
 *  GraphicsImportGetDataReferenceOffsetAndLimit64()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function GraphicsImportGetDataReferenceOffsetAndLimit64(ci: GraphicsImportComponent; var offset: wide; var limit: wide): ComponentResult; external name '_GraphicsImportGetDataReferenceOffsetAndLimit64';
{
 *  GraphicsImportGetDefaultMatrix()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function GraphicsImportGetDefaultMatrix(ci: GraphicsImportComponent; var defaultMatrix: MatrixRecord): ComponentResult; external name '_GraphicsImportGetDefaultMatrix';
{
 *  GraphicsImportGetDefaultClip()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function GraphicsImportGetDefaultClip(ci: GraphicsImportComponent; var defaultRgn: RgnHandle): ComponentResult; external name '_GraphicsImportGetDefaultClip';
{
 *  GraphicsImportGetDefaultGraphicsMode()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function GraphicsImportGetDefaultGraphicsMode(ci: GraphicsImportComponent; var defaultGraphicsMode: SInt32; var defaultOpColor: RGBColor): ComponentResult; external name '_GraphicsImportGetDefaultGraphicsMode';
{
 *  GraphicsImportGetDefaultSourceRect()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function GraphicsImportGetDefaultSourceRect(ci: GraphicsImportComponent; var defaultSourceRect: Rect): ComponentResult; external name '_GraphicsImportGetDefaultSourceRect';
{
 *  GraphicsImportGetColorSyncProfile()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function GraphicsImportGetColorSyncProfile(ci: GraphicsImportComponent; var profile: Handle): ComponentResult; external name '_GraphicsImportGetColorSyncProfile';
{
 *  GraphicsImportSetDestRect()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function GraphicsImportSetDestRect(ci: GraphicsImportComponent; const (*var*) destRect: Rect): ComponentResult; external name '_GraphicsImportSetDestRect';
{
 *  GraphicsImportGetDestRect()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function GraphicsImportGetDestRect(ci: GraphicsImportComponent; var destRect: Rect): ComponentResult; external name '_GraphicsImportGetDestRect';
{
 *  GraphicsImportSetFlags()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function GraphicsImportSetFlags(ci: GraphicsImportComponent; flags: SInt32): ComponentResult; external name '_GraphicsImportSetFlags';
{
 *  GraphicsImportGetFlags()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function GraphicsImportGetFlags(ci: GraphicsImportComponent; var flags: SInt32): ComponentResult; external name '_GraphicsImportGetFlags';
{ 2 private selectors }
{
 *  GraphicsImportGetBaseDataOffsetAndSize64()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 5.0.2 and later
 *    CarbonLib:        in CarbonLib 1.4 and later
 *    Mac OS X:         in version 10.1 and later
 *    Windows:          in qtmlClient.lib 5.0.2 and later
 }
function GraphicsImportGetBaseDataOffsetAndSize64(ci: GraphicsImportComponent; var offset: wide; var size: wide): ComponentResult; external name '_GraphicsImportGetBaseDataOffsetAndSize64';
{
 *  GraphicsImportSetImageIndexToThumbnail()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 6.0 and later
 *    CarbonLib:        in CarbonLib 1.6 and later
 *    Mac OS X:         in version 10.2 and later
 *    Windows:          in qtmlClient.lib 6.0 and later
 }
function GraphicsImportSetImageIndexToThumbnail(ci: GraphicsImportComponent): ComponentResult; external name '_GraphicsImportSetImageIndexToThumbnail';
type
    GraphicsExportComponent             = ComponentInstance;

const
    GraphicsExporterComponentType = $67726578 (* 'grex' *);
    kBaseGraphicsExporterSubType = $62617365 (* 'base' *);

    graphicsExporterIsBaseExporter = $00000001;
    graphicsExporterCanTranscode = $00000002;
    graphicsExporterUsesImageCompressor = $00000004;


type
    QTResolutionSettingsPtr = ^QTResolutionSettings;
    QTResolutionSettings = record
        horizontalResolution:   Fixed;
        verticalResolution:     Fixed;
    end;

    QTTargetDataSizePtr = ^QTTargetDataSize;
    QTTargetDataSize = record
        targetDataSize:         UInt32;
    end;

    QTThumbnailSettingsPtr = ^QTThumbnailSettings;
    QTThumbnailSettings = record
        enableThumbnail:        SInt32;                             {  a thoroughly padded Boolean }
        maxThumbnailWidth:      SInt32;                             {  set to zero to let someone else decide }
        maxThumbnailHeight:     SInt32;                             {  set to zero to let someone else decide }
    end;


const
    kQTResolutionSettings       = $7265736F (* 'reso' *);
    kQTTargetDataSize           = $6461737A (* 'dasz' *);
    kQTDontRecompress           = $646E7472 (* 'dntr' *);
    kQTInterlaceStyle           = $696C6163 (* 'ilac' *);
    kQTColorSyncProfile         = $69636370 (* 'iccp' *);
    kQTThumbnailSettings        = $7468756D (* 'thum' *);
    kQTEnableExif               = $65786966 (* 'exif' *);                       {  UInt8 (boolean) }
    kQTMetaData                 = $6D657461 (* 'meta' *);

    kQTTIFFCompressionMethod    = $74696663 (* 'tifc' *);                       {  UInt32 }
    kQTTIFFCompression_None     = 1;
    kQTTIFFCompression_PackBits = 32773;
    kQTTIFFLittleEndian         = $74696665 (* 'tife' *);                       {  UInt8 (boolean) }

    kQTPNGFilterPreference      = $706E6766 (* 'pngf' *);                       {  UInt32 }
    kQTPNGFilterBestForColorType = $62666C74 (* 'bflt' *);
    kQTPNGFilterNone            = 0;
    kQTPNGFilterSub             = 1;
    kQTPNGFilterUp              = 2;
    kQTPNGFilterAverage         = 3;
    kQTPNGFilterPaeth           = 4;
    kQTPNGFilterAdaptivePerRow  = $61666C74 (* 'aflt' *);
    kQTPNGInterlaceStyle        = $696C6163 (* 'ilac' *);                       {  UInt32 }
    kQTPNGInterlaceNone         = 0;
    kQTPNGInterlaceAdam7        = 1;


    {   * These are GraphicsExport procedures * }
    {    To use: set the input and output (and other settings as desired) and call GEDoExport.  }
    {
     *  GraphicsExportDoExport()
     *
     *  Availability:
     *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
     *    CarbonLib:        in CarbonLib 1.0.2 and later
     *    Mac OS X:         in version 10.0 and later
     *    Windows:          in qtmlClient.lib 4.0 and later
        }
function GraphicsExportDoExport(ci: GraphicsExportComponent; var actualSizeWritten: UInt32): ComponentResult; external name '_GraphicsExportDoExport';
{ Used for internal communication between the base and format-specific graphics exporter: }
{
 *  GraphicsExportCanTranscode()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function GraphicsExportCanTranscode(ci: GraphicsExportComponent; var canTranscode: boolean): ComponentResult; external name '_GraphicsExportCanTranscode';
{
 *  GraphicsExportDoTranscode()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function GraphicsExportDoTranscode(ci: GraphicsExportComponent): ComponentResult; external name '_GraphicsExportDoTranscode';
{
 *  GraphicsExportCanUseCompressor()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function GraphicsExportCanUseCompressor(ci: GraphicsExportComponent; var canUseCompressor: boolean; codecSettingsAtomContainerPtr: UnivPtr): ComponentResult; external name '_GraphicsExportCanUseCompressor';
{
 *  GraphicsExportDoUseCompressor()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function GraphicsExportDoUseCompressor(ci: GraphicsExportComponent; codecSettingsAtomContainer: UnivPtr; var outDesc: ImageDescriptionHandle): ComponentResult; external name '_GraphicsExportDoUseCompressor';
{
 *  GraphicsExportDoStandaloneExport()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function GraphicsExportDoStandaloneExport(ci: GraphicsExportComponent): ComponentResult; external name '_GraphicsExportDoStandaloneExport';
{ Queries applications can make of a format-specific graphics exporter: }
{
 *  GraphicsExportGetDefaultFileTypeAndCreator()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function GraphicsExportGetDefaultFileTypeAndCreator(ci: GraphicsExportComponent; var fileType: OSType; var fileCreator: OSType): ComponentResult; external name '_GraphicsExportGetDefaultFileTypeAndCreator';
{
 *  GraphicsExportGetDefaultFileNameExtension()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function GraphicsExportGetDefaultFileNameExtension(ci: GraphicsExportComponent; var fileNameExtension: OSType): ComponentResult; external name '_GraphicsExportGetDefaultFileNameExtension';
{
 *  GraphicsExportGetMIMETypeList()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function GraphicsExportGetMIMETypeList(ci: GraphicsExportComponent; qtAtomContainerPtr: UnivPtr): ComponentResult; external name '_GraphicsExportGetMIMETypeList';
{ GraphicsExportIsTranscodePossibleFromCurrentInput is removed; call GraphicsExportCanTranscode instead }
{ Graphics exporter settings: }
{
 *  GraphicsExportRequestSettings()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function GraphicsExportRequestSettings(ci: GraphicsExportComponent; filterProc: ModalFilterYDUPP; yourDataProc: UnivPtr): ComponentResult; external name '_GraphicsExportRequestSettings';
{
 *  GraphicsExportSetSettingsFromAtomContainer()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function GraphicsExportSetSettingsFromAtomContainer(ci: GraphicsExportComponent; qtAtomContainer: UnivPtr): ComponentResult; external name '_GraphicsExportSetSettingsFromAtomContainer';
{
 *  GraphicsExportGetSettingsAsAtomContainer()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function GraphicsExportGetSettingsAsAtomContainer(ci: GraphicsExportComponent; qtAtomContainerPtr: UnivPtr): ComponentResult; external name '_GraphicsExportGetSettingsAsAtomContainer';
{
 *  GraphicsExportGetSettingsAsText()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function GraphicsExportGetSettingsAsText(ci: GraphicsExportComponent; var theText: Handle): ComponentResult; external name '_GraphicsExportGetSettingsAsText';
{ Graphics exporters may implement some or none of the following: }
{
 *  GraphicsExportSetDontRecompress()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function GraphicsExportSetDontRecompress(ci: GraphicsExportComponent; dontRecompress: boolean): ComponentResult; external name '_GraphicsExportSetDontRecompress';
{
 *  GraphicsExportGetDontRecompress()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function GraphicsExportGetDontRecompress(ci: GraphicsExportComponent; var dontRecompress: boolean): ComponentResult; external name '_GraphicsExportGetDontRecompress';
{
 *  GraphicsExportSetInterlaceStyle()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function GraphicsExportSetInterlaceStyle(ci: GraphicsExportComponent; interlaceStyle: UInt32): ComponentResult; external name '_GraphicsExportSetInterlaceStyle';
{
 *  GraphicsExportGetInterlaceStyle()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function GraphicsExportGetInterlaceStyle(ci: GraphicsExportComponent; var interlaceStyle: UInt32): ComponentResult; external name '_GraphicsExportGetInterlaceStyle';
{
 *  GraphicsExportSetMetaData()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function GraphicsExportSetMetaData(ci: GraphicsExportComponent; userData: UnivPtr): ComponentResult; external name '_GraphicsExportSetMetaData';
{
 *  GraphicsExportGetMetaData()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function GraphicsExportGetMetaData(ci: GraphicsExportComponent; userData: UnivPtr): ComponentResult; external name '_GraphicsExportGetMetaData';
{
 *  GraphicsExportSetTargetDataSize()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function GraphicsExportSetTargetDataSize(ci: GraphicsExportComponent; targetDataSize: UInt32): ComponentResult; external name '_GraphicsExportSetTargetDataSize';
{
 *  GraphicsExportGetTargetDataSize()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function GraphicsExportGetTargetDataSize(ci: GraphicsExportComponent; var targetDataSize: UInt32): ComponentResult; external name '_GraphicsExportGetTargetDataSize';
{
 *  GraphicsExportSetCompressionMethod()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function GraphicsExportSetCompressionMethod(ci: GraphicsExportComponent; compressionMethod: SInt32): ComponentResult; external name '_GraphicsExportSetCompressionMethod';
{
 *  GraphicsExportGetCompressionMethod()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function GraphicsExportGetCompressionMethod(ci: GraphicsExportComponent; var compressionMethod: SInt32): ComponentResult; external name '_GraphicsExportGetCompressionMethod';
{
 *  GraphicsExportSetCompressionQuality()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function GraphicsExportSetCompressionQuality(ci: GraphicsExportComponent; spatialQuality: CodecQ): ComponentResult; external name '_GraphicsExportSetCompressionQuality';
{
 *  GraphicsExportGetCompressionQuality()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function GraphicsExportGetCompressionQuality(ci: GraphicsExportComponent; var spatialQuality: CodecQ): ComponentResult; external name '_GraphicsExportGetCompressionQuality';
{
 *  GraphicsExportSetResolution()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function GraphicsExportSetResolution(ci: GraphicsExportComponent; horizontalResolution: Fixed; verticalResolution: Fixed): ComponentResult; external name '_GraphicsExportSetResolution';
{
 *  GraphicsExportGetResolution()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function GraphicsExportGetResolution(ci: GraphicsExportComponent; var horizontalResolution: Fixed; var verticalResolution: Fixed): ComponentResult; external name '_GraphicsExportGetResolution';
{
 *  GraphicsExportSetDepth()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function GraphicsExportSetDepth(ci: GraphicsExportComponent; depth: SInt32): ComponentResult; external name '_GraphicsExportSetDepth';
{
 *  GraphicsExportGetDepth()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function GraphicsExportGetDepth(ci: GraphicsExportComponent; var depth: SInt32): ComponentResult; external name '_GraphicsExportGetDepth';
{ (2 unused selectors) }
{
 *  GraphicsExportSetColorSyncProfile()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function GraphicsExportSetColorSyncProfile(ci: GraphicsExportComponent; colorSyncProfile: Handle): ComponentResult; external name '_GraphicsExportSetColorSyncProfile';
{
 *  GraphicsExportGetColorSyncProfile()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function GraphicsExportGetColorSyncProfile(ci: GraphicsExportComponent; var colorSyncProfile: Handle): ComponentResult; external name '_GraphicsExportGetColorSyncProfile';
{ Always implemented by the base graphics exporter: }
{
 *  GraphicsExportSetProgressProc()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function GraphicsExportSetProgressProc(ci: GraphicsExportComponent; progressProc: ICMProgressProcRecordPtr): ComponentResult; external name '_GraphicsExportSetProgressProc';
{
 *  GraphicsExportGetProgressProc()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function GraphicsExportGetProgressProc(ci: GraphicsExportComponent; progressProc: ICMProgressProcRecordPtr): ComponentResult; external name '_GraphicsExportGetProgressProc';
{ Sources for the input image: }
{
 *  GraphicsExportSetInputDataReference()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function GraphicsExportSetInputDataReference(ci: GraphicsExportComponent; dataRef: Handle; dataRefType: OSType; desc: ImageDescriptionHandle): ComponentResult; external name '_GraphicsExportSetInputDataReference';
{
 *  GraphicsExportGetInputDataReference()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function GraphicsExportGetInputDataReference(ci: GraphicsExportComponent; var dataRef: Handle; var dataRefType: OSType): ComponentResult; external name '_GraphicsExportGetInputDataReference';
{
 *  GraphicsExportSetInputFile()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function GraphicsExportSetInputFile(ci: GraphicsExportComponent; const (*var*) theFile: FSSpec; desc: ImageDescriptionHandle): ComponentResult; external name '_GraphicsExportSetInputFile';
{
 *  GraphicsExportGetInputFile()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function GraphicsExportGetInputFile(ci: GraphicsExportComponent; var theFile: FSSpec): ComponentResult; external name '_GraphicsExportGetInputFile';
{
 *  GraphicsExportSetInputHandle()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function GraphicsExportSetInputHandle(ci: GraphicsExportComponent; h: Handle; desc: ImageDescriptionHandle): ComponentResult; external name '_GraphicsExportSetInputHandle';
{
 *  GraphicsExportGetInputHandle()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function GraphicsExportGetInputHandle(ci: GraphicsExportComponent; var h: Handle): ComponentResult; external name '_GraphicsExportGetInputHandle';
{
 *  GraphicsExportSetInputPtr()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function GraphicsExportSetInputPtr(ci: GraphicsExportComponent; p: Ptr; size: UInt32; desc: ImageDescriptionHandle): ComponentResult; external name '_GraphicsExportSetInputPtr';
{
 *  GraphicsExportGetInputPtr()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function GraphicsExportGetInputPtr(ci: GraphicsExportComponent; var p: Ptr; var size: UInt32): ComponentResult; external name '_GraphicsExportGetInputPtr';
{
 *  GraphicsExportSetInputGraphicsImporter()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function GraphicsExportSetInputGraphicsImporter(ci: GraphicsExportComponent; grip: GraphicsImportComponent): ComponentResult; external name '_GraphicsExportSetInputGraphicsImporter';
{
 *  GraphicsExportGetInputGraphicsImporter()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function GraphicsExportGetInputGraphicsImporter(ci: GraphicsExportComponent; var grip: GraphicsImportComponent): ComponentResult; external name '_GraphicsExportGetInputGraphicsImporter';
{
 *  GraphicsExportSetInputPicture()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function GraphicsExportSetInputPicture(ci: GraphicsExportComponent; picture: PicHandle): ComponentResult; external name '_GraphicsExportSetInputPicture';
{
 *  GraphicsExportGetInputPicture()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function GraphicsExportGetInputPicture(ci: GraphicsExportComponent; var picture: PicHandle): ComponentResult; external name '_GraphicsExportGetInputPicture';
{
 *  GraphicsExportSetInputGWorld()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function GraphicsExportSetInputGWorld(ci: GraphicsExportComponent; gworld: GWorldPtr): ComponentResult; external name '_GraphicsExportSetInputGWorld';
{
 *  GraphicsExportGetInputGWorld()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function GraphicsExportGetInputGWorld(ci: GraphicsExportComponent; var gworld: GWorldPtr): ComponentResult; external name '_GraphicsExportGetInputGWorld';
{
 *  GraphicsExportSetInputPixmap()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function GraphicsExportSetInputPixmap(ci: GraphicsExportComponent; pixmap: PixMapHandle): ComponentResult; external name '_GraphicsExportSetInputPixmap';
{
 *  GraphicsExportGetInputPixmap()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function GraphicsExportGetInputPixmap(ci: GraphicsExportComponent; var pixmap: PixMapHandle): ComponentResult; external name '_GraphicsExportGetInputPixmap';
{ Only applicable when the input is a data reference, file, handle or ptr: }
{
 *  GraphicsExportSetInputOffsetAndLimit()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function GraphicsExportSetInputOffsetAndLimit(ci: GraphicsExportComponent; offset: UInt32; limit: UInt32): ComponentResult; external name '_GraphicsExportSetInputOffsetAndLimit';
{
 *  GraphicsExportGetInputOffsetAndLimit()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function GraphicsExportGetInputOffsetAndLimit(ci: GraphicsExportComponent; var offset: UInt32; var limit: UInt32): ComponentResult; external name '_GraphicsExportGetInputOffsetAndLimit';
{ Used by format-specific graphics exporters when transcoding: }
{
 *  GraphicsExportMayExporterReadInputData()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function GraphicsExportMayExporterReadInputData(ci: GraphicsExportComponent; var mayReadInputData: boolean): ComponentResult; external name '_GraphicsExportMayExporterReadInputData';
{
 *  GraphicsExportGetInputDataSize()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function GraphicsExportGetInputDataSize(ci: GraphicsExportComponent; var size: UInt32): ComponentResult; external name '_GraphicsExportGetInputDataSize';
{
 *  GraphicsExportReadInputData()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function GraphicsExportReadInputData(ci: GraphicsExportComponent; dataPtr: UnivPtr; dataOffset: UInt32; dataSize: UInt32): ComponentResult; external name '_GraphicsExportReadInputData';
{ Used by format-specific graphics exporters, especially when doing standalone export: }
{
 *  GraphicsExportGetInputImageDescription()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function GraphicsExportGetInputImageDescription(ci: GraphicsExportComponent; var desc: ImageDescriptionHandle): ComponentResult; external name '_GraphicsExportGetInputImageDescription';
{
 *  GraphicsExportGetInputImageDimensions()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function GraphicsExportGetInputImageDimensions(ci: GraphicsExportComponent; var dimensions: Rect): ComponentResult; external name '_GraphicsExportGetInputImageDimensions';
{
 *  GraphicsExportGetInputImageDepth()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function GraphicsExportGetInputImageDepth(ci: GraphicsExportComponent; var inputDepth: SInt32): ComponentResult; external name '_GraphicsExportGetInputImageDepth';
{
 *  GraphicsExportDrawInputImage()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function GraphicsExportDrawInputImage(ci: GraphicsExportComponent; gw: CGrafPtr; gd: GDHandle; const (*var*) srcRect: Rect; const (*var*) dstRect: Rect): ComponentResult; external name '_GraphicsExportDrawInputImage';
{ Destinations for the output image: }
{
 *  GraphicsExportSetOutputDataReference()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function GraphicsExportSetOutputDataReference(ci: GraphicsExportComponent; dataRef: Handle; dataRefType: OSType): ComponentResult; external name '_GraphicsExportSetOutputDataReference';
{
 *  GraphicsExportGetOutputDataReference()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function GraphicsExportGetOutputDataReference(ci: GraphicsExportComponent; var dataRef: Handle; var dataRefType: OSType): ComponentResult; external name '_GraphicsExportGetOutputDataReference';
{
 *  GraphicsExportSetOutputFile()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function GraphicsExportSetOutputFile(ci: GraphicsExportComponent; const (*var*) theFile: FSSpec): ComponentResult; external name '_GraphicsExportSetOutputFile';
{
 *  GraphicsExportGetOutputFile()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function GraphicsExportGetOutputFile(ci: GraphicsExportComponent; var theFile: FSSpec): ComponentResult; external name '_GraphicsExportGetOutputFile';
{
 *  GraphicsExportSetOutputHandle()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function GraphicsExportSetOutputHandle(ci: GraphicsExportComponent; h: Handle): ComponentResult; external name '_GraphicsExportSetOutputHandle';
{
 *  GraphicsExportGetOutputHandle()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function GraphicsExportGetOutputHandle(ci: GraphicsExportComponent; var h: Handle): ComponentResult; external name '_GraphicsExportGetOutputHandle';
{
 *  GraphicsExportSetOutputOffsetAndMaxSize()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function GraphicsExportSetOutputOffsetAndMaxSize(ci: GraphicsExportComponent; offset: UInt32; maxSize: UInt32; truncateFile: boolean): ComponentResult; external name '_GraphicsExportSetOutputOffsetAndMaxSize';
{
 *  GraphicsExportGetOutputOffsetAndMaxSize()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function GraphicsExportGetOutputOffsetAndMaxSize(ci: GraphicsExportComponent; var offset: UInt32; var maxSize: UInt32; var truncateFile: boolean): ComponentResult; external name '_GraphicsExportGetOutputOffsetAndMaxSize';
{
 *  GraphicsExportSetOutputFileTypeAndCreator()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function GraphicsExportSetOutputFileTypeAndCreator(ci: GraphicsExportComponent; fileType: OSType; fileCreator: OSType): ComponentResult; external name '_GraphicsExportSetOutputFileTypeAndCreator';
{
 *  GraphicsExportGetOutputFileTypeAndCreator()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function GraphicsExportGetOutputFileTypeAndCreator(ci: GraphicsExportComponent; var fileType: OSType; var fileCreator: OSType): ComponentResult; external name '_GraphicsExportGetOutputFileTypeAndCreator';
{ Used by format-specific graphics exporters: }
{
 *  GraphicsExportWriteOutputData()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function GraphicsExportWriteOutputData(ci: GraphicsExportComponent; dataPtr: UnivPtr; dataSize: UInt32): ComponentResult; external name '_GraphicsExportWriteOutputData';
{
 *  GraphicsExportSetOutputMark()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function GraphicsExportSetOutputMark(ci: GraphicsExportComponent; mark: UInt32): ComponentResult; external name '_GraphicsExportSetOutputMark';
{
 *  GraphicsExportGetOutputMark()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function GraphicsExportGetOutputMark(ci: GraphicsExportComponent; var mark: UInt32): ComponentResult; external name '_GraphicsExportGetOutputMark';
{
 *  GraphicsExportReadOutputData()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function GraphicsExportReadOutputData(ci: GraphicsExportComponent; dataPtr: UnivPtr; dataOffset: UInt32; dataSize: UInt32): ComponentResult; external name '_GraphicsExportReadOutputData';
{ Allows embedded thumbnail creation, if supported. }
{
 *  GraphicsExportSetThumbnailEnabled()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 5.0.2 and later
 *    CarbonLib:        in CarbonLib 1.4 and later
 *    Mac OS X:         in version 10.1 and later
 *    Windows:          in qtmlClient.lib 5.0.2 and later
 }
function GraphicsExportSetThumbnailEnabled(ci: GraphicsExportComponent; enableThumbnail: boolean; maxThumbnailWidth: SInt32; maxThumbnailHeight: SInt32): ComponentResult; external name '_GraphicsExportSetThumbnailEnabled';
{
 *  GraphicsExportGetThumbnailEnabled()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 5.0.2 and later
 *    CarbonLib:        in CarbonLib 1.4 and later
 *    Mac OS X:         in version 10.1 and later
 *    Windows:          in qtmlClient.lib 5.0.2 and later
 }
function GraphicsExportGetThumbnailEnabled(ci: GraphicsExportComponent; var thumbnailEnabled: boolean; var maxThumbnailWidth: SInt32; var maxThumbnailHeight: SInt32): ComponentResult; external name '_GraphicsExportGetThumbnailEnabled';
{ Allows export of Exif files, if supported.  This disables Exif-incompatible settings such as grayscale JPEG and compressed TIFF, and enables export of Exif metadata. }
{
 *  GraphicsExportSetExifEnabled()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 5.0.2 and later
 *    CarbonLib:        in CarbonLib 1.4 and later
 *    Mac OS X:         in version 10.1 and later
 *    Windows:          in qtmlClient.lib 5.0.2 and later
 }
function GraphicsExportSetExifEnabled(ci: GraphicsExportComponent; enableExif: boolean): ComponentResult; external name '_GraphicsExportSetExifEnabled';
{
 *  GraphicsExportGetExifEnabled()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 5.0.2 and later
 *    CarbonLib:        in CarbonLib 1.4 and later
 *    Mac OS X:         in version 10.1 and later
 *    Windows:          in qtmlClient.lib 5.0.2 and later
 }
function GraphicsExportGetExifEnabled(ci: GraphicsExportComponent; var exifEnabled: boolean): ComponentResult; external name '_GraphicsExportGetExifEnabled';
type
    ImageTranscoderComponent            = ComponentInstance;

const
    ImageTranscodererComponentType = $696D7463 (* 'imtc' *);


    {   * These are ImageTranscoder procedures *    }
    {
     *  ImageTranscoderBeginSequence()
     *
     *  Availability:
     *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
     *    Windows:          in qtmlClient.lib 3.0 and later
        }
function ImageTranscoderBeginSequence(itc: ImageTranscoderComponent; srcDesc: ImageDescriptionHandle; var dstDesc: ImageDescriptionHandle; data: UnivPtr; dataSize: SInt32): ComponentResult; external name '_ImageTranscoderBeginSequence';
{
 *  ImageTranscoderConvert()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function ImageTranscoderConvert(itc: ImageTranscoderComponent; srcData: UnivPtr; srcDataSize: SInt32; var dstData: UnivPtr; var dstDataSize: SInt32): ComponentResult; external name '_ImageTranscoderConvert';
{
 *  ImageTranscoderDisposeData()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function ImageTranscoderDisposeData(itc: ImageTranscoderComponent; dstData: UnivPtr): ComponentResult; external name '_ImageTranscoderDisposeData';
{
 *  ImageTranscoderEndSequence()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function ImageTranscoderEndSequence(itc: ImageTranscoderComponent): ComponentResult; external name '_ImageTranscoderEndSequence';
{ UPP call backs }
{$ALIGN MAC68K}
{#POP}
{unit LowMem}
{$ALIGN MAC68K}











{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}

{*************************************************************************************

    SIMPLE LOWMEM ACCESSORS

*************************************************************************************}
{
    The following functions were moved to Quickdraw.h:

        LMSetDeviceList
        LMSetLastSPExtra
        LMGetWidthListHand
        LMSetWidthListHand
        LMGetScrHRes
        LMSetScrHRes
        LMSetScrVRes
        LMGetScrVRes
        LMGetHiliteMode
        LMSetHiliteMode
        LMGetMainDevice
        LMSetMainDevice
        LMGetDeviceList
        LMGetQDColors
        LMSetQDColors
        LMGetWidthPtr
        LMSetWidthPtr
        LMGetWidthTabHandle
        LMSetWidthTabHandle
        LMGetLastSPExtra
        LMGetLastFOND
        LMSetLastFOND
        LMGetFractEnable
        LMSetFractEnable
        LMGetTheGDevice
        LMSetTheGDevice
        LMGetCursorNew
        LMSetCursorNew
        LMGetHiliteRGB
        LMSetHiliteRGB

    The following functions were moved to TextEdit.h:

        LMGetWordRedraw
        LMSetWordRedraw

    The following functions were moved to Menus.h:

        LMGetTheMenu

    The following functions were moved to Events.h:

        LMGetKeyRepThresh
        LMSetKeyRepThresh
        LMGetKeyThresh
        LMSetKeyRepThresh
        LMGetKbdLast
        LMSetKbdLast
        LMGetKbdType
        LMSetKbdType

}

{
 *  LMGetMemTop()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function LMGetMemTop: Ptr; external name '_LMGetMemTop';
{
 *  LMSetMemTop()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure LMSetMemTop(value: Ptr); external name '_LMSetMemTop';
{
 *  LMGetBufPtr()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function LMGetBufPtr: Ptr; external name '_LMGetBufPtr';
{
 *  LMSetBufPtr()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure LMSetBufPtr(value: Ptr); external name '_LMSetBufPtr';
{
 *  LMGetHeapEnd()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function LMGetHeapEnd: Ptr; external name '_LMGetHeapEnd';
{
 *  LMSetHeapEnd()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure LMSetHeapEnd(value: Ptr); external name '_LMSetHeapEnd';

{
 *  LMGetCPUFlag()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function LMGetCPUFlag: ByteParameter; external name '_LMGetCPUFlag';
{
 *  LMSetCPUFlag()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure LMSetCPUFlag(value: ByteParameter); external name '_LMSetCPUFlag';

{
 *  LMGetRndSeed()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function LMGetRndSeed: SInt32; external name '_LMGetRndSeed';
{
 *  LMSetRndSeed()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure LMSetRndSeed(value: SInt32); external name '_LMSetRndSeed';
{
 *  LMGetSEvtEnb()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function LMGetSEvtEnb: ByteParameter; external name '_LMGetSEvtEnb';
{
 *  LMSetSEvtEnb()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure LMSetSEvtEnb(value: ByteParameter); external name '_LMSetSEvtEnb';

{
 *  LMGetBootDrive()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function LMGetBootDrive: SInt16; external name '_LMGetBootDrive';
{
 *  LMSetBootDrive()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure LMSetBootDrive(value: SInt16); external name '_LMSetBootDrive';

{
 *  LMGetMemErr()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function LMGetMemErr: SInt16; external name '_LMGetMemErr';
{
 *  LMSetMemErr()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure LMSetMemErr(value: SInt16); external name '_LMSetMemErr';
{
 *  LMGetSdVolume()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function LMGetSdVolume: ByteParameter; external name '_LMGetSdVolume';
{
 *  LMSetSdVolume()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure LMSetSdVolume(value: ByteParameter); external name '_LMSetSdVolume';
{
 *  LMGetSoundPtr()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function LMGetSoundPtr: Ptr; external name '_LMGetSoundPtr';
{
 *  LMSetSoundPtr()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure LMSetSoundPtr(value: Ptr); external name '_LMSetSoundPtr';
{
 *  LMGetSoundBase()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function LMGetSoundBase: Ptr; external name '_LMGetSoundBase';
{
 *  LMSetSoundBase()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure LMSetSoundBase(value: Ptr); external name '_LMSetSoundBase';
{
 *  LMGetSoundLevel()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function LMGetSoundLevel: ByteParameter; external name '_LMGetSoundLevel';
{
 *  LMSetSoundLevel()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure LMSetSoundLevel(value: ByteParameter); external name '_LMSetSoundLevel';
{
 *  LMGetCurPitch()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function LMGetCurPitch: SInt16; external name '_LMGetCurPitch';
{
 *  LMSetCurPitch()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure LMSetCurPitch(value: SInt16); external name '_LMSetCurPitch';

{
 *  LMGetSysZone()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function LMGetSysZone: THz; external name '_LMGetSysZone';
{
 *  LMSetSysZone()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure LMSetSysZone(value: THz); external name '_LMSetSysZone';
{
 *  LMGetApplZone()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function LMGetApplZone: THz; external name '_LMGetApplZone';
{
 *  LMSetApplZone()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure LMSetApplZone(value: THz); external name '_LMSetApplZone';

{
 *  LMGetScrDmpEnb()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function LMGetScrDmpEnb: ByteParameter; external name '_LMGetScrDmpEnb';
{
 *  LMSetScrDmpEnb()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure LMSetScrDmpEnb(value: ByteParameter); external name '_LMSetScrDmpEnb';
{
 *  LMGetBufTgFNum()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function LMGetBufTgFNum: SInt32; external name '_LMGetBufTgFNum';
{
 *  LMSetBufTgFNum()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure LMSetBufTgFNum(value: SInt32); external name '_LMSetBufTgFNum';
{
 *  LMGetBufTgFFlg()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function LMGetBufTgFFlg: SInt16; external name '_LMGetBufTgFFlg';
{
 *  LMSetBufTgFFlg()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure LMSetBufTgFFlg(value: SInt16); external name '_LMSetBufTgFFlg';
{
 *  LMGetBufTgFBkNum()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function LMGetBufTgFBkNum: SInt16; external name '_LMGetBufTgFBkNum';
{
 *  LMSetBufTgFBkNum()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure LMSetBufTgFBkNum(value: SInt16); external name '_LMSetBufTgFBkNum';
{
 *  LMGetBufTgDate()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function LMGetBufTgDate: SInt32; external name '_LMGetBufTgDate';
{
 *  LMSetBufTgDate()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure LMSetBufTgDate(value: SInt32); external name '_LMSetBufTgDate';

{
 *  LMGetMinStack()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function LMGetMinStack: SInt32; external name '_LMGetMinStack';
{
 *  LMSetMinStack()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure LMSetMinStack(value: SInt32); external name '_LMSetMinStack';
{
 *  LMGetDefltStack()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function LMGetDefltStack: SInt32; external name '_LMGetDefltStack';
{
 *  LMSetDefltStack()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure LMSetDefltStack(value: SInt32); external name '_LMSetDefltStack';
{
 *  LMGetGZRootHnd()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function LMGetGZRootHnd: Handle; external name '_LMGetGZRootHnd';
{
 *  LMSetGZRootHnd()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure LMSetGZRootHnd(value: Handle); external name '_LMSetGZRootHnd';
{
 *  LMGetGZMoveHnd()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function LMGetGZMoveHnd: Handle; external name '_LMGetGZMoveHnd';
{
 *  LMSetGZMoveHnd()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure LMSetGZMoveHnd(value: Handle); external name '_LMSetGZMoveHnd';
{
   LMGetFCBSPtr, LMSetFCBSPtr and LMSetFSFCBLen are not supported with Mac OS 9
   and later. Access to information in File Control Blocks or Fork Control Blocks
   (FCBs) should, if at all possible, be made with the GetFCBInfo or GetForkCBInfo
   routines. See the Technote "FCBs, Now and Forever" or the Technical Q&A
   "Accessing File Control Blocks" for complete information on this subject.
   Direct access to FCBs is not allowed by Carbon. Non-Carbon programs that
   require direct access to FCBs should use the File System Manager (FSM) FCB accessor
   functions if FSM is available (use the Gestalt selector gestaltFSAttr to determine
   this). Non-Carbon programs needing direct access to FCBs when FSM is not available
   can define ENABLE_FCB_ARRAY_ACCESS to be true when compiling.
}
{$setc ENABLE_FCB_ARRAY_ACCESS := 0}


{
   LMGetFSFCBLen is supported only for the purpose of determining that the HFS
   file system is available as documented in developer Technotes (the HFS file system
   is available in System 3.2 and later). There is no documented use of FSFCBLen
   other than testing it for a positive value.
}

{
 *  LMGetToExtFS()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function LMGetToExtFS: UniversalProcPtr; external name '_LMGetToExtFS';
{
 *  LMSetToExtFS()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure LMSetToExtFS(value: UniversalProcPtr); external name '_LMSetToExtFS';

{
 *  LMGetJStash()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function LMGetJStash: UniversalProcPtr; external name '_LMGetJStash';
{
 *  LMSetJStash()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure LMSetJStash(value: UniversalProcPtr); external name '_LMSetJStash';

{
 *  LMGetCurApRefNum()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function LMGetCurApRefNum: SInt16; external name '_LMGetCurApRefNum';
{
 *  LMSetCurApRefNum()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure LMSetCurApRefNum(value: SInt16); external name '_LMSetCurApRefNum';

{
 *  LMGetCurStackBase()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function LMGetCurStackBase: Ptr; external name '_LMGetCurStackBase';
{
 *  LMSetCurStackBase()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure LMSetCurStackBase(value: Ptr); external name '_LMSetCurStackBase';

{
 *  LMGetCurPageOption()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function LMGetCurPageOption: SInt16; external name '_LMGetCurPageOption';
{
 *  LMSetCurPageOption()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure LMSetCurPageOption(value: SInt16); external name '_LMSetCurPageOption';
{
 *  LMGetPrintErr()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function LMGetPrintErr: SInt16; external name '_LMGetPrintErr';
{
 *  LMSetPrintErr()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure LMSetPrintErr(value: SInt16); external name '_LMSetPrintErr';
{   Carbon Scrap Manager does not support low memory. }


{
 *  LMGetApFontID()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function LMGetApFontID: SInt16; external name '_LMGetApFontID';
{
 *  LMSetApFontID()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure LMSetApFontID(value: SInt16); external name '_LMSetApFontID';
{ Carbon versions of the Window Manager do not support LowMem. }
{  Carbon Usage: use GetWindowList }



{
 *  LMGetOneOne()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function LMGetOneOne: SInt32; external name '_LMGetOneOne';
{
 *  LMSetOneOne()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure LMSetOneOne(value: SInt32); external name '_LMSetOneOne';
{
 *  LMGetMinusOne()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function LMGetMinusOne: SInt32; external name '_LMGetMinusOne';
{
 *  LMSetMinusOne()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure LMSetMinusOne(value: SInt32); external name '_LMSetMinusOne';
{  Carbon Usage: use GetMenuTrackingData }

{
 *  LMGetSysMap()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function LMGetSysMap: SInt16; external name '_LMGetSysMap';
{
 *  LMSetSysMap()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure LMSetSysMap(value: SInt16); external name '_LMSetSysMap';

{
 *  LMGetResLoad()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function LMGetResLoad: ByteParameter; external name '_LMGetResLoad';
{
 *  LMSetResLoad()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure LMSetResLoad(value: ByteParameter); external name '_LMSetResLoad';
{
 *  LMGetResErr()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function LMGetResErr: SInt16; external name '_LMGetResErr';
{
 *  LMSetResErr()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure LMSetResErr(value: SInt16); external name '_LMSetResErr';

{
 *  LMGetTmpResLoad()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function LMGetTmpResLoad: ByteParameter; external name '_LMGetTmpResLoad';
{
 *  LMSetTmpResLoad()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure LMSetTmpResLoad(value: ByteParameter); external name '_LMSetTmpResLoad';
{
 *  LMGetIntlSpec()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function LMGetIntlSpec: Ptr; external name '_LMGetIntlSpec';
{
 *  LMSetIntlSpec()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure LMSetIntlSpec(value: Ptr); external name '_LMSetIntlSpec';
{ LMGetWordRedraw and LMSetWordRedraw moved to TextEdit.h }
{
 *  LMGetSysFontFam()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function LMGetSysFontFam: SInt16; external name '_LMGetSysFontFam';
{
 *  LMSetSysFontFam()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure LMSetSysFontFam(value: SInt16); external name '_LMSetSysFontFam';
{
 *  LMGetSysFontSize()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function LMGetSysFontSize: SInt16; external name '_LMGetSysFontSize';
{
 *  LMSetSysFontSize()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure LMSetSysFontSize(value: SInt16); external name '_LMSetSysFontSize';
{  Carbon Usge: use GetMBarHeight }

{*************************************************************************************
    "BIG DATA"

        These lowmem accessors access big (> 4 bytes) values.
*************************************************************************************}

{
 *  LMGetCurApName()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function LMGetCurApName: StringPtr; external name '_LMGetCurApName';

{
 *  LMSetCurApName()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure LMSetCurApName(const (*var*) curApNameValue: Str31); external name '_LMSetCurApName';

{
 *  LMGetSysResName()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function LMGetSysResName: StringPtr; external name '_LMGetSysResName';

{
 *  LMSetSysResName()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure LMSetSysResName(const (*var*) sysResNameValue: Str15); external name '_LMSetSysResName';

{
 *  LMGetFinderName()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function LMGetFinderName: StringPtr; external name '_LMGetFinderName';

{
 *  LMSetFinderName()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure LMSetFinderName(const (*var*) finderNameValue: Str15); external name '_LMSetFinderName';

{
 *  LMGetToolScratch()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function LMGetToolScratch: Ptr; external name '_LMGetToolScratch';

{
 *  LMSetToolScratch()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure LMSetToolScratch(toolScratchValue: UnivPtr); external name '_LMSetToolScratch';

{
 *  LMGetLvl2DT()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function LMGetLvl2DT(vectorNumber: SInt16): UniversalProcPtr; external name '_LMGetLvl2DT';

{
 *  LMSetLvl2DT()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure LMSetLvl2DT(Lvl2DTValue: UniversalProcPtr; vectorNumber: SInt16); external name '_LMSetLvl2DT';


{*************************************************************************************
    "Missing Accessors"

        These lowmem accessors are not in the original InterfaceLib.  They were
        added to InterfaceLib in Mac OS 8.5.  In Universal Interfaces 3.2 they
        were defined via a macro. In you want to use these functions on a pre-8.5
        systems, you must write your own macros to override the function prototype
        or write your own implementation.

*************************************************************************************}



{
 *  LMGetHighHeapMark()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function LMGetHighHeapMark: Ptr; external name '_LMGetHighHeapMark';
{
 *  LMSetHighHeapMark()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure LMSetHighHeapMark(value: Ptr); external name '_LMSetHighHeapMark';
{  accesses "StkLowPt" }
{
 *  LMGetStackLowPoint()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function LMGetStackLowPoint: Ptr; external name '_LMGetStackLowPoint';
{
 *  LMSetStackLowPoint()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure LMSetStackLowPoint(value: Ptr); external name '_LMSetStackLowPoint';
{  accesses "ROMMapHndl" }

{
 *  LMGetDiskFormatingHFSDefaults()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function LMGetDiskFormatingHFSDefaults: Ptr; external name '_LMGetDiskFormatingHFSDefaults';
{
 *  LMSetDiskFormatingHFSDefaults()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 8.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure LMSetDiskFormatingHFSDefaults(value: Ptr); external name '_LMSetDiskFormatingHFSDefaults';
{  accesses "PortAUse" }

{$ALIGN MAC68K}
{#POP}
{unit MacHelp}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}

{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{ Help Manager constants, etc.                                                     }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}

const
    kMacHelpVersion             = $0003;


type
    HMContentRequest            = SInt16;
const
    kHMSupplyContent            = 0;
    kHMDisposeContent           = 1;


type
    HMContentType               = UInt32;
const
    kHMNoContent                = $6E6F6E65 (* 'none' *);
    kHMCFStringContent          = $63667374 (* 'cfst' *);                       {  CFStringRef }
    kHMPascalStrContent         = $70737472 (* 'pstr' *);
    kHMStringResContent         = $73747223 (* 'str#' *);
    kHMTEHandleContent          = $74787468 (* 'txth' *);                       {  NOT SUPPORTED ON MAC OS X }
    kHMTextResContent           = $74657874 (* 'text' *);                       {  NOT SUPPORTED ON MAC OS X }
    kHMStrResContent            = $73747220 (* 'str ' *);


    {
     *  HMTagDisplaySide
     *
     *  Discussion:
     *    Help tag display locations relative to absolute hot rect
        }

type
    HMTagDisplaySide            = SInt16;
const
    kHMDefaultSide              = 0;
    kHMOutsideTopScriptAligned  = 1;
    kHMOutsideLeftCenterAligned = 2;
    kHMOutsideBottomScriptAligned = 3;
    kHMOutsideRightCenterAligned = 4;
    kHMOutsideTopLeftAligned    = 5;
    kHMOutsideTopRightAligned   = 6;
    kHMOutsideLeftTopAligned    = 7;
    kHMOutsideLeftBottomAligned = 8;
    kHMOutsideBottomLeftAligned = 9;
    kHMOutsideBottomRightAligned = 10;
    kHMOutsideRightTopAligned   = 11;
    kHMOutsideRightBottomAligned = 12;
    kHMOutsideTopCenterAligned  = 13;
    kHMOutsideBottomCenterAligned = 14;
    kHMInsideRightCenterAligned = 15;
    kHMInsideLeftCenterAligned  = 16;
    kHMInsideBottomCenterAligned = 17;
    kHMInsideTopCenterAligned   = 18;
    kHMInsideTopLeftCorner      = 19;
    kHMInsideTopRightCorner     = 20;
    kHMInsideBottomLeftCorner   = 21;
    kHMInsideBottomRightCorner  = 22;
    kHMAbsoluteCenterAligned    = 23;

    {    Obsoleted constants HMTagDisplaySides, use the new ones, please    }
    kHMTopSide                  = 1;
    kHMLeftSide                 = 2;
    kHMBottomSide               = 3;
    kHMRightSide                = 4;
    kHMTopLeftCorner            = 5;
    kHMTopRightCorner           = 6;
    kHMLeftTopCorner            = 7;
    kHMLeftBottomCorner         = 8;
    kHMBottomLeftCorner         = 9;
    kHMBottomRightCorner        = 10;
    kHMRightTopCorner           = 11;
    kHMRightBottomCorner        = 12;


type
    HMContentProvidedType       = SInt16;
const
    kHMContentProvided          = 0;
    kHMContentNotProvided       = 1;
    kHMContentNotProvidedDontPropagate = 2;

    kHMMinimumContentIndex      = 0;                            {  first entry in HMHelpContentRec.content is the minimum content  }
    kHMMaximumContentIndex      = 1;                            {  second entry in HMHelpContentRec.content is the maximum content  }

    errHMIllegalContentForMinimumState = -10980;                {  unrecognized content type for minimum content  }
    errHMIllegalContentForMaximumState = -10981;                {  unrecognized content type for maximum content  }

    {  obsolete names; will be removed }
    kHMIllegalContentForMinimumState = -10980;

    kHelpTagEventHandlerTag     = $68657674 (* 'hevt' *);


type
    HMStringResType = RECORD
        hmmResID:               SInt16;
        hmmIndex:               SInt16;
    END;
    HMHelpContent = record
        contentType:            HMContentType;
        case SInt16 of
        0: (
            tagCFString:        CFStringRef;                            {  CFStringRef }
            );
        1: (
            tagString:          Str255;                                 {  Pascal String }
            );
        2: (
            tagStringRes:       HMStringResType;                        {  STR# resource ID and index }
            );
        3: (
            tagTEHandle:        TEHandle;                               {  TextEdit handle (NOT SUPPORTED ON MAC OS X) }
            );
        4: (
            tagTextRes:         SInt16;                                 {  TEXT/styl resource ID (NOT SUPPORTED ON MAC OS X) }
            );
        5: (
            tagStrRes:          SInt16;                                 {  STR resource ID }
            );
    end;

    HMHelpContentPtr = ^HMHelpContentRec;
    HMHelpContentRec = record
        version:                SInt32;
        absHotRect:             Rect;
        tagSide:                HMTagDisplaySide;
        content:                array [0..1] of HMHelpContent;
    end;

    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {    Callback procs                                         }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    HMControlContentProcPtr = function(inControl: ControlRef; inGlobalMouse: Point; inRequest: HMContentRequest; var outContentProvided: HMContentProvidedType; var ioHelpContent: HMHelpContentRec): OSStatus;

    HMWindowContentProcPtr = function(inWindow: WindowRef; inGlobalMouse: Point; inRequest: HMContentRequest; var outContentProvided: HMContentProvidedType; var ioHelpContent: HMHelpContentRec): OSStatus;

    HMMenuTitleContentProcPtr = function(inMenu: MenuRef; inRequest: HMContentRequest; var outContentProvided: HMContentProvidedType; var ioHelpContent: HMHelpContentRec): OSStatus;

    HMMenuItemContentProcPtr = function(const (*var*) inTrackingData: MenuTrackingData; inRequest: HMContentRequest; var outContentProvided: HMContentProvidedType; var ioHelpContent: HMHelpContentRec): OSStatus;

    HMControlContentUPP = ^SInt32; { an opaque UPP }
    HMWindowContentUPP = ^SInt32; { an opaque UPP }
    HMMenuTitleContentUPP = ^SInt32; { an opaque UPP }
    HMMenuItemContentUPP = ^SInt32; { an opaque UPP }

const
    uppHMControlContentProcInfo = $0000FBF0;
    uppHMWindowContentProcInfo = $0000FBF0;
    uppHMMenuTitleContentProcInfo = $00003EF0;
    uppHMMenuItemContentProcInfo = $00003EF0;
    {
     *  NewHMControlContentUPP()
     *
     *  Availability:
     *    Non-Carbon CFM:   available as macro/inline
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function NewHMControlContentUPP(userRoutine: HMControlContentProcPtr): HMControlContentUPP; external name '_NewHMControlContentUPP'; { old name was NewHMControlContentProc }
{
 *  NewHMWindowContentUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewHMWindowContentUPP(userRoutine: HMWindowContentProcPtr): HMWindowContentUPP; external name '_NewHMWindowContentUPP'; { old name was NewHMWindowContentProc }
{
 *  NewHMMenuTitleContentUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewHMMenuTitleContentUPP(userRoutine: HMMenuTitleContentProcPtr): HMMenuTitleContentUPP; external name '_NewHMMenuTitleContentUPP'; { old name was NewHMMenuTitleContentProc }
{
 *  NewHMMenuItemContentUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewHMMenuItemContentUPP(userRoutine: HMMenuItemContentProcPtr): HMMenuItemContentUPP; external name '_NewHMMenuItemContentUPP'; { old name was NewHMMenuItemContentProc }
{
 *  DisposeHMControlContentUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeHMControlContentUPP(userUPP: HMControlContentUPP); external name '_DisposeHMControlContentUPP';
{
 *  DisposeHMWindowContentUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeHMWindowContentUPP(userUPP: HMWindowContentUPP); external name '_DisposeHMWindowContentUPP';
{
 *  DisposeHMMenuTitleContentUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeHMMenuTitleContentUPP(userUPP: HMMenuTitleContentUPP); external name '_DisposeHMMenuTitleContentUPP';
{
 *  DisposeHMMenuItemContentUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeHMMenuItemContentUPP(userUPP: HMMenuItemContentUPP); external name '_DisposeHMMenuItemContentUPP';
{
 *  InvokeHMControlContentUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeHMControlContentUPP(inControl: ControlRef; inGlobalMouse: Point; inRequest: HMContentRequest; var outContentProvided: HMContentProvidedType; ioHelpContent: HMHelpContentPtr; userRoutine: HMControlContentUPP): OSStatus; external name '_InvokeHMControlContentUPP'; { old name was CallHMControlContentProc }
{
 *  InvokeHMWindowContentUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeHMWindowContentUPP(inWindow: WindowRef; inGlobalMouse: Point; inRequest: HMContentRequest; var outContentProvided: HMContentProvidedType; ioHelpContent: HMHelpContentPtr; userRoutine: HMWindowContentUPP): OSStatus; external name '_InvokeHMWindowContentUPP'; { old name was CallHMWindowContentProc }
{
 *  InvokeHMMenuTitleContentUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeHMMenuTitleContentUPP(inMenu: MenuRef; inRequest: HMContentRequest; var outContentProvided: HMContentProvidedType; ioHelpContent: HMHelpContentPtr; userRoutine: HMMenuTitleContentUPP): OSStatus; external name '_InvokeHMMenuTitleContentUPP'; { old name was CallHMMenuTitleContentProc }
{
 *  InvokeHMMenuItemContentUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeHMMenuItemContentUPP(const (*var*) inTrackingData: MenuTrackingData; inRequest: HMContentRequest; var outContentProvided: HMContentProvidedType; ioHelpContent: HMHelpContentPtr; userRoutine: HMMenuItemContentUPP): OSStatus; external name '_InvokeHMMenuItemContentUPP'; { old name was CallHMMenuItemContentProc }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{ API                                                                                      }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{ Help Menu }
{
 *  HMGetHelpMenu()
 *
 *  Summary:
 *    Returns a menu to which applications may add their own help items.
 *
 *  Parameters:
 *
 *    outHelpMenu:
 *      On exit, contains the help menu.
 *
 *    outFirstCustomItemIndex:
 *      On exit, contains the menu item index that will be used by the
 *      first item added by the application. This parameter may be NULL.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function HMGetHelpMenu(var outHelpMenu: MenuRef; outFirstCustomItemIndex: MenuItemIndexPtr): OSStatus; external name '_HMGetHelpMenu';

{ Installing/Retrieving Content }
{ Menu title and item help tags are not yet supported by Carbon or CarbonLib. }
{ They will be fully supported in a future release. }
{
 *  HMSetControlHelpContent()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function HMSetControlHelpContent(inControl: ControlRef; const (*var*) inContent: HMHelpContentRec): OSStatus; external name '_HMSetControlHelpContent';

{
 *  HMGetControlHelpContent()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function HMGetControlHelpContent(inControl: ControlRef; var outContent: HMHelpContentRec): OSStatus; external name '_HMGetControlHelpContent';

{
 *  HMSetWindowHelpContent()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function HMSetWindowHelpContent(inWindow: WindowRef; const (*var*) inContent: HMHelpContentRec): OSStatus; external name '_HMSetWindowHelpContent';

{
 *  HMGetWindowHelpContent()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function HMGetWindowHelpContent(inWindow: WindowRef; var outContent: HMHelpContentRec): OSStatus; external name '_HMGetWindowHelpContent';

{
 *  HMSetMenuItemHelpContent()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function HMSetMenuItemHelpContent(inMenu: MenuRef; inItem: MenuItemIndex; const (*var*) inContent: HMHelpContentRec): OSStatus; external name '_HMSetMenuItemHelpContent';

{
 *  HMGetMenuItemHelpContent()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function HMGetMenuItemHelpContent(inMenu: MenuRef; inItem: MenuItemIndex; var outContent: HMHelpContentRec): OSStatus; external name '_HMGetMenuItemHelpContent';

{ Installing/Retrieving Content Callbacks }
{
 *  HMInstallControlContentCallback()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function HMInstallControlContentCallback(inControl: ControlRef; inContentUPP: HMControlContentUPP): OSStatus; external name '_HMInstallControlContentCallback';

{
 *  HMInstallWindowContentCallback()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function HMInstallWindowContentCallback(inWindow: WindowRef; inContentUPP: HMWindowContentUPP): OSStatus; external name '_HMInstallWindowContentCallback';

{
 *  HMInstallMenuTitleContentCallback()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function HMInstallMenuTitleContentCallback(inMenu: MenuRef; inContentUPP: HMMenuTitleContentUPP): OSStatus; external name '_HMInstallMenuTitleContentCallback';

{
 *  HMInstallMenuItemContentCallback()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function HMInstallMenuItemContentCallback(inMenu: MenuRef; inContentUPP: HMMenuItemContentUPP): OSStatus; external name '_HMInstallMenuItemContentCallback';

{
 *  HMGetControlContentCallback()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function HMGetControlContentCallback(inControl: ControlRef; var outContentUPP: HMControlContentUPP): OSStatus; external name '_HMGetControlContentCallback';

{
 *  HMGetWindowContentCallback()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function HMGetWindowContentCallback(inWindow: WindowRef; var outContentUPP: HMWindowContentUPP): OSStatus; external name '_HMGetWindowContentCallback';

{
 *  HMGetMenuTitleContentCallback()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function HMGetMenuTitleContentCallback(inMenu: MenuRef; var outContentUPP: HMMenuTitleContentUPP): OSStatus; external name '_HMGetMenuTitleContentCallback';

{
 *  HMGetMenuItemContentCallback()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function HMGetMenuItemContentCallback(inMenu: MenuRef; var outContentUPP: HMMenuItemContentUPP): OSStatus; external name '_HMGetMenuItemContentCallback';

{ Enabling and Disabling Help Tags }
{
 *  HMAreHelpTagsDisplayed()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function HMAreHelpTagsDisplayed: boolean; external name '_HMAreHelpTagsDisplayed';

{
 *  HMSetHelpTagsDisplayed()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function HMSetHelpTagsDisplayed(inDisplayTags: boolean): OSStatus; external name '_HMSetHelpTagsDisplayed';

{
 *  HMSetTagDelay()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function HMSetTagDelay(inDelay: Duration): OSStatus; external name '_HMSetTagDelay';

{
 *  HMGetTagDelay()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function HMGetTagDelay(var outDelay: Duration): OSStatus; external name '_HMGetTagDelay';

{ Compatibility }
{
 *  HMSetMenuHelpFromBalloonRsrc()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function HMSetMenuHelpFromBalloonRsrc(inMenu: MenuRef; inHmnuRsrcID: SInt16): OSStatus; external name '_HMSetMenuHelpFromBalloonRsrc';

{
 *  HMSetDialogHelpFromBalloonRsrc()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function HMSetDialogHelpFromBalloonRsrc(inDialog: DialogRef; inHdlgRsrcID: SInt16; inItemStart: SInt16): OSStatus; external name '_HMSetDialogHelpFromBalloonRsrc';

{ Displaying tags }
{
 *  HMDisplayTag()
 *
 *  Summary:
 *    Displays a help tag at a user defined location.
 *
 *  Parameters:
 *
 *    inContent:
 *      HMHelpContentRec describing the help tag to be displayed.
 *
 *  Result:
 *    An OSStatus code indicating success or failure.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
function HMDisplayTag(const (*var*) inContent: HMHelpContentRec): OSStatus; external name '_HMDisplayTag';

{
 *  HMHideTag()
 *
 *  Summary:
 *    HMHideTag hides the currently visible help tag.  If there is no
 *    current help tag, this call does nothing.
 *
 *  Result:
 *    An OSStatus code indicating success or failure.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.2 and later
 *    Mac OS X:         in version 10.1 and later
 }
function HMHideTag: OSStatus; external name '_HMHideTag';

{$ALIGN MAC68K}
{#POP}
{unit MacTextEditor}
{$ALIGN MAC68K}










{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}




type
    TXNObject    = ^SInt32; { an opaque 32-bit type }
    TXNObjectPtr = ^TXNObject;  { when a var xx:TXNObject parameter can be nil, it is changed to xx: TXNObjectPtr }
    TXNFontMenuObject    = ^SInt32; { an opaque 32-bit type }
    TXNFontMenuObjectPtr = ^TXNFontMenuObject;  { when a var xx:TXNFontMenuObject parameter can be nil, it is changed to xx: TXNFontMenuObjectPtr }
    TXNFrameID                          = UInt32;
    TXNVersionValue                     = UInt32;

const
    kTXNWillDefaultToATSUIBit   = 0;
    kTXNWillDefaultToCarbonEventBit = 1;



type
    TXNFeatureBits              = UInt32;
const
    kTXNWillDefaultToATSUIMask  = $00000001;
    kTXNWillDefaultToCarbonEventMask = $00000002;

    kTXNWantMoviesBit           = 0;
    kTXNWantSoundBit            = 1;
    kTXNWantGraphicsBit         = 2;
    kTXNAlwaysUseQuickDrawTextBit = 3;
    kTXNUseTemporaryMemoryBit   = 4;



type
    TXNInitOptions              = UInt32;
const
    kTXNWantMoviesMask          = $00000001;
    kTXNWantSoundMask           = $00000002;
    kTXNWantGraphicsMask        = $00000004;
    kTXNAlwaysUseQuickDrawTextMask = $00000008;
    kTXNUseTemporaryMemoryMask  = $00000010;

    kTXNDrawGrowIconBit         = 0;
    kTXNShowWindowBit           = 1;
    kTXNWantHScrollBarBit       = 2;
    kTXNWantVScrollBarBit       = 3;
    kTXNNoTSMEverBit            = 4;
    kTXNReadOnlyBit             = 5;
    kTXNNoKeyboardSyncBit       = 6;
    kTXNNoSelectionBit          = 7;
    kTXNSaveStylesAsSTYLResourceBit = 8;
    kOutputTextInUnicodeEncodingBit = 9;
    kTXNDoNotInstallDragProcsBit = 10;
    kTXNAlwaysWrapAtViewEdgeBit = 11;
    kTXNDontDrawCaretWhenInactiveBit = 12;
    kTXNDontDrawSelectionWhenInactiveBit = 13;
    kTXNSingleLineOnlyBit       = 14;
    kTXNDisableDragAndDropBit   = 15;
    kTXNUseQDforImagingBit      = 16;



    {
     *  TXNFrameOptions
     *
     *  Summary:
     *    Defines the initial behavior of an MLTE object created with
     *    TXNNewObject.
     *
     *  Discussion:
     *    These masks can be combined and passed to TXNNewObject to define
     *    the initial behavior of a new object.
        }

type
    TXNFrameOptions             = UInt32;
const
    kTXNDrawGrowIconMask        = $00000001;
    kTXNShowWindowMask          = $00000002;
    kTXNWantHScrollBarMask      = $00000004;
    kTXNWantVScrollBarMask      = $00000008;
    kTXNNoTSMEverMask           = $00000010;
    kTXNReadOnlyMask            = $00000020;
    kTXNNoKeyboardSyncMask      = $00000040;
    kTXNNoSelectionMask         = $00000080;
    kTXNSaveStylesAsSTYLResourceMask = $00000100;
    kOutputTextInUnicodeEncodingMask = $00000200;
    kTXNDoNotInstallDragProcsMask = $00000400;
    kTXNAlwaysWrapAtViewEdgeMask = $00000800;
    kTXNDontDrawCaretWhenInactiveMask = $00001000;
    kTXNDontDrawSelectionWhenInactiveMask = $00002000;
    kTXNSingleLineOnlyMask      = $00004000;
    kTXNDisableDragAndDropMask  = $00008000;
    kTXNUseQDforImagingMask     = $00010000;
    kTXNMonostyledTextMask      = $00020000;

    kTXNSetFlushnessBit         = 0;
    kTXNSetJustificationBit     = 1;
    kTXNUseFontFallBackBit      = 2;
    kTXNRotateTextBit           = 3;
    kTXNUseVerticalTextBit      = 4;
    kTXNDontUpdateBoxRectBit    = 5;
    kTXNDontDrawTextBit         = 6;
    kTXNUseCGContextRefBit      = 7;
    kTXNImageWithQDBit          = 8;
    kTXNDontWrapTextBit         = 9;


    {
     *  TXNTextBoxOptions
     *
     *  Summary:
     *    Defines how text will be drawn by one of the TXNxxxDrawTextBox
     *    API.
     *
     *  Discussion:
     *    These masks can be combined and added to a TXNTextBoxOptionsData
     *    structure to be passed to a TXNxxxDrawTextBox API.
        }

type
    TXNTextBoxOptions           = UInt32;
const
    kTXNSetFlushnessMask        = $00000001;
    kTXNSetJustificationMask    = $00000002;
    kTXNUseFontFallBackMask     = $00000004;
    kTXNRotateTextMask          = $00000008;
    kTXNUseVerticalTextMask     = $00000010;
    kTXNDontUpdateBoxRectMask   = $00000020;
    kTXNDontDrawTextMask        = $00000040;
    kTXNUseCGContextRefMask     = $00000080;
    kTXNImageWithQDMask         = $00000100;
    kTXNDontWrapTextMask        = $00000200;


type
    TXNTextBoxOptionsDataPtr = ^TXNTextBoxOptionsData;
    TXNTextBoxOptionsData = record
        optionTags:             TXNTextBoxOptions;
        flushness:              Fract;
        justification:          Fract;
        rotation:               Fixed;
        options:                Ptr;                                    {  for future use }
    end;


const
    kTXNFontContinuousBit       = 0;
    kTXNSizeContinuousBit       = 1;
    kTXNStyleContinuousBit      = 2;
    kTXNColorContinuousBit      = 3;


type
    TXNContinuousFlags          = UInt32;
const
    kTXNFontContinuousMask      = $00000001;
    kTXNSizeContinuousMask      = $00000002;
    kTXNStyleContinuousMask     = $00000004;
    kTXNColorContinuousMask     = $00000008;

    kTXNIgnoreCaseBit           = 0;
    kTXNEntireWordBit           = 1;
    kTXNUseEncodingWordRulesBit = 31;


type
    TXNMatchOptions             = UInt32;
const
    kTXNIgnoreCaseMask          = $00000001;
    kTXNEntireWordMask          = $00000002;
    kTXNUseEncodingWordRulesMask = $80000000;



type
    TXNFileType                 = UInt32;
const
    kTXNTextensionFile          = $7478746E (* 'txtn' *);
    kTXNTextFile                = $54455854 (* 'TEXT' *);
    kTXNPictureFile             = $50494354 (* 'PICT' *);
    kTXNMovieFile               = $4D6F6F56 (* 'MooV' *);
    kTXNSoundFile               = $7366696C (* 'sfil' *);
    kTXNAIFFFile                = $41494646 (* 'AIFF' *);
    kTXNUnicodeTextFile         = $75747874 (* 'utxt' *);

    { In MLTE version 1.1 and earlier, only kTXNTextEditStyleFrameType is supported.  }

type
    TXNFrameType                = UInt32;
const
    kTXNTextEditStyleFrameType  = 1;
    kTXNPageFrameType           = 2;
    kTXNMultipleFrameType       = 3;



type
    TXNDataType                 = UInt32;
    TXNDataTypePtr              = ^TXNDataType; { when a VAR xx: TXNDataType parameter can be nil, it is changed to xx: TXNDataTypePtr }
const
    kTXNTextData                = $54455854 (* 'TEXT' *);
    kTXNPictureData             = $50494354 (* 'PICT' *);
    kTXNMovieData               = $6D6F6F76 (* 'moov' *);
    kTXNSoundData               = $736E6420 (* 'snd ' *);
    kTXNUnicodeTextData         = $75747874 (* 'utxt' *);



type
    TXNControlTag               = UInt32;
    TXNControlTagPtr            = ^TXNControlTag; { when a VAR xx: TXNControlTag parameter can be nil, it is changed to xx: TXNControlTagPtr }
const
    kTXNLineDirectionTag        = $6C6E6472 (* 'lndr' *);
    kTXNJustificationTag        = $6A757374 (* 'just' *);
    kTXNIOPrivilegesTag         = $696F7076 (* 'iopv' *);
    kTXNSelectionStateTag       = $736C7374 (* 'slst' *);
    kTXNInlineStateTag          = $696E7374 (* 'inst' *);
    kTXNWordWrapStateTag        = $77777273 (* 'wwrs' *);
    kTXNKeyboardSyncStateTag    = $6B627379 (* 'kbsy' *);
    kTXNAutoIndentStateTag      = $6175696E (* 'auin' *);
    kTXNTabSettingsTag          = $74616273 (* 'tabs' *);
    kTXNRefConTag               = $7266636E (* 'rfcn' *);
    kTXNMarginsTag              = $6D617267 (* 'marg' *);
    kTXNFlattenMoviesTag        = $666C6174 (* 'flat' *);
    kTXNDoFontSubstitution      = $66537562 (* 'fSub' *);                       { note : this could degrade performance greatly in the case of large documents. }
    kTXNNoUserIOTag             = $6E75696F (* 'nuio' *);
    kTXNUseCarbonEvents         = $63626362 (* 'cbcb' *);
    kTXNDrawCaretWhenInactiveTag = $64637274 (* 'dcrt' *);
    kTXNDrawSelectionWhenInactiveTag = $64736C6E (* 'dsln' *);
    kTXNDisableDragAndDropTag   = $64726167 (* 'drag' *);


type
    TXNActionKey                = UInt32;
    TXNActionKeyPtr             = ^TXNActionKey; { when a VAR xx: TXNActionKey parameter can be nil, it is changed to xx: TXNActionKeyPtr }
const
    kTXNTypingAction            = 0;
    kTXNCutAction               = 1;
    kTXNPasteAction             = 2;
    kTXNClearAction             = 3;
    kTXNChangeFontAction        = 4;
    kTXNChangeFontColorAction   = 5;
    kTXNChangeFontSizeAction    = 6;
    kTXNChangeStyleAction       = 7;
    kTXNAlignLeftAction         = 8;
    kTXNAlignCenterAction       = 9;
    kTXNAlignRightAction        = 10;
    kTXNDropAction              = 11;
    kTXNMoveAction              = 12;
    kTXNFontFeatureAction       = 13;
    kTXNFontVariationAction     = 14;
    kTXNUndoLastAction          = 1024;                         { use if none of the above apply }

    kTXNClearThisControl        = $FFFFFFFF;
    kTXNClearTheseFontFeatures  = $80000000;

    {
      convenience constants for TXNGet/SetTXNControls
       kTXNIOPrivilegesTag
    }
    kTXNReadWrite               = false;
    kTXNReadOnly                = true;

    {  kTXNSelectionStateTag }
    kTXNSelectionOn             = true;
    kTXNSelectionOff            = false;

    {  kTXNInlineStateTag }
    kTXNUseInline               = false;
    kTXNUseBottomline           = true;


    {  kTXNWordWrapStateTag }
    kTXNAutoWrap                = false;
    kTXNNoAutoWrap              = true;

    {  kTXNKeyboardSyncStateTag }
    kTXNSyncKeyboard            = false;
    kTXNNoSyncKeyboard          = true;

    {  kTXNAutoIndentStateTag }
    kTXNAutoIndentOff           = false;
    kTXNAutoIndentOn            = true;

    {  kTXNDrawCaretWhenInactiveTag }
    kTXNDontDrawCaretWhenInactive = false;
    kTXNDrawCaretWhenInactive   = true;

    {  kTXNDrawSelectionWhenInactiveTag }
    kTXNDontDrawSelectionWhenInactive = false;
    kTXNDrawSelectionWhenInactive = true;

    {  kTXNDisableDragAndDropTag }
    kTXNEnableDragAndDrop       = false;
    kTXNDisableDragAndDrop      = true;


type
    TXNTabType                  = SInt8;
const
    kTXNRightTab                = -1;
    kTXNLeftTab                 = 0;
    kTXNCenterTab               = 1;


type
    TXNTabPtr = ^TXNTab;
    TXNTab = record
        value:                  SInt16;
        tabType:                SInt8;
        filler:                 SInt8;
    end;


const
    kTXNLeftToRight             = 0;
    kTXNRightToLeft             = 1;

    kTXNFlushDefault            = 0;                            { flush according to the line direction  }
    kTXNFlushLeft               = 1;
    kTXNFlushRight              = 2;
    kTXNCenter                  = 4;
    kTXNFullJust                = 8;
    kTXNForceFullJust           = 16;                           { flush left for all scripts  }

    {
      note in version 1 of Textension. The bottomMargin and
      rightMargin fields are placeholders.  In version 1 you
      can only change the top and left edge margins.  The other
      values are placeholders for possible future enhancements
    }

type
    TXNMarginsPtr = ^TXNMargins;
    TXNMargins = record
        topMargin:              SInt16;
        leftMargin:             SInt16;
        bottomMargin:           SInt16;
        rightMargin:            SInt16;
    end;

    TXNControlDataPtr = ^TXNControlData;
    TXNControlData = record
        case SInt16 of
        0: (
            uValue:             UInt32;
            );
        1: (
            sValue:             SInt32;
            );
        2: (
            tabValue:           TXNTab;
            );
        3: (
            marginsPtr:         TXNMarginsPtr;
            );
    end;

    TXNScrollBarState           = UInt8;
const
    kScrollBarsAlwaysActive     = true;
    kScrollBarsSyncWithFocus    = false;

    {
      kTXNNoFontVariations is returned in the dataValue field when the caller as asked
      to see if the variation is continuous and there was no variation in the continuous range
    }
    kTXNDontCareTypeSize        = $FFFFFFFF;
    kTXNDontCareTypeStyle       = $FF;
    kTXNIncrementTypeSize       = $00000001;
    kTXNDecrementTypeSize       = $80000000;
    kTXNUseScriptDefaultValue   = -1;
    kTXNNoFontVariations        = $7FFF;


type
    TXNOffset                   = UInt32;
    TXNOffsetPtr                = ^TXNOffset; { when a VAR xx: TXNOffset parameter can be nil, it is changed to xx: TXNOffsetPtr }
const
    kTXNUseCurrentSelection     = $FFFFFFFF;
    kTXNStartOffset             = 0;
    kTXNEndOffset               = $7FFFFFFF;



    kTXNSingleStylePerTextDocumentResType = $4D505352 (* 'MPSR' *);
    kTXNMultipleStylesPerTextDocumentResType = $7374796C (* 'styl' *);


type
    TXNObjectRefcon                     = Ptr;
    { constants for TXNShowSelection }

const
    kTXNShowStart               = false;
    kTXNShowEnd                 = true;


type
    TXNErrors                           = OSStatus;
    {  default constants for TXNMacOSPreferredFontDescription  }

const
    kTXNDefaultFontName         = 0;                            {  really a fontID not a name }

    kTXNDefaultFontSize         = $000C0000;

    kTXNDefaultFontStyle        = 0;





type
    TXNTypeRunAttributes        = UInt32;
const
    kTXNQDFontNameAttribute     = $666E746E (* 'fntn' *);
    kTXNQDFontFamilyIDAttribute = $666F6E74 (* 'font' *);
    kTXNQDFontSizeAttribute     = $73697A65 (* 'size' *);
    kTXNQDFontStyleAttribute    = $66616365 (* 'face' *);
    kTXNQDFontColorAttribute    = $6B6C6F72 (* 'klor' *);
    kTXNTextEncodingAttribute   = $656E6364 (* 'encd' *);
    kTXNATSUIFontFeaturesAttribute = $61746665 (* 'atfe' *);
    kTXNATSUIFontVariationsAttribute = $61747661 (* 'atva' *);

    {
      kTXNQDFontSizeAttributeSize is obsolete and incorrect
      font sizes are always returned as a Fixed value, just as
      they are passed to MLTE.  Use kTXNFontSizeAttributeSize.
    }

type
    TXNTypeRunAttributeSizes    = UInt32;
const
    kTXNQDFontNameAttributeSize = 256;
    kTXNQDFontFamilyIDAttributeSize = 2;
    kTXNQDFontSizeAttributeSize = 2;
    kTXNQDFontStyleAttributeSize = 1;
    kTXNQDFontColorAttributeSize = 6;
    kTXNTextEncodingAttributeSize = 4;
    kTXNFontSizeAttributeSize   = 4;


type
    TXNPermanentTextEncodingType  = UInt32;
const
    kTXNSystemDefaultEncoding   = 0;
    kTXNMacOSEncoding           = 1;
    kTXNUnicodeEncoding         = 2;




type
    TXTNTag                             = FourCharCode;
    TXNATSUIFeaturesPtr = ^TXNATSUIFeatures;
    TXNATSUIFeatures = record
        featureCount:           ItemCount;
        featureTypes:           ATSUFontFeatureTypePtr;
        featureSelectors:       ATSUFontFeatureSelectorPtr;
    end;

    TXNATSUIVariationsPtr = ^TXNATSUIVariations;
    TXNATSUIVariations = record
        variationCount:         ItemCount;
        variationAxis:          ATSUFontVariationAxisPtr;
        variationValues:        ATSUFontVariationValuePtr;
    end;

    TXNAttributeDataPtr = ^TXNAttributeData;
    TXNAttributeData = record
        case SInt16 of
        0: (
            dataPtr:            Ptr;
            );
        1: (
            dataValue:          UInt32;
            );
        2: (
            atsuFeatures:       TXNATSUIFeaturesPtr;
            );
        3: (
            atsuVariations:     TXNATSUIVariationsPtr;
            );
    end;

    TXNTypeAttributesPtr = ^TXNTypeAttributes;
    TXNTypeAttributes = record
        tag:                    TXTNTag;
        size:                   ByteCount;
        data:                   TXNAttributeData;
    end;

    TXNMacOSPreferredFontDescriptionPtr = ^TXNMacOSPreferredFontDescription;
    TXNMacOSPreferredFontDescription = record
        fontID:                 UInt32;
        pointSize:              Fixed;
        encoding:               TextEncoding;
        fontStyle:              SInt8;
    end;

    TXNMatchTextRecordPtr = ^TXNMatchTextRecord;
    TXNMatchTextRecord = record
        iTextPtr:               Ptr;
        iTextToMatchLength:     SInt32;
        iTextEncoding:          TextEncoding;
    end;

    { constants & typedefs for setting the background }
    TXNBackgroundType           = UInt32;
const
    kTXNBackgroundTypeRGB       = 1;

    {
       The TXNBackgroundData is left as a union so that it can be expanded
       in the future to support other background types
    }

type
    TXNBackgroundDataPtr = ^TXNBackgroundData;
    TXNBackgroundData = record
        case SInt16 of
        0: (
            color:              RGBColor;
            );
    end;

    TXNBackgroundPtr = ^TXNBackground;
    TXNBackground = record
        bgType:                 TXNBackgroundType;
        bg:                     TXNBackgroundData;
    end;

    TXNLongRectPtr = ^TXNLongRect;
    TXNLongRect = record
        top:                    SInt32;
        left:                   SInt32;
        bottom:                 SInt32;
        right:                  SInt32;
    end;

    {
      options for TXNGet/ClearActionChangeCount to decide what type(s) of action
      count to use
    }

const
    kTXNTextInputCountBit       = 0;
    kTXNRunCountBit             = 1;


type
    TXNCountOptions             = UInt32;
const
    kTXNTextInputCountMask      = $00000001;
    kTXNRunCountMask            = $00000002;
    kTXNAllCountMask            = $00000003;





type
    TXNFindProcPtr = function(const (*var*) matchData: TXNMatchTextRecord; iDataType: TXNDataType; iMatchOptions: TXNMatchOptions; iSearchTextPtr: UnivPtr; encoding: TextEncoding; absStartOffset: TXNOffset; searchTextLength: ByteCount; var oStartMatch: TXNOffset; var oEndMatch: TXNOffset; var ofound: boolean; refCon: UInt32): OSStatus;

    TXNActionKeyMapperProcPtr = function(actionKey: TXNActionKey; commandID: UInt32): CFStringRef;

    TXNFindUPP = ^SInt32; { an opaque UPP }
    TXNActionKeyMapperUPP = ^SInt32; { an opaque UPP }

const
    uppTXNFindProcInfo = $0FFFFFF0;
    uppTXNActionKeyMapperProcInfo = $000003F0;
    {
     *  NewTXNFindUPP()
     *
     *  Availability:
     *    Non-Carbon CFM:   available as macro/inline
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function NewTXNFindUPP(userRoutine: TXNFindProcPtr): TXNFindUPP; external name '_NewTXNFindUPP'; { old name was NewTXNFindProc }
{
 *  NewTXNActionKeyMapperUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewTXNActionKeyMapperUPP(userRoutine: TXNActionKeyMapperProcPtr): TXNActionKeyMapperUPP; external name '_NewTXNActionKeyMapperUPP'; { old name was NewTXNActionKeyMapperProc }
{
 *  DisposeTXNFindUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeTXNFindUPP(userUPP: TXNFindUPP); external name '_DisposeTXNFindUPP';
{
 *  DisposeTXNActionKeyMapperUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeTXNActionKeyMapperUPP(userUPP: TXNActionKeyMapperUPP); external name '_DisposeTXNActionKeyMapperUPP';
{
 *  InvokeTXNFindUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeTXNFindUPP(const (*var*) matchData: TXNMatchTextRecord; iDataType: TXNDataType; iMatchOptions: TXNMatchOptions; iSearchTextPtr: UnivPtr; encoding: TextEncoding; absStartOffset: TXNOffset; searchTextLength: ByteCount; var oStartMatch: TXNOffset; var oEndMatch: TXNOffset; var ofound: boolean; refCon: UInt32; userRoutine: TXNFindUPP): OSStatus; external name '_InvokeTXNFindUPP'; { old name was CallTXNFindProc }
{
 *  InvokeTXNActionKeyMapperUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeTXNActionKeyMapperUPP(actionKey: TXNActionKey; commandID: UInt32; userRoutine: TXNActionKeyMapperUPP): CFStringRef; external name '_InvokeTXNActionKeyMapperUPP'; { old name was CallTXNActionKeyMapperProc }
{
  These are currently the only settings for the flags field of TXNCarbonEventInfo
  If you want the AppleEventHandlers removed use kTXNNoAppleEventHandlersMask.
  If you want to subsequently restart AppleEvent Handlers after removing
  your Texthandlers. Use kTXNRestartAppleEventHandlersMask.
}


const
    kTXNNoAppleEventHandlersBit = 0;
    kTXNRestartAppleEventHandlersBit = 1;

    kTXNNoAppleEventHandlersMask = $01;
    kTXNRestartAppleEventHandlersMask = $02;

    { dictionary keys currently supported in the TXNCarbonEventInfo dictionary }

    {  use this to pass an EventTargetRef to MLTE via the TXNSetTXNControl... call }

type
    TXNCarbonEventInfoPtr = ^TXNCarbonEventInfo;
    TXNCarbonEventInfo = record
        useCarbonEvents:        boolean;
        filler:                 SInt8;
        flags:                  UInt16;
        fDictionary:            CFDictionaryRef;
    end;


    {
      *****************************************************************************************************
       Allocates a new frame (i.e. new is called to allocate a TXNObject) and returns a pointer to the object
       in the newDoc parameter.
       Input:

        iFileSpec:  If not NULL the file is read to obtain the document contents  after the object is
                    successfully allocated.  If NULL you start with an empty document.

        iWindow:        Required.  The window in which the document is going to be  displayed.

        iFrame:     If text-area does not fill the entire window.  This specifies the area to fill.  Can be NULL.
                    In  which case, the windowÕs portRect is used as the frame.

        iFrameOptions:  Specify the options to be supported by this frame.  The available options are support
                        for cutting and pasting  movies and sound, handle scrollbars and handle grow box in  the
                        frame.
        iFrameType:     Specify the type of frame to be used.  In MLTE version 1.1 and earlier, only
                        kTXNTextEditStyleFrameType is supported.

        iFileType:  Specify the primary file type.  If you  use  kTextensionTextFile files will be saved
                    in a private format (see xxx).  If you  want saved files to be plain text files you should
                    specify 'TEXT' here. If you specify 'TEXT' here you can use the frameOptions parameter to
                    specify  whether the TEXT files should be saved  with 'MPSR' resources or 'styl' resources.
                    These are resources which contain style information for a  file, and they  both have there
                    own limitations.  If you use 'styl' resources to save style info your documents can have as
                    many styles as you like however tabs will not be saved.  If you use 'MPSR' resources only the
                    first style in the document  will be saved (you as client are expected to apply all style
                    changes to the entire document).  If you  truly want  rich documents which can potentially
                    contain graphics and sound you should specify kTextensionTextFileOutput.  If you want a plain
                    text editor like SimpleText specify that style information by saved via ÔstylÕ resources.
                    If you want files similar to those output by CW IDE, BBEdit, and MPW specify that style
                    information be saved in a ÔMPSRÕ resource.

       Output:

        OSStatus:   function  result.  If anything goes wrong the error is returned.  Success must be complete.
                    That is if everything  works, but there is a failure reading a specified file the  object
                    is freed.
        oTXNObject:     Pointer to the opaque datastructure allocated by the function.  Most of the subsequent
                        functions require that such a pointer be passed in.

        oTXNFrameID:    Unique ID for the frame. <Note in version 1.0 this value is always set to 0>
        iRefCon:        Caller can set this to any value.  It is retained by the
                        TXNNewObject which can later be asked to return it.
      **************************************************************************************************************
    }
    {
     *  TXNNewObject()
     *
     *  Availability:
     *    Non-Carbon CFM:   in Textension 1.0 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function TXNNewObject(iFileSpec: {Const}FSSpecPtr; iWindow: WindowRef; iFrame: {Const}RectPtr; iFrameOptions: TXNFrameOptions; iFrameType: TXNFrameType; iFileType: TXNFileType; iPermanentEncoding: TXNPermanentTextEncodingType; var oTXNObject: TXNObject; var oTXNFrameID: TXNFrameID; iRefCon: TXNObjectRefcon): OSStatus; external name '_TXNNewObject';


{
  *************************************************************************************************
   Delete a previously allocated TXNObject and all associated data structures.  If the frameType is
   multiple frames all frames are released.

   Input:
    iTXNObject: opaque structure to free.
  **************************************************************************************************
}
{
 *  TXNDeleteObject()
 *
 *  Availability:
 *    Non-Carbon CFM:   in Textension 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure TXNDeleteObject(iTXNObject: TXNObject); external name '_TXNDeleteObject';


{
  *************************************************************************************************
   Changes the frame's size to match the new width and height.
   Input:

    iTXNObject:     opaque Textension structure.

    iWidth:         New width in pixels.

    iHeight:        New height in pixels.

    iTXNFrameID:    FrameID that specifies the frame to move.
  *************************************************************************************************
}
{
 *  TXNResizeFrame()
 *
 *  Availability:
 *    Non-Carbon CFM:   in Textension 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure TXNResizeFrame(iTXNObject: TXNObject; iWidth: UInt32; iHeight: UInt32; iTXNFrameID: TXNFrameID); external name '_TXNResizeFrame';


{
  *************************************************************************************************
   Changes the frame's bounds to match the Rect.
   Input:
        iTXNObject :                                opaque Textension structure.

        (iTop, iLeft, iBottom, iRight):     Rect of the view


    iTXNFrameID:        FrameID that specifies the frame to move.
  *************************************************************************************************
}
{
 *  TXNSetFrameBounds()
 *
 *  Availability:
 *    Non-Carbon CFM:   in Textension 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure TXNSetFrameBounds(iTXNObject: TXNObject; iTop: SInt32; iLeft: SInt32; iBottom: SInt32; iRight: SInt32; iTXNFrameID: TXNFrameID); external name '_TXNSetFrameBounds';


{
  ****************************************************************************************************
    Initialize the Textension library.  Should be called as soon as possible after the Macintosh toolbox
    is initialized.
   Input:
    iDefaultFonts:      A table of font information including fontFamily ID, point size,
                        style, and script code. The table can be NULL or can have
                        an entry for any script for which you would like to to
                        designate a default font.  Only a valid script number is
                        required.  You can designate that Textension should use
                        the default for a give script by setting the field to kTXNUseScriptDefaultValue (-1).

   For example, if you wanted to specify New York as the default
   font to use for Roman scripts, but were happy with the
   default style and size you would call the function like this:

    TXNMacOSPreferredFontDescription    defaults;
    GetFNum( "\pNew York", &defaults.fontID );
    defaults.pointSize = kTXNDefaultFontSize;
    defaults.fontStyle = kTXNDefaultFontStyle;
    defaults.script = smRoman;
    status = TXNInitTextension( &defaults, 1, 0 );
    iCountDefaultFonts: Count of entries in the iDefaultFonts parameter.



    iUsageFlags:        Specify whether sound and movies should be supported.
   Output:
    OSStatus:       Function result.  NoErr if everything initialized correctly.  Variety of
                    possible MacOS errors if something goes wrong.
  *********************************************************************************************/
}
{
 *  TXNInitTextension()
 *
 *  Availability:
 *    Non-Carbon CFM:   in Textension 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TXNInitTextension(iDefaultFonts: TXNMacOSPreferredFontDescriptionPtr; iCountDefaultFonts: ItemCount; iUsageFlags: TXNInitOptions): OSStatus; external name '_TXNInitTextension';


{
  *************************************************************************************
   Close the Textension library.  It is necessary to call this function so that Textension
   can correctly close down any TSM connections and do other clean up.
  **************************************************************************************
}
{
 *  TXNTerminateTextension()
 *
 *  Availability:
 *    Non-Carbon CFM:   in Textension 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure TXNTerminateTextension; external name '_TXNTerminateTextension';

{
  **************************************************************************************
    Process a keydown event. Note that if CJK script is installed and current font is
    CJK inline input will take place. This is always the case unless the application has
    requested the bottomline window or has turned off TSM (see initialization options above).

   Input:
        iTXNObject:     opaque struct to apply keydown to.

        iEvent:     the keydown event.
  ***************************************************************************************
}
{
 *  TXNKeyDown()
 *
 *  Availability:
 *    Non-Carbon CFM:   in Textension 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure TXNKeyDown(iTXNObject: TXNObject; const (*var*) iEvent: EventRecord); external name '_TXNKeyDown';

{
  ***************************************************************************************
    Handle switching the cursor.  If over text area set to i-beam.  Over graphics, sound,
    movie, scrollbar or outside of window set to arrow.

    Input:
        iTXNObject:         Opaque struct obtained from TXNNewObject.
        ioCursorRgn:        Region to be passed to WaitNextEvent.  Resized  accordingly by
                        TXNAdjustCursor.
  ***************************************************************************************
}
{
 *  TXNAdjustCursor()
 *
 *  Availability:
 *    Non-Carbon CFM:   in Textension 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure TXNAdjustCursor(iTXNObject: TXNObject; ioCursorRgn: RgnHandle); external name '_TXNAdjustCursor';


{
  ****************************************************************************************
    Process click in content region.  Takes care of scrolling, selecting text,  playing
    sound and movies, drag & drop, and double-clicks.
    Input:
        iTXNObject:     Opaque struct obtained from TXNNewObject.
        iEvent:     the mousedown event
  *****************************************************************************************
}
{
 *  TXNClick()
 *
 *  Availability:
 *    Non-Carbon CFM:   in Textension 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure TXNClick(iTXNObject: TXNObject; const (*var*) iEvent: EventRecord); external name '_TXNClick';


{
  ********************************************************************************************

    Call this when WaitNextEvent returns false or there is no active TSNObject .
    The TXNObject parameter can be NULL which allows a client to call this function at any
    time.  This is necessary to insure input methods enough time to be reasonably responsive.
    NOTE : You do not need to call this when working on Carbon, TSM events are passed directly
           to the text object.
    Input:
        iTXNObject:         The currently active TXNObject or NULL.
        ioEvent:            The event record.  Usually a NULL event.  If the
                            event is not an NULL event on entry, and an input
                            method consumes the event the event should return
                            as a NULL event.
    Output:
        Boolean:        True if TSM handled this event.  False if TSM did not handle this event.
  **********************************************************************************************
}

{
 *  TXNSelectAll()
 *
 *  Availability:
 *    Non-Carbon CFM:   in Textension 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure TXNSelectAll(iTXNObject: TXNObject); external name '_TXNSelectAll';



{
  ***********************************************************************************************
    Focues the TXNObject.  Scrollbars and insertion point are made active  if iBecomingFocused
    is true, and inactive if false.

    Input:
        iTXNObject:         opaque TXNObject

        iBecomingFocused:   true if becoming active.  false otherwise.
  ************************************************************************************************
}
{
 *  TXNFocus()
 *
 *  Availability:
 *    Non-Carbon CFM:   in Textension 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure TXNFocus(iTXNObject: TXNObject; iBecomingFocused: boolean); external name '_TXNFocus';

{
  ************************************************************************************************
    Handle update event (i.e. draw everything in a frame.) This function calls the Toolbox
    BeginUpdate - EndUpdate functions for the window that was passed to TXNNewObject.  This
    makes it inappropriate for windows that contain something else besides the TXNObject.
    Input:
        iTXNObject: opaque TXNObject
  ************************************************************************************************
}
{
 *  TXNUpdate()
 *
 *  Availability:
 *    Non-Carbon CFM:   in Textension 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure TXNUpdate(iTXNObject: TXNObject); external name '_TXNUpdate';

{
  *************************************************************************************************
    Redraw the TXNObject including any scrollbars associated with the text frame.  Call this function
    in response to an update event for a window that contains multiple TXNObjects or some other graphic
    element.  The caller is responsible for calling BeginUpdate/EndUpdate in response to the update
    event.
    Input:
        iTXNObject:     opaque TXNObject to draw
        iDrawPort:  Can be NULL. If NULL the port is drawn to the port currently attached to the
                    iTXNObject.  If not NULL drawing goes to the iDrawPort.  If drawing is done
                    to the iDrawPort selection is not updated.  This works this way so that it
                    is possible to Draw a TXNObject to a static port (i.e. print the thing without
                    reflowing the text to match the paper size which is what TXNPrint does)
                    and not have a line drawn where the selection would be.  If you pass an
                    iDrawPort to an active TXNObject (i.e. editable) the selection will not be updated. In
                    this case the selection will behave oddly until text is typed which will serve
                    to realign the selection.  Bottom-line don't pass a port in unless you want
                    static text (printed or non-editable)
  *************************************************************************************************
}
{
 *  TXNDraw()
 *
 *  Availability:
 *    Non-Carbon CFM:   in Textension 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure TXNDraw(iTXNObject: TXNObject; iDrawPort: GWorldPtr); external name '_TXNDraw';

{
  *************************************************************************************************
    Force a frame to be updated.  Very much like toolbox call InvalRect.

    Input:
        iTXNObject: opaque TXNObject
  **************************************************************************************************
}
{
 *  TXNForceUpdate()
 *
 *  Availability:
 *    Non-Carbon CFM:   in Textension 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure TXNForceUpdate(iTXNObject: TXNObject); external name '_TXNForceUpdate';


{
  **************************************************************************************************
    Depending on state of window get the appropriate sleep time to be passed to WaitNextEvent.
    Input:
        iTXNObject: opaque TXNObject obtained from TXNNewObject

    Output:

        UInt32: function result appropriate sleep time.
  ***************************************************************************************************
}
{
 *  TXNGetSleepTicks()
 *
 *  Availability:
 *    Non-Carbon CFM:   in Textension 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TXNGetSleepTicks(iTXNObject: TXNObject): UInt32; external name '_TXNGetSleepTicks';

{
  ***************************************************************************************************
    Do necessary Idle time processing. Typically flash the cursor. If a TextService is active
    pass a NULL event to the Text Service so it gets  time.
    Input:
        iTXNObject: opaque TXNObject obtained from TXNNewObject
  ****************************************************************************************************
}
{
 *  TXNIdle()
 *
 *  Availability:
 *    Non-Carbon CFM:   in Textension 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure TXNIdle(iTXNObject: TXNObject); external name '_TXNIdle';


{
  *********************************************************************************************************
    Handle mouse-down in grow region.
    Input:
        iTXNObject:     opaque TXNObject obtained from TXNNewObject
        iEvent:     The mousedown event
  *********************************************************************************************************
}
{
 *  TXNGrowWindow()
 *
 *  Availability:
 *    Non-Carbon CFM:   in Textension 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure TXNGrowWindow(iTXNObject: TXNObject; const (*var*) iEvent: EventRecord); external name '_TXNGrowWindow';


{
  ********************************************************************************************************
    Handle mousedown in zoom.
    Input:
        iTXNObject:     opaque TXNObject obtained from  TXNNewObject
        iPart:      Value returned by FindWindow
  *********************************************************************************************************
}
{
 *  TXNZoomWindow()
 *
 *  Availability:
 *    Non-Carbon CFM:   in Textension 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure TXNZoomWindow(iTXNObject: TXNObject; iPart: SInt16); external name '_TXNZoomWindow';


{
  *******************************************************************************************************
    Use this to determine if the Undo item in Edit menu should be highlighted or not.  Tells you if last
    command was undoable.
    Input:
        iTXNObject:     opaque TXNObject obtained from TXNNewObject
    Output:
        Boolean     function result.  If True the last command is undoable and the undo item in the menu
                    should be active.  If false last command cannot be undone and undo should be grayed
                    in the menu.
        oTXNActionKey The key code that the caller can use to pick a string to describe the undoable
                      action in the undo item.  Pass in NULL if the string isn't needed.
  *********************************************************************************************************
}
{
 *  TXNCanUndo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in Textension 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TXNCanUndo(iTXNObject: TXNObject; oTXNActionKey: TXNActionKeyPtr): boolean; external name '_TXNCanUndo';

{
  ********************************************************************************************************
    Undo the last command.
    Input:
        iTXNObject:     opaque TXNObject obtained from TXNNewObject
  *********************************************************************************************************
}
{
 *  TXNUndo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in Textension 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure TXNUndo(iTXNObject: TXNObject); external name '_TXNUndo';

{
  *********************************************************************************************************
    Use this to determine if the current item on the undo stack is redoable.  If it returns true.
    than the redo item in the edit menu should be active.

    Input:
        iTXNObject:     opaque TXNObject obtained from TXNNewObject.
        oTXNActionKey The key code that the caller can use to pick a string to describe the redoable
                      action in the redo item.  Pass in NULL if the string isn't needed.
}

{ ********************************************************************************************************* }
{
 *  TXNCanRedo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in Textension 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TXNCanRedo(iTXNObject: TXNObject; oTXNActionKey: TXNActionKeyPtr): boolean; external name '_TXNCanRedo';


{
  ********************************************************************************************************
    Redo the last command.
    Input:
        iTXNObject:     opaque TXNObject obtained from TXNNewObject
  *********************************************************************************************************
}
{
 *  TXNRedo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in Textension 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure TXNRedo(iTXNObject: TXNObject); external name '_TXNRedo';



{
  *********************************************************************************************************
    Cut the current selection to the clipboard.
    Input:
        iTXNObject:     opaque TXNObject obtained from TXNNewObject
    Output:
        OSStatus:   function result.  Variety of memory or scrap MacOS errors.
  **********************************************************************************************************
}
{
 *  TXNCut()
 *
 *  Availability:
 *    Non-Carbon CFM:   in Textension 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TXNCut(iTXNObject: TXNObject): OSStatus; external name '_TXNCut';


{
  *********************************************************************************************************
    TXNCopy
        Copy current selection

    Input:
        iTXNObject:         current document

  **********************************************************************************************************
}
{
 *  TXNCopy()
 *
 *  Availability:
 *    Non-Carbon CFM:   in Textension 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TXNCopy(iTXNObject: TXNObject): OSStatus; external name '_TXNCopy';


{
  ***********************************************************************************************************
    TXNPaste
        Paste the clipboard

    Input:
        iTXNObject:         current document

  **********************************************************************************************************
}
{
 *  TXNPaste()
 *
 *  Availability:
 *    Non-Carbon CFM:   in Textension 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TXNPaste(iTXNObject: TXNObject): OSStatus; external name '_TXNPaste';


{
  **********************************************************************************************************
    TXNClear
        clear the current selection

    Input:
        iTXNObject:         current document

  **********************************************************************************************************
}
{
 *  TXNClear()
 *
 *  Availability:
 *    Non-Carbon CFM:   in Textension 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TXNClear(iTXNObject: TXNObject): OSStatus; external name '_TXNClear';


{
  *********************************************************************************************************
    TXNGetSelection
        Get the absolute offsets of the current selection.
        Embedded graphics, sound, etc. each count as one character.

    Input:
        iTXNObject:         current document

    Output:
        oStartOffset:   absolute beginning of the current selection.
        oEndOffset:     end of current selection.
  *********************************************************************************************************
}
{
 *  TXNGetSelection()
 *
 *  Availability:
 *    Non-Carbon CFM:   in Textension 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure TXNGetSelection(iTXNObject: TXNObject; var oStartOffset: TXNOffset; var oEndOffset: TXNOffset); external name '_TXNGetSelection';


{
  *****************************************************************************************************
    Scroll the current selection into view.
    Input:
        iTXNObject:         opaque TXNObject obtained from TXNNewObject
        iShowEnd:   If true the end of the selection is scrolled into view. If false the
                    beginning of selection is scrolled into view.
  ****************************************************************************************************
}
{
 *  TXNShowSelection()
 *
 *  Availability:
 *    Non-Carbon CFM:   in Textension 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure TXNShowSelection(iTXNObject: TXNObject; iShowEnd: boolean); external name '_TXNShowSelection';


{
  *****************************************************************************************************
    Call to find out if the current selection is empty. Use this to determine if Paste, Cut, Copy,
    Clear should be highlighted in Edit menu.
    Input:
        iTXNObject:     opaque TXNObject obtained from TXNNewObject
    Output:
        Boolean:    function result.  True if current selection is empty (i.e. start offset == end offset).
                    False if selection is not empty.
  ********************************************************************************************************
}
{
 *  TXNIsSelectionEmpty()
 *
 *  Availability:
 *    Non-Carbon CFM:   in Textension 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TXNIsSelectionEmpty(iTXNObject: TXNObject): boolean; external name '_TXNIsSelectionEmpty';


{
  ********************************************************************************************************
    Set the current selection.

    Input:
        iTXNObject:     opaque TXNObject obtained from TXNNewObject
        iStartOffset:   new beginning
        iEndOffset:     new end
  ********************************************************************************************************
}
{
 *  TXNSetSelection()
 *
 *  Availability:
 *    Non-Carbon CFM:   in Textension 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TXNSetSelection(iTXNObject: TXNObject; iStartOffset: TXNOffset; iEndOffset: TXNOffset): OSStatus; external name '_TXNSetSelection';


{
  *******************************************************************************************************
    TXNGetContinuousTypeAttributes
        Test the current selection to see if type size, style, color and/or font are continuous.
        That is is the current selection made up of one font, one font size, one Style, and/or one color.
        On return examine the flags to see if the attributes specified were continuous.  If an attribute
        is continuous then the dataValue field in the TXNTypeAttributes can be examined to get the continous
        value.  Remember that for color you pass a ptr to an RGBColor in attr[0].data.dataPtr.
    Input:
        iTXNObject:             current document
        oContinuousFlags:   Bits which can be examined to see if type size, style, color, and/or font are continuous

                            e.g
                            if (  TXNGetContinuousTypeAttributes( txnObject, &flags, 1, &attr ) == noErr )
                            (
                                    if ( flags & kTXNFontContinuousMask )
                                        ....check a font name
        ioCount:            Count of TXNTypeAttributes records in the ioTypeAttributes array.
        ioTypeAttributes:   Array of TXNTypeAttributes that indicate the type attributes the
                            caller is interested in.  For example, if you wanted to know if
                            the current selection was continuous in terms of being all
                            one same font size you could do something like this.

                            TXNTypeAttributes       attr[1] = ( TXNFontSizeAttribute, sizeof(Fixed),( 0 ) )

                            on return  from the function if size is continuous (i.e. if the bit 3 of flags is set)
                            then the third field (attr[0].data.dataValue) will contain the size of the font as a Fixed value.


  ***********************************************************************************************************
}
{
 *  TXNGetContinuousTypeAttributes()
 *
 *  Availability:
 *    Non-Carbon CFM:   in Textension 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TXNGetContinuousTypeAttributes(iTxnObject: TXNObject; var oContinuousFlags: TXNContinuousFlags; iCount: ItemCount; ioTypeAttributes: TXNTypeAttributesPtr): OSStatus; external name '_TXNGetContinuousTypeAttributes';





{
  *************************************************************************************************
    TXNSetTypeAttributes
        Set the current ranges font information.  Values are passed
        in the attributes array.  Values <= sizeof(UInt32) are passed
        by value. > sizeof(UInt32) are passed as a pointer.  That is
        the TXNTypeAttributes' 3rd field is a union that servers as
        either a 32-bit SInt16 where values can be written or a 32-bit pointer
        a value.
    Input:
        iTXNObject:         current document
        iAttrCount:     Count of type attributes in the TXNTypeAttributes array.
        iAttributes:    Attributes that caller would like to set.
        iStartOffset:   Start of the range where text attributes should be changed.
        iEndOffset:     End of the range.

    Output:
        OSStatus:           various MacOS  errs.  Notably memory manager and paramErrs.
  *************************************************************************************************
}
{
 *  TXNSetTypeAttributes()
 *
 *  Availability:
 *    Non-Carbon CFM:   in Textension 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TXNSetTypeAttributes(iTXNObject: TXNObject; iAttrCount: ItemCount; iAttributes: TXNTypeAttributesPtr; iStartOffset: TXNOffset; iEndOffset: TXNOffset): OSStatus; external name '_TXNSetTypeAttributes';



{
 *  TXNSetTXNObjectControls()
 *
 *  Summary:
 *    Sets formatting and privileges attributes (such as justification,
 *    line direction, tab values, and read-only status) that apply to
 *    the entire text object.
 *
 *  Discussion:
 *    On systems that use Apple Type Services for Unicode Imaging
 *    (ATSUI), the ATSUI line control attribute tags can be passed to
 *    this function in the iControlTag parameter. This is the case for
 *    all the ATSUI tags except kATSULineRotationTag. ATSUI tags are
 *    applied to the entire text object.
 *
 *  Parameters:
 *
 *    iTXNObject:
 *      The text object that identifies the document for which you want
 *      to set formatting and privileges attributes.
 *
 *    iClearAll:
 *      A Boolean value. If you set this to true, all formatting and
 *      privileges attributes are reset to their default value. That
 *      is, true clears existing tags and resets each to its default
 *      value.
 *
 *    iControlCount:
 *      The number of items in the iControlTags array.
 *
 *    iControlTags:
 *      An array of values that specifies kind of data that is passed
 *      in the iControlData parameter. See ÒFormatting and Privileges
 *      SettingsÓ for a description of possible values. On systems that
 *      use Apple Type Services for Unicode Imaging (ATSUI), you can
 *      also pass ATSUI attribute tag constants. See the ATSUI
 *      documentation for a description of the ATSUI constants. Can be
 *      NULL if iClearAll is true.
 *
 *    iControlData:
 *      An array of TXNControlData unions that contain the information
 *      your application wants to set. The value you supply to the
 *      iControlTags parameter specifies how the union of type
 *      TXNControlData is treated. You must make sure that the value
 *      you assign to the iControlData parameter is the appropriate
 *      type implied by the value you passed in the iControlTags
 *      parameter. Can be NULL if iClearAll is true.
 *
 *  Result:
 *    An operating system status code.
 *
 *  Availability:
 *    Non-Carbon CFM:   in Textension 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TXNSetTXNObjectControls(iTXNObject: TXNObject; iClearAll: boolean; iControlCount: ItemCount; iControlTags: TXNControlTagPtr; iControlData: TXNControlDataPtr): OSStatus; external name '_TXNSetTXNObjectControls';


{
 *  TXNGetTXNObjectControls()
 *
 *  Summary:
 *    Gets the current formatting and privileges attributes (such as
 *    justification, line direction, tab values, and read-only status)
 *    for a text object.
 *
 *  Parameters:
 *
 *    iTXNObject:
 *      The text object that identifies the document to be activated.
 *
 *    iControlCount:
 *      The number of items in the iControlTags array.
 *
 *    iControlTags:
 *      An array of values that specify the kind of formatting
 *      information you want returned in the oControlData array. See
 *      ÒFormatting and Privileges SettingsÓ for a description of
 *      possible values.
 *
 *    oControlData:
 *      An array of TXNControlData unions. On return, the array
 *      contains the information that was requested through the
 *      iControlTags array. Your application must allocate the
 *      oControlData array.
 *
 *  Result:
 *    An operating system status code.
 *
 *  Availability:
 *    Non-Carbon CFM:   in Textension 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TXNGetTXNObjectControls(iTXNObject: TXNObject; iControlCount: ItemCount; iControlTags: TXNControlTagPtr; var oControlData: TXNControlData): OSStatus; external name '_TXNGetTXNObjectControls';




{
  ******************************************************************************************************
    TXNCountRunsInRange
        Given a range specified by the starting and ending offset return a count of the runs in that
        range.  Run in this case means changes in TextSyles or a graphic or sound.
        Result:
            OSStatus:       paramerr mostly
        Input:
            iTXNObject          The TXNObject you are interested in.
            iStartOffset        start of range
            iEndOffset          end of range

        Output:
            oRunCount           count of runs in the range
  *******************************************************************************************************
}
{
 *  TXNCountRunsInRange()
 *
 *  Availability:
 *    Non-Carbon CFM:   in Textension 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TXNCountRunsInRange(iTXNObject: TXNObject; iStartOffset: TXNOffset; iEndOffset: TXNOffset; var oRunCount: ItemCount): OSStatus; external name '_TXNCountRunsInRange';

{
 *  TXNGetIndexedRunInfoFromRange()
 *
 *  Summary:
 *    Gets information about a run in a range of data.
 *
 *  Discussion:
 *    You should first call the TXNCountRunsInRange function to get the
 *    count. The TXNTypeAttributes structure must specify the text
 *    attribute in which the application is interested. In other words,
 *    the tag field must be set.
 *
 *  Parameters:
 *
 *    iTXNObject:
 *      The text object for the current text area.
 *
 *    iIndex:
 *      The value that corresponds to the run for which you want to get
 *      information. You call the TXNCountRunsInRange function to get
 *      the number of runs in a range. The iIndex parameter is
 *      zero-based, so its possible values are from 0 to the number of
 *      runs in a range minus 1.
 *
 *    iStartOffset:
 *      The offset at which you want to start to obtain run information.
 *
 *    iEndOffset:
 *      The offset at which you want run information to end.
 *
 *    oRunStartOffset:
 *      On return, a pointer to a value that identifies the start of
 *      run relative to the beginning of the text, not the beginning of
 *      the range you specified in the iStartOffset parameter.
 *
 *    oRunEndOffset:
 *      On return, a pointer to a value that identifies the end of the
 *      run relative to the beginning of the text, not the beginning of
 *      the range you specified in the iStartOffset parameter.
 *
 *    oRunDataType:
 *      On return, a pointer to a value that identifies the type of
 *      data in the run. See ÒSupported Data TypesÓ for a description
 *      of possible values.
 *
 *    iTypeAttributeCount:
 *      The number of font attributes.
 *
 *    ioTypeAttributes:
 *      A pointer to a structure of type TXNTypeAttributes. On input,
 *      you specify the attribute (such as color) in the tag field and
 *      the attribute size in the size field. You can pass NULL for the
 *      data field. On return, the data field contains the attribute
 *      data. The data field is a union that serves either as a 32-bit
 *      SInt16 or a 32-bit pointer, depending on the size field.
 *
 *  Result:
 *    An operating system status code.
 *
 *  Availability:
 *    Non-Carbon CFM:   in Textension 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TXNGetIndexedRunInfoFromRange(iTXNObject: TXNObject; iIndex: ItemCount; iStartOffset: TXNOffset; iEndOffset: TXNOffset; oRunStartOffset: TXNOffsetPtr; oRunEndOffset: TXNOffsetPtr; oRunDataType: TXNDataTypePtr; iTypeAttributeCount: ItemCount; ioTypeAttributes: TXNTypeAttributesPtr): OSStatus; external name '_TXNGetIndexedRunInfoFromRange';


{
  **********************************************************************************************************
    TXNDataSize
    Return the size in bytes of the characters in a given TXNObject.
    Result:
        ByteCount:          The bytes required to hold the characters
    Input:
        iTXNObject:         The TXNObject

  **********************************************************************************************************
}
{
 *  TXNDataSize()
 *
 *  Availability:
 *    Non-Carbon CFM:   in Textension 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TXNDataSize(iTXNObject: TXNObject): ByteCount; external name '_TXNDataSize';


{
  ***********************************************************************************************************
    Copy the data in the range specified by startOffset and endOffset. This function should be used
    in conjunction with TXNNextDataRun.  The client would call TXNCountRunsInRange to the number of data
    runs in a given range.  The client can then walk the runs with the function TXNGetIndexedRunInfoFromRange.
    TXNGetIndexedRunInfoFromRange lets you examine each runs type and text attributes.
    For each data run of interest (i.e. one whose data the caller wanted to look at)
    the client would call TXNGetData. The handle passed to TXNGetData should not be allocated.
    TXNGetData takes care of allocating the dataHandle as necessary.  However, the caller is  responsible
    for disposing the handle.
    No effort is made to insure that data copies align on a word boundary.  Data is simply copied as
    specified in the offsets.
    Input:
        iTXNObject:     opaque TXNObject obtained from TXNNewObject.
        iStartOffset:   absolute offset from which data copy should begin.
        iEndOffset: absolute offset at which data copy should end.

    Output:
        OSStatus    Memory errors or  TXN_IllegalToCrossDataBoundaries if offsets specify a range that
                    crosses a data type boundary.
        oDataHandle: If noErr a new handle containing the requested data. The caller is responsible
                     for disposing the handle.  Note that the handle is a copy so it can be safely
                     disposed at any time.
  **********************************************************************************************************
}
{
 *  TXNGetData()
 *
 *  Availability:
 *    Non-Carbon CFM:   in Textension 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TXNGetData(iTXNObject: TXNObject; iStartOffset: TXNOffset; iEndOffset: TXNOffset; var oDataHandle: Handle): OSStatus; external name '_TXNGetData';


{
  ***********************************************************************************************************
    Copy the data in the range specified by startOffset and endOffset.
    The handle passed to TXNGetDataEncoded should not be allocated.
    TXNGetData takes care of allocating the dataHandle as necessary.  However, the caller is  responsible
    for disposing the handle.
    No effort is made to insure that data copies align on a word boundary.  Data is simply copied as
    specified in the offsets.
    Input:
        iTXNObject:     opaque TXNObject obtained from TXNNewObject.
        iStartOffset:   absolute offset from which data copy should begin.
        iEndOffset: absolute offset at which data copy should end.
        iEncoding : should be kTXNTextData or kTXNUnicodeTextData
    Output:
        OSStatus    Memory errors or  TXN_IllegalToCrossDataBoundaries if offsets specify a range that
                crosses a data type boundary.
        oDataHandle:        If noErr a new handle containing the requested data.
  **********************************************************************************************************
}
{
 *  TXNGetDataEncoded()
 *
 *  Availability:
 *    Non-Carbon CFM:   in Textension 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TXNGetDataEncoded(iTXNObject: TXNObject; iStartOffset: TXNOffset; iEndOffset: TXNOffset; var oDataHandle: Handle; iEncoding: TXNDataType): OSStatus; external name '_TXNGetDataEncoded';


{
  *********************************************************************************************************
    Replace the specified range with the contents of the specified file.  The data fork of the file
    must be opened by the caller.
    Input:
        iTXNObject:     opaque TXNObject obtained from  TXNNewObject
        fileSpec:   HFS file reference obtained when file is opened.
        fileType:   files type.
        iFileLength: The length of data in the file that should be considered data.  This
                     parameter is available to enable callers to embed text inside their
                     own private data structures.  Note that if the data is in the Textension(txtn)
                     format this parameter is ignored since length, etc. information is
                     part of the format. Further note that if you you just want Textension
                     to read a file and you are not interested in embedding you can just pass
                     kTXNEndOffset(0x7FFFFFFF), and Textension will use the file manager to
                     determine the files length.
        iStartOffset:   start position at which to insert the file into the document.
        iEndOffset:     end position of range being replaced by the file.
    Output:
        OSStatus:   File manager error or noErr.
  ***********************************************************************************************************
}
{
 *  TXNSetDataFromFile()
 *
 *  Availability:
 *    Non-Carbon CFM:   in Textension 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TXNSetDataFromFile(iTXNObject: TXNObject; iFileRefNum: SInt16; iFileType: OSType; iFileLength: ByteCount; iStartOffset: TXNOffset; iEndOffset: TXNOffset): OSStatus; external name '_TXNSetDataFromFile';


{
 *  TXNSetData()
 *
 *  Summary:
 *    Replaces a range of data (text, graphics, and so forth).
 *
 *  Parameters:
 *
 *    iTXNObject:
 *      The text object that identifies the document in which you want
 *      to replace data.
 *
 *    iDataType:
 *      The type of the replacement data. See ÒSupported Data TypesÓ
 *      for a description of possible values.
 *
 *    iDataPtr:
 *      A pointer to the data that will replace the data that is in the
 *      range specified by the iStartOffset and iEndOffset parameters.
 *      Can be NULL if the start and end offsets are different.
 *
 *    iDataSize:
 *      The size of the data to which iDataPtr points.
 *
 *    iStartOffset:
 *      The beginning of the range of data to replace. You can use the
 *      TXNGetSelection function to get the absolute offsets of the
 *      current selection.
 *
 *    iEndOffset:
 *      The end of the range to replace. You can use the
 *      TXNGetSelection function to get the absolute offsets of the
 *      current selection. If you want to insert text, the ending and
 *      starting offsets should be the same value.
 *
 *  Result:
 *    An operating system status code.
 *
 *  Availability:
 *    Non-Carbon CFM:   in Textension 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TXNSetData(iTXNObject: TXNObject; iDataType: TXNDataType; iDataPtr: UnivPtr; iDataSize: ByteCount; iStartOffset: TXNOffset; iEndOffset: TXNOffset): OSStatus; external name '_TXNSetData';

{
  ************************************************************************************************************
    Retrieve number of times document has been changed.  That is for every committed command
    (keydown, cut, copy) the value returned is count of those. This is useful for deciding if  the Save
    item in the File menu should be active.
    Input:
        iTXNObject:     opaque TXNObject obtained from TXNNewObject

    Output:
        ItemCount:  count of changes.  This is total changes since document  was created or last saved.
                    Not count since this routine was last called or anything like that.
  ***********************************************************************************************************
}
{
 *  TXNGetChangeCount()
 *
 *  Availability:
 *    Non-Carbon CFM:   in Textension 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TXNGetChangeCount(iTXNObject: TXNObject): ItemCount; external name '_TXNGetChangeCount';


{
  *********************************************************************************************************
    Save the contents of the document as the given type.
    Input:
        iTXNObject:         opaque TXNObject obtained from TXNNewObject.
        iType:              The type of file to create.
        iResType:           When saving file as plain TEXT the type of resource to
                            save style information.  Use kTXNMultipleStylesPerTextDocumentResType
                            if your document contains multiple styles and you want a SimpleText
                            like document.  Use kTXNSingleStylePerTextDocumentResType if the
                            document has a single style and you would like a BBEdit, MPW, CW type
                            of document.
        iPermanentEncoding: The encoding in which the document should be saved (Unicode, Text or System
                            default).
        iFileSpecification:  The file specification to which the document should be saved. The
                             file must have been opened by the caller.  The file specification is remembered by the TXNObject
                             and is used for any subsequent calls to TXNRevert.
        iDataReference:     The data fork ref num.  This is used to write data to the data fork of the
                            file. The data is written beginning at the current mark.
        iResourceReference: The resource fork ref num.  If the caller has specified that style information be
                            saved as a resource (MPW or SimpleText) than this should be a valid reference to
                            an open resource fork.  If the txtn format is being used than this input value
                            is ignored.
    Output:
        OSStatus        The result of writing the file.
  **********************************************************************************************************
}
{
 *  TXNSave()
 *
 *  Availability:
 *    Non-Carbon CFM:   in Textension 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TXNSave(iTXNObject: TXNObject; iType: TXNFileType; iResType: OSType; iPermanentEncoding: TXNPermanentTextEncodingType; const (*var*) iFileSpecification: FSSpec; iDataReference: SInt16; iResourceReference: SInt16): OSStatus; external name '_TXNSave';


{
  ***********************************************************************************************************
    Revert  to the last saved version of this document.  If the file was not previously saved the document
    is reverted to an empty document.
    Input:
        iTXNObject:     opaque TXNObject obtained from TXNNewObject
    Output:
        OSStatus:   File manager errors, paramErr, or noErr.
  **********************************************************************************************************
}
{
 *  TXNRevert()
 *
 *  Availability:
 *    Non-Carbon CFM:   in Textension 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TXNRevert(iTXNObject: TXNObject): OSStatus; external name '_TXNRevert';


{
  *********************************************************************************************************
    Display the Page Setup dialog of the current default printer and react to any changes
    (i.e. Reformat the text if the page layout changes.)
    Input:
        iTXNObject:     opaque TXNObject obtained from TXNNewObject.

    Output:
        OSStatus:   Print Manager errors, paramErr, noErr.
  **********************************************************************************************************
}
{
 *  TXNPageSetup()
 *
 *  Availability:
 *    Non-Carbon CFM:   in Textension 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TXNPageSetup(iTXNObject: TXNObject): OSStatus; external name '_TXNPageSetup';


{
  **********************************************************************************************************
    Print the document.
    Input:
        iTXNObject:     opaque TXNObject obtained from TXNNewObject.
    Output:
        OSStatus:   Print Manager errors, paramErr, noErr.
  **********************************************************************************************************
}
{
 *  TXNPrint()
 *
 *  Availability:
 *    Non-Carbon CFM:   in Textension 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TXNPrint(iTXNObject: TXNObject): OSStatus; external name '_TXNPrint';


{
  ***********************************************************************************************************
    Test to see if the current scrap contains data that is supported by Textension.  Used to determine
    if Paste item in Edit menu should be active or inactive. The types of data supported depends on what
    data types were specified in the TXNInitTextension options.
    Output:
        Boolean:        function result.  True if data type in Clipboard is supported.  False if
                        not a supported data type.  If result is True the Paste item in the menu can
                        be highlighted.
  **********************************************************************************************************
}
{
 *  TXNIsScrapPastable()
 *
 *  Availability:
 *    Non-Carbon CFM:   in Textension 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TXNIsScrapPastable: boolean; external name '_TXNIsScrapPastable';


{
  ***********************************************************************************************************
    Convert the Textension private scrap to the public clipboard.  This should be called on suspend
    events and before the application displays a dialog that might support cut and paste.  Or more
    generally, whenever someone other than the Textension Shared Library needs access to the scrap data.
    Output:
         OSStatus:  Function result.  Memory Manager errors, Scrap Manager errors, noErr.
  ************************************************************************************************************
}
{
 *  TXNConvertToPublicScrap()
 *
 *  Availability:
 *    Non-Carbon CFM:   in Textension 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TXNConvertToPublicScrap: OSStatus; external name '_TXNConvertToPublicScrap';


{
  ***********************************************************************************************************
    Convert the  public clipboard to our private scrap .  This should be called on resume
    events and after an application has modified the scrap. Before doing work we check the validity of the public
    scrap (date modification and type)
    Output:
         OSStatus:  Function result.  Memory Manager errors, Scrap Manager errors, noErr.
  ************************************************************************************************************
}
{
 *  TXNConvertFromPublicScrap()
 *
 *  Availability:
 *    Non-Carbon CFM:   in Textension 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TXNConvertFromPublicScrap: OSStatus; external name '_TXNConvertFromPublicScrap';


{
  ************************************************************************************************************
    Get the  rectangle describing the current view into the document. The coordinates of this rectangle will be
    local to the the window.
    Input:
        iTXNObject:     opaque TXNObject obtained from TXNNewObject.
    Output:
        oViewRect:      the requested view rectangle.
  *************************************************************************************************************
}
{
 *  TXNGetViewRect()
 *
 *  Availability:
 *    Non-Carbon CFM:   in Textension 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure TXNGetViewRect(iTXNObject: TXNObject; var oViewRect: Rect); external name '_TXNGetViewRect';


{
  *************************************************************************************************
   Set the rectangle describing the current view into the document. This
   will change how much text is viewable.  Not where a line of text wraps.
   That is controlled by TXNSetFrameBoundsSize.
   Input:
        iTXNObject :    opaque Textension structure.

        iViewRect:      Rect of the view


  *************************************************************************************************
}
{
 *  TXNSetViewRect()
 *
 *  Availability:
 *    Non-Carbon CFM:   in Textension 1.3 and later
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure TXNSetViewRect(iTXNObject: TXNObject; const (*var*) iViewRect: Rect); external name '_TXNSetViewRect';


{
  ***********************************************************************************************************
    Find a piece of text or a graphics object.
    Input:
        iTXNObject:         opaque TXNObject obtained from TXNNewObject.
        iMatchTextDataPtr   ptr to a MatchTextRecord which contains the text to match, the length of that text
                            and the TextEncoding the text is encoded in.  This must be there if you are looking
                            for Text, but can be NULL if you are looking for a graphics object.
        iDataType           The type of data to find.  This can be any of the types defined in TXNDataType enum
                            (TEXT, PICT, moov, snd ).  However, if PICT, moov, or snd is passed then the default
                            behavior is to match on any non-Text object.  If you really want to find a specific
                            type you can provide a custom find callback or ignore matches which aren't the precise
                            type you are interested in.
        iStartSearchOffset  The offset at which a search should begin. The constant kTXNStartOffset specifies the start
                            of the objects data.
        iEndSearchOffset    The offset at which the search should end. The constant kTXNEndOffset specifies the end
                            of the objects data.
        iFindProc           A custom callback.  If will be called to match things rather than the default matching
                            behavior.
        iRefCon             This can be use for whatever the caller likes.  It is passed to the FindProc (if a FindProc
                            is provided.
    Output:
        oStartMatchOffset   absolute offset to start of match.  set to 0xFFFFFFFF if not match.
        oEndMatchOffset     absolute offset to end of match.  Set to 0xFFFFFFFF is no match.
    The default matching behavior is pretty simple for Text a basic binary compare is done.  If the matchOptions say
    to ignore case the characters to be searched are duplicated and case neutralized.  This naturally can fail due
    to lack of memory if there is a large amount of text.  It also slows things down.  If MatchOptions say
    find an entire word that once a match is found an effort is made to determine if the match is a word.  The default
    behavior is to test the character before and after the to see if it is White space.  If the kTXNUseEncodingWordRulesBit
    is set than the Script Manager's FindWord function is called to make this determination.
    If the caller is looking for a non-text type than each non-text type in the document is returned.
    If more elaborate ( a regular expression processor or whatever ) is what you want then that is what the FindProc is
    for.
  *******************************************************************************************************************
}
{
 *  TXNFind()
 *
 *  Availability:
 *    Non-Carbon CFM:   in Textension 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TXNFind(iTXNObject: TXNObject; iMatchTextDataPtr: {Const}TXNMatchTextRecordPtr; iDataType: TXNDataType; iMatchOptions: TXNMatchOptions; iStartSearchOffset: TXNOffset; iEndSearchOffset: TXNOffset; iFindProc: TXNFindUPP; iRefCon: SInt32; var oStartMatchOffset: TXNOffset; var oEndMatchOffset: TXNOffset): OSStatus; external name '_TXNFind';


{
  ***************************************************************************************************************
   TXNSetFontDefaults

   For a given TXNObject specify the font defaults for each script.
   Input:
        iTXNObject:         opaque TXNObject obtained from TXNNewObject.
        iCount:             count of FontDescriptions.
        iFontDefaults:      array of FontDescriptins.
   Output:
        OSStatus:           function result ( memory error, paramErr )
  ****************************************************************************************************************
}
{
 *  TXNSetFontDefaults()
 *
 *  Availability:
 *    Non-Carbon CFM:   in Textension 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TXNSetFontDefaults(iTXNObject: TXNObject; iCount: ItemCount; iFontDefaults: TXNMacOSPreferredFontDescriptionPtr): OSStatus; external name '_TXNSetFontDefaults';


{
  ***************************************************************************************************************
   TXNGetFontDefaults

   For a given TXNObject make a copy of the font defaults.
   Input:
        iTXNObject:         opaque TXNObject obtained from TXNNewObject.
        iCount:             count of FontDescriptions in the array.
        iFontDefaults:      array of FontDescriptins to be filled out.
   Output:
        OSStatus:           function result ( memory error, paramErr )
    To determine how many font descriptions need to be in the array you should call this function with
    a NULL for the array.  iCount will return with the number of font defaults currently stored.
  ****************************************************************************************************************
}
{
 *  TXNGetFontDefaults()
 *
 *  Availability:
 *    Non-Carbon CFM:   in Textension 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TXNGetFontDefaults(iTXNObject: TXNObject; var ioCount: ItemCount; ioFontDefaults: TXNMacOSPreferredFontDescriptionPtr): OSStatus; external name '_TXNGetFontDefaults';


{
  ****************************************************************************************************************
    TXNAttachObjectToWindow
    If a TXNObject was initialized with a NULL window pointer use this function
    to attach a window to that object.  In version 1.0 of Textension attaching
    a TXNObject to more than one window is not supported.
    Input:
        iTXNObject:         opaque TXNObject obtained from TXNNewObject.
        iWindow:            GWorldPtr that the object should be attached to
        iIsActualWindow:    Let the library know if the GWorldPtr is actually
                            a WindowRef or actually a GWorldPtr.  This is important
                            if the client is taking advantage of the editing packages
                            scrollbar support.
    Output:
        OSStatus:           function result (kObjectAlreadyAttachedToWindowErr, paramErr )
  ****************************************************************************************************************
}
{
 *  TXNAttachObjectToWindow()
 *
 *  Availability:
 *    Non-Carbon CFM:   in Textension 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TXNAttachObjectToWindow(iTXNObject: TXNObject; iWindow: GWorldPtr; iIsActualWindow: boolean): OSStatus; external name '_TXNAttachObjectToWindow';


{
  ****************************************************************************************************************
    TXNIsObjectAttachedToWindow
    A utility function that allows a caller to check a TXNObject to see if it is attached
    to a window.
    Input:
        iTXNObject:         opaque TXNObject obtained from TXNNewObject.
    Output:
        Boolean:            function result.  True is object is attached.
                            False if TXNObject is not attached.
  ****************************************************************************************************************
}
{
 *  TXNIsObjectAttachedToWindow()
 *
 *  Availability:
 *    Non-Carbon CFM:   in Textension 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TXNIsObjectAttachedToWindow(iTXNObject: TXNObject): boolean; external name '_TXNIsObjectAttachedToWindow';


{
  ****************************************************************************************************************
    TXNDragTracker
    If you ask that Drag handling procs not be installed.  Call this when your drag tracker is called
    and you want Textension to take over
    Input:
        iTXNObject:         opaque TXNObject obtained from TXNNewObject.
        iTXNFrameID:            TXNFrameID obtained from TXNNewObject
        iMessage:           drag message obtained from Drag Manager
        iWindow :           WindowRef obtained from Drag Manager
        iDragReference:     dragReference obtained from Drag Manager
        iDifferentObjectSameWindow: Pass true if the drag is still in the same window
                                   that it started in. False if the drag has moved into
                                   a different window.
    Output:
        OSErr:              function result.  OSErr is used over
                            OSStatus so that it matches the Drag Manager definition of Tracking callback
  ****************************************************************************************************************
}
{
 *  TXNDragTracker()
 *
 *  Availability:
 *    Non-Carbon CFM:   in Textension 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TXNDragTracker(iTXNObject: TXNObject; iTXNFrameID: TXNFrameID; iMessage: DragTrackingMessage; iWindow: WindowRef; iDragReference: DragReference; iDifferentObjectSameWindow: boolean): OSErr; external name '_TXNDragTracker';


{
  ****************************************************************************************************************
    TXNDragReceiver
    If you ask that Drag handling procs not be installed.  Call this when your drag receiver is called
    and you want Textension to take over
    Input:
        iTXNObject:         opaque TXNObject obtained from TXNNewObject.
        iTXNFrameID         TXNFrameID obtained from TXNNewObject
        iWindow             WindowRef obtained from Drag Manager
        iDragReference      dragReference obtained from Drag Manager
        iDifferentObjectSameWindow: Pass true if the drag is still in the same window
                                   that it started in. False if the drag has moved into
                                   a different window.
    Output:
        OSErr:              function result.  OSErr is used over
                            OSStatus so that it matches the Drag Manager definition of Tracking callback
  ****************************************************************************************************************
}
{
 *  TXNDragReceiver()
 *
 *  Availability:
 *    Non-Carbon CFM:   in Textension 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TXNDragReceiver(iTXNObject: TXNObject; iTXNFrameID: TXNFrameID; iWindow: WindowRef; iDragReference: DragReference; iDifferentObjectSameWindow: boolean): OSErr; external name '_TXNDragReceiver';


{
  ****************************************************************************************************************
    TXNActivate
    Make the TXNObject object active in the sense that it can be scrolled if it has scrollbars.  If the TXNScrollBarState parameter
    is true than the scrollbars will be active even when the TXNObject is not focused (i.e. insertion point not active)

    This function should be used if you have multiple TXNObjects in a window, and you want them all to be scrollable
    even though only one at a time can have the keyboard focus.
    Input:
        iTXNObject:         opaque TXNObject obtained from TXNNewObject.
        iTXNFrameID         TXNFrameID obtained from TXNNewObject
        iActiveState        Boolean if true Scrollbars active even though TXNObject does not have the keyboard focus.
                            if false scrollbars are synced with active state (i.e. a focused object has an
                            active insertion point or selection and active scrollbars. An unfocused object has inactive
                            selection (grayed or framed selection) and inactive scrollbars.  The latter state is the
                            default and usually the one you use if you have one TXNObject in a window.
    Output:
        OSStatus:           function result.  ParamErr if bad iTXNObject or frame ID.
  ****************************************************************************************************************
}
{
 *  TXNActivate()
 *
 *  Availability:
 *    Non-Carbon CFM:   in Textension 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TXNActivate(iTXNObject: TXNObject; iTXNFrameID: TXNFrameID; iActiveState: ByteParameter): OSStatus; external name '_TXNActivate';


{
  *****************************************************************************************************************
    TXNSetBackgound
    Set the type of background the TXNObject's text, etc. is drawn onto.  At this point the background
    can be a color or a picture.

    Input:
        iTXNObject:         opaque TXNObject obtained from IncomingDataFilter callback.
        iBackgroundInfo:    struct containing information that describes the background
    Output:
        OSStatus:           function result.  paramErrs.
  ********************************************************************************************************************
}
{
 *  TXNSetBackground()
 *
 *  Availability:
 *    Non-Carbon CFM:   in Textension 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TXNSetBackground(iTXNObject: TXNObject; const (*var*) iBackgroundInfo: TXNBackground): OSStatus; external name '_TXNSetBackground';


{
  *****************************************************************************************************************
    TXNEchoMode
    Put the TXNObject into echo mode.  What that means is that all characters in the TXNObject have the character
    'echoCharacter' substituted for the actual glyph when drawing occurs. Note that the echoCharacter is typed
    as a UniChar, but this is done merely to facilitate passing any 2 byte character.  The encoding parameter
    actually determines the encoding used to locate a font and display a character.  Thus if you wanted to
    display the diamond found in the Shift-JIS encoding for MacOS you would pass in 0x86A6 for the character
    but an encoding that was built to represent the MacOS Japanese encoding.

    Input:
        iTXNObject:         opaque TXNObject obtained from IncomingDataFilter callback.
        iEchoCharacter:     character to use in substitution
        iEncoding:          encoding from which character is drawn.
        iOn:                true if turning EchoMode on.  False if turning it off.
    Output:
        OSStatus:           function result.  paramErrs.
  ********************************************************************************************************************
}
{
 *  TXNEchoMode()
 *
 *  Availability:
 *    Non-Carbon CFM:   in Textension 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TXNEchoMode(iTXNObject: TXNObject; iEchoCharacter: UniChar; iEncoding: TextEncoding; iOn: boolean): OSStatus; external name '_TXNEchoMode';


{
  ********************************************************************************************************************
    TXNNewFontMenuObject
    Get a FontMenuObject.  Caller can extract a fontmenu from this object and pass this object to the active
    TXNObject to handle events in the font menu.
    Input:
        iFontMenuHandle:    An empty menu handle (well the title is there) that the caller created via
                            NewMenu or GetNewMenu. This menu handle should not be disposed before
                            the returned TXNFontMenuObject has been disposed via TXNDisposeFontMenuObject.
        iMenuID:            The MenuID for iFontMenuHandle.
        iStartHierMenuID:   The first MenuID to use if any hierarchical menus need to be created. TXNNewFontMenuObject
                            uses SetMenuItemHierarchicalID when creating hierarchial menus.  The iStartHierMenuID must
                            therefor follow the rules for this function.  On systems less than system 8.5 the submenuID
                            must be less than 255.  For systems above system 8.5 the range can be as large can be as large
                            32767.  However, it is important to remember that TXNNewFontMenuObject only uses iStartHierMenuID
                            as a starting id when adding hierarchical menus.  Therefore provide plenty of room to increment
                            this value. For example, on a system less than 8.5 it would be good to start at 175.  On systems greater
                            than 8.5 it is probably a good idea to not use a value higher than 32000.

    Output:
        OSStatus:           function result.  memory, parameter errors.
        TXNFontMenuObject:  A font menu object
  *********************************************************************************************************************
}
{
 *  TXNNewFontMenuObject()
 *
 *  Availability:
 *    Non-Carbon CFM:   in Textension 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TXNNewFontMenuObject(iFontMenuHandle: MenuRef; iMenuID: SInt16; iStartHierMenuID: SInt16; var oTXNFontMenuObject: TXNFontMenuObject): OSStatus; external name '_TXNNewFontMenuObject';


{
  *********************************************************************************************************************
    TXNGetFontMenuHandle
    Get the MenuRef from the TXNFontMenuObject.
    Input:
        iTXNFontMenuObject:     A Font Menu Object obtained from TXNNewFontMenuObject.
    Output:
        OSStatus:           function result. parameter errors.
        oFontMenuHandle:    The returned font menu. (returned value could be NULL)
  *********************************************************************************************************************
}
{
 *  TXNGetFontMenuHandle()
 *
 *  Availability:
 *    Non-Carbon CFM:   in Textension 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TXNGetFontMenuHandle(iTXNFontMenuObject: TXNFontMenuObject; var oFontMenuHandle: MenuRef): OSStatus; external name '_TXNGetFontMenuHandle';


{
  *********************************************************************************************************************
    TXNDisposeFontMenuObject
    Dispose a TXNFontMenuObject and its font menu handle
    Input:
        iTXNFontMenuObject:     A Font Menu Object obtained from TXNNewFontMenuObject.
    Output:
        OSStatus:   function result. parameter errors.
  *********************************************************************************************************************
}
{
 *  TXNDisposeFontMenuObject()
 *
 *  Availability:
 *    Non-Carbon CFM:   in Textension 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TXNDisposeFontMenuObject(iTXNFontMenuObject: TXNFontMenuObject): OSStatus; external name '_TXNDisposeFontMenuObject';


{
  *********************************************************************************************************************
    TXNDoFontMenuSelection
        Given the menuID and menu item returned by MenuSelect determine the selected font
        and change the current selection to be that Font.  If the input TXNObject is
        not active a parameter error is returned.
    Input:
        iTXNObject: An opaque TXNObject obtained from TXNNewObject.
        iTXNFontMenuObject:     A Font Menu Object obtained from TXNNewFontMenuObject.
        iMenuID:    SInt16 the ID of the selected menu.
        iMenuItem:  The item that was selected.
    Output:
        OSStatus:   ParamErr and memory errors are possible.
  **********************************************************************************************************************
}
{
 *  TXNDoFontMenuSelection()
 *
 *  Availability:
 *    Non-Carbon CFM:   in Textension 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TXNDoFontMenuSelection(iTXNObject: TXNObject; iTXNFontMenuObject: TXNFontMenuObject; iMenuID: SInt16; iMenuItem: SInt16): OSStatus; external name '_TXNDoFontMenuSelection';


{
 *  TXNPrepareFontMenu()
 *
 *  Summary:
 *    Prepares a Font menu for display.
 *
 *  Discussion:
 *    You should call the TXNPrepareFontMenu function just before your
 *    application opens the Font menu for your user. If the text
 *    objectÕs current selection is a single font, MLTE places a
 *    checkmark next to the menu item for that font.
 *
 *  Parameters:
 *
 *    iTXNObject:
 *      The text object that identifies the document with the Font menu
 *      you want to prepare. Pass NULL to display an inactive menu
 *      (dimmed).
 *
 *    iTXNFontMenuObject:
 *      A Font menu object.
 *
 *  Result:
 *    An operating system status code.
 *
 *  Availability:
 *    Non-Carbon CFM:   in Textension 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TXNPrepareFontMenu(iTXNObject: TXNObject; iTXNFontMenuObject: TXNFontMenuObject): OSStatus; external name '_TXNPrepareFontMenu';


{
  **********************************************************************************************************************
    TXNVersionInformation
        Get the version number and a set of feature bits.  TXNVersionValue uses a NumVersion structure.
        See MacTypes.h for the format of the version.  Currently there are two feature bits:  one for
        ATSUI default, another one for CarbonEvent default.
    Input:
        NONE

    Output:
        TXNVersionValue:    Current version.
        TXNFeatureBits*:    Pointer to a bit mask.  See TXNFeatureMask enum above. If kTXNWillDefaultToATSUIBit
                            is set it means that by default MLTE will use ATSUI to image and measure text and will
                            default to using Unicode to store characters.  If kTXNWillDefaultToCarbonEventBit is set,
                            then MLTE will use carbon events by default and apple event will not be supported.
  **********************************************************************************************************************
}
{
 *  TXNVersionInformation()
 *
 *  Availability:
 *    Non-Carbon CFM:   in Textension 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TXNVersionInformation(var oFeatureFlags: TXNFeatureBits): TXNVersionValue; external name '_TXNVersionInformation';

{
  ****************************************************************************************
    TXNPointToOffset


    Input:
        iTXNObject: An opaque TXNObject obtained from TXNNewObject.
        iPoint:     a point (in local coord.)
    Output:
        TXNOffset   :   Offset corresponding to the point
        OSStatus:   Memory, out of bounds errors.(if the point is out of the ViewRect)
  ****************************************************************************************
}
{
 *  TXNPointToOffset()
 *
 *  Availability:
 *    Non-Carbon CFM:   in Textension 1.1 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TXNPointToOffset(iTXNObject: TXNObject; iPoint: Point; var oOffset: TXNOffset): OSStatus; external name '_TXNPointToOffset';


{
  ****************************************************************************************
    TXNOffsetToPoint


    Input:
        iTXNObject: An opaque TXNObject obtained from TXNNewObject.
        iOffset:    an offset
    Output:
        Point   :   Point corresponding to the offset iOffset.
        OSStatus:   Memory, out of bounds errors.
  ****************************************************************************************
}
{
 *  TXNOffsetToPoint()
 *
 *  Availability:
 *    Non-Carbon CFM:   in Textension 1.1 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TXNOffsetToPoint(iTXNObject: TXNObject; iOffset: TXNOffset; var oPoint: Point): OSStatus; external name '_TXNOffsetToPoint';


{
  ****************************************************************************************
    TXNDrawUnicodeTextBox
        Draws an unicode string in the specified rectangle. Client is supposed to do an
        eraseRect if needed. The drawing will be clipped to the rect unless the client specifies
        a rotation.
        Use kTXNUseVerticalTextMask to display text vertically (no need to use the kRotate flag in this case

    Input:
        iText       :   Ptr to an unicode string (UTF16 chars)
        iLen        :   number of UniChars. (this is not the size of Ptr)
        ioBox       :   Text box where the text will be displayed
        iStyle      :   Optional - Style to use to display the text
                        (if NULL is passed, we'll use whatever is in the current grafport)
        iOptions    :   Optional - check the struct at the beginning of this file.
    Output:
        ioBox   :   iobox.bottom will be updated to reflect the total height of the text
                    (iobox.left will be updated if kTXNUseVerticalTextMask is used)
        OSStatus:   Memory errors.
  ****************************************************************************************
}
{
 *  TXNDrawUnicodeTextBox()
 *
 *  Availability:
 *    Non-Carbon CFM:   in Textension 1.1 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TXNDrawUnicodeTextBox(iText: ConstUniCharPtr; iLen: UniCharCount; var ioBox: Rect; iStyle: ATSUStyle; ioOptions: TXNTextBoxOptionsDataPtr): OSStatus; external name '_TXNDrawUnicodeTextBox';


{
  ****************************************************************************************
    TXNDrawCFStringTextBox
        Same as TXNDrawUnicodeTextBox above.  The obvious difference is that the text
        parameter is a CFStringRef.

    Input:
        iText       :   A CFStringRef. See CFBase.h and CFString.h
        ioBox       :   Text box where the text has to be displayed
        iStyle      :   Optional - Style to use to display the text
                        (if NULL is passed, we'll use whatever is in the current grafport)
        iOptions    :   Optional - check the struct at the beginning of this file.
    Output:
        ioBox   :   iobox.bottom will be updated to reflect the total height of the text
                    (iobox.left will be updated if kTXNUseVerticalTextMask is used)
        OSStatus:   Memory errors.
  ****************************************************************************************
}
{
 *  TXNDrawCFStringTextBox()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TXNDrawCFStringTextBox(iText: CFStringRef; var ioBox: Rect; iStyle: ATSUStyle; ioOptions: TXNTextBoxOptionsDataPtr): OSStatus; external name '_TXNDrawCFStringTextBox';


{
  ***************************************************************************************************************
    TXNGetLineCount
    Get the total number of lines in the TXNObject.
    Input:
        iTXNObject:         opaque TXNObject.
    Output:
        OSStatus:           error.  (ParamErr for invalid TXNObject)
        oLineTotal          total number of lines in the object (0 based)
  ***************************************************************************************************************
}
{
 *  TXNGetLineCount()
 *
 *  Availability:
 *    Non-Carbon CFM:   in Textension 1.1 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TXNGetLineCount(iTXNObject: TXNObject; var oLineTotal: ItemCount): OSStatus; external name '_TXNGetLineCount';

{
  ***************************************************************************************************************
    TXNGetLineMetrics
    Get the metrics for the specified line.
    Input:
        iTXNObject:         opaque TXNObject.
        iLineNumber:        the line we want the metrics from. (0 based)
    Output:
        OSStatus:           error.  (ParamErr for invalid TXNObject or invalid line)
        oLineWidth          Line Width (fixed)
        oLineHeight         Line Height (ascent+descent)
  ***************************************************************************************************************
}
{
 *  TXNGetLineMetrics()
 *
 *  Availability:
 *    Non-Carbon CFM:   in Textension 1.1 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TXNGetLineMetrics(iTXNObject: TXNObject; iLineNumber: UInt32; var oLineWidth: Fixed; var oLineHeight: Fixed): OSStatus; external name '_TXNGetLineMetrics';

{
 *  TXNGetActionChangeCount()
 *
 *  Discussion:
 *    Retrieves the number of times the specified action(s) have
 *    occurred. Explicit call to TXNClearActionChangeCount is needed
 *    when the counter(s) have to be reset.
 *
 *  Parameters:
 *
 *    iTXNObject:
 *      Opaque TXNObject obtained from TXNNewObject.
 *
 *    iOptions:
 *      Specify the the type of action changes to be include when
 *      retrieving the count.  Choose from the TXNOptions.
 *
 *    oCount:
 *      The number of counts returned by the function.
 *
 *  Result:
 *    errors
 *
 *  Availability:
 *    Non-Carbon CFM:   in Textension 1.3 and later
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.1 and later
 }
function TXNGetActionChangeCount(iTXNObject: TXNObject; iOptions: TXNCountOptions; var oCount: ItemCount): OSStatus; external name '_TXNGetActionChangeCount';


{
 *  TXNClearActionChangeCount()
 *
 *  Discussion:
 *    Reset the specified action counter(s) to zero. Use kAllCountMask
 *    to reset everything.
 *
 *  Parameters:
 *
 *    iTXNObject:
 *      Opaque TXNObject obtained from TXNNewObject.
 *
 *    iOptions:
 *      Specify the the type of action changes to be include when
 *      resetting the count.  Choose from the TXNOptions.
 *
 *  Result:
 *    errors
 *
 *  Availability:
 *    Non-Carbon CFM:   in Textension 1.3 and later
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.1 and later
 }
function TXNClearActionChangeCount(iTXNObject: TXNObject; iOptions: TXNCountOptions): OSStatus; external name '_TXNClearActionChangeCount';


{
 *  TXNIsObjectAttachedToSpecificWindow()
 *
 *  Discussion:
 *    A utility function that allows a caller to check a TXNObject to
 *    see if it is attached to a specific window.
 *
 *  Parameters:
 *
 *    iTXNObject:
 *      Opaque TXNObject obtained from TXNNewObject.
 *
 *    iWindow:
 *      The window to check attachment against.
 *
 *    oAttached:
 *      true if the object is attached to the given window, false
 *      otherwise.
 *
 *  Result:
 *    An operating system status code.
 *
 *  Availability:
 *    Non-Carbon CFM:   in Textension 1.2 and later
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 }
function TXNIsObjectAttachedToSpecificWindow(iTXNObject: TXNObject; iWindow: WindowRef; var oAttached: boolean): OSStatus; external name '_TXNIsObjectAttachedToSpecificWindow';

{
 *  TXNSetRectBounds()
 *
 *  Discussion:
 *    Set the View rectangle and or the Destination rectangle.  The
 *    View rectangle controls the text you see.  The Destination
 *    rectangle controls how text is laid out.  The Scrollbar is drawn
 *    inside the View rectangle.
 *
 *  Parameters:
 *
 *    iTXNObject:
 *      Opaque TXNObject obtained from TXNNewObject.
 *
 *    iViewRect:
 *      The new view rectangle.  If you do not want to change the view
 *      rectangle pass NULL.
 *
 *    iDestinationRect:
 *      The new destination rectangle.  Pass NULL if you don't want to
 *      change the destination retangle.
 *
 *    iUpdate:
 *      If you would like the the text and where the scrollbars are
 *      placed recalculated and redrawn pass true.  If you prefer to
 *      wait on this pass false.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.5 and later
 *    Mac OS X:         in version 10.1 and later
 }
procedure TXNSetRectBounds(iTXNObject: TXNObject; iViewRect: {Const}RectPtr; iDestinationRect: {Const}TXNLongRectPtr; iUpdate: boolean); external name '_TXNSetRectBounds';

{
 *  TXNGetRectBounds()
 *
 *  Discussion:
 *    Get the values for the current View rectangle, destination
 *    rectangle and text rectangle.
 *
 *  Parameters:
 *
 *    iTXNObject:
 *      Opaque TXNObject obtained from TXNNewObject.
 *
 *    oViewRect:
 *      The current view rectangle
 *
 *    oDestinationRect:
 *      The current destination rectangle
 *
 *    oTextRect:
 *      The smallest rectangle needed to contain the current text.
 *      This rectangle is calculated by walking the lines of text and
 *      measuring each line.  So this can be expensive.  The width of
 *      this rectangle will be the width of the longest line in the
 *      text.
 *
 *  Result:
 *    errors
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.5 and later
 *    Mac OS X:         in version 10.1 and later
 }
function TXNGetRectBounds(iTXNObject: TXNObject; oViewRect: RectPtr; oDestinationRect: TXNLongRectPtr; oTextRect: TXNLongRectPtr): OSStatus; external name '_TXNGetRectBounds';


{
 *  TXNRecalcTextLayout()
 *
 *  Discussion:
 *    Call this if you called TXNSetRectBounds with the iUpdate
 *    parameter set to false. This function will recalculate the text
 *    layout based on the view and destination rectangles you set.  It
 *    will also recalcuate where the scrollbars if any should be
 *    placed. Finally an update event will be generated so that the
 *    TXNObject is redrawn.
 *
 *  Parameters:
 *
 *    iTXNObject:
 *      Opaque TXNObject obtained from TXNNewObject.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.5 and later
 *    Mac OS X:         in version 10.1 and later
 }
procedure TXNRecalcTextLayout(iTXNObject: TXNObject); external name '_TXNRecalcTextLayout';




{$ALIGN MAC68K}
{#POP}
{unit Printing}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}


const
    kFirstPageMin               = 1;                            {  min value for first page  }
    kLastPageMax                = 32767;                        {  max value for last page  }

    iPFMaxPgs                   = 128;
    iPrPgFract                  = 120;                          { Page scale factor. ptPgSize (below) is in units of 1/iPrPgFract }
    iPrPgFst                    = 1;                            { Page range constants }
    iPrPgMax                    = 9999;
    iPrRelease                  = 3;                            { Current version number of the code. }
    iPrSavPFil                  = -1;
    iPrAbort                    = $0080;
    iPrDevCtl                   = 7;                            { The PrDevCtl Proc's ctl number }
    lPrReset                    = $00010000;                    { The PrDevCtl Proc's CParam for reset }
    lPrLineFeed                 = $00030000;
    lPrLFStd                    = $0003FFFF;                    { The PrDevCtl Proc's CParam for std paper advance }
    lPrLFSixth                  = $0003FFFF;
    lPrPageEnd                  = $00020000;                    { The PrDevCtl Proc's CParam for end page }
    lPrDocOpen                  = $00010000;
    lPrPageOpen                 = $00040000;
    lPrPageClose                = $00020000;
    lPrDocClose                 = $00050000;
    iFMgrCtl                    = 8;                            { The FMgr's Tail-hook Proc's ctl number }
    iMscCtl                     = 9;                            { The FMgr's Tail-hook Proc's ctl number }
    iPvtCtl                     = 10;                           { The FMgr's Tail-hook Proc's ctl number }

    {     Error Codes moved to Errors.(hap)     }
    pPrGlobals                  = $00000944;                    { The PrVars lo mem area: }
    bDraftLoop                  = 0;
    bSpoolLoop                  = 1;
    bUser1Loop                  = 2;
    bUser2Loop                  = 3;
    fNewRunBit                  = 2;
    fHiResOK                    = 3;
    fWeOpenedRF                 = 4;                            { Driver constants  }
    iPrBitsCtl                  = 4;
    lScreenBits                 = 0;
    lPaintBits                  = 1;
    lHiScreenBits               = $00000002;                    { The Bitmap Print Proc's Screen Bitmap param }
    lHiPaintBits                = $00000003;                    { The Bitmap Print Proc's Paint [sq pix] param }
    iPrIOCtl                    = 5;
    iPrEvtCtl                   = 6;                            { The PrEvent Proc's ctl number }
    lPrEvtAll                   = $0002FFFD;                    { The PrEvent Proc's CParam for the entire screen }
    lPrEvtTop                   = $0001FFFD;                    { The PrEvent Proc's CParam for the top folder }
    iPrDrvrRef                  = -3;

    getRslDataOp                = 4;
    setRslOp                    = 5;
    draftBitsOp                 = 6;
    noDraftBitsOp               = 7;
    getRotnOp                   = 8;
    NoSuchRsl                   = 1;
    OpNotImpl                   = 2;                            { the driver doesn't support this opcode }
    RgType1                     = 1;


type
    TFeed                       = SInt8;
const
    feedCut                     = 0;
    feedFanfold                 = 1;
    feedMechCut                 = 2;
    feedOther                   = 3;


type
    TScan                       = SInt8;
const
    scanTB                      = 0;
    scanBT                      = 1;
    scanLR                      = 2;
    scanRL                      = 3;

    {    A Rect Ptr     }

type
    TPRect                              = ^Rect;
    TPRectPtr                           = ^TPRect;
    PrIdleProcPtr = procedure;

    PItemProcPtr = procedure(theDialog: DialogRef; item: SInt16);

    PrIdleUPP = ^SInt32; { an opaque UPP }
    PItemUPP = ^SInt32; { an opaque UPP }

const
    uppPrIdleProcInfo = $00000000;
    uppPItemProcInfo = $000002C0;


type
    TPPrPort    = ^SInt32; { an opaque 32-bit type }
    TPPrPortPtr = ^TPPrPort;  { when a var xx:TPPrPort parameter can be nil, it is changed to xx: TPPrPortPtr }

    TPPrPortRef                         = TPPrPort;
    {    Printing Graf Port. All printer imaging, whether spooling, banding, etc, happens "thru" a GrafPort.
      This is the "PrPeek" record.  }
    TPrInfoPtr = ^TPrInfo;
    TPrInfo = record
        iDev:                   SInt16;                             { Font mgr/QuickDraw device code }
        iVRes:                  SInt16;                             { Resolution of device, in device coordinates }
        iHRes:                  SInt16;                             { ..note: V before H => compatable with Point. }
        rPage:                  Rect;                                   { The page (printable) rectangle in device coordinates. }
    end;

    TPPrInfo                            = ^TPrInfo;
    {    Print Info Record: The parameters needed for page composition.     }
    TPrStlPtr = ^TPrStl;
    TPrStl = record
        wDev:                   SInt16;
        iPageV:                 SInt16;
        iPageH:                 SInt16;
        bPort:                  SInt8;
        feed:                   SInt8;
    end;

    TPPrStl                             = ^TPrStl;
    TPrXInfoPtr = ^TPrXInfo;
    TPrXInfo = record
        iRowBytes:              SInt16;
        iBandV:                 SInt16;
        iBandH:                 SInt16;
        iDevBytes:              SInt16;
        iBands:                 SInt16;
        bPatScale:              SInt8;
        bUlThick:               SInt8;
        bUlOffset:              SInt8;
        bUlShadow:              SInt8;
        scan:                   SInt8;
        bXInfoX:                SInt8;
    end;

    TPPrXInfo                           = ^TPrXInfo;
    TPrJobPtr = ^TPrJob;
    TPrJob = record
        iFstPage:               SInt16;                             { Page Range. }
        iLstPage:               SInt16;
        iCopies:                SInt16;                             { No. copies. }
        bJDocLoop:              SInt8;                                  { The Doc style: Draft, Spool, .., and .. }
        fFromUsr:               boolean;                                { Printing from an User's App (not PrApp) flag }
        pIdleProc:              PrIdleUPP;                              { The Proc called while waiting on IO etc. }
        pFileName:              StringPtr;                              { Spool File Name: NIL for default. }
        iFileVol:               SInt16;                             { Spool File vol, set to 0 initially }
        bFileVers:              SInt8;                                  { Spool File version, set to 0 initially }
        bJobX:                  SInt8;                                  { An eXtra byte. }
    end;

    TPPrJob                             = ^TPrJob;
    {    Print Job: Print "form" for a single print request.    }
    TPrFlag1Ptr = ^TPrFlag1;
    TPrFlag1 = packed record
        f15:                    boolean;
        f14:                    boolean;
        f13:                    boolean;
        f12:                    boolean;
        f11:                    boolean;
        f10:                    boolean;
        f9:                     boolean;
        f8:                     boolean;
        f7:                     boolean;
        f6:                     boolean;
        f5:                     boolean;
        f4:                     boolean;
        f3:                     boolean;
        f2:                     boolean;
        fLstPgFst:              boolean;
        fUserScale:             boolean;
    end;

    TPrintPtr = ^TPrint;
    TPrint = record
        iPrVersion:             SInt16;                             { (2) Printing software version }
        prInfo:                 TPrInfo;                                { (14) the PrInfo data associated with the current style. }
        rPaper:                 Rect;                                   { (8) The paper rectangle [offset from rPage] }
        prStl:                  TPrStl;                                 { (8)  This print request's style. }
        prInfoPT:               TPrInfo;                                { (14)  Print Time Imaging metrics }
        prXInfo:                TPrXInfo;                               { (16)  Print-time (expanded) Print info record. }
        prJob:                  TPrJob;                                 { (20) The Print Job request (82)  Total of the above; 120-82 = 38 bytes needed to fill 120 }
        case SInt16 of
        0: (
            printX:             array [1..19] of SInt16;
            );
        1: (
            prFlag1:            TPrFlag1;
            iZoomMin:           SInt16;
            iZoomMax:           SInt16;
            hDocName:           StringHandle;
           );
    end;

    TPPrint                             = ^TPrint;
    THPrint                             = ^TPPrint;
    TPrStatusPtr = ^TPrStatus;
    TPrStatus = record
        iTotPages:              SInt16;                             { Total pages in Print File. }
        iCurPage:               SInt16;                             { Current page number }
        iTotCopies:             SInt16;                             { Total copies requested }
        iCurCopy:               SInt16;                             { Current copy number }
        iTotBands:              SInt16;                             { Total bands per page. }
        iCurBand:               SInt16;                             { Current band number }
        fPgDirty:               boolean;                                { True if current page has been written to. }
        fImaging:               boolean;                                { Set while in band's DrawPic call. }
        hPrint:                 THPrint;                                { Handle to the active Printer record }
        pPrPort:                TPPrPort;                               { Ptr to the active PrPort }
        hPic:                   PicHandle;                              { Handle to the active Picture }
    end;

    TPPrStatus                          = ^TPrStatus;
    TPPrStatusRef                       = TPPrStatus;

    {    Print Status: Print information during printing.   }
    TPfPgDirPtr = ^TPfPgDir;
    TPfPgDir = record
        iPages:                 SInt16;
        iPgPos:                 array [0..128] of SInt32;               { array [0..iPfMaxPgs] of SInt32 }
    end;

    TPPfPgDir                           = ^TPfPgDir;
    THPfPgDir                           = ^TPPfPgDir;
    {    PicFile = a TPfHeader followed by n QuickDraw Pics (whose PicSize is invalid!)     }
    {    This is the Printing Dialog Record. Only used by folks appending their own
       DITLs to the print dialogs.  Print Dialog: The Dialog Stream object.     }
    TPPrDlg    = ^SInt32; { an opaque 32-bit type }
    TPPrDlgPtr = ^TPPrDlg;  { when a var xx:TPPrDlg parameter can be nil, it is changed to xx: TPPrDlgPtr }

    TPPrDlgRef                          = TPPrDlg;
    PDlgInitProcPtr = function(hPrint: THPrint): TPPrDlgRef;

    PDlgInitUPP = ^SInt32; { an opaque UPP }

const
    uppPDlgInitProcInfo = $000000F0;


type
    TGnlDataPtr = ^TGnlData;
    TGnlData = record
        iOpCode:                SInt16;
        iError:                 SInt16;
        lReserved:              SInt32;                             { more fields here depending on call }
    end;

    TRslRgPtr = ^TRslRg;
    TRslRg = record
        iMin:                   SInt16;
        iMax:                   SInt16;
    end;

    TRslRecPtr = ^TRslRec;
    TRslRec = record
        iXRsl:                  SInt16;
        iYRsl:                  SInt16;
    end;

    TGetRslBlkPtr = ^TGetRslBlk;
    TGetRslBlk = record
        iOpCode:                SInt16;
        iError:                 SInt16;
        lReserved:              SInt32;
        iRgType:                SInt16;
        xRslRg:                 TRslRg;
        yRslRg:                 TRslRg;
        iRslRecCnt:             SInt16;
        rgRslRec:               array [1..27] of TRslRec;
    end;

    TSetRslBlkPtr = ^TSetRslBlk;
    TSetRslBlk = record
        iOpCode:                SInt16;
        iError:                 SInt16;
        lReserved:              SInt32;
        hPrint:                 THPrint;
        iXRsl:                  SInt16;
        iYRsl:                  SInt16;
    end;

    TDftBitsBlkPtr = ^TDftBitsBlk;
    TDftBitsBlk = record
        iOpCode:                SInt16;
        iError:                 SInt16;
        lReserved:              SInt32;
        hPrint:                 THPrint;
    end;

    TGetRotnBlkPtr = ^TGetRotnBlk;
    TGetRotnBlk = record
        iOpCode:                SInt16;
        iError:                 SInt16;
        lReserved:              SInt32;
        hPrint:                 THPrint;
        fLandscape:             boolean;
        bXtra:                  SInt8;
    end;




{$ALIGN MAC68K}
{#POP}
{unit Sound}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}

{
                        * * *  N O T E  * * *

    This file has been updated to include Sound Manager 3.3 interfaces.

    Some of the Sound Manager 3.0 interfaces were not put into the InterfaceLib
    that originally shipped with the PowerMacs. These missing functions and the
    new 3.3 interfaces have been released in the SoundLib library for PowerPC
    developers to link with. The runtime library for these functions are
    installed by the Sound Manager. The following functions are found in SoundLib.

        GetCompressionInfo(), GetSoundPreference(), SetSoundPreference(),
        UnsignedFixedMulDiv(), SndGetInfo(), SndSetInfo(), GetSoundOutputInfo(),
        SetSoundOutputInfo(), GetCompressionName(), SoundConverterOpen(),
        SoundConverterClose(), SoundConverterGetBufferSizes(), SoundConverterBeginConversion(),
        SoundConverterConvertBuffer(), SoundConverterEndConversion(),
        AudioGetBass(), AudioGetInfo(), AudioGetMute(), AudioGetOutputDevice(),
        AudioGetTreble(), AudioGetVolume(), AudioMuteOnEvent(), AudioSetBass(),
        AudioSetMute(), AudioSetToDefaults(), AudioSetTreble(), AudioSetVolume(),
        OpenMixerSoundComponent(), CloseMixerSoundComponent(), SoundComponentAddSource(),
        SoundComponentGetInfo(), SoundComponentGetSource(), SoundComponentGetSourceData(),
        SoundComponentInitOutputDevice(), SoundComponentPauseSource(),
        SoundComponentPlaySourceBuffer(), SoundComponentRemoveSource(),
        SoundComponentSetInfo(), SoundComponentSetOutput(), SoundComponentSetSource(),
        SoundComponentStartSource(), SoundComponentStopSource(),
        ParseAIFFHeader(), ParseSndHeader(), SoundConverterGetInfo(), SoundConverterSetInfo()
}
{
    Interfaces for Sound Driver, !!! OBSOLETE and NOT SUPPORTED !!!

    These items are no longer defined, but appear here so that someone
    searching the interfaces might find them. If you are using one of these
    items, you must change your code to support the Sound Manager.

        swMode, ftMode, ffMode
        FreeWave, FFSynthRec, Tone, SWSynthRec, Wave, FTSoundRec
        SndCompletionProcPtr
        StartSound, StopSound, SoundDone
        SetSoundVol, GetSoundVol
}
{
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   constants
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
}
const twelfthRootTwo = 1.05946309435;


const
    soundListRsrc               = $736E6420 (* 'snd ' *);                       { Resource type used by Sound Manager }

    kSimpleBeepID               = 1;                            { reserved resource ID for Simple Beep }

    rate48khz                   = $BB800000;                    { 48000.00000 in fixed-point }
    rate44khz                   = $AC440000;                    { 44100.00000 in fixed-point }
    rate32khz                   = $7D000000;                    { 32000.00000 in fixed-point }
    rate22050hz                 = $56220000;                    { 22050.00000 in fixed-point }
    rate22khz                   = $56EE8BA3;                    { 22254.54545 in fixed-point }
    rate16khz                   = $3E800000;                    { 16000.00000 in fixed-point }
    rate11khz                   = $2B7745D1;                    { 11127.27273 in fixed-point }
    rate11025hz                 = $2B110000;                    { 11025.00000 in fixed-point }
    rate8khz                    = $1F400000;                    {  8000.00000 in fixed-point }

    {   synthesizer numbers for SndNewChannel   }
    sampledSynth                = 5;                            { sampled sound synthesizer }


    kMiddleC                    = 60;                           { MIDI note value for middle C }

    kNoVolume                   = 0;                            { setting for no sound volume }
    kFullVolume                 = $0100;                        { 1.0, setting for full hardware output volume }

    stdQLength                  = 128;

    dataOffsetFlag              = $8000;

    kUseOptionalOutputDevice    = -1;                           { only for Sound Manager 3.0 or later }

    notCompressed               = 0;                            { compression ID's }
    fixedCompression            = -1;                           { compression ID for fixed-sized compression }
    variableCompression         = -2;                           { compression ID for variable-sized compression }

    twoToOne                    = 1;
    eightToThree                = 2;
    threeToOne                  = 3;
    sixToOne                    = 4;
    sixToOnePacketSize          = 8;
    threeToOnePacketSize        = 16;

    stateBlockSize              = 64;
    leftOverBlockSize           = 32;

    firstSoundFormat            = $0001;                        { general sound format }
    secondSoundFormat           = $0002;                        { special sampled sound format (HyperCard) }


    sysBeepDisable              = $0000;                        { SysBeep() enable flags }
    sysBeepEnable               = $01;
    sysBeepSynchronous          = $02;                          { if bit set, make alert sounds synchronous }

    unitTypeNoSelection         = $FFFF;                        { unitTypes for AudioSelection.unitType }
    unitTypeSeconds             = $0000;

    stdSH                       = $00;                          { Standard sound header encode value }
    extSH                       = $FF;                          { Extended sound header encode value }
    cmpSH                       = $FE;                          { Compressed sound header encode value }

    {   command numbers for SndDoCommand and SndDoImmediate }
    nullCmd                     = 0;
    quietCmd                    = 3;
    flushCmd                    = 4;
    reInitCmd                   = 5;
    waitCmd                     = 10;
    pauseCmd                    = 11;
    resumeCmd                   = 12;
    callBackCmd                 = 13;
    syncCmd                     = 14;
    availableCmd                = 24;
    versionCmd                  = 25;
    volumeCmd                   = 46;                           { sound manager 3.0 or later only }
    getVolumeCmd                = 47;                           { sound manager 3.0 or later only }
    clockComponentCmd           = 50;                           { sound manager 3.2.1 or later only }
    getClockComponentCmd        = 51;                           { sound manager 3.2.1 or later only }
    scheduledSoundCmd           = 52;                           { sound manager 3.3 or later only }
    linkSoundComponentsCmd      = 53;                           { sound manager 3.3 or later only }
    soundCmd                    = 80;
    bufferCmd                   = 81;
    rateMultiplierCmd           = 86;
    getRateMultiplierCmd        = 87;



    initChanLeft                = $0002;                        { left stereo channel }
    initChanRight               = $0003;                        { right stereo channel }
    initNoInterp                = $0004;                        { no linear interpolation }
    initNoDrop                  = $0008;                        { no drop-sample conversion }
    initMono                    = $0080;                        { monophonic channel }
    initStereo                  = $00C0;                        { stereo channel }
    initMACE3                   = $0300;                        { MACE 3:1 }
    initMACE6                   = $0400;                        { MACE 6:1 }
    initPanMask                 = $0003;                        { mask for right/left pan values }
    initSRateMask               = $0030;                        { mask for sample rate values }
    initStereoMask              = $00C0;                        { mask for mono/stereo values }
    initCompMask                = $FF00;                        { mask for compression IDs }

    {   Get&Set Sound Information Selectors }
    siActiveChannels            = $63686163 (* 'chac' *);                       { active channels }
    siActiveLevels              = $6C6D6163 (* 'lmac' *);                       { active meter levels }
    siAGCOnOff                  = $61676320 (* 'agc ' *);                       { automatic gain control state }
    siAsync                     = $6173796E (* 'asyn' *);                       { asynchronous capability }
    siAVDisplayBehavior         = $61766462 (* 'avdb' *);
    siChannelAvailable          = $63686176 (* 'chav' *);                       { number of channels available }
    siCompressionAvailable      = $636D6176 (* 'cmav' *);                       { compression types available }
    siCompressionChannels       = $63706374 (* 'cpct' *);                       { compressor's number of channels }
    siCompressionFactor         = $636D6661 (* 'cmfa' *);                       { current compression factor }
    siCompressionHeader         = $636D6864 (* 'cmhd' *);                       { return compression header }
    siCompressionNames          = $636E616D (* 'cnam' *);                       { compression type names available }
    siCompressionParams         = $65766177 (* 'evaw' *);                       { compression parameters }
    siCompressionSampleRate     = $63707274 (* 'cprt' *);                       { compressor's sample rate }
    siCompressionType           = $636F6D70 (* 'comp' *);                       { current compression type }
    siContinuous                = $636F6E74 (* 'cont' *);                       { continous recording }
    siDecompressionParams       = $77617665 (* 'wave' *);                       { decompression parameters }
    siDeviceBufferInfo          = $6462696E (* 'dbin' *);                       { size of interrupt buffer }
    siDeviceConnected           = $64636F6E (* 'dcon' *);                       { input device connection status }
    siDeviceIcon                = $69636F6E (* 'icon' *);                       { input device icon }
    siDeviceName                = $6E616D65 (* 'name' *);                       { input device name }
    siEQSpectrumBands           = $65717362 (* 'eqsb' *);                       {  number of spectrum bands }
    siEQSpectrumLevels          = $65716C76 (* 'eqlv' *);                       {  gets spectum meter levels }
    siEQSpectrumOnOff           = $65716C6F (* 'eqlo' *);                       {  turn on/off spectum meter levels }
    siEQSpectrumResolution      = $65717273 (* 'eqrs' *);                       {  set the resolution of the FFT, 0 = low res (<=16 bands), 1 = high res (16-64 bands) }
    siEQToneControlGain         = $65717467 (* 'eqtg' *);                       {  set the bass and treble gain }
    siEQToneControlOnOff        = $65717463 (* 'eqtc' *);                       {  turn on equalizer attenuation }
    siHardwareBalance           = $6862616C (* 'hbal' *);
    siHardwareBalanceSteps      = $68626C73 (* 'hbls' *);
    siHardwareBass              = $68626173 (* 'hbas' *);
    siHardwareBassSteps         = $68627374 (* 'hbst' *);
    siHardwareBusy              = $68776273 (* 'hwbs' *);                       { sound hardware is in use }
    siHardwareFormat            = $6877666D (* 'hwfm' *);                       { get hardware format }
    siHardwareMute              = $686D7574 (* 'hmut' *);                       { mute state of all hardware }
    siHardwareMuteNoPrefs       = $686D6E70 (* 'hmnp' *);                       { mute state of all hardware, but don't store in prefs  }
    siHardwareTreble            = $68747262 (* 'htrb' *);
    siHardwareTrebleSteps       = $68777473 (* 'hwts' *);
    siHardwareVolume            = $68766F6C (* 'hvol' *);                       { volume level of all hardware }
    siHardwareVolumeSteps       = $68737470 (* 'hstp' *);                       { number of volume steps for hardware }
    siHeadphoneMute             = $706D7574 (* 'pmut' *);                       { mute state of headphones }
    siHeadphoneVolume           = $70766F6C (* 'pvol' *);                       { volume level of headphones }
    siHeadphoneVolumeSteps      = $68647374 (* 'hdst' *);                       { number of volume steps for headphones }
    siInputAvailable            = $696E6176 (* 'inav' *);                       { input sources available }
    siInputGain                 = $6761696E (* 'gain' *);                       { input gain }
    siInputSource               = $736F7572 (* 'sour' *);                       { input source selector }
    siInputSourceNames          = $736E616D (* 'snam' *);                       { input source names }
    siLevelMeterOnOff           = $6C6D6574 (* 'lmet' *);                       { level meter state }
    siModemGain                 = $6D676169 (* 'mgai' *);                       { modem input gain }
    siMonitorAvailable          = $6D6E6176 (* 'mnav' *);
    siMonitorSource             = $6D6F6E73 (* 'mons' *);
    siNumberChannels            = $6368616E (* 'chan' *);                       { current number of channels }
    siOptionsDialog             = $6F707464 (* 'optd' *);                       { display options dialog }
    siOSTypeInputSource         = $696E7074 (* 'inpt' *);                       { input source by OSType }
    siOSTypeInputAvailable      = $696E6176 (* 'inav' *);                       { list of available input source OSTypes }
    siOutputDeviceName          = $6F6E616D (* 'onam' *);                       { output device name }
    siPlayThruOnOff             = $706C7468 (* 'plth' *);                       { playthrough state }
    siPostMixerSoundComponent   = $70736D78 (* 'psmx' *);                       { install post-mixer effect }
    siPreMixerSoundComponent    = $70726D78 (* 'prmx' *);                       { install pre-mixer effect }
    siQuality                   = $7175616C (* 'qual' *);                       { quality setting }
    siRateMultiplier            = $726D756C (* 'rmul' *);                       { throttle rate setting }
    siRecordingQuality          = $7175616C (* 'qual' *);                       { recording quality }
    siSampleRate                = $73726174 (* 'srat' *);                       { current sample rate }
    siSampleRateAvailable       = $73726176 (* 'srav' *);                       { sample rates available }
    siSampleSize                = $7373697A (* 'ssiz' *);                       { current sample size }
    siSampleSizeAvailable       = $73736176 (* 'ssav' *);                       { sample sizes available }
    siSetupCDAudio              = $73756364 (* 'sucd' *);                       { setup sound hardware for CD audio }
    siSetupModemAudio           = $73756D64 (* 'sumd' *);                       { setup sound hardware for modem audio }
    siSlopeAndIntercept         = $666C6170 (* 'flap' *);                       { floating point variables for conversion }
    siSoundClock                = $73636C6B (* 'sclk' *);
    siUseThisSoundClock         = $73636C63 (* 'sclc' *);                       { sdev uses this to tell the mixer to use his sound clock }
    siSpeakerMute               = $736D7574 (* 'smut' *);                       { mute state of all built-in speaker }
    siSpeakerVolume             = $73766F6C (* 'svol' *);                       { volume level of built-in speaker }
    siSSpCPULoadLimit           = $33646C6C (* '3dll' *);
    siSSpLocalization           = $33646966 (* '3dif' *);
    siSSpSpeakerSetup           = $33647374 (* '3dst' *);
    siStereoInputGain           = $73676169 (* 'sgai' *);                       { stereo input gain }
    siSubwooferMute             = $626D7574 (* 'bmut' *);                       { mute state of sub-woofer }
    siTerminalType              = $74747970 (* 'ttyp' *);                       {  usb terminal type  }
    siTwosComplementOnOff       = $74776F73 (* 'twos' *);                       { two's complement state }
    siVendorProduct             = $7670726F (* 'vpro' *);                       {  vendor and product ID  }
    siVolume                    = $766F6C75 (* 'volu' *);                       { volume level of source }
    siVoxRecordInfo             = $766F7872 (* 'voxr' *);                       { VOX record parameters }
    siVoxStopInfo               = $766F7873 (* 'voxs' *);                       { VOX stop parameters }
    siWideStereo                = $77696465 (* 'wide' *);                       { wide stereo setting }
    siSupportedExtendedFlags    = $6578666C (* 'exfl' *);                       { which flags are supported in Extended sound data structures }
    siRateConverterRollOffSlope = $72636462 (* 'rcdb' *);                       { the roll-off slope for the rate converter's filter, in whole dB as a long this value is a long whose range is from 20 (worst quality/fastest performance) to 90 (best quality/slowest performance) }
    siOutputLatency             = $6F6C7465 (* 'olte' *);                       { latency of sound output component }

    siCloseDriver               = $636C6F73 (* 'clos' *);                       { reserved for internal use only }
    siInitializeDriver          = $696E6974 (* 'init' *);                       { reserved for internal use only }
    siPauseRecording            = $70617573 (* 'paus' *);                       { reserved for internal use only }
    siUserInterruptProc         = $75736572 (* 'user' *);                       { reserved for internal use only }

    {  input source Types }
    kInvalidSource              = $FFFFFFFF;                    { this source may be returned from GetInfo if no other source is the monitored source }
    kNoSource                   = $6E6F6E65 (* 'none' *);                       { no source selection }
    kCDSource                   = $63642020 (* 'cd  ' *);                       { internal CD player input }
    kExtMicSource               = $656D6963 (* 'emic' *);                       { external mic input }
    kSoundInSource              = $73696E6A (* 'sinj' *);                       { sound input jack }
    kRCAInSource                = $69726361 (* 'irca' *);                       { RCA jack input }
    kTVFMTunerSource            = $7476666D (* 'tvfm' *);
    kDAVInSource                = $69646176 (* 'idav' *);                       { DAV analog input }
    kIntMicSource               = $696D6963 (* 'imic' *);                       { internal mic input }
    kMediaBaySource             = $6D626179 (* 'mbay' *);                       { media bay input }
    kModemSource                = $6D6F646D (* 'modm' *);                       { modem input (internal modem on desktops, PCI input on PowerBooks) }
    kPCCardSource               = $70636D20 (* 'pcm ' *);                       { PC Card pwm input }
    kZoomVideoSource            = $7A767063 (* 'zvpc' *);                       { zoom video input }
    kDVDSource                  = $64766461 (* 'dvda' *);                       {  DVD audio input }
    kMicrophoneArray            = $6D696361 (* 'mica' *);                       {  microphone array }

    { Sound Component Types and Subtypes }
    kNoSoundComponentType       = $2A2A2A2A (* '****' *);
    kSoundComponentType         = $73696674 (* 'sift' *);                       { component type }
    kSoundComponentPPCType      = $6E696674 (* 'nift' *);                       { component type for PowerPC code }
    kRate8SubType               = $72617462 (* 'ratb' *);                       { 8-bit rate converter }
    kRate16SubType              = $72617477 (* 'ratw' *);                       { 16-bit rate converter }
    kConverterSubType           = $636F6E76 (* 'conv' *);                       { sample format converter }
    kSndSourceSubType           = $736F7572 (* 'sour' *);                       { generic source component }
    kMixerType                  = $6D697872 (* 'mixr' *);
    kMixer8SubType              = $6D697862 (* 'mixb' *);                       { 8-bit mixer }
    kMixer16SubType             = $6D697877 (* 'mixw' *);                       { 16-bit mixer }
    kSoundInputDeviceType       = $73696E70 (* 'sinp' *);                       { sound input component }
    kWaveInSubType              = $77617669 (* 'wavi' *);                       { Windows waveIn }
    kWaveInSnifferSubType       = $7769736E (* 'wisn' *);                       { Windows waveIn sniffer }
    kSoundOutputDeviceType      = $73646576 (* 'sdev' *);                       { sound output component }
    kClassicSubType             = $636C6173 (* 'clas' *);                       { classic hardware, i.e. Mac Plus }
    kASCSubType                 = $61736320 (* 'asc ' *);                       { Apple Sound Chip device }
    kDSPSubType                 = $64737020 (* 'dsp ' *);                       { DSP device }
    kAwacsSubType               = $61776163 (* 'awac' *);                       { Another of Will's Audio Chips device }
    kGCAwacsSubType             = $61776763 (* 'awgc' *);                       { Awacs audio with Grand Central DMA }
    kSingerSubType              = $73696E67 (* 'sing' *);                       { Singer (via Whitney) based sound }
    kSinger2SubType             = $736E6732 (* 'sng2' *);                       { Singer 2 (via Whitney) for Acme }
    kWhitSubType                = $77686974 (* 'whit' *);                       { Whit sound component for PrimeTime 3 }
    kSoundBlasterSubType        = $73626C73 (* 'sbls' *);                       { Sound Blaster for CHRP }
    kWaveOutSubType             = $7761766F (* 'wavo' *);                       { Windows waveOut }
    kWaveOutSnifferSubType      = $776F736E (* 'wosn' *);                       { Windows waveOut sniffer }
    kDirectSoundSubType         = $64736E64 (* 'dsnd' *);                       { Windows DirectSound }
    kDirectSoundSnifferSubType  = $6473736E (* 'dssn' *);                       { Windows DirectSound sniffer }
    kUNIXsdevSubType            = $756E3178 (* 'un1x' *);                       { UNIX base sdev }
    kUSBSubType                 = $75736220 (* 'usb ' *);                       { USB device }
    kBlueBoxSubType             = $62736E64 (* 'bsnd' *);                       { Blue Box sound component }
    kSoundCompressor            = $73636F6D (* 'scom' *);
    kSoundDecompressor          = $73646563 (* 'sdec' *);
    kAudioComponentType         = $6164696F (* 'adio' *);                       { Audio components and sub-types }
    kAwacsPhoneSubType          = $6870686E (* 'hphn' *);
    kAudioVisionSpeakerSubType  = $74656C63 (* 'telc' *);
    kAudioVisionHeadphoneSubType = $74656C68 (* 'telh' *);
    kPhilipsFaderSubType        = $74766176 (* 'tvav' *);
    kSGSToneSubType             = $73677330 (* 'sgs0' *);
    kSoundEffectsType           = $736E6678 (* 'snfx' *);                       { sound effects type }
    kEqualizerSubType           = $6571616C (* 'eqal' *);                       { frequency equalizer }
    kSSpLocalizationSubType     = $736E6433 (* 'snd3' *);

    { Format Types }
    kSoundNotCompressed         = $4E4F4E45 (* 'NONE' *);                       { sound is not compressed }
    k8BitOffsetBinaryFormat     = $72617720 (* 'raw ' *);                       { 8-bit offset binary }
    k16BitBigEndianFormat       = $74776F73 (* 'twos' *);                       { 16-bit big endian }
    k16BitLittleEndianFormat    = $736F7774 (* 'sowt' *);                       { 16-bit little endian }
    kFloat32Format              = $666C3332 (* 'fl32' *);                       { 32-bit floating point }
    kFloat64Format              = $666C3634 (* 'fl64' *);                       { 64-bit floating point }
    k24BitFormat                = $696E3234 (* 'in24' *);                       { 24-bit SInt16 }
    k32BitFormat                = $696E3332 (* 'in32' *);                       { 32-bit SInt16 }
    k32BitLittleEndianFormat    = $32336E69 (* '23ni' *);                       { 32-bit little endian SInt16  }
    kMACE3Compression           = $4D414333 (* 'MAC3' *);                       { MACE 3:1 }
    kMACE6Compression           = $4D414336 (* 'MAC6' *);                       { MACE 6:1 }
    kCDXA4Compression           = $63647834 (* 'cdx4' *);                       { CD/XA 4:1 }
    kCDXA2Compression           = $63647832 (* 'cdx2' *);                       { CD/XA 2:1 }
    kIMACompression             = $696D6134 (* 'ima4' *);                       { IMA 4:1 }
    kULawCompression            = $756C6177 (* 'ulaw' *);                       { µLaw 2:1 }
    kALawCompression            = $616C6177 (* 'alaw' *);                       { aLaw 2:1 }
    kMicrosoftADPCMFormat       = $6D730002;                    { Microsoft ADPCM - ACM code 2 }
    kDVIIntelIMAFormat          = $6D730011;                    { DVI/Intel IMA ADPCM - ACM code 17 }
    kDVAudioFormat              = $64766361 (* 'dvca' *);                       { DV Audio }
    kQDesignCompression         = $51444D43 (* 'QDMC' *);                       { QDesign music }
    kQDesign2Compression        = $51444D32 (* 'QDM2' *);                       { QDesign2 music }
    kQUALCOMMCompression        = $51636C70 (* 'Qclp' *);                       { QUALCOMM PureVoice }
    kOffsetBinary               = $72617720 (* 'raw ' *);                       { for compatibility }
    kTwosComplement             = $74776F73 (* 'twos' *);                       { for compatibility }
    kLittleEndianFormat         = $736F7774 (* 'sowt' *);                       { for compatibility }
    kMPEGLayer3Format           = $6D730055;                    { MPEG Layer 3, CBR only (pre QT4.1) }
    kFullMPEGLay3Format         = $2E6D7033 (* '.mp3' *);                       { MPEG Layer 3, CBR & VBR (QT4.1 and later) }

    k16BitNativeEndianFormat    = $74776F73 (* 'twos' *);
    k16BitNonNativeEndianFormat = $736F7774 (* 'sowt' *);


    { Features Flags }
    k8BitRawIn                  = $01;                          { data description }
    k8BitTwosIn                 = $02;
    k16BitIn                    = $04;
    kStereoIn                   = $08;
    k8BitRawOut                 = $0100;
    k8BitTwosOut                = $0200;
    k16BitOut                   = $0400;
    kStereoOut                  = $0800;
    kReverse                    = $00010000;                    {   function description }
    kRateConvert                = $00020000;
    kCreateSoundSource          = $00040000;
    kVMAwareness                = $00200000;                    {  component will hold its memory }
    kHighQuality                = $00400000;                    {   performance description }
    kNonRealTime                = $00800000;

    { SoundComponentPlaySourceBuffer action flags }
    kSourcePaused               = $01;
    kPassThrough                = $00010000;
    kNoSoundComponentChain      = $00020000;

    { SoundParamBlock flags, usefull for OpenMixerSoundComponent }
    kNoMixing                   = $01;                          { don't mix source }
    kNoSampleRateConversion     = $02;                          { don't convert sample rate (i.e. 11 kHz -> 22 kHz) }
    kNoSampleSizeConversion     = $04;                          { don't convert sample size (i.e. 16 -> 8) }
    kNoSampleFormatConversion   = $08;                          { don't convert sample format (i.e. 'twos' -> 'raw ') }
    kNoChannelConversion        = $10;                          { don't convert stereo/mono }
    kNoDecompression            = $20;                          { don't decompress (i.e. 'MAC3' -> 'raw ') }
    kNoVolumeConversion         = $40;                          { don't apply volume }
    kNoRealtimeProcessing       = $80;                          { won't run at interrupt time }
    kScheduledSource            = $0100;                        { source is scheduled }
    kNonInterleavedBuffer       = $0200;                        { buffer is not interleaved samples }
    kNonPagingMixer             = $0400;                        { if VM is on, use the non-paging mixer }
    kSoundConverterMixer        = $0800;                        { the mixer is to be used by the SoundConverter }
    kPagingMixer                = $1000;                        { the mixer is to be used as a paging mixer when VM is on }
    kVMAwareMixer               = $2000;                        { passed to the output device when the SM is going to deal with VM safety }
    kExtendedSoundData          = $4000;                        { SoundComponentData record is actually an ExtendedSoundComponentData }

    { SoundParamBlock quality settings }
    kBestQuality                = $01;                          { use interpolation in rate conversion }

    { useful bit masks }
    kInputMask                  = $000000FF;                    { masks off input bits }
    kOutputMask                 = $0000FF00;                    { masks off output bits }
    kOutputShift                = 8;                            { amount output bits are shifted }
    kActionMask                 = $00FF0000;                    { masks off action bits }
    kSoundComponentBits         = $00FFFFFF;

    { audio atom types }
    kAudioFormatAtomType        = $66726D61 (* 'frma' *);
    kAudioEndianAtomType        = $656E6461 (* 'enda' *);
    kAudioVBRAtomType           = $76627261 (* 'vbra' *);
    kAudioTerminatorAtomType    = 0;

    { siAVDisplayBehavior types }
    kAVDisplayHeadphoneRemove   = 0;                            {  monitor does not have a headphone attached }
    kAVDisplayHeadphoneInsert   = 1;                            {  monitor has a headphone attached }
    kAVDisplayPlainTalkRemove   = 2;                            {  monitor either sending no input through CPU input port or unable to tell if input is coming in }
    kAVDisplayPlainTalkInsert   = 3;                            {  monitor sending PlainTalk level microphone source input through sound input port }

    { Audio Component constants }
                                                                { Values for whichChannel parameter }
    audioAllChannels            = 0;                            { All channels (usually interpreted as both left and right) }
    audioLeftChannel            = 1;                            { Left channel }
    audioRightChannel           = 2;                            { Right channel }
                                                                { Values for mute parameter }
    audioUnmuted                = 0;                            { Device is unmuted }
    audioMuted                  = 1;                            { Device is muted }
                                                                { Capabilities flags definitions }
    audioDoesMono               = $00000001;                    { Device supports mono output }
    audioDoesStereo             = $00000002;                    { Device supports stereo output }
    audioDoesIndependentChannels = $00000004;                   { Device supports independent software control of each channel }

    {   Sound Input Qualities   }
    siCDQuality                 = $63642020 (* 'cd  ' *);                       { 44.1kHz, stereo, 16 bit }
    siBestQuality               = $62657374 (* 'best' *);                       { 22kHz, mono, 8 bit }
    siBetterQuality             = $62657472 (* 'betr' *);                       { 22kHz, mono, MACE 3:1 }
    siGoodQuality               = $676F6F64 (* 'good' *);                       { 22kHz, mono, MACE 6:1 }
    siNoneQuality               = $6E6F6E65 (* 'none' *);                       { settings don't match any quality for a get call }

    siDeviceIsConnected         = 1;                            { input device is connected and ready for input }
    siDeviceNotConnected        = 0;                            { input device is not connected }
    siDontKnowIfConnected       = -1;                           { can't tell if input device is connected }
    siReadPermission            = 0;                            { permission passed to SPBOpenDevice }
    siWritePermission           = 1;                            { permission passed to SPBOpenDevice }

    { flags that SoundConverterFillBuffer will return }
    kSoundConverterDidntFillBuffer = $01;                       { set if the converter couldn't completely satisfy a SoundConverterFillBuffer request }
    kSoundConverterHasLeftOverData = $02;                       { set if the converter had left over data after completely satisfying a SoundConverterFillBuffer call }

    {  flags for extendedFlags fields of ExtendedSoundComponentData, ExtendedSoundParamBlock, and ExtendedScheduledSoundHeader }
    kExtendedSoundSampleCountNotValid = $00000001;              {  set if sampleCount of SoundComponentData isn't meaningful; use buffer size instead }
    kExtendedSoundBufferSizeValid = $00000002;                  {  set if bufferSize field is valid }

    {
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       typedefs
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    }


type
    SndCommandPtr = ^SndCommand;
    SndCommand = packed record
        cmd:                    UInt16;
        param1:                 SInt16;
        param2:                 SInt32;
    end;

    SndChannelPtr = ^SndChannel;
    SndCallBackProcPtr = procedure(chan: SndChannelPtr; var cmd: SndCommand);

    SndCallBackUPP = ^SInt32; { an opaque UPP }
    SndChannel = packed record
        nextChan:               SndChannelPtr;
        firstMod:               Ptr;                                    {  reserved for the Sound Manager  }
        callBack:               SndCallBackUPP;
        userInfo:               SInt32;
        wait:                   SInt32;                             {  The following is for internal Sound Manager use only. }
        cmdInProgress:          SndCommand;
        flags:                  SInt16;
        qLength:                SInt16;
        qHead:                  SInt16;
        qTail:                  SInt16;
        queue:                  array [0..127] of SndCommand;
    end;


const
    uppSndCallBackProcInfo = $000003C0;
    {
     *  NewSndCallBackUPP()
     *
     *  Availability:
     *    Non-Carbon CFM:   available as macro/inline
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function NewSndCallBackUPP(userRoutine: SndCallBackProcPtr): SndCallBackUPP; external name '_NewSndCallBackUPP'; { old name was NewSndCallBackProc }
{
 *  DisposeSndCallBackUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeSndCallBackUPP(userUPP: SndCallBackUPP); external name '_DisposeSndCallBackUPP';
{
 *  InvokeSndCallBackUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvokeSndCallBackUPP(chan: SndChannelPtr; var cmd: SndCommand; userRoutine: SndCallBackUPP); external name '_InvokeSndCallBackUPP'; { old name was CallSndCallBackProc }
{MACE structures}

type
    StateBlockPtr = ^StateBlock;
    StateBlock = record
        stateVar:               array [0..63] of SInt16;
    end;

    LeftOverBlockPtr = ^LeftOverBlock;
    LeftOverBlock = record
        count:                  UInt32;
        sampleArea:             array [0..31] of SInt8;
    end;

    ModRefPtr = ^ModRef;
    ModRef = record
        modNumber:              UInt16;
        modInit:                SInt32;
    end;

    SndListResourcePtr = ^SndListResource;
    SndListResource = record
        format:                 SInt16;
        numModifiers:           SInt16;
        modifierPart:           array [0..0] of ModRef;
        numCommands:            SInt16;
        commandPart:            array [0..0] of SndCommand;
        dataPart:               SInt8;
    end;

    SndListPtr                          = ^SndListResource;
    SndListHandle                       = ^SndListPtr;
    SndListHndl                         = SndListHandle;
    {   HyperCard sound resource format }
    Snd2ListResourcePtr = ^Snd2ListResource;
    Snd2ListResource = record
        format:                 SInt16;
        refCount:               SInt16;
        numCommands:            SInt16;
        commandPart:            array [0..0] of SndCommand;
        dataPart:               SInt8;
    end;

    Snd2ListPtr                         = ^Snd2ListResource;
    Snd2ListHandle                      = ^Snd2ListPtr;
    Snd2ListHndl                        = Snd2ListHandle;
    SoundHeaderPtr = ^SoundHeader;
    SoundHeader = packed record
        samplePtr:              Ptr;                                    { if NIL then samples are in sampleArea }
        length:                 UInt32;                                 { length of sound in bytes }
        sampleRate:             UnsignedFixed;                          { sample rate for this sound }
        loopStart:              UInt32;                                 { start of looping portion }
        loopEnd:                UInt32;                                 { end of looping portion }
        encode:                 UInt8;                                  { header encoding }
        baseFrequency:          UInt8;                                  { baseFrequency value }
        sampleArea:             packed array [0..0] of UInt8;           { space for when samples follow directly }
    end;

    CmpSoundHeaderPtr = ^CmpSoundHeader;
    CmpSoundHeader = packed record
        samplePtr:              Ptr;                                    { if nil then samples are in sample area }
        numChannels:            UInt32;                                 { number of channels i.e. mono = 1 }
        sampleRate:             UnsignedFixed;                          { sample rate in Apples Fixed point representation }
        loopStart:              UInt32;                                 { loopStart of sound before compression }
        loopEnd:                UInt32;                                 { loopEnd of sound before compression }
        encode:                 UInt8;                                  { data structure used , stdSH, extSH, or cmpSH }
        baseFrequency:          UInt8;                                  { same meaning as regular SoundHeader }
        numFrames:              UInt32;                                 { length in frames ( packetFrames or sampleFrames ) }
        AIFFSampleRate:         extended80;                             { IEEE sample rate }
        markerChunk:            Ptr;                                    { sync track }
        format:                 OSType;                                 { data format type, was futureUse1 }
        futureUse2:             UInt32;                                 { reserved by Apple }
        stateVars:              StateBlockPtr;                          { pointer to State Block }
        leftOverSamples:        LeftOverBlockPtr;                       { used to save truncated samples between compression calls }
        compressionID:          SInt16;                             { 0 means no compression, non zero means compressionID }
        packetSize:             UInt16;                                 { number of bits in compressed sample packet }
        snthID:                 UInt16;                                 { resource ID of Sound Manager snth that contains NRT C/E }
        sampleSize:             UInt16;                                 { number of bits in non-compressed sample }
        sampleArea:             packed array [0..0] of UInt8;           { space for when samples follow directly }
    end;

    ExtSoundHeaderPtr = ^ExtSoundHeader;
    ExtSoundHeader = packed record
        samplePtr:              Ptr;                                    { if nil then samples are in sample area }
        numChannels:            UInt32;                                 { number of channels,  ie mono = 1 }
        sampleRate:             UnsignedFixed;                          { sample rate in Apples Fixed point representation }
        loopStart:              UInt32;                                 { same meaning as regular SoundHeader }
        loopEnd:                UInt32;                                 { same meaning as regular SoundHeader }
        encode:                 UInt8;                                  { data structure used , stdSH, extSH, or cmpSH }
        baseFrequency:          UInt8;                                  { same meaning as regular SoundHeader }
        numFrames:              UInt32;                                 { length in total number of frames }
        AIFFSampleRate:         extended80;                             { IEEE sample rate }
        markerChunk:            Ptr;                                    { sync track }
        instrumentChunks:       Ptr;                                    { AIFF instrument chunks }
        AESRecording:           Ptr;
        sampleSize:             UInt16;                                 { number of bits in sample }
        futureUse1:             UInt16;                                 { reserved by Apple }
        futureUse2:             UInt32;                                 { reserved by Apple }
        futureUse3:             UInt32;                                 { reserved by Apple }
        futureUse4:             UInt32;                                 { reserved by Apple }
        sampleArea:             packed array [0..0] of UInt8;           { space for when samples follow directly }
    end;

    SoundHeaderUnionPtr = ^SoundHeaderUnion;
    SoundHeaderUnion = record
        case SInt16 of
        0: (
            stdHeader:          SoundHeader;
            );
        1: (
            cmpHeader:          CmpSoundHeader;
            );
        2: (
            extHeader:          ExtSoundHeader;
            );
    end;

    ConversionBlockPtr = ^ConversionBlock;
    ConversionBlock = record
        destination:            SInt16;
        unused:                 SInt16;
        inputPtr:               CmpSoundHeaderPtr;
        outputPtr:              CmpSoundHeaderPtr;
    end;

    {  ScheduledSoundHeader flags }

const
    kScheduledSoundDoScheduled  = $01;
    kScheduledSoundDoCallBack   = $02;
    kScheduledSoundExtendedHdr  = $04;


type
    ScheduledSoundHeaderPtr = ^ScheduledSoundHeader;
    ScheduledSoundHeader = record
        u:                      SoundHeaderUnion;
        flags:                  SInt32;
        reserved:               SInt16;
        callBackParam1:         SInt16;
        callBackParam2:         SInt32;
        startTime:              TimeRecord;
    end;

    ExtendedScheduledSoundHeaderPtr = ^ExtendedScheduledSoundHeader;
    ExtendedScheduledSoundHeader = record
        u:                      SoundHeaderUnion;
        flags:                  SInt32;
        reserved:               SInt16;
        callBackParam1:         SInt16;
        callBackParam2:         SInt32;
        startTime:              TimeRecord;
        recordSize:             SInt32;
        extendedFlags:          SInt32;
        bufferSize:             SInt32;
    end;

    SMStatusPtr = ^SMStatus;
    SMStatus = packed record
        smMaxCPULoad:           SInt16;
        smNumChannels:          SInt16;
        smCurCPULoad:           SInt16;
    end;

    SCStatusPtr = ^SCStatus;
    SCStatus = record
        scStartTime:            UnsignedFixed;
        scEndTime:              UnsignedFixed;
        scCurrentTime:          UnsignedFixed;
        scChannelBusy:          boolean;
        scChannelDisposed:      boolean;
        scChannelPaused:        boolean;
        scUnused:               boolean;
        scChannelAttributes:    UInt32;
        scCPULoad:              SInt32;
    end;

    AudioSelectionPtr = ^AudioSelection;
    AudioSelection = packed record
        unitType:               SInt32;
        selStart:               UnsignedFixed;
        selEnd:                 UnsignedFixed;
    end;


    SoundInfoListPtr = ^SoundInfoList;
    SoundInfoList = packed record
        count:                  SInt16;
        infoHandle:             Handle;
    end;

    SoundComponentDataPtr = ^SoundComponentData;
    SoundComponentData = record
        flags:                  SInt32;
        format:                 OSType;
        numChannels:            SInt16;
        sampleSize:             SInt16;
        sampleRate:             UnsignedFixed;
        sampleCount:            SInt32;
        buffer:                 Ptr;
        reserved:               SInt32;
    end;

    ExtendedSoundComponentDataPtr = ^ExtendedSoundComponentData;
    ExtendedSoundComponentData = record
        desc:                   SoundComponentData;                     { description of sound buffer }
        recordSize:             SInt32;                             { size of this record in bytes }
        extendedFlags:          SInt32;                             { flags for extended record }
        bufferSize:             SInt32;                             { size of buffer in bytes }
    end;

    SoundParamBlockPtr = ^SoundParamBlock;
    SoundParamProcPtr = function(var pb: SoundParamBlockPtr): boolean;

    SoundParamUPP = ^SInt32; { an opaque UPP }
    SoundParamBlock = record
        recordSize:             SInt32;                             { size of this record in bytes }
        desc:                   SoundComponentData;                     { description of sound buffer }
        rateMultiplier:         UnsignedFixed;                          { rate multiplier to apply to sound }
        leftVolume:             SInt16;                             { volumes to apply to sound }
        rightVolume:            SInt16;
        quality:                SInt32;                             { quality to apply to sound }
        filter:                 ComponentInstance;                      { filter to apply to sound }
        moreRtn:                SoundParamUPP;                          { routine to call to get more data }
        completionRtn:          SoundParamUPP;                          { routine to call when buffer is complete }
        refCon:                 SInt32;                             { user refcon }
        result:                 SInt16;                             { result }
    end;

    ExtendedSoundParamBlockPtr = ^ExtendedSoundParamBlock;
    ExtendedSoundParamBlock = record
        pb:                     SoundParamBlock;                        { classic SoundParamBlock except recordSize == sizeof(ExtendedSoundParamBlock) }
        reserved:               SInt16;
        extendedFlags:          SInt32;                             { flags }
        bufferSize:             SInt32;                             { size of buffer in bytes }
    end;

    CompressionInfoPtr = ^CompressionInfo;
    CompressionInfo = record
        recordSize:             SInt32;
        format:                 OSType;
        compressionID:          SInt16;
        samplesPerPacket:       UInt16;
        bytesPerPacket:         UInt16;
        bytesPerFrame:          UInt16;
        bytesPerSample:         UInt16;
        futureUse1:             UInt16;
    end;

    CompressionInfoHandle               = ^CompressionInfoPtr;
    { variables for floating point conversion }
    SoundSlopeAndInterceptRecordPtr = ^SoundSlopeAndInterceptRecord;
    SoundSlopeAndInterceptRecord = record
        slope:                  Float64;
        intercept:              Float64;
        minClip:                Float64;
        maxClip:                Float64;
    end;

    SoundSlopeAndInterceptPtr           = ^SoundSlopeAndInterceptRecord;
    { private thing to use as a reference to a Sound Converter }
    SoundConverter    = ^SInt32; { an opaque 32-bit type }
    SoundConverterPtr = ^SoundConverter;  { when a var xx:SoundConverter parameter can be nil, it is changed to xx: SoundConverterPtr }
    { callback routine to provide data to the Sound Converter }
    SoundConverterFillBufferDataProcPtr = function(var data: SoundComponentDataPtr; refCon: UnivPtr): boolean;

    SoundConverterFillBufferDataUPP = ^SInt32; { an opaque UPP }
    { private thing to use as a reference to a Sound Source }
    SoundSource    = ^SInt32; { an opaque 32-bit type }
    SoundSourcePtr = ^SoundSource;  { when a var xx:SoundSource parameter can be nil, it is changed to xx: SoundSourcePtr }
    SoundComponentLinkPtr = ^SoundComponentLink;
    SoundComponentLink = record
        description:            ComponentDescription;                   { Describes the sound component }
        mixerID:                SoundSource;                            { Reserved by Apple }
        linkID:                 SoundSourcePtr;                         { Reserved by Apple }
    end;

    AudioInfoPtr = ^AudioInfo;
    AudioInfo = record
        capabilitiesFlags:      SInt32;                             { Describes device capabilities }
        reserved:               SInt32;                             { Reserved by Apple }
        numVolumeSteps:         UInt16;                                 { Number of significant increments between min and max volume }
    end;

    AudioFormatAtomPtr = ^AudioFormatAtom;
    AudioFormatAtom = record
        size:                   SInt32;                             {  = sizeof(AudioFormatAtom) }
        atomType:               OSType;                                 {  = kAudioFormatAtomType }
        format:                 OSType;
    end;

    AudioEndianAtomPtr = ^AudioEndianAtom;
    AudioEndianAtom = record
        size:                   SInt32;                             {  = sizeof(AudioEndianAtom) }
        atomType:               OSType;                                 {  = kAudioEndianAtomType }
        littleEndian:           SInt16;
    end;

    AudioTerminatorAtomPtr = ^AudioTerminatorAtom;
    AudioTerminatorAtom = record
        size:                   SInt32;                             {  = sizeof(AudioTerminatorAtom) }
        atomType:               OSType;                                 {  = kAudioTerminatorAtomType }
    end;

    LevelMeterInfoPtr = ^LevelMeterInfo;
    LevelMeterInfo = record
        numChannels:            SInt16;                             {  mono or stereo source }
        leftMeter:              SInt8;                                  {  0-255 range }
        rightMeter:             SInt8;                                  {  0-255 range }
    end;

    EQSpectrumBandsRecordPtr = ^EQSpectrumBandsRecord;
    EQSpectrumBandsRecord = record
        count:                  SInt16;
        frequency:              UnsignedFixedPtr;                       {  pointer to array of frequencies }
    end;

    {  Sound Input Structures }
    SPBPtr = ^SPB;
    {   user procedures called by sound input routines  }
    SIInterruptProcPtr = procedure(inParamPtr: SPBPtr; dataBuffer: Ptr; peakAmplitude: SInt16; sampleSize: SInt32);

    SICompletionProcPtr = procedure(inParamPtr: SPBPtr);

    SIInterruptUPP = ^SInt32; { an opaque UPP }
    SICompletionUPP = ^SInt32; { an opaque UPP }
    {   Sound Input Parameter Block }
    SPB = record
        inRefNum:               SInt32;                             { reference number of sound input device }
        count:                  UInt32;                                 { number of bytes to record }
        milliseconds:           UInt32;                                 { number of milliseconds to record }
        bufferLength:           UInt32;                                 { length of buffer in bytes }
        bufferPtr:              Ptr;                                    { buffer to store sound data in }
        completionRoutine:      SICompletionUPP;                        { completion routine }
        interruptRoutine:       SIInterruptUPP;                         { interrupt routine }
        userLong:               SInt32;                             { user-defined field }
        error:                  OSErr;                                  { error }
        unused1:                SInt32;                             { reserved - must be zero }
    end;


const
    uppSoundParamProcInfo = $000000D0;
    uppSoundConverterFillBufferDataProcInfo = $000003D0;
    uppSIInterruptProcInfo = $1C579802;
    uppSICompletionProcInfo = $000000C0;
    {
     *  NewSoundParamUPP()
     *
     *  Availability:
     *    Non-Carbon CFM:   available as macro/inline
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function NewSoundParamUPP(userRoutine: SoundParamProcPtr): SoundParamUPP; external name '_NewSoundParamUPP'; { old name was NewSoundParamProc }
{
 *  NewSoundConverterFillBufferDataUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewSoundConverterFillBufferDataUPP(userRoutine: SoundConverterFillBufferDataProcPtr): SoundConverterFillBufferDataUPP; external name '_NewSoundConverterFillBufferDataUPP'; { old name was NewSoundConverterFillBufferDataProc }
{
 *  NewSIInterruptUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewSIInterruptUPP(userRoutine: SIInterruptProcPtr): SIInterruptUPP; external name '_NewSIInterruptUPP'; { old name was NewSIInterruptProc }
{
 *  NewSICompletionUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewSICompletionUPP(userRoutine: SICompletionProcPtr): SICompletionUPP; external name '_NewSICompletionUPP'; { old name was NewSICompletionProc }
{
 *  DisposeSoundParamUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeSoundParamUPP(userUPP: SoundParamUPP); external name '_DisposeSoundParamUPP';
{
 *  DisposeSoundConverterFillBufferDataUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeSoundConverterFillBufferDataUPP(userUPP: SoundConverterFillBufferDataUPP); external name '_DisposeSoundConverterFillBufferDataUPP';
{
 *  DisposeSIInterruptUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeSIInterruptUPP(userUPP: SIInterruptUPP); external name '_DisposeSIInterruptUPP';
{
 *  DisposeSICompletionUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeSICompletionUPP(userUPP: SICompletionUPP); external name '_DisposeSICompletionUPP';
{
 *  InvokeSoundParamUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeSoundParamUPP(var pb: SoundParamBlockPtr; userRoutine: SoundParamUPP): boolean; external name '_InvokeSoundParamUPP'; { old name was CallSoundParamProc }
{
 *  InvokeSoundConverterFillBufferDataUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeSoundConverterFillBufferDataUPP(var data: SoundComponentDataPtr; refCon: UnivPtr; userRoutine: SoundConverterFillBufferDataUPP): boolean; external name '_InvokeSoundConverterFillBufferDataUPP'; { old name was CallSoundConverterFillBufferDataProc }
{
 *  InvokeSIInterruptUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvokeSIInterruptUPP(inParamPtr: SPBPtr; dataBuffer: Ptr; peakAmplitude: SInt16; sampleSize: SInt32; userRoutine: SIInterruptUPP); external name '_InvokeSIInterruptUPP'; { old name was CallSIInterruptProc }
{
 *  InvokeSICompletionUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvokeSICompletionUPP(inParamPtr: SPBPtr; userRoutine: SICompletionUPP); external name '_InvokeSICompletionUPP'; { old name was CallSICompletionProc }
type
    FilePlayCompletionProcPtr = procedure(chan: SndChannelPtr);

    FilePlayCompletionUPP = ^SInt32; { an opaque UPP }

const
    uppFilePlayCompletionProcInfo = $000000C0;

{
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   prototypes
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
}
{ Sound Manager routines }
{
 *  SysBeep()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SysBeep(duration: SInt16); external name '_SysBeep';
{
 *  SndDoCommand()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SndDoCommand(chan: SndChannelPtr; const (*var*) cmd: SndCommand; noWait: boolean): OSErr; external name '_SndDoCommand';
{
 *  SndDoImmediate()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SndDoImmediate(chan: SndChannelPtr; const (*var*) cmd: SndCommand): OSErr; external name '_SndDoImmediate';
{
 *  SndNewChannel()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SndNewChannel(var chan: SndChannelPtr; synth: SInt16; init: SInt32; userRoutine: SndCallBackUPP): OSErr; external name '_SndNewChannel';
{
 *  SndDisposeChannel()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SndDisposeChannel(chan: SndChannelPtr; quietNow: boolean): OSErr; external name '_SndDisposeChannel';
{
 *  SndPlay()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SndPlay(chan: SndChannelPtr; sndHandle: SndListHandle; async: boolean): OSErr; external name '_SndPlay';


{
 *  SndSoundManagerVersion()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SndSoundManagerVersion: NumVersion; external name '_SndSoundManagerVersion';

{
 *  SndChannelStatus()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SndChannelStatus(chan: SndChannelPtr; theLength: SInt16; theStatus: SCStatusPtr): OSErr; external name '_SndChannelStatus';
{
 *  SndManagerStatus()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SndManagerStatus(theLength: SInt16; theStatus: SMStatusPtr): OSErr; external name '_SndManagerStatus';
{
 *  SndGetSysBeepState()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SndGetSysBeepState(var sysBeepState: SInt16); external name '_SndGetSysBeepState';
{
 *  SndSetSysBeepState()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SndSetSysBeepState(sysBeepState: SInt16): OSErr; external name '_SndSetSysBeepState';

{
 *  GetSysBeepVolume()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetSysBeepVolume(var level: SInt32): OSErr; external name '_GetSysBeepVolume';
{
 *  SetSysBeepVolume()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetSysBeepVolume(level: SInt32): OSErr; external name '_SetSysBeepVolume';
{
 *  GetDefaultOutputVolume()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetDefaultOutputVolume(var level: SInt32): OSErr; external name '_GetDefaultOutputVolume';
{
 *  SetDefaultOutputVolume()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetDefaultOutputVolume(level: SInt32): OSErr; external name '_SetDefaultOutputVolume';
{
 *  GetSoundHeaderOffset()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetSoundHeaderOffset(sndHandle: SndListHandle; var offset: SInt32): OSErr; external name '_GetSoundHeaderOffset';
{
 *  UnsignedFixedMulDiv()
 *
 *  Availability:
 *    Non-Carbon CFM:   in SoundLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         not available
 }
function UnsignedFixedMulDiv(value: UnsignedFixed; multiplier: UnsignedFixed; divisor: UnsignedFixed): UnsignedFixed; external name '_UnsignedFixedMulDiv';
{
 *  GetCompressionInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in SoundLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetCompressionInfo(compressionID: SInt16; format: OSType; numChannels: SInt16; sampleSize: SInt16; cp: CompressionInfoPtr): OSErr; external name '_GetCompressionInfo';
{
 *  SetSoundPreference()
 *
 *  Availability:
 *    Non-Carbon CFM:   in SoundLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetSoundPreference(theType: OSType; var name: Str255; settings: Handle): OSErr; external name '_SetSoundPreference';
{
 *  GetSoundPreference()
 *
 *  Availability:
 *    Non-Carbon CFM:   in SoundLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetSoundPreference(theType: OSType; var name: Str255; settings: Handle): OSErr; external name '_GetSoundPreference';
{
 *  OpenMixerSoundComponent()
 *
 *  Availability:
 *    Non-Carbon CFM:   in SoundLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OpenMixerSoundComponent(outputDescription: SoundComponentDataPtr; outputFlags: SInt32; var mixerComponent: ComponentInstance): OSErr; external name '_OpenMixerSoundComponent';
{
 *  CloseMixerSoundComponent()
 *
 *  Availability:
 *    Non-Carbon CFM:   in SoundLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CloseMixerSoundComponent(ci: ComponentInstance): OSErr; external name '_CloseMixerSoundComponent';
{ Sound Manager 3.1 and later calls, uses _SoundDispatch }
{
 *  SndGetInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in SoundLib 3.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SndGetInfo(chan: SndChannelPtr; selector: OSType; infoPtr: UnivPtr): OSErr; external name '_SndGetInfo';
{
 *  SndSetInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in SoundLib 3.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SndSetInfo(chan: SndChannelPtr; selector: OSType; infoPtr: UnivPtr): OSErr; external name '_SndSetInfo';
{
 *  GetSoundOutputInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in SoundLib 3.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetSoundOutputInfo(outputDevice: Component; selector: OSType; infoPtr: UnivPtr): OSErr; external name '_GetSoundOutputInfo';
{
 *  SetSoundOutputInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in SoundLib 3.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetSoundOutputInfo(outputDevice: Component; selector: OSType; infoPtr: UnivPtr): OSErr; external name '_SetSoundOutputInfo';
{ Sound Manager 3.2 and later calls, uses _SoundDispatch }
{
 *  GetCompressionName()
 *
 *  Availability:
 *    Non-Carbon CFM:   in SoundLib 3.2 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetCompressionName(compressionType: OSType; var compressionName: Str255): OSErr; external name '_GetCompressionName';
{
 *  SoundConverterOpen()
 *
 *  Availability:
 *    Non-Carbon CFM:   in SoundLib 3.2 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SoundConverterOpen(const (*var*) inputFormat: SoundComponentData; const (*var*) outputFormat: SoundComponentData; var sc: SoundConverter): OSErr; external name '_SoundConverterOpen';
{
 *  SoundConverterClose()
 *
 *  Availability:
 *    Non-Carbon CFM:   in SoundLib 3.2 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SoundConverterClose(sc: SoundConverter): OSErr; external name '_SoundConverterClose';
{
 *  SoundConverterGetBufferSizes()
 *
 *  Availability:
 *    Non-Carbon CFM:   in SoundLib 3.2 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SoundConverterGetBufferSizes(sc: SoundConverter; inputBytesTarget: UInt32; var inputFrames: UInt32; var inputBytes: UInt32; var outputBytes: UInt32): OSErr; external name '_SoundConverterGetBufferSizes';
{
 *  SoundConverterBeginConversion()
 *
 *  Availability:
 *    Non-Carbon CFM:   in SoundLib 3.2 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SoundConverterBeginConversion(sc: SoundConverter): OSErr; external name '_SoundConverterBeginConversion';
{
 *  SoundConverterConvertBuffer()
 *
 *  Availability:
 *    Non-Carbon CFM:   in SoundLib 3.2 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SoundConverterConvertBuffer(sc: SoundConverter; inputPtr: UnivPtr; inputFrames: UInt32; outputPtr: UnivPtr; var outputFrames: UInt32; var outputBytes: UInt32): OSErr; external name '_SoundConverterConvertBuffer';
{
 *  SoundConverterEndConversion()
 *
 *  Availability:
 *    Non-Carbon CFM:   in SoundLib 3.2 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SoundConverterEndConversion(sc: SoundConverter; outputPtr: UnivPtr; var outputFrames: UInt32; var outputBytes: UInt32): OSErr; external name '_SoundConverterEndConversion';
{ Sound Manager 3.3 and later calls, uses _SoundDispatch }
{
 *  SoundConverterGetInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in SoundLib 3.3 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SoundConverterGetInfo(sc: SoundConverter; selector: OSType; infoPtr: UnivPtr): OSErr; external name '_SoundConverterGetInfo';
{
 *  SoundConverterSetInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in SoundLib 3.3 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SoundConverterSetInfo(sc: SoundConverter; selector: OSType; infoPtr: UnivPtr): OSErr; external name '_SoundConverterSetInfo';
{ Sound Manager 3.6 and later calls, uses _SoundDispatch }
{
 *  SoundConverterFillBuffer()
 *
 *  Availability:
 *    Non-Carbon CFM:   in SoundLib 3.6 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SoundConverterFillBuffer(sc: SoundConverter; fillBufferDataUPP: SoundConverterFillBufferDataUPP; fillBufferDataRefCon: UnivPtr; outputBuffer: UnivPtr; outputBufferByteSize: UInt32; var bytesWritten: UInt32; var framesWritten: UInt32; var outputFlags: UInt32): OSErr; external name '_SoundConverterFillBuffer';
{
 *  SoundManagerGetInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in SoundLib 3.6 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SoundManagerGetInfo(selector: OSType; infoPtr: UnivPtr): OSErr; external name '_SoundManagerGetInfo';
{
 *  SoundManagerSetInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in SoundLib 3.6 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SoundManagerSetInfo(selector: OSType; infoPtr: UnivPtr): OSErr; external name '_SoundManagerSetInfo';
{
  Sound Component Functions
   basic sound component functions
}

{
 *  SoundComponentInitOutputDevice()
 *
 *  Availability:
 *    Non-Carbon CFM:   in SoundLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SoundComponentInitOutputDevice(ti: ComponentInstance; actions: SInt32): ComponentResult; external name '_SoundComponentInitOutputDevice';
{
 *  SoundComponentSetSource()
 *
 *  Availability:
 *    Non-Carbon CFM:   in SoundLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SoundComponentSetSource(ti: ComponentInstance; sourceID: SoundSource; source: ComponentInstance): ComponentResult; external name '_SoundComponentSetSource';
{
 *  SoundComponentGetSource()
 *
 *  Availability:
 *    Non-Carbon CFM:   in SoundLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SoundComponentGetSource(ti: ComponentInstance; sourceID: SoundSource; var source: ComponentInstance): ComponentResult; external name '_SoundComponentGetSource';
{
 *  SoundComponentGetSourceData()
 *
 *  Availability:
 *    Non-Carbon CFM:   in SoundLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SoundComponentGetSourceData(ti: ComponentInstance; var sourceData: SoundComponentDataPtr): ComponentResult; external name '_SoundComponentGetSourceData';
{
 *  SoundComponentSetOutput()
 *
 *  Availability:
 *    Non-Carbon CFM:   in SoundLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SoundComponentSetOutput(ti: ComponentInstance; requested: SoundComponentDataPtr; var actual: SoundComponentDataPtr): ComponentResult; external name '_SoundComponentSetOutput';
{  junction methods for the mixer, must be called at non-interrupt level }
{
 *  SoundComponentAddSource()
 *
 *  Availability:
 *    Non-Carbon CFM:   in SoundLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SoundComponentAddSource(ti: ComponentInstance; var sourceID: SoundSource): ComponentResult; external name '_SoundComponentAddSource';
{
 *  SoundComponentRemoveSource()
 *
 *  Availability:
 *    Non-Carbon CFM:   in SoundLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SoundComponentRemoveSource(ti: ComponentInstance; sourceID: SoundSource): ComponentResult; external name '_SoundComponentRemoveSource';
{  info methods }
{
 *  SoundComponentGetInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in SoundLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SoundComponentGetInfo(ti: ComponentInstance; sourceID: SoundSource; selector: OSType; infoPtr: UnivPtr): ComponentResult; external name '_SoundComponentGetInfo';
{
 *  SoundComponentSetInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in SoundLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SoundComponentSetInfo(ti: ComponentInstance; sourceID: SoundSource; selector: OSType; infoPtr: UnivPtr): ComponentResult; external name '_SoundComponentSetInfo';
{  control methods }
{
 *  SoundComponentStartSource()
 *
 *  Availability:
 *    Non-Carbon CFM:   in SoundLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SoundComponentStartSource(ti: ComponentInstance; count: SInt16; var sources: SoundSource): ComponentResult; external name '_SoundComponentStartSource';
{
 *  SoundComponentStopSource()
 *
 *  Availability:
 *    Non-Carbon CFM:   in SoundLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SoundComponentStopSource(ti: ComponentInstance; count: SInt16; var sources: SoundSource): ComponentResult; external name '_SoundComponentStopSource';
{
 *  SoundComponentPauseSource()
 *
 *  Availability:
 *    Non-Carbon CFM:   in SoundLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SoundComponentPauseSource(ti: ComponentInstance; count: SInt16; var sources: SoundSource): ComponentResult; external name '_SoundComponentPauseSource';
{
 *  SoundComponentPlaySourceBuffer()
 *
 *  Availability:
 *    Non-Carbon CFM:   in SoundLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SoundComponentPlaySourceBuffer(ti: ComponentInstance; sourceID: SoundSource; pb: SoundParamBlockPtr; actions: SInt32): ComponentResult; external name '_SoundComponentPlaySourceBuffer';
{ Audio Components }
{Volume is described as a value between 0 and 1, with 0 indicating minimum
  volume and 1 indicating maximum volume; if the device doesn't support
  software control of volume, then a value of unimpErr is returned, indicating
  that these functions are not supported by the device
}



const
    kDelegatedSoundComponentSelectors = $0100;

    {    Sound Input Manager routines, uses _SoundDispatch  }
    {
     *  SPBVersion()
     *
     *  Availability:
     *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function SPBVersion: NumVersion; external name '_SPBVersion';
{
 *  SndRecord()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SndRecord(filterProc: ModalFilterUPP; corner: Point; quality: OSType; var sndHandle: SndListHandle): OSErr; external name '_SndRecord';

{
 *  SPBSignInDevice()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SPBSignInDevice(deviceRefNum: SInt16; const (*var*) deviceName: Str255): OSErr; external name '_SPBSignInDevice';
{
 *  SPBSignOutDevice()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SPBSignOutDevice(deviceRefNum: SInt16): OSErr; external name '_SPBSignOutDevice';
{
 *  SPBGetIndexedDevice()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SPBGetIndexedDevice(count: SInt16; var deviceName: Str255; var deviceIconHandle: Handle): OSErr; external name '_SPBGetIndexedDevice';
{
 *  SPBOpenDevice()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SPBOpenDevice(const (*var*) deviceName: Str255; permission: SInt16; var inRefNum: SInt32): OSErr; external name '_SPBOpenDevice';
{
 *  SPBCloseDevice()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SPBCloseDevice(inRefNum: SInt32): OSErr; external name '_SPBCloseDevice';
{
 *  SPBRecord()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SPBRecord(inParamPtr: SPBPtr; asynchFlag: boolean): OSErr; external name '_SPBRecord';

{
 *  SPBPauseRecording()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SPBPauseRecording(inRefNum: SInt32): OSErr; external name '_SPBPauseRecording';
{
 *  SPBResumeRecording()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SPBResumeRecording(inRefNum: SInt32): OSErr; external name '_SPBResumeRecording';
{
 *  SPBStopRecording()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SPBStopRecording(inRefNum: SInt32): OSErr; external name '_SPBStopRecording';
{
 *  SPBGetRecordingStatus()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SPBGetRecordingStatus(inRefNum: SInt32; var recordingStatus: SInt16; var meterLevel: SInt16; var totalSamplesToRecord: UInt32; var numberOfSamplesRecorded: UInt32; var totalMsecsToRecord: UInt32; var numberOfMsecsRecorded: UInt32): OSErr; external name '_SPBGetRecordingStatus';
{
 *  SPBGetDeviceInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SPBGetDeviceInfo(inRefNum: SInt32; infoType: OSType; infoData: UnivPtr): OSErr; external name '_SPBGetDeviceInfo';
{
 *  SPBSetDeviceInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SPBSetDeviceInfo(inRefNum: SInt32; infoType: OSType; infoData: UnivPtr): OSErr; external name '_SPBSetDeviceInfo';
{
 *  SPBMillisecondsToBytes()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SPBMillisecondsToBytes(inRefNum: SInt32; var milliseconds: SInt32): OSErr; external name '_SPBMillisecondsToBytes';
{
 *  SPBBytesToMilliseconds()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SPBBytesToMilliseconds(inRefNum: SInt32; var byteCount: SInt32): OSErr; external name '_SPBBytesToMilliseconds';
{
 *  SetupSndHeader()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetupSndHeader(sndHandle: SndListHandle; numChannels: SInt16; sampleRate: UnsignedFixed; sampleSize: SInt16; compressionType: OSType; baseNote: SInt16; numBytes: UInt32; var headerLen: SInt16): OSErr; external name '_SetupSndHeader';
{
 *  SetupAIFFHeader()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetupAIFFHeader(fRefNum: SInt16; numChannels: SInt16; sampleRate: UnsignedFixed; sampleSize: SInt16; compressionType: OSType; numBytes: UInt32; numFrames: UInt32): OSErr; external name '_SetupAIFFHeader';
{ Sound Input Manager 1.1 and later calls, uses _SoundDispatch }
{
 *  ParseAIFFHeader()
 *
 *  Availability:
 *    Non-Carbon CFM:   in SoundLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ParseAIFFHeader(fRefNum: SInt16; var sndInfo: SoundComponentData; var numFrames: UInt32; var dataOffset: UInt32): OSErr; external name '_ParseAIFFHeader';
{
 *  ParseSndHeader()
 *
 *  Availability:
 *    Non-Carbon CFM:   in SoundLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ParseSndHeader(sndHandle: SndListHandle; var sndInfo: SoundComponentData; var numFrames: UInt32; var dataOffset: UInt32): OSErr; external name '_ParseSndHeader';
{  Only to be used if you are writing a sound input component; this }
{  is the param block for a read request from the SoundMgr to the   }
{  sound input component.  Not to be confused with the SPB struct   }
{  above, which is the param block for a read request from an app   }
{  to the SoundMgr.                                                 }

type
    SndInputCmpParamPtr = ^SndInputCmpParam;
    SICCompletionProcPtr = procedure(SICParmPtr: SndInputCmpParamPtr);

    SndInputCmpParam = record
        ioCompletion:           SICCompletionProcPtr;                   {  completion routine [pointer] }
        ioInterrupt:            SIInterruptProcPtr;                     {  interrupt routine [pointer] }
        ioResult:               OSErr;                                  {  I/O result code [word] }
        pad:                    SInt16;
        ioReqCount:             UInt32;
        ioActCount:             UInt32;
        ioBuffer:               Ptr;
        ioMisc:                 Ptr;
    end;

    {
     *  SndInputReadAsync()
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        not available
     *    Mac OS X:         in version 10.0 and later
        }
function SndInputReadAsync(self: ComponentInstance; SICParmPtr: SndInputCmpParamPtr): ComponentResult; external name '_SndInputReadAsync';
{
 *  SndInputReadSync()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function SndInputReadSync(self: ComponentInstance; SICParmPtr: SndInputCmpParamPtr): ComponentResult; external name '_SndInputReadSync';
{
 *  SndInputPauseRecording()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function SndInputPauseRecording(self: ComponentInstance): ComponentResult; external name '_SndInputPauseRecording';
{
 *  SndInputResumeRecording()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function SndInputResumeRecording(self: ComponentInstance): ComponentResult; external name '_SndInputResumeRecording';
{
 *  SndInputStopRecording()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function SndInputStopRecording(self: ComponentInstance): ComponentResult; external name '_SndInputStopRecording';
{
 *  SndInputGetStatus()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function SndInputGetStatus(self: ComponentInstance; var recordingStatus: SInt16; var totalSamplesToRecord: UInt32; var numberOfSamplesRecorded: UInt32): ComponentResult; external name '_SndInputGetStatus';
{
 *  SndInputGetDeviceInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function SndInputGetDeviceInfo(self: ComponentInstance; infoType: OSType; infoData: UnivPtr): ComponentResult; external name '_SndInputGetDeviceInfo';
{
 *  SndInputSetDeviceInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function SndInputSetDeviceInfo(self: ComponentInstance; infoType: OSType; infoData: UnivPtr): ComponentResult; external name '_SndInputSetDeviceInfo';
{
 *  SndInputInitHardware()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function SndInputInitHardware(self: ComponentInstance): ComponentResult; external name '_SndInputInitHardware';


{$ALIGN MAC68K}
{#POP}
{unit TSMTE}
{$ALIGN MAC68K}










{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}

{  signature, interface types }

const
    kTSMTESignature             = $746D5445 (* 'tmTE' *);
    kTSMTEInterfaceType         = $746D5445 (* 'tmTE' *);

    {
        In Carbon, since DialogRef is opaque, the TSMDialogRecord is removed.
        Only one kind of TSMTE dialog remains, with extended data managed by TSMTE.
        Use kTSMTESignature for the dialog refCon, and use the accessors below,
        i.e. GetTSMTEDialogTSMTERecHandle, to get at the old TSMDialogRecord info.
    }

    {  update flag for TSMTERec }
    kTSMTEAutoScroll            = 1;


    {  callback procedure definitions }


type
    TSMTEPreUpdateProcPtr = procedure(textH: TEHandle; refCon: SInt32);

    TSMTEPostUpdateProcPtr = procedure(textH: TEHandle; fixLen: SInt32; inputAreaStart: SInt32; inputAreaEnd: SInt32; pinStart: SInt32; pinEnd: SInt32; refCon: SInt32);

    TSMTEPreUpdateUPP = ^SInt32; { an opaque UPP }
    TSMTEPostUpdateUPP = ^SInt32; { an opaque UPP }


    {  data types }
    TSMTERecPtr = ^TSMTERec;
    TSMTERec = record
        textH:                  TEHandle;
        preUpdateProc:          TSMTEPreUpdateUPP;
        postUpdateProc:         TSMTEPostUpdateUPP;
        updateFlag:             SInt32;
        refCon:                 SInt32;
    end;

    TSMTERecHandle                      = ^TSMTERecPtr;


const
    uppTSMTEPreUpdateProcInfo = $000003C0;
    uppTSMTEPostUpdateProcInfo = $000FFFC0;
    {
     *  NewTSMTEPreUpdateUPP()
     *
     *  Availability:
     *    Non-Carbon CFM:   available as macro/inline
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function NewTSMTEPreUpdateUPP(userRoutine: TSMTEPreUpdateProcPtr): TSMTEPreUpdateUPP; external name '_NewTSMTEPreUpdateUPP'; { old name was NewTSMTEPreUpdateProc }
{
 *  NewTSMTEPostUpdateUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewTSMTEPostUpdateUPP(userRoutine: TSMTEPostUpdateProcPtr): TSMTEPostUpdateUPP; external name '_NewTSMTEPostUpdateUPP'; { old name was NewTSMTEPostUpdateProc }
{
 *  DisposeTSMTEPreUpdateUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeTSMTEPreUpdateUPP(userUPP: TSMTEPreUpdateUPP); external name '_DisposeTSMTEPreUpdateUPP';
{
 *  DisposeTSMTEPostUpdateUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeTSMTEPostUpdateUPP(userUPP: TSMTEPostUpdateUPP); external name '_DisposeTSMTEPostUpdateUPP';
{
 *  InvokeTSMTEPreUpdateUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvokeTSMTEPreUpdateUPP(textH: TEHandle; refCon: SInt32; userRoutine: TSMTEPreUpdateUPP); external name '_InvokeTSMTEPreUpdateUPP'; { old name was CallTSMTEPreUpdateProc }
{
 *  InvokeTSMTEPostUpdateUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvokeTSMTEPostUpdateUPP(textH: TEHandle; fixLen: SInt32; inputAreaStart: SInt32; inputAreaEnd: SInt32; pinStart: SInt32; pinEnd: SInt32; refCon: SInt32; userRoutine: TSMTEPostUpdateUPP); external name '_InvokeTSMTEPostUpdateUPP'; { old name was CallTSMTEPostUpdateProc }
{
 *  IsTSMTEDialog()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0.2 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
function IsTSMTEDialog(dialog: DialogRef): boolean; external name '_IsTSMTEDialog';

{ Getters }
{
 *  GetTSMTEDialogDocumentID()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0.2 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetTSMTEDialogDocumentID(dialog: DialogRef): TSMDocumentID; external name '_GetTSMTEDialogDocumentID';

{
 *  GetTSMTEDialogTSMTERecHandle()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0.2 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetTSMTEDialogTSMTERecHandle(dialog: DialogRef): TSMTERecHandle; external name '_GetTSMTEDialogTSMTERecHandle';

{ Setters }
{
 *  SetTSMTEDialogDocumentID()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0.2 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetTSMTEDialogDocumentID(dialog: DialogRef; documentID: TSMDocumentID); external name '_SetTSMTEDialogDocumentID';

{
 *  SetTSMTEDialogTSMTERecHandle()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CarbonAccessors.o 1.0.2 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure SetTSMTEDialogTSMTERecHandle(dialog: DialogRef; tsmteRecHandle: TSMTERecHandle); external name '_SetTSMTEDialogTSMTERecHandle';


{$ALIGN MAC68K}
{#POP}
{unit CMApplication}
{$ALIGN MAC68K}









{$setc _DECLARE_CS_QD_API_ := 1}


{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}


const
    kDefaultCMMSignature        = $6170706C (* 'appl' *);

    {    Macintosh 68K trap word    }
    cmTrap                      = $ABEE;


    {    PicComment IDs     }
    cmBeginProfile              = 220;
    cmEndProfile                = 221;
    cmEnableMatching            = 222;
    cmDisableMatching           = 223;
    cmComment                   = 224;

    {    PicComment selectors for cmComment     }
    cmBeginProfileSel           = 0;
    cmContinueProfileSel        = 1;
    cmEndProfileSel             = 2;
    cmProfileIdentifierSel      = 3;


    {    Defines for version 1.0 CMProfileSearchRecord.fieldMask    }
    cmMatchCMMType              = $00000001;
    cmMatchApplProfileVersion   = $00000002;
    cmMatchDataType             = $00000004;
    cmMatchDeviceType           = $00000008;
    cmMatchDeviceManufacturer   = $00000010;
    cmMatchDeviceModel          = $00000020;
    cmMatchDeviceAttributes     = $00000040;
    cmMatchFlags                = $00000080;
    cmMatchOptions              = $00000100;
    cmMatchWhite                = $00000200;
    cmMatchBlack                = $00000400;

    {    Defines for version 2.0 CMSearchRecord.searchMask  }
    cmMatchAnyProfile           = $00000000;
    cmMatchProfileCMMType       = $00000001;
    cmMatchProfileClass         = $00000002;
    cmMatchDataColorSpace       = $00000004;
    cmMatchProfileConnectionSpace = $00000008;
    cmMatchManufacturer         = $00000010;
    cmMatchModel                = $00000020;
    cmMatchAttributes           = $00000040;
    cmMatchProfileFlags         = $00000080;


    {    Flags for PostScript-related functions     }
    cmPS7bit                    = 1;
    cmPS8bit                    = 2;

    {    Flags for profile embedding functions  }
    cmEmbedWholeProfile         = $00000000;
    cmEmbedProfileIdentifier    = $00000001;

    {    Commands for CMFlattenUPP()    }
    cmOpenReadSpool             = 1;
    cmOpenWriteSpool            = 2;
    cmReadSpool                 = 3;
    cmWriteSpool                = 4;
    cmCloseSpool                = 5;

    {    Commands for CMAccessUPP()     }
    cmOpenReadAccess            = 1;
    cmOpenWriteAccess           = 2;
    cmReadAccess                = 3;
    cmWriteAccess               = 4;
    cmCloseAccess               = 5;
    cmCreateNewAccess           = 6;
    cmAbortWriteAccess          = 7;
    cmBeginAccess               = 8;
    cmEndAccess                 = 9;


    {    Use types for CMGet/SetDefaultProfileByUse()   }
    cmInputUse                  = $696E7074 (* 'inpt' *);
    cmOutputUse                 = $6F757470 (* 'outp' *);
    cmDisplayUse                = $64706C79 (* 'dply' *);
    cmProofUse                  = $70727566 (* 'pruf' *);


    {    Union of 1.0 and 2.0 profile header variants   }

type
    CMAppleProfileHeaderPtr = ^CMAppleProfileHeader;
    CMAppleProfileHeader = record
        case SInt16 of
        0: (
            cm1:                CMHeader;
            );
        1: (
            cm2:                CM2Header;
            );
    end;

    {    CWConcatColorWorld() definitions   }
    CMConcatProfileSetPtr = ^CMConcatProfileSet;
    CMConcatProfileSet = record
        keyIndex:               UInt16;                                 {  Zero-based  }
        count:                  UInt16;                                 {  Min 1  }
        profileSet:             array [0..0] of CMProfileRef;           {  Variable. Ordered from Source -> Dest  }
    end;

    {    NCWConcatColorWorld() definitions  }
    NCMConcatProfileSpecPtr = ^NCMConcatProfileSpec;
    NCMConcatProfileSpec = record
        renderingIntent:        UInt32;                                 {  renderingIntent override  }
        transformTag:           UInt32;                                 {  transform enumerations defined below  }
        profile:                CMProfileRef;                           {  profile  }
    end;

    NCMConcatProfileSetPtr = ^NCMConcatProfileSet;
    NCMConcatProfileSet = record
        cmm:                    OSType;                                 {  e.g. 'KCMS', 'appl', ...  uniquely ids the cmm, or 0000  }
        flags:                  UInt32;                                 {  specify quality, lookup only, no gamut checking ...  }
        flagsMask:              UInt32;                                 {  which bits of 'flags' to use to override profile  }
        profileCount:           UInt32;                                 {  how many ProfileSpecs in the following set  }
        profileSpecs:           array [0..0] of NCMConcatProfileSpec;   {  Variable. Ordered from Source -> Dest  }
    end;


const
    kNoTransform                = 0;                            {  Not used  }
    kUseAtoB                    = 1;                            {  Use 'A2B*' tag from this profile or equivalent  }
    kUseBtoA                    = 2;                            {  Use 'B2A*' tag from this profile or equivalent  }
    kUseBtoB                    = 3;                            {  Use 'pre*' tag from this profile or equivalent  }
                                                                {  For typical device profiles the following synonyms may be useful  }
    kDeviceToPCS                = 1;                            {  Device Dependent to Device Independent  }
    kPCSToDevice                = 2;                            {  Device Independent to Device Dependent  }
    kPCSToPCS                   = 3;                            {  Independent, through device's gamut  }
    kUseProfileIntent           = $FFFFFFFF;                    {  For renderingIntent in NCMConcatProfileSpec     }


    {    ColorSync color data types     }

type
    CMRGBColorPtr = ^CMRGBColor;
    CMRGBColor = record
        red:                    UInt16;                                 {  0..65535  }
        green:                  UInt16;
        blue:                   UInt16;
    end;

    CMCMYKColorPtr = ^CMCMYKColor;
    CMCMYKColor = record
        cyan:                   UInt16;                                 {  0..65535  }
        magenta:                UInt16;
        yellow:                 UInt16;
        black:                  UInt16;
    end;

    CMCMYColorPtr = ^CMCMYColor;
    CMCMYColor = record
        cyan:                   UInt16;                                 {  0..65535  }
        magenta:                UInt16;
        yellow:                 UInt16;
    end;

    CMHLSColorPtr = ^CMHLSColor;
    CMHLSColor = record
        hue:                    UInt16;                                 {  0..65535. Fraction of circle. Red at 0  }
        lightness:              UInt16;                                 {  0..65535  }
        saturation:             UInt16;                                 {  0..65535  }
    end;

    CMHSVColorPtr = ^CMHSVColor;
    CMHSVColor = record
        hue:                    UInt16;                                 {  0..65535. Fraction of circle. Red at 0  }
        saturation:             UInt16;                                 {  0..65535  }
        value:                  UInt16;                                 {  0..65535  }
    end;

    CMLabColorPtr = ^CMLabColor;
    CMLabColor = record
        L:                      UInt16;                                 {  0..65535 maps to 0..100  }
        a:                      UInt16;                                 {  0..65535 maps to -128..127.996  }
        b:                      UInt16;                                 {  0..65535 maps to -128..127.996  }
    end;

    CMLuvColorPtr = ^CMLuvColor;
    CMLuvColor = record
        L:                      UInt16;                                 {  0..65535 maps to 0..100  }
        u:                      UInt16;                                 {  0..65535 maps to -128..127.996  }
        v:                      UInt16;                                 {  0..65535 maps to -128..127.996  }
    end;

    CMYxyColorPtr = ^CMYxyColor;
    CMYxyColor = record
        capY:                   UInt16;                                 {  0..65535 maps to 0..1  }
        x:                      UInt16;                                 {  0..65535 maps to 0..1  }
        y:                      UInt16;                                 {  0..65535 maps to 0..1  }
    end;

    CMGrayColorPtr = ^CMGrayColor;
    CMGrayColor = record
        gray:                   UInt16;                                 {  0..65535  }
    end;

    CMMultichannel5ColorPtr = ^CMMultichannel5Color;
    CMMultichannel5Color = record
        components:             packed array [0..4] of UInt8;           {  0..255  }
    end;

    CMMultichannel6ColorPtr = ^CMMultichannel6Color;
    CMMultichannel6Color = record
        components:             packed array [0..5] of UInt8;           {  0..255  }
    end;

    CMMultichannel7ColorPtr = ^CMMultichannel7Color;
    CMMultichannel7Color = record
        components:             packed array [0..6] of UInt8;           {  0..255  }
    end;

    CMMultichannel8ColorPtr = ^CMMultichannel8Color;
    CMMultichannel8Color = record
        components:             packed array [0..7] of UInt8;           {  0..255  }
    end;

    CMNamedColorPtr = ^CMNamedColor;
    CMNamedColor = record
        namedColorIndex:        UInt32;                                 {  0..a lot  }
    end;

    CMColorPtr = ^CMColor;
    CMColor = record
        case SInt16 of
        0: (
            rgb:                CMRGBColor;
            );
        1: (
            hsv:                CMHSVColor;
            );
        2: (
            hls:                CMHLSColor;
            );
        3: (
            XYZ:                CMXYZColor;
            );
        4: (
            Lab:                CMLabColor;
            );
        5: (
            Luv:                CMLuvColor;
            );
        6: (
            Yxy:                CMYxyColor;
            );
        7: (
            cmyk:               CMCMYKColor;
            );
        8: (
            cmy:                CMCMYColor;
            );
        9: (
            gray:               CMGrayColor;
            );
        10: (
            mc5:                CMMultichannel5Color;
            );
        11: (
            mc6:                CMMultichannel6Color;
            );
        12: (
            mc7:                CMMultichannel7Color;
            );
        13: (
            mc8:                CMMultichannel8Color;
            );
        14: (
            namedColor:         CMNamedColor;
            );
    end;

    {    GetIndexedProfile() search definition  }
    CMProfileSearchRecordPtr = ^CMProfileSearchRecord;
    CMProfileSearchRecord = record
        header:                 CMHeader;
        fieldMask:              UInt32;
        reserved:               array [0..1] of UInt32;
    end;

    CMProfileSearchRecordHandle         = ^CMProfileSearchRecordPtr;
    {    CMNewProfileSearch() search definition     }
    CMSearchRecordPtr = ^CMSearchRecord;
    CMSearchRecord = record
        CMMType:                OSType;
        profileClass:           OSType;
        dataColorSpace:         OSType;
        profileConnectionSpace: OSType;
        deviceManufacturer:     UInt32;
        deviceModel:            UInt32;
        deviceAttributes:       array [0..1] of UInt32;
        profileFlags:           UInt32;
        searchMask:             UInt32;
        filter:                 CMProfileFilterUPP;
    end;

    {    CMMIterateUPP() structure  }
    CMMInfoPtr = ^CMMInfo;
    CMMInfo = record
        dataSize:               UInt32;                                 {  Size of this structure - compatibility }
        CMMType:                OSType;                                 {  Signature, e.g. 'appl', 'HDM ' or 'KCMS' }
        CMMMfr:                 OSType;                                 {  Vendor, e.g. 'appl' }
        CMMVersion:             UInt32;                                 {  CMM version number }
        ASCIIName:              packed array [0..31] of UInt8;          {  pascal string - name }
        ASCIIDesc:              packed array [0..255] of UInt8;         {  pascal string - description or copyright }
        UniCodeNameCount:       UniCharCount;                           {  count of UniChars in following array }
        UniCodeName:            array [0..31] of UniChar;               {  the name in UniCode chars }
        UniCodeDescCount:       UniCharCount;                           {  count of UniChars in following array }
        UniCodeDesc:            array [0..255] of UniChar;              {  the description in UniCode chars }
    end;

    {    GetCWInfo() structures     }
    CMMInfoRecordPtr = ^CMMInfoRecord;
    CMMInfoRecord = record
        CMMType:                OSType;
        CMMVersion:             SInt32;
    end;

    CMCWInfoRecordPtr = ^CMCWInfoRecord;
    CMCWInfoRecord = record
        cmmCount:               UInt32;
        cmmInfo:                array [0..1] of CMMInfoRecord;
    end;

    {    profile identifier structures  }
    CMProfileIdentifierPtr = ^CMProfileIdentifier;
    CMProfileIdentifier = record
        profileHeader:          CM2Header;
        calibrationDate:        CMDateTime;
        ASCIIProfileDescriptionLen: UInt32;
        ASCIIProfileDescription: SInt8;                                 {  variable length  }
    end;

    {    colorspace masks   }

const
    cmColorSpaceSpaceMask       = $0000003F;
    cmColorSpacePremulAlphaMask = $00000040;
    cmColorSpaceAlphaMask       = $00000080;
    cmColorSpaceSpaceAndAlphaMask = $000000FF;
    cmColorSpacePackingMask     = $0000FF00;
    cmColorSpaceEncodingMask    = $000F0000;
    cmColorSpaceReservedMask    = $FFF00000;

    {    packing formats    }
    cmNoColorPacking            = $0000;
    cmWord5ColorPacking         = $0500;
    cmWord565ColorPacking       = $0600;
    cmLong8ColorPacking         = $0800;
    cmLong10ColorPacking        = $0A00;
    cmAlphaFirstPacking         = $1000;
    cmOneBitDirectPacking       = $0B00;
    cmAlphaLastPacking          = $0000;
    cm8_8ColorPacking           = $2800;
    cm16_8ColorPacking          = $2000;
    cm24_8ColorPacking          = $2100;
    cm32_8ColorPacking          = $0800;
    cm40_8ColorPacking          = $2200;
    cm48_8ColorPacking          = $2300;
    cm56_8ColorPacking          = $2400;
    cm64_8ColorPacking          = $2500;
    cm32_16ColorPacking         = $2600;
    cm48_16ColorPacking         = $2900;
    cm64_16ColorPacking         = $2A00;
    cm32_32ColorPacking         = $2700;
    cmLittleEndianPacking       = $4000;
    cmReverseChannelPacking     = $8000;

    {    channel encoding format    }
    cmSRGB16ChannelEncoding     = $00010000;                    {  used for sRGB64 encoding ( ±3.12 format) }

    {    general colorspaces    }
    cmNoSpace                   = $0000;
    cmRGBSpace                  = $0001;
    cmCMYKSpace                 = $0002;
    cmHSVSpace                  = $0003;
    cmHLSSpace                  = $0004;
    cmYXYSpace                  = $0005;
    cmXYZSpace                  = $0006;
    cmLUVSpace                  = $0007;
    cmLABSpace                  = $0008;
    cmReservedSpace1            = $0009;
    cmGraySpace                 = $000A;
    cmReservedSpace2            = $000B;
    cmGamutResultSpace          = $000C;
    cmNamedIndexedSpace         = $0010;
    cmMCFiveSpace               = $0011;
    cmMCSixSpace                = $0012;
    cmMCSevenSpace              = $0013;
    cmMCEightSpace              = $0014;
    cmAlphaPmulSpace            = $0040;
    cmAlphaSpace                = $0080;
    cmRGBASpace                 = $0081;
    cmGrayASpace                = $008A;
    cmRGBAPmulSpace             = $00C1;
    cmGrayAPmulSpace            = $00CA;

    {    supported CMBitmapColorSpaces - Each of the following is a     }
    {    combination of a general colospace and a packing formats.  }
    {    Each can also be or'd with cmReverseChannelPacking.    }
    cmGray8Space                = $280A;
    cmGray16Space               = $000A;
    cmGray16LSpace              = $400A;
    cmGrayA16Space              = $208A;
    cmGrayA32Space              = $008A;
    cmGrayA32LSpace             = $408A;
    cmGrayA16PmulSpace          = $20CA;
    cmGrayA32PmulSpace          = $00CA;
    cmGrayA32LPmulSpace         = $40CA;
    cmRGB16Space                = $0501;
    cmRGB16LSpace               = $4501;
    cmRGB565Space               = $0601;
    cmRGB565LSpace              = $4601;
    cmRGB24Space                = $2101;
    cmRGB32Space                = $0801;
    cmRGB48Space                = $2901;
    cmRGB48LSpace               = $6901;
    cmARGB32Space               = $1881;
    cmARGB64Space               = $3A81;
    cmARGB64LSpace              = $7A81;
    cmRGBA32Space               = $0881;
    cmRGBA64Space               = $2A81;
    cmRGBA64LSpace              = $6A81;
    cmARGB32PmulSpace           = $18C1;
    cmARGB64PmulSpace           = $3AC1;
    cmARGB64LPmulSpace          = $7AC1;
    cmRGBA32PmulSpace           = $08C1;
    cmRGBA64PmulSpace           = $2AC1;
    cmRGBA64LPmulSpace          = $6AC1;
    cmCMYK32Space               = $0802;
    cmCMYK64Space               = $2A02;
    cmCMYK64LSpace              = $6A02;
    cmHSV32Space                = $0A03;
    cmHLS32Space                = $0A04;
    cmYXY32Space                = $0A05;
    cmXYZ24Space                = $2106;
    cmXYZ32Space                = $0A06;
    cmXYZ48Space                = $2906;
    cmXYZ48LSpace               = $6906;
    cmLUV32Space                = $0A07;
    cmLAB24Space                = $2108;
    cmLAB32Space                = $0A08;
    cmLAB48Space                = $2908;
    cmLAB48LSpace               = $6908;
    cmGamutResult1Space         = $0B0C;
    cmNamedIndexed32Space       = $2710;
    cmNamedIndexed32LSpace      = $6710;
    cmMCFive8Space              = $2211;
    cmMCSix8Space               = $2312;
    cmMCSeven8Space             = $2413;
    cmMCEight8Space             = $2514;



type
    CMBitmapColorSpace                  = UInt32;
    CMBitmapPtr = ^CMBitmap;
    CMBitmap = record
        image:                  CStringPtr;
        width:                  SInt32;
        height:                 SInt32;
        rowBytes:               SInt32;
        pixelSize:              SInt32;
        space:                  CMBitmapColorSpace;
        user1:                  SInt32;
        user2:                  SInt32;
    end;

    {    CMConvertXYZToXYZ() definitions    }
    CMChromaticAdaptation               = UInt32;

const
    cmUseDefaultChromaticAdaptation = 0;
    cmLinearChromaticAdaptation = 1;
    cmVonKriesChromaticAdaptation = 2;
    cmBradfordChromaticAdaptation = 3;


    {    Profile Locations  }
    CS_MAX_PATH                 = 256;

    cmNoProfileBase             = 0;
    cmFileBasedProfile          = 1;
    cmHandleBasedProfile        = 2;
    cmPtrBasedProfile           = 3;
    cmProcedureBasedProfile     = 4;
    cmPathBasedProfile          = 5;
    cmBufferBasedProfile        = 6;


type
    CMFileLocationPtr = ^CMFileLocation;
    CMFileLocation = record
        spec:                   FSSpec;
    end;

    CMHandleLocationPtr = ^CMHandleLocation;
    CMHandleLocation = record
        h:                      Handle;
    end;

    CMPtrLocationPtr = ^CMPtrLocation;
    CMPtrLocation = record
        p:                      Ptr;
    end;

    CMProcedureLocationPtr = ^CMProcedureLocation;
    CMProcedureLocation = record
        proc:                   CMProfileAccessUPP;
        refCon:                 Ptr;
    end;

    CMPathLocationPtr = ^CMPathLocation;
    CMPathLocation = record
        path:                   packed array [0..255] of char;
    end;

    CMBufferLocationPtr = ^CMBufferLocation;
    CMBufferLocation = record
        buffer:                 Ptr;
        size:                   UInt32;
    end;

    CMProfLocPtr = ^CMProfLoc;
    CMProfLoc = record
        case SInt16 of
        0: (
            fileLoc:            CMFileLocation;
            );
        1: (
            handleLoc:          CMHandleLocation;
            );
        2: (
            ptrLoc:             CMPtrLocation;
            );
        3: (
            procLoc:            CMProcedureLocation;
            );
        4: (
            pathLoc:            CMPathLocation;
            );
        5: (
            bufferLoc:          CMBufferLocation;
            );
    end;

    CMProfileLocationPtr = ^CMProfileLocation;
    CMProfileLocation = record
        locType:                SInt16;
        u:                      CMProfLoc;
    end;


const
    cmOriginalProfileLocationSize = 72;
    cmCurrentProfileLocationSize = 258;


    {    Typedef for Profile MD5 message digest     }

type
    CMProfileMD5                        = packed array [0..15] of UInt8;
    CMProfileMD5Ptr                     = ^CMProfileMD5;
    {    Struct and enums used for Profile iteration    }

const
    cmProfileIterateDataVersion1 = $00010000;
    cmProfileIterateDataVersion2 = $00020000;                   {  Added makeAndModel }
    cmProfileIterateDataVersion3 = $00030000;                   {  Added MD5 digest }


type
    CMProfileIterateDataPtr = ^CMProfileIterateData;
    CMProfileIterateData = record
        dataVersion:            UInt32;                                 {  cmProfileIterateDataVersion2  }
        header:                 CM2Header;
        code:                   ScriptCode;
        name:                   Str255;
        location:               CMProfileLocation;
        uniCodeNameCount:       UniCharCount;
        uniCodeName:            UniCharPtr;
        asciiName:              Ptr;
        makeAndModel:           CMMakeAndModelPtr;
        digest:                 CMProfileMD5Ptr;
    end;

    {    Caller-supplied callback function for Profile & CMM iteration  }
    CMProfileIterateProcPtr = function(var iterateData: CMProfileIterateData; refCon: UnivPtr): OSErr;

    CMMIterateProcPtr = function(var iterateData: CMMInfo; refCon: UnivPtr): OSErr;

    CMProfileIterateUPP = ^SInt32; { an opaque UPP }
    CMMIterateUPP = ^SInt32; { an opaque UPP }

const
    uppCMProfileIterateProcInfo = $000003E0;
    uppCMMIterateProcInfo = $000003E0;
    {
     *  NewCMProfileIterateUPP()
     *
     *  Availability:
     *    Non-Carbon CFM:   available as macro/inline
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in 3.0 and later
        }
function NewCMProfileIterateUPP(userRoutine: CMProfileIterateProcPtr): CMProfileIterateUPP; external name '_NewCMProfileIterateUPP'; { old name was NewCMProfileIterateProc }
{
 *  NewCMMIterateUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
function NewCMMIterateUPP(userRoutine: CMMIterateProcPtr): CMMIterateUPP; external name '_NewCMMIterateUPP'; { old name was NewCMMIterateProc }
{
 *  DisposeCMProfileIterateUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
procedure DisposeCMProfileIterateUPP(userUPP: CMProfileIterateUPP); external name '_DisposeCMProfileIterateUPP';
{
 *  DisposeCMMIterateUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
procedure DisposeCMMIterateUPP(userUPP: CMMIterateUPP); external name '_DisposeCMMIterateUPP';
{
 *  InvokeCMProfileIterateUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
function InvokeCMProfileIterateUPP(var iterateData: CMProfileIterateData; refCon: UnivPtr; userRoutine: CMProfileIterateUPP): OSErr; external name '_InvokeCMProfileIterateUPP'; { old name was CallCMProfileIterateProc }
{
 *  InvokeCMMIterateUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
function InvokeCMMIterateUPP(var iterateData: CMMInfo; refCon: UnivPtr; userRoutine: CMMIterateUPP): OSErr; external name '_InvokeCMMIterateUPP'; { old name was CallCMMIterateProc }
{ Profile file and element access }
{
 *  CMNewProfile()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ColorSyncLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
function CMNewProfile(var prof: CMProfileRef; const (*var*) theProfile: CMProfileLocation): CMError; external name '_CMNewProfile';
{
 *  CMOpenProfile()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ColorSyncLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
function CMOpenProfile(var prof: CMProfileRef; const (*var*) theProfile: CMProfileLocation): CMError; external name '_CMOpenProfile';
{
 *  CMCloseProfile()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ColorSyncLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
function CMCloseProfile(prof: CMProfileRef): CMError; external name '_CMCloseProfile';
{
 *  CMUpdateProfile()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ColorSyncLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
function CMUpdateProfile(prof: CMProfileRef): CMError; external name '_CMUpdateProfile';
{
 *  CMCopyProfile()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ColorSyncLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
function CMCopyProfile(var targetProf: CMProfileRef; const (*var*) targetLocation: CMProfileLocation; srcProf: CMProfileRef): CMError; external name '_CMCopyProfile';
{
 *  CMValidateProfile()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ColorSyncLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
function CMValidateProfile(prof: CMProfileRef; var valid: boolean; var preferredCMMnotfound: boolean): CMError; external name '_CMValidateProfile';
{
 *  CMGetProfileLocation()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ColorSyncLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
function CMGetProfileLocation(prof: CMProfileRef; var theProfile: CMProfileLocation): CMError; external name '_CMGetProfileLocation';
{
 *  NCMGetProfileLocation()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ColorSyncLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
function NCMGetProfileLocation(prof: CMProfileRef; var theProfile: CMProfileLocation; var locationSize: UInt32): CMError; external name '_NCMGetProfileLocation';
{
 *  CMFlattenProfile()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ColorSyncLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
function CMFlattenProfile(prof: CMProfileRef; flags: UInt32; proc: CMFlattenUPP; refCon: UnivPtr; var preferredCMMnotfound: boolean): CMError; external name '_CMFlattenProfile';

{
 *  CMGetProfileHeader()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ColorSyncLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
function CMGetProfileHeader(prof: CMProfileRef; var header: CMAppleProfileHeader): CMError; external name '_CMGetProfileHeader';
{
 *  CMSetProfileHeader()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ColorSyncLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
function CMSetProfileHeader(prof: CMProfileRef; const (*var*) header: CMAppleProfileHeader): CMError; external name '_CMSetProfileHeader';
{
 *  CMProfileElementExists()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ColorSyncLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
function CMProfileElementExists(prof: CMProfileRef; tag: OSType; var found: boolean): CMError; external name '_CMProfileElementExists';
{
 *  CMCountProfileElements()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ColorSyncLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
function CMCountProfileElements(prof: CMProfileRef; var elementCount: UInt32): CMError; external name '_CMCountProfileElements';
{
 *  CMGetProfileElement()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ColorSyncLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
function CMGetProfileElement(prof: CMProfileRef; tag: OSType; var elementSize: UInt32; elementData: UnivPtr): CMError; external name '_CMGetProfileElement';
{
 *  CMSetProfileElement()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ColorSyncLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
function CMSetProfileElement(prof: CMProfileRef; tag: OSType; elementSize: UInt32; elementData: UnivPtr): CMError; external name '_CMSetProfileElement';
{
 *  CMSetProfileElementSize()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ColorSyncLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
function CMSetProfileElementSize(prof: CMProfileRef; tag: OSType; elementSize: UInt32): CMError; external name '_CMSetProfileElementSize';
{
 *  CMSetProfileElementReference()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ColorSyncLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
function CMSetProfileElementReference(prof: CMProfileRef; elementTag: OSType; referenceTag: OSType): CMError; external name '_CMSetProfileElementReference';
{
 *  CMGetPartialProfileElement()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ColorSyncLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
function CMGetPartialProfileElement(prof: CMProfileRef; tag: OSType; offset: UInt32; var byteCount: UInt32; elementData: UnivPtr): CMError; external name '_CMGetPartialProfileElement';
{
 *  CMSetPartialProfileElement()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ColorSyncLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
function CMSetPartialProfileElement(prof: CMProfileRef; tag: OSType; offset: UInt32; byteCount: UInt32; elementData: UnivPtr): CMError; external name '_CMSetPartialProfileElement';
{
 *  CMGetIndProfileElementInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ColorSyncLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
function CMGetIndProfileElementInfo(prof: CMProfileRef; index: UInt32; var tag: OSType; var elementSize: UInt32; var refs: boolean): CMError; external name '_CMGetIndProfileElementInfo';
{
 *  CMGetIndProfileElement()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ColorSyncLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
function CMGetIndProfileElement(prof: CMProfileRef; index: UInt32; var elementSize: UInt32; elementData: UnivPtr): CMError; external name '_CMGetIndProfileElement';
{
 *  CMRemoveProfileElement()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ColorSyncLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
function CMRemoveProfileElement(prof: CMProfileRef; tag: OSType): CMError; external name '_CMRemoveProfileElement';
{
 *  CMGetScriptProfileDescription()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ColorSyncLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
function CMGetScriptProfileDescription(prof: CMProfileRef; var name: Str255; var code: ScriptCode): CMError; external name '_CMGetScriptProfileDescription';
{
 *  CMGetProfileDescriptions()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ColorSyncLib 2.6 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
function CMGetProfileDescriptions(prof: CMProfileRef; aName: CStringPtr; var aCount: UInt32; var mName: Str255; var mCode: ScriptCode; var uName: UniChar; var uCount: UniCharCount): CMError; external name '_CMGetProfileDescriptions';
{
 *  CMSetProfileDescriptions()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ColorSyncLib 2.6 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
function CMSetProfileDescriptions(prof: CMProfileRef; aName: ConstCStringPtr; aCount: UInt32; const (*var*) mName: Str255; mCode: ScriptCode; uName: ConstUniCharPtr; uCount: UniCharCount): CMError; external name '_CMSetProfileDescriptions';
{
 *  CMCopyProfileLocalizedStringDictionary()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ColorSyncLib 3.1 and later
 *    CarbonLib:        not available
 *    Mac OS X:         in 3.1 and later
 }
function CMCopyProfileLocalizedStringDictionary(prof: CMProfileRef; tag: OSType; var theDict: CFDictionaryRef): CMError; external name '_CMCopyProfileLocalizedStringDictionary';

{
 *  CMSetProfileLocalizedStringDictionary()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ColorSyncLib 3.1 and later
 *    CarbonLib:        not available
 *    Mac OS X:         in 3.1 and later
 }
function CMSetProfileLocalizedStringDictionary(prof: CMProfileRef; tag: OSType; theDict: CFDictionaryRef): CMError; external name '_CMSetProfileLocalizedStringDictionary';

{
 *  CMCopyProfileLocalizedString()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ColorSyncLib 3.1 and later
 *    CarbonLib:        not available
 *    Mac OS X:         in 3.1 and later
 }
function CMCopyProfileLocalizedString(prof: CMProfileRef; tag: OSType; reqLocale: CFStringRef; var locale: CFStringRef; var str: CFStringRef): CMError; external name '_CMCopyProfileLocalizedString';

{
 *  CMCloneProfileRef()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ColorSyncLib 2.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
function CMCloneProfileRef(prof: CMProfileRef): CMError; external name '_CMCloneProfileRef';
{
 *  CMGetProfileRefCount()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ColorSyncLib 2.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
function CMGetProfileRefCount(prof: CMProfileRef; var count: SInt32): CMError; external name '_CMGetProfileRefCount';
{
 *  CMProfileModified()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ColorSyncLib 2.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
function CMProfileModified(prof: CMProfileRef; var modified: boolean): CMError; external name '_CMProfileModified';
{
 *  CMGetProfileMD5()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in 3.1 and later
 }
function CMGetProfileMD5(prof: CMProfileRef; var digest: CMProfileMD5): CMError; external name '_CMGetProfileMD5';


{ named Color access functions }
{
 *  CMGetNamedColorInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ColorSyncLib 2.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
function CMGetNamedColorInfo(prof: CMProfileRef; var deviceChannels: UInt32; var deviceColorSpace: OSType; var PCSColorSpace: OSType; var count: UInt32; prefix: StringPtr; suffix: StringPtr): CMError; external name '_CMGetNamedColorInfo';
{
 *  CMGetNamedColorValue()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ColorSyncLib 2.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
function CMGetNamedColorValue(prof: CMProfileRef; name: StringPtr; var deviceColor: CMColor; var PCSColor: CMColor): CMError; external name '_CMGetNamedColorValue';
{
 *  CMGetIndNamedColorValue()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ColorSyncLib 2.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
function CMGetIndNamedColorValue(prof: CMProfileRef; index: UInt32; var deviceColor: CMColor; var PCSColor: CMColor): CMError; external name '_CMGetIndNamedColorValue';
{
 *  CMGetNamedColorIndex()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ColorSyncLib 2.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
function CMGetNamedColorIndex(prof: CMProfileRef; name: StringPtr; var index: UInt32): CMError; external name '_CMGetNamedColorIndex';
{
 *  CMGetNamedColorName()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ColorSyncLib 2.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
function CMGetNamedColorName(prof: CMProfileRef; index: UInt32; name: StringPtr): CMError; external name '_CMGetNamedColorName';
{ General-purpose matching functions }
{
 *  NCWNewColorWorld()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ColorSyncLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
function NCWNewColorWorld(var cw: CMWorldRef; src: CMProfileRef; dst: CMProfileRef): CMError; external name '_NCWNewColorWorld';
{
 *  CWConcatColorWorld()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ColorSyncLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
function CWConcatColorWorld(var cw: CMWorldRef; var profileSet: CMConcatProfileSet): CMError; external name '_CWConcatColorWorld';
{
 *  CWNewLinkProfile()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ColorSyncLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
function CWNewLinkProfile(var prof: CMProfileRef; const (*var*) targetLocation: CMProfileLocation; var profileSet: CMConcatProfileSet): CMError; external name '_CWNewLinkProfile';
{
 *  NCWConcatColorWorld()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ColorSyncLib 2.6 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
function NCWConcatColorWorld(var cw: CMWorldRef; var profileSet: NCMConcatProfileSet; proc: CMConcatCallBackUPP; refCon: UnivPtr): CMError; external name '_NCWConcatColorWorld';
{
 *  NCWNewLinkProfile()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ColorSyncLib 2.6 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
function NCWNewLinkProfile(var prof: CMProfileRef; const (*var*) targetLocation: CMProfileLocation; var profileSet: NCMConcatProfileSet; proc: CMConcatCallBackUPP; refCon: UnivPtr): CMError; external name '_NCWNewLinkProfile';
{
 *  CWDisposeColorWorld()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ColorSyncLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
procedure CWDisposeColorWorld(cw: CMWorldRef); external name '_CWDisposeColorWorld';
{
 *  CWMatchColors()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ColorSyncLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
function CWMatchColors(cw: CMWorldRef; var myColors: CMColor; count: UInt32): CMError; external name '_CWMatchColors';
{
 *  CWCheckColors()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ColorSyncLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
function CWCheckColors(cw: CMWorldRef; var myColors: CMColor; count: UInt32; var result: UInt32): CMError; external name '_CWCheckColors';
{
 *  CWMatchBitmap()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ColorSyncLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
function CWMatchBitmap(cw: CMWorldRef; var bitmap: CMBitmap; progressProc: CMBitmapCallBackUPP; refCon: UnivPtr; var matchedBitmap: CMBitmap): CMError; external name '_CWMatchBitmap';
{
 *  CWCheckBitmap()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ColorSyncLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
function CWCheckBitmap(cw: CMWorldRef; const (*var*) bitmap: CMBitmap; progressProc: CMBitmapCallBackUPP; refCon: UnivPtr; var resultBitmap: CMBitmap): CMError; external name '_CWCheckBitmap';
{ Quickdraw-specific matching }
{
 *  CWMatchPixMap()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ColorSyncLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         not available
 }
function CWMatchPixMap(cw: CMWorldRef; var myPixMap: PixMap; progressProc: CMBitmapCallBackUPP; refCon: UnivPtr): CMError; external name '_CWMatchPixMap';
{
 *  CWCheckPixMap()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ColorSyncLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         not available
 }
function CWCheckPixMap(cw: CMWorldRef; var myPixMap: PixMap; progressProc: CMBitmapCallBackUPP; refCon: UnivPtr; var resultBitMap: BitMap): CMError; external name '_CWCheckPixMap';
{
 *  NCMBeginMatching()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ColorSyncLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         not available
 }
function NCMBeginMatching(src: CMProfileRef; dst: CMProfileRef; var myRef: CMMatchRef): CMError; external name '_NCMBeginMatching';
{
 *  CMEndMatching()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ColorSyncLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         not available
 }
procedure CMEndMatching(myRef: CMMatchRef); external name '_CMEndMatching';
{
 *  NCMDrawMatchedPicture()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ColorSyncLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         not available
 }
procedure NCMDrawMatchedPicture(myPicture: PicHandle; dst: CMProfileRef; var myRect: Rect); external name '_NCMDrawMatchedPicture';
{
 *  CMEnableMatchingComment()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ColorSyncLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         not available
 }
procedure CMEnableMatchingComment(enableIt: boolean); external name '_CMEnableMatchingComment';
{
 *  NCMUseProfileComment()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ColorSyncLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         not available
 }
function NCMUseProfileComment(prof: CMProfileRef; flags: UInt32): CMError; external name '_NCMUseProfileComment';


{
 *  CMCreateProfileIdentifier()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ColorSyncLib 2.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
function CMCreateProfileIdentifier(prof: CMProfileRef; ident: CMProfileIdentifierPtr; var size: UInt32): CMError; external name '_CMCreateProfileIdentifier';
{ System Profile access }
{
 *  CMGetSystemProfile()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ColorSyncLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
function CMGetSystemProfile(var prof: CMProfileRef): CMError; external name '_CMGetSystemProfile';
{
 *  CMSetSystemProfile()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ColorSyncLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
function CMSetSystemProfile(const (*var*) profileFileSpec: FSSpec): CMError; external name '_CMSetSystemProfile';
{
 *  NCMSetSystemProfile()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ColorSyncLib 2.6 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
function NCMSetSystemProfile(const (*var*) profLoc: CMProfileLocation): CMError; external name '_NCMSetSystemProfile';
{
 *  CMGetDefaultProfileBySpace()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ColorSyncLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
function CMGetDefaultProfileBySpace(dataColorSpace: OSType; var prof: CMProfileRef): CMError; external name '_CMGetDefaultProfileBySpace';
{
 *  CMSetDefaultProfileBySpace()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ColorSyncLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
function CMSetDefaultProfileBySpace(dataColorSpace: OSType; prof: CMProfileRef): CMError; external name '_CMSetDefaultProfileBySpace';
{
 *  CMGetProfileByAVID()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ColorSyncLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
function CMGetProfileByAVID(theID: CMDisplayIDType; var prof: CMProfileRef): CMError; external name '_CMGetProfileByAVID';
{
 *  CMSetProfileByAVID()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ColorSyncLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
function CMSetProfileByAVID(theID: CMDisplayIDType; prof: CMProfileRef): CMError; external name '_CMSetProfileByAVID';
{
 *  CMGetGammaByAVID()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ColorSyncLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
function CMGetGammaByAVID(theID: CMDisplayIDType; var gamma: CMVideoCardGamma; var size: UInt32): CMError; external name '_CMGetGammaByAVID';

{
 *  CMSetGammaByAVID()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ColorSyncLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
function CMSetGammaByAVID(theID: CMDisplayIDType; var gamma: CMVideoCardGamma): CMError; external name '_CMSetGammaByAVID';


{ Profile access by Use }
{
 *  CMGetDefaultProfileByUse()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ColorSyncLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
function CMGetDefaultProfileByUse(use: OSType; var prof: CMProfileRef): CMError; external name '_CMGetDefaultProfileByUse';
{
 *  CMSetDefaultProfileByUse()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ColorSyncLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
function CMSetDefaultProfileByUse(use: OSType; prof: CMProfileRef): CMError; external name '_CMSetDefaultProfileByUse';
{ Profile Management }
{
 *  CMNewProfileSearch()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ColorSyncLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
function CMNewProfileSearch(var searchSpec: CMSearchRecord; refCon: UnivPtr; var count: UInt32; var searchResult: CMProfileSearchRef): CMError; external name '_CMNewProfileSearch';
{
 *  CMUpdateProfileSearch()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ColorSyncLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
function CMUpdateProfileSearch(search: CMProfileSearchRef; refCon: UnivPtr; var count: UInt32): CMError; external name '_CMUpdateProfileSearch';
{
 *  CMDisposeProfileSearch()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ColorSyncLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
procedure CMDisposeProfileSearch(search: CMProfileSearchRef); external name '_CMDisposeProfileSearch';
{
 *  CMSearchGetIndProfile()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ColorSyncLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
function CMSearchGetIndProfile(search: CMProfileSearchRef; index: UInt32; var prof: CMProfileRef): CMError; external name '_CMSearchGetIndProfile';
{
 *  CMSearchGetIndProfileFileSpec()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ColorSyncLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
function CMSearchGetIndProfileFileSpec(search: CMProfileSearchRef; index: UInt32; var profileFile: FSSpec): CMError; external name '_CMSearchGetIndProfileFileSpec';
{
 *  CMProfileIdentifierFolderSearch()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ColorSyncLib 2.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
function CMProfileIdentifierFolderSearch(ident: CMProfileIdentifierPtr; var matchedCount: UInt32; var searchResult: CMProfileSearchRef): CMError; external name '_CMProfileIdentifierFolderSearch';
{
 *  CMProfileIdentifierListSearch()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ColorSyncLib 2.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
function CMProfileIdentifierListSearch(ident: CMProfileIdentifierPtr; var profileList: CMProfileRef; listSize: UInt32; var matchedCount: UInt32; var matchedList: CMProfileRef): CMError; external name '_CMProfileIdentifierListSearch';
{
 *  CMIterateColorSyncFolder()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ColorSyncLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
function CMIterateColorSyncFolder(proc: CMProfileIterateUPP; var seed: UInt32; var count: UInt32; refCon: UnivPtr): CMError; external name '_CMIterateColorSyncFolder';
{
 *  NCMUnflattenProfile()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ColorSyncLib 2.6 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
function NCMUnflattenProfile(var targetLocation: CMProfileLocation; proc: CMFlattenUPP; refCon: UnivPtr; var preferredCMMnotfound: boolean): CMError; external name '_NCMUnflattenProfile';
{ Utilities }
{
 *  CMGetColorSyncFolderSpec()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ColorSyncLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
function CMGetColorSyncFolderSpec(vRefNum: SInt16; createFolder: boolean; var foundVRefNum: SInt16; var foundDirID: SInt32): CMError; external name '_CMGetColorSyncFolderSpec';


{
 *  CMGetCWInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ColorSyncLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
function CMGetCWInfo(cw: CMWorldRef; var info: CMCWInfoRecord): CMError; external name '_CMGetCWInfo';

{
 *  CMGetPreferredCMM()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ColorSyncLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
function CMGetPreferredCMM(var cmmType: OSType; var preferredCMMnotfound: boolean): CMError; external name '_CMGetPreferredCMM';
{
 *  CMIterateCMMInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ColorSyncLib 2.6 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
function CMIterateCMMInfo(proc: CMMIterateUPP; var count: UInt32; refCon: UnivPtr): CMError; external name '_CMIterateCMMInfo';
{
 *  CMGetColorSyncVersion()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ColorSyncLib 2.6 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
function CMGetColorSyncVersion(var version: UInt32): CMError; external name '_CMGetColorSyncVersion';
{
 *  CMLaunchControlPanel()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ColorSyncLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
function CMLaunchControlPanel(flags: UInt32): CMError; external name '_CMLaunchControlPanel';

{ ColorSpace conversion functions }
{
 *  CMConvertXYZToLab()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ColorSyncLib 2.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
function CMConvertXYZToLab(const (*var*) src: CMColor; const (*var*) white: CMXYZColor; var dst: CMColor; count: UInt32): CMError; external name '_CMConvertXYZToLab';
{
 *  CMConvertLabToXYZ()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ColorSyncLib 2.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
function CMConvertLabToXYZ(const (*var*) src: CMColor; const (*var*) white: CMXYZColor; var dst: CMColor; count: UInt32): CMError; external name '_CMConvertLabToXYZ';
{
 *  CMConvertXYZToLuv()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ColorSyncLib 2.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
function CMConvertXYZToLuv(const (*var*) src: CMColor; const (*var*) white: CMXYZColor; var dst: CMColor; count: UInt32): CMError; external name '_CMConvertXYZToLuv';
{
 *  CMConvertLuvToXYZ()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ColorSyncLib 2.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
function CMConvertLuvToXYZ(const (*var*) src: CMColor; const (*var*) white: CMXYZColor; var dst: CMColor; count: UInt32): CMError; external name '_CMConvertLuvToXYZ';
{
 *  CMConvertXYZToYxy()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ColorSyncLib 2.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
function CMConvertXYZToYxy(const (*var*) src: CMColor; var dst: CMColor; count: UInt32): CMError; external name '_CMConvertXYZToYxy';
{
 *  CMConvertYxyToXYZ()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ColorSyncLib 2.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
function CMConvertYxyToXYZ(const (*var*) src: CMColor; var dst: CMColor; count: UInt32): CMError; external name '_CMConvertYxyToXYZ';
{
 *  CMConvertRGBToHLS()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ColorSyncLib 2.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
function CMConvertRGBToHLS(const (*var*) src: CMColor; var dst: CMColor; count: UInt32): CMError; external name '_CMConvertRGBToHLS';
{
 *  CMConvertHLSToRGB()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ColorSyncLib 2.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
function CMConvertHLSToRGB(const (*var*) src: CMColor; var dst: CMColor; count: UInt32): CMError; external name '_CMConvertHLSToRGB';
{
 *  CMConvertRGBToHSV()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ColorSyncLib 2.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
function CMConvertRGBToHSV(const (*var*) src: CMColor; var dst: CMColor; count: UInt32): CMError; external name '_CMConvertRGBToHSV';
{
 *  CMConvertHSVToRGB()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ColorSyncLib 2.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
function CMConvertHSVToRGB(const (*var*) src: CMColor; var dst: CMColor; count: UInt32): CMError; external name '_CMConvertHSVToRGB';
{
 *  CMConvertRGBToGray()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ColorSyncLib 2.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
function CMConvertRGBToGray(const (*var*) src: CMColor; var dst: CMColor; count: UInt32): CMError; external name '_CMConvertRGBToGray';
{
 *  CMConvertXYZToFixedXYZ()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ColorSyncLib 2.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
function CMConvertXYZToFixedXYZ(const (*var*) src: CMXYZColor; var dst: CMFixedXYZColor; count: UInt32): CMError; external name '_CMConvertXYZToFixedXYZ';
{
 *  CMConvertFixedXYZToXYZ()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ColorSyncLib 2.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
function CMConvertFixedXYZToXYZ(const (*var*) src: CMFixedXYZColor; var dst: CMXYZColor; count: UInt32): CMError; external name '_CMConvertFixedXYZToXYZ';
{
 *  CMConvertXYZToXYZ()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in 3.1 and later
 }
function CMConvertXYZToXYZ(const (*var*) src: CMColor; const (*var*) srcIlluminant: CMXYZColor; var dst: CMColor; const (*var*) dstIlluminant: CMXYZColor; method: CMChromaticAdaptation; count: UInt32): CMError; external name '_CMConvertXYZToXYZ';


{ PS-related }
{
 *  CMGetPS2ColorSpace()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ColorSyncLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
function CMGetPS2ColorSpace(srcProf: CMProfileRef; flags: UInt32; proc: CMFlattenUPP; refCon: UnivPtr; var preferredCMMnotfound: boolean): CMError; external name '_CMGetPS2ColorSpace';
{
 *  CMGetPS2ColorRenderingIntent()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ColorSyncLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
function CMGetPS2ColorRenderingIntent(srcProf: CMProfileRef; flags: UInt32; proc: CMFlattenUPP; refCon: UnivPtr; var preferredCMMnotfound: boolean): CMError; external name '_CMGetPS2ColorRenderingIntent';
{
 *  CMGetPS2ColorRendering()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ColorSyncLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
function CMGetPS2ColorRendering(srcProf: CMProfileRef; dstProf: CMProfileRef; flags: UInt32; proc: CMFlattenUPP; refCon: UnivPtr; var preferredCMMnotfound: boolean): CMError; external name '_CMGetPS2ColorRendering';
{
 *  CMGetPS2ColorRenderingVMSize()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ColorSyncLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
function CMGetPS2ColorRenderingVMSize(srcProf: CMProfileRef; dstProf: CMProfileRef; var vmSize: UInt32; var preferredCMMnotfound: boolean): CMError; external name '_CMGetPS2ColorRenderingVMSize';
{ ColorSync 1.0 functions which have parallel 2.0 counterparts }

{$ALIGN MAC68K}
{#POP}
{unit CMCalibrator}
{$ALIGN MAC68K}










{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}


type
    CalibrateEventProcPtr = procedure(var event: EventRecord);

    CalibrateEventUPP = ^SInt32; { an opaque UPP }

    {  Interface for new ColorSync monitor calibrators (ColorSync 2.6 and greater)  }


const
    kCalibratorNamePrefix       = $63616C69 (* 'cali' *);


type
    CalibratorInfoPtr = ^CalibratorInfo;
    CalibratorInfo = record
        dataSize:               UInt32;                                 {  Size of this structure - compatibility  }
        displayID:              CMDisplayIDType;                        {  Contains an hDC on Win32  }
        profileLocationSize:    UInt32;                                 {  Max size for returned profile location  }
        profileLocationPtr:     CMProfileLocationPtr;                   {  For returning the profile  }
        eventProc:              CalibrateEventUPP;                      {  Ignored on Win32  }
        isGood:                 boolean;                                {  true or false  }
    end;

    CanCalibrateProcPtr = function(displayID: CMDisplayIDType; var errMessage: Str255): boolean;

    CalibrateProcPtr = function(var theInfo: CalibratorInfo): OSErr;

    CanCalibrateUPP = ^SInt32; { an opaque UPP }
    CalibrateUPP = ^SInt32; { an opaque UPP }

const
    uppCalibrateEventProcInfo = $000000C0;
    uppCanCalibrateProcInfo = $000003D0;
    uppCalibrateProcInfo = $000000E0;
    {
     *  NewCalibrateEventUPP()
     *
     *  Availability:
     *    Non-Carbon CFM:   available as macro/inline
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function NewCalibrateEventUPP(userRoutine: CalibrateEventProcPtr): CalibrateEventUPP; external name '_NewCalibrateEventUPP'; { old name was NewCalibrateEventProc }
{
 *  NewCanCalibrateUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         not available
 }
function NewCanCalibrateUPP(userRoutine: CanCalibrateProcPtr): CanCalibrateUPP; external name '_NewCanCalibrateUPP'; { old name was NewCanCalibrateProc }
{
 *  NewCalibrateUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         not available
 }
function NewCalibrateUPP(userRoutine: CalibrateProcPtr): CalibrateUPP; external name '_NewCalibrateUPP'; { old name was NewCalibrateProc }
{
 *  DisposeCalibrateEventUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeCalibrateEventUPP(userUPP: CalibrateEventUPP); external name '_DisposeCalibrateEventUPP';
{
 *  DisposeCanCalibrateUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         not available
 }
procedure DisposeCanCalibrateUPP(userUPP: CanCalibrateUPP); external name '_DisposeCanCalibrateUPP';
{
 *  DisposeCalibrateUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         not available
 }
procedure DisposeCalibrateUPP(userUPP: CalibrateUPP); external name '_DisposeCalibrateUPP';
{
 *  InvokeCalibrateEventUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvokeCalibrateEventUPP(var event: EventRecord; userRoutine: CalibrateEventUPP); external name '_InvokeCalibrateEventUPP'; { old name was CallCalibrateEventProc }
{
 *  InvokeCanCalibrateUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         not available
 }
function InvokeCanCalibrateUPP(displayID: CMDisplayIDType; var errMessage: Str255; userRoutine: CanCalibrateUPP): boolean; external name '_InvokeCanCalibrateUPP'; { old name was CallCanCalibrateProc }
{
 *  InvokeCalibrateUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         not available
 }
function InvokeCalibrateUPP(var theInfo: CalibratorInfo; userRoutine: CalibrateUPP): OSErr; external name '_InvokeCalibrateUPP'; { old name was CallCalibrateProc }
{
 *  CMCalibrateDisplay()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function CMCalibrateDisplay(var theInfo: CalibratorInfo): OSErr; external name '_CMCalibrateDisplay';



{$ALIGN MAC68K}
{#POP}
{unit CMDeviceIntegration}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}

{
    The current versions of the data structure
    containing information on registered devices.
}

const
    cmDeviceInfoVersion1        = $00010000;
    cmDeviceProfileInfoVersion1 = $00010000;

    cmCurrentDeviceInfoVersion  = $00010000;
    cmCurrentProfileInfoVersion = $00010000;

    {
        Certain APIs require a device ID or profile ID.
        In some cases, a "default ID" can be used.
        }
    cmDefaultDeviceID           = 0;
    cmDefaultProfileID          = 0;

    {
        Possible values for device states accessible by the
        CMGetDeviceState() and CMSetDeviceState() APIs.
        }
    cmDeviceStateDefault        = $00000000;
    cmDeviceStateOffline        = $00000001;
    cmDeviceStateBusy           = $00000002;
    cmDeviceStateForceNotify    = $80000000;
    cmDeviceStateDeviceRsvdBits = $00FF0000;
    cmDeviceStateAppleRsvdBits  = $FF00FFFF;

    {
        Possible values for flags passed to the
        CMIterateDeviceProfiles() API.

        "Factory" profiles are registered via the
        CMSetDeviceFactoryProfiles() API.

        "Custom" profiles are those which are meant to take
        the place of the factory profiles, as a result of
        customization or calibration.  These profiles are
        registered via the CMSetDeviceProfiles() API.

        To retrieve all of the the former for all devices,
        use cmIterateFactoryDeviceProfiles as the flags
        value when calling CMIterateDeviceProfiles().

        To retrieve only the latter for all devices, use
        the cmIterateCustomDeviceProfiles, as the flags
        value when calling CMIterateDeviceProfiles().

        To get the profiles in use for all devices, use
        cmIterateCurrentDeviceProfiles as the flags value.
        This will replace the factory profiles with any
        overrides, yielding the currently used set.
        }
    cmIterateFactoryDeviceProfiles = $00000001;
    cmIterateCustomDeviceProfiles = $00000002;
    cmIterateCurrentDeviceProfiles = $00000003;
    cmIterateDeviceProfilesMask = $00000003;

    kMaxDeviceNameLength        = 256;
    kMaxProfileNameLength       = 256;

    {
        Errors returned by CMDeviceIntegration APIs
        }
    cmDeviceDBNotFoundErr       = -4227;                        {  Prefs not found/loaded  }
    cmDeviceAlreadyRegistered   = -4228;                        {  Re-registration of device  }
    cmDeviceNotRegistered       = -4229;                        {  Device not found  }
    cmDeviceProfilesNotFound    = -4230;                        {  Profiles not found  }
    cmInternalCFErr             = -4231;                        {  CoreFoundation failure  }

    {
        Device state data.
        }

type
    CMDeviceState                       = UInt32;
    {
        A CMDeviceID must be unique within a device's class.
        }
    CMDeviceID                          = UInt32;
    {
        A CMDeviceProfileID must only be unique per device.
        }
    CMDeviceProfileID                   = UInt32;
    {
        DeviceClass type.
        }

const
    cmScannerDeviceClass        = $73636E72 (* 'scnr' *);
    cmCameraDeviceClass         = $636D7261 (* 'cmra' *);
    cmDisplayDeviceClass        = $6D6E7472 (* 'mntr' *);
    cmPrinterDeviceClass        = $70727472 (* 'prtr' *);
    cmProofDeviceClass          = $70727566 (* 'pruf' *);


type
    CMDeviceClass                       = OSType;
    {
        CMDeviceScope
        Structure specifying a device's or a device setting's scope.
        }
    CMDeviceScopePtr = ^CMDeviceScope;
    CMDeviceScope = record
        deviceUser:             CFStringRef;                            {  kCFPreferencesCurrentUser | _AnyUser  }
        deviceHost:             CFStringRef;                            {  kCFPreferencesCurrentHost | _AnyHost  }
    end;

    {
        CMDeviceInfo
        Structure containing information on a given device.
        }
    CMDeviceInfoPtr = ^CMDeviceInfo;
    CMDeviceInfo = record
        dataVersion:            UInt32;                                 {  cmDeviceInfoVersion1  }
        deviceClass:            CMDeviceClass;                          {  device class  }
        deviceID:               CMDeviceID;                             {  device ID  }
        deviceScope:            CMDeviceScope;                          {  device's scope  }
        deviceState:            CMDeviceState;                          {  Device State flags  }
        defaultProfileID:       CMDeviceProfileID;                      {  Can change  }
        deviceName:             ^CFDictionaryRef;                       {  Ptr to storage for CFDictionary of  }
                                                                        {  localized device names (could be nil)  }
        profileCount:           UInt32;                                 {  Count of registered profiles  }
        reserved:               UInt32;                                 {  Reserved for use by ColorSync  }
    end;

    {
        CMDeviceProfileInfo
        Structure containing information on a device profile.
        }
    CMDeviceProfileInfoPtr = ^CMDeviceProfileInfo;
    CMDeviceProfileInfo = record
        dataVersion:            UInt32;                                 {  cmProfileInfoVersion1  }
        profileID:              CMDeviceProfileID;                      {  The identifier for this profile  }
        profileLoc:             CMProfileLocation;                      {  The profile's location  }
        profileName:            CFDictionaryRef;                        {  CFDictionary of localized device names  }
        reserved:               UInt32;                                 {  Reserved for use by ColorSync  }
    end;

    {
        CMDeviceProfileArray
        Structure containing the profiles for a device.
        }
    CMDeviceProfileArrayPtr = ^CMDeviceProfileArray;
    CMDeviceProfileArray = record
        profileCount:           UInt32;                                 {  Count of profiles in array  }
        profiles:               array [0..0] of CMDeviceProfileInfo;    {  The profile info records  }
    end;

    {
        Caller-supplied iterator functions
        }
    CMIterateDeviceInfoProcPtr = function(const (*var*) deviceInfo: CMDeviceInfo; refCon: UnivPtr): OSErr;

    CMIterateDeviceProfileProcPtr = function(const (*var*) deviceInfo: CMDeviceInfo; const (*var*) profileData: CMDeviceProfileInfo; refCon: UnivPtr): OSErr;

    {
        Device Registration
        }
    {
     *  CMRegisterColorDevice()
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        not available
     *    Mac OS X:         in 3.1 and later
        }
function CMRegisterColorDevice(deviceClass: CMDeviceClass; deviceID: CMDeviceID; deviceName: CFDictionaryRef; const (*var*) deviceScope: CMDeviceScope): CMError; external name '_CMRegisterColorDevice';

{
 *  CMUnregisterColorDevice()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in 3.1 and later
 }
function CMUnregisterColorDevice(deviceClass: CMDeviceClass; deviceID: CMDeviceID): CMError; external name '_CMUnregisterColorDevice';

{
    Default Device accessors
}
{
 *  CMSetDefaultDevice()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in 3.1 and later
 }
function CMSetDefaultDevice(deviceClass: CMDeviceClass; deviceID: CMDeviceID): CMError; external name '_CMSetDefaultDevice';

{
 *  CMGetDefaultDevice()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in 3.1 and later
 }
function CMGetDefaultDevice(deviceClass: CMDeviceClass; var deviceID: CMDeviceID): CMError; external name '_CMGetDefaultDevice';

{
    Device Profile Registration & Access
}
{
 *  CMSetDeviceFactoryProfiles()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in 3.1 and later
 }
function CMSetDeviceFactoryProfiles(deviceClass: CMDeviceClass; deviceID: CMDeviceID; defaultProfID: CMDeviceProfileID; const (*var*) deviceProfiles: CMDeviceProfileArray): CMError; external name '_CMSetDeviceFactoryProfiles';

{
 *  CMGetDeviceFactoryProfiles()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in 3.1 and later
 }
function CMGetDeviceFactoryProfiles(deviceClass: CMDeviceClass; deviceID: CMDeviceID; var defaultProfID: CMDeviceProfileID; var arraySize: UInt32; var deviceProfiles: CMDeviceProfileArray): CMError; external name '_CMGetDeviceFactoryProfiles';

{
 *  CMSetDeviceProfiles()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in 3.1 and later
 }
function CMSetDeviceProfiles(deviceClass: CMDeviceClass; deviceID: CMDeviceID; const (*var*) profileScope: CMDeviceScope; const (*var*) deviceProfiles: CMDeviceProfileArray): CMError; external name '_CMSetDeviceProfiles';

{
 *  CMGetDeviceProfiles()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in 3.1 and later
 }
function CMGetDeviceProfiles(deviceClass: CMDeviceClass; deviceID: CMDeviceID; var arraySize: UInt32; var deviceProfiles: CMDeviceProfileArray): CMError; external name '_CMGetDeviceProfiles';

{
 *  CMSetDeviceDefaultProfileID()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in 3.1 and later
 }
function CMSetDeviceDefaultProfileID(deviceClass: CMDeviceClass; deviceID: CMDeviceID; defaultProfID: CMDeviceProfileID): CMError; external name '_CMSetDeviceDefaultProfileID';

{
 *  CMGetDeviceDefaultProfileID()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in 3.1 and later
 }
function CMGetDeviceDefaultProfileID(deviceClass: CMDeviceClass; deviceID: CMDeviceID; var defaultProfID: CMDeviceProfileID): CMError; external name '_CMGetDeviceDefaultProfileID';

{
 *  CMGetDeviceProfile()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in 3.1 and later
 }
function CMGetDeviceProfile(deviceClass: CMDeviceClass; deviceID: CMDeviceID; profileID: CMDeviceProfileID; var deviceProfLoc: CMProfileLocation): CMError; external name '_CMGetDeviceProfile';

{
 *  CMSetDeviceProfile()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in 3.1 and later
 }
function CMSetDeviceProfile(deviceClass: CMDeviceClass; deviceID: CMDeviceID; const (*var*) profileScope: CMDeviceScope; profileID: CMDeviceProfileID; const (*var*) deviceProfLoc: CMProfileLocation): CMError; external name '_CMSetDeviceProfile';

{
    Other Device State/Info accessors
}
{
 *  CMSetDeviceState()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in 3.1 and later
 }
function CMSetDeviceState(deviceClass: CMDeviceClass; deviceID: CMDeviceID; deviceState: CMDeviceState): CMError; external name '_CMSetDeviceState';

{
 *  CMGetDeviceState()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in 3.1 and later
 }
function CMGetDeviceState(deviceClass: CMDeviceClass; deviceID: CMDeviceID; var deviceState: CMDeviceState): CMError; external name '_CMGetDeviceState';

{
 *  CMGetDeviceInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in 3.1 and later
 }
function CMGetDeviceInfo(deviceClass: CMDeviceClass; deviceID: CMDeviceID; var deviceInfo: CMDeviceInfo): CMError; external name '_CMGetDeviceInfo';

{
    Device Data & Profile Iterators
}
{
 *  CMIterateColorDevices()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in 3.1 and later
 }
function CMIterateColorDevices(proc: CMIterateDeviceInfoProcPtr; var seed: UInt32; var count: UInt32; refCon: UnivPtr): CMError; external name '_CMIterateColorDevices';

{
 *  CMIterateDeviceProfiles()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in 3.1 and later
 }
function CMIterateDeviceProfiles(proc: CMIterateDeviceProfileProcPtr; var seed: UInt32; var count: UInt32; flags: UInt32; refCon: UnivPtr): CMError; external name '_CMIterateDeviceProfiles';


{$ALIGN MAC68K}
{#POP}
{unit CMMComponent}
{$ALIGN MAC68K}








{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}

{ Component-based CMM interface version }

const
    CMMInterfaceVersion         = 1;


    {    Component-based CMM function selectors     }
                                                                {  Required  }
    kCMMOpen                    = -1;                           {  kComponentOpenSelect, }
    kCMMClose                   = -2;                           {  kComponentCloseSelect, }
    kCMMGetInfo                 = -4;                           {  kComponentVersionSelect }
    kNCMMInit                   = 6;
    kCMMMatchColors             = 1;
    kCMMCheckColors             = 2;                            {  }
                                                                {  }
                                                                {  Optional  }
    kCMMValidateProfile         = 8;
    kCMMMatchBitmap             = 9;
    kCMMCheckBitmap             = 10;
    kCMMConcatenateProfiles     = 5;
    kCMMConcatInit              = 7;
    kCMMNewLinkProfile          = 16;
    kNCMMConcatInit             = 18;
    kNCMMNewLinkProfile         = 19;
    kCMMGetPS2ColorSpace        = 11;
    kCMMGetPS2ColorRenderingIntent = 12;
    kCMMGetPS2ColorRendering    = 13;
    kCMMGetPS2ColorRenderingVMSize = 17;                        {  }
                                                                {  }
                                                                {  obsolete with ColorSync 2.5  }
    kCMMFlattenProfile          = 14;
    kCMMUnflattenProfile        = 15;                           {  }
                                                                {  }
                                                                {  obsolete with ColorSync 2.6  }
    kCMMInit                    = 0;
    kCMMGetNamedColorInfo       = 70;
    kCMMGetNamedColorValue      = 71;
    kCMMGetIndNamedColorValue   = 72;
    kCMMGetNamedColorIndex      = 73;
    kCMMGetNamedColorName       = 74;                           {  }
                                                                {  }
                                                                {  obsolete with ColorSync 3.0  }
    kCMMMatchPixMap             = 3;
    kCMMCheckPixMap             = 4;



{$ALIGN MAC68K}
{#POP}
{unit CMPRComponent}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}


const
    CMPRInterfaceVersion        = 0;

    {    Component function selectors   }
    kCMPRGetProfile             = 0;
    kCMPRSetProfile             = 1;
    kCMPRSetProfileDescription  = 2;
    kCMPRGetIndexedProfile      = 3;
    kCMPRDeleteDeviceProfile    = 4;



{$ALIGN MAC68K}
{#POP}
{unit CMScriptingPlugin}
{$ALIGN MAC68K}











{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}


const
                                                                {  ColorSync Scripting AppleEvent Errors  }
    cmspInvalidImageFile        = -4220;                        {  Plugin cannot handle this image file type  }
    cmspInvalidImageSpace       = -4221;                        {  Plugin cannot create an image file of this colorspace  }
    cmspInvalidProfileEmbed     = -4222;                        {  Specific invalid profile errors  }
    cmspInvalidProfileSource    = -4223;
    cmspInvalidProfileDest      = -4224;
    cmspInvalidProfileProof     = -4225;
    cmspInvalidProfileLink      = -4226;


    {   *** embedFlags field  ***   }
    {    reserved for future use: currently 0   }

    {   *** matchFlags field  ***   }
    cmspFavorEmbeddedMask       = $00000001;                    {  if bit 0 is 0 then use srcProf profile, if 1 then use profile embedded in image if present }


    {   *** scripting plugin entry points  ***  }

type
    ValidateImageProcPtr = function(const (*var*) spec: FSSpec): CMError;

    GetImageSpaceProcPtr = function(const (*var*) spec: FSSpec; var space: OSType): CMError;

    ValidateSpaceProcPtr = function(const (*var*) spec: FSSpec; var space: OSType): CMError;

    EmbedImageProcPtr = function(const (*var*) specFrom: FSSpec; const (*var*) specInto: FSSpec; embedProf: CMProfileRef; embedFlags: UInt32): CMError;

    UnembedImageProcPtr = function(const (*var*) specFrom: FSSpec; const (*var*) specInto: FSSpec): CMError;

    MatchImageProcPtr = function(const (*var*) specFrom: FSSpec; const (*var*) specInto: FSSpec; qual: UInt32; srcIntent: UInt32; srcProf: CMProfileRef; dstProf: CMProfileRef; prfProf: CMProfileRef; matchFlags: UInt32): CMError;

    CountImageProfilesProcPtr = function(const (*var*) spec: FSSpec; var count: UInt32): CMError;

    GetIndImageProfileProcPtr = function(const (*var*) spec: FSSpec; index: UInt32; var prof: CMProfileRef): CMError;

    SetIndImageProfileProcPtr = function(const (*var*) specFrom: FSSpec; const (*var*) specInto: FSSpec; index: UInt32; prof: CMProfileRef; embedFlags: UInt32): CMError;

    {   *** CSScriptingLib API  *** }

    {
     *  CMValidImage()
     *
     *  Availability:
     *    Non-Carbon CFM:   in CSScriptingLib 2.6 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in 3.0 and later
        }
function CMValidImage(const (*var*) spec: FSSpec): CMError; external name '_CMValidImage';

{
 *  CMGetImageSpace()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CSScriptingLib 2.6 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
function CMGetImageSpace(const (*var*) spec: FSSpec; var space: OSType): CMError; external name '_CMGetImageSpace';

{
 *  CMEmbedImage()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CSScriptingLib 2.6 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
function CMEmbedImage(const (*var*) specFrom: FSSpec; const (*var*) specInto: FSSpec; repl: boolean; embProf: CMProfileRef): CMError; external name '_CMEmbedImage';

{
 *  CMUnembedImage()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CSScriptingLib 2.6 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
function CMUnembedImage(const (*var*) specFrom: FSSpec; const (*var*) specInto: FSSpec; repl: boolean): CMError; external name '_CMUnembedImage';

{
 *  CMMatchImage()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CSScriptingLib 2.6 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
function CMMatchImage(const (*var*) specFrom: FSSpec; const (*var*) specInto: FSSpec; repl: boolean; qual: UInt32; srcProf: CMProfileRef; srcIntent: UInt32; dstProf: CMProfileRef): CMError; external name '_CMMatchImage';

{
 *  CMProofImage()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CSScriptingLib 2.6 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
function CMProofImage(const (*var*) specFrom: FSSpec; const (*var*) specInto: FSSpec; repl: boolean; qual: UInt32; srcProf: CMProfileRef; srcIntent: UInt32; dstProf: CMProfileRef; prfProf: CMProfileRef): CMError; external name '_CMProofImage';

{
 *  CMLinkImage()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CSScriptingLib 2.6 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
function CMLinkImage(const (*var*) specFrom: FSSpec; const (*var*) specInto: FSSpec; repl: boolean; qual: UInt32; lnkProf: CMProfileRef; lnkIntent: UInt32): CMError; external name '_CMLinkImage';

{
 *  CMCountImageProfiles()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CSScriptingLib 2.6 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
function CMCountImageProfiles(const (*var*) spec: FSSpec; var count: UInt32): CMError; external name '_CMCountImageProfiles';

{
 *  CMGetIndImageProfile()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CSScriptingLib 2.6 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
function CMGetIndImageProfile(const (*var*) spec: FSSpec; index: UInt32; var prof: CMProfileRef): CMError; external name '_CMGetIndImageProfile';

{
 *  CMSetIndImageProfile()
 *
 *  Availability:
 *    Non-Carbon CFM:   in CSScriptingLib 2.6 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in 3.0 and later
 }
function CMSetIndImageProfile(const (*var*) specFrom: FSSpec; const (*var*) specInto: FSSpec; repl: boolean; index: UInt32; prof: CMProfileRef): CMError; external name '_CMSetIndImageProfile';

{$ALIGN MAC68K}
{#POP}
{unit ColorPicker}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}


const
                                                                { Maximum small fract value, as long }
    kMaximumSmallFract          = $0000FFFF;

    kDefaultColorPickerWidth    = 383;
    kDefaultColorPickerHeight   = 238;


type
    DialogPlacementSpec         = SInt16;
const
    kAtSpecifiedOrigin          = 0;
    kDeepestColorScreen         = 1;
    kCenterOnMainScreen         = 2;


    {    These are for the flags field in the structs below (for example ColorPickerInfo).  }
    kColorPickerDialogIsMoveable = 1;
    kColorPickerDialogIsModal   = 2;
    kColorPickerCanModifyPalette = 4;
    kColorPickerCanAnimatePalette = 8;
    kColorPickerAppIsColorSyncAware = 16;
    kColorPickerInSystemDialog  = 32;
    kColorPickerInApplicationDialog = 64;
    kColorPickerInPickerDialog  = 128;
    kColorPickerDetachedFromChoices = 256;
    kColorPickerCallColorProcLive = 512;



    {    A SmallFract value is just the fractional part of a Fixed number,
    which is the low order word.  SmallFracts are used to save room,
    and to be compatible with Quickdraw's RGBColor.  They can be
    assigned directly to and from INTEGERs.     }
    {    Unsigned fraction between 0 and 1  }

type
    SmallFract                          = UInt16;
    {    For developmental simplicity in switching between the HLS and HSV
    models, HLS is reordered into HSL. Thus both models start with
    hue and saturation values; value/lightness/brightness is last.  }

    HSVColorPtr = ^HSVColor;
    HSVColor = record
        hue:                    SmallFract;                             { Fraction of circle, red at 0 }
        saturation:             SmallFract;                             { 0-1, 0 for gray, 1 for pure color }
        value:                  SmallFract;                             { 0-1, 0 for black, 1 for max intensity }
    end;

    HSLColorPtr = ^HSLColor;
    HSLColor = record
        hue:                    SmallFract;                             { Fraction of circle, red at 0 }
        saturation:             SmallFract;                             { 0-1, 0 for gray, 1 for pure color }
        lightness:              SmallFract;                             { 0-1, 0 for black, 1 for white }
    end;

    CMYColorPtr = ^CMYColor;
    CMYColor = record
        cyan:                   SmallFract;
        magenta:                SmallFract;
        yellow:                 SmallFract;
    end;

    PMColorPtr = ^PMColor;
    PMColor = record
        profile:                CMProfileHandle;
        color:                  CMColor;
    end;

    NPMColorPtr = ^NPMColor;
    NPMColor = record
        profile:                CMProfileRef;
        color:                  CMColor;
    end;

    Picker    = ^SInt32; { an opaque 32-bit type }
    PickerPtr = ^Picker;  { when a var xx:Picker parameter can be nil, it is changed to xx: PickerPtr }
    PickerMenuItemInfoPtr = ^PickerMenuItemInfo;
    PickerMenuItemInfo = record
        editMenuID:             SInt16;
        cutItem:                SInt16;
        copyItem:               SInt16;
        pasteItem:              SInt16;
        clearItem:              SInt16;
        undoItem:               SInt16;
    end;

    {    Structs related to deprecated API's have been pulled from this file.   }
    {    Those structs necessary for developers writing their own color pickers...  }
    {    have been moved to ColorPickerComponents.h.    }

    ColorChangedProcPtr = procedure(userData: SInt32; var newColor: PMColor);

    NColorChangedProcPtr = procedure(userData: SInt32; var newColor: NPMColor);

    UserEventProcPtr = function(var event: EventRecord): boolean;

    ColorChangedUPP = ^SInt32; { an opaque UPP }
    NColorChangedUPP = ^SInt32; { an opaque UPP }
    UserEventUPP = ^SInt32; { an opaque UPP }
    ColorPickerInfoPtr = ^ColorPickerInfo;
    ColorPickerInfo = record
        theColor:               PMColor;
        dstProfile:             CMProfileHandle;
        flags:                  UInt32;
        placeWhere:             DialogPlacementSpec;
        dialogOrigin:           Point;
        pickerType:             OSType;
        eventProc:              UserEventUPP;
        colorProc:              ColorChangedUPP;
        colorProcData:          UInt32;
        prompt:                 Str255;
        mInfo:                  PickerMenuItemInfo;
        newColorChosen:         boolean;
        filler:                 SInt8;
    end;

    NColorPickerInfoPtr = ^NColorPickerInfo;
    NColorPickerInfo = record
        theColor:               NPMColor;
        dstProfile:             CMProfileRef;
        flags:                  UInt32;
        placeWhere:             DialogPlacementSpec;
        dialogOrigin:           Point;
        pickerType:             OSType;
        eventProc:              UserEventUPP;
        colorProc:              NColorChangedUPP;
        colorProcData:          UInt32;
        prompt:                 Str255;
        mInfo:                  PickerMenuItemInfo;
        newColorChosen:         boolean;
        reserved:               SInt8;                                  { Must be 0 }
    end;


    {   Below are the color conversion routines. }
    {
     *  Fix2SmallFract()
     *
     *  Availability:
     *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         not available
        }
function Fix2SmallFract(f: Fixed): SmallFract; external name '_Fix2SmallFract';
{
 *  SmallFract2Fix()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         not available
 }
function SmallFract2Fix(s: SmallFract): Fixed; external name '_SmallFract2Fix';
{
 *  CMY2RGB()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         not available
 }
procedure CMY2RGB(const (*var*) cColor: CMYColor; var rColor: RGBColor); external name '_CMY2RGB';
{
 *  RGB2CMY()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         not available
 }
procedure RGB2CMY(const (*var*) rColor: RGBColor; var cColor: CMYColor); external name '_RGB2CMY';
{
 *  HSL2RGB()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         not available
 }
procedure HSL2RGB(const (*var*) hColor: HSLColor; var rColor: RGBColor); external name '_HSL2RGB';
{
 *  RGB2HSL()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         not available
 }
procedure RGB2HSL(const (*var*) rColor: RGBColor; var hColor: HSLColor); external name '_RGB2HSL';
{
 *  HSV2RGB()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         not available
 }
procedure HSV2RGB(const (*var*) hColor: HSVColor; var rColor: RGBColor); external name '_HSV2RGB';
{
 *  RGB2HSV()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         not available
 }
procedure RGB2HSV(const (*var*) rColor: RGBColor; var hColor: HSVColor); external name '_RGB2HSV';
{   GetColor() works with or without the Color Picker extension. }
{
 *  GetColor()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         not available
 }
function GetColor(where: Point; const (*var*) prompt: Str255; const (*var*) inColor: RGBColor; var outColor: RGBColor): boolean; external name '_GetColor';
{   PickColor() requires the Color Picker extension (version 2.0 or greater). }
{
 *  PickColor()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ColorPickerLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         not available
 }
function PickColor(var theColorInfo: ColorPickerInfo): OSErr; external name '_PickColor';
{   NPickColor() requires the Color Picker extension (version 2.1 or greater). }
{
 *  NPickColor()
 *
 *  Availability:
 *    Non-Carbon CFM:   in ColorPickerLib 2.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         not available
 }
function NPickColor(var theColorInfo: NColorPickerInfo): OSErr; external name '_NPickColor';
{ A suite of mid-level API calls have been deprecated.  Likely you never...  }
{ used them anyway.  They were removed from this file and should not be... }
{ used in the future as they are not gauranteed to be supported. }

const
    uppColorChangedProcInfo = $000003C0;
    uppNColorChangedProcInfo = $000003C0;
    uppUserEventProcInfo = $000000D0;
    {
     *  NewColorChangedUPP()
     *
     *  Availability:
     *    Non-Carbon CFM:   available as macro/inline
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         not available
        }
function NewColorChangedUPP(userRoutine: ColorChangedProcPtr): ColorChangedUPP; external name '_NewColorChangedUPP'; { old name was NewColorChangedProc }
{
 *  NewNColorChangedUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         not available
 }
function NewNColorChangedUPP(userRoutine: NColorChangedProcPtr): NColorChangedUPP; external name '_NewNColorChangedUPP'; { old name was NewNColorChangedProc }
{
 *  NewUserEventUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         not available
 }
function NewUserEventUPP(userRoutine: UserEventProcPtr): UserEventUPP; external name '_NewUserEventUPP'; { old name was NewUserEventProc }
{
 *  DisposeColorChangedUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         not available
 }
procedure DisposeColorChangedUPP(userUPP: ColorChangedUPP); external name '_DisposeColorChangedUPP';
{
 *  DisposeNColorChangedUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         not available
 }
procedure DisposeNColorChangedUPP(userUPP: NColorChangedUPP); external name '_DisposeNColorChangedUPP';
{
 *  DisposeUserEventUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         not available
 }
procedure DisposeUserEventUPP(userUPP: UserEventUPP); external name '_DisposeUserEventUPP';
{
 *  InvokeColorChangedUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         not available
 }
procedure InvokeColorChangedUPP(userData: SInt32; var newColor: PMColor; userRoutine: ColorChangedUPP); external name '_InvokeColorChangedUPP'; { old name was CallColorChangedProc }
{
 *  InvokeNColorChangedUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         not available
 }
procedure InvokeNColorChangedUPP(userData: SInt32; var newColor: NPMColor; userRoutine: NColorChangedUPP); external name '_InvokeNColorChangedUPP'; { old name was CallNColorChangedProc }
{
 *  InvokeUserEventUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         not available
 }
function InvokeUserEventUPP(var event: EventRecord; userRoutine: UserEventUPP): boolean; external name '_InvokeUserEventUPP'; { old name was CallUserEventProc }
{$ALIGN MAC68K}
{#POP}
{unit ControlDefinitions}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}

{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{  ¥ Resource Types                                                                                    }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}


const
    kControlTabListResType      = $74616223 (* 'tab#' *);                       {  used for tab control (Appearance 1.0 and later) }
    kControlListDescResType     = $6C646573 (* 'ldes' *);                       {  used for list box control (Appearance 1.0 and later) }

    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {     ¥ Check Box Values                                                                    }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    kControlCheckBoxUncheckedValue = 0;
    kControlCheckBoxCheckedValue = 1;
    kControlCheckBoxMixedValue  = 2;

    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {     ¥ Radio Button Values                                                                 }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    kControlRadioButtonUncheckedValue = 0;
    kControlRadioButtonCheckedValue = 1;
    kControlRadioButtonMixedValue = 2;

    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {     ¥ Pop-Up Menu Control Constants                                                       }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {  Variant codes for the System 7 pop-up menu }
    popupFixedWidth             = $01;
    popupVariableWidth          = $02;
    popupUseAddResMenu          = $04;
    popupUseWFont               = $08;

    {  Menu label styles for the System 7 pop-up menu }
    popupTitleBold              = $0100;
    popupTitleItalic            = $0200;
    popupTitleUnderline         = $0400;
    popupTitleOutline           = $0800;
    popupTitleShadow            = $1000;
    popupTitleCondense          = $2000;
    popupTitleExtend            = $4000;
    popupTitleNoStyle           = $8000;

    {  Menu label justifications for the System 7 pop-up menu }
    popupTitleLeftJust          = $00000000;
    popupTitleCenterJust        = $00000001;
    popupTitleRightJust         = $000000FF;

    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {     ¥ PopUp Menu Private Data Structure                                                                   }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }

{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{  ¥ Control Definition IDÕs                                                                           }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{  Standard System 7 procIDs }


const
    pushButProc                 = 0;
    checkBoxProc                = 1;
    radioButProc                = 2;
    scrollBarProc               = 16;
    popupMenuProc               = 1008;

    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {     ¥ Control Part Codes                                                                  }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    kControlLabelPart           = 1;
    kControlMenuPart            = 2;
    kControlTrianglePart        = 4;
    kControlEditTextPart        = 5;                            {  Appearance 1.0 and later }
    kControlPicturePart         = 6;                            {  Appearance 1.0 and later }
    kControlIconPart            = 7;                            {  Appearance 1.0 and later }
    kControlClockPart           = 8;                            {  Appearance 1.0 and later }
    kControlListBoxPart         = 24;                           {  Appearance 1.0 and later }
    kControlListBoxDoubleClickPart = 25;                        {  Appearance 1.0 and later }
    kControlImageWellPart       = 26;                           {  Appearance 1.0 and later }
    kControlRadioGroupPart      = 27;                           {  Appearance 1.0.2 and later }
    kControlButtonPart          = 10;
    kControlCheckBoxPart        = 11;
    kControlRadioButtonPart     = 11;
    kControlUpButtonPart        = 20;
    kControlDownButtonPart      = 21;
    kControlPageUpPart          = 22;
    kControlPageDownPart        = 23;
    kControlClockHourDayPart    = 9;                            {  Appearance 1.1 and later }
    kControlClockMinuteMonthPart = 10;                          {  Appearance 1.1 and later }
    kControlClockSecondYearPart = 11;                           {  Appearance 1.1 and later }
    kControlClockAMPMPart       = 12;                           {  Appearance 1.1 and later }
    kControlDataBrowserPart     = 24;                           {  CarbonLib 1.0 and later }
    kControlDataBrowserDraggedPart = 25;                        {  CarbonLib 1.0 and later }



    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {     ¥ Control Types and IDÕs available only with Appearance 1.0 and later                                 }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {     ¥ BEVEL BUTTON interface (CDEF 2)                                                     }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {     Bevel buttons allow you to control the content type (pict/icon/etc.), the behavior    }
    {    (pushbutton/toggle/sticky), and the bevel size. You also have the option of            }
    {     attaching a menu to it. When a menu is present, you can specify which way the         }
    {     popup arrow is facing (down or right).                                                }
    {                                                                                           }
    {     This is all made possible by overloading the Min, Max, and Value parameters for the   }
    {     control, as well as adjusting the variant. Here's the breakdown of what goes where:   }
    {                                                                                           }
    {     Parameter                   What Goes Here                                            }
    {     ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ         ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ      }
    {     Min                         Hi Byte = Behavior, Lo Byte = content type.               }
    {     Max                         ResID for resource-based content types.                   }
    {     Value                       MenuID to attach, 0 = no menu, please.                    }
    {                                                                                           }
    {     The variant is broken down into two halfs. The low 2 bits control the bevel type.     }
    {     Bit 2 controls the popup arrow direction (if a menu is present) and bit 3 controls    }
    {     whether or not to use the control's owning window's font.                             }
    {                                                                                           }
    {     Constants for all you need to put this together are below. The values for behaviors   }
    {     are set up so that you can simply add them to the content type and pass them into     }
    {     the Min parameter of NewControl.                                                      }
    {                                                                                           }
    {     An example call:                                                                      }
    {                                                                                           }
    {     control = NewControl( window, &bounds, "\p", true, 0, kControlContentIconSuiteRes +   }
    {                             kBehaviorToggles, myIconSuiteID, bevelButtonSmallBevelProc,   }
    {                             0L );                                                         }
    {                                                                                           }
    {     Attaching a menu:                                                                     }
    {                                                                                           }
    {     control = NewControl( window, &bounds, "\p", true, kMyMenuID,                         }
    {             kControlContentIconSuiteRes, myIconSuiteID, bevelButtonSmallBevelProc +       }
    {             kBevelButtonMenuOnRight, 0L );                                                }
    {                                                                                           }
    {     This will attach menu ID kMyMenuID to the button, with the popup arrow facing right.  }
    {     This also puts the menu up to the right of the button. You can also specify that a    }
    {     menu can have multiple items checked at once by adding kBehaviorMultiValueMenus       }
    {     into the Min parameter. If you do use multivalue menus, the GetBevelButtonMenuValue   }
    {     helper function will return the last item chosen from the menu, whether or not it     }
    {     was checked.                                                                          }
    {                                                                                           }
    {     NOTE:   Bevel buttons with menus actually have *two* values. The value of the         }
    {             button (on/off), and the value of the menu. The menu value can be gotten      }
    {             with the GetBevelButtonMenuValue helper function.                             }
    {                                                                                           }
    {     Handle-based Content                                                                  }
    {     ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ                                                                  }
    {     You can create your control and then set the content to an existing handle to an      }
    {     icon suite, etc. using the macros below. Please keep in mind that resource-based      }
    {     content is owned by the control, handle-based content is owned by you. The CDEF will  }
    {     not try to dispose of handle-based content. If you are changing the content type of   }
    {     the button on the fly, you must make sure that if you are replacing a handle-         }
    {     based content with a resource-based content to properly dispose of the handle,        }
    {     else a memory leak will ensue.                                                        }
    {                                                                                           }
    {    Bevel Button Proc IDs  }
    kControlBevelButtonSmallBevelProc = 32;
    kControlBevelButtonNormalBevelProc = 33;
    kControlBevelButtonLargeBevelProc = 34;

    {    Add these variant codes to kBevelButtonSmallBevelProc to change the type of button     }
    kControlBevelButtonSmallBevelVariant = 0;
    kControlBevelButtonNormalBevelVariant = $01;
    kControlBevelButtonLargeBevelVariant = $02;
    kControlBevelButtonMenuOnRightVariant = $04;

    {    Bevel Thicknesses  }

type
    ControlBevelThickness       = UInt16;
const
    kControlBevelButtonSmallBevel = 0;
    kControlBevelButtonNormalBevel = 1;
    kControlBevelButtonLargeBevel = 2;

    {    Behaviors of bevel buttons. These are set up so you can add    }
    {    them together with the content types.                          }
    kControlBehaviorPushbutton  = 0;
    kControlBehaviorToggles     = $0100;
    kControlBehaviorSticky      = $0200;
    kControlBehaviorSingleValueMenu = 0;
    kControlBehaviorMultiValueMenu = $4000;                     {  only makes sense when a menu is attached. }
    kControlBehaviorOffsetContents = $8000;

    {    Behaviors for 1.0.1 or later   }
    kControlBehaviorCommandMenu = $2000;                        {  menu holds commands, not choices. Overrides multi-value bit. }


type
    ControlBevelButtonBehavior          = UInt16;
    ControlBevelButtonMenuBehavior      = UInt16;
    {    Bevel Button Menu Placements   }
    ControlBevelButtonMenuPlacement  = UInt16;
const
    kControlBevelButtonMenuOnBottom = 0;
    kControlBevelButtonMenuOnRight = $04;

    {    Control Kind Tag   }
    kControlKindBevelButton     = $6265766C (* 'bevl' *);

    {    Creation API: Carbon Only  }
    {
     *  CreateBevelButtonControl()
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.1 and later
     *    Mac OS X:         in version 10.0 and later
        }
function CreateBevelButtonControl(window: WindowRef; const (*var*) boundsRect: Rect; title: CFStringRef; thickness: ControlBevelThickness; behavior: ControlBevelButtonBehavior; info: ControlButtonContentInfoPtr; menuID: SInt16; menuBehavior: ControlBevelButtonMenuBehavior; menuPlacement: ControlBevelButtonMenuPlacement; var outControl: ControlRef): OSStatus; external name '_CreateBevelButtonControl';



{ Graphic Alignments }

type
    ControlButtonGraphicAlignment  = SInt16;
const
    kControlBevelButtonAlignSysDirection = -1;                  {  only left or right }
    kControlBevelButtonAlignCenter = 0;
    kControlBevelButtonAlignLeft = 1;
    kControlBevelButtonAlignRight = 2;
    kControlBevelButtonAlignTop = 3;
    kControlBevelButtonAlignBottom = 4;
    kControlBevelButtonAlignTopLeft = 5;
    kControlBevelButtonAlignBottomLeft = 6;
    kControlBevelButtonAlignTopRight = 7;
    kControlBevelButtonAlignBottomRight = 8;

    {    Text Alignments    }

type
    ControlButtonTextAlignment  = SInt16;
const
    kControlBevelButtonAlignTextSysDirection = 0;
    kControlBevelButtonAlignTextCenter = 1;
    kControlBevelButtonAlignTextFlushRight = -1;
    kControlBevelButtonAlignTextFlushLeft = -2;

    {    Text Placements    }

type
    ControlButtonTextPlacement  = SInt16;
const
    kControlBevelButtonPlaceSysDirection = -1;                  {  if graphic on right, then on left }
    kControlBevelButtonPlaceNormally = 0;
    kControlBevelButtonPlaceToRightOfGraphic = 1;
    kControlBevelButtonPlaceToLeftOfGraphic = 2;
    kControlBevelButtonPlaceBelowGraphic = 3;
    kControlBevelButtonPlaceAboveGraphic = 4;


    {    Data tags supported by the bevel button controls   }
    kControlBevelButtonContentTag = $636F6E74 (* 'cont' *);                     {  ButtonContentInfo }
    kControlBevelButtonTransformTag = $7472616E (* 'tran' *);                   {  IconTransformType }
    kControlBevelButtonTextAlignTag = $74616C69 (* 'tali' *);                   {  ButtonTextAlignment }
    kControlBevelButtonTextOffsetTag = $746F6666 (* 'toff' *);                  {  SInt16 }
    kControlBevelButtonGraphicAlignTag = $67616C69 (* 'gali' *);                {  ButtonGraphicAlignment }
    kControlBevelButtonGraphicOffsetTag = $676F6666 (* 'goff' *);               {  Point }
    kControlBevelButtonTextPlaceTag = $74706C63 (* 'tplc' *);                   {  ButtonTextPlacement }
    kControlBevelButtonMenuValueTag = $6D76616C (* 'mval' *);                   {  SInt16 }
    kControlBevelButtonMenuHandleTag = $6D686E64 (* 'mhnd' *);                  {  MenuRef }
    kControlBevelButtonMenuRefTag = $6D686E64 (* 'mhnd' *);                     {  MenuRef }
    kControlBevelButtonCenterPopupGlyphTag = $70676C63 (* 'pglc' *);            {  Boolean: true = center, false = bottom right }

    {    These are tags in 1.0.1 or later   }
    kControlBevelButtonLastMenuTag = $6C6D6E75 (* 'lmnu' *);                    {  SInt16: menuID of last menu item selected from }
    kControlBevelButtonMenuDelayTag = $6D646C79 (* 'mdly' *);                   {  SInt32: ticks to delay before menu appears }

    {    tags available with Appearance 1.1 or later    }
                                                                {  Boolean: True = if an icon of the ideal size for }
                                                                {  the button isn't available, scale a larger or }
                                                                {  smaller icon to the ideal size. False = don't }
                                                                {  scale; draw a smaller icon or clip a larger icon. }
                                                                {  Default is false. Only applies to IconSuites and }
    kControlBevelButtonScaleIconTag = $7363616C (* 'scal' *);                   {  IconRefs. }

    {    tags available in Mac OS X and later   }
    kControlBevelButtonOwnedMenuRefTag = $6F6D7266 (* 'omrf' *);                {  MenuRef (control will dispose) }
    kControlBevelButtonKindTag  = $6265626B (* 'bebk' *);                       {  ThemeButtonKind ( kTheme[Small,Medium,Large,Rounded]BevelButton ) }

    {    Helper routines are available only thru the shared library/glue.   }
    {
     *  GetBevelButtonMenuValue()
     *
     *  Availability:
     *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function GetBevelButtonMenuValue(inButton: ControlRef; var outValue: SInt16): OSErr; external name '_GetBevelButtonMenuValue';

{
 *  SetBevelButtonMenuValue()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetBevelButtonMenuValue(inButton: ControlRef; inValue: SInt16): OSErr; external name '_SetBevelButtonMenuValue';

{
 *  GetBevelButtonMenuHandle()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetBevelButtonMenuHandle(inButton: ControlRef; var outHandle: MenuHandle): OSErr; external name '_GetBevelButtonMenuHandle';

{
 *  GetBevelButtonContentInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetBevelButtonContentInfo(inButton: ControlRef; outContent: ControlButtonContentInfoPtr): OSErr; external name '_GetBevelButtonContentInfo';

{
 *  SetBevelButtonContentInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetBevelButtonContentInfo(inButton: ControlRef; inContent: ControlButtonContentInfoPtr): OSErr; external name '_SetBevelButtonContentInfo';

{
 *  SetBevelButtonTransform()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetBevelButtonTransform(inButton: ControlRef; transform: IconTransformType): OSErr; external name '_SetBevelButtonTransform';

{
 *  SetBevelButtonGraphicAlignment()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetBevelButtonGraphicAlignment(inButton: ControlRef; inAlign: ControlButtonGraphicAlignment; inHOffset: SInt16; inVOffset: SInt16): OSErr; external name '_SetBevelButtonGraphicAlignment';

{
 *  SetBevelButtonTextAlignment()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetBevelButtonTextAlignment(inButton: ControlRef; inAlign: ControlButtonTextAlignment; inHOffset: SInt16): OSErr; external name '_SetBevelButtonTextAlignment';

{
 *  SetBevelButtonTextPlacement()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetBevelButtonTextPlacement(inButton: ControlRef; inWhere: ControlButtonTextPlacement): OSErr; external name '_SetBevelButtonTextPlacement';


{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{  ¥ SLIDER (CDEF 3)                                                                   }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{  There are several variants that control the behavior of the slider control. Any     }
{  combination of the following three constants can be added to the basic CDEF ID      }
{  (kSliderProc).                                                                      }
{                                                                                      }
{  Variants:                                                                           }
{                                                                                      }
{      kSliderLiveFeedback     Slider does not use "ghosted" indicator when tracking.  }
{                              ActionProc is called (set via SetControlAction) as the  }
{                              indicator is dragged. The value is updated so that the  }
{                              actionproc can adjust some other property based on the  }
{                              value each time the action proc is called. If no action }
{                              proc is installed, it reverts to the ghost indicator.   }
{                                                                                      }
{      kSliderHasTickMarks     Slider is drawn with 'tick marks'. The control          }
{                              rectangle must be large enough to accomidate the tick   }
{                              marks.                                                  }
{                                                                                      }
{      kSliderReverseDirection Slider thumb points in opposite direction than normal.  }
{                              If the slider is vertical, the thumb will point to the  }
{                              left, if the slider is horizontal, the thumb will point }
{                              upwards.                                                }
{                                                                                      }
{      kSliderNonDirectional   This option overrides the kSliderReverseDirection and   }
{                              kSliderHasTickMarks variants. It creates an indicator   }
{                              which is rectangular and doesn't point in any direction }
{                              like the normal indicator does.                         }
{ Slider proc ID and variants }

const
    kControlSliderProc          = 48;
    kControlSliderLiveFeedback  = $01;
    kControlSliderHasTickMarks  = $02;
    kControlSliderReverseDirection = $04;
    kControlSliderNonDirectional = $08;

    {    Slider Orientation     }

type
    ControlSliderOrientation    = UInt16;
const
    kControlSliderPointsDownOrRight = 0;
    kControlSliderPointsUpOrLeft = 1;
    kControlSliderDoesNotPoint  = 2;

    {    Control Kind Tag   }
    kControlKindSlider          = $736C6472 (* 'sldr' *);

    {    Creation API: Carbon Only  }
    {
     *  CreateSliderControl()
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.1 and later
     *    Mac OS X:         in version 10.0 and later
        }
function CreateSliderControl(window: WindowRef; const (*var*) boundsRect: Rect; value: SInt32; minimum: SInt32; maximum: SInt32; orientation: ControlSliderOrientation; numTickMarks: UInt16; liveTracking: boolean; liveTrackingProc: ControlActionUPP; var outControl: ControlRef): OSStatus; external name '_CreateSliderControl';


{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{  ¥ DISCLOSURE TRIANGLE (CDEF 4)                                                      }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{  This control can be used as either left or right facing. It can also handle its own }
{  tracking if you wish. This means that when the 'autotoggle' variant is used, if the }
{  user clicks the control, it's state will change automatically from open to closed   }
{  and vice-versa depending on its initial state. After a successful call to Track-    }
{  Control, you can just check the current value to see what state it was switched to. }
{ Triangle proc IDs }

const
    kControlTriangleProc        = 64;
    kControlTriangleLeftFacingProc = 65;
    kControlTriangleAutoToggleProc = 66;
    kControlTriangleLeftFacingAutoToggleProc = 67;


type
    ControlDisclosureTriangleOrientation  = UInt16;
const
    kControlDisclosureTrianglePointDefault = 0;                 {  points right on a left-to-right script system (Mac OS X and later or CarbonLib 1.5 and later only) }
    kControlDisclosureTrianglePointRight = 1;
    kControlDisclosureTrianglePointLeft = 2;

    {    Control Kind Tag   }
    kControlKindDisclosureTriangle = $64697374 (* 'dist' *);

    {
     *  CreateDisclosureTriangleControl()
     *
     *  Summary:
     *    Creates a Disclosure Triangle control at a specific position in
     *    the specified window.
     *
     *  Discussion:
     *    Disclosure Triangles are small controls that give the user a way
     *    to toggle the visibility of information or other user interface.
     *    When information is in a hidden state, a Disclosure Triangle is
     *    considered "closed" and should point to the right (or sometimes
     *    to the left). When the user clicks on it, the Disclosure Triangle
     *    rotates downwards into the "open" state. The application should
     *    repond by revealing the appropriate information or interface. On
     *    Mac OS X, a root control will be created for the window if one
     *    does not already exist. If a root control exists for the window,
     *    the Disclosure Triangle control will be embedded into it.
     *
     *  Parameters:
     *
     *    inWindow:
     *      The WindowRef into which the Disclosure Triangle will be
     *      created.
     *
     *    inBoundsRect:
     *      The desired position (in coordinates local to the window's
     *      port) for the Disclosure Triangle.
     *
     *    inOrientation:
     *      The direction the Disclosure Triangle should point when it is
     *      "closed". Passing kControlDisclosureTrianglePointDefault is
     *      only legal as of Mac OS X and CarbonLib 1.5.
     *
     *    inTitle:
     *      The title for the Disclosure Triangle. The title will only be
     *      displayed if the inDrawTitle parameter is true. Title display
     *      only works on Mac OS X.
     *
     *    inInitialValue:
     *      The starting value determines whether the Disclosure Triangle
     *      is initially in its "open" or "closed" state. The value 0
     *      represents the "closed" state and 1 represents the "open" state.
     *
     *    inDrawTitle:
     *      A Boolean indicating whether the Disclosure Triangle should
     *      draw its title next to the widget. Title display only works on
     *      Mac OS X.
     *
     *    inAutoToggles:
     *      A Boolean indicating whether the Disclosure Triangle should
     *      change its own value (from "open" to "closed" and vice-versa)
     *      automatically when it is clicked on.
     *
     *    outControl:
     *      On successful output, outControl will contain a reference to
     *      the Disclosure Triangle control.
     *
     *  Result:
     *    An OSStatus code indicating success or failure.
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.1 and later
     *    Mac OS X:         in version 10.0 and later
        }
function CreateDisclosureTriangleControl(inWindow: WindowRef; const (*var*) inBoundsRect: Rect; inOrientation: ControlDisclosureTriangleOrientation; inTitle: CFStringRef; inInitialValue: SInt32; inDrawTitle: boolean; inAutoToggles: boolean; var outControl: ControlRef): OSStatus; external name '_CreateDisclosureTriangleControl';


{ Tagged data supported by disclosure triangles }

const
    kControlTriangleLastValueTag = $6C617374 (* 'last' *);                      {  SInt16 }

    {    Helper routines are available only thru the shared library/glue.   }
    {
     *  SetDisclosureTriangleLastValue()
     *
     *  Availability:
     *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function SetDisclosureTriangleLastValue(inTabControl: ControlRef; inValue: SInt16): OSErr; external name '_SetDisclosureTriangleLastValue';

{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{  ¥ PROGRESS INDICATOR (CDEF 5)                                                       }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{  This CDEF implements both determinate and indeterminate progress bars. To switch,   }
{  just use SetControlData to set the indeterminate flag to make it indeterminate call }
{  IdleControls to step thru the animation. IdleControls should be called at least     }
{  once during your event loop.                                                        }
{                                                                                      }
{  We also use this same CDEF for Relevance bars. At this time this control does not   }
{  idle.                                                                               }
{ Progress Bar proc IDs }

const
    kControlProgressBarProc     = 80;
    kControlRelevanceBarProc    = 81;

    {    Control Kind Tag   }
    kControlKindProgressBar     = $70726762 (* 'prgb' *);
    kControlKindRelevanceBar    = $72656C62 (* 'relb' *);

    {    Creation API: Carbon only  }
    {
     *  CreateProgressBarControl()
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.1 and later
     *    Mac OS X:         in version 10.0 and later
        }
function CreateProgressBarControl(window: WindowRef; const (*var*) boundsRect: Rect; value: SInt32; minimum: SInt32; maximum: SInt32; indeterminate: boolean; var outControl: ControlRef): OSStatus; external name '_CreateProgressBarControl';

{
 *  CreateRelevanceBarControl()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CreateRelevanceBarControl(window: WindowRef; const (*var*) boundsRect: Rect; value: SInt32; minimum: SInt32; maximum: SInt32; var outControl: ControlRef): OSStatus; external name '_CreateRelevanceBarControl';

{ Tagged data supported by progress bars }

const
    kControlProgressBarIndeterminateTag = $696E6465 (* 'inde' *);               {  Boolean }
    kControlProgressBarAnimatingTag = $616E696D (* 'anim' *);                   {  Boolean }

    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {     ¥ LITTLE ARROWS (CDEF 6)                                                              }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {     This control implements the little up and down arrows you'd see in the Memory         }
    {     control panel for adjusting the cache size.                                           }
    {    Little Arrows proc IDs     }
    kControlLittleArrowsProc    = 96;

    {    Control Kind Tag   }
    kControlKindLittleArrows    = $6C617272 (* 'larr' *);

    {    Creation API: Carbon only  }
    {
     *  CreateLittleArrowsControl()
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.1 and later
     *    Mac OS X:         in version 10.0 and later
        }
function CreateLittleArrowsControl(window: WindowRef; const (*var*) boundsRect: Rect; value: SInt32; minimum: SInt32; maximum: SInt32; increment: SInt32; var outControl: ControlRef): OSStatus; external name '_CreateLittleArrowsControl';

{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{  ¥ CHASING ARROWS (CDEF 7)                                                           }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{  To animate this control, make sure to call IdleControls repeatedly.                 }
{                                                                                      }
{ Chasing Arrows proc IDs }

const
    kControlChasingArrowsProc   = 112;

    {    Control Kind Tag   }
    kControlKindChasingArrows   = $63617272 (* 'carr' *);

    {    Creation API: Carbon only  }
    {
     *  CreateChasingArrowsControl()
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.1 and later
     *    Mac OS X:         in version 10.0 and later
        }
function CreateChasingArrowsControl(window: WindowRef; const (*var*) boundsRect: Rect; var outControl: ControlRef): OSStatus; external name '_CreateChasingArrowsControl';

{ Tagged data supported by the Chasing Arrows control }

const
    kControlChasingArrowsAnimatingTag = $616E696D (* 'anim' *);                 {  Boolean }


    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {     ¥ TABS (CDEF 8)                                                                       }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {     Tabs use an auxiliary resource (tab#) to hold tab information such as the tab name    }
    {     and an icon suite ID for each tab.                                                    }
    {                                                                                           }
    {     The ID of the tab# resource that you wish to associate with a tab control should      }
    {     be passed in as the Value parameter of the control. If you are using GetNewControl,   }
    {     then the Value slot in the CNTL resource should have the ID of the 'tab#' resource    }
    {     on creation.                                                                          }
    {                                                                                           }
    {     Passing zero in for the tab# resource tells the control not to read in a tab# res.    }
    {     You can then use SetControlMaximum to add tabs, followed by a call to SetControlData  }
    {     with the kControlTabInfoTag, passing in a pointer to a ControlTabInfoRec. This sets   }
    {     the name and optionally an icon for a tab.                                            }
    {    Tabs proc IDs  }
    kControlTabLargeProc        = 128;                          {  Large tab size, north facing    }
    kControlTabSmallProc        = 129;                          {  Small tab size, north facing    }
    kControlTabLargeNorthProc   = 128;                          {  Large tab size, north facing    }
    kControlTabSmallNorthProc   = 129;                          {  Small tab size, north facing    }
    kControlTabLargeSouthProc   = 130;                          {  Large tab size, south facing    }
    kControlTabSmallSouthProc   = 131;                          {  Small tab size, south facing    }
    kControlTabLargeEastProc    = 132;                          {  Large tab size, east facing     }
    kControlTabSmallEastProc    = 133;                          {  Small tab size, east facing     }
    kControlTabLargeWestProc    = 134;                          {  Large tab size, west facing     }
    kControlTabSmallWestProc    = 135;                          {  Small tab size, west facing     }

    {    Tab Directions     }

type
    ControlTabDirection         = UInt16;
const
    kControlTabDirectionNorth   = 0;
    kControlTabDirectionSouth   = 1;
    kControlTabDirectionEast    = 2;
    kControlTabDirectionWest    = 3;

    {    Tab Sizes  }

type
    ControlTabSize              = UInt16;
const
    kControlTabSizeLarge        = 0;
    kControlTabSizeSmall        = 1;

    {    Control Tab Entry - used during creation                               }
    {    Note that the client is responsible for allocating/providing           }
    {    the ControlButtonContentInfo and string storage for this               }
    {    structure.                                                             }

type
    ControlTabEntryPtr = ^ControlTabEntry;
    ControlTabEntry = record
        icon:                   ControlButtonContentInfoPtr;
        name:                   CFStringRef;
        enabled:                boolean;
    end;

    {    Control Kind Tag   }

const
    kControlKindTabs            = $74616273 (* 'tabs' *);

    {    Creation API: Carbon only  }
    {
     *  CreateTabsControl()
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.1 and later
     *    Mac OS X:         in version 10.0 and later
        }
function CreateTabsControl(window: WindowRef; const (*var*) boundsRect: Rect; size: ControlTabSize; direction: ControlTabDirection; numTabs: UInt16; const (*var*) tabArray: ControlTabEntry; var outControl: ControlRef): OSStatus; external name '_CreateTabsControl';


{ Tagged data supported by tabs }

const
    kControlTabContentRectTag   = $72656374 (* 'rect' *);                       {  Rect }
    kControlTabEnabledFlagTag   = $656E6162 (* 'enab' *);                       {  Boolean }
    kControlTabFontStyleTag     = $666F6E74 (* 'font' *);                       {  ControlFontStyleRec }

    {    New tags in 1.0.1 or later     }
    kControlTabInfoTag          = $74616269 (* 'tabi' *);                       {  ControlTabInfoRec }

    {    New tags in X 10.1 or later    }
    kControlTabImageContentTag  = $636F6E74 (* 'cont' *);                       {  ControlButtonContentInfo }

    kControlTabInfoVersionZero  = 0;                            {  ControlTabInfoRec }
    kControlTabInfoVersionOne   = 1;                            {  ControlTabInfoRecV1 }


type
    ControlTabInfoRecPtr = ^ControlTabInfoRec;
    ControlTabInfoRec = record
        version:                SInt16;                                 {  version of this structure. }
        iconSuiteID:            SInt16;                                 {  icon suite to use. Zero indicates no icon }
        name:                   Str255;                                 {  name to be displayed on the tab }
    end;

    ControlTabInfoRecV1Ptr = ^ControlTabInfoRecV1;
    ControlTabInfoRecV1 = record
        version:                SInt16;                                 {  version of this structure. == kControlTabInfoVersionOne }
        iconSuiteID:            SInt16;                                 {  icon suite to use. Zero indicates no icon }
        name:                   CFStringRef;                            {  name to be displayed on the tab. Will be retained so caller }
                                                                        {  should always release it. }
    end;

    {    Helper routines are available only thru the shared library/glue.   }
    {
     *  GetTabContentRect()
     *
     *  Availability:
     *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function GetTabContentRect(inTabControl: ControlRef; var outContentRect: Rect): OSErr; external name '_GetTabContentRect';

{
 *  SetTabEnabled()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetTabEnabled(inTabControl: ControlRef; inTabToHilite: SInt16; inEnabled: boolean): OSErr; external name '_SetTabEnabled';

{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{  ¥ VISUAL SEPARATOR (CDEF 9)                                                         }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{  Separator lines determine their orientation (horizontal or vertical) automatically  }
{  based on the relative height and width of their contrlRect.                         }
{ Visual separator proc IDs }

const
    kControlSeparatorLineProc   = 144;

    {    Control Kind Tag   }
    kControlKindSeparator       = $73657061 (* 'sepa' *);

    {    Creation API: Carbon only  }
    {
     *  CreateSeparatorControl()
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.1 and later
     *    Mac OS X:         in version 10.0 and later
        }
function CreateSeparatorControl(window: WindowRef; const (*var*) boundsRect: Rect; var outControl: ControlRef): OSStatus; external name '_CreateSeparatorControl';

{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{  ¥ GROUP BOX (CDEF 10)                                                               }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{  The group box CDEF can be use in several ways. It can have no title, a text title,  }
{  a check box as the title, or a popup button as a title. There are two versions of   }
{  group boxes, primary and secondary, which look slightly different.                  }
{ Group Box proc IDs }

const
    kControlGroupBoxTextTitleProc = 160;
    kControlGroupBoxCheckBoxProc = 161;
    kControlGroupBoxPopupButtonProc = 162;
    kControlGroupBoxSecondaryTextTitleProc = 164;
    kControlGroupBoxSecondaryCheckBoxProc = 165;
    kControlGroupBoxSecondaryPopupButtonProc = 166;

    {    Control Kind Tag   }
    kControlKindGroupBox        = $67727062 (* 'grpb' *);
    kControlKindCheckGroupBox   = $63677270 (* 'cgrp' *);
    kControlKindPopupGroupBox   = $70677270 (* 'pgrp' *);

    {    Creation APIs: Carbon only     }
    {
     *  CreateGroupBoxControl()
     *
     *  Summary:
     *    Creates a group box control.
     *
     *  Parameters:
     *
     *    window:
     *      The window that should contain the control.
     *
     *    boundsRect:
     *      The bounding box of the control.
     *
     *    title:
     *      The title of the control.
     *
     *    primary:
     *      Whether to create a primary or secondary group box.
     *
     *    outControl:
     *      On exit, contains the new control.
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.1 and later
     *    Mac OS X:         in version 10.0 and later
        }
function CreateGroupBoxControl(window: WindowRef; const (*var*) boundsRect: Rect; title: CFStringRef; primary: boolean; var outControl: ControlRef): OSStatus; external name '_CreateGroupBoxControl';

{
 *  CreateCheckGroupBoxControl()
 *
 *  Summary:
 *    Creates a group box control that has a check box as its title.
 *
 *  Parameters:
 *
 *    window:
 *      The window that should contain the control.
 *
 *    boundsRect:
 *      The bounding box of the control.
 *
 *    title:
 *      The title of the control (used as the title of the check box).
 *
 *    initialValue:
 *      The initial value of the check box.
 *
 *    primary:
 *      Whether to create a primary or secondary group box.
 *
 *    autoToggle:
 *      Whether to create an auto-toggling check box. Auto-toggling
 *      check box titles are only supported on Mac OS X; this parameter
 *      must be false when used with CarbonLib.
 *
 *    outControl:
 *      On exit, contains the new control.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CreateCheckGroupBoxControl(window: WindowRef; const (*var*) boundsRect: Rect; title: CFStringRef; initialValue: SInt32; primary: boolean; autoToggle: boolean; var outControl: ControlRef): OSStatus; external name '_CreateCheckGroupBoxControl';

{
 *  CreatePopupGroupBoxControl()
 *
 *  Summary:
 *    Creates a group box control that has a popup button as its title.
 *
 *  Parameters:
 *
 *    window:
 *      The window that should contain the control.
 *
 *    boundsRect:
 *      The bounding box of the control.
 *
 *    title:
 *      The title of the control (used as the title of the popup
 *      button).
 *
 *    primary:
 *      Whether to create a primary or secondary group box.
 *
 *    menuID:
 *      The menu ID of the menu to be displayed by the popup button.
 *
 *    variableWidth:
 *      Whether the popup button should have a variable-width title.
 *      Fixed-width titles are only supported by Mac OS X; this
 *      parameter must be true when used with CarbonLib.
 *
 *    titleWidth:
 *      The width in pixels of the popup button title.
 *
 *    titleJustification:
 *      The justification of the popup button title. Use one of the
 *      TextEdit justification constants here (teFlushDefault,
 *      teCenter, teFlushRight, or teFlushLeft).
 *
 *    titleStyle:
 *      The QuickDraw text style of the popup button title.
 *
 *    outControl:
 *      On exit, contains the new control.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CreatePopupGroupBoxControl(window: WindowRef; const (*var*) boundsRect: Rect; title: CFStringRef; primary: boolean; menuID: SInt16; variableWidth: boolean; titleWidth: SInt16; titleJustification: SInt16; titleStyle: ByteParameter; var outControl: ControlRef): OSStatus; external name '_CreatePopupGroupBoxControl';


{ Tagged data supported by group box }

const
    kControlGroupBoxMenuHandleTag = $6D68616E (* 'mhan' *);                     {  MenuRef (popup title only) }
    kControlGroupBoxMenuRefTag  = $6D68616E (* 'mhan' *);                       {  MenuRef (popup title only) }
    kControlGroupBoxFontStyleTag = $666F6E74 (* 'font' *);                      {  ControlFontStyleRec }

    {    tags available with Appearance 1.1 or later    }
    kControlGroupBoxTitleRectTag = $74726563 (* 'trec' *);                      {  Rect. Rectangle that the title text/control is drawn in. (get only) }

    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {     ¥ IMAGE WELL (CDEF 11)                                                                }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {     Image Wells allow you to control the content type (pict/icon/etc.) shown in the       }
    {     well.                                                                                 }
    {                                                                                           }
    {     This is made possible by overloading the Min and Value parameters for the control.    }
    {                                                                                           }
    {     Parameter                   What Goes Here                                            }
    {     ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ         ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ        }
    {     Min                         content type (see constants for bevel buttons)            }
    {     Value                       Resource ID of content type, if resource-based.           }
    {                                                                                           }
    {                                                                                           }
    {     Handle-based Content                                                                  }
    {     ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ                                                                  }
    {     You can create your control and then set the content to an existing handle to an      }
    {     icon suite, etc. using the macros below. Please keep in mind that resource-based      }
    {     content is owned by the control, handle-based content is owned by you. The CDEF will  }
    {     not try to dispose of handle-based content. If you are changing the content type of   }
    {     the button on the fly, you must make sure that if you are replacing a handle-         }
    {     based content with a resource-based content to properly dispose of the handle,        }
    {     else a memory leak will ensue.                                                        }
    {                                                                                           }
    {    Image Well proc IDs    }
    kControlImageWellProc       = 176;

    {    Control Kind Tag   }
    kControlKindImageWell       = $77656C6C (* 'well' *);

    {    Creation API: Carbon only  }
    {
     *  CreateImageWellControl()
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.1 and later
     *    Mac OS X:         in version 10.0 and later
        }
function CreateImageWellControl(window: WindowRef; const (*var*) boundsRect: Rect; const (*var*) info: ControlButtonContentInfo; var outControl: ControlRef): OSStatus; external name '_CreateImageWellControl';

{ Tagged data supported by image wells }

const
    kControlImageWellContentTag = $636F6E74 (* 'cont' *);                       {  ButtonContentInfo }
    kControlImageWellTransformTag = $7472616E (* 'tran' *);                     {  IconTransformType }
    kControlImageWellIsDragDestinationTag = $64726167 (* 'drag' *);             {  Boolean }

    {    Helper routines are available only thru the shared library/glue.   }
    {
     *  GetImageWellContentInfo()
     *
     *  Availability:
     *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function GetImageWellContentInfo(inButton: ControlRef; outContent: ControlButtonContentInfoPtr): OSErr; external name '_GetImageWellContentInfo';

{
 *  SetImageWellContentInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetImageWellContentInfo(inButton: ControlRef; inContent: ControlButtonContentInfoPtr): OSErr; external name '_SetImageWellContentInfo';

{
 *  SetImageWellTransform()
 *
 *  Availability:
 *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetImageWellTransform(inButton: ControlRef; inTransform: IconTransformType): OSErr; external name '_SetImageWellTransform';

{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{  ¥ POPUP ARROW (CDEF 12)                                                             }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{  The popup arrow CDEF is used to draw the small arrow normally associated with a     }
{  popup control. The arrow can point in four directions, and a small or large version }
{  can be used. This control is provided to allow clients to draw the arrow in a       }
{  normalized fashion which will take advantage of themes automatically.               }
{                                                                                      }
{ Popup Arrow proc IDs }

const
    kControlPopupArrowEastProc  = 192;
    kControlPopupArrowWestProc  = 193;
    kControlPopupArrowNorthProc = 194;
    kControlPopupArrowSouthProc = 195;
    kControlPopupArrowSmallEastProc = 196;
    kControlPopupArrowSmallWestProc = 197;
    kControlPopupArrowSmallNorthProc = 198;
    kControlPopupArrowSmallSouthProc = 199;

    {    Popup Arrow Orientations   }
    kControlPopupArrowOrientationEast = 0;
    kControlPopupArrowOrientationWest = 1;
    kControlPopupArrowOrientationNorth = 2;
    kControlPopupArrowOrientationSouth = 3;


type
    ControlPopupArrowOrientation        = UInt16;
    {    Popup Arrow Size   }

const
    kControlPopupArrowSizeNormal = 0;
    kControlPopupArrowSizeSmall = 1;


type
    ControlPopupArrowSize               = UInt16;
    {    Control Kind Tag   }

const
    kControlKindPopupArrow      = $70617272 (* 'parr' *);

    {    Creation API: Carbon only  }
    {
     *  CreatePopupArrowControl()
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.1 and later
     *    Mac OS X:         in version 10.0 and later
        }
function CreatePopupArrowControl(window: WindowRef; const (*var*) boundsRect: Rect; orientation: ControlPopupArrowOrientation; size: ControlPopupArrowSize; var outControl: ControlRef): OSStatus; external name '_CreatePopupArrowControl';

{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{  ¥ PLACARD (CDEF 14)                                                                 }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{ Placard proc IDs }

const
    kControlPlacardProc         = 224;

    {    Control Kind Tag   }
    kControlKindPlacard         = $706C6163 (* 'plac' *);

    {    Creation API: Carbon only  }
    {
     *  CreatePlacardControl()
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.1 and later
     *    Mac OS X:         in version 10.0 and later
        }
function CreatePlacardControl(window: WindowRef; const (*var*) boundsRect: Rect; var outControl: ControlRef): OSStatus; external name '_CreatePlacardControl';

{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{  ¥ CLOCK (CDEF 15)                                                                   }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{  NOTE:   You can specify more options in the Value paramter when creating the clock. }
{          See below.                                                                  }
{                                                                                      }
{  NOTE:   Under Appearance 1.1, the clock control knows and returns more part codes.  }
{          The new clock-specific part codes are defined with the other control parts. }
{          Besides these clock-specific parts, we also return kControlUpButtonPart     }
{          and kControlDownButtonPart when they hit the up and down arrows.            }
{          The new part codes give you more flexibility for focusing and hit testing.  }
{                                                                                      }
{          The original kControlClockPart is still valid. When hit testing, it means   }
{          that some non-editable area of the clock's whitespace has been clicked.     }
{          When focusing a currently unfocused clock, it changes the focus to the      }
{          first part; it is the same as passing kControlFocusNextPart. When           }
{          re-focusing a focused clock, it will not change the focus at all.           }
{ Clock proc IDs }

const
    kControlClockTimeProc       = 240;
    kControlClockTimeSecondsProc = 241;
    kControlClockDateProc       = 242;
    kControlClockMonthYearProc  = 243;

    {    Clock Types    }

type
    ControlClockType            = UInt16;
const
    kControlClockTypeHourMinute = 0;
    kControlClockTypeHourMinuteSecond = 1;
    kControlClockTypeMonthDayYear = 2;
    kControlClockTypeMonthYear  = 3;

    {    Clock Flags    }
    {     These flags can be passed into 'value' field on creation of the control.              }
    {     Value is set to 0 after control is created.                                           }

type
    ControlClockFlags           = UInt32;
const
    kControlClockFlagStandard   = 0;                            {  editable, non-live }
    kControlClockNoFlags        = 0;
    kControlClockFlagDisplayOnly = 1;                           {  add this to become non-editable }
    kControlClockIsDisplayOnly  = 1;
    kControlClockFlagLive       = 2;                            {  automatically shows current time on idle. only valid with display only. }
    kControlClockIsLive         = 2;

    {    Control Kind Tag   }
    kControlKindClock           = $636C636B (* 'clck' *);

    {    Creation API: Carbon only  }
    {
     *  CreateClockControl()
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.1 and later
     *    Mac OS X:         in version 10.0 and later
        }
function CreateClockControl(window: WindowRef; const (*var*) boundsRect: Rect; clockType: ControlClockType; clockFlags: ControlClockFlags; var outControl: ControlRef): OSStatus; external name '_CreateClockControl';

{ Tagged data supported by clocks }

const
    kControlClockLongDateTag    = $64617465 (* 'date' *);                       {  LongDateRec }
    kControlClockFontStyleTag   = $666F6E74 (* 'font' *);                       {  ControlFontStyleRec }
    kControlClockAnimatingTag   = $616E696D (* 'anim' *);                       {  Boolean }

    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {     ¥ USER PANE (CDEF 16)                                                                 }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {     User panes have two primary purposes: to allow easy implementation of a custom        }
    {     control by the developer, and to provide a generic container for embedding other      }
    {     controls.                                                                             }
    {                                                                                           }
    {     In Carbon, with the advent of Carbon-event-based controls, you may find it easier     }
    {     to simply write a new control from scratch than to customize a user pane control.     }
    {     The set of callbacks provided by the user pane will not be extended to support        }
    {     new Control Manager features; instead, you should just write a real control.          }
    {                                                                                           }
    {     User panes do not, by default, support embedding. If you try to embed a control       }
    {     into a user pane, you will get back errControlIsNotEmbedder. You can make a user      }
    {     pane support embedding by passing the kControlSupportsEmbedding flag in the 'value'   }
    {     parameter when you create the control.                                                }
    {                                                                                           }
    {     User panes support the following overloaded control initialization options:           }
    {                                                                                           }
    {     Parameter                   What Goes Here                                            }
    {     ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ         ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ        }
    {     Value                       Control feature flags                                     }

    {    User Pane proc IDs     }
    kControlUserPaneProc        = 256;

    {    Control Kind Tag   }
    kControlKindUserPane        = $7570616E (* 'upan' *);

    {    Creation API: Carbon only  }
    {
     *  CreateUserPaneControl()
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.1 and later
     *    Mac OS X:         in version 10.0 and later
        }
function CreateUserPaneControl(window: WindowRef; const (*var*) boundsRect: Rect; features: UInt32; var outControl: ControlRef): OSStatus; external name '_CreateUserPaneControl';

{ Tagged data supported by user panes }
{ Currently, they are all proc ptrs for doing things like drawing and hit testing, etc. }

const
    kControlUserItemDrawProcTag = $75696470 (* 'uidp' *);                       {  UserItemUPP }
    kControlUserPaneDrawProcTag = $64726177 (* 'draw' *);                       {  ControlUserPaneDrawingUPP }
    kControlUserPaneHitTestProcTag = $68697474 (* 'hitt' *);                    {  ControlUserPaneHitTestUPP }
    kControlUserPaneTrackingProcTag = $7472616B (* 'trak' *);                   {  ControlUserPaneTrackingUPP }
    kControlUserPaneIdleProcTag = $69646C65 (* 'idle' *);                       {  ControlUserPaneIdleUPP }
    kControlUserPaneKeyDownProcTag = $6B657964 (* 'keyd' *);                    {  ControlUserPaneKeyDownUPP }
    kControlUserPaneActivateProcTag = $61637469 (* 'acti' *);                   {  ControlUserPaneActivateUPP }
    kControlUserPaneFocusProcTag = $666F6369 (* 'foci' *);                      {  ControlUserPaneFocusUPP }
    kControlUserPaneBackgroundProcTag = $6261636B (* 'back' *);                 {  ControlUserPaneBackgroundUPP }


type
    ControlUserPaneDrawProcPtr = procedure(control: ControlRef; part: SInt16);

    ControlUserPaneHitTestProcPtr = function(control: ControlRef; where: Point): ControlPartCode;

    ControlUserPaneTrackingProcPtr = function(control: ControlRef; startPt: Point; actionProc: ControlActionUPP): ControlPartCode;

    ControlUserPaneIdleProcPtr = procedure(control: ControlRef);

    ControlUserPaneKeyDownProcPtr = function(control: ControlRef; keyCode: SInt16; charCode: SInt16; modifiers: SInt16): ControlPartCode;

    ControlUserPaneActivateProcPtr = procedure(control: ControlRef; activating: boolean);

    ControlUserPaneFocusProcPtr = function(control: ControlRef; action: ControlFocusPart): ControlPartCode;

    ControlUserPaneBackgroundProcPtr = procedure(control: ControlRef; info: ControlBackgroundPtr);

    ControlUserPaneDrawUPP = ^SInt32; { an opaque UPP }
    ControlUserPaneHitTestUPP = ^SInt32; { an opaque UPP }
    ControlUserPaneTrackingUPP = ^SInt32; { an opaque UPP }
    ControlUserPaneIdleUPP = ^SInt32; { an opaque UPP }
    ControlUserPaneKeyDownUPP = ^SInt32; { an opaque UPP }
    ControlUserPaneActivateUPP = ^SInt32; { an opaque UPP }
    ControlUserPaneFocusUPP = ^SInt32; { an opaque UPP }
    ControlUserPaneBackgroundUPP = ^SInt32; { an opaque UPP }

const
    uppControlUserPaneDrawProcInfo = $000002C0;
    uppControlUserPaneHitTestProcInfo = $000003E0;
    uppControlUserPaneTrackingProcInfo = $00000FE0;
    uppControlUserPaneIdleProcInfo = $000000C0;
    uppControlUserPaneKeyDownProcInfo = $00002AE0;
    uppControlUserPaneActivateProcInfo = $000001C0;
    uppControlUserPaneFocusProcInfo = $000002E0;
    uppControlUserPaneBackgroundProcInfo = $000003C0;
    {
     *  NewControlUserPaneDrawUPP()
     *
     *  Availability:
     *    Non-Carbon CFM:   available as macro/inline
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function NewControlUserPaneDrawUPP(userRoutine: ControlUserPaneDrawProcPtr): ControlUserPaneDrawUPP; external name '_NewControlUserPaneDrawUPP'; { old name was NewControlUserPaneDrawProc }
{
 *  NewControlUserPaneHitTestUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewControlUserPaneHitTestUPP(userRoutine: ControlUserPaneHitTestProcPtr): ControlUserPaneHitTestUPP; external name '_NewControlUserPaneHitTestUPP'; { old name was NewControlUserPaneHitTestProc }
{
 *  NewControlUserPaneTrackingUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewControlUserPaneTrackingUPP(userRoutine: ControlUserPaneTrackingProcPtr): ControlUserPaneTrackingUPP; external name '_NewControlUserPaneTrackingUPP'; { old name was NewControlUserPaneTrackingProc }
{
 *  NewControlUserPaneIdleUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewControlUserPaneIdleUPP(userRoutine: ControlUserPaneIdleProcPtr): ControlUserPaneIdleUPP; external name '_NewControlUserPaneIdleUPP'; { old name was NewControlUserPaneIdleProc }
{
 *  NewControlUserPaneKeyDownUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewControlUserPaneKeyDownUPP(userRoutine: ControlUserPaneKeyDownProcPtr): ControlUserPaneKeyDownUPP; external name '_NewControlUserPaneKeyDownUPP'; { old name was NewControlUserPaneKeyDownProc }
{
 *  NewControlUserPaneActivateUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewControlUserPaneActivateUPP(userRoutine: ControlUserPaneActivateProcPtr): ControlUserPaneActivateUPP; external name '_NewControlUserPaneActivateUPP'; { old name was NewControlUserPaneActivateProc }
{
 *  NewControlUserPaneFocusUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewControlUserPaneFocusUPP(userRoutine: ControlUserPaneFocusProcPtr): ControlUserPaneFocusUPP; external name '_NewControlUserPaneFocusUPP'; { old name was NewControlUserPaneFocusProc }
{
 *  NewControlUserPaneBackgroundUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewControlUserPaneBackgroundUPP(userRoutine: ControlUserPaneBackgroundProcPtr): ControlUserPaneBackgroundUPP; external name '_NewControlUserPaneBackgroundUPP'; { old name was NewControlUserPaneBackgroundProc }
{
 *  DisposeControlUserPaneDrawUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeControlUserPaneDrawUPP(userUPP: ControlUserPaneDrawUPP); external name '_DisposeControlUserPaneDrawUPP';
{
 *  DisposeControlUserPaneHitTestUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeControlUserPaneHitTestUPP(userUPP: ControlUserPaneHitTestUPP); external name '_DisposeControlUserPaneHitTestUPP';
{
 *  DisposeControlUserPaneTrackingUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeControlUserPaneTrackingUPP(userUPP: ControlUserPaneTrackingUPP); external name '_DisposeControlUserPaneTrackingUPP';
{
 *  DisposeControlUserPaneIdleUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeControlUserPaneIdleUPP(userUPP: ControlUserPaneIdleUPP); external name '_DisposeControlUserPaneIdleUPP';
{
 *  DisposeControlUserPaneKeyDownUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeControlUserPaneKeyDownUPP(userUPP: ControlUserPaneKeyDownUPP); external name '_DisposeControlUserPaneKeyDownUPP';
{
 *  DisposeControlUserPaneActivateUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeControlUserPaneActivateUPP(userUPP: ControlUserPaneActivateUPP); external name '_DisposeControlUserPaneActivateUPP';
{
 *  DisposeControlUserPaneFocusUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeControlUserPaneFocusUPP(userUPP: ControlUserPaneFocusUPP); external name '_DisposeControlUserPaneFocusUPP';
{
 *  DisposeControlUserPaneBackgroundUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeControlUserPaneBackgroundUPP(userUPP: ControlUserPaneBackgroundUPP); external name '_DisposeControlUserPaneBackgroundUPP';
{
 *  InvokeControlUserPaneDrawUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvokeControlUserPaneDrawUPP(control: ControlRef; part: SInt16; userRoutine: ControlUserPaneDrawUPP); external name '_InvokeControlUserPaneDrawUPP'; { old name was CallControlUserPaneDrawProc }
{
 *  InvokeControlUserPaneHitTestUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeControlUserPaneHitTestUPP(control: ControlRef; where: Point; userRoutine: ControlUserPaneHitTestUPP): ControlPartCode; external name '_InvokeControlUserPaneHitTestUPP'; { old name was CallControlUserPaneHitTestProc }
{
 *  InvokeControlUserPaneTrackingUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeControlUserPaneTrackingUPP(control: ControlRef; startPt: Point; actionProc: ControlActionUPP; userRoutine: ControlUserPaneTrackingUPP): ControlPartCode; external name '_InvokeControlUserPaneTrackingUPP'; { old name was CallControlUserPaneTrackingProc }
{
 *  InvokeControlUserPaneIdleUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvokeControlUserPaneIdleUPP(control: ControlRef; userRoutine: ControlUserPaneIdleUPP); external name '_InvokeControlUserPaneIdleUPP'; { old name was CallControlUserPaneIdleProc }
{
 *  InvokeControlUserPaneKeyDownUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeControlUserPaneKeyDownUPP(control: ControlRef; keyCode: SInt16; charCode: SInt16; modifiers: SInt16; userRoutine: ControlUserPaneKeyDownUPP): ControlPartCode; external name '_InvokeControlUserPaneKeyDownUPP'; { old name was CallControlUserPaneKeyDownProc }
{
 *  InvokeControlUserPaneActivateUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvokeControlUserPaneActivateUPP(control: ControlRef; activating: boolean; userRoutine: ControlUserPaneActivateUPP); external name '_InvokeControlUserPaneActivateUPP'; { old name was CallControlUserPaneActivateProc }
{
 *  InvokeControlUserPaneFocusUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeControlUserPaneFocusUPP(control: ControlRef; action: ControlFocusPart; userRoutine: ControlUserPaneFocusUPP): ControlPartCode; external name '_InvokeControlUserPaneFocusUPP'; { old name was CallControlUserPaneFocusProc }
{
 *  InvokeControlUserPaneBackgroundUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvokeControlUserPaneBackgroundUPP(control: ControlRef; info: ControlBackgroundPtr; userRoutine: ControlUserPaneBackgroundUPP); external name '_InvokeControlUserPaneBackgroundUPP'; { old name was CallControlUserPaneBackgroundProc }
{
  ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
    ¥ EDIT TEXT (CDEF 17)
  ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
}
{ Edit Text proc IDs }

const
    kControlEditTextProc        = 272;
    kControlEditTextPasswordProc = 274;

    {    proc IDs available with Appearance 1.1 or later    }
    kControlEditTextInlineInputProc = 276;                      {  Can't combine with the other variants }

    {    Control Kind Tag   }
    kControlKindEditText        = $65747874 (* 'etxt' *);

    {    Creation API: Carbon only  }
    {
     *  CreateEditTextControl()
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.1 and later
     *    Mac OS X:         in version 10.0 and later
        }
function CreateEditTextControl(window: WindowRef; const (*var*) boundsRect: Rect; text: CFStringRef; isPassword: boolean; useInlineInput: boolean; style: {Const}ControlFontStyleRecPtr; var outControl: ControlRef): OSStatus; external name '_CreateEditTextControl';


{ Tagged data supported by edit text }

const
    kControlEditTextStyleTag    = $666F6E74 (* 'font' *);                       {  ControlFontStyleRec }
    kControlEditTextTextTag     = $74657874 (* 'text' *);                       {  Buffer of chars - you supply the buffer }
    kControlEditTextTEHandleTag = $7468616E (* 'than' *);                       {  The TEHandle of the text edit record }
    kControlEditTextKeyFilterTag = $666C7472 (* 'fltr' *);
    kControlEditTextSelectionTag = $73656C65 (* 'sele' *);                      {  ControlEditTextSelectionRec }
    kControlEditTextPasswordTag = $70617373 (* 'pass' *);                       {  The clear text password text }

    {    tags available with Appearance 1.1 or later    }
    kControlEditTextKeyScriptBehaviorTag = $6B736372 (* 'kscr' *);              {  ControlKeyScriptBehavior. Defaults to "PrefersRoman" for password fields, }
                                                                {        or "AllowAnyScript" for non-password fields. }
    kControlEditTextLockedTag   = $6C6F636B (* 'lock' *);                       {  Boolean. Locking disables editability. }
    kControlEditTextFixedTextTag = $66747874 (* 'ftxt' *);                      {  Like the normal text tag, but fixes inline input first }
    kControlEditTextValidationProcTag = $76616C69 (* 'vali' *);                 {  ControlEditTextValidationUPP. Called when a key filter can't be: after cut, paste, etc. }
    kControlEditTextInlinePreUpdateProcTag = $70727570 (* 'prup' *);            {  TSMTEPreUpdateUPP and TSMTEPostUpdateUpp. For use with inline input variant... }
    kControlEditTextInlinePostUpdateProcTag = $706F7570 (* 'poup' *);           {  ...The refCon parameter will contain the ControlRef. }

    {    Tags available with Mac OS X and later     }
    kControlEditTextCFStringTag = $63667374 (* 'cfst' *);                       {  CFStringRef (Also available on CarbonLib 1.5) }
    kControlEditTextPasswordCFStringTag = $70776366 (* 'pwcf' *);               {  CFStringRef -- UnicodeEditText Only }




    {    Structure for getting the edit text selection  }

type
    ControlEditTextSelectionRecPtr = ^ControlEditTextSelectionRec;
    ControlEditTextSelectionRec = record
        selStart:               SInt16;
        selEnd:                 SInt16;
    end;

    ControlEditTextSelectionPtr         = ^ControlEditTextSelectionRec;
    ControlEditTextValidationProcPtr = procedure(control: ControlRef);

    ControlEditTextValidationUPP = ^SInt32; { an opaque UPP }

const
    uppControlEditTextValidationProcInfo = $000000C0;
    {
     *  NewControlEditTextValidationUPP()
     *
     *  Availability:
     *    Non-Carbon CFM:   available as macro/inline
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function NewControlEditTextValidationUPP(userRoutine: ControlEditTextValidationProcPtr): ControlEditTextValidationUPP; external name '_NewControlEditTextValidationUPP'; { old name was NewControlEditTextValidationProc }
{
 *  DisposeControlEditTextValidationUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeControlEditTextValidationUPP(userUPP: ControlEditTextValidationUPP); external name '_DisposeControlEditTextValidationUPP';
{
 *  InvokeControlEditTextValidationUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvokeControlEditTextValidationUPP(control: ControlRef; userRoutine: ControlEditTextValidationUPP); external name '_InvokeControlEditTextValidationUPP'; { old name was CallControlEditTextValidationProc }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{  ¥ STATIC TEXT (CDEF 18)                                                             }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{ Static Text proc IDs }

const
    kControlStaticTextProc      = 288;

    {    Control Kind Tag   }
    kControlKindStaticText      = $73747874 (* 'stxt' *);

    {    Creation API: Carbon only  }
    {
     *  CreateStaticTextControl()
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.1 and later
     *    Mac OS X:         in version 10.0 and later
        }
function CreateStaticTextControl(window: WindowRef; const (*var*) boundsRect: Rect; text: CFStringRef; const (*var*) style: ControlFontStyleRec; var outControl: ControlRef): OSStatus; external name '_CreateStaticTextControl';


{ Tagged data supported by static text }

const
    kControlStaticTextStyleTag  = $666F6E74 (* 'font' *);                       {  ControlFontStyleRec }
    kControlStaticTextTextTag   = $74657874 (* 'text' *);                       {  Copy of text }
    kControlStaticTextTextHeightTag = $74686569 (* 'thei' *);                   {  SInt16 }

    {    Tags available with appearance 1.1 or later    }
    kControlStaticTextTruncTag  = $7472756E (* 'trun' *);                       {  TruncCode (-1 means no truncation) }

    {    Tags available with Mac OS X or later  }
    kControlStaticTextCFStringTag = $63667374 (* 'cfst' *);                     {  CFStringRef (Also available on CarbonLib 1.5) }


    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {     ¥ PICTURE CONTROL (CDEF 19)                                                           }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {     Value parameter should contain the ID of the picture you wish to display when         }
    {     creating controls of this type. If you don't want the control tracked at all, use     }
    {     the 'no track' variant.                                                               }
    {    Picture control proc IDs   }
    kControlPictureProc         = 304;
    kControlPictureNoTrackProc  = 305;                          {  immediately returns kControlPicturePart }

    {    Control Kind Tag   }
    kControlKindPicture         = $70696374 (* 'pict' *);

    {    Creation API: Carbon only  }
    {
     *  CreatePictureControl()
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.1 and later
     *    Mac OS X:         in version 10.0 and later
        }
function CreatePictureControl(window: WindowRef; const (*var*) boundsRect: Rect; const (*var*) content: ControlButtonContentInfo; dontTrack: boolean; var outControl: ControlRef): OSStatus; external name '_CreatePictureControl';

{ Tagged data supported by picture controls }

const
    kControlPictureHandleTag    = $70696368 (* 'pich' *);                       {  PicHandle }

    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {     ¥ ICON CONTROL (CDEF 20)                                                              }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {     Value parameter should contain the ID of the ICON or cicn you wish to display when    }
    {     creating controls of this type. If you don't want the control tracked at all, use     }
    {     the 'no track' variant.                                                               }
    {    Icon control proc IDs  }
    kControlIconProc            = 320;
    kControlIconNoTrackProc     = 321;                          {  immediately returns kControlIconPart }
    kControlIconSuiteProc       = 322;
    kControlIconSuiteNoTrackProc = 323;                         {  immediately returns kControlIconPart }

                                                                {  icon ref controls may have either an icon, color icon, icon suite, or icon ref. }
                                                                {  for data other than icon, you must set the data by passing a }
                                                                {  ControlButtonContentInfo to SetControlData }
    kControlIconRefProc         = 324;
    kControlIconRefNoTrackProc  = 325;                          {  immediately returns kControlIconPart }

    {    Control Kind Tag   }
    kControlKindIcon            = $69636F6E (* 'icon' *);

    {
     *  CreateIconControl()
     *
     *  Summary:
     *    Creates an Icon control at a specific position in the specified
     *    window.
     *
     *  Discussion:
     *    Icon controls display an icon that (optionally) hilites when
     *    clicked on. On Mac OS X, a root control will be created for the
     *    window if one does not already exist. If a root control exists
     *    for the window, the Icon control will be embedded into it.
     *
     *  Parameters:
     *
     *    inWindow:
     *      The WindowRef into which the Icon control will be created.
     *
     *    inBoundsRect:
     *      The desired position (in coordinates local to the window's
     *      port) for the Icon control.
     *
     *    inIconContent:
     *      The descriptor for the icon you want the control to display.
     *      Mac OS X and CarbonLib 1.5 (and beyond) support all of the icon
     *      content types. Prior to CarbonLib 1.5, the only content types
     *      that are properly respected are kControlContentIconSuiteRes,
     *      kControlContentCIconRes, and kControlContentICONRes.
     *
     *    inDontTrack:
     *      A Boolean value indicating whether the control should hilite
     *      when it is clicked on. False means hilite and track the mouse.
     *
     *    outControl:
     *      On successful output, outControl will contain a reference to
     *      the Icon control.
     *
     *  Result:
     *    An OSStatus code indicating success or failure.
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.1 and later
     *    Mac OS X:         in version 10.0 and later
        }
function CreateIconControl(inWindow: WindowRef; const (*var*) inBoundsRect: Rect; const (*var*) inIconContent: ControlButtonContentInfo; inDontTrack: boolean; var outControl: ControlRef): OSStatus; external name '_CreateIconControl';

{ Tagged data supported by icon controls }

const
    kControlIconTransformTag    = $7472666D (* 'trfm' *);                       {  IconTransformType }
    kControlIconAlignmentTag    = $616C676E (* 'algn' *);                       {  IconAlignmentType }

    {    Tags available with appearance 1.1 or later    }
    kControlIconResourceIDTag   = $69726573 (* 'ires' *);                       {  SInt16 resource ID of icon to use }
    kControlIconContentTag      = $636F6E74 (* 'cont' *);                       {  accepts a ControlButtonContentInfo }

    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {     ¥ WINDOW HEADER (CDEF 21)                                                             }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {    Window Header proc IDs     }
    kControlWindowHeaderProc    = 336;                          {  normal header }
    kControlWindowListViewHeaderProc = 337;                     {  variant for list views - no bottom line }

    {    Control Kind Tag   }
    kControlKindWindowHeader    = $77686564 (* 'whed' *);

    {    Creation API: Carbon Only  }
    {
     *  CreateWindowHeaderControl()
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.1 and later
     *    Mac OS X:         in version 10.0 and later
        }
function CreateWindowHeaderControl(window: WindowRef; const (*var*) boundsRect: Rect; isListHeader: boolean; var outControl: ControlRef): OSStatus; external name '_CreateWindowHeaderControl';

{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{  ¥ LIST BOX (CDEF 22)                                                                }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{  Lists use an auxiliary resource to define their format. The resource type used is   }
{  'ldes' and a definition for it can be found in Appearance.r. The resource ID for    }
{  the ldes is passed in the 'value' parameter when creating the control. You may pass }
{  zero in value. This tells the List Box control to not use a resource. The list will }
{  be created with default values, and will use the standard LDEF (0). You can change  }
{  the list by getting the list handle. You can set the LDEF to use by using the tag   }
{  below (kControlListBoxLDEFTag)                                                      }
{ List Box proc IDs }

const
    kControlListBoxProc         = 352;
    kControlListBoxAutoSizeProc = 353;

    {    Control Kind Tag   }
    kControlKindListBox         = $6C626F78 (* 'lbox' *);

    {    Creation API: Carbon Only  }
    {
     *  CreateListBoxControl()
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.1 and later
     *    Mac OS X:         in version 10.0 and later
        }
function CreateListBoxControl(window: WindowRef; const (*var*) boundsRect: Rect; autoSize: boolean; numRows: SInt16; numColumns: SInt16; horizScroll: boolean; vertScroll: boolean; cellHeight: SInt16; cellWidth: SInt16; hasGrowSpace: boolean; const (*var*) listDef: ListDefSpec; var outControl: ControlRef): OSStatus; external name '_CreateListBoxControl';

{ Tagged data supported by list box }

const
    kControlListBoxListHandleTag = $6C68616E (* 'lhan' *);                      {  ListHandle }
    kControlListBoxKeyFilterTag = $666C7472 (* 'fltr' *);                       {  ControlKeyFilterUPP }
    kControlListBoxFontStyleTag = $666F6E74 (* 'font' *);                       {  ControlFontStyleRec }

    {    New tags in 1.0.1 or later     }
    kControlListBoxDoubleClickTag = $64626C63 (* 'dblc' *);                     {  Boolean. Was last click a double-click? }
    kControlListBoxLDEFTag      = $6C646566 (* 'ldef' *);                       {  SInt16. ID of LDEF to use. }

    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {     ¥ PUSH BUTTON (CDEF 23)                                                               }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {     The new standard checkbox and radio button controls support a "mixed" value that      }
    {     indicates that the current setting contains a mixed set of on and off values. The     }
    {     control value used to display this indication is defined in Controls.h:               }
    {                                                                                           }
    {         kControlCheckBoxMixedValue = 2                                                    }
    {                                                                                           }
    {     Two new variants of the standard pushbutton have been added to the standard control   }
    {     suite that draw a color icon next to the control title. One variant draws the icon    }
    {     on the left side, the other draws it on the right side (when the system justifica-    }
    {     tion is right to left, these are reversed).                                           }
    {                                                                                           }
    {     When either of the icon pushbuttons are created, the contrlMax field of the control   }
    {     record is used to determine the ID of the 'cicn' resource drawn in the pushbutton.    }
    {                                                                                           }
    {     In addition, a push button can now be told to draw with a default outline using the   }
    {     SetControlData routine with the kControlPushButtonDefaultTag below.                   }
    {                                                                                           }
    {     A push button may also be marked using the kControlPushButtonCancelTag. This has      }
    {     no visible representation, but does cause the button to play the CancelButton theme   }
    {     sound instead of the regular pushbutton theme sound when pressed.                     }
    {                                                                                           }
    {    Theme Push Button/Check Box/Radio Button proc IDs  }
    kControlPushButtonProc      = 368;
    kControlCheckBoxProc        = 369;
    kControlRadioButtonProc     = 370;
    kControlPushButLeftIconProc = 374;                          {  Standard pushbutton with left-side icon }
    kControlPushButRightIconProc = 375;                         {  Standard pushbutton with right-side icon }

    {    Variants with Appearance 1.1 or later  }
    kControlCheckBoxAutoToggleProc = 371;
    kControlRadioButtonAutoToggleProc = 372;

    {    Push Button Icon Alignments    }

type
    ControlPushButtonIconAlignment  = UInt16;
const
    kControlPushButtonIconOnLeft = 6;
    kControlPushButtonIconOnRight = 7;

    {    Control Kind Tag   }
    kControlKindPushButton      = $70757368 (* 'push' *);
    kControlKindPushIconButton  = $7069636E (* 'picn' *);
    kControlKindRadioButton     = $7264696F (* 'rdio' *);
    kControlKindCheckBox        = $63626F78 (* 'cbox' *);

    {    Creation APIs: Carbon Only     }
    {
     *  CreatePushButtonControl()
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.1 and later
     *    Mac OS X:         in version 10.0 and later
        }
function CreatePushButtonControl(window: WindowRef; const (*var*) boundsRect: Rect; title: CFStringRef; var outControl: ControlRef): OSStatus; external name '_CreatePushButtonControl';

{
 *  CreatePushButtonWithIconControl()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CreatePushButtonWithIconControl(window: WindowRef; const (*var*) boundsRect: Rect; title: CFStringRef; var icon: ControlButtonContentInfo; iconAlignment: ControlPushButtonIconAlignment; var outControl: ControlRef): OSStatus; external name '_CreatePushButtonWithIconControl';

{
 *  CreateRadioButtonControl()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CreateRadioButtonControl(window: WindowRef; const (*var*) boundsRect: Rect; title: CFStringRef; initialValue: SInt32; autoToggle: boolean; var outControl: ControlRef): OSStatus; external name '_CreateRadioButtonControl';

{
 *  CreateCheckBoxControl()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CreateCheckBoxControl(window: WindowRef; const (*var*) boundsRect: Rect; title: CFStringRef; initialValue: SInt32; autoToggle: boolean; var outControl: ControlRef): OSStatus; external name '_CreateCheckBoxControl';



{ Tagged data supported by standard buttons }

const
    kControlPushButtonDefaultTag = $64666C74 (* 'dflt' *);                      {  default ring flag }
    kControlPushButtonCancelTag = $636E636C (* 'cncl' *);                       {  cancel button flag (1.1 and later) }

    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {     ¥ SCROLL BAR (CDEF 24)                                                                }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {     This is the new Appearance scroll bar.                                                }
    {                                                                                           }
    {    Theme Scroll Bar proc IDs  }
    kControlScrollBarProc       = 384;                          {  normal scroll bar }
    kControlScrollBarLiveProc   = 386;                          {  live scrolling variant }

    {    Control Kind Tag   }
    kControlKindScrollBar       = $73626172 (* 'sbar' *);

    {    Creation API: Carbon Only  }
    {
     *  CreateScrollBarControl()
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.1 and later
     *    Mac OS X:         in version 10.0 and later
        }
function CreateScrollBarControl(window: WindowRef; const (*var*) boundsRect: Rect; value: SInt32; minimum: SInt32; maximum: SInt32; viewSize: SInt32; liveTracking: boolean; liveTrackingProc: ControlActionUPP; var outControl: ControlRef): OSStatus; external name '_CreateScrollBarControl';

{ These tags are available in Mac OS X or later }

const
    kControlScrollBarShowsArrowsTag = $6172726F (* 'arro' *);                   {  Boolean whether or not to draw the scroll arrows }


    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {     ¥ POPUP BUTTON (CDEF 25)                                                              }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {     This is the new Appearance Popup Button. It takes the same variants and does the      }
    {     same overloading as the previous popup menu control. There are some differences:      }
    {                                                                                           }
    {     Passing in a menu ID of -12345 causes the popup not to try and get the menu from a    }
    {     resource. Instead, you can build the menu and later stuff the MenuRef field in        }
    {     the popup data information.                                                           }
    {                                                                                           }
    {     You can pass -1 in the Max parameter to have the control calculate the width of the   }
    {     title on its own instead of guessing and then tweaking to get it right. It adds the   }
    {     appropriate amount of space between the title and the popup.                          }
    {                                                                                           }
    {    Theme Popup Button proc IDs    }
    kControlPopupButtonProc     = 400;
    kControlPopupFixedWidthVariant = $01;
    kControlPopupVariableWidthVariant = $02;
    kControlPopupUseAddResMenuVariant = $04;
    kControlPopupUseWFontVariant = $08;

    {    Control Kind Tag   }
    kControlKindPopupButton     = $706F7062 (* 'popb' *);

    {    Creation API: Carbon Only  }
    {
     *  CreatePopupButtonControl()
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.1 and later
     *    Mac OS X:         in version 10.0 and later
        }
function CreatePopupButtonControl(window: WindowRef; const (*var*) boundsRect: Rect; title: CFStringRef; menuID: SInt16; variableWidth: boolean; titleWidth: SInt16; titleJustification: SInt16; titleStyle: ByteParameter; var outControl: ControlRef): OSStatus; external name '_CreatePopupButtonControl';



{ These tags are available in 1.0.1 or later of Appearance }

const
    kControlPopupButtonMenuHandleTag = $6D68616E (* 'mhan' *);                  {  MenuRef }
    kControlPopupButtonMenuRefTag = $6D68616E (* 'mhan' *);                     {  MenuRef }
    kControlPopupButtonMenuIDTag = $6D6E6964 (* 'mnid' *);                      {  SInt16 }

    {    These tags are available in 1.1 or later of Appearance     }
    kControlPopupButtonExtraHeightTag = $65786874 (* 'exht' *);                 {  SInt16 - extra vertical whitespace within the button }
    kControlPopupButtonOwnedMenuRefTag = $6F6D7266 (* 'omrf' *);                {  MenuRef }

    {    These tags are available in Mac OS X   }
    kControlPopupButtonCheckCurrentTag = $6368636B (* 'chck' *);                {  Boolean    - whether the popup puts a checkmark next to the current item (defaults to true) }


    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {     ¥ RADIO GROUP (CDEF 26)                                                               }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {     This control implements a radio group. It is an embedding control and can therefore   }
    {     only be used when a control hierarchy is established for its owning window. You       }
    {     should only embed radio buttons within it. As radio buttons are embedded into it,     }
    {     the group sets up its value, min, and max to represent the number of embedded items.  }
    {     The current value of the control is the index of the sub-control that is the current  }
    {     'on' radio button. To get the current radio button control handle, you can use the    }
    {     control manager call GetIndSubControl, passing in the value of the radio group.       }
    {                                                                                           }
    {     NOTE: This control is only available with Appearance 1.0.1.                           }
    {    Radio Group Proc ID    }
    kControlRadioGroupProc      = 416;

    {    Control Kind Tag   }
    kControlKindRadioGroup      = $72677270 (* 'rgrp' *);

    {    Creation API: Carbon Only  }
    {
     *  CreateRadioGroupControl()
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.1 and later
     *    Mac OS X:         in version 10.0 and later
        }
function CreateRadioGroupControl(window: WindowRef; const (*var*) boundsRect: Rect; var outControl: ControlRef): OSStatus; external name '_CreateRadioGroupControl';

{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{  ¥ SCROLL TEXT BOX (CDEF 27)                                                         }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{  This control implements a scrolling box of (non-editable) text. This is useful for  }
{  credits in about boxes, etc.                                                        }
{  The standard version of this control has a scroll bar, but the autoscrolling        }
{  variant does not. The autoscrolling variant needs two pieces of information to      }
{  work: delay (in ticks) before the scrolling starts, and time (in ticks) between     }
{  scrolls. It will scroll one pixel at a time, unless changed via SetControlData.     }
{                                                                                      }
{  Parameter                   What Goes Here                                          }
{  ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ         ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ    }
{  Value                       Resource ID of 'TEXT'/'styl' content.                   }
{  Min                         Scroll start delay (in ticks)                       .   }
{  Max                         Delay (in ticks) between scrolls.                       }
{                                                                                      }
{  NOTE: This control is only available with Appearance 1.1.                           }
{ Scroll Text Box Proc IDs }

const
    kControlScrollTextBoxProc   = 432;
    kControlScrollTextBoxAutoScrollProc = 433;

    {    Control Kind Tag   }
    kControlKindScrollingTextBox = $73746278 (* 'stbx' *);

    {    Creation API: Carbon Only  }
    {
     *  CreateScrollingTextBoxControl()
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.1 and later
     *    Mac OS X:         in version 10.0 and later
        }
function CreateScrollingTextBoxControl(window: WindowRef; const (*var*) boundsRect: Rect; contentResID: SInt16; autoScroll: boolean; delayBeforeAutoScroll: UInt32; delayBetweenAutoScroll: UInt32; autoScrollAmount: UInt16; var outControl: ControlRef): OSStatus; external name '_CreateScrollingTextBoxControl';

{ Tagged data supported by Scroll Text Box }

const
    kControlScrollTextBoxDelayBeforeAutoScrollTag = $7374646C (* 'stdl' *);     {  UInt32 (ticks until autoscrolling starts) }
    kControlScrollTextBoxDelayBetweenAutoScrollTag = $7363646C (* 'scdl' *);    {  UInt32 (ticks between scrolls) }
    kControlScrollTextBoxAutoScrollAmountTag = $73616D74 (* 'samt' *);          {  UInt16 (pixels per scroll) -- defaults to 1 }
    kControlScrollTextBoxContentsTag = $74726573 (* 'tres' *);                  {  SInt16 (resource ID of 'TEXT'/'styl') -- write only! }
    kControlScrollTextBoxAnimatingTag = $616E696D (* 'anim' *);                 {  Boolean (whether the text box should auto-scroll) }


    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {     ¥ DISCLOSURE BUTTON                                                                   }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {
     *  CreateDisclosureButtonControl()
     *
     *  Summary:
     *    Creates a new instance of the Disclosure Button Control.
     *
     *  Discussion:
     *    CreateDisclosureButtonControl is preferred over NewControl
     *    because it allows you to specify the exact set of parameters
     *    required to create the control without overloading parameter
     *    semantics. The initial minimum of the Disclosure Button will be
     *    kControlDisclosureButtonClosed, and the maximum will be
     *    kControlDisclosureButtonDisclosed.
     *
     *  Parameters:
     *
     *    inWindow:
     *      The WindowRef in which to create the control.
     *
     *    inBoundsRect:
     *      The bounding rectangle for the control. The height of the
     *      control is fixed and the control will be centered vertically
     *      within the rectangle you specify.
     *
     *    inValue:
     *      The initial value; either kControlDisclosureButtonClosed or
     *      kControlDisclosureButtonDisclosed.
     *
     *    inAutoToggles:
     *      A boolean value indicating whether its value should change
     *      automatically after tracking the mouse.
     *
     *    outControl:
     *      On successful exit, this will contain the new control.
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function CreateDisclosureButtonControl(inWindow: WindowRef; const (*var*) inBoundsRect: Rect; inValue: SInt32; inAutoToggles: boolean; var outControl: ControlRef): OSStatus; external name '_CreateDisclosureButtonControl';


{ Control Kind Tag }

const
    kControlKindDisclosureButton = $64697362 (* 'disb' *);


    {
     *  Discussion:
     *    Disclosure Button Values
        }
    kControlDisclosureButtonClosed = 0;
    kControlDisclosureButtonDisclosed = 1;


    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }
    {     ¥ ROUND BUTTON                                                                        }
    {   ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ  }

    {
     *  ControlRoundButtonSize
     *
     *  Discussion:
     *    Button Sizes
        }

type
    ControlRoundButtonSize      = SInt16;
const
    kControlRoundButtonNormalSize = 0;
    kControlRoundButtonLargeSize = 2;

    {    Data tags supported by the round button controls   }
    kControlRoundButtonContentTag = $636F6E74 (* 'cont' *);                     {  ControlButtonContentInfo }
    kControlRoundButtonSizeTag  = $73697A65 (* 'size' *);                       {  ControlRoundButtonSize }

    {    Control Kind Tag   }
    kControlKindRoundButton     = $726E6462 (* 'rndb' *);

    {
     *  CreateRoundButtonControl()
     *
     *  Summary:
     *    Creates a new instance of the Round Button Control.
     *
     *  Discussion:
     *    CreateRoundButtonControl is preferred over NewControl because it
     *    allows you to specify the exact set of parameters required to
     *    create the control without overloading parameter semantics.
     *
     *  Parameters:
     *
     *    inWindow:
     *      The WindowRef in which to create the control.
     *
     *    inBoundsRect:
     *      The bounding rectangle for the control. The height and width of
     *      the control is fixed (specified by the ControlRoundButtonSize
     *      parameter) and the control will be centered within the
     *      rectangle you specify.
     *
     *    inSize:
     *      The button size; either kControlRoundButtonNormalSize or
     *      kControlRoundButtonLargeSize.
     *
     *    inContent:
     *      Any optional content displayed in the button. Currently only
     *      kControlContentIconRef is supported.
     *
     *    outControl:
     *      On successful exit, this will contain the new control.
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function CreateRoundButtonControl(inWindow: WindowRef; const (*var*) inBoundsRect: Rect; inSize: ControlRoundButtonSize; var inContent: ControlButtonContentInfo; var outControl: ControlRef): OSStatus; external name '_CreateRoundButtonControl';


{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{    ¥ DATA BROWSER                                                                    }
{     (CDEF 29)                                                                        }
{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
{  This control implements a user interface component for browsing (optionally)        }
{  hiearchical data structures. The browser supports multiple presentation styles      }
{  including, but not limited to:                                                      }
{                                                                                      }
{      kDataBrowserListView   - items and item properties in                           }
{                               multi-column (optionally outline) format               }
{      kDataBrowserColumnView - in-place browsing using fixed navigation columns       }
{                                                                                      }
{  The browser manages all view styles through a single high-level interface.          }
{  The high-level interface makes the following assumptions:                           }
{                                                                                      }
{      - Items have unique 32-bit identifiers (0 is reserved)                          }
{                                                                                      }
{      - Items have two kinds of named and typed properties:                           }
{           - Predefined attribute properties ( < 1024 )                               }
{             (including some display properties)                                      }
{           - Client-defined display properties ( >= 1024 )                            }
{                                                                                      }
{      - Some items are containers of other items                                      }
{      - Items may be sorted by any property                                           }
{                                                                                      }
{  Because a browser doesn't know all details about the type of objects it manages,    }
{  some implementation responsibility is best handled by its client. The client must   }
{  provide a set of callback routines which define the item hierarchy and help to      }
{  populate the browser with items. The client may also provide callbacks for handling }
{  custom data types and doing low-level event management.                             }
{                                                                                      }
{  The API is subdivided into a "universal" set of routines that applies to all view   }
{  styles, and a set of routines unique to each view style. kDataBrowserListView and   }
{  kDataBrowserColumnView share an (internal) TableView abstract base class. The       }
{  TableView formatting options and API applies to both of these view styles.          }
{                                                                                      }
{  NOTE: This control is only available with CarbonLib 1.1.                            }
{                                                                                      }
{  NOTE: This control must be created with the CreateDataBrowserControl API in         }
{        CarbonLib 1.1 through 1.4. In Mac OS X and CarbonLib 1.5 and later, you       }
{        may use the control's procID (29) to create the control with NewControl       }
{        or with a 'CNTL' resource.                                                    }
{ Control Kind Tag }

const
    kControlKindDataBrowser     = $64617462 (* 'datb' *);

    {    Error Codes    }
    errDataBrowserNotConfigured = -4970;
    errDataBrowserItemNotFound  = -4971;
    errDataBrowserItemNotAdded  = -4975;
    errDataBrowserPropertyNotFound = -4972;
    errDataBrowserInvalidPropertyPart = -4973;
    errDataBrowserInvalidPropertyData = -4974;
    errDataBrowserPropertyNotSupported = -4979;                 {  Return from DataBrowserGetSetItemDataProc  }

                                                                {  Generic Control Tags  }
    kControlDataBrowserIncludesFrameAndFocusTag = $62726472 (* 'brdr' *);       {  Boolean  }
    kControlDataBrowserKeyFilterTag = $666C7472 (* 'fltr' *);
    kControlDataBrowserEditTextKeyFilterTag = $666C7472 (* 'fltr' *);
    kControlDataBrowserEditTextValidationProcTag = $76616C69 (* 'vali' *);

    {    Data Browser View Styles   }

type
    DataBrowserViewStyle                = OSType;

const
    kDataBrowserNoView          = $3F3F3F3F (* '????' *);                       {  Error State  }
    kDataBrowserListView        = $6C737476 (* 'lstv' *);
    kDataBrowserColumnView      = $636C6D76 (* 'clmv' *);

    {    Selection Flags    }

type
    DataBrowserSelectionFlags   = UInt32;
const
    kDataBrowserDragSelect      = $01;                          {  Å ListMgr lNoRect  }
    kDataBrowserSelectOnlyOne   = $02;                          {  Å ListMgr lOnlyOne  }
    kDataBrowserResetSelection  = $04;                          {  Å ListMgr lNoExtend  }
    kDataBrowserCmdTogglesSelection = $08;                      {  Å ListMgr lUseSense  }
    kDataBrowserNoDisjointSelection = $10;                      {  Å ListMgr lNoDisjoint  }
    kDataBrowserAlwaysExtendSelection = $20;                    {  Å ListMgr lExtendDrag  }
    kDataBrowserNeverEmptySelectionSet = $40;                   {  Å ListMgr lNoNilHilite  }

    {    Data Browser Sorting   }

type
    DataBrowserSortOrder        = UInt16;
const
    kDataBrowserOrderUndefined  = 0;                            {  Not currently supported  }
    kDataBrowserOrderIncreasing = 1;
    kDataBrowserOrderDecreasing = 2;

    {    Data Browser Item Management   }

type
    DataBrowserItemID           = UInt32;
    DataBrowserItemIDPtr        = ^DataBrowserItemID;
const
    kDataBrowserNoItem          = 0;                            {  Reserved DataBrowserItemID  }


type
    DataBrowserItemState        = UInt32;
const
    kDataBrowserItemNoState     = 0;
    kDataBrowserItemAnyState    = $FFFFFFFF;
    kDataBrowserItemIsSelected  = $01;
    kDataBrowserContainerIsOpen = $02;
    kDataBrowserItemIsDragTarget = $04;                         {  During a drag operation  }

    {    Options for use with RevealDataBrowserItem     }

type
    DataBrowserRevealOptions    = UInt8;
const
    kDataBrowserRevealOnly      = 0;
    kDataBrowserRevealAndCenterInView = $01;
    kDataBrowserRevealWithoutSelecting = $02;

    {    Set operations for use with SetDataBrowserSelectedItems    }

type
    DataBrowserSetOption        = UInt32;
const
    kDataBrowserItemsAdd        = 0;                            {  add specified items to existing set  }
    kDataBrowserItemsAssign     = 1;                            {  assign destination set to specified items  }
    kDataBrowserItemsToggle     = 2;                            {  toggle membership state of specified items  }
    kDataBrowserItemsRemove     = 3;                            {  remove specified items from existing set  }

    {    Commands for use with MoveDataBrowserSelectionAnchor   }

type
    DataBrowserSelectionAnchorDirection  = UInt32;
const
    kDataBrowserSelectionAnchorUp = 0;
    kDataBrowserSelectionAnchorDown = 1;
    kDataBrowserSelectionAnchorLeft = 2;
    kDataBrowserSelectionAnchorRight = 3;

    {    Edit menu command IDs for use with Enable/ExecuteDataBrowserEditCommand    }

type
    DataBrowserEditCommand      = UInt32;
const
    kDataBrowserEditMsgUndo     = $756E646F (* 'undo' *);
    kDataBrowserEditMsgRedo     = $7265646F (* 'redo' *);
    kDataBrowserEditMsgCut      = $63757420 (* 'cut ' *);
    kDataBrowserEditMsgCopy     = $636F7079 (* 'copy' *);
    kDataBrowserEditMsgPaste    = $70617374 (* 'past' *);
    kDataBrowserEditMsgClear    = $636C6561 (* 'clea' *);
    kDataBrowserEditMsgSelectAll = $73616C6C (* 'sall' *);

    {    Notifications used in DataBrowserItemNotificationProcPtr   }

type
    DataBrowserItemNotification  = UInt32;
const
    kDataBrowserItemAdded       = 1;                            {  The specified item has been added to the browser  }
    kDataBrowserItemRemoved     = 2;                            {  The specified item has been removed from the browser  }
    kDataBrowserEditStarted     = 3;                            {  Starting an EditText session for specified item  }
    kDataBrowserEditStopped     = 4;                            {  Stopping an EditText session for specified item  }
    kDataBrowserItemSelected    = 5;                            {  Item has just been added to the selection set  }
    kDataBrowserItemDeselected  = 6;                            {  Item has just been removed from the selection set  }
    kDataBrowserItemDoubleClicked = 7;
    kDataBrowserContainerOpened = 8;                            {  Container is open  }
    kDataBrowserContainerClosing = 9;                           {  Container is about to close (and will real soon now, y'all)  }
    kDataBrowserContainerClosed = 10;                           {  Container is closed (y'all come back now!)  }
    kDataBrowserContainerSorting = 11;                          {  Container is about to be sorted (lock any volatile properties)  }
    kDataBrowserContainerSorted = 12;                           {  Container has been sorted (you may release any property locks)  }
    kDataBrowserUserToggledContainer = 16;                      {  _User_ requested container open/close state to be toggled  }
    kDataBrowserTargetChanged   = 15;                           {  The target has changed to the specified item  }
    kDataBrowserUserStateChanged = 13;                          {  The user has reformatted the view for the target  }
    kDataBrowserSelectionSetChanged = 14;                       {  The selection set has been modified (net result may be the same)  }

    {    DataBrowser Property Management    }
    {    0-1023 reserved; >= 1024 for client use    }

type
    DataBrowserPropertyID       = UInt32;
const
                                                                {  Predefined attribute properties, optional & non-display unless otherwise stated  }
    kDataBrowserItemNoProperty  = 0;                            {  The anti-property (no associated data)  }
    kDataBrowserItemIsActiveProperty = 1;                       {  Boolean typed data (defaults to true)  }
    kDataBrowserItemIsSelectableProperty = 2;                   {  Boolean typed data (defaults to true)  }
    kDataBrowserItemIsEditableProperty = 3;                     {  Boolean typed data (defaults to false, used for editable properties)  }
    kDataBrowserItemIsContainerProperty = 4;                    {  Boolean typed data (defaults to false)  }
    kDataBrowserContainerIsOpenableProperty = 5;                {  Boolean typed data (defaults to true)  }
    kDataBrowserContainerIsClosableProperty = 6;                {  Boolean typed data (defaults to true)  }
    kDataBrowserContainerIsSortableProperty = 7;                {  Boolean typed data (defaults to true)  }
    kDataBrowserItemSelfIdentityProperty = 8;                   {  kDataBrowserIconAndTextType (display property; ColumnView only)  }
    kDataBrowserContainerAliasIDProperty = 9;                   {  DataBrowserItemID (alias/symlink an item to a container item)  }
    kDataBrowserColumnViewPreviewProperty = 10;                 {  kDataBrowserCustomType (display property; ColumnView only)  }
    kDataBrowserItemParentContainerProperty = 11;               {  DataBrowserItemID (the parent of the specified item, used by ColumnView)  }

    {    DataBrowser Property Types (for display properties; i.e. ListView columns)     }
    {         These are primarily presentation types (or styles) although           }
    {         they also imply a particular set of primitive types or structures.    }

type
    DataBrowserPropertyType             = OSType;

const
                                                                {  == Corresponding data type or structure ==  }
    kDataBrowserCustomType      = $3F3F3F3F (* '????' *);                       {  No associated data, custom callbacks used  }
    kDataBrowserIconType        = $69636E72 (* 'icnr' *);                       {  IconRef, IconTransformType, RGBColor  }
    kDataBrowserTextType        = $74657874 (* 'text' *);                       {  CFStringRef  }
    kDataBrowserDateTimeType    = $64617465 (* 'date' *);                       {  DateTime or LongDateTime  }
    kDataBrowserSliderType      = $736C6472 (* 'sldr' *);                       {  Min, Max, Value  }
    kDataBrowserCheckboxType    = $63686278 (* 'chbx' *);                       {  ThemeButtonValue  }
    kDataBrowserProgressBarType = $70726F67 (* 'prog' *);                       {  Min, Max, Value  }
    kDataBrowserRelevanceRankType = $72616E6B (* 'rank' *);                     {  Min, Max, Value  }
    kDataBrowserPopupMenuType   = $6D656E75 (* 'menu' *);                       {  MenuRef, Value  }
    kDataBrowserIconAndTextType = $7469636E (* 'ticn' *);                       {  IconRef, CFStringRef, etc  }

    {    DataBrowser Property Parts     }
    {         Visual components of a property type.         }
    {         For use with GetDataBrowserItemPartBounds.    }

type
    DataBrowserPropertyPart             = OSType;

const
    kDataBrowserPropertyEnclosingPart = 0;
    kDataBrowserPropertyContentPart = $2D2D2D2D (* '----' *);
    kDataBrowserPropertyDisclosurePart = $64697363 (* 'disc' *);
    kDataBrowserPropertyTextPart = $74657874 (* 'text' *);
    kDataBrowserPropertyIconPart = $69636E72 (* 'icnr' *);
    kDataBrowserPropertySliderPart = $736C6472 (* 'sldr' *);
    kDataBrowserPropertyCheckboxPart = $63686278 (* 'chbx' *);
    kDataBrowserPropertyProgressBarPart = $70726F67 (* 'prog' *);
    kDataBrowserPropertyRelevanceRankPart = $72616E6B (* 'rank' *);

    {    Modify appearance/behavior of display properties   }

type
    DataBrowserPropertyFlags            = UInt32;
    {  Low 8 bits apply to all property types  }

const
    kDataBrowserUniversalPropertyFlagsMask = $FF;
    kDataBrowserPropertyIsMutable = $01;
    kDataBrowserDefaultPropertyFlags = $00;
    kDataBrowserUniversalPropertyFlags = $FF;                   {  support for an old name }
    kDataBrowserPropertyIsEditable = $01;                       {  support for an old name }

    {  Next 8 bits contain property-specific modifiers  }
    kDataBrowserPropertyFlagsOffset = 8;
    kDataBrowserPropertyFlagsMask = $FF00;
    kDataBrowserCheckboxTriState = $0100;                       {  kDataBrowserCheckboxType }
    kDataBrowserDateTimeRelative = $0100;                       {  kDataBrowserDateTimeType  }
    kDataBrowserDateTimeDateOnly = $0200;                       {  kDataBrowserDateTimeType  }
    kDataBrowserDateTimeTimeOnly = $0400;                       {  kDataBrowserDateTimeType  }
    kDataBrowserDateTimeSecondsToo = $0800;                     {  kDataBrowserDateTimeType  }
    kDataBrowserSliderPlainThumb = $00;                         {  kDataBrowserSliderType  }
    kDataBrowserSliderUpwardThumb = $0100;                      {  kDataBrowserSliderType  }
    kDataBrowserSliderDownwardThumb = $0200;                    {  kDataBrowserSliderType  }
    kDataBrowserDoNotTruncateText = $0300;                      {  kDataBrowserTextType && kDataBrowserIconAndTextType  }
    kDataBrowserTruncateTextAtEnd = $0200;                      {  kDataBrowserTextType && kDataBrowserIconAndTextType  }
    kDataBrowserTruncateTextMiddle = $00;                       {  kDataBrowserTextType && kDataBrowserIconAndTextType  }
    kDataBrowserTruncateTextAtStart = $0100;                    {  kDataBrowserTextType && kDataBrowserIconAndTextType  }
    kDataBrowserPropertyModificationFlags = $FF00;              {  support for an old name }
    kDataBrowserRelativeDateTime = $0100;                       {  support for an old name }

    {
       Next 8 bits contain viewStyle-specific modifiers
       See individual ViewStyle sections below for flag definitions
    }
    kDataBrowserViewSpecificFlagsOffset = 16;
    kDataBrowserViewSpecificFlagsMask = $00FF0000;
    kDataBrowserViewSpecificPropertyFlags = $00FF0000;          {  support for an old name }

    {  High 8 bits are reserved for client application use  }
    kDataBrowserClientPropertyFlagsOffset = 24;
    kDataBrowserClientPropertyFlagsMask = $FF000000;

    {    Client defined property description    }

type
    DataBrowserPropertyDescPtr = ^DataBrowserPropertyDesc;
    DataBrowserPropertyDesc = record
        propertyID:             DataBrowserPropertyID;
        propertyType:           DataBrowserPropertyType;
        propertyFlags:          DataBrowserPropertyFlags;
    end;

    {    Callback definition for use with ForEachDataBrowserItem    }
    DataBrowserItemProcPtr = procedure(item: DataBrowserItemID; state: DataBrowserItemState; clientData: UnivPtr);

    DataBrowserItemUPP = ^SInt32; { an opaque UPP }

const
    uppDataBrowserItemProcInfo = $00000FC0;
    {
     *  NewDataBrowserItemUPP()
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.1 and later
     *    Mac OS X:         in version 10.0 and later
        }
function NewDataBrowserItemUPP(userRoutine: DataBrowserItemProcPtr): DataBrowserItemUPP; external name '_NewDataBrowserItemUPP';
{
 *  DisposeDataBrowserItemUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeDataBrowserItemUPP(userUPP: DataBrowserItemUPP); external name '_DisposeDataBrowserItemUPP';
{
 *  InvokeDataBrowserItemUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvokeDataBrowserItemUPP(item: DataBrowserItemID; state: DataBrowserItemState; clientData: UnivPtr; userRoutine: DataBrowserItemUPP); external name '_InvokeDataBrowserItemUPP';
{ Creation/Configuration }
{
 *  CreateDataBrowserControl()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CreateDataBrowserControl(window: WindowRef; const (*var*) boundsRect: Rect; style: DataBrowserViewStyle; var outControl: ControlRef): OSStatus; external name '_CreateDataBrowserControl';

{
 *  GetDataBrowserViewStyle()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetDataBrowserViewStyle(browser: ControlRef; var style: DataBrowserViewStyle): OSStatus; external name '_GetDataBrowserViewStyle';

{
 *  SetDataBrowserViewStyle()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetDataBrowserViewStyle(browser: ControlRef; style: DataBrowserViewStyle): OSStatus; external name '_SetDataBrowserViewStyle';

{ Item Manipulation }
{ Passing NULL for "items" argument to RemoveDataBrowserItems and }
{ UpdateDataBrowserItems refers to all items in the specified container. }
{ Passing NULL for "items" argument to AddDataBrowserItems means }
{ "generate IDs starting from 1." }
{
 *  AddDataBrowserItems()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function AddDataBrowserItems(browser: ControlRef; container: DataBrowserItemID; numItems: UInt32; items: DataBrowserItemIDPtr; preSortProperty: DataBrowserPropertyID): OSStatus; external name '_AddDataBrowserItems';

{
 *  RemoveDataBrowserItems()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function RemoveDataBrowserItems(browser: ControlRef; container: DataBrowserItemID; numItems: UInt32; items: DataBrowserItemIDPtr; preSortProperty: DataBrowserPropertyID): OSStatus; external name '_RemoveDataBrowserItems';

{
 *  UpdateDataBrowserItems()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function UpdateDataBrowserItems(browser: ControlRef; container: DataBrowserItemID; numItems: UInt32; items: DataBrowserItemIDPtr; preSortProperty: DataBrowserPropertyID; propertyID: DataBrowserPropertyID): OSStatus; external name '_UpdateDataBrowserItems';

{ Edit Menu Enabling and Handling }
{
 *  EnableDataBrowserEditCommand()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function EnableDataBrowserEditCommand(browser: ControlRef; command: DataBrowserEditCommand): boolean; external name '_EnableDataBrowserEditCommand';

{
 *  ExecuteDataBrowserEditCommand()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ExecuteDataBrowserEditCommand(browser: ControlRef; command: DataBrowserEditCommand): OSStatus; external name '_ExecuteDataBrowserEditCommand';

{
 *  GetDataBrowserSelectionAnchor()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetDataBrowserSelectionAnchor(browser: ControlRef; var first: DataBrowserItemID; var last: DataBrowserItemID): OSStatus; external name '_GetDataBrowserSelectionAnchor';

{
 *  MoveDataBrowserSelectionAnchor()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function MoveDataBrowserSelectionAnchor(browser: ControlRef; direction: DataBrowserSelectionAnchorDirection; extendSelection: boolean): OSStatus; external name '_MoveDataBrowserSelectionAnchor';

{ Container Manipulation }
{
 *  OpenDataBrowserContainer()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function OpenDataBrowserContainer(browser: ControlRef; container: DataBrowserItemID): OSStatus; external name '_OpenDataBrowserContainer';

{
 *  CloseDataBrowserContainer()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CloseDataBrowserContainer(browser: ControlRef; container: DataBrowserItemID): OSStatus; external name '_CloseDataBrowserContainer';

{
 *  SortDataBrowserContainer()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SortDataBrowserContainer(browser: ControlRef; container: DataBrowserItemID; sortChildren: boolean): OSStatus; external name '_SortDataBrowserContainer';

{ Aggregate Item Access and Iteration }
{
 *  GetDataBrowserItems()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetDataBrowserItems(browser: ControlRef; container: DataBrowserItemID; recurse: boolean; state: DataBrowserItemState; items: Handle): OSStatus; external name '_GetDataBrowserItems';

{
 *  GetDataBrowserItemCount()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetDataBrowserItemCount(browser: ControlRef; container: DataBrowserItemID; recurse: boolean; state: DataBrowserItemState; var numItems: UInt32): OSStatus; external name '_GetDataBrowserItemCount';

{
 *  ForEachDataBrowserItem()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function ForEachDataBrowserItem(browser: ControlRef; container: DataBrowserItemID; recurse: boolean; state: DataBrowserItemState; callback: DataBrowserItemUPP; clientData: UnivPtr): OSStatus; external name '_ForEachDataBrowserItem';

{ Individual Item Access and Display }
{
 *  IsDataBrowserItemSelected()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function IsDataBrowserItemSelected(browser: ControlRef; item: DataBrowserItemID): boolean; external name '_IsDataBrowserItemSelected';

{
 *  GetDataBrowserItemState()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetDataBrowserItemState(browser: ControlRef; item: DataBrowserItemID; var state: DataBrowserItemState): OSStatus; external name '_GetDataBrowserItemState';

{
 *  RevealDataBrowserItem()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function RevealDataBrowserItem(browser: ControlRef; item: DataBrowserItemID; propertyID: DataBrowserPropertyID; options: ByteParameter): OSStatus; external name '_RevealDataBrowserItem';

{ Selection Set Manipulation }
{
 *  SetDataBrowserSelectedItems()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetDataBrowserSelectedItems(browser: ControlRef; numItems: UInt32; items: DataBrowserItemIDPtr; operation: DataBrowserSetOption): OSStatus; external name '_SetDataBrowserSelectedItems';


{ DataBrowser Attribute Manipulation }
{ The user customizable portion of the current view style settings }
{
 *  SetDataBrowserUserState()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetDataBrowserUserState(browser: ControlRef; stateInfo: CFDataRef): OSStatus; external name '_SetDataBrowserUserState';

{
 *  GetDataBrowserUserState()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetDataBrowserUserState(browser: ControlRef; var stateInfo: CFDataRef): OSStatus; external name '_GetDataBrowserUserState';

{ All items are active/enabled or not }
{
 *  SetDataBrowserActiveItems()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetDataBrowserActiveItems(browser: ControlRef; active: boolean): OSStatus; external name '_SetDataBrowserActiveItems';

{
 *  GetDataBrowserActiveItems()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetDataBrowserActiveItems(browser: ControlRef; var active: boolean): OSStatus; external name '_GetDataBrowserActiveItems';

{ Inset the scrollbars within the DataBrowser bounds }
{
 *  SetDataBrowserScrollBarInset()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetDataBrowserScrollBarInset(browser: ControlRef; var insetRect: Rect): OSStatus; external name '_SetDataBrowserScrollBarInset';

{
 *  GetDataBrowserScrollBarInset()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetDataBrowserScrollBarInset(browser: ControlRef; var insetRect: Rect): OSStatus; external name '_GetDataBrowserScrollBarInset';

{ The "user focused" item }
{ For the ListView, this means the root container }
{ For the ColumnView, this means the rightmost container column }
{
 *  SetDataBrowserTarget()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetDataBrowserTarget(browser: ControlRef; target: DataBrowserItemID): OSStatus; external name '_SetDataBrowserTarget';

{
 *  GetDataBrowserTarget()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetDataBrowserTarget(browser: ControlRef; var target: DataBrowserItemID): OSStatus; external name '_GetDataBrowserTarget';

{ Current sort ordering }
{ ListView tracks this per-column }
{
 *  SetDataBrowserSortOrder()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetDataBrowserSortOrder(browser: ControlRef; order: DataBrowserSortOrder): OSStatus; external name '_SetDataBrowserSortOrder';

{
 *  GetDataBrowserSortOrder()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetDataBrowserSortOrder(browser: ControlRef; var order: DataBrowserSortOrder): OSStatus; external name '_GetDataBrowserSortOrder';

{ Scrollbar values }
{
 *  SetDataBrowserScrollPosition()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetDataBrowserScrollPosition(browser: ControlRef; top: UInt32; left: UInt32): OSStatus; external name '_SetDataBrowserScrollPosition';

{
 *  GetDataBrowserScrollPosition()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetDataBrowserScrollPosition(browser: ControlRef; var top: UInt32; var left: UInt32): OSStatus; external name '_GetDataBrowserScrollPosition';

{ Show/Hide each scrollbar }
{
 *  SetDataBrowserHasScrollBars()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetDataBrowserHasScrollBars(browser: ControlRef; horiz: boolean; vert: boolean): OSStatus; external name '_SetDataBrowserHasScrollBars';

{
 *  GetDataBrowserHasScrollBars()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetDataBrowserHasScrollBars(browser: ControlRef; var horiz: boolean; var vert: boolean): OSStatus; external name '_GetDataBrowserHasScrollBars';

{ Property passed to sort callback (ListView sort column) }
{
 *  SetDataBrowserSortProperty()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetDataBrowserSortProperty(browser: ControlRef; proprty: DataBrowserPropertyID): OSStatus; external name '_SetDataBrowserSortProperty';

{
 *  GetDataBrowserSortProperty()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetDataBrowserSortProperty(browser: ControlRef; var proprty: DataBrowserPropertyID): OSStatus; external name '_GetDataBrowserSortProperty';

{ Modify selection behavior }
{
 *  SetDataBrowserSelectionFlags()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetDataBrowserSelectionFlags(browser: ControlRef; selectionFlags: DataBrowserSelectionFlags): OSStatus; external name '_SetDataBrowserSelectionFlags';

{
 *  GetDataBrowserSelectionFlags()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetDataBrowserSelectionFlags(browser: ControlRef; var selectionFlags: DataBrowserSelectionFlags): OSStatus; external name '_GetDataBrowserSelectionFlags';

{ Dynamically modify property appearance/behavior }
{
 *  SetDataBrowserPropertyFlags()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetDataBrowserPropertyFlags(browser: ControlRef; proprty: DataBrowserPropertyID; flags: DataBrowserPropertyFlags): OSStatus; external name '_SetDataBrowserPropertyFlags';

{
 *  GetDataBrowserPropertyFlags()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetDataBrowserPropertyFlags(browser: ControlRef; proprty: DataBrowserPropertyID; var flags: DataBrowserPropertyFlags): OSStatus; external name '_GetDataBrowserPropertyFlags';

{ Text of current in-place edit session }
{
 *  SetDataBrowserEditText()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetDataBrowserEditText(browser: ControlRef; text: CFStringRef): OSStatus; external name '_SetDataBrowserEditText';

{
 *  CopyDataBrowserEditText()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.5 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CopyDataBrowserEditText(browser: ControlRef; var text: CFStringRef): OSStatus; external name '_CopyDataBrowserEditText';

{
 *  GetDataBrowserEditText()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetDataBrowserEditText(browser: ControlRef; text: CFMutableStringRef): OSStatus; external name '_GetDataBrowserEditText';

{ Item/property currently being edited }
{
 *  SetDataBrowserEditItem()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetDataBrowserEditItem(browser: ControlRef; item: DataBrowserItemID; proprty: DataBrowserPropertyID): OSStatus; external name '_SetDataBrowserEditItem';

{
 *  GetDataBrowserEditItem()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetDataBrowserEditItem(browser: ControlRef; var item: DataBrowserItemID; var proprty: DataBrowserPropertyID): OSStatus; external name '_GetDataBrowserEditItem';

{ Get the current bounds of a visual part of an item's property }
{
 *  GetDataBrowserItemPartBounds()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetDataBrowserItemPartBounds(browser: ControlRef; item: DataBrowserItemID; proprty: DataBrowserPropertyID; part: DataBrowserPropertyPart; var bounds: Rect): OSStatus; external name '_GetDataBrowserItemPartBounds';


{ DataBrowser ItemData Accessors (used within DataBrowserItemData callback) }

type
    DataBrowserItemDataRef              = Ptr;
    {
     *  SetDataBrowserItemDataIcon()
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.1 and later
     *    Mac OS X:         in version 10.0 and later
        }
function SetDataBrowserItemDataIcon(itemData: DataBrowserItemDataRef; theData: IconRef): OSStatus; external name '_SetDataBrowserItemDataIcon';

{
 *  GetDataBrowserItemDataIcon()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.5 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetDataBrowserItemDataIcon(itemData: DataBrowserItemDataRef; var theData: IconRef): OSStatus; external name '_GetDataBrowserItemDataIcon';

{
 *  SetDataBrowserItemDataText()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetDataBrowserItemDataText(itemData: DataBrowserItemDataRef; theData: CFStringRef): OSStatus; external name '_SetDataBrowserItemDataText';

{
 *  GetDataBrowserItemDataText()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetDataBrowserItemDataText(itemData: DataBrowserItemDataRef; var theData: CFStringRef): OSStatus; external name '_GetDataBrowserItemDataText';


{
 *  SetDataBrowserItemDataValue()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetDataBrowserItemDataValue(itemData: DataBrowserItemDataRef; theData: SInt32): OSStatus; external name '_SetDataBrowserItemDataValue';

{
 *  GetDataBrowserItemDataValue()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetDataBrowserItemDataValue(itemData: DataBrowserItemDataRef; var theData: SInt32): OSStatus; external name '_GetDataBrowserItemDataValue';

{
 *  SetDataBrowserItemDataMinimum()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetDataBrowserItemDataMinimum(itemData: DataBrowserItemDataRef; theData: SInt32): OSStatus; external name '_SetDataBrowserItemDataMinimum';

{
 *  GetDataBrowserItemDataMinimum()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetDataBrowserItemDataMinimum(itemData: DataBrowserItemDataRef; var theData: SInt32): OSStatus; external name '_GetDataBrowserItemDataMinimum';

{
 *  SetDataBrowserItemDataMaximum()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetDataBrowserItemDataMaximum(itemData: DataBrowserItemDataRef; theData: SInt32): OSStatus; external name '_SetDataBrowserItemDataMaximum';

{
 *  GetDataBrowserItemDataMaximum()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetDataBrowserItemDataMaximum(itemData: DataBrowserItemDataRef; var theData: SInt32): OSStatus; external name '_GetDataBrowserItemDataMaximum';

{
 *  SetDataBrowserItemDataBooleanValue()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetDataBrowserItemDataBooleanValue(itemData: DataBrowserItemDataRef; theData: boolean): OSStatus; external name '_SetDataBrowserItemDataBooleanValue';

{
 *  GetDataBrowserItemDataBooleanValue()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetDataBrowserItemDataBooleanValue(itemData: DataBrowserItemDataRef; var theData: boolean): OSStatus; external name '_GetDataBrowserItemDataBooleanValue';

{
 *  SetDataBrowserItemDataMenuRef()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetDataBrowserItemDataMenuRef(itemData: DataBrowserItemDataRef; theData: MenuRef): OSStatus; external name '_SetDataBrowserItemDataMenuRef';

{
 *  GetDataBrowserItemDataMenuRef()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetDataBrowserItemDataMenuRef(itemData: DataBrowserItemDataRef; var theData: MenuRef): OSStatus; external name '_GetDataBrowserItemDataMenuRef';

{
 *  SetDataBrowserItemDataRGBColor()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetDataBrowserItemDataRGBColor(itemData: DataBrowserItemDataRef; const (*var*) theData: RGBColor): OSStatus; external name '_SetDataBrowserItemDataRGBColor';

{
 *  GetDataBrowserItemDataRGBColor()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetDataBrowserItemDataRGBColor(itemData: DataBrowserItemDataRef; var theData: RGBColor): OSStatus; external name '_GetDataBrowserItemDataRGBColor';


{
 *  SetDataBrowserItemDataDrawState()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetDataBrowserItemDataDrawState(itemData: DataBrowserItemDataRef; theData: ThemeDrawState): OSStatus; external name '_SetDataBrowserItemDataDrawState';

{
 *  GetDataBrowserItemDataDrawState()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetDataBrowserItemDataDrawState(itemData: DataBrowserItemDataRef; var theData: ThemeDrawState): OSStatus; external name '_GetDataBrowserItemDataDrawState';

{
 *  SetDataBrowserItemDataButtonValue()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetDataBrowserItemDataButtonValue(itemData: DataBrowserItemDataRef; theData: ThemeButtonValue): OSStatus; external name '_SetDataBrowserItemDataButtonValue';

{
 *  GetDataBrowserItemDataButtonValue()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetDataBrowserItemDataButtonValue(itemData: DataBrowserItemDataRef; var theData: ThemeButtonValue): OSStatus; external name '_GetDataBrowserItemDataButtonValue';

{
 *  SetDataBrowserItemDataIconTransform()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetDataBrowserItemDataIconTransform(itemData: DataBrowserItemDataRef; theData: IconTransformType): OSStatus; external name '_SetDataBrowserItemDataIconTransform';

{
 *  GetDataBrowserItemDataIconTransform()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetDataBrowserItemDataIconTransform(itemData: DataBrowserItemDataRef; var theData: IconTransformType): OSStatus; external name '_GetDataBrowserItemDataIconTransform';


{
 *  SetDataBrowserItemDataDateTime()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetDataBrowserItemDataDateTime(itemData: DataBrowserItemDataRef; theData: SInt32): OSStatus; external name '_SetDataBrowserItemDataDateTime';

{
 *  GetDataBrowserItemDataDateTime()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetDataBrowserItemDataDateTime(itemData: DataBrowserItemDataRef; var theData: SInt32): OSStatus; external name '_GetDataBrowserItemDataDateTime';

{
 *  SetDataBrowserItemDataLongDateTime()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetDataBrowserItemDataLongDateTime(itemData: DataBrowserItemDataRef; const (*var*) theData: LongDateTime): OSStatus; external name '_SetDataBrowserItemDataLongDateTime';

{
 *  GetDataBrowserItemDataLongDateTime()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetDataBrowserItemDataLongDateTime(itemData: DataBrowserItemDataRef; var theData: LongDateTime): OSStatus; external name '_GetDataBrowserItemDataLongDateTime';


{
 *  SetDataBrowserItemDataItemID()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetDataBrowserItemDataItemID(itemData: DataBrowserItemDataRef; theData: DataBrowserItemID): OSStatus; external name '_SetDataBrowserItemDataItemID';

{
 *  GetDataBrowserItemDataItemID()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.5 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetDataBrowserItemDataItemID(itemData: DataBrowserItemDataRef; var theData: DataBrowserItemID): OSStatus; external name '_GetDataBrowserItemDataItemID';

{
 *  GetDataBrowserItemDataProperty()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetDataBrowserItemDataProperty(itemData: DataBrowserItemDataRef; var theData: DataBrowserPropertyID): OSStatus; external name '_GetDataBrowserItemDataProperty';


{ Standard DataBrowser Callbacks }
{ Basic Item Management & Manipulation }

type
    DataBrowserItemDataProcPtr = function(browser: ControlRef; item: DataBrowserItemID; proprty: DataBrowserPropertyID; itemData: DataBrowserItemDataRef; setValue: boolean): OSStatus;

    DataBrowserItemDataUPP = ^SInt32; { an opaque UPP }
    {    Item Comparison    }
    DataBrowserItemCompareProcPtr = function(browser: ControlRef; itemOne: DataBrowserItemID; itemTwo: DataBrowserItemID; sortProperty: DataBrowserPropertyID): boolean;

    DataBrowserItemCompareUPP = ^SInt32; { an opaque UPP }
    {    ItemEvent Notification     }
    {     A Very Important Note about DataBrowserItemNotificationProcPtr:                                       }
    {                                                                                                           }
    {     Under all currently shipping versions of CarbonLib (eg. up through 1.3), your callback is called      }
    {     just as the prototype appears in this header. It should only be expecting three parameters because    }
    {     DataBrowser will only pass three parameters.                                                          }
    {                                                                                                           }
    {     Under Mac OS X, your callback is called with an additional parameter. If you wish to interpret        }
    {     the additional parameter, your callback should have the same prototype as the                         }
    {     DataBrowserItemNotificationWithItemProcPtr (below). You may freely take a callback with this          }
    {     prototype and pass it to NewDataBrowserItemNotificationUPP in order to generate a                     }
    {     DataBrowserItemNotificationUPP that you can use just like any other DataBrowserItemNotificationUPP.   }
    {                                                                                                           }
    {     If you use this technique under CarbonLib, you will *not* receive valid data in the fourth            }
    {     parameter, and any attempt to use the invalid data will probably result in a crash.                   }
    DataBrowserItemNotificationWithItemProcPtr = procedure(browser: ControlRef; item: DataBrowserItemID; message: DataBrowserItemNotification; itemData: DataBrowserItemDataRef);

    DataBrowserItemNotificationProcPtr = procedure(browser: ControlRef; item: DataBrowserItemID; message: DataBrowserItemNotification);

    DataBrowserItemNotificationWithItemUPP = ^SInt32; { an opaque UPP }
    DataBrowserItemNotificationUPP = ^SInt32; { an opaque UPP }

    {    Drag & Drop Processing     }
    DataBrowserAddDragItemProcPtr = function(browser: ControlRef; theDrag: DragReference; item: DataBrowserItemID; var itemRef: ItemReference): boolean;

    DataBrowserAcceptDragProcPtr = function(browser: ControlRef; theDrag: DragReference; item: DataBrowserItemID): boolean;

    DataBrowserReceiveDragProcPtr = function(browser: ControlRef; theDrag: DragReference; item: DataBrowserItemID): boolean;

    DataBrowserPostProcessDragProcPtr = procedure(browser: ControlRef; theDrag: DragReference; trackDragResult: OSStatus);

    DataBrowserAddDragItemUPP = ^SInt32; { an opaque UPP }
    DataBrowserAcceptDragUPP = ^SInt32; { an opaque UPP }
    DataBrowserReceiveDragUPP = ^SInt32; { an opaque UPP }
    DataBrowserPostProcessDragUPP = ^SInt32; { an opaque UPP }
    {    Contextual Menu Support    }
    DataBrowserGetContextualMenuProcPtr = procedure(browser: ControlRef; var menu: MenuRef; var helpType: UInt32; var helpItemString: CFStringRef; var selection: AEDesc);

    DataBrowserSelectContextualMenuProcPtr = procedure(browser: ControlRef; menu: MenuRef; selectionType: UInt32; menuID: SInt16; menuItem: MenuItemIndex);

    DataBrowserGetContextualMenuUPP = ^SInt32; { an opaque UPP }
    DataBrowserSelectContextualMenuUPP = ^SInt32; { an opaque UPP }
    {    Help Manager Support   }
    DataBrowserItemHelpContentProcPtr = procedure(browser: ControlRef; item: DataBrowserItemID; proprty: DataBrowserPropertyID; inRequest: HMContentRequest; var outContentProvided: HMContentProvidedType; ioHelpContent: HMHelpContentPtr);

    DataBrowserItemHelpContentUPP = ^SInt32; { an opaque UPP }

const
    uppDataBrowserItemDataProcInfo = $00007FF0;
    uppDataBrowserItemCompareProcInfo = $00003FD0;
    uppDataBrowserItemNotificationWithItemProcInfo = $00003FC0;
    uppDataBrowserItemNotificationProcInfo = $00000FC0;
    uppDataBrowserAddDragItemProcInfo = $00003FD0;
    uppDataBrowserAcceptDragProcInfo = $00000FD0;
    uppDataBrowserReceiveDragProcInfo = $00000FD0;
    uppDataBrowserPostProcessDragProcInfo = $00000FC0;
    uppDataBrowserGetContextualMenuProcInfo = $0000FFC0;
    uppDataBrowserSelectContextualMenuProcInfo = $0000AFC0;
    uppDataBrowserItemHelpContentProcInfo = $0003EFC0;
    {
     *  NewDataBrowserItemDataUPP()
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.1 and later
     *    Mac OS X:         in version 10.0 and later
        }
function NewDataBrowserItemDataUPP(userRoutine: DataBrowserItemDataProcPtr): DataBrowserItemDataUPP; external name '_NewDataBrowserItemDataUPP';
{
 *  NewDataBrowserItemCompareUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewDataBrowserItemCompareUPP(userRoutine: DataBrowserItemCompareProcPtr): DataBrowserItemCompareUPP; external name '_NewDataBrowserItemCompareUPP';
{
 *  NewDataBrowserItemNotificationWithItemUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.5 and later
 *    Mac OS X:         in version 10.1 and later
 }
function NewDataBrowserItemNotificationWithItemUPP(userRoutine: DataBrowserItemNotificationWithItemProcPtr): DataBrowserItemNotificationWithItemUPP; external name '_NewDataBrowserItemNotificationWithItemUPP';
{
 *  NewDataBrowserItemNotificationUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewDataBrowserItemNotificationUPP(userRoutine: DataBrowserItemNotificationProcPtr): DataBrowserItemNotificationUPP; external name '_NewDataBrowserItemNotificationUPP';
{
 *  NewDataBrowserAddDragItemUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewDataBrowserAddDragItemUPP(userRoutine: DataBrowserAddDragItemProcPtr): DataBrowserAddDragItemUPP; external name '_NewDataBrowserAddDragItemUPP';
{
 *  NewDataBrowserAcceptDragUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewDataBrowserAcceptDragUPP(userRoutine: DataBrowserAcceptDragProcPtr): DataBrowserAcceptDragUPP; external name '_NewDataBrowserAcceptDragUPP';
{
 *  NewDataBrowserReceiveDragUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewDataBrowserReceiveDragUPP(userRoutine: DataBrowserReceiveDragProcPtr): DataBrowserReceiveDragUPP; external name '_NewDataBrowserReceiveDragUPP';
{
 *  NewDataBrowserPostProcessDragUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewDataBrowserPostProcessDragUPP(userRoutine: DataBrowserPostProcessDragProcPtr): DataBrowserPostProcessDragUPP; external name '_NewDataBrowserPostProcessDragUPP';
{
 *  NewDataBrowserGetContextualMenuUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewDataBrowserGetContextualMenuUPP(userRoutine: DataBrowserGetContextualMenuProcPtr): DataBrowserGetContextualMenuUPP; external name '_NewDataBrowserGetContextualMenuUPP';
{
 *  NewDataBrowserSelectContextualMenuUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewDataBrowserSelectContextualMenuUPP(userRoutine: DataBrowserSelectContextualMenuProcPtr): DataBrowserSelectContextualMenuUPP; external name '_NewDataBrowserSelectContextualMenuUPP';
{
 *  NewDataBrowserItemHelpContentUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewDataBrowserItemHelpContentUPP(userRoutine: DataBrowserItemHelpContentProcPtr): DataBrowserItemHelpContentUPP; external name '_NewDataBrowserItemHelpContentUPP';
{
 *  DisposeDataBrowserItemDataUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeDataBrowserItemDataUPP(userUPP: DataBrowserItemDataUPP); external name '_DisposeDataBrowserItemDataUPP';
{
 *  DisposeDataBrowserItemCompareUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeDataBrowserItemCompareUPP(userUPP: DataBrowserItemCompareUPP); external name '_DisposeDataBrowserItemCompareUPP';
{
 *  DisposeDataBrowserItemNotificationWithItemUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.5 and later
 *    Mac OS X:         in version 10.1 and later
 }
procedure DisposeDataBrowserItemNotificationWithItemUPP(userUPP: DataBrowserItemNotificationWithItemUPP); external name '_DisposeDataBrowserItemNotificationWithItemUPP';
{
 *  DisposeDataBrowserItemNotificationUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeDataBrowserItemNotificationUPP(userUPP: DataBrowserItemNotificationUPP); external name '_DisposeDataBrowserItemNotificationUPP';
{
 *  DisposeDataBrowserAddDragItemUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeDataBrowserAddDragItemUPP(userUPP: DataBrowserAddDragItemUPP); external name '_DisposeDataBrowserAddDragItemUPP';
{
 *  DisposeDataBrowserAcceptDragUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeDataBrowserAcceptDragUPP(userUPP: DataBrowserAcceptDragUPP); external name '_DisposeDataBrowserAcceptDragUPP';
{
 *  DisposeDataBrowserReceiveDragUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeDataBrowserReceiveDragUPP(userUPP: DataBrowserReceiveDragUPP); external name '_DisposeDataBrowserReceiveDragUPP';
{
 *  DisposeDataBrowserPostProcessDragUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeDataBrowserPostProcessDragUPP(userUPP: DataBrowserPostProcessDragUPP); external name '_DisposeDataBrowserPostProcessDragUPP';
{
 *  DisposeDataBrowserGetContextualMenuUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeDataBrowserGetContextualMenuUPP(userUPP: DataBrowserGetContextualMenuUPP); external name '_DisposeDataBrowserGetContextualMenuUPP';
{
 *  DisposeDataBrowserSelectContextualMenuUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeDataBrowserSelectContextualMenuUPP(userUPP: DataBrowserSelectContextualMenuUPP); external name '_DisposeDataBrowserSelectContextualMenuUPP';
{
 *  DisposeDataBrowserItemHelpContentUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeDataBrowserItemHelpContentUPP(userUPP: DataBrowserItemHelpContentUPP); external name '_DisposeDataBrowserItemHelpContentUPP';
{
 *  InvokeDataBrowserItemDataUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeDataBrowserItemDataUPP(browser: ControlRef; item: DataBrowserItemID; proprty: DataBrowserPropertyID; itemData: DataBrowserItemDataRef; setValue: boolean; userRoutine: DataBrowserItemDataUPP): OSStatus; external name '_InvokeDataBrowserItemDataUPP';
{
 *  InvokeDataBrowserItemCompareUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeDataBrowserItemCompareUPP(browser: ControlRef; itemOne: DataBrowserItemID; itemTwo: DataBrowserItemID; sortProperty: DataBrowserPropertyID; userRoutine: DataBrowserItemCompareUPP): boolean; external name '_InvokeDataBrowserItemCompareUPP';
{
 *  InvokeDataBrowserItemNotificationWithItemUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.5 and later
 *    Mac OS X:         in version 10.1 and later
 }
procedure InvokeDataBrowserItemNotificationWithItemUPP(browser: ControlRef; item: DataBrowserItemID; message: DataBrowserItemNotification; itemData: DataBrowserItemDataRef; userRoutine: DataBrowserItemNotificationWithItemUPP); external name '_InvokeDataBrowserItemNotificationWithItemUPP';
{
 *  InvokeDataBrowserItemNotificationUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvokeDataBrowserItemNotificationUPP(browser: ControlRef; item: DataBrowserItemID; message: DataBrowserItemNotification; userRoutine: DataBrowserItemNotificationUPP); external name '_InvokeDataBrowserItemNotificationUPP';
{
 *  InvokeDataBrowserAddDragItemUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeDataBrowserAddDragItemUPP(browser: ControlRef; theDrag: DragReference; item: DataBrowserItemID; var itemRef: ItemReference; userRoutine: DataBrowserAddDragItemUPP): boolean; external name '_InvokeDataBrowserAddDragItemUPP';
{
 *  InvokeDataBrowserAcceptDragUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeDataBrowserAcceptDragUPP(browser: ControlRef; theDrag: DragReference; item: DataBrowserItemID; userRoutine: DataBrowserAcceptDragUPP): boolean; external name '_InvokeDataBrowserAcceptDragUPP';
{
 *  InvokeDataBrowserReceiveDragUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeDataBrowserReceiveDragUPP(browser: ControlRef; theDrag: DragReference; item: DataBrowserItemID; userRoutine: DataBrowserReceiveDragUPP): boolean; external name '_InvokeDataBrowserReceiveDragUPP';
{
 *  InvokeDataBrowserPostProcessDragUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvokeDataBrowserPostProcessDragUPP(browser: ControlRef; theDrag: DragReference; trackDragResult: OSStatus; userRoutine: DataBrowserPostProcessDragUPP); external name '_InvokeDataBrowserPostProcessDragUPP';
{
 *  InvokeDataBrowserGetContextualMenuUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvokeDataBrowserGetContextualMenuUPP(browser: ControlRef; var menu: MenuRef; var helpType: UInt32; var helpItemString: CFStringRef; var selection: AEDesc; userRoutine: DataBrowserGetContextualMenuUPP); external name '_InvokeDataBrowserGetContextualMenuUPP';
{
 *  InvokeDataBrowserSelectContextualMenuUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvokeDataBrowserSelectContextualMenuUPP(browser: ControlRef; menu: MenuRef; selectionType: UInt32; menuID: SInt16; menuItem: MenuItemIndex; userRoutine: DataBrowserSelectContextualMenuUPP); external name '_InvokeDataBrowserSelectContextualMenuUPP';
{
 *  InvokeDataBrowserItemHelpContentUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvokeDataBrowserItemHelpContentUPP(browser: ControlRef; item: DataBrowserItemID; proprty: DataBrowserPropertyID; inRequest: HMContentRequest; var outContentProvided: HMContentProvidedType; ioHelpContent: HMHelpContentPtr; userRoutine: DataBrowserItemHelpContentUPP); external name '_InvokeDataBrowserItemHelpContentUPP';
{ Standard Callback (vtable) Structure }

const
    kDataBrowserLatestCallbacks = 0;


type
    DataBrowserCallbacksPtr = ^DataBrowserCallbacks;
    DataBrowserCallbacks = record
        version:                UInt32;                                 {  Use kDataBrowserLatestCallbacks  }
        case SInt16 of
        0: (
            itemDataCallback:   DataBrowserItemDataUPP;
            itemCompareCallback: DataBrowserItemCompareUPP;
            itemNotificationCallback: DataBrowserItemNotificationUPP;
            addDragItemCallback: DataBrowserAddDragItemUPP;
            acceptDragCallback: DataBrowserAcceptDragUPP;
            receiveDragCallback: DataBrowserReceiveDragUPP;
            postProcessDragCallback: DataBrowserPostProcessDragUPP;
            itemHelpContentCallback: DataBrowserItemHelpContentUPP;
            getContextualMenuCallback: DataBrowserGetContextualMenuUPP;
            selectContextualMenuCallback: DataBrowserSelectContextualMenuUPP;
           );
    end;

    {
     *  InitDataBrowserCallbacks()
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.1 and later
     *    Mac OS X:         in version 10.0 and later
        }
function InitDataBrowserCallbacks(var callbacks: DataBrowserCallbacks): OSStatus; external name '_InitDataBrowserCallbacks';

{
 *  GetDataBrowserCallbacks()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetDataBrowserCallbacks(browser: ControlRef; var callbacks: DataBrowserCallbacks): OSStatus; external name '_GetDataBrowserCallbacks';

{
 *  SetDataBrowserCallbacks()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetDataBrowserCallbacks(browser: ControlRef; const (*var*) callbacks: DataBrowserCallbacks): OSStatus; external name '_SetDataBrowserCallbacks';


{ Custom Format Callbacks (kDataBrowserCustomType display properties) }

type
    DataBrowserDragFlags                = UInt32;
    DataBrowserTrackingResult   = SInt16;
const
    kDataBrowserContentHit      = 1;
    kDataBrowserNothingHit      = 0;
    kDataBrowserStopTracking    = -1;


type
    DataBrowserDrawItemProcPtr = procedure(browser: ControlRef; item: DataBrowserItemID; proprty: DataBrowserPropertyID; itemState: DataBrowserItemState; const (*var*) theRect: Rect; gdDepth: SInt16; colorDevice: boolean);

    DataBrowserEditItemProcPtr = function(browser: ControlRef; item: DataBrowserItemID; proprty: DataBrowserPropertyID; theString: CFStringRef; var maxEditTextRect: Rect; var shrinkToFit: boolean): boolean;

    DataBrowserHitTestProcPtr = function(browser: ControlRef; itemID: DataBrowserItemID; proprty: DataBrowserPropertyID; const (*var*) theRect: Rect; const (*var*) mouseRect: Rect): boolean;

    DataBrowserTrackingProcPtr = function(browser: ControlRef; itemID: DataBrowserItemID; proprty: DataBrowserPropertyID; const (*var*) theRect: Rect; startPt: Point; modifiers: EventModifiers): DataBrowserTrackingResult;

    DataBrowserItemDragRgnProcPtr = procedure(browser: ControlRef; itemID: DataBrowserItemID; proprty: DataBrowserPropertyID; const (*var*) theRect: Rect; dragRgn: RgnHandle);

    DataBrowserItemAcceptDragProcPtr = function(browser: ControlRef; itemID: DataBrowserItemID; proprty: DataBrowserPropertyID; const (*var*) theRect: Rect; theDrag: DragReference): DataBrowserDragFlags;

    DataBrowserItemReceiveDragProcPtr = function(browser: ControlRef; itemID: DataBrowserItemID; proprty: DataBrowserPropertyID; dragFlags: DataBrowserDragFlags; theDrag: DragReference): boolean;

    DataBrowserDrawItemUPP = ^SInt32; { an opaque UPP }
    DataBrowserEditItemUPP = ^SInt32; { an opaque UPP }
    DataBrowserHitTestUPP = ^SInt32; { an opaque UPP }
    DataBrowserTrackingUPP = ^SInt32; { an opaque UPP }
    DataBrowserItemDragRgnUPP = ^SInt32; { an opaque UPP }
    DataBrowserItemAcceptDragUPP = ^SInt32; { an opaque UPP }
    DataBrowserItemReceiveDragUPP = ^SInt32; { an opaque UPP }

const
    uppDataBrowserDrawItemProcInfo = $0006FFC0;
    uppDataBrowserEditItemProcInfo = $0003FFD0;
    uppDataBrowserHitTestProcInfo = $0000FFD0;
    uppDataBrowserTrackingProcInfo = $0002FFE0;
    uppDataBrowserItemDragRgnProcInfo = $0000FFC0;
    uppDataBrowserItemAcceptDragProcInfo = $0000FFF0;
    uppDataBrowserItemReceiveDragProcInfo = $0000FFD0;
    {
     *  NewDataBrowserDrawItemUPP()
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.1 and later
     *    Mac OS X:         in version 10.1 and later
        }
function NewDataBrowserDrawItemUPP(userRoutine: DataBrowserDrawItemProcPtr): DataBrowserDrawItemUPP; external name '_NewDataBrowserDrawItemUPP';
{
 *  NewDataBrowserEditItemUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.1 and later
 }
function NewDataBrowserEditItemUPP(userRoutine: DataBrowserEditItemProcPtr): DataBrowserEditItemUPP; external name '_NewDataBrowserEditItemUPP';
{
 *  NewDataBrowserHitTestUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.1 and later
 }
function NewDataBrowserHitTestUPP(userRoutine: DataBrowserHitTestProcPtr): DataBrowserHitTestUPP; external name '_NewDataBrowserHitTestUPP';
{
 *  NewDataBrowserTrackingUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.1 and later
 }
function NewDataBrowserTrackingUPP(userRoutine: DataBrowserTrackingProcPtr): DataBrowserTrackingUPP; external name '_NewDataBrowserTrackingUPP';
{
 *  NewDataBrowserItemDragRgnUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.1 and later
 }
function NewDataBrowserItemDragRgnUPP(userRoutine: DataBrowserItemDragRgnProcPtr): DataBrowserItemDragRgnUPP; external name '_NewDataBrowserItemDragRgnUPP';
{
 *  NewDataBrowserItemAcceptDragUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.1 and later
 }
function NewDataBrowserItemAcceptDragUPP(userRoutine: DataBrowserItemAcceptDragProcPtr): DataBrowserItemAcceptDragUPP; external name '_NewDataBrowserItemAcceptDragUPP';
{
 *  NewDataBrowserItemReceiveDragUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.1 and later
 }
function NewDataBrowserItemReceiveDragUPP(userRoutine: DataBrowserItemReceiveDragProcPtr): DataBrowserItemReceiveDragUPP; external name '_NewDataBrowserItemReceiveDragUPP';
{
 *  DisposeDataBrowserDrawItemUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.1 and later
 }
procedure DisposeDataBrowserDrawItemUPP(userUPP: DataBrowserDrawItemUPP); external name '_DisposeDataBrowserDrawItemUPP';
{
 *  DisposeDataBrowserEditItemUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.1 and later
 }
procedure DisposeDataBrowserEditItemUPP(userUPP: DataBrowserEditItemUPP); external name '_DisposeDataBrowserEditItemUPP';
{
 *  DisposeDataBrowserHitTestUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.1 and later
 }
procedure DisposeDataBrowserHitTestUPP(userUPP: DataBrowserHitTestUPP); external name '_DisposeDataBrowserHitTestUPP';
{
 *  DisposeDataBrowserTrackingUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.1 and later
 }
procedure DisposeDataBrowserTrackingUPP(userUPP: DataBrowserTrackingUPP); external name '_DisposeDataBrowserTrackingUPP';
{
 *  DisposeDataBrowserItemDragRgnUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.1 and later
 }
procedure DisposeDataBrowserItemDragRgnUPP(userUPP: DataBrowserItemDragRgnUPP); external name '_DisposeDataBrowserItemDragRgnUPP';
{
 *  DisposeDataBrowserItemAcceptDragUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.1 and later
 }
procedure DisposeDataBrowserItemAcceptDragUPP(userUPP: DataBrowserItemAcceptDragUPP); external name '_DisposeDataBrowserItemAcceptDragUPP';
{
 *  DisposeDataBrowserItemReceiveDragUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.1 and later
 }
procedure DisposeDataBrowserItemReceiveDragUPP(userUPP: DataBrowserItemReceiveDragUPP); external name '_DisposeDataBrowserItemReceiveDragUPP';
{
 *  InvokeDataBrowserDrawItemUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.1 and later
 }
procedure InvokeDataBrowserDrawItemUPP(browser: ControlRef; item: DataBrowserItemID; proprty: DataBrowserPropertyID; itemState: DataBrowserItemState; const (*var*) theRect: Rect; gdDepth: SInt16; colorDevice: boolean; userRoutine: DataBrowserDrawItemUPP); external name '_InvokeDataBrowserDrawItemUPP';
{
 *  InvokeDataBrowserEditItemUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.1 and later
 }
function InvokeDataBrowserEditItemUPP(browser: ControlRef; item: DataBrowserItemID; proprty: DataBrowserPropertyID; theString: CFStringRef; var maxEditTextRect: Rect; var shrinkToFit: boolean; userRoutine: DataBrowserEditItemUPP): boolean; external name '_InvokeDataBrowserEditItemUPP';
{
 *  InvokeDataBrowserHitTestUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.1 and later
 }
function InvokeDataBrowserHitTestUPP(browser: ControlRef; itemID: DataBrowserItemID; proprty: DataBrowserPropertyID; const (*var*) theRect: Rect; const (*var*) mouseRect: Rect; userRoutine: DataBrowserHitTestUPP): boolean; external name '_InvokeDataBrowserHitTestUPP';
{
 *  InvokeDataBrowserTrackingUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.1 and later
 }
function InvokeDataBrowserTrackingUPP(browser: ControlRef; itemID: DataBrowserItemID; proprty: DataBrowserPropertyID; const (*var*) theRect: Rect; startPt: Point; modifiers: EventModifiers; userRoutine: DataBrowserTrackingUPP): DataBrowserTrackingResult; external name '_InvokeDataBrowserTrackingUPP';
{
 *  InvokeDataBrowserItemDragRgnUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.1 and later
 }
procedure InvokeDataBrowserItemDragRgnUPP(browser: ControlRef; itemID: DataBrowserItemID; proprty: DataBrowserPropertyID; const (*var*) theRect: Rect; dragRgn: RgnHandle; userRoutine: DataBrowserItemDragRgnUPP); external name '_InvokeDataBrowserItemDragRgnUPP';
{
 *  InvokeDataBrowserItemAcceptDragUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.1 and later
 }
function InvokeDataBrowserItemAcceptDragUPP(browser: ControlRef; itemID: DataBrowserItemID; proprty: DataBrowserPropertyID; const (*var*) theRect: Rect; theDrag: DragReference; userRoutine: DataBrowserItemAcceptDragUPP): DataBrowserDragFlags; external name '_InvokeDataBrowserItemAcceptDragUPP';
{
 *  InvokeDataBrowserItemReceiveDragUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.1 and later
 }
function InvokeDataBrowserItemReceiveDragUPP(browser: ControlRef; itemID: DataBrowserItemID; proprty: DataBrowserPropertyID; dragFlags: DataBrowserDragFlags; theDrag: DragReference; userRoutine: DataBrowserItemReceiveDragUPP): boolean; external name '_InvokeDataBrowserItemReceiveDragUPP';
{ Custom Callback (vtable) Structure }

const
    kDataBrowserLatestCustomCallbacks = 0;


type
    DataBrowserCustomCallbacksPtr = ^DataBrowserCustomCallbacks;
    DataBrowserCustomCallbacks = record
        version:                UInt32;                                 {  Use kDataBrowserLatestCustomCallbacks  }
        case SInt16 of
        0: (
            drawItemCallback:   DataBrowserDrawItemUPP;
            editTextCallback:   DataBrowserEditItemUPP;
            hitTestCallback:    DataBrowserHitTestUPP;
            trackingCallback:   DataBrowserTrackingUPP;
            dragRegionCallback: DataBrowserItemDragRgnUPP;
            acceptDragCallback: DataBrowserItemAcceptDragUPP;
            receiveDragCallback: DataBrowserItemReceiveDragUPP;
           );
    end;

    {
     *  InitDataBrowserCustomCallbacks()
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.1 and later
     *    Mac OS X:         in version 10.0 and later
        }
function InitDataBrowserCustomCallbacks(var callbacks: DataBrowserCustomCallbacks): OSStatus; external name '_InitDataBrowserCustomCallbacks';

{
 *  GetDataBrowserCustomCallbacks()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetDataBrowserCustomCallbacks(browser: ControlRef; var callbacks: DataBrowserCustomCallbacks): OSStatus; external name '_GetDataBrowserCustomCallbacks';

{
 *  SetDataBrowserCustomCallbacks()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetDataBrowserCustomCallbacks(browser: ControlRef; const (*var*) callbacks: DataBrowserCustomCallbacks): OSStatus; external name '_SetDataBrowserCustomCallbacks';




{ TableView Formatting }

type
    DataBrowserTableViewHiliteStyle  = UInt32;
const
    kDataBrowserTableViewMinimalHilite = 0;
    kDataBrowserTableViewFillHilite = 1;


type
    DataBrowserTableViewPropertyFlags  = UInt32;
const
                                                                {  kDataBrowserTableView DataBrowserPropertyFlags  }
    kDataBrowserTableViewSelectionColumn = $00010000;

    {    The row and column indicies are zero-based     }

type
    DataBrowserTableViewRowIndex        = UInt32;
    DataBrowserTableViewColumnIndex     = UInt32;
    DataBrowserTableViewColumnID        = DataBrowserPropertyID;
    DataBrowserTableViewColumnDesc      = DataBrowserPropertyDesc;
    DataBrowserTableViewColumnDescPtr   = ^DataBrowserTableViewColumnDesc;

    {    TableView API  }
    {    Use when setting column position   }

const
    kDataBrowserTableViewLastColumn = $FFFFFFFF;

    {
     *  RemoveDataBrowserTableViewColumn()
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.1 and later
     *    Mac OS X:         in version 10.0 and later
        }
function RemoveDataBrowserTableViewColumn(browser: ControlRef; column: DataBrowserTableViewColumnID): OSStatus; external name '_RemoveDataBrowserTableViewColumn';

{
 *  GetDataBrowserTableViewColumnCount()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetDataBrowserTableViewColumnCount(browser: ControlRef; var numColumns: UInt32): OSStatus; external name '_GetDataBrowserTableViewColumnCount';


{
 *  SetDataBrowserTableViewHiliteStyle()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetDataBrowserTableViewHiliteStyle(browser: ControlRef; hiliteStyle: DataBrowserTableViewHiliteStyle): OSStatus; external name '_SetDataBrowserTableViewHiliteStyle';

{
 *  GetDataBrowserTableViewHiliteStyle()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetDataBrowserTableViewHiliteStyle(browser: ControlRef; var hiliteStyle: DataBrowserTableViewHiliteStyle): OSStatus; external name '_GetDataBrowserTableViewHiliteStyle';


{
 *  SetDataBrowserTableViewRowHeight()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetDataBrowserTableViewRowHeight(browser: ControlRef; height: UInt16): OSStatus; external name '_SetDataBrowserTableViewRowHeight';

{
 *  GetDataBrowserTableViewRowHeight()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetDataBrowserTableViewRowHeight(browser: ControlRef; var height: UInt16): OSStatus; external name '_GetDataBrowserTableViewRowHeight';

{
 *  SetDataBrowserTableViewColumnWidth()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetDataBrowserTableViewColumnWidth(browser: ControlRef; width: UInt16): OSStatus; external name '_SetDataBrowserTableViewColumnWidth';

{
 *  GetDataBrowserTableViewColumnWidth()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetDataBrowserTableViewColumnWidth(browser: ControlRef; var width: UInt16): OSStatus; external name '_GetDataBrowserTableViewColumnWidth';

{
 *  SetDataBrowserTableViewItemRowHeight()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetDataBrowserTableViewItemRowHeight(browser: ControlRef; item: DataBrowserItemID; height: UInt16): OSStatus; external name '_SetDataBrowserTableViewItemRowHeight';

{
 *  GetDataBrowserTableViewItemRowHeight()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetDataBrowserTableViewItemRowHeight(browser: ControlRef; item: DataBrowserItemID; var height: UInt16): OSStatus; external name '_GetDataBrowserTableViewItemRowHeight';

{
 *  SetDataBrowserTableViewNamedColumnWidth()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetDataBrowserTableViewNamedColumnWidth(browser: ControlRef; column: DataBrowserTableViewColumnID; width: UInt16): OSStatus; external name '_SetDataBrowserTableViewNamedColumnWidth';

{
 *  GetDataBrowserTableViewNamedColumnWidth()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetDataBrowserTableViewNamedColumnWidth(browser: ControlRef; column: DataBrowserTableViewColumnID; var width: UInt16): OSStatus; external name '_GetDataBrowserTableViewNamedColumnWidth';

{
 *  SetDataBrowserTableViewGeometry()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetDataBrowserTableViewGeometry(browser: ControlRef; variableWidthColumns: boolean; variableHeightRows: boolean): OSStatus; external name '_SetDataBrowserTableViewGeometry';

{
 *  GetDataBrowserTableViewGeometry()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetDataBrowserTableViewGeometry(browser: ControlRef; var variableWidthColumns: boolean; var variableHeightRows: boolean): OSStatus; external name '_GetDataBrowserTableViewGeometry';


{
 *  GetDataBrowserTableViewItemID()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetDataBrowserTableViewItemID(browser: ControlRef; row: DataBrowserTableViewRowIndex; var item: DataBrowserItemID): OSStatus; external name '_GetDataBrowserTableViewItemID';

{
 *  SetDataBrowserTableViewItemRow()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetDataBrowserTableViewItemRow(browser: ControlRef; item: DataBrowserItemID; row: DataBrowserTableViewRowIndex): OSStatus; external name '_SetDataBrowserTableViewItemRow';

{
 *  GetDataBrowserTableViewItemRow()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetDataBrowserTableViewItemRow(browser: ControlRef; item: DataBrowserItemID; var row: DataBrowserTableViewRowIndex): OSStatus; external name '_GetDataBrowserTableViewItemRow';

{
 *  SetDataBrowserTableViewColumnPosition()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetDataBrowserTableViewColumnPosition(browser: ControlRef; column: DataBrowserTableViewColumnID; position: DataBrowserTableViewColumnIndex): OSStatus; external name '_SetDataBrowserTableViewColumnPosition';

{
 *  GetDataBrowserTableViewColumnPosition()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetDataBrowserTableViewColumnPosition(browser: ControlRef; column: DataBrowserTableViewColumnID; var position: DataBrowserTableViewColumnIndex): OSStatus; external name '_GetDataBrowserTableViewColumnPosition';

{
 *  GetDataBrowserTableViewColumnProperty()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetDataBrowserTableViewColumnProperty(browser: ControlRef; column: DataBrowserTableViewColumnIndex; var proprty: DataBrowserTableViewColumnID): OSStatus; external name '_GetDataBrowserTableViewColumnProperty';




{ kDataBrowserListView Formatting }

type
    DataBrowserListViewPropertyFlags  = UInt32;
const
                                                                {  kDataBrowserListView DataBrowserPropertyFlags  }
    kDataBrowserListViewMovableColumn = $00020000;
    kDataBrowserListViewSortableColumn = $00040000;
    kDataBrowserListViewSelectionColumn = $00010000;
    kDataBrowserListViewTypeSelectColumn = $00080000;
    kDataBrowserListViewDefaultColumnFlags = $00060000;


    kDataBrowserListViewLatestHeaderDesc = 0;


type
    DataBrowserListViewHeaderDescPtr = ^DataBrowserListViewHeaderDesc;
    DataBrowserListViewHeaderDesc = record
        version:                UInt32;                                 {  Use kDataBrowserListViewLatestHeaderDesc  }
        minimumWidth:           UInt16;
        maximumWidth:           UInt16;
        titleOffset:            SInt16;
        titleString:            CFStringRef;
        initialOrder:           DataBrowserSortOrder;
        btnFontStyle:           ControlFontStyleRec;
        btnContentInfo:         ControlButtonContentInfo;
    end;

    DataBrowserListViewColumnDescPtr = ^DataBrowserListViewColumnDesc;
    DataBrowserListViewColumnDesc = record
        propertyDesc:           DataBrowserTableViewColumnDesc;
        headerBtnDesc:          DataBrowserListViewHeaderDesc;
    end;

    {    kDataBrowserListView API   }

const
    kDataBrowserListViewAppendColumn = -1;

    {
     *  AutoSizeDataBrowserListViewColumns()
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.1 and later
     *    Mac OS X:         in version 10.0 and later
        }
function AutoSizeDataBrowserListViewColumns(browser: ControlRef): OSStatus; external name '_AutoSizeDataBrowserListViewColumns';

{
 *  AddDataBrowserListViewColumn()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function AddDataBrowserListViewColumn(browser: ControlRef; var columnDesc: DataBrowserListViewColumnDesc; position: DataBrowserTableViewColumnIndex): OSStatus; external name '_AddDataBrowserListViewColumn';

{
 *  GetDataBrowserListViewHeaderDesc()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.5 and later
 *    Mac OS X:         not available
 }
function GetDataBrowserListViewHeaderDesc(browser: ControlRef; column: DataBrowserTableViewColumnID; var desc: DataBrowserListViewHeaderDesc): OSStatus; external name '_GetDataBrowserListViewHeaderDesc';

{
 *  SetDataBrowserListViewHeaderDesc()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.5 and later
 *    Mac OS X:         not available
 }
function SetDataBrowserListViewHeaderDesc(browser: ControlRef; column: DataBrowserTableViewColumnID; var desc: DataBrowserListViewHeaderDesc): OSStatus; external name '_SetDataBrowserListViewHeaderDesc';

{
 *  SetDataBrowserListViewHeaderBtnHeight()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetDataBrowserListViewHeaderBtnHeight(browser: ControlRef; height: UInt16): OSStatus; external name '_SetDataBrowserListViewHeaderBtnHeight';

{
 *  GetDataBrowserListViewHeaderBtnHeight()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetDataBrowserListViewHeaderBtnHeight(browser: ControlRef; var height: UInt16): OSStatus; external name '_GetDataBrowserListViewHeaderBtnHeight';

{
 *  SetDataBrowserListViewUsePlainBackground()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetDataBrowserListViewUsePlainBackground(browser: ControlRef; usePlainBackground: boolean): OSStatus; external name '_SetDataBrowserListViewUsePlainBackground';

{
 *  GetDataBrowserListViewUsePlainBackground()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetDataBrowserListViewUsePlainBackground(browser: ControlRef; var usePlainBackground: boolean): OSStatus; external name '_GetDataBrowserListViewUsePlainBackground';

{
 *  SetDataBrowserListViewDisclosureColumn()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetDataBrowserListViewDisclosureColumn(browser: ControlRef; column: DataBrowserTableViewColumnID; expandableRows: boolean): OSStatus; external name '_SetDataBrowserListViewDisclosureColumn';

{
 *  GetDataBrowserListViewDisclosureColumn()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetDataBrowserListViewDisclosureColumn(browser: ControlRef; var column: DataBrowserTableViewColumnID; var expandableRows: boolean): OSStatus; external name '_GetDataBrowserListViewDisclosureColumn';


{ kDataBrowserColumnView API }
{
 *  GetDataBrowserColumnViewPath()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetDataBrowserColumnViewPath(browser: ControlRef; path: Handle): OSStatus; external name '_GetDataBrowserColumnViewPath';

{
 *  GetDataBrowserColumnViewPathLength()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetDataBrowserColumnViewPathLength(browser: ControlRef; var pathLength: UInt32): OSStatus; external name '_GetDataBrowserColumnViewPathLength';

{
 *  SetDataBrowserColumnViewPath()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetDataBrowserColumnViewPath(browser: ControlRef; length: UInt32; path: DataBrowserItemIDPtr): OSStatus; external name '_SetDataBrowserColumnViewPath';

{
 *  SetDataBrowserColumnViewDisplayType()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetDataBrowserColumnViewDisplayType(browser: ControlRef; propertyType: DataBrowserPropertyType): OSStatus; external name '_SetDataBrowserColumnViewDisplayType';

{
 *  GetDataBrowserColumnViewDisplayType()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function GetDataBrowserColumnViewDisplayType(browser: ControlRef; var propertyType: DataBrowserPropertyType): OSStatus; external name '_GetDataBrowserColumnViewDisplayType';


{ DataBrowser UPP macros }
{---------------------------------------------------------------------------------------}
{ EditUnicodeText Contol                                                                }
{---------------------------------------------------------------------------------------}
{ This control is only available in Mac OS X.  It is super similar to Edit Text control }
{ Use all the same Get/Set tags.  But don't ask for the TEHandle.                       }
{---------------------------------------------------------------------------------------}
{ This callback supplies the functionality of the TSMTEPostUpdateProcPtr that is used }
{ in the EditText control.  A client should supply this call if they want to look at  }
{ inline text that has been fixed before it is included in the actual body text       }
{ if the new text (i.e. the text in the handle) should be included in the body text    }
{ the client should return true.  If the client wants to block the inclusion of the    }
{ text they should return false.                                                       }

type
    EditUnicodePostUpdateProcPtr = function(uniText: UniCharArrayHandle; uniTextLength: UniCharCount; iStartOffset: UniCharArrayOffset; iEndOffset: UniCharArrayOffset; refcon: UnivPtr): boolean;

    EditUnicodePostUpdateUPP = ^SInt32; { an opaque UPP }

const
    uppEditUnicodePostUpdateProcInfo = $0000FFD0;
    {
     *  NewEditUnicodePostUpdateUPP()
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib on Mac OS X
     *    Mac OS X:         in version 10.0 and later
        }
function NewEditUnicodePostUpdateUPP(userRoutine: EditUnicodePostUpdateProcPtr): EditUnicodePostUpdateUPP; external name '_NewEditUnicodePostUpdateUPP';
{
 *  DisposeEditUnicodePostUpdateUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib on Mac OS X
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeEditUnicodePostUpdateUPP(userUPP: EditUnicodePostUpdateUPP); external name '_DisposeEditUnicodePostUpdateUPP';
{
 *  InvokeEditUnicodePostUpdateUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib on Mac OS X
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeEditUnicodePostUpdateUPP(uniText: UniCharArrayHandle; uniTextLength: UniCharCount; iStartOffset: UniCharArrayOffset; iEndOffset: UniCharArrayOffset; refcon: UnivPtr; userRoutine: EditUnicodePostUpdateUPP): boolean; external name '_InvokeEditUnicodePostUpdateUPP';
{ Use this tag when calling ControlSet/GetData to specify the UnicodePostUpdateProcPtr }
{ tags available with Appearance 1.1 or later }

const
    kControlEditUnicodeTextPostUpdateProcTag = $75707570 (* 'upup' *);


    kControlEditUnicodeTextProc = 912;
    kControlEditUnicodeTextPasswordProc = 914;

    {    Control Kind Tag   }
    kControlKindEditUnicodeText = $65757478 (* 'eutx' *);

    {    Creation API for X     }
    {
     *  CreateEditUnicodeTextControl()
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function CreateEditUnicodeTextControl(window: WindowRef; const (*var*) boundsRect: Rect; text: CFStringRef; isPassword: boolean; style: {Const}ControlFontStyleRecPtr; var outControl: ControlRef): OSStatus; external name '_CreateEditUnicodeTextControl';

const
    { Tagged data supported by Unicode text Control only }
    kControlEditTextSingleLineTag = $73676C63 (* 'sglc' *);





{$ALIGN MAC68K}
{#POP}
{unit Displays}
{$ALIGN MAC68K}










{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}


type
    DMProcessInfoPtr                    = ProcessSerialNumberPtr;
    DMModalFilterUPP                    = ModalFilterUPP;


const
                                                                {  AppleEvents Core Suite  }
    kAESystemConfigNotice       = $636E6667 (* 'cnfg' *);                       {  Core Suite types  }
    kAEDisplayNotice            = $6473706C (* 'dspl' *);
    kAEDisplaySummary           = $6473756D (* 'dsum' *);
    keyDMConfigVersion          = $646D6376 (* 'dmcv' *);
    keyDMConfigFlags            = $646D6366 (* 'dmcf' *);
    keyDMConfigReserved         = $646D6372 (* 'dmcr' *);
    keyDisplayID                = $646D6964 (* 'dmid' *);
    keyDisplayComponent         = $646D6463 (* 'dmdc' *);
    keyDisplayDevice            = $646D6464 (* 'dmdd' *);
    keyDisplayFlags             = $646D6466 (* 'dmdf' *);
    keyDisplayMode              = $646D646D (* 'dmdm' *);
    keyDisplayModeReserved      = $646D6D72 (* 'dmmr' *);
    keyDisplayReserved          = $646D6472 (* 'dmdr' *);
    keyDisplayMirroredId        = $646D6D69 (* 'dmmi' *);
    keyDeviceFlags              = $64646466 (* 'dddf' *);
    keyDeviceDepthMode          = $6464646D (* 'dddm' *);
    keyDeviceRect               = $64646472 (* 'dddr' *);
    keyPixMapRect               = $64706472 (* 'dpdr' *);
    keyPixMapHResolution        = $64706872 (* 'dphr' *);
    keyPixMapVResolution        = $64707672 (* 'dpvr' *);
    keyPixMapPixelType          = $64707074 (* 'dppt' *);
    keyPixMapPixelSize          = $64707073 (* 'dpps' *);
    keyPixMapCmpCount           = $64706363 (* 'dpcc' *);
    keyPixMapCmpSize            = $64706373 (* 'dpcs' *);
    keyPixMapAlignment          = $64707061 (* 'dppa' *);
    keyPixMapResReserved        = $64707272 (* 'dprr' *);
    keyPixMapReserved           = $64707072 (* 'dppr' *);
    keyPixMapColorTableSeed     = $64706374 (* 'dpct' *);
    keySummaryMenubar           = $64736D62 (* 'dsmb' *);
    keySummaryChanges           = $64736368 (* 'dsch' *);
    keyDisplayOldConfig         = $646F6C64 (* 'dold' *);
    keyDisplayNewConfig         = $646E6577 (* 'dnew' *);

    dmOnlyActiveDisplays        = true;
    dmAllDisplays               = false;


                                                                {  DMSendDependentNotification notifyClass  }
    kDependentNotifyClassShowCursor = $73686372 (* 'shcr' *);                   {  When display mgr shows a hidden cursor during an unmirror  }
    kDependentNotifyClassDriverOverride = $6E647276 (* 'ndrv' *);               {  When a driver is overridden  }
    kDependentNotifyClassDisplayMgrOverride = $646D6772 (* 'dmgr' *);           {  When display manager is upgraded  }
    kDependentNotifyClassProfileChanged = $70726F66 (* 'prof' *);               {  When DMSetProfileByAVID is called  }


                                                                {  Switch Flags  }
    kNoSwitchConfirmBit         = 0;                            {  Flag indicating that there is no need to confirm a switch to this mode  }
    kDepthNotAvailableBit       = 1;                            {  Current depth not available in new mode  }
    kShowModeBit                = 3;                            {  Show this mode even though it requires a confirm.  }
    kModeNotResizeBit           = 4;                            {  Do not use this mode to resize display (for cards that mode drives a different connector).  }
    kNeverShowModeBit           = 5;                            {  This mode should not be shown in the user interface.  }

    {       Summary Change Flags (sticky bits indicating an operation was performed)
        For example, moving a display then moving it back will still set the kMovedDisplayBit.
        }
    kBeginEndConfigureBit       = 0;
    kMovedDisplayBit            = 1;
    kSetMainDisplayBit          = 2;
    kSetDisplayModeBit          = 3;
    kAddDisplayBit              = 4;
    kRemoveDisplayBit           = 5;
    kNewDisplayBit              = 6;
    kDisposeDisplayBit          = 7;
    kEnabledDisplayBit          = 8;
    kDisabledDisplayBit         = 9;
    kMirrorDisplayBit           = 10;
    kUnMirrorDisplayBit         = 11;


                                                                {  Notification Messages for extended call back routines  }
    kDMNotifyRequestConnectionProbe = 0;                        {  Like kDMNotifyRequestDisplayProbe only not for smart displays (used in wake before all busses are awake)  }
    kDMNotifyInstalled          = 1;                            {  At install time  }
    kDMNotifyEvent              = 2;                            {  Post change time  }
    kDMNotifyRemoved            = 3;                            {  At remove time  }
    kDMNotifyPrep               = 4;                            {  Pre change time  }
    kDMNotifyExtendEvent        = 5;                            {  Allow registrees to extend apple event before it is sent  }
    kDMNotifyDependents         = 6;                            {  Minor notification check without full update  }
    kDMNotifySuspendConfigure   = 7;                            {  Temporary end of configuration  }
    kDMNotifyResumeConfigure    = 8;                            {  Resume configuration  }
    kDMNotifyRequestDisplayProbe = 9;                           {  Request smart displays re-probe (used in sleep and hot plugging)  }
                                                                {  Notification Flags  }
    kExtendedNotificationProc   = $00010000;


    {    types for notifyType   }
    kFullNotify                 = 0;                            {  This is the appleevent whole nine yards notify  }
    kFullDependencyNotify       = 1;                            {  Only sends to those who want to know about interrelated functionality (used for updating UI)  }

    {    DisplayID/DeviceID constants   }
    kDummyDeviceID              = $00FF;                        {  This is the ID of the dummy display, used when the last ÒrealÓ display is disabled. }
    kInvalidDisplayID           = $0000;                        {  This is the invalid ID }
    kFirstDisplayID             = $0100;

                                                                {  bits for panelListFlags  }
    kAllowDuplicatesBit         = 0;

                                                                {  bits for nameFlags  }
    kSuppressNumberBit          = 0;
    kSuppressNumberMask         = 1;
    kForceNumberBit             = 1;
    kForceNumberMask            = 2;
    kSuppressNameBit            = 2;
    kSuppressNameMask           = 4;

    {  DMGetNameByAVID masks }
    kDMSupressNumbersMask       = $01;                          {  Supress the numbers and return only names }
    kDMForceNumbersMask         = $02;                          {  Force numbers to always be shown (even on single display configs) }
    kDMSupressNameMask          = $04;                          {  Supress the names and return only numbers. }



    {    Constants for fidelity checks  }
    kNoFidelity                 = 0;
    kMinimumFidelity            = 1;
    kDefaultFidelity            = 500;                          {  I'm just picking a number for Apple default panels and engines }
    kDefaultManufacturerFidelity = 1000;                        {  I'm just picking a number for Manufacturer's panels and engines (overrides apple defaults) }

    kAnyPanelType               = 0;                            {  Pass to DMNewEngineList for list of all panels (as opposed to specific types) }
    kAnyEngineType              = 0;                            {  Pass to DMNewEngineList for list of all engines }
    kAnyDeviceType              = 0;                            {  Pass to DMNewDeviceList for list of all devices }
    kAnyPortType                = 0;                            {  Pass to DMNewDevicePortList for list of all devices }

    {    portListFlags for DM_NewDevicePortList     }
                                                                {  Should offline devices be put into the port list (such as dummy display)  }
    kPLIncludeOfflineDevicesBit = 0;


    {    confirmFlags for DMConfirmConfiguration    }
    kForceConfirmBit            = 0;                            {  Force a confirm dialog  }
    kForceConfirmMask           = $01;


    {    Flags for displayModeFlags     }
    kDisplayModeListNotPreferredBit = 0;
    kDisplayModeListNotPreferredMask = $01;


    {    Flags for itemFlags    }
    kComponentListNotPreferredBit = 0;
    kComponentListNotPreferredMask = $01;

    kDisplayTimingInfoVersionZero = 1;
    kDisplayTimingInfoReservedCountVersionZero = 16;
    kDisplayModeEntryVersionZero = 0;                           {  displayModeVersion - original version }
    kDisplayModeEntryVersionOne = 1;                            {  displayModeVersion - added displayModeOverrideInfo }


    kMakeAndModelReservedCount  = 4;                            {  Number of reserved fields }


    {  Display Gestalt for DMDisplayGestalt }
    kDisplayGestaltDisplayCommunicationAttr = $636F6D6D (* 'comm' *);
    kDisplayGestaltForbidI2CMask = $01;                         {  Some displays have firmware problems if they get I2C communication.  If this bit is set, then I2C communication is forbidden }
    kDisplayGestaltUseI2CPowerMask = $02;                       {  Some displays require I2C power settings (most use DPMS). }
    kDisplayGestaltCalibratorAttr = $63616C69 (* 'cali' *);
    kDisplayGestaltBrightnessAffectsGammaMask = $01;            {  Used by default calibrator (should we show brightness panel)  }
    kDisplayGestaltViewAngleAffectsGammaMask = $02;             {  Currently not used by color sync }



type
    DMFidelityType                      = UInt32;
    {
       AVID is an ID for ports and devices the old DisplayID type
        is carried on for compatibility
    }


    DMListType                          = Ptr;
    DMListIndexType                     = UInt32;
    AVPowerStateRec                     = VDPowerStateRec;
    AVPowerStateRecPtr                  = ^AVPowerStateRec;
    AVPowerStatePtr                     = ^VDPowerStateRec;
    DMDisplayTimingInfoRecPtr = ^DMDisplayTimingInfoRec;
    DMDisplayTimingInfoRec = record
        timingInfoVersion:      UInt32;
        timingInfoAttributes:   UInt32;                                 {  Flags  }
        timingInfoRelativeQuality: SInt32;                              {  quality of the timing  }
        timingInfoRelativeDefault: SInt32;                              {  relative default of the timing  }
        timingInfoReserved:     array [0..15] of UInt32;                {  Reserved  }
    end;

    DMDisplayTimingInfoPtr              = ^DMDisplayTimingInfoRec;

    DMComponentListEntryRecPtr = ^DMComponentListEntryRec;
    DMComponentListEntryRec = record
        itemID:                 DisplayIDType;                          {  DisplayID Manager }
        itemComponent:          Component;                              {  Component Manager }
        itemDescription:        ComponentDescription;                   {  We can always construct this if we use something beyond the compontent mgr. }
        itemClass:              ResType;                                {  Class of group to put this panel (eg geometry/color/etc for panels, brightness/contrast for engines, video out/sound/etc for devices) }
        itemFidelity:           DMFidelityType;                         {  How good is this item for the specified search? }
        itemSubClass:           ResType;                                {  Subclass of group to put this panel.  Can use to do sub-grouping (eg volume for volume panel and mute panel) }
        itemSort:               Point;                                  {  Set to 0 - future to sort the items in a sub group. }
        itemFlags:              UInt32;                                 {  Set to 0 (future expansion) }
        itemReserved:           ResType;                                {  What kind of code does the itemReference point to  (right now - kPanelEntryTypeComponentMgr only) }
        itemFuture1:            UInt32;                                 {  Set to 0 (future expansion - probably an alternate code style) }
        itemFuture2:            UInt32;                                 {  Set to 0 (future expansion - probably an alternate code style) }
        itemFuture3:            UInt32;                                 {  Set to 0 (future expansion - probably an alternate code style) }
        itemFuture4:            UInt32;                                 {  Set to 0 (future expansion - probably an alternate code style) }
    end;

    DMComponentListEntryPtr             = ^DMComponentListEntryRec;
    {  ¥¥¥ Move AVLocationRec to AVComponents.i AFTER AVComponents.i is created }
    AVLocationRecPtr = ^AVLocationRec;
    AVLocationRec = record
        locationConstant:       UInt32;                                 {  Set to 0 (future expansion - probably an alternate code style) }
    end;

    AVLocationPtr                       = ^AVLocationRec;
    DMDepthInfoRecPtr = ^DMDepthInfoRec;
    DMDepthInfoRec = record
        depthSwitchInfo:        VDSwitchInfoPtr;                        {  This is the switch mode to choose this timing/depth  }
        depthVPBlock:           VPBlockPtr;                             {  VPBlock (including size, depth and format)  }
        depthFlags:             UInt32;                                 {  VDVideoParametersInfoRec.csDepthFlags   }
        depthReserved1:         UInt32;                                 {  Reserved  }
        depthReserved2:         UInt32;                                 {  Reserved  }
    end;

    DMDepthInfoPtr                      = ^DMDepthInfoRec;
    DMDepthInfoBlockRecPtr = ^DMDepthInfoBlockRec;
    DMDepthInfoBlockRec = record
        depthBlockCount:        UInt32;                                 {  How many depths are there?  }
        depthVPBlock:           DMDepthInfoPtr;                         {  Array of DMDepthInfoRec  }
        depthBlockFlags:        UInt32;                                 {  Reserved  }
        depthBlockReserved1:    UInt32;                                 {  Reserved  }
        depthBlockReserved2:    UInt32;                                 {  Reserved  }
    end;

    DMDepthInfoBlockPtr                 = ^DMDepthInfoBlockRec;
    DMDisplayModeListEntryRecPtr = ^DMDisplayModeListEntryRec;
    DMDisplayModeListEntryRec = record
        displayModeFlags:       UInt32;
        displayModeSwitchInfo:  VDSwitchInfoPtr;
        displayModeResolutionInfo: VDResolutionInfoPtr;
        displayModeTimingInfo:  VDTimingInfoPtr;
        displayModeDepthBlockInfo: DMDepthInfoBlockPtr;                 {  Information about all the depths }
        displayModeVersion:     UInt32;                                 {  What version is this record (now kDisplayModeEntryVersionOne) }
        displayModeName:        StringPtr;                              {  Name of the timing mode }
        displayModeDisplayInfo: DMDisplayTimingInfoPtr;                 {  Information from the display. }
    end;

    DMDisplayModeListEntryPtr           = ^DMDisplayModeListEntryRec;

    DependentNotifyRecPtr = ^DependentNotifyRec;
    DependentNotifyRec = record
        notifyType:             ResType;                                {  What type was the engine that made the change (may be zero) }
        notifyClass:            ResType;                                {  What class was the change (eg geometry, color etc) }
        notifyPortID:           DisplayIDType;                          {  Which device was touched (kInvalidDisplayID -> all or none) }
        notifyComponent:        ComponentInstance;                      {  What engine did it (may be 0)? }
        notifyVersion:          UInt32;                                 {  Set to 0 (future expansion) }
        notifyFlags:            UInt32;                                 {  Set to 0 (future expansion) }
        notifyReserved:         UInt32;                                 {  Set to 0 (future expansion) }
        notifyFuture:           UInt32;                                 {  Set to 0 (future expansion) }
    end;

    DependentNotifyPtr                  = ^DependentNotifyRec;

    DMMakeAndModelRecPtr = ^DMMakeAndModelRec;
    DMMakeAndModelRec = record
        manufacturer:           ResType;
        model:                  UInt32;
        serialNumber:           UInt32;
        manufactureDate:        UInt32;
        makeReserved:           array [0..3] of UInt32;
    end;

    DMMakeAndModelPtr                   = ^DMMakeAndModelRec;
    {  DMNewDisplayList displayListIncludeFlags }

const
    kIncludeOnlineActiveDisplaysMask = $01;
    kIncludeOnlineDisabledDisplaysMask = $02;
    kIncludeOfflineDisplaysMask = $04;
    kIncludeOfflineDummyDisplaysMask = $08;
    kIncludeHardwareMirroredDisplaysMask = $10;


                                                                {  modeListFlags for DMNewDisplayModeList  }
    kDMModeListIncludeAllModesMask = $01;                       {  Include all timing modes not _explicitly_ excluded (see other bits) }
    kDMModeListIncludeOfflineModesMask = $02;
    kDMModeListExcludeDriverModesMask = $04;                    {  Exclude old-style timing modes (cscGetNextResolution/kDisplayModeIDFindFirstResolution modes) }
    kDMModeListExcludeDisplayModesMask = $08;                   {  Exclude timing modes that come from the display (always arbritrary timing modes) }
    kDMModeListExcludeCustomModesMask = $10;                    {  Exclude custom modes that came neither from the driver or display (need a better name) }
    kDMModeListPreferStretchedModesMask = $20;                  {  Prefer modes that are stretched over modes that are letterboxed when setting kDisplayModeListNotPreferredBit }
    kDMModeListPreferSafeModesMask = $40;                       {  Prefer modes that are safe over modes that are not when setting kDisplayModeListNotPreferredBit }
    kDMModeListExcludeDriverScaledModesMask = $80;              {  Exclude modes that are scaled by the driver (usually on fixed resolution displays) }


    {  DMNewDisplayList displayListFlags }

type
    DisplayListEntryRecPtr = ^DisplayListEntryRec;
    DisplayListEntryRec = record
        displayListEntryGDevice: GDHandle;
        displayListEntryDisplayID: DisplayIDType;
        displayListEntryIncludeFlags: UInt32;                           {  Reason this entry was included }
        displayListEntryReserved1: UInt32;
        displayListEntryReserved2: UInt32;                              {  Zero }
        displayListEntryReserved3: UInt32;                              {  Zero }
        displayListEntryReserved4: UInt32;                              {  Zero }
        displayListEntryReserved5: UInt32;                              {  Zero }
    end;

    DisplayListEntryPtr                 = ^DisplayListEntryRec;
    DMProfileListEntryRecPtr = ^DMProfileListEntryRec;
    DMProfileListEntryRec = record
        profileRef:             CMProfileRef;
        profileReserved1:       Ptr;                                    {  Reserved }
        profileReserved2:       Ptr;                                    {  Reserved }
        profileReserved3:       Ptr;                                    {  Reserved }
    end;

    DMProfileListEntryPtr               = ^DMProfileListEntryRec;
    DMNotificationProcPtr = procedure(var theEvent: AppleEvent);

    DMExtendedNotificationProcPtr = procedure(userData: UnivPtr; theMessage: SInt16; notifyData: UnivPtr);

    DMComponentListIteratorProcPtr = procedure(userData: UnivPtr; itemIndex: DMListIndexType; componentInfo: DMComponentListEntryPtr);

    DMDisplayModeListIteratorProcPtr = procedure(userData: UnivPtr; itemIndex: DMListIndexType; displaymodeInfo: DMDisplayModeListEntryPtr);

    DMProfileListIteratorProcPtr = procedure(userData: UnivPtr; itemIndex: DMListIndexType; profileInfo: DMProfileListEntryPtr);

    DMDisplayListIteratorProcPtr = procedure(userData: UnivPtr; itemIndex: DMListIndexType; displaymodeInfo: DisplayListEntryPtr);

    DMNotificationUPP = ^SInt32; { an opaque UPP }
    DMExtendedNotificationUPP = ^SInt32; { an opaque UPP }
    DMComponentListIteratorUPP = ^SInt32; { an opaque UPP }
    DMDisplayModeListIteratorUPP = ^SInt32; { an opaque UPP }
    DMProfileListIteratorUPP = ^SInt32; { an opaque UPP }
    DMDisplayListIteratorUPP = ^SInt32; { an opaque UPP }

const
    uppDMNotificationProcInfo = $000000C0;
    uppDMExtendedNotificationProcInfo = $00000EC0;
    uppDMComponentListIteratorProcInfo = $00000FC0;
    uppDMDisplayModeListIteratorProcInfo = $00000FC0;
    uppDMProfileListIteratorProcInfo = $00000FC0;
    uppDMDisplayListIteratorProcInfo = $00000FC0;
    {
     *  NewDMNotificationUPP()
     *
     *  Availability:
     *    Non-Carbon CFM:   available as macro/inline
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function NewDMNotificationUPP(userRoutine: DMNotificationProcPtr): DMNotificationUPP; external name '_NewDMNotificationUPP'; { old name was NewDMNotificationProc }
{
 *  NewDMExtendedNotificationUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewDMExtendedNotificationUPP(userRoutine: DMExtendedNotificationProcPtr): DMExtendedNotificationUPP; external name '_NewDMExtendedNotificationUPP'; { old name was NewDMExtendedNotificationProc }
{
 *  NewDMComponentListIteratorUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewDMComponentListIteratorUPP(userRoutine: DMComponentListIteratorProcPtr): DMComponentListIteratorUPP; external name '_NewDMComponentListIteratorUPP'; { old name was NewDMComponentListIteratorProc }
{
 *  NewDMDisplayModeListIteratorUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewDMDisplayModeListIteratorUPP(userRoutine: DMDisplayModeListIteratorProcPtr): DMDisplayModeListIteratorUPP; external name '_NewDMDisplayModeListIteratorUPP'; { old name was NewDMDisplayModeListIteratorProc }
{
 *  NewDMProfileListIteratorUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewDMProfileListIteratorUPP(userRoutine: DMProfileListIteratorProcPtr): DMProfileListIteratorUPP; external name '_NewDMProfileListIteratorUPP'; { old name was NewDMProfileListIteratorProc }
{
 *  NewDMDisplayListIteratorUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewDMDisplayListIteratorUPP(userRoutine: DMDisplayListIteratorProcPtr): DMDisplayListIteratorUPP; external name '_NewDMDisplayListIteratorUPP'; { old name was NewDMDisplayListIteratorProc }
{
 *  DisposeDMNotificationUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeDMNotificationUPP(userUPP: DMNotificationUPP); external name '_DisposeDMNotificationUPP';
{
 *  DisposeDMExtendedNotificationUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeDMExtendedNotificationUPP(userUPP: DMExtendedNotificationUPP); external name '_DisposeDMExtendedNotificationUPP';
{
 *  DisposeDMComponentListIteratorUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeDMComponentListIteratorUPP(userUPP: DMComponentListIteratorUPP); external name '_DisposeDMComponentListIteratorUPP';
{
 *  DisposeDMDisplayModeListIteratorUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeDMDisplayModeListIteratorUPP(userUPP: DMDisplayModeListIteratorUPP); external name '_DisposeDMDisplayModeListIteratorUPP';
{
 *  DisposeDMProfileListIteratorUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeDMProfileListIteratorUPP(userUPP: DMProfileListIteratorUPP); external name '_DisposeDMProfileListIteratorUPP';
{
 *  DisposeDMDisplayListIteratorUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeDMDisplayListIteratorUPP(userUPP: DMDisplayListIteratorUPP); external name '_DisposeDMDisplayListIteratorUPP';
{
 *  InvokeDMNotificationUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvokeDMNotificationUPP(var theEvent: AppleEvent; userRoutine: DMNotificationUPP); external name '_InvokeDMNotificationUPP'; { old name was CallDMNotificationProc }
{
 *  InvokeDMExtendedNotificationUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvokeDMExtendedNotificationUPP(userData: UnivPtr; theMessage: SInt16; notifyData: UnivPtr; userRoutine: DMExtendedNotificationUPP); external name '_InvokeDMExtendedNotificationUPP'; { old name was CallDMExtendedNotificationProc }
{
 *  InvokeDMComponentListIteratorUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvokeDMComponentListIteratorUPP(userData: UnivPtr; itemIndex: DMListIndexType; componentInfo: DMComponentListEntryPtr; userRoutine: DMComponentListIteratorUPP); external name '_InvokeDMComponentListIteratorUPP'; { old name was CallDMComponentListIteratorProc }
{
 *  InvokeDMDisplayModeListIteratorUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvokeDMDisplayModeListIteratorUPP(userData: UnivPtr; itemIndex: DMListIndexType; displaymodeInfo: DMDisplayModeListEntryPtr; userRoutine: DMDisplayModeListIteratorUPP); external name '_InvokeDMDisplayModeListIteratorUPP'; { old name was CallDMDisplayModeListIteratorProc }
{
 *  InvokeDMProfileListIteratorUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvokeDMProfileListIteratorUPP(userData: UnivPtr; itemIndex: DMListIndexType; profileInfo: DMProfileListEntryPtr; userRoutine: DMProfileListIteratorUPP); external name '_InvokeDMProfileListIteratorUPP'; { old name was CallDMProfileListIteratorProc }
{
 *  InvokeDMDisplayListIteratorUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvokeDMDisplayListIteratorUPP(userData: UnivPtr; itemIndex: DMListIndexType; displaymodeInfo: DisplayListEntryPtr; userRoutine: DMDisplayListIteratorUPP); external name '_InvokeDMDisplayListIteratorUPP'; { old name was CallDMDisplayListIteratorProc }

{
 *  DMGetFirstScreenDevice()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DMGetFirstScreenDevice(activeOnly: boolean): GDHandle; external name '_DMGetFirstScreenDevice';
{
 *  DMGetNextScreenDevice()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DMGetNextScreenDevice(theDevice: GDHandle; activeOnly: boolean): GDHandle; external name '_DMGetNextScreenDevice';
{
 *  DMDrawDesktopRect()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DMDrawDesktopRect(var globalRect: Rect); external name '_DMDrawDesktopRect';
{
 *  DMDrawDesktopRegion()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DMDrawDesktopRegion(globalRgn: RgnHandle); external name '_DMDrawDesktopRegion';
{
 *  DMBeginConfigureDisplays()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DMBeginConfigureDisplays(var displayState: Handle): OSErr; external name '_DMBeginConfigureDisplays';
{
 *  DMEndConfigureDisplays()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DMEndConfigureDisplays(displayState: Handle): OSErr; external name '_DMEndConfigureDisplays';
{
 *  DMAddDisplay()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DMAddDisplay(newDevice: GDHandle; driver: SInt16; mode: UInt32; reserved: UInt32; displayID: UInt32; displayComponent: Component; displayState: Handle): OSErr; external name '_DMAddDisplay';
{
 *  DMMoveDisplay()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DMMoveDisplay(moveDevice: GDHandle; x: SInt16; y: SInt16; displayState: Handle): OSErr; external name '_DMMoveDisplay';
{
 *  DMDisableDisplay()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DMDisableDisplay(disableDevice: GDHandle; displayState: Handle): OSErr; external name '_DMDisableDisplay';
{
 *  DMEnableDisplay()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DMEnableDisplay(enableDevice: GDHandle; displayState: Handle): OSErr; external name '_DMEnableDisplay';
{
 *  DMRemoveDisplay()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DMRemoveDisplay(removeDevice: GDHandle; displayState: Handle): OSErr; external name '_DMRemoveDisplay';
{
 *  DMSetMainDisplay()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DMSetMainDisplay(newMainDevice: GDHandle; displayState: Handle): OSErr; external name '_DMSetMainDisplay';
{
 *  DMSetDisplayMode()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DMSetDisplayMode(theDevice: GDHandle; mode: UInt32; var depthMode: UInt32; reserved: UInt32; displayState: Handle): OSErr; external name '_DMSetDisplayMode';
{
 *  DMCheckDisplayMode()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DMCheckDisplayMode(theDevice: GDHandle; mode: UInt32; depthMode: UInt32; var switchFlags: UInt32; reserved: UInt32; var modeOk: boolean): OSErr; external name '_DMCheckDisplayMode';
{
 *  DMGetDeskRegion()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DMGetDeskRegion(var desktopRegion: RgnHandle): OSErr; external name '_DMGetDeskRegion';
{
 *  DMRegisterNotifyProc()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DMRegisterNotifyProc(notificationProc: DMNotificationUPP; whichPSN: DMProcessInfoPtr): OSErr; external name '_DMRegisterNotifyProc';
{
 *  DMRemoveNotifyProc()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DMRemoveNotifyProc(notificationProc: DMNotificationUPP; whichPSN: DMProcessInfoPtr): OSErr; external name '_DMRemoveNotifyProc';
{
 *  DMQDIsMirroringCapable()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DMQDIsMirroringCapable(var qdIsMirroringCapable: boolean): OSErr; external name '_DMQDIsMirroringCapable';
{
 *  DMCanMirrorNow()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DMCanMirrorNow(var canMirrorNow: boolean): OSErr; external name '_DMCanMirrorNow';
{
 *  DMIsMirroringOn()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DMIsMirroringOn(var isMirroringOn: boolean): OSErr; external name '_DMIsMirroringOn';
{
 *  DMMirrorDevices()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DMMirrorDevices(gD1: GDHandle; gD2: GDHandle; displayState: Handle): OSErr; external name '_DMMirrorDevices';
{
 *  DMUnmirrorDevice()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DMUnmirrorDevice(gDevice: GDHandle; displayState: Handle): OSErr; external name '_DMUnmirrorDevice';
{
 *  DMGetNextMirroredDevice()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DMGetNextMirroredDevice(gDevice: GDHandle; var mirroredDevice: GDHandle): OSErr; external name '_DMGetNextMirroredDevice';
{
 *  DMBlockMirroring()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DMBlockMirroring: OSErr; external name '_DMBlockMirroring';
{
 *  DMUnblockMirroring()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DMUnblockMirroring: OSErr; external name '_DMUnblockMirroring';

{
 *  DMGetDisplayIDByGDevice()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DMGetDisplayIDByGDevice(displayDevice: GDHandle; var displayID: DisplayIDType; failToMain: boolean): OSErr; external name '_DMGetDisplayIDByGDevice';
{
 *  DMGetGDeviceByDisplayID()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DMGetGDeviceByDisplayID(displayID: DisplayIDType; var displayDevice: GDHandle; failToMain: boolean): OSErr; external name '_DMGetGDeviceByDisplayID';
{
 *  DMSetDisplayComponent()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DMSetDisplayComponent(theDevice: GDHandle; displayComponent: Component): OSErr; external name '_DMSetDisplayComponent';
{
 *  DMGetDisplayComponent()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DMGetDisplayComponent(theDevice: GDHandle; var displayComponent: Component): OSErr; external name '_DMGetDisplayComponent';
{
 *  DMNewDisplay()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DMNewDisplay(var newDevice: GDHandle; driverRefNum: SInt16; mode: UInt32; reserved: UInt32; displayID: DisplayIDType; displayComponent: Component; displayState: Handle): OSErr; external name '_DMNewDisplay';
{
 *  DMDisposeDisplay()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DMDisposeDisplay(disposeDevice: GDHandle; displayState: Handle): OSErr; external name '_DMDisposeDisplay';
{
 *  DMResolveDisplayComponents()
 *
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DMResolveDisplayComponents: OSErr; external name '_DMResolveDisplayComponents';
{
 *  DMRegisterExtendedNotifyProc()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DisplayLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DMRegisterExtendedNotifyProc(notifyProc: DMExtendedNotificationUPP; notifyUserData: UnivPtr; nofifyOnFlags: UInt16; whichPSN: DMProcessInfoPtr): OSErr; external name '_DMRegisterExtendedNotifyProc';
{
 *  DMRemoveExtendedNotifyProc()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DisplayLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DMRemoveExtendedNotifyProc(notifyProc: DMExtendedNotificationUPP; notifyUserData: UnivPtr; whichPSN: DMProcessInfoPtr; removeFlags: UInt16): OSErr; external name '_DMRemoveExtendedNotifyProc';
{
 *  DMNewAVPanelList()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DisplayLib68k 2.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DMNewAVPanelList(displayID: DisplayIDType; panelType: ResType; minimumFidelity: DMFidelityType; panelListFlags: UInt32; reserved: UInt32; var thePanelCount: DMListIndexType; var thePanelList: DMListType): OSErr; external name '_DMNewAVPanelList';
{
 *  DMNewAVEngineList()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DisplayLib68k 2.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DMNewAVEngineList(displayID: DisplayIDType; engineType: ResType; minimumFidelity: DMFidelityType; engineListFlags: UInt32; reserved: UInt32; var engineCount: DMListIndexType; var engineList: DMListType): OSErr; external name '_DMNewAVEngineList';
{
 *  DMNewAVDeviceList()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DisplayLib68k 2.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DMNewAVDeviceList(deviceType: ResType; deviceListFlags: UInt32; reserved: UInt32; var deviceCount: DMListIndexType; var deviceList: DMListType): OSErr; external name '_DMNewAVDeviceList';
{
 *  DMNewAVPortListByPortType()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DisplayLib68k 2.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DMNewAVPortListByPortType(subType: ResType; portListFlags: UInt32; reserved: UInt32; var devicePortCount: DMListIndexType; var theDevicePortList: DMListType): OSErr; external name '_DMNewAVPortListByPortType';
{
 *  DMGetIndexedComponentFromList()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DisplayLib68k 2.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DMGetIndexedComponentFromList(panelList: DMListType; itemIndex: DMListIndexType; reserved: UInt32; listIterator: DMComponentListIteratorUPP; userData: UnivPtr): OSErr; external name '_DMGetIndexedComponentFromList';
{
 *  DMDisposeList()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DisplayLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DMDisposeList(panelList: DMListType): OSErr; external name '_DMDisposeList';
{
 *  DMGetNameByAVID()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DisplayLib68k 2.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DMGetNameByAVID(theID: AVIDType; nameFlags: UInt32; var name: Str255): OSErr; external name '_DMGetNameByAVID';
{
 *  DMNewAVIDByPortComponent()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DisplayLib68k 2.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DMNewAVIDByPortComponent(thePortComponent: Component; portKind: ResType; reserved: UInt32; var newID: AVIDType): OSErr; external name '_DMNewAVIDByPortComponent';
{
 *  DMGetPortComponentByAVID()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DisplayLib68k 2.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DMGetPortComponentByAVID(thePortID: DisplayIDType; var thePortComponent: Component; var theDesciption: ComponentDescription; var thePortKind: ResType): OSErr; external name '_DMGetPortComponentByAVID';
{
 *  DMSendDependentNotification()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DisplayLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DMSendDependentNotification(notifyType: ResType; notifyClass: ResType; displayID: AVIDType; notifyComponent: ComponentInstance): OSErr; external name '_DMSendDependentNotification';
{
 *  DMDisposeAVComponent()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DisplayLib68k 2.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DMDisposeAVComponent(theAVComponent: Component): OSErr; external name '_DMDisposeAVComponent';
{
 *  DMSaveScreenPrefs()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DisplayLib68k 2.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DMSaveScreenPrefs(reserved1: UInt32; saveFlags: UInt32; reserved2: UInt32): OSErr; external name '_DMSaveScreenPrefs';
{
 *  DMNewAVIDByDeviceComponent()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DisplayLib68k 2.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DMNewAVIDByDeviceComponent(theDeviceComponent: Component; portKind: ResType; reserved: UInt32; var newID: DisplayIDType): OSErr; external name '_DMNewAVIDByDeviceComponent';
{
 *  DMNewAVPortListByDeviceAVID()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DisplayLib68k 2.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DMNewAVPortListByDeviceAVID(theID: AVIDType; minimumFidelity: DMFidelityType; portListFlags: UInt32; reserved: UInt32; var devicePortCount: DMListIndexType; var theDevicePortList: DMListType): OSErr; external name '_DMNewAVPortListByDeviceAVID';
{
 *  DMGetDeviceComponentByAVID()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DisplayLib68k 2.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DMGetDeviceComponentByAVID(theDeviceID: AVIDType; var theDeviceComponent: Component; var theDesciption: ComponentDescription; var theDeviceKind: ResType): OSErr; external name '_DMGetDeviceComponentByAVID';
{
 *  DMNewDisplayModeList()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DisplayLib68k 2.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DMNewDisplayModeList(displayID: DisplayIDType; modeListFlags: UInt32; reserved: UInt32; var thePanelCount: DMListIndexType; var thePanelList: DMListType): OSErr; external name '_DMNewDisplayModeList';
{
 *  DMGetIndexedDisplayModeFromList()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DisplayLib68k 2.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DMGetIndexedDisplayModeFromList(panelList: DMListType; itemIndex: DMListIndexType; reserved: UInt32; listIterator: DMDisplayModeListIteratorUPP; userData: UnivPtr): OSErr; external name '_DMGetIndexedDisplayModeFromList';
{
 *  DMGetGraphicInfoByAVID()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DisplayLib68k 2.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DMGetGraphicInfoByAVID(theID: AVIDType; var theAVPcit: PicHandle; var theAVIconSuite: Handle; var theAVLocation: AVLocationRec): OSErr; external name '_DMGetGraphicInfoByAVID';
{
 *  DMGetAVPowerState()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DisplayLib68k 2.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DMGetAVPowerState(theID: AVIDType; getPowerState: AVPowerStatePtr; reserved1: UInt32): OSErr; external name '_DMGetAVPowerState';
{
 *  DMSetAVPowerState()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DisplayLib68k 2.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DMSetAVPowerState(theID: AVIDType; setPowerState: AVPowerStatePtr; powerFlags: UInt32; displayState: Handle): OSErr; external name '_DMSetAVPowerState';
{
 *  DMGetDeviceAVIDByPortAVID()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DisplayLib68k 2.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DMGetDeviceAVIDByPortAVID(portAVID: AVIDType; var deviceAVID: AVIDType): OSErr; external name '_DMGetDeviceAVIDByPortAVID';
{
 *  DMGetEnableByAVID()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DisplayLib68k 2.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DMGetEnableByAVID(theAVID: AVIDType; var isAVIDEnabledNow: boolean; var canChangeEnableNow: boolean): OSErr; external name '_DMGetEnableByAVID';
{
 *  DMSetEnableByAVID()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DisplayLib68k 2.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DMSetEnableByAVID(theAVID: AVIDType; doEnable: boolean; displayState: Handle): OSErr; external name '_DMSetEnableByAVID';
{
 *  DMGetDisplayMode()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DisplayLib68k 2.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DMGetDisplayMode(theDevice: GDHandle; switchInfo: VDSwitchInfoPtr): OSErr; external name '_DMGetDisplayMode';
{
 *  DMConfirmConfiguration()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DisplayLib 2.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function DMConfirmConfiguration(filterProc: DMModalFilterUPP; confirmFlags: UInt32; reserved: UInt32; displayState: Handle): OSErr; external name '_DMConfirmConfiguration';
{$ALIGN MAC68K}
{#POP}
{unit DrawSprocket}
{$ALIGN MAC68K}








{#PUSH}
{$ALIGN POWER}
{#LibExport+}

{
********************************************************************************
** constants
********************************************************************************
}

type
    DSpDepthMask                = SInt32;
const
    kDSpDepthMask_1             = $01;
    kDSpDepthMask_2             = $02;
    kDSpDepthMask_4             = $04;
    kDSpDepthMask_8             = $08;
    kDSpDepthMask_16            = $10;
    kDSpDepthMask_32            = $20;
    kDSpDepthMask_All           = -1;


type
    DSpColorNeeds               = SInt32;
const
    kDSpColorNeeds_DontCare     = 0;
    kDSpColorNeeds_Request      = 1;
    kDSpColorNeeds_Require      = 2;


type
    DSpContextState             = SInt32;
const
    kDSpContextState_Active     = 0;
    kDSpContextState_Paused     = 1;
    kDSpContextState_Inactive   = 2;

    {    kDSpContextOption_QD3DAccel not yet implemented    }

type
    DSpContextOption            = SInt32;
const
                                                                {     kDSpContextOption_QD3DAccel       = 1<<0, }
    kDSpContextOption_PageFlip  = $02;
    kDSpContextOption_DontSyncVBL = $04;
    kDSpContextOption_Stereoscopic = $08;


type
    DSpAltBufferOption          = SInt32;
const
    kDSpAltBufferOption_RowBytesEqualsWidth = $01;


type
    DSpBufferKind               = SInt32;
const
    kDSpBufferKind_Normal       = 0;


type
    DSpBlitMode                 = SInt32;
const
    kDSpBlitMode_Plain          = 0;
    kDSpBlitMode_SrcKey         = $01;
    kDSpBlitMode_DstKey         = $02;
    kDSpBlitMode_Interpolation  = $04;

    {
    ********************************************************************************
    ** data types
    ********************************************************************************
        }

type
    DSpAltBufferReference    = ^SInt32; { an opaque 32-bit type }
    DSpAltBufferReferencePtr = ^DSpAltBufferReference;  { when a var xx:DSpAltBufferReference parameter can be nil, it is changed to xx: DSpAltBufferReferencePtr }
    DSpContextReference    = ^SInt32; { an opaque 32-bit type }
    DSpContextReferencePtr = ^DSpContextReference;  { when a var xx:DSpContextReference parameter can be nil, it is changed to xx: DSpContextReferencePtr }
    DSpContextReferenceConst    = ^SInt32; { an opaque 32-bit type }
    DSpContextReferenceConstPtr = ^DSpContextReferenceConst;  { when a var xx:DSpContextReferenceConst parameter can be nil, it is changed to xx: DSpContextReferenceConstPtr }
    DSpEventProcPtr = function(var inEvent: EventRecord): boolean;

    DSpCallbackProcPtr = function(inContext: DSpContextReference; inRefCon: UnivPtr): boolean;

    DSpEventUPP = ^SInt32; { an opaque UPP }
    DSpCallbackUPP = ^SInt32; { an opaque UPP }

const
    uppDSpEventProcInfo = $000000D1;
    uppDSpCallbackProcInfo = $000003D1;


type
    DSpContextAttributesPtr = ^DSpContextAttributes;
    DSpContextAttributes = record
        frequency:              Fixed;
        displayWidth:           UInt32;
        displayHeight:          UInt32;
        reserved1:              UInt32;
        reserved2:              UInt32;
        colorNeeds:             UInt32;
        colorTable:             CTabHandle;
        contextOptions:         OptionBits;
        backBufferDepthMask:    OptionBits;
        displayDepthMask:       OptionBits;
        backBufferBestDepth:    UInt32;
        displayBestDepth:       UInt32;
        pageCount:              UInt32;
        filler:                 packed array [0..2] of char;
        gameMustConfirmSwitch:  boolean;
        reserved3:              array [0..3] of UInt32;
    end;

    DSpAltBufferAttributesPtr = ^DSpAltBufferAttributes;
    DSpAltBufferAttributes = record
        width:                  UInt32;
        height:                 UInt32;
        options:                DSpAltBufferOption;
        reserved:               array [0..3] of UInt32;
    end;

    DSpBlitInfoPtr = ^DSpBlitInfo;
    DSpBlitDoneProc = procedure(info: DSpBlitInfoPtr);

    DSpBlitInfo = record
        completionFlag:         boolean;
        filler:                 packed array [0..2] of char;
        completionProc:         DSpBlitDoneProc;
        srcContext:             DSpContextReference;
        srcBuffer:              CGrafPtr;
        srcRect:                Rect;
        srcKey:                 UInt32;
        dstContext:             DSpContextReference;
        dstBuffer:              CGrafPtr;
        dstRect:                Rect;
        dstKey:                 UInt32;
        mode:                   DSpBlitMode;
        reserved:               array [0..3] of UInt32;
    end;

    {
    ********************************************************************************
    ** function prototypes
    ********************************************************************************
        }

    {
    ** global operations
        }
    {
     *  DSpStartup()
     *
     *  Availability:
     *    Non-Carbon CFM:   in DrawSprocketLib 1.0 and later
     *    CarbonLib:        not available
     *    Mac OS X:         in version 10.0 and later
        }
function DSpStartup: OSStatus; external name '_DSpStartup';

{
 *  DSpShutdown()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DrawSprocketLib 1.0 and later
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function DSpShutdown: OSStatus; external name '_DSpShutdown';

{
 *  DSpGetVersion()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DrawSprocketLib 1.7 and later
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function DSpGetVersion: NumVersion; external name '_DSpGetVersion';

{
 *  DSpGetFirstContext()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DrawSprocketLib 1.0 and later
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function DSpGetFirstContext(inDisplayID: DisplayIDType; var outContext: DSpContextReference): OSStatus; external name '_DSpGetFirstContext';

{
 *  DSpGetNextContext()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DrawSprocketLib 1.0 and later
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function DSpGetNextContext(inCurrentContext: DSpContextReference; var outContext: DSpContextReference): OSStatus; external name '_DSpGetNextContext';

{
 *  DSpGetCurrentContext()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DrawSprocketLib 1.7 and later
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function DSpGetCurrentContext(inDisplayID: DisplayIDType; var outContext: DSpContextReference): OSStatus; external name '_DSpGetCurrentContext';

{
 *  DSpFindBestContext()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DrawSprocketLib 1.0 and later
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function DSpFindBestContext(inDesiredAttributes: DSpContextAttributesPtr; var outContext: DSpContextReference): OSStatus; external name '_DSpFindBestContext';

{
 *  DSpFindBestContextOnDisplayID()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DrawSprocketLib 1.7 and later
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function DSpFindBestContextOnDisplayID(inDesiredAttributes: DSpContextAttributesPtr; var outContext: DSpContextReference; inDisplayID: DisplayIDType): OSStatus; external name '_DSpFindBestContextOnDisplayID';


{
 *  DSpProcessEvent()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DrawSprocketLib 1.0 and later
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function DSpProcessEvent(var inEvent: EventRecord; var outEventWasProcessed: boolean): OSStatus; external name '_DSpProcessEvent';

{
 *  DSpSetBlankingColor()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DrawSprocketLib 1.0 and later
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function DSpSetBlankingColor(const (*var*) inRGBColor: RGBColor): OSStatus; external name '_DSpSetBlankingColor';

{
 *  DSpSetDebugMode()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DrawSprocketLib 1.0 and later
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function DSpSetDebugMode(inDebugMode: boolean): OSStatus; external name '_DSpSetDebugMode';

{
 *  DSpFindContextFromPoint()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DrawSprocketLib 1.0 and later
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function DSpFindContextFromPoint(inGlobalPoint: Point; var outContext: DSpContextReference): OSStatus; external name '_DSpFindContextFromPoint';

{
 *  DSpGetMouse()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DrawSprocketLib 1.0 and later
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function DSpGetMouse(var outGlobalPoint: Point): OSStatus; external name '_DSpGetMouse';

{
** alternate buffer operations
}

{
 *  DSpContext_GetAttributes()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DrawSprocketLib 1.0 and later
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function DSpContext_GetAttributes(inContext: DSpContextReferenceConst; outAttributes: DSpContextAttributesPtr): OSStatus; external name '_DSpContext_GetAttributes';

{
 *  DSpContext_Reserve()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DrawSprocketLib 1.0 and later
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function DSpContext_Reserve(inContext: DSpContextReference; inDesiredAttributes: DSpContextAttributesPtr): OSStatus; external name '_DSpContext_Reserve';

{
 *  DSpContext_Queue()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DrawSprocketLib 1.7 and later
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function DSpContext_Queue(inParentContext: DSpContextReference; inChildContext: DSpContextReference; inDesiredAttributes: DSpContextAttributesPtr): OSStatus; external name '_DSpContext_Queue';

{
 *  DSpContext_Switch()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DrawSprocketLib 1.7 and later
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function DSpContext_Switch(inOldContext: DSpContextReference; inNewContext: DSpContextReference): OSStatus; external name '_DSpContext_Switch';

{
 *  DSpContext_Release()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DrawSprocketLib 1.0 and later
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function DSpContext_Release(inContext: DSpContextReference): OSStatus; external name '_DSpContext_Release';

{
 *  DSpContext_Dispose()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function DSpContext_Dispose(inContext: DSpContextReference): OSStatus; external name '_DSpContext_Dispose';

{
 *  DSpContext_GetDisplayID()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DrawSprocketLib 1.0 and later
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function DSpContext_GetDisplayID(inContext: DSpContextReferenceConst; var outDisplayID: DisplayIDType): OSStatus; external name '_DSpContext_GetDisplayID';

{
 *  DSpContext_GlobalToLocal()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DrawSprocketLib 1.0 and later
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function DSpContext_GlobalToLocal(inContext: DSpContextReferenceConst; var ioPoint: Point): OSStatus; external name '_DSpContext_GlobalToLocal';

{
 *  DSpContext_LocalToGlobal()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DrawSprocketLib 1.0 and later
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function DSpContext_LocalToGlobal(inContext: DSpContextReferenceConst; var ioPoint: Point): OSStatus; external name '_DSpContext_LocalToGlobal';


{
 *  DSpContext_GetMonitorFrequency()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DrawSprocketLib 1.0 and later
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function DSpContext_GetMonitorFrequency(inContext: DSpContextReferenceConst; var outFrequency: Fixed): OSStatus; external name '_DSpContext_GetMonitorFrequency';


{
 *  DSpContext_SetState()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DrawSprocketLib 1.0 and later
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function DSpContext_SetState(inContext: DSpContextReference; inState: DSpContextState): OSStatus; external name '_DSpContext_SetState';

{
 *  DSpContext_GetState()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DrawSprocketLib 1.0 and later
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function DSpContext_GetState(inContext: DSpContextReferenceConst; var outState: DSpContextState): OSStatus; external name '_DSpContext_GetState';

{
 *  DSpContext_IsBusy()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DrawSprocketLib 1.0 and later
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function DSpContext_IsBusy(inContext: DSpContextReferenceConst; var outBusyFlag: boolean): OSStatus; external name '_DSpContext_IsBusy';

{ dirty rectangles }

{
 *  DSpContext_FadeGammaOut()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DrawSprocketLib 1.0 and later
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function DSpContext_FadeGammaOut(inContext: DSpContextReference; var inZeroIntensityColor: RGBColor): OSStatus; external name '_DSpContext_FadeGammaOut';

{
 *  DSpContext_FadeGammaIn()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DrawSprocketLib 1.0 and later
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function DSpContext_FadeGammaIn(inContext: DSpContextReference; var inZeroIntensityColor: RGBColor): OSStatus; external name '_DSpContext_FadeGammaIn';

{
 *  DSpContext_FadeGamma()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DrawSprocketLib 1.0 and later
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function DSpContext_FadeGamma(inContext: DSpContextReference; inPercentOfOriginalIntensity: SInt32; var inZeroIntensityColor: RGBColor): OSStatus; external name '_DSpContext_FadeGamma';

{ buffering }
{
 *  DSpContext_SwapBuffers()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DrawSprocketLib 1.0 and later
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function DSpContext_SwapBuffers(inContext: DSpContextReference; inBusyProc: DSpCallbackUPP; inUserRefCon: UnivPtr): OSStatus; external name '_DSpContext_SwapBuffers';

{
 *  DSpContext_GetBackBuffer()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DrawSprocketLib 1.0 and later
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function DSpContext_GetBackBuffer(inContext: DSpContextReference; inBufferKind: DSpBufferKind; var outBackBuffer: CGrafPtr): OSStatus; external name '_DSpContext_GetBackBuffer';

{
 *  DSpContext_GetFrontBuffer()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DrawSprocketLib 1.1 and later
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function DSpContext_GetFrontBuffer(inContext: DSpContextReferenceConst; var outFrontBuffer: CGrafPtr): OSStatus; external name '_DSpContext_GetFrontBuffer';

{ clut operations }
{
 *  DSpContext_SetCLUTEntries()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DrawSprocketLib 1.0 and later
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function DSpContext_SetCLUTEntries(inContext: DSpContextReference; const (*var*) inEntries: ColorSpec; inStartingEntry: UInt16; inLastEntry: UInt16): OSStatus; external name '_DSpContext_SetCLUTEntries';

{
 *  DSpContext_GetCLUTEntries()
 *
 *  Availability:
 *    Non-Carbon CFM:   in DrawSprocketLib 1.0 and later
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 }
function DSpContext_GetCLUTEntries(inContext: DSpContextReferenceConst; var outEntries: ColorSpec; inStartingEntry: UInt16; inLastEntry: UInt16): OSStatus; external name '_DSpContext_GetCLUTEntries';

{ blit operations }

{$ALIGN MAC68K}
{#POP}
{unit IBCarbonRuntime}
{$ALIGN MAC68K}








{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}


const
    kIBCarbonRuntimeCantFindNibFile = -10960;
    kIBCarbonRuntimeObjectNotOfRequestedType = -10961;
    kIBCarbonRuntimeCantFindObject = -10962;

    {    ----- typedef ------   }

type
    IBNibRef    = ^SInt32; { an opaque 32-bit type }
    IBNibRefPtr = ^IBNibRef;  { when a var xx:IBNibRef parameter can be nil, it is changed to xx: IBNibRefPtr }
    {    ----- Create & Dispose NIB References ------   }
    {
     *  CreateNibReference()
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.1 and later
     *    Mac OS X:         in version 10.0 and later
        }
function CreateNibReference(inNibName: CFStringRef; var outNibRef: IBNibRef): OSStatus; external name '_CreateNibReference';

{
 *  CreateNibReferenceWithCFBundle()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CreateNibReferenceWithCFBundle(inBundle: CFBundleRef; inNibName: CFStringRef; var outNibRef: IBNibRef): OSStatus; external name '_CreateNibReferenceWithCFBundle';

{
 *  DisposeNibReference()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeNibReference(inNibRef: IBNibRef); external name '_DisposeNibReference';

{ ----- Window ------ }
{
 *  CreateWindowFromNib()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CreateWindowFromNib(inNibRef: IBNibRef; inName: CFStringRef; var outWindow: WindowRef): OSStatus; external name '_CreateWindowFromNib';

{  ----- Menu ----- }

{
 *  CreateMenuFromNib()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CreateMenuFromNib(inNibRef: IBNibRef; inName: CFStringRef; var outMenuRef: MenuRef): OSStatus; external name '_CreateMenuFromNib';

{  ----- MenuBar ------ }

{
 *  CreateMenuBarFromNib()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function CreateMenuBarFromNib(inNibRef: IBNibRef; inName: CFStringRef; var outMenuBar: Handle): OSStatus; external name '_CreateMenuBarFromNib';

{
 *  SetMenuBarFromNib()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function SetMenuBarFromNib(inNibRef: IBNibRef; inName: CFStringRef): OSStatus; external name '_SetMenuBarFromNib';

{$ALIGN MAC68K}
{#POP}
{unit Movies}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}


{  "kFix1" is defined in FixMath as "fixed1"  }
{ error codes are in Errors.[haa] }
{ gestalt codes are in Gestalt.[hpa] }

const
    MovieFileType               = $4D6F6F56 (* 'MooV' *);
    MovieScrapType              = $6D6F6F76 (* 'moov' *);

    MovieResourceType           = $6D6F6F76 (* 'moov' *);
    MovieForwardPointerResourceType = $666F7265 (* 'fore' *);
    MovieBackwardPointerResourceType = $6261636B (* 'back' *);

    MovieResourceAtomType       = $6D6F6F76 (* 'moov' *);
    MovieDataAtomType           = $6D646174 (* 'mdat' *);
    FreeAtomType                = $66726565 (* 'free' *);
    SkipAtomType                = $736B6970 (* 'skip' *);
    WideAtomPlaceholderType     = $77696465 (* 'wide' *);

    MediaHandlerType            = $6D686C72 (* 'mhlr' *);
    DataHandlerType             = $64686C72 (* 'dhlr' *);

    VideoMediaType              = $76696465 (* 'vide' *);
    SoundMediaType              = $736F756E (* 'soun' *);
    TextMediaType               = $74657874 (* 'text' *);
    BaseMediaType               = $676E7263 (* 'gnrc' *);
    MPEGMediaType               = $4D504547 (* 'MPEG' *);
    MusicMediaType              = $6D757369 (* 'musi' *);
    TimeCodeMediaType           = $746D6364 (* 'tmcd' *);
    SpriteMediaType             = $73707274 (* 'sprt' *);
    FlashMediaType              = $666C7368 (* 'flsh' *);
    MovieMediaType              = $6D6F6F76 (* 'moov' *);
    TweenMediaType              = $7477656E (* 'twen' *);
    ThreeDeeMediaType           = $71643364 (* 'qd3d' *);
    SkinMediaType               = $736B696E (* 'skin' *);
    HandleDataHandlerSubType    = $686E646C (* 'hndl' *);
    PointerDataHandlerSubType   = $70747220 (* 'ptr ' *);
    NullDataHandlerSubType      = $6E756C6C (* 'null' *);
    ResourceDataHandlerSubType  = $72737263 (* 'rsrc' *);
    URLDataHandlerSubType       = $75726C20 (* 'url ' *);
    WiredActionHandlerType      = $77697265 (* 'wire' *);

    VisualMediaCharacteristic   = $65796573 (* 'eyes' *);
    AudioMediaCharacteristic    = $65617273 (* 'ears' *);
    kCharacteristicCanSendVideo = $76736E64 (* 'vsnd' *);
    kCharacteristicProvidesActions = $6163746E (* 'actn' *);
    kCharacteristicNonLinear    = $6E6F6E6C (* 'nonl' *);
    kCharacteristicCanStep      = $73746570 (* 'step' *);
    kCharacteristicHasNoDuration = $6E6F7469 (* 'noti' *);
    kCharacteristicHasSkinData  = $736B696E (* 'skin' *);
    kCharacteristicProvidesKeyFocus = $6B657966 (* 'keyf' *);

    kUserDataMovieControllerType = $63747970 (* 'ctyp' *);
    kUserDataName               = $6E616D65 (* 'name' *);
    kUserDataTextAlbum          = $A9616C62 (* '©alb' *);
    kUserDataTextArtist         = $A9415254 (* '©ART' *);
    kUserDataTextAuthor         = $A9617574 (* '©aut' *);
    kUserDataTextChapter        = $A9636870 (* '©chp' *);
    kUserDataTextComment        = $A9636D74 (* '©cmt' *);
    kUserDataTextComposer       = $A9636F6D (* '©com' *);
    kUserDataTextCopyright      = $A9637079 (* '©cpy' *);
    kUserDataTextCreationDate   = $A9646179 (* '©day' *);
    kUserDataTextDescription    = $A9646573 (* '©des' *);
    kUserDataTextDirector       = $A9646972 (* '©dir' *);
    kUserDataTextDisclaimer     = $A9646973 (* '©dis' *);
    kUserDataTextEncodedBy      = $A9656E63 (* '©enc' *);
    kUserDataTextFullName       = $A96E616D (* '©nam' *);
    kUserDataTextGenre          = $A967656E (* '©gen' *);
    kUserDataTextHostComputer   = $A9687374 (* '©hst' *);
    kUserDataTextInformation    = $A9696E66 (* '©inf' *);
    kUserDataTextKeywords       = $A96B6579 (* '©key' *);
    kUserDataTextMake           = $A96D616B (* '©mak' *);
    kUserDataTextModel          = $A96D6F64 (* '©mod' *);
    kUserDataTextOriginalArtist = $A96F7065 (* '©ope' *);
    kUserDataTextOriginalFormat = $A9666D74 (* '©fmt' *);
    kUserDataTextOriginalSource = $A9737263 (* '©src' *);
    kUserDataTextPerformers     = $A9707266 (* '©prf' *);
    kUserDataTextProducer       = $A9707264 (* '©prd' *);
    kUserDataTextProduct        = $A9505244 (* '©PRD' *);
    kUserDataTextSoftware       = $A9737772 (* '©swr' *);
    kUserDataTextSpecialPlaybackRequirements = $A9726571 (* '©req' *);
    kUserDataTextTrack          = $A974726B (* '©trk' *);
    kUserDataTextWarning        = $A977726E (* '©wrn' *);
    kUserDataTextWriter         = $A9777274 (* '©wrt' *);
    kUserDataTextURLLink        = $A975726C (* '©url' *);
    kUserDataTextEditDate1      = $A9656431 (* '©ed1' *);

    kUserDataUnicodeBit         = $00000080;

    DoTheRightThing             = 0;



type
    MovieRecordPtr = ^MovieRecord;
    MovieRecord = record
        data:                   array [0..0] of SInt32;
    end;

    Movie                               = ^MovieRecord;
    MoviePtr                            = ^Movie;
    TrackRecordPtr = ^TrackRecord;
    TrackRecord = record
        data:                   array [0..0] of SInt32;
    end;

    Track                               = ^TrackRecord;
    MediaRecordPtr = ^MediaRecord;
    MediaRecord = record
        data:                   array [0..0] of SInt32;
    end;

    Media                               = ^MediaRecord;
    UserDataRecordPtr = ^UserDataRecord;
    UserDataRecord = record
        data:                   array [0..0] of SInt32;
    end;

    UserData                            = ^UserDataRecord;
    TrackEditStateRecordPtr = ^TrackEditStateRecord;
    TrackEditStateRecord = record
        data:                   array [0..0] of SInt32;
    end;

    TrackEditState                      = ^TrackEditStateRecord;
    MovieEditStateRecordPtr = ^MovieEditStateRecord;
    MovieEditStateRecord = record
        data:                   array [0..0] of SInt32;
    end;

    MovieEditState                      = ^MovieEditStateRecord;
    QTRestrictionSetRecordPtr = ^QTRestrictionSetRecord;
    QTRestrictionSetRecord = record
        data:                   array [0..0] of SInt32;
    end;

    QTRestrictionSet                    = ^QTRestrictionSetRecord;
    SpriteWorldRecordPtr = ^SpriteWorldRecord;
    SpriteWorldRecord = record
        data:                   array [0..0] of SInt32;
    end;

    SpriteWorld                         = ^SpriteWorldRecord;
    SpriteRecordPtr = ^SpriteRecord;
    SpriteRecord = record
        data:                   array [0..0] of SInt32;
    end;

    Sprite                              = ^SpriteRecord;
    QTTweenerRecordPtr = ^QTTweenerRecord;
    QTTweenerRecord = record
        data:                   array [0..0] of SInt32;
    end;

    QTTweener                           = ^QTTweenerRecord;
    SampleDescriptionPtr = ^SampleDescription;
    SampleDescription = record
        descSize:               SInt32;
        dataFormat:             SInt32;
        resvd1:                 SInt32;
        resvd2:                 SInt16;
        dataRefIndex:           SInt16;
    end;

    SampleDescriptionHandle             = ^SampleDescriptionPtr;
    QTBandwidthReference    = ^SInt32; { an opaque 32-bit type }
    QTBandwidthReferencePtr = ^QTBandwidthReference;  { when a var xx:QTBandwidthReference parameter can be nil, it is changed to xx: QTBandwidthReferencePtr }
    QTScheduledBandwidthReference    = ^SInt32; { an opaque 32-bit type }
    QTScheduledBandwidthReferencePtr = ^QTScheduledBandwidthReference;  { when a var xx:QTScheduledBandwidthReference parameter can be nil, it is changed to xx: QTScheduledBandwidthReferencePtr }

const
    kQTNetworkStatusNoNetwork   = -2;
    kQTNetworkStatusUncertain   = -1;
    kQTNetworkStatusNotConnected = 0;
    kQTNetworkStatusConnected   = 1;


type
    QTAtomContainer                     = Handle;
    QTAtom                              = SInt32;
    QTAtomType                          = SInt32;
    QTAtomID                            = SInt32;
    {  QTFloatDouble is the 64-bit IEEE-754 standard }
    QTFloatDouble                       = Float64;
    {  QTFloatSingle is the 32-bit IEEE-754 standard }
    QTFloatSingle                       = Float32;


    SoundDescriptionPtr = ^SoundDescription;
    SoundDescription = record
        descSize:               SInt32;                             {  total size of SoundDescription including extra data  }
        dataFormat:             SInt32;                             {  sound format  }
        resvd1:                 SInt32;                             {  reserved for apple use. set to zero  }
        resvd2:                 SInt16;                             {  reserved for apple use. set to zero  }
        dataRefIndex:           SInt16;
        version:                SInt16;                             {  which version is this data  }
        revlevel:               SInt16;                             {  what version of that codec did this  }
        vendor:                 SInt32;                             {  whose  codec compressed this data  }
        numChannels:            SInt16;                             {  number of channels of sound  }
        sampleSize:             SInt16;                             {  number of bits per sample  }
        compressionID:          SInt16;                             {  unused. set to zero.  }
        packetSize:             SInt16;                             {  unused. set to zero.  }
        sampleRate:             UnsignedFixed;                          {  sample rate sound is captured at  }
    end;

    SoundDescriptionHandle              = ^SoundDescriptionPtr;
    {  version 1 of the SoundDescription record }
    SoundDescriptionV1Ptr = ^SoundDescriptionV1;
    SoundDescriptionV1 = record
                                                                        {  original fields }
        desc:                   SoundDescription;
                                                                        {  fixed compression ratio information }
        samplesPerPacket:       UInt32;
        bytesPerPacket:         UInt32;
        bytesPerFrame:          UInt32;
        bytesPerSample:         UInt32;
                                                                        {  additional atom based fields ([long size, long type, some data], repeat) }
    end;

    SoundDescriptionV1Handle            = ^SoundDescriptionV1Ptr;
    TextDescriptionPtr = ^TextDescription;
    TextDescription = record
        descSize:               SInt32;                             {  Total size of TextDescription }
        dataFormat:             SInt32;                             {  'text' }
        resvd1:                 SInt32;
        resvd2:                 SInt16;
        dataRefIndex:           SInt16;
        displayFlags:           SInt32;                             {  see enum below for flag values }
        textJustification:      SInt32;                             {  Can be: teCenter,teFlush -Default,-Right,-Left }
        bgColor:                RGBColor;                               {  Background color }
        defaultTextBox:         Rect;                                   {  Location to place the text within the track bounds }
        defaultStyle:           ScrpSTElement;                          {  Default style (struct defined in TextEdit.h) }
        defaultFontName:        SInt8;                                  {  Font Name (pascal string - struct extended to fit)  }
    end;

    TextDescriptionHandle               = ^TextDescriptionPtr;
    SpriteDescriptionPtr = ^SpriteDescription;
    SpriteDescription = record
        descSize:               SInt32;                             {  total size of SpriteDescription including extra data  }
        dataFormat:             SInt32;                             {    }
        resvd1:                 SInt32;                             {  reserved for apple use  }
        resvd2:                 SInt16;
        dataRefIndex:           SInt16;
        version:                SInt32;                             {  which version is this data  }
        decompressorType:       OSType;                                 {  which decompressor to use, 0 for no decompression  }
        sampleFlags:            SInt32;                             {  how to interpret samples  }
    end;

    SpriteDescriptionHandle             = ^SpriteDescriptionPtr;
    FlashDescriptionPtr = ^FlashDescription;
    FlashDescription = record
        descSize:               SInt32;
        dataFormat:             SInt32;
        resvd1:                 SInt32;
        resvd2:                 SInt16;
        dataRefIndex:           SInt16;
        version:                SInt32;                             {  which version is this data  }
        decompressorType:       OSType;                                 {  which decompressor to use, 0 for no decompression  }
        flags:                  SInt32;
    end;

    FlashDescriptionHandle              = ^FlashDescriptionPtr;
    ThreeDeeDescriptionPtr = ^ThreeDeeDescription;
    ThreeDeeDescription = record
        descSize:               SInt32;                             {  total size of ThreeDeeDescription including extra data  }
        dataFormat:             SInt32;                             {    }
        resvd1:                 SInt32;                             {  reserved for apple use  }
        resvd2:                 SInt16;
        dataRefIndex:           SInt16;
        version:                SInt32;                             {  which version is this data  }
        rendererType:           SInt32;                             {  which renderer to use, 0 for default  }
        decompressorType:       SInt32;                             {  which decompressor to use, 0 for default  }
    end;

    ThreeDeeDescriptionHandle           = ^ThreeDeeDescriptionPtr;
    DataReferenceRecordPtr = ^DataReferenceRecord;
    DataReferenceRecord = record
        dataRefType:            OSType;
        dataRef:                Handle;
    end;

    DataReferencePtr                    = ^DataReferenceRecord;
    {   --------------------------
      Music Sample Description
    --------------------------  }
    MusicDescriptionPtr = ^MusicDescription;
    MusicDescription = record
        descSize:               SInt32;
        dataFormat:             SInt32;                             {  'musi'  }
        resvd1:                 SInt32;
        resvd2:                 SInt16;
        dataRefIndex:           SInt16;
        musicFlags:             SInt32;
        headerData:             array [0..0] of UInt32;                 {  variable size!  }
    end;

    MusicDescriptionHandle              = ^MusicDescriptionPtr;

const
    kMusicFlagDontPlay2Soft     = $00000001;
    kMusicFlagDontSlaveToMovie  = $00000002;


    dfDontDisplay               = $01;                          {  Don't display the text }
    dfDontAutoScale             = $02;                          {  Don't scale text as track bounds grows or shrinks }
    dfClipToTextBox             = $04;                          {  Clip update to the textbox }
    dfUseMovieBGColor           = $08;                          {  Set text background to movie's background color }
    dfShrinkTextBoxToFit        = $10;                          {  Compute minimum box to fit the sample }
    dfScrollIn                  = $20;                          {  Scroll text in until last of text is in view  }
    dfScrollOut                 = $40;                          {  Scroll text out until last of text is gone (if both set, scroll in then out) }
    dfHorizScroll               = $80;                          {  Scroll text horizontally (otherwise it's vertical) }
    dfReverseScroll             = $0100;                        {  vert: scroll down rather than up; horiz: scroll backwards (justfication dependent) }
    dfContinuousScroll          = $0200;                        {  new samples cause previous samples to scroll out  }
    dfFlowHoriz                 = $0400;                        {  horiz scroll text flows in textbox rather than extend to right  }
    dfContinuousKaraoke         = $0800;                        {  ignore begin offset, hilite everything up to the end offset(karaoke) }
    dfDropShadow                = $1000;                        {  display text with a drop shadow  }
    dfAntiAlias                 = $2000;                        {  attempt to display text anti aliased }
    dfKeyedText                 = $4000;                        {  key the text over background }
    dfInverseHilite             = $8000;                        {  Use inverse hiliting rather than using hilite color }
    dfTextColorHilite           = $00010000;                    {  changes text color in place of hiliting.  }

    searchTextDontGoToFoundTime = $00010000;
    searchTextDontHiliteFoundText = $00020000;
    searchTextOneTrackOnly      = $00040000;
    searchTextEnabledTracksOnly = $00080000;

    { use these with the text property routines }
                                                                {  set property parameter / get property parameter }
    kTextTextHandle             = 1;                            {  Handle / preallocated Handle }
    kTextTextPtr                = 2;                            {  Pointer }
    kTextTEStyle                = 3;                            {  TextStyle * / TextStyle * }
    kTextSelection              = 4;                            {  long [2] / long [2] }
    kTextBackColor              = 5;                            {  RGBColor * / RGBColor * }
    kTextForeColor              = 6;                            {  RGBColor * / RGBColor * }
    kTextFace                   = 7;                            {  long / long * }
    kTextFont                   = 8;                            {  long / long * }
    kTextSize                   = 9;                            {  long / long * }
    kTextAlignment              = 10;                           {  short * / short * }
    kTextHilite                 = 11;                           {  hiliteRecord * / hiliteRecord * }
    kTextDropShadow             = 12;                           {  dropShadowRecord * / dropShadowRecord * }
    kTextDisplayFlags           = 13;                           {  long / long * }
    kTextScroll                 = 14;                           {  TimeValue * / TimeValue * }
    kTextRelativeScroll         = 15;                           {  Point * }
    kTextHyperTextFace          = 16;                           {  hyperTextSetFace * / hyperTextSetFace * }
    kTextHyperTextColor         = 17;                           {  hyperTextSetColor * / hyperTextSetColor * }
    kTextKeyEntry               = 18;                           {  short }
    kTextMouseDown              = 19;                           {  Point * }
    kTextTextBox                = 20;                           {  Rect * / Rect * }
    kTextEditState              = 21;                           {  short / short * }
    kTextLength                 = 22;                           {        / long * }

    k3DMediaRendererEntry       = $72656E64 (* 'rend' *);
    k3DMediaRendererName        = $6E616D65 (* 'name' *);
    k3DMediaRendererCode        = $72636F64 (* 'rcod' *);

    {    progress messages  }
    movieProgressOpen           = 0;
    movieProgressUpdatePercent  = 1;
    movieProgressClose          = 2;

    {    progress operations    }
    progressOpFlatten           = 1;
    progressOpInsertTrackSegment = 2;
    progressOpInsertMovieSegment = 3;
    progressOpPaste             = 4;
    progressOpAddMovieSelection = 5;
    progressOpCopy              = 6;
    progressOpCut               = 7;
    progressOpLoadMovieIntoRam  = 8;
    progressOpLoadTrackIntoRam  = 9;
    progressOpLoadMediaIntoRam  = 10;
    progressOpImportMovie       = 11;
    progressOpExportMovie       = 12;

    mediaQualityDraft           = $0000;
    mediaQualityNormal          = $0040;
    mediaQualityBetter          = $0080;
    mediaQualityBest            = $00C0;

    {   ****
        Interactive Sprites Support
    ****    }
    {  QTEventRecord flags }
    kQTEventPayloadIsQTList     = $00000001;


type
    QTEventRecordPtr = ^QTEventRecord;
    QTEventRecord = record
        version:                SInt32;
        eventType:              OSType;
        where:                  Point;
        flags:                  SInt32;
        payloadRefcon:          SInt32;                             {  from here down only present if version >= 2 }
        param1:                 SInt32;
        param2:                 SInt32;
        param3:                 SInt32;
    end;

    QTAtomSpecPtr = ^QTAtomSpec;
    QTAtomSpec = record
        container:              QTAtomContainer;
        atom:                   QTAtom;
    end;

    ResolvedQTEventSpecPtr = ^ResolvedQTEventSpec;
    ResolvedQTEventSpec = record
        actionAtom:             QTAtomSpec;
        targetTrack:            Track;
        targetRefCon:           SInt32;
    end;


    {  action constants  }

const
    kActionMovieSetVolume       = 1024;                         {  (short movieVolume)  }
    kActionMovieSetRate         = 1025;                         {  (Fixed rate)  }
    kActionMovieSetLoopingFlags = 1026;                         {  (long loopingFlags)  }
    kActionMovieGoToTime        = 1027;                         {  (TimeValue time)  }
    kActionMovieGoToTimeByName  = 1028;                         {  (Str255 timeName)  }
    kActionMovieGoToBeginning   = 1029;                         {  no params  }
    kActionMovieGoToEnd         = 1030;                         {  no params  }
    kActionMovieStepForward     = 1031;                         {  no params  }
    kActionMovieStepBackward    = 1032;                         {  no params  }
    kActionMovieSetSelection    = 1033;                         {  (TimeValue startTime, TimeValue endTime)  }
    kActionMovieSetSelectionByName = 1034;                      {  (Str255 startTimeName, Str255 endTimeName)  }
    kActionMoviePlaySelection   = 1035;                         {  (Boolean selectionOnly)  }
    kActionMovieSetLanguage     = 1036;                         {  (long language)  }
    kActionMovieChanged         = 1037;                         {  no params  }
    kActionMovieRestartAtTime   = 1038;                         {  (TimeValue startTime, Fixed rate)  }
    kActionMovieGotoNextChapter = 1039;                         {  no params  }
    kActionMovieGotoPreviousChapter = 1040;                     {  no params  }
    kActionMovieGotoFirstChapter = 1041;                        {  no params  }
    kActionMovieGotoLastChapter = 1042;                         {  no params  }
    kActionMovieGotoChapterByIndex = 1043;                      {  ( short index )  }
    kActionMovieSetScale        = 1044;                         {  (Fixed xScale, Fixed yScale)  }
    kActionTrackSetVolume       = 2048;                         {  (short volume)  }
    kActionTrackSetBalance      = 2049;                         {  (short balance)  }
    kActionTrackSetEnabled      = 2050;                         {  (Boolean enabled)  }
    kActionTrackSetMatrix       = 2051;                         {  (MatrixRecord matrix)  }
    kActionTrackSetLayer        = 2052;                         {  (short layer)  }
    kActionTrackSetClip         = 2053;                         {  (RgnHandle clip)  }
    kActionTrackSetCursor       = 2054;                         {  (QTATomID cursorID)  }
    kActionTrackSetGraphicsMode = 2055;                         {  (ModifierTrackGraphicsModeRecord graphicsMode)  }
    kActionTrackSetIdleFrequency = 2056;                        {  (long frequency)  }
    kActionTrackSetBassTreble   = 2057;                         {  (short base, short treble)  }
    kActionSpriteSetMatrix      = 3072;                         {  (MatrixRecord matrix)  }
    kActionSpriteSetImageIndex  = 3073;                         {  (short imageIndex)  }
    kActionSpriteSetVisible     = 3074;                         {  (short visible)  }
    kActionSpriteSetLayer       = 3075;                         {  (short layer)  }
    kActionSpriteSetGraphicsMode = 3076;                        {  (ModifierTrackGraphicsModeRecord graphicsMode)  }
    kActionSpritePassMouseToCodec = 3078;                       {  no params  }
    kActionSpriteClickOnCodec   = 3079;                         {  Point localLoc  }
    kActionSpriteTranslate      = 3080;                         {  (Fixed x, Fixed y, Boolean isAbsolute)  }
    kActionSpriteScale          = 3081;                         {  (Fixed xScale, Fixed yScale)  }
    kActionSpriteRotate         = 3082;                         {  (Fixed degrees)  }
    kActionSpriteStretch        = 3083;                         {  (Fixed p1x, Fixed p1y, Fixed p2x, Fixed p2y, Fixed p3x, Fixed p3y, Fixed p4x, Fixed p4y)  }
    kActionSpriteSetCanBeHitTested = 3094;                      {  (short canBeHitTested)  }
    kActionQTVRSetPanAngle      = 4096;                         {  (float panAngle)  }
    kActionQTVRSetTiltAngle     = 4097;                         {  (float tiltAngle)  }
    kActionQTVRSetFieldOfView   = 4098;                         {  (float fieldOfView)  }
    kActionQTVRShowDefaultView  = 4099;                         {  no params  }
    kActionQTVRGoToNodeID       = 4100;                         {  (UInt32 nodeID)  }
    kActionQTVREnableHotSpot    = 4101;                         {  long ID, Boolean enable  }
    kActionQTVRShowHotSpots     = 4102;                         {  Boolean show  }
    kActionQTVRTranslateObject  = 4103;                         {  float xMove, float yMove  }
    kActionQTVRSetViewState     = 4109;                         {  long viewStateType, short state  }
    kActionMusicPlayNote        = 5120;                         {  (long sampleDescIndex, long partNumber, long delay, long pitch, long velocity, long duration)  }
    kActionMusicSetController   = 5121;                         {  (long sampleDescIndex, long partNumber, long delay, long controller, long value)  }
    kActionCase                 = 6144;                         {  [(CaseStatementActionAtoms)]  }
    kActionWhile                = 6145;                         {  [(WhileStatementActionAtoms)]  }
    kActionGoToURL              = 6146;                         {  (C string urlLink)  }
    kActionSendQTEventToSprite  = 6147;                         {  ([(SpriteTargetAtoms)], QTEventRecord theEvent)  }
    kActionDebugStr             = 6148;                         {  (Str255 theString)  }
    kActionPushCurrentTime      = 6149;                         {  no params  }
    kActionPushCurrentTimeWithLabel = 6150;                     {  (Str255 theLabel)  }
    kActionPopAndGotoTopTime    = 6151;                         {  no params  }
    kActionPopAndGotoLabeledTime = 6152;                        {  (Str255 theLabel)  }
    kActionStatusString         = 6153;                         {  (C string theString, long stringTypeFlags)  }
    kActionSendQTEventToTrackObject = 6154;                     {  ([(TrackObjectTargetAtoms)], QTEventRecord theEvent)  }
    kActionAddChannelSubscription = 6155;                       {  (Str255 channelName, C string channelsURL, C string channelsPictureURL)  }
    kActionRemoveChannelSubscription = 6156;                    {  (C string channelsURL)  }
    kActionOpenCustomActionHandler = 6157;                      {  (long handlerID, ComponentDescription handlerDesc)  }
    kActionDoScript             = 6158;                         {  (long scriptTypeFlags, CString command, CString arguments)  }
    kActionDoCompressedActions  = 6159;                         {  (compressed QTAtomContainer prefixed with eight bytes: long compressorType, long decompressedSize)  }
    kActionSendAppMessage       = 6160;                         {  (long appMessageID)  }
    kActionLoadComponent        = 6161;                         {  (ComponentDescription handlerDesc)  }
    kActionSetFocus             = 6162;                         {  [(TargetAtoms theObject)]  }
    kActionDontPassKeyEvent     = 6163;                         {  no params  }
    kActionSetRandomSeed        = 6164;                         {  long randomSeed  }
    kActionSpriteTrackSetVariable = 7168;                       {  (QTAtomID variableID, float value)  }
    kActionSpriteTrackNewSprite = 7169;                         {  (QTAtomID spriteID, short imageIndex, MatrixRecord *matrix, short visible, short layer, ModifierTrackGraphicsModeRecord *graphicsMode, QTAtomID actionHandlingSpriteID)  }
    kActionSpriteTrackDisposeSprite = 7170;                     {  (QTAtomID spriteID)  }
    kActionSpriteTrackSetVariableToString = 7171;               {  (QTAtomID variableID, C string value)  }
    kActionSpriteTrackConcatVariables = 7172;                   {  (QTAtomID firstVariableID, QTAtomID secondVariableID, QTAtomID resultVariableID )  }
    kActionSpriteTrackSetVariableToMovieURL = 7173;             {  (QTAtomID variableID, < optional: [(MovieTargetAtoms)] > )  }
    kActionSpriteTrackSetVariableToMovieBaseURL = 7174;         {  (QTAtomID variableID, < optional: [(MovieTargetAtoms)] > )  }
    kActionSpriteTrackSetAllSpritesHitTestingMode = 7181;
    kActionSpriteTrackNewImage  = 7182;                         {  (C string imageURL, QTAtomID desiredID)  }
    kActionSpriteTrackDisposeImage = 7183;                      {  (short imageIndex)  }
    kActionApplicationNumberAndString = 8192;                   {  (long aNumber, Str255 aString )  }
    kActionQD3DNamedObjectTranslateTo = 9216;                   {  (Fixed x, Fixed y, Fixed z )  }
    kActionQD3DNamedObjectScaleTo = 9217;                       {  (Fixed xScale, Fixed yScale, Fixed zScale )  }
    kActionQD3DNamedObjectRotateTo = 9218;                      {  (Fixed xDegrees, Fixed yDegrees, Fixed zDegrees )  }
    kActionFlashTrackSetPan     = 10240;                        {  (short xPercent, short yPercent )  }
    kActionFlashTrackSetZoom    = 10241;                        {  (short zoomFactor )  }
    kActionFlashTrackSetZoomRect = 10242;                       {  (long left, long top, long right, long bottom )  }
    kActionFlashTrackGotoFrameNumber = 10243;                   {  (long frameNumber )  }
    kActionFlashTrackGotoFrameLabel = 10244;                    {  (C string frameLabel )  }
    kActionFlashTrackSetFlashVariable = 10245;                  {  (C string path, C string name, C string value, Boolean updateFocus)  }
    kActionFlashTrackDoButtonActions = 10246;                   {  (C string path, long buttonID, long transition)  }
    kActionMovieTrackAddChildMovie = 11264;                     {  (QTAtomID childMovieID, C string childMovieURL)  }
    kActionMovieTrackLoadChildMovie = 11265;                    {  (QTAtomID childMovieID)  }
    kActionMovieTrackLoadChildMovieWithQTListParams = 11266;    {  (QTAtomID childMovieID, C string qtlistXML)  }
    kActionTextTrackPasteText   = 12288;                        {  (C string theText, long startSelection, long endSelection )  }
    kActionTextTrackSetTextBox  = 12291;                        {  (short left, short top, short right, short bottom)  }
    kActionTextTrackSetTextStyle = 12292;                       {  (Handle textStyle)  }
    kActionTextTrackSetSelection = 12293;                       {  (long startSelection, long endSelection )  }
    kActionTextTrackSetBackgroundColor = 12294;                 {  (ModifierTrackGraphicsModeRecord backgroundColor )  }
    kActionTextTrackSetForegroundColor = 12295;                 {  (ModifierTrackGraphicsModeRecord foregroundColor )  }
    kActionTextTrackSetFace     = 12296;                        {  (long fontFace )  }
    kActionTextTrackSetFont     = 12297;                        {  (long fontID )  }
    kActionTextTrackSetSize     = 12298;                        {  (long fontSize )  }
    kActionTextTrackSetAlignment = 12299;                       {  (short alignment )  }
    kActionTextTrackSetHilite   = 12300;                        {  (long startHighlight, long endHighlight, ModifierTrackGraphicsModeRecord highlightColor )  }
    kActionTextTrackSetDropShadow = 12301;                      {  (Point dropShadow, short transparency )  }
    kActionTextTrackSetDisplayFlags = 12302;                    {  (long flags )  }
    kActionTextTrackSetScroll   = 12303;                        {  (long delay )  }
    kActionTextTrackRelativeScroll = 12304;                     {  (short deltaX, short deltaY )  }
    kActionTextTrackFindText    = 12305;                        {  (long flags, Str255 theText, ModifierTrackGraphicsModeRecord highlightColor )  }
    kActionTextTrackSetHyperTextFace = 12306;                   {  (short index, long fontFace )  }
    kActionTextTrackSetHyperTextColor = 12307;                  {  (short index, ModifierTrackGraphicsModeRecord highlightColor )  }
    kActionTextTrackKeyEntry    = 12308;                        {  (short character )  }
    kActionTextTrackMouseDown   = 12309;                        {  no params  }
    kActionTextTrackSetEditable = 12310;                        {  (short editState)  }
    kActionListAddElement       = 13312;                        {  (C string parentPath, long atIndex, C string newElementName)  }
    kActionListRemoveElements   = 13313;                        {  (C string parentPath, long startIndex, long endIndex)  }
    kActionListSetElementValue  = 13314;                        {  (C string elementPath, C string valueString)  }
    kActionListPasteFromXML     = 13315;                        {  (C string xml, C string targetParentPath, long startIndex)  }
    kActionListSetMatchingFromXML = 13316;                      {  (C string xml, C string targetParentPath)  }
    kActionListSetFromURL       = 13317;                        {  (C string url, C string targetParentPath )  }
    kActionListExchangeLists    = 13318;                        {  (C string url, C string parentPath)  }
    kActionListServerQuery      = 13319;                        {  (C string url, C string keyValuePairs, long flags, C string parentPath)  }


    kOperandExpression          = 1;
    kOperandConstant            = 2;
    kOperandSubscribedToChannel = 3;                            {  C string channelsURL  }
    kOperandUniqueCustomActionHandlerID = 4;
    kOperandCustomActionHandlerIDIsOpen = 5;                    {  long ID  }
    kOperandConnectionSpeed     = 6;
    kOperandGMTDay              = 7;
    kOperandGMTMonth            = 8;
    kOperandGMTYear             = 9;
    kOperandGMTHours            = 10;
    kOperandGMTMinutes          = 11;
    kOperandGMTSeconds          = 12;
    kOperandLocalDay            = 13;
    kOperandLocalMonth          = 14;
    kOperandLocalYear           = 15;
    kOperandLocalHours          = 16;
    kOperandLocalMinutes        = 17;
    kOperandLocalSeconds        = 18;
    kOperandRegisteredForQuickTimePro = 19;
    kOperandPlatformRunningOn   = 20;
    kOperandQuickTimeVersion    = 21;
    kOperandComponentVersion    = 22;                           {  C string type, C string subType, C string manufacturer  }
    kOperandOriginalHandlerRefcon = 23;
    kOperandTicks               = 24;
    kOperandMaxLoadedTimeInMovie = 25;
    kOperandEventParameter      = 26;                           {  short index  }
    kOperandFreeMemory          = 27;
    kOperandNetworkStatus       = 28;
    kOperandQuickTimeVersionRegistered = 29;                    {  long version  }
    kOperandSystemVersion       = 30;
    kOperandMovieVolume         = 1024;
    kOperandMovieRate           = 1025;
    kOperandMovieIsLooping      = 1026;
    kOperandMovieLoopIsPalindrome = 1027;
    kOperandMovieTime           = 1028;
    kOperandMovieDuration       = 1029;
    kOperandMovieTimeScale      = 1030;
    kOperandMovieWidth          = 1031;
    kOperandMovieHeight         = 1032;
    kOperandMovieLoadState      = 1033;
    kOperandMovieTrackCount     = 1034;
    kOperandMovieIsActive       = 1035;
    kOperandMovieName           = 1036;
    kOperandMovieID             = 1037;
    kOperandMovieChapterCount   = 1038;
    kOperandMovieChapterIndex   = 1039;
    kOperandMovieChapterName    = 1040;
    kOperandMovieChapterNameByIndex = 1041;                     {  ( short index )  }
    kOperandMovieChapterIndexByName = 1042;                     {  (c string name)   }
    kOperandMovieAnnotation     = 1043;                         {  (c string requested, long flags)  }
    kOperandMovieConnectionFlags = 1044;
    kOperandMovieConnectionString = 1045;
    kOperandTrackVolume         = 2048;
    kOperandTrackBalance        = 2049;
    kOperandTrackEnabled        = 2050;
    kOperandTrackLayer          = 2051;
    kOperandTrackWidth          = 2052;
    kOperandTrackHeight         = 2053;
    kOperandTrackDuration       = 2054;
    kOperandTrackName           = 2055;
    kOperandTrackID             = 2056;
    kOperandTrackIdleFrequency  = 2057;
    kOperandTrackBass           = 2058;
    kOperandTrackTreble         = 2059;
    kOperandSpriteBoundsLeft    = 3072;
    kOperandSpriteBoundsTop     = 3073;
    kOperandSpriteBoundsRight   = 3074;
    kOperandSpriteBoundsBottom  = 3075;
    kOperandSpriteImageIndex    = 3076;
    kOperandSpriteVisible       = 3077;
    kOperandSpriteLayer         = 3078;
    kOperandSpriteTrackVariable = 3079;                         {  [QTAtomID variableID]  }
    kOperandSpriteTrackNumSprites = 3080;
    kOperandSpriteTrackNumImages = 3081;
    kOperandSpriteID            = 3082;
    kOperandSpriteIndex         = 3083;
    kOperandSpriteFirstCornerX  = 3084;
    kOperandSpriteFirstCornerY  = 3085;
    kOperandSpriteSecondCornerX = 3086;
    kOperandSpriteSecondCornerY = 3087;
    kOperandSpriteThirdCornerX  = 3088;
    kOperandSpriteThirdCornerY  = 3089;
    kOperandSpriteFourthCornerX = 3090;
    kOperandSpriteFourthCornerY = 3091;
    kOperandSpriteImageRegistrationPointX = 3092;
    kOperandSpriteImageRegistrationPointY = 3093;
    kOperandSpriteTrackSpriteIDAtPoint = 3094;                  {  short x, short y  }
    kOperandSpriteName          = 3095;
    kOperandSpriteCanBeHitTested = 3105;                        {  short  }
    kOperandSpriteTrackAllSpritesHitTestingMode = 3106;
    kOperandSpriteTrackImageIDByIndex = 3107;                   {  short imageIndex  }
    kOperandSpriteTrackImageIndexByID = 3108;                   {  QTAtomID  }
    kOperandQTVRPanAngle        = 4096;
    kOperandQTVRTiltAngle       = 4097;
    kOperandQTVRFieldOfView     = 4098;
    kOperandQTVRNodeID          = 4099;
    kOperandQTVRHotSpotsVisible = 4100;
    kOperandQTVRViewCenterH     = 4101;
    kOperandQTVRViewCenterV     = 4102;
    kOperandQTVRViewStateCount  = 4103;
    kOperandQTVRViewState       = 4104;                         {  long viewStateType  }
    kOperandMouseLocalHLoc      = 5120;                         {  [TargetAtoms aTrack]  }
    kOperandMouseLocalVLoc      = 5121;                         {  [TargetAtoms aTrack]  }
    kOperandKeyIsDown           = 5122;                         {  [short modKeys, char asciiValue]  }
    kOperandRandom              = 5123;                         {  [short min, short max]  }
    kOperandCanHaveFocus        = 5124;                         {  [(TargetAtoms theObject)]  }
    kOperandHasFocus            = 5125;                         {  [(TargetAtoms theObject)]  }
    kOperandTextTrackEditable   = 6144;
    kOperandTextTrackCopyText   = 6145;                         {  long startSelection, long endSelection  }
    kOperandTextTrackStartSelection = 6146;
    kOperandTextTrackEndSelection = 6147;
    kOperandTextTrackTextBoxLeft = 6148;
    kOperandTextTrackTextBoxTop = 6149;
    kOperandTextTrackTextBoxRight = 6150;
    kOperandTextTrackTextBoxBottom = 6151;
    kOperandTextTrackTextLength = 6152;
    kOperandListCountElements   = 7168;                         {  (C string parentPath)  }
    kOperandListGetElementPathByIndex = 7169;                   {  (C string parentPath, long index)  }
    kOperandListGetElementValue = 7170;                         {  (C string elementPath)  }
    kOperandListCopyToXML       = 7171;                         {  (C string parentPath, long startIndex, long endIndex)  }
    kOperandSin                 = 8192;                         {  float x     }
    kOperandCos                 = 8193;                         {  float x     }
    kOperandTan                 = 8194;                         {  float x     }
    kOperandATan                = 8195;                         {  float x     }
    kOperandATan2               = 8196;                         {  float y, float x    }
    kOperandDegreesToRadians    = 8197;                         {  float x  }
    kOperandRadiansToDegrees    = 8198;                         {  float x  }
    kOperandSquareRoot          = 8199;                         {  float x  }
    kOperandExponent            = 8200;                         {  float x  }
    kOperandLog                 = 8201;                         {  float x  }
    kOperandFlashTrackVariable  = 9216;                         {  [CString path, CString name]  }
    kOperandStringLength        = 10240;                        {  (C string text)  }
    kOperandStringCompare       = 10241;                        {  (C string aText, C string bText, Boolean caseSensitive, Boolan diacSensitive)  }
    kOperandStringSubString     = 10242;                        {  (C string text, long offset, long length)  }
    kOperandStringConcat        = 10243;                        {  (C string aText, C string bText)  }

    kFirstMovieAction           = 1024;
    kLastMovieAction            = 1044;
    kFirstTrackAction           = 2048;
    kLastTrackAction            = 2057;
    kFirstSpriteAction          = 3072;
    kLastSpriteAction           = 3094;
    kFirstQTVRAction            = 4096;
    kLastQTVRAction             = 4109;
    kFirstMusicAction           = 5120;
    kLastMusicAction            = 5121;
    kFirstSystemAction          = 6144;
    kLastSystemAction           = 6164;
    kFirstSpriteTrackAction     = 7168;
    kLastSpriteTrackAction      = 7183;
    kFirstApplicationAction     = 8192;
    kLastApplicationAction      = 8192;
    kFirstQD3DNamedObjectAction = 9216;
    kLastQD3DNamedObjectAction  = 9218;
    kFirstFlashTrackAction      = 10240;
    kLastFlashTrackAction       = 10246;
    kFirstMovieTrackAction      = 11264;
    kLastMovieTrackAction       = 11266;
    kFirstTextTrackAction       = 12288;
    kLastTextTrackAction        = 12310;
    kFirstMultiTargetAction     = 13312;
    kLastMultiTargetAction      = 13319;
    kFirstAction                = 1024;
    kLastAction                 = 13319;

    {  target atom types }
    kTargetMovie                = $6D6F6F76 (* 'moov' *);                       {  no data  }
    kTargetMovieName            = $6D6F6E61 (* 'mona' *);                       {  (PString movieName)  }
    kTargetMovieID              = $6D6F6964 (* 'moid' *);                       {  (long movieID)  }
    kTargetRootMovie            = $6D6F726F (* 'moro' *);                       {  no data  }
    kTargetParentMovie          = $6D6F7061 (* 'mopa' *);                       {  no data  }
    kTargetChildMovieTrackName  = $6D6F746E (* 'motn' *);                       {  (PString childMovieTrackName)  }
    kTargetChildMovieTrackID    = $6D6F7469 (* 'moti' *);                       {  (long childMovieTrackID)  }
    kTargetChildMovieTrackIndex = $6D6F7478 (* 'motx' *);                       {  (long childMovieTrackIndex)  }
    kTargetChildMovieMovieName  = $6D6F6D6E (* 'momn' *);                       {  (PString childMovieName)  }
    kTargetChildMovieMovieID    = $6D6F6D69 (* 'momi' *);                       {  (long childMovieID)  }
    kTargetTrackName            = $74726E61 (* 'trna' *);                       {  (PString trackName)  }
    kTargetTrackID              = $74726964 (* 'trid' *);                       {  (long trackID)  }
    kTargetTrackType            = $74727479 (* 'trty' *);                       {  (OSType trackType)  }
    kTargetTrackIndex           = $7472696E (* 'trin' *);                       {  (long trackIndex)  }
    kTargetSpriteName           = $73706E61 (* 'spna' *);                       {  (PString spriteName)  }
    kTargetSpriteID             = $73706964 (* 'spid' *);                       {  (QTAtomID spriteID)  }
    kTargetSpriteIndex          = $7370696E (* 'spin' *);                       {  (short spriteIndex)  }
    kTargetQD3DNamedObjectName  = $6E616E61 (* 'nana' *);                       {  (CString objectName)  }
    kTargetCurrentQTEventParams = $65767061 (* 'evpa' *);                       {  no data  }

    {  action container atom types }
    kQTEventType                = $65766E74 (* 'evnt' *);
    kAction                     = $6163746E (* 'actn' *);
    kWhichAction                = $77686963 (* 'whic' *);
    kActionParameter            = $7061726D (* 'parm' *);
    kActionTarget               = $74617267 (* 'targ' *);
    kActionFlags                = $666C6167 (* 'flag' *);
    kActionParameterMinValue    = $6D696E76 (* 'minv' *);
    kActionParameterMaxValue    = $6D617876 (* 'maxv' *);
    kActionListAtomType         = $6C697374 (* 'list' *);
    kExpressionContainerAtomType = $65787072 (* 'expr' *);
    kConditionalAtomType        = $74657374 (* 'test' *);
    kOperatorAtomType           = $6F706572 (* 'oper' *);
    kOperandAtomType            = $6F70726E (* 'oprn' *);
    kCommentAtomType            = $77687920 (* 'why ' *);
    kCustomActionHandler        = $63757374 (* 'cust' *);
    kCustomHandlerID            = $69642020 (* 'id  ' *);
    kCustomHandlerDesc          = $64657363 (* 'desc' *);
    kQTEventRecordAtomType      = $65726563 (* 'erec' *);

    {  QTEvent types  }
    kQTEventMouseClick          = $636C696B (* 'clik' *);
    kQTEventMouseClickEnd       = $63656E64 (* 'cend' *);
    kQTEventMouseClickEndTriggerButton = $74726967 (* 'trig' *);
    kQTEventMouseEnter          = $656E7472 (* 'entr' *);
    kQTEventMouseExit           = $65786974 (* 'exit' *);
    kQTEventMouseMoved          = $6D6F7665 (* 'move' *);
    kQTEventFrameLoaded         = $6672616D (* 'fram' *);
    kQTEventIdle                = $69646C65 (* 'idle' *);
    kQTEventKey                 = $6B657920 (* 'key ' *);                       {  qtevent.param1 = key, qtevent.param2 = modifiers, qtEvent.param3 = scanCode  }
    kQTEventMovieLoaded         = $6C6F6164 (* 'load' *);
    kQTEventRequestToModifyMovie = $7265716D (* 'reqm' *);
    kQTEventListReceived        = $6C697374 (* 'list' *);
    kQTEventKeyUp               = $6B657955 (* 'keyU' *);                       {  qtevent.param1 = key, qtevent.param2 = modifiers, qtEvent.param3 = scanCode  }

    {  flags for the kActionFlags atom  }
    kActionFlagActionIsDelta    = $00000002;
    kActionFlagParameterWrapsAround = $00000004;
    kActionFlagActionIsToggle   = $00000008;

    {  flags for stringTypeFlags field of the QTStatusStringRecord  }
    kStatusStringIsURLLink      = $00000002;
    kStatusStringIsStreamingStatus = $00000004;
    kStatusHasCodeNumber        = $00000008;                    {  high 16 bits of stringTypeFlags is error code number }
    kStatusIsError              = $00000010;

    {  flags for scriptTypeFlags field of the QTDoScriptRecord }
    kScriptIsUnknownType        = $00000001;
    kScriptIsJavaScript         = $00000002;
    kScriptIsLingoEvent         = $00000004;
    kScriptIsVBEvent            = $00000008;
    kScriptIsProjectorCommand   = $00000010;
    kScriptIsAppleScript        = $00000020;

    {  flags for CheckQuickTimeRegistration routine }
    kQTRegistrationDialogTimeOutFlag = $01;
    kQTRegistrationDialogShowDialog = $02;
    kQTRegistrationDialogForceDialog = $04;

    {  constants for kOperatorAtomType IDs (operator types) }
    kOperatorAdd                = $61646420 (* 'add ' *);
    kOperatorSubtract           = $73756220 (* 'sub ' *);
    kOperatorMultiply           = $6D756C74 (* 'mult' *);
    kOperatorDivide             = $64697620 (* 'div ' *);
    kOperatorOr                 = $6F722020 (* 'or  ' *);
    kOperatorAnd                = $616E6420 (* 'and ' *);
    kOperatorNot                = $6E6F7420 (* 'not ' *);
    kOperatorLessThan           = $3C202020 (* '<   ' *);
    kOperatorLessThanEqualTo    = $3C3D2020 (* '<=  ' *);
    kOperatorEqualTo            = $3D202020 (* '=   ' *);
    kOperatorNotEqualTo         = $213D2020 (* '!=  ' *);
    kOperatorGreaterThan        = $3E202020 (* '>   ' *);
    kOperatorGreaterThanEqualTo = $3E3D2020 (* '>=  ' *);
    kOperatorModulo             = $6D6F6420 (* 'mod ' *);
    kOperatorIntegerDivide      = $69646976 (* 'idiv' *);
    kOperatorAbsoluteValue      = $61627320 (* 'abs ' *);
    kOperatorNegate             = $6E656720 (* 'neg ' *);

    {  constants for kOperandPlatformRunningOn }
    kPlatformMacintosh          = 1;
    kPlatformWindows            = 2;

    {  flags for kOperandSystemVersion }
    kSystemIsWindows9x          = $00010000;
    kSystemIsWindowsNT          = $00020000;

    {  constants for MediaPropertiesAtom }
    kMediaPropertyNonLinearAtomType = $6E6F6E6C (* 'nonl' *);
    kMediaPropertyHasActions    = 105;

    {    TimeBase and TimeRecord moved to MacTypes.h    }

type
    TimeBaseFlags               = UInt32;
const
    loopTimeBase                = 1;
    palindromeLoopTimeBase      = 2;
    maintainTimeBaseZero        = 4;


type
    CallBackRecordPtr = ^CallBackRecord;
    CallBackRecord = record
        data:                   array [0..0] of SInt32;
    end;

    QTCallBack                          = ^CallBackRecord;
    {    CallBack equates   }
    QTCallBackFlags             = UInt16;
const
    triggerTimeFwd              = $0001;                        {  when curTime exceeds triggerTime going forward  }
    triggerTimeBwd              = $0002;                        {  when curTime exceeds triggerTime going backwards  }
    triggerTimeEither           = $0003;                        {  when curTime exceeds triggerTime going either direction  }
    triggerRateLT               = $0004;                        {  when rate changes to less than trigger value  }
    triggerRateGT               = $0008;                        {  when rate changes to greater than trigger value  }
    triggerRateEqual            = $0010;                        {  when rate changes to equal trigger value  }
    triggerRateLTE              = $0014;
    triggerRateGTE              = $0018;
    triggerRateNotEqual         = $001C;
    triggerRateChange           = 0;
    triggerAtStart              = $0001;
    triggerAtStop               = $0002;


type
    TimeBaseStatus              = UInt32;
const
    timeBaseBeforeStartTime     = 1;
    timeBaseAfterStopTime       = 2;



type
    QTCallBackType              = UInt16;
const
    callBackAtTime              = 1;
    callBackAtRate              = 2;
    callBackAtTimeJump          = 3;
    callBackAtExtremes          = 4;
    callBackAtTimeBaseDisposed  = 5;
    callBackAtInterrupt         = $8000;
    callBackAtDeferredTask      = $4000;


type
    QTCallBackProcPtr = procedure(cb: QTCallBack; refCon: SInt32);

    QTCallBackUPP = ^SInt32; { an opaque UPP }

const
    qtcbNeedsRateChanges        = 1;                            {  wants to know about rate changes  }
    qtcbNeedsTimeChanges        = 2;                            {  wants to know about time changes  }
    qtcbNeedsStartStopChanges   = 4;                            {  wants to know when TimeBase start/stop is changed }


type
    QTCallBackHeaderPtr = ^QTCallBackHeader;
    QTCallBackHeader = record
        callBackFlags:          SInt32;
        reserved1:              SInt32;
        qtPrivate:              array [0..39] of SInt8;
    end;

    QTSyncTaskProcPtr = procedure(task: UnivPtr);

    QTSyncTaskUPP = ^SInt32; { an opaque UPP }
    QTSyncTaskRecordPtr = ^QTSyncTaskRecord;
    QTSyncTaskRecord = record
        qLink:                  Ptr;
        proc:                   QTSyncTaskUPP;
    end;

    QTSyncTaskPtr                       = ^QTSyncTaskRecord;

    MovieRgnCoverProcPtr = function(theMovie: Movie; changedRgn: RgnHandle; refcon: SInt32): OSErr;

    MovieProgressProcPtr = function(theMovie: Movie; message: SInt16; whatOperation: SInt16; percentDone: Fixed; refcon: SInt32): OSErr;

    MovieDrawingCompleteProcPtr = function(theMovie: Movie; refCon: SInt32): OSErr;

    TrackTransferProcPtr = function(t: Track; refCon: SInt32): OSErr;

    GetMovieProcPtr = function(offset: SInt32; size: SInt32; dataPtr: UnivPtr; refCon: UnivPtr): OSErr;

    MoviePreviewCallOutProcPtr = function(refcon: SInt32): boolean;

    TextMediaProcPtr = function(theText: Handle; theMovie: Movie; var displayFlag: SInt16; refcon: SInt32): OSErr;

    ActionsProcPtr = function(refcon: UnivPtr; targetTrack: Track; targetRefCon: SInt32; theEvent: QTEventRecordPtr): OSErr;

    DoMCActionProcPtr = function(refcon: UnivPtr; action: SInt16; params: UnivPtr; var handled: boolean): OSErr;

    MovieExecuteWiredActionsProcPtr = function(theMovie: Movie; refcon: UnivPtr; flags: SInt32; wiredActions: QTAtomContainer): OSErr;

    MoviePrePrerollCompleteProcPtr = procedure(theMovie: Movie; prerollErr: OSErr; refcon: UnivPtr);

    QTNextTaskNeededSoonerCallbackProcPtr = procedure(duration: TimeValue; flags: UInt32; refcon: UnivPtr);

    MoviesErrorProcPtr = procedure(theErr: OSErr; refcon: SInt32);

    MovieRgnCoverUPP = ^SInt32; { an opaque UPP }
    MovieProgressUPP = ^SInt32; { an opaque UPP }
    MovieDrawingCompleteUPP = ^SInt32; { an opaque UPP }
    TrackTransferUPP = ^SInt32; { an opaque UPP }
    GetMovieUPP = ^SInt32; { an opaque UPP }
    MoviePreviewCallOutUPP = ^SInt32; { an opaque UPP }
    TextMediaUPP = ^SInt32; { an opaque UPP }
    ActionsUPP = ^SInt32; { an opaque UPP }
    DoMCActionUPP = ^SInt32; { an opaque UPP }
    MovieExecuteWiredActionsUPP = ^SInt32; { an opaque UPP }
    MoviePrePrerollCompleteUPP = ^SInt32; { an opaque UPP }
    QTNextTaskNeededSoonerCallbackUPP = ^SInt32; { an opaque UPP }
    MoviesErrorUPP = ^SInt32; { an opaque UPP }
    MediaHandler                        = ComponentInstance;
    DataHandler                         = ComponentInstance;
    MediaHandlerComponent               = Component;
    DataHandlerComponent                = Component;
    HandlerError                        = ComponentResult;

const
    keepInRam                   = $01;                          {  load and make non-purgable }
    unkeepInRam                 = $02;                          {  mark as purgable }
    flushFromRam                = $04;                          {  empty those handles }
    loadForwardTrackEdits       = $08;                          {     load track edits into ram for playing forward }
    loadBackwardTrackEdits      = $10;                          {     load track edits into ram for playing in reverse }

    newMovieActive              = $01;
    newMovieDontResolveDataRefs = $02;
    newMovieDontAskUnresolvedDataRefs = $04;
    newMovieDontAutoAlternates  = $08;
    newMovieDontUpdateForeBackPointers = $10;
    newMovieDontAutoUpdateClock = $20;
    newMovieAsyncOK             = $0100;
    newMovieIdleImportOK        = $0400;
    newMovieDontInteractWithUser = $0800;

    {    track usage bits   }
    trackUsageInMovie           = $02;
    trackUsageInPreview         = $04;
    trackUsageInPoster          = $08;

    {    Add/GetMediaSample flags   }
    mediaSampleNotSync          = $01;                          {  sample is not a sync sample (eg. is frame differenced  }
    mediaSampleShadowSync       = $02;                          {  sample is a shadow sync  }

    pasteInParallel             = $01;
    showUserSettingsDialog      = $02;
    movieToFileOnlyExport       = $04;
    movieFileSpecValid          = $08;

    nextTimeMediaSample         = $01;
    nextTimeMediaEdit           = $02;
    nextTimeTrackEdit           = $04;
    nextTimeSyncSample          = $08;
    nextTimeStep                = $10;
    nextTimeEdgeOK              = $4000;
    nextTimeIgnoreActiveSegment = $8000;


type
    nextTimeFlagsEnum                   = UInt16;

const
    createMovieFileDeleteCurFile = $80000000;
    createMovieFileDontCreateMovie = $40000000;
    createMovieFileDontOpenFile = $20000000;
    createMovieFileDontCreateResFile = $10000000;


type
    createMovieFileFlagsEnum            = UInt32;

const
    flattenAddMovieToDataFork   = $00000001;
    flattenActiveTracksOnly     = $00000004;
    flattenDontInterleaveFlatten = $00000008;
    flattenFSSpecPtrIsDataRefRecordPtr = $00000010;
    flattenCompressMovieResource = $00000020;
    flattenForceMovieResourceBeforeMovieData = $00000040;


type
    movieFlattenFlagsEnum               = UInt32;

const
    movieInDataForkResID        = -1;                           {  magic res ID  }

    mcTopLeftMovie              = $01;                          {  usually centered  }
    mcScaleMovieToFit           = $02;                          {  usually only scales down  }
    mcWithBadge                 = $04;                          {  give me a badge  }
    mcNotVisible                = $08;                          {  don't show controller  }
    mcWithFrame                 = $10;                          {  gimme a frame  }

    movieScrapDontZeroScrap     = $01;
    movieScrapOnlyPutMovie      = $02;

    dataRefSelfReference        = $01;
    dataRefWasNotResolved       = $02;


type
    dataRefAttributesFlags              = UInt32;

const
    kMovieAnchorDataRefIsDefault = $01;                         {  data ref returned is movie default data ref  }

    hintsScrubMode              = $01;                          {  mask == && (if flags == scrub on, flags != scrub off)  }
    hintsLoop                   = $02;
    hintsDontPurge              = $04;
    hintsUseScreenBuffer        = $20;
    hintsAllowInterlace         = $40;
    hintsUseSoundInterp         = $80;
    hintsHighQuality            = $0100;                        {  slooooow  }
    hintsPalindrome             = $0200;
    hintsInactive               = $0800;
    hintsOffscreen              = $1000;
    hintsDontDraw               = $2000;
    hintsAllowBlacklining       = $4000;
    hintsDontUseVideoOverlaySurface = $00010000;
    hintsIgnoreBandwidthRestrictions = $00020000;
    hintsPlayingEveryFrame      = $00040000;
    hintsAllowDynamicResize     = $00080000;
    hintsSingleField            = $00100000;
    hintsNoRenderingTimeOut     = $00200000;
    hintsFlushVideoInsteadOfDirtying = $00400000;
    hintsEnableSubPixelPositioning = $00800000;


type
    playHintsEnum                       = UInt32;

const
    mediaHandlerFlagBaseClient  = 1;


type
    mediaHandlerFlagsEnum               = UInt32;

const
    movieTrackMediaType         = $01;
    movieTrackCharacteristic    = $02;
    movieTrackEnabledOnly       = $04;


type
    SampleReferenceRecordPtr = ^SampleReferenceRecord;
    SampleReferenceRecord = record
        dataOffset:             SInt32;
        dataSize:               SInt32;
        durationPerSample:      TimeValue;
        numberOfSamples:        SInt32;
        sampleFlags:            SInt16;
    end;

    SampleReferencePtr                  = ^SampleReferenceRecord;
    SampleReference64RecordPtr = ^SampleReference64Record;
    SampleReference64Record = record
        dataOffset:             wide;
        dataSize:               UInt32;
        durationPerSample:      TimeValue;
        numberOfSamples:        UInt32;
        sampleFlags:            SInt16;
    end;

    SampleReference64Ptr                = ^SampleReference64Record;

    {   ************************
    * Initialization Routines
    *************************   }
    {
     *  CheckQuickTimeRegistration()
     *
     *  Availability:
     *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
     *    CarbonLib:        in CarbonLib 1.1 and later
     *    Mac OS X:         in version 10.0 and later
     *    Windows:          in qtmlClient.lib 3.0 and later
        }
procedure CheckQuickTimeRegistration(registrationKey: UnivPtr; flags: SInt32); external name '_CheckQuickTimeRegistration';
{
 *  EnterMovies()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function EnterMovies: OSErr; external name '_EnterMovies';
{
 *  ExitMovies()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure ExitMovies; external name '_ExitMovies';
{************************
* Error Routines
*************************}

{
 *  GetMoviesError()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetMoviesError: OSErr; external name '_GetMoviesError';
{
 *  ClearMoviesStickyError()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure ClearMoviesStickyError; external name '_ClearMoviesStickyError';
{
 *  GetMoviesStickyError()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetMoviesStickyError: OSErr; external name '_GetMoviesStickyError';
{
 *  SetMoviesErrorProc()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure SetMoviesErrorProc(errProc: MoviesErrorUPP; refcon: SInt32); external name '_SetMoviesErrorProc';
{************************
* Idle Routines
*************************}
{
 *  MoviesTask()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure MoviesTask(theMovie: Movie; maxMilliSecToUse: SInt32); external name '_MoviesTask';
{
 *  PrerollMovie()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function PrerollMovie(theMovie: Movie; time: TimeValue; Rate: Fixed): OSErr; external name '_PrerollMovie';
{
 *  PrePrerollMovie()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function PrePrerollMovie(m: Movie; time: TimeValue; rate: Fixed; proc: MoviePrePrerollCompleteUPP; refcon: UnivPtr): OSErr; external name '_PrePrerollMovie';
{
 *  AbortPrePrerollMovie()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
procedure AbortPrePrerollMovie(m: Movie; err: OSErr); external name '_AbortPrePrerollMovie';
{
 *  LoadMovieIntoRam()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function LoadMovieIntoRam(theMovie: Movie; time: TimeValue; duration: TimeValue; flags: SInt32): OSErr; external name '_LoadMovieIntoRam';
{
 *  LoadTrackIntoRam()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function LoadTrackIntoRam(theTrack: Track; time: TimeValue; duration: TimeValue; flags: SInt32): OSErr; external name '_LoadTrackIntoRam';
{
 *  LoadMediaIntoRam()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function LoadMediaIntoRam(theMedia: Media; time: TimeValue; duration: TimeValue; flags: SInt32): OSErr; external name '_LoadMediaIntoRam';
{
 *  SetMovieActive()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure SetMovieActive(theMovie: Movie; active: boolean); external name '_SetMovieActive';
{
 *  GetMovieActive()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetMovieActive(theMovie: Movie): boolean; external name '_GetMovieActive';
{
 *  QTGetWallClockTimeBase()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 6.0 and later
 *    CarbonLib:        in CarbonLib 1.6 and later
 *    Mac OS X:         in version 10.2 and later
 *    Windows:          in qtmlClient.lib 6.0 and later
 }
function QTGetWallClockTimeBase(var wallClockTimeBase: TimeBase): OSErr; external name '_QTGetWallClockTimeBase';
{************************
* Idle Management
*************************}

type
    IdleManager    = ^SInt32; { an opaque 32-bit type }
    IdleManagerPtr = ^IdleManager;  { when a var xx:IdleManager parameter can be nil, it is changed to xx: IdleManagerPtr }
    {
     *  QTIdleManagerOpen()
     *
     *  Availability:
     *    Non-Carbon CFM:   in QuickTimeLib 6.0 and later
     *    CarbonLib:        in CarbonLib 1.6 and later
     *    Mac OS X:         in version 10.2 and later
     *    Windows:          in qtmlClient.lib 6.0 and later
        }
function QTIdleManagerOpen: IdleManager; external name '_QTIdleManagerOpen';
{
 *  QTIdleManagerClose()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 6.0 and later
 *    CarbonLib:        in CarbonLib 1.6 and later
 *    Mac OS X:         in version 10.2 and later
 *    Windows:          in qtmlClient.lib 6.0 and later
 }
function QTIdleManagerClose(im: IdleManager): OSErr; external name '_QTIdleManagerClose';
{
 *  QTIdleManagerGetNextIdleTime()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 6.0 and later
 *    CarbonLib:        in CarbonLib 1.6 and later
 *    Mac OS X:         in version 10.2 and later
 *    Windows:          in qtmlClient.lib 6.0 and later
 }
function QTIdleManagerGetNextIdleTime(im: IdleManager; var nextIdle: TimeRecord): OSErr; external name '_QTIdleManagerGetNextIdleTime';
{
 *  QTIdleManagerSetNextIdleTime()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 6.0 and later
 *    CarbonLib:        in CarbonLib 1.6 and later
 *    Mac OS X:         in version 10.2 and later
 *    Windows:          in qtmlClient.lib 6.0 and later
 }
function QTIdleManagerSetNextIdleTime(im: IdleManager; var nextIdle: TimeRecord): OSErr; external name '_QTIdleManagerSetNextIdleTime';
{
 *  QTIdleManagerSetNextIdleTimeNever()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 6.0 and later
 *    CarbonLib:        in CarbonLib 1.6 and later
 *    Mac OS X:         in version 10.2 and later
 *    Windows:          in qtmlClient.lib 6.0 and later
 }
function QTIdleManagerSetNextIdleTimeNever(im: IdleManager): OSErr; external name '_QTIdleManagerSetNextIdleTimeNever';
{
 *  QTIdleManagerSetNextIdleTimeNow()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 6.0 and later
 *    CarbonLib:        in CarbonLib 1.6 and later
 *    Mac OS X:         in version 10.2 and later
 *    Windows:          in qtmlClient.lib 6.0 and later
 }
function QTIdleManagerSetNextIdleTimeNow(im: IdleManager): OSErr; external name '_QTIdleManagerSetNextIdleTimeNow';
{
 *  QTIdleManagerSetNextIdleTimeDelta()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 6.0 and later
 *    CarbonLib:        in CarbonLib 1.6 and later
 *    Mac OS X:         in version 10.2 and later
 *    Windows:          in qtmlClient.lib 6.0 and later
 }
function QTIdleManagerSetNextIdleTimeDelta(im: IdleManager; duration: TimeValue; scale: TimeScale): OSErr; external name '_QTIdleManagerSetNextIdleTimeDelta';
{
 *  QTIdleManagerSetParent()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 6.0 and later
 *    CarbonLib:        in CarbonLib 1.6 and later
 *    Mac OS X:         in version 10.2 and later
 *    Windows:          in qtmlClient.lib 6.0 and later
 }
function QTIdleManagerSetParent(im: IdleManager; parent: IdleManager): OSErr; external name '_QTIdleManagerSetParent';
{
 *  QTIdleManagerNeedsAnIdle()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 6.0 and later
 *    CarbonLib:        in CarbonLib 1.6 and later
 *    Mac OS X:         in version 10.2 and later
 *    Windows:          in qtmlClient.lib 6.0 and later
 }
function QTIdleManagerNeedsAnIdle(im: IdleManager; var needsOne: boolean): OSErr; external name '_QTIdleManagerNeedsAnIdle';
{************************
* Carbon Movie Control
*************************}
{  Movie Control option bits }

const
    kMovieControlOptionHideController = $00000001;
    kMovieControlOptionLocateTopLeft = $00000002;
    kMovieControlOptionEnableEditing = $00000004;
    kMovieControlOptionHandleEditingHI = $00000008;
    kMovieControlOptionSetKeysEnabled = $00000010;
    kMovieControlOptionManuallyIdled = $00000020;

    {  Item tags for use in GetControlData() (some with SetControlData()) calls on Movie Controls }
    kMovieControlDataMovieController = $6D632020 (* 'mc  ' *);
    kMovieControlDataMovie      = $6D6F6F76 (* 'moov' *);
    kMovieControlDataManualIdling = $6D616E75 (* 'manu' *);

    {
    ** CreateMovieControl() -   This is the public API routine that creates a Movie Control. Given a window and location
    **                          plus a movie, it constructs a Movie Control with a Movie Controller in the window.
        }
    {
     *  CreateMovieControl()
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.6 and later
     *    Mac OS X:         in version 10.2 and later
        }
function CreateMovieControl(theWindow: WindowRef; var localRect: Rect; theMovie: Movie; options: UInt32; var returnedControl: ControlRef): OSErr; external name '_CreateMovieControl';
{************************
* calls for playing movies, previews, posters
*************************}
{
 *  StartMovie()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure StartMovie(theMovie: Movie); external name '_StartMovie';
{
 *  StopMovie()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure StopMovie(theMovie: Movie); external name '_StopMovie';
{
 *  GoToBeginningOfMovie()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure GoToBeginningOfMovie(theMovie: Movie); external name '_GoToBeginningOfMovie';
{
 *  GoToEndOfMovie()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure GoToEndOfMovie(theMovie: Movie); external name '_GoToEndOfMovie';
{
 *  IsMovieDone()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function IsMovieDone(theMovie: Movie): boolean; external name '_IsMovieDone';
{
 *  GetMoviePreviewMode()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetMoviePreviewMode(theMovie: Movie): boolean; external name '_GetMoviePreviewMode';
{
 *  SetMoviePreviewMode()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure SetMoviePreviewMode(theMovie: Movie; usePreview: boolean); external name '_SetMoviePreviewMode';
{
 *  ShowMoviePoster()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure ShowMoviePoster(theMovie: Movie); external name '_ShowMoviePoster';
{
 *  PlayMoviePreview()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure PlayMoviePreview(theMovie: Movie; callOutProc: MoviePreviewCallOutUPP; refcon: SInt32); external name '_PlayMoviePreview';
{************************
* calls for controlling movies & tracks which are playing
*************************}
{
 *  GetMovieTimeBase()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetMovieTimeBase(theMovie: Movie): TimeBase; external name '_GetMovieTimeBase';
{
 *  SetMovieMasterTimeBase()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure SetMovieMasterTimeBase(theMovie: Movie; tb: TimeBase; const (*var*) slaveZero: TimeRecord); external name '_SetMovieMasterTimeBase';
{
 *  SetMovieMasterClock()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure SetMovieMasterClock(theMovie: Movie; clockMeister: Component; const (*var*) slaveZero: TimeRecord); external name '_SetMovieMasterClock';
{
 *  ChooseMovieClock()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 6.0 and later
 *    CarbonLib:        in CarbonLib 1.6 and later
 *    Mac OS X:         in version 10.2 and later
 *    Windows:          in qtmlClient.lib 6.0 and later
 }
procedure ChooseMovieClock(m: Movie; flags: SInt32); external name '_ChooseMovieClock';
{
 *  GetMovieGWorld()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure GetMovieGWorld(theMovie: Movie; var port: CGrafPtr; var gdh: GDHandle); external name '_GetMovieGWorld';
{
 *  SetMovieGWorld()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure SetMovieGWorld(theMovie: Movie; port: CGrafPtr; gdh: GDHandle); external name '_SetMovieGWorld';
const
    movieDrawingCallWhenChanged = 0;
    movieDrawingCallAlways      = 1;

    {
     *  SetMovieDrawingCompleteProc()
     *
     *  Availability:
     *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
     *    Windows:          in qtmlClient.lib 3.0 and later
        }
procedure SetMovieDrawingCompleteProc(theMovie: Movie; flags: SInt32; proc: MovieDrawingCompleteUPP; refCon: SInt32); external name '_SetMovieDrawingCompleteProc';
{
 *  GetMovieNaturalBoundsRect()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure GetMovieNaturalBoundsRect(theMovie: Movie; var naturalBounds: Rect); external name '_GetMovieNaturalBoundsRect';
{
 *  GetNextTrackForCompositing()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetNextTrackForCompositing(theMovie: Movie; theTrack: Track): Track; external name '_GetNextTrackForCompositing';
{
 *  GetPrevTrackForCompositing()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetPrevTrackForCompositing(theMovie: Movie; theTrack: Track): Track; external name '_GetPrevTrackForCompositing';
{
 *  SetTrackGWorld()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure SetTrackGWorld(theTrack: Track; port: CGrafPtr; gdh: GDHandle; proc: TrackTransferUPP; refCon: SInt32); external name '_SetTrackGWorld';
{
 *  GetMoviePict()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetMoviePict(theMovie: Movie; time: TimeValue): PicHandle; external name '_GetMoviePict';
{
 *  GetTrackPict()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetTrackPict(theTrack: Track; time: TimeValue): PicHandle; external name '_GetTrackPict';
{
 *  GetMoviePosterPict()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetMoviePosterPict(theMovie: Movie): PicHandle; external name '_GetMoviePosterPict';
{ called between Begin & EndUpdate }
{
 *  UpdateMovie()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function UpdateMovie(theMovie: Movie): OSErr; external name '_UpdateMovie';
{
 *  InvalidateMovieRegion()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function InvalidateMovieRegion(theMovie: Movie; invalidRgn: RgnHandle): OSErr; external name '_InvalidateMovieRegion';
{*** spatial movie routines ***}
{
 *  GetMovieBox()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure GetMovieBox(theMovie: Movie; var boxRect: Rect); external name '_GetMovieBox';
{
 *  SetMovieBox()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure SetMovieBox(theMovie: Movie; const (*var*) boxRect: Rect); external name '_SetMovieBox';
{* movie display clip }
{
 *  GetMovieDisplayClipRgn()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetMovieDisplayClipRgn(theMovie: Movie): RgnHandle; external name '_GetMovieDisplayClipRgn';
{
 *  SetMovieDisplayClipRgn()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure SetMovieDisplayClipRgn(theMovie: Movie; theClip: RgnHandle); external name '_SetMovieDisplayClipRgn';
{* movie src clip }
{
 *  GetMovieClipRgn()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetMovieClipRgn(theMovie: Movie): RgnHandle; external name '_GetMovieClipRgn';
{
 *  SetMovieClipRgn()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure SetMovieClipRgn(theMovie: Movie; theClip: RgnHandle); external name '_SetMovieClipRgn';
{* track src clip }
{
 *  GetTrackClipRgn()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetTrackClipRgn(theTrack: Track): RgnHandle; external name '_GetTrackClipRgn';
{
 *  SetTrackClipRgn()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure SetTrackClipRgn(theTrack: Track; theClip: RgnHandle); external name '_SetTrackClipRgn';
{* bounds in display space (not clipped by display clip) }
{
 *  GetMovieDisplayBoundsRgn()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetMovieDisplayBoundsRgn(theMovie: Movie): RgnHandle; external name '_GetMovieDisplayBoundsRgn';
{
 *  GetTrackDisplayBoundsRgn()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetTrackDisplayBoundsRgn(theTrack: Track): RgnHandle; external name '_GetTrackDisplayBoundsRgn';
{* bounds in movie space }
{
 *  GetMovieBoundsRgn()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetMovieBoundsRgn(theMovie: Movie): RgnHandle; external name '_GetMovieBoundsRgn';
{
 *  GetTrackMovieBoundsRgn()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetTrackMovieBoundsRgn(theTrack: Track): RgnHandle; external name '_GetTrackMovieBoundsRgn';
{* bounds in track space }
{
 *  GetTrackBoundsRgn()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetTrackBoundsRgn(theTrack: Track): RgnHandle; external name '_GetTrackBoundsRgn';
{* mattes - always in track space }
{
 *  GetTrackMatte()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetTrackMatte(theTrack: Track): PixMapHandle; external name '_GetTrackMatte';
{
 *  SetTrackMatte()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure SetTrackMatte(theTrack: Track; theMatte: PixMapHandle); external name '_SetTrackMatte';
{
 *  DisposeMatte()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure DisposeMatte(theMatte: PixMapHandle); external name '_DisposeMatte';
{* video out }
{
 *  SetMovieVideoOutput()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 5.0 and later
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 5.0 and later
 }
procedure SetMovieVideoOutput(theMovie: Movie; vout: ComponentInstance); external name '_SetMovieVideoOutput';
{************************
* calls for getting/saving movies
*************************}
{
 *  NewMovie()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function NewMovie(flags: SInt32): Movie; external name '_NewMovie';
{
 *  PutMovieIntoHandle()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function PutMovieIntoHandle(theMovie: Movie; publicMovie: Handle): OSErr; external name '_PutMovieIntoHandle';
{
 *  PutMovieIntoDataFork()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function PutMovieIntoDataFork(theMovie: Movie; fRefNum: SInt16; offset: SInt32; maxSize: SInt32): OSErr; external name '_PutMovieIntoDataFork';
{
 *  PutMovieIntoDataFork64()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function PutMovieIntoDataFork64(theMovie: Movie; fRefNum: SInt32; const (*var*) offset: wide; maxSize: UInt32): OSErr; external name '_PutMovieIntoDataFork64';
{
 *  PutMovieIntoStorage()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 6.0 and later
 *    CarbonLib:        in CarbonLib 1.6 and later
 *    Mac OS X:         in version 10.2 and later
 *    Windows:          in qtmlClient.lib 6.0 and later
 }
function PutMovieIntoStorage(theMovie: Movie; dh: DataHandler; const (*var*) offset: wide; maxSize: UInt32): OSErr; external name '_PutMovieIntoStorage';
{
 *  PutMovieForDataRefIntoHandle()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 6.0 and later
 *    CarbonLib:        in CarbonLib 1.6 and later
 *    Mac OS X:         in version 10.2 and later
 *    Windows:          in qtmlClient.lib 6.0 and later
 }
function PutMovieForDataRefIntoHandle(theMovie: Movie; dataRef: Handle; dataRefType: OSType; publicMovie: Handle): OSErr; external name '_PutMovieForDataRefIntoHandle';
{
 *  DisposeMovie()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure DisposeMovie(theMovie: Movie); external name '_DisposeMovie';
{************************
* Movie State Routines
*************************}
{
 *  GetMovieCreationTime()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetMovieCreationTime(theMovie: Movie): UInt32; external name '_GetMovieCreationTime';
{
 *  GetMovieModificationTime()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetMovieModificationTime(theMovie: Movie): UInt32; external name '_GetMovieModificationTime';
{
 *  GetMovieTimeScale()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetMovieTimeScale(theMovie: Movie): TimeScale; external name '_GetMovieTimeScale';
{
 *  SetMovieTimeScale()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure SetMovieTimeScale(theMovie: Movie; timeScale: TimeScale); external name '_SetMovieTimeScale';
{
 *  GetMovieDuration()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetMovieDuration(theMovie: Movie): TimeValue; external name '_GetMovieDuration';
{
 *  GetMovieRate()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetMovieRate(theMovie: Movie): Fixed; external name '_GetMovieRate';
{
 *  SetMovieRate()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure SetMovieRate(theMovie: Movie; rate: Fixed); external name '_SetMovieRate';
{
 *  GetMoviePreferredRate()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetMoviePreferredRate(theMovie: Movie): Fixed; external name '_GetMoviePreferredRate';
{
 *  SetMoviePreferredRate()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure SetMoviePreferredRate(theMovie: Movie; rate: Fixed); external name '_SetMoviePreferredRate';
{
 *  GetMoviePreferredVolume()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetMoviePreferredVolume(theMovie: Movie): SInt16; external name '_GetMoviePreferredVolume';
{
 *  SetMoviePreferredVolume()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure SetMoviePreferredVolume(theMovie: Movie; volume: SInt16); external name '_SetMoviePreferredVolume';
{
 *  GetMovieVolume()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetMovieVolume(theMovie: Movie): SInt16; external name '_GetMovieVolume';
{
 *  SetMovieVolume()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure SetMovieVolume(theMovie: Movie; volume: SInt16); external name '_SetMovieVolume';
{
 *  GetMovieMatrix()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure GetMovieMatrix(theMovie: Movie; var matrix: MatrixRecord); external name '_GetMovieMatrix';
{
 *  SetMovieMatrix()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure SetMovieMatrix(theMovie: Movie; const (*var*) matrix: MatrixRecord); external name '_SetMovieMatrix';
{
 *  GetMoviePreviewTime()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure GetMoviePreviewTime(theMovie: Movie; var previewTime: TimeValue; var previewDuration: TimeValue); external name '_GetMoviePreviewTime';
{
 *  SetMoviePreviewTime()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure SetMoviePreviewTime(theMovie: Movie; previewTime: TimeValue; previewDuration: TimeValue); external name '_SetMoviePreviewTime';
{
 *  GetMoviePosterTime()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetMoviePosterTime(theMovie: Movie): TimeValue; external name '_GetMoviePosterTime';
{
 *  SetMoviePosterTime()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure SetMoviePosterTime(theMovie: Movie; posterTime: TimeValue); external name '_SetMoviePosterTime';
{
 *  GetMovieSelection()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure GetMovieSelection(theMovie: Movie; var selectionTime: TimeValue; var selectionDuration: TimeValue); external name '_GetMovieSelection';
{
 *  SetMovieSelection()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure SetMovieSelection(theMovie: Movie; selectionTime: TimeValue; selectionDuration: TimeValue); external name '_SetMovieSelection';
{
 *  SetMovieActiveSegment()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure SetMovieActiveSegment(theMovie: Movie; startTime: TimeValue; duration: TimeValue); external name '_SetMovieActiveSegment';
{
 *  GetMovieActiveSegment()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure GetMovieActiveSegment(theMovie: Movie; var startTime: TimeValue; var duration: TimeValue); external name '_GetMovieActiveSegment';
{
 *  GetMovieTime()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetMovieTime(theMovie: Movie; var currentTime: TimeRecord): TimeValue; external name '_GetMovieTime';
{
 *  SetMovieTime()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure SetMovieTime(theMovie: Movie; const (*var*) newtime: TimeRecord); external name '_SetMovieTime';
{
 *  SetMovieTimeValue()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure SetMovieTimeValue(theMovie: Movie; newtime: TimeValue); external name '_SetMovieTimeValue';
{
 *  GetMovieUserData()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetMovieUserData(theMovie: Movie): UserData; external name '_GetMovieUserData';
{
 *  QTGetTimeUntilNextTask()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 6.0 and later
 *    CarbonLib:        in CarbonLib 1.6 and later
 *    Mac OS X:         in version 10.2 and later
 *    Windows:          in qtmlClient.lib 6.0 and later
 }
function QTGetTimeUntilNextTask(var duration: SInt32; scale: SInt32): OSErr; external name '_QTGetTimeUntilNextTask';
{
 *  QTInstallNextTaskNeededSoonerCallback()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 6.0 and later
 *    CarbonLib:        in CarbonLib 1.6 and later
 *    Mac OS X:         in version 10.2 and later
 *    Windows:          in qtmlClient.lib 6.0 and later
 }
function QTInstallNextTaskNeededSoonerCallback(callbackProc: QTNextTaskNeededSoonerCallbackUPP; scale: TimeScale; flags: UInt32; refcon: UnivPtr): OSErr; external name '_QTInstallNextTaskNeededSoonerCallback';
{
 *  QTUninstallNextTaskNeededSoonerCallback()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 6.0 and later
 *    CarbonLib:        in CarbonLib 1.6 and later
 *    Mac OS X:         in version 10.2 and later
 *    Windows:          in qtmlClient.lib 6.0 and later
 }
function QTUninstallNextTaskNeededSoonerCallback(callbackProc: QTNextTaskNeededSoonerCallbackUPP; refcon: UnivPtr): OSErr; external name '_QTUninstallNextTaskNeededSoonerCallback';
{************************
* Track/Media finding routines
*************************}
{
 *  GetMovieTrackCount()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetMovieTrackCount(theMovie: Movie): SInt32; external name '_GetMovieTrackCount';
{
 *  GetMovieTrack()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetMovieTrack(theMovie: Movie; trackID: SInt32): Track; external name '_GetMovieTrack';
{
 *  GetMovieIndTrack()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetMovieIndTrack(theMovie: Movie; index: SInt32): Track; external name '_GetMovieIndTrack';
{
 *  GetMovieIndTrackType()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetMovieIndTrackType(theMovie: Movie; index: SInt32; trackType: OSType; flags: SInt32): Track; external name '_GetMovieIndTrackType';
{
 *  GetTrackID()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetTrackID(theTrack: Track): SInt32; external name '_GetTrackID';
{
 *  GetTrackMovie()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetTrackMovie(theTrack: Track): Movie; external name '_GetTrackMovie';
{************************
* Track creation routines
*************************}
{
 *  NewMovieTrack()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function NewMovieTrack(theMovie: Movie; width: Fixed; height: Fixed; trackVolume: SInt16): Track; external name '_NewMovieTrack';
{
 *  DisposeMovieTrack()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure DisposeMovieTrack(theTrack: Track); external name '_DisposeMovieTrack';
{************************
* Track State routines
*************************}
{
 *  GetTrackCreationTime()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetTrackCreationTime(theTrack: Track): UInt32; external name '_GetTrackCreationTime';
{
 *  GetTrackModificationTime()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetTrackModificationTime(theTrack: Track): UInt32; external name '_GetTrackModificationTime';
{
 *  GetTrackEnabled()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetTrackEnabled(theTrack: Track): boolean; external name '_GetTrackEnabled';
{
 *  SetTrackEnabled()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure SetTrackEnabled(theTrack: Track; isEnabled: boolean); external name '_SetTrackEnabled';
{
 *  GetTrackUsage()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetTrackUsage(theTrack: Track): SInt32; external name '_GetTrackUsage';
{
 *  SetTrackUsage()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure SetTrackUsage(theTrack: Track; usage: SInt32); external name '_SetTrackUsage';
{
 *  GetTrackDuration()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetTrackDuration(theTrack: Track): TimeValue; external name '_GetTrackDuration';
{
 *  GetTrackOffset()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetTrackOffset(theTrack: Track): TimeValue; external name '_GetTrackOffset';
{
 *  SetTrackOffset()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure SetTrackOffset(theTrack: Track; movieOffsetTime: TimeValue); external name '_SetTrackOffset';
{
 *  GetTrackLayer()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetTrackLayer(theTrack: Track): SInt16; external name '_GetTrackLayer';
{
 *  SetTrackLayer()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure SetTrackLayer(theTrack: Track; layer: SInt16); external name '_SetTrackLayer';
{
 *  GetTrackAlternate()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetTrackAlternate(theTrack: Track): Track; external name '_GetTrackAlternate';
{
 *  SetTrackAlternate()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure SetTrackAlternate(theTrack: Track; alternateT: Track); external name '_SetTrackAlternate';
{
 *  SetAutoTrackAlternatesEnabled()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure SetAutoTrackAlternatesEnabled(theMovie: Movie; enable: boolean); external name '_SetAutoTrackAlternatesEnabled';
{
 *  SelectMovieAlternates()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure SelectMovieAlternates(theMovie: Movie); external name '_SelectMovieAlternates';
{
 *  GetTrackVolume()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetTrackVolume(theTrack: Track): SInt16; external name '_GetTrackVolume';
{
 *  SetTrackVolume()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure SetTrackVolume(theTrack: Track; volume: SInt16); external name '_SetTrackVolume';
{
 *  GetTrackMatrix()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure GetTrackMatrix(theTrack: Track; var matrix: MatrixRecord); external name '_GetTrackMatrix';
{
 *  SetTrackMatrix()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure SetTrackMatrix(theTrack: Track; const (*var*) matrix: MatrixRecord); external name '_SetTrackMatrix';
{
 *  GetTrackDimensions()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure GetTrackDimensions(theTrack: Track; var width: Fixed; var height: Fixed); external name '_GetTrackDimensions';
{
 *  SetTrackDimensions()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure SetTrackDimensions(theTrack: Track; width: Fixed; height: Fixed); external name '_SetTrackDimensions';
{
 *  GetTrackUserData()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetTrackUserData(theTrack: Track): UserData; external name '_GetTrackUserData';
{
 *  GetTrackDisplayMatrix()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetTrackDisplayMatrix(theTrack: Track; var matrix: MatrixRecord): OSErr; external name '_GetTrackDisplayMatrix';
{
 *  GetTrackSoundLocalizationSettings()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetTrackSoundLocalizationSettings(theTrack: Track; var settings: Handle): OSErr; external name '_GetTrackSoundLocalizationSettings';
{
 *  SetTrackSoundLocalizationSettings()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SetTrackSoundLocalizationSettings(theTrack: Track; settings: Handle): OSErr; external name '_SetTrackSoundLocalizationSettings';
{************************
* get Media routines
*************************}
{
 *  NewTrackMedia()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function NewTrackMedia(theTrack: Track; mediaType: OSType; timeScale: TimeScale; dataRef: Handle; dataRefType: OSType): Media; external name '_NewTrackMedia';
{
 *  DisposeTrackMedia()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure DisposeTrackMedia(theMedia: Media); external name '_DisposeTrackMedia';
{
 *  GetTrackMedia()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetTrackMedia(theTrack: Track): Media; external name '_GetTrackMedia';
{
 *  GetMediaTrack()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetMediaTrack(theMedia: Media): Track; external name '_GetMediaTrack';
{************************
* Media State routines
*************************}
{
 *  GetMediaCreationTime()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetMediaCreationTime(theMedia: Media): UInt32; external name '_GetMediaCreationTime';
{
 *  GetMediaModificationTime()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetMediaModificationTime(theMedia: Media): UInt32; external name '_GetMediaModificationTime';
{
 *  GetMediaTimeScale()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetMediaTimeScale(theMedia: Media): TimeScale; external name '_GetMediaTimeScale';
{
 *  SetMediaTimeScale()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure SetMediaTimeScale(theMedia: Media; timeScale: TimeScale); external name '_SetMediaTimeScale';
{
 *  GetMediaDuration()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetMediaDuration(theMedia: Media): TimeValue; external name '_GetMediaDuration';
{
 *  GetMediaLanguage()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetMediaLanguage(theMedia: Media): SInt16; external name '_GetMediaLanguage';
{
 *  SetMediaLanguage()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure SetMediaLanguage(theMedia: Media; language: SInt16); external name '_SetMediaLanguage';
{
 *  GetMediaQuality()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetMediaQuality(theMedia: Media): SInt16; external name '_GetMediaQuality';
{
 *  SetMediaQuality()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure SetMediaQuality(theMedia: Media; quality: SInt16); external name '_SetMediaQuality';
{
 *  GetMediaHandlerDescription()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure GetMediaHandlerDescription(theMedia: Media; var mediaType: OSType; var creatorName: Str255; var creatorManufacturer: OSType); external name '_GetMediaHandlerDescription';
{
 *  GetMediaUserData()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetMediaUserData(theMedia: Media): UserData; external name '_GetMediaUserData';
{
 *  GetMediaInputMap()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetMediaInputMap(theMedia: Media; var inputMap: QTAtomContainer): OSErr; external name '_GetMediaInputMap';
{
 *  SetMediaInputMap()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SetMediaInputMap(theMedia: Media; inputMap: QTAtomContainer): OSErr; external name '_SetMediaInputMap';
{************************
* Media Handler routines
*************************}
{
 *  GetMediaHandler()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetMediaHandler(theMedia: Media): MediaHandler; external name '_GetMediaHandler';
{
 *  SetMediaHandler()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SetMediaHandler(theMedia: Media; mH: MediaHandlerComponent): OSErr; external name '_SetMediaHandler';
{************************
* Media's Data routines
*************************}
{
 *  BeginMediaEdits()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function BeginMediaEdits(theMedia: Media): OSErr; external name '_BeginMediaEdits';
{
 *  EndMediaEdits()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function EndMediaEdits(theMedia: Media): OSErr; external name '_EndMediaEdits';
{
 *  SetMediaDefaultDataRefIndex()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SetMediaDefaultDataRefIndex(theMedia: Media; index: SInt16): OSErr; external name '_SetMediaDefaultDataRefIndex';
{
 *  GetMediaDataHandlerDescription()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure GetMediaDataHandlerDescription(theMedia: Media; index: SInt16; var dhType: OSType; var creatorName: Str255; var creatorManufacturer: OSType); external name '_GetMediaDataHandlerDescription';
{
 *  GetMediaDataHandler()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetMediaDataHandler(theMedia: Media; index: SInt16): DataHandler; external name '_GetMediaDataHandler';
{
 *  SetMediaDataHandler()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SetMediaDataHandler(theMedia: Media; index: SInt16; dataHandler: DataHandlerComponent): OSErr; external name '_SetMediaDataHandler';
{
 *  GetDataHandler()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetDataHandler(dataRef: Handle; dataHandlerSubType: OSType; flags: SInt32): Component; external name '_GetDataHandler';
{
 *  OpenADataHandler()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.1 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.1 and later
 }
function OpenADataHandler(dataRef: Handle; dataHandlerSubType: OSType; anchorDataRef: Handle; anchorDataRefType: OSType; tb: TimeBase; flags: SInt32; var dh: ComponentInstance): OSErr; external name '_OpenADataHandler';
{************************
* Media Sample Table Routines
*************************}
{
 *  GetMediaSampleDescriptionCount()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetMediaSampleDescriptionCount(theMedia: Media): SInt32; external name '_GetMediaSampleDescriptionCount';
{
 *  GetMediaSampleDescription()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure GetMediaSampleDescription(theMedia: Media; index: SInt32; descH: SampleDescriptionHandle); external name '_GetMediaSampleDescription';
{
 *  SetMediaSampleDescription()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SetMediaSampleDescription(theMedia: Media; index: SInt32; descH: SampleDescriptionHandle): OSErr; external name '_SetMediaSampleDescription';
{
 *  GetMediaSampleCount()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetMediaSampleCount(theMedia: Media): SInt32; external name '_GetMediaSampleCount';
{
 *  GetMediaSyncSampleCount()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetMediaSyncSampleCount(theMedia: Media): SInt32; external name '_GetMediaSyncSampleCount';
{
 *  SampleNumToMediaTime()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure SampleNumToMediaTime(theMedia: Media; logicalSampleNum: SInt32; var sampleTime: TimeValue; var sampleDuration: TimeValue); external name '_SampleNumToMediaTime';
{
 *  MediaTimeToSampleNum()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure MediaTimeToSampleNum(theMedia: Media; time: TimeValue; var sampleNum: SInt32; var sampleTime: TimeValue; var sampleDuration: TimeValue); external name '_MediaTimeToSampleNum';
{
 *  AddMediaSample()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function AddMediaSample(theMedia: Media; dataIn: Handle; inOffset: SInt32; size: UInt32; durationPerSample: TimeValue; sampleDescriptionH: SampleDescriptionHandle; numberOfSamples: SInt32; sampleFlags: SInt16; var sampleTime: TimeValue): OSErr; external name '_AddMediaSample';
{
 *  AddMediaSampleReference()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function AddMediaSampleReference(theMedia: Media; dataOffset: SInt32; size: UInt32; durationPerSample: TimeValue; sampleDescriptionH: SampleDescriptionHandle; numberOfSamples: SInt32; sampleFlags: SInt16; var sampleTime: TimeValue): OSErr; external name '_AddMediaSampleReference';
{
 *  AddMediaSampleReferences()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function AddMediaSampleReferences(theMedia: Media; sampleDescriptionH: SampleDescriptionHandle; numberOfSamples: SInt32; sampleRefs: SampleReferencePtr; var sampleTime: TimeValue): OSErr; external name '_AddMediaSampleReferences';
{
 *  AddMediaSampleReferences64()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function AddMediaSampleReferences64(theMedia: Media; sampleDescriptionH: SampleDescriptionHandle; numberOfSamples: SInt32; sampleRefs: SampleReference64Ptr; var sampleTime: TimeValue): OSErr; external name '_AddMediaSampleReferences64';
{
 *  GetMediaSample()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetMediaSample(theMedia: Media; dataOut: Handle; maxSizeToGrow: SInt32; var size: SInt32; time: TimeValue; var sampleTime: TimeValue; var durationPerSample: TimeValue; sampleDescriptionH: SampleDescriptionHandle; var sampleDescriptionIndex: SInt32; maxNumberOfSamples: SInt32; var numberOfSamples: SInt32; var sampleFlags: SInt16): OSErr; external name '_GetMediaSample';
{
 *  GetMediaSampleReference()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetMediaSampleReference(theMedia: Media; var dataOffset: SInt32; var size: SInt32; time: TimeValue; var sampleTime: TimeValue; var durationPerSample: TimeValue; sampleDescriptionH: SampleDescriptionHandle; var sampleDescriptionIndex: SInt32; maxNumberOfSamples: SInt32; var numberOfSamples: SInt32; var sampleFlags: SInt16): OSErr; external name '_GetMediaSampleReference';
{
 *  GetMediaSampleReferences()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetMediaSampleReferences(theMedia: Media; time: TimeValue; var sampleTime: TimeValue; sampleDescriptionH: SampleDescriptionHandle; var sampleDescriptionIndex: SInt32; maxNumberOfEntries: SInt32; var actualNumberofEntries: SInt32; sampleRefs: SampleReferencePtr): OSErr; external name '_GetMediaSampleReferences';
{
 *  GetMediaSampleReferences64()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function GetMediaSampleReferences64(theMedia: Media; time: TimeValue; var sampleTime: TimeValue; sampleDescriptionH: SampleDescriptionHandle; var sampleDescriptionIndex: SInt32; maxNumberOfEntries: SInt32; var actualNumberofEntries: SInt32; sampleRefs: SampleReference64Ptr): OSErr; external name '_GetMediaSampleReferences64';
{
 *  SetMediaPreferredChunkSize()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SetMediaPreferredChunkSize(theMedia: Media; maxChunkSize: SInt32): OSErr; external name '_SetMediaPreferredChunkSize';
{
 *  GetMediaPreferredChunkSize()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetMediaPreferredChunkSize(theMedia: Media; var maxChunkSize: SInt32): OSErr; external name '_GetMediaPreferredChunkSize';
{
 *  SetMediaShadowSync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SetMediaShadowSync(theMedia: Media; frameDiffSampleNum: SInt32; syncSampleNum: SInt32): OSErr; external name '_SetMediaShadowSync';
{
 *  GetMediaShadowSync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetMediaShadowSync(theMedia: Media; frameDiffSampleNum: SInt32; var syncSampleNum: SInt32): OSErr; external name '_GetMediaShadowSync';
{************************
* Editing Routines
*************************}
{
 *  InsertMediaIntoTrack()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function InsertMediaIntoTrack(theTrack: Track; trackStart: TimeValue; mediaTime: TimeValue; mediaDuration: TimeValue; mediaRate: Fixed): OSErr; external name '_InsertMediaIntoTrack';
{
 *  InsertTrackSegment()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function InsertTrackSegment(srcTrack: Track; dstTrack: Track; srcIn: TimeValue; srcDuration: TimeValue; dstIn: TimeValue): OSErr; external name '_InsertTrackSegment';
{
 *  InsertMovieSegment()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function InsertMovieSegment(srcMovie: Movie; dstMovie: Movie; srcIn: TimeValue; srcDuration: TimeValue; dstIn: TimeValue): OSErr; external name '_InsertMovieSegment';
{
 *  InsertEmptyTrackSegment()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function InsertEmptyTrackSegment(dstTrack: Track; dstIn: TimeValue; dstDuration: TimeValue): OSErr; external name '_InsertEmptyTrackSegment';
{
 *  InsertEmptyMovieSegment()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function InsertEmptyMovieSegment(dstMovie: Movie; dstIn: TimeValue; dstDuration: TimeValue): OSErr; external name '_InsertEmptyMovieSegment';
{
 *  DeleteTrackSegment()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function DeleteTrackSegment(theTrack: Track; startTime: TimeValue; duration: TimeValue): OSErr; external name '_DeleteTrackSegment';
{
 *  DeleteMovieSegment()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function DeleteMovieSegment(theMovie: Movie; startTime: TimeValue; duration: TimeValue): OSErr; external name '_DeleteMovieSegment';
{
 *  ScaleTrackSegment()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function ScaleTrackSegment(theTrack: Track; startTime: TimeValue; oldDuration: TimeValue; newDuration: TimeValue): OSErr; external name '_ScaleTrackSegment';
{
 *  ScaleMovieSegment()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function ScaleMovieSegment(theMovie: Movie; startTime: TimeValue; oldDuration: TimeValue; newDuration: TimeValue): OSErr; external name '_ScaleMovieSegment';
{************************
* Hi-level Editing Routines
*************************}
{
 *  CutMovieSelection()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function CutMovieSelection(theMovie: Movie): Movie; external name '_CutMovieSelection';
{
 *  CopyMovieSelection()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function CopyMovieSelection(theMovie: Movie): Movie; external name '_CopyMovieSelection';
{
 *  PasteMovieSelection()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure PasteMovieSelection(theMovie: Movie; src: Movie); external name '_PasteMovieSelection';
{
 *  AddMovieSelection()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure AddMovieSelection(theMovie: Movie; src: Movie); external name '_AddMovieSelection';
{
 *  ClearMovieSelection()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure ClearMovieSelection(theMovie: Movie); external name '_ClearMovieSelection';
{
 *  PasteHandleIntoMovie()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function PasteHandleIntoMovie(h: Handle; handleType: OSType; theMovie: Movie; flags: SInt32; userComp: ComponentInstance): OSErr; external name '_PasteHandleIntoMovie';
{
 *  PutMovieIntoTypedHandle()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function PutMovieIntoTypedHandle(theMovie: Movie; targetTrack: Track; handleType: OSType; publicMovie: Handle; start: TimeValue; dur: TimeValue; flags: SInt32; userComp: ComponentInstance): OSErr; external name '_PutMovieIntoTypedHandle';
{
 *  IsScrapMovie()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function IsScrapMovie(targetTrack: Track): Component; external name '_IsScrapMovie';
{************************
* Middle-level Editing Routines
*************************}
{
 *  CopyTrackSettings()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function CopyTrackSettings(srcTrack: Track; dstTrack: Track): OSErr; external name '_CopyTrackSettings';
{
 *  CopyMovieSettings()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function CopyMovieSettings(srcMovie: Movie; dstMovie: Movie): OSErr; external name '_CopyMovieSettings';
{
 *  AddEmptyTrackToMovie()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function AddEmptyTrackToMovie(srcTrack: Track; dstMovie: Movie; dataRef: Handle; dataRefType: OSType; var dstTrack: Track): OSErr; external name '_AddEmptyTrackToMovie';
const
    kQTCloneShareSamples        = $01;
    kQTCloneDontCopyEdits       = $02;

    {
     *  AddClonedTrackToMovie()
     *
     *  Availability:
     *    Non-Carbon CFM:   in QuickTimeLib 5.0 and later
     *    CarbonLib:        in CarbonLib 1.3 and later
     *    Mac OS X:         in version 10.0 and later
     *    Windows:          in qtmlClient.lib 5.0 and later
        }
function AddClonedTrackToMovie(srcTrack: Track; dstMovie: Movie; flags: SInt32; var dstTrack: Track): OSErr; external name '_AddClonedTrackToMovie';
{************************
* movie & track edit state routines
*************************}
{
 *  NewMovieEditState()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function NewMovieEditState(theMovie: Movie): MovieEditState; external name '_NewMovieEditState';
{
 *  UseMovieEditState()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function UseMovieEditState(theMovie: Movie; toState: MovieEditState): OSErr; external name '_UseMovieEditState';
{
 *  DisposeMovieEditState()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function DisposeMovieEditState(state: MovieEditState): OSErr; external name '_DisposeMovieEditState';
{
 *  NewTrackEditState()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function NewTrackEditState(theTrack: Track): TrackEditState; external name '_NewTrackEditState';
{
 *  UseTrackEditState()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function UseTrackEditState(theTrack: Track; state: TrackEditState): OSErr; external name '_UseTrackEditState';
{
 *  DisposeTrackEditState()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function DisposeTrackEditState(state: TrackEditState): OSErr; external name '_DisposeTrackEditState';
{************************
* track reference routines
*************************}
{
 *  AddTrackReference()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function AddTrackReference(theTrack: Track; refTrack: Track; refType: OSType; var addedIndex: SInt32): OSErr; external name '_AddTrackReference';
{
 *  DeleteTrackReference()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function DeleteTrackReference(theTrack: Track; refType: OSType; index: SInt32): OSErr; external name '_DeleteTrackReference';
{
 *  SetTrackReference()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SetTrackReference(theTrack: Track; refTrack: Track; refType: OSType; index: SInt32): OSErr; external name '_SetTrackReference';
{
 *  GetTrackReference()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetTrackReference(theTrack: Track; refType: OSType; index: SInt32): Track; external name '_GetTrackReference';
{
 *  GetNextTrackReferenceType()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetNextTrackReferenceType(theTrack: Track; refType: OSType): SInt32; external name '_GetNextTrackReferenceType';
{
 *  GetTrackReferenceCount()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetTrackReferenceCount(theTrack: Track; refType: OSType): SInt32; external name '_GetTrackReferenceCount';
{************************
* high level file conversion routines
*************************}
{
 *  ConvertFileToMovieFile()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function ConvertFileToMovieFile(const (*var*) inputFile: FSSpec; const (*var*) outputFile: FSSpec; creator: OSType; scriptTag: ScriptCode; var resID: SInt16; flags: SInt32; userComp: ComponentInstance; proc: MovieProgressUPP; refCon: SInt32): OSErr; external name '_ConvertFileToMovieFile';
{
 *  ConvertMovieToFile()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function ConvertMovieToFile(theMovie: Movie; onlyTrack: Track; var outputFile: FSSpec; fileType: OSType; creator: OSType; scriptTag: ScriptCode; var resID: SInt16; flags: SInt32; userComp: ComponentInstance): OSErr; external name '_ConvertMovieToFile';
const
    kGetMovieImporterValidateToFind = $00000001;
    kGetMovieImporterAllowNewFile = $00000002;
    kGetMovieImporterDontConsiderGraphicsImporters = $00000004;
    kGetMovieImporterDontConsiderFileOnlyImporters = $00000040;
    kGetMovieImporterAutoImportOnly = $00000400;                {  reject aggressive movie importers which have dontAutoFileMovieImport set }

    {
     *  GetMovieImporterForDataRef()
     *
     *  Availability:
     *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
     *    Windows:          in qtmlClient.lib 3.0 and later
        }
function GetMovieImporterForDataRef(dataRefType: OSType; dataRef: Handle; flags: SInt32; var importer: Component): OSErr; external name '_GetMovieImporterForDataRef';
const
    kQTGetMIMETypeInfoIsQuickTimeMovieType = $6D6F6F76 (* 'moov' *);            {  info is a pointer to a Boolean }
    kQTGetMIMETypeInfoIsUnhelpfulType = $64756D62 (* 'dumb' *);                 {  info is a pointer to a Boolean }

    {
     *  QTGetMIMETypeInfo()
     *
     *  Availability:
     *    Non-Carbon CFM:   in QuickTimeLib 5.0 and later
     *    CarbonLib:        in CarbonLib 1.3 and later
     *    Mac OS X:         in version 10.0 and later
     *    Windows:          in qtmlClient.lib 5.0 and later
        }
function QTGetMIMETypeInfo(mimeStringStart: ConstCStringPtr; mimeStringLength: SInt16; infoSelector: OSType; infoDataPtr: UnivPtr; var infoDataSize: SInt32): OSErr; external name '_QTGetMIMETypeInfo';
{************************
* Movie Timebase Conversion Routines
*************************}
{
 *  TrackTimeToMediaTime()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function TrackTimeToMediaTime(value: TimeValue; theTrack: Track): TimeValue; external name '_TrackTimeToMediaTime';
{
 *  GetTrackEditRate()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetTrackEditRate(theTrack: Track; atTime: TimeValue): Fixed; external name '_GetTrackEditRate';
{************************
* Miscellaneous Routines
*************************}

{
 *  GetMovieDataSize()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetMovieDataSize(theMovie: Movie; startTime: TimeValue; duration: TimeValue): SInt32; external name '_GetMovieDataSize';
{
 *  GetMovieDataSize64()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function GetMovieDataSize64(theMovie: Movie; startTime: TimeValue; duration: TimeValue; var dataSize: wide): OSErr; external name '_GetMovieDataSize64';
{
 *  GetTrackDataSize()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetTrackDataSize(theTrack: Track; startTime: TimeValue; duration: TimeValue): SInt32; external name '_GetTrackDataSize';
{
 *  GetTrackDataSize64()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function GetTrackDataSize64(theTrack: Track; startTime: TimeValue; duration: TimeValue; var dataSize: wide): OSErr; external name '_GetTrackDataSize64';
{
 *  GetMediaDataSize()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetMediaDataSize(theMedia: Media; startTime: TimeValue; duration: TimeValue): SInt32; external name '_GetMediaDataSize';
{
 *  GetMediaDataSize64()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function GetMediaDataSize64(theMedia: Media; startTime: TimeValue; duration: TimeValue; var dataSize: wide): OSErr; external name '_GetMediaDataSize64';
{
 *  PtInMovie()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function PtInMovie(theMovie: Movie; pt: Point): boolean; external name '_PtInMovie';
{
 *  PtInTrack()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function PtInTrack(theTrack: Track; pt: Point): boolean; external name '_PtInTrack';
{************************
* Group Selection Routines
*************************}

{
 *  SetMovieLanguage()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure SetMovieLanguage(theMovie: Movie; language: SInt32); external name '_SetMovieLanguage';
{************************
* User Data
*************************}

{
 *  GetUserData()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetUserData(theUserData: UserData; data: Handle; udType: OSType; index: SInt32): OSErr; external name '_GetUserData';
{
 *  AddUserData()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function AddUserData(theUserData: UserData; data: Handle; udType: OSType): OSErr; external name '_AddUserData';
{
 *  RemoveUserData()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function RemoveUserData(theUserData: UserData; udType: OSType; index: SInt32): OSErr; external name '_RemoveUserData';
{
 *  CountUserDataType()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function CountUserDataType(theUserData: UserData; udType: OSType): SInt16; external name '_CountUserDataType';
{
 *  GetNextUserDataType()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetNextUserDataType(theUserData: UserData; udType: OSType): SInt32; external name '_GetNextUserDataType';
{
 *  GetUserDataItem()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetUserDataItem(theUserData: UserData; data: UnivPtr; size: SInt32; udType: OSType; index: SInt32): OSErr; external name '_GetUserDataItem';
{
 *  SetUserDataItem()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SetUserDataItem(theUserData: UserData; data: UnivPtr; size: SInt32; udType: OSType; index: SInt32): OSErr; external name '_SetUserDataItem';
{
 *  AddUserDataText()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function AddUserDataText(theUserData: UserData; data: Handle; udType: OSType; index: SInt32; itlRegionTag: SInt16): OSErr; external name '_AddUserDataText';
{
 *  GetUserDataText()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetUserDataText(theUserData: UserData; data: Handle; udType: OSType; index: SInt32; itlRegionTag: SInt16): OSErr; external name '_GetUserDataText';
{
 *  RemoveUserDataText()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function RemoveUserDataText(theUserData: UserData; udType: OSType; index: SInt32; itlRegionTag: SInt16): OSErr; external name '_RemoveUserDataText';
{
 *  NewUserData()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function NewUserData(var theUserData: UserData): OSErr; external name '_NewUserData';
{
 *  DisposeUserData()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function DisposeUserData(theUserData: UserData): OSErr; external name '_DisposeUserData';
{
 *  NewUserDataFromHandle()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function NewUserDataFromHandle(h: Handle; var theUserData: UserData): OSErr; external name '_NewUserDataFromHandle';
{
 *  PutUserDataIntoHandle()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function PutUserDataIntoHandle(theUserData: UserData; h: Handle): OSErr; external name '_PutUserDataIntoHandle';
const
    kQTCopyUserDataReplace      = $72706C63 (* 'rplc' *);                       {  Delete all destination user data items and then add source user data items  }
    kQTCopyUserDataMerge        = $6D657267 (* 'merg' *);                       {  Add source user data items to destination user data  }

    {
     *  CopyMovieUserData()
     *
     *  Availability:
     *    Non-Carbon CFM:   in QuickTimeLib 6.0 and later
     *    CarbonLib:        in CarbonLib 1.6 and later
     *    Mac OS X:         in version 10.2 and later
     *    Windows:          in qtmlClient.lib 6.0 and later
        }
function CopyMovieUserData(srcMovie: Movie; dstMovie: Movie; copyRule: OSType): OSErr; external name '_CopyMovieUserData';
{
 *  CopyTrackUserData()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 6.0 and later
 *    CarbonLib:        in CarbonLib 1.6 and later
 *    Mac OS X:         in version 10.2 and later
 *    Windows:          in qtmlClient.lib 6.0 and later
 }
function CopyTrackUserData(srcTrack: Track; dstTrack: Track; copyRule: OSType): OSErr; external name '_CopyTrackUserData';
{
 *  CopyMediaUserData()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 6.0 and later
 *    CarbonLib:        in CarbonLib 1.6 and later
 *    Mac OS X:         in version 10.2 and later
 *    Windows:          in qtmlClient.lib 6.0 and later
 }
function CopyMediaUserData(srcMedia: Media; dstMedia: Media; copyRule: OSType): OSErr; external name '_CopyMediaUserData';
{
 *  CopyUserData()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 6.0 and later
 *    CarbonLib:        in CarbonLib 1.6 and later
 *    Mac OS X:         in version 10.2 and later
 *    Windows:          in qtmlClient.lib 6.0 and later
 }
function CopyUserData(srcUserData: UserData; dstUserData: UserData; copyRule: OSType): OSErr; external name '_CopyUserData';
{
 *  SetMoviePropertyAtom()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.1 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.1 and later
 }
function SetMoviePropertyAtom(theMovie: Movie; propertyAtom: QTAtomContainer): OSErr; external name '_SetMoviePropertyAtom';
{
 *  GetMoviePropertyAtom()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.1 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.1 and later
 }
function GetMoviePropertyAtom(theMovie: Movie; var propertyAtom: QTAtomContainer): OSErr; external name '_GetMoviePropertyAtom';
{
 *  GetMediaNextInterestingTime()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure GetMediaNextInterestingTime(theMedia: Media; interestingTimeFlags: SInt16; time: TimeValue; rate: Fixed; var interestingTime: TimeValue; var interestingDuration: TimeValue); external name '_GetMediaNextInterestingTime';
{
 *  GetTrackNextInterestingTime()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure GetTrackNextInterestingTime(theTrack: Track; interestingTimeFlags: SInt16; time: TimeValue; rate: Fixed; var interestingTime: TimeValue; var interestingDuration: TimeValue); external name '_GetTrackNextInterestingTime';
{
 *  GetMovieNextInterestingTime()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure GetMovieNextInterestingTime(theMovie: Movie; interestingTimeFlags: SInt16; numMediaTypes: SInt16; whichMediaTypes: OSTypePtr; time: TimeValue; rate: Fixed; var interestingTime: TimeValue; var interestingDuration: TimeValue); external name '_GetMovieNextInterestingTime';
{
 *  CreateMovieFile()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function CreateMovieFile(const (*var*) fileSpec: FSSpec; creator: OSType; scriptTag: ScriptCode; createMovieFileFlags: SInt32; var resRefNum: SInt16; var newmovie: Movie): OSErr; external name '_CreateMovieFile';
{
 *  OpenMovieFile()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function OpenMovieFile(const (*var*) fileSpec: FSSpec; var resRefNum: SInt16; permission: SInt8): OSErr; external name '_OpenMovieFile';
{
 *  CloseMovieFile()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function CloseMovieFile(resRefNum: SInt16): OSErr; external name '_CloseMovieFile';
{
 *  DeleteMovieFile()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function DeleteMovieFile(const (*var*) fileSpec: FSSpec): OSErr; external name '_DeleteMovieFile';
{
 *  NewMovieFromFile()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function NewMovieFromFile(var theMovie: Movie; resRefNum: SInt16; resId: SInt16Ptr; resName: StringPtr; newMovieFlags: SInt16; dataRefWasChanged: BooleanPtr): OSErr; external name '_NewMovieFromFile';
{
 *  NewMovieFromHandle()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function NewMovieFromHandle(var theMovie: Movie; h: Handle; newMovieFlags: SInt16; var dataRefWasChanged: boolean): OSErr; external name '_NewMovieFromHandle';
{
 *  NewMovieFromDataFork()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function NewMovieFromDataFork(var theMovie: Movie; fRefNum: SInt16; fileOffset: SInt32; newMovieFlags: SInt16; var dataRefWasChanged: boolean): OSErr; external name '_NewMovieFromDataFork';
{
 *  NewMovieFromDataFork64()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function NewMovieFromDataFork64(var theMovie: Movie; fRefNum: SInt32; const (*var*) fileOffset: wide; newMovieFlags: SInt16; var dataRefWasChanged: boolean): OSErr; external name '_NewMovieFromDataFork64';
{
 *  NewMovieFromUserProc()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function NewMovieFromUserProc(var m: Movie; flags: SInt16; var dataRefWasChanged: boolean; getProc: GetMovieUPP; refCon: UnivPtr; defaultDataRef: Handle; dataRefType: OSType): OSErr; external name '_NewMovieFromUserProc';
{
 *  NewMovieFromDataRef()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function NewMovieFromDataRef(var m: Movie; flags: SInt16; var id: SInt16; dataRef: Handle; dtaRefType: OSType): OSErr; external name '_NewMovieFromDataRef';
{
 *  NewMovieFromStorageOffset()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 6.0 and later
 *    CarbonLib:        in CarbonLib 1.6 and later
 *    Mac OS X:         in version 10.2 and later
 *    Windows:          in qtmlClient.lib 6.0 and later
 }
function NewMovieFromStorageOffset(var theMovie: Movie; dh: DataHandler; const (*var*) fileOffset: wide; newMovieFlags: SInt16; var dataRefWasCataRefType: boolean): OSErr; external name '_NewMovieFromStorageOffset';
{
 *  NewMovieForDataRefFromHandle()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 6.0 and later
 *    CarbonLib:        in CarbonLib 1.6 and later
 *    Mac OS X:         in version 10.2 and later
 *    Windows:          in qtmlClient.lib 6.0 and later
 }
function NewMovieForDataRefFromHandle(var theMovie: Movie; h: Handle; newMovieFlags: SInt16; var dataRefWasChanged: boolean; dataRef: Handle; dataRefType: OSType): OSErr; external name '_NewMovieForDataRefFromHandle';
{
 *  AddMovieResource()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function AddMovieResource(theMovie: Movie; resRefNum: SInt16; var resId: SInt16; const (*var*) resName: Str255): OSErr; external name '_AddMovieResource';
{
 *  UpdateMovieResource()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function UpdateMovieResource(theMovie: Movie; resRefNum: SInt16; resId: SInt16; const (*var*) resName: Str255): OSErr; external name '_UpdateMovieResource';
{
 *  RemoveMovieResource()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function RemoveMovieResource(resRefNum: SInt16; resId: SInt16): OSErr; external name '_RemoveMovieResource';
{
 *  CreateMovieStorage()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 6.0 and later
 *    CarbonLib:        in CarbonLib 1.6 and later
 *    Mac OS X:         in version 10.2 and later
 *    Windows:          in qtmlClient.lib 6.0 and later
 }
function CreateMovieStorage(dataRef: Handle; dataRefType: OSType; creator: OSType; scriptTag: ScriptCode; createMovieFileFlags: SInt32; var outDataHandler: DataHandler; var newmovie: Movie): OSErr; external name '_CreateMovieStorage';
{
 *  OpenMovieStorage()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 6.0 and later
 *    CarbonLib:        in CarbonLib 1.6 and later
 *    Mac OS X:         in version 10.2 and later
 *    Windows:          in qtmlClient.lib 6.0 and later
 }
function OpenMovieStorage(dataRef: Handle; dataRefType: OSType; flags: SInt32; var outDataHandler: DataHandler): OSErr; external name '_OpenMovieStorage';
{
 *  CloseMovieStorage()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 6.0 and later
 *    CarbonLib:        in CarbonLib 1.6 and later
 *    Mac OS X:         in version 10.2 and later
 *    Windows:          in qtmlClient.lib 6.0 and later
 }
function CloseMovieStorage(dh: DataHandler): OSErr; external name '_CloseMovieStorage';
{
 *  DeleteMovieStorage()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 6.0 and later
 *    CarbonLib:        in CarbonLib 1.6 and later
 *    Mac OS X:         in version 10.2 and later
 *    Windows:          in qtmlClient.lib 6.0 and later
 }
function DeleteMovieStorage(dataRef: Handle; dataRefType: OSType): OSErr; external name '_DeleteMovieStorage';
{
 *  AddMovieToStorage()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 6.0 and later
 *    CarbonLib:        in CarbonLib 1.6 and later
 *    Mac OS X:         in version 10.2 and later
 *    Windows:          in qtmlClient.lib 6.0 and later
 }
function AddMovieToStorage(theMovie: Movie; dh: DataHandler): OSErr; external name '_AddMovieToStorage';
{
 *  UpdateMovieInStorage()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 6.0 and later
 *    CarbonLib:        in CarbonLib 1.6 and later
 *    Mac OS X:         in version 10.2 and later
 *    Windows:          in qtmlClient.lib 6.0 and later
 }
function UpdateMovieInStorage(theMovie: Movie; dh: DataHandler): OSErr; external name '_UpdateMovieInStorage';
{
 *  HasMovieChanged()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function HasMovieChanged(theMovie: Movie): boolean; external name '_HasMovieChanged';
{
 *  ClearMovieChanged()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure ClearMovieChanged(theMovie: Movie); external name '_ClearMovieChanged';
{
 *  SetMovieDefaultDataRef()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SetMovieDefaultDataRef(theMovie: Movie; dataRef: Handle; dataRefType: OSType): OSErr; external name '_SetMovieDefaultDataRef';
{
 *  GetMovieDefaultDataRef()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetMovieDefaultDataRef(theMovie: Movie; var dataRef: Handle; var dataRefType: OSType): OSErr; external name '_GetMovieDefaultDataRef';
{
 *  SetMovieAnchorDataRef()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.1 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.1 and later
 }
function SetMovieAnchorDataRef(theMovie: Movie; dataRef: Handle; dataRefType: OSType): OSErr; external name '_SetMovieAnchorDataRef';
{
 *  GetMovieAnchorDataRef()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.1 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.1 and later
 }
function GetMovieAnchorDataRef(theMovie: Movie; var dataRef: Handle; var dataRefType: OSType; var outFlags: SInt32): OSErr; external name '_GetMovieAnchorDataRef';
{
 *  SetMovieColorTable()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SetMovieColorTable(theMovie: Movie; ctab: CTabHandle): OSErr; external name '_SetMovieColorTable';
{
 *  GetMovieColorTable()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetMovieColorTable(theMovie: Movie; var ctab: CTabHandle): OSErr; external name '_GetMovieColorTable';
{
 *  FlattenMovie()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure FlattenMovie(theMovie: Movie; movieFlattenFlags: SInt32; const (*var*) theFile: FSSpec; creator: OSType; scriptTag: ScriptCode; createMovieFileFlags: SInt32; var resId: SInt16; const (*var*) resName: Str255); external name '_FlattenMovie';
{
 *  FlattenMovieData()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function FlattenMovieData(theMovie: Movie; movieFlattenFlags: SInt32; const (*var*) theFile: FSSpec; creator: OSType; scriptTag: ScriptCode; createMovieFileFlags: SInt32): Movie; external name '_FlattenMovieData';
{
 *  FlattenMovieDataToDataRef()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 6.0 and later
 *    CarbonLib:        in CarbonLib 1.6 and later
 *    Mac OS X:         in version 10.2 and later
 *    Windows:          in qtmlClient.lib 6.0 and later
 }
function FlattenMovieDataToDataRef(theMovie: Movie; movieFlattenFlags: SInt32; dataRef: Handle; dataRefType: OSType; creator: OSType; scriptTag: ScriptCode; createMovieFileFlags: SInt32): Movie; external name '_FlattenMovieDataToDataRef';
{
 *  SetMovieProgressProc()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure SetMovieProgressProc(theMovie: Movie; p: MovieProgressUPP; refcon: SInt32); external name '_SetMovieProgressProc';
{
 *  GetMovieProgressProc()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
procedure GetMovieProgressProc(theMovie: Movie; var p: MovieProgressUPP; var refcon: SInt32); external name '_GetMovieProgressProc';
{
 *  CreateShortcutMovieFile()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function CreateShortcutMovieFile(const (*var*) fileSpec: FSSpec; creator: OSType; scriptTag: ScriptCode; createMovieFileFlags: SInt32; targetDataRef: Handle; targetDataRefType: OSType): OSErr; external name '_CreateShortcutMovieFile';
{
 *  MovieSearchText()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MovieSearchText(theMovie: Movie; text: Ptr; size: SInt32; searchFlags: SInt32; var searchTrack: Track; var searchTime: TimeValue; var searchOffset: SInt32): OSErr; external name '_MovieSearchText';
{
 *  GetPosterBox()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure GetPosterBox(theMovie: Movie; var boxRect: Rect); external name '_GetPosterBox';
{
 *  SetPosterBox()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure SetPosterBox(theMovie: Movie; const (*var*) boxRect: Rect); external name '_SetPosterBox';
{
 *  GetMovieSegmentDisplayBoundsRgn()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetMovieSegmentDisplayBoundsRgn(theMovie: Movie; time: TimeValue; duration: TimeValue): RgnHandle; external name '_GetMovieSegmentDisplayBoundsRgn';
{
 *  GetTrackSegmentDisplayBoundsRgn()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetTrackSegmentDisplayBoundsRgn(theTrack: Track; time: TimeValue; duration: TimeValue): RgnHandle; external name '_GetTrackSegmentDisplayBoundsRgn';
{
 *  SetMovieCoverProcs()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure SetMovieCoverProcs(theMovie: Movie; uncoverProc: MovieRgnCoverUPP; coverProc: MovieRgnCoverUPP; refcon: SInt32); external name '_SetMovieCoverProcs';
{
 *  GetMovieCoverProcs()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetMovieCoverProcs(theMovie: Movie; var uncoverProc: MovieRgnCoverUPP; var coverProc: MovieRgnCoverUPP; var refcon: SInt32): OSErr; external name '_GetMovieCoverProcs';
{
 *  GetTrackStatus()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetTrackStatus(theTrack: Track): ComponentResult; external name '_GetTrackStatus';
{
 *  GetMovieStatus()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetMovieStatus(theMovie: Movie; var firstProblemTrack: Track): ComponentResult; external name '_GetMovieStatus';
const
    kMovieLoadStateError        = -1;
    kMovieLoadStateLoading      = 1000;
    kMovieLoadStateLoaded       = 2000;
    kMovieLoadStatePlayable     = 10000;
    kMovieLoadStatePlaythroughOK = 20000;
    kMovieLoadStateComplete     = 100000;

    {
     *  GetMovieLoadState()
     *
     *  Availability:
     *    Non-Carbon CFM:   in QuickTimeLib 4.1 and later
     *    CarbonLib:        in CarbonLib 1.1 and later
     *    Mac OS X:         in version 10.0 and later
     *    Windows:          in qtmlClient.lib 4.1 and later
        }
function GetMovieLoadState(theMovie: Movie): SInt32; external name '_GetMovieLoadState';
{ Input flags for CanQuickTimeOpenFile/DataRef }

const
    kQTDontUseDataToFindImporter = $00000001;
    kQTDontLookForMovieImporterIfGraphicsImporterFound = $00000002;
    kQTAllowOpeningStillImagesAsMovies = $00000004;
    kQTAllowImportersThatWouldCreateNewFile = $00000008;
    kQTAllowAggressiveImporters = $00000010;                    {  eg, TEXT and PICT movie importers }

    {    Determines whether the file could be opened using a graphics importer or opened in place as a movie.   }
    {
     *  CanQuickTimeOpenFile()
     *
     *  Availability:
     *    Non-Carbon CFM:   in QuickTimeLib 5.0 and later
     *    CarbonLib:        in CarbonLib 1.3 and later
     *    Mac OS X:         in version 10.0 and later
     *    Windows:          in qtmlClient.lib 5.0 and later
        }
function CanQuickTimeOpenFile(fileSpec: FSSpecPtr; fileType: OSType; fileNameExtension: OSType; var outCanOpenWithGraphicsImporter: boolean; var outCanOpenAsMovie: boolean; var outPreferGraphicsImporter: boolean; inFlags: UInt32): OSErr; external name '_CanQuickTimeOpenFile';
{ Determines whether the file could be opened using a graphics importer or opened in place as a movie. }
{
 *  CanQuickTimeOpenDataRef()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 5.0 and later
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 5.0 and later
 }
function CanQuickTimeOpenDataRef(dataRef: Handle; dataRefType: OSType; var outCanOpenWithGraphicsImporter: boolean; var outCanOpenAsMovie: boolean; var outPreferGraphicsImporter: boolean; inFlags: UInt32): OSErr; external name '_CanQuickTimeOpenDataRef';
{***
    Movie Controller support routines
***}
{
 *  NewMovieController()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function NewMovieController(theMovie: Movie; const (*var*) movieRect: Rect; someFlags: SInt32): ComponentInstance; external name '_NewMovieController';
{
 *  DisposeMovieController()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure DisposeMovieController(mc: ComponentInstance); external name '_DisposeMovieController';
{
 *  ShowMovieInformation()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure ShowMovieInformation(theMovie: Movie; filterProc: ModalFilterUPP; refCon: SInt32); external name '_ShowMovieInformation';
{****
    Scrap routines
****}
{
 *  PutMovieOnScrap()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function PutMovieOnScrap(theMovie: Movie; movieScrapFlags: SInt32): OSErr; external name '_PutMovieOnScrap';
{
 *  NewMovieFromScrap()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function NewMovieFromScrap(newMovieFlags: SInt32): Movie; external name '_NewMovieFromScrap';
{****
    DataRef routines
****}

{
 *  GetMediaDataRef()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetMediaDataRef(theMedia: Media; index: SInt16; var dataRef: Handle; var dataRefType: OSType; var dataRefAttributes: SInt32): OSErr; external name '_GetMediaDataRef';
{
 *  SetMediaDataRef()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SetMediaDataRef(theMedia: Media; index: SInt16; dataRef: Handle; dataRefType: OSType): OSErr; external name '_SetMediaDataRef';
{
 *  SetMediaDataRefAttributes()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SetMediaDataRefAttributes(theMedia: Media; index: SInt16; dataRefAttributes: SInt32): OSErr; external name '_SetMediaDataRefAttributes';
{
 *  AddMediaDataRef()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function AddMediaDataRef(theMedia: Media; var index: SInt16; dataRef: Handle; dataRefType: OSType): OSErr; external name '_AddMediaDataRef';
{
 *  GetMediaDataRefCount()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetMediaDataRefCount(theMedia: Media; var count: SInt16): OSErr; external name '_GetMediaDataRefCount';
{
 *  QTNewAlias()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function QTNewAlias(const (*var*) fss: FSSpec; var alias: AliasHandle; minimal: boolean): OSErr; external name '_QTNewAlias';
{****
    Playback hint routines
****}
{
 *  SetMoviePlayHints()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure SetMoviePlayHints(theMovie: Movie; flags: SInt32; flagsMask: SInt32); external name '_SetMoviePlayHints';
{
 *  SetMediaPlayHints()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure SetMediaPlayHints(theMedia: Media; flags: SInt32; flagsMask: SInt32); external name '_SetMediaPlayHints';
{
 *  GetMediaPlayHints()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure GetMediaPlayHints(theMedia: Media; var flags: SInt32); external name '_GetMediaPlayHints';
{****
    Load time track hints
****}

const
    preloadAlways               = $00000001;
    preloadOnlyIfEnabled        = $00000002;

    {
     *  SetTrackLoadSettings()
     *
     *  Availability:
     *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
     *    Windows:          in qtmlClient.lib 3.0 and later
        }
procedure SetTrackLoadSettings(theTrack: Track; preloadTime: TimeValue; preloadDuration: TimeValue; preloadFlags: SInt32; defaultHints: SInt32); external name '_SetTrackLoadSettings';
{
 *  GetTrackLoadSettings()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure GetTrackLoadSettings(theTrack: Track; var preloadTime: TimeValue; var preloadDuration: TimeValue; var preloadFlags: SInt32; var defaultHints: SInt32); external name '_GetTrackLoadSettings';
{****
    Big screen TV
****}

const
    fullScreenHideCursor        = $00000001;
    fullScreenAllowEvents       = $00000002;
    fullScreenDontChangeMenuBar = $00000004;
    fullScreenPreflightSize     = $00000008;

    {
     *  BeginFullScreen()
     *
     *  Availability:
     *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
     *    Windows:          in qtmlClient.lib 3.0 and later
        }
function BeginFullScreen(var restoreState: Ptr; whichGD: GDHandle; var desiredWidth: SInt16; var desiredHeight: SInt16; var newWindow: WindowRef; var eraseColor: RGBColor; flags: SInt32): OSErr; external name '_BeginFullScreen';
{
 *  EndFullScreen()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function EndFullScreen(fullState: Ptr; flags: SInt32): OSErr; external name '_EndFullScreen';
{****
    Wired Actions
****}
{  flags for MovieExecuteWiredActions }

const
    movieExecuteWiredActionDontExecute = $00000001;

    {
     *  AddMovieExecuteWiredActionsProc()
     *
     *  Availability:
     *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
     *    CarbonLib:        in CarbonLib 1.0.2 and later
     *    Mac OS X:         in version 10.0 and later
     *    Windows:          in qtmlClient.lib 4.0 and later
        }
function AddMovieExecuteWiredActionsProc(theMovie: Movie; proc: MovieExecuteWiredActionsUPP; refCon: UnivPtr): OSErr; external name '_AddMovieExecuteWiredActionsProc';
{
 *  RemoveMovieExecuteWiredActionsProc()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function RemoveMovieExecuteWiredActionsProc(theMovie: Movie; proc: MovieExecuteWiredActionsUPP; refCon: UnivPtr): OSErr; external name '_RemoveMovieExecuteWiredActionsProc';
{
 *  MovieExecuteWiredActions()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function MovieExecuteWiredActions(theMovie: Movie; flags: SInt32; actions: QTAtomContainer): OSErr; external name '_MovieExecuteWiredActions';
{****
    Keyboard Navigation/Editable Text Field Support
****}
{
   Navigation Direction Constants
        for MediaNavigateTargetRefCon
}

const
    kRefConNavigationNext       = 0;
    kRefConNavigationPrevious   = 1;

    {
       Refcon Properties
            for MediaRefConGetProerty/MediaRefConSetProperty
    }
    kRefConPropertyCanHaveFocus = 1;                            {  Boolean  }
    kRefConPropertyHasFocus     = 2;                            {  Boolean  }

    {  media properties }
    kTrackFocusCanEditFlag      = $6B656474 (* 'kedt' *);
    kTrackDefaultFocusFlags     = $6B666F63 (* 'kfoc' *);
    kTrackFocusDefaultRefcon    = $6B726566 (* 'kref' *);

    {  focus flags }
    kTrackFocusOn               = 1;
    kTrackHandlesTabs           = 2;                            {  this is reserved for a future release }

    {   ****
        Flash track properties
    ****    }
    kFlashTrackPropertyAcceptAllClicks = $636C696B (* 'clik' *);                {  type of media property atom; data is a Boolean  }

    {   ****
        Sprite Toolbox
    ****    }
    kBackgroundSpriteLayerNum   = 32767;


    {   Sprite Properties }
    kSpritePropertyMatrix       = 1;
    kSpritePropertyImageDescription = 2;
    kSpritePropertyImageDataPtr = 3;
    kSpritePropertyVisible      = 4;
    kSpritePropertyLayer        = 5;
    kSpritePropertyGraphicsMode = 6;
    kSpritePropertyImageDataSize = 7;
    kSpritePropertyActionHandlingSpriteID = 8;
    kSpritePropertyCanBeHitTested = 9;
    kSpritePropertyImageIndex   = 100;
    kSpriteTrackPropertyBackgroundColor = 101;
    kSpriteTrackPropertyOffscreenBitDepth = 102;
    kSpriteTrackPropertySampleFormat = 103;
    kSpriteTrackPropertyScaleSpritesToScaleWorld = 104;
    kSpriteTrackPropertyHasActions = 105;
    kSpriteTrackPropertyVisible = 106;
    kSpriteTrackPropertyQTIdleEventsFrequency = 107;
    kSpriteTrackPropertyAllSpritesHitTestingMode = 108;
    kSpriteTrackPropertyPreferredDepthInterpretationMode = 109;
    kSpriteImagePropertyRegistrationPoint = 1000;
    kSpriteImagePropertyGroupID = 1001;

    {  values for kSpriteTrackPropertyPreferredDepthInterpretationMode }
    kSpriteTrackPreferredDepthCompatibilityMode = 0;
    kSpriteTrackPreferredDepthModernMode = 1;

    {  values for kSpriteTrackPropertyAllSpritesHitTestingMode }
    kSpriteHitTestUseSpritesOwnPropertiesMode = 0;
    kSpriteHitTestTreatAllSpritesAsHitTestableMode = 1;
    kSpriteHitTestTreatAllSpritesAsNotHitTestableMode = 2;

    {  special value for kSpriteTrackPropertyQTIdleEventsFrequency (the default) }
    kNoQTIdleEvents             = -1;

    {  GetSpriteProperties for accessing invalid SpriteWorldRegion }
    kGetSpriteWorldInvalidRegionAndLeaveIntact = -1;
    kGetSpriteWorldInvalidRegionAndThenSetEmpty = -2;

    {  flagsIn for SpriteWorldIdle }
    kOnlyDrawToSpriteWorld      = $00000001;
    kSpriteWorldPreflight       = $00000002;

    {  flagsOut for SpriteWorldIdle }
    kSpriteWorldDidDraw         = $00000001;
    kSpriteWorldNeedsToDraw     = $00000002;

    {  flags for sprite track sample format }
    kKeyFrameAndSingleOverride  = $00000002;
    kKeyFrameAndAllOverrides    = $00000004;

    {  sprite world flags }
    kScaleSpritesToScaleWorld   = $00000002;
    kSpriteWorldHighQuality     = $00000004;
    kSpriteWorldDontAutoInvalidate = $00000008;
    kSpriteWorldInvisible       = $00000010;
    kSpriteWorldDirtyInsteadOfFlush = $00000020;

    {
     *  NewSpriteWorld()
     *
     *  Availability:
     *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
     *    Windows:          in qtmlClient.lib 3.0 and later
        }
function NewSpriteWorld(var newSpriteWorld: SpriteWorld; destination: GWorldPtr; spriteLayer: GWorldPtr; var backgroundColor: RGBColor; background: GWorldPtr): OSErr; external name '_NewSpriteWorld';
{
 *  DisposeSpriteWorld()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure DisposeSpriteWorld(theSpriteWorld: SpriteWorld); external name '_DisposeSpriteWorld';
{
 *  SetSpriteWorldClip()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SetSpriteWorldClip(theSpriteWorld: SpriteWorld; clipRgn: RgnHandle): OSErr; external name '_SetSpriteWorldClip';
{
 *  SetSpriteWorldMatrix()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SetSpriteWorldMatrix(theSpriteWorld: SpriteWorld; const (*var*) matrix: MatrixRecord): OSErr; external name '_SetSpriteWorldMatrix';
{
 *  SetSpriteWorldGraphicsMode()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SetSpriteWorldGraphicsMode(theSpriteWorld: SpriteWorld; mode: SInt32; const (*var*) opColor: RGBColor): OSErr; external name '_SetSpriteWorldGraphicsMode';
{
 *  SpriteWorldIdle()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SpriteWorldIdle(theSpriteWorld: SpriteWorld; flagsIn: SInt32; var flagsOut: SInt32): OSErr; external name '_SpriteWorldIdle';
{
 *  InvalidateSpriteWorld()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function InvalidateSpriteWorld(theSpriteWorld: SpriteWorld; var invalidArea: Rect): OSErr; external name '_InvalidateSpriteWorld';
{
 *  SpriteWorldHitTest()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SpriteWorldHitTest(theSpriteWorld: SpriteWorld; flags: SInt32; loc: Point; var spriteHit: Sprite): OSErr; external name '_SpriteWorldHitTest';
{
 *  SpriteHitTest()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SpriteHitTest(theSprite: Sprite; flags: SInt32; loc: Point; var wasHit: boolean): OSErr; external name '_SpriteHitTest';
{
 *  DisposeAllSprites()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure DisposeAllSprites(theSpriteWorld: SpriteWorld); external name '_DisposeAllSprites';
{
 *  SetSpriteWorldFlags()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SetSpriteWorldFlags(spriteWorld: SpriteWorld; flags: SInt32; flagsMask: SInt32): OSErr; external name '_SetSpriteWorldFlags';
{
 *  NewSprite()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function NewSprite(var newSprite: Sprite; itsSpriteWorld: SpriteWorld; idh: ImageDescriptionHandle; imageDataPtr: Ptr; var matrix: MatrixRecord; visible: boolean; layer: SInt16): OSErr; external name '_NewSprite';
{
 *  DisposeSprite()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure DisposeSprite(theSprite: Sprite); external name '_DisposeSprite';
{
 *  InvalidateSprite()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure InvalidateSprite(theSprite: Sprite); external name '_InvalidateSprite';
{
 *  SetSpriteProperty()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SetSpriteProperty(theSprite: Sprite; propertyType: SInt32; propertyValue: UnivPtr): OSErr; external name '_SetSpriteProperty';
{
 *  GetSpriteProperty()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetSpriteProperty(theSprite: Sprite; propertyType: SInt32; propertyValue: UnivPtr): OSErr; external name '_GetSpriteProperty';
{****
    QT Atom Data Support
****}

const
    kParentAtomIsContainer      = 0;

    {  create and dispose QTAtomContainer objects }

    {
     *  QTNewAtomContainer()
     *
     *  Availability:
     *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
     *    Windows:          in qtmlClient.lib 3.0 and later
        }
function QTNewAtomContainer(var atomData: QTAtomContainer): OSErr; external name '_QTNewAtomContainer';
{
 *  QTDisposeAtomContainer()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function QTDisposeAtomContainer(atomData: QTAtomContainer): OSErr; external name '_QTDisposeAtomContainer';
{  locating nested atoms within QTAtomContainer container }

{
 *  QTGetNextChildType()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function QTGetNextChildType(container: QTAtomContainer; parentAtom: QTAtom; currentChildType: QTAtomType): QTAtomType; external name '_QTGetNextChildType';
{
 *  QTCountChildrenOfType()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function QTCountChildrenOfType(container: QTAtomContainer; parentAtom: QTAtom; childType: QTAtomType): SInt16; external name '_QTCountChildrenOfType';
{
 *  QTFindChildByIndex()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function QTFindChildByIndex(container: QTAtomContainer; parentAtom: QTAtom; atomType: QTAtomType; index: SInt16; var id: QTAtomID): QTAtom; external name '_QTFindChildByIndex';
{
 *  QTFindChildByID()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function QTFindChildByID(container: QTAtomContainer; parentAtom: QTAtom; atomType: QTAtomType; id: QTAtomID; var index: SInt16): QTAtom; external name '_QTFindChildByID';
{
 *  QTNextChildAnyType()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function QTNextChildAnyType(container: QTAtomContainer; parentAtom: QTAtom; currentChild: QTAtom; var nextChild: QTAtom): OSErr; external name '_QTNextChildAnyType';
{  set a leaf atom's data }
{
 *  QTSetAtomData()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function QTSetAtomData(container: QTAtomContainer; atom: QTAtom; dataSize: SInt32; atomData: UnivPtr): OSErr; external name '_QTSetAtomData';
{  extracting data }
{
 *  QTCopyAtomDataToHandle()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function QTCopyAtomDataToHandle(container: QTAtomContainer; atom: QTAtom; targetHandle: Handle): OSErr; external name '_QTCopyAtomDataToHandle';
{
 *  QTCopyAtomDataToPtr()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function QTCopyAtomDataToPtr(container: QTAtomContainer; atom: QTAtom; sizeOrLessOK: boolean; size: SInt32; targetPtr: UnivPtr; var actualSize: SInt32): OSErr; external name '_QTCopyAtomDataToPtr';
{
 *  QTGetAtomTypeAndID()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function QTGetAtomTypeAndID(container: QTAtomContainer; atom: QTAtom; var atomType: QTAtomType; var id: QTAtomID): OSErr; external name '_QTGetAtomTypeAndID';
{  extract a copy of an atom and all of it's children, caller disposes }
{
 *  QTCopyAtom()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function QTCopyAtom(container: QTAtomContainer; atom: QTAtom; var targetContainer: QTAtomContainer): OSErr; external name '_QTCopyAtom';
{  obtaining direct reference to atom data }
{
 *  QTLockContainer()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function QTLockContainer(container: QTAtomContainer): OSErr; external name '_QTLockContainer';
{
 *  QTGetAtomDataPtr()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function QTGetAtomDataPtr(container: QTAtomContainer; atom: QTAtom; var dataSize: SInt32; var atomData: Ptr): OSErr; external name '_QTGetAtomDataPtr';
{
 *  QTUnlockContainer()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function QTUnlockContainer(container: QTAtomContainer): OSErr; external name '_QTUnlockContainer';
{
   building QTAtomContainer trees
   creates and inserts new atom at specified index, existing atoms at or after index are moved toward end of list
   used for Top-Down tree creation
}
{
 *  QTInsertChild()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function QTInsertChild(container: QTAtomContainer; parentAtom: QTAtom; atomType: QTAtomType; id: QTAtomID; index: SInt16; dataSize: SInt32; data: UnivPtr; var newAtom: QTAtom): OSErr; external name '_QTInsertChild';
{  inserts children from childrenContainer as children of parentAtom }
{
 *  QTInsertChildren()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function QTInsertChildren(container: QTAtomContainer; parentAtom: QTAtom; childrenContainer: QTAtomContainer): OSErr; external name '_QTInsertChildren';
{  destruction }
{
 *  QTRemoveAtom()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function QTRemoveAtom(container: QTAtomContainer; atom: QTAtom): OSErr; external name '_QTRemoveAtom';
{
 *  QTRemoveChildren()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function QTRemoveChildren(container: QTAtomContainer; atom: QTAtom): OSErr; external name '_QTRemoveChildren';
{  replacement must be same type as target }
{
 *  QTReplaceAtom()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function QTReplaceAtom(targetContainer: QTAtomContainer; targetAtom: QTAtom; replacementContainer: QTAtomContainer; replacementAtom: QTAtom): OSErr; external name '_QTReplaceAtom';
{
 *  QTSwapAtoms()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function QTSwapAtoms(container: QTAtomContainer; atom1: QTAtom; atom2: QTAtom): OSErr; external name '_QTSwapAtoms';
{
 *  QTSetAtomID()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function QTSetAtomID(container: QTAtomContainer; atom: QTAtom; newID: QTAtomID): OSErr; external name '_QTSetAtomID';
{
 *  QTGetAtomParent()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function QTGetAtomParent(container: QTAtomContainer; childAtom: QTAtom): QTAtom; external name '_QTGetAtomParent';
{
 *  SetMediaPropertyAtom()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SetMediaPropertyAtom(theMedia: Media; propertyAtom: QTAtomContainer): OSErr; external name '_SetMediaPropertyAtom';
{
 *  GetMediaPropertyAtom()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetMediaPropertyAtom(theMedia: Media; var propertyAtom: QTAtomContainer): OSErr; external name '_GetMediaPropertyAtom';
{****
    Tween Support
****}

type
    TweenRecordPtr = ^TweenRecord;
    TweenerDataProcPtr = function(tr: TweenRecordPtr; tweenData: UnivPtr; tweenDataSize: SInt32; dataDescriptionSeed: SInt32; dataDescription: Handle; asyncCompletionProc: ICMCompletionProcRecordPtr; transferProc: UniversalProcPtr; refCon: UnivPtr): ComponentResult;

    TweenerDataUPP = ^SInt32; { an opaque UPP }
    TweenRecord = record
        version:                SInt32;
        container:              QTAtomContainer;
        tweenAtom:              QTAtom;
        dataAtom:               QTAtom;
        percent:                Fixed;
        dataProc:               TweenerDataUPP;
        private1:               Ptr;
        private2:               Ptr;
    end;

    TweenV1RecordPtr = ^TweenV1Record;
    TweenV1Record = record
        version:                SInt32;
        container:              QTAtomContainer;
        tweenAtom:              QTAtom;
        dataAtom:               QTAtom;
        percent:                Fixed;
        dataProc:               TweenerDataUPP;
        private1:               Ptr;
        private2:               Ptr;
        fractPercent:           Fract;
    end;


const
    kTweenRecordNoFlags         = 0;
    kTweenRecordIsAtInterruptTime = $00000001;


type
    TweenV2RecordPtr = ^TweenV2Record;
    TweenV2Record = record
        version:                SInt32;
        container:              QTAtomContainer;
        tweenAtom:              QTAtom;
        dataAtom:               QTAtom;
        percent:                Fixed;
        dataProc:               TweenerDataUPP;
        private1:               Ptr;
        private2:               Ptr;
        fractPercent:           Fract;
        flags:                  SInt32;
    end;

    {
     *  QTNewTween()
     *
     *  Availability:
     *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
     *    Windows:          in qtmlClient.lib 3.0 and later
        }
function QTNewTween(var tween: QTTweener; container: QTAtomContainer; tweenAtom: QTAtom; maxTime: TimeValue): OSErr; external name '_QTNewTween';
{
 *  QTDisposeTween()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function QTDisposeTween(tween: QTTweener): OSErr; external name '_QTDisposeTween';
{
 *  QTDoTween()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function QTDoTween(tween: QTTweener; atTime: TimeValue; result: Handle; var resultSize: SInt32; tweenDataProc: TweenerDataUPP; tweenDataRefCon: UnivPtr): OSErr; external name '_QTDoTween';
{
    QTDoTweenPtr is an interrupt-safe version of QTDoTween.  It has the following limitations:
     - not all tween types support this call (those which must allocated memory), in which case they return codecUnimpErr.
     - the QTAtomContainer used for the tween must be locked
     - the dataSize must be large enough to contain the result
     - this call is not supported for sequence tweens, use interpolation tweens instead
}
{
 *  QTDoTweenPtr()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 6.0 and later
 *    CarbonLib:        in CarbonLib 1.6 and later
 *    Mac OS X:         in version 10.2 and later
 *    Windows:          in qtmlClient.lib 6.0 and later
 }
function QTDoTweenPtr(tween: QTTweener; atTime: TimeValue; result: Ptr; resultSize: SInt32): OSErr; external name '_QTDoTweenPtr';
{****
    Sound Description Manipulations
****}
{
 *  AddSoundDescriptionExtension()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function AddSoundDescriptionExtension(desc: SoundDescriptionHandle; extension: Handle; idType: OSType): OSErr; external name '_AddSoundDescriptionExtension';
{
 *  GetSoundDescriptionExtension()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetSoundDescriptionExtension(desc: SoundDescriptionHandle; var extension: Handle; idType: OSType): OSErr; external name '_GetSoundDescriptionExtension';
{
 *  RemoveSoundDescriptionExtension()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function RemoveSoundDescriptionExtension(desc: SoundDescriptionHandle; idType: OSType): OSErr; external name '_RemoveSoundDescriptionExtension';
{****
    Preferences
****}
{
 *  GetQuickTimePreference()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetQuickTimePreference(preferenceType: OSType; var preferenceAtom: QTAtomContainer): OSErr; external name '_GetQuickTimePreference';
{
 *  SetQuickTimePreference()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SetQuickTimePreference(preferenceType: OSType; preferenceAtom: QTAtomContainer): OSErr; external name '_SetQuickTimePreference';
{****
    Effects and dialog Support
****}
{  atom types for entries in the effects list }

const
    kEffectNameAtom             = $6E616D65 (* 'name' *);                       {  name of effect  }
    kEffectTypeAtom             = $74797065 (* 'type' *);                       {  codec sub-type for effect  }
    kEffectManufacturerAtom     = $6D616E75 (* 'manu' *);                       {  codec manufacturer for effect  }


type
    QTParamPreviewRecordPtr = ^QTParamPreviewRecord;
    QTParamPreviewRecord = record
        sourceID:               SInt32;                             {  1 based source identifier }
        sourcePicture:          PicHandle;                              {  picture for preview, must not dispose until dialog is disposed }
    end;

    QTParamPreviewPtr                   = ^QTParamPreviewRecord;
    QTParamDialogEventRecordPtr = ^QTParamDialogEventRecord;
    QTParamDialogEventRecord = record
        theEvent:               EventRecordPtr;                         {  Event received by the dialog  }
        whichDialog:            DialogRef;                              {  dialog that event was directed towards  }
        itemHit:                SInt16;                             {  dialog item which was hit  }
    end;

    QTParamDialogEventPtr               = ^QTParamDialogEventRecord;
    QTParamFetchPreviewRecordPtr = ^QTParamFetchPreviewRecord;
    QTParamFetchPreviewRecord = record
        theWorld:               GWorldPtr;                              {  the world into which to draw the preview  }
        percentage:             Fixed;                                  {  frame percentage (from 0.0 - 1.0) to be drawn  }
    end;

    QTParamFetchPreviewPtr              = ^QTParamFetchPreviewRecord;

const
    pdActionConfirmDialog       = 1;                            {  no param }
    pdActionSetAppleMenu        = 2;                            {  param is MenuRef }
    pdActionSetEditMenu         = 3;                            {  param is MenuRef }
    pdActionGetDialogValues     = 4;                            {  param is QTAtomContainer }
    pdActionSetPreviewUserItem  = 5;                            {  param is long }
    pdActionSetPreviewPicture   = 6;                            {  param is QTParamPreviewPtr; }
    pdActionSetColorPickerEventProc = 7;                        {  param is UserEventUPP }
    pdActionSetDialogTitle      = 8;                            {  param is StringPtr  }
    pdActionGetSubPanelMenu     = 9;                            {  param is MenuRef*  }
    pdActionActivateSubPanel    = 10;                           {  param is long  }
    pdActionConductStopAlert    = 11;                           {  param is StringPtr  }
    pdActionModelessCallback    = 12;                           {  param is QTParamDialogEventPtr  }
    pdActionFetchPreview        = 13;                           {  param is QTParamFetchPreviewPtr  }
    pdActionSetDialogSettings   = 14;                           {  param is QTAtomContainer  }
    pdActionGetDialogSettings   = 15;                           {  param is QTAtomContainer  }
    pdActionGetNextSample       = 16;                           {  param is QTAtomContainer with effect sample to change - createdDialog may be NIL  }
    pdActionGetPreviousSample   = 17;                           {  param is QTAtomContainer with effect sample to change - createdDialog may be NIL  }
    pdActionCompactSample       = 18;                           {  param is QTAtomContainer with effect sample to compact, - createdDialog may be NIL  }
    pdActionSetEditCallout      = 19;                           {  param is QTParamPreviewCalloutPtr, can be NIL  }
    pdActionSetSampleTime       = 20;                           {  param is QTParamSampleTimePtr, can be NIL  }
    pdActionDoEditCommand       = 21;                           {  param is long with menu command (ie, mcMenuCut etc)  }
    pdActionGetSubPanelMenuValue = 22;                          {  param is long and returns current sub-panel value selected by the effect  }
                                                                {  Action codes and typedefs used for custom controls within effects  }
    pdActionCustomNewControl    = 23;                           {  param is QTCustomControlNewPtr  }
    pdActionCustomDisposeControl = 24;                          {  param is QTCustomControlNewPtr  }
    pdActionCustomPositionControl = 25;                         {  param is QTCustomControlPositionControlPtr  }
    pdActionCustomShowHideControl = 26;                         {  param is QTCustomControlShowHideControlPtr  }
    pdActionCustomHandleEvent   = 27;                           {  param is QTCustomControlHandleEventPtr  }
    pdActionCustomSetFocus      = 28;                           {  param is QTCustomControlSetFocusPtr  }
    pdActionCustomSetEditMenu   = 29;                           {  param is QTCustomControlSetEditMenuPtr  }
    pdActionCustomSetPreviewPicture = 30;                       {  param is QTCustomControlSetPreviewPicturePtr  }
    pdActionCustomSetEditCallout = 31;                          {  param is QTCustomControlSetEditCalloutPtr  }
    pdActionCustomGetEnableValue = 32;                          {  param is QTCustomControlGetEnableValuePtr  }
    pdActionCustomSetSampleTime = 33;                           {  param is QTCustomControlSetSampleTimePtr  }
    pdActionCustomGetValue      = 34;                           {  param is QTCustomControlGetValue  }
    pdActionCustomDoEditCommand = 35;                           {  param is QTCustomControlDoEditCommand  }

    {    Sample Time information    }
    pdSampleTimeDisplayOptionsNone = $00000000;


type
    QTParamSampleTimeRecordPtr = ^QTParamSampleTimeRecord;
    QTParamSampleTimeRecord = record
        displayOptions:         SInt32;
        sampleStartTime:        TimeRecord;
        sampleDuration:         TimeValue;
        framesPerSecond:        SInt32;                             {  if 0, will cause revert to seconds display }
    end;

    QTParamSampleTimePtr                = ^QTParamSampleTimeRecord;
    {    Preview change callout information     }
    QTParamPreviewCalloutRecordPtr = ^QTParamPreviewCalloutRecord;
    QTParamPreviewCalloutRecord = record
        calloutProc:            MoviePreviewCallOutUPP;                 {  called when user makes editing changes to dialog.  May be NIL.  You should return true from your function.  }
        refCon:                 SInt32;                             {  passed to the callout procedure  }
    end;

    QTParamPreviewCalloutPtr            = ^QTParamPreviewCalloutRecord;
    QTParameterDialogOptions            = SInt32;
    {  ------- CUSTOM EFFECT CONTROLS }
    {
        Effects may choose to implement custom controls to allow the user to more easily edit complex parameters
        that are ill-served by simple sliders or type in boxes.   Effects may allow a custom control for either
        a single parameter, or for a group of parameters.

        Parameter(s) for a custom control must still be data types defined by the standard set, or for
        complex records of data, must be defined within a group as individual parameters made up from base
        data types (for example, a point is a group containing two Fixed point numbers).
        This is to allow applications that do not wish to use the custom control for the effect to set values themselves.

        Effects should be aware that these custom controls may be deployed by the application in either a dialog or
        a window, with application defined background colors or patterns, along with application defined font
        characteristics for the window.

        It is recommended that effects implement custom controls only when needed, and that custom controls be used
        for specific types of parameters (ie, point, rectangle, polygon, path) rather than the entire user interface
        for the effect.  Effects may choose to implement multiple custom controls which combine with standard controls
        to present the total user interface.  For effects which have very complex user interfaces not well suited for
        inclusion within a single window, it is recommended to use kParameterImageIsPreset -- which allows the effect to
        have an external editing application for parameters which may then be set within the standard UI via the open file
        dialog or drag and drop.  The Lens Flare effect's "Flare Type" is an example of such a preset.

        For parameters that use a custom control to control a single parameter value, a new behavior
        flag has been added (kCustomControl), and the behavior for the parameter should be kParameterItemControl.

        For parameters that are groups, the same flag (kCustomControl) should be used, and the behavior
        should be kParameterItemGroupDivider.  Groups with the kCustomControl bit set will be implemented
        by calling the custom control for that group -- the parameters within that group will not be processed
        in the normal manner.

        In both cases, the new customType and customID fields of the behavior must be filled in.  These are
        used in order to allow your custom control to determine which parameter is being edited in the case
        where the custom control is used for the editing of multiple parameters.  These values are passed into
        the pdActionCustomNewControl call.  Since the custom control mechanism is also used by QuickTime's
        default effect dialogs, you should be prepared to pass onto the base effect any pdActionCustomNewControl
        calls for type/id pairs that you do not handle yourself.  When  pdActionCustomNewControl is called
        for controls of types handled by QuickTime, customType is kParameterAtomTypeAndID and customID is
        the ID of the parameter atom.
        }


    {
        pdActionCustomNewControlControl is called by application to create a new custom control or set of controls
        for an effect parameter.  When pdActionCustomNewControl is called, the effect should perform any
        basic allocation it needs for storage and return the result in storage. The options parameter tells
        the control if the application wishes to support interpolated, optionally interpolated, or a single
        value parameter.

        Since pdActionCustomNewControlControl may be called upon your effect for other items within the
        dialog, it is recommended that your effect have an easy way to determine which controls it implements:
         a) by having storage be a pointer with an OSType at the begining to mark controls
            implemented by your code.
         - or -
         b) keeping track in your component globals those custom controls which you have created.

        When pdActionCustomDisposeControl is called any allocation done by the control should be disposed. In addition,
        pdActionCustomDisposeControl is the last chance the control has to commit any user changes into the sample.
        Controls which implement type in fields typically need to commit any final user edits at this time.
        }
    QTCustomControlNewRecordPtr = ^QTCustomControlNewRecord;
    QTCustomControlNewRecord = record
        storage:                Ptr;                                    {  storage allocated/disposed by the control }
        options:                QTParameterDialogOptions;               {  options used to control interpolation/not }
        sample:                 QTAtomContainer;                        {  sample that holds the data to be edited }
        customType:             SInt32;                             {  custom type and ID specified by effect for creation of this control }
        customID:               SInt32;
    end;

    QTCustomControlNewPtr               = ^QTCustomControlNewRecord;
    {
        pdActionCustomPositionControl is called by the application to position the control within a window or dialog.

        The control should determine if it will fit in the alloted area and position itself there.  It should also
        return the space taken up by the control.   Note you are free to implement controls which are variable in size depending upon
        which parameter you are editing.  You need not scale your control to the requested size.  If the area presented to your
        control is too small, set didFit to false.  You should still return in used the size you would have liked to use for
        the control.   The application will then try again with a new size.  Note that all
        controls must be able to fit within a minimum of 300 by 250 pixels.

        Custom controls that draw text should make note of the text font, size, and style at this time in order
        to properly display within application windows.

        Note that the default state for the control is hidden.  You will receive a pdActionCustomShowHideControl
        in order to enable your control.  You should not draw your control in response to pdActionCustomPositionControl.
        }
    QTCustomControlPositionControlRecordPtr = ^QTCustomControlPositionControlRecord;
    QTCustomControlPositionControlRecord = record
        storage:                Ptr;                                    {  storage for the control }
        window:                 WindowPtr;                              {  window to be used by the control }
        location:               Rect;                                   {  location within the window the control may use }
        used:                   Rect;                                   {  returned by the control to indicate size it actually used }
        didFit:                 boolean;                                {  did the control fit in the specified area? }
        pad:                    array [0..2] of boolean;
    end;

    QTCustomControlPositionControlPtr   = ^QTCustomControlPositionControlRecord;
    {
        pdActionCustomShowHideControl is called when the application wishes to enable/disable your control, or
        completely disable drawing of the control

        Your control should make note of the new state (if different from the last) and perform an InvalRect()
        on your drawing area, or you may draw your control's initial state in the case of show.  You should not
        attempt to erase your control as the result of a hide -- instead call InvalRect() and allow the application
        to process the resulting event as appropriate.
        }
    QTCustomControlShowHideControlRecordPtr = ^QTCustomControlShowHideControlRecord;
    QTCustomControlShowHideControlRecord = record
        storage:                Ptr;                                    {  storage for the control }
        show:                   boolean;                                {  display the control? }
        enable:                 boolean;                                {  enable the control (ie, black vs gray display) }
        pad:                    array [0..1] of boolean;
    end;

    QTCustomControlShowHideControlPtr   = ^QTCustomControlShowHideControlRecord;
    {
        pdActionCustomHandleEvent is called to allow your custom control to process events.

        Typical controls handle the following events:
            - activate - to draw your control in normal/gray mode
            - update - to draw your control
            - mouseDown - to handle clicks
            - keyDown - to handle typing when you have focus
            - idle - to perform idle drawing (if applicable)
        If your control handles the entire event, set didProcess to true.  If
        you handled the event, but other controls still need the event, set didProcess to false.

        If your control supports the concept of focus for the purposes of typing (such as by having
        a type-in box for the parameter) then you set the tookFocus Boolean as part of your processing
        of the event.  It is assumed that your control will draw the appropriate focus UI as a result, and
        the calling application will disable any focus drawing within the remainder of the UI.

        By default, custom controls are not given idle time.  If you need idle time, set needIdle to true
        in response to the even that causes you to need idle (typically the taking of focus, or the first draw).
        Your control will continue to be given idle events until you set needIdle to false in response to
        a nullEvent.
        }
    QTCustomControlHandleEventRecordPtr = ^QTCustomControlHandleEventRecord;
    QTCustomControlHandleEventRecord = record
        storage:                Ptr;                                    {  storage for the control }
        pEvent:                 EventRecordPtr;                         {  event to process }
        didProcess:             boolean;                                {  did we process entire event? }
        tookFocus:              boolean;                                {  did we take focus as a result of this event (typically mouseDowns) }
        needIdle:               boolean;                                {  does this control need idle events? }
        didEdit:                boolean;                                {  did we edit the samples? }
    end;

    QTCustomControlHandleEventPtr       = ^QTCustomControlHandleEventRecord;
    {
        pdActionCustomSetFocus is called in order to set or advance the current focus of the user interface, typically
        because the user has pressed the tab or shift-tab keys, or because the user clicked within the area defined by
        your control.

        Your control will be called with pdActionFocusFirst,  pdActionFocusLast, or pdActionFocusOff to set or clear focus on your
        control.  Your control will be called with pdActionFocusForward or pdActionFocusBackward to cycle
        focus within your control (if your control has multiple focus).  If your control does not support focus,
        or the focus request results in focus moving beyond your supported range, return pdActionFocusOff in
        the focus parameter.  Otherwise, return the focus that you set.

        Controls which have no focus would always set focus to be pdActionFocusOff.

        Controls with a single focus would set pdActionFocusFirst when requsted to set either
        pdActionFocusFirst or pdActionFocusLast, and would set pdActionFocusOff for either
        pdActionFocusForward or pdActionFocusBackward.
        }

const
    pdActionFocusOff            = 0;                            {  no focus  }
    pdActionFocusFirst          = 1;                            {  focus on first element  }
    pdActionFocusLast           = 2;                            {  focus on last element  }
    pdActionFocusForward        = 3;                            {  focus on next element  }
    pdActionFocusBackward       = 4;                            {  focus on previous element  }


type
    QTCustomControlSetFocusRecordPtr = ^QTCustomControlSetFocusRecord;
    QTCustomControlSetFocusRecord = record
        storage:                Ptr;                                    {  storage for the control }
        focus:                  SInt32;                             {  focus to set, return resulting focus }
    end;

    QTCustomControlSetFocusPtr          = ^QTCustomControlSetFocusRecord;
    {
        pdActionCustomSetEditMenu will be called to inform your custom control of the location of the edit menu.

        If your control has editing boxes, this is useful in order to allow the user to perform cut/copy/paste operations
        when focus is on one of these boxes.
        }
    QTCustomControlSetEditMenuRecordPtr = ^QTCustomControlSetEditMenuRecord;
    QTCustomControlSetEditMenuRecord = record
        storage:                Ptr;                                    {  storage for the control }
        editMenu:               MenuHandle;                             {  edit menu, or NIL }
    end;

    QTCustomControlSetEditMenuPtr       = ^QTCustomControlSetEditMenuRecord;
    {
        pdActionCustomSetPreviewPicture will be called to inform your custom control of preview information that you
        may wish to use in the drawing of your user interface.
        }
    QTCustomControlSetPreviewPictureRecordPtr = ^QTCustomControlSetPreviewPictureRecord;
    QTCustomControlSetPreviewPictureRecord = record
        storage:                Ptr;                                    {  storage for the control }
        preview:                QTParamPreviewPtr;                      {  preview to set }
    end;

    QTCustomControlSetPreviewPicturePtr = ^QTCustomControlSetPreviewPictureRecord;
    {
        pdActionCustomSetEditCallout tells your control of the need by the application to be informed of
        changes to the parameter values (typically for the purposes of updating previews).

        If a callout is available, your custom control should call it whenever a change has been
        made to the parameter(s) that your control is editing (as a result of user actions, most typically).
        If you choose not to implement this, live dragging or updating of values will not work.
        }
    QTCustomControlSetEditCalloutRecordPtr = ^QTCustomControlSetEditCalloutRecord;
    QTCustomControlSetEditCalloutRecord = record
        storage:                Ptr;                                    {  storage for the control }
        callout:                QTParamPreviewCalloutPtr;               {  requested callout, or NIL to disable }
    end;

    QTCustomControlSetEditCalloutPtr    = ^QTCustomControlSetEditCalloutRecord;
    {
        pdActionCustomGetEnableValue allows you to return a value for the purposes of enabling/disabling
        other controls.
        Most custom controls do not need to implement this call.

        If your control is able to control the enabling and disabling of other parameter controls (such as is done
        by standard pop up or enumerated type controls), you need to supply a value that can be use for greater than/less than
        types of comparisons.
        }
    QTCustomControlGetEnableValueRecordPtr = ^QTCustomControlGetEnableValueRecord;
    QTCustomControlGetEnableValueRecord = record
        storage:                Ptr;                                    {  storage for the control }
        currentValue:           SInt32;                             {  value to compare against for enable/disable purposes }
    end;

    QTCustomControlGetEnableValuePtr    = ^QTCustomControlGetEnableValueRecord;
    {
        pdActionCustomSetSampleTime tells your control information from the application about the duration
        and start time for the sample being edited.

        Most controls do not need this information, but some may choose to use it in the interface
        they present the user.  However, this call need not be made by applications, so the custom
        control should be prepared to run when the sample time information is not available.
        }
    QTCustomControlSetSampleTimeRecordPtr = ^QTCustomControlSetSampleTimeRecord;
    QTCustomControlSetSampleTimeRecord = record
        storage:                Ptr;                                    {  storage for the control }
        sampleTime:             QTParamSampleTimePtr;                   {  sample time information or NIL }
    end;

    QTCustomControlSetSampleTimePtr     = ^QTCustomControlSetSampleTimeRecord;
    {
        pdActionCustomGetValue tells your control to store any value(s) into the specified atom container.

        All custom controls must implement this call
        }
    QTCustomControlGetValueRecordPtr = ^QTCustomControlGetValueRecord;
    QTCustomControlGetValueRecord = record
        storage:                Ptr;                                    {  storage for the control }
        sample:                 QTAtomContainer;                        {  sample to store into }
    end;

    QTCustomControlGetValuePtr          = ^QTCustomControlGetValueRecord;
    {
        pdActionCustomDoEditCommand tells your control to handle edit commands if it allow focus and type in boxes.

        All custom controls must implement this call if they support edit boxes
        }
    QTCustomControlDoEditCommandRecordPtr = ^QTCustomControlDoEditCommandRecord;
    QTCustomControlDoEditCommandRecord = record
        storage:                Ptr;                                    {  storage for the control }
        command:                SInt32;                             {  command to execute, return 0 here if processed }
    end;

    QTCustomControlDoEditCommandPtr     = ^QTCustomControlDoEditCommandRecord;
    QTParameterDialog                   = SInt32;

const
    elOptionsIncludeNoneInList  = $00000001;                    {  "None" effect is included in list  }


type
    QTEffectListOptions                 = SInt32;

const
    pdOptionsCollectOneValue    = $00000001;                    {  should collect a single value only }
    pdOptionsAllowOptionalInterpolations = $00000002;           {  non-novice interpolation options are shown  }
    pdOptionsModalDialogBox     = $00000004;                    {  dialog box should be modal  }
    pdOptionsEditCurrentEffectOnly = $00000008;                 {  List of effects will not be shown  }
    pdOptionsHidePreview        = $00000010;                    {  Preview item will not be shown  }

    effectIsRealtime            = 0;                            {  effect can be rendered in real time  }

    {
        QTGetEffectsListExtended is a call that provides for
        more advanced filtering of effects to be placed into the
        effect list.  Applications can filter on:
         1) number of input sources
         2) effect major or minor class
         3) custom filtering through a callback
        The callback will be called for each effect which passes
        the other criteria for inclusion.  If the callback
        returns a true result the effect will be included in the list.

        Note that your filter proc may receive multiple effects from various
        manufacturers.  If you return true for multiple effects of a given type
        only the one with the higher parameter version number will be included.
        If you wish other filtering (such as effects from a given manufacturer, you
        can do this by return false for the other effects and true for those
        that you prefer.
        }

type
    QTEffectListFilterProcPtr = function(effect: Component; effectMinSource: SInt32; effectMaxSource: SInt32; majorClass: OSType; minorClass: OSType; refcon: UnivPtr): boolean;

    QTEffectListFilterUPP = ^SInt32; { an opaque UPP }
    {
     *  QTGetEffectsList()
     *
     *  Availability:
     *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
     *    Windows:          in qtmlClient.lib 3.0 and later
        }
function QTGetEffectsList(var returnedList: QTAtomContainer; minSources: SInt32; maxSources: SInt32; getOptions: QTEffectListOptions): OSErr; external name '_QTGetEffectsList';
{
 *  QTGetEffectsListExtended()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 6.0 and later
 *    CarbonLib:        in CarbonLib 1.6 and later
 *    Mac OS X:         in version 10.2 and later
 *    Windows:          in qtmlClient.lib 6.0 and later
 }
function QTGetEffectsListExtended(var returnedList: QTAtomContainer; minSources: SInt32; maxSources: SInt32; getOptions: QTEffectListOptions; majorClass: OSType; minorClass: OSType; filterProc: QTEffectListFilterUPP; filterRefCon: UnivPtr): OSErr; external name '_QTGetEffectsListExtended';
{
 *  QTCreateStandardParameterDialog()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function QTCreateStandardParameterDialog(effectList: QTAtomContainer; parameters: QTAtomContainer; dialogOptions: QTParameterDialogOptions; var createdDialog: QTParameterDialog): OSErr; external name '_QTCreateStandardParameterDialog';
{
 *  QTIsStandardParameterDialogEvent()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function QTIsStandardParameterDialogEvent(var pEvent: EventRecord; createdDialog: QTParameterDialog): OSErr; external name '_QTIsStandardParameterDialogEvent';
{
 *  QTDismissStandardParameterDialog()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function QTDismissStandardParameterDialog(createdDialog: QTParameterDialog): OSErr; external name '_QTDismissStandardParameterDialog';
{
 *  QTStandardParameterDialogDoAction()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function QTStandardParameterDialogDoAction(createdDialog: QTParameterDialog; action: SInt32; params: UnivPtr): OSErr; external name '_QTStandardParameterDialogDoAction';
{
 *  QTGetEffectSpeed()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function QTGetEffectSpeed(parameters: QTAtomContainer; var pFPS: Fixed): OSErr; external name '_QTGetEffectSpeed';
{****
    Error reporting
****}

type
    QTErrorReplacementRecordPtr = ^QTErrorReplacementRecord;
    QTErrorReplacementRecord = record
        numEntries:             SInt32;
        replacementString:      array [0..0] of StringPtr;              {  array of numEntries StringPtrs (each String is allocated separately). }
    end;

    QTErrorReplacementPtr               = ^QTErrorReplacementRecord;
    {
        QTAddMovieError is used to add orthogonal errors to a list of errors that will
        later be reported (at the end of an import or playback, for example).  Errors are stored
        in 'qter' resources within the component.

        QTAddMovieError(Movie       addTo,                          // in: movie to add error to
                        Component   adder,                          // in: component which is adding the error
                        long        errorCode,                      // in: error code being added
                        QTErrorReplacementPtr   stringReplacements);// in: list of strings to subsitute (in order) for "^1", "^2", etc
        }
    {
     *  QTAddMovieError()
     *
     *  Availability:
     *    Non-Carbon CFM:   in QuickTimeLib 6.0 and later
     *    CarbonLib:        in CarbonLib 1.6 and later
     *    Mac OS X:         in version 10.2 and later
     *    Windows:          in qtmlClient.lib 6.0 and later
        }
function QTAddMovieError(movieH: Movie; c: Component; errorCode: SInt32; stringReplacements: QTErrorReplacementPtr): OSErr; external name '_QTAddMovieError';
{****
    Access Keys
****}

const
    kAccessKeyAtomType          = $61636B79 (* 'acky' *);

    kAccessKeySystemFlag        = $00000001;

    {
     *  QTGetAccessKeys()
     *
     *  Availability:
     *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
     *    Windows:          in qtmlClient.lib 3.0 and later
        }
function QTGetAccessKeys(var accessKeyType: Str255; flags: SInt32; var keys: QTAtomContainer): OSErr; external name '_QTGetAccessKeys';
{
 *  QTRegisterAccessKey()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function QTRegisterAccessKey(var accessKeyType: Str255; flags: SInt32; accessKey: Handle): OSErr; external name '_QTRegisterAccessKey';
{
 *  QTUnregisterAccessKey()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function QTUnregisterAccessKey(var accessKeyType: Str255; flags: SInt32; accessKey: Handle): OSErr; external name '_QTUnregisterAccessKey';
{****
    Content Restrictions
****}

{
 *  QTGetMovieRestrictions()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 6.0 and later
 *    CarbonLib:        in CarbonLib 1.6 and later
 *    Mac OS X:         in version 10.2 and later
 *    Windows:          in qtmlClient.lib 6.0 and later
 }
function QTGetMovieRestrictions(theMovie: Movie; var outRestrictionSet: QTRestrictionSet; var outSeed: UInt32): OSErr; external name '_QTGetMovieRestrictions';
{
 *  QTRestrictionsGetInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 6.0 and later
 *    CarbonLib:        in CarbonLib 1.6 and later
 *    Mac OS X:         in version 10.2 and later
 *    Windows:          in qtmlClient.lib 6.0 and later
 }
function QTRestrictionsGetInfo(inRestrictionSet: QTRestrictionSet; var outRestrictionClassCount: SInt32; var outSeed: SInt32): OSErr; external name '_QTRestrictionsGetInfo';
{
 *  QTRestrictionsGetIndClass()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 6.0 and later
 *    CarbonLib:        in CarbonLib 1.6 and later
 *    Mac OS X:         in version 10.2 and later
 *    Windows:          in qtmlClient.lib 6.0 and later
 }
function QTRestrictionsGetIndClass(inRestrictionSet: QTRestrictionSet; inIndex: SInt32; var outClass: OSType): OSErr; external name '_QTRestrictionsGetIndClass';
{
 *  QTRestrictionsGetItem()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 6.0 and later
 *    CarbonLib:        in CarbonLib 1.6 and later
 *    Mac OS X:         in version 10.2 and later
 *    Windows:          in qtmlClient.lib 6.0 and later
 }
function QTRestrictionsGetItem(inRestrictionSet: QTRestrictionSet; inRestrictionClass: OSType; var outRestrictions: UInt32): OSErr; external name '_QTRestrictionsGetItem';
{
 *  QTGetSupportedRestrictions()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 6.0 and later
 *    CarbonLib:        in CarbonLib 1.6 and later
 *    Mac OS X:         in version 10.2 and later
 *    Windows:          in qtmlClient.lib 6.0 and later
 }
function QTGetSupportedRestrictions(inRestrictionClass: OSType; var outRestrictionIDs: UInt32): OSErr; external name '_QTGetSupportedRestrictions';
{
 *  QTCreateUUID()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 6.0 and later
 *    CarbonLib:        in CarbonLib 1.6 and later
 *    Mac OS X:         in version 10.2 and later
 *    Windows:          in qtmlClient.lib 6.0 and later
 }
function QTCreateUUID(var outUUID: QTUUID; creationFlags: SInt32): OSErr; external name '_QTCreateUUID';
{
 *  QTEqualUUIDs()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 6.0 and later
 *    CarbonLib:        in CarbonLib 1.6 and later
 *    Mac OS X:         in version 10.2 and later
 *    Windows:          in qtmlClient.lib 6.0 and later
 }
function QTEqualUUIDs(const (*var*) uuid1: QTUUID; const (*var*) uuid2: QTUUID): boolean; external name '_QTEqualUUIDs';
{****
    Time table
****}
{
 *  MakeTrackTimeTable()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MakeTrackTimeTable(trackH: Track; var offsets: SInt32Ptr; startTime: TimeValue; endTime: TimeValue; timeIncrement: TimeValue; firstDataRefIndex: SInt16; lastDataRefIndex: SInt16; var retdataRefSkew: SInt32): OSErr; external name '_MakeTrackTimeTable';
{
 *  MakeMediaTimeTable()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MakeMediaTimeTable(theMedia: Media; var offsets: SInt32Ptr; startTime: TimeValue; endTime: TimeValue; timeIncrement: TimeValue; firstDataRefIndex: SInt16; lastDataRefIndex: SInt16; var retdataRefSkew: SInt32): OSErr; external name '_MakeMediaTimeTable';
{
 *  GetMaxLoadedTimeInMovie()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetMaxLoadedTimeInMovie(theMovie: Movie; var time: TimeValue): OSErr; external name '_GetMaxLoadedTimeInMovie';
{
 *  QTMovieNeedsTimeTable()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function QTMovieNeedsTimeTable(theMovie: Movie; var needsTimeTable: boolean): OSErr; external name '_QTMovieNeedsTimeTable';
{
 *  QTGetDataRefMaxFileOffset()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function QTGetDataRefMaxFileOffset(movieH: Movie; dataRefType: OSType; dataRef: Handle; var offset: SInt32): OSErr; external name '_QTGetDataRefMaxFileOffset';
{****
    Bandwidth management support
****}

const
    ConnectionSpeedPrefsType    = $63737064 (* 'cspd' *);
    BandwidthManagementPrefsType = $62776D67 (* 'bwmg' *);



type
    ConnectionSpeedPrefsRecordPtr = ^ConnectionSpeedPrefsRecord;
    ConnectionSpeedPrefsRecord = record
        connectionSpeed:        SInt32;
    end;

    ConnectionSpeedPrefsPtr             = ^ConnectionSpeedPrefsRecord;
    ConnectionSpeedPrefsHandle          = ^ConnectionSpeedPrefsPtr;
    BandwidthManagementPrefsRecordPtr = ^BandwidthManagementPrefsRecord;
    BandwidthManagementPrefsRecord = record
        overrideConnectionSpeedForBandwidth: boolean;
    end;

    BandwidthManagementPrefsPtr         = ^BandwidthManagementPrefsRecord;
    BandwidthManagementPrefsHandle      = ^BandwidthManagementPrefsPtr;

const
    kQTIdlePriority             = 10;
    kQTNonRealTimePriority      = 20;
    kQTRealTimeSharedPriority   = 25;
    kQTRealTimePriority         = 30;

    kQTBandwidthNotifyNeedToStop = $00000001;
    kQTBandwidthNotifyGoodToGo  = $00000002;
    kQTBandwidthChangeRequest   = $00000004;
    kQTBandwidthQueueRequest    = $00000008;
    kQTBandwidthScheduledRequest = $00000010;
    kQTBandwidthVoluntaryRelease = $00000020;


type
    QTBandwidthNotificationProcPtr = function(flags: SInt32; reserved: UnivPtr; refcon: UnivPtr): OSErr;

    QTScheduledBandwidthRecordPtr = ^QTScheduledBandwidthRecord;
    QTScheduledBandwidthRecord = record
        recordSize:             SInt32;                             {  total number of bytes in QTScheduledBandwidthRecord }
        priority:               SInt32;
        dataRate:               SInt32;
        startTime:              CompTimeValue;                          {  bandwidth usage start time }
        duration:               CompTimeValue;                          {  duration of bandwidth usage (0 if unknown) }
        prerollDuration:        CompTimeValue;                          {  time for negotiation before startTime (0 if unknown) }
        scale:                  TimeScale;                              {  timescale of value/duration/prerollDuration fields }
        base:                   TimeBase;                               {  timebase }
    end;

    QTScheduledBandwidthPtr             = ^QTScheduledBandwidthRecord;
    QTScheduledBandwidthHandle          = ^QTScheduledBandwidthPtr;
    QTBandwidthNotificationUPP = ^SInt32; { an opaque UPP }
    {
     *  QTBandwidthRequest()
     *
     *  Availability:
     *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
     *    CarbonLib:        in CarbonLib 1.0.2 and later
     *    Mac OS X:         in version 10.0 and later
     *    Windows:          in qtmlClient.lib 4.0 and later
        }
function QTBandwidthRequest(priority: SInt32; callback: QTBandwidthNotificationUPP; refcon: UnivPtr; var bwRef: QTBandwidthReference; flags: SInt32): OSErr; external name '_QTBandwidthRequest';
{
 *  QTBandwidthRequestForTimeBase()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.1 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.1 and later
 }
function QTBandwidthRequestForTimeBase(tb: TimeBase; priority: SInt32; callback: QTBandwidthNotificationUPP; refcon: UnivPtr; var bwRef: QTBandwidthReference; flags: SInt32): OSErr; external name '_QTBandwidthRequestForTimeBase';
{
 *  QTBandwidthRelease()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function QTBandwidthRelease(bwRef: QTBandwidthReference; flags: SInt32): OSErr; external name '_QTBandwidthRelease';
{
 *  QTScheduledBandwidthRequest()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.1 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.1 and later
 }
function QTScheduledBandwidthRequest(scheduleRec: QTScheduledBandwidthPtr; notificationCallback: QTBandwidthNotificationUPP; refcon: UnivPtr; var sbwRef: QTScheduledBandwidthReference; flags: SInt32): OSErr; external name '_QTScheduledBandwidthRequest';
{
 *  QTScheduledBandwidthRelease()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.1 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.1 and later
 }
function QTScheduledBandwidthRelease(sbwRef: QTScheduledBandwidthReference; flags: SInt32): OSErr; external name '_QTScheduledBandwidthRelease';
const
    uppQTCallBackProcInfo = $000003C0;
    uppQTSyncTaskProcInfo = $000000C0;
    uppMovieRgnCoverProcInfo = $00000FE0;
    uppMovieProgressProcInfo = $0000FAE0;
    uppMovieDrawingCompleteProcInfo = $000003E0;
    uppTrackTransferProcInfo = $000003E0;
    uppGetMovieProcInfo = $00003FE0;
    uppMoviePreviewCallOutProcInfo = $000000D0;
    uppTextMediaProcInfo = $00003FE0;
    uppActionsProcInfo = $00003FE0;
    uppDoMCActionProcInfo = $00003EE0;
    uppMovieExecuteWiredActionsProcInfo = $00003FE0;
    uppMoviePrePrerollCompleteProcInfo = $00000EC0;
    uppQTNextTaskNeededSoonerCallbackProcInfo = $00000FC0;
    uppMoviesErrorProcInfo = $00000380;
    uppTweenerDataProcInfo = $003FFFF0;
    uppQTEffectListFilterProcInfo = $0003FFD0;
    uppQTBandwidthNotificationProcInfo = $00000FE0;
    {
     *  NewQTCallBackUPP()
     *
     *  Availability:
     *    Non-Carbon CFM:   available as macro/inline
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function NewQTCallBackUPP(userRoutine: QTCallBackProcPtr): QTCallBackUPP; external name '_NewQTCallBackUPP'; { old name was NewQTCallBackProc }
{
 *  NewQTSyncTaskUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewQTSyncTaskUPP(userRoutine: QTSyncTaskProcPtr): QTSyncTaskUPP; external name '_NewQTSyncTaskUPP'; { old name was NewQTSyncTaskProc }
{
 *  NewMovieRgnCoverUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewMovieRgnCoverUPP(userRoutine: MovieRgnCoverProcPtr): MovieRgnCoverUPP; external name '_NewMovieRgnCoverUPP'; { old name was NewMovieRgnCoverProc }
{
 *  NewMovieProgressUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewMovieProgressUPP(userRoutine: MovieProgressProcPtr): MovieProgressUPP; external name '_NewMovieProgressUPP'; { old name was NewMovieProgressProc }
{
 *  NewMovieDrawingCompleteUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewMovieDrawingCompleteUPP(userRoutine: MovieDrawingCompleteProcPtr): MovieDrawingCompleteUPP; external name '_NewMovieDrawingCompleteUPP'; { old name was NewMovieDrawingCompleteProc }
{
 *  NewTrackTransferUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewTrackTransferUPP(userRoutine: TrackTransferProcPtr): TrackTransferUPP; external name '_NewTrackTransferUPP'; { old name was NewTrackTransferProc }
{
 *  NewGetMovieUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewGetMovieUPP(userRoutine: GetMovieProcPtr): GetMovieUPP; external name '_NewGetMovieUPP'; { old name was NewGetMovieProc }
{
 *  NewMoviePreviewCallOutUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewMoviePreviewCallOutUPP(userRoutine: MoviePreviewCallOutProcPtr): MoviePreviewCallOutUPP; external name '_NewMoviePreviewCallOutUPP'; { old name was NewMoviePreviewCallOutProc }
{
 *  NewTextMediaUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewTextMediaUPP(userRoutine: TextMediaProcPtr): TextMediaUPP; external name '_NewTextMediaUPP'; { old name was NewTextMediaProc }
{
 *  NewActionsUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewActionsUPP(userRoutine: ActionsProcPtr): ActionsUPP; external name '_NewActionsUPP'; { old name was NewActionsProc }
{
 *  NewDoMCActionUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewDoMCActionUPP(userRoutine: DoMCActionProcPtr): DoMCActionUPP; external name '_NewDoMCActionUPP'; { old name was NewDoMCActionProc }
{
 *  NewMovieExecuteWiredActionsUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewMovieExecuteWiredActionsUPP(userRoutine: MovieExecuteWiredActionsProcPtr): MovieExecuteWiredActionsUPP; external name '_NewMovieExecuteWiredActionsUPP'; { old name was NewMovieExecuteWiredActionsProc }
{
 *  NewMoviePrePrerollCompleteUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewMoviePrePrerollCompleteUPP(userRoutine: MoviePrePrerollCompleteProcPtr): MoviePrePrerollCompleteUPP; external name '_NewMoviePrePrerollCompleteUPP'; { old name was NewMoviePrePrerollCompleteProc }
{
 *  NewQTNextTaskNeededSoonerCallbackUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.6 and later
 *    Mac OS X:         in version 10.2 and later
 }
function NewQTNextTaskNeededSoonerCallbackUPP(userRoutine: QTNextTaskNeededSoonerCallbackProcPtr): QTNextTaskNeededSoonerCallbackUPP; external name '_NewQTNextTaskNeededSoonerCallbackUPP'; { old name was NewQTNextTaskNeededSoonerCallbackProc }
{
 *  NewMoviesErrorUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewMoviesErrorUPP(userRoutine: MoviesErrorProcPtr): MoviesErrorUPP; external name '_NewMoviesErrorUPP'; { old name was NewMoviesErrorProc }
{
 *  NewTweenerDataUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewTweenerDataUPP(userRoutine: TweenerDataProcPtr): TweenerDataUPP; external name '_NewTweenerDataUPP'; { old name was NewTweenerDataProc }
{
 *  NewQTEffectListFilterUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.6 and later
 *    Mac OS X:         in version 10.2 and later
 }
function NewQTEffectListFilterUPP(userRoutine: QTEffectListFilterProcPtr): QTEffectListFilterUPP; external name '_NewQTEffectListFilterUPP'; { old name was NewQTEffectListFilterProc }
{
 *  NewQTBandwidthNotificationUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewQTBandwidthNotificationUPP(userRoutine: QTBandwidthNotificationProcPtr): QTBandwidthNotificationUPP; external name '_NewQTBandwidthNotificationUPP'; { old name was NewQTBandwidthNotificationProc }
{
 *  DisposeQTCallBackUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeQTCallBackUPP(userUPP: QTCallBackUPP); external name '_DisposeQTCallBackUPP';
{
 *  DisposeQTSyncTaskUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeQTSyncTaskUPP(userUPP: QTSyncTaskUPP); external name '_DisposeQTSyncTaskUPP';
{
 *  DisposeMovieRgnCoverUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeMovieRgnCoverUPP(userUPP: MovieRgnCoverUPP); external name '_DisposeMovieRgnCoverUPP';
{
 *  DisposeMovieProgressUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeMovieProgressUPP(userUPP: MovieProgressUPP); external name '_DisposeMovieProgressUPP';
{
 *  DisposeMovieDrawingCompleteUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeMovieDrawingCompleteUPP(userUPP: MovieDrawingCompleteUPP); external name '_DisposeMovieDrawingCompleteUPP';
{
 *  DisposeTrackTransferUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeTrackTransferUPP(userUPP: TrackTransferUPP); external name '_DisposeTrackTransferUPP';
{
 *  DisposeGetMovieUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeGetMovieUPP(userUPP: GetMovieUPP); external name '_DisposeGetMovieUPP';
{
 *  DisposeMoviePreviewCallOutUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeMoviePreviewCallOutUPP(userUPP: MoviePreviewCallOutUPP); external name '_DisposeMoviePreviewCallOutUPP';
{
 *  DisposeTextMediaUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeTextMediaUPP(userUPP: TextMediaUPP); external name '_DisposeTextMediaUPP';
{
 *  DisposeActionsUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeActionsUPP(userUPP: ActionsUPP); external name '_DisposeActionsUPP';
{
 *  DisposeDoMCActionUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeDoMCActionUPP(userUPP: DoMCActionUPP); external name '_DisposeDoMCActionUPP';
{
 *  DisposeMovieExecuteWiredActionsUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeMovieExecuteWiredActionsUPP(userUPP: MovieExecuteWiredActionsUPP); external name '_DisposeMovieExecuteWiredActionsUPP';
{
 *  DisposeMoviePrePrerollCompleteUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeMoviePrePrerollCompleteUPP(userUPP: MoviePrePrerollCompleteUPP); external name '_DisposeMoviePrePrerollCompleteUPP';
{
 *  DisposeQTNextTaskNeededSoonerCallbackUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.6 and later
 *    Mac OS X:         in version 10.2 and later
 }
procedure DisposeQTNextTaskNeededSoonerCallbackUPP(userUPP: QTNextTaskNeededSoonerCallbackUPP); external name '_DisposeQTNextTaskNeededSoonerCallbackUPP';
{
 *  DisposeMoviesErrorUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeMoviesErrorUPP(userUPP: MoviesErrorUPP); external name '_DisposeMoviesErrorUPP';
{
 *  DisposeTweenerDataUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeTweenerDataUPP(userUPP: TweenerDataUPP); external name '_DisposeTweenerDataUPP';
{
 *  DisposeQTEffectListFilterUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.6 and later
 *    Mac OS X:         in version 10.2 and later
 }
procedure DisposeQTEffectListFilterUPP(userUPP: QTEffectListFilterUPP); external name '_DisposeQTEffectListFilterUPP';
{
 *  DisposeQTBandwidthNotificationUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeQTBandwidthNotificationUPP(userUPP: QTBandwidthNotificationUPP); external name '_DisposeQTBandwidthNotificationUPP';
{
 *  InvokeQTCallBackUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvokeQTCallBackUPP(cb: QTCallBack; refCon: SInt32; userRoutine: QTCallBackUPP); external name '_InvokeQTCallBackUPP'; { old name was CallQTCallBackProc }
{
 *  InvokeQTSyncTaskUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvokeQTSyncTaskUPP(task: UnivPtr; userRoutine: QTSyncTaskUPP); external name '_InvokeQTSyncTaskUPP'; { old name was CallQTSyncTaskProc }
{
 *  InvokeMovieRgnCoverUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeMovieRgnCoverUPP(theMovie: Movie; changedRgn: RgnHandle; refcon: SInt32; userRoutine: MovieRgnCoverUPP): OSErr; external name '_InvokeMovieRgnCoverUPP'; { old name was CallMovieRgnCoverProc }
{
 *  InvokeMovieProgressUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeMovieProgressUPP(theMovie: Movie; message: SInt16; whatOperation: SInt16; percentDone: Fixed; refcon: SInt32; userRoutine: MovieProgressUPP): OSErr; external name '_InvokeMovieProgressUPP'; { old name was CallMovieProgressProc }
{
 *  InvokeMovieDrawingCompleteUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeMovieDrawingCompleteUPP(theMovie: Movie; refCon: SInt32; userRoutine: MovieDrawingCompleteUPP): OSErr; external name '_InvokeMovieDrawingCompleteUPP'; { old name was CallMovieDrawingCompleteProc }
{
 *  InvokeTrackTransferUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeTrackTransferUPP(t: Track; refCon: SInt32; userRoutine: TrackTransferUPP): OSErr; external name '_InvokeTrackTransferUPP'; { old name was CallTrackTransferProc }
{
 *  InvokeGetMovieUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeGetMovieUPP(offset: SInt32; size: SInt32; dataPtr: UnivPtr; refCon: UnivPtr; userRoutine: GetMovieUPP): OSErr; external name '_InvokeGetMovieUPP'; { old name was CallGetMovieProc }
{
 *  InvokeMoviePreviewCallOutUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeMoviePreviewCallOutUPP(refcon: SInt32; userRoutine: MoviePreviewCallOutUPP): boolean; external name '_InvokeMoviePreviewCallOutUPP'; { old name was CallMoviePreviewCallOutProc }
{
 *  InvokeTextMediaUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeTextMediaUPP(theText: Handle; theMovie: Movie; var displayFlag: SInt16; refcon: SInt32; userRoutine: TextMediaUPP): OSErr; external name '_InvokeTextMediaUPP'; { old name was CallTextMediaProc }
{
 *  InvokeActionsUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeActionsUPP(refcon: UnivPtr; targetTrack: Track; targetRefCon: SInt32; theEvent: QTEventRecordPtr; userRoutine: ActionsUPP): OSErr; external name '_InvokeActionsUPP'; { old name was CallActionsProc }
{
 *  InvokeDoMCActionUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeDoMCActionUPP(refcon: UnivPtr; action: SInt16; params: UnivPtr; var handled: boolean; userRoutine: DoMCActionUPP): OSErr; external name '_InvokeDoMCActionUPP'; { old name was CallDoMCActionProc }
{
 *  InvokeMovieExecuteWiredActionsUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeMovieExecuteWiredActionsUPP(theMovie: Movie; refcon: UnivPtr; flags: SInt32; wiredActions: QTAtomContainer; userRoutine: MovieExecuteWiredActionsUPP): OSErr; external name '_InvokeMovieExecuteWiredActionsUPP'; { old name was CallMovieExecuteWiredActionsProc }
{
 *  InvokeMoviePrePrerollCompleteUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvokeMoviePrePrerollCompleteUPP(theMovie: Movie; prerollErr: OSErr; refcon: UnivPtr; userRoutine: MoviePrePrerollCompleteUPP); external name '_InvokeMoviePrePrerollCompleteUPP'; { old name was CallMoviePrePrerollCompleteProc }
{
 *  InvokeQTNextTaskNeededSoonerCallbackUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.6 and later
 *    Mac OS X:         in version 10.2 and later
 }
procedure InvokeQTNextTaskNeededSoonerCallbackUPP(duration: TimeValue; flags: UInt32; refcon: UnivPtr; userRoutine: QTNextTaskNeededSoonerCallbackUPP); external name '_InvokeQTNextTaskNeededSoonerCallbackUPP'; { old name was CallQTNextTaskNeededSoonerCallbackProc }
{
 *  InvokeMoviesErrorUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvokeMoviesErrorUPP(theErr: OSErr; refcon: SInt32; userRoutine: MoviesErrorUPP); external name '_InvokeMoviesErrorUPP'; { old name was CallMoviesErrorProc }
{
 *  InvokeTweenerDataUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeTweenerDataUPP(tr: TweenRecordPtr; tweenData: UnivPtr; tweenDataSize: SInt32; dataDescriptionSeed: SInt32; dataDescription: Handle; asyncCompletionProc: ICMCompletionProcRecordPtr; transferProc: UniversalProcPtr; refCon: UnivPtr; userRoutine: TweenerDataUPP): ComponentResult; external name '_InvokeTweenerDataUPP'; { old name was CallTweenerDataProc }
{
 *  InvokeQTEffectListFilterUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.6 and later
 *    Mac OS X:         in version 10.2 and later
 }
function InvokeQTEffectListFilterUPP(effect: Component; effectMinSource: SInt32; effectMaxSource: SInt32; majorClass: OSType; minorClass: OSType; refcon: UnivPtr; userRoutine: QTEffectListFilterUPP): boolean; external name '_InvokeQTEffectListFilterUPP'; { old name was CallQTEffectListFilterProc }
{
 *  InvokeQTBandwidthNotificationUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeQTBandwidthNotificationUPP(flags: SInt32; reserved: UnivPtr; refcon: UnivPtr; userRoutine: QTBandwidthNotificationUPP): OSErr; external name '_InvokeQTBandwidthNotificationUPP'; { old name was CallQTBandwidthNotificationProc }
{****
    QT International Text Atom Support
****}

const
    kITextRemoveEverythingBut   = $00;
    kITextRemoveLeaveSuggestedAlternate = $02;

    kITextAtomType              = $69747874 (* 'itxt' *);
    kITextStringAtomType        = $74657874 (* 'text' *);

    {
     *  ITextAddString()
     *
     *  Availability:
     *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
     *    Windows:          in qtmlClient.lib 3.0 and later
        }
function ITextAddString(container: QTAtomContainer; parentAtom: QTAtom; theRegionCode: RegionCode; const (*var*) theString: Str255): OSErr; external name '_ITextAddString';
{
 *  ITextRemoveString()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function ITextRemoveString(container: QTAtomContainer; parentAtom: QTAtom; theRegionCode: RegionCode; flags: SInt32): OSErr; external name '_ITextRemoveString';
{
 *  ITextGetString()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function ITextGetString(container: QTAtomContainer; parentAtom: QTAtom; requestedRegion: RegionCode; var foundRegion: RegionCode; theString: StringPtr): OSErr; external name '_ITextGetString';
{
 *  QTTextToNativeText()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function QTTextToNativeText(theText: Handle; encoding: SInt32; flags: SInt32): OSErr; external name '_QTTextToNativeText';
{  QTParseTextHREF inContainer atoms }

const
    kQTParseTextHREFText        = $74657874 (* 'text' *);                       {  string }
    kQTParseTextHREFBaseURL     = $6275726C (* 'burl' *);                       {  string }
    kQTParseTextHREFClickPoint  = $636C696B (* 'clik' *);                       {  Point; if present, QTParseTextHREF will expand URLs to support server-side image maps }
    kQTParseTextHREFUseAltDelim = $616C7464 (* 'altd' *);                       {  boolean; if no kQTParseTextHREFDelimiter, delim is ':' }
    kQTParseTextHREFDelimiter   = $64656C6D (* 'delm' *);                       {  character }
    kQTParseTextHREFRecomposeHREF = $72687266 (* 'rhrf' *);                     {  Boolean; if true, QTParseTextHREF returns recomposed HREF with URL expanded as appropriate }

    {  QTParseTextHREF outContainer atoms }
    kQTParseTextHREFURL         = $75726C20 (* 'url ' *);                       {  string }
    kQTParseTextHREFTarget      = $74617267 (* 'targ' *);                       {  string }
    kQTParseTextHREFChapter     = $63686170 (* 'chap' *);                       {  string }
    kQTParseTextHREFIsAutoHREF  = $6175746F (* 'auto' *);                       {  Boolean }
    kQTParseTextHREFIsServerMap = $736D6170 (* 'smap' *);                       {  Boolean }
    kQTParseTextHREFHREF        = $68726566 (* 'href' *);                       {  string; recomposed HREF with URL expanded as appropriate, suitable for mcActionLinkToURL }
    kQTParseTextHREFEMBEDArgs   = $6D626564 (* 'mbed' *);                       {  string; text between 'E<' and '>' to be used as new movie's embed tags }

    {
     *  QTParseTextHREF()
     *
     *  Availability:
     *    Non-Carbon CFM:   in QuickTimeLib 4.1 and later
     *    CarbonLib:        in CarbonLib 1.1 and later
     *    Mac OS X:         in version 10.0 and later
     *    Windows:          in qtmlClient.lib 4.1 and later
        }
function QTParseTextHREF(href: CStringPtr; hrefLen: SInt32; inContainer: QTAtomContainer; var outContainer: QTAtomContainer): OSErr; external name '_QTParseTextHREF';
{************************
* track reference types
*************************}

const
    kTrackReferenceChapterList  = $63686170 (* 'chap' *);
    kTrackReferenceTimeCode     = $746D6364 (* 'tmcd' *);
    kTrackReferenceModifier     = $73737263 (* 'ssrc' *);

    {   ************************
    * modifier track types
    *************************   }
    kTrackModifierInput         = $696E;                        {  is really 'in' }
    kTrackModifierType          = $7479;                        {  is really 'ty' }
    kTrackModifierReference     = $73737263 (* 'ssrc' *);
    kTrackModifierObjectID      = $6F626964 (* 'obid' *);
    kTrackModifierInputName     = $6E616D65 (* 'name' *);

    kInputMapSubInputID         = $73756269 (* 'subi' *);

    kTrackModifierTypeMatrix    = 1;
    kTrackModifierTypeClip      = 2;
    kTrackModifierTypeGraphicsMode = 5;
    kTrackModifierTypeVolume    = 3;
    kTrackModifierTypeBalance   = 4;
    kTrackModifierTypeImage     = $76696465 (* 'vide' *);                       {  was kTrackModifierTypeSpriteImage }
    kTrackModifierObjectMatrix  = 6;
    kTrackModifierObjectGraphicsMode = 7;
    kTrackModifierType3d4x4Matrix = 8;
    kTrackModifierCameraData    = 9;
    kTrackModifierSoundLocalizationData = 10;
    kTrackModifierObjectImageIndex = 11;
    kTrackModifierObjectLayer   = 12;
    kTrackModifierObjectVisible = 13;
    kTrackModifierAngleAspectCamera = 14;
    kTrackModifierPanAngle      = $70616E20 (* 'pan ' *);
    kTrackModifierTiltAngle     = $74696C74 (* 'tilt' *);
    kTrackModifierVerticalFieldOfViewAngle = $666F7620 (* 'fov ' *);
    kTrackModifierObjectQTEventSend = $65766E74 (* 'evnt' *);
    kTrackModifierObjectCanBeHitTested = 15;


type
    ModifierTrackGraphicsModeRecordPtr = ^ModifierTrackGraphicsModeRecord;
    ModifierTrackGraphicsModeRecord = record
        graphicsMode:           SInt32;
        opColor:                RGBColor;
    end;


    {   ************************
    * tween track types
    *************************   }

const
    kTweenTypeShort             = 1;
    kTweenTypeLong              = 2;
    kTweenTypeFixed             = 3;
    kTweenTypePoint             = 4;
    kTweenTypeQDRect            = 5;
    kTweenTypeQDRegion          = 6;
    kTweenTypeMatrix            = 7;
    kTweenTypeRGBColor          = 8;
    kTweenTypeGraphicsModeWithRGBColor = 9;
    kTweenTypeQTFloatSingle     = 10;
    kTweenTypeQTFloatDouble     = 11;
    kTweenTypeFixedPoint        = 12;
    kTweenType3dScale           = $33736361 (* '3sca' *);
    kTweenType3dTranslate       = $33747261 (* '3tra' *);
    kTweenType3dRotate          = $33726F74 (* '3rot' *);
    kTweenType3dRotateAboutPoint = $33726170 (* '3rap' *);
    kTweenType3dRotateAboutAxis = $33726178 (* '3rax' *);
    kTweenType3dRotateAboutVector = $33727663 (* '3rvc' *);
    kTweenType3dQuaternion      = $33717561 (* '3qua' *);
    kTweenType3dMatrix          = $336D6174 (* '3mat' *);
    kTweenType3dCameraData      = $3363616D (* '3cam' *);
    kTweenType3dAngleAspectCameraData = $33636161 (* '3caa' *);
    kTweenType3dSoundLocalizationData = $33736C63 (* '3slc' *);
    kTweenTypePathToMatrixTranslation = $67786D74 (* 'gxmt' *);
    kTweenTypePathToMatrixRotation = $67787072 (* 'gxpr' *);
    kTweenTypePathToMatrixTranslationAndRotation = $67786D72 (* 'gxmr' *);
    kTweenTypePathToFixedPoint  = $67786670 (* 'gxfp' *);
    kTweenTypePathXtoY          = $67787879 (* 'gxxy' *);
    kTweenTypePathYtoX          = $67787978 (* 'gxyx' *);
    kTweenTypeAtomList          = $61746F6D (* 'atom' *);
    kTweenTypePolygon           = $706F6C79 (* 'poly' *);
    kTweenTypeMultiMatrix       = $6D756C6D (* 'mulm' *);
    kTweenTypeSpin              = $7370696E (* 'spin' *);
    kTweenType3dMatrixNonLinear = $336E6C72 (* '3nlr' *);
    kTweenType3dVRObject        = $3376726F (* '3vro' *);

    kTweenEntry                 = $7477656E (* 'twen' *);
    kTweenData                  = $64617461 (* 'data' *);
    kTweenType                  = $74776E74 (* 'twnt' *);
    kTweenStartOffset           = $74777374 (* 'twst' *);
    kTweenDuration              = $74776475 (* 'twdu' *);
    kTweenFlags                 = $666C6167 (* 'flag' *);
    kTweenOutputMin             = $6F6D696E (* 'omin' *);
    kTweenOutputMax             = $6F6D6178 (* 'omax' *);
    kTweenSequenceElement       = $73657165 (* 'seqe' *);
    kTween3dInitialCondition    = $69636E64 (* 'icnd' *);
    kTweenInterpolationID       = $696E7472 (* 'intr' *);
    kTweenRegionData            = $71647267 (* 'qdrg' *);
    kTweenPictureData           = $50494354 (* 'PICT' *);
    kListElementType            = $74797065 (* 'type' *);
    kListElementDataType        = $64617479 (* 'daty' *);
    kNameAtom                   = $6E616D65 (* 'name' *);
    kInitialRotationAtom        = $696E726F (* 'inro' *);
    kNonLinearTweenHeader       = $6E6C7468 (* 'nlth' *);

    {  kTweenFlags }
    kTweenReturnDelta           = $00000001;


type
    TweenSequenceEntryRecordPtr = ^TweenSequenceEntryRecord;
    TweenSequenceEntryRecord = record
        endPercent:             Fixed;
        tweenAtomID:            QTAtomID;
        dataAtomID:             QTAtomID;
    end;



    {   ****
        Content Restrictions
    ****    }

const
    kQTRestrictionClassSave     = $73617665 (* 'save' *);
    kQTRestrictionSaveDontAddMovieResource = $00000001;
    kQTRestrictionSaveDontFlatten = $00000002;
    kQTRestrictionSaveDontExport = $00000004;
    kQTRestrictionSaveDontExtract = $00000008;                  {  don't allow any form of extraction of content }
    kQTRestrictionClassEdit     = $65646974 (* 'edit' *);
    kQTRestrictionEditDontCopy  = $00000001;                    {  disable copy  }
    kQTRestrictionEditDontCut   = $00000002;                    {  disable cut  }
    kQTRestrictionEditDontPaste = $00000004;                    {  disable paste  }
    kQTRestrictionEditDontClear = $00000008;                    {  disable clear }
    kQTRestrictionEditDontModify = $00000010;                   {  don't allow modification of content }
    kQTRestrictionEditDontExtract = $00000020;                  {  don't allow any form of extraction of content }


    {   ************************
    * Video Media routines
    *************************   }


    videoFlagDontLeanAhead      = $00000001;




    {  use these five routines at your own peril }
    {
     *  VideoMediaResetStatistics()
     *
     *  Availability:
     *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
     *    Windows:          in qtmlClient.lib 3.0 and later
        }
function VideoMediaResetStatistics(mh: MediaHandler): ComponentResult; external name '_VideoMediaResetStatistics';
{
 *  VideoMediaGetStatistics()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function VideoMediaGetStatistics(mh: MediaHandler): ComponentResult; external name '_VideoMediaGetStatistics';
{
 *  VideoMediaGetStallCount()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function VideoMediaGetStallCount(mh: MediaHandler; var stalls: UInt32): ComponentResult; external name '_VideoMediaGetStallCount';
{
 *  VideoMediaSetCodecParameter()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function VideoMediaSetCodecParameter(mh: MediaHandler; cType: CodecType; parameterID: OSType; parameterChangeSeed: SInt32; dataPtr: UnivPtr; dataSize: SInt32): ComponentResult; external name '_VideoMediaSetCodecParameter';
{
 *  VideoMediaGetCodecParameter()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function VideoMediaGetCodecParameter(mh: MediaHandler; cType: CodecType; parameterID: OSType; outParameterData: Handle): ComponentResult; external name '_VideoMediaGetCodecParameter';
{************************
* Text Media routines
*************************}



{ Return displayFlags for TextProc }

const
    txtProcDefaultDisplay       = 0;                            {     Use the media's default }
    txtProcDontDisplay          = 1;                            {     Don't display the text }
    txtProcDoDisplay            = 2;                            {     Do display the text }

    {
     *  TextMediaSetTextProc()
     *
     *  Availability:
     *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
     *    Windows:          in qtmlClient.lib 3.0 and later
        }
function TextMediaSetTextProc(mh: MediaHandler; TextProc: TextMediaUPP; refcon: SInt32): ComponentResult; external name '_TextMediaSetTextProc';
{
 *  TextMediaAddTextSample()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function TextMediaAddTextSample(mh: MediaHandler; text: Ptr; size: UInt32; fontNumber: SInt16; fontSize: SInt16; txtFace: ByteParameter; var textColor: RGBColor; var backColor: RGBColor; textJustification: SInt16; var textBox: Rect; displayFlags: SInt32; scrollDelay: TimeValue; hiliteStart: SInt16; hiliteEnd: SInt16; var rgbHiliteColor: RGBColor; duration: TimeValue; var sampleTime: TimeValue): ComponentResult; external name '_TextMediaAddTextSample';
{
 *  TextMediaAddTESample()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function TextMediaAddTESample(mh: MediaHandler; hTE: TEHandle; var backColor: RGBColor; textJustification: SInt16; var textBox: Rect; displayFlags: SInt32; scrollDelay: TimeValue; hiliteStart: SInt16; hiliteEnd: SInt16; var rgbHiliteColor: RGBColor; duration: TimeValue; var sampleTime: TimeValue): ComponentResult; external name '_TextMediaAddTESample';
{
 *  TextMediaAddHiliteSample()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function TextMediaAddHiliteSample(mh: MediaHandler; hiliteStart: SInt16; hiliteEnd: SInt16; var rgbHiliteColor: RGBColor; duration: TimeValue; var sampleTime: TimeValue): ComponentResult; external name '_TextMediaAddHiliteSample';
{
 *  TextMediaDrawRaw()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function TextMediaDrawRaw(mh: MediaHandler; gw: GWorldPtr; gd: GDHandle; data: UnivPtr; dataSize: SInt32; tdh: TextDescriptionHandle): ComponentResult; external name '_TextMediaDrawRaw';
{
 *  TextMediaSetTextProperty()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function TextMediaSetTextProperty(mh: MediaHandler; atMediaTime: TimeValue; propertyType: SInt32; data: UnivPtr; dataSize: SInt32): ComponentResult; external name '_TextMediaSetTextProperty';
{
 *  TextMediaRawSetup()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function TextMediaRawSetup(mh: MediaHandler; gw: GWorldPtr; gd: GDHandle; data: UnivPtr; dataSize: SInt32; tdh: TextDescriptionHandle; sampleDuration: TimeValue): ComponentResult; external name '_TextMediaRawSetup';
{
 *  TextMediaRawIdle()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function TextMediaRawIdle(mh: MediaHandler; gw: GWorldPtr; gd: GDHandle; sampleTime: TimeValue; flagsIn: SInt32; var flagsOut: SInt32): ComponentResult; external name '_TextMediaRawIdle';
{
 *  TextMediaGetTextProperty()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 5.0 and later
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 5.0 and later
 }
function TextMediaGetTextProperty(mh: MediaHandler; atMediaTime: TimeValue; propertyType: SInt32; data: UnivPtr; dataSize: SInt32): ComponentResult; external name '_TextMediaGetTextProperty';
const
    findTextEdgeOK              = $01;                          {  Okay to find text at specified sample time }
    findTextCaseSensitive       = $02;                          {  Case sensitive search }
    findTextReverseSearch       = $04;                          {  Search from sampleTime backwards }
    findTextWrapAround          = $08;                          {  Wrap search when beginning or end of movie is hit }
    findTextUseOffset           = $10;                          {  Begin search at the given character offset into sample rather than edge }

    {
     *  TextMediaFindNextText()
     *
     *  Availability:
     *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
     *    Windows:          in qtmlClient.lib 3.0 and later
        }
function TextMediaFindNextText(mh: MediaHandler; text: Ptr; size: SInt32; findFlags: SInt16; startTime: TimeValue; var foundTime: TimeValue; var foundDuration: TimeValue; var offset: SInt32): ComponentResult; external name '_TextMediaFindNextText';
{
 *  TextMediaHiliteTextSample()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function TextMediaHiliteTextSample(mh: MediaHandler; sampleTime: TimeValue; hiliteStart: SInt16; hiliteEnd: SInt16; var rgbHiliteColor: RGBColor): ComponentResult; external name '_TextMediaHiliteTextSample';
const
    dropShadowOffsetType        = $6472706F (* 'drpo' *);
    dropShadowTranslucencyType  = $64727074 (* 'drpt' *);

    {
     *  TextMediaSetTextSampleData()
     *
     *  Availability:
     *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
     *    Windows:          in qtmlClient.lib 3.0 and later
        }
function TextMediaSetTextSampleData(mh: MediaHandler; data: UnivPtr; dataType: OSType): ComponentResult; external name '_TextMediaSetTextSampleData';
{************************
* Sprite Media routines
*************************}
{ flags for sprite hit test routines }

const
    spriteHitTestBounds         = $00000001;                    {     point must only be within sprite's bounding box }
    spriteHitTestImage          = $00000002;                    {   point must be within the shape of the sprite's image }
    spriteHitTestInvisibleSprites = $00000004;                  {   invisible sprites may be hit tested }
    spriteHitTestIsClick        = $00000008;                    {   for codecs that want mouse events }
    spriteHitTestLocInDisplayCoordinates = $00000010;           {     set if you want to pass a display coordiate point to SpriteHitTest }
    spriteHitTestTreatAllSpritesAsHitTestable = $00000020;      {  set if you want to override each sprites hittestable property as true }

    {    atom types for sprite media    }
    kSpriteAtomType             = $73707274 (* 'sprt' *);
    kSpriteImagesContainerAtomType = $696D6374 (* 'imct' *);
    kSpriteImageAtomType        = $696D6167 (* 'imag' *);
    kSpriteImageDataAtomType    = $696D6461 (* 'imda' *);
    kSpriteImageDataRefAtomType = $696D7265 (* 'imre' *);
    kSpriteImageDataRefTypeAtomType = $696D7274 (* 'imrt' *);
    kSpriteImageGroupIDAtomType = $696D6772 (* 'imgr' *);
    kSpriteImageRegistrationAtomType = $696D7267 (* 'imrg' *);
    kSpriteImageDefaultImageIndexAtomType = $64656669 (* 'defi' *);
    kSpriteSharedDataAtomType   = $64666C74 (* 'dflt' *);
    kSpriteNameAtomType         = $6E616D65 (* 'name' *);
    kSpriteImageNameAtomType    = $6E616D65 (* 'name' *);
    kSpriteUsesImageIDsAtomType = $75736573 (* 'uses' *);                       {  leaf data is an array of QTAtomID's, one per image used }
    kSpriteBehaviorsAtomType    = $62656861 (* 'beha' *);
    kSpriteImageBehaviorAtomType = $696D6167 (* 'imag' *);
    kSpriteCursorBehaviorAtomType = $63727372 (* 'crsr' *);
    kSpriteStatusStringsBehaviorAtomType = $73737472 (* 'sstr' *);
    kSpriteVariablesContainerAtomType = $76617273 (* 'vars' *);
    kSpriteStringVariableAtomType = $73747276 (* 'strv' *);
    kSpriteFloatingPointVariableAtomType = $666C6F76 (* 'flov' *);


type
    QTRuntimeSpriteDescStructPtr = ^QTRuntimeSpriteDescStruct;
    QTRuntimeSpriteDescStruct = record
        version:                SInt32;                             {  set to zero }
        spriteID:               QTAtomID;
        imageIndex:             SInt16;
        matrix:                 MatrixRecord;
        visible:                SInt16;
        layer:                  SInt16;
        graphicsMode:           ModifierTrackGraphicsModeRecord;
        actionHandlingSpriteID: QTAtomID;
    end;

    QTRuntimeSpriteDescPtr              = ^QTRuntimeSpriteDescStruct;
    {
       when filling in QTSpriteButtonBehaviorStruct values -1 may be used to indicate that
       the state transition does not change the property
    }
    QTSpriteButtonBehaviorStructPtr = ^QTSpriteButtonBehaviorStruct;
    QTSpriteButtonBehaviorStruct = record
        notOverNotPressedStateID: QTAtomID;
        overNotPressedStateID:  QTAtomID;
        overPressedStateID:     QTAtomID;
        notOverPressedStateID:  QTAtomID;
    end;

    QTSpriteButtonBehaviorPtr           = ^QTSpriteButtonBehaviorStruct;
    {
     *  SpriteMediaSetProperty()
     *
     *  Availability:
     *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
     *    Windows:          in qtmlClient.lib 3.0 and later
        }
function SpriteMediaSetProperty(mh: MediaHandler; spriteIndex: SInt16; propertyType: SInt32; propertyValue: UnivPtr): ComponentResult; external name '_SpriteMediaSetProperty';
{
 *  SpriteMediaGetProperty()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SpriteMediaGetProperty(mh: MediaHandler; spriteIndex: SInt16; propertyType: SInt32; propertyValue: UnivPtr): ComponentResult; external name '_SpriteMediaGetProperty';
{
 *  SpriteMediaHitTestSprites()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SpriteMediaHitTestSprites(mh: MediaHandler; flags: SInt32; loc: Point; var spriteHitIndex: SInt16): ComponentResult; external name '_SpriteMediaHitTestSprites';
{
 *  SpriteMediaCountSprites()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SpriteMediaCountSprites(mh: MediaHandler; var numSprites: SInt16): ComponentResult; external name '_SpriteMediaCountSprites';
{
 *  SpriteMediaCountImages()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SpriteMediaCountImages(mh: MediaHandler; var numImages: SInt16): ComponentResult; external name '_SpriteMediaCountImages';
{
 *  SpriteMediaGetIndImageDescription()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SpriteMediaGetIndImageDescription(mh: MediaHandler; imageIndex: SInt16; imageDescription: ImageDescriptionHandle): ComponentResult; external name '_SpriteMediaGetIndImageDescription';
{
 *  SpriteMediaGetDisplayedSampleNumber()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SpriteMediaGetDisplayedSampleNumber(mh: MediaHandler; var sampleNum: SInt32): ComponentResult; external name '_SpriteMediaGetDisplayedSampleNumber';
{
 *  SpriteMediaGetSpriteName()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SpriteMediaGetSpriteName(mh: MediaHandler; spriteID: QTAtomID; var spriteName: Str255): ComponentResult; external name '_SpriteMediaGetSpriteName';
{
 *  SpriteMediaGetImageName()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SpriteMediaGetImageName(mh: MediaHandler; imageIndex: SInt16; var imageName: Str255): ComponentResult; external name '_SpriteMediaGetImageName';
{
 *  SpriteMediaSetSpriteProperty()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SpriteMediaSetSpriteProperty(mh: MediaHandler; spriteID: QTAtomID; propertyType: SInt32; propertyValue: UnivPtr): ComponentResult; external name '_SpriteMediaSetSpriteProperty';
{
 *  SpriteMediaGetSpriteProperty()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SpriteMediaGetSpriteProperty(mh: MediaHandler; spriteID: QTAtomID; propertyType: SInt32; propertyValue: UnivPtr): ComponentResult; external name '_SpriteMediaGetSpriteProperty';
{
 *  SpriteMediaHitTestAllSprites()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SpriteMediaHitTestAllSprites(mh: MediaHandler; flags: SInt32; loc: Point; var spriteHitID: QTAtomID): ComponentResult; external name '_SpriteMediaHitTestAllSprites';
{
 *  SpriteMediaHitTestOneSprite()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SpriteMediaHitTestOneSprite(mh: MediaHandler; spriteID: QTAtomID; flags: SInt32; loc: Point; var wasHit: boolean): ComponentResult; external name '_SpriteMediaHitTestOneSprite';
{
 *  SpriteMediaSpriteIndexToID()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SpriteMediaSpriteIndexToID(mh: MediaHandler; spriteIndex: SInt16; var spriteID: QTAtomID): ComponentResult; external name '_SpriteMediaSpriteIndexToID';
{
 *  SpriteMediaSpriteIDToIndex()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SpriteMediaSpriteIDToIndex(mh: MediaHandler; spriteID: QTAtomID; var spriteIndex: SInt16): ComponentResult; external name '_SpriteMediaSpriteIDToIndex';
{
 *  SpriteMediaGetSpriteActionsForQTEvent()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SpriteMediaGetSpriteActionsForQTEvent(mh: MediaHandler; event: QTEventRecordPtr; spriteID: QTAtomID; var container: QTAtomContainer; var atom: QTAtom): ComponentResult; external name '_SpriteMediaGetSpriteActionsForQTEvent';
{
 *  SpriteMediaSetActionVariable()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SpriteMediaSetActionVariable(mh: MediaHandler; variableID: QTAtomID; value: SinglePtr): ComponentResult; external name '_SpriteMediaSetActionVariable';
{
 *  SpriteMediaGetActionVariable()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SpriteMediaGetActionVariable(mh: MediaHandler; variableID: QTAtomID; var value: Single): ComponentResult; external name '_SpriteMediaGetActionVariable';
{
 *  SpriteMediaGetIndImageProperty()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SpriteMediaGetIndImageProperty(mh: MediaHandler; imageIndex: SInt16; imagePropertyType: SInt32; imagePropertyValue: UnivPtr): ComponentResult; external name '_SpriteMediaGetIndImageProperty';
{
 *  SpriteMediaNewSprite()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function SpriteMediaNewSprite(mh: MediaHandler; newSpriteDesc: QTRuntimeSpriteDescPtr): ComponentResult; external name '_SpriteMediaNewSprite';
{
 *  SpriteMediaDisposeSprite()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function SpriteMediaDisposeSprite(mh: MediaHandler; spriteID: QTAtomID): ComponentResult; external name '_SpriteMediaDisposeSprite';
{
 *  SpriteMediaSetActionVariableToString()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function SpriteMediaSetActionVariableToString(mh: MediaHandler; variableID: QTAtomID; theCString: Ptr): ComponentResult; external name '_SpriteMediaSetActionVariableToString';
{
 *  SpriteMediaGetActionVariableAsString()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function SpriteMediaGetActionVariableAsString(mh: MediaHandler; variableID: QTAtomID; var theCString: Handle): ComponentResult; external name '_SpriteMediaGetActionVariableAsString';
{
 *  SpriteMediaNewImage()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 6.0 and later
 *    CarbonLib:        in CarbonLib 1.6 and later
 *    Mac OS X:         in version 10.2 and later
 *    Windows:          in qtmlClient.lib 6.0 and later
 }
function SpriteMediaNewImage(mh: MediaHandler; dataRef: Handle; dataRefType: OSType; desiredID: QTAtomID): ComponentResult; external name '_SpriteMediaNewImage';
{
 *  SpriteMediaDisposeImage()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 6.0 and later
 *    CarbonLib:        in CarbonLib 1.6 and later
 *    Mac OS X:         in version 10.2 and later
 *    Windows:          in qtmlClient.lib 6.0 and later
 }
function SpriteMediaDisposeImage(mh: MediaHandler; imageIndex: SInt16): ComponentResult; external name '_SpriteMediaDisposeImage';
{
 *  SpriteMediaImageIndexToID()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 6.0 and later
 *    CarbonLib:        in CarbonLib 1.6 and later
 *    Mac OS X:         in version 10.2 and later
 *    Windows:          in qtmlClient.lib 6.0 and later
 }
function SpriteMediaImageIndexToID(mh: MediaHandler; imageIndex: SInt16; var imageID: QTAtomID): ComponentResult; external name '_SpriteMediaImageIndexToID';
{
 *  SpriteMediaImageIDToIndex()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 6.0 and later
 *    CarbonLib:        in CarbonLib 1.6 and later
 *    Mac OS X:         in version 10.2 and later
 *    Windows:          in qtmlClient.lib 6.0 and later
 }
function SpriteMediaImageIDToIndex(mh: MediaHandler; imageID: QTAtomID; var imageIndex: SInt16): ComponentResult; external name '_SpriteMediaImageIDToIndex';
{************************
* Flash Media routines
*************************}

{
 *  FlashMediaSetPan()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function FlashMediaSetPan(mh: MediaHandler; xPercent: SInt16; yPercent: SInt16): ComponentResult; external name '_FlashMediaSetPan';
{
 *  FlashMediaSetZoom()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function FlashMediaSetZoom(mh: MediaHandler; factor: SInt16): ComponentResult; external name '_FlashMediaSetZoom';
{
 *  FlashMediaSetZoomRect()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function FlashMediaSetZoomRect(mh: MediaHandler; left: SInt32; top: SInt32; right: SInt32; bottom: SInt32): ComponentResult; external name '_FlashMediaSetZoomRect';
{
 *  FlashMediaGetRefConBounds()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function FlashMediaGetRefConBounds(mh: MediaHandler; refCon: SInt32; var left: SInt32; var top: SInt32; var right: SInt32; var bottom: SInt32): ComponentResult; external name '_FlashMediaGetRefConBounds';
{
 *  FlashMediaGetRefConID()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function FlashMediaGetRefConID(mh: MediaHandler; refCon: SInt32; var refConID: SInt32): ComponentResult; external name '_FlashMediaGetRefConID';
{
 *  FlashMediaIDToRefCon()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function FlashMediaIDToRefCon(mh: MediaHandler; refConID: SInt32; var refCon: SInt32): ComponentResult; external name '_FlashMediaIDToRefCon';
{
 *  FlashMediaGetDisplayedFrameNumber()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function FlashMediaGetDisplayedFrameNumber(mh: MediaHandler; var flashFrameNumber: SInt32): ComponentResult; external name '_FlashMediaGetDisplayedFrameNumber';
{
 *  FlashMediaFrameNumberToMovieTime()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function FlashMediaFrameNumberToMovieTime(mh: MediaHandler; flashFrameNumber: SInt32; var movieTime: TimeValue): ComponentResult; external name '_FlashMediaFrameNumberToMovieTime';
{
 *  FlashMediaFrameLabelToMovieTime()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function FlashMediaFrameLabelToMovieTime(mh: MediaHandler; theLabel: Ptr; var movieTime: TimeValue): ComponentResult; external name '_FlashMediaFrameLabelToMovieTime';
{
 *  FlashMediaGetFlashVariable()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 5.0 and later
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 5.0 and later
 }
function FlashMediaGetFlashVariable(mh: MediaHandler; path: CStringPtr; name: CStringPtr; var theVariableCStringOut: Handle): ComponentResult; external name '_FlashMediaGetFlashVariable';
{
 *  FlashMediaSetFlashVariable()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 5.0 and later
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 5.0 and later
 }
function FlashMediaSetFlashVariable(mh: MediaHandler; path: CStringPtr; name: CStringPtr; value: CStringPtr; updateFocus: boolean): ComponentResult; external name '_FlashMediaSetFlashVariable';
{
 *  FlashMediaDoButtonActions()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 5.0 and later
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 5.0 and later
 }
function FlashMediaDoButtonActions(mh: MediaHandler; path: CStringPtr; buttonID: SInt32; transition: SInt32): ComponentResult; external name '_FlashMediaDoButtonActions';
{
 *  FlashMediaGetSupportedSwfVersion()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 5.0 and later
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 5.0 and later
 }
function FlashMediaGetSupportedSwfVersion(mh: MediaHandler; var swfVersion: UInt8): ComponentResult; external name '_FlashMediaGetSupportedSwfVersion';
{  sample format atoms }

const
    kMovieMediaDataReference    = $6D6D6472 (* 'mmdr' *);                       {  data reference }
    kMovieMediaDefaultDataReferenceID = $64647269 (* 'ddri' *);                 {  atom id }
    kMovieMediaSlaveTime        = $736C7469 (* 'slti' *);                       {  boolean }
    kMovieMediaSlaveAudio       = $736C6175 (* 'slau' *);                       {  boolean }
    kMovieMediaSlaveGraphicsMode = $736C6772 (* 'slgr' *);                      {  boolean }
    kMovieMediaAutoPlay         = $706C6179 (* 'play' *);                       {  boolean }
    kMovieMediaLoop             = $6C6F6F70 (* 'loop' *);                       {  UInt8 (0=no loop, 1=loop, 2=palindrome loop) }
    kMovieMediaUseMIMEType      = $6D696D65 (* 'mime' *);                       {  string indicating the MIME type to use for the dataref (usually not required) }
    kMovieMediaTitle            = $7469746C (* 'titl' *);                       {  string of the media's title (tooltips) }
    kMovieMediaAltText          = $616C7474 (* 'altt' *);                       {  string of alternate text if media isn't loaded }
    kMovieMediaClipBegin        = $636C7062 (* 'clpb' *);                       {  MovieMediaTimeRecord of start time of embedded media }
    kMovieMediaClipDuration     = $636C7064 (* 'clpd' *);                       {  MovieMediaTimeRecord of duration of embedded media }
    kMovieMediaRegionAtom       = $72656769 (* 'regi' *);                       {  contains subatoms that describe layout }
    kMovieMediaSlaveTrackDuration = $736C7472 (* 'sltr' *);                     {  Boolean indicating that media handler should adjust track and media based on actual embedded movie duration }
    kMovieMediaEnableFrameStepping = $656E6673 (* 'enfs' *);                    {  boolean. if true stepping on external movie steps frames within embedded movie. }
    kMovieMediaBackgroundColor  = $626B636C (* 'bkcl' *);                       {  RGBColor. }
    kMovieMediaPrerollTime      = $70726572 (* 'prer' *);                       {  SInt32 indicating preroll time }

    {  fit types }
    kMovieMediaFitNone          = 0;
    kMovieMediaFitScroll        = $7363726F (* 'scro' *);
    kMovieMediaFitClipIfNecessary = $68696464 (* 'hidd' *);
    kMovieMediaFitFill          = $66696C6C (* 'fill' *);
    kMovieMediaFitMeet          = $6D656574 (* 'meet' *);
    kMovieMediaFitSlice         = $736C6963 (* 'slic' *);

    {  sub atoms for region atom }
    kMovieMediaSpatialAdjustment = $66697420 (* 'fit ' *);                      {  OSType from kMovieMediaFit* }
    kMovieMediaRectangleAtom    = $72656374 (* 'rect' *);
    kMovieMediaTop              = $746F7020 (* 'top ' *);
    kMovieMediaLeft             = $6C656674 (* 'left' *);
    kMovieMediaWidth            = $77642020 (* 'wd  ' *);
    kMovieMediaHeight           = $68742020 (* 'ht  ' *);

    {  contained movie properties }
    kMoviePropertyDuration      = $64757261 (* 'dura' *);                       {  TimeValue * }
    kMoviePropertyTimeScale     = $74696D73 (* 'tims' *);                       {  TimeValue * }
    kMoviePropertyTime          = $74696D76 (* 'timv' *);                       {  TimeValue * }
    kMoviePropertyNaturalBounds = $6E617462 (* 'natb' *);                       {  Rect * }
    kMoviePropertyMatrix        = $6D747278 (* 'mtrx' *);                       {  Matrix * }
    kMoviePropertyTrackList     = $746C7374 (* 'tlst' *);                       {  long *** }


    kTrackPropertyMediaType     = $6D747970 (* 'mtyp' *);                       {  OSType }
    kTrackPropertyInstantiation = $696E7374 (* 'inst' *);                       {  MovieMediaInstantiationInfoRecord }


type
    MovieMediaTimeRecordPtr = ^MovieMediaTimeRecord;
    MovieMediaTimeRecord = record
        time:                   wide;
        scale:                  TimeScale;
    end;

    MovieMediaInstantiationInfoRecordPtr = ^MovieMediaInstantiationInfoRecord;
    MovieMediaInstantiationInfoRecord = record
        immediately:            boolean;
        pad:                    boolean;
        bitRate:                SInt32;
    end;

    {   ************************
    * Movie Media routines
    *************************   }


    {
     *  MovieMediaGetChildDoMCActionCallback()
     *
     *  Availability:
     *    Non-Carbon CFM:   in QuickTimeLib 4.1 and later
     *    CarbonLib:        in CarbonLib 1.1 and later
     *    Mac OS X:         in version 10.0 and later
     *    Windows:          in qtmlClient.lib 4.1 and later
        }
function MovieMediaGetChildDoMCActionCallback(mh: MediaHandler; var doMCActionCallbackProc: DoMCActionUPP; var refcon: SInt32): ComponentResult; external name '_MovieMediaGetChildDoMCActionCallback';
{
 *  MovieMediaGetDoMCActionCallback()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.1 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.1 and later
 }
function MovieMediaGetDoMCActionCallback(mh: MediaHandler; var doMCActionCallbackProc: DoMCActionUPP; var refcon: SInt32): ComponentResult; external name '_MovieMediaGetDoMCActionCallback';
{
 *  MovieMediaGetCurrentMovieProperty()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.1 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.1 and later
 }
function MovieMediaGetCurrentMovieProperty(mh: MediaHandler; whichProperty: OSType; value: UnivPtr): ComponentResult; external name '_MovieMediaGetCurrentMovieProperty';
{
 *  MovieMediaGetCurrentTrackProperty()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.1 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.1 and later
 }
function MovieMediaGetCurrentTrackProperty(mh: MediaHandler; trackID: SInt32; whichProperty: OSType; value: UnivPtr): ComponentResult; external name '_MovieMediaGetCurrentTrackProperty';
{
 *  MovieMediaGetChildMovieDataReference()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.1 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.1 and later
 }
function MovieMediaGetChildMovieDataReference(mh: MediaHandler; dataRefID: QTAtomID; dataRefIndex: SInt16; var dataRefType: OSType; var dataRef: Handle; var dataRefIDOut: QTAtomID; var dataRefIndexOut: SInt16): ComponentResult; external name '_MovieMediaGetChildMovieDataReference';
{
 *  MovieMediaSetChildMovieDataReference()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.1 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.1 and later
 }
function MovieMediaSetChildMovieDataReference(mh: MediaHandler; dataRefID: QTAtomID; dataRefType: OSType; dataRef: Handle): ComponentResult; external name '_MovieMediaSetChildMovieDataReference';
{
 *  MovieMediaLoadChildMovieFromDataReference()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.1 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.1 and later
 }
function MovieMediaLoadChildMovieFromDataReference(mh: MediaHandler; dataRefID: QTAtomID): ComponentResult; external name '_MovieMediaLoadChildMovieFromDataReference';
{************************
* 3D Media routines
*************************}
{
 *  Media3DGetNamedObjectList()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function Media3DGetNamedObjectList(mh: MediaHandler; var objectList: QTAtomContainer): ComponentResult; external name '_Media3DGetNamedObjectList';
{
 *  Media3DGetRendererList()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function Media3DGetRendererList(mh: MediaHandler; var rendererList: QTAtomContainer): ComponentResult; external name '_Media3DGetRendererList';
{
 *  Media3DGetCurrentGroup()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function Media3DGetCurrentGroup(mh: MediaHandler; group: UnivPtr): ComponentResult; external name '_Media3DGetCurrentGroup';
{
 *  Media3DTranslateNamedObjectTo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function Media3DTranslateNamedObjectTo(mh: MediaHandler; objectName: CStringPtr; x: Fixed; y: Fixed; z: Fixed): ComponentResult; external name '_Media3DTranslateNamedObjectTo';
{
 *  Media3DScaleNamedObjectTo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function Media3DScaleNamedObjectTo(mh: MediaHandler; objectName: CStringPtr; xScale: Fixed; yScale: Fixed; zScale: Fixed): ComponentResult; external name '_Media3DScaleNamedObjectTo';
{
 *  Media3DRotateNamedObjectTo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function Media3DRotateNamedObjectTo(mh: MediaHandler; objectName: CStringPtr; xDegrees: Fixed; yDegrees: Fixed; zDegrees: Fixed): ComponentResult; external name '_Media3DRotateNamedObjectTo';
{
 *  Media3DSetCameraData()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function Media3DSetCameraData(mh: MediaHandler; cameraData: UnivPtr): ComponentResult; external name '_Media3DSetCameraData';
{
 *  Media3DGetCameraData()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function Media3DGetCameraData(mh: MediaHandler; cameraData: UnivPtr): ComponentResult; external name '_Media3DGetCameraData';
{
 *  Media3DSetCameraAngleAspect()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function Media3DSetCameraAngleAspect(mh: MediaHandler; fov: QTFloatSingle; aspectRatioXToY: QTFloatSingle): ComponentResult; external name '_Media3DSetCameraAngleAspect';
{
 *  Media3DGetCameraAngleAspect()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function Media3DGetCameraAngleAspect(mh: MediaHandler; var fov: QTFloatSingle; var aspectRatioXToY: QTFloatSingle): ComponentResult; external name '_Media3DGetCameraAngleAspect';
{
 *  Media3DSetCameraRange()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function Media3DSetCameraRange(mh: MediaHandler; tQ3CameraRange: UnivPtr): ComponentResult; external name '_Media3DSetCameraRange';
{
 *  Media3DGetCameraRange()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function Media3DGetCameraRange(mh: MediaHandler; tQ3CameraRange: UnivPtr): ComponentResult; external name '_Media3DGetCameraRange';
{
 *  Media3DGetViewObject()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.1 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.1 and later
 }
function Media3DGetViewObject(mh: MediaHandler; tq3viewObject: UnivPtr): ComponentResult; external name '_Media3DGetViewObject';
{***************************************
*                                       *
*   M O V I E   C O N T R O L L E R     *
*                                       *
***************************************}

const
    MovieControllerComponentType = $706C6179 (* 'play' *);


    kMovieControllerQTVRFlag    = $01;
    kMovieControllerDontDisplayToUser = $02;


type
    MovieController                     = ComponentInstance;
    MovieControllerPtr                  = ^MovieController;

const
    mcActionIdle                = 1;                            {  no param }
    mcActionDraw                = 2;                            {  param is WindowRef }
    mcActionActivate            = 3;                            {  no param }
    mcActionDeactivate          = 4;                            {  no param }
    mcActionMouseDown           = 5;                            {  param is pointer to EventRecord }
    mcActionKey                 = 6;                            {  param is pointer to EventRecord }
    mcActionPlay                = 8;                            {  param is Fixed, play rate }
    mcActionGoToTime            = 12;                           {  param is TimeRecord }
    mcActionSetVolume           = 14;                           {  param is a short }
    mcActionGetVolume           = 15;                           {  param is pointer to a short }
    mcActionStep                = 18;                           {  param is number of steps (short) }
    mcActionSetLooping          = 21;                           {  param is Boolean }
    mcActionGetLooping          = 22;                           {  param is pointer to a Boolean }
    mcActionSetLoopIsPalindrome = 23;                           {  param is Boolean }
    mcActionGetLoopIsPalindrome = 24;                           {  param is pointer to a Boolean }
    mcActionSetGrowBoxBounds    = 25;                           {  param is a Rect }
    mcActionControllerSizeChanged = 26;                         {  no param }
    mcActionSetSelectionBegin   = 29;                           {  param is TimeRecord }
    mcActionSetSelectionDuration = 30;                          {  param is TimeRecord, action only taken on set-duration }
    mcActionSetKeysEnabled      = 32;                           {  param is Boolean }
    mcActionGetKeysEnabled      = 33;                           {  param is pointer to Boolean }
    mcActionSetPlaySelection    = 34;                           {  param is Boolean }
    mcActionGetPlaySelection    = 35;                           {  param is pointer to Boolean }
    mcActionSetUseBadge         = 36;                           {  param is Boolean }
    mcActionGetUseBadge         = 37;                           {  param is pointer to Boolean }
    mcActionSetFlags            = 38;                           {  param is long of flags }
    mcActionGetFlags            = 39;                           {  param is pointer to a long of flags }
    mcActionSetPlayEveryFrame   = 40;                           {  param is Boolean }
    mcActionGetPlayEveryFrame   = 41;                           {  param is pointer to Boolean }
    mcActionGetPlayRate         = 42;                           {  param is pointer to Fixed }
    mcActionShowBalloon         = 43;                           {  param is a pointer to a boolean. set to false to stop balloon }
    mcActionBadgeClick          = 44;                           {  param is pointer to Boolean. set to false to ignore click }
    mcActionMovieClick          = 45;                           {  param is pointer to event record. change "what" to nullEvt to kill click }
    mcActionSuspend             = 46;                           {  no param }
    mcActionResume              = 47;                           {  no param }
    mcActionSetControllerKeysEnabled = 48;                      {  param is Boolean }
    mcActionGetTimeSliderRect   = 49;                           {  param is pointer to rect }
    mcActionMovieEdited         = 50;                           {  no param }
    mcActionGetDragEnabled      = 51;                           {  param is pointer to Boolean }
    mcActionSetDragEnabled      = 52;                           {  param is Boolean }
    mcActionGetSelectionBegin   = 53;                           {  param is TimeRecord }
    mcActionGetSelectionDuration = 54;                          {  param is TimeRecord }
    mcActionPrerollAndPlay      = 55;                           {  param is Fixed, play rate }
    mcActionGetCursorSettingEnabled = 56;                       {  param is pointer to Boolean }
    mcActionSetCursorSettingEnabled = 57;                       {  param is Boolean }
    mcActionSetColorTable       = 58;                           {  param is CTabHandle }
    mcActionLinkToURL           = 59;                           {  param is Handle to URL }
    mcActionCustomButtonClick   = 60;                           {  param is pointer to EventRecord }
    mcActionForceTimeTableUpdate = 61;                          {  no param }
    mcActionSetControllerTimeLimits = 62;                       {  param is pointer to 2 time values min/max. do no send this message to controller. used internally only. }
    mcActionExecuteAllActionsForQTEvent = 63;                   {  param is ResolvedQTEventSpecPtr }
    mcActionExecuteOneActionForQTEvent = 64;                    {  param is ResolvedQTEventSpecPtr }
    mcActionAdjustCursor        = 65;                           {  param is pointer to EventRecord (WindowRef is in message parameter) }
    mcActionUseTrackForTimeTable = 66;                          {  param is pointer to (long trackID; Boolean useIt). do not send this message to controller.  }
    mcActionClickAndHoldPoint   = 67;                           {  param is point (local coordinates). return true if point has click & hold action (e.g., VR object movie autorotate spot) }
    mcActionShowMessageString   = 68;                           {  param is a StringPtr }
    mcActionShowStatusString    = 69;                           {  param is a QTStatusStringPtr }
    mcActionGetExternalMovie    = 70;                           {  param is a QTGetExternalMoviePtr }
    mcActionGetChapterTime      = 71;                           {  param is a QTGetChapterTimePtr }
    mcActionPerformActionList   = 72;                           {  param is a QTAtomSpecPtr }
    mcActionEvaluateExpression  = 73;                           {  param is a QTEvaluateExpressionPtr }
    mcActionFetchParameterAs    = 74;                           {  param is a QTFetchParameterAsPtr }
    mcActionGetCursorByID       = 75;                           {  param is a QTGetCursorByIDPtr }
    mcActionGetNextURL          = 76;                           {  param is a Handle to URL }
    mcActionMovieChanged        = 77;
    mcActionDoScript            = 78;                           {  param is QTDoScriptPtr }
    mcActionRestartAtTime       = 79;                           {  param is QTResartAtTimePtr }
    mcActionGetIndChapter       = 80;                           {  param is QTChapterInfoPtr }
    mcActionLinkToURLExtended   = 81;                           {  param is QTAtomContainer as used by QTParseHREF }
    mcActionSetVolumeStep       = 82;                           {  param is short containing amount to step volume via arrow keys - default = 64 }
    mcActionAutoPlay            = 83;                           {  param is Fixed, play rate }
    mcActionPauseToBuffer       = 84;                           {  param is Fixed, play rate on restart }
    mcActionAppMessageReceived  = 85;                           {  param is a long, application message }
    mcActionEvaluateExpressionWithType = 89;                    {  param is a QTEvaluateExpressionWithTypePtr }
    mcActionGetMovieName        = 90;                           {  param is a p String Handle }
    mcActionGetMovieID          = 91;                           {  param is pointer to long }
    mcActionGetMovieActive      = 92;                           {  param is pointer to Boolean }


type
    mcAction                            = SInt16;

const
    mcFlagSuppressMovieFrame    = $01;
    mcFlagSuppressStepButtons   = $02;
    mcFlagSuppressSpeakerButton = $04;
    mcFlagsUseWindowPalette     = $08;
    mcFlagsDontInvalidate       = $10;
    mcFlagsUseCustomButton      = $20;


    mcPositionDontInvalidate    = $20;


type
    mcFlags                             = UInt32;

const
    kMCIEEnabledButtonPicture   = 1;
    kMCIEDisabledButtonPicture  = 2;
    kMCIEDepressedButtonPicture = 3;
    kMCIEEnabledSizeBoxPicture  = 4;
    kMCIEDisabledSizeBoxPicture = 5;
    kMCIEEnabledUnavailableButtonPicture = 6;
    kMCIEDisabledUnavailableButtonPicture = 7;
    kMCIESoundSlider            = 128;
    kMCIESoundThumb             = 129;
    kMCIEColorTable             = 256;
    kMCIEIsFlatAppearance       = 257;
    kMCIEDoButtonIconsDropOnDepress = 258;


type
    MCInterfaceElement                  = UInt32;
    MCActionFilterProcPtr = function(mc: MovieController; var action: SInt16; params: UnivPtr): boolean;

    MCActionFilterWithRefConProcPtr = function(mc: MovieController; action: SInt16; params: UnivPtr; refCon: SInt32): boolean;

    MCActionFilterUPP = ^SInt32; { an opaque UPP }
    MCActionFilterWithRefConUPP = ^SInt32; { an opaque UPP }
    {
        menu related stuff
        }

const
    mcInfoUndoAvailable         = $01;
    mcInfoCutAvailable          = $02;
    mcInfoCopyAvailable         = $04;
    mcInfoPasteAvailable        = $08;
    mcInfoClearAvailable        = $10;
    mcInfoHasSound              = $20;
    mcInfoIsPlaying             = $40;
    mcInfoIsLooping             = $80;
    mcInfoIsInPalindrome        = $0100;
    mcInfoEditingEnabled        = $0200;
    mcInfoMovieIsInteractive    = $0400;

    {  menu item codes }
    mcMenuUndo                  = 1;
    mcMenuCut                   = 3;
    mcMenuCopy                  = 4;
    mcMenuPaste                 = 5;
    mcMenuClear                 = 6;

    {  messages to the application via mcActionAppMessageReceived }
    kQTAppMessageSoftwareChanged = 1;                           {  notification to app that installed QuickTime software has been updated }
    kQTAppMessageWindowCloseRequested = 3;                      {  request for app to close window containing movie controller }
    kQTAppMessageExitFullScreenRequested = 4;                   {  request for app to turn off full screen mode if active }
    kQTAppMessageDisplayChannels = 5;                           {  request for app to display the channel UI }
    kQTAppMessageEnterFullScreenRequested = 6;                  {  request for app to turn on full screen mode }

    {  structures used as mcActionFilterProc params }

type
    QTStatusStringRecordPtr = ^QTStatusStringRecord;
    QTStatusStringRecord = record
        stringTypeFlags:        SInt32;
        statusString:           CStringPtr;
    end;

    QTStatusStringPtr                   = ^QTStatusStringRecord;
    QTGetExternalMovieRecordPtr = ^QTGetExternalMovieRecord;
    QTGetExternalMovieRecord = record
        targetType:             SInt32;                             {  set to kTargetMovieName or kTargetMovieID }
        movieName:              StringPtr;
        movieID:                SInt32;
        theMovie:               MoviePtr;
        theController:          MovieControllerPtr;
    end;

    QTGetExternalMoviePtr               = ^QTGetExternalMovieRecord;
    QTGetChapterTimeRecordPtr = ^QTGetChapterTimeRecord;
    QTGetChapterTimeRecord = record
        chapterName:            StringPtr;
        chapterTime:            TimeRecord;
    end;

    QTGetChapterTimePtr                 = ^QTGetChapterTimeRecord;
    QTChapterInfoRecordPtr = ^QTChapterInfoRecord;
    QTChapterInfoRecord = record
        index:                  SInt32;                             {  first chapter has index of 1 }
        time:                   TimeValue;                              {  -1 if no more chapters available }
        name:                   Str255;
    end;

    QTChapterInfoPtr                    = ^QTChapterInfoRecord;
    QTEvaluateExpressionRecordPtr = ^QTEvaluateExpressionRecord;
    QTEvaluateExpressionRecord = record
        expressionSpec:         QTAtomSpec;
        expressionResult:       ^Single;
    end;

    QTEvaluateExpressionPtr             = ^QTEvaluateExpressionRecord;
    QTEvaluateExpressionWithTypeRecordPtr = ^QTEvaluateExpressionWithTypeRecord;
    QTEvaluateExpressionWithTypeRecord = record
        recordSize:             SInt32;                             {  Size of structure (fill in at allocation)  }
        expressionSpec:         QTAtomSpec;
        expressionResult:       ^Single;
        fetchAsType:            SInt32;
        nonNumericResult:       Handle;
                                                                        {  Current size is 24  }
    end;

    QTEvaluateExpressionWithTypePtr     = ^QTEvaluateExpressionWithTypeRecord;
    QTFetchParameterAsRecordPtr = ^QTFetchParameterAsRecord;
    QTFetchParameterAsRecord = record
        paramListSpec:          QTAtomSpec;
        paramIndex:             SInt32;
        paramType:              SInt32;
        allowedFlags:           SInt32;
        min:                    Ptr;
        max:                    Ptr;
        currentValue:           Ptr;
        newValue:               Ptr;
        isUnsignedValue:        boolean;
    end;

    QTFetchParameterAsPtr               = ^QTFetchParameterAsRecord;
    QTGetCursorByIDRecordPtr = ^QTGetCursorByIDRecord;
    QTGetCursorByIDRecord = record
        cursorID:               SInt16;
        colorCursorData:        Handle;
        reserved1:              SInt32;
    end;

    QTGetCursorByIDPtr                  = ^QTGetCursorByIDRecord;
    QTDoScriptRecordPtr = ^QTDoScriptRecord;
    QTDoScriptRecord = record
        scriptTypeFlags:        SInt32;
        command:                CStringPtr;
        arguments:              CStringPtr;
    end;

    QTDoScriptPtr                       = ^QTDoScriptRecord;
    QTRestartAtTimeRecordPtr = ^QTRestartAtTimeRecord;
    QTRestartAtTimeRecord = record
        startTime:              TimeValue;                              {  time scale is the movie timescale }
        rate:                   Fixed;                                  {  if rate is zero, the movie's current rate is maintained }
    end;

    QTRestartAtTimePtr                  = ^QTRestartAtTimeRecord;
    {  values for paramType field of QTFetchParameterAsRecord }

const
    kFetchAsBooleanPtr          = 1;
    kFetchAsShortPtr            = 2;
    kFetchAsLongPtr             = 3;
    kFetchAsMatrixRecordPtr     = 4;
    kFetchAsModifierTrackGraphicsModeRecord = 5;
    kFetchAsHandle              = 6;
    kFetchAsStr255              = 7;
    kFetchAsFloatPtr            = 8;
    kFetchAsPointPtr            = 9;
    kFetchAsNewAtomContainer    = 10;
    kFetchAsQTEventRecordPtr    = 11;
    kFetchAsFixedPtr            = 12;
    kFetchAsSetControllerValuePtr = 13;
    kFetchAsRgnHandle           = 14;                           {  flipped to native }
    kFetchAsComponentDescriptionPtr = 15;
    kFetchAsCString             = 16;

    kQTCursorOpenHand           = -19183;
    kQTCursorClosedHand         = -19182;
    kQTCursorPointingHand       = -19181;
    kQTCursorRightArrow         = -19180;
    kQTCursorLeftArrow          = -19179;
    kQTCursorDownArrow          = -19178;
    kQTCursorUpArrow            = -19177;
    kQTCursorIBeam              = -19176;





    {    target management  }
    {
     *  MCSetMovie()
     *
     *  Availability:
     *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
     *    Windows:          in qtmlClient.lib 3.0 and later
        }
function MCSetMovie(mc: MovieController; theMovie: Movie; movieWindow: WindowRef; where: Point): ComponentResult; external name '_MCSetMovie';
{
 *  MCGetIndMovie()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MCGetIndMovie(mc: MovieController; index: SInt16): Movie; external name '_MCGetIndMovie';
{
 *  MCRemoveAllMovies()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MCRemoveAllMovies(mc: MovieController): ComponentResult; external name '_MCRemoveAllMovies';
{
 *  MCRemoveAMovie()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MCRemoveAMovie(mc: MovieController; m: Movie): ComponentResult; external name '_MCRemoveAMovie';
{
 *  MCRemoveMovie()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MCRemoveMovie(mc: MovieController): ComponentResult; external name '_MCRemoveMovie';
{ event handling etc. }
{
 *  MCIsPlayerEvent()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MCIsPlayerEvent(mc: MovieController; const (*var*) e: EventRecord): ComponentResult; external name '_MCIsPlayerEvent';
{ obsolete. use MCSetActionFilterWithRefCon instead. }
{
 *  MCSetActionFilter()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MCSetActionFilter(mc: MovieController; blob: MCActionFilterUPP): ComponentResult; external name '_MCSetActionFilter';
{
    proc is of the form:
        Boolean userPlayerFilter(MovieController mc, short *action, void *params) =
    proc returns TRUE if it handles the action, FALSE if not
    action is passed as a var so that it could be changed by filter
    this is consistent with the current dialog manager stuff
    params is any potential parameters that go with the action
        such as set playback rate to xxx.
}
{
 *  MCDoAction()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MCDoAction(mc: MovieController; action: SInt16; params: UnivPtr): ComponentResult; external name '_MCDoAction';
{ state type things }
{
 *  MCSetControllerAttached()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MCSetControllerAttached(mc: MovieController; attach: boolean): ComponentResult; external name '_MCSetControllerAttached';
{
 *  MCIsControllerAttached()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MCIsControllerAttached(mc: MovieController): ComponentResult; external name '_MCIsControllerAttached';
{
 *  MCSetControllerPort()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MCSetControllerPort(mc: MovieController; gp: CGrafPtr): ComponentResult; external name '_MCSetControllerPort';
{
 *  MCGetControllerPort()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MCGetControllerPort(mc: MovieController): CGrafPtr; external name '_MCGetControllerPort';
{
 *  MCSetVisible()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MCSetVisible(mc: MovieController; visible: boolean): ComponentResult; external name '_MCSetVisible';
{
 *  MCGetVisible()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MCGetVisible(mc: MovieController): ComponentResult; external name '_MCGetVisible';
{
 *  MCGetControllerBoundsRect()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MCGetControllerBoundsRect(mc: MovieController; var bounds: Rect): ComponentResult; external name '_MCGetControllerBoundsRect';
{
 *  MCSetControllerBoundsRect()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MCSetControllerBoundsRect(mc: MovieController; const (*var*) bounds: Rect): ComponentResult; external name '_MCSetControllerBoundsRect';
{
 *  MCGetControllerBoundsRgn()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MCGetControllerBoundsRgn(mc: MovieController): RgnHandle; external name '_MCGetControllerBoundsRgn';
{
 *  MCGetWindowRgn()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MCGetWindowRgn(mc: MovieController; w: WindowRef): RgnHandle; external name '_MCGetWindowRgn';
{ other stuff }
{
 *  MCMovieChanged()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MCMovieChanged(mc: MovieController; m: Movie): ComponentResult; external name '_MCMovieChanged';
{
    called when the app has changed thing about the movie (like bounding rect) or rate. So that we
        can update our graphical (and internal) state accordingly.
}
{
 *  MCSetDuration()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MCSetDuration(mc: MovieController; duration: TimeValue): ComponentResult; external name '_MCSetDuration';
{
    duration to use for time slider -- will be reset next time MCMovieChanged is called
        or MCSetMovie is called
}
{
 *  MCGetCurrentTime()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MCGetCurrentTime(mc: MovieController; var scale: TimeScale): TimeValue; external name '_MCGetCurrentTime';
{
    returns the time value and the time scale it is on. if there are no movies, the
        time scale is passed back as 0. scale is an optional parameter

}
{
 *  MCNewAttachedController()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MCNewAttachedController(mc: MovieController; theMovie: Movie; w: WindowRef; where: Point): ComponentResult; external name '_MCNewAttachedController';
{
    makes theMovie the only movie attached to the controller. makes the controller visible.
    the window and where parameters are passed a long to MCSetMovie and behave as
    described there
}
{
 *  MCDraw()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MCDraw(mc: MovieController; w: WindowRef): ComponentResult; external name '_MCDraw';
{
 *  MCActivate()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MCActivate(mc: MovieController; w: WindowRef; activate: boolean): ComponentResult; external name '_MCActivate';
{
 *  MCIdle()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MCIdle(mc: MovieController): ComponentResult; external name '_MCIdle';
{
 *  MCKey()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MCKey(mc: MovieController; key: SInt8; modifiers: SInt32): ComponentResult; external name '_MCKey';
{
 *  MCClick()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MCClick(mc: MovieController; w: WindowRef; where: Point; when: SInt32; modifiers: SInt32): ComponentResult; external name '_MCClick';
{
    calls for editing
}
{
 *  MCEnableEditing()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MCEnableEditing(mc: MovieController; enabled: boolean): ComponentResult; external name '_MCEnableEditing';
{
 *  MCIsEditingEnabled()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MCIsEditingEnabled(mc: MovieController): SInt32; external name '_MCIsEditingEnabled';
{
 *  MCCopy()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MCCopy(mc: MovieController): Movie; external name '_MCCopy';
{
 *  MCCut()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MCCut(mc: MovieController): Movie; external name '_MCCut';
{
 *  MCPaste()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MCPaste(mc: MovieController; srcMovie: Movie): ComponentResult; external name '_MCPaste';
{
 *  MCClear()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MCClear(mc: MovieController): ComponentResult; external name '_MCClear';
{
 *  MCUndo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MCUndo(mc: MovieController): ComponentResult; external name '_MCUndo';
{
 *  somewhat special stuff
 }
{
 *  MCPositionController()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MCPositionController(mc: MovieController; const (*var*) movieRect: Rect; const (*var*) controllerRect: Rect; someFlags: SInt32): ComponentResult; external name '_MCPositionController';
{
 *  MCGetControllerInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MCGetControllerInfo(mc: MovieController; var someFlags: SInt32): ComponentResult; external name '_MCGetControllerInfo';
{
 *  MCSetClip()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MCSetClip(mc: MovieController; theClip: RgnHandle; movieClip: RgnHandle): ComponentResult; external name '_MCSetClip';
{
 *  MCGetClip()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MCGetClip(mc: MovieController; var theClip: RgnHandle; var movieClip: RgnHandle): ComponentResult; external name '_MCGetClip';
{
 *  MCDrawBadge()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MCDrawBadge(mc: MovieController; movieRgn: RgnHandle; var badgeRgn: RgnHandle): ComponentResult; external name '_MCDrawBadge';
{
 *  MCSetUpEditMenu()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MCSetUpEditMenu(mc: MovieController; modifiers: SInt32; mh: MenuRef): ComponentResult; external name '_MCSetUpEditMenu';
{
 *  MCGetMenuString()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MCGetMenuString(mc: MovieController; modifiers: SInt32; item: SInt16; var aString: Str255): ComponentResult; external name '_MCGetMenuString';
{
 *  MCSetActionFilterWithRefCon()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MCSetActionFilterWithRefCon(mc: MovieController; blob: MCActionFilterWithRefConUPP; refCon: SInt32): ComponentResult; external name '_MCSetActionFilterWithRefCon';
{
 *  MCPtInController()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MCPtInController(mc: MovieController; thePt: Point; var inController: boolean): ComponentResult; external name '_MCPtInController';
{
 *  MCInvalidate()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MCInvalidate(mc: MovieController; w: WindowRef; invalidRgn: RgnHandle): ComponentResult; external name '_MCInvalidate';
{
 *  MCAdjustCursor()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MCAdjustCursor(mc: MovieController; w: WindowRef; where: Point; modifiers: SInt32): ComponentResult; external name '_MCAdjustCursor';
{
 *  MCGetInterfaceElement()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MCGetInterfaceElement(mc: MovieController; whichElement: MCInterfaceElement; element: UnivPtr): ComponentResult; external name '_MCGetInterfaceElement';
{
 *  MCGetDoActionsProc()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function MCGetDoActionsProc(mc: MovieController; var doMCActionProc: DoMCActionUPP; var doMCActionRefCon: SInt32): ComponentResult; external name '_MCGetDoActionsProc';
{
 *  MCAddMovieSegment()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 5.0 and later
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 5.0 and later
 }
function MCAddMovieSegment(mc: MovieController; srcMovie: Movie; scaled: boolean): ComponentResult; external name '_MCAddMovieSegment';
{
 *  MCTrimMovieSegment()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 5.0 and later
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 5.0 and later
 }
function MCTrimMovieSegment(mc: MovieController): ComponentResult; external name '_MCTrimMovieSegment';
{
 *  MCSetIdleManager()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 6.0 and later
 *    CarbonLib:        in CarbonLib 1.6 and later
 *    Mac OS X:         in version 10.2 and later
 *    Windows:          in qtmlClient.lib 6.0 and later
 }
function MCSetIdleManager(mc: MovieController; im: IdleManager): ComponentResult; external name '_MCSetIdleManager';
{ Called (but not implemented) by controllers that derive from the standard movie controller.
   All controllers except standard movie controller must delegate this call. }

const
    kControllerUnderstandsIdleManagers = $01;

    {
     *  MCSetControllerCapabilities()
     *
     *  Availability:
     *    Non-Carbon CFM:   in QuickTimeLib 6.0 and later
     *    CarbonLib:        in CarbonLib 1.6 and later
     *    Mac OS X:         in version 10.2 and later
     *    Windows:          in qtmlClient.lib 6.0 and later
        }
function MCSetControllerCapabilities(mc: MovieController; flags: SInt32; flagsMask: SInt32): ComponentResult; external name '_MCSetControllerCapabilities';
{***************************************
*                                       *
*       T  I  M  E  B  A  S  E          *
*                                       *
***************************************}
{
 *  NewTimeBase()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function NewTimeBase: TimeBase; external name '_NewTimeBase';
{
 *  DisposeTimeBase()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure DisposeTimeBase(tb: TimeBase); external name '_DisposeTimeBase';
{
 *  GetTimeBaseTime()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetTimeBaseTime(tb: TimeBase; s: TimeScale; var tr: TimeRecord): TimeValue; external name '_GetTimeBaseTime';
{
 *  SetTimeBaseTime()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure SetTimeBaseTime(tb: TimeBase; const (*var*) tr: TimeRecord); external name '_SetTimeBaseTime';
{
 *  SetTimeBaseValue()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure SetTimeBaseValue(tb: TimeBase; t: TimeValue; s: TimeScale); external name '_SetTimeBaseValue';
{
 *  GetTimeBaseRate()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetTimeBaseRate(tb: TimeBase): Fixed; external name '_GetTimeBaseRate';
{
 *  SetTimeBaseRate()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure SetTimeBaseRate(tb: TimeBase; r: Fixed); external name '_SetTimeBaseRate';
{
 *  GetTimeBaseStartTime()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetTimeBaseStartTime(tb: TimeBase; s: TimeScale; var tr: TimeRecord): TimeValue; external name '_GetTimeBaseStartTime';
{
 *  SetTimeBaseStartTime()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure SetTimeBaseStartTime(tb: TimeBase; const (*var*) tr: TimeRecord); external name '_SetTimeBaseStartTime';
{
 *  GetTimeBaseStopTime()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetTimeBaseStopTime(tb: TimeBase; s: TimeScale; var tr: TimeRecord): TimeValue; external name '_GetTimeBaseStopTime';
{
 *  SetTimeBaseStopTime()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure SetTimeBaseStopTime(tb: TimeBase; const (*var*) tr: TimeRecord); external name '_SetTimeBaseStopTime';
{
 *  GetTimeBaseFlags()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetTimeBaseFlags(tb: TimeBase): SInt32; external name '_GetTimeBaseFlags';
{
 *  SetTimeBaseFlags()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure SetTimeBaseFlags(tb: TimeBase; timeBaseFlags: SInt32); external name '_SetTimeBaseFlags';
{
 *  SetTimeBaseMasterTimeBase()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure SetTimeBaseMasterTimeBase(slave: TimeBase; master: TimeBase; const (*var*) slaveZero: TimeRecord); external name '_SetTimeBaseMasterTimeBase';
{
 *  GetTimeBaseMasterTimeBase()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetTimeBaseMasterTimeBase(tb: TimeBase): TimeBase; external name '_GetTimeBaseMasterTimeBase';
{
 *  SetTimeBaseMasterClock()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure SetTimeBaseMasterClock(slave: TimeBase; clockMeister: Component; const (*var*) slaveZero: TimeRecord); external name '_SetTimeBaseMasterClock';
{
 *  GetTimeBaseMasterClock()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetTimeBaseMasterClock(tb: TimeBase): ComponentInstance; external name '_GetTimeBaseMasterClock';
{
 *  ConvertTime()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure ConvertTime(var theTime: TimeRecord; newBase: TimeBase); external name '_ConvertTime';
{
 *  ConvertTimeScale()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure ConvertTimeScale(var theTime: TimeRecord; newScale: TimeScale); external name '_ConvertTimeScale';
{
 *  AddTime()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure AddTime(var dst: TimeRecord; const (*var*) src: TimeRecord); external name '_AddTime';
{
 *  SubtractTime()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure SubtractTime(var dst: TimeRecord; const (*var*) src: TimeRecord); external name '_SubtractTime';
{
 *  GetTimeBaseStatus()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetTimeBaseStatus(tb: TimeBase; var unpinnedTime: TimeRecord): SInt32; external name '_GetTimeBaseStatus';
{
 *  SetTimeBaseZero()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure SetTimeBaseZero(tb: TimeBase; var zero: TimeRecord); external name '_SetTimeBaseZero';
{
 *  GetTimeBaseEffectiveRate()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetTimeBaseEffectiveRate(tb: TimeBase): Fixed; external name '_GetTimeBaseEffectiveRate';
{***************************************
*                                       *
*       C  A  L  L  B  A  C  K          *
*                                       *
***************************************}
{
 *  NewCallBack()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function NewCallBack(tb: TimeBase; cbType: SInt16): QTCallBack; external name '_NewCallBack';
{
 *  DisposeCallBack()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure DisposeCallBack(cb: QTCallBack); external name '_DisposeCallBack';
{
 *  GetCallBackType()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetCallBackType(cb: QTCallBack): SInt16; external name '_GetCallBackType';
{
 *  GetCallBackTimeBase()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetCallBackTimeBase(cb: QTCallBack): TimeBase; external name '_GetCallBackTimeBase';
{
 *  CallMeWhen()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function CallMeWhen(cb: QTCallBack; callBackProc: QTCallBackUPP; refCon: SInt32; param1: SInt32; param2: SInt32; param3: SInt32): OSErr; external name '_CallMeWhen';
{
 *  CancelCallBack()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure CancelCallBack(cb: QTCallBack); external name '_CancelCallBack';
{***************************************
*                                       *
*       C L O C K   C A L L B A C K     *
*             S U P P O R T             *
*                                       *
***************************************}
{
 *  AddCallBackToTimeBase()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function AddCallBackToTimeBase(cb: QTCallBack): OSErr; external name '_AddCallBackToTimeBase';
{
 *  RemoveCallBackFromTimeBase()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function RemoveCallBackFromTimeBase(cb: QTCallBack): OSErr; external name '_RemoveCallBackFromTimeBase';
{
 *  GetFirstCallBack()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetFirstCallBack(tb: TimeBase): QTCallBack; external name '_GetFirstCallBack';
{
 *  GetNextCallBack()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GetNextCallBack(cb: QTCallBack): QTCallBack; external name '_GetNextCallBack';
{
 *  ExecuteCallBack()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
procedure ExecuteCallBack(cb: QTCallBack); external name '_ExecuteCallBack';
{
 *  MusicMediaGetIndexedTunePlayer()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MusicMediaGetIndexedTunePlayer(ti: ComponentInstance; sampleDescIndex: SInt32; var tp: ComponentInstance): ComponentResult; external name '_MusicMediaGetIndexedTunePlayer';
{ UPP call backs }

const
    uppMCActionFilterProcInfo = $00000FD0;
    uppMCActionFilterWithRefConProcInfo = $00003ED0;
    {
     *  NewMCActionFilterUPP()
     *
     *  Availability:
     *    Non-Carbon CFM:   available as macro/inline
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function NewMCActionFilterUPP(userRoutine: MCActionFilterProcPtr): MCActionFilterUPP; external name '_NewMCActionFilterUPP'; { old name was NewMCActionFilterProc }
{
 *  NewMCActionFilterWithRefConUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewMCActionFilterWithRefConUPP(userRoutine: MCActionFilterWithRefConProcPtr): MCActionFilterWithRefConUPP; external name '_NewMCActionFilterWithRefConUPP'; { old name was NewMCActionFilterWithRefConProc }
{
 *  DisposeMCActionFilterUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeMCActionFilterUPP(userUPP: MCActionFilterUPP); external name '_DisposeMCActionFilterUPP';
{
 *  DisposeMCActionFilterWithRefConUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeMCActionFilterWithRefConUPP(userUPP: MCActionFilterWithRefConUPP); external name '_DisposeMCActionFilterWithRefConUPP';
{
 *  InvokeMCActionFilterUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeMCActionFilterUPP(mc: MovieController; var action: SInt16; params: UnivPtr; userRoutine: MCActionFilterUPP): boolean; external name '_InvokeMCActionFilterUPP'; { old name was CallMCActionFilterProc }
{
 *  InvokeMCActionFilterWithRefConUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeMCActionFilterWithRefConUPP(mc: MovieController; action: SInt16; params: UnivPtr; refCon: SInt32; userRoutine: MCActionFilterWithRefConUPP): boolean; external name '_InvokeMCActionFilterWithRefConUPP'; { old name was CallMCActionFilterWithRefConProc }
{$ALIGN MAC68K}
{#POP}
{unit MoviesFormat}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}


const
    kMovieVersion               = 0;                            {  version number of the format here described  }

    {   ***************************************
    *
    *   General Types -
    *       These types are used in more than one of the
    *       directory types.
    *
    *************************************** }
    {    MoviesUserData is the type used for user data in movie and track directories   }

type
    MoviesUserDataPtr = ^MoviesUserData;
    MoviesUserData = record
        size:                   SInt32;                             {  size of this user data  }
        udType:                 SInt32;                             {  type of user data  }
        data:                   SInt8;                                  {  the user data  }
    end;

    UserDataAtomPtr = ^UserDataAtom;
    UserDataAtom = record
        size:                   SInt32;
        atomType:               SInt32;
        userData:               array [0..0] of MoviesUserData;
    end;

    {    MoviesDataDescription tells us where the data for the movie or track lives.
       The data can follow the directory, be in the datafork of the same file as the directory resource,
       be in the resource fork of the same file as the directory resource, be in another file in the
       data fork or resource fork, or require a specific bottleneck to fetch the data.  }
    {   ***************************************
    *
    *   MediaDirectory information -
    *       The MediaDirectory is tightly coupled to the data.
    *
    *************************************** }

    SampleDescriptionAtomPtr = ^SampleDescriptionAtom;
    SampleDescriptionAtom = record
        size:                   SInt32;
        atomType:               SInt32;                             {  = 'stsd'  }
        flags:                  SInt32;                             {  1 byte of version / 3 bytes of flags  }
        numEntries:             SInt32;
        sampleDescTable:        array [0..0] of SampleDescription;
    end;

    {    TimeToSampleNum maps physical sample time to physical sample number.   }
    TimeToSampleNumPtr = ^TimeToSampleNum;
    TimeToSampleNum = record
        sampleCount:            SInt32;
        sampleDuration:         TimeValue;
    end;

    TimeToSampleNumAtomPtr = ^TimeToSampleNumAtom;
    TimeToSampleNumAtom = record
        size:                   SInt32;
        atomType:               SInt32;                             {  = 'stts'  }
        flags:                  SInt32;                             {  1 byte of version / 3 bytes of flags  }
        numEntries:             SInt32;
        timeToSampleNumTable:   array [0..0] of TimeToSampleNum;
    end;

    {    SyncSamples is a list of the physical samples which are self contained.    }
    SyncSampleAtomPtr = ^SyncSampleAtom;
    SyncSampleAtom = record
        size:                   SInt32;
        atomType:               SInt32;                             {  = 'stss'  }
        flags:                  SInt32;                             {  1 byte of version / 3 bytes of flags  }
        numEntries:             SInt32;
        syncSampleTable:        array [0..0] of SInt32;
    end;

    {    SampleToChunk maps physical sample number to chunk number.     }
    {    same as SampleToChunk, but redundant first sample is removed   }
    SampleToChunkPtr = ^SampleToChunk;
    SampleToChunk = record
        firstChunk:             SInt32;
        samplesPerChunk:        SInt32;
        sampleDescriptionID:    SInt32;
    end;

    SampleToChunkAtomPtr = ^SampleToChunkAtom;
    SampleToChunkAtom = record
        size:                   SInt32;
        atomType:               SInt32;                             {  = 'stsc'  }
        flags:                  SInt32;                             {  1 byte of version / 3 bytes of flags  }
        numEntries:             SInt32;
        sampleToChunkTable:     array [0..0] of SampleToChunk;
    end;

    ChunkOffsetAtomPtr = ^ChunkOffsetAtom;
    ChunkOffsetAtom = record
        size:                   SInt32;
        atomType:               SInt32;                             {  = 'stco'  }
        flags:                  SInt32;                             {  1 byte of version / 3 bytes of flags  }
        numEntries:             SInt32;
        chunkOffsetTable:       array [0..0] of SInt32;
    end;

    SampleSizeAtomPtr = ^SampleSizeAtom;
    SampleSizeAtom = record
        size:                   SInt32;
        atomType:               SInt32;                             {  = 'stsz'  }
        flags:                  SInt32;                             {  1 byte of version / 3 bytes of flags  }
        sampleSize:             SInt32;
        numEntries:             SInt32;
        sampleSizeTable:        array [0..0] of SInt32;
    end;

    ShadowSyncPtr = ^ShadowSync;
    ShadowSync = record
        fdSampleNum:            SInt32;
        syncSampleNum:          SInt32;
    end;

    ShadowSyncAtomPtr = ^ShadowSyncAtom;
    ShadowSyncAtom = record
        size:                   SInt32;
        atomType:               SInt32;                             {  = 'stsz'  }
        flags:                  SInt32;                             {  1 byte of version / 3 bytes of flags  }
        numEntries:             SInt32;
        shadowSyncTable:        array [0..0] of ShadowSync;
    end;

    SampleTableAtomPtr = ^SampleTableAtom;
    SampleTableAtom = record
        size:                   SInt32;
        atomType:               SInt32;                             {  = 'stbl'  }
        sampleDescription:      SampleDescriptionAtom;
        timeToSampleNum:        TimeToSampleNumAtom;
        sampleToChunk:          SampleToChunkAtom;
        syncSample:             SyncSampleAtom;
        sampleSize:             SampleSizeAtom;
        chunkOffset:            ChunkOffsetAtom;
        shadowSync:             ShadowSyncAtom;
    end;

    PublicHandlerInfoPtr = ^PublicHandlerInfo;
    PublicHandlerInfo = record
        flags:                  SInt32;                             {  1 byte of version / 3 bytes of flags  }
        componentType:          SInt32;
        componentSubType:       SInt32;
        componentManufacturer:  SInt32;
        componentFlags:         SInt32;
        componentFlagsMask:     SInt32;
        componentName:          SInt8;
    end;

    HandlerAtomPtr = ^HandlerAtom;
    HandlerAtom = record
        size:                   SInt32;
        atomType:               SInt32;                             {  = 'hdlr'  }
        hInfo:                  PublicHandlerInfo;
    end;

    {    a data reference is a private structure    }
    DataRefAtom                         = SInt32;
    DataInfoAtomPtr = ^DataInfoAtom;
    DataInfoAtom = record
        size:                   SInt32;
        atomType:               SInt32;                             {  = 'dinf'  }
        dataRef:                DataRefAtom;
    end;

    RgnAtomPtr = ^RgnAtom;
    RgnAtom = record
        size:                   SInt32;
        atomType:               SInt32;
        rgnSize:                SInt16;
        rgnBBox:                Rect;
        data:                   SInt8;
    end;

    MatteCompressedAtomPtr = ^MatteCompressedAtom;
    MatteCompressedAtom = record
        size:                   SInt32;
        atomType:               SInt32;
        flags:                  SInt32;                             {  1 byte of version / 3 bytes of flags  }
        matteImageDescription:  ImageDescription;
        matteData:              SInt8;
    end;

    MatteAtomPtr = ^MatteAtom;
    MatteAtom = record
        size:                   SInt32;
        atomType:               SInt32;
        aCompressedMatte:       MatteCompressedAtom;
    end;

    ClippingAtomPtr = ^ClippingAtom;
    ClippingAtom = record
        size:                   SInt32;
        atomType:               SInt32;
        aRgnClip:               RgnAtom;
    end;

    {   **********************
    * Media Info Example Structures
    **********************  }

    VideoMediaInfoHeaderPtr = ^VideoMediaInfoHeader;
    VideoMediaInfoHeader = record
        flags:                  SInt32;                             {  1 byte of version / 3 bytes of flags  }
        graphicsMode:           SInt16;                             {  for QD - transfer mode  }
        opColorRed:             SInt16;                             {  opcolor for transfer mode  }
        opColorGreen:           SInt16;
        opColorBlue:            SInt16;
    end;

    VideoMediaInfoHeaderAtomPtr = ^VideoMediaInfoHeaderAtom;
    VideoMediaInfoHeaderAtom = record
        size:                   SInt32;                             {  size of Media info  }
        atomType:               SInt32;                             {  = 'vmhd'  }
        vmiHeader:              VideoMediaInfoHeader;
    end;

    VideoMediaInfoPtr = ^VideoMediaInfo;
    VideoMediaInfo = record
        size:                   SInt32;                             {  size of Media info  }
        atomType:               SInt32;                             {  = 'minf'  }
        header:                 VideoMediaInfoHeaderAtom;
        dataHandler:            HandlerAtom;
        dataInfo:               DataInfoAtom;
        sampleTable:            SampleTableAtom;
    end;

    SoundMediaInfoHeaderPtr = ^SoundMediaInfoHeader;
    SoundMediaInfoHeader = record
        flags:                  SInt32;                             {  1 byte of version / 3 bytes of flags  }
        balance:                SInt16;
        rsrvd:                  SInt16;
    end;

    SoundMediaInfoHeaderAtomPtr = ^SoundMediaInfoHeaderAtom;
    SoundMediaInfoHeaderAtom = record
        size:                   SInt32;                             {  size of Media info  }
        atomType:               SInt32;                             {  = 'vmhd'  }
        smiHeader:              SoundMediaInfoHeader;
    end;

    SoundMediaInfoPtr = ^SoundMediaInfo;
    SoundMediaInfo = record
        size:                   SInt32;                             {  size of Media info  }
        atomType:               SInt32;                             {  = 'minf'  }
        header:                 SoundMediaInfoHeaderAtom;
        dataHandler:            HandlerAtom;
        dataReference:          DataRefAtom;
        sampleTable:            SampleTableAtom;
    end;

    {    whatever data the media handler needs goes after the atomType  }
    MediaInfoPtr = ^MediaInfo;
    MediaInfo = record
        size:                   SInt32;
        atomType:               SInt32;
    end;

    {   **********************
    * Media Directory Structures
    **********************  }
    MediaHeaderPtr = ^MediaHeader;
    MediaHeader = record
        flags:                  SInt32;                             {  1 byte of version / 3 bytes of flags  }
        creationTime:           SInt32;                             {  seconds since Jan 1904 when directory was created  }
        modificationTime:       SInt32;                             {  seconds since Jan 1904 when directory was appended  }
        timeScale:              TimeValue;                              {  start time for Media (Media time)  }
        duration:               TimeValue;                              {  length of Media (Media time)  }
        language:               SInt16;
        quality:                SInt16;
    end;

    MediaHeaderAtomPtr = ^MediaHeaderAtom;
    MediaHeaderAtom = record
        size:                   SInt32;
        atomType:               SInt32;
        header:                 MediaHeader;
    end;

    MediaDirectoryPtr = ^MediaDirectory;
    MediaDirectory = record
        size:                   SInt32;
        atomType:               SInt32;                             {  = 'mdia'  }
        mediaHeader:            MediaHeaderAtom;                        {  standard Media information  }
        mediaHandler:           HandlerAtom;
        mediaInfo:              MediaInfo;
    end;

    {   **********************
    * Track Structures
    **********************  }

const
    TrackEnable                 = $01;
    TrackInMovie                = $02;
    TrackInPreview              = $04;
    TrackInPoster               = $08;


type
    TrackHeaderPtr = ^TrackHeader;
    TrackHeader = record
        flags:                  SInt32;                             {  1 byte of version / 3 bytes of flags  }
        creationTime:           SInt32;                             {  seconds since Jan 1904 when directory was created  }
        modificationTime:       SInt32;                             {  seconds since Jan 1904 when directory was appended  }
        trackID:                SInt32;
        reserved1:              SInt32;
        duration:               TimeValue;                              {  length of track (track time)  }
        reserved2:              SInt32;
        reserved3:              SInt32;
        layer:                  SInt16;
        alternateGroup:         SInt16;
        volume:                 SInt16;
        reserved4:              SInt16;
        matrix:                 MatrixRecord;
        trackWidth:             Fixed;
        trackHeight:            Fixed;
    end;

    TrackHeaderAtomPtr = ^TrackHeaderAtom;
    TrackHeaderAtom = record
        size:                   SInt32;                             {  size of track header  }
        atomType:               SInt32;                             {  = 'tkhd'  }
        header:                 TrackHeader;
    end;

    EditListTypePtr = ^EditListType;
    EditListType = record
        trackDuration:          TimeValue;
        mediaTime:              TimeValue;
        mediaRate:              Fixed;
    end;

    EditListAtomPtr = ^EditListAtom;
    EditListAtom = record
        size:                   SInt32;
        atomType:               SInt32;                             {  = elst  }
        flags:                  SInt32;                             {  1 byte of version / 3 bytes of flags  }
        numEntries:             SInt32;
        editListTable:          array [0..0] of EditListType;
    end;

    EditsAtomPtr = ^EditsAtom;
    EditsAtom = record
        size:                   SInt32;
        atomType:               SInt32;                             {  = edts  }
        editList:               EditListAtom;
    end;

    TrackLoadSettingsPtr = ^TrackLoadSettings;
    TrackLoadSettings = record
        preloadStartTime:       TimeValue;
        preloadDuration:        TimeValue;
        preloadFlags:           SInt32;
        defaultHints:           SInt32;
    end;

    TrackLoadSettingsAtomPtr = ^TrackLoadSettingsAtom;
    TrackLoadSettingsAtom = record
        size:                   SInt32;
        atomType:               SInt32;                             {  = load  }
        settings:               TrackLoadSettings;
    end;

    TrackDirectoryPtr = ^TrackDirectory;
    TrackDirectory = record
        size:                   SInt32;
        atomType:               SInt32;                             {  = 'trak'  }
        trackHeader:            TrackHeaderAtom;                        {  standard track information  }
        trackClip:              ClippingAtom;
        edits:                  EditsAtom;
        media:                  MediaDirectory;
        userData:               UserDataAtom;                           {  space for extending with new data types  }
    end;

    {   ***************************************
    *
    *   MovieDirectory -
    *       The MovieDirectory is the top level structure which
    *       holds the TrackInstance describing where the
    *       TrackDirectories are.
    *
    *************************************** }
    MovieHeaderPtr = ^MovieHeader;
    MovieHeader = record
        flags:                  SInt32;                             {  1 byte of version / 3 bytes of flags  }
        creationTime:           SInt32;                             {  seconds since Jan 1904 when directory was created  }
        modificationTime:       SInt32;                             {  seconds since Jan 1904 when directory was appended  }
        timeScale:              TimeValue;                              {  Time specifications  }
        duration:               TimeValue;
        preferredRate:          Fixed;                                  {  rate at which to play this movie  }
        preferredVolume:        SInt16;                             {  volume to play movie at  }
        reserved1:              SInt16;
        preferredLong1:         SInt32;
        preferredLong2:         SInt32;
        matrix:                 MatrixRecord;
        previewTime:            TimeValue;                              {  time in track the proxy begins (track time)  }
        previewDuration:        TimeValue;                              {  how long the proxy lasts (track time)  }
        posterTime:             TimeValue;                              {  time in track the proxy begins (track time)  }
        selectionTime:          TimeValue;                              {  time in track the proxy begins (track time)  }
        selectionDuration:      TimeValue;                              {  time in track the proxy begins (track time)  }
        currentTime:            TimeValue;                              {  time in track the proxy begins (track time)  }
        nextTrackID:            SInt32;                             {  next value to use for a TrackID  }
    end;

    MovieHeaderAtomPtr = ^MovieHeaderAtom;
    MovieHeaderAtom = record
        size:                   SInt32;
        atomType:               SInt32;                             {  = 'mvhd'  }
        header:                 MovieHeader;
    end;

    TrackDirectoryEntryPtr = ^TrackDirectoryEntry;
    TrackDirectoryEntry = record
        trackDirectory:         TrackDirectory;                         {  Track directory information  }
    end;

    MovieDirectoryPtr = ^MovieDirectory;
    MovieDirectory = record
        size:                   SInt32;
        atomType:               SInt32;                             {  = 'moov'  }
        header:                 MovieHeaderAtom;
        movieClip:              ClippingAtom;
                                                                        {  Track Directories  }
        track:                  array [0..0] of TrackDirectoryEntry;    {  Track directory information  }
                                                                        {  User data for Movie  }
        userData:               UserDataAtom;                           {  space for user extensions  }
    end;

    {   ***************************************
    *************************************** }

    {    Movie formats and tags     }

const
                                                                {  some system defined format IDs  }
    MOVIE_TYPE                  = $6D6F6F76 (* 'moov' *);
    TRACK_TYPE                  = $7472616B (* 'trak' *);
    MEDIA_TYPE                  = $6D646961 (* 'mdia' *);
    VIDEO_TYPE                  = $76696465 (* 'vide' *);
    SOUND_TYPE                  = $736F756E (* 'soun' *);

    {    atom id's  }
    MovieAID                    = $6D6F6F76 (* 'moov' *);
    MovieHeaderAID              = $6D766864 (* 'mvhd' *);
    ClipAID                     = $636C6970 (* 'clip' *);
    RgnClipAID                  = $6372676E (* 'crgn' *);
    MatteAID                    = $6D617474 (* 'matt' *);
    MatteCompAID                = $6B6D6174 (* 'kmat' *);
    TrackAID                    = $7472616B (* 'trak' *);
    UserDataAID                 = $75647461 (* 'udta' *);
    TrackHeaderAID              = $746B6864 (* 'tkhd' *);
    EditsAID                    = $65647473 (* 'edts' *);
    EditListAID                 = $656C7374 (* 'elst' *);
    MediaAID                    = $6D646961 (* 'mdia' *);
    MediaHeaderAID              = $6D646864 (* 'mdhd' *);
    MediaInfoAID                = $6D696E66 (* 'minf' *);
    VideoMediaInfoHeaderAID     = $766D6864 (* 'vmhd' *);
    SoundMediaInfoHeaderAID     = $736D6864 (* 'smhd' *);
    GenericMediaInfoHeaderAID   = $676D6864 (* 'gmhd' *);
    GenericMediaInfoAID         = $676D696E (* 'gmin' *);
    DataInfoAID                 = $64696E66 (* 'dinf' *);
    DataRefAID                  = $64726566 (* 'dref' *);
    SampleTableAID              = $7374626C (* 'stbl' *);
    STSampleDescAID             = $73747364 (* 'stsd' *);
    STTimeToSampAID             = $73747473 (* 'stts' *);
    STSyncSampleAID             = $73747373 (* 'stss' *);
    STSampleToChunkAID          = $73747363 (* 'stsc' *);
    STShadowSyncAID             = $73747368 (* 'stsh' *);
    HandlerAID                  = $68646C72 (* 'hdlr' *);
    STSampleSizeAID             = $7374737A (* 'stsz' *);
    STChunkOffsetAID            = $7374636F (* 'stco' *);
    STChunkOffset64AID          = $636F3634 (* 'co64' *);
    STSampleIDAID               = $73746964 (* 'stid' *);
    DataRefContainerAID         = $64726663 (* 'drfc' *);
    TrackReferenceAID           = $74726566 (* 'tref' *);
    ColorTableAID               = $63746162 (* 'ctab' *);
    LoadSettingsAID             = $6C6F6164 (* 'load' *);
    PropertyAtomAID             = $636F6465 (* 'code' *);
    InputMapAID                 = $696D6170 (* 'imap' *);
    MovieBufferHintsAID         = $6D626668 (* 'mbfh' *);
    MovieDataRefAliasAID        = $6D647261 (* 'mdra' *);
    SoundLocalizationAID        = $736C6F63 (* 'sloc' *);
    CompressedMovieAID          = $636D6F76 (* 'cmov' *);
    CompressedMovieDataAID      = $636D7664 (* 'cmvd' *);
    DataCompressionAtomAID      = $64636F6D (* 'dcom' *);
    ReferenceMovieRecordAID     = $726D7261 (* 'rmra' *);
    ReferenceMovieDescriptorAID = $726D6461 (* 'rmda' *);
    ReferenceMovieDataRefAID    = $72647266 (* 'rdrf' *);
    ReferenceMovieVersionCheckAID = $726D7663 (* 'rmvc' *);
    ReferenceMovieDataRateAID   = $726D6472 (* 'rmdr' *);
    ReferenceMovieComponentCheckAID = $726D6364 (* 'rmcd' *);
    ReferenceMovieQualityAID    = $726D7175 (* 'rmqu' *);
    ReferenceMovieLanguageAID   = $726D6C61 (* 'rmla' *);
    ReferenceMovieCPURatingAID  = $726D6373 (* 'rmcs' *);
    ReferenceMovieAlternateGroupAID = $726D6167 (* 'rmag' *);
    ReferenceMovieNetworkStatusAID = $726E6574 (* 'rnet' *);
    CloneMediaAID               = $636C6F6E (* 'clon' *);
    FileTypeAID                 = $66747970 (* 'ftyp' *);
    SecureContentInfoAID        = $73696E66 (* 'sinf' *);
    SecureContentSchemeTypeAID  = $7363686D (* 'schm' *);
    SecureContentSchemeInfoAID  = $73636869 (* 'schi' *);

    {  Text ATOM definitions }


type
    TextBoxAtomPtr = ^TextBoxAtom;
    TextBoxAtom = record
        size:                   SInt32;
        atomType:               SInt32;                             {  = 'tbox'  }
        textBox:                Rect;                                   {  New text box (overrides defaultTextBox) }
    end;

    HiliteAtomPtr = ^HiliteAtom;
    HiliteAtom = record
        size:                   SInt32;
        atomType:               SInt32;                             {  = 'hlit'  }
        selStart:               SInt32;                             {  hilite selection start character }
        selEnd:                 SInt32;                             {  hilite selection end character }
    end;

    KaraokeRecPtr = ^KaraokeRec;
    KaraokeRec = record
        timeVal:                TimeValue;
        beginHilite:            SInt16;
        endHilite:              SInt16;
    end;

    KaraokeAtomPtr = ^KaraokeAtom;
    KaraokeAtom = record
        numEntries:             SInt32;
        karaokeEntries:         array [0..0] of KaraokeRec;
    end;

    {  for ReferenceMovieDataRefRecord.flags }

const
    kDataRefIsSelfContained     = $01;


type
    ReferenceMovieDataRefRecordPtr = ^ReferenceMovieDataRefRecord;
    ReferenceMovieDataRefRecord = record
        flags:                  SInt32;
        dataRefType:            OSType;
        dataRefSize:            SInt32;
        dataRef:                SInt8;
    end;

    {  for VersionCheckRecord.checkType }

const
    kVersionCheckMin            = 0;                            {  val1 is the min. version required }
    kVersionCheckMask           = 1;                            {  (gestalt return value & val2) must == val1 }


type
    QTAltVersionCheckRecordPtr = ^QTAltVersionCheckRecord;
    QTAltVersionCheckRecord = record
        flags:                  SInt32;                             {  currently always 0 }
        gestaltTag:             OSType;
        val1:                   UInt32;
        val2:                   UInt32;
        checkType:              SInt16;
    end;

    {  some helpful constants for DataRateRecord.dataRate  }

const
    kDataRate144ModemRate       = 1400;
    kDataRate288ModemRate       = 2800;
    kDataRateISDNRate           = 5600;
    kDataRateDualISDNRate       = 11200;
    kDataRate256kbpsRate        = 25600;
    kDataRate384kbpsRate        = 38400;
    kDataRate512kbpsRate        = 51200;
    kDataRate768kbpsRate        = 76800;
    kDataRate1MbpsRate          = 100000;
    kDataRateT1Rate             = 150000;
    kDataRateInfiniteRate       = $7FFFFFFF;
    kDataRateDefaultIfNotSet    = 5600;


type
    QTAltDataRateRecordPtr = ^QTAltDataRateRecord;
    QTAltDataRateRecord = record
        flags:                  SInt32;                             {  currently always 0 }
        dataRate:               SInt32;
    end;

    QTAltComponentCheckRecordPtr = ^QTAltComponentCheckRecord;
    QTAltComponentCheckRecord = record
        flags:                  SInt32;                             {  currently always 0  }
        cd:                     ComponentDescription;
        minVersion:             UInt32;
    end;

    QTAltLanguageRecordPtr = ^QTAltLanguageRecord;
    QTAltLanguageRecord = record
        flags:                  SInt32;                             {  currently always 0 }
        language:               SInt16;
    end;



const
    kQTCPUSpeed1Rating          = 100;                          {  slowest }
    kQTCPUSpeed2Rating          = 200;
    kQTCPUSpeed3Rating          = 300;
    kQTCPUSpeed4Rating          = 400;
    kQTCPUSpeed5Rating          = 500;                          {  fastest }


type
    QTAltCPURatingRecordPtr = ^QTAltCPURatingRecord;
    QTAltCPURatingRecord = record
        flags:                  UInt32;                                 {  currently always 0 }
        speed:                  UInt16;
    end;

    ReferenceMovieNetworkStatusRecordPtr = ^ReferenceMovieNetworkStatusRecord;
    ReferenceMovieNetworkStatusRecord = record
        flags:                  UInt32;                                 {  currently always 0 }
        valueCount:             UInt32;                                 {  how many status values are in array }
        netStatusValues:        array [0..0] of SInt32;             {  a value from kQTNetworkStatus... constants }
    end;

    CloneRecordPtr = ^CloneRecord;
    CloneRecord = record
        flags:                  SInt32;
        masterTrackID:          SInt32;                             {  track ID of the track we're cloning  }
    end;

    CloneAtomPtr = ^CloneAtom;
    CloneAtom = record
        size:                   SInt32;
        atomType:               SInt32;                             {  = clon  }
        cloneInfo:              CloneRecord;
    end;

    FileTypeAtomPtr = ^FileTypeAtom;
    FileTypeAtom = record
        size:                   SInt32;
        atomType:               SInt32;                             {  = 'ftyp'  }
        majorBrand:             SInt32;                             {  best use brand  }
        minorVersion:           SInt32;
        compatibleBrands:       array [0..3] of SInt32;             {  1 or greater  }
    end;


const
    kQTFileTypeBrandQuickTimeMovie = $71742020 (* 'qt  ' *);                    {  QuickTime movie files }
    kQTFileTypeBrandISOFile     = $69736F6D (* 'isom' *);                       {  ISO Base Media files }
    kQTFileTypeBrandMPEG4v1     = $6D703431 (* 'mp41' *);                       {  MPEG-4 (ISO/IEC 14496-1) version 1 files }
    kQTFileTypeBrandMPEG4v2     = $6D703432 (* 'mp42' *);                       {  MPEG-4 (ISO/IEC 14496-1) version 2 files }


type
    SecureContentInfoAtomPtr = ^SecureContentInfoAtom;
    SecureContentInfoAtom = record
        size:                   SInt32;
        atomType:               SInt32;                             {  = 'sinf'  }
    end;

    SecureContentSchemeTypeAtomPtr = ^SecureContentSchemeTypeAtom;
    SecureContentSchemeTypeAtom = record
        size:                   SInt32;
        atomType:               SInt32;                             {  = 'schm'  }
        flags:                  SInt32;                             {  1 byte of version / 3 bytes of flags  }
        schemeType:             SInt32;
        schemeVersion:          UInt16;
                                                                        {  if flags & 1, C string holding URL for security component server }
    end;

    SecureContentSchemeInfoAtomPtr = ^SecureContentSchemeInfoAtom;
    SecureContentSchemeInfoAtom = record
        size:                   SInt32;
        atomType:               SInt32;                             {  = 'schi'  }
    end;

{$ALIGN MAC68K}
{#POP}
{unit PMCore}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}


{ Callbacks }

type
    PMIdleProcPtr = procedure;

    PMIdleUPP = ^SInt32; { an opaque UPP }

const
    uppPMIdleProcInfo = $00000000;
    {
     *  NewPMIdleUPP()
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function NewPMIdleUPP(userRoutine: PMIdleProcPtr): PMIdleUPP; external name '_NewPMIdleUPP';
{
 *  DisposePMIdleUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposePMIdleUPP(userUPP: PMIdleUPP); external name '_DisposePMIdleUPP';
{
 *  InvokePMIdleUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvokePMIdleUPP(userRoutine: PMIdleUPP); external name '_InvokePMIdleUPP';
{ Session routines }
{ Session support }
{
 *  PMRetain()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PMRetain(objct: PMObject): OSStatus; external name '_PMRetain';

{
 *  PMRelease()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PMRelease(objct: PMObject): OSStatus; external name '_PMRelease';

{ Session Print loop }
{**********************}
{ A session is created with a refcount of 1. }
{**********************}
{
 *  PMCreateSession()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PMCreateSession(var printSession: PMPrintSession): OSStatus; external name '_PMCreateSession';

{ Session PMPageFormat }
{**********************}
{ A pageformat is created with a refcount of 1. }
{**********************}
{
 *  PMCreatePageFormat()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PMCreatePageFormat(var pageFormat: PMPageFormat): OSStatus; external name '_PMCreatePageFormat';

{
 *  PMSessionDefaultPageFormat()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PMSessionDefaultPageFormat(printSession: PMPrintSession; pageFormat: PMPageFormat): OSStatus; external name '_PMSessionDefaultPageFormat';

{
 *  PMSessionValidatePageFormat()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PMSessionValidatePageFormat(printSession: PMPrintSession; pageFormat: PMPageFormat; result: BooleanPtr): OSStatus; external name '_PMSessionValidatePageFormat';

{ Session PMPrintSettings }
{**********************}
{ A printSettings is created with a refcount of 1. }
{**********************}
{
 *  PMCreatePrintSettings()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PMCreatePrintSettings(var printSettings: PMPrintSettings): OSStatus; external name '_PMCreatePrintSettings';

{
 *  PMSessionDefaultPrintSettings()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PMSessionDefaultPrintSettings(printSession: PMPrintSession; printSettings: PMPrintSettings): OSStatus; external name '_PMSessionDefaultPrintSettings';

{
 *  PMSessionValidatePrintSettings()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PMSessionValidatePrintSettings(printSession: PMPrintSession; printSettings: PMPrintSettings; result: BooleanPtr): OSStatus; external name '_PMSessionValidatePrintSettings';

{ Session Classic support }
{
 *  PMSessionGeneral()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PMSessionGeneral(printSession: PMPrintSession; pData: Ptr): OSStatus; external name '_PMSessionGeneral';

{
 *  PMSessionConvertOldPrintRecord()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PMSessionConvertOldPrintRecord(printSession: PMPrintSession; printRecordHandle: Handle; var printSettings: PMPrintSettings; var pageFormat: PMPageFormat): OSStatus; external name '_PMSessionConvertOldPrintRecord';

{
 *  PMSessionMakeOldPrintRecord()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PMSessionMakeOldPrintRecord(printSession: PMPrintSession; printSettings: PMPrintSettings; pageFormat: PMPageFormat; var printRecordHandle: Handle): OSStatus; external name '_PMSessionMakeOldPrintRecord';

{ Session Driver Information }
{
 *  PMPrinterGetDescriptionURL()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PMPrinterGetDescriptionURL(printer: PMPrinter; descriptionType: CFStringRef; var fileURL: CFURLRef): OSStatus; external name '_PMPrinterGetDescriptionURL';

{
 *  PMSessionGetCurrentPrinter()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PMSessionGetCurrentPrinter(printSession: PMPrintSession; var currentPrinter: PMPrinter): OSStatus; external name '_PMSessionGetCurrentPrinter';

{
 *  PMPrinterGetLanguageInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PMPrinterGetLanguageInfo(printer: PMPrinter; var info: PMLanguageInfo): OSStatus; external name '_PMPrinterGetLanguageInfo';

{
 *  PMPrinterGetDriverCreator()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PMPrinterGetDriverCreator(printer: PMPrinter; var creator: OSType): OSStatus; external name '_PMPrinterGetDriverCreator';

{
 *  PMPrinterGetDriverReleaseInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PMPrinterGetDriverReleaseInfo(printer: PMPrinter; var release: VersRec): OSStatus; external name '_PMPrinterGetDriverReleaseInfo';

{
 *  PMPrinterGetPrinterResolutionCount()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PMPrinterGetPrinterResolutionCount(printer: PMPrinter; var count: UInt32): OSStatus; external name '_PMPrinterGetPrinterResolutionCount';

{
 *  PMPrinterGetPrinterResolution()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PMPrinterGetPrinterResolution(printer: PMPrinter; tag: PMTag; var res: PMResolution): OSStatus; external name '_PMPrinterGetPrinterResolution';

{
 *  PMPrinterGetIndexedPrinterResolution()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PMPrinterGetIndexedPrinterResolution(printer: PMPrinter; index: UInt32; var res: PMResolution): OSStatus; external name '_PMPrinterGetIndexedPrinterResolution';

{
 *  PMPrinterIsPostScriptCapable()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.6 and later
 *    Mac OS X:         in version 10.2 and later
 }
function PMPrinterIsPostScriptCapable(printer: PMPrinter): boolean; external name '_PMPrinterIsPostScriptCapable';

{
 *  PMPrinterGetMakeAndModelName()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.6 and later
 *    Mac OS X:         in version 10.2 and later
 }
function PMPrinterGetMakeAndModelName(printer: PMPrinter; var makeAndModel: CFStringRef): OSStatus; external name '_PMPrinterGetMakeAndModelName';

{ Session ColorSync & PostScript Support }
{
 *  PMSessionEnableColorSync()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PMSessionEnableColorSync(printSession: PMPrintSession): OSStatus; external name '_PMSessionEnableColorSync';

{
 *  PMSessionDisableColorSync()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PMSessionDisableColorSync(printSession: PMPrintSession): OSStatus; external name '_PMSessionDisableColorSync';

{
 *  PMSessionPostScriptBegin()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PMSessionPostScriptBegin(printSession: PMPrintSession): OSStatus; external name '_PMSessionPostScriptBegin';

{
 *  PMSessionPostScriptEnd()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PMSessionPostScriptEnd(printSession: PMPrintSession): OSStatus; external name '_PMSessionPostScriptEnd';

{
 *  PMSessionPostScriptHandle()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PMSessionPostScriptHandle(printSession: PMPrintSession; psHandle: Handle): OSStatus; external name '_PMSessionPostScriptHandle';

{
 *  PMSessionPostScriptData()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PMSessionPostScriptData(printSession: PMPrintSession; psPtr: Ptr; len: Size): OSStatus; external name '_PMSessionPostScriptData';

{
 *  PMSessionPostScriptFile()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PMSessionPostScriptFile(printSession: PMPrintSession; var psFile: FSSpec): OSStatus; external name '_PMSessionPostScriptFile';

{
 *  PMSessionSetPSInjectionData()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PMSessionSetPSInjectionData(printSession: PMPrintSession; printSettings: PMPrintSettings; injectionDictArray: CFArrayRef): OSStatus; external name '_PMSessionSetPSInjectionData';

{ Session Error }
{
 *  PMSessionError()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PMSessionError(printSession: PMPrintSession): OSStatus; external name '_PMSessionError';

{
 *  PMSessionSetError()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PMSessionSetError(printSession: PMPrintSession; printError: OSStatus): OSStatus; external name '_PMSessionSetError';

{ Other Session routines }
{
 *  PMSessionGetDocumentFormatGeneration()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PMSessionGetDocumentFormatGeneration(printSession: PMPrintSession; var docFormats: CFArrayRef): OSStatus; external name '_PMSessionGetDocumentFormatGeneration';

{
 *  PMSessionSetDocumentFormatGeneration()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PMSessionSetDocumentFormatGeneration(printSession: PMPrintSession; docFormat: CFStringRef; graphicsContextTypes: CFArrayRef; options: CFTypeRef): OSStatus; external name '_PMSessionSetDocumentFormatGeneration';

{
 *  PMSessionGetDocumentFormatSupported()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PMSessionGetDocumentFormatSupported(printSession: PMPrintSession; var docFormats: CFArrayRef; limit: UInt32): OSStatus; external name '_PMSessionGetDocumentFormatSupported';

{
 *  PMSessionIsDocumentFormatSupported()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PMSessionIsDocumentFormatSupported(printSession: PMPrintSession; docFormat: CFStringRef; var supported: boolean): OSStatus; external name '_PMSessionIsDocumentFormatSupported';

{
 *  PMSessionGetGraphicsContext()
 *
 *  Parameters:
 *
 *    printSession:
 *      the session
 *
 *    graphicsContextType:
 *      either kPMGraphicsContextQuickdraw or
 *      kPMGraphicsContextCoreGraphics
 *
 *    graphicsContext:
 *      returns a GrafPtr or a CGContextRef
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PMSessionGetGraphicsContext(printSession: PMPrintSession; graphicsContextType: CFStringRef; var graphicsContext: UnivPtr): OSStatus; external name '_PMSessionGetGraphicsContext';

{
 *  PMSessionSetIdleProc()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PMSessionSetIdleProc(printSession: PMPrintSession; idleProc: PMIdleUPP): OSStatus; external name '_PMSessionSetIdleProc';

{
 *  PMSessionSetDataInSession()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PMSessionSetDataInSession(printSession: PMPrintSession; key: CFStringRef; data: CFTypeRef): OSStatus; external name '_PMSessionSetDataInSession';

{
 *  PMSessionGetDataFromSession()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PMSessionGetDataFromSession(printSession: PMPrintSession; key: CFStringRef; var data: CFTypeRef): OSStatus; external name '_PMSessionGetDataFromSession';

{
 *  PMSessionCreatePrinterList()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.4 and later
 *    Mac OS X:         in version 10.1 and later
 }
function PMSessionCreatePrinterList(printSession: PMPrintSession; var printerList: CFArrayRef; var currentIndex: CFIndex; var currentPrinter: PMPrinter): OSStatus; external name '_PMSessionCreatePrinterList';

{
 *  PMSessionSetCurrentPrinter()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.4 and later
 *    Mac OS X:         in version 10.1 and later
 }
function PMSessionSetCurrentPrinter(session: PMPrintSession; printerName: CFStringRef): OSStatus; external name '_PMSessionSetCurrentPrinter';

{
 *  PMSessionSetDestination()
 *
 *  Summary:
 *    Alter a print session and print settings so that an associated
 *    print job is sent to the provided destination type in the,
 *    optional, MIME document format.
 *
 *  Discussion:
 *    This function is most useful when an application would like to
 *    write its print output to disk without requiring user
 *    interaction. The list of MIME types that can be sent to the
 *    provided destination can be obtained from
 *    PMSessionCopyOutputFormatList and one of these passed to this
 *    function.
 *
 *  Parameters:
 *
 *    printSession:
 *      The session to be used for a print job. The session holds the
 *      preview setting which can override the destination type in the
 *      print settings.
 *
 *    printSettings:
 *      The print settings to be used for a print job. The print
 *      settings specify whether a job will be directed toward a
 *      printer or to file. It also holds the requested MIME output
 *      type.
 *
 *    destType:
 *      The destiation type for a print job associated with the
 *      provided print session and print settings. Fax is currently not
 *      supported, but kPMDestinationPrinter, kPMDestinationFile, and
 *      kPMDestinationPreview can be set.
 *
 *    destFormat:
 *      The MIME type to be generated for the provided destination
 *      type. This parameter can be NULL in which the default format
 *      for the requested destination type is used. To obtain a list of
 *      valid formats for a given destiation type, use the function
 *      PMSessionCopyOutputFormatList.
 *
 *    destLocation:
 *      Some destination types support a destination location. The
 *      clearest example is the kPMDestinationFile destination type
 *      which allows a caller to also supply a file URL specifying
 *      where the output file is to be created.
 *
 *    SPECIAL_AVAILABILITY_NOTE:
 *      This routine is available in ApplicationsServices.framework in
 *      Mac OS X version 10.1 and later. On Mac OS X it is available to
 *      CFM applications through CarbonLib starting with Mac OS X
 *      version 10.2 and later.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.5 and later
 *    Mac OS X:         in version 10.1 and later
 }
function PMSessionSetDestination(printSession: PMPrintSession; printSettings: PMPrintSettings; destType: PMDestinationType; destFormat: CFStringRef; destLocation: CFURLRef): OSStatus; external name '_PMSessionSetDestination';

{
 *  PMSessionGetDestinationType()
 *
 *  Summary:
 *    Hand back the destination type that will be used for a print job
 *    with the specified print settings and print session.
 *
 *  Discussion:
 *    Currently there are four destination types:
 *    kPMDestinationPrinter, kPMDestinationFile, kPMDestinationFax and
 *    kPMDestinationPreview. The first three destination types are
 *    stored in the print settings. The switch for preview is stored in
 *    the print session and, if enabled, overrides the destination in
 *    the print setting. This function is preferred over
 *    PMGetDestination as the latter does not take a print session
 *    parameter and therefore can not indicate whether preview has been
 *    selected as the destination.
 *
 *  Parameters:
 *
 *    printSession:
 *      The session to be used for a print job. The session holds the
 *      preview setting which can override the destination type in the
 *      print settings.
 *
 *    printSettings:
 *      The print settings to be used for a print job. The print
 *      settings specify whether a job will be directed toward a
 *      printer or to file.
 *
 *    destTypeP:
 *      A pointer to a caller supplied PMDestinationType variable. If
 *      this function succeeds then *'destTypeP' will be filled in with
 *      the destination type for a print job that used the specified
 *      session and print settings. If this function fails, then
 *      *'destType' will be set to kPMDestinationInvalid.
 *
 *    SPECIAL_AVAILABILITY_NOTE:
 *      This routine is available in ApplicationsServices.framework in
 *      Mac OS X version 10.1 and later. On Mac OS X it is available to
 *      CFM applications through CarbonLib starting with Mac OS X
 *      version 10.2 and later.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.5 and later
 *    Mac OS X:         in version 10.1 and later
 }
function PMSessionGetDestinationType(printSession: PMPrintSession; printSettings: PMPrintSettings; var destTypeP: PMDestinationType): OSStatus; external name '_PMSessionGetDestinationType';

{
 *  PMSessionCopyDestinationFormat()
 *
 *  Summary:
 *    Hand back the destination output MIME type associated with the
 *    provided print session and print settings.
 *
 *  Parameters:
 *
 *    printSession:
 *      A currently open print session.
 *
 *    printSettings:
 *      The print settings that are to be searched.
 *
 *    destFormatP:
 *      A pointer to a caller allocated CFStringRef variable. If this
 *      routine returns noErr then *'destFormatP' will either be a copy
 *      of a CFStringRef specifying the output format for the print
 *      job, or NULL indicating that the default output format will be
 *      used. If this function return an error, then *'destFormatP'
 *      will be set to NULL.
 *
 *    SPECIAL_AVAILABILITY_NOTE:
 *      This routine is available in ApplicationsServices.framework in
 *      Mac OS X version 10.1 and later. On Mac OS X it is available to
 *      CFM applications through CarbonLib starting with Mac OS X
 *      version 10.2 and later.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.5 and later
 *    Mac OS X:         in version 10.1 and later
 }
function PMSessionCopyDestinationFormat(printSession: PMPrintSession; printSettings: PMPrintSettings; var destFormatP: CFStringRef): OSStatus; external name '_PMSessionCopyDestinationFormat';

{
 *  PMSessionCopyDestinationLocation()
 *
 *  Summary:
 *    Hand back the URL destination location given a print session and
 *    print settings.
 *
 *  Discussion:
 *    Some destination type support a destination location which
 *    further defines where the output from a pritn job should be sent.
 *    The kPMDestinationFile destiation type, for example, will use a
 *    file URL to determine where a new file should be created.
 *
 *  Parameters:
 *
 *    printSession:
 *      A currently open print session.
 *
 *    printSettings:
 *      The print settings that are to be searched.
 *
 *    destLocationP:
 *      A pointer to a caller allocated CFURLRef variable. If this
 *      routine returns noErr then *'outputFileP' will either be NULL
 *      indicating that the job is using the default destination
 *      location for the current destination type or a copy of a
 *      CFURLRef will be placed in *'destLocationP'. If this function
 *      returns an error then 'destLocationP' will be set to NULL.
 *
 *    SPECIAL_AVAILABILITY_NOTE:
 *      This routine is available in ApplicationsServices.framework in
 *      Mac OS X version 10.1 and later. On Mac OS X it is available to
 *      CFM applications through CarbonLib starting with Mac OS X
 *      version 10.2 and later.
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.5 and later
 *    Mac OS X:         in version 10.1 and later
 }
function PMSessionCopyDestinationLocation(printSession: PMPrintSession; printSettings: PMPrintSettings; var destLocationP: CFURLRef): OSStatus; external name '_PMSessionCopyDestinationLocation';

{
 *  PMSessionCopyOutputFormatList()
 *
 *  Summary:
 *    Hands back an an array of MIME types describing the possible
 *    output formats for the printer module associated with the current
 *    printer.
 *
 *  Parameters:
 *
 *    printSession:
 *      This session's current printer's printer module will be queried
 *      for its supported output MIME types.
 *
 *    destType:
 *      A print job can have one of several possible destination types.
 *      The list of valid output formats is dependent upon the
 *      destination type. This parameter specifies destination type of
 *      interest when retrieving the output formats list.
 *
 *    documentFormatP:
 *      A pointer to a caller's CFArrayRef variable. If this routine
 *      completes successfully, then *'documentFormatP' will be set to
 *      a CFArrayRef containing CFStringRefs. Each CFStringRef in the
 *      array is a MIME type specifying a type of output that can be
 *      generated by the printer module associated with the current
 *      printer.
 *
 *    SPECIAL_AVAILABILITY_NOTE:
 *      This routine is available in ApplicationsServices.framework in
 *      Mac OS X version 10.1 and later. On Mac OS X it is available to
 *      CFM applications through CarbonLib starting with Mac OS X
 *      version 10.2 and later. On Mac OS 8/9 using CarbonLib, this
 *      routine returns kPMNotImplemented
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.6 and later
 *    Mac OS X:         in version 10.1 and later
 }
function PMSessionCopyOutputFormatList(printSession: PMPrintSession; destType: PMDestinationType; var documentFormatP: CFArrayRef): OSStatus; external name '_PMSessionCopyOutputFormatList';


{
 *  PMSessionCreatePageFormatList()
 *
 *  Summary:
 *    Hand back a list of page format instances. Each page format
 *    instance describes a paper size available on the specified
 *    printer.
 *
 *  Parameters:
 *
 *    printSession:
 *      A currently open print session.
 *
 *    printer:
 *      The printer whose page size list should be enumerated. To get
 *      the session's current printer, see PMSessionGetCurrentPrinter().
 *
 *    pageFormatList:
 *      If this function is successful then noErr will be returned and
 *      *'pageFormatList' will be set to a newly created CFArray. Each
 *      element in the array will be a PMPageFormat describing an
 *      available paper size for the specified printer. If this
 *      function fails then a non-zero error code will be returned and
 *      *'pageFormatList' will be set to NULL.
 *
 *    SPECIAL_AVAILABILITY_NOTE:
 *      This routine is available in ApplicationsServices.framework in
 *      Mac OS X version 10.1 and later. On Mac OS X it is available to
 *      CFM applications through CarbonLib starting with Mac OS X
 *      version 10.2 and later. On Mac OS 8/9 using CarbonLib, this
 *      routine returns kPMNotImplemented
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.6 and later
 *    Mac OS X:         in version 10.1 and later
 }
function PMSessionCreatePageFormatList(printSession: PMPrintSession; printer: PMPrinter; var pageFormatList: CFArrayRef): OSStatus; external name '_PMSessionCreatePageFormatList';

{
 * SPECIAL AVAILABILITY note: This routine is available in ApplicationsServices.framework in
 * Mac OS X version 10.0 and later. On Mac OS X it is available to CFM applications through CarbonLib
 * starting with Mac OS X version 10.2 and later.
 *
 * On Mac OS 8/9 using CarbonLib, this routine returns kPMNotImplemented
 }
{
 *  PMSessionBeginDocumentNoDialog()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.6 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PMSessionBeginDocumentNoDialog(printSession: PMPrintSession; printSettings: PMPrintSettings; pageFormat: PMPageFormat): OSStatus; external name '_PMSessionBeginDocumentNoDialog';

{
 * SPECIAL AVAILABILITY note: This routine is available in ApplicationsServices.framework in
 * Mac OS X version 10.0 and later. On Mac OS X it is available to CFM applications through CarbonLib
 * starting with Mac OS X version 10.2 and later.
 *
 * On Mac OS 8/9 using CarbonLib, this routine returns kPMNotImplemented
 }
{
 *  PMSessionEndDocumentNoDialog()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.6 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PMSessionEndDocumentNoDialog(printSession: PMPrintSession): OSStatus; external name '_PMSessionEndDocumentNoDialog';

{
 * SPECIAL AVAILABILITY note: This routine is available in ApplicationsServices.framework in
 * Mac OS X version 10.0 and later. On Mac OS X it is available to CFM applications through CarbonLib
 * starting with Mac OS X version 10.2 and later.
 *
 * On Mac OS 8/9 using CarbonLib, this routine returns kPMNotImplemented
 }
{
 *  PMSessionBeginPageNoDialog()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.6 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PMSessionBeginPageNoDialog(printSession: PMPrintSession; pageFormat: PMPageFormat; pageFrame: PMRectPtr): OSStatus; external name '_PMSessionBeginPageNoDialog';

{
 * SPECIAL AVAILABILITY note: This routine is available in ApplicationsServices.framework in
 * Mac OS X version 10.0 and later. On Mac OS X it is available to CFM applications through CarbonLib
 * starting with Mac OS X version 10.2 and later.
 *
 * On Mac OS 8/9 using CarbonLib, this routine returns kPMNotImplemented
 }
{
 *  PMSessionEndPageNoDialog()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.6 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PMSessionEndPageNoDialog(printSession: PMPrintSession): OSStatus; external name '_PMSessionEndPageNoDialog';


{ PMPageFormat }
{
 *  PMCopyPageFormat()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PMCopyPageFormat(formatSrc: PMPageFormat; formatDest: PMPageFormat): OSStatus; external name '_PMCopyPageFormat';

{**********************}
{  Flattening a page format should only be necessary if you intend to preserve }
{  the object settings along with a document. A page format will persist outside of a }
{  PMBegin/PMEnd block. This will allow you to use any accessors on the object without }
{  the need to flatten and unflatten. Keep in mind accessors make no assumption }
{  on the validity of the value you set. This can only be done thru PMValidatePageFormat }
{  in a PMBegin/PMEnd block or with PMSessionValidatePageFormat with a valid session. }
{  It is your responsibility for disposing of the handle. }
{**********************}
{
 *  PMFlattenPageFormat()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PMFlattenPageFormat(pageFormat: PMPageFormat; var flatFormat: Handle): OSStatus; external name '_PMFlattenPageFormat';

{
 *  PMUnflattenPageFormat()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PMUnflattenPageFormat(flatFormat: Handle; var pageFormat: PMPageFormat): OSStatus; external name '_PMUnflattenPageFormat';

{ PMPageFormat Accessors }
{**********************}
{ PMSetxxx calls only saves the value inside the printing object. They make no assumption on the }
{ validity of the value. This should be done using PMValidatePageFormat/PMSessionValidatePageFormat }
{ Any dependant settings are also updated during a validate call. }
{ For example: }
{ PMGetAdjustedPaperRect - returns a rect of a certain size }
{ PMSetScale( aPageFormat, 500.0 )  }
{ PMGetAdjustedPaperRect - returns the SAME rect as the first call  }
{}
{ PMGetAdjustedPaperRect - returns a rect of a certain size }
{ PMSetScale( aPageFormat, 500.0 ) }
{ PMValidatePageFormat or PMSessionValidatePageFormat }
{ PMGetAdjustedPaperRect - returns a rect thats scaled 500% from the first call }
{**********************}
{
 *  PMGetPageFormatExtendedData()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PMGetPageFormatExtendedData(pageFormat: PMPageFormat; dataID: OSType; var size: UInt32; extendedData: UnivPtr): OSStatus; external name '_PMGetPageFormatExtendedData';

{
 *  PMSetPageFormatExtendedData()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PMSetPageFormatExtendedData(pageFormat: PMPageFormat; dataID: OSType; size: UInt32; extendedData: UnivPtr): OSStatus; external name '_PMSetPageFormatExtendedData';

{**********************}
{  A value of 100.0 means 100% (no scaling). 50.0 means 50% scaling }
{**********************}
{
 *  PMGetScale()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PMGetScale(pageFormat: PMPageFormat; var scale: Double): OSStatus; external name '_PMGetScale';

{
 *  PMSetScale()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PMSetScale(pageFormat: PMPageFormat; scale: Double): OSStatus; external name '_PMSetScale';

{**********************}
{  This is the drawing resolution of an app. This should not be confused with }
{  the resolution of the printer. You can call PMGetPrinterResolution to see }
{  what resolutions are avaliable for the current printer. }
{**********************}
{
 *  PMGetResolution()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PMGetResolution(pageFormat: PMPageFormat; var res: PMResolution): OSStatus; external name '_PMGetResolution';

{
 *  PMSetResolution()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PMSetResolution(pageFormat: PMPageFormat; const (*var*) res: PMResolution): OSStatus; external name '_PMSetResolution';

{**********************}
{  This is the physical size of the paper without regard to resolution, orientation }
{  or scaling. It is returned as a 72dpi value. }
{**********************}
{
 *  PMGetPhysicalPaperSize()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PMGetPhysicalPaperSize(pageFormat: PMPageFormat; var paperSize: PMRect): OSStatus; external name '_PMGetPhysicalPaperSize';

{
 *  PMSetPhysicalPaperSize()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PMSetPhysicalPaperSize(pageFormat: PMPageFormat; const (*var*) paperSize: PMRect): OSStatus; external name '_PMSetPhysicalPaperSize';

{**********************}
{  This is the physical size of the page without regard to resolution, orientation }
{  or scaling. It is returned as a 72dpi value. }
{**********************}
{
 *  PMGetPhysicalPageSize()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PMGetPhysicalPageSize(pageFormat: PMPageFormat; var pageSize: PMRect): OSStatus; external name '_PMGetPhysicalPageSize';

{
 *  PMGetAdjustedPaperRect()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PMGetAdjustedPaperRect(pageFormat: PMPageFormat; var paperRect: PMRect): OSStatus; external name '_PMGetAdjustedPaperRect';

{
 *  PMGetAdjustedPageRect()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PMGetAdjustedPageRect(pageFormat: PMPageFormat; var pageRect: PMRect): OSStatus; external name '_PMGetAdjustedPageRect';

{
 *  PMGetUnadjustedPaperRect()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PMGetUnadjustedPaperRect(pageFormat: PMPageFormat; var paperRect: PMRect): OSStatus; external name '_PMGetUnadjustedPaperRect';

{
 *  PMSetUnadjustedPaperRect()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PMSetUnadjustedPaperRect(pageFormat: PMPageFormat; const (*var*) paperRect: PMRect): OSStatus; external name '_PMSetUnadjustedPaperRect';

{
 *  PMGetUnadjustedPageRect()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PMGetUnadjustedPageRect(pageFormat: PMPageFormat; var pageRect: PMRect): OSStatus; external name '_PMGetUnadjustedPageRect';

{
 *  PMSetAdjustedPageRect()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PMSetAdjustedPageRect(pageFormat: PMPageFormat; const (*var*) pageRect: PMRect): OSStatus; external name '_PMSetAdjustedPageRect';

{
 *  PMGetOrientation()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PMGetOrientation(pageFormat: PMPageFormat; var orientation: PMOrientation): OSStatus; external name '_PMGetOrientation';

{
 *  PMSetOrientation()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PMSetOrientation(pageFormat: PMPageFormat; orientation: PMOrientation; lock: boolean): OSStatus; external name '_PMSetOrientation';

{ PMPrintSettings }
{
 *  PMCopyPrintSettings()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PMCopyPrintSettings(settingSrc: PMPrintSettings; settingDest: PMPrintSettings): OSStatus; external name '_PMCopyPrintSettings';

{**********************}
{  Flattening a print settings should only be necessary if you intend to preserve }
{  the object settings along with a document. A print settings will persist outside of a }
{  PMBegin/PMEnd block. This allows you to use any accessors on the object without }
{  the need to flatten and unflatten. Keep in mind the accessors make no assumption }
{  on the validity of the value. This can only be done thru PMValidatePrintSettings }
{  in a PMBegin/PMEnd block or with PMSessionValidatePrintSettings with a valid session. }
{  It is your responsibility for disposing of the handle. }
{**********************}
{
 *  PMFlattenPrintSettings()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PMFlattenPrintSettings(printSettings: PMPrintSettings; var flatSettings: Handle): OSStatus; external name '_PMFlattenPrintSettings';

{
 *  PMUnflattenPrintSettings()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PMUnflattenPrintSettings(flatSettings: Handle; var printSettings: PMPrintSettings): OSStatus; external name '_PMUnflattenPrintSettings';

{ PMPrintSettings Accessors }
{
 *  PMGetPrintSettingsExtendedData()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PMGetPrintSettingsExtendedData(printSettings: PMPrintSettings; dataID: OSType; var size: UInt32; extendedData: UnivPtr): OSStatus; external name '_PMGetPrintSettingsExtendedData';

{
 *  PMSetPrintSettingsExtendedData()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PMSetPrintSettingsExtendedData(printSettings: PMPrintSettings; dataID: OSType; size: UInt32; extendedData: UnivPtr): OSStatus; external name '_PMSetPrintSettingsExtendedData';

{
 *  PMGetDestination()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PMGetDestination(printSettings: PMPrintSettings; var destType: PMDestinationType; var fileURL: CFURLRef): OSStatus; external name '_PMGetDestination';

{
 *  PMGetJobName()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PMGetJobName(printSettings: PMPrintSettings; name: StringPtr): OSStatus; external name '_PMGetJobName';

{
 *  PMSetJobName()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PMSetJobName(printSettings: PMPrintSettings; const (*var*) name: Str255): OSStatus; external name '_PMSetJobName';

{
 *  PMGetCopies()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PMGetCopies(printSettings: PMPrintSettings; var copies: UInt32): OSStatus; external name '_PMGetCopies';

{
 *  PMSetCopies()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PMSetCopies(printSettings: PMPrintSettings; copies: UInt32; lock: boolean): OSStatus; external name '_PMSetCopies';

{
 *  PMGetFirstPage()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PMGetFirstPage(printSettings: PMPrintSettings; var first: UInt32): OSStatus; external name '_PMGetFirstPage';

{
 *  PMSetFirstPage()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PMSetFirstPage(printSettings: PMPrintSettings; first: UInt32; lock: boolean): OSStatus; external name '_PMSetFirstPage';

{
 *  PMGetLastPage()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PMGetLastPage(printSettings: PMPrintSettings; var last: UInt32): OSStatus; external name '_PMGetLastPage';

{
 *  PMSetLastPage()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PMSetLastPage(printSettings: PMPrintSettings; last: UInt32; lock: boolean): OSStatus; external name '_PMSetLastPage';

{**********************}
{  The default page range is from 1-32000. The page range is something that is }
{  set by the application. It is NOT the first and last page to print. It serves }
{  as limits for setting the first and last page. You may pass kPMPrintAllPages for }
{  the maxPage value to specified that all pages are available for printing. }
{**********************}
{
 *  PMGetPageRange()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PMGetPageRange(printSettings: PMPrintSettings; var minPage: UInt32; var maxPage: UInt32): OSStatus; external name '_PMGetPageRange';

{**********************}
{ The first and last page are immediately clipped to the new range }
{**********************}
{
 *  PMSetPageRange()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PMSetPageRange(printSettings: PMPrintSettings; minPage: UInt32; maxPage: UInt32): OSStatus; external name '_PMSetPageRange';

{
 *  PMSetProfile()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PMSetProfile(printSettings: PMPrintSettings; tag: PMTag; const (*var*) profile: CMProfileLocation): OSStatus; external name '_PMSetProfile';

{
 *  PMGetColorMode()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PMGetColorMode(printSettings: PMPrintSettings; var colorMode: PMColorMode): OSStatus; external name '_PMGetColorMode';

{
 *  PMSetColorMode()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PMSetColorMode(printSettings: PMPrintSettings; colorMode: PMColorMode): OSStatus; external name '_PMSetColorMode';

{
 *  PMGetJobNameCFString()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PMGetJobNameCFString(printSettings: PMPrintSettings; var name: CFStringRef): OSStatus; external name '_PMGetJobNameCFString';

{
 *  PMSetJobNameCFString()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PMSetJobNameCFString(printSettings: PMPrintSettings; name: CFStringRef): OSStatus; external name '_PMSetJobNameCFString';

{
 *  PMSetCollate()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.6 and later
 *    Mac OS X:         in version 10.2 and later
 }
function PMSetCollate(printSettings: PMPrintSettings; collate: boolean): OSStatus; external name '_PMSetCollate';

{
 *  PMGetCollate()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.6 and later
 *    Mac OS X:         in version 10.2 and later
 }
function PMGetCollate(printSettings: PMPrintSettings; var collate: boolean): OSStatus; external name '_PMGetCollate';

{$ALIGN MAC68K}
{#POP}
{unit QuickTimeMusic}
{$ALIGN MAC68K}










{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}


const
    kaiToneDescType             = $746F6E65 (* 'tone' *);
    kaiNoteRequestInfoType      = $6E747271 (* 'ntrq' *);
    kaiKnobListType             = $6B6E626C (* 'knbl' *);
    kaiKeyRangeInfoType         = $73696E66 (* 'sinf' *);
    kaiSampleDescType           = $73647363 (* 'sdsc' *);
    kaiSampleInfoType           = $736D696E (* 'smin' *);
    kaiSampleDataType           = $73646174 (* 'sdat' *);
    kaiSampleDataQUIDType       = $71756964 (* 'quid' *);
    kaiInstInfoType             = $69696E66 (* 'iinf' *);
    kaiPictType                 = $70696374 (* 'pict' *);
    kaiWriterType               = $A9777274 (* '©wrt' *);
    kaiCopyrightType            = $A9637079 (* '©cpy' *);
    kaiOtherStrType             = $73747220 (* 'str ' *);
    kaiInstrumentRefType        = $69726566 (* 'iref' *);
    kaiInstGMQualityType        = $7175616C (* 'qual' *);
    kaiLibraryInfoType          = $6C696E66 (* 'linf' *);
    kaiLibraryDescType          = $6C647363 (* 'ldsc' *);


type
    InstLibDescRecPtr = ^InstLibDescRec;
    InstLibDescRec = record
        libIDName:              Str31;
    end;

    InstKnobRecPtr = ^InstKnobRec;
    InstKnobRec = record
        number:                 BigEndianLong;
        value:                  BigEndianLong;
    end;


const
    kInstKnobMissingUnknown     = 0;
    kInstKnobMissingDefault     = $01;


type
    InstKnobListPtr = ^InstKnobList;
    InstKnobList = record
        knobCount:              BigEndianLong;
        knobFlags:              BigEndianLong;
        knob:                   array [0..0] of InstKnobRec;
    end;


const
    kMusicLoopTypeNormal        = 0;
    kMusicLoopTypePalindrome    = 1;                            {  back & forth }

    instSamplePreProcessFlag    = $01;


type
    InstSampleDescRecPtr = ^InstSampleDescRec;
    InstSampleDescRec = record
        dataFormat:             BigEndianOSType;
        numChannels:            BigEndianShort;
        sampleSize:             BigEndianShort;
        sampleRate:             BigEndianUnsignedFixed;
        sampleDataID:           BigEndianShort;
        offset:                 BigEndianLong;                          {  offset within SampleData - this could be just for internal use }
        numSamples:             BigEndianLong;                          {  this could also just be for internal use, we'll see }
        loopType:               BigEndianLong;
        loopStart:              BigEndianLong;
        loopEnd:                BigEndianLong;
        pitchNormal:            BigEndianLong;
        pitchLow:               BigEndianLong;
        pitchHigh:              BigEndianLong;
    end;

    AtomicInstrument                    = Handle;
    AtomicInstrumentPtr                 = Ptr;

const
    kQTMIDIComponentType        = $6D696469 (* 'midi' *);

    kOMSComponentSubType        = $4F4D5320 (* 'OMS ' *);
    kFMSComponentSubType        = $464D5320 (* 'FMS ' *);
    kMIDIManagerComponentSubType = $6D6D6772 (* 'mmgr' *);
    kOSXMIDIComponentSubType    = $6F73786D (* 'osxm' *);


type
    QTMIDIComponent                     = ComponentInstance;

const
    kMusicPacketPortLost        = 1;                            {  received when application loses the default input port  }
    kMusicPacketPortFound       = 2;                            {  received when application gets it back out from under someone else's claim  }
    kMusicPacketTimeGap         = 3;                            {  data[0] = number of milliseconds to keep the MIDI line silent  }

    kAppleSysexID               = $11;                          {  apple sysex is followed by 2-byte command. 0001 is the command for samplesize  }
    kAppleSysexCmdSampleSize    = $0001;                        {  21 bit number in 3 midi bytes follows sysex ID and 2 cmd bytes  }
    kAppleSysexCmdSampleBreak   = $0002;                        {  specifies that the sample should break right here  }
    kAppleSysexCmdAtomicInstrument = $0010;                     {  contents of atomic instrument handle  }
    kAppleSysexCmdDeveloper     = $7F00;                        {  F0 11 7F 00 ww xx yy zz ... F7 is available for non-Apple developers, where wxyz is unique app signature with 8th bit cleared, unique to developer, and 00 and 7f are reserved  }


type
    MusicMIDIPacketPtr = ^MusicMIDIPacket;
    MusicMIDIPacket = record
        length:                 UInt16;
        reserved:               UInt32;                                 {  if length zero, then reserved = above enum  }
        data:                   packed array [0..248] of UInt8;
    end;

    MusicMIDISendProcPtr = function(self: ComponentInstance; refCon: SInt32; var mmp: MusicMIDIPacket): ComponentResult;

    MusicMIDISendUPP = ^SInt32; { an opaque UPP }

const
    kSynthesizerConnectionFMS   = 1;                            {  this connection imported from FMS  }
    kSynthesizerConnectionMMgr  = 2;                            {  this connection imported from the MIDI Mgr  }
    kSynthesizerConnectionOMS   = 4;                            {  this connection imported from OMS  }
    kSynthesizerConnectionQT    = 8;                            {  this connection is a QuickTime-only port  }
    kSynthesizerConnectionOSXMIDI = 16;                         {  this connection is an OS X CoreMIDI port  }
                                                                {  lowest five bits are mutually exclusive; combinations reserved for future use. }
    kSynthesizerConnectionUnavailable = 256;                    {  port exists, but cannot be used just now  }

    {
        The sampleBankFile field of this structure can be used to pass in a pointer to an FSSpec
        that represents a SoundFont 2 or DLS file (otherwise set it to NULL ).

        You then pass in a structure with this field set (all other fields should be zero) to
        NARegisterMusicDevice:
            - with synthType as kSoftSynthComponentSubType
            - with name being used to return to the application the "name" of the synth
            that should be used in the synthesiserName field of the ToneDescription structure
            and is also used to retrieve a particular MusicComponent with the
            NAGetRegisteredMusicDevice call

        This call will create a MusicComponent of kSoftSynthComponentSubType, with the specified
        sound bank as the sample data source.

        This field requires QuickTime 5.0 or later and should be set to NULL for prior versions.
        }

type
    SynthesizerConnectionsPtr = ^SynthesizerConnections;
    SynthesizerConnections = record
        clientID:               OSType;
        inputPortID:            OSType;                                 {  terminology death: this port is used to SEND to the midi synth  }
        outputPortID:           OSType;                                 {  terminology death: this port receives from a keyboard or other control device  }
        midiChannel:            SInt32;                             {  The system channel; others are configurable (or the nubus slot number)  }
        flags:                  SInt32;
        unique:                 SInt32;                             {  unique id may be used instead of index, to getinfo and unregister calls  }
        sampleBankFile:         FSSpecPtr;                              {  see notes above  }
        reserved2:              SInt32;                             {  should be zero  }
    end;

    QTMIDIPortPtr = ^QTMIDIPort;
    QTMIDIPort = record
        portConnections:        SynthesizerConnections;
        portName:               Str63;
    end;

    QTMIDIPortListPtr = ^QTMIDIPortList;
    QTMIDIPortList = record
        portCount:              SInt16;
        port:                   array [0..0] of QTMIDIPort;
    end;

    QTMIDIPortListHandle                = ^QTMIDIPortListPtr;
    {
     *  QTMIDIGetMIDIPorts()
     *
     *  Availability:
     *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
     *    Windows:          in qtmlClient.lib 3.0 and later
        }
function QTMIDIGetMIDIPorts(ci: QTMIDIComponent; var inputPorts: QTMIDIPortListHandle; var outputPorts: QTMIDIPortListHandle): ComponentResult; external name '_QTMIDIGetMIDIPorts';
{
 *  QTMIDIUseSendPort()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function QTMIDIUseSendPort(ci: QTMIDIComponent; portIndex: SInt32; inUse: SInt32): ComponentResult; external name '_QTMIDIUseSendPort';
{
 *  QTMIDISendMIDI()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function QTMIDISendMIDI(ci: QTMIDIComponent; portIndex: SInt32; var mp: MusicMIDIPacket): ComponentResult; external name '_QTMIDISendMIDI';
const
    kMusicComponentType         = $6D757369 (* 'musi' *);
    kInstrumentComponentType    = $696E7374 (* 'inst' *);

    kSoftSynthComponentSubType  = $73732020 (* 'ss  ' *);
    kGMSynthComponentSubType    = $676D2020 (* 'gm  ' *);



type
    MusicComponent                      = ComponentInstance;
    {  MusicSynthesizerFlags }

const
    kSynthesizerDynamicVoice    = $01;                          {  can assign voices on the fly (else, polyphony is very important  }
    kSynthesizerUsesMIDIPort    = $02;                          {  must be patched through MIDI Manager  }
    kSynthesizerMicrotone       = $04;                          {  can play microtonal scales  }
    kSynthesizerHasSamples      = $08;                          {  synthesizer has some use for sampled data  }
    kSynthesizerMixedDrums      = $10;                          {  any part can play drum parts, total = instrument parts  }
    kSynthesizerSoftware        = $20;                          {  implemented in main CPU software == uses cpu cycles  }
    kSynthesizerHardware        = $40;                          {  is a hardware device (such as nubus, or maybe DSP?)  }
    kSynthesizerDynamicChannel  = $80;                          {  can move any part to any channel or disable each part. (else we assume it lives on all channels in masks)  }
    kSynthesizerHogsSystemChannel = $0100;                      {  can be channelwise dynamic, but always responds on its system channel  }
    kSynthesizerHasSystemChannel = $0200;                       {  has some "system channel" notion to distinguish it from multiple instances of the same device (GM devices dont)  }
    kSynthesizerSlowSetPart     = $0400;                        {  SetPart() and SetPartInstrumentNumber() calls do not have rapid response, may glitch notes  }
    kSynthesizerOffline         = $1000;                        {  can enter an offline synthesis mode  }
    kSynthesizerGM              = $4000;                        {  synth is a GM device  }
    kSynthesizerDLS             = $8000;                        {  synth supports DLS level 1  }
    kSynthesizerSoundLocalization = $00010000;                  {  synth supports extremely baroque, nonstandard, and proprietary "apple game sprockets" localization parameter set  }

    {
     * Note that these controller numbers
     * are _not_ identical to the MIDI controller numbers.
     * These are _signed_ 8.8 values, and the LSB's are
     * always sent to a MIDI device. Controllers 32-63 are
     * reserved (for MIDI, they are LSB's for 0-31, but we
     * always send both).
     *
     * The full range, therefore, is -128.00 to 127.7f.
     *
     * _Excepting_ _volume_, all controls default to zero.
     *
     * Pitch bend is specified in fractional semitones! No
     * more "pitch bend range" nonsense. You can bend as far
     * as you want, any time you want.
        }

type
    MusicController                     = SInt32;

const
    kControllerModulationWheel  = 1;
    kControllerBreath           = 2;
    kControllerFoot             = 4;
    kControllerPortamentoTime   = 5;                            {  time in 8.8 seconds, portamento on/off is omitted, 0 time = 'off'  }
    kControllerVolume           = 7;                            {  main volume control  }
    kControllerBalance          = 8;
    kControllerPan              = 10;                           {  0 - "default", 1 - n: positioned in output 1-n (incl fractions)  }
    kControllerExpression       = 11;                           {  secondary volume control  }
    kControllerLever1           = 16;                           {  general purpose controllers  }
    kControllerLever2           = 17;                           {  general purpose controllers  }
    kControllerLever3           = 18;                           {  general purpose controllers  }
    kControllerLever4           = 19;                           {  general purpose controllers  }
    kControllerLever5           = 80;                           {  general purpose controllers  }
    kControllerLever6           = 81;                           {  general purpose controllers  }
    kControllerLever7           = 82;                           {  general purpose controllers  }
    kControllerLever8           = 83;                           {  general purpose controllers  }
    kControllerPitchBend        = 32;                           {  positive & negative semitones, with 8 bits fraction, same units as transpose controllers }
    kControllerAfterTouch       = 33;                           {  aka channel pressure  }
    kControllerPartTranspose    = 40;                           {  identical to pitchbend, for overall part xpose  }
    kControllerTuneTranspose    = 41;                           {  another pitchbend, for "song global" pitch offset  }
    kControllerPartVolume       = 42;                           {  another volume control, passed right down from note allocator part volume  }
    kControllerTuneVolume       = 43;                           {  another volume control, used for "song global" volume - since we share one synthesizer across multiple tuneplayers }
    kControllerSustain          = 64;                           {  boolean - positive for on, 0 or negative off  }
    kControllerPortamento       = 65;                           {  boolean }
    kControllerSostenuto        = 66;                           {  boolean  }
    kControllerSoftPedal        = 67;                           {  boolean  }
    kControllerReverb           = 91;
    kControllerTremolo          = 92;
    kControllerChorus           = 93;
    kControllerCeleste          = 94;
    kControllerPhaser           = 95;
    kControllerEditPart         = 113;                          {  last 16 controllers 113-128 and above are global controllers which respond on part zero  }
    kControllerMasterTune       = 114;
    kControllerMasterTranspose  = 114;                          {  preferred }
    kControllerMasterVolume     = 115;
    kControllerMasterCPULoad    = 116;
    kControllerMasterPolyphony  = 117;
    kControllerMasterFeatures   = 118;


    {  ID's of knobs supported by the QuickTime Music Synthesizer built into QuickTime }

    kQTMSKnobStartID            = $02000000;
    kQTMSKnobVolumeAttackTimeID = $02000001;
    kQTMSKnobVolumeDecayTimeID  = $02000002;
    kQTMSKnobVolumeSustainLevelID = $02000003;
    kQTMSKnobVolumeRelease1RateID = $02000004;
    kQTMSKnobVolumeDecayKeyScalingID = $02000005;
    kQTMSKnobVolumeReleaseTimeID = $02000006;
    kQTMSKnobVolumeLFODelayID   = $02000007;
    kQTMSKnobVolumeLFORampTimeID = $02000008;
    kQTMSKnobVolumeLFOPeriodID  = $02000009;
    kQTMSKnobVolumeLFOShapeID   = $0200000A;
    kQTMSKnobVolumeLFODepthID   = $0200000B;
    kQTMSKnobVolumeOverallID    = $0200000C;
    kQTMSKnobVolumeVelocity127ID = $0200000D;
    kQTMSKnobVolumeVelocity96ID = $0200000E;
    kQTMSKnobVolumeVelocity64ID = $0200000F;
    kQTMSKnobVolumeVelocity32ID = $02000010;
    kQTMSKnobVolumeVelocity16ID = $02000011;                    {  Pitch related knobs }
    kQTMSKnobPitchTransposeID   = $02000012;
    kQTMSKnobPitchLFODelayID    = $02000013;
    kQTMSKnobPitchLFORampTimeID = $02000014;
    kQTMSKnobPitchLFOPeriodID   = $02000015;
    kQTMSKnobPitchLFOShapeID    = $02000016;
    kQTMSKnobPitchLFODepthID    = $02000017;
    kQTMSKnobPitchLFOQuantizeID = $02000018;                    {  Stereo related knobs }
    kQTMSKnobStereoDefaultPanID = $02000019;
    kQTMSKnobStereoPositionKeyScalingID = $0200001A;
    kQTMSKnobPitchLFOOffsetID   = $0200001B;
    kQTMSKnobExclusionGroupID   = $0200001C;                    {  Misc knobs, late additions }
    kQTMSKnobSustainTimeID      = $0200001D;
    kQTMSKnobSustainInfiniteID  = $0200001E;
    kQTMSKnobVolumeLFOStereoID  = $0200001F;
    kQTMSKnobVelocityLowID      = $02000020;
    kQTMSKnobVelocityHighID     = $02000021;
    kQTMSKnobVelocitySensitivityID = $02000022;
    kQTMSKnobPitchSensitivityID = $02000023;
    kQTMSKnobVolumeLFODepthFromWheelID = $02000024;
    kQTMSKnobPitchLFODepthFromWheelID = $02000025;              {  Volume Env again }
    kQTMSKnobVolumeExpOptionsID = $02000026;                    {  Env1 }
    kQTMSKnobEnv1AttackTimeID   = $02000027;
    kQTMSKnobEnv1DecayTimeID    = $02000028;
    kQTMSKnobEnv1SustainLevelID = $02000029;
    kQTMSKnobEnv1SustainTimeID  = $0200002A;
    kQTMSKnobEnv1SustainInfiniteID = $0200002B;
    kQTMSKnobEnv1ReleaseTimeID  = $0200002C;
    kQTMSKnobEnv1ExpOptionsID   = $0200002D;                    {  Env2 }
    kQTMSKnobEnv2AttackTimeID   = $0200002E;
    kQTMSKnobEnv2DecayTimeID    = $0200002F;
    kQTMSKnobEnv2SustainLevelID = $02000030;
    kQTMSKnobEnv2SustainTimeID  = $02000031;
    kQTMSKnobEnv2SustainInfiniteID = $02000032;
    kQTMSKnobEnv2ReleaseTimeID  = $02000033;
    kQTMSKnobEnv2ExpOptionsID   = $02000034;                    {  Pitch Env }
    kQTMSKnobPitchEnvelopeID    = $02000035;
    kQTMSKnobPitchEnvelopeDepthID = $02000036;                  {  Filter }
    kQTMSKnobFilterKeyFollowID  = $02000037;
    kQTMSKnobFilterTransposeID  = $02000038;
    kQTMSKnobFilterQID          = $02000039;
    kQTMSKnobFilterFrequencyEnvelopeID = $0200003A;
    kQTMSKnobFilterFrequencyEnvelopeDepthID = $0200003B;
    kQTMSKnobFilterQEnvelopeID  = $0200003C;
    kQTMSKnobFilterQEnvelopeDepthID = $0200003D;                {  Reverb Threshhold }
    kQTMSKnobReverbThresholdID  = $0200003E;
    kQTMSKnobVolumeAttackVelScalingID = $0200003F;
    kQTMSKnobLastIDPlus1        = $02000040;




    kControllerMaximum          = $00007FFF;                    {  +01111111.11111111  }
    kControllerMinimum          = $FFFF8000;                    {  -10000000.00000000  }


type
    SynthesizerDescriptionPtr = ^SynthesizerDescription;
    SynthesizerDescription = record
        synthesizerType:        OSType;                                 {  synthesizer type (must be same as component subtype)  }
        name:                   Str31;                                  {  text name of synthesizer type  }
        flags:                  UInt32;                                 {  from the above enum  }
        voiceCount:             UInt32;                                 {  maximum polyphony  }
        partCount:              UInt32;                                 {  maximum multi-timbrality (and midi channels)  }
        instrumentCount:        UInt32;                                 {  non gm, built in (rom) instruments only  }
        modifiableInstrumentCount: UInt32;                              {  plus n-more are user modifiable  }
        channelMask:            UInt32;                                 {  (midi device only) which channels device always uses  }
        drumPartCount:          UInt32;                                 {  maximum multi-timbrality of drum parts  }
        drumCount:              UInt32;                                 {  non gm, built in (rom) drumkits only  }
        modifiableDrumCount:    UInt32;                                 {  plus n-more are user modifiable  }
        drumChannelMask:        UInt32;                                 {  (midi device only) which channels device always uses  }
        outputCount:            UInt32;                                 {  number of audio outputs (usually two)  }
        latency:                UInt32;                                 {  response time in µSec  }
        controllers:            array [0..3] of UInt32;                 {  array of 128 bits  }
        gmInstruments:          array [0..3] of UInt32;                 {  array of 128 bits  }
        gmDrums:                array [0..3] of UInt32;                 {  array of 128 bits  }
    end;


const
    kVoiceCountDynamic          = -1;                           {  constant to use to specify dynamic voicing  }



type
    ToneDescriptionPtr = ^ToneDescription;
    ToneDescription = record
        synthesizerType:        BigEndianOSType;                        {  synthesizer type  }
        synthesizerName:        Str31;                                  {  name of instantiation of synth  }
        instrumentName:         Str31;                                  {  preferred name for human use  }
        instrumentNumber:       BigEndianLong;                          {  inst-number used if synth-name matches  }
        gmNumber:               BigEndianLong;                          {  Best matching general MIDI number  }
    end;


const
    kFirstGMInstrument          = $00000001;
    kLastGMInstrument           = $00000080;
    kFirstGSInstrument          = $00000081;
    kLastGSInstrument           = $00003FFF;
    kFirstDrumkit               = $00004000;                    {  (first value is "no drum". instrument numbers from 16384->16384+128 are drumkits, and for GM they are _defined_ drumkits!  }
    kLastDrumkit                = $00004080;
    kFirstROMInstrument         = $00008000;
    kLastROMInstrument          = $0000FFFF;
    kFirstUserInstrument        = $00010000;
    kLastUserInstrument         = $0001FFFF;

    {  InstrumentMatch }
    kInstrumentMatchSynthesizerType = 1;
    kInstrumentMatchSynthesizerName = 2;
    kInstrumentMatchName        = 4;
    kInstrumentMatchNumber      = 8;
    kInstrumentMatchGMNumber    = 16;
    kInstrumentMatchGSNumber    = 32;

    {  KnobFlags }
    kKnobBasic                  = 8;                            {  knob shows up in certain simplified lists of knobs  }
    kKnobReadOnly               = 16;                           {  knob value cannot be changed by user or with a SetKnob call  }
    kKnobInterruptUnsafe        = 32;                           {  only alter this knob from foreground task time (may access toolbox)  }
    kKnobKeyrangeOverride       = 64;                           {  knob can be overridden within a single keyrange (software synth only)  }
    kKnobGroupStart             = 128;                          {  knob is first in some logical group of knobs  }
    kKnobFixedPoint8            = 1024;
    kKnobFixedPoint16           = 2048;                         {  One of these may be used at a time.  }
    kKnobTypeNumber             = $00;
    kKnobTypeGroupName          = $1000;                        {  "knob" is really a group name for display purposes  }
    kKnobTypeBoolean            = $2000;                        {  if range is greater than 1, its a multi-checkbox field  }
    kKnobTypeNote               = $3000;                        {  knob range is equivalent to MIDI keys  }
    kKnobTypePan                = $4000;                        {  range goes left/right (lose this? )  }
    kKnobTypeInstrument         = $5000;                        {  knob value = reference to another instrument number  }
    kKnobTypeSetting            = $6000;                        {  knob value is 1 of n different things (eg, fm algorithms) popup menu  }
    kKnobTypeMilliseconds       = $7000;                        {  knob is a millisecond time range  }
    kKnobTypePercentage         = $8000;                        {  knob range is displayed as a Percentage  }
    kKnobTypeHertz              = $9000;                        {  knob represents frequency  }
    kKnobTypeButton             = $A000;                        {  momentary trigger push button  }


    kUnknownKnobValue           = $7FFFFFFF;                    {  a knob with this value means, we don't know it.  }
    kDefaultKnobValue           = $7FFFFFFE;                    {  used to set a knob to its default value.  }


type
    KnobDescriptionPtr = ^KnobDescription;
    KnobDescription = record
        name:                   Str63;
        lowValue:               SInt32;
        highValue:              SInt32;
        defaultValue:           SInt32;                             {  a default instrument is made of all default values  }
        flags:                  SInt32;
        knobID:                 SInt32;
    end;

    GCInstrumentDataPtr = ^GCInstrumentData;
    GCInstrumentData = record
        tone:                   ToneDescription;
        knobCount:              SInt32;
        knob:                   array [0..0] of SInt32;
    end;

    GCInstrumentDataHandle              = ^GCInstrumentDataPtr;
    InstrumentAboutInfoPtr = ^InstrumentAboutInfo;
    InstrumentAboutInfo = record
        p:                      PicHandle;
        author:                 Str255;
        copyright:              Str255;
        other:                  Str255;
    end;



const
    notImplementedMusicErr      = $8000F7E9;
    cantSendToSynthesizerErr    = $8000F7E8;
    cantReceiveFromSynthesizerErr = $8000F7E7;
    illegalVoiceAllocationErr   = $8000F7E6;
    illegalPartErr              = $8000F7E5;
    illegalChannelErr           = $8000F7E4;
    illegalKnobErr              = $8000F7E3;
    illegalKnobValueErr         = $8000F7E2;
    illegalInstrumentErr        = $8000F7E1;
    illegalControllerErr        = $8000F7E0;
    midiManagerAbsentErr        = $8000F7DF;
    synthesizerNotRespondingErr = $8000F7DE;
    synthesizerErr              = $8000F7DD;
    illegalNoteChannelErr       = $8000F7DC;
    noteChannelNotAllocatedErr  = $8000F7DB;
    tunePlayerFullErr           = $8000F7DA;
    tuneParseErr                = $8000F7D9;

    kGetAtomicInstNoExpandedSamples = $01;
    kGetAtomicInstNoOriginalSamples = $02;
    kGetAtomicInstNoSamples     = $03;
    kGetAtomicInstNoKnobList    = $04;
    kGetAtomicInstNoInstrumentInfo = $08;
    kGetAtomicInstOriginalKnobList = $10;
    kGetAtomicInstAllKnobs      = $20;                          {  return even those that are set to default }

    {
       For non-gm instruments, instrument number of tone description == 0
       If you want to speed up while running, slam the inst num with what Get instrument number returns
       All missing knobs are slammed to the default value
    }
    kSetAtomicInstKeepOriginalInstrument = $01;
    kSetAtomicInstShareAcrossParts = $02;                       {  inst disappears when app goes away }
    kSetAtomicInstCallerTosses  = $04;                          {  the caller isn't keeping a copy around (for NASetAtomicInstrument) }
    kSetAtomicInstCallerGuarantees = $08;                       {  the caller guarantees a copy is around }
    kSetAtomicInstInterruptSafe = $10;                          {  dont move memory at this time (but process at next task time) }
    kSetAtomicInstDontPreprocess = $80;                         {  perform no further preprocessing because either 1)you know the instrument is digitally clean, or 2) you got it from a GetPartAtomic }

    kInstrumentNamesModifiable  = 1;
    kInstrumentNamesBoth        = 2;

    {
     * Structures specific to the GenericMusicComponent
        }

    kGenericMusicComponentSubtype = $67656E65 (* 'gene' *);


type
    GenericKnobDescriptionPtr = ^GenericKnobDescription;
    GenericKnobDescription = record
        kd:                     KnobDescription;
        hw1:                    SInt32;                             {  driver defined  }
        hw2:                    SInt32;                             {  driver defined  }
        hw3:                    SInt32;                             {  driver defined  }
        settingsID:             SInt32;                             {  resource ID list for boolean and popup names  }
    end;

    GenericKnobDescriptionListPtr = ^GenericKnobDescriptionList;
    GenericKnobDescriptionList = record
        knobCount:              SInt32;
        knob:                   array [0..0] of GenericKnobDescription;
    end;

    GenericKnobDescriptionListHandle    = ^GenericKnobDescriptionListPtr;
    {    knobTypes for MusicDerivedSetKnob  }

const
    kGenericMusicKnob           = 1;
    kGenericMusicInstrumentKnob = 2;
    kGenericMusicDrumKnob       = 3;
    kGenericMusicGlobalController = 4;



    kGenericMusicResFirst       = 0;
    kGenericMusicResMiscStringList = 1;                         {  STR# 1: synth name, 2:about author,3:aboutcopyright,4:aboutother  }
    kGenericMusicResMiscLongList = 2;                           {  Long various params, see list below  }
    kGenericMusicResInstrumentList = 3;                         {  NmLs of names and shorts, categories prefixed by '¥¥'  }
    kGenericMusicResDrumList    = 4;                            {  NmLs of names and shorts  }
    kGenericMusicResInstrumentKnobDescriptionList = 5;          {  Knob  }
    kGenericMusicResDrumKnobDescriptionList = 6;                {  Knob  }
    kGenericMusicResKnobDescriptionList = 7;                    {  Knob  }
    kGenericMusicResBitsLongList = 8;                           {  Long back to back bitmaps of controllers, gminstruments, and drums  }
    kGenericMusicResModifiableInstrumentHW = 9;                 {  Shrt same as the hw shorts trailing the instrument names, a shortlist  }
    kGenericMusicResGMTranslation = 10;                         {  Long 128 long entries, 1 for each gm inst, of local instrument numbers 1-n (not hw numbers)  }
    kGenericMusicResROMInstrumentData = 11;                     {  knob lists for ROM instruments, so the knob values may be known  }
    kGenericMusicResAboutPICT   = 12;                           {  picture for aboutlist. must be present for GetAbout call to work  }
    kGenericMusicResLast        = 13;

    {    elements of the misc long list     }
    kGenericMusicMiscLongFirst  = 0;
    kGenericMusicMiscLongVoiceCount = 1;
    kGenericMusicMiscLongPartCount = 2;
    kGenericMusicMiscLongModifiableInstrumentCount = 3;
    kGenericMusicMiscLongChannelMask = 4;
    kGenericMusicMiscLongDrumPartCount = 5;
    kGenericMusicMiscLongModifiableDrumCount = 6;
    kGenericMusicMiscLongDrumChannelMask = 7;
    kGenericMusicMiscLongOutputCount = 8;
    kGenericMusicMiscLongLatency = 9;
    kGenericMusicMiscLongFlags  = 10;
    kGenericMusicMiscLongFirstGMHW = 11;                        {  number to add to locate GM main instruments  }
    kGenericMusicMiscLongFirstGMDrumHW = 12;                    {  number to add to locate GM drumkits  }
    kGenericMusicMiscLongFirstUserHW = 13;                      {  First hw number of user instruments (presumed sequential)  }
    kGenericMusicMiscLongLast   = 14;


type
    GCPartPtr = ^GCPart;
    GCPart = record
        hwInstrumentNumber:     SInt32;                             {  internal number of recalled instrument  }
        controller:             array [0..127] of SInt16;               {  current values for all controllers  }
        volume:                 SInt32;                             {  ctrl 7 is special case  }
        polyphony:              SInt32;
        midiChannel:            SInt32;                             {  1-16 if in use  }
        id:                     GCInstrumentData;                       {  ToneDescription & knoblist, uncertain length  }
    end;

    {
     * Calls specific to the GenericMusicComponent
        }

const
    kMusicGenericRange          = $0100;
    kMusicDerivedRange          = $0200;

    {
     * Flags in GenericMusicConfigure call
        }
    kGenericMusicDoMIDI         = $01;                          {  implement normal MIDI messages for note, controllers, and program changes 0-127  }
    kGenericMusicBank0          = $02;                          {  implement instrument bank changes on controller 0  }
    kGenericMusicBank32         = $04;                          {  implement instrument bank changes on controller 32  }
    kGenericMusicErsatzMIDI     = $08;                          {  construct MIDI packets, but send them to the derived component  }
    kGenericMusicCallKnobs      = $10;                          {  call the derived component with special knob format call  }
    kGenericMusicCallParts      = $20;                          {  call the derived component with special part format call  }
    kGenericMusicCallInstrument = $40;                          {  call MusicDerivedSetInstrument for MusicSetInstrument calls  }
    kGenericMusicCallNumber     = $80;                          {  call MusicDerivedSetPartInstrumentNumber for MusicSetPartInstrumentNumber calls, & don't send any C0 or bank stuff  }
    kGenericMusicCallROMInstrument = $0100;                     {  call MusicSetInstrument for MusicSetPartInstrumentNumber for "ROM" instruments, passing params from the ROMi resource  }
    kGenericMusicAllDefaults    = $0200;                        {  indicates that when a new instrument is recalled, all knobs are reset to DEFAULT settings. True for GS modules  }






type
    MusicOfflineDataProcPtr = function(SoundData: Ptr; numBytes: SInt32; myRefCon: SInt32): ComponentResult;

    MusicOfflineDataUPP = ^SInt32; { an opaque UPP }
    OfflineSampleTypePtr = ^OfflineSampleType;
    OfflineSampleType = record
        numChannels:            UInt32;                                 { number of channels,  ie mono = 1 }
        sampleRate:             UnsignedFixed;                          { sample rate in Apples Fixed point representation }
        sampleSize:             UInt16;                                 { number of bits in sample }
    end;

    InstrumentInfoRecordPtr = ^InstrumentInfoRecord;
    InstrumentInfoRecord = record
        instrumentNumber:       SInt32;                             {  instrument number (if 0, name is a catagory) }
        flags:                  SInt32;                             {  show in picker, etc. }
        toneNameIndex:          SInt32;                             {  index in toneNames (1 based) }
        itxtNameAtomID:         SInt32;                             {  index in itxtNames (itxt/name by index) }
    end;

    InstrumentInfoListPtr = ^InstrumentInfoList;
    InstrumentInfoList = record
        recordCount:            SInt32;
        toneNames:              Handle;                                 {  name from tone description }
        itxtNames:              QTAtomContainer;                        {  itxt/name atoms for instruments }
        info:                   array [0..0] of InstrumentInfoRecord;
    end;

    InstrumentInfoListHandle            = ^InstrumentInfoListPtr;
    {
     *  MusicGetDescription()
     *
     *  Availability:
     *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
     *    Windows:          in qtmlClient.lib 3.0 and later
        }
function MusicGetDescription(mc: MusicComponent; var sd: SynthesizerDescription): ComponentResult; external name '_MusicGetDescription';
{
 *  MusicGetPart()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MusicGetPart(mc: MusicComponent; part: SInt32; var midiChannel: SInt32; var polyphony: SInt32): ComponentResult; external name '_MusicGetPart';
{
 *  MusicSetPart()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MusicSetPart(mc: MusicComponent; part: SInt32; midiChannel: SInt32; polyphony: SInt32): ComponentResult; external name '_MusicSetPart';
{
 *  MusicSetPartInstrumentNumber()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MusicSetPartInstrumentNumber(mc: MusicComponent; part: SInt32; instrumentNumber: SInt32): ComponentResult; external name '_MusicSetPartInstrumentNumber';
{
 *  MusicGetPartInstrumentNumber()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MusicGetPartInstrumentNumber(mc: MusicComponent; part: SInt32): ComponentResult; external name '_MusicGetPartInstrumentNumber';
{
 *  MusicStorePartInstrument()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MusicStorePartInstrument(mc: MusicComponent; part: SInt32; instrumentNumber: SInt32): ComponentResult; external name '_MusicStorePartInstrument';
{
 *  MusicGetPartAtomicInstrument()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MusicGetPartAtomicInstrument(mc: MusicComponent; part: SInt32; var ai: AtomicInstrument; flags: SInt32): ComponentResult; external name '_MusicGetPartAtomicInstrument';
{
 *  MusicSetPartAtomicInstrument()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MusicSetPartAtomicInstrument(mc: MusicComponent; part: SInt32; aiP: AtomicInstrumentPtr; flags: SInt32): ComponentResult; external name '_MusicSetPartAtomicInstrument';
{
 *  MusicGetPartKnob()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MusicGetPartKnob(mc: MusicComponent; part: SInt32; knobID: SInt32): ComponentResult; external name '_MusicGetPartKnob';
{
 *  MusicSetPartKnob()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MusicSetPartKnob(mc: MusicComponent; part: SInt32; knobID: SInt32; knobValue: SInt32): ComponentResult; external name '_MusicSetPartKnob';
{
 *  MusicGetKnob()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MusicGetKnob(mc: MusicComponent; knobID: SInt32): ComponentResult; external name '_MusicGetKnob';
{
 *  MusicSetKnob()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MusicSetKnob(mc: MusicComponent; knobID: SInt32; knobValue: SInt32): ComponentResult; external name '_MusicSetKnob';
{
 *  MusicGetPartName()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MusicGetPartName(mc: MusicComponent; part: SInt32; name: StringPtr): ComponentResult; external name '_MusicGetPartName';
{
 *  MusicSetPartName()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MusicSetPartName(mc: MusicComponent; part: SInt32; name: StringPtr): ComponentResult; external name '_MusicSetPartName';
{
 *  MusicFindTone()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MusicFindTone(mc: MusicComponent; var td: ToneDescription; var libraryIndexOut: SInt32; var fit: UInt32): ComponentResult; external name '_MusicFindTone';
{
 *  MusicPlayNote()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MusicPlayNote(mc: MusicComponent; part: SInt32; pitch: SInt32; velocity: SInt32): ComponentResult; external name '_MusicPlayNote';
{
 *  MusicResetPart()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MusicResetPart(mc: MusicComponent; part: SInt32): ComponentResult; external name '_MusicResetPart';
{
 *  MusicSetPartController()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MusicSetPartController(mc: MusicComponent; part: SInt32; controllerNumber: MusicController; controllerValue: SInt32): ComponentResult; external name '_MusicSetPartController';
{
 *  MusicGetPartController()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MusicGetPartController(mc: MusicComponent; part: SInt32; controllerNumber: MusicController): ComponentResult; external name '_MusicGetPartController';
{
 *  MusicGetMIDIProc()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MusicGetMIDIProc(mc: MusicComponent; var midiSendProc: MusicMIDISendUPP; var refCon: SInt32): ComponentResult; external name '_MusicGetMIDIProc';
{
 *  MusicSetMIDIProc()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MusicSetMIDIProc(mc: MusicComponent; midiSendProc: MusicMIDISendUPP; refCon: SInt32): ComponentResult; external name '_MusicSetMIDIProc';
{
 *  MusicGetInstrumentNames()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MusicGetInstrumentNames(mc: MusicComponent; modifiableInstruments: SInt32; var instrumentNames: Handle; var instrumentCategoryLasts: Handle; var instrumentCategoryNames: Handle): ComponentResult; external name '_MusicGetInstrumentNames';
{
 *  MusicGetDrumNames()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MusicGetDrumNames(mc: MusicComponent; modifiableInstruments: SInt32; var instrumentNumbers: Handle; var instrumentNames: Handle): ComponentResult; external name '_MusicGetDrumNames';
{
 *  MusicGetMasterTune()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MusicGetMasterTune(mc: MusicComponent): ComponentResult; external name '_MusicGetMasterTune';
{
 *  MusicSetMasterTune()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MusicSetMasterTune(mc: MusicComponent; masterTune: SInt32): ComponentResult; external name '_MusicSetMasterTune';
{
 *  MusicGetInstrumentAboutInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MusicGetInstrumentAboutInfo(mc: MusicComponent; part: SInt32; var iai: InstrumentAboutInfo): ComponentResult; external name '_MusicGetInstrumentAboutInfo';
{
 *  MusicGetDeviceConnection()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MusicGetDeviceConnection(mc: MusicComponent; index: SInt32; var id1: SInt32; var id2: SInt32): ComponentResult; external name '_MusicGetDeviceConnection';
{
 *  MusicUseDeviceConnection()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MusicUseDeviceConnection(mc: MusicComponent; id1: SInt32; id2: SInt32): ComponentResult; external name '_MusicUseDeviceConnection';
{
 *  MusicGetKnobSettingStrings()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MusicGetKnobSettingStrings(mc: MusicComponent; knobIndex: SInt32; isGlobal: SInt32; var settingsNames: Handle; var settingsCategoryLasts: Handle; var settingsCategoryNames: Handle): ComponentResult; external name '_MusicGetKnobSettingStrings';
{
 *  MusicGetMIDIPorts()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MusicGetMIDIPorts(mc: MusicComponent; var inputPortCount: SInt32; var outputPortCount: SInt32): ComponentResult; external name '_MusicGetMIDIPorts';
{
 *  MusicSendMIDI()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MusicSendMIDI(mc: MusicComponent; portIndex: SInt32; var mp: MusicMIDIPacket): ComponentResult; external name '_MusicSendMIDI';
{
 *  MusicStartOffline()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MusicStartOffline(mc: MusicComponent; var numChannels: UInt32; var sampleRate: UnsignedFixed; var sampleSize: UInt16; dataProc: MusicOfflineDataUPP; dataProcRefCon: SInt32): ComponentResult; external name '_MusicStartOffline';
{
 *  MusicSetOfflineTimeTo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MusicSetOfflineTimeTo(mc: MusicComponent; newTimeStamp: SInt32): ComponentResult; external name '_MusicSetOfflineTimeTo';
{
 *  MusicGetInstrumentKnobDescription()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MusicGetInstrumentKnobDescription(mc: MusicComponent; knobIndex: SInt32; var mkd: KnobDescription): ComponentResult; external name '_MusicGetInstrumentKnobDescription';
{
 *  MusicGetDrumKnobDescription()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MusicGetDrumKnobDescription(mc: MusicComponent; knobIndex: SInt32; var mkd: KnobDescription): ComponentResult; external name '_MusicGetDrumKnobDescription';
{
 *  MusicGetKnobDescription()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MusicGetKnobDescription(mc: MusicComponent; knobIndex: SInt32; var mkd: KnobDescription): ComponentResult; external name '_MusicGetKnobDescription';
{
 *  MusicGetInfoText()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MusicGetInfoText(mc: MusicComponent; selector: SInt32; var textH: Handle; var styleH: Handle): ComponentResult; external name '_MusicGetInfoText';
const
    kGetInstrumentInfoNoBuiltIn = $01;
    kGetInstrumentInfoMidiUserInst = $02;
    kGetInstrumentInfoNoIText   = $04;

    {
     *  MusicGetInstrumentInfo()
     *
     *  Availability:
     *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
     *    Windows:          in qtmlClient.lib 3.0 and later
        }
function MusicGetInstrumentInfo(mc: MusicComponent; getInstrumentInfoFlags: SInt32; var infoListH: InstrumentInfoListHandle): ComponentResult; external name '_MusicGetInstrumentInfo';
{
 *  MusicTask()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MusicTask(mc: MusicComponent): ComponentResult; external name '_MusicTask';
{
 *  MusicSetPartInstrumentNumberInterruptSafe()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MusicSetPartInstrumentNumberInterruptSafe(mc: MusicComponent; part: SInt32; instrumentNumber: SInt32): ComponentResult; external name '_MusicSetPartInstrumentNumberInterruptSafe';
{
 *  MusicSetPartSoundLocalization()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MusicSetPartSoundLocalization(mc: MusicComponent; part: SInt32; data: Handle): ComponentResult; external name '_MusicSetPartSoundLocalization';
{
 *  MusicGenericConfigure()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MusicGenericConfigure(mc: MusicComponent; mode: SInt32; flags: SInt32; baseResID: SInt32): ComponentResult; external name '_MusicGenericConfigure';
{
 *  MusicGenericGetPart()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MusicGenericGetPart(mc: MusicComponent; partNumber: SInt32; var part: UnivPtr): ComponentResult; external name '_MusicGenericGetPart';
{
 *  MusicGenericGetKnobList()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MusicGenericGetKnobList(mc: MusicComponent; knobType: SInt32; var gkdlH: GenericKnobDescriptionListHandle): ComponentResult; external name '_MusicGenericGetKnobList';
{
 *  MusicGenericSetResourceNumbers()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MusicGenericSetResourceNumbers(mc: MusicComponent; resourceIDH: Handle): ComponentResult; external name '_MusicGenericSetResourceNumbers';
{
 *  MusicDerivedMIDISend()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MusicDerivedMIDISend(mc: MusicComponent; var packet: MusicMIDIPacket): ComponentResult; external name '_MusicDerivedMIDISend';
{
 *  MusicDerivedSetKnob()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MusicDerivedSetKnob(mc: MusicComponent; knobType: SInt32; knobNumber: SInt32; knobValue: SInt32; partNumber: SInt32; var p: GCPart; var gkd: GenericKnobDescription): ComponentResult; external name '_MusicDerivedSetKnob';
{
 *  MusicDerivedSetPart()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MusicDerivedSetPart(mc: MusicComponent; partNumber: SInt32; var p: GCPart): ComponentResult; external name '_MusicDerivedSetPart';
{
 *  MusicDerivedSetInstrument()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MusicDerivedSetInstrument(mc: MusicComponent; partNumber: SInt32; var p: GCPart): ComponentResult; external name '_MusicDerivedSetInstrument';
{
 *  MusicDerivedSetPartInstrumentNumber()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MusicDerivedSetPartInstrumentNumber(mc: MusicComponent; partNumber: SInt32; var p: GCPart): ComponentResult; external name '_MusicDerivedSetPartInstrumentNumber';
{
 *  MusicDerivedSetMIDI()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MusicDerivedSetMIDI(mc: MusicComponent; midiProc: MusicMIDISendUPP; refcon: SInt32; midiChannel: SInt32): ComponentResult; external name '_MusicDerivedSetMIDI';
{
 *  MusicDerivedStorePartInstrument()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MusicDerivedStorePartInstrument(mc: MusicComponent; partNumber: SInt32; var p: GCPart; instrumentNumber: SInt32): ComponentResult; external name '_MusicDerivedStorePartInstrument';
{
 *  MusicDerivedOpenResFile()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MusicDerivedOpenResFile(mc: MusicComponent): ComponentResult; external name '_MusicDerivedOpenResFile';
{
 *  MusicDerivedCloseResFile()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MusicDerivedCloseResFile(mc: MusicComponent; resRefNum: SInt16): ComponentResult; external name '_MusicDerivedCloseResFile';
{--------------------------
    Types
--------------------------}

const
    kNoteRequestNoGM            = 1;                            {  don't degrade to a GM synth  }
    kNoteRequestNoSynthType     = 2;                            {  don't degrade to another synth of same type but different name  }
    kNoteRequestSynthMustMatch  = 4;                            {  synthType must be a match, including kGMSynthComponentSubType  }


    kNoteRequestSpecifyMIDIChannel = $80;


type
    NoteAllocator                       = ComponentInstance;
    {
        The midiChannelAssignment field of this structure is used to assign a MIDI channel
        when a NoteChannel is created from a NoteRequest.
        A value of 0 indicates a MIDI channel has *not* been assigned
        A value of (kNoteRequestSpecifyMIDIChannel | 1->16) is a MIDI channel assignment

        This field requires QuickTime 5.0 or later and should be set to 0 for prior versions.
        }
    NoteRequestMIDIChannel              = UInt8;
    NoteRequestInfoPtr = ^NoteRequestInfo;
    NoteRequestInfo = record
        flags:                  SInt8;                                  {  1: dont accept GM match, 2: dont accept same-synth-type match  }
        midiChannelAssignment:  SInt8;                                  {  (kNoteRequestSpecifyMIDIChannel | 1->16) as MIDI Channel assignement or zero - see notes above   }
        polyphony:              BigEndianShort;                         {  Maximum number of voices  }
        typicalPolyphony:       BigEndianFixed;                         {  Hint for level mixing  }
    end;

    NoteRequestPtr = ^NoteRequest;
    NoteRequest = record
        info:                   NoteRequestInfo;
        tone:                   ToneDescription;
    end;

    NoteChannel    = ^SInt32; { an opaque 32-bit type }
    NoteChannelPtr = ^NoteChannel;  { when a var xx:NoteChannel parameter can be nil, it is changed to xx: NoteChannelPtr }



const
    kPickDontMix                = 1;                            {  dont mix instruments with drum sounds  }
    kPickSameSynth              = 2;                            {  only allow the same device that went in, to come out  }
    kPickUserInsts              = 4;                            {  show user insts in addition to ROM voices  }
    kPickEditAllowEdit          = 8;                            {  lets user switch over to edit mode  }
    kPickEditAllowPick          = 16;                           {  lets the user switch over to pick mode  }
    kPickEditSynthGlobal        = 32;                           {  edit the global knobs of the synth  }
    kPickEditControllers        = 64;                           {  edit the controllers of the notechannel  }


    kNoteAllocatorComponentType = $6E6F7461 (* 'nota' *);


    {   --------------------------------
        Note Allocator Prototypes
    --------------------------------    }
    {
     *  NARegisterMusicDevice()
     *
     *  Availability:
     *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
     *    Windows:          in qtmlClient.lib 3.0 and later
        }
function NARegisterMusicDevice(na: NoteAllocator; synthType: OSType; var name: Str31; var connections: SynthesizerConnections): ComponentResult; external name '_NARegisterMusicDevice';
{
 *  NAUnregisterMusicDevice()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function NAUnregisterMusicDevice(na: NoteAllocator; index: SInt32): ComponentResult; external name '_NAUnregisterMusicDevice';
{
 *  NAGetRegisteredMusicDevice()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function NAGetRegisteredMusicDevice(na: NoteAllocator; index: SInt32; var synthType: OSType; var name: Str31; var connections: SynthesizerConnections; var mc: MusicComponent): ComponentResult; external name '_NAGetRegisteredMusicDevice';
{
 *  NASaveMusicConfiguration()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function NASaveMusicConfiguration(na: NoteAllocator): ComponentResult; external name '_NASaveMusicConfiguration';
{
 *  NANewNoteChannel()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function NANewNoteChannel(na: NoteAllocator; var noteRequest: NoteRequest; var outChannel: NoteChannel): ComponentResult; external name '_NANewNoteChannel';
{
 *  NADisposeNoteChannel()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function NADisposeNoteChannel(na: NoteAllocator; noteChannel: NoteChannel): ComponentResult; external name '_NADisposeNoteChannel';
{
 *  NAGetNoteChannelInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function NAGetNoteChannelInfo(na: NoteAllocator; noteChannel: NoteChannel; var index: SInt32; var part: SInt32): ComponentResult; external name '_NAGetNoteChannelInfo';
{
 *  NAPrerollNoteChannel()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function NAPrerollNoteChannel(na: NoteAllocator; noteChannel: NoteChannel): ComponentResult; external name '_NAPrerollNoteChannel';
{
 *  NAUnrollNoteChannel()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function NAUnrollNoteChannel(na: NoteAllocator; noteChannel: NoteChannel): ComponentResult; external name '_NAUnrollNoteChannel';
{
 *  NASetNoteChannelVolume()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function NASetNoteChannelVolume(na: NoteAllocator; noteChannel: NoteChannel; volume: Fixed): ComponentResult; external name '_NASetNoteChannelVolume';
{
 *  NAResetNoteChannel()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function NAResetNoteChannel(na: NoteAllocator; noteChannel: NoteChannel): ComponentResult; external name '_NAResetNoteChannel';
{
 *  NAPlayNote()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function NAPlayNote(na: NoteAllocator; noteChannel: NoteChannel; pitch: SInt32; velocity: SInt32): ComponentResult; external name '_NAPlayNote';
{
 *  NASetController()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function NASetController(na: NoteAllocator; noteChannel: NoteChannel; controllerNumber: SInt32; controllerValue: SInt32): ComponentResult; external name '_NASetController';
{
 *  NASetKnob()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function NASetKnob(na: NoteAllocator; noteChannel: NoteChannel; knobNumber: SInt32; knobValue: SInt32): ComponentResult; external name '_NASetKnob';
{
 *  NAFindNoteChannelTone()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function NAFindNoteChannelTone(na: NoteAllocator; noteChannel: NoteChannel; var td: ToneDescription; var instrumentNumber: SInt32): ComponentResult; external name '_NAFindNoteChannelTone';
{
 *  NASetInstrumentNumber()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function NASetInstrumentNumber(na: NoteAllocator; noteChannel: NoteChannel; instrumentNumber: SInt32): ComponentResult; external name '_NASetInstrumentNumber';
{
 *  NAPickInstrument()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function NAPickInstrument(na: NoteAllocator; filterProc: ModalFilterUPP; prompt: StringPtr; var sd: ToneDescription; flags: UInt32; refCon: SInt32; reserved1: SInt32; reserved2: SInt32): ComponentResult; external name '_NAPickInstrument';
{
 *  NAPickArrangement()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function NAPickArrangement(na: NoteAllocator; filterProc: ModalFilterUPP; prompt: StringPtr; zero1: SInt32; zero2: SInt32; t: Track; songName: StringPtr): ComponentResult; external name '_NAPickArrangement';
{
 *  NAStuffToneDescription()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function NAStuffToneDescription(na: NoteAllocator; gmNumber: SInt32; var td: ToneDescription): ComponentResult; external name '_NAStuffToneDescription';
{
 *  NACopyrightDialog()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function NACopyrightDialog(na: NoteAllocator; p: PicHandle; author: StringPtr; copyright: StringPtr; other: StringPtr; title: StringPtr; filterProc: ModalFilterUPP; refCon: SInt32): ComponentResult; external name '_NACopyrightDialog';
{
    kNADummyOneSelect = 29
    kNADummyTwoSelect = 30
}

{
 *  NAGetIndNoteChannel()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function NAGetIndNoteChannel(na: NoteAllocator; index: SInt32; var nc: NoteChannel; var seed: SInt32): ComponentResult; external name '_NAGetIndNoteChannel';
{
 *  NAGetMIDIPorts()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function NAGetMIDIPorts(na: NoteAllocator; var inputPorts: QTMIDIPortListHandle; var outputPorts: QTMIDIPortListHandle): ComponentResult; external name '_NAGetMIDIPorts';
{
 *  NAGetNoteRequest()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function NAGetNoteRequest(na: NoteAllocator; noteChannel: NoteChannel; var nrOut: NoteRequest): ComponentResult; external name '_NAGetNoteRequest';
{
 *  NASendMIDI()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function NASendMIDI(na: NoteAllocator; noteChannel: NoteChannel; var mp: MusicMIDIPacket): ComponentResult; external name '_NASendMIDI';
{
 *  NAPickEditInstrument()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function NAPickEditInstrument(na: NoteAllocator; filterProc: ModalFilterUPP; prompt: StringPtr; refCon: SInt32; nc: NoteChannel; ai: AtomicInstrument; flags: SInt32): ComponentResult; external name '_NAPickEditInstrument';
{
 *  NANewNoteChannelFromAtomicInstrument()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function NANewNoteChannelFromAtomicInstrument(na: NoteAllocator; instrument: AtomicInstrumentPtr; flags: SInt32; var outChannel: NoteChannel): ComponentResult; external name '_NANewNoteChannelFromAtomicInstrument';
{
 *  NASetAtomicInstrument()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function NASetAtomicInstrument(na: NoteAllocator; noteChannel: NoteChannel; instrument: AtomicInstrumentPtr; flags: SInt32): ComponentResult; external name '_NASetAtomicInstrument';
{
 *  NAGetKnob()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function NAGetKnob(na: NoteAllocator; noteChannel: NoteChannel; knobNumber: SInt32; var knobValue: SInt32): ComponentResult; external name '_NAGetKnob';
{
 *  NATask()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function NATask(na: NoteAllocator): ComponentResult; external name '_NATask';
{
 *  NASetNoteChannelBalance()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function NASetNoteChannelBalance(na: NoteAllocator; noteChannel: NoteChannel; balance: SInt32): ComponentResult; external name '_NASetNoteChannelBalance';
{
 *  NASetInstrumentNumberInterruptSafe()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function NASetInstrumentNumberInterruptSafe(na: NoteAllocator; noteChannel: NoteChannel; instrumentNumber: SInt32): ComponentResult; external name '_NASetInstrumentNumberInterruptSafe';
{
 *  NASetNoteChannelSoundLocalization()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function NASetNoteChannelSoundLocalization(na: NoteAllocator; noteChannel: NoteChannel; data: Handle): ComponentResult; external name '_NASetNoteChannelSoundLocalization';
{
 *  NAGetController()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function NAGetController(na: NoteAllocator; noteChannel: NoteChannel; controllerNumber: SInt32; var controllerValue: SInt32): ComponentResult; external name '_NAGetController';
const
    kTuneQueueDepth             = 8;                            {  Deepest you can queue tune segments  }



type
    TuneStatusPtr = ^TuneStatus;
    TuneStatus = record
        tune:                   SInt32Ptr;                              {  currently playing tune  }
        tunePtr:                SInt32Ptr;                              {  position within currently playing piece  }
        time:                   TimeValue;                              {  current tune time  }
        queueCount:             SInt16;                             {  how many pieces queued up?  }
        queueSpots:             SInt16;                             {  How many more tunepieces can be queued  }
        queueTime:              TimeValue;                              {  How much time is queued up? (can be very inaccurate)  }
        reserved:               array [0..2] of SInt32;
    end;

    TuneCallBackProcPtr = procedure(const (*var*) status: TuneStatus; refCon: SInt32);

    TunePlayCallBackProcPtr = procedure(var event: UInt32; seed: SInt32; refCon: SInt32);

    TuneCallBackUPP = ^SInt32; { an opaque UPP }
    TunePlayCallBackUPP = ^SInt32; { an opaque UPP }
    TunePlayer                          = ComponentInstance;

const
    kTunePlayerComponentType    = $74756E65 (* 'tune' *);


    {
     *  TuneSetHeader()
     *
     *  Availability:
     *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
     *    Windows:          in qtmlClient.lib 3.0 and later
        }
function TuneSetHeader(tp: TunePlayer; var header: UInt32): ComponentResult; external name '_TuneSetHeader';
{
 *  TuneGetTimeBase()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function TuneGetTimeBase(tp: TunePlayer; var tb: TimeBase): ComponentResult; external name '_TuneGetTimeBase';
{
 *  TuneSetTimeScale()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function TuneSetTimeScale(tp: TunePlayer; scale: TimeScale): ComponentResult; external name '_TuneSetTimeScale';
{
 *  TuneGetTimeScale()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function TuneGetTimeScale(tp: TunePlayer; var scale: TimeScale): ComponentResult; external name '_TuneGetTimeScale';
{
 *  TuneGetIndexedNoteChannel()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function TuneGetIndexedNoteChannel(tp: TunePlayer; i: SInt32; var nc: NoteChannel): ComponentResult; external name '_TuneGetIndexedNoteChannel';
{ Values for when to start. }

const
    kTuneStartNow               = 1;                            {  start after buffer is implied  }
    kTuneDontClipNotes          = 2;                            {  allow notes to finish their durations outside sample  }
    kTuneExcludeEdgeNotes       = 4;                            {  dont play notes that start at end of tune  }
    kTuneQuickStart             = 8;                            {  Leave all the controllers where they are, ignore start time  }
    kTuneLoopUntil              = 16;                           {  loop a queued tune if there's nothing else in the queue }
    kTunePlayDifference         = 32;                           {  by default, the tune difference is skipped }
    kTunePlayConcurrent         = 64;                           {  dont block the next tune sequence with this one }
    kTuneStartNewMaster         = 16384;

    {
     *  TuneQueue()
     *
     *  Availability:
     *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
     *    Windows:          in qtmlClient.lib 3.0 and later
        }
function TuneQueue(tp: TunePlayer; var tune: UInt32; tuneRate: Fixed; tuneStartPosition: UInt32; tuneStopPosition: UInt32; queueFlags: UInt32; callBackProc: TuneCallBackUPP; refCon: SInt32): ComponentResult; external name '_TuneQueue';
{
 *  TuneInstant()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function TuneInstant(tp: TunePlayer; var tune: UInt32; tunePosition: UInt32): ComponentResult; external name '_TuneInstant';
{
 *  TuneGetStatus()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function TuneGetStatus(tp: TunePlayer; var status: TuneStatus): ComponentResult; external name '_TuneGetStatus';
{ Values for stopping. }

const
    kTuneStopFade               = 1;                            {  do a quick, synchronous fadeout  }
    kTuneStopSustain            = 2;                            {  don't silece notes  }
    kTuneStopInstant            = 4;                            {  silence notes fast (else, decay them)  }
    kTuneStopReleaseChannels    = 8;                            {  afterwards, let the channels go  }

    {
     *  TuneStop()
     *
     *  Availability:
     *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
     *    Windows:          in qtmlClient.lib 3.0 and later
        }
function TuneStop(tp: TunePlayer; stopFlags: SInt32): ComponentResult; external name '_TuneStop';
{
 *  TuneSetVolume()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function TuneSetVolume(tp: TunePlayer; volume: Fixed): ComponentResult; external name '_TuneSetVolume';
{
 *  TuneGetVolume()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function TuneGetVolume(tp: TunePlayer): ComponentResult; external name '_TuneGetVolume';
{
 *  TunePreroll()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function TunePreroll(tp: TunePlayer): ComponentResult; external name '_TunePreroll';
{
 *  TuneUnroll()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function TuneUnroll(tp: TunePlayer): ComponentResult; external name '_TuneUnroll';
{
 *  TuneSetNoteChannels()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function TuneSetNoteChannels(tp: TunePlayer; count: UInt32; var noteChannelList: NoteChannel; playCallBackProc: TunePlayCallBackUPP; refCon: SInt32): ComponentResult; external name '_TuneSetNoteChannels';
{
 *  TuneSetPartTranspose()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function TuneSetPartTranspose(tp: TunePlayer; part: UInt32; transpose: SInt32; velocityShift: SInt32): ComponentResult; external name '_TuneSetPartTranspose';
{
 *  TuneGetNoteAllocator()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function TuneGetNoteAllocator(tp: TunePlayer): NoteAllocator; external name '_TuneGetNoteAllocator';
{
 *  TuneSetSofter()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function TuneSetSofter(tp: TunePlayer; softer: SInt32): ComponentResult; external name '_TuneSetSofter';
{
 *  TuneTask()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function TuneTask(tp: TunePlayer): ComponentResult; external name '_TuneTask';
{
 *  TuneSetBalance()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function TuneSetBalance(tp: TunePlayer; balance: SInt32): ComponentResult; external name '_TuneSetBalance';
{
 *  TuneSetSoundLocalization()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function TuneSetSoundLocalization(tp: TunePlayer; data: Handle): ComponentResult; external name '_TuneSetSoundLocalization';
{
 *  TuneSetHeaderWithSize()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function TuneSetHeaderWithSize(tp: TunePlayer; var header: UInt32; size: UInt32): ComponentResult; external name '_TuneSetHeaderWithSize';
{ flags for part mix. }

const
    kTuneMixMute                = 1;                            {  disable a part  }
    kTuneMixSolo                = 2;                            {  if any parts soloed, play only soloed parts  }


    {
     *  TuneSetPartMix()
     *
     *  Availability:
     *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
     *    Windows:          in qtmlClient.lib 3.0 and later
        }
function TuneSetPartMix(tp: TunePlayer; partNumber: UInt32; volume: SInt32; balance: SInt32; mixFlags: SInt32): ComponentResult; external name '_TuneSetPartMix';
{
 *  TuneGetPartMix()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function TuneGetPartMix(tp: TunePlayer; partNumber: UInt32; var volumeOut: SInt32; var balanceOut: SInt32; var mixFlagsOut: SInt32): ComponentResult; external name '_TuneGetPartMix';
type
    MusicOpWord                         = UInt32;
    MusicOpWordPtr                      = ^MusicOpWord;
    {       QuickTime Music Track Event Formats:

        At this time, QuickTime music tracks support 5 different event types -- REST events,
        short NOTE events, short CONTROL events, short GENERAL events, Long NOTE events,
        long CONTROL events, and variable GENERAL events.

            ¥ REST Event (4 bytes/event):

                (0 0 0) (5-bit UNUSED) (24-bit Rest Duration)

            ¥ÊShort NOTE Events (4 bytes/event):

                (0 0 1) (5-bit Part) (6-bit Pitch) (7-bit Volume) (11-bit Duration)

                where:  Pitch is offset by 32 (Actual pitch = pitch field + 32)

            ¥ÊShort CONTROL Events (4 bytes/event):

                (0 1 0) (5-bit Part) (8-bit Controller) (1-bit UNUSED) (1-bit Sign) (7-bit MSB) (7-bit LSB)
                                                                             ( or 15-bit Signed Value)
            ¥ Short GENERAL Event (4 bytes/event):

                (0 1 1) (1-bit UNUSED) (12-bit Sub-Type) (16-bit Value)

            ¥ Long NOTE Events (8 bytes/event):

                (1 0 0 1) (12-bit Part) (1-bit UNUSED) (7-bit Pitch) (1-bit UNUSED) (7-bit Volume)
                (1 0) (8-bit UNUSED) (22-bit Duration)

            ¥ÊLong CONTROL Event (8 bytes/event):

                (1 0 1 0) (12-bit Part) (16-bit Value MSB)
                (1 0) (14-bit Controller) (16-bit Value LSB)

            ¥ÊLong KNOB Event (8 bytes/event):

                (1 0 1 1) (12-bit Sub-Type) (16-bit Value MSB)
                (1 0) (14-bit KNOB) (16-bit Value LSB)

            ¥ÊVariable GENERAL Length Events (N bytes/event):

                (1 1 1 1) (12-bit Sub-Type) (16-bit Length)
                    :
                (32-bit Data values)
                    :
                (1 1) (14-bit UNUSED) (16-bit Length)

                where:  Length field is the number of LONG words in the record.
                        Lengths include the first and last long words (Minimum length = 2)

        The following event type values have not been used yet and are reserved for
        future expansion:

            ¥ (1 0 0 0)     (8 bytes/event)
            ¥ (1 1 0 0)     (N bytes/event)
            ¥ (1 1 0 1)     (N bytes/event)
            ¥ (1 1 1 0)     (N bytes/event)

        For all events, the following generalizations apply:

            -   All duration values are specified in Millisecond units.
            -   Pitch values are intended to map directly to the MIDI key numbers.
            -   Controllers from 0 to 127 correspond to the standard MIDI controllers.
                Controllers greater than 127 correspond to other controls (i.e., Pitch Bend,
                Key Pressure, and Channel Pressure).
        }

    {  Defines for the implemented music event data fields }

const
    kRestEventType              = $00000000;                    {  lower 3-bits  }
    kNoteEventType              = $00000001;                    {  lower 3-bits  }
    kControlEventType           = $00000002;                    {  lower 3-bits  }
    kMarkerEventType            = $00000003;                    {  lower 3-bits  }
    kUndefined1EventType        = $00000008;                    {  4-bits  }
    kXNoteEventType             = $00000009;                    {  4-bits  }
    kXControlEventType          = $0000000A;                    {  4-bits  }
    kKnobEventType              = $0000000B;                    {  4-bits  }
    kUndefined2EventType        = $0000000C;                    {  4-bits  }
    kUndefined3EventType        = $0000000D;                    {  4-bits  }
    kUndefined4EventType        = $0000000E;                    {  4-bits  }
    kGeneralEventType           = $0000000F;                    {  4-bits  }
    kXEventLengthBits           = $00000002;                    {  2 bits: indicates 8-byte event record  }
    kGeneralEventLengthBits     = $00000003;                    {  2 bits: indicates variable length event record  }
    kEventLen                   = 1;                            {  length of events in long words  }
    kXEventLen                  = 2;
    kRestEventLen               = 1;                            {  length of events in long words  }
    kNoteEventLen               = 1;
    kControlEventLen            = 1;
    kMarkerEventLen             = 1;
    kXNoteEventLen              = 2;
    kXControlEventLen           = 2;
    kGeneralEventLen            = 2;                            {  2 or more, however  }
                                                                {  Universal Event Defines }
    kEventLengthFieldPos        = 30;                           {  by looking at these two bits of the 1st or last word          }
    kEventLengthFieldWidth      = 2;                            {  of an event you can determine the event length                 }
                                                                {  length field: 0 & 1 => 1 long; 2 => 2 longs; 3 => variable length  }
    kEventTypeFieldPos          = 29;                           {  event type field for short events  }
    kEventTypeFieldWidth        = 3;                            {  short type is 3 bits  }
    kXEventTypeFieldPos         = 28;                           {  event type field for extended events  }
    kXEventTypeFieldWidth       = 4;                            {  extended type is 4 bits  }
    kEventPartFieldPos          = 24;
    kEventPartFieldWidth        = 5;
    kXEventPartFieldPos         = 16;                           {  in the 1st long word  }
    kXEventPartFieldWidth       = 12;                           {  Rest Events }
    kRestEventDurationFieldPos  = 0;
    kRestEventDurationFieldWidth = 24;
    kRestEventDurationMax       = $00FFFFFF;                    {  Note Events }
    kNoteEventPitchFieldPos     = 18;
    kNoteEventPitchFieldWidth   = 6;
    kNoteEventPitchOffset       = 32;                           {  add to value in pitch field to get actual pitch  }
    kNoteEventVolumeFieldPos    = 11;
    kNoteEventVolumeFieldWidth  = 7;
    kNoteEventVolumeOffset      = 0;                            {  add to value in volume field to get actual volume  }
    kNoteEventDurationFieldPos  = 0;
    kNoteEventDurationFieldWidth = 11;
    kNoteEventDurationMax       = $000007FF;
    kXNoteEventPitchFieldPos    = 0;                            {  in the 1st long word  }
    kXNoteEventPitchFieldWidth  = 16;
    kXNoteEventDurationFieldPos = 0;                            {  in the 2nd long word  }
    kXNoteEventDurationFieldWidth = 22;
    kXNoteEventDurationMax      = $003FFFFF;
    kXNoteEventVolumeFieldPos   = 22;                           {  in the 2nd long word  }
    kXNoteEventVolumeFieldWidth = 7;                            {  Control Events }
    kControlEventControllerFieldPos = 16;
    kControlEventControllerFieldWidth = 8;
    kControlEventValueFieldPos  = 0;
    kControlEventValueFieldWidth = 16;
    kXControlEventControllerFieldPos = 0;                       {  in the 2nd long word  }
    kXControlEventControllerFieldWidth = 16;
    kXControlEventValueFieldPos = 0;                            {  in the 1st long word  }
    kXControlEventValueFieldWidth = 16;                         {  Knob Events }
    kKnobEventValueHighFieldPos = 0;                            {  1st long word  }
    kKnobEventValueHighFieldWidth = 16;
    kKnobEventKnobFieldPos      = 16;                           {  2nd long word  }
    kKnobEventKnobFieldWidth    = 14;
    kKnobEventValueLowFieldPos  = 0;                            {  2nd long word  }
    kKnobEventValueLowFieldWidth = 16;                          {  Marker Events }
    kMarkerEventSubtypeFieldPos = 16;
    kMarkerEventSubtypeFieldWidth = 8;
    kMarkerEventValueFieldPos   = 0;
    kMarkerEventValueFieldWidth = 16;                           {  General Events }
    kGeneralEventSubtypeFieldPos = 16;                          {  in the last long word  }
    kGeneralEventSubtypeFieldWidth = 14;
    kGeneralEventLengthFieldPos = 0;                            {  in the 1st & last long words  }
    kGeneralEventLengthFieldWidth = 16;

    kEndMarkerValue             = $60000000;


    {  macros for extracting various fields from the QuickTime event records }


    {  General Event Defined Types }
    kGeneralEventNoteRequest    = 1;                            {  Encapsulates NoteRequest data structure  }
    kGeneralEventPartKey        = 4;
    kGeneralEventTuneDifference = 5;                            {  Contains a standard sequence, with end marker, for the tune difference of a sequence piece (halts QuickTime 2.0 Music)  }
    kGeneralEventAtomicInstrument = 6;                          {  Encapsulates AtomicInstrument record  }
    kGeneralEventKnob           = 7;                            {  knobID/knobValue pairs; smallest event is 4 longs  }
    kGeneralEventMIDIChannel    = 8;                            {  used in tune header, one longword identifies the midi channel it originally came from  }
    kGeneralEventPartChange     = 9;                            {  used in tune sequence, one longword identifies the tune part which can now take over this part's note channel (similar to program change) (halts QuickTime 2.0 Music) }
    kGeneralEventNoOp           = 10;                           {  guaranteed to do nothing and be ignored. (halts QuickTime 2.0 Music)  }
    kGeneralEventUsedNotes      = 11;                           {  four longwords specifying which midi notes are actually used, 0..127 msb to lsb  }
    kGeneralEventPartMix        = 12;                           {  three longwords: Fixed volume, long balance, long flags  }

    {  Marker Event Defined Types       // marker is 60 ee vv vv in hex, where e = event type, and v = value }
    kMarkerEventEnd             = 0;                            {  marker type 0 means: value 0 - stop, value != 0 - ignore }
    kMarkerEventBeat            = 1;                            {  value 0 = single beat; anything else is 65536ths-of-a-beat (quarter note) }
    kMarkerEventTempo           = 2;                            {  value same as beat marker, but indicates that a tempo event should be computed (based on where the next beat or tempo marker is) and emitted upon export }

    kCurrentlyNativeEndian      = 1;
    kCurrentlyNotNativeEndian   = 2;

    {    UPP call backs     }
    uppMusicMIDISendProcInfo = $00000FF0;
    uppMusicOfflineDataProcInfo = $00000FF0;
    uppTuneCallBackProcInfo = $000003C0;
    uppTunePlayCallBackProcInfo = $00000FC0;
    {
     *  NewMusicMIDISendUPP()
     *
     *  Availability:
     *    Non-Carbon CFM:   available as macro/inline
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function NewMusicMIDISendUPP(userRoutine: MusicMIDISendProcPtr): MusicMIDISendUPP; external name '_NewMusicMIDISendUPP'; { old name was NewMusicMIDISendProc }
{
 *  NewMusicOfflineDataUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewMusicOfflineDataUPP(userRoutine: MusicOfflineDataProcPtr): MusicOfflineDataUPP; external name '_NewMusicOfflineDataUPP'; { old name was NewMusicOfflineDataProc }
{
 *  NewTuneCallBackUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewTuneCallBackUPP(userRoutine: TuneCallBackProcPtr): TuneCallBackUPP; external name '_NewTuneCallBackUPP'; { old name was NewTuneCallBackProc }
{
 *  NewTunePlayCallBackUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewTunePlayCallBackUPP(userRoutine: TunePlayCallBackProcPtr): TunePlayCallBackUPP; external name '_NewTunePlayCallBackUPP'; { old name was NewTunePlayCallBackProc }
{
 *  DisposeMusicMIDISendUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeMusicMIDISendUPP(userUPP: MusicMIDISendUPP); external name '_DisposeMusicMIDISendUPP';
{
 *  DisposeMusicOfflineDataUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeMusicOfflineDataUPP(userUPP: MusicOfflineDataUPP); external name '_DisposeMusicOfflineDataUPP';
{
 *  DisposeTuneCallBackUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeTuneCallBackUPP(userUPP: TuneCallBackUPP); external name '_DisposeTuneCallBackUPP';
{
 *  DisposeTunePlayCallBackUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeTunePlayCallBackUPP(userUPP: TunePlayCallBackUPP); external name '_DisposeTunePlayCallBackUPP';
{
 *  InvokeMusicMIDISendUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeMusicMIDISendUPP(self: ComponentInstance; refCon: SInt32; var mmp: MusicMIDIPacket; userRoutine: MusicMIDISendUPP): ComponentResult; external name '_InvokeMusicMIDISendUPP'; { old name was CallMusicMIDISendProc }
{
 *  InvokeMusicOfflineDataUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeMusicOfflineDataUPP(SoundData: Ptr; numBytes: SInt32; myRefCon: SInt32; userRoutine: MusicOfflineDataUPP): ComponentResult; external name '_InvokeMusicOfflineDataUPP'; { old name was CallMusicOfflineDataProc }
{
 *  InvokeTuneCallBackUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvokeTuneCallBackUPP(const (*var*) status: TuneStatus; refCon: SInt32; userRoutine: TuneCallBackUPP); external name '_InvokeTuneCallBackUPP'; { old name was CallTuneCallBackProc }
{
 *  InvokeTunePlayCallBackUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvokeTunePlayCallBackUPP(var event: UInt32; seed: SInt32; refCon: SInt32; userRoutine: TunePlayCallBackUPP); external name '_InvokeTunePlayCallBackUPP'; { old name was CallTunePlayCallBackProc }
{$ALIGN MAC68K}
{#POP}
{unit QuickTimeVR}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}


type
    QTVRInstance    = ^SInt32; { an opaque 32-bit type }
    QTVRInstancePtr = ^QTVRInstance;  { when a var xx:QTVRInstance parameter can be nil, it is changed to xx: QTVRInstancePtr }


const
    kQTVRControllerSubType      = $63747970 (* 'ctyp' *);
    kQTVRQTVRType               = $71747672 (* 'qtvr' *);
    kQTVRPanoramaType           = $70616E6F (* 'pano' *);
    kQTVRObjectType             = $6F626A65 (* 'obje' *);
    kQTVROldPanoType            = $5354706E (* 'STpn' *);                       {  Used in QTVR 1.0 release }
    kQTVROldObjectType          = $73746E61 (* 'stna' *);                       {  Used in QTVR 1.0 release }


    {  QTVR hot spot types }
    kQTVRHotSpotLinkType        = $6C696E6B (* 'link' *);
    kQTVRHotSpotURLType         = $75726C20 (* 'url ' *);
    kQTVRHotSpotUndefinedType   = $756E6466 (* 'undf' *);

    {  Special Values for nodeID in QTVRGoToNodeID }
    kQTVRCurrentNode            = 0;
    kQTVRPreviousNode           = $80000000;
    kQTVRDefaultNode            = $80000001;

    {  Panorama correction modes used for the kQTVRImagingCorrection imaging property }
    kQTVRNoCorrection           = 0;
    kQTVRPartialCorrection      = 1;
    kQTVRFullCorrection         = 2;

    {  Imaging Modes used by QTVRSetImagingProperty, QTVRGetImagingProperty, QTVRUpdate, QTVRBeginUpdate }

type
    QTVRImagingMode             = UInt32;
const
    kQTVRStatic                 = 1;
    kQTVRMotion                 = 2;
    kQTVRCurrentMode            = 0;                            {  Special Value for QTVRUpdate }
    kQTVRAllModes               = 100;                          {  Special value for QTVRSetProperty }

    {  Imaging Properties used by QTVRSetImagingProperty, QTVRGetImagingProperty }
    kQTVRImagingCorrection      = 1;
    kQTVRImagingQuality         = 2;
    kQTVRImagingDirectDraw      = 3;
    kQTVRImagingCurrentMode     = 100;                          {  Get Only }

    {  OR the above with kImagingDefaultValue to get/set the default value }
    kImagingDefaultValue        = $80000000;

    {  Transition Types used by QTVRSetTransitionProperty, QTVREnableTransition }
    kQTVRTransitionSwing        = 1;

    {  Transition Properties QTVRSetTransitionProperty }
    kQTVRTransitionSpeed        = 1;
    kQTVRTransitionDirection    = 2;

    {  Constraint values used to construct value returned by GetConstraintStatus }
    kQTVRUnconstrained          = 0;
    kQTVRCantPanLeft            = $00000001;
    kQTVRCantPanRight           = $00000002;
    kQTVRCantPanUp              = $00000004;
    kQTVRCantPanDown            = $00000008;
    kQTVRCantZoomIn             = $00000010;
    kQTVRCantZoomOut            = $00000020;
    kQTVRCantTranslateLeft      = $00000040;
    kQTVRCantTranslateRight     = $00000080;
    kQTVRCantTranslateUp        = $00000100;
    kQTVRCantTranslateDown      = $00000200;

    {  Object-only mouse mode values used to construct value returned by QTVRGetCurrentMouseMode }
    kQTVRPanning                = $00000001;                    {  standard objects, "object only" controllers }
    kQTVRTranslating            = $00000002;                    {  all objects }
    kQTVRZooming                = $00000004;                    {  all objects }
    kQTVRScrolling              = $00000008;                    {  standard object arrow scrollers and joystick object }
    kQTVRSelecting              = $00000010;                    {  object absolute controller }

    {  Properties for use with QTVRSetInteractionProperty/GetInteractionProperty }
    kQTVRInteractionMouseClickHysteresis = 1;                   {  pixels within which the mouse is considered not to have moved (UInt16) }
    kQTVRInteractionMouseClickTimeout = 2;                      {  ticks after which a mouse click times out and turns into panning (UInt32) }
    kQTVRInteractionPanTiltSpeed = 3;                           {  control the relative pan/tilt speed from 1 (slowest) to 10 (fastest). (UInt32) Default is 5; }
    kQTVRInteractionZoomSpeed   = 4;                            {  control the relative zooming speed from 1 (slowest) to 10 (fastest). (UInt32) Default is 5; }
    kQTVRInteractionTranslateOnMouseDown = 101;                 {  Holding MouseDown with this setting translates zoomed object movies (Boolean) }
    kQTVRInteractionMouseMotionScale = 102;                     {  The maximum angle of rotation caused by dragging across the display window. (* float) }
    kQTVRInteractionNudgeMode   = 103;                          {  A QTVRNudgeMode: rotate, translate, or the same as the current mouse mode. Requires QTVR 2.1 }

    {  OR the above with kQTVRInteractionDefaultValue to get/set the default value }
    kQTVRInteractionDefaultValue = $80000000;


    {  Geometry constants used in QTVRSetBackBufferPrefs, QTVRGetBackBufferSettings, QTVRGetBackBufferMemInfo }
    kQTVRUseMovieGeometry       = 0;
    kQTVRVerticalCylinder       = $7663796C (* 'vcyl' *);
    kQTVRHorizontalCylinder     = $6863796C (* 'hcyl' *);
    kQTVRCube                   = $63756265 (* 'cube' *);

    {  Resolution constants used in QTVRSetBackBufferPrefs, QTVRGetBackBufferSettings, QTVRGetBackBufferMemInfo }
    kQTVRDefaultRes             = 0;
    kQTVRFullRes                = $00000001;
    kQTVRHalfRes                = $00000002;
    kQTVRQuarterRes             = $00000004;

    {  QTVR-specific pixelFormat constants used in QTVRSetBackBufferPrefs, QTVRGetBackBufferSettings, QTVRGetBackBufferMemInfo }
    kQTVRUseMovieDepth          = 0;

    {  Cache Size Pref constants used in QTVRSetBackBufferPrefs, QTVRGetBackBufferSettings }
    kQTVRMinimumCache           = -1;
    kQTVRSuggestedCache         = 0;
    kQTVRFullCache              = 1;

    {  Angular units used by QTVRSetAngularUnits }

type
    QTVRAngularUnits            = UInt32;
const
    kQTVRDegrees                = 0;
    kQTVRRadians                = 1;

    {  Values for enableFlag parameter in QTVREnableHotSpot }
    kQTVRHotSpotID              = 0;
    kQTVRHotSpotType            = 1;
    kQTVRAllHotSpots            = 2;

    {  Values for viewParameter for QTVRSet/GetViewParameter }
    kQTVRPanAngle               = $0100;                        {  default units; &float, &float }
    kQTVRTiltAngle              = $0101;                        {  default units; &float, &float }
    kQTVRFieldOfViewAngle       = $0103;                        {  default units; &float, &float }
    kQTVRViewCenter             = $0104;                        {  pixels (per object movies); &QTVRFloatPoint, &QTVRFloatPoint }
    kQTVRHotSpotsVisible        = $0200;                        {  Boolean, &Boolean }

    {  Values for flagsIn for QTVRSet/GetViewParameter }
    kQTVRValueIsRelative        = $00000001;                    {  Is the value absolute or relative to the current value? }
    kQTVRValueIsRate            = $00000002;                    {  Is the value absolute or a rate of change to be applied? }
    kQTVRValueIsUserPrefRelative = $00000004;                   {  Is the value a percentage of the user rate pref? }

    {  Values for kind parameter in QTVRGet/SetConstraints, QTVRGetViewingLimits }
    kQTVRPan                    = 0;
    kQTVRTilt                   = 1;
    kQTVRFieldOfView            = 2;
    kQTVRViewCenterH            = 4;                            {  WrapAndConstrain only }
    kQTVRViewCenterV            = 5;                            {  WrapAndConstrain only }

    {  Values for setting parameter in QTVRSetAnimationSetting, QTVRGetAnimationSetting }

type
    QTVRObjectAnimationSetting  = UInt32;
const
                                                                {  View Frame Animation Settings }
    kQTVRPalindromeViewFrames   = 1;
    kQTVRStartFirstViewFrame    = 2;
    kQTVRDontLoopViewFrames     = 3;
    kQTVRPlayEveryViewFrame     = 4;                            {  Requires QTVR 2.1 (kQTVRAPIMajorVersion02 + kQTVRAPIMinorVersion10) }
                                                                {  View Animation Settings }
    kQTVRSyncViewToFrameRate    = 16;
    kQTVRPalindromeViews        = 17;
    kQTVRPlayStreamingViews     = 18;                           {  Requires QTVR 2.1 (kQTVRAPIMajorVersion02 + kQTVRAPIMinorVersion10) }


type
    QTVRControlSetting          = UInt32;
const
    kQTVRWrapPan                = 1;
    kQTVRWrapTilt               = 2;
    kQTVRCanZoom                = 3;
    kQTVRReverseHControl        = 4;
    kQTVRReverseVControl        = 5;
    kQTVRSwapHVControl          = 6;
    kQTVRTranslation            = 7;


type
    QTVRViewStateType           = UInt32;
const
    kQTVRDefault                = 0;
    kQTVRCurrent                = 2;
    kQTVRMouseDown              = 3;


type
    QTVRNudgeControl            = UInt32;
const
    kQTVRRight                  = 0;
    kQTVRUpRight                = 45;
    kQTVRUp                     = 90;
    kQTVRUpLeft                 = 135;
    kQTVRLeft                   = 180;
    kQTVRDownLeft               = 225;
    kQTVRDown                   = 270;
    kQTVRDownRight              = 315;


type
    QTVRNudgeMode               = UInt32;
const
    kQTVRNudgeRotate            = 0;
    kQTVRNudgeTranslate         = 1;
    kQTVRNudgeSameAsMouse       = 2;


    {  Flags to control elements of the QTVR control bar (set via mcActionSetFlags)  }
    mcFlagQTVRSuppressBackBtn   = $00010000;
    mcFlagQTVRSuppressZoomBtns  = $00020000;
    mcFlagQTVRSuppressHotSpotBtn = $00040000;
    mcFlagQTVRSuppressTranslateBtn = $00080000;
    mcFlagQTVRSuppressHelpText  = $00100000;
    mcFlagQTVRSuppressHotSpotNames = $00200000;
    mcFlagQTVRExplicitFlagSet   = $80000000;                    {  bits 0->30 should be interpreted as "explicit on" for the corresponding suppression bits }

    {  Cursor types used in type field of QTVRCursorRecord }
    kQTVRUseDefaultCursor       = 0;
    kQTVRStdCursorType          = 1;
    kQTVRColorCursorType        = 2;

    {  Values for flags parameter in QTVRMouseOverHotSpot callback }
    kQTVRHotSpotEnter           = 0;
    kQTVRHotSpotWithin          = 1;
    kQTVRHotSpotLeave           = 2;

    {  Values for flags parameter in QTVRSetPrescreenImagingCompleteProc }
    kQTVRPreScreenEveryIdle     = $00000001;                    {  Requires QTVR 2.1 (kQTVRAPIMajorVersion02 + kQTVRAPIMinorVersion10) }

    {  Values for flags field of areasOfInterest in QTVRSetBackBufferImagingProc }
    kQTVRBackBufferEveryUpdate  = $00000001;
    kQTVRBackBufferEveryIdle    = $00000002;
    kQTVRBackBufferAlwaysRefresh = $00000004;
    kQTVRBackBufferHorizontal   = $00000008;                    {  Requires that backbuffer proc be long-rowBytes aware (gestaltQDHasLongRowBytes) }

    {  Values for flagsIn parameter in QTVRBackBufferImaging callback }
    kQTVRBackBufferRectVisible  = $00000001;
    kQTVRBackBufferWasRefreshed = $00000002;

    {  Values for flagsOut parameter in QTVRBackBufferImaging callback }
    kQTVRBackBufferFlagDidDraw  = $00000001;
    kQTVRBackBufferFlagLastFlag = $80000000;

    {  QTVRCursorRecord used in QTVRReplaceCursor }

type
    QTVRCursorRecordPtr = ^QTVRCursorRecord;
    QTVRCursorRecord = record
        theType:                UInt16;                                 {  field was previously named "type" }
        rsrcID:                 SInt16;
        handle:                 Handle;
    end;

    QTVRFloatPointPtr = ^QTVRFloatPoint;
    QTVRFloatPoint = record
        x:                      Single;
        y:                      Single;
    end;

    {  Struct used for areasOfInterest parameter in QTVRSetBackBufferImagingProc }
    QTVRAreaOfInterestPtr = ^QTVRAreaOfInterest;
    QTVRAreaOfInterest = record
        panAngle:               Single;
        tiltAngle:              Single;
        width:                  Single;
        height:                 Single;
        flags:                  UInt32;
    end;

    {
      =================================================================================================
       Callback routines
      -------------------------------------------------------------------------------------------------
    }

    QTVRLeavingNodeProcPtr = function(qtvr: QTVRInstance; fromNodeID: UInt32; toNodeID: UInt32; var cancel: boolean; refCon: SInt32): OSErr;

    QTVREnteringNodeProcPtr = function(qtvr: QTVRInstance; nodeID: UInt32; refCon: SInt32): OSErr;

    QTVRMouseOverHotSpotProcPtr = function(qtvr: QTVRInstance; hotSpotID: UInt32; flags: UInt32; refCon: SInt32): OSErr;

    QTVRImagingCompleteProcPtr = function(qtvr: QTVRInstance; refCon: SInt32): OSErr;

    QTVRBackBufferImagingProcPtr = function(qtvr: QTVRInstance; var drawRect: Rect; areaIndex: UInt16; flagsIn: UInt32; var flagsOut: UInt32; refCon: SInt32): OSErr;

    QTVRLeavingNodeUPP = ^SInt32; { an opaque UPP }
    QTVREnteringNodeUPP = ^SInt32; { an opaque UPP }
    QTVRMouseOverHotSpotUPP = ^SInt32; { an opaque UPP }
    QTVRImagingCompleteUPP = ^SInt32; { an opaque UPP }
    QTVRBackBufferImagingUPP = ^SInt32; { an opaque UPP }

const
    uppQTVRLeavingNodeProcInfo = $0000FFE0;
    uppQTVREnteringNodeProcInfo = $00000FE0;
    uppQTVRMouseOverHotSpotProcInfo = $00003FE0;
    uppQTVRImagingCompleteProcInfo = $000003E0;
    uppQTVRBackBufferImagingProcInfo = $0003FBE0;
    {
     *  NewQTVRLeavingNodeUPP()
     *
     *  Availability:
     *    Non-Carbon CFM:   available as macro/inline
     *    CarbonLib:        in CarbonLib 1.1 and later
     *    Mac OS X:         in version 10.0 and later
        }
function NewQTVRLeavingNodeUPP(userRoutine: QTVRLeavingNodeProcPtr): QTVRLeavingNodeUPP; external name '_NewQTVRLeavingNodeUPP'; { old name was NewQTVRLeavingNodeProc }
{
 *  NewQTVREnteringNodeUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewQTVREnteringNodeUPP(userRoutine: QTVREnteringNodeProcPtr): QTVREnteringNodeUPP; external name '_NewQTVREnteringNodeUPP'; { old name was NewQTVREnteringNodeProc }
{
 *  NewQTVRMouseOverHotSpotUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewQTVRMouseOverHotSpotUPP(userRoutine: QTVRMouseOverHotSpotProcPtr): QTVRMouseOverHotSpotUPP; external name '_NewQTVRMouseOverHotSpotUPP'; { old name was NewQTVRMouseOverHotSpotProc }
{
 *  NewQTVRImagingCompleteUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewQTVRImagingCompleteUPP(userRoutine: QTVRImagingCompleteProcPtr): QTVRImagingCompleteUPP; external name '_NewQTVRImagingCompleteUPP'; { old name was NewQTVRImagingCompleteProc }
{
 *  NewQTVRBackBufferImagingUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewQTVRBackBufferImagingUPP(userRoutine: QTVRBackBufferImagingProcPtr): QTVRBackBufferImagingUPP; external name '_NewQTVRBackBufferImagingUPP'; { old name was NewQTVRBackBufferImagingProc }
{
 *  DisposeQTVRLeavingNodeUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeQTVRLeavingNodeUPP(userUPP: QTVRLeavingNodeUPP); external name '_DisposeQTVRLeavingNodeUPP';
{
 *  DisposeQTVREnteringNodeUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeQTVREnteringNodeUPP(userUPP: QTVREnteringNodeUPP); external name '_DisposeQTVREnteringNodeUPP';
{
 *  DisposeQTVRMouseOverHotSpotUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeQTVRMouseOverHotSpotUPP(userUPP: QTVRMouseOverHotSpotUPP); external name '_DisposeQTVRMouseOverHotSpotUPP';
{
 *  DisposeQTVRImagingCompleteUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeQTVRImagingCompleteUPP(userUPP: QTVRImagingCompleteUPP); external name '_DisposeQTVRImagingCompleteUPP';
{
 *  DisposeQTVRBackBufferImagingUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeQTVRBackBufferImagingUPP(userUPP: QTVRBackBufferImagingUPP); external name '_DisposeQTVRBackBufferImagingUPP';
{
 *  InvokeQTVRLeavingNodeUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeQTVRLeavingNodeUPP(qtvr: QTVRInstance; fromNodeID: UInt32; toNodeID: UInt32; var cancel: boolean; refCon: SInt32; userRoutine: QTVRLeavingNodeUPP): OSErr; external name '_InvokeQTVRLeavingNodeUPP'; { old name was CallQTVRLeavingNodeProc }
{
 *  InvokeQTVREnteringNodeUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeQTVREnteringNodeUPP(qtvr: QTVRInstance; nodeID: UInt32; refCon: SInt32; userRoutine: QTVREnteringNodeUPP): OSErr; external name '_InvokeQTVREnteringNodeUPP'; { old name was CallQTVREnteringNodeProc }
{
 *  InvokeQTVRMouseOverHotSpotUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeQTVRMouseOverHotSpotUPP(qtvr: QTVRInstance; hotSpotID: UInt32; flags: UInt32; refCon: SInt32; userRoutine: QTVRMouseOverHotSpotUPP): OSErr; external name '_InvokeQTVRMouseOverHotSpotUPP'; { old name was CallQTVRMouseOverHotSpotProc }
{
 *  InvokeQTVRImagingCompleteUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeQTVRImagingCompleteUPP(qtvr: QTVRInstance; refCon: SInt32; userRoutine: QTVRImagingCompleteUPP): OSErr; external name '_InvokeQTVRImagingCompleteUPP'; { old name was CallQTVRImagingCompleteProc }
{
 *  InvokeQTVRBackBufferImagingUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeQTVRBackBufferImagingUPP(qtvr: QTVRInstance; var drawRect: Rect; areaIndex: UInt16; flagsIn: UInt32; var flagsOut: UInt32; refCon: SInt32; userRoutine: QTVRBackBufferImagingUPP): OSErr; external name '_InvokeQTVRBackBufferImagingUPP'; { old name was CallQTVRBackBufferImagingProc }
{
  =================================================================================================
    QTVR Intercept Struct, Callback, Routine Descriptors
  -------------------------------------------------------------------------------------------------
}


type
    QTVRProcSelector            = UInt32;
const
    kQTVRSetPanAngleSelector    = $2000;
    kQTVRSetTiltAngleSelector   = $2001;
    kQTVRSetFieldOfViewSelector = $2002;
    kQTVRSetViewCenterSelector  = $2003;
    kQTVRMouseEnterSelector     = $2004;
    kQTVRMouseWithinSelector    = $2005;
    kQTVRMouseLeaveSelector     = $2006;
    kQTVRMouseDownSelector      = $2007;
    kQTVRMouseStillDownSelector = $2008;
    kQTVRMouseUpSelector        = $2009;
    kQTVRTriggerHotSpotSelector = $200A;
    kQTVRGetHotSpotTypeSelector = $200B;                        {  Requires QTVR 2.1 (kQTVRAPIMajorVersion02 + kQTVRAPIMinorVersion10) }
    kQTVRSetViewParameterSelector = $200C;                      {  Requires QTVR 5.0 (kQTVRAPIMajorVersion05 + kQTVRAPIMinorVersion00) }
    kQTVRGetViewParameterSelector = $200D;                      {  Requires QTVR 5.0 (kQTVRAPIMajorVersion05 + kQTVRAPIMinorVersion00) }


type
    QTVRInterceptRecordPtr = ^QTVRInterceptRecord;
    QTVRInterceptRecord = record
        reserved1:              SInt32;
        selector:               SInt32;
        reserved2:              SInt32;
        reserved3:              SInt32;
        paramCount:             SInt32;
        parameter:              array [0..5] of Ptr;
    end;

    QTVRInterceptPtr                    = ^QTVRInterceptRecord;
    {  Prototype for Intercept Proc callback }
    QTVRInterceptProcPtr = procedure(qtvr: QTVRInstance; qtvrMsg: QTVRInterceptPtr; refCon: SInt32; var cancel: boolean);

    QTVRInterceptUPP = ^SInt32; { an opaque UPP }

const
    uppQTVRInterceptProcInfo = $00003FC0;
    {
     *  NewQTVRInterceptUPP()
     *
     *  Availability:
     *    Non-Carbon CFM:   available as macro/inline
     *    CarbonLib:        in CarbonLib 1.1 and later
     *    Mac OS X:         in version 10.0 and later
        }
function NewQTVRInterceptUPP(userRoutine: QTVRInterceptProcPtr): QTVRInterceptUPP; external name '_NewQTVRInterceptUPP'; { old name was NewQTVRInterceptProc }
{
 *  DisposeQTVRInterceptUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeQTVRInterceptUPP(userUPP: QTVRInterceptUPP); external name '_DisposeQTVRInterceptUPP';
{
 *  InvokeQTVRInterceptUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvokeQTVRInterceptUPP(qtvr: QTVRInstance; qtvrMsg: QTVRInterceptPtr; refCon: SInt32; var cancel: boolean; userRoutine: QTVRInterceptUPP); external name '_InvokeQTVRInterceptUPP'; { old name was CallQTVRInterceptProc }
{
  =================================================================================================
    Initialization QTVR calls
  -------------------------------------------------------------------------------------------------
   Requires QTVR 2.1 (kQTVRAPIMajorVersion02 + kQTVRAPIMinorVersion10) and only work on Non-Macintosh platforms
}

{
  =================================================================================================
    General QTVR calls
  -------------------------------------------------------------------------------------------------
}
{
 *  QTVRGetQTVRTrack()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeVRLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTVR.lib 2.1 and later
 }
function QTVRGetQTVRTrack(theMovie: Movie; index: SInt32): Track; external name '_QTVRGetQTVRTrack';

{
 *  QTVRGetQTVRInstance()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeVRLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTVR.lib 2.1 and later
 }
function QTVRGetQTVRInstance(var qtvr: QTVRInstance; qtvrTrack: Track; mc: MovieController): OSErr; external name '_QTVRGetQTVRInstance';

{
  =================================================================================================
    Viewing Angles and Zooming
  -------------------------------------------------------------------------------------------------
}

{  QTVRSetViewParameter requires QTVR 5.0 (kQTVRAPIMajorVersion05 + kQTVRAPIMinorVersion00) }
{
 *  QTVRSetViewParameter()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeVRLib 5.0 and later
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTVR.lib 5.0 and later
 }
function QTVRSetViewParameter(qtvr: QTVRInstance; viewParameter: UInt32; value: UnivPtr; flagsIn: UInt32): OSErr; external name '_QTVRSetViewParameter';

{  QTVRGetViewParameter requires QTVR 5.0 (kQTVRAPIMajorVersion05 + kQTVRAPIMinorVersion00) }
{
 *  QTVRGetViewParameter()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeVRLib 5.0 and later
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTVR.lib 5.0 and later
 }
function QTVRGetViewParameter(qtvr: QTVRInstance; viewParameter: UInt32; value: UnivPtr; flagsIn: UInt32; var flagsOut: UInt32): OSErr; external name '_QTVRGetViewParameter';

{
 *  QTVRSetPanAngle()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeVRLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTVR.lib 2.1 and later
 }
function QTVRSetPanAngle(qtvr: QTVRInstance; panAngle: Single): OSErr; external name '_QTVRSetPanAngle';

{
 *  QTVRGetPanAngle()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeVRLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTVR.lib 2.1 and later
 }
function QTVRGetPanAngle(qtvr: QTVRInstance): Single; external name '_QTVRGetPanAngle';

{
 *  QTVRSetTiltAngle()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeVRLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTVR.lib 2.1 and later
 }
function QTVRSetTiltAngle(qtvr: QTVRInstance; tiltAngle: Single): OSErr; external name '_QTVRSetTiltAngle';

{
 *  QTVRGetTiltAngle()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeVRLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTVR.lib 2.1 and later
 }
function QTVRGetTiltAngle(qtvr: QTVRInstance): Single; external name '_QTVRGetTiltAngle';

{
 *  QTVRSetFieldOfView()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeVRLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTVR.lib 2.1 and later
 }
function QTVRSetFieldOfView(qtvr: QTVRInstance; fieldOfView: Single): OSErr; external name '_QTVRSetFieldOfView';

{
 *  QTVRGetFieldOfView()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeVRLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTVR.lib 2.1 and later
 }
function QTVRGetFieldOfView(qtvr: QTVRInstance): Single; external name '_QTVRGetFieldOfView';

{
 *  QTVRShowDefaultView()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeVRLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTVR.lib 2.1 and later
 }
function QTVRShowDefaultView(qtvr: QTVRInstance): OSErr; external name '_QTVRShowDefaultView';

{  Object Specific }
{
 *  QTVRSetViewCenter()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeVRLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTVR.lib 2.1 and later
 }
function QTVRSetViewCenter(qtvr: QTVRInstance; const (*var*) viewCenter: QTVRFloatPoint): OSErr; external name '_QTVRSetViewCenter';

{
 *  QTVRGetViewCenter()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeVRLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTVR.lib 2.1 and later
 }
function QTVRGetViewCenter(qtvr: QTVRInstance; var viewCenter: QTVRFloatPoint): OSErr; external name '_QTVRGetViewCenter';

{
 *  QTVRNudge()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeVRLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTVR.lib 2.1 and later
 }
function QTVRNudge(qtvr: QTVRInstance; direction: QTVRNudgeControl): OSErr; external name '_QTVRNudge';

{  QTVRInteractionNudge requires QTVR 2.1 (kQTVRAPIMajorVersion02 + kQTVRAPIMinorVersion10) }
{
 *  QTVRInteractionNudge()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeVRLib 2.1 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTVR.lib 2.1 and later
 }
function QTVRInteractionNudge(qtvr: QTVRInstance; direction: QTVRNudgeControl): OSErr; external name '_QTVRInteractionNudge';

{
  =================================================================================================
    Scene and Node Location Information
  -------------------------------------------------------------------------------------------------
}

{
 *  QTVRGetVRWorld()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeVRLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTVR.lib 2.1 and later
 }
function QTVRGetVRWorld(qtvr: QTVRInstance; var VRWorld: QTAtomContainer): OSErr; external name '_QTVRGetVRWorld';

{
 *  QTVRGetNodeInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeVRLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTVR.lib 2.1 and later
 }
function QTVRGetNodeInfo(qtvr: QTVRInstance; nodeID: UInt32; var nodeInfo: QTAtomContainer): OSErr; external name '_QTVRGetNodeInfo';

{
 *  QTVRGoToNodeID()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeVRLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTVR.lib 2.1 and later
 }
function QTVRGoToNodeID(qtvr: QTVRInstance; nodeID: UInt32): OSErr; external name '_QTVRGoToNodeID';

{
 *  QTVRGetCurrentNodeID()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeVRLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTVR.lib 2.1 and later
 }
function QTVRGetCurrentNodeID(qtvr: QTVRInstance): UInt32; external name '_QTVRGetCurrentNodeID';

{
 *  QTVRGetNodeType()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeVRLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTVR.lib 2.1 and later
 }
function QTVRGetNodeType(qtvr: QTVRInstance; nodeID: UInt32): SInt32; external name '_QTVRGetNodeType';

{
  =================================================================================================
    Hot Spot related calls
  -------------------------------------------------------------------------------------------------
}

{
 *  QTVRPtToHotSpotID()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeVRLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTVR.lib 2.1 and later
 }
function QTVRPtToHotSpotID(qtvr: QTVRInstance; pt: Point; var hotSpotID: UInt32): OSErr; external name '_QTVRPtToHotSpotID';

{  QTVRGetHotSpotType requires QTVR 2.1 (kQTVRAPIMajorVersion02 + kQTVRAPIMinorVersion10) }
{
 *  QTVRGetHotSpotType()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeVRLib 2.1 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTVR.lib 2.1 and later
 }
function QTVRGetHotSpotType(qtvr: QTVRInstance; hotSpotID: UInt32; var hotSpotType: OSType): OSErr; external name '_QTVRGetHotSpotType';

{
 *  QTVRTriggerHotSpot()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeVRLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTVR.lib 2.1 and later
 }
function QTVRTriggerHotSpot(qtvr: QTVRInstance; hotSpotID: UInt32; nodeInfo: QTAtomContainer; selectedAtom: QTAtom): OSErr; external name '_QTVRTriggerHotSpot';

{
 *  QTVRSetMouseOverHotSpotProc()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeVRLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTVR.lib 2.1 and later
 }
function QTVRSetMouseOverHotSpotProc(qtvr: QTVRInstance; mouseOverHotSpotProc: QTVRMouseOverHotSpotUPP; refCon: SInt32; flags: UInt32): OSErr; external name '_QTVRSetMouseOverHotSpotProc';

{
 *  QTVREnableHotSpot()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeVRLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTVR.lib 2.1 and later
 }
function QTVREnableHotSpot(qtvr: QTVRInstance; enableFlag: UInt32; hotSpotValue: UInt32; enable: boolean): OSErr; external name '_QTVREnableHotSpot';

{
 *  QTVRGetVisibleHotSpots()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeVRLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTVR.lib 2.1 and later
 }
function QTVRGetVisibleHotSpots(qtvr: QTVRInstance; hotSpots: Handle): UInt32; external name '_QTVRGetVisibleHotSpots';

{
 *  QTVRGetHotSpotRegion()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeVRLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTVR.lib 2.1 and later
 }
function QTVRGetHotSpotRegion(qtvr: QTVRInstance; hotSpotID: UInt32; hotSpotRegion: RgnHandle): OSErr; external name '_QTVRGetHotSpotRegion';

{
  =================================================================================================
    Event & Cursor Handling Calls
  -------------------------------------------------------------------------------------------------
}

{
 *  QTVRSetMouseOverTracking()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeVRLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTVR.lib 2.1 and later
 }
function QTVRSetMouseOverTracking(qtvr: QTVRInstance; enable: boolean): OSErr; external name '_QTVRSetMouseOverTracking';

{
 *  QTVRGetMouseOverTracking()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeVRLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTVR.lib 2.1 and later
 }
function QTVRGetMouseOverTracking(qtvr: QTVRInstance): boolean; external name '_QTVRGetMouseOverTracking';

{
 *  QTVRSetMouseDownTracking()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeVRLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTVR.lib 2.1 and later
 }
function QTVRSetMouseDownTracking(qtvr: QTVRInstance; enable: boolean): OSErr; external name '_QTVRSetMouseDownTracking';

{
 *  QTVRGetMouseDownTracking()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeVRLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTVR.lib 2.1 and later
 }
function QTVRGetMouseDownTracking(qtvr: QTVRInstance): boolean; external name '_QTVRGetMouseDownTracking';

{
 *  QTVRMouseEnter()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeVRLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTVR.lib 2.1 and later
 }
function QTVRMouseEnter(qtvr: QTVRInstance; pt: Point; var hotSpotID: UInt32; w: WindowRef): OSErr; external name '_QTVRMouseEnter';

{
 *  QTVRMouseWithin()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeVRLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTVR.lib 2.1 and later
 }
function QTVRMouseWithin(qtvr: QTVRInstance; pt: Point; var hotSpotID: UInt32; w: WindowRef): OSErr; external name '_QTVRMouseWithin';

{
 *  QTVRMouseLeave()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeVRLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTVR.lib 2.1 and later
 }
function QTVRMouseLeave(qtvr: QTVRInstance; pt: Point; w: WindowRef): OSErr; external name '_QTVRMouseLeave';

{
 *  QTVRMouseDown()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeVRLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTVR.lib 2.1 and later
 }
function QTVRMouseDown(qtvr: QTVRInstance; pt: Point; when: UInt32; modifiers: UInt16; var hotSpotID: UInt32; w: WindowRef): OSErr; external name '_QTVRMouseDown';

{
 *  QTVRMouseStillDown()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeVRLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTVR.lib 2.1 and later
 }
function QTVRMouseStillDown(qtvr: QTVRInstance; pt: Point; var hotSpotID: UInt32; w: WindowRef): OSErr; external name '_QTVRMouseStillDown';

{
 *  QTVRMouseUp()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeVRLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTVR.lib 2.1 and later
 }
function QTVRMouseUp(qtvr: QTVRInstance; pt: Point; var hotSpotID: UInt32; w: WindowRef): OSErr; external name '_QTVRMouseUp';

{  These require QTVR 2.01 (kQTVRAPIMajorVersion02 + kQTVRAPIMinorVersion01) }
{
 *  QTVRMouseStillDownExtended()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeVRLib 2.0.1 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTVR.lib 2.1 and later
 }
function QTVRMouseStillDownExtended(qtvr: QTVRInstance; pt: Point; var hotSpotID: UInt32; w: WindowRef; when: UInt32; modifiers: UInt16): OSErr; external name '_QTVRMouseStillDownExtended';

{
 *  QTVRMouseUpExtended()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeVRLib 2.0.1 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTVR.lib 2.1 and later
 }
function QTVRMouseUpExtended(qtvr: QTVRInstance; pt: Point; var hotSpotID: UInt32; w: WindowRef; when: UInt32; modifiers: UInt16): OSErr; external name '_QTVRMouseUpExtended';

{
  =================================================================================================
    Intercept Routines
  -------------------------------------------------------------------------------------------------
}

{
 *  QTVRInstallInterceptProc()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeVRLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTVR.lib 2.1 and later
 }
function QTVRInstallInterceptProc(qtvr: QTVRInstance; selector: QTVRProcSelector; interceptProc: QTVRInterceptUPP; refCon: SInt32; flags: UInt32): OSErr; external name '_QTVRInstallInterceptProc';

{
 *  QTVRCallInterceptedProc()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeVRLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTVR.lib 2.1 and later
 }
function QTVRCallInterceptedProc(qtvr: QTVRInstance; var qtvrMsg: QTVRInterceptRecord): OSErr; external name '_QTVRCallInterceptedProc';

{
  =================================================================================================
    Object Movie Specific Calls
  -------------------------------------------------------------------------------------------------
   QTVRGetCurrentMouseMode requires QTRVR 2.1 (kQTVRAPIMajorVersion02 + kQTVRAPIMinorVersion10)
}
{
 *  QTVRGetCurrentMouseMode()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeVRLib 2.1 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTVR.lib 2.1 and later
 }
function QTVRGetCurrentMouseMode(qtvr: QTVRInstance): UInt32; external name '_QTVRGetCurrentMouseMode';

{
 *  QTVRSetFrameRate()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeVRLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTVR.lib 2.1 and later
 }
function QTVRSetFrameRate(qtvr: QTVRInstance; rate: Single): OSErr; external name '_QTVRSetFrameRate';

{
 *  QTVRGetFrameRate()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeVRLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTVR.lib 2.1 and later
 }
function QTVRGetFrameRate(qtvr: QTVRInstance): Single; external name '_QTVRGetFrameRate';

{
 *  QTVRSetViewRate()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeVRLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTVR.lib 2.1 and later
 }
function QTVRSetViewRate(qtvr: QTVRInstance; rate: Single): OSErr; external name '_QTVRSetViewRate';

{
 *  QTVRGetViewRate()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeVRLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTVR.lib 2.1 and later
 }
function QTVRGetViewRate(qtvr: QTVRInstance): Single; external name '_QTVRGetViewRate';

{
 *  QTVRSetViewCurrentTime()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeVRLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTVR.lib 2.1 and later
 }
function QTVRSetViewCurrentTime(qtvr: QTVRInstance; time: TimeValue): OSErr; external name '_QTVRSetViewCurrentTime';

{
 *  QTVRGetViewCurrentTime()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeVRLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTVR.lib 2.1 and later
 }
function QTVRGetViewCurrentTime(qtvr: QTVRInstance): TimeValue; external name '_QTVRGetViewCurrentTime';

{
 *  QTVRGetCurrentViewDuration()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeVRLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTVR.lib 2.1 and later
 }
function QTVRGetCurrentViewDuration(qtvr: QTVRInstance): TimeValue; external name '_QTVRGetCurrentViewDuration';

{
  =================================================================================================
   View State Calls - QTVR Object Only
  -------------------------------------------------------------------------------------------------
}

{
 *  QTVRSetViewState()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeVRLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTVR.lib 2.1 and later
 }
function QTVRSetViewState(qtvr: QTVRInstance; viewStateType: QTVRViewStateType; state: UInt16): OSErr; external name '_QTVRSetViewState';

{
 *  QTVRGetViewState()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeVRLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTVR.lib 2.1 and later
 }
function QTVRGetViewState(qtvr: QTVRInstance; viewStateType: QTVRViewStateType; var state: UInt16): OSErr; external name '_QTVRGetViewState';

{
 *  QTVRGetViewStateCount()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeVRLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTVR.lib 2.1 and later
 }
function QTVRGetViewStateCount(qtvr: QTVRInstance): UInt16; external name '_QTVRGetViewStateCount';

{
 *  QTVRSetAnimationSetting()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeVRLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTVR.lib 2.1 and later
 }
function QTVRSetAnimationSetting(qtvr: QTVRInstance; setting: QTVRObjectAnimationSetting; enable: boolean): OSErr; external name '_QTVRSetAnimationSetting';

{
 *  QTVRGetAnimationSetting()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeVRLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTVR.lib 2.1 and later
 }
function QTVRGetAnimationSetting(qtvr: QTVRInstance; setting: QTVRObjectAnimationSetting; var enable: boolean): OSErr; external name '_QTVRGetAnimationSetting';

{
 *  QTVRSetControlSetting()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeVRLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTVR.lib 2.1 and later
 }
function QTVRSetControlSetting(qtvr: QTVRInstance; setting: QTVRControlSetting; enable: boolean): OSErr; external name '_QTVRSetControlSetting';

{
 *  QTVRGetControlSetting()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeVRLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTVR.lib 2.1 and later
 }
function QTVRGetControlSetting(qtvr: QTVRInstance; setting: QTVRControlSetting; var enable: boolean): OSErr; external name '_QTVRGetControlSetting';

{
 *  QTVREnableFrameAnimation()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeVRLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTVR.lib 2.1 and later
 }
function QTVREnableFrameAnimation(qtvr: QTVRInstance; enable: boolean): OSErr; external name '_QTVREnableFrameAnimation';

{
 *  QTVRGetFrameAnimation()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeVRLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTVR.lib 2.1 and later
 }
function QTVRGetFrameAnimation(qtvr: QTVRInstance): boolean; external name '_QTVRGetFrameAnimation';

{
 *  QTVREnableViewAnimation()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeVRLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTVR.lib 2.1 and later
 }
function QTVREnableViewAnimation(qtvr: QTVRInstance; enable: boolean): OSErr; external name '_QTVREnableViewAnimation';

{
 *  QTVRGetViewAnimation()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeVRLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTVR.lib 2.1 and later
 }
function QTVRGetViewAnimation(qtvr: QTVRInstance): boolean; external name '_QTVRGetViewAnimation';


{
  =================================================================================================
    Imaging Characteristics
  -------------------------------------------------------------------------------------------------
}

{
 *  QTVRSetVisible()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeVRLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTVR.lib 2.1 and later
 }
function QTVRSetVisible(qtvr: QTVRInstance; visible: boolean): OSErr; external name '_QTVRSetVisible';

{
 *  QTVRGetVisible()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeVRLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTVR.lib 2.1 and later
 }
function QTVRGetVisible(qtvr: QTVRInstance): boolean; external name '_QTVRGetVisible';

{
 *  QTVRSetImagingProperty()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeVRLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTVR.lib 2.1 and later
 }
function QTVRSetImagingProperty(qtvr: QTVRInstance; imagingMode: QTVRImagingMode; imagingProperty: UInt32; propertyValue: SInt32): OSErr; external name '_QTVRSetImagingProperty';

{
 *  QTVRGetImagingProperty()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeVRLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTVR.lib 2.1 and later
 }
function QTVRGetImagingProperty(qtvr: QTVRInstance; imagingMode: QTVRImagingMode; imagingProperty: UInt32; var propertyValue: SInt32): OSErr; external name '_QTVRGetImagingProperty';

{
 *  QTVRUpdate()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeVRLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTVR.lib 2.1 and later
 }
function QTVRUpdate(qtvr: QTVRInstance; imagingMode: QTVRImagingMode): OSErr; external name '_QTVRUpdate';

{
 *  QTVRBeginUpdateStream()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeVRLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTVR.lib 2.1 and later
 }
function QTVRBeginUpdateStream(qtvr: QTVRInstance; imagingMode: QTVRImagingMode): OSErr; external name '_QTVRBeginUpdateStream';

{
 *  QTVREndUpdateStream()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeVRLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTVR.lib 2.1 and later
 }
function QTVREndUpdateStream(qtvr: QTVRInstance): OSErr; external name '_QTVREndUpdateStream';

{
 *  QTVRSetTransitionProperty()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeVRLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTVR.lib 2.1 and later
 }
function QTVRSetTransitionProperty(qtvr: QTVRInstance; transitionType: UInt32; transitionProperty: UInt32; transitionValue: SInt32): OSErr; external name '_QTVRSetTransitionProperty';

{
 *  QTVREnableTransition()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeVRLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTVR.lib 2.1 and later
 }
function QTVREnableTransition(qtvr: QTVRInstance; transitionType: UInt32; enable: boolean): OSErr; external name '_QTVREnableTransition';

{
  =================================================================================================
    Basic Conversion and Math Routines
  -------------------------------------------------------------------------------------------------
}

{
 *  QTVRSetAngularUnits()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeVRLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTVR.lib 2.1 and later
 }
function QTVRSetAngularUnits(qtvr: QTVRInstance; units: QTVRAngularUnits): OSErr; external name '_QTVRSetAngularUnits';

{
 *  QTVRGetAngularUnits()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeVRLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTVR.lib 2.1 and later
 }
function QTVRGetAngularUnits(qtvr: QTVRInstance): QTVRAngularUnits; external name '_QTVRGetAngularUnits';

{  Pano specific routines }
{
 *  QTVRPtToAngles()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeVRLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTVR.lib 2.1 and later
 }
function QTVRPtToAngles(qtvr: QTVRInstance; pt: Point; var panAngle: Single; var tiltAngle: Single): OSErr; external name '_QTVRPtToAngles';

{
 *  QTVRCoordToAngles()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeVRLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTVR.lib 2.1 and later
 }
function QTVRCoordToAngles(qtvr: QTVRInstance; var coord: QTVRFloatPoint; var panAngle: Single; var tiltAngle: Single): OSErr; external name '_QTVRCoordToAngles';

{
 *  QTVRAnglesToCoord()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeVRLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTVR.lib 2.1 and later
 }
function QTVRAnglesToCoord(qtvr: QTVRInstance; panAngle: Single; tiltAngle: Single; var coord: QTVRFloatPoint): OSErr; external name '_QTVRAnglesToCoord';

{  Object specific routines }
{
 *  QTVRPanToColumn()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeVRLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTVR.lib 2.1 and later
 }
function QTVRPanToColumn(qtvr: QTVRInstance; panAngle: Single): SInt16; external name '_QTVRPanToColumn';

{  zero based    }
{
 *  QTVRColumnToPan()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeVRLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTVR.lib 2.1 and later
 }
function QTVRColumnToPan(qtvr: QTVRInstance; column: SInt16): Single; external name '_QTVRColumnToPan';

{  zero based    }
{
 *  QTVRTiltToRow()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeVRLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTVR.lib 2.1 and later
 }
function QTVRTiltToRow(qtvr: QTVRInstance; tiltAngle: Single): SInt16; external name '_QTVRTiltToRow';

{  zero based    }
{
 *  QTVRRowToTilt()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeVRLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTVR.lib 2.1 and later
 }
function QTVRRowToTilt(qtvr: QTVRInstance; row: SInt16): Single; external name '_QTVRRowToTilt';

{  zero based                }
{
 *  QTVRWrapAndConstrain()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeVRLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTVR.lib 2.1 and later
 }
function QTVRWrapAndConstrain(qtvr: QTVRInstance; kind: SInt16; value: Single; var result: Single): OSErr; external name '_QTVRWrapAndConstrain';


{
  =================================================================================================
    Interaction Routines
  -------------------------------------------------------------------------------------------------
}

{
 *  QTVRSetEnteringNodeProc()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeVRLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTVR.lib 2.1 and later
 }
function QTVRSetEnteringNodeProc(qtvr: QTVRInstance; enteringNodeProc: QTVREnteringNodeUPP; refCon: SInt32; flags: UInt32): OSErr; external name '_QTVRSetEnteringNodeProc';

{
 *  QTVRSetLeavingNodeProc()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeVRLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTVR.lib 2.1 and later
 }
function QTVRSetLeavingNodeProc(qtvr: QTVRInstance; leavingNodeProc: QTVRLeavingNodeUPP; refCon: SInt32; flags: UInt32): OSErr; external name '_QTVRSetLeavingNodeProc';

{
 *  QTVRSetInteractionProperty()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeVRLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTVR.lib 2.1 and later
 }
function QTVRSetInteractionProperty(qtvr: QTVRInstance; proprty: UInt32; value: UnivPtr): OSErr; external name '_QTVRSetInteractionProperty';

{
 *  QTVRGetInteractionProperty()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeVRLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTVR.lib 2.1 and later
 }
function QTVRGetInteractionProperty(qtvr: QTVRInstance; proprty: UInt32; value: UnivPtr): OSErr; external name '_QTVRGetInteractionProperty';

{
 *  QTVRReplaceCursor()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeVRLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTVR.lib 2.1 and later
 }
function QTVRReplaceCursor(qtvr: QTVRInstance; var cursRecord: QTVRCursorRecord): OSErr; external name '_QTVRReplaceCursor';

{
  =================================================================================================
    Viewing Limits and Constraints
  -------------------------------------------------------------------------------------------------
}

{
 *  QTVRGetViewingLimits()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeVRLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTVR.lib 2.1 and later
 }
function QTVRGetViewingLimits(qtvr: QTVRInstance; kind: UInt16; var minValue: Single; var maxValue: Single): OSErr; external name '_QTVRGetViewingLimits';

{
 *  QTVRGetConstraintStatus()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeVRLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTVR.lib 2.1 and later
 }
function QTVRGetConstraintStatus(qtvr: QTVRInstance): UInt32; external name '_QTVRGetConstraintStatus';

{
 *  QTVRGetConstraints()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeVRLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTVR.lib 2.1 and later
 }
function QTVRGetConstraints(qtvr: QTVRInstance; kind: UInt16; var minValue: Single; var maxValue: Single): OSErr; external name '_QTVRGetConstraints';

{
 *  QTVRSetConstraints()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeVRLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTVR.lib 2.1 and later
 }
function QTVRSetConstraints(qtvr: QTVRInstance; kind: UInt16; minValue: Single; maxValue: Single): OSErr; external name '_QTVRSetConstraints';


{
  =================================================================================================
    Back Buffer Memory Management
  -------------------------------------------------------------------------------------------------
}

{
 *  QTVRGetAvailableResolutions()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeVRLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTVR.lib 2.1 and later
 }
function QTVRGetAvailableResolutions(qtvr: QTVRInstance; var resolutionsMask: UInt16): OSErr; external name '_QTVRGetAvailableResolutions';

{  These require QTVR 2.1 (kQTVRAPIMajorVersion02 + kQTVRAPIMinorVersion10) }
{
 *  QTVRGetBackBufferMemInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeVRLib 2.1 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTVR.lib 2.1 and later
 }
function QTVRGetBackBufferMemInfo(qtvr: QTVRInstance; geometry: UInt32; resolution: UInt16; cachePixelFormat: UInt32; var minCacheBytes: SInt32; var suggestedCacheBytes: SInt32; var fullCacheBytes: SInt32): OSErr; external name '_QTVRGetBackBufferMemInfo';

{
 *  QTVRGetBackBufferSettings()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeVRLib 2.1 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTVR.lib 2.1 and later
 }
function QTVRGetBackBufferSettings(qtvr: QTVRInstance; var geometry: UInt32; var resolution: UInt16; var cachePixelFormat: UInt32; var cacheSize: SInt16): OSErr; external name '_QTVRGetBackBufferSettings';

{
 *  QTVRSetBackBufferPrefs()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeVRLib 2.1 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTVR.lib 2.1 and later
 }
function QTVRSetBackBufferPrefs(qtvr: QTVRInstance; geometry: UInt32; resolution: UInt16; cachePixelFormat: UInt32; cacheSize: SInt16): OSErr; external name '_QTVRSetBackBufferPrefs';

{
  =================================================================================================
    Buffer Access
  -------------------------------------------------------------------------------------------------
}

{
 *  QTVRSetPrescreenImagingCompleteProc()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeVRLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTVR.lib 2.1 and later
 }
function QTVRSetPrescreenImagingCompleteProc(qtvr: QTVRInstance; imagingCompleteProc: QTVRImagingCompleteUPP; refCon: SInt32; flags: UInt32): OSErr; external name '_QTVRSetPrescreenImagingCompleteProc';

{
 *  QTVRSetBackBufferImagingProc()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeVRLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTVR.lib 2.1 and later
 }
function QTVRSetBackBufferImagingProc(qtvr: QTVRInstance; backBufferImagingProc: QTVRBackBufferImagingUPP; numAreas: UInt16; var areasOfInterest: QTVRAreaOfInterest; refCon: SInt32): OSErr; external name '_QTVRSetBackBufferImagingProc';

{
 *  QTVRRefreshBackBuffer()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeVRLib 2.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTVR.lib 2.1 and later
 }
function QTVRRefreshBackBuffer(qtvr: QTVRInstance; flags: UInt32): OSErr; external name '_QTVRRefreshBackBuffer';



{
  =================================================================================================
    Old Names
  -------------------------------------------------------------------------------------------------
}


{$ALIGN MAC68K}
{#POP}
{unit QuickTimeVRFormat}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}

{  User data type for the Movie Controller type specifier }

const
    kQTControllerType           = $63747970 (* 'ctyp' *);                       {  Atom & ID of where our }
    kQTControllerID             = 1;                            {  ...controller name is stored }

    {  VRWorld atom types }
    kQTVRWorldHeaderAtomType    = $76727363 (* 'vrsc' *);
    kQTVRImagingParentAtomType  = $696D6770 (* 'imgp' *);
    kQTVRPanoImagingAtomType    = $696D706E (* 'impn' *);
    kQTVRObjectImagingAtomType  = $696D6F62 (* 'imob' *);
    kQTVRNodeParentAtomType     = $76726E70 (* 'vrnp' *);
    kQTVRNodeIDAtomType         = $76726E69 (* 'vrni' *);
    kQTVRNodeLocationAtomType   = $6E6C6F63 (* 'nloc' *);
    kQTVRCursorParentAtomType   = $76726370 (* 'vrcp' *);                       {  New with 2.1 }
    kQTVRCursorAtomType         = $43555253 (* 'CURS' *);                       {  New with 2.1 }
    kQTVRColorCursorAtomType    = $63727372 (* 'crsr' *);                       {  New with 2.1 }

    {  NodeInfo atom types }
    kQTVRNodeHeaderAtomType     = $6E646864 (* 'ndhd' *);
    kQTVRHotSpotParentAtomType  = $68737061 (* 'hspa' *);
    kQTVRHotSpotAtomType        = $686F7473 (* 'hots' *);
    kQTVRHotSpotInfoAtomType    = $6873696E (* 'hsin' *);
    kQTVRLinkInfoAtomType       = $6C696E6B (* 'link' *);

    {  Miscellaneous atom types }
    kQTVRStringAtomType         = $76727367 (* 'vrsg' *);
    kQTVRStringEncodingAtomType = $76727365 (* 'vrse' *);                       {  New with 2.1 }
    kQTVRPanoSampleDataAtomType = $70646174 (* 'pdat' *);
    kQTVRObjectInfoAtomType     = $6F626A69 (* 'obji' *);
    kQTVRImageTrackRefAtomType  = $696D7472 (* 'imtr' *);                       {  Parent is kQTVRObjectInfoAtomType. Required if track ref is not 1 as required by 2.0 format. }
    kQTVRHotSpotTrackRefAtomType = $68737472 (* 'hstr' *);                      {  Parent is kQTVRObjectInfoAtomType. Required if track ref is not 1 as required by 2.0 format. }
    kQTVRAngleRangeAtomType     = $61726E67 (* 'arng' *);
    kQTVRTrackRefArrayAtomType  = $74726566 (* 'tref' *);
    kQTVRPanConstraintAtomType  = $70636F6E (* 'pcon' *);
    kQTVRTiltConstraintAtomType = $74636F6E (* 'tcon' *);
    kQTVRFOVConstraintAtomType  = $66636F6E (* 'fcon' *);
    kQTVRCubicViewAtomType      = $63757677 (* 'cuvw' *);                       {  New with 5.0 }
    kQTVRCubicFaceDataAtomType  = $63756661 (* 'cufa' *);                       {  New with 5.0 }

    kQTVRObjectInfoAtomID       = 1;
    kQTVRObjectImageTrackRefAtomID = 1;                         {  New with 2.1, it adds a track reference to select between multiple image tracks }
    kQTVRObjectHotSpotTrackRefAtomID = 1;                       {  New with 2.1, it adds a track reference to select between multiple hotspot tracks }

    {  Track reference types }
    kQTVRImageTrackRefType      = $696D6774 (* 'imgt' *);
    kQTVRHotSpotTrackRefType    = $686F7474 (* 'hott' *);

    {  Old hot spot types }
    kQTVRHotSpotNavigableType   = $6E617667 (* 'navg' *);

    {  Valid bits used in QTVRLinkHotSpotAtom }
    kQTVRValidPan               = $00000001;
    kQTVRValidTilt              = $00000002;
    kQTVRValidFOV               = $00000004;
    kQTVRValidViewCenter        = $00000008;


    {  Values for flags field in QTVRPanoSampleAtom }
    kQTVRPanoFlagHorizontal     = $00000001;
    kQTVRPanoFlagLast           = $80000000;


    {  Values for locationFlags field in QTVRNodeLocationAtom }
    kQTVRSameFile               = 0;


    {  Header for QTVR track's Sample Description record (vrWorld atom container is appended) }

type
    QTVRSampleDescriptionPtr = ^QTVRSampleDescription;
    QTVRSampleDescription = record
        descSize:               UInt32;                                 {  total size of the QTVRSampleDescription }
        descType:               UInt32;                                 {  must be 'qtvr' }
        reserved1:              UInt32;                                 {  must be zero }
        reserved2:              UInt16;                                 {  must be zero }
        dataRefIndex:           UInt16;                                 {  must be zero }
        data:                   UInt32;                                 {  Will be extended to hold vrWorld QTAtomContainer }
    end;

    QTVRSampleDescriptionHandle         = ^QTVRSampleDescriptionPtr;
    {
      =================================================================================================
       Definitions and structures used in the VRWorld QTAtomContainer
      -------------------------------------------------------------------------------------------------
    }

    QTVRStringAtomPtr = ^QTVRStringAtom;
    QTVRStringAtom = record
        stringUsage:            UInt16;
        stringLength:           UInt16;
        theString:              packed array [0..3] of UInt8;           {  field previously named "string" }
    end;


    QTVRWorldHeaderAtomPtr = ^QTVRWorldHeaderAtom;
    QTVRWorldHeaderAtom = record
        majorVersion:           UInt16;
        minorVersion:           UInt16;
        nameAtomID:             QTAtomID;
        defaultNodeID:          UInt32;
        vrWorldFlags:           UInt32;
        reserved1:              UInt32;
        reserved2:              UInt32;
    end;


    {  Valid bits used in QTVRPanoImagingAtom }

const
    kQTVRValidCorrection        = $00000001;
    kQTVRValidQuality           = $00000002;
    kQTVRValidDirectDraw        = $00000004;
    kQTVRValidFirstExtraProperty = $00000008;


type
    QTVRPanoImagingAtomPtr = ^QTVRPanoImagingAtom;
    QTVRPanoImagingAtom = record
        majorVersion:           UInt16;
        minorVersion:           UInt16;
        imagingMode:            UInt32;
        imagingValidFlags:      UInt32;
        correction:             UInt32;
        quality:                UInt32;
        directDraw:             UInt32;
        imagingProperties:      array [0..5] of UInt32;                 {  for future properties }
        reserved1:              UInt32;
        reserved2:              UInt32;
    end;

    QTVRNodeLocationAtomPtr = ^QTVRNodeLocationAtom;
    QTVRNodeLocationAtom = record
        majorVersion:           UInt16;
        minorVersion:           UInt16;
        nodeType:               OSType;
        locationFlags:          UInt32;
        locationData:           UInt32;
        reserved1:              UInt32;
        reserved2:              UInt32;
    end;

    {
      =================================================================================================
       Definitions and structures used in the Nodeinfo QTAtomContainer
      -------------------------------------------------------------------------------------------------
    }

    QTVRNodeHeaderAtomPtr = ^QTVRNodeHeaderAtom;
    QTVRNodeHeaderAtom = record
        majorVersion:           UInt16;
        minorVersion:           UInt16;
        nodeType:               OSType;
        nodeID:                 QTAtomID;
        nameAtomID:             QTAtomID;
        commentAtomID:          QTAtomID;
        reserved1:              UInt32;
        reserved2:              UInt32;
    end;

    QTVRAngleRangeAtomPtr = ^QTVRAngleRangeAtom;
    QTVRAngleRangeAtom = record
        minimumAngle:           Float32;
        maximumAngle:           Float32;
    end;

    QTVRHotSpotInfoAtomPtr = ^QTVRHotSpotInfoAtom;
    QTVRHotSpotInfoAtom = record
        majorVersion:           UInt16;
        minorVersion:           UInt16;
        hotSpotType:            OSType;
        nameAtomID:             QTAtomID;
        commentAtomID:          QTAtomID;
        cursorID:               array [0..2] of SInt32;
                                                                        {  canonical view for this hot spot }
        bestPan:                Float32;
        bestTilt:               Float32;
        bestFOV:                Float32;
        bestViewCenter:         QTVRFloatPoint;
                                                                        {  Bounding box for this hot spot }
        hotSpotRect:            Rect;
        flags:                  UInt32;
        reserved1:              UInt32;
        reserved2:              UInt32;
    end;

    QTVRLinkHotSpotAtomPtr = ^QTVRLinkHotSpotAtom;
    QTVRLinkHotSpotAtom = record
        majorVersion:           UInt16;
        minorVersion:           UInt16;
        toNodeID:               UInt32;
        fromValidFlags:         UInt32;
        fromPan:                Float32;
        fromTilt:               Float32;
        fromFOV:                Float32;
        fromViewCenter:         QTVRFloatPoint;
        toValidFlags:           UInt32;
        toPan:                  Float32;
        toTilt:                 Float32;
        toFOV:                  Float32;
        toViewCenter:           QTVRFloatPoint;
        distance:               Float32;
        flags:                  UInt32;
        reserved1:              UInt32;
        reserved2:              UInt32;
    end;

    {
      =================================================================================================
       Definitions and structures used in Panorama and Object tracks
      -------------------------------------------------------------------------------------------------
    }

    QTVRPanoSampleAtomPtr = ^QTVRPanoSampleAtom;
    QTVRPanoSampleAtom = record
        majorVersion:           UInt16;
        minorVersion:           UInt16;
        imageRefTrackIndex:     UInt32;                                 {  track reference index of the full res image track }
        hotSpotRefTrackIndex:   UInt32;                                 {  track reference index of the full res hot spot track }
        minPan:                 Float32;
        maxPan:                 Float32;
        minTilt:                Float32;
        maxTilt:                Float32;
        minFieldOfView:         Float32;
        maxFieldOfView:         Float32;
        defaultPan:             Float32;
        defaultTilt:            Float32;
        defaultFieldOfView:     Float32;
                                                                        {  Info for highest res version of image track }
        imageSizeX:             UInt32;                                 {  pixel width of the panorama (e.g. 768) }
        imageSizeY:             UInt32;                                 {  pixel height of the panorama (e.g. 2496) }
        imageNumFramesX:        UInt16;                                 {  diced frames wide (e.g. 1) }
        imageNumFramesY:        UInt16;                                 {  diced frames high (e.g. 24) }
                                                                        {  Info for highest res version of hotSpot track }
        hotSpotSizeX:           UInt32;                                 {  pixel width of the hot spot panorama (e.g. 768) }
        hotSpotSizeY:           UInt32;                                 {  pixel height of the hot spot panorama (e.g. 2496) }
        hotSpotNumFramesX:      UInt16;                                 {  diced frames wide (e.g. 1) }
        hotSpotNumFramesY:      UInt16;                                 {  diced frames high (e.g. 24) }
        flags:                  UInt32;
        panoType:               OSType;
        reserved2:              UInt32;
    end;

    {
       View atom for cubes (since same fields in QTVRPanoSampleAtom are set to special
       values for backwards compatibility and hence are ignored by the cubic engine)
    }
    QTVRCubicViewAtomPtr = ^QTVRCubicViewAtom;
    QTVRCubicViewAtom = record
        minPan:                 Float32;
        maxPan:                 Float32;
        minTilt:                Float32;
        maxTilt:                Float32;
        minFieldOfView:         Float32;
        maxFieldOfView:         Float32;
        defaultPan:             Float32;
        defaultTilt:            Float32;
        defaultFieldOfView:     Float32;
    end;

    QTVRCubicFaceDataPtr = ^QTVRCubicFaceData;
    QTVRCubicFaceData = record
        orientation:            array [0..3] of Float32;                {  WXYZ quaternion of absolute orientation }
        center:                 array [0..1] of Float32;                {  Center of image relative to center of projection (default = (0,0)) in normalized units }
        aspect:                 Float32;                                {  aspect>1 => tall pixels; aspect <1 => squat pixels (default = 1) }
        skew:                   Float32;                                {  skew x by y (default = 0) }
    end;

    {  Special resolution values for the Image Track Reference Atoms. Use only one value per track reference. }

const
    kQTVRFullTrackRes           = $00000001;
    kQTVRHalfTrackRes           = $00000002;
    kQTVRQuarterTrackRes        = $00000004;
    kQTVRPreviewTrackRes        = $8000;


type
    QTVRTrackRefEntryPtr = ^QTVRTrackRefEntry;
    QTVRTrackRefEntry = record
        trackRefType:           UInt32;
        trackResolution:        UInt16;
        trackRefIndex:          UInt32;
    end;

    {
      =================================================================================================
       Object File format 2.0
      -------------------------------------------------------------------------------------------------
    }

const
    kQTVRObjectAnimateViewFramesOn = $00000001;
    kQTVRObjectPalindromeViewFramesOn = $00000002;
    kQTVRObjectStartFirstViewFrameOn = $00000004;
    kQTVRObjectAnimateViewsOn   = $00000008;
    kQTVRObjectPalindromeViewsOn = $00000010;
    kQTVRObjectSyncViewToFrameRate = $00000020;
    kQTVRObjectDontLoopViewFramesOn = $00000040;
    kQTVRObjectPlayEveryViewFrameOn = $00000080;
    kQTVRObjectStreamingViewsOn = $00000100;

    kQTVRObjectWrapPanOn        = $00000001;
    kQTVRObjectWrapTiltOn       = $00000002;
    kQTVRObjectCanZoomOn        = $00000004;
    kQTVRObjectReverseHControlOn = $00000008;
    kQTVRObjectReverseVControlOn = $00000010;
    kQTVRObjectSwapHVControlOn  = $00000020;
    kQTVRObjectTranslationOn    = $00000040;

    kGrabberScrollerUI          = 1;                            {  "Object"  }
    kOldJoyStickUI              = 2;                            {   "1.0 Object as Scene"      }
    kJoystickUI                 = 3;                            {  "Object In Scene" }
    kGrabberUI                  = 4;                            {  "Grabber only" }
    kAbsoluteUI                 = 5;                            {  "Absolute pointer" }



type
    QTVRObjectSampleAtomPtr = ^QTVRObjectSampleAtom;
    QTVRObjectSampleAtom = record
        majorVersion:           UInt16;                                 {  kQTVRMajorVersion }
        minorVersion:           UInt16;                                 {  kQTVRMinorVersion }
        movieType:              UInt16;                                 {  ObjectUITypes }
        viewStateCount:         UInt16;                                 {  The number of view states 1 based }
        defaultViewState:       UInt16;                                 {  The default view state number. The number must be 1 to viewStateCount }
        mouseDownViewState:     UInt16;                                 {  The mouse down view state.   The number must be 1 to viewStateCount }
        viewDuration:           UInt32;                                 {  The duration of each view including all animation frames in a view }
        columns:                UInt32;                                 {  Number of columns in movie }
        rows:                   UInt32;                                 {  Number rows in movie }
        mouseMotionScale:       Float32;                                {  180.0 for kStandardObject or kQTVRObjectInScene, actual degrees for kOldNavigableMovieScene. }
        minPan:                 Float32;                                {  Start   horizontal pan angle in degrees }
        maxPan:                 Float32;                                {  End     horizontal pan angle in degrees }
        defaultPan:             Float32;                                {  Initial horizontal pan angle in degrees (poster view) }
        minTilt:                Float32;                                {  Start   vertical   pan angle in degrees }
        maxTilt:                Float32;                                {  End     vertical   pan angle in degrees }
        defaultTilt:            Float32;                                {  Initial vertical   pan angle in degrees (poster view)   }
        minFieldOfView:         Float32;                                {  minimum field of view setting (appears as the maximum zoom effect) must be >= 1 }
        fieldOfView:            Float32;                                {  the field of view range must be >= 1 }
        defaultFieldOfView:     Float32;                                {  must be in minFieldOfView and maxFieldOfView range inclusive }
        defaultViewCenterH:     Float32;
        defaultViewCenterV:     Float32;
        viewRate:               Float32;
        frameRate:              Float32;
        animationSettings:      UInt32;                                 {  32 reserved bit fields }
        controlSettings:        UInt32;                                 {  32 reserved bit fields }
    end;

    {
      =================================================================================================
       QuickTime VR Authoring Components
      -------------------------------------------------------------------------------------------------
    }

    {
       ComponentDescription constants for QTVR Export components
        (componentType = MovieExportType; componentSubType = MovieFileType)
    }

const
    kQTVRFlattenerManufacturer  = $76727765 (* 'vrwe' *);                       {  aka QTVRFlattenerType }
    kQTVRSplitterManufacturer   = $76727370 (* 'vrsp' *);
    kQTVRObjExporterManufacturer = $76726F62 (* 'vrob' *);

    {  QuickTime VR Flattener atom types }
    kQTVRFlattenerSettingsParentAtomType = $56525765 (* 'VRWe' *);              {  parent of settings atoms (other than compression) }
    kQTVRFlattenerPreviewResAtomType = $50526573 (* 'PRes' *);                  {  preview resolution Int16 }
    kQTVRFlattenerImportSpecAtomType = $49537065 (* 'ISpe' *);                  {  import file spec FSSpec }
    kQTVRFlattenerCreatePreviewAtomType = $50726576 (* 'Prev' *);               {  Boolean }
    kQTVRFlattenerImportPreviewAtomType = $49507265 (* 'IPre' *);               {  Boolean }
    kQTVRFlattenerBlurPreviewAtomType = $426C7572 (* 'Blur' *);                 {  Boolean }

    {  QuickTime VR Splitter atom types }
    kQTVRSplitterSettingsParentAtomType = $56525370 (* 'VRSp' *);               {  parent of settings atoms (other than compression) }
    kQTVRSplitterGenerateHTMLAtomType = $4768746D (* 'Ghtm' *);                 {  Boolean }
    kQTVRSplitterOverwriteFilesAtomType = $4F776669 (* 'Owfi' *);               {  Boolean }
    kQTVRSplitterUseFlattenerAtomType = $55736566 (* 'Usef' *);                 {  Boolean }
    kQTVRSplitterShowControllerAtomType = $5368636F (* 'Shco' *);               {  Boolean }
    kQTVRSplitterTargetMyselfAtomType = $5467746D (* 'Tgtm' *);                 {  Boolean }

    {  QuickTime VR Object Exporter atom types }
    kQTVRObjExporterSettingsBlockSize = $6273697A (* 'bsiz' *);                 {  block size for compression }
    kQTVRObjExporterSettingsTargetSize = $7473697A (* 'tsiz' *);                {  target file size }






{$ALIGN MAC68K}
{#POP}
{unit ImageCodec}
{$ALIGN MAC68K}










{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}


{  codec capabilities flags    }

const
    codecCanScale               = $00000001;
    codecCanMask                = $00000002;
    codecCanMatte               = $00000004;
    codecCanTransform           = $00000008;
    codecCanTransferMode        = $00000010;
    codecCanCopyPrev            = $00000020;
    codecCanSpool               = $00000040;
    codecCanClipVertical        = $00000080;
    codecCanClipRectangular     = $00000100;
    codecCanRemapColor          = $00000200;
    codecCanFastDither          = $00000400;
    codecCanSrcExtract          = $00000800;
    codecCanCopyPrevComp        = $00001000;
    codecCanAsync               = $00002000;
    codecCanMakeMask            = $00004000;
    codecCanShift               = $00008000;
    codecCanAsyncWhen           = $00010000;
    codecCanShieldCursor        = $00020000;
    codecCanManagePrevBuffer    = $00040000;
    codecHasVolatileBuffer      = $00080000;                    {  codec requires redraw after window movement  }
    codecWantsRegionMask        = $00100000;
    codecImageBufferIsOnScreen  = $00200000;                    {  old def of codec using overlay surface, = ( codecIsDirectToScreenOnly | codecUsesOverlaySurface | codecImageBufferIsOverlaySurface | codecSrcMustBeImageBuffer )  }
    codecWantsDestinationPixels = $00400000;
    codecWantsSpecialScaling    = $00800000;
    codecHandlesInputs          = $01000000;
    codecCanDoIndirectSurface   = $02000000;                    {  codec can handle indirect surface (GDI)  }
    codecIsSequenceSensitive    = $04000000;
    codecRequiresOffscreen      = $08000000;
    codecRequiresMaskBits       = $10000000;
    codecCanRemapResolution     = $20000000;
    codecIsDirectToScreenOnly   = $40000000;                    {  codec can only decompress data to the screen  }
    codecCanLockSurface         = $80000000;                    {  codec can lock destination surface, icm doesn't lock for you  }

    {     codec capabilities flags2     }
    codecUsesOverlaySurface     = $00000001;                    {  codec uses overlay surface  }
    codecImageBufferIsOverlaySurface = $00000002;               {  codec image buffer is overlay surface, the bits in the buffer are on the screen  }
    codecSrcMustBeImageBuffer   = $00000004;                    {  codec can only source data from an image buffer  }
    codecImageBufferIsInAGPMemory = $00000010;                  {  codec image buffer is in AGP space, byte writes are OK  }
    codecImageBufferIsInPCIMemory = $00000020;                  {  codec image buffer is across a PCI bus; byte writes are bad  }
    codecImageBufferMemoryFlagsValid = $00000040;               {  set by ImageCodecNewImageBufferMemory/NewImageGWorld to indicate that it set the AGP/PCI flags (supported in QuickTime 6.0 and later)  }
    codecDrawsHigherQualityScaled = $00000080;                  {  codec will draw higher-quality image if it performs scaling (eg, wipe effect with border)  }


type
    CodecCapabilitiesPtr = ^CodecCapabilities;
    CodecCapabilities = record
        flags:                  SInt32;
        wantedPixelSize:        SInt16;
        extendWidth:            SInt16;
        extendHeight:           SInt16;
        bandMin:                SInt16;
        bandInc:                SInt16;
        pad:                    SInt16;
        time:                   UInt32;
        flags2:                 SInt32;                             {  field new in QuickTime 4.0  }
    end;

    {     codec condition flags     }

const
    codecConditionFirstBand     = $00000001;
    codecConditionLastBand      = $00000002;
    codecConditionFirstFrame    = $00000004;
    codecConditionNewDepth      = $00000008;
    codecConditionNewTransform  = $00000010;
    codecConditionNewSrcRect    = $00000020;
    codecConditionNewMask       = $00000040;
    codecConditionNewMatte      = $00000080;
    codecConditionNewTransferMode = $00000100;
    codecConditionNewClut       = $00000200;
    codecConditionNewAccuracy   = $00000400;
    codecConditionNewDestination = $00000800;
    codecConditionFirstScreen   = $00001000;
    codecConditionDoCursor      = $00002000;
    codecConditionCatchUpDiff   = $00004000;
    codecConditionMaskMayBeChanged = $00008000;
    codecConditionToBuffer      = $00010000;
    codecConditionCodecChangedMask = $80000000;


    codecInfoResourceType       = $63646369 (* 'cdci' *);                       {  codec info resource type  }
    codecInterfaceVersion       = 2;                            {  high word returned in component GetVersion  }


type
    CDSequenceDataSourceQueueEntryPtr = ^CDSequenceDataSourceQueueEntry;
    CDSequenceDataSourceQueueEntry = record
        nextBusy:               Ptr;
        descSeed:               SInt32;
        dataDesc:               Handle;
        data:                   Ptr;
        dataSize:               SInt32;
        useCount:               SInt32;
        frameTime:              TimeValue;
        frameDuration:          TimeValue;
        timeScale:              TimeValue;
    end;

    CDSequenceDataSourcePtr = ^CDSequenceDataSource;
    CDSequenceDataSource = record
        recordSize:             SInt32;
        next:                   Ptr;
        seqID:                  ImageSequence;
        sourceID:               ImageSequenceDataSource;
        sourceType:             OSType;
        sourceInputNumber:      SInt32;
        dataPtr:                Ptr;
        dataDescription:        Handle;
        changeSeed:             SInt32;
        transferProc:           ICMConvertDataFormatUPP;
        transferRefcon:         Ptr;
        dataSize:               SInt32;
                                                                        {  fields available in QT 3 and later  }
        dataQueue:              QHdrPtr;                                {  queue of CDSequenceDataSourceQueueEntry structures }
        originalDataPtr:        Ptr;
        originalDataSize:       SInt32;
        originalDataDescription: Handle;
        originalDataDescriptionSeed: SInt32;
    end;

    ICMFrameTimeInfoPtr = ^ICMFrameTimeInfo;
    ICMFrameTimeInfo = record
        startTime:              wide;
        scale:                  SInt32;
        duration:               SInt32;
    end;

    CodecCompressParamsPtr = ^CodecCompressParams;
    CodecCompressParams = record
        sequenceID:             ImageSequence;                          {  precompress,bandcompress  }
        imageDescription:       ImageDescriptionHandle;                 {  precompress,bandcompress  }
        data:                   Ptr;
        bufferSize:             SInt32;
        frameNumber:            SInt32;
        startLine:              SInt32;
        stopLine:               SInt32;
        conditionFlags:         SInt32;
        callerFlags:            CodecFlags;
        capabilities:           CodecCapabilitiesPtr;                   {  precompress,bandcompress  }
        progressProcRecord:     ICMProgressProcRecord;
        completionProcRecord:   ICMCompletionProcRecord;
        flushProcRecord:        ICMFlushProcRecord;
        srcPixMap:              PixMap;                                 {  precompress,bandcompress  }
        prevPixMap:             PixMap;
        spatialQuality:         CodecQ;
        temporalQuality:        CodecQ;
        similarity:             Fixed;
        dataRateParams:         DataRateParamsPtr;
        reserved:               SInt32;
                                                                        {  The following fields only exist for QuickTime 2.1 and greater  }
        majorSourceChangeSeed:  UInt16;
        minorSourceChangeSeed:  UInt16;
        sourceData:             CDSequenceDataSourcePtr;
                                                                        {  The following fields only exist for QuickTime 2.5 and greater  }
        preferredPacketSizeInBytes: SInt32;
                                                                        {  The following fields only exist for QuickTime 3.0 and greater  }
        requestedBufferWidth:   SInt32;                             {  must set codecWantsSpecialScaling to indicate this field is valid }
        requestedBufferHeight:  SInt32;                             {  must set codecWantsSpecialScaling to indicate this field is valid }
                                                                        {  The following fields only exist for QuickTime 4.0 and greater  }
        wantedSourcePixelType:  OSType;
                                                                        {  The following fields only exist for QuickTime 5.0 and greater  }
        compressedDataSize:     SInt32;                             {  if nonzero, this overrides (*imageDescription)->dataSize }
        taskWeight:             UInt32;                                 {  preferred weight for MP tasks implementing this operation }
        taskName:               OSType;                                 {  preferred name (type) for MP tasks implementing this operation }
    end;

    CodecDecompressParamsPtr = ^CodecDecompressParams;
    CodecDecompressParams = record
        sequenceID:             ImageSequence;                          {  predecompress,banddecompress  }
        imageDescription:       ImageDescriptionHandle;                 {  predecompress,banddecompress  }
        data:                   Ptr;
        bufferSize:             SInt32;
        frameNumber:            SInt32;
        startLine:              SInt32;
        stopLine:               SInt32;
        conditionFlags:         SInt32;
        callerFlags:            CodecFlags;
        capabilities:           CodecCapabilitiesPtr;                   {  predecompress,banddecompress  }
        progressProcRecord:     ICMProgressProcRecord;
        completionProcRecord:   ICMCompletionProcRecord;
        dataProcRecord:         ICMDataProcRecord;
        port:                   CGrafPtr;                               {  predecompress,banddecompress  }
        dstPixMap:              PixMap;                                 {  predecompress,banddecompress  }
        maskBits:               BitMapPtr;
        mattePixMap:            PixMapPtr;
        srcRect:                Rect;                                   {  predecompress,banddecompress  }
        matrix:                 MatrixRecordPtr;                        {  predecompress,banddecompress  }
        accuracy:               CodecQ;                                 {  predecompress,banddecompress  }
        transferMode:           SInt16;                             {  predecompress,banddecompress  }
        frameTime:              ICMFrameTimePtr;                        {  banddecompress  }
        reserved:               array [0..0] of SInt32;
                                                                        {  The following fields only exist for QuickTime 2.0 and greater  }
        matrixFlags:            SInt8;                                  {  high bit set if 2x resize  }
        matrixType:             SInt8;
        dstRect:                Rect;                                   {  only valid for simple transforms  }
                                                                        {  The following fields only exist for QuickTime 2.1 and greater  }
        majorSourceChangeSeed:  UInt16;
        minorSourceChangeSeed:  UInt16;
        sourceData:             CDSequenceDataSourcePtr;
        maskRegion:             RgnHandle;
                                                                        {  The following fields only exist for QuickTime 2.5 and greater  }
        wantedDestinationPixelTypes: ^OSTypePtr;                        {  Handle to 0-terminated list of OSTypes  }
        screenFloodMethod:      SInt32;
        screenFloodValue:       SInt32;
        preferredOffscreenPixelSize: SInt16;
                                                                        {  The following fields only exist for QuickTime 3.0 and greater  }
        syncFrameTime:          ICMFrameTimeInfoPtr;                    {  banddecompress  }
        needUpdateOnTimeChange: boolean;                                {  banddecompress  }
        enableBlackLining:      boolean;
        needUpdateOnSourceChange: boolean;                              {  band decompress  }
        pad:                    boolean;
        unused:                 SInt32;
        finalDestinationPort:   CGrafPtr;
        requestedBufferWidth:   SInt32;                             {  must set codecWantsSpecialScaling to indicate this field is valid }
        requestedBufferHeight:  SInt32;                             {  must set codecWantsSpecialScaling to indicate this field is valid }
                                                                        {  The following fields only exist for QuickTime 4.0 and greater  }
        displayableAreaOfRequestedBuffer: Rect;                         {  set in predecompress }
        requestedSingleField:   boolean;
        needUpdateOnNextIdle:   boolean;
        pad2:                   array [0..1] of boolean;
        bufferGammaLevel:       Fixed;
                                                                        {  The following fields only exist for QuickTime 5.0 and greater  }
        taskWeight:             UInt32;                                 {  preferred weight for MP tasks implementing this operation }
        taskName:               OSType;                                 {  preferred name (type) for MP tasks implementing this operation }
                                                                        {  The following fields only exist for QuickTime 6.0 and greater  }
        bidirectionalPredictionMode: boolean;
        destinationBufferMemoryPreference: SInt8;                       {  a codec's PreDecompress/Preflight call can set this to express a preference about what kind of memory its destination buffer should go into.  no guarantees. }
        codecBufferMemoryPreference: SInt8;                             {  may indicate preferred kind of memory that NewImageGWorld/NewImageBufferMemory should create its buffer in, if applicable. }
        pad4:                   SInt8;
        mediaContextID:         QTMediaContextID;
    end;


const
    matrixFlagScale2x           = $00000080;
    matrixFlagScale1x           = $00000040;
    matrixFlagScaleHalf         = $00000020;

    kScreenFloodMethodNone      = 0;
    kScreenFloodMethodKeyColor  = 1;
    kScreenFloodMethodAlpha     = 2;

    kFlushLastQueuedFrame       = 0;
    kFlushFirstQueuedFrame      = 1;

    kNewImageGWorldErase        = $00000001;

    {    values for destinationBufferMemoryPreference and codecBufferMemoryPreference   }
    kICMImageBufferNoPreference = 0;
    kICMImageBufferPreferMainMemory = 1;
    kICMImageBufferPreferVideoMemory = 2;


type
    ImageCodecTimeTriggerProcPtr = procedure(refcon: UnivPtr);

    ImageCodecDrawBandCompleteProcPtr = procedure(refcon: UnivPtr; drawBandResult: ComponentResult; drawBandCompleteFlags: UInt32);

    ImageCodecTimeTriggerUPP = ^SInt32; { an opaque UPP }
    ImageCodecDrawBandCompleteUPP = ^SInt32; { an opaque UPP }

const
    uppImageCodecTimeTriggerProcInfo = $000000C0;
    uppImageCodecDrawBandCompleteProcInfo = $00000FC0;
    {
     *  NewImageCodecTimeTriggerUPP()
     *
     *  Availability:
     *    Non-Carbon CFM:   available as macro/inline
     *    CarbonLib:        in CarbonLib 1.0.2 and later
     *    Mac OS X:         in version 10.0 and later
        }
function NewImageCodecTimeTriggerUPP(userRoutine: ImageCodecTimeTriggerProcPtr): ImageCodecTimeTriggerUPP; external name '_NewImageCodecTimeTriggerUPP'; { old name was NewImageCodecTimeTriggerProc }
{
 *  NewImageCodecDrawBandCompleteUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewImageCodecDrawBandCompleteUPP(userRoutine: ImageCodecDrawBandCompleteProcPtr): ImageCodecDrawBandCompleteUPP; external name '_NewImageCodecDrawBandCompleteUPP'; { old name was NewImageCodecDrawBandCompleteProc }
{
 *  DisposeImageCodecTimeTriggerUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeImageCodecTimeTriggerUPP(userUPP: ImageCodecTimeTriggerUPP); external name '_DisposeImageCodecTimeTriggerUPP';
{
 *  DisposeImageCodecDrawBandCompleteUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeImageCodecDrawBandCompleteUPP(userUPP: ImageCodecDrawBandCompleteUPP); external name '_DisposeImageCodecDrawBandCompleteUPP';
{
 *  InvokeImageCodecTimeTriggerUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvokeImageCodecTimeTriggerUPP(refcon: UnivPtr; userRoutine: ImageCodecTimeTriggerUPP); external name '_InvokeImageCodecTimeTriggerUPP'; { old name was CallImageCodecTimeTriggerProc }
{
 *  InvokeImageCodecDrawBandCompleteUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvokeImageCodecDrawBandCompleteUPP(refcon: UnivPtr; drawBandResult: ComponentResult; drawBandCompleteFlags: UInt32; userRoutine: ImageCodecDrawBandCompleteUPP); external name '_InvokeImageCodecDrawBandCompleteUPP'; { old name was CallImageCodecDrawBandCompleteProc }
type
    ImageSubCodecDecompressCapabilitiesPtr = ^ImageSubCodecDecompressCapabilities;
    ImageSubCodecDecompressCapabilities = record
        recordSize:             SInt32;                             {  sizeof(ImageSubCodecDecompressCapabilities) }
        decompressRecordSize:   SInt32;                             {  size of your codec's decompress record }
        canAsync:               boolean;                                {  default true }
        pad0:                   SInt8;
                                                                        {  The following field only exists for QuickTime 4.1 and greater  }
        suggestedQueueSize:     UInt16;
                                                                        {  The following field only exists for QuickTime 4.0 and greater  }
        canProvideTrigger:      boolean;
                                                                        {  The following fields only exist for QuickTime 5.0 and greater  }
        subCodecFlushesScreen:  boolean;                                {  only used on Mac OS X }
        subCodecCallsDrawBandComplete: boolean;
        pad2:                   SInt8;
                                                                        {  The following fields only exist for QuickTime 5.0.1 and greater  }
        isChildCodec:           boolean;                                {  set by base codec before calling Initialize }
        pad3:                   packed array [0..2] of UInt8;
    end;


const
    kCodecFrameTypeUnknown      = 0;
    kCodecFrameTypeKey          = 1;
    kCodecFrameTypeDifference   = 2;
    kCodecFrameTypeDroppableDifference = 3;


type
    ImageSubCodecDecompressRecordPtr = ^ImageSubCodecDecompressRecord;
    ImageSubCodecDecompressRecord = record
        baseAddr:               Ptr;
        rowBytes:               SInt32;
        codecData:              Ptr;
        progressProcRecord:     ICMProgressProcRecord;
        dataProcRecord:         ICMDataProcRecord;
        userDecompressRecord:   Ptr;                                    {  pointer to codec-specific per-band data }
        frameType:              SInt8;
        inhibitMP:              boolean;                                {  set this in BeginBand to tell the base decompressor not to call DrawBand from an MP task for this frame.  (Only has any effect for MP-capable subcodecs.  New in QuickTime 5.0.) }
        pad:                    packed array [0..1] of UInt8;
        priv:                   array [0..1] of SInt32;
                                                                        {  The following fields only exist for QuickTime 5.0 and greater  }
        drawBandCompleteUPP:    ImageCodecDrawBandCompleteUPP;          {  only used if subcodec set subCodecCallsDrawBandComplete; if drawBandCompleteUPP is non-nil, codec must call it when a frame is finished, but may return from DrawBand before the frame is finished.  }
        drawBandCompleteRefCon: Ptr;                                    {  Note: do not call drawBandCompleteUPP directly from a hardware interrupt; instead, use DTInstall to run a function at deferred task time, and call drawBandCompleteUPP from that.  }
    end;

    {
      These data structures are used by code that wants to pass planar pixmap
       information around.
      The structure below gives the basic idea of what is being done.
      Normal instances of code will use a fixed number of planes (eg YUV420 uses
       three planes, Y, U and V). Each such code instance will define its own
       version of the PlanarPixMapInfo struct counting the number of planes it
       needs along with defining constants that specify the meanings of each
       plane.
    }
    PlanarComponentInfoPtr = ^PlanarComponentInfo;
    PlanarComponentInfo = record
        offset:                 SInt32;
        rowBytes:               UInt32;
    end;

    PlanarPixMapInfoPtr = ^PlanarPixMapInfo;
    PlanarPixMapInfo = record
        componentInfo:          array [0..0] of PlanarComponentInfo;
    end;

    PlanarPixmapInfoSorensonYUV9Ptr = ^PlanarPixmapInfoSorensonYUV9;
    PlanarPixmapInfoSorensonYUV9 = record
        componentInfoY:         PlanarComponentInfo;
        componentInfoU:         PlanarComponentInfo;
        componentInfoV:         PlanarComponentInfo;
    end;

    PlanarPixmapInfoYUV420Ptr = ^PlanarPixmapInfoYUV420;
    PlanarPixmapInfoYUV420 = record
        componentInfoY:         PlanarComponentInfo;
        componentInfoCb:        PlanarComponentInfo;
        componentInfoCr:        PlanarComponentInfo;
    end;


const
    codecSuggestedBufferSentinel = $73656E74 (* 'sent' *);                      {  codec public resource containing suggested data pattern to put past end of data buffer  }


    {  name of parameters or effect -- placed in root container, required  }
    kParameterTitleName         = $6E616D65 (* 'name' *);
    kParameterTitleID           = 1;

    {  codec sub-type of parameters or effect -- placed in root container, required  }
    kParameterWhatName          = $77686174 (* 'what' *);
    kParameterWhatID            = 1;

    {  effect version -- placed in root container, optional, but recommended  }
    kParameterVersionName       = $76657273 (* 'vers' *);
    kParameterVersionID         = 1;

    {  is effect repeatable -- placed in root container, optional, default is TRUE }
    kParameterRepeatableName    = $70657465 (* 'pete' *);
    kParameterRepeatableID      = 1;

    kParameterRepeatableTrue    = 1;
    kParameterRepeatableFalse   = 0;

    {  substitution codec in case effect is missing -- placed in root container, recommended  }
    kParameterAlternateCodecName = $73756273 (* 'subs' *);
    kParameterAlternateCodecID  = 1;

    {  maximum number of sources -- placed in root container, required  }
    kParameterSourceCountName   = $73726373 (* 'srcs' *);
    kParameterSourceCountID     = 1;

    {  EFFECT CLASSES }

    {
       The effect major class defines the major grouping of the effect.
       Major classes are defined only by Apple and are not extendable by third
       parties.  Major classes are used for filtering of the effect list by
       applications, but do not define what UI sub-group may or may not be
       presented to the user.  For example, the major class may be a transition,
       but the minor class may be a wipe.
    }

    {
       Effects that fail to include a
       kEffectMajorClassType will be classified as kMiscMajorClass.
    }
    kEffectMajorClassType       = $636C7361 (* 'clsa' *);
    kEffectMajorClassID         = 1;

    kGeneratorMajorClass        = $67656E72 (* 'genr' *);                       {  zero source effects }
    kFilterMajorClass           = $66696C74 (* 'filt' *);                       {  one source effects }
    kTransitionMajorClass       = $7472616E (* 'tran' *);                       {  multisource morph effects  }
    kCompositorMajorClass       = $636F6D70 (* 'comp' *);                       {  multisource layer effects }
    kMiscMajorClass             = $6D697363 (* 'misc' *);                       {  all other effects }

    {
       The effect minor class defines the grouping of effects for the purposes
       of UI.  Apple defines a set of minor classes and will extend it over
       time.  Apple also provides strings within the UI for minor classes
       that it defines.  Third party developers may either classify
       their effects as a type defined by Apple, or may define their own
       minor class.  Effects which define a minor class of their own
       must also then supply a kEffectMinorClassNameType atom.
    }

    {
       If a kEffectMinorClassNameType atom is present, but
       the minor type is one defined by Apple, the Apple supplied
       string will be used in the UI.
    }

    {
       Effects that fail to supply a kEffectMinorClassType will be
       classified as kMiscMinorClass.
    }
    kEffectMinorClassType       = $636C7369 (* 'clsi' *);
    kEffectMinorClassID         = 1;
    kEffectMinorClassNameType   = $636C736E (* 'clsn' *);
    kEffectMinorClassNameID     = 1;

    kGeneratorMinorClass        = $67656E72 (* 'genr' *);                       {  "Generators" }
    kRenderMinorClass           = $72656E64 (* 'rend' *);                       {  "Render" }
    kFilterMinorClass           = $66696C74 (* 'filt' *);                       {  "Filters" }
    kArtisticMinorClass         = $61727473 (* 'arts' *);                       {  "Artistic }
    kBlurMinorClass             = $626C7572 (* 'blur' *);                       {  "Blur" }
    kSharpenMinorClass          = $73687270 (* 'shrp' *);                       {  "Sharpen" }
    kDistortMinorClass          = $64697374 (* 'dist' *);                       {  "Distort" }
    kNoiseMinorClass            = $6E6F6973 (* 'nois' *);                       {  "Noise" }
    kAdjustmentMinorClass       = $61647374 (* 'adst' *);                       {  "Adjustments" }
    kTransitionMinorClass       = $7472616E (* 'tran' *);                       {  "Transitions" }
    kWipeMinorClass             = $77697065 (* 'wipe' *);                       {  "Wipes" }
    k3DMinorClass               = $707A7265 (* 'pzre' *);                       {  "3D Transitions" }
    kCompositorMinorClass       = $636F6D70 (* 'comp' *);                       {  "Compositors" }
    kEffectsMinorClass          = $66786678 (* 'fxfx' *);                       {  "Special Effects" }
    kMiscMinorClass             = $6D697363 (* 'misc' *);                       {  "Miscellaneous" }

    {
       Effects can define a number of "preset" values which will be presented to the user
       in a simplified UI.  Each preset is an atom within the parameter description list
       and must have an atom ID from 1 going up sequentially.  Inside of this atom are three other
       atoms containing:
        1) the name of the preset as a Pascal string
        2) a preview picture for the preset, 86 x 64 pixels in size
        3) the ENTIRE set of parameter values needed to create a sample of this preset.
    }
    kEffectPresetType           = $70656666 (* 'peff' *);
    kPresetNameType             = $706E616D (* 'pnam' *);
    kPresetNameID               = 1;
    kPresetPreviewPictureType   = $70706374 (* 'ppct' *);
    kPresetPreviewPictureID     = 1;
    kPresetSettingsType         = $70737374 (* 'psst' *);
    kPresetSettingsID           = 1;

    kParameterDependencyName    = $64656570 (* 'deep' *);
    kParameterDependencyID      = 1;

    kParameterListDependsUponColorProfiles = $70726F66 (* 'prof' *);
    kParameterListDependsUponFonts = $666F6E74 (* 'font' *);


type
    ParameterDependancyRecordPtr = ^ParameterDependancyRecord;
    ParameterDependancyRecord = record
        dependCount:            SInt32;
        depends:                array [0..0] of OSType;
    end;

    {
       enumeration list in container -- placed in root container, optional unless used by a
       parameter in the list
    }

const
    kParameterEnumList          = $656E756D (* 'enum' *);


type
    EnumValuePairPtr = ^EnumValuePair;
    EnumValuePair = record
        value:                  SInt32;
        name:                   Str255;
    end;

    EnumListRecordPtr = ^EnumListRecord;
    EnumListRecord = record
        enumCount:              SInt32;                             {  number of enumeration items to follow }
        values:                 array [0..0] of EnumValuePair;          {  values and names for them, packed  }
    end;

    {  atom type of parameter }

const
    kParameterAtomTypeAndID     = $74797065 (* 'type' *);

    kNoAtom                     = $6E6F6E65 (* 'none' *);                       {  atom type for no data got/set }
    kAtomNoFlags                = $00000000;
    kAtomNotInterpolated        = $00000001;                    {  atom can never be interpolated }
    kAtomInterpolateIsOptional  = $00000002;                    {  atom can be interpolated, but it is an advanced user operation }
    kAtomMayBeIndexed           = $00000004;                    {  more than one value of atom can exist with accending IDs (ie, lists of colors) }


type
    ParameterAtomTypeAndIDPtr = ^ParameterAtomTypeAndID;
    ParameterAtomTypeAndID = record
        atomType:               QTAtomType;                             {  type of atom this data comes from/goes into }
        atomID:                 QTAtomID;                               {  ID of atom this data comes from/goes into }
        atomFlags:              SInt32;                             {  options for this atom }
        atomName:               Str255;                                 {  name of this value type }
    end;

    {  data type of a parameter }

const
    kParameterDataType          = $64617461 (* 'data' *);

    kParameterTypeDataLong      = 2;                            {  SInt16 value }
    kParameterTypeDataFixed     = 3;                            {  fixed point value }
    kParameterTypeDataRGBValue  = 8;                            {  RGBColor data }
    kParameterTypeDataDouble    = 11;                           {  IEEE 64 bit floating point value }
    kParameterTypeDataText      = $74657874 (* 'text' *);                       {  editable text item }
    kParameterTypeDataEnum      = $656E756D (* 'enum' *);                       {  enumerated lookup value }
    kParameterTypeDataBitField  = $626F6F6C (* 'bool' *);                       {  bit field value (something that holds boolean(s)) }
    kParameterTypeDataImage     = $696D6167 (* 'imag' *);                       {  reference to an image via Picture data }


type
    ParameterDataTypePtr = ^ParameterDataType;
    ParameterDataType = record
        dataType:               OSType;                                 {  type of data this item is stored as }
    end;

    {
       alternate (optional) data type -- main data type always required.
       Must be modified or deleted when modifying main data type.
       Main data type must be modified when alternate is modified.
    }

const
    kParameterAlternateDataType = $616C7431 (* 'alt1' *);
    kParameterTypeDataColorValue = $636D6C72 (* 'cmlr' *);                      {  CMColor data (supported on machines with ColorSync) }
    kParameterTypeDataCubic     = $63756269 (* 'cubi' *);                       {  cubic bezier(s) (no built-in support) }
    kParameterTypeDataNURB      = $6E757262 (* 'nurb' *);                       {  nurb(s) (no built-in support) }


type
    ParameterAlternateDataEntryPtr = ^ParameterAlternateDataEntry;
    ParameterAlternateDataEntry = record
        dataType:               OSType;                                 {  type of data this item is stored as }
        alternateAtom:          QTAtomType;                             {  where to store }
    end;

    ParameterAlternateDataTypePtr = ^ParameterAlternateDataType;
    ParameterAlternateDataType = record
        numEntries:             SInt32;
        entries:                array [0..0] of ParameterAlternateDataEntry;
    end;

    {  legal values for the parameter }

const
    kParameterDataRange         = $72616E67 (* 'rang' *);

    kNoMinimumLongFixed         = $7FFFFFFF;                    {  ignore minimum/maxiumum values }
    kNoMaximumLongFixed         = $80000000;
    kNoScaleLongFixed           = 0;                            {  don't perform any scaling of value }
    kNoPrecision                = -1;                           {  allow as many digits as format }

    {  'text' }

type
    StringRangeRecordPtr = ^StringRangeRecord;
    StringRangeRecord = record
        maxChars:               SInt32;                             {  maximum length of string }
        maxLines:               SInt32;                             {  number of editing lines to use (1 typical, 0 to default) }
    end;

    {  'long' }
    LongRangeRecordPtr = ^LongRangeRecord;
    LongRangeRecord = record
        minValue:               SInt32;                             {  no less than this }
        maxValue:               SInt32;                             {  no more than this }
        scaleValue:             SInt32;                             {  muliply content by this going in, divide going out }
        precisionDigits:        SInt32;                             {  # digits of precision when editing via typing }
    end;

    {  'enum' }
    EnumRangeRecordPtr = ^EnumRangeRecord;
    EnumRangeRecord = record
        enumID:                 SInt32;                             {  'enum' list in root container to search within }
    end;

    {  'fixd' }
    FixedRangeRecordPtr = ^FixedRangeRecord;
    FixedRangeRecord = record
        minValue:               Fixed;                                  {  no less than this }
        maxValue:               Fixed;                                  {  no more than this }
        scaleValue:             Fixed;                                  {  muliply content by this going in, divide going out }
        precisionDigits:        SInt32;                             {  # digits of precision when editing via typing }
    end;

    {  'doub' }
    {  'bool'    }
    BooleanRangeRecordPtr = ^BooleanRangeRecord;
    BooleanRangeRecord = record
        maskValue:              SInt32;                             {  value to mask on/off to set/clear the boolean }
    end;

    {  'rgb ' }
    RGBRangeRecordPtr = ^RGBRangeRecord;
    RGBRangeRecord = record
        minColor:               RGBColor;
        maxColor:               RGBColor;
    end;

    {  'imag' }

const
    kParameterImageNoFlags      = 0;
    kParameterImageIsPreset     = 1;

    kStandardPresetGroup        = $70736574 (* 'pset' *);


type
    ImageRangeRecordPtr = ^ImageRangeRecord;
    ImageRangeRecord = record
        imageFlags:             SInt32;
        fileType:               OSType;                                 {  file type to contain the preset group (normally kStandardPresetGroup) }
        replacedAtoms:          SInt32;                             {  # atoms at this level replaced by this preset group }
    end;

    {  union of all of the above }
    {  UI behavior of a parameter }

const
    kParameterDataBehavior      = $6469746C (* 'ditl' *);

                                                                {  items edited via typing }
    kParameterItemEditText      = $65646974 (* 'edit' *);                       {  edit text box }
    kParameterItemEditLong      = $6C6F6E67 (* 'long' *);                       {  long number editing box }
    kParameterItemEditFixed     = $66697864 (* 'fixd' *);                       {  fixed point number editing box }
    kParameterItemEditDouble    = $646F7562 (* 'doub' *);                       {  double number editing box }
                                                                {  items edited via control(s) }
    kParameterItemPopUp         = $706F7075 (* 'popu' *);                       {  pop up value for enum types }
    kParameterItemRadioCluster  = $72616469 (* 'radi' *);                       {  radio cluster for enum types }
    kParameterItemCheckBox      = $63686578 (* 'chex' *);                       {  check box for booleans }
    kParameterItemControl       = $636E746C (* 'cntl' *);                       {  item controlled via a standard control of some type }
                                                                {  special user items }
    kParameterItemLine          = $6C696E65 (* 'line' *);                       {  line }
    kParameterItemColorPicker   = $7069636B (* 'pick' *);                       {  color swatch & picker }
    kParameterItemGroupDivider  = $64697669 (* 'divi' *);                       {  start of a new group of items }
    kParameterItemStaticText    = $73746174 (* 'stat' *);                       {  display "parameter name" as static text }
    kParameterItemDragImage     = $696D6167 (* 'imag' *);                       {  allow image display, along with drag and drop }
                                                                {  flags valid for lines and groups }
    kGraphicsNoFlags            = $00000000;                    {  no options for graphics }
    kGraphicsFlagsGray          = $00000001;                    {  draw lines with gray }
                                                                {  flags valid for groups }
    kGroupNoFlags               = $00000000;                    {  no options for group -- may be combined with graphics options              }
    kGroupAlignText             = $00010000;                    {  edit text items in group have the same size }
    kGroupSurroundBox           = $00020000;                    {  group should be surrounded with a box }
    kGroupMatrix                = $00040000;                    {  side-by-side arrangement of group is okay }
    kGroupNoName                = $00080000;                    {  name of group should not be displayed above box }
                                                                {  flags valid for popup/radiocluster/checkbox/control }
    kDisableControl             = $00000001;
    kDisableWhenNotEqual        = $00000001;
    kDisableWhenEqual           = $00000011;
    kDisableWhenLessThan        = $00000021;
    kDisableWhenGreaterThan     = $00000031;                    {  flags valid for controls }
    kCustomControl              = $00100000;                    {  flags valid for popups }
    kPopupStoreAsString         = $00010000;


type
    ControlBehaviorsPtr = ^ControlBehaviors;
    ControlBehaviors = record
        groupID:                QTAtomID;                               {  group under control of this item }
        controlValue:           SInt32;                             {  control value for comparison purposes }
    end;

    ParameterDataBehaviorPtr = ^ParameterDataBehavior;
    ParameterDataBehavior = record
        behaviorType:           OSType;
        behaviorFlags:          SInt32;
        case SInt16 of
        0: (
            controls:           ControlBehaviors;
            );
    end;

    {  higher level purpose of a parameter or set of parameters }

const
    kParameterDataUsage         = $75736520 (* 'use ' *);

    kParameterUsagePixels       = $7069786C (* 'pixl' *);
    kParameterUsageRectangle    = $72656374 (* 'rect' *);
    kParameterUsagePoint        = $78792020 (* 'xy  ' *);
    kParameterUsage3DPoint      = $78797A20 (* 'xyz ' *);
    kParameterUsageDegrees      = $64656772 (* 'degr' *);
    kParameterUsageRadians      = $72616473 (* 'rads' *);
    kParameterUsagePercent      = $70636E74 (* 'pcnt' *);
    kParameterUsageSeconds      = $73656373 (* 'secs' *);
    kParameterUsageMilliseconds = $6D736563 (* 'msec' *);
    kParameterUsageMicroseconds = $B5736563 (* 'µsec' *);
    kParameterUsage3by3Matrix   = $33627933 (* '3by3' *);
    kParameterUsageCircularDegrees = $64656763 (* 'degc' *);
    kParameterUsageCircularRadians = $72616463 (* 'radc' *);


type
    ParameterDataUsagePtr = ^ParameterDataUsage;
    ParameterDataUsage = record
        usageType:              OSType;                                 {  higher level purpose of the data or group }
    end;

    {  default value(s) for a parameter }

const
    kParameterDataDefaultItem   = $64666C74 (* 'dflt' *);

    {    atoms that help to fill in data within the info window     }
    kParameterInfoLongName      = $A96E616D (* '©nam' *);
    kParameterInfoCopyright     = $A9637079 (* '©cpy' *);
    kParameterInfoDescription   = $A9696E66 (* '©inf' *);
    kParameterInfoWindowTitle   = $A9776E74 (* '©wnt' *);
    kParameterInfoPicture       = $A9706978 (* '©pix' *);
    kParameterInfoManufacturer  = $A96D616E (* '©man' *);
    kParameterInfoIDs           = 1;

    {    flags for ImageCodecValidateParameters     }
    kParameterValidationNoFlags = $00000000;
    kParameterValidationFinalValidation = $00000001;


type
    QTParameterValidationOptions        = SInt32;
    {  QTAtomTypes for atoms in image compressor settings containers }

const
    kImageCodecSettingsFieldCount = $6669656C (* 'fiel' *);                     {  Number of fields (UInt8)  }
    kImageCodecSettingsFieldOrdering = $66646F6D (* 'fdom' *);                  {  Ordering of fields (UInt8) }
    kImageCodecSettingsFieldOrderingF1F2 = 1;
    kImageCodecSettingsFieldOrderingF2F1 = 2;


    {  Additional Image Description Extensions }
    kColorInfoImageDescriptionExtension = $636F6C72 (* 'colr' *);               {  image description extension describing the color properties     }
    kPixelAspectRatioImageDescriptionExtension = $70617370 (* 'pasp' *);        {  image description extension describing the pixel aspect ratio }
    kCleanApertureImageDescriptionExtension = $636C6170 (* 'clap' *);           {  image description extension describing the pixel aspect ratio }


    {  Color Info Image Description Extension types }
    kVideoColorInfoImageDescriptionExtensionType = $6E636C63 (* 'nclc' *);      {  For video color descriptions (defined below)     }
    kICCProfileColorInfoImageDescriptionExtensionType = $70726F66 (* 'prof' *); {  For ICC Profile color descriptions (not defined here) }


    {  Video Color Info Image Description Extensions }

type
    NCLCColorInfoImageDescriptionExtensionPtr = ^NCLCColorInfoImageDescriptionExtension;
    NCLCColorInfoImageDescriptionExtension = record
        colorParamType:         OSType;                                 {  Type of color parameter 'nclc'                }
        primaries:              UInt16;                                 {  CIE 1931 xy chromaticity coordinates           }
        transferFunction:       UInt16;                                 {  Nonlinear transfer function from RGB to ErEgEb  }
        matrix:                 UInt16;                                 {  Matrix from ErEgEb to EyEcbEcr            }
    end;

    {  Primaries }

const
    kQTPrimaries_ITU_R709_2     = 1;                            {  ITU-R BT.709-2, SMPTE 274M-1995, and SMPTE 296M-1997  }
    kQTPrimaries_Unknown        = 2;                            {  Unknown  }
    kQTPrimaries_EBU_3213       = 5;                            {  EBU Tech. 3213 (1981)  }
    kQTPrimaries_SMPTE_C        = 6;                            {  SMPTE C Primaries from SMPTE RP 145-1993  }

    {  Transfer Function }
    kQTTransferFunction_ITU_R709_2 = 1;                         {  Recommendation ITU-R BT.709-2, SMPTE 274M-1995, SMPTE 296M-1997, SMPTE 293M-1996 and SMPTE 170M-1994  }
    kQTTransferFunction_Unknown = 2;                            {  Unknown  }
    kQTTransferFunction_SMPTE_240M_1995 = 7;                    {  SMPTE 240M-1995 and interim color implementation of SMPTE 274M-1995  }

    {  Matrix }
    kQTMatrix_ITU_R_709_2       = 1;                            {  Recommendation ITU-R BT.709-2 (1125/60/2:1 only), SMPTE 274M-1995 and SMPTE 296M-1997  }
    kQTMatrix_Unknown           = 2;                            {  Unknown  }
    kQTMatrix_ITU_R_601_4       = 6;                            {  Recommendation ITU-R BT.601-4, Recommendation ITU-R BT.470-4 System B and G, SMPTE 170M-1994 and SMPTE 293M-1996  }
    kQTMatrix_SMPTE_240M_1995   = 7;                            {  SMPTE 240M-1995 and interim color implementation of SMPTE 274M-1995  }


    {  Field/Frame Info Image Description (this remaps to FieldInfoImageDescriptionExtension) }

type
    FieldInfoImageDescriptionExtension2Ptr = ^FieldInfoImageDescriptionExtension2;
    FieldInfoImageDescriptionExtension2 = packed record
        fields:                 UInt8;
        detail:                 UInt8;
    end;


const
    kQTFieldsProgressiveScan    = 1;
    kQTFieldsInterlaced         = 2;

    kQTFieldDetailUnknown       = 0;
    kQTFieldDetailTemporalTopFirst = 1;
    kQTFieldDetailTemporalBottomFirst = 6;
    kQTFieldDetailSpatialFirstLineEarly = 9;
    kQTFieldDetailSpatialFirstLineLate = 14;


    {  Pixel Aspect Ratio Image Description Extensions }

type
    PixelAspectRatioImageDescriptionExtensionPtr = ^PixelAspectRatioImageDescriptionExtension;
    PixelAspectRatioImageDescriptionExtension = record
        hSpacing:               UInt32;                                 {  Horizontal Spacing  }
        vSpacing:               UInt32;                                 {  Vertical Spacing  }
    end;

    {  Clean Aperture Image Description Extensions }
    CleanApertureImageDescriptionExtensionPtr = ^CleanApertureImageDescriptionExtension;
    CleanApertureImageDescriptionExtension = record
        cleanApertureWidthN:    UInt32;                                 {  width of clean aperture, numerator, denominator  }
        cleanApertureWidthD:    UInt32;
        cleanApertureHeightN:   UInt32;                                 {  height of clean aperture, numerator, denominator }
        cleanApertureHeightD:   UInt32;
        horizOffN:              UInt32;                                 {  horizontal offset of clean aperture center minus (width-1)/2, numerator, denominator  }
        horizOffD:              UInt32;
        vertOffN:               UInt32;                                 {  vertical offset of clean aperture center minus (height-1)/2, numerator, denominator  }
        vertOffD:               UInt32;
    end;

    ImageCodecMPDrawBandProcPtr = function(refcon: UnivPtr; var drp: ImageSubCodecDecompressRecord): ComponentResult;

    ImageCodecMPDrawBandUPP = ^SInt32; { an opaque UPP }

const
    uppImageCodecMPDrawBandProcInfo = $000003F0;
    {
     *  NewImageCodecMPDrawBandUPP()
     *
     *  Availability:
     *    Non-Carbon CFM:   available as macro/inline
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function NewImageCodecMPDrawBandUPP(userRoutine: ImageCodecMPDrawBandProcPtr): ImageCodecMPDrawBandUPP; external name '_NewImageCodecMPDrawBandUPP'; { old name was NewImageCodecMPDrawBandProc }
{
 *  DisposeImageCodecMPDrawBandUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeImageCodecMPDrawBandUPP(userUPP: ImageCodecMPDrawBandUPP); external name '_DisposeImageCodecMPDrawBandUPP';
{
 *  InvokeImageCodecMPDrawBandUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeImageCodecMPDrawBandUPP(refcon: UnivPtr; var drp: ImageSubCodecDecompressRecord; userRoutine: ImageCodecMPDrawBandUPP): ComponentResult; external name '_InvokeImageCodecMPDrawBandUPP'; { old name was CallImageCodecMPDrawBandProc }
{  codec selectors 0-127 are reserved by Apple }
{  codec selectors 128-191 are subtype specific }
{  codec selectors 192-255 are vendor specific }
{  codec selectors 256-32767 are available for general use }
{  negative selectors are reserved by the Component Manager }
{
 *  ImageCodecGetCodecInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function ImageCodecGetCodecInfo(ci: ComponentInstance; var info: CodecInfo): ComponentResult; external name '_ImageCodecGetCodecInfo';
{
 *  ImageCodecGetCompressionTime()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function ImageCodecGetCompressionTime(ci: ComponentInstance; src: PixMapHandle; const (*var*) srcRect: Rect; depth: SInt16; var spatialQuality: CodecQ; var temporalQuality: CodecQ; var time: UInt32): ComponentResult; external name '_ImageCodecGetCompressionTime';
{
 *  ImageCodecGetMaxCompressionSize()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function ImageCodecGetMaxCompressionSize(ci: ComponentInstance; src: PixMapHandle; const (*var*) srcRect: Rect; depth: SInt16; quality: CodecQ; var size: SInt32): ComponentResult; external name '_ImageCodecGetMaxCompressionSize';
{
 *  ImageCodecPreCompress()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function ImageCodecPreCompress(ci: ComponentInstance; var params: CodecCompressParams): ComponentResult; external name '_ImageCodecPreCompress';
{
 *  ImageCodecBandCompress()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function ImageCodecBandCompress(ci: ComponentInstance; var params: CodecCompressParams): ComponentResult; external name '_ImageCodecBandCompress';
{
 *  ImageCodecPreDecompress()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function ImageCodecPreDecompress(ci: ComponentInstance; var params: CodecDecompressParams): ComponentResult; external name '_ImageCodecPreDecompress';
{
 *  ImageCodecBandDecompress()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function ImageCodecBandDecompress(ci: ComponentInstance; var params: CodecDecompressParams): ComponentResult; external name '_ImageCodecBandDecompress';
{
 *  ImageCodecBusy()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function ImageCodecBusy(ci: ComponentInstance; seq: ImageSequence): ComponentResult; external name '_ImageCodecBusy';
{
 *  ImageCodecGetCompressedImageSize()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function ImageCodecGetCompressedImageSize(ci: ComponentInstance; desc: ImageDescriptionHandle; data: Ptr; bufferSize: SInt32; dataProc: ICMDataProcRecordPtr; var dataSize: SInt32): ComponentResult; external name '_ImageCodecGetCompressedImageSize';
{
 *  ImageCodecGetSimilarity()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function ImageCodecGetSimilarity(ci: ComponentInstance; src: PixMapHandle; const (*var*) srcRect: Rect; desc: ImageDescriptionHandle; data: Ptr; var similarity: Fixed): ComponentResult; external name '_ImageCodecGetSimilarity';
{
 *  ImageCodecTrimImage()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function ImageCodecTrimImage(ci: ComponentInstance; Desc: ImageDescriptionHandle; inData: Ptr; inBufferSize: SInt32; dataProc: ICMDataProcRecordPtr; outData: Ptr; outBufferSize: SInt32; flushProc: ICMFlushProcRecordPtr; var trimRect: Rect; progressProc: ICMProgressProcRecordPtr): ComponentResult; external name '_ImageCodecTrimImage';
{
 *  ImageCodecRequestSettings()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function ImageCodecRequestSettings(ci: ComponentInstance; settings: Handle; var rp: Rect; filterProc: ModalFilterUPP): ComponentResult; external name '_ImageCodecRequestSettings';
{
 *  ImageCodecGetSettings()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function ImageCodecGetSettings(ci: ComponentInstance; settings: Handle): ComponentResult; external name '_ImageCodecGetSettings';
{
 *  ImageCodecSetSettings()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function ImageCodecSetSettings(ci: ComponentInstance; settings: Handle): ComponentResult; external name '_ImageCodecSetSettings';
{
 *  ImageCodecFlush()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function ImageCodecFlush(ci: ComponentInstance): ComponentResult; external name '_ImageCodecFlush';
{
 *  ImageCodecSetTimeCode()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function ImageCodecSetTimeCode(ci: ComponentInstance; timeCodeFormat: UnivPtr; timeCodeTime: UnivPtr): ComponentResult; external name '_ImageCodecSetTimeCode';
{
 *  ImageCodecIsImageDescriptionEquivalent()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function ImageCodecIsImageDescriptionEquivalent(ci: ComponentInstance; newDesc: ImageDescriptionHandle; var equivalent: boolean): ComponentResult; external name '_ImageCodecIsImageDescriptionEquivalent';
{
 *  ImageCodecNewMemory()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function ImageCodecNewMemory(ci: ComponentInstance; var data: Ptr; dataSize: Size; dataUse: SInt32; memoryGoneProc: ICMMemoryDisposedUPP; refCon: UnivPtr): ComponentResult; external name '_ImageCodecNewMemory';
{
 *  ImageCodecDisposeMemory()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function ImageCodecDisposeMemory(ci: ComponentInstance; data: Ptr): ComponentResult; external name '_ImageCodecDisposeMemory';
{
 *  ImageCodecHitTestData()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function ImageCodecHitTestData(ci: ComponentInstance; desc: ImageDescriptionHandle; data: UnivPtr; dataSize: Size; where: Point; var hit: boolean): ComponentResult; external name '_ImageCodecHitTestData';
{
 *  ImageCodecNewImageBufferMemory()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function ImageCodecNewImageBufferMemory(ci: ComponentInstance; var params: CodecDecompressParams; flags: SInt32; memoryGoneProc: ICMMemoryDisposedUPP; refCon: UnivPtr): ComponentResult; external name '_ImageCodecNewImageBufferMemory';
{
 *  ImageCodecExtractAndCombineFields()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function ImageCodecExtractAndCombineFields(ci: ComponentInstance; fieldFlags: SInt32; data1: UnivPtr; dataSize1: SInt32; desc1: ImageDescriptionHandle; data2: UnivPtr; dataSize2: SInt32; desc2: ImageDescriptionHandle; outputData: UnivPtr; var outDataSize: SInt32; descOut: ImageDescriptionHandle): ComponentResult; external name '_ImageCodecExtractAndCombineFields';
{
 *  ImageCodecGetMaxCompressionSizeWithSources()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function ImageCodecGetMaxCompressionSizeWithSources(ci: ComponentInstance; src: PixMapHandle; const (*var*) srcRect: Rect; depth: SInt16; quality: CodecQ; sourceData: CDSequenceDataSourcePtr; var size: SInt32): ComponentResult; external name '_ImageCodecGetMaxCompressionSizeWithSources';
{
 *  ImageCodecSetTimeBase()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function ImageCodecSetTimeBase(ci: ComponentInstance; base: UnivPtr): ComponentResult; external name '_ImageCodecSetTimeBase';
{
 *  ImageCodecSourceChanged()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function ImageCodecSourceChanged(ci: ComponentInstance; majorSourceChangeSeed: UInt32; minorSourceChangeSeed: UInt32; sourceData: CDSequenceDataSourcePtr; var flagsOut: SInt32): ComponentResult; external name '_ImageCodecSourceChanged';
{
 *  ImageCodecFlushFrame()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function ImageCodecFlushFrame(ci: ComponentInstance; flags: UInt32): ComponentResult; external name '_ImageCodecFlushFrame';
{
 *  ImageCodecGetSettingsAsText()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function ImageCodecGetSettingsAsText(ci: ComponentInstance; var text: Handle): ComponentResult; external name '_ImageCodecGetSettingsAsText';
{
 *  ImageCodecGetParameterListHandle()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function ImageCodecGetParameterListHandle(ci: ComponentInstance; var parameterDescriptionHandle: Handle): ComponentResult; external name '_ImageCodecGetParameterListHandle';
{
 *  ImageCodecGetParameterList()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function ImageCodecGetParameterList(ci: ComponentInstance; var parameterDescription: QTAtomContainer): ComponentResult; external name '_ImageCodecGetParameterList';
{
 *  ImageCodecCreateStandardParameterDialog()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function ImageCodecCreateStandardParameterDialog(ci: ComponentInstance; parameterDescription: QTAtomContainer; parameters: QTAtomContainer; dialogOptions: QTParameterDialogOptions; existingDialog: DialogPtr; existingUserItem: SInt16; var createdDialog: QTParameterDialog): ComponentResult; external name '_ImageCodecCreateStandardParameterDialog';
{
 *  ImageCodecIsStandardParameterDialogEvent()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function ImageCodecIsStandardParameterDialogEvent(ci: ComponentInstance; var pEvent: EventRecord; createdDialog: QTParameterDialog): ComponentResult; external name '_ImageCodecIsStandardParameterDialogEvent';
{
 *  ImageCodecDismissStandardParameterDialog()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function ImageCodecDismissStandardParameterDialog(ci: ComponentInstance; createdDialog: QTParameterDialog): ComponentResult; external name '_ImageCodecDismissStandardParameterDialog';
{
 *  ImageCodecStandardParameterDialogDoAction()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function ImageCodecStandardParameterDialogDoAction(ci: ComponentInstance; createdDialog: QTParameterDialog; action: SInt32; params: UnivPtr): ComponentResult; external name '_ImageCodecStandardParameterDialogDoAction';
{
 *  ImageCodecNewImageGWorld()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function ImageCodecNewImageGWorld(ci: ComponentInstance; var params: CodecDecompressParams; var newGW: GWorldPtr; flags: SInt32): ComponentResult; external name '_ImageCodecNewImageGWorld';
{
 *  ImageCodecDisposeImageGWorld()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function ImageCodecDisposeImageGWorld(ci: ComponentInstance; theGW: GWorldPtr): ComponentResult; external name '_ImageCodecDisposeImageGWorld';
{
 *  ImageCodecHitTestDataWithFlags()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function ImageCodecHitTestDataWithFlags(ci: ComponentInstance; desc: ImageDescriptionHandle; data: UnivPtr; dataSize: Size; where: Point; var hit: SInt32; hitFlags: SInt32): ComponentResult; external name '_ImageCodecHitTestDataWithFlags';
{
 *  ImageCodecValidateParameters()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function ImageCodecValidateParameters(ci: ComponentInstance; parameters: QTAtomContainer; validationFlags: QTParameterValidationOptions; errorString: StringPtr): ComponentResult; external name '_ImageCodecValidateParameters';
{
 *  ImageCodecGetBaseMPWorkFunction()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function ImageCodecGetBaseMPWorkFunction(ci: ComponentInstance; var workFunction: ComponentMPWorkFunctionUPP; var refCon: UnivPtr; drawProc: ImageCodecMPDrawBandUPP; drawProcRefCon: UnivPtr): ComponentResult; external name '_ImageCodecGetBaseMPWorkFunction';
{
 *  ImageCodecRequestGammaLevel()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 5.0 and later
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 5.0 and later
 }
function ImageCodecRequestGammaLevel(ci: ComponentInstance; srcGammaLevel: Fixed; dstGammaLevel: Fixed; var codecCanMatch: SInt32): ComponentResult; external name '_ImageCodecRequestGammaLevel';
{
 *  ImageCodecGetSourceDataGammaLevel()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 5.0 and later
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 5.0 and later
 }
function ImageCodecGetSourceDataGammaLevel(ci: ComponentInstance; var sourceDataGammaLevel: Fixed): ComponentResult; external name '_ImageCodecGetSourceDataGammaLevel';
{
 *  ImageCodecGetDecompressLatency()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 5.0 and later
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 5.0 and later
 }
function ImageCodecGetDecompressLatency(ci: ComponentInstance; var latency: TimeRecord): ComponentResult; external name '_ImageCodecGetDecompressLatency';
{
 *  ImageCodecMergeFloatingImageOntoWindow()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 6.0 and later
 *    CarbonLib:        in CarbonLib 1.6 and later
 *    Mac OS X:         in version 10.2 and later
 *    Windows:          in qtmlClient.lib 6.0 and later
 }
function ImageCodecMergeFloatingImageOntoWindow(ci: ComponentInstance; flags: UInt32): ComponentResult; external name '_ImageCodecMergeFloatingImageOntoWindow';
{
 *  ImageCodecRemoveFloatingImage()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 6.0 and later
 *    CarbonLib:        in CarbonLib 1.6 and later
 *    Mac OS X:         in version 10.2 and later
 *    Windows:          in qtmlClient.lib 6.0 and later
 }
function ImageCodecRemoveFloatingImage(ci: ComponentInstance; flags: UInt32): ComponentResult; external name '_ImageCodecRemoveFloatingImage';
{
 *  ImageCodecGetDITLForSize()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 6.0 and later
 *    CarbonLib:        in CarbonLib 1.6 and later
 *    Mac OS X:         in version 10.2 and later
 *    Windows:          in qtmlClient.lib 6.0 and later
 }
function ImageCodecGetDITLForSize(ci: ComponentInstance; var ditl: Handle; var requestedSize: Point): ComponentResult; external name '_ImageCodecGetDITLForSize';
{
 *  ImageCodecDITLInstall()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 6.0 and later
 *    CarbonLib:        in CarbonLib 1.6 and later
 *    Mac OS X:         in version 10.2 and later
 *    Windows:          in qtmlClient.lib 6.0 and later
 }
function ImageCodecDITLInstall(ci: ComponentInstance; d: DialogRef; itemOffset: SInt16): ComponentResult; external name '_ImageCodecDITLInstall';
{
 *  ImageCodecDITLEvent()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 6.0 and later
 *    CarbonLib:        in CarbonLib 1.6 and later
 *    Mac OS X:         in version 10.2 and later
 *    Windows:          in qtmlClient.lib 6.0 and later
 }
function ImageCodecDITLEvent(ci: ComponentInstance; d: DialogRef; itemOffset: SInt16; const (*var*) theEvent: EventRecord; var itemHit: SInt16; var handled: boolean): ComponentResult; external name '_ImageCodecDITLEvent';
{
 *  ImageCodecDITLItem()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 6.0 and later
 *    CarbonLib:        in CarbonLib 1.6 and later
 *    Mac OS X:         in version 10.2 and later
 *    Windows:          in qtmlClient.lib 6.0 and later
 }
function ImageCodecDITLItem(ci: ComponentInstance; d: DialogRef; itemOffset: SInt16; itemNum: SInt16): ComponentResult; external name '_ImageCodecDITLItem';
{
 *  ImageCodecDITLRemove()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 6.0 and later
 *    CarbonLib:        in CarbonLib 1.6 and later
 *    Mac OS X:         in version 10.2 and later
 *    Windows:          in qtmlClient.lib 6.0 and later
 }
function ImageCodecDITLRemove(ci: ComponentInstance; d: DialogRef; itemOffset: SInt16): ComponentResult; external name '_ImageCodecDITLRemove';
{
 *  ImageCodecDITLValidateInput()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 6.0 and later
 *    CarbonLib:        in CarbonLib 1.6 and later
 *    Mac OS X:         in version 10.2 and later
 *    Windows:          in qtmlClient.lib 6.0 and later
 }
function ImageCodecDITLValidateInput(ci: ComponentInstance; var ok: boolean): ComponentResult; external name '_ImageCodecDITLValidateInput';
{
 *  ImageCodecPreflight()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function ImageCodecPreflight(ci: ComponentInstance; var params: CodecDecompressParams): ComponentResult; external name '_ImageCodecPreflight';
{
 *  ImageCodecInitialize()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function ImageCodecInitialize(ci: ComponentInstance; var cap: ImageSubCodecDecompressCapabilities): ComponentResult; external name '_ImageCodecInitialize';
{
 *  ImageCodecBeginBand()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function ImageCodecBeginBand(ci: ComponentInstance; var params: CodecDecompressParams; var drp: ImageSubCodecDecompressRecord; flags: SInt32): ComponentResult; external name '_ImageCodecBeginBand';
{
 *  ImageCodecDrawBand()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function ImageCodecDrawBand(ci: ComponentInstance; var drp: ImageSubCodecDecompressRecord): ComponentResult; external name '_ImageCodecDrawBand';
{
 *  ImageCodecEndBand()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function ImageCodecEndBand(ci: ComponentInstance; var drp: ImageSubCodecDecompressRecord; result: OSErr; flags: SInt32): ComponentResult; external name '_ImageCodecEndBand';
{
 *  ImageCodecQueueStarting()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function ImageCodecQueueStarting(ci: ComponentInstance): ComponentResult; external name '_ImageCodecQueueStarting';
{
 *  ImageCodecQueueStopping()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function ImageCodecQueueStopping(ci: ComponentInstance): ComponentResult; external name '_ImageCodecQueueStopping';
{
 *  ImageCodecDroppingFrame()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function ImageCodecDroppingFrame(ci: ComponentInstance; const (*var*) drp: ImageSubCodecDecompressRecord): ComponentResult; external name '_ImageCodecDroppingFrame';
{
 *  ImageCodecScheduleFrame()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function ImageCodecScheduleFrame(ci: ComponentInstance; const (*var*) drp: ImageSubCodecDecompressRecord; triggerProc: ImageCodecTimeTriggerUPP; triggerProcRefCon: UnivPtr): ComponentResult; external name '_ImageCodecScheduleFrame';
{
 *  ImageCodecCancelTrigger()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function ImageCodecCancelTrigger(ci: ComponentInstance): ComponentResult; external name '_ImageCodecCancelTrigger';
const
    kMotionJPEGTag              = $6D6A7067 (* 'mjpg' *);
    kJPEGQuantizationTablesImageDescriptionExtension = $6D6A7174 (* 'mjqt' *);
    kJPEGHuffmanTablesImageDescriptionExtension = $6D6A6874 (* 'mjht' *);
    kFieldInfoImageDescriptionExtension = $6669656C (* 'fiel' *);               {  image description extension describing the field count and field orderings }

    kFieldOrderUnknown          = 0;
    kFieldsStoredF1F2DisplayedF1F2 = 1;
    kFieldsStoredF1F2DisplayedF2F1 = 2;
    kFieldsStoredF2F1DisplayedF1F2 = 5;
    kFieldsStoredF2F1DisplayedF2F1 = 6;


type
    MotionJPEGApp1MarkerPtr = ^MotionJPEGApp1Marker;
    MotionJPEGApp1Marker = record
        unused:                 SInt32;
        tag:                    SInt32;
        fieldSize:              SInt32;
        paddedFieldSize:        SInt32;
        offsetToNextField:      SInt32;
        qTableOffset:           SInt32;
        huffmanTableOffset:     SInt32;
        sofOffset:              SInt32;
        sosOffset:              SInt32;
        soiOffset:              SInt32;
    end;

    FieldInfoImageDescriptionExtensionPtr = ^FieldInfoImageDescriptionExtension;
    FieldInfoImageDescriptionExtension = packed record
        fieldCount:             UInt8;
        fieldOrderings:         UInt8;
    end;


    {
     *  QTPhotoSetSampling()
     *
     *  Availability:
     *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
     *    Windows:          in qtmlClient.lib 3.0 and later
        }
function QTPhotoSetSampling(codec: ComponentInstance; yH: SInt16; yV: SInt16; cbH: SInt16; cbV: SInt16; crH: SInt16; crV: SInt16): ComponentResult; external name '_QTPhotoSetSampling';
{
 *  QTPhotoSetRestartInterval()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function QTPhotoSetRestartInterval(codec: ComponentInstance; restartInterval: UInt16): ComponentResult; external name '_QTPhotoSetRestartInterval';
{
 *  QTPhotoDefineHuffmanTable()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function QTPhotoDefineHuffmanTable(codec: ComponentInstance; componentNumber: SInt16; isDC: boolean; lengthCounts: UInt8Ptr; values: UInt8Ptr): ComponentResult; external name '_QTPhotoDefineHuffmanTable';
{
 *  QTPhotoDefineQuantizationTable()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function QTPhotoDefineQuantizationTable(codec: ComponentInstance; componentNumber: SInt16; table: UInt8Ptr): ComponentResult; external name '_QTPhotoDefineQuantizationTable';
{ source identifier -- placed in root container of description, one or more required }

const
    kEffectSourceName           = $73726320 (* 'src ' *);


    {    source type -- placed in the input map to identify the source kind     }
    kEffectDataSourceType       = $64747374 (* 'dtst' *);

    {     default effect types  }
    kEffectRawSource            = 0;                            {  the source is raw image data }
    kEffectGenericType          = $67656666 (* 'geff' *);                       {  generic effect for combining others }


type
    EffectSourcePtr = ^EffectSource;
    SourceDataPtr = ^SourceData;
    SourceData = record
        case SInt16 of
        0: (
            image:              CDSequenceDataSourcePtr;
            );
        1: (
            effect:             EffectSourcePtr;
            );
    end;


    EffectSource = record
        effectType:             SInt32;                             {  type of effect or kEffectRawSource if raw ICM data }
        data:                   Ptr;                                    {  track data for this effect }
        source:                 SourceData;                             {  source/effect pointers }
        next:                   EffectSourcePtr;                        {  the next source for the parent effect }
                                                                        {  fields added for QuickTime 4.0 }
        lastTranslatedFrameTime: TimeValue;                             {  start frame time of last converted frame, may be -1 }
        lastFrameDuration:      TimeValue;                              {  duration of the last converted frame, may be zero }
        lastFrameTimeScale:     TimeValue;                              {  time scale of this source frame, only has meaning if above fields are valid }
    end;

    EffectsFrameParamsPtr = ^EffectsFrameParams;
    EffectsFrameParams = record
        frameTime:              ICMFrameTimeRecord;                     {  timing data }
        effectDuration:         SInt32;                             {  the duration of a single effect frame }
        doAsync:                boolean;                                {  set to true if the effect can go async }
        pad:                    packed array [0..2] of UInt8;
        source:                 EffectSourcePtr;                        {  ptr to the source input tree }
        refCon:                 Ptr;                                    {  storage for the effect }
    end;



    {
     *  ImageCodecEffectSetup()
     *
     *  Availability:
     *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
     *    Windows:          in qtmlClient.lib 3.0 and later
        }
function ImageCodecEffectSetup(effect: ComponentInstance; var p: CodecDecompressParams): ComponentResult; external name '_ImageCodecEffectSetup';
{
 *  ImageCodecEffectBegin()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function ImageCodecEffectBegin(effect: ComponentInstance; var p: CodecDecompressParams; ePtr: EffectsFrameParamsPtr): ComponentResult; external name '_ImageCodecEffectBegin';
{
 *  ImageCodecEffectRenderFrame()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function ImageCodecEffectRenderFrame(effect: ComponentInstance; p: EffectsFrameParamsPtr): ComponentResult; external name '_ImageCodecEffectRenderFrame';
{
 *  ImageCodecEffectConvertEffectSourceToFormat()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function ImageCodecEffectConvertEffectSourceToFormat(effect: ComponentInstance; sourceToConvert: EffectSourcePtr; requestedDesc: ImageDescriptionHandle): ComponentResult; external name '_ImageCodecEffectConvertEffectSourceToFormat';
{
 *  ImageCodecEffectCancel()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function ImageCodecEffectCancel(effect: ComponentInstance; p: EffectsFrameParamsPtr): ComponentResult; external name '_ImageCodecEffectCancel';
{
 *  ImageCodecEffectGetSpeed()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function ImageCodecEffectGetSpeed(effect: ComponentInstance; parameters: QTAtomContainer; var pFPS: Fixed): ComponentResult; external name '_ImageCodecEffectGetSpeed';
const
    kSMPTENoFlag                = 0;
    kSMPTESmoothEdgeFlag        = $01;                          {  smooth edges of the stroke }
    kSMPTEStrokeEdgeFlag        = $02;                          {  stroke edge with color }


type
    SMPTEFlags                          = SInt32;
    SMPTEFrameReference                 = SInt32;

const
    kSlideHorizontalWipe        = 1;
    kSlideVerticalWipe          = 2;
    kTopLeftWipe                = 3;
    kTopRightWipe               = 4;
    kBottomRightWipe            = 5;
    kBottomLeftWipe             = 6;
    kFourCornerWipe             = 7;
    kFourBoxWipe                = 8;
    kBarnVerticalWipe           = 21;
    kBarnHorizontalWipe         = 22;
    kTopCenterWipe              = 23;
    kRightCenterWipe            = 24;
    kBottomCenterWipe           = 25;
    kLeftCenterWipe             = 26;
    kDiagonalLeftDownWipe       = 41;
    kDiagonalRightDownWipe      = 42;
    kTopBottomBowTieWipe        = 43;
    kLeftRightBowTieWipe        = 44;
    kDiagonalLeftOutWipe        = 45;
    kDiagonalRightOutWipe       = 46;
    kDiagonalCrossWipe          = 47;
    kDiagonalBoxWipe            = 48;
    kFilledVWipe                = 61;
    kFilledVRightWipe           = 62;
    kFilledVBottomWipe          = 63;
    kFilledVLeftWipe            = 64;
    kHollowVWipe                = 65;
    kHollowVRightWipe           = 66;
    kHollowVBottomWipe          = 67;
    kHollowVLeftWipe            = 68;
    kVerticalZigZagWipe         = 71;
    kHorizontalZigZagWipe       = 72;
    kVerticalBarnZigZagWipe     = 73;
    kHorizontalBarnZigZagWipe   = 74;

    kRectangleWipe              = 101;
    kDiamondWipe                = 102;
    kTriangleWipe               = 103;
    kTriangleRightWipe          = 104;
    kTriangleUpsideDownWipe     = 105;
    kTriangleLeftWipe           = 106;
    kSpaceShipWipe              = 107;
    kSpaceShipRightWipe         = 108;
    kSpaceShipUpsideDownWipe    = 109;
    kSpaceShipLeftWipe          = 110;
    kPentagonWipe               = 111;
    kPentagonUpsideDownWipe     = 112;
    kHexagonWipe                = 113;
    kHexagonSideWipe            = 114;
    kCircleWipe                 = 119;
    kOvalWipe                   = 120;
    kOvalSideWipe               = 121;
    kCatEyeWipe                 = 122;
    kCatEyeSideWipe             = 123;
    kRoundRectWipe              = 124;
    kRoundRectSideWipe          = 125;
    kFourPointStarWipe          = 127;
    kFivePointStarWipe          = 128;
    kStarOfDavidWipe            = 129;
    kHeartWipe                  = 130;
    kKeyholeWipe                = 131;

    kRotatingTopWipe            = 201;
    kRotatingRightWipe          = 202;
    kRotatingBottomWipe         = 203;
    kRotatingLeftWipe           = 204;
    kRotatingTopBottomWipe      = 205;
    kRotatingLeftRightWipe      = 206;
    kRotatingQuadrantWipe       = 207;
    kTopToBottom180Wipe         = 211;
    kRightToLeft180Wipe         = 212;
    kTopToBottom90Wipe          = 213;
    kRightToLeft90Wipe          = 214;
    kTop180Wipe                 = 221;
    kRight180Wipe               = 222;
    kBottom180Wipe              = 223;
    kLeft180Wipe                = 224;
    kCounterRotatingTopBottomWipe = 225;
    kCounterRotatingLeftRightWipe = 226;
    kDoubleRotatingTopBottomWipe = 227;
    kDoubleRotatingLeftRightWipe = 228;
    kVOpenTopWipe               = 231;
    kVOpenRightWipe             = 232;
    kVOpenBottomWipe            = 233;
    kVOpenLeftWipe              = 234;
    kVOpenTopBottomWipe         = 235;
    kVOpenLeftRightWipe         = 236;
    kRotatingTopLeftWipe        = 241;
    kRotatingBottomLeftWipe     = 242;
    kRotatingBottomRightWipe    = 243;
    kRotatingTopRightWipe       = 244;
    kRotatingTopLeftBottomRightWipe = 245;
    kRotatingBottomLeftTopRightWipe = 246;
    kRotatingTopLeftRightWipe   = 251;
    kRotatingLeftTopBottomWipe  = 252;
    kRotatingBottomLeftRightWipe = 253;
    kRotatingRightTopBottomWipe = 254;
    kRotatingDoubleCenterRightWipe = 261;
    kRotatingDoubleCenterTopWipe = 262;
    kRotatingDoubleCenterTopBottomWipe = 263;
    kRotatingDoubleCenterLeftRightWipe = 264;

    kHorizontalMatrixWipe       = 301;
    kVerticalMatrixWipe         = 302;
    kTopLeftDiagonalMatrixWipe  = 303;
    kTopRightDiagonalMatrixWipe = 304;
    kBottomRightDiagonalMatrixWipe = 305;
    kBottomLeftDiagonalMatrixWipe = 306;
    kClockwiseTopLeftMatrixWipe = 310;
    kClockwiseTopRightMatrixWipe = 311;
    kClockwiseBottomRightMatrixWipe = 312;
    kClockwiseBottomLeftMatrixWipe = 313;
    kCounterClockwiseTopLeftMatrixWipe = 314;
    kCounterClockwiseTopRightMatrixWipe = 315;
    kCounterClockwiseBottomRightMatrixWipe = 316;
    kCounterClockwiseBottomLeftMatrixWipe = 317;
    kVerticalStartTopMatrixWipe = 320;
    kVerticalStartBottomMatrixWipe = 321;
    kVerticalStartTopOppositeMatrixWipe = 322;
    kVerticalStartBottomOppositeMatrixWipe = 323;
    kHorizontalStartLeftMatrixWipe = 324;
    kHorizontalStartRightMatrixWipe = 325;
    kHorizontalStartLeftOppositeMatrixWipe = 326;
    kHorizontalStartRightOppositeMatrixWipe = 327;
    kDoubleDiagonalTopRightMatrixWipe = 328;
    kDoubleDiagonalBottomRightMatrixWipe = 329;
    kDoubleSpiralTopMatixWipe   = 340;
    kDoubleSpiralBottomMatixWipe = 341;
    kDoubleSpiralLeftMatixWipe  = 342;
    kDoubleSpiralRightMatixWipe = 343;
    kQuadSpiralVerticalMatixWipe = 344;
    kQuadSpiralHorizontalMatixWipe = 345;
    kVerticalWaterfallLeftMatrixWipe = 350;
    kVerticalWaterfallRightMatrixWipe = 351;
    kHorizontalWaterfallLeftMatrixWipe = 352;
    kHorizontalWaterfallRightMatrixWipe = 353;
    kRandomWipe                 = 409;                          {  non-SMPTE standard numbers }
    kRandomWipeGroupWipe        = 501;
    kRandomIrisGroupWipe        = 502;
    kRandomRadialGroupWipe      = 503;
    kRandomMatrixGroupWipe      = 504;


type
    SMPTEWipeType                       = UInt32;
    {
     *  ImageCodecEffectPrepareSMPTEFrame()
     *
     *  Availability:
     *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
     *    CarbonLib:        in CarbonLib 1.0.2 and later
     *    Mac OS X:         in version 10.0 and later
     *    Windows:          in qtmlClient.lib 4.0 and later
        }
function ImageCodecEffectPrepareSMPTEFrame(effect: ComponentInstance; destPixMap: PixMapPtr; var returnValue: SMPTEFrameReference): ComponentResult; external name '_ImageCodecEffectPrepareSMPTEFrame';
{
 *  ImageCodecEffectDisposeSMPTEFrame()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function ImageCodecEffectDisposeSMPTEFrame(effect: ComponentInstance; frameRef: SMPTEFrameReference): ComponentResult; external name '_ImageCodecEffectDisposeSMPTEFrame';
{
 *  ImageCodecEffectRenderSMPTEFrame()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function ImageCodecEffectRenderSMPTEFrame(effect: ComponentInstance; destPixMap: PixMapPtr; frameRef: SMPTEFrameReference; effectPercentageEven: Fixed; effectPercentageOdd: Fixed; var pSourceRect: Rect; var pMatrix: MatrixRecord; effectNumber: SMPTEWipeType; xRepeat: SInt32; yRepeat: SInt32; flags: SMPTEFlags; penWidth: Fixed; strokeValue: SInt32): ComponentResult; external name '_ImageCodecEffectRenderSMPTEFrame';
{ curve atom types and data structures }

const
    kCurvePathAtom              = $70617468 (* 'path' *);
    kCurveEndAtom               = $7A65726F (* 'zero' *);
    kCurveAntialiasControlAtom  = $616E7469 (* 'anti' *);
    kCurveAntialiasOff          = 0;
    kCurveAntialiasOn           = $FFFFFFFF;
    kCurveFillTypeAtom          = $66696C6C (* 'fill' *);
    kCurvePenThicknessAtom      = $70656E74 (* 'pent' *);
    kCurveMiterLimitAtom        = $6D697472 (* 'mitr' *);
    kCurveJoinAttributesAtom    = $6A6F696E (* 'join' *);
    kCurveMinimumDepthAtom      = $6D696E64 (* 'mind' *);
    kCurveDepthAlwaysOffscreenMask = $80000000;
    kCurveTransferModeAtom      = $78666572 (* 'xfer' *);
    kCurveGradientAngleAtom     = $616E676C (* 'angl' *);
    kCurveGradientRadiusAtom    = $72616469 (* 'radi' *);
    kCurveGradientOffsetAtom    = $63656E74 (* 'cent' *);

    kCurveARGBColorAtom         = $61726762 (* 'argb' *);


type
    ARGBColorPtr = ^ARGBColor;
    ARGBColor = record
        alpha:                  UInt16;
        red:                    UInt16;
        green:                  UInt16;
        blue:                   UInt16;
    end;


const
    kCurveGradientRecordAtom    = $67726164 (* 'grad' *);


type
    GradientColorRecordPtr = ^GradientColorRecord;
    GradientColorRecord = record
        thisColor:              ARGBColor;
        endingPercentage:       Fixed;
    end;

    GradientColorPtr                    = ^GradientColorRecord;

const
    kCurveGradientTypeAtom      = $67726474 (* 'grdt' *);

    {    currently supported gradient types     }
    kLinearGradient             = 0;
    kCircularGradient           = 1;


type
    GradientType                        = SInt32;
    {
     *  CurveGetLength()
     *
     *  Availability:
     *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
     *    Windows:          in qtmlClient.lib 3.0 and later
        }
function CurveGetLength(effect: ComponentInstance; var target: gxPaths; index: SInt32; var wideLength: wide): ComponentResult; external name '_CurveGetLength';
{
 *  CurveLengthToPoint()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function CurveLengthToPoint(effect: ComponentInstance; var target: gxPaths; index: SInt32; length: Fixed; var location: FixedPoint; var tangent: FixedPoint): ComponentResult; external name '_CurveLengthToPoint';
{
 *  CurveNewPath()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function CurveNewPath(effect: ComponentInstance; var pPath: Handle): ComponentResult; external name '_CurveNewPath';
{
 *  CurveCountPointsInPath()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function CurveCountPointsInPath(effect: ComponentInstance; var aPath: gxPaths; contourIndex: UInt32; var pCount: UInt32): ComponentResult; external name '_CurveCountPointsInPath';
{
 *  CurveGetPathPoint()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function CurveGetPathPoint(effect: ComponentInstance; var aPath: gxPaths; contourIndex: UInt32; pointIndex: UInt32; var thePoint: gxPoint; var ptIsOnPath: boolean): ComponentResult; external name '_CurveGetPathPoint';
{
 *  CurveInsertPointIntoPath()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function CurveInsertPointIntoPath(effect: ComponentInstance; var aPoint: gxPoint; thePath: Handle; contourIndex: UInt32; pointIndex: UInt32; ptIsOnPath: boolean): ComponentResult; external name '_CurveInsertPointIntoPath';
{
 *  CurveSetPathPoint()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function CurveSetPathPoint(effect: ComponentInstance; var aPath: gxPaths; contourIndex: UInt32; pointIndex: UInt32; var thePoint: gxPoint; ptIsOnPath: boolean): ComponentResult; external name '_CurveSetPathPoint';
{
 *  CurveGetNearestPathPoint()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function CurveGetNearestPathPoint(effect: ComponentInstance; var aPath: gxPaths; var thePoint: FixedPoint; var contourIndex: UInt32; var pointIndex: UInt32; var theDelta: Fixed): ComponentResult; external name '_CurveGetNearestPathPoint';
{
 *  CurvePathPointToLength()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function CurvePathPointToLength(ci: ComponentInstance; var aPath: gxPaths; startDist: Fixed; endDist: Fixed; var thePoint: FixedPoint; var pLength: Fixed): ComponentResult; external name '_CurvePathPointToLength';
{
 *  CurveCreateVectorStream()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function CurveCreateVectorStream(effect: ComponentInstance; var pStream: Handle): ComponentResult; external name '_CurveCreateVectorStream';
{
 *  CurveAddAtomToVectorStream()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function CurveAddAtomToVectorStream(effect: ComponentInstance; atomType: OSType; atomSize: Size; pAtomData: UnivPtr; vectorStream: Handle): ComponentResult; external name '_CurveAddAtomToVectorStream';
{
 *  CurveAddPathAtomToVectorStream()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function CurveAddPathAtomToVectorStream(effect: ComponentInstance; pathData: Handle; vectorStream: Handle): ComponentResult; external name '_CurveAddPathAtomToVectorStream';
{
 *  CurveAddZeroAtomToVectorStream()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function CurveAddZeroAtomToVectorStream(effect: ComponentInstance; vectorStream: Handle): ComponentResult; external name '_CurveAddZeroAtomToVectorStream';
{
 *  CurveGetAtomDataFromVectorStream()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function CurveGetAtomDataFromVectorStream(effect: ComponentInstance; vectorStream: Handle; atomType: SInt32; var dataSize: SInt32; var dataPtr: Ptr): ComponentResult; external name '_CurveGetAtomDataFromVectorStream';
{ UPP call backs }
{$ALIGN MAC68K}
{#POP}
{unit MediaHandlers}
{$ALIGN MAC68K}










{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}


type
    PrePrerollCompleteProcPtr = procedure(mh: MediaHandler; err: OSErr; refcon: UnivPtr);

    PrePrerollCompleteUPP = ^SInt32; { an opaque UPP }

const
    handlerHasSpatial           = $01;
    handlerCanClip              = $02;
    handlerCanMatte             = $04;
    handlerCanTransferMode      = $08;
    handlerNeedsBuffer          = $10;
    handlerNoIdle               = $20;
    handlerNoScheduler          = $40;
    handlerWantsTime            = $80;
    handlerCGrafPortOnly        = $0100;
    handlerCanSend              = $0200;
    handlerCanHandleComplexMatrix = $0400;
    handlerWantsDestinationPixels = $0800;
    handlerCanSendImageData     = $1000;
    handlerCanPicSave           = $2000;

    {    media task flags   }
    mMustDraw                   = $08;
    mAtEnd                      = $10;
    mPreflightDraw              = $20;
    mSyncDrawing                = $40;
    mPrecompositeOnly           = $0200;
    mSoundOnly                  = $0400;
    mDoIdleActionsBeforeDraws   = $0800;
    mDisableIdleActions         = $1000;

    {    media task result flags    }
    mDidDraw                    = $01;
    mNeedsToDraw                = $04;
    mDrawAgain                  = $08;
    mPartialDraw                = $10;
    mWantIdleActions            = $20;

    forceUpdateRedraw           = $01;
    forceUpdateNewBuffer        = $02;

    {    media hit test flags   }
    mHitTestBounds              = $00000001;                    {     point must only be within targetRefCon's bounding box  }
    mHitTestImage               = $00000002;                    {   point must be within the shape of the targetRefCon's image  }
    mHitTestInvisible           = $00000004;                    {   invisible targetRefCon's may be hit tested  }
    mHitTestIsClick             = $00000008;                    {   for codecs that want mouse events  }

    {    media is opaque flags  }
    mOpaque                     = $00000001;
    mInvisible                  = $00000002;

    {    MediaSetPublicInfo/MediaGetPublicInfo selectors    }
    kMediaQTIdleFrequencySelector = $69646671 (* 'idfq' *);


type
    GetMovieCompleteParamsPtr = ^GetMovieCompleteParams;
    GetMovieCompleteParams = record
        version:                SInt16;
        theMovie:               Movie;
        theTrack:               Track;
        theMedia:               Media;
        movieScale:             TimeScale;
        mediaScale:             TimeScale;
        movieDuration:          TimeValue;
        trackDuration:          TimeValue;
        mediaDuration:          TimeValue;
        effectiveRate:          Fixed;
        timeBase:               TimeBase;
        volume:                 SInt16;
        width:                  Fixed;
        height:                 Fixed;
        trackMovieMatrix:       MatrixRecord;
        moviePort:              CGrafPtr;
        movieGD:                GDHandle;
        trackMatte:             PixMapHandle;
        inputMap:               QTAtomContainer;
        mediaContextID:         QTMediaContextID;
    end;


const
    kMediaVideoParamBrightness  = 1;
    kMediaVideoParamContrast    = 2;
    kMediaVideoParamHue         = 3;
    kMediaVideoParamSharpness   = 4;
    kMediaVideoParamSaturation  = 5;
    kMediaVideoParamBlackLevel  = 6;
    kMediaVideoParamWhiteLevel  = 7;

    {  These are for MediaGetInfo() and MediaSetInfo(). }
    kMHInfoEncodedFrameRate     = $6F726174 (* 'orat' *);                       {  Parameter is a MHInfoEncodedFrameRateRecord*. }

    {  This holds the frame rate at which the track was encoded. }

type
    MHInfoEncodedFrameRateRecordPtr = ^MHInfoEncodedFrameRateRecord;
    MHInfoEncodedFrameRateRecord = record
        encodedFrameRate:       Fixed;
    end;

    dataHandlePtr                       = ^Handle;
    dataHandleHandle                    = ^dataHandlePtr;

    QTCustomActionTargetRecordPtr = ^QTCustomActionTargetRecord;
    QTCustomActionTargetRecord = record
        movie:                  Movie;
        doMCActionCallbackProc: DoMCActionUPP;
        callBackRefcon:         SInt32;
        track:                  Track;
        trackObjectRefCon:      SInt32;
        defaultTrack:           Track;
        defaultObjectRefCon:    SInt32;
        reserved1:              SInt32;
        reserved2:              SInt32;
    end;

    QTCustomActionTargetPtr             = ^QTCustomActionTargetRecord;
    MediaEQSpectrumBandsRecordPtr = ^MediaEQSpectrumBandsRecord;
    MediaEQSpectrumBandsRecord = record
        count:                  SInt16;
        frequency:              UnsignedFixedPtr;                       {  pointer to array of frequencies }
    end;

    {
     *  CallComponentExecuteWiredAction()
     *
     *  Availability:
     *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
     *    CarbonLib:        in CarbonLib 1.0.2 and later
     *    Mac OS X:         in version 10.0 and later
     *    Windows:          in qtmlClient.lib 4.0 and later
        }
function CallComponentExecuteWiredAction(ci: ComponentInstance; actionContainer: QTAtomContainer; actionAtom: QTAtom; target: QTCustomActionTargetPtr; event: QTEventRecordPtr): ComponentResult; external name '_CallComponentExecuteWiredAction';
{ MediaCallRange2 }
{ These are unique to each type of media handler }
{ They are also included in the public interfaces }


{  Flags for MediaSetChunkManagementFlags }

const
    kEmptyPurgableChunksOverAllowance = 1;

    {
     *  MediaSetChunkManagementFlags()
     *
     *  Availability:
     *    Non-Carbon CFM:   in QuickTimeLib 6.0 and later
     *    CarbonLib:        in CarbonLib 1.6 and later
     *    Mac OS X:         in version 10.2 and later
     *    Windows:          in qtmlClient.lib 6.0 and later
        }
function MediaSetChunkManagementFlags(mh: MediaHandler; flags: UInt32; flagsMask: UInt32): ComponentResult; external name '_MediaSetChunkManagementFlags';
{
 *  MediaGetChunkManagementFlags()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 6.0 and later
 *    CarbonLib:        in CarbonLib 1.6 and later
 *    Mac OS X:         in version 10.2 and later
 *    Windows:          in qtmlClient.lib 6.0 and later
 }
function MediaGetChunkManagementFlags(mh: MediaHandler; var flags: UInt32): ComponentResult; external name '_MediaGetChunkManagementFlags';
{
 *  MediaSetPurgeableChunkMemoryAllowance()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 6.0 and later
 *    CarbonLib:        in CarbonLib 1.6 and later
 *    Mac OS X:         in version 10.2 and later
 *    Windows:          in qtmlClient.lib 6.0 and later
 }
function MediaSetPurgeableChunkMemoryAllowance(mh: MediaHandler; allowance: Size): ComponentResult; external name '_MediaSetPurgeableChunkMemoryAllowance';
{
 *  MediaGetPurgeableChunkMemoryAllowance()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 6.0 and later
 *    CarbonLib:        in CarbonLib 1.6 and later
 *    Mac OS X:         in version 10.2 and later
 *    Windows:          in qtmlClient.lib 6.0 and later
 }
function MediaGetPurgeableChunkMemoryAllowance(mh: MediaHandler; var allowance: Size): ComponentResult; external name '_MediaGetPurgeableChunkMemoryAllowance';
{
 *  MediaEmptyAllPurgeableChunks()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 6.0 and later
 *    CarbonLib:        in CarbonLib 1.6 and later
 *    Mac OS X:         in version 10.2 and later
 *    Windows:          in qtmlClient.lib 6.0 and later
 }
function MediaEmptyAllPurgeableChunks(mh: MediaHandler): ComponentResult; external name '_MediaEmptyAllPurgeableChunks';
{**** These are the calls for dealing with the Generic media handler ****}
{
 *  MediaInitialize()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MediaInitialize(mh: MediaHandler; var gmc: GetMovieCompleteParams): ComponentResult; external name '_MediaInitialize';
{
 *  MediaSetHandlerCapabilities()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MediaSetHandlerCapabilities(mh: MediaHandler; flags: SInt32; flagsMask: SInt32): ComponentResult; external name '_MediaSetHandlerCapabilities';
{
 *  MediaIdle()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MediaIdle(mh: MediaHandler; atMediaTime: TimeValue; flagsIn: SInt32; var flagsOut: SInt32; const (*var*) movieTime: TimeRecord): ComponentResult; external name '_MediaIdle';
{
 *  MediaGetMediaInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MediaGetMediaInfo(mh: MediaHandler; h: Handle): ComponentResult; external name '_MediaGetMediaInfo';
{
 *  MediaPutMediaInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MediaPutMediaInfo(mh: MediaHandler; h: Handle): ComponentResult; external name '_MediaPutMediaInfo';
{
 *  MediaSetActive()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MediaSetActive(mh: MediaHandler; enableMedia: boolean): ComponentResult; external name '_MediaSetActive';
{
 *  MediaSetRate()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MediaSetRate(mh: MediaHandler; rate: Fixed): ComponentResult; external name '_MediaSetRate';
{
 *  MediaGGetStatus()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MediaGGetStatus(mh: MediaHandler; var statusErr: ComponentResult): ComponentResult; external name '_MediaGGetStatus';
{
 *  MediaTrackEdited()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MediaTrackEdited(mh: MediaHandler): ComponentResult; external name '_MediaTrackEdited';
{
 *  MediaSetMediaTimeScale()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MediaSetMediaTimeScale(mh: MediaHandler; newTimeScale: TimeScale): ComponentResult; external name '_MediaSetMediaTimeScale';
{
 *  MediaSetMovieTimeScale()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MediaSetMovieTimeScale(mh: MediaHandler; newTimeScale: TimeScale): ComponentResult; external name '_MediaSetMovieTimeScale';
{
 *  MediaSetGWorld()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MediaSetGWorld(mh: MediaHandler; aPort: CGrafPtr; aGD: GDHandle): ComponentResult; external name '_MediaSetGWorld';
{
 *  MediaSetDimensions()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MediaSetDimensions(mh: MediaHandler; width: Fixed; height: Fixed): ComponentResult; external name '_MediaSetDimensions';
{
 *  MediaSetClip()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MediaSetClip(mh: MediaHandler; theClip: RgnHandle): ComponentResult; external name '_MediaSetClip';
{
 *  MediaSetMatrix()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MediaSetMatrix(mh: MediaHandler; var trackMovieMatrix: MatrixRecord): ComponentResult; external name '_MediaSetMatrix';
{
 *  MediaGetTrackOpaque()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MediaGetTrackOpaque(mh: MediaHandler; var trackIsOpaque: boolean): ComponentResult; external name '_MediaGetTrackOpaque';
{
 *  MediaSetGraphicsMode()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MediaSetGraphicsMode(mh: MediaHandler; mode: SInt32; const (*var*) opColor: RGBColor): ComponentResult; external name '_MediaSetGraphicsMode';
{
 *  MediaGetGraphicsMode()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MediaGetGraphicsMode(mh: MediaHandler; var mode: SInt32; var opColor: RGBColor): ComponentResult; external name '_MediaGetGraphicsMode';
{
 *  MediaGSetVolume()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MediaGSetVolume(mh: MediaHandler; volume: SInt16): ComponentResult; external name '_MediaGSetVolume';
{
 *  MediaSetSoundBalance()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MediaSetSoundBalance(mh: MediaHandler; balance: SInt16): ComponentResult; external name '_MediaSetSoundBalance';
{
 *  MediaGetSoundBalance()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MediaGetSoundBalance(mh: MediaHandler; var balance: SInt16): ComponentResult; external name '_MediaGetSoundBalance';
{
 *  MediaGetNextBoundsChange()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MediaGetNextBoundsChange(mh: MediaHandler; var when: TimeValue): ComponentResult; external name '_MediaGetNextBoundsChange';
{
 *  MediaGetSrcRgn()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MediaGetSrcRgn(mh: MediaHandler; rgn: RgnHandle; atMediaTime: TimeValue): ComponentResult; external name '_MediaGetSrcRgn';
{
 *  MediaPreroll()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MediaPreroll(mh: MediaHandler; time: TimeValue; rate: Fixed): ComponentResult; external name '_MediaPreroll';
{
 *  MediaSampleDescriptionChanged()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MediaSampleDescriptionChanged(mh: MediaHandler; index: SInt32): ComponentResult; external name '_MediaSampleDescriptionChanged';
{
 *  MediaHasCharacteristic()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MediaHasCharacteristic(mh: MediaHandler; characteristic: OSType; var hasIt: boolean): ComponentResult; external name '_MediaHasCharacteristic';
{
 *  MediaGetOffscreenBufferSize()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MediaGetOffscreenBufferSize(mh: MediaHandler; var bounds: Rect; depth: SInt16; ctab: CTabHandle): ComponentResult; external name '_MediaGetOffscreenBufferSize';
{
 *  MediaSetHints()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MediaSetHints(mh: MediaHandler; hints: SInt32): ComponentResult; external name '_MediaSetHints';
{
 *  MediaGetName()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MediaGetName(mh: MediaHandler; var name: Str255; requestedLanguage: SInt32; var actualLanguage: SInt32): ComponentResult; external name '_MediaGetName';
{
 *  MediaForceUpdate()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MediaForceUpdate(mh: MediaHandler; forceUpdateFlags: SInt32): ComponentResult; external name '_MediaForceUpdate';
{
 *  MediaGetDrawingRgn()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MediaGetDrawingRgn(mh: MediaHandler; var partialRgn: RgnHandle): ComponentResult; external name '_MediaGetDrawingRgn';
{
 *  MediaGSetActiveSegment()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MediaGSetActiveSegment(mh: MediaHandler; activeStart: TimeValue; activeDuration: TimeValue): ComponentResult; external name '_MediaGSetActiveSegment';
{
 *  MediaInvalidateRegion()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MediaInvalidateRegion(mh: MediaHandler; invalRgn: RgnHandle): ComponentResult; external name '_MediaInvalidateRegion';
{
 *  MediaGetNextStepTime()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MediaGetNextStepTime(mh: MediaHandler; flags: SInt16; mediaTimeIn: TimeValue; var mediaTimeOut: TimeValue; rate: Fixed): ComponentResult; external name '_MediaGetNextStepTime';
{
 *  MediaSetNonPrimarySourceData()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MediaSetNonPrimarySourceData(mh: MediaHandler; inputIndex: SInt32; dataDescriptionSeed: SInt32; dataDescription: Handle; data: UnivPtr; dataSize: SInt32; asyncCompletionProc: ICMCompletionProcRecordPtr; transferProc: ICMConvertDataFormatUPP; refCon: UnivPtr): ComponentResult; external name '_MediaSetNonPrimarySourceData';
{
 *  MediaChangedNonPrimarySource()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MediaChangedNonPrimarySource(mh: MediaHandler; inputIndex: SInt32): ComponentResult; external name '_MediaChangedNonPrimarySource';
{
 *  MediaTrackReferencesChanged()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MediaTrackReferencesChanged(mh: MediaHandler): ComponentResult; external name '_MediaTrackReferencesChanged';
{
 *  MediaGetSampleDataPointer()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MediaGetSampleDataPointer(mh: MediaHandler; sampleNum: SInt32; var dataPtr: Ptr; var dataSize: SInt32; var sampleDescIndex: SInt32): ComponentResult; external name '_MediaGetSampleDataPointer';
{
 *  MediaReleaseSampleDataPointer()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MediaReleaseSampleDataPointer(mh: MediaHandler; sampleNum: SInt32): ComponentResult; external name '_MediaReleaseSampleDataPointer';
{
 *  MediaTrackPropertyAtomChanged()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MediaTrackPropertyAtomChanged(mh: MediaHandler): ComponentResult; external name '_MediaTrackPropertyAtomChanged';
{
 *  MediaSetTrackInputMapReference()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MediaSetTrackInputMapReference(mh: MediaHandler; inputMap: QTAtomContainer): ComponentResult; external name '_MediaSetTrackInputMapReference';
{
 *  MediaSetVideoParam()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MediaSetVideoParam(mh: MediaHandler; whichParam: SInt32; var value: UInt16): ComponentResult; external name '_MediaSetVideoParam';
{
 *  MediaGetVideoParam()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MediaGetVideoParam(mh: MediaHandler; whichParam: SInt32; var value: UInt16): ComponentResult; external name '_MediaGetVideoParam';
{
 *  MediaCompare()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MediaCompare(mh: MediaHandler; var isOK: boolean; srcMedia: Media; srcMediaComponent: ComponentInstance): ComponentResult; external name '_MediaCompare';
{
 *  MediaGetClock()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MediaGetClock(mh: MediaHandler; var clock: ComponentInstance): ComponentResult; external name '_MediaGetClock';
{
 *  MediaSetSoundOutputComponent()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MediaSetSoundOutputComponent(mh: MediaHandler; outputComponent: Component): ComponentResult; external name '_MediaSetSoundOutputComponent';
{
 *  MediaGetSoundOutputComponent()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MediaGetSoundOutputComponent(mh: MediaHandler; var outputComponent: Component): ComponentResult; external name '_MediaGetSoundOutputComponent';
{
 *  MediaSetSoundLocalizationData()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MediaSetSoundLocalizationData(mh: MediaHandler; data: Handle): ComponentResult; external name '_MediaSetSoundLocalizationData';
{
 *  MediaGetInvalidRegion()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MediaGetInvalidRegion(mh: MediaHandler; rgn: RgnHandle): ComponentResult; external name '_MediaGetInvalidRegion';
{
 *  MediaSampleDescriptionB2N()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MediaSampleDescriptionB2N(mh: MediaHandler; sampleDescriptionH: SampleDescriptionHandle): ComponentResult; external name '_MediaSampleDescriptionB2N';
{
 *  MediaSampleDescriptionN2B()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MediaSampleDescriptionN2B(mh: MediaHandler; sampleDescriptionH: SampleDescriptionHandle): ComponentResult; external name '_MediaSampleDescriptionN2B';
{
 *  MediaQueueNonPrimarySourceData()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MediaQueueNonPrimarySourceData(mh: MediaHandler; inputIndex: SInt32; dataDescriptionSeed: SInt32; dataDescription: Handle; data: UnivPtr; dataSize: SInt32; asyncCompletionProc: ICMCompletionProcRecordPtr; const (*var*) frameTime: ICMFrameTimeRecord; transferProc: ICMConvertDataFormatUPP; refCon: UnivPtr): ComponentResult; external name '_MediaQueueNonPrimarySourceData';
{
 *  MediaFlushNonPrimarySourceData()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MediaFlushNonPrimarySourceData(mh: MediaHandler; inputIndex: SInt32): ComponentResult; external name '_MediaFlushNonPrimarySourceData';
{
 *  MediaGetURLLink()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MediaGetURLLink(mh: MediaHandler; displayWhere: Point; var urlLink: Handle): ComponentResult; external name '_MediaGetURLLink';
{
 *  MediaMakeMediaTimeTable()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MediaMakeMediaTimeTable(mh: MediaHandler; var offsets: SInt32Ptr; startTime: TimeValue; endTime: TimeValue; timeIncrement: TimeValue; firstDataRefIndex: SInt16; lastDataRefIndex: SInt16; var retDataRefSkew: SInt32): ComponentResult; external name '_MediaMakeMediaTimeTable';
{
 *  MediaHitTestForTargetRefCon()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MediaHitTestForTargetRefCon(mh: MediaHandler; flags: SInt32; loc: Point; var targetRefCon: SInt32): ComponentResult; external name '_MediaHitTestForTargetRefCon';
{
 *  MediaHitTestTargetRefCon()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MediaHitTestTargetRefCon(mh: MediaHandler; targetRefCon: SInt32; flags: SInt32; loc: Point; var wasHit: boolean): ComponentResult; external name '_MediaHitTestTargetRefCon';
{
 *  MediaGetActionsForQTEvent()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MediaGetActionsForQTEvent(mh: MediaHandler; event: QTEventRecordPtr; targetRefCon: SInt32; var container: QTAtomContainer; var atom: QTAtom): ComponentResult; external name '_MediaGetActionsForQTEvent';
{
 *  MediaDisposeTargetRefCon()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MediaDisposeTargetRefCon(mh: MediaHandler; targetRefCon: SInt32): ComponentResult; external name '_MediaDisposeTargetRefCon';
{
 *  MediaTargetRefConsEqual()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MediaTargetRefConsEqual(mh: MediaHandler; firstRefCon: SInt32; secondRefCon: SInt32; var equal: boolean): ComponentResult; external name '_MediaTargetRefConsEqual';
{
 *  MediaSetActionsCallback()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MediaSetActionsCallback(mh: MediaHandler; actionsCallbackProc: ActionsUPP; refcon: UnivPtr): ComponentResult; external name '_MediaSetActionsCallback';
{
 *  MediaPrePrerollBegin()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MediaPrePrerollBegin(mh: MediaHandler; time: TimeValue; rate: Fixed; completeProc: PrePrerollCompleteUPP; refcon: UnivPtr): ComponentResult; external name '_MediaPrePrerollBegin';
{
 *  MediaPrePrerollCancel()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MediaPrePrerollCancel(mh: MediaHandler; refcon: UnivPtr): ComponentResult; external name '_MediaPrePrerollCancel';
{
 *  MediaEnterEmptyEdit()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MediaEnterEmptyEdit(mh: MediaHandler): ComponentResult; external name '_MediaEnterEmptyEdit';
{
 *  MediaCurrentMediaQueuedData()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MediaCurrentMediaQueuedData(mh: MediaHandler; var milliSecs: SInt32): ComponentResult; external name '_MediaCurrentMediaQueuedData';
{
 *  MediaGetEffectiveVolume()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function MediaGetEffectiveVolume(mh: MediaHandler; var volume: SInt16): ComponentResult; external name '_MediaGetEffectiveVolume';
{
 *  MediaResolveTargetRefCon()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function MediaResolveTargetRefCon(mh: MediaHandler; container: QTAtomContainer; atom: QTAtom; var targetRefCon: SInt32): ComponentResult; external name '_MediaResolveTargetRefCon';
{
 *  MediaGetSoundLevelMeteringEnabled()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function MediaGetSoundLevelMeteringEnabled(mh: MediaHandler; var enabled: boolean): ComponentResult; external name '_MediaGetSoundLevelMeteringEnabled';
{
 *  MediaSetSoundLevelMeteringEnabled()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function MediaSetSoundLevelMeteringEnabled(mh: MediaHandler; enable: boolean): ComponentResult; external name '_MediaSetSoundLevelMeteringEnabled';
{
 *  MediaGetSoundLevelMeterInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function MediaGetSoundLevelMeterInfo(mh: MediaHandler; levelInfo: LevelMeterInfoPtr): ComponentResult; external name '_MediaGetSoundLevelMeterInfo';
{
 *  MediaGetEffectiveSoundBalance()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function MediaGetEffectiveSoundBalance(mh: MediaHandler; var balance: SInt16): ComponentResult; external name '_MediaGetEffectiveSoundBalance';
{
 *  MediaSetScreenLock()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function MediaSetScreenLock(mh: MediaHandler; lockIt: boolean): ComponentResult; external name '_MediaSetScreenLock';
{
 *  MediaSetDoMCActionCallback()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function MediaSetDoMCActionCallback(mh: MediaHandler; doMCActionCallbackProc: DoMCActionUPP; refcon: UnivPtr): ComponentResult; external name '_MediaSetDoMCActionCallback';
{
 *  MediaGetErrorString()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function MediaGetErrorString(mh: MediaHandler; theError: ComponentResult; var errorString: Str255): ComponentResult; external name '_MediaGetErrorString';
{
 *  MediaGetSoundEqualizerBands()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function MediaGetSoundEqualizerBands(mh: MediaHandler; spectrumInfo: MediaEQSpectrumBandsRecordPtr): ComponentResult; external name '_MediaGetSoundEqualizerBands';
{
 *  MediaSetSoundEqualizerBands()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function MediaSetSoundEqualizerBands(mh: MediaHandler; spectrumInfo: MediaEQSpectrumBandsRecordPtr): ComponentResult; external name '_MediaSetSoundEqualizerBands';
{
 *  MediaGetSoundEqualizerBandLevels()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function MediaGetSoundEqualizerBandLevels(mh: MediaHandler; var bandLevels: UInt8): ComponentResult; external name '_MediaGetSoundEqualizerBandLevels';
{
 *  MediaDoIdleActions()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function MediaDoIdleActions(mh: MediaHandler): ComponentResult; external name '_MediaDoIdleActions';
{
 *  MediaSetSoundBassAndTreble()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function MediaSetSoundBassAndTreble(mh: MediaHandler; bass: SInt16; treble: SInt16): ComponentResult; external name '_MediaSetSoundBassAndTreble';
{
 *  MediaGetSoundBassAndTreble()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function MediaGetSoundBassAndTreble(mh: MediaHandler; var bass: SInt16; var treble: SInt16): ComponentResult; external name '_MediaGetSoundBassAndTreble';
{
 *  MediaTimeBaseChanged()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function MediaTimeBaseChanged(mh: MediaHandler): ComponentResult; external name '_MediaTimeBaseChanged';
{
 *  MediaMCIsPlayerEvent()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.1 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.1 and later
 }
function MediaMCIsPlayerEvent(mh: MediaHandler; const (*var*) e: EventRecord; var handledIt: boolean): ComponentResult; external name '_MediaMCIsPlayerEvent';
{
 *  MediaGetMediaLoadState()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.1 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.1 and later
 }
function MediaGetMediaLoadState(mh: MediaHandler; var mediaLoadState: SInt32): ComponentResult; external name '_MediaGetMediaLoadState';
{
 *  MediaVideoOutputChanged()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 5.0 and later
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 5.0 and later
 }
function MediaVideoOutputChanged(mh: MediaHandler; vout: ComponentInstance): ComponentResult; external name '_MediaVideoOutputChanged';
{
 *  MediaEmptySampleCache()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 5.0 and later
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 5.0 and later
 }
function MediaEmptySampleCache(mh: MediaHandler; sampleNum: SInt32; sampleCount: SInt32): ComponentResult; external name '_MediaEmptySampleCache';
{
 *  MediaGetPublicInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 5.0 and later
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 5.0 and later
 }
function MediaGetPublicInfo(mh: MediaHandler; infoSelector: OSType; infoDataPtr: UnivPtr; var ioDataSize: Size): ComponentResult; external name '_MediaGetPublicInfo';
{
 *  MediaSetPublicInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 5.0 and later
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 5.0 and later
 }
function MediaSetPublicInfo(mh: MediaHandler; infoSelector: OSType; infoDataPtr: UnivPtr; dataSize: Size): ComponentResult; external name '_MediaSetPublicInfo';
{
 *  MediaGetUserPreferredCodecs()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 5.0 and later
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 5.0 and later
 }
function MediaGetUserPreferredCodecs(mh: MediaHandler; var userPreferredCodecs: CodecComponentHandle): ComponentResult; external name '_MediaGetUserPreferredCodecs';
{
 *  MediaSetUserPreferredCodecs()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 5.0 and later
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 5.0 and later
 }
function MediaSetUserPreferredCodecs(mh: MediaHandler; userPreferredCodecs: CodecComponentHandle): ComponentResult; external name '_MediaSetUserPreferredCodecs';
{  Keyboard Focus Support }

{
 *  MediaRefConSetProperty()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 6.0 and later
 *    CarbonLib:        in CarbonLib 1.6 and later
 *    Mac OS X:         in version 10.2 and later
 *    Windows:          in qtmlClient.lib 6.0 and later
 }
function MediaRefConSetProperty(mh: MediaHandler; refCon: SInt32; propertyType: SInt32; propertyValue: UnivPtr): ComponentResult; external name '_MediaRefConSetProperty';
{
 *  MediaRefConGetProperty()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 6.0 and later
 *    CarbonLib:        in CarbonLib 1.6 and later
 *    Mac OS X:         in version 10.2 and later
 *    Windows:          in qtmlClient.lib 6.0 and later
 }
function MediaRefConGetProperty(mh: MediaHandler; refCon: SInt32; propertyType: SInt32; propertyValue: UnivPtr): ComponentResult; external name '_MediaRefConGetProperty';
{
 *  MediaNavigateTargetRefCon()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 6.0 and later
 *    CarbonLib:        in CarbonLib 1.6 and later
 *    Mac OS X:         in version 10.2 and later
 *    Windows:          in qtmlClient.lib 6.0 and later
 }
function MediaNavigateTargetRefCon(mh: MediaHandler; navigation: SInt32; var refCon: SInt32): ComponentResult; external name '_MediaNavigateTargetRefCon';
{
 *  MediaGGetIdleManager()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 6.0 and later
 *    CarbonLib:        in CarbonLib 1.6 and later
 *    Mac OS X:         in version 10.2 and later
 *    Windows:          in qtmlClient.lib 6.0 and later
 }
function MediaGGetIdleManager(mh: MediaHandler; var pim: IdleManager): ComponentResult; external name '_MediaGGetIdleManager';
{
 *  MediaGSetIdleManager()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 6.0 and later
 *    CarbonLib:        in CarbonLib 1.6 and later
 *    Mac OS X:         in version 10.2 and later
 *    Windows:          in qtmlClient.lib 6.0 and later
 }
function MediaGSetIdleManager(mh: MediaHandler; im: IdleManager): ComponentResult; external name '_MediaGSetIdleManager';
const
    uppPrePrerollCompleteProcInfo = $00000EC0;

{$ALIGN MAC68K}
{#POP}
{unit PMApplication}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}

{ Callbacks }

type
    PMItemProcPtr = procedure(theDialog: DialogRef; item: SInt16);

    PMPrintDialogInitProcPtr = procedure(printSettings: PMPrintSettings; var theDialog: PMDialog);

    PMPageSetupDialogInitProcPtr = procedure(pageFormat: PMPageFormat; var theDialog: PMDialog);

    PMSheetDoneProcPtr = procedure(printSession: PMPrintSession; documentWindow: WindowRef; accepted: boolean);

    PMItemUPP = ^SInt32; { an opaque UPP }
    PMPrintDialogInitUPP = ^SInt32; { an opaque UPP }
    PMPageSetupDialogInitUPP = ^SInt32; { an opaque UPP }
    PMSheetDoneUPP = ^SInt32; { an opaque UPP }

const
    uppPMItemProcInfo = $000002C0;
    uppPMPrintDialogInitProcInfo = $000003C0;
    uppPMPageSetupDialogInitProcInfo = $000003C0;
    uppPMSheetDoneProcInfo = $000007C0;
    {
     *  NewPMItemUPP()
     *
     *  Availability:
     *    Non-Carbon CFM:   not available
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function NewPMItemUPP(userRoutine: PMItemProcPtr): PMItemUPP; external name '_NewPMItemUPP';
{
 *  NewPMPrintDialogInitUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewPMPrintDialogInitUPP(userRoutine: PMPrintDialogInitProcPtr): PMPrintDialogInitUPP; external name '_NewPMPrintDialogInitUPP';
{
 *  NewPMPageSetupDialogInitUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewPMPageSetupDialogInitUPP(userRoutine: PMPageSetupDialogInitProcPtr): PMPageSetupDialogInitUPP; external name '_NewPMPageSetupDialogInitUPP';
{
 *  NewPMSheetDoneUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewPMSheetDoneUPP(userRoutine: PMSheetDoneProcPtr): PMSheetDoneUPP; external name '_NewPMSheetDoneUPP';
{
 *  DisposePMItemUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposePMItemUPP(userUPP: PMItemUPP); external name '_DisposePMItemUPP';
{
 *  DisposePMPrintDialogInitUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposePMPrintDialogInitUPP(userUPP: PMPrintDialogInitUPP); external name '_DisposePMPrintDialogInitUPP';
{
 *  DisposePMPageSetupDialogInitUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposePMPageSetupDialogInitUPP(userUPP: PMPageSetupDialogInitUPP); external name '_DisposePMPageSetupDialogInitUPP';
{
 *  DisposePMSheetDoneUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposePMSheetDoneUPP(userUPP: PMSheetDoneUPP); external name '_DisposePMSheetDoneUPP';
{
 *  InvokePMItemUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvokePMItemUPP(theDialog: DialogRef; item: SInt16; userRoutine: PMItemUPP); external name '_InvokePMItemUPP';
{
 *  InvokePMPrintDialogInitUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvokePMPrintDialogInitUPP(printSettings: PMPrintSettings; var theDialog: PMDialog; userRoutine: PMPrintDialogInitUPP); external name '_InvokePMPrintDialogInitUPP';
{
 *  InvokePMPageSetupDialogInitUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvokePMPageSetupDialogInitUPP(pageFormat: PMPageFormat; var theDialog: PMDialog; userRoutine: PMPageSetupDialogInitUPP); external name '_InvokePMPageSetupDialogInitUPP';
{
 *  InvokePMSheetDoneUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvokePMSheetDoneUPP(printSession: PMPrintSession; documentWindow: WindowRef; accepted: boolean; userRoutine: PMSheetDoneUPP); external name '_InvokePMSheetDoneUPP';
{ Print loop }
{
 *  PMSessionBeginDocument()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PMSessionBeginDocument(printSession: PMPrintSession; printSettings: PMPrintSettings; pageFormat: PMPageFormat): OSStatus; external name '_PMSessionBeginDocument';

{
 *  PMSessionEndDocument()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PMSessionEndDocument(printSession: PMPrintSession): OSStatus; external name '_PMSessionEndDocument';

{
 *  PMSessionBeginPage()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PMSessionBeginPage(printSession: PMPrintSession; pageFormat: PMPageFormat; pageFrame: PMRectPtr): OSStatus; external name '_PMSessionBeginPage';

{
 *  PMSessionEndPage()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PMSessionEndPage(printSession: PMPrintSession): OSStatus; external name '_PMSessionEndPage';

{ Session Printing Dialogs }
{
 *  PMSessionPageSetupDialog()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PMSessionPageSetupDialog(printSession: PMPrintSession; pageFormat: PMPageFormat; var accepted: boolean): OSStatus; external name '_PMSessionPageSetupDialog';

{
 *  PMSessionPrintDialog()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PMSessionPrintDialog(printSession: PMPrintSession; printSettings: PMPrintSettings; constPageFormat: PMPageFormat; var accepted: boolean): OSStatus; external name '_PMSessionPrintDialog';

{
 *  PMSessionPageSetupDialogInit()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PMSessionPageSetupDialogInit(printSession: PMPrintSession; pageFormat: PMPageFormat; var newDialog: PMDialog): OSStatus; external name '_PMSessionPageSetupDialogInit';

{
 *  PMSessionPrintDialogInit()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PMSessionPrintDialogInit(printSession: PMPrintSession; printSettings: PMPrintSettings; constPageFormat: PMPageFormat; var newDialog: PMDialog): OSStatus; external name '_PMSessionPrintDialogInit';

{
 *  PMSessionPrintDialogMain()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PMSessionPrintDialogMain(printSession: PMPrintSession; printSettings: PMPrintSettings; constPageFormat: PMPageFormat; var accepted: boolean; myInitProc: PMPrintDialogInitUPP): OSStatus; external name '_PMSessionPrintDialogMain';

{
 *  PMSessionPageSetupDialogMain()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PMSessionPageSetupDialogMain(printSession: PMPrintSession; pageFormat: PMPageFormat; var accepted: boolean; myInitProc: PMPageSetupDialogInitUPP): OSStatus; external name '_PMSessionPageSetupDialogMain';

{**********************}
{  Sheets are not available on classic. }
{**********************}
{
 *  PMSessionUseSheets()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.2 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PMSessionUseSheets(printSession: PMPrintSession; documentWindow: WindowRef; sheetDoneProc: PMSheetDoneUPP): OSStatus; external name '_PMSessionUseSheets';


{ Printing Dialog accessors }
{
 *  PMGetDialogPtr()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PMGetDialogPtr(pmDialog: PMDialog; var theDialog: DialogRef): OSStatus; external name '_PMGetDialogPtr';

{
 *  PMGetModalFilterProc()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PMGetModalFilterProc(pmDialog: PMDialog; var filterProc: ModalFilterUPP): OSStatus; external name '_PMGetModalFilterProc';

{
 *  PMSetModalFilterProc()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PMSetModalFilterProc(pmDialog: PMDialog; filterProc: ModalFilterUPP): OSStatus; external name '_PMSetModalFilterProc';

{
 *  PMGetItemProc()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PMGetItemProc(pmDialog: PMDialog; var itemProc: PMItemUPP): OSStatus; external name '_PMGetItemProc';

{
 *  PMSetItemProc()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PMSetItemProc(pmDialog: PMDialog; itemProc: PMItemUPP): OSStatus; external name '_PMSetItemProc';

{
 *  PMGetDialogAccepted()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PMGetDialogAccepted(pmDialog: PMDialog; var process: boolean): OSStatus; external name '_PMGetDialogAccepted';

{
 *  PMSetDialogAccepted()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PMSetDialogAccepted(pmDialog: PMDialog; process: boolean): OSStatus; external name '_PMSetDialogAccepted';

{
 *  PMGetDialogDone()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PMGetDialogDone(pmDialog: PMDialog; var done: boolean): OSStatus; external name '_PMGetDialogDone';

{
 *  PMSetDialogDone()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function PMSetDialogDone(pmDialog: PMDialog; done: boolean): OSStatus; external name '_PMSetDialogDone';

{$ALIGN MAC68K}
{#POP}
{unit QuickTimeComponents}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}


const
    clockComponentType          = $636C6F6B (* 'clok' *);
    systemTickClock             = $7469636B (* 'tick' *);                       {  subtype: 60ths since boot    }
    systemSecondClock           = $7365636F (* 'seco' *);                       {  subtype: seconds since 1904        }
    systemMillisecondClock      = $6D696C6C (* 'mill' *);                       {  subtype: 1000ths since boot        }
    systemMicrosecondClock      = $6D696372 (* 'micr' *);                       {  subtype: 1000000ths since boot  }

    kClockRateIsLinear          = 1;
    kClockImplementsCallBacks   = 2;
    kClockCanHandleIntermittentSound = 4;                       {  sound clocks only  }

    {   * These are Clock procedures *  }
    {
     *  ClockGetTime()
     *
     *  Availability:
     *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
     *    Windows:          in qtmlClient.lib 3.0 and later
        }
function ClockGetTime(aClock: ComponentInstance; var out: TimeRecord): ComponentResult; external name '_ClockGetTime';
{
 *  ClockNewCallBack()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function ClockNewCallBack(aClock: ComponentInstance; tb: TimeBase; callBackType: SInt16): QTCallBack; external name '_ClockNewCallBack';
{
 *  ClockDisposeCallBack()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function ClockDisposeCallBack(aClock: ComponentInstance; cb: QTCallBack): ComponentResult; external name '_ClockDisposeCallBack';
{
 *  ClockCallMeWhen()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function ClockCallMeWhen(aClock: ComponentInstance; cb: QTCallBack; param1: SInt32; param2: SInt32; param3: SInt32): ComponentResult; external name '_ClockCallMeWhen';
{
 *  ClockCancelCallBack()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function ClockCancelCallBack(aClock: ComponentInstance; cb: QTCallBack): ComponentResult; external name '_ClockCancelCallBack';
{
 *  ClockRateChanged()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function ClockRateChanged(aClock: ComponentInstance; cb: QTCallBack): ComponentResult; external name '_ClockRateChanged';
{
 *  ClockTimeChanged()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function ClockTimeChanged(aClock: ComponentInstance; cb: QTCallBack): ComponentResult; external name '_ClockTimeChanged';
{
 *  ClockSetTimeBase()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function ClockSetTimeBase(aClock: ComponentInstance; tb: TimeBase): ComponentResult; external name '_ClockSetTimeBase';
{
 *  ClockStartStopChanged()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function ClockStartStopChanged(aClock: ComponentInstance; cb: QTCallBack; startChanged: boolean; stopChanged: boolean): ComponentResult; external name '_ClockStartStopChanged';
{
 *  ClockGetRate()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function ClockGetRate(aClock: ComponentInstance; var rate: Fixed): ComponentResult; external name '_ClockGetRate';
const
    StandardCompressionType     = $73636469 (* 'scdi' *);
    StandardCompressionSubType  = $696D6167 (* 'imag' *);
    StandardCompressionSubTypeSound = $736F756E (* 'soun' *);



type
    SCModalFilterProcPtr = function(theDialog: DialogRef; var theEvent: EventRecord; var itemHit: SInt16; refcon: SInt32): boolean;

    SCModalHookProcPtr = function(theDialog: DialogRef; itemHit: SInt16; params: UnivPtr; refcon: SInt32): SInt16;

    SCModalFilterUPP = ^SInt32; { an opaque UPP }
    SCModalHookUPP = ^SInt32; { an opaque UPP }
    {   Preference flags. }

const
    scListEveryCodec            = $00000002;
    scAllowZeroFrameRate        = $00000004;
    scAllowZeroKeyFrameRate     = $00000008;
    scShowBestDepth             = $00000010;
    scUseMovableModal           = $00000020;
    scDisableFrameRateItem      = $00000040;
    scShowDataRateAsKilobits    = $00000080;


    {   Possible test flags for setting test image. }
    scPreferCropping            = $01;
    scPreferScaling             = $02;
    scPreferScalingAndCropping  = $03;
    scDontDetermineSettingsFromTestImage = $04;


    {   Dimensions of the image preview box. }
    scTestImageWidth            = 80;
    scTestImageHeight           = 80;

    {   Possible items returned by hookProc. }
    scOKItem                    = 1;
    scCancelItem                = 2;
    scCustomItem                = 3;

    {   Result returned when user cancelled. }
    scUserCancelled             = 1;



    {   Get/SetInfo structures. }


type
    SCSpatialSettingsPtr = ^SCSpatialSettings;
    SCSpatialSettings = record
        codecType:              CodecType;
        codec:                  CodecComponent;
        depth:                  SInt16;
        spatialQuality:         CodecQ;
    end;

    SCTemporalSettingsPtr = ^SCTemporalSettings;
    SCTemporalSettings = record
        temporalQuality:        CodecQ;
        frameRate:              Fixed;
        keyFrameRate:           SInt32;
    end;

    SCDataRateSettingsPtr = ^SCDataRateSettings;
    SCDataRateSettings = record
        dataRate:               SInt32;
        frameDuration:          SInt32;
        minSpatialQuality:      CodecQ;
        minTemporalQuality:     CodecQ;
    end;

    SCExtendedProcsPtr = ^SCExtendedProcs;
    SCExtendedProcs = record
        filterProc:             SCModalFilterUPP;
        hookProc:               SCModalHookUPP;
        refcon:                 SInt32;
        customName:             Str31;
    end;

    {   Get/SetInfo selectors }

const
    scSpatialSettingsType       = $7370746C (* 'sptl' *);                       {  pointer to SCSpatialSettings struct }
    scTemporalSettingsType      = $7470726C (* 'tprl' *);                       {  pointer to SCTemporalSettings struct }
    scDataRateSettingsType      = $64726174 (* 'drat' *);                       {  pointer to SCDataRateSettings struct }
    scColorTableType            = $636C7574 (* 'clut' *);                       {  pointer to CTabHandle }
    scProgressProcType          = $70726F67 (* 'prog' *);                       {  pointer to ProgressRecord struct }
    scExtendedProcsType         = $78707263 (* 'xprc' *);                       {  pointer to SCExtendedProcs struct }
    scPreferenceFlagsType       = $70726566 (* 'pref' *);                       {  pointer to long }
    scSettingsStateType         = $73737461 (* 'ssta' *);                       {  pointer to Handle }
    scSequenceIDType            = $73657175 (* 'sequ' *);                       {  pointer to ImageSequence }
    scWindowPositionType        = $776E6477 (* 'wndw' *);                       {  pointer to Point }
    scCodecFlagsType            = $63666C67 (* 'cflg' *);                       {  pointer to CodecFlags }
    scCodecSettingsType         = $63646563 (* 'cdec' *);                       {  pointer to Handle }
    scForceKeyValueType         = $6B73696D (* 'ksim' *);                       {  pointer to long }
    scSoundSampleRateType       = $73737274 (* 'ssrt' *);                       {  pointer to UnsignedFixed }
    scSoundSampleSizeType       = $73737373 (* 'ssss' *);                       {  pointer to short }
    scSoundChannelCountType     = $73736363 (* 'sscc' *);                       {  pointer to short }
    scSoundCompressionType      = $73736374 (* 'ssct' *);                       {  pointer to OSType }
    scCompressionListType       = $6374796C (* 'ctyl' *);                       {  pointer to OSType Handle }
    scCodecManufacturerType     = $636D6672 (* 'cmfr' *);                       {  pointer to OSType }
    scSoundVBRCompressionOK     = $63766272 (* 'cvbr' *);                       {  pointer to Boolean }
    scSoundInputSampleRateType  = $73736972 (* 'ssir' *);                       {  pointer to UnsignedFixed }
    scSoundSampleRateChangeOK   = $72636F6B (* 'rcok' *);                       {  pointer to Boolean }
    scAvailableCompressionListType = $61766169 (* 'avai' *);                    {  pointer to OSType Handle }

    {   scTypeNotFoundErr returned by Get/SetInfo when type cannot be found. }



type
    SCParamsPtr = ^SCParams;
    SCParams = record
        flags:                  SInt32;
        theCodecType:           CodecType;
        theCodec:               CodecComponent;
        spatialQuality:         CodecQ;
        temporalQuality:        CodecQ;
        depth:                  SInt16;
        frameRate:              Fixed;
        keyFrameRate:           SInt32;
        reserved1:              SInt32;
        reserved2:              SInt32;
    end;


const
    scGetCompression            = 1;
    scShowMotionSettings        = $00000001;
    scSettingsChangedItem       = -1;

    scCompressFlagIgnoreIdenticalFrames = 1;

    {  QTAtomTypes for atoms found in settings atom containers }
    kQTSettingsVideo            = $76696465 (* 'vide' *);                       {  Container for video/image compression related atoms (Get/SetInfo selectors) }
    kQTSettingsSound            = $736F756E (* 'soun' *);                       {  Container for sound compression related atoms (Get/SetInfo selectors) }
    kQTSettingsComponentVersion = $76657273 (* 'vers' *);                       {  . Version of component that wrote settings (QTSettingsVersionAtomRecord) }

    {  Format of 'vers' atom found in settings atom containers }

type
    QTSettingsVersionAtomRecordPtr = ^QTSettingsVersionAtomRecord;
    QTSettingsVersionAtomRecord = record
        componentVersion:       SInt32;                             {  standard compression component version }
        flags:                  SInt16;                             {  low bit is 1 if little endian platform, 0 if big endian platform }
        reserved:               SInt16;                             {  should be 0 }
    end;

    {   * These are Progress procedures *   }
    {
     *  SCGetCompressionExtended()
     *
     *  Availability:
     *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
     *    Windows:          in qtmlClient.lib 3.0 and later
        }
function SCGetCompressionExtended(ci: ComponentInstance; var params: SCParams; where: Point; filterProc: SCModalFilterUPP; hookProc: SCModalHookUPP; refcon: SInt32; customName: StringPtr): ComponentResult; external name '_SCGetCompressionExtended';
{
 *  SCPositionRect()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SCPositionRect(ci: ComponentInstance; var rp: Rect; var where: Point): ComponentResult; external name '_SCPositionRect';
{
 *  SCPositionDialog()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SCPositionDialog(ci: ComponentInstance; id: SInt16; var where: Point): ComponentResult; external name '_SCPositionDialog';
{
 *  SCSetTestImagePictHandle()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SCSetTestImagePictHandle(ci: ComponentInstance; testPict: PicHandle; var testRect: Rect; testFlags: SInt16): ComponentResult; external name '_SCSetTestImagePictHandle';
{
 *  SCSetTestImagePictFile()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SCSetTestImagePictFile(ci: ComponentInstance; testFileRef: SInt16; var testRect: Rect; testFlags: SInt16): ComponentResult; external name '_SCSetTestImagePictFile';
{
 *  SCSetTestImagePixMap()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SCSetTestImagePixMap(ci: ComponentInstance; testPixMap: PixMapHandle; var testRect: Rect; testFlags: SInt16): ComponentResult; external name '_SCSetTestImagePixMap';
{
 *  SCGetBestDeviceRect()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SCGetBestDeviceRect(ci: ComponentInstance; var r: Rect): ComponentResult; external name '_SCGetBestDeviceRect';
{
 *  SCRequestImageSettings()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SCRequestImageSettings(ci: ComponentInstance): ComponentResult; external name '_SCRequestImageSettings';
{
 *  SCCompressImage()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SCCompressImage(ci: ComponentInstance; src: PixMapHandle; const (*var*) srcRect: Rect; var desc: ImageDescriptionHandle; var data: Handle): ComponentResult; external name '_SCCompressImage';
{
 *  SCCompressPicture()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SCCompressPicture(ci: ComponentInstance; srcPicture: PicHandle; dstPicture: PicHandle): ComponentResult; external name '_SCCompressPicture';
{
 *  SCCompressPictureFile()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SCCompressPictureFile(ci: ComponentInstance; srcRefNum: SInt16; dstRefNum: SInt16): ComponentResult; external name '_SCCompressPictureFile';
{
 *  SCRequestSequenceSettings()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SCRequestSequenceSettings(ci: ComponentInstance): ComponentResult; external name '_SCRequestSequenceSettings';
{
 *  SCCompressSequenceBegin()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SCCompressSequenceBegin(ci: ComponentInstance; src: PixMapHandle; const (*var*) srcRect: Rect; var desc: ImageDescriptionHandle): ComponentResult; external name '_SCCompressSequenceBegin';
{
 *  SCCompressSequenceFrame()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SCCompressSequenceFrame(ci: ComponentInstance; src: PixMapHandle; const (*var*) srcRect: Rect; var data: Handle; var dataSize: SInt32; var notSyncFlag: SInt16): ComponentResult; external name '_SCCompressSequenceFrame';
{
 *  SCCompressSequenceEnd()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SCCompressSequenceEnd(ci: ComponentInstance): ComponentResult; external name '_SCCompressSequenceEnd';
{
 *  SCDefaultPictHandleSettings()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SCDefaultPictHandleSettings(ci: ComponentInstance; srcPicture: PicHandle; motion: SInt16): ComponentResult; external name '_SCDefaultPictHandleSettings';
{
 *  SCDefaultPictFileSettings()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SCDefaultPictFileSettings(ci: ComponentInstance; srcRef: SInt16; motion: SInt16): ComponentResult; external name '_SCDefaultPictFileSettings';
{
 *  SCDefaultPixMapSettings()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SCDefaultPixMapSettings(ci: ComponentInstance; src: PixMapHandle; motion: SInt16): ComponentResult; external name '_SCDefaultPixMapSettings';
{
 *  SCGetInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SCGetInfo(ci: ComponentInstance; infoType: OSType; info: UnivPtr): ComponentResult; external name '_SCGetInfo';
{
 *  SCSetInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SCSetInfo(ci: ComponentInstance; infoType: OSType; info: UnivPtr): ComponentResult; external name '_SCSetInfo';
{
 *  SCNewGWorld()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SCNewGWorld(ci: ComponentInstance; var gwp: GWorldPtr; var rp: Rect; flags: GWorldFlags): ComponentResult; external name '_SCNewGWorld';
{
 *  SCSetCompressFlags()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SCSetCompressFlags(ci: ComponentInstance; flags: SInt32): ComponentResult; external name '_SCSetCompressFlags';
{
 *  SCGetCompressFlags()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SCGetCompressFlags(ci: ComponentInstance; var flags: SInt32): ComponentResult; external name '_SCGetCompressFlags';
{
 *  SCGetSettingsAsText()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SCGetSettingsAsText(ci: ComponentInstance; var text: Handle): ComponentResult; external name '_SCGetSettingsAsText';
{
 *  SCGetSettingsAsAtomContainer()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SCGetSettingsAsAtomContainer(ci: ComponentInstance; var settings: QTAtomContainer): ComponentResult; external name '_SCGetSettingsAsAtomContainer';
{
 *  SCSetSettingsFromAtomContainer()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SCSetSettingsFromAtomContainer(ci: ComponentInstance; settings: QTAtomContainer): ComponentResult; external name '_SCSetSettingsFromAtomContainer';
{ Note: if you're using SCCompressSequenceFrameAsync with a scForceKeyValue setting, you must call SCAsyncIdle occasionally at main task time. }
{
 *  SCCompressSequenceFrameAsync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 5.0 and later
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 5.0 and later
 }
function SCCompressSequenceFrameAsync(ci: ComponentInstance; src: PixMapHandle; const (*var*) srcRect: Rect; var data: Handle; var dataSize: SInt32; var notSyncFlag: SInt16; asyncCompletionProc: ICMCompletionProcRecordPtr): ComponentResult; external name '_SCCompressSequenceFrameAsync';
{
 *  SCAsyncIdle()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 5.0 and later
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 5.0 and later
 }
function SCAsyncIdle(ci: ComponentInstance): ComponentResult; external name '_SCAsyncIdle';
const
    TweenComponentType          = $7477656E (* 'twen' *);


type
    TweenerComponent                    = ComponentInstance;
    {
     *  TweenerInitialize()
     *
     *  Availability:
     *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
     *    Windows:          in qtmlClient.lib 3.0 and later
        }
function TweenerInitialize(tc: TweenerComponent; container: QTAtomContainer; tweenAtom: QTAtom; dataAtom: QTAtom): ComponentResult; external name '_TweenerInitialize';
{
 *  TweenerDoTween()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function TweenerDoTween(tc: TweenerComponent; var tr: TweenRecord): ComponentResult; external name '_TweenerDoTween';
{
 *  TweenerReset()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function TweenerReset(tc: TweenerComponent): ComponentResult; external name '_TweenerReset';
const
    TCSourceRefNameType         = $6E616D65 (* 'name' *);

    tcDropFrame                 = $01;
    tc24HourMax                 = $02;
    tcNegTimesOK                = $04;
    tcCounter                   = $08;


type
    TimeCodeDefPtr = ^TimeCodeDef;
    TimeCodeDef = record
        flags:                  SInt32;                             {  drop-frame, etc. }
        fTimeScale:             TimeScale;                              {  time scale of frameDuration (eg. 2997) }
        frameDuration:          TimeValue;                              {  duration of each frame (eg. 100) }
        numFrames:              SInt8;                                  {  frames/sec for timecode (eg. 30) OR frames/tick for counter mode }
        padding:                SInt8;                                  {  unused padding byte }
    end;


const
    tctNegFlag                  = $80;                          {  negative bit is in minutes }


type
    TimeCodeTimePtr = ^TimeCodeTime;
    TimeCodeTime = record
        hours:                  SInt8;
        minutes:                SInt8;
        seconds:                SInt8;
        frames:                 SInt8;
    end;

    TimeCodeCounterPtr = ^TimeCodeCounter;
    TimeCodeCounter = record
        counter:                SInt32;
    end;

    TimeCodeRecordPtr = ^TimeCodeRecord;
    TimeCodeRecord = record
        case SInt16 of
        0: (
            t:                  TimeCodeTime;
            );
        1: (
            c:                  TimeCodeCounter;
            );
    end;

    TimeCodeDescriptionPtr = ^TimeCodeDescription;
    TimeCodeDescription = record
        descSize:               SInt32;                             {  standard sample description header }
        dataFormat:             SInt32;
        resvd1:                 SInt32;
        resvd2:                 SInt16;
        dataRefIndex:           SInt16;
        flags:                  SInt32;                             {  timecode specific stuff }
        timeCodeDef:            TimeCodeDef;
        srcRef:                 array [0..0] of SInt32;
    end;

    TimeCodeDescriptionHandle           = ^TimeCodeDescriptionPtr;

const
    tcdfShowTimeCode            = $01;



type
    TCTextOptionsPtr = ^TCTextOptions;
    TCTextOptions = record
        txFont:                 SInt16;
        txFace:                 SInt16;
        txSize:                 SInt16;
        pad:                    SInt16;                             {  let's make it longword aligned - thanks..  }
        foreColor:              RGBColor;
        backColor:              RGBColor;
    end;

    {
     *  TCGetCurrentTimeCode()
     *
     *  Availability:
     *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
     *    Windows:          in qtmlClient.lib 3.0 and later
        }
function TCGetCurrentTimeCode(mh: MediaHandler; var frameNum: SInt32; var tcdef: TimeCodeDef; var tcrec: TimeCodeRecord; var srcRefH: UserData): HandlerError; external name '_TCGetCurrentTimeCode';
{
 *  TCGetTimeCodeAtTime()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function TCGetTimeCodeAtTime(mh: MediaHandler; mediaTime: TimeValue; var frameNum: SInt32; var tcdef: TimeCodeDef; var tcdata: TimeCodeRecord; var srcRefH: UserData): HandlerError; external name '_TCGetTimeCodeAtTime';
{
 *  TCTimeCodeToString()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function TCTimeCodeToString(mh: MediaHandler; var tcdef: TimeCodeDef; var tcrec: TimeCodeRecord; tcStr: StringPtr): HandlerError; external name '_TCTimeCodeToString';
{
 *  TCTimeCodeToFrameNumber()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function TCTimeCodeToFrameNumber(mh: MediaHandler; var tcdef: TimeCodeDef; var tcrec: TimeCodeRecord; var frameNumber: SInt32): HandlerError; external name '_TCTimeCodeToFrameNumber';
{
 *  TCFrameNumberToTimeCode()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function TCFrameNumberToTimeCode(mh: MediaHandler; frameNumber: SInt32; var tcdef: TimeCodeDef; var tcrec: TimeCodeRecord): HandlerError; external name '_TCFrameNumberToTimeCode';
{
 *  TCGetSourceRef()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function TCGetSourceRef(mh: MediaHandler; tcdH: TimeCodeDescriptionHandle; var srefH: UserData): HandlerError; external name '_TCGetSourceRef';
{
 *  TCSetSourceRef()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function TCSetSourceRef(mh: MediaHandler; tcdH: TimeCodeDescriptionHandle; srefH: UserData): HandlerError; external name '_TCSetSourceRef';
{
 *  TCSetTimeCodeFlags()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function TCSetTimeCodeFlags(mh: MediaHandler; flags: SInt32; flagsMask: SInt32): HandlerError; external name '_TCSetTimeCodeFlags';
{
 *  TCGetTimeCodeFlags()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function TCGetTimeCodeFlags(mh: MediaHandler; var flags: SInt32): HandlerError; external name '_TCGetTimeCodeFlags';
{
 *  TCSetDisplayOptions()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function TCSetDisplayOptions(mh: MediaHandler; textOptions: TCTextOptionsPtr): HandlerError; external name '_TCSetDisplayOptions';
{
 *  TCGetDisplayOptions()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function TCGetDisplayOptions(mh: MediaHandler; textOptions: TCTextOptionsPtr): HandlerError; external name '_TCGetDisplayOptions';
type
    MovieImportComponent                = ComponentInstance;
    MovieExportComponent                = ComponentInstance;

const
    MovieImportType             = $65617420 (* 'eat ' *);
    MovieExportType             = $73706974 (* 'spit' *);

    canMovieImportHandles       = $01;
    canMovieImportFiles         = $02;
    hasMovieImportUserInterface = $04;
    canMovieExportHandles       = $08;
    canMovieExportFiles         = $10;
    hasMovieExportUserInterface = $20;
    movieImporterIsXMLBased     = $20;
    dontAutoFileMovieImport     = $40;
    canMovieExportAuxDataHandle = $80;
    canMovieImportValidateHandles = $0100;
    canMovieImportValidateFile  = $0200;
    dontRegisterWithEasyOpen    = $0400;
    canMovieImportInPlace       = $0800;
    movieImportSubTypeIsFileExtension = $1000;
    canMovieImportPartial       = $2000;
    hasMovieImportMIMEList      = $4000;
    canMovieImportAvoidBlocking = $8000;
    canMovieExportFromProcedures = $8000;
    canMovieExportValidateMovie = $00010000;
    movieImportMustGetDestinationMediaType = $00010000;
    movieExportNeedsResourceFork = $00020000;
    canMovieImportDataReferences = $00040000;
    movieExportMustGetSourceMediaType = $00080000;
    canMovieImportWithIdle      = $00100000;
    canMovieImportValidateDataReferences = $00200000;
    reservedForUseByGraphicsImporters = $00800000;

    movieImportCreateTrack      = 1;
    movieImportInParallel       = 2;
    movieImportMustUseTrack     = 4;
    movieImportWithIdle         = 16;

    movieImportResultUsedMultipleTracks = 8;
    movieImportResultNeedIdles  = 32;
    movieImportResultComplete   = 64;

    kMovieExportTextOnly        = 0;
    kMovieExportAbsoluteTime    = 1;
    kMovieExportRelativeTime    = 2;

    kMIDIImportSilenceBefore    = $01;
    kMIDIImportSilenceAfter     = $02;
    kMIDIImport20Playable       = $04;
    kMIDIImportWantLyrics       = $08;


    kQTMediaConfigResourceType  = $6D636667 (* 'mcfg' *);
    kQTMediaConfigResourceVersion = 2;
    kQTMediaGroupResourceType   = $6D677270 (* 'mgrp' *);
    kQTMediaGroupResourceVersion = 1;
    kQTBrowserInfoResourceType  = $62727773 (* 'brws' *);
    kQTBrowserInfoResourceVersion = 1;


    kQTMediaMIMEInfoHasChanged  = $00000002;                    {  the MIME type(s) is(are) new or has changed since the last time }
                                                                {   someone asked about it }
    kQTMediaFileInfoHasChanged  = $00000004;                    {  the file extension(s) is(are) new or has changed since the last time }
                                                                {   anyone asked about it }
    kQTMediaConfigCanUseApp     = $00040000;                    {  this MIME type can be configured to use app }
    kQTMediaConfigCanUsePlugin  = $00080000;                    {  this MIME type can be configured to use plug-in }
    kQTMediaConfigUNUSED        = $00100000;                    {  currently unused }
    kQTMediaConfigBinaryFile    = $00800000;                    {  file should be transfered in binary mode }
    kQTMediaConfigTextFile      = 0;                            {  not a bit, defined for clarity }
    kQTMediaConfigMacintoshFile = $01000000;                    {  file's resource fork is significant }
    kQTMediaConfigAssociateByDefault = $08000000;               {  take this file association by default }
    kQTMediaConfigUseAppByDefault = $10000000;                  {  use the app by default for this MIME type }
    kQTMediaConfigUsePluginByDefault = $20000000;               {  use the plug-in by default for this MIME type }
    kQTMediaConfigDefaultsMask  = $30000000;
    kQTMediaConfigDefaultsShift = 12;                           {  ((flags & kQTMediaConfigDefaultsMask) >> kQTMediaConfigDefaultsShift) to get default setting  }
    kQTMediaConfigHasFileHasQTAtoms = $40000000;                {  the file has a "QuickTime like" file format  }


    {  mime type group constants for groupID field of 'mcfg' resource }
    kQTMediaConfigStreamGroupID = $7374726D (* 'strm' *);
    kQTMediaConfigInteractiveGroupID = $696E7472 (* 'intr' *);
    kQTMediaConfigVideoGroupID  = $65796573 (* 'eyes' *);
    kQTMediaConfigAudioGroupID  = $65617273 (* 'ears' *);
    kQTMediaConfigMPEGGroupID   = $6D706567 (* 'mpeg' *);
    kQTMediaConfigMP3GroupID    = $6D703320 (* 'mp3 ' *);
    kQTMediaConfigImageGroupID  = $6F676C65 (* 'ogle' *);
    kQTMediaConfigMiscGroupID   = $6D697363 (* 'misc' *);

    {  file type group constants for groupID field of 'mcfg' resource }
    kQTMediaInfoNetGroup        = $6E657420 (* 'net ' *);
    kQTMediaInfoWinGroup        = $77696E20 (* 'win ' *);
    kQTMediaInfoMacGroup        = $6D616320 (* 'mac ' *);
    kQTMediaInfoMiscGroup       = $3F3F3F3F;                    {  '????' }



    kMimeInfoMimeTypeTag        = $6D696D65 (* 'mime' *);
    kMimeInfoFileExtensionTag   = $65787420 (* 'ext ' *);
    kMimeInfoDescriptionTag     = $64657363 (* 'desc' *);
    kMimeInfoGroupTag           = $67726F70 (* 'grop' *);
    kMimeInfoDoNotOverrideExistingFileTypeAssociation = $6E6F6661 (* 'nofa' *);

    kQTFileTypeAIFF             = $41494646 (* 'AIFF' *);
    kQTFileTypeAIFC             = $41494643 (* 'AIFC' *);
    kQTFileTypeDVC              = $64766321 (* 'dvc!' *);
    kQTFileTypeMIDI             = $4D696469 (* 'Midi' *);
    kQTFileTypePicture          = $50494354 (* 'PICT' *);
    kQTFileTypeMovie            = $4D6F6F56 (* 'MooV' *);
    kQTFileTypeText             = $54455854 (* 'TEXT' *);
    kQTFileTypeWave             = $57415645 (* 'WAVE' *);
    kQTFileTypeSystemSevenSound = $7366696C (* 'sfil' *);
    kQTFileTypeMuLaw            = $554C4157 (* 'ULAW' *);
    kQTFileTypeAVI              = $56665720 (* 'VfW ' *);
    kQTFileTypeSoundDesignerII  = $53643266 (* 'Sd2f' *);
    kQTFileTypeAudioCDTrack     = $7472616B (* 'trak' *);
    kQTFileTypePICS             = $50494353 (* 'PICS' *);
    kQTFileTypeGIF              = $47494666 (* 'GIFf' *);
    kQTFileTypePNG              = $504E4766 (* 'PNGf' *);
    kQTFileTypeTIFF             = $54494646 (* 'TIFF' *);
    kQTFileTypePhotoShop        = $38425053 (* '8BPS' *);
    kQTFileTypeSGIImage         = $2E534749 (* '.SGI' *);
    kQTFileTypeBMP              = $424D5066 (* 'BMPf' *);
    kQTFileTypeJPEG             = $4A504547 (* 'JPEG' *);
    kQTFileTypeJFIF             = $4A504547 (* 'JPEG' *);
    kQTFileTypeMacPaint         = $504E5447 (* 'PNTG' *);
    kQTFileTypeTargaImage       = $54504943 (* 'TPIC' *);
    kQTFileTypeQuickDrawGXPicture = $71646778 (* 'qdgx' *);
    kQTFileTypeQuickTimeImage   = $71746966 (* 'qtif' *);
    kQTFileType3DMF             = $33444D46 (* '3DMF' *);
    kQTFileTypeFLC              = $464C4320 (* 'FLC ' *);
    kQTFileTypeFlash            = $5357464C (* 'SWFL' *);
    kQTFileTypeFlashPix         = $46506978 (* 'FPix' *);
    kQTFileTypeMP4              = $6D706734 (* 'mpg4' *);

    {  QTAtomTypes for atoms in import/export settings containers }
    kQTSettingsDVExportNTSC     = $64766376 (* 'dvcv' *);                       {  True is export as NTSC, false is export as PAL. (Boolean) }
    kQTSettingsDVExportLockedAudio = $6C6F636B (* 'lock' *);                    {  True if audio locked to video. (Boolean) }
    kQTSettingsEffect           = $65666665 (* 'effe' *);                       {  Parent atom whose contents are atoms of an effects description }
    kQTSettingsGraphicsFileImportSequence = $73657175 (* 'sequ' *);             {  Parent atom of graphic file movie import component }
    kQTSettingsGraphicsFileImportSequenceEnabled = $656E6162 (* 'enab' *);      {  . If true, import numbered image sequence (Boolean) }
    kQTSettingsMovieExportEnableVideo = $656E7669 (* 'envi' *);                 {  Enable exporting of video track (Boolean) }
    kQTSettingsMovieExportEnableSound = $656E736F (* 'enso' *);                 {  Enable exporting of sound track (Boolean) }
    kQTSettingsMovieExportSaveOptions = $73617665 (* 'save' *);                 {  Parent atom of save options }
    kQTSettingsMovieExportSaveForInternet = $66617374 (* 'fast' *);             {  . Save for Internet }
    kQTSettingsMovieExportSaveCompressedMovie = $636D706D (* 'cmpm' *);         {  . Save compressed movie resource }
    kQTSettingsMIDI             = $4D494449 (* 'MIDI' *);                       {  MIDI import related container }
    kQTSettingsMIDISettingFlags = $73747467 (* 'sttg' *);                       {  . MIDI import settings (UInt32) }
    kQTSettingsText             = $74657874 (* 'text' *);                       {  Text related container }
    kQTSettingsTextDescription  = $64657363 (* 'desc' *);                       {  . Text import settings (TextDescription record) }
    kQTSettingsTextSize         = $73697A65 (* 'size' *);                       {  . Width/height to create during import (FixedPoint) }
    kQTSettingsTextSettingFlags = $73747467 (* 'sttg' *);                       {  . Text export settings (UInt32) }
    kQTSettingsTextTimeFraction = $74696D66 (* 'timf' *);                       {  . Movie time fraction for export (UInt32) }
    kQTSettingsTime             = $74696D65 (* 'time' *);                       {  Time related container }
    kQTSettingsTimeDuration     = $64757261 (* 'dura' *);                       {  . Time related container }
    kQTSettingsAudioCDTrack     = $7472616B (* 'trak' *);                       {  Audio CD track related container }
    kQTSettingsAudioCDTrackRateShift = $72736866 (* 'rshf' *);                  {  . Rate shift to be performed (SInt16) }
    kQTSettingsDVExportDVFormat = $64766366 (* 'dvcf' *);                       {  Exported DV Format, DV('dv  ') or DVCPRO('dvp '). (OSType) }





type
    MovieExportGetDataParamsPtr = ^MovieExportGetDataParams;
    MovieExportGetDataParams = record
        recordSize:             SInt32;
        trackID:                SInt32;
        sourceTimeScale:        TimeScale;
        requestedTime:          TimeValue;
        actualTime:             TimeValue;
        dataPtr:                Ptr;
        dataSize:               SInt32;
        desc:                   SampleDescriptionHandle;
        descType:               OSType;
        descSeed:               SInt32;
        requestedSampleCount:   SInt32;
        actualSampleCount:      SInt32;
        durationPerSample:      TimeValue;
        sampleFlags:            SInt32;
    end;

    MovieExportGetDataProcPtr = function(refCon: UnivPtr; var params: MovieExportGetDataParams): OSErr;

    MovieExportGetPropertyProcPtr = function(refcon: UnivPtr; trackID: SInt32; propertyType: OSType; propertyValue: UnivPtr): OSErr;


const
    kQTPresetsListResourceType  = $73746723 (* 'stg#' *);
    kQTPresetsPlatformListResourceType = $73746770 (* 'stgp' *);

    kQTPresetInfoIsDivider      = 1;


type
    QTPresetInfoPtr = ^QTPresetInfo;
    QTPresetInfo = record
        presetKey:              OSType;                                 {  unique key for this preset in presetsArray  }
        presetFlags:            UInt32;                                 {  flags about this preset  }
        settingsResourceType:   OSType;                                 {  resource type of settings resource  }
        settingsResourceID:     SInt16;                                 {  resource id of settings resource  }
        padding1:               SInt16;
        nameStringListID:       SInt16;                                 {  name string list resource id  }
        nameStringIndex:        SInt16;                                 {  name string index  }
        infoStringListID:       SInt16;                                 {  info string list resource id  }
        infoStringIndex:        SInt16;                                 {  info string index  }
    end;

    QTPresetListRecordPtr = ^QTPresetListRecord;
    QTPresetListRecord = record
        flags:                  UInt32;                                 {  flags for whole list  }
        count:                  UInt32;                                 {  number of elements in presetsArray  }
        reserved:               UInt32;
        presetsArray:           array [0..0] of QTPresetInfo;           {  info about each preset  }
    end;


const
    kQTMovieExportSourceInfoResourceType = $73726323 (* 'src#' *);
    kQTMovieExportSourceInfoIsMediaType = $00000001;
    kQTMovieExportSourceInfoIsMediaCharacteristic = $00000002;
    kQTMovieExportSourceInfoIsSourceType = $00000004;


type
    QTMovieExportSourceInfoPtr = ^QTMovieExportSourceInfo;
    QTMovieExportSourceInfo = record
        mediaType:              OSType;                                 {  Media type of source  }
        minCount:               UInt16;                                 {  min number of sources of this kind required, zero if none required  }
        maxCount:               UInt16;                                 {  max number of sources of this kind allowed, -1 if unlimited allowed  }
        flags:                  SInt32;                             {  reserved for flags  }
    end;

    QTMovieExportSourceRecordPtr = ^QTMovieExportSourceRecord;
    QTMovieExportSourceRecord = record
        count:                  SInt32;
        reserved:               SInt32;
        sourceArray:            array [0..0] of QTMovieExportSourceInfo;
    end;

    MovieExportGetDataUPP = ^SInt32; { an opaque UPP }
    MovieExportGetPropertyUPP = ^SInt32; { an opaque UPP }

const
    uppSCModalFilterProcInfo = $00003FD0;
    uppSCModalHookProcInfo = $00003EE0;
    uppMovieExportGetDataProcInfo = $000003E0;
    uppMovieExportGetPropertyProcInfo = $00003FE0;
    {
     *  NewSCModalFilterUPP()
     *
     *  Availability:
     *    Non-Carbon CFM:   available as macro/inline
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function NewSCModalFilterUPP(userRoutine: SCModalFilterProcPtr): SCModalFilterUPP; external name '_NewSCModalFilterUPP'; { old name was NewSCModalFilterProc }
{
 *  NewSCModalHookUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewSCModalHookUPP(userRoutine: SCModalHookProcPtr): SCModalHookUPP; external name '_NewSCModalHookUPP'; { old name was NewSCModalHookProc }
{
 *  NewMovieExportGetDataUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewMovieExportGetDataUPP(userRoutine: MovieExportGetDataProcPtr): MovieExportGetDataUPP; external name '_NewMovieExportGetDataUPP'; { old name was NewMovieExportGetDataProc }
{
 *  NewMovieExportGetPropertyUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewMovieExportGetPropertyUPP(userRoutine: MovieExportGetPropertyProcPtr): MovieExportGetPropertyUPP; external name '_NewMovieExportGetPropertyUPP'; { old name was NewMovieExportGetPropertyProc }
{
 *  DisposeSCModalFilterUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeSCModalFilterUPP(userUPP: SCModalFilterUPP); external name '_DisposeSCModalFilterUPP';
{
 *  DisposeSCModalHookUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeSCModalHookUPP(userUPP: SCModalHookUPP); external name '_DisposeSCModalHookUPP';
{
 *  DisposeMovieExportGetDataUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeMovieExportGetDataUPP(userUPP: MovieExportGetDataUPP); external name '_DisposeMovieExportGetDataUPP';
{
 *  DisposeMovieExportGetPropertyUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeMovieExportGetPropertyUPP(userUPP: MovieExportGetPropertyUPP); external name '_DisposeMovieExportGetPropertyUPP';
{
 *  InvokeSCModalFilterUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeSCModalFilterUPP(theDialog: DialogRef; var theEvent: EventRecord; var itemHit: SInt16; refcon: SInt32; userRoutine: SCModalFilterUPP): boolean; external name '_InvokeSCModalFilterUPP'; { old name was CallSCModalFilterProc }
{
 *  InvokeSCModalHookUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeSCModalHookUPP(theDialog: DialogRef; itemHit: SInt16; params: UnivPtr; refcon: SInt32; userRoutine: SCModalHookUPP): SInt16; external name '_InvokeSCModalHookUPP'; { old name was CallSCModalHookProc }
{
 *  InvokeMovieExportGetDataUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeMovieExportGetDataUPP(refCon: UnivPtr; var params: MovieExportGetDataParams; userRoutine: MovieExportGetDataUPP): OSErr; external name '_InvokeMovieExportGetDataUPP'; { old name was CallMovieExportGetDataProc }
{
 *  InvokeMovieExportGetPropertyUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeMovieExportGetPropertyUPP(refcon: UnivPtr; trackID: SInt32; propertyType: OSType; propertyValue: UnivPtr; userRoutine: MovieExportGetPropertyUPP): OSErr; external name '_InvokeMovieExportGetPropertyUPP'; { old name was CallMovieExportGetPropertyProc }
{
 *  MovieImportHandle()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MovieImportHandle(ci: MovieImportComponent; dataH: Handle; theMovie: Movie; targetTrack: Track; var usedTrack: Track; atTime: TimeValue; var addedDuration: TimeValue; inFlags: SInt32; var outFlags: SInt32): ComponentResult; external name '_MovieImportHandle';
{
 *  MovieImportFile()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MovieImportFile(ci: MovieImportComponent; const (*var*) theFile: FSSpec; theMovie: Movie; targetTrack: Track; var usedTrack: Track; atTime: TimeValue; var addedDuration: TimeValue; inFlags: SInt32; var outFlags: SInt32): ComponentResult; external name '_MovieImportFile';
{
 *  MovieImportSetSampleDuration()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MovieImportSetSampleDuration(ci: MovieImportComponent; duration: TimeValue; scale: TimeScale): ComponentResult; external name '_MovieImportSetSampleDuration';
{
 *  MovieImportSetSampleDescription()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MovieImportSetSampleDescription(ci: MovieImportComponent; desc: SampleDescriptionHandle; mediaType: OSType): ComponentResult; external name '_MovieImportSetSampleDescription';
{
 *  MovieImportSetMediaFile()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MovieImportSetMediaFile(ci: MovieImportComponent; alias: AliasHandle): ComponentResult; external name '_MovieImportSetMediaFile';
{
 *  MovieImportSetDimensions()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MovieImportSetDimensions(ci: MovieImportComponent; width: Fixed; height: Fixed): ComponentResult; external name '_MovieImportSetDimensions';
{
 *  MovieImportSetChunkSize()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MovieImportSetChunkSize(ci: MovieImportComponent; chunkSize: SInt32): ComponentResult; external name '_MovieImportSetChunkSize';
{
 *  MovieImportSetProgressProc()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MovieImportSetProgressProc(ci: MovieImportComponent; proc: MovieProgressUPP; refcon: SInt32): ComponentResult; external name '_MovieImportSetProgressProc';
{
 *  MovieImportSetAuxiliaryData()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MovieImportSetAuxiliaryData(ci: MovieImportComponent; data: Handle; handleType: OSType): ComponentResult; external name '_MovieImportSetAuxiliaryData';
{
 *  MovieImportSetFromScrap()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MovieImportSetFromScrap(ci: MovieImportComponent; fromScrap: boolean): ComponentResult; external name '_MovieImportSetFromScrap';
{
 *  MovieImportDoUserDialog()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MovieImportDoUserDialog(ci: MovieImportComponent; const (*var*) theFile: FSSpec; theData: Handle; var canceled: boolean): ComponentResult; external name '_MovieImportDoUserDialog';
{
 *  MovieImportSetDuration()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MovieImportSetDuration(ci: MovieImportComponent; duration: TimeValue): ComponentResult; external name '_MovieImportSetDuration';
{
 *  MovieImportGetAuxiliaryDataType()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MovieImportGetAuxiliaryDataType(ci: MovieImportComponent; var auxType: OSType): ComponentResult; external name '_MovieImportGetAuxiliaryDataType';
{
 *  MovieImportValidate()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MovieImportValidate(ci: MovieImportComponent; const (*var*) theFile: FSSpec; theData: Handle; var valid: boolean): ComponentResult; external name '_MovieImportValidate';
{
 *  MovieImportGetFileType()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MovieImportGetFileType(ci: MovieImportComponent; var fileType: OSType): ComponentResult; external name '_MovieImportGetFileType';
{
 *  MovieImportDataRef()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MovieImportDataRef(ci: MovieImportComponent; dataRef: Handle; dataRefType: OSType; theMovie: Movie; targetTrack: Track; var usedTrack: Track; atTime: TimeValue; var addedDuration: TimeValue; inFlags: SInt32; var outFlags: SInt32): ComponentResult; external name '_MovieImportDataRef';
{
 *  MovieImportGetSampleDescription()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MovieImportGetSampleDescription(ci: MovieImportComponent; var desc: SampleDescriptionHandle; var mediaType: OSType): ComponentResult; external name '_MovieImportGetSampleDescription';
{
 *  MovieImportGetMIMETypeList()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MovieImportGetMIMETypeList(ci: MovieImportComponent; var mimeInfo: QTAtomContainer): ComponentResult; external name '_MovieImportGetMIMETypeList';
{
 *  MovieImportSetOffsetAndLimit()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MovieImportSetOffsetAndLimit(ci: MovieImportComponent; offset: UInt32; limit: UInt32): ComponentResult; external name '_MovieImportSetOffsetAndLimit';
{
 *  MovieImportGetSettingsAsAtomContainer()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MovieImportGetSettingsAsAtomContainer(ci: MovieImportComponent; var settings: QTAtomContainer): ComponentResult; external name '_MovieImportGetSettingsAsAtomContainer';
{
 *  MovieImportSetSettingsFromAtomContainer()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MovieImportSetSettingsFromAtomContainer(ci: MovieImportComponent; settings: QTAtomContainer): ComponentResult; external name '_MovieImportSetSettingsFromAtomContainer';
{
 *  MovieImportSetOffsetAndLimit64()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function MovieImportSetOffsetAndLimit64(ci: MovieImportComponent; const (*var*) offset: wide; const (*var*) limit: wide): ComponentResult; external name '_MovieImportSetOffsetAndLimit64';
{
 *  MovieImportIdle()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function MovieImportIdle(ci: MovieImportComponent; inFlags: SInt32; var outFlags: SInt32): ComponentResult; external name '_MovieImportIdle';
{
 *  MovieImportValidateDataRef()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function MovieImportValidateDataRef(ci: MovieImportComponent; dataRef: Handle; dataRefType: OSType; var valid: UInt8): ComponentResult; external name '_MovieImportValidateDataRef';
{
 *  MovieImportGetLoadState()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.1 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.1 and later
 }
function MovieImportGetLoadState(ci: MovieImportComponent; var importerLoadState: SInt32): ComponentResult; external name '_MovieImportGetLoadState';
{
 *  MovieImportGetMaxLoadedTime()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.1 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.1 and later
 }
function MovieImportGetMaxLoadedTime(ci: MovieImportComponent; var time: TimeValue): ComponentResult; external name '_MovieImportGetMaxLoadedTime';
{
 *  MovieImportEstimateCompletionTime()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 5.0 and later
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 5.0 and later
 }
function MovieImportEstimateCompletionTime(ci: MovieImportComponent; var time: TimeRecord): ComponentResult; external name '_MovieImportEstimateCompletionTime';
{
 *  MovieImportSetDontBlock()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 5.0 and later
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 5.0 and later
 }
function MovieImportSetDontBlock(ci: MovieImportComponent; dontBlock: boolean): ComponentResult; external name '_MovieImportSetDontBlock';
{
 *  MovieImportGetDontBlock()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 5.0 and later
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 5.0 and later
 }
function MovieImportGetDontBlock(ci: MovieImportComponent; var willBlock: boolean): ComponentResult; external name '_MovieImportGetDontBlock';
{
 *  MovieImportSetIdleManager()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 6.0 and later
 *    CarbonLib:        in CarbonLib 1.6 and later
 *    Mac OS X:         in version 10.2 and later
 *    Windows:          in qtmlClient.lib 6.0 and later
 }
function MovieImportSetIdleManager(ci: MovieImportComponent; im: IdleManager): ComponentResult; external name '_MovieImportSetIdleManager';
{
 *  MovieImportSetNewMovieFlags()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 6.0 and later
 *    CarbonLib:        in CarbonLib 1.6 and later
 *    Mac OS X:         in version 10.2 and later
 *    Windows:          in qtmlClient.lib 6.0 and later
 }
function MovieImportSetNewMovieFlags(ci: MovieImportComponent; newMovieFlags: SInt32): ComponentResult; external name '_MovieImportSetNewMovieFlags';
{
 *  MovieImportGetDestinationMediaType()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 6.0 and later
 *    CarbonLib:        in CarbonLib 1.6 and later
 *    Mac OS X:         in version 10.2 and later
 *    Windows:          in qtmlClient.lib 6.0 and later
 }
function MovieImportGetDestinationMediaType(ci: MovieImportComponent; var mediaType: OSType): ComponentResult; external name '_MovieImportGetDestinationMediaType';
{
 *  MovieExportToHandle()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MovieExportToHandle(ci: MovieExportComponent; dataH: Handle; theMovie: Movie; onlyThisTrack: Track; startTime: TimeValue; duration: TimeValue): ComponentResult; external name '_MovieExportToHandle';
{
 *  MovieExportToFile()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MovieExportToFile(ci: MovieExportComponent; const (*var*) theFile: FSSpec; theMovie: Movie; onlyThisTrack: Track; startTime: TimeValue; duration: TimeValue): ComponentResult; external name '_MovieExportToFile';
{
 *  MovieExportGetAuxiliaryData()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MovieExportGetAuxiliaryData(ci: MovieExportComponent; dataH: Handle; var handleType: OSType): ComponentResult; external name '_MovieExportGetAuxiliaryData';
{
 *  MovieExportSetProgressProc()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MovieExportSetProgressProc(ci: MovieExportComponent; proc: MovieProgressUPP; refcon: SInt32): ComponentResult; external name '_MovieExportSetProgressProc';
{
 *  MovieExportSetSampleDescription()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MovieExportSetSampleDescription(ci: MovieExportComponent; desc: SampleDescriptionHandle; mediaType: OSType): ComponentResult; external name '_MovieExportSetSampleDescription';
{
 *  MovieExportDoUserDialog()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MovieExportDoUserDialog(ci: MovieExportComponent; theMovie: Movie; onlyThisTrack: Track; startTime: TimeValue; duration: TimeValue; var canceled: boolean): ComponentResult; external name '_MovieExportDoUserDialog';
{
 *  MovieExportGetCreatorType()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MovieExportGetCreatorType(ci: MovieExportComponent; var creator: OSType): ComponentResult; external name '_MovieExportGetCreatorType';
{
 *  MovieExportToDataRef()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MovieExportToDataRef(ci: MovieExportComponent; dataRef: Handle; dataRefType: OSType; theMovie: Movie; onlyThisTrack: Track; startTime: TimeValue; duration: TimeValue): ComponentResult; external name '_MovieExportToDataRef';
{
 *  MovieExportFromProceduresToDataRef()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MovieExportFromProceduresToDataRef(ci: MovieExportComponent; dataRef: Handle; dataRefType: OSType): ComponentResult; external name '_MovieExportFromProceduresToDataRef';
{
 *  MovieExportAddDataSource()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MovieExportAddDataSource(ci: MovieExportComponent; trackType: OSType; scale: TimeScale; var trackID: SInt32; getPropertyProc: MovieExportGetPropertyUPP; getDataProc: MovieExportGetDataUPP; refCon: UnivPtr): ComponentResult; external name '_MovieExportAddDataSource';
{
 *  MovieExportValidate()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MovieExportValidate(ci: MovieExportComponent; theMovie: Movie; onlyThisTrack: Track; var valid: boolean): ComponentResult; external name '_MovieExportValidate';
{
 *  MovieExportGetSettingsAsAtomContainer()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MovieExportGetSettingsAsAtomContainer(ci: MovieExportComponent; var settings: QTAtomContainer): ComponentResult; external name '_MovieExportGetSettingsAsAtomContainer';
{
 *  MovieExportSetSettingsFromAtomContainer()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MovieExportSetSettingsFromAtomContainer(ci: MovieExportComponent; settings: QTAtomContainer): ComponentResult; external name '_MovieExportSetSettingsFromAtomContainer';
{
 *  MovieExportGetFileNameExtension()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MovieExportGetFileNameExtension(ci: MovieExportComponent; var extension: OSType): ComponentResult; external name '_MovieExportGetFileNameExtension';
{
 *  MovieExportGetShortFileTypeString()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MovieExportGetShortFileTypeString(ci: MovieExportComponent; var typeString: Str255): ComponentResult; external name '_MovieExportGetShortFileTypeString';
{
 *  MovieExportGetSourceMediaType()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MovieExportGetSourceMediaType(ci: MovieExportComponent; var mediaType: OSType): ComponentResult; external name '_MovieExportGetSourceMediaType';
{
 *  MovieExportSetGetMoviePropertyProc()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function MovieExportSetGetMoviePropertyProc(ci: MovieExportComponent; getPropertyProc: MovieExportGetPropertyUPP; refCon: UnivPtr): ComponentResult; external name '_MovieExportSetGetMoviePropertyProc';
{  Text Export Display Info data structure }

type
    TextDisplayDataPtr = ^TextDisplayData;
    TextDisplayData = record
        displayFlags:           SInt32;
        textJustification:      SInt32;
        bgColor:                RGBColor;
        textBox:                Rect;
        beginHilite:            SInt16;
        endHilite:              SInt16;
        hiliteColor:            RGBColor;
        doHiliteColor:          boolean;
        filler:                 SInt8;
        scrollDelayDur:         TimeValue;
        dropShadowOffset:       Point;
        dropShadowTransparency: SInt16;
    end;

    TextExportComponent                 = ComponentInstance;
    GraphicImageMovieImportComponent    = ComponentInstance;
    {
     *  TextExportGetDisplayData()
     *
     *  Availability:
     *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
     *    Windows:          in qtmlClient.lib 3.0 and later
        }
function TextExportGetDisplayData(ci: TextExportComponent; var textDisplay: TextDisplayData): ComponentResult; external name '_TextExportGetDisplayData';
{
 *  TextExportGetTimeFraction()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function TextExportGetTimeFraction(ci: TextExportComponent; var movieTimeFraction: SInt32): ComponentResult; external name '_TextExportGetTimeFraction';
{
 *  TextExportSetTimeFraction()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function TextExportSetTimeFraction(ci: TextExportComponent; movieTimeFraction: SInt32): ComponentResult; external name '_TextExportSetTimeFraction';
{
 *  TextExportGetSettings()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function TextExportGetSettings(ci: TextExportComponent; var setting: SInt32): ComponentResult; external name '_TextExportGetSettings';
{
 *  TextExportSetSettings()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function TextExportSetSettings(ci: TextExportComponent; setting: SInt32): ComponentResult; external name '_TextExportSetSettings';
{
 *  MIDIImportGetSettings()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MIDIImportGetSettings(ci: TextExportComponent; var setting: SInt32): ComponentResult; external name '_MIDIImportGetSettings';
{
 *  MIDIImportSetSettings()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MIDIImportSetSettings(ci: TextExportComponent; setting: SInt32): ComponentResult; external name '_MIDIImportSetSettings';
{
 *  MovieExportNewGetDataAndPropertiesProcs()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MovieExportNewGetDataAndPropertiesProcs(ci: MovieExportComponent; trackType: OSType; var scale: TimeScale; theMovie: Movie; theTrack: Track; startTime: TimeValue; duration: TimeValue; var getPropertyProc: MovieExportGetPropertyUPP; var getDataProc: MovieExportGetDataUPP; var refCon: UnivPtr): ComponentResult; external name '_MovieExportNewGetDataAndPropertiesProcs';
{
 *  MovieExportDisposeGetDataAndPropertiesProcs()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function MovieExportDisposeGetDataAndPropertiesProcs(ci: MovieExportComponent; getPropertyProc: MovieExportGetPropertyUPP; getDataProc: MovieExportGetDataUPP; refCon: UnivPtr): ComponentResult; external name '_MovieExportDisposeGetDataAndPropertiesProcs';
const
    movieExportUseConfiguredSettings = $75636667 (* 'ucfg' *);                  {  pointer to Boolean }
    movieExportWidth            = $77647468 (* 'wdth' *);                       {  pointer to Fixed }
    movieExportHeight           = $68656774 (* 'hegt' *);                       {  pointer to Fixed }
    movieExportDuration         = $64757261 (* 'dura' *);                       {  pointer to TimeRecord }
    movieExportVideoFilter      = $69666C74 (* 'iflt' *);                       {  pointer to QTAtomContainer }
    movieExportTimeScale        = $746D7363 (* 'tmsc' *);                       {  pointer to TimeScale }

    {
     *  GraphicsImageImportSetSequenceEnabled()
     *
     *  Availability:
     *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
     *    Windows:          in qtmlClient.lib 3.0 and later
        }
function GraphicsImageImportSetSequenceEnabled(ci: GraphicImageMovieImportComponent; enable: boolean): ComponentResult; external name '_GraphicsImageImportSetSequenceEnabled';
{
 *  GraphicsImageImportGetSequenceEnabled()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function GraphicsImageImportGetSequenceEnabled(ci: GraphicImageMovieImportComponent; var enable: boolean): ComponentResult; external name '_GraphicsImageImportGetSequenceEnabled';
{----------------------------'brws' ¥ browser prefs configuration info ------------------------}

const
    kQTBrowserInfoCanUseSystemFolderPlugin = $00000001;         {  Mac browser can use plug-in from System "Internet Plug-ins" folder  }




    kQTPreFlightOpenComponent   = $00000002;                    {  Open component as preflight check }


type
    ComponentPreflightFlagsPtr = ^ComponentPreflightFlags;
    ComponentPreflightFlags = record
        flags:                  SInt32;
    end;






    {   **************

        File Preview Components

    **************  }
    pnotComponent                       = ComponentInstance;

const
    pnotComponentWantsEvents    = 1;
    pnotComponentNeedsNoCache   = 2;

    ShowFilePreviewComponentType = $706E6F74 (* 'pnot' *);
    CreateFilePreviewComponentType = $706D616B (* 'pmak' *);

    {
     *  PreviewShowData()
     *
     *  Availability:
     *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
     *    Windows:          in qtmlClient.lib 3.0 and later
        }
function PreviewShowData(p: pnotComponent; dataType: OSType; data: Handle; const (*var*) inHere: Rect): ComponentResult; external name '_PreviewShowData';
{
 *  PreviewMakePreview()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function PreviewMakePreview(p: pnotComponent; var previewType: OSType; var previewResult: Handle; const (*var*) sourceFile: FSSpec; progress: ICMProgressProcRecordPtr): ComponentResult; external name '_PreviewMakePreview';
{
 *  PreviewMakePreviewReference()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function PreviewMakePreviewReference(p: pnotComponent; var previewType: OSType; var resID: SInt16; const (*var*) sourceFile: FSSpec): ComponentResult; external name '_PreviewMakePreviewReference';
{
 *  PreviewEvent()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function PreviewEvent(p: pnotComponent; var e: EventRecord; var handledEvent: boolean): ComponentResult; external name '_PreviewEvent';
type
    DataCompressorComponent             = ComponentInstance;
    DataDecompressorComponent           = ComponentInstance;
    DataCodecComponent                  = ComponentInstance;

const
    DataCompressorComponentType = $64636F6D (* 'dcom' *);
    DataDecompressorComponentType = $64646563 (* 'ddec' *);
    AppleDataCompressorSubType  = $61646563 (* 'adec' *);
    zlibDataCompressorSubType   = $7A6C6962 (* 'zlib' *);


    {   * These are DataCodec procedures *  }
    {
     *  DataCodecDecompress()
     *
     *  Availability:
     *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
     *    Windows:          in qtmlClient.lib 3.0 and later
        }
function DataCodecDecompress(dc: DataCodecComponent; srcData: UnivPtr; srcSize: UInt32; dstData: UnivPtr; dstBufferSize: UInt32): ComponentResult; external name '_DataCodecDecompress';
{
 *  DataCodecGetCompressBufferSize()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function DataCodecGetCompressBufferSize(dc: DataCodecComponent; srcSize: UInt32; var dstSize: UInt32): ComponentResult; external name '_DataCodecGetCompressBufferSize';
{
 *  DataCodecCompress()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function DataCodecCompress(dc: DataCodecComponent; srcData: UnivPtr; srcSize: UInt32; dstData: UnivPtr; dstBufferSize: UInt32; var actualDstSize: UInt32; var decompressSlop: UInt32): ComponentResult; external name '_DataCodecCompress';
{
 *  DataCodecBeginInterruptSafe()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function DataCodecBeginInterruptSafe(dc: DataCodecComponent; maxSrcSize: UInt32): ComponentResult; external name '_DataCodecBeginInterruptSafe';
{
 *  DataCodecEndInterruptSafe()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function DataCodecEndInterruptSafe(dc: DataCodecComponent): ComponentResult; external name '_DataCodecEndInterruptSafe';
{
 *  DataCodecDecompressPartial()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function DataCodecDecompressPartial(dc: DataCodecComponent; var next_in: UnivPtr; var avail_in: UInt32; var total_in: UInt32; var next_out: UnivPtr; var avail_out: UInt32; var total_out: UInt32; var didFinish: boolean): ComponentResult; external name '_DataCodecDecompressPartial';
{
 *  DataCodecCompressPartial()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function DataCodecCompressPartial(dc: DataCodecComponent; var next_in: UnivPtr; var avail_in: UInt32; var total_in: UInt32; var next_out: UnivPtr; var avail_out: UInt32; var total_out: UInt32; tryToFinish: boolean; var didFinish: boolean): ComponentResult; external name '_DataCodecCompressPartial';
type
    DataHCompletionProcPtr = procedure(request: Ptr; refcon: SInt32; err: OSErr);

    DataHCompletionUPP = ^SInt32; { an opaque UPP }


const
    kDataHCanRead               = $00000001;
    kDataHSpecialRead           = $00000002;
    kDataHSpecialReadFile       = $00000004;
    kDataHCanWrite              = $00000008;
    kDataHSpecialWrite          = $10;
    kDataHSpecialWriteFile      = $20;
    kDataHCanStreamingWrite     = $40;
    kDataHMustCheckDataRef      = $80;

    {  Data reference records for specific data ref types }

type
    HandleDataRefRecordPtr = ^HandleDataRefRecord;
    HandleDataRefRecord = record
        dataHndl:               Handle;
    end;

    HandleDataRefPtr                    = ^HandleDataRefRecord;
    HandleDataRef                       = ^HandleDataRefPtr;
    PointerDataRefRecordPtr = ^PointerDataRefRecord;
    PointerDataRefRecord = record
        data:                   Ptr;
        dataLength:             Size;
    end;

    PointerDataRefPtr                   = ^PointerDataRefRecord;
    PointerDataRef                      = ^PointerDataRefPtr;
    {  Data reference extensions }

const
    kDataRefExtensionChokeSpeed = $63686F6B (* 'chok' *);
    kDataRefExtensionFileName   = $666E616D (* 'fnam' *);
    kDataRefExtensionMIMEType   = $6D696D65 (* 'mime' *);
    kDataRefExtensionMacOSFileType = $66747970 (* 'ftyp' *);
    kDataRefExtensionInitializationData = $64617461 (* 'data' *);
    kDataRefExtensionQuickTimeMediaType = $6D747970 (* 'mtyp' *);

    kDataHChokeToMovieDataRate  = $01;                          {  param is 0 }
    kDataHChokeToParam          = $02;                          {  param is bytes per second }


type
    DataHChokeAtomRecordPtr = ^DataHChokeAtomRecord;
    DataHChokeAtomRecord = record
        flags:                  SInt32;                             {  one of kDataHChokeTo constants }
        param:                  SInt32;
    end;


    DataHVolumeListRecordPtr = ^DataHVolumeListRecord;
    DataHVolumeListRecord = record
        vRefNum:                SInt16;
        flags:                  SInt32;
    end;

    DataHVolumeListPtr                  = ^DataHVolumeListRecord;
    DataHVolumeList                     = ^DataHVolumeListPtr;

const
    kDataHExtendedSchedule      = $78746E64 (* 'xtnd' *);


type
    DataHScheduleRecordPtr = ^DataHScheduleRecord;
    DataHScheduleRecord = record
        timeNeededBy:           TimeRecord;
        extendedID:             SInt32;                             {  always is kDataHExtendedSchedule }
        extendedVers:           SInt32;                             {  always set to 0 }
        priority:               Fixed;                                  {  100.0 or more means must have. lower numbersÉ }
    end;

    DataHSchedulePtr                    = ^DataHScheduleRecord;
    {  Flags for DataHGetInfoFlags }

const
    kDataHInfoFlagNeverStreams  = $01;                          {  set if this data handler doesn't stream }
    kDataHInfoFlagCanUpdateDataRefs = $02;                      {  set if this data handler might update data reference }
    kDataHInfoFlagNeedsNetworkBandwidth = $04;                  {  set if this data handler may need to occupy the network }


    {  Types for DataHGetFileTypeOrdering }
    kDataHFileTypeMacOSFileType = $66747970 (* 'ftyp' *);
    kDataHFileTypeExtension     = $66657874 (* 'fext' *);
    kDataHFileTypeMIME          = $6D696D65 (* 'mime' *);


type
    DataHFileTypeOrderingPtr            = ^OSType;
    DataHFileTypeOrderingHandle         = ^DataHFileTypeOrderingPtr;

    {
     *  DataHGetData()
     *
     *  Availability:
     *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
     *    Windows:          in qtmlClient.lib 3.0 and later
        }
function DataHGetData(dh: DataHandler; h: Handle; hOffset: SInt32; offset: SInt32; size: SInt32): ComponentResult; external name '_DataHGetData';
{
 *  DataHPutData()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function DataHPutData(dh: DataHandler; h: Handle; hOffset: SInt32; var offset: SInt32; size: SInt32): ComponentResult; external name '_DataHPutData';
{
 *  DataHFlushData()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function DataHFlushData(dh: DataHandler): ComponentResult; external name '_DataHFlushData';
{
 *  DataHOpenForWrite()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function DataHOpenForWrite(dh: DataHandler): ComponentResult; external name '_DataHOpenForWrite';
{
 *  DataHCloseForWrite()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function DataHCloseForWrite(dh: DataHandler): ComponentResult; external name '_DataHCloseForWrite';
{
 *  DataHOpenForRead()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function DataHOpenForRead(dh: DataHandler): ComponentResult; external name '_DataHOpenForRead';
{
 *  DataHCloseForRead()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function DataHCloseForRead(dh: DataHandler): ComponentResult; external name '_DataHCloseForRead';
{
 *  DataHSetDataRef()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function DataHSetDataRef(dh: DataHandler; dataRef: Handle): ComponentResult; external name '_DataHSetDataRef';
{
 *  DataHGetDataRef()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function DataHGetDataRef(dh: DataHandler; var dataRef: Handle): ComponentResult; external name '_DataHGetDataRef';
{
 *  DataHCompareDataRef()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function DataHCompareDataRef(dh: DataHandler; dataRef: Handle; var equal: boolean): ComponentResult; external name '_DataHCompareDataRef';
{
 *  DataHTask()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function DataHTask(dh: DataHandler): ComponentResult; external name '_DataHTask';
{
 *  DataHScheduleData()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function DataHScheduleData(dh: DataHandler; PlaceToPutDataPtr: Ptr; FileOffset: SInt32; DataSize: SInt32; RefCon: SInt32; scheduleRec: DataHSchedulePtr; CompletionRtn: DataHCompletionUPP): ComponentResult; external name '_DataHScheduleData';
{
 *  DataHFinishData()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function DataHFinishData(dh: DataHandler; PlaceToPutDataPtr: Ptr; Cancel: boolean): ComponentResult; external name '_DataHFinishData';
{
 *  DataHFlushCache()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function DataHFlushCache(dh: DataHandler): ComponentResult; external name '_DataHFlushCache';
{
 *  DataHResolveDataRef()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function DataHResolveDataRef(dh: DataHandler; theDataRef: Handle; var wasChanged: boolean; userInterfaceAllowed: boolean): ComponentResult; external name '_DataHResolveDataRef';
{
 *  DataHGetFileSize()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function DataHGetFileSize(dh: DataHandler; var fileSize: SInt32): ComponentResult; external name '_DataHGetFileSize';
{
 *  DataHCanUseDataRef()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function DataHCanUseDataRef(dh: DataHandler; dataRef: Handle; var useFlags: SInt32): ComponentResult; external name '_DataHCanUseDataRef';
{
 *  DataHGetVolumeList()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function DataHGetVolumeList(dh: DataHandler; var volumeList: DataHVolumeList): ComponentResult; external name '_DataHGetVolumeList';
{
 *  DataHWrite()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function DataHWrite(dh: DataHandler; data: Ptr; offset: SInt32; size: SInt32; completion: DataHCompletionUPP; refCon: SInt32): ComponentResult; external name '_DataHWrite';
{
 *  DataHPreextend()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function DataHPreextend(dh: DataHandler; maxToAdd: UInt32; var spaceAdded: UInt32): ComponentResult; external name '_DataHPreextend';
{
 *  DataHSetFileSize()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function DataHSetFileSize(dh: DataHandler; fileSize: SInt32): ComponentResult; external name '_DataHSetFileSize';
{
 *  DataHGetFreeSpace()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function DataHGetFreeSpace(dh: DataHandler; var freeSize: UInt32): ComponentResult; external name '_DataHGetFreeSpace';
{
 *  DataHCreateFile()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function DataHCreateFile(dh: DataHandler; creator: OSType; deleteExisting: boolean): ComponentResult; external name '_DataHCreateFile';
{
 *  DataHGetPreferredBlockSize()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function DataHGetPreferredBlockSize(dh: DataHandler; var blockSize: SInt32): ComponentResult; external name '_DataHGetPreferredBlockSize';
{
 *  DataHGetDeviceIndex()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function DataHGetDeviceIndex(dh: DataHandler; var deviceIndex: SInt32): ComponentResult; external name '_DataHGetDeviceIndex';
{
 *  DataHIsStreamingDataHandler()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function DataHIsStreamingDataHandler(dh: DataHandler; var yes: boolean): ComponentResult; external name '_DataHIsStreamingDataHandler';
{
 *  DataHGetDataInBuffer()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function DataHGetDataInBuffer(dh: DataHandler; startOffset: SInt32; var size: SInt32): ComponentResult; external name '_DataHGetDataInBuffer';
{
 *  DataHGetScheduleAheadTime()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function DataHGetScheduleAheadTime(dh: DataHandler; var millisecs: SInt32): ComponentResult; external name '_DataHGetScheduleAheadTime';
{
 *  DataHSetCacheSizeLimit()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function DataHSetCacheSizeLimit(dh: DataHandler; cacheSizeLimit: Size): ComponentResult; external name '_DataHSetCacheSizeLimit';
{
 *  DataHGetCacheSizeLimit()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function DataHGetCacheSizeLimit(dh: DataHandler; var cacheSizeLimit: Size): ComponentResult; external name '_DataHGetCacheSizeLimit';
{
 *  DataHGetMovie()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function DataHGetMovie(dh: DataHandler; var theMovie: Movie; var id: SInt16): ComponentResult; external name '_DataHGetMovie';
{
 *  DataHAddMovie()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function DataHAddMovie(dh: DataHandler; theMovie: Movie; var id: SInt16): ComponentResult; external name '_DataHAddMovie';
{
 *  DataHUpdateMovie()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function DataHUpdateMovie(dh: DataHandler; theMovie: Movie; id: SInt16): ComponentResult; external name '_DataHUpdateMovie';
{
 *  DataHDoesBuffer()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function DataHDoesBuffer(dh: DataHandler; var buffersReads: boolean; var buffersWrites: boolean): ComponentResult; external name '_DataHDoesBuffer';
{
 *  DataHGetFileName()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function DataHGetFileName(dh: DataHandler; var str: Str255): ComponentResult; external name '_DataHGetFileName';
{
 *  DataHGetAvailableFileSize()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function DataHGetAvailableFileSize(dh: DataHandler; var fileSize: SInt32): ComponentResult; external name '_DataHGetAvailableFileSize';
{
 *  DataHGetMacOSFileType()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function DataHGetMacOSFileType(dh: DataHandler; var fileType: OSType): ComponentResult; external name '_DataHGetMacOSFileType';
{
 *  DataHGetMIMEType()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function DataHGetMIMEType(dh: DataHandler; var mimeType: Str255): ComponentResult; external name '_DataHGetMIMEType';
{
 *  DataHSetDataRefWithAnchor()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function DataHSetDataRefWithAnchor(dh: DataHandler; anchorDataRef: Handle; dataRefType: OSType; dataRef: Handle): ComponentResult; external name '_DataHSetDataRefWithAnchor';
{
 *  DataHGetDataRefWithAnchor()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function DataHGetDataRefWithAnchor(dh: DataHandler; anchorDataRef: Handle; dataRefType: OSType; var dataRef: Handle): ComponentResult; external name '_DataHGetDataRefWithAnchor';
{
 *  DataHSetMacOSFileType()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function DataHSetMacOSFileType(dh: DataHandler; fileType: OSType): ComponentResult; external name '_DataHSetMacOSFileType';
{
 *  DataHSetTimeBase()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function DataHSetTimeBase(dh: DataHandler; tb: TimeBase): ComponentResult; external name '_DataHSetTimeBase';
{
 *  DataHGetInfoFlags()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function DataHGetInfoFlags(dh: DataHandler; var flags: UInt32): ComponentResult; external name '_DataHGetInfoFlags';
{
 *  DataHScheduleData64()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function DataHScheduleData64(dh: DataHandler; PlaceToPutDataPtr: Ptr; const (*var*) FileOffset: wide; DataSize: SInt32; RefCon: SInt32; scheduleRec: DataHSchedulePtr; CompletionRtn: DataHCompletionUPP): ComponentResult; external name '_DataHScheduleData64';
{
 *  DataHWrite64()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function DataHWrite64(dh: DataHandler; data: Ptr; const (*var*) offset: wide; size: SInt32; completion: DataHCompletionUPP; refCon: SInt32): ComponentResult; external name '_DataHWrite64';
{
 *  DataHGetFileSize64()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function DataHGetFileSize64(dh: DataHandler; var fileSize: wide): ComponentResult; external name '_DataHGetFileSize64';
{
 *  DataHPreextend64()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function DataHPreextend64(dh: DataHandler; const (*var*) maxToAdd: wide; var spaceAdded: wide): ComponentResult; external name '_DataHPreextend64';
{
 *  DataHSetFileSize64()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function DataHSetFileSize64(dh: DataHandler; const (*var*) fileSize: wide): ComponentResult; external name '_DataHSetFileSize64';
{
 *  DataHGetFreeSpace64()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function DataHGetFreeSpace64(dh: DataHandler; var freeSize: wide): ComponentResult; external name '_DataHGetFreeSpace64';
{
 *  DataHAppend64()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function DataHAppend64(dh: DataHandler; data: UnivPtr; var fileOffset: wide; size: UInt32): ComponentResult; external name '_DataHAppend64';
{
 *  DataHReadAsync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function DataHReadAsync(dh: DataHandler; dataPtr: UnivPtr; dataSize: UInt32; const (*var*) dataOffset: wide; completion: DataHCompletionUPP; refCon: SInt32): ComponentResult; external name '_DataHReadAsync';
{
 *  DataHPollRead()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function DataHPollRead(dh: DataHandler; dataPtr: UnivPtr; var dataSizeSoFar: UInt32): ComponentResult; external name '_DataHPollRead';
{
 *  DataHGetDataAvailability()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function DataHGetDataAvailability(dh: DataHandler; offset: SInt32; len: SInt32; var missing_offset: SInt32; var missing_len: SInt32): ComponentResult; external name '_DataHGetDataAvailability';
{
 *  DataHGetFileSizeAsync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function DataHGetFileSizeAsync(dh: DataHandler; var fileSize: wide; completionRtn: DataHCompletionUPP; refCon: SInt32): ComponentResult; external name '_DataHGetFileSizeAsync';
{
 *  DataHGetDataRefAsType()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.1 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.1 and later
 }
function DataHGetDataRefAsType(dh: DataHandler; requestedType: OSType; var dataRef: Handle): ComponentResult; external name '_DataHGetDataRefAsType';
{
 *  DataHSetDataRefExtension()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.1 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.1 and later
 }
function DataHSetDataRefExtension(dh: DataHandler; extension: Handle; idType: OSType): ComponentResult; external name '_DataHSetDataRefExtension';
{
 *  DataHGetDataRefExtension()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.1 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.1 and later
 }
function DataHGetDataRefExtension(dh: DataHandler; var extension: Handle; idType: OSType): ComponentResult; external name '_DataHGetDataRefExtension';
{
 *  DataHGetMovieWithFlags()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.1 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.1 and later
 }
function DataHGetMovieWithFlags(dh: DataHandler; var theMovie: Movie; var id: SInt16; flags: SInt16): ComponentResult; external name '_DataHGetMovieWithFlags';
{
 *  DataHGetFileTypeOrdering()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 5.0 and later
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 5.0 and later
 }
function DataHGetFileTypeOrdering(dh: DataHandler; var orderingListHandle: DataHFileTypeOrderingHandle): ComponentResult; external name '_DataHGetFileTypeOrdering';
{  flags for DataHCreateFileWithFlags }

const
    kDataHCreateFileButDontCreateResFile = $00000001;

    {
     *  DataHCreateFileWithFlags()
     *
     *  Availability:
     *    Non-Carbon CFM:   in QuickTimeLib 5.0 and later
     *    CarbonLib:        in CarbonLib 1.3 and later
     *    Mac OS X:         in version 10.0 and later
     *    Windows:          in qtmlClient.lib 5.0 and later
        }
function DataHCreateFileWithFlags(dh: DataHandler; creator: OSType; deleteExisting: boolean; flags: UInt32): ComponentResult; external name '_DataHCreateFileWithFlags';
{
 *  DataHGetMIMETypeAsync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 5.0 and later
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 5.0 and later
 }
function DataHGetMIMETypeAsync(dh: DataHandler; var mimeType: Str255; completionRtn: DataHCompletionUPP; refCon: SInt32): ComponentResult; external name '_DataHGetMIMETypeAsync';
{
 *  DataHGetInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 5.0.1 and later
 *    CarbonLib:        in CarbonLib 1.6 and later
 *    Mac OS X:         in version 10.1 and later
 *    Windows:          in qtmlClient.lib 5.0.1 and later
 }
function DataHGetInfo(dh: DataHandler; what: OSType; info: UnivPtr): ComponentResult; external name '_DataHGetInfo';
{
 *  DataHSetIdleManager()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 6.0 and later
 *    CarbonLib:        in CarbonLib 1.6 and later
 *    Mac OS X:         in version 10.2 and later
 *    Windows:          in qtmlClient.lib 6.0 and later
 }
function DataHSetIdleManager(dh: DataHandler; im: IdleManager): ComponentResult; external name '_DataHSetIdleManager';
{
 *  DataHDeleteFile()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 6.0 and later
 *    CarbonLib:        in CarbonLib 1.6 and later
 *    Mac OS X:         in version 10.2 and later
 *    Windows:          in qtmlClient.lib 6.0 and later
 }
function DataHDeleteFile(dh: DataHandler): ComponentResult; external name '_DataHDeleteFile';
const
    kDataHMovieUsageDoAppendMDAT = $00000001;                   {  if set, datahandler should append wide and mdat atoms in append call }

    {
     *  DataHSetMovieUsageFlags()
     *
     *  Availability:
     *    Non-Carbon CFM:   in QuickTimeLib 6.0 and later
     *    CarbonLib:        in CarbonLib 1.6 and later
     *    Mac OS X:         in version 10.2 and later
     *    Windows:          in qtmlClient.lib 6.0 and later
        }
function DataHSetMovieUsageFlags(dh: DataHandler; flags: SInt32): ComponentResult; external name '_DataHSetMovieUsageFlags';
const
    kDataHTempUseSameDirectory  = $00000001;                    {  temp data ref should be in same directory as current data ref (vs. in temporary directory) }
    kDataHTempUseSameVolume     = $00000002;                    {  temp data ref should be on same volume as current data ref (vs. find "best" volume) }
    kDataHTempCreateFile        = $00000004;                    {  create the file }
    kDataHTempOpenFile          = $00000008;                    {  open temporary file for write (kDataHTempCreateFile must be passed, too) }

    {
     *  DataHUseTemporaryDataRef()
     *
     *  Availability:
     *    Non-Carbon CFM:   in QuickTimeLib 6.0 and later
     *    CarbonLib:        in CarbonLib 1.6 and later
     *    Mac OS X:         in version 10.2 and later
     *    Windows:          in qtmlClient.lib 6.0 and later
        }
function DataHUseTemporaryDataRef(dh: DataHandler; inFlags: SInt32): ComponentResult; external name '_DataHUseTemporaryDataRef';
{
 *  DataHGetTemporaryDataRefCapabilities()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 6.0 and later
 *    CarbonLib:        in CarbonLib 1.6 and later
 *    Mac OS X:         in version 10.2 and later
 *    Windows:          in qtmlClient.lib 6.0 and later
 }
function DataHGetTemporaryDataRefCapabilities(dh: DataHandler; var outUnderstoodFlags: SInt32): ComponentResult; external name '_DataHGetTemporaryDataRefCapabilities';
{
 *  DataHRenameFile()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 6.0 and later
 *    CarbonLib:        in CarbonLib 1.6 and later
 *    Mac OS X:         in version 10.2 and later
 *    Windows:          in qtmlClient.lib 6.0 and later
 }
function DataHRenameFile(dh: DataHandler; newDataRef: Handle): ComponentResult; external name '_DataHRenameFile';
{
 *  DataHPlaybackHints()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function DataHPlaybackHints(dh: DataHandler; flags: SInt32; minFileOffset: UInt32; maxFileOffset: UInt32; bytesPerSecond: SInt32): ComponentResult; external name '_DataHPlaybackHints';
{
 *  DataHPlaybackHints64()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.1 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.1 and later
 }
function DataHPlaybackHints64(dh: DataHandler; flags: SInt32; const (*var*) minFileOffset: wide; const (*var*) maxFileOffset: wide; bytesPerSecond: SInt32): ComponentResult; external name '_DataHPlaybackHints64';
{  Symbolic constants for DataHGetDataRate }

const
    kDataHGetDataRateInfiniteRate = $7FFFFFFF;                  {  all the data arrived instantaneously }

    {
     *  DataHGetDataRate()
     *
     *  Availability:
     *    Non-Carbon CFM:   in QuickTimeLib 5.0 and later
     *    CarbonLib:        in CarbonLib 1.3 and later
     *    Mac OS X:         in version 10.0 and later
     *    Windows:          in qtmlClient.lib 5.0 and later
        }
function DataHGetDataRate(dh: DataHandler; flags: SInt32; var bytesPerSecond: SInt32): ComponentResult; external name '_DataHGetDataRate';
{  Flags for DataHSetTimeHints }

const
    kDataHSetTimeHintsSkipBandwidthRequest = $01;               {  set if this data handler should use the network without requesting bandwidth }

    {
     *  DataHSetTimeHints()
     *
     *  Availability:
     *    Non-Carbon CFM:   in QuickTimeLib 5.0 and later
     *    CarbonLib:        in CarbonLib 1.3 and later
     *    Mac OS X:         in version 10.0 and later
     *    Windows:          in qtmlClient.lib 5.0 and later
        }
function DataHSetTimeHints(dh: DataHandler; flags: SInt32; bandwidthPriority: SInt32; scale: TimeScale; minTime: TimeValue; maxTime: TimeValue): ComponentResult; external name '_DataHSetTimeHints';
{ Standard type for video digitizers }

const
    videoDigitizerComponentType = $76646967 (* 'vdig' *);
    vdigInterfaceRev            = 2;

    {    Input Format Standards     }
    ntscIn                      = 0;                            {  current input format  }
    currentIn                   = 0;                            {  ntsc input format  }
    palIn                       = 1;                            {  pal input format  }
    secamIn                     = 2;                            {  secam input format  }
    ntscReallyIn                = 3;                            {  ntsc input format  }

    {    Input Formats  }
    compositeIn                 = 0;                            {  input is composite format  }
    sVideoIn                    = 1;                            {  input is sVideo format  }
    rgbComponentIn              = 2;                            {  input is rgb component format  }
    rgbComponentSyncIn          = 3;                            {  input is rgb component format (sync on green?) }
    yuvComponentIn              = 4;                            {  input is yuv component format  }
    yuvComponentSyncIn          = 5;                            {  input is yuv component format (sync on green?)  }
    tvTunerIn                   = 6;
    sdiIn                       = 7;


    {    Video Digitizer PlayThru States    }
    vdPlayThruOff               = 0;
    vdPlayThruOn                = 1;

    {    Input Color Space Modes    }
    vdDigitizerBW               = 0;                            {  black and white  }
    vdDigitizerRGB              = 1;                            {  rgb color  }

    {    Phase Lock Loop Modes  }
    vdBroadcastMode             = 0;                            {  Broadcast / Laser Disk video mode  }
    vdVTRMode                   = 1;                            {  VCR / Magnetic media mode  }

    {    Field Select Options   }
    vdUseAnyField               = 0;                            {  Digitizers choice on field use  }
    vdUseOddField               = 1;                            {  Use odd field for half size vert and smaller  }
    vdUseEvenField              = 2;                            {  Use even field for half size vert and smaller  }

    {    vdig types     }
    vdTypeBasic                 = 0;                            {  basic, no clipping  }
    vdTypeAlpha                 = 1;                            {  supports clipping with alpha channel  }
    vdTypeMask                  = 2;                            {  supports clipping with mask plane  }
    vdTypeKey                   = 3;                            {  supports clipping with key color(s)  }



    {    Digitizer Input Capability/Current Flags   }
    digiInDoesNTSC              = $00000001;                    {  digitizer supports NTSC input format  }
    digiInDoesPAL               = $00000002;                    {  digitizer supports PAL input format  }
    digiInDoesSECAM             = $00000004;                    {  digitizer supports SECAM input format  }
    digiInDoesGenLock           = $00000080;                    {  digitizer does genlock  }
    digiInDoesComposite         = $00000100;                    {  digitizer supports composite input type  }
    digiInDoesSVideo            = $00000200;                    {  digitizer supports S-Video input type  }
    digiInDoesComponent         = $00000400;                    {  digitizer supports component = rgb, input type  }
    digiInVTR_Broadcast         = $00000800;                    {  digitizer can differentiate between the two  }
    digiInDoesColor             = $00001000;                    {  digitizer supports color  }
    digiInDoesBW                = $00002000;                    {  digitizer supports black & white  }
                                                                {  Digitizer Input Current Flags = these are valid only during active operating conditions,    }
    digiInSignalLock            = $80000000;                    {  digitizer detects input signal is locked, this bit = horiz lock || vertical lock  }


    {    Digitizer Output Capability/Current Flags  }
    digiOutDoes1                = $00000001;                    {  digitizer supports 1 bit pixels  }
    digiOutDoes2                = $00000002;                    {  digitizer supports 2 bit pixels  }
    digiOutDoes4                = $00000004;                    {  digitizer supports 4 bit pixels  }
    digiOutDoes8                = $00000008;                    {  digitizer supports 8 bit pixels  }
    digiOutDoes16               = $00000010;                    {  digitizer supports 16 bit pixels  }
    digiOutDoes32               = $00000020;                    {  digitizer supports 32 bit pixels  }
    digiOutDoesDither           = $00000040;                    {  digitizer dithers in indexed modes  }
    digiOutDoesStretch          = $00000080;                    {  digitizer can arbitrarily stretch  }
    digiOutDoesShrink           = $00000100;                    {  digitizer can arbitrarily shrink  }
    digiOutDoesMask             = $00000200;                    {  digitizer can mask to clipping regions  }
    digiOutDoesDouble           = $00000800;                    {  digitizer can stretch to exactly double size  }
    digiOutDoesQuad             = $00001000;                    {  digitizer can stretch exactly quadruple size  }
    digiOutDoesQuarter          = $00002000;                    {  digitizer can shrink to exactly quarter size  }
    digiOutDoesSixteenth        = $00004000;                    {  digitizer can shrink to exactly sixteenth size  }
    digiOutDoesRotate           = $00008000;                    {  digitizer supports rotate transformations  }
    digiOutDoesHorizFlip        = $00010000;                    {  digitizer supports horizontal flips Sx < 0  }
    digiOutDoesVertFlip         = $00020000;                    {  digitizer supports vertical flips Sy < 0  }
    digiOutDoesSkew             = $00040000;                    {  digitizer supports skew = shear,twist,  }
    digiOutDoesBlend            = $00080000;
    digiOutDoesWarp             = $00100000;
    digiOutDoesHW_DMA           = $00200000;                    {  digitizer not constrained to local device  }
    digiOutDoesHWPlayThru       = $00400000;                    {  digitizer doesn't need time to play thru  }
    digiOutDoesILUT             = $00800000;                    {  digitizer does inverse LUT for index modes  }
    digiOutDoesKeyColor         = $01000000;                    {  digitizer does key color functions too  }
    digiOutDoesAsyncGrabs       = $02000000;                    {  digitizer supports async grabs  }
    digiOutDoesUnreadableScreenBits = $04000000;                {  playthru doesn't generate readable bits on screen }
    digiOutDoesCompress         = $08000000;                    {  supports alternate output data types  }
    digiOutDoesCompressOnly     = $10000000;                    {  can't provide raw frames anywhere  }
    digiOutDoesPlayThruDuringCompress = $20000000;              {  digi can do playthru while providing compressed data  }
    digiOutDoesCompressPartiallyVisible = $40000000;            {  digi doesn't need all bits visible on screen to do hardware compress  }
    digiOutDoesNotNeedCopyOfCompressData = $80000000;           {  digi doesn't need any bufferization when providing compressed data  }

    {    Types  }

type
    VideoDigitizerComponent             = ComponentInstance;
    VideoDigitizerError                 = ComponentResult;
    DigitizerInfoPtr = ^DigitizerInfo;
    DigitizerInfo = record
        vdigType:               SInt16;
        inputCapabilityFlags:   SInt32;
        outputCapabilityFlags:  SInt32;
        inputCurrentFlags:      SInt32;
        outputCurrentFlags:     SInt32;
        slot:                   SInt16;                             {  temporary for connection purposes  }
        gdh:                    GDHandle;                               {  temporary for digitizers that have preferred screen  }
        maskgdh:                GDHandle;                               {  temporary for digitizers that have mask planes  }
        minDestHeight:          SInt16;                             {  Smallest resizable height  }
        minDestWidth:           SInt16;                             {  Smallest resizable width  }
        maxDestHeight:          SInt16;                             {  Largest resizable height  }
        maxDestWidth:           SInt16;                             {  Largest resizable width  }
        blendLevels:            SInt16;                             {  Number of blend levels supported (2 if 1 bit mask)  }
        reserved:               SInt32;                             {  reserved  }
    end;

    VdigTypePtr = ^VdigType;
    VdigType = record
        digType:                SInt32;
        reserved:               SInt32;
    end;

    VdigTypeListPtr = ^VdigTypeList;
    VdigTypeList = record
        count:                  SInt16;
        list:                   array [0..0] of VdigType;
    end;

    VdigBufferRecPtr = ^VdigBufferRec;
    VdigBufferRec = record
        dest:                   PixMapHandle;
        location:               Point;
        reserved:               SInt32;
    end;

    VdigBufferRecListPtr = ^VdigBufferRecList;
    VdigBufferRecList = record
        count:                  SInt16;
        matrix:                 MatrixRecordPtr;
        mask:                   RgnHandle;
        list:                   array [0..0] of VdigBufferRec;
    end;

    VdigBufferRecListHandle             = ^VdigBufferRecListPtr;
    VdigIntProcPtr = procedure(flags: SInt32; refcon: SInt32);

    VdigIntUPP = ^SInt32; { an opaque UPP }
    VDCompressionListPtr = ^VDCompressionList;
    VDCompressionList = record
        codec:                  CodecComponent;
        cType:                  CodecType;
        typeName:               Str63;
        name:                   Str63;
        formatFlags:            SInt32;
        compressFlags:          SInt32;
        reserved:               SInt32;
    end;

    VDCompressionListHandle             = ^VDCompressionListPtr;

const
    dmaDepth1                   = 1;
    dmaDepth2                   = 2;
    dmaDepth4                   = 4;
    dmaDepth8                   = 8;
    dmaDepth16                  = 16;
    dmaDepth32                  = 32;
    dmaDepth2Gray               = 64;
    dmaDepth4Gray               = 128;
    dmaDepth8Gray               = 256;

    kVDIGControlledFrameRate    = -1;


    {
     *  VDGetMaxSrcRect()
     *
     *  Availability:
     *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
     *    Windows:          in qtmlClient.lib 3.0 and later
        }
function VDGetMaxSrcRect(ci: VideoDigitizerComponent; inputStd: SInt16; var maxSrcRect: Rect): VideoDigitizerError; external name '_VDGetMaxSrcRect';
{
 *  VDGetActiveSrcRect()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function VDGetActiveSrcRect(ci: VideoDigitizerComponent; inputStd: SInt16; var activeSrcRect: Rect): VideoDigitizerError; external name '_VDGetActiveSrcRect';
{
 *  VDSetDigitizerRect()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function VDSetDigitizerRect(ci: VideoDigitizerComponent; var digitizerRect: Rect): VideoDigitizerError; external name '_VDSetDigitizerRect';
{
 *  VDGetDigitizerRect()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function VDGetDigitizerRect(ci: VideoDigitizerComponent; var digitizerRect: Rect): VideoDigitizerError; external name '_VDGetDigitizerRect';
{
 *  VDGetVBlankRect()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function VDGetVBlankRect(ci: VideoDigitizerComponent; inputStd: SInt16; var vBlankRect: Rect): VideoDigitizerError; external name '_VDGetVBlankRect';
{
 *  VDGetMaskPixMap()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function VDGetMaskPixMap(ci: VideoDigitizerComponent; maskPixMap: PixMapHandle): VideoDigitizerError; external name '_VDGetMaskPixMap';
{
 *  VDGetPlayThruDestination()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function VDGetPlayThruDestination(ci: VideoDigitizerComponent; var dest: PixMapHandle; var destRect: Rect; var m: MatrixRecord; var mask: RgnHandle): VideoDigitizerError; external name '_VDGetPlayThruDestination';
{
 *  VDUseThisCLUT()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function VDUseThisCLUT(ci: VideoDigitizerComponent; colorTableHandle: CTabHandle): VideoDigitizerError; external name '_VDUseThisCLUT';
{
 *  VDSetInputGammaValue()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function VDSetInputGammaValue(ci: VideoDigitizerComponent; channel1: Fixed; channel2: Fixed; channel3: Fixed): VideoDigitizerError; external name '_VDSetInputGammaValue';
{
 *  VDGetInputGammaValue()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function VDGetInputGammaValue(ci: VideoDigitizerComponent; var channel1: Fixed; var channel2: Fixed; var channel3: Fixed): VideoDigitizerError; external name '_VDGetInputGammaValue';
{
 *  VDSetBrightness()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function VDSetBrightness(ci: VideoDigitizerComponent; var brightness: UInt16): VideoDigitizerError; external name '_VDSetBrightness';
{
 *  VDGetBrightness()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function VDGetBrightness(ci: VideoDigitizerComponent; var brightness: UInt16): VideoDigitizerError; external name '_VDGetBrightness';
{
 *  VDSetContrast()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function VDSetContrast(ci: VideoDigitizerComponent; var contrast: UInt16): VideoDigitizerError; external name '_VDSetContrast';
{
 *  VDSetHue()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function VDSetHue(ci: VideoDigitizerComponent; var hue: UInt16): VideoDigitizerError; external name '_VDSetHue';
{
 *  VDSetSharpness()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function VDSetSharpness(ci: VideoDigitizerComponent; var sharpness: UInt16): VideoDigitizerError; external name '_VDSetSharpness';
{
 *  VDSetSaturation()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function VDSetSaturation(ci: VideoDigitizerComponent; var saturation: UInt16): VideoDigitizerError; external name '_VDSetSaturation';
{
 *  VDGetContrast()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function VDGetContrast(ci: VideoDigitizerComponent; var contrast: UInt16): VideoDigitizerError; external name '_VDGetContrast';
{
 *  VDGetHue()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function VDGetHue(ci: VideoDigitizerComponent; var hue: UInt16): VideoDigitizerError; external name '_VDGetHue';
{
 *  VDGetSharpness()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function VDGetSharpness(ci: VideoDigitizerComponent; var sharpness: UInt16): VideoDigitizerError; external name '_VDGetSharpness';
{
 *  VDGetSaturation()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function VDGetSaturation(ci: VideoDigitizerComponent; var saturation: UInt16): VideoDigitizerError; external name '_VDGetSaturation';
{
 *  VDGrabOneFrame()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function VDGrabOneFrame(ci: VideoDigitizerComponent): VideoDigitizerError; external name '_VDGrabOneFrame';
{
 *  VDGetMaxAuxBuffer()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function VDGetMaxAuxBuffer(ci: VideoDigitizerComponent; var pm: PixMapHandle; var r: Rect): VideoDigitizerError; external name '_VDGetMaxAuxBuffer';
{
 *  VDGetDigitizerInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function VDGetDigitizerInfo(ci: VideoDigitizerComponent; var info: DigitizerInfo): VideoDigitizerError; external name '_VDGetDigitizerInfo';
{
 *  VDGetCurrentFlags()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function VDGetCurrentFlags(ci: VideoDigitizerComponent; var inputCurrentFlag: SInt32; var outputCurrentFlag: SInt32): VideoDigitizerError; external name '_VDGetCurrentFlags';
{
 *  VDSetKeyColor()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function VDSetKeyColor(ci: VideoDigitizerComponent; index: SInt32): VideoDigitizerError; external name '_VDSetKeyColor';
{
 *  VDGetKeyColor()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function VDGetKeyColor(ci: VideoDigitizerComponent; var index: SInt32): VideoDigitizerError; external name '_VDGetKeyColor';
{
 *  VDAddKeyColor()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function VDAddKeyColor(ci: VideoDigitizerComponent; var index: SInt32): VideoDigitizerError; external name '_VDAddKeyColor';
{
 *  VDGetNextKeyColor()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function VDGetNextKeyColor(ci: VideoDigitizerComponent; index: SInt32): VideoDigitizerError; external name '_VDGetNextKeyColor';
{
 *  VDSetKeyColorRange()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function VDSetKeyColorRange(ci: VideoDigitizerComponent; var minRGB: RGBColor; var maxRGB: RGBColor): VideoDigitizerError; external name '_VDSetKeyColorRange';
{
 *  VDGetKeyColorRange()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function VDGetKeyColorRange(ci: VideoDigitizerComponent; var minRGB: RGBColor; var maxRGB: RGBColor): VideoDigitizerError; external name '_VDGetKeyColorRange';
{
 *  VDSetDigitizerUserInterrupt()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function VDSetDigitizerUserInterrupt(ci: VideoDigitizerComponent; flags: SInt32; userInterruptProc: VdigIntUPP; refcon: SInt32): VideoDigitizerError; external name '_VDSetDigitizerUserInterrupt';
{
 *  VDSetInputColorSpaceMode()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function VDSetInputColorSpaceMode(ci: VideoDigitizerComponent; colorSpaceMode: SInt16): VideoDigitizerError; external name '_VDSetInputColorSpaceMode';
{
 *  VDGetInputColorSpaceMode()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function VDGetInputColorSpaceMode(ci: VideoDigitizerComponent; var colorSpaceMode: SInt16): VideoDigitizerError; external name '_VDGetInputColorSpaceMode';
{
 *  VDSetClipState()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function VDSetClipState(ci: VideoDigitizerComponent; clipEnable: SInt16): VideoDigitizerError; external name '_VDSetClipState';
{
 *  VDGetClipState()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function VDGetClipState(ci: VideoDigitizerComponent; var clipEnable: SInt16): VideoDigitizerError; external name '_VDGetClipState';
{
 *  VDSetClipRgn()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function VDSetClipRgn(ci: VideoDigitizerComponent; clipRegion: RgnHandle): VideoDigitizerError; external name '_VDSetClipRgn';
{
 *  VDClearClipRgn()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function VDClearClipRgn(ci: VideoDigitizerComponent; clipRegion: RgnHandle): VideoDigitizerError; external name '_VDClearClipRgn';
{
 *  VDGetCLUTInUse()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function VDGetCLUTInUse(ci: VideoDigitizerComponent; var colorTableHandle: CTabHandle): VideoDigitizerError; external name '_VDGetCLUTInUse';
{
 *  VDSetPLLFilterType()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function VDSetPLLFilterType(ci: VideoDigitizerComponent; pllType: SInt16): VideoDigitizerError; external name '_VDSetPLLFilterType';
{
 *  VDGetPLLFilterType()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function VDGetPLLFilterType(ci: VideoDigitizerComponent; var pllType: SInt16): VideoDigitizerError; external name '_VDGetPLLFilterType';
{
 *  VDGetMaskandValue()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function VDGetMaskandValue(ci: VideoDigitizerComponent; blendLevel: UInt16; var mask: SInt32; var value: SInt32): VideoDigitizerError; external name '_VDGetMaskandValue';
{
 *  VDSetMasterBlendLevel()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function VDSetMasterBlendLevel(ci: VideoDigitizerComponent; var blendLevel: UInt16): VideoDigitizerError; external name '_VDSetMasterBlendLevel';
{
 *  VDSetPlayThruDestination()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function VDSetPlayThruDestination(ci: VideoDigitizerComponent; dest: PixMapHandle; destRect: RectPtr; m: MatrixRecordPtr; mask: RgnHandle): VideoDigitizerError; external name '_VDSetPlayThruDestination';
{
 *  VDSetPlayThruOnOff()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function VDSetPlayThruOnOff(ci: VideoDigitizerComponent; state: SInt16): VideoDigitizerError; external name '_VDSetPlayThruOnOff';
{
 *  VDSetFieldPreference()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function VDSetFieldPreference(ci: VideoDigitizerComponent; fieldFlag: SInt16): VideoDigitizerError; external name '_VDSetFieldPreference';
{
 *  VDGetFieldPreference()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function VDGetFieldPreference(ci: VideoDigitizerComponent; var fieldFlag: SInt16): VideoDigitizerError; external name '_VDGetFieldPreference';
{
 *  VDPreflightDestination()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function VDPreflightDestination(ci: VideoDigitizerComponent; var digitizerRect: Rect; var dest: PixMapPtr; destRect: RectPtr; m: MatrixRecordPtr): VideoDigitizerError; external name '_VDPreflightDestination';
{
 *  VDPreflightGlobalRect()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function VDPreflightGlobalRect(ci: VideoDigitizerComponent; theWindow: GrafPtr; var globalRect: Rect): VideoDigitizerError; external name '_VDPreflightGlobalRect';
{
 *  VDSetPlayThruGlobalRect()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function VDSetPlayThruGlobalRect(ci: VideoDigitizerComponent; theWindow: GrafPtr; var globalRect: Rect): VideoDigitizerError; external name '_VDSetPlayThruGlobalRect';
{
 *  VDSetInputGammaRecord()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function VDSetInputGammaRecord(ci: VideoDigitizerComponent; inputGammaPtr: VDGamRecPtr): VideoDigitizerError; external name '_VDSetInputGammaRecord';
{
 *  VDGetInputGammaRecord()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function VDGetInputGammaRecord(ci: VideoDigitizerComponent; var inputGammaPtr: VDGamRecPtr): VideoDigitizerError; external name '_VDGetInputGammaRecord';
{
 *  VDSetBlackLevelValue()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function VDSetBlackLevelValue(ci: VideoDigitizerComponent; var blackLevel: UInt16): VideoDigitizerError; external name '_VDSetBlackLevelValue';
{
 *  VDGetBlackLevelValue()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function VDGetBlackLevelValue(ci: VideoDigitizerComponent; var blackLevel: UInt16): VideoDigitizerError; external name '_VDGetBlackLevelValue';
{
 *  VDSetWhiteLevelValue()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function VDSetWhiteLevelValue(ci: VideoDigitizerComponent; var whiteLevel: UInt16): VideoDigitizerError; external name '_VDSetWhiteLevelValue';
{
 *  VDGetWhiteLevelValue()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function VDGetWhiteLevelValue(ci: VideoDigitizerComponent; var whiteLevel: UInt16): VideoDigitizerError; external name '_VDGetWhiteLevelValue';
{
 *  VDGetVideoDefaults()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function VDGetVideoDefaults(ci: VideoDigitizerComponent; var blackLevel: UInt16; var whiteLevel: UInt16; var brightness: UInt16; var hue: UInt16; var saturation: UInt16; var contrast: UInt16; var sharpness: UInt16): VideoDigitizerError; external name '_VDGetVideoDefaults';
{
 *  VDGetNumberOfInputs()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function VDGetNumberOfInputs(ci: VideoDigitizerComponent; var inputs: SInt16): VideoDigitizerError; external name '_VDGetNumberOfInputs';
{
 *  VDGetInputFormat()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function VDGetInputFormat(ci: VideoDigitizerComponent; input: SInt16; var format: SInt16): VideoDigitizerError; external name '_VDGetInputFormat';
{
 *  VDSetInput()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function VDSetInput(ci: VideoDigitizerComponent; input: SInt16): VideoDigitizerError; external name '_VDSetInput';
{
 *  VDGetInput()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function VDGetInput(ci: VideoDigitizerComponent; var input: SInt16): VideoDigitizerError; external name '_VDGetInput';
{
 *  VDSetInputStandard()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function VDSetInputStandard(ci: VideoDigitizerComponent; inputStandard: SInt16): VideoDigitizerError; external name '_VDSetInputStandard';
{
 *  VDSetupBuffers()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function VDSetupBuffers(ci: VideoDigitizerComponent; bufferList: VdigBufferRecListHandle): VideoDigitizerError; external name '_VDSetupBuffers';
{
 *  VDGrabOneFrameAsync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function VDGrabOneFrameAsync(ci: VideoDigitizerComponent; buffer: SInt16): VideoDigitizerError; external name '_VDGrabOneFrameAsync';
{
 *  VDDone()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function VDDone(ci: VideoDigitizerComponent; buffer: SInt16): VideoDigitizerError; external name '_VDDone';
{
 *  VDSetCompression()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function VDSetCompression(ci: VideoDigitizerComponent; compressType: OSType; depth: SInt16; var bounds: Rect; spatialQuality: CodecQ; temporalQuality: CodecQ; keyFrameRate: SInt32): VideoDigitizerError; external name '_VDSetCompression';
{
 *  VDCompressOneFrameAsync()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function VDCompressOneFrameAsync(ci: VideoDigitizerComponent): VideoDigitizerError; external name '_VDCompressOneFrameAsync';
{    Note that UInt8* queuedFrameCount replaces Boolean* done. 0(==false) still means no frames, and 1(==true) one,
    but if more than one are available the number should be returned here. The value 2 previously meant more than one frame,
    so some VDIGs may return 2 even if more than 2 are available, and some will still return 1 as they are using the original definition }
{
 *  VDCompressDone()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function VDCompressDone(ci: VideoDigitizerComponent; var queuedFrameCount: UInt8; var theData: Ptr; var dataSize: SInt32; var similarity: UInt8; var t: TimeRecord): VideoDigitizerError; external name '_VDCompressDone';
{
 *  VDReleaseCompressBuffer()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function VDReleaseCompressBuffer(ci: VideoDigitizerComponent; bufferAddr: Ptr): VideoDigitizerError; external name '_VDReleaseCompressBuffer';
{
 *  VDGetImageDescription()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function VDGetImageDescription(ci: VideoDigitizerComponent; desc: ImageDescriptionHandle): VideoDigitizerError; external name '_VDGetImageDescription';
{
 *  VDResetCompressSequence()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function VDResetCompressSequence(ci: VideoDigitizerComponent): VideoDigitizerError; external name '_VDResetCompressSequence';
{
 *  VDSetCompressionOnOff()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function VDSetCompressionOnOff(ci: VideoDigitizerComponent; state: boolean): VideoDigitizerError; external name '_VDSetCompressionOnOff';
{
 *  VDGetCompressionTypes()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function VDGetCompressionTypes(ci: VideoDigitizerComponent; h: VDCompressionListHandle): VideoDigitizerError; external name '_VDGetCompressionTypes';
{
 *  VDSetTimeBase()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function VDSetTimeBase(ci: VideoDigitizerComponent; t: TimeBase): VideoDigitizerError; external name '_VDSetTimeBase';
{
 *  VDSetFrameRate()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function VDSetFrameRate(ci: VideoDigitizerComponent; framesPerSecond: Fixed): VideoDigitizerError; external name '_VDSetFrameRate';
{
 *  VDGetDataRate()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function VDGetDataRate(ci: VideoDigitizerComponent; var milliSecPerFrame: SInt32; var framesPerSecond: Fixed; var bytesPerSecond: SInt32): VideoDigitizerError; external name '_VDGetDataRate';
{
 *  VDGetSoundInputDriver()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function VDGetSoundInputDriver(ci: VideoDigitizerComponent; var soundDriverName: Str255): VideoDigitizerError; external name '_VDGetSoundInputDriver';
{
 *  VDGetDMADepths()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function VDGetDMADepths(ci: VideoDigitizerComponent; var depthArray: SInt32; var preferredDepth: SInt32): VideoDigitizerError; external name '_VDGetDMADepths';
{
 *  VDGetPreferredTimeScale()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function VDGetPreferredTimeScale(ci: VideoDigitizerComponent; var preferred: TimeScale): VideoDigitizerError; external name '_VDGetPreferredTimeScale';
{
 *  VDReleaseAsyncBuffers()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function VDReleaseAsyncBuffers(ci: VideoDigitizerComponent): VideoDigitizerError; external name '_VDReleaseAsyncBuffers';
{ 83 is reserved for compatibility reasons }
{
 *  VDSetDataRate()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function VDSetDataRate(ci: VideoDigitizerComponent; bytesPerSecond: SInt32): VideoDigitizerError; external name '_VDSetDataRate';
{
 *  VDGetTimeCode()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function VDGetTimeCode(ci: VideoDigitizerComponent; var atTime: TimeRecord; timeCodeFormat: UnivPtr; timeCodeTime: UnivPtr): VideoDigitizerError; external name '_VDGetTimeCode';
{
 *  VDUseSafeBuffers()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function VDUseSafeBuffers(ci: VideoDigitizerComponent; useSafeBuffers: boolean): VideoDigitizerError; external name '_VDUseSafeBuffers';
{
 *  VDGetSoundInputSource()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function VDGetSoundInputSource(ci: VideoDigitizerComponent; videoInput: SInt32; var soundInput: SInt32): VideoDigitizerError; external name '_VDGetSoundInputSource';
{
 *  VDGetCompressionTime()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function VDGetCompressionTime(ci: VideoDigitizerComponent; compressionType: OSType; depth: SInt16; var srcRect: Rect; var spatialQuality: CodecQ; var temporalQuality: CodecQ; var compressTime: UInt32): VideoDigitizerError; external name '_VDGetCompressionTime';
{
 *  VDSetPreferredPacketSize()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function VDSetPreferredPacketSize(ci: VideoDigitizerComponent; preferredPacketSizeInBytes: SInt32): VideoDigitizerError; external name '_VDSetPreferredPacketSize';
{
 *  VDSetPreferredImageDimensions()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function VDSetPreferredImageDimensions(ci: VideoDigitizerComponent; width: SInt32; height: SInt32): VideoDigitizerError; external name '_VDSetPreferredImageDimensions';
{
 *  VDGetPreferredImageDimensions()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function VDGetPreferredImageDimensions(ci: VideoDigitizerComponent; var width: SInt32; var height: SInt32): VideoDigitizerError; external name '_VDGetPreferredImageDimensions';
{
 *  VDGetInputName()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function VDGetInputName(ci: VideoDigitizerComponent; videoInput: SInt32; var name: Str255): VideoDigitizerError; external name '_VDGetInputName';
{
 *  VDSetDestinationPort()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function VDSetDestinationPort(ci: VideoDigitizerComponent; destPort: CGrafPtr): VideoDigitizerError; external name '_VDSetDestinationPort';
{
   The following call is designed to give the VDIG a little more control over how it is presented to the User, to clarify the
   distinction between Devices and Inputs. Historically, the assumption has been that there is one component registered per device
   and the component name is displayed. This change lets a component choose its name after registration.
   vdDeviceFlagShowInputsAsDevices is meant for components that register once and support multiple devices
   The UI is clearer if these are presented as device rather than inputs,
   and this allows a VDIG to present itself this way without huge restructuring
   vdDeviceFlagHideDevice is for the kind of VDIG that registers itself, and then can register a further VDIG for each device.
   If no hardware is available, returning this flag will omit it from the list.
   This call being made is also a good time to check for hardware and register further VDIG components if needed,
   allowing for lazy initialization when the Application needs to find a VDIG rather than on every launch or replug.
}


const
    vdDeviceFlagShowInputsAsDevices = $01;                      {  Tell the Panel to promote Inputs to Devices }
    vdDeviceFlagHideDevice      = $02;                          {  Omit this Device entirely from the list }

    {
     *  VDGetDeviceNameAndFlags()
     *
     *  Availability:
     *    Non-Carbon CFM:   in QuickTimeLib 6.0 and later
     *    CarbonLib:        in CarbonLib 1.6 and later
     *    Mac OS X:         in version 10.2 and later
     *    Windows:          in qtmlClient.lib 6.0 and later
        }
function VDGetDeviceNameAndFlags(ci: VideoDigitizerComponent; var outName: Str255; var outNameFlags: UInt32): VideoDigitizerError; external name '_VDGetDeviceNameAndFlags';
const
    vdFlagCaptureStarting       = $01;                          {  Capture is about to start; allocate bandwidth  }
    vdFlagCaptureStopping       = $02;                          {  Capture is about to stop; stop queuing frames }
    vdFlagCaptureIsForPreview   = $04;                          {  Capture is just to screen for preview purposes }
    vdFlagCaptureIsForRecord    = $08;                          {  Capture is going to be recorded }
    vdFlagCaptureLowLatency     = $10;                          {  Fresh frames are more important than delivering every frame - don't queue too much }
    vdFlagCaptureAlwaysUseTimeBase = $20;                       {  Use the timebase for every frame; don't worry about making durations uniform }
    vdFlagCaptureSetSettingsBegin = $40;                        {  A series of calls are about to be made to restore settings. }
    vdFlagCaptureSetSettingsEnd = $80;                          {  Finished restoring settings; any set calls after this are from the app or UI }

    {
     *  VDCaptureStateChanging()
     *
     *  Availability:
     *    Non-Carbon CFM:   in QuickTimeLib 6.0 and later
     *    CarbonLib:        in CarbonLib 1.6 and later
     *    Mac OS X:         in version 10.2 and later
     *    Windows:          in qtmlClient.lib 6.0 and later
        }
function VDCaptureStateChanging(ci: VideoDigitizerComponent; inStateFlags: UInt32): VideoDigitizerError; external name '_VDCaptureStateChanging';
{
   These UniqueID calls are so that the VDIG can give the SG information enabling it to restore a particular
   configuration - choose a particular device and input from those available.
   For example, restoring the specific camera for a set of several hot-plugged FireWire cameras
   the caller can pass nil if it is not interested in one of the IDs
   returning 0 in an ID means you don't have one
}

{
 *  VDGetUniqueIDs()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 6.0 and later
 *    CarbonLib:        in CarbonLib 1.6 and later
 *    Mac OS X:         in version 10.2 and later
 *    Windows:          in qtmlClient.lib 6.0 and later
 }
function VDGetUniqueIDs(ci: VideoDigitizerComponent; var outDeviceID: UInt64; var outInputID: UInt64): VideoDigitizerError; external name '_VDGetUniqueIDs';
{
   Note this is a 'Select' not a 'Set' - the assumption is that the Unique ID is a function of the hardware
   and not modifiable by the calling application. Either a nil pointer or 0 an the ID means don't care.
   return vdDontHaveThatUniqueIDErr if your device doesn't have a match.
}

{
 *  VDSelectUniqueIDs()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 6.0 and later
 *    CarbonLib:        in CarbonLib 1.6 and later
 *    Mac OS X:         in version 10.2 and later
 *    Windows:          in qtmlClient.lib 6.0 and later
 }
function VDSelectUniqueIDs(ci: VideoDigitizerComponent; const (*var*) inDeviceID: UInt64; const (*var*) inInputID: UInt64): VideoDigitizerError; external name '_VDSelectUniqueIDs';
const
    xmlParseComponentType       = $70617273 (* 'pars' *);
    xmlParseComponentSubType    = $786D6C20 (* 'xml ' *);

    xmlIdentifierInvalid        = 0;
    xmlIdentifierUnrecognized   = $FFFFFFFF;
    xmlContentTypeInvalid       = 0;
    xmlContentTypeElement       = 1;
    xmlContentTypeCharData      = 2;

    elementFlagAlwaysSelfContained = $00000001;                 {     Element doesn't have contents or closing tag even if it doesn't end with />, as in the HTML <img> tag }
    elementFlagPreserveWhiteSpace = $00000002;                  {   Preserve whitespace in content, default is to remove it  }
    xmlParseFlagAllowUppercase  = $00000001;                    {     Entities and attributes do not have to be lowercase (strict XML), but can be upper or mixed case as in HTML }
    xmlParseFlagAllowUnquotedAttributeValues = $00000002;       {     Attributes values do not have to be enclosed in quotes (strict XML), but can be left unquoted if they contain no spaces }
    xmlParseFlagEventParseOnly  = $00000004;                    {     Do event parsing only }

    attributeValueKindCharString = 0;
    attributeValueKindInteger   = $00000001;                    {     Number }
    attributeValueKindPercent   = $00000002;                    {     Number or percent }
    attributeValueKindBoolean   = $00000004;                    {     "true" or "false" }
    attributeValueKindOnOff     = $00000008;                    {     "on" or "off" }
    attributeValueKindColor     = $00000010;                    {     Either "#rrggbb" or a color name }
    attributeValueKindEnum      = $00000020;                    {     one of a number of strings; the enum strings are passed as a zero-separated, double-zero-terminated C string in the attributeKindValueInfo param }
    attributeValueKindCaseSensEnum = $00000040;                 {     one of a number of strings; the enum strings are passed as for attributeValueKindEnum, but the values are case-sensitive }
    MAX_ATTRIBUTE_VALUE_KIND    = $00000040;

    nameSpaceIDNone             = 0;

    {   A Parsed XML attribute value, one of number/percent, boolean/on-off, color, or enumerated type }

type
    XMLAttributeValuePtr = ^XMLAttributeValue;
    XMLAttributeValue = record
        case SInt16 of
        0: (
            number:             SInt32;                                 {     The value when valueKind is attributeValueKindInteger or attributeValueKindPercent }
            );
        1: (
            boolean:            boolean;                                {     The value when valueKind is attributeValueKindBoolean or attributeValueKindOnOff }
            );
        2: (
            color:              RGBColor;                               {     The value when valueKind is attributeValueKindColor }
            );
        3: (
            enumType:           UInt32;                                 {     The value when valueKind is attributeValueKindEnum }
            );
    end;

    {   An XML attribute-value pair }
    XMLAttributePtr = ^XMLAttribute;
    XMLAttribute = record
        identifier:             UInt32;                                 {     Tokenized identifier, if the attribute name was recognized by the parser }
        name:                   CStringPtr;                             {     Attribute name, Only present if identifier == xmlIdentifierUnrecognized }
        valueKind:              SInt32;                             {     Type of parsed value, if the value was recognized and parsed; otherwise, attributeValueKindCharString }
        value:                  XMLAttributeValue;                      {     Parsed attribute value }
        valueStr:               CStringPtr;                             {     Always present }
    end;

    {   Forward struct declarations for recursively-defined tree structure }
    XMLContentPtr = ^XMLContent;
    {
        An XML Element, i.e.
            <element attr="value" attr="value" ...> [contents] </element>
        or
            <element attr="value" attr="value" .../>
    }
    XMLElementPtr = ^XMLElement;
    XMLElement = record
        identifier:             UInt32;                                 {     Tokenized identifier, if the element name was recognized by the parser }
        name:                   CStringPtr;                             {     Element name, only present if identifier == xmlIdentifierUnrecognized }
        attributes:             XMLAttributePtr;                        {     Array of attributes, terminated with an attribute with identifier == xmlIdentifierInvalid }
        contents:               XMLContentPtr;                          {     Array of contents, terminated with a content with kind == xmlIdentifierInvalid }
    end;

    {
        The content of an XML element is a series of parts, each of which may be either another element
        or simply character data.
    }
    XMLElementContentPtr = ^XMLElementContent;
    XMLElementContent = record
        case SInt16 of
        0: (
            element:            XMLElement;                             {     The contents when the content kind is xmlContentTypeElement }
            );
        1: (
            charData:           CStringPtr;                             {     The contents when the content kind is xmlContentTypeCharData }
            );
    end;

    XMLContent = record
        kind:                   UInt32;
        actualContent:          XMLElementContent;
    end;

    XMLDocRecordPtr = ^XMLDocRecord;
    XMLDocRecord = record
        xmlDataStorage:         Ptr;                                    {     opaque storage }
        rootElement:            XMLElement;
    end;

    XMLDoc                              = ^XMLDocRecord;
    { callback routines for event parsing }
    StartDocumentHandler = function(refcon: SInt32): ComponentResult;

    EndDocumentHandler = function(refcon: SInt32): ComponentResult;

    StartElementHandler = function(name: ConstCStringPtr; var atts: ConstCStringPtr; refcon: SInt32): ComponentResult;

    EndElementHandler = function(name: ConstCStringPtr; refcon: SInt32): ComponentResult;

    CharDataHandler = function(charData: ConstCStringPtr; refcon: SInt32): ComponentResult;

    PreprocessInstructionHandler = function(name: ConstCStringPtr; atts: ConstCStringPtrPtr; refcon: SInt32): ComponentResult;

    CommentHandler = function(comment: ConstCStringPtr; refcon: SInt32): ComponentResult;

    CDataHandler = function(cdata: ConstCStringPtr; refcon: SInt32): ComponentResult;

    StartDocumentHandlerUPP = ^SInt32; { an opaque UPP }
    EndDocumentHandlerUPP = ^SInt32; { an opaque UPP }
    StartElementHandlerUPP = ^SInt32; { an opaque UPP }
    EndElementHandlerUPP = ^SInt32; { an opaque UPP }
    CharDataHandlerUPP = ^SInt32; { an opaque UPP }
    PreprocessInstructionHandlerUPP = ^SInt32; { an opaque UPP }
    CommentHandlerUPP = ^SInt32; { an opaque UPP }
    CDataHandlerUPP = ^SInt32; { an opaque UPP }
    {   Parses the XML file pointed to by dataRef, returning a XMLDoc parse tree }
    {
     *  XMLParseDataRef()
     *
     *  Availability:
     *    Non-Carbon CFM:   in QuickTimeLib 5.0 and later
     *    CarbonLib:        in CarbonLib 1.3 and later
     *    Mac OS X:         in version 10.0 and later
     *    Windows:          in qtmlClient.lib 5.0 and later
        }
function XMLParseDataRef(aParser: ComponentInstance; dataRef: Handle; dataRefType: OSType; parseFlags: SInt32; var document: XMLDoc): ComponentResult; external name '_XMLParseDataRef';
{   Parses the XML file pointed to by fileSpec, returning a XMLDoc parse tree }
{
 *  XMLParseFile()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 5.0 and later
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 5.0 and later
 }
function XMLParseFile(aParser: ComponentInstance; fileSpec: ConstFSSpecPtr; parseFlags: SInt32; var document: XMLDoc): ComponentResult; external name '_XMLParseFile';
{   Disposes of a XMLDoc parse tree }
{
 *  XMLParseDisposeXMLDoc()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 5.0 and later
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 5.0 and later
 }
function XMLParseDisposeXMLDoc(aParser: ComponentInstance; document: XMLDoc): ComponentResult; external name '_XMLParseDisposeXMLDoc';
{
    Returns a more detailed description of the error and the line in which it occurred, if a
    file failed to parse properly.
}
{
 *  XMLParseGetDetailedParseError()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 5.0 and later
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 5.0 and later
 }
function XMLParseGetDetailedParseError(aParser: ComponentInstance; var errorLine: SInt32; errDesc: StringPtr): ComponentResult; external name '_XMLParseGetDetailedParseError';
{
    Tell the parser of an element to be recognized. The tokenized element unique identifier is
    passed in *elementID, unless *elementID is zero, whereupon a unique ID is generated and returned.
    Thus, a valid element identifier can never be zero.
}
{
 *  XMLParseAddElement()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 5.0 and later
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 5.0 and later
 }
function XMLParseAddElement(aParser: ComponentInstance; elementName: CStringPtr; nameSpaceID: UInt32; var elementID: UInt32; elementFlags: SInt32): ComponentResult; external name '_XMLParseAddElement';
{
    Tells the parser of an attribute for the specified element. The tokenized attribute unique
    ID is passed in *attributeID, unless *attributeID is zero, whereupon a unique ID is generated and
    returned. Thus, a valid attribute identifier can never be zero.
}
{
 *  XMLParseAddAttribute()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 5.0 and later
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 5.0 and later
 }
function XMLParseAddAttribute(aParser: ComponentInstance; elementID: UInt32; nameSpaceID: UInt32; attributeName: CStringPtr; var attributeID: UInt32): ComponentResult; external name '_XMLParseAddAttribute';
{
    Tells the parser of several attributes for the specified element. The attributes are passed
    as a zero-delimited, double-zero-terminated C string in attributeNames, and the attribute
    IDs are passed in on attributeIDs as an array; if any attributeIDs are zero, unique IDs
    are generated for those and returned
}
{
 *  XMLParseAddMultipleAttributes()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 5.0 and later
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 5.0 and later
 }
function XMLParseAddMultipleAttributes(aParser: ComponentInstance; elementID: UInt32; var nameSpaceIDs: UInt32; attributeNames: CStringPtr; var attributeIDs: UInt32): ComponentResult; external name '_XMLParseAddMultipleAttributes';
{
    Tells the parser of an attribute, which may have a particular type of value, for the
    specified element. Params are as in XMLParseAddAttribute, plus all the kinds of values
    the attribute may have are passed in attributeValueKind, and optional additional information
    required to tokenize the particular kind of attribute is passed in attributeValueKindInfo
}
{
 *  XMLParseAddAttributeAndValue()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 5.0 and later
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 5.0 and later
 }
function XMLParseAddAttributeAndValue(aParser: ComponentInstance; elementID: UInt32; nameSpaceID: UInt32; attributeName: CStringPtr; var attributeID: UInt32; attributeValueKind: UInt32; attributeValueKindInfo: UnivPtr): ComponentResult; external name '_XMLParseAddAttributeAndValue';
{
    Tells the parser of several attributes, which may have a particular type of value, for the
    specified element. Params are as in XMLParseAddMultipleAttributes, plus all the kinds of values
    the attributes may have are passed in attributeValueKinds, and optional additional information
    required to tokenize the particular kind of attributes is passed in attributeValueKindInfos
}
{
 *  XMLParseAddMultipleAttributesAndValues()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 5.0 and later
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 5.0 and later
 }
function XMLParseAddMultipleAttributesAndValues(aParser: ComponentInstance; elementID: UInt32; var nameSpaceIDs: UInt32; attributeNames: CStringPtr; var attributeIDs: UInt32; var attributeValueKinds: UInt32; var attributeValueKindInfos: UnivPtr): ComponentResult; external name '_XMLParseAddMultipleAttributesAndValues';
{
    Tells the parser that the particular attribute may have an additional kind of
    value, as specified by attributeValueKind and attributeValueKindInfo
}
{
 *  XMLParseAddAttributeValueKind()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 5.0 and later
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 5.0 and later
 }
function XMLParseAddAttributeValueKind(aParser: ComponentInstance; elementID: UInt32; attributeID: UInt32; attributeValueKind: UInt32; attributeValueKindInfo: UnivPtr): ComponentResult; external name '_XMLParseAddAttributeValueKind';
{
    Tell the parser of a namespace to be recognized. The tokenized namespace unique identifier is
    passed in *nameSpaceID, unless *nameSpaceID is zero, whereupon a unique ID is generated and returned.
    Thus, a valid nameSpaceID identifier can never be zero.
}
{
 *  XMLParseAddNameSpace()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 5.0 and later
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 5.0 and later
 }
function XMLParseAddNameSpace(aParser: ComponentInstance; nameSpaceURL: CStringPtr; var nameSpaceID: UInt32): ComponentResult; external name '_XMLParseAddNameSpace';
{   Specifies the offset and limit for reading from the dataref to be used when parsing }
{
 *  XMLParseSetOffsetAndLimit()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 5.0 and later
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 5.0 and later
 }
function XMLParseSetOffsetAndLimit(aParser: ComponentInstance; offset: UInt32; limit: UInt32): ComponentResult; external name '_XMLParseSetOffsetAndLimit';
{   Set the event parse refcon }
{
 *  XMLParseSetEventParseRefCon()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 5.0 and later
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 5.0 and later
 }
function XMLParseSetEventParseRefCon(aParser: ComponentInstance; refcon: SInt32): ComponentResult; external name '_XMLParseSetEventParseRefCon';
{   Set the start document handler UPP for event parsing }
{
 *  XMLParseSetStartDocumentHandler()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 5.0 and later
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 5.0 and later
 }
function XMLParseSetStartDocumentHandler(aParser: ComponentInstance; startDocument: StartDocumentHandlerUPP): ComponentResult; external name '_XMLParseSetStartDocumentHandler';
{   Set the end document handler UPP for event parsing }
{
 *  XMLParseSetEndDocumentHandler()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 5.0 and later
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 5.0 and later
 }
function XMLParseSetEndDocumentHandler(aParser: ComponentInstance; endDocument: EndDocumentHandlerUPP): ComponentResult; external name '_XMLParseSetEndDocumentHandler';
{   Set the start element handler UPP for event parsing }
{
 *  XMLParseSetStartElementHandler()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 5.0 and later
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 5.0 and later
 }
function XMLParseSetStartElementHandler(aParser: ComponentInstance; startElement: StartElementHandlerUPP): ComponentResult; external name '_XMLParseSetStartElementHandler';
{   Set the end element handler UPP for event parsing }
{
 *  XMLParseSetEndElementHandler()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 5.0 and later
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 5.0 and later
 }
function XMLParseSetEndElementHandler(aParser: ComponentInstance; endElement: EndElementHandlerUPP): ComponentResult; external name '_XMLParseSetEndElementHandler';
{   Set the character data handler UPP for event parsing }
{
 *  XMLParseSetCharDataHandler()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 5.0 and later
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 5.0 and later
 }
function XMLParseSetCharDataHandler(aParser: ComponentInstance; charData: CharDataHandlerUPP): ComponentResult; external name '_XMLParseSetCharDataHandler';
{   Set the preprocess instruction handler UPP for event parsing }
{
 *  XMLParseSetPreprocessInstructionHandler()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 5.0 and later
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 5.0 and later
 }
function XMLParseSetPreprocessInstructionHandler(aParser: ComponentInstance; preprocessInstruction: PreprocessInstructionHandlerUPP): ComponentResult; external name '_XMLParseSetPreprocessInstructionHandler';
{   Set the comment handler UPP for event parsing }
{
 *  XMLParseSetCommentHandler()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 5.0 and later
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 5.0 and later
 }
function XMLParseSetCommentHandler(aParser: ComponentInstance; comment: CommentHandlerUPP): ComponentResult; external name '_XMLParseSetCommentHandler';
{   Set the cdata handler UPP for event parsing }
{
 *  XMLParseSetCDataHandler()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 6.0 and later
 *    CarbonLib:        in CarbonLib 1.6 and later
 *    Mac OS X:         in version 10.2 and later
 *    Windows:          in qtmlClient.lib 6.0 and later
 }
function XMLParseSetCDataHandler(aParser: ComponentInstance; cdata: CDataHandlerUPP): ComponentResult; external name '_XMLParseSetCDataHandler';
{
    Helper Macros

        These macros allow you to easily add entities and attributes to the parser
        in an error free manner when the identifiers are defined in a particular manner.
        For these to work, you must define the identifiers as follows:

        For entities, they must be defined as element_elementName, as in:

            enum
            (
                element_xml =   1,      //  "xml"
                element_head,           //  "head"
                element_body            //  "body"
            );

        If the element name has characters that are illegal in an identifier,
        some of the macros support that, but the identifier must not contain
        the illegal characters:

            enum
            (
                element_rootlayout      //  "root-layout"
            )

        For attribute names, similar rules apply except that they must be defined
        as attr_attributeName, as in:

            enum
            (
                attr_src    =   1,      //  "src"
                attr_href,
                attr_width,
                attr_height
            )

        Finally, the existence of local variables elementID and attributeID is required.
}
{
    Adds the specified element to the parser, i.e. XML_ADD_ELEMENT(head) adds the element "head" with
    a unique identifier of element_head
}
{
    Adds the specified element to the parser, not using the same string to generate the identifier and
    the element name. Use for element names that contain characters which are illegal in identifiers,
    i.e XML_ADD_COMPLEX_ELEMENT("root-layout",rootlayout) adds the element "root-layout" with a unique
    identifier of element_rootlayout
}
{
    Adds the specified attribute to the current element in the parser, i.e. XML_ADD_ATTRIBUTE(src)
    adds the attribute "src" to the current element, and identifies it by attr_src
}
{
    Adds the specified attribute to the current element in the parser, i.e. XML_ADD_ATTRIBUTE(element_img, src)
    adds the attribute "src" to the element_img element, and identifies it by attr_src
    Adds the specified attribute to the current element in the parser, not using the same string to
    generate the identifier and the element name. Use for attribute names that contain characters which
    are illegal in identifiers, i.e XML_ADD_COMPLEX_ATTRIBUTE("http-equiv",httpequiv) adds the element
    "http-equiv" with a unique identifier of attr_httpequiv
}


{
    General Sequence Grab stuff
}

type
    SeqGrabComponent                    = ComponentInstance;
    SGChannel                           = ComponentInstance;

const
    SeqGrabComponentType        = $62617267 (* 'barg' *);
    SeqGrabChannelType          = $73676368 (* 'sgch' *);
    SeqGrabPanelType            = $7367706E (* 'sgpn' *);
    SeqGrabCompressionPanelType = $636D7072 (* 'cmpr' *);
    SeqGrabSourcePanelType      = $736F7572 (* 'sour' *);

    seqGrabToDisk               = 1;
    seqGrabToMemory             = 2;
    seqGrabDontUseTempMemory    = 4;
    seqGrabAppendToFile         = 8;
    seqGrabDontAddMovieResource = 16;
    seqGrabDontMakeMovie        = 32;
    seqGrabPreExtendFile        = 64;
    seqGrabDataProcIsInterruptSafe = 128;
    seqGrabDataProcDoesOverlappingReads = 256;


type
    SeqGrabDataOutputEnum               = UInt32;

const
    seqGrabRecord               = 1;
    seqGrabPreview              = 2;
    seqGrabPlayDuringRecord     = 4;
    seqGrabLowLatencyCapture    = 8;                            {  return the freshest frame possible, for live work (videoconferencing, live broadcast, live image processing)  }
    seqGrabAlwaysUseTimeBase    = 16;                           {  Tell VDIGs to use TimebaseTime always, rather than creating uniform frame durations, for more accurate live sync with audio  }


type
    SeqGrabUsageEnum                    = UInt32;

const
    seqGrabHasBounds            = 1;
    seqGrabHasVolume            = 2;
    seqGrabHasDiscreteSamples   = 4;
    seqGrabDoNotBufferizeData   = 8;
    seqGrabCanMoveWindowWhileRecording = 16;


type
    SeqGrabChannelInfoEnum              = UInt32;
    SGOutputRecordPtr = ^SGOutputRecord;
    SGOutputRecord = record
        data:                   array [0..0] of SInt32;
    end;

    SGOutput                            = ^SGOutputRecord;
    SeqGrabFrameInfoPtr = ^SeqGrabFrameInfo;
    SeqGrabFrameInfo = record
        frameOffset:            SInt32;
        frameTime:              SInt32;
        frameSize:              SInt32;
        frameChannel:           SGChannel;
        frameRefCon:            SInt32;
    end;

    SeqGrabExtendedFrameInfoPtr = ^SeqGrabExtendedFrameInfo;
    SeqGrabExtendedFrameInfo = record
        frameOffset:            wide;
        frameTime:              SInt32;
        frameSize:              SInt32;
        frameChannel:           SGChannel;
        frameRefCon:            SInt32;
        frameOutput:            SGOutput;
    end;


const
    grabPictOffScreen           = 1;
    grabPictIgnoreClip          = 2;
    grabPictCurrentImage        = 4;

    sgFlagControlledGrab        = $01;
    sgFlagAllowNonRGBPixMaps    = $02;


type
    SGDataProcPtr = function(c: SGChannel; p: Ptr; len: SInt32; var offset: SInt32; chRefCon: SInt32; time: TimeValue; writeType: SInt16; refCon: SInt32): OSErr;

    SGDataUPP = ^SInt32; { an opaque UPP }
    SGDeviceInputNamePtr = ^SGDeviceInputName;
    SGDeviceInputName = record
        name:                   Str63;
        icon:                   Handle;
        flags:                  SInt32;
        reserved:               SInt32;                             {  zero }
    end;


const
    sgDeviceInputNameFlagInputUnavailable = $01;


type
    SGDeviceInputListRecordPtr = ^SGDeviceInputListRecord;
    SGDeviceInputListRecord = record
        count:                  SInt16;
        selectedIndex:          SInt16;
        reserved:               SInt32;                             {  zero }
        entry:                  array [0..0] of SGDeviceInputName;
    end;

    SGDeviceInputListPtr                = ^SGDeviceInputListRecord;
    SGDeviceInputList                   = ^SGDeviceInputListPtr;
    SGDeviceNamePtr = ^SGDeviceName;
    SGDeviceName = record
        name:                   Str63;
        icon:                   Handle;
        flags:                  SInt32;
        refCon:                 SInt32;
        inputs:                 SGDeviceInputList;                      {  list of inputs; formerly reserved to 0 }
    end;


const
    sgDeviceNameFlagDeviceUnavailable = $01;
    sgDeviceNameFlagShowInputsAsDevices = $02;


type
    SGDeviceListRecordPtr = ^SGDeviceListRecord;
    SGDeviceListRecord = record
        count:                  SInt16;
        selectedIndex:          SInt16;
        reserved:               SInt32;                             {  zero }
        entry:                  array [0..0] of SGDeviceName;
    end;

    SGDeviceListPtr                     = ^SGDeviceListRecord;
    SGDeviceList                        = ^SGDeviceListPtr;

const
    sgDeviceListWithIcons       = $01;
    sgDeviceListDontCheckAvailability = $02;
    sgDeviceListIncludeInputs   = $04;

    seqGrabWriteAppend          = 0;
    seqGrabWriteReserve         = 1;
    seqGrabWriteFill            = 2;

    seqGrabUnpause              = 0;
    seqGrabPause                = 1;
    seqGrabPauseForMenu         = 3;

    channelFlagDontOpenResFile  = 2;
    channelFlagHasDependency    = 4;


type
    SGModalFilterProcPtr = function(theDialog: DialogRef; const (*var*) theEvent: EventRecord; var itemHit: SInt16; refCon: SInt32): boolean;

    SGModalFilterUPP = ^SInt32; { an opaque UPP }

const
    sgPanelFlagForPanel         = 1;

    seqGrabSettingsPreviewOnly  = 1;

    channelPlayNormal           = 0;
    channelPlayFast             = 1;
    channelPlayHighQuality      = 2;
    channelPlayAllData          = 4;


    {
     *  SGInitialize()
     *
     *  Availability:
     *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
     *    Windows:          in qtmlClient.lib 3.0 and later
        }
function SGInitialize(s: SeqGrabComponent): ComponentResult; external name '_SGInitialize';
{
 *  SGSetDataOutput()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGSetDataOutput(s: SeqGrabComponent; const (*var*) movieFile: FSSpec; whereFlags: SInt32): ComponentResult; external name '_SGSetDataOutput';
{
 *  SGGetDataOutput()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGGetDataOutput(s: SeqGrabComponent; var movieFile: FSSpec; var whereFlags: SInt32): ComponentResult; external name '_SGGetDataOutput';
{
 *  SGSetGWorld()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGSetGWorld(s: SeqGrabComponent; gp: CGrafPtr; gd: GDHandle): ComponentResult; external name '_SGSetGWorld';
{
 *  SGGetGWorld()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGGetGWorld(s: SeqGrabComponent; var gp: CGrafPtr; var gd: GDHandle): ComponentResult; external name '_SGGetGWorld';
{
 *  SGNewChannel()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGNewChannel(s: SeqGrabComponent; channelType: OSType; var ref: SGChannel): ComponentResult; external name '_SGNewChannel';
{
 *  SGDisposeChannel()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGDisposeChannel(s: SeqGrabComponent; c: SGChannel): ComponentResult; external name '_SGDisposeChannel';
{
 *  SGStartPreview()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGStartPreview(s: SeqGrabComponent): ComponentResult; external name '_SGStartPreview';
{
 *  SGStartRecord()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGStartRecord(s: SeqGrabComponent): ComponentResult; external name '_SGStartRecord';
{
 *  SGIdle()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGIdle(s: SeqGrabComponent): ComponentResult; external name '_SGIdle';
{
 *  SGStop()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGStop(s: SeqGrabComponent): ComponentResult; external name '_SGStop';
{
 *  SGPause()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGPause(s: SeqGrabComponent; pause: ByteParameter): ComponentResult; external name '_SGPause';
{
 *  SGPrepare()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGPrepare(s: SeqGrabComponent; prepareForPreview: boolean; prepareForRecord: boolean): ComponentResult; external name '_SGPrepare';
{
 *  SGRelease()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGRelease(s: SeqGrabComponent): ComponentResult; external name '_SGRelease';
{
 *  SGGetMovie()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGGetMovie(s: SeqGrabComponent): Movie; external name '_SGGetMovie';
{
 *  SGSetMaximumRecordTime()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGSetMaximumRecordTime(s: SeqGrabComponent; ticks: UInt32): ComponentResult; external name '_SGSetMaximumRecordTime';
{
 *  SGGetMaximumRecordTime()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGGetMaximumRecordTime(s: SeqGrabComponent; var ticks: UInt32): ComponentResult; external name '_SGGetMaximumRecordTime';
{
 *  SGGetStorageSpaceRemaining()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGGetStorageSpaceRemaining(s: SeqGrabComponent; var bytes: UInt32): ComponentResult; external name '_SGGetStorageSpaceRemaining';
{
 *  SGGetTimeRemaining()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGGetTimeRemaining(s: SeqGrabComponent; var ticksLeft: SInt32): ComponentResult; external name '_SGGetTimeRemaining';
{
 *  SGGrabPict()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGGrabPict(s: SeqGrabComponent; var p: PicHandle; const (*var*) bounds: Rect; offscreenDepth: SInt16; grabPictFlags: SInt32): ComponentResult; external name '_SGGrabPict';
{
 *  SGGetLastMovieResID()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGGetLastMovieResID(s: SeqGrabComponent; var resID: SInt16): ComponentResult; external name '_SGGetLastMovieResID';
{
 *  SGSetFlags()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGSetFlags(s: SeqGrabComponent; sgFlags: SInt32): ComponentResult; external name '_SGSetFlags';
{
 *  SGGetFlags()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGGetFlags(s: SeqGrabComponent; var sgFlags: SInt32): ComponentResult; external name '_SGGetFlags';
{
 *  SGSetDataProc()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGSetDataProc(s: SeqGrabComponent; proc: SGDataUPP; refCon: SInt32): ComponentResult; external name '_SGSetDataProc';
{
 *  SGNewChannelFromComponent()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGNewChannelFromComponent(s: SeqGrabComponent; var newChannel: SGChannel; sgChannelComponent: Component): ComponentResult; external name '_SGNewChannelFromComponent';
{
 *  SGDisposeDeviceList()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGDisposeDeviceList(s: SeqGrabComponent; list: SGDeviceList): ComponentResult; external name '_SGDisposeDeviceList';
{
 *  SGAppendDeviceListToMenu()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGAppendDeviceListToMenu(s: SeqGrabComponent; list: SGDeviceList; mh: MenuRef): ComponentResult; external name '_SGAppendDeviceListToMenu';
{
 *  SGSetSettings()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGSetSettings(s: SeqGrabComponent; ud: UserData; flags: SInt32): ComponentResult; external name '_SGSetSettings';
{
 *  SGGetSettings()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGGetSettings(s: SeqGrabComponent; var ud: UserData; flags: SInt32): ComponentResult; external name '_SGGetSettings';
{
 *  SGGetIndChannel()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGGetIndChannel(s: SeqGrabComponent; index: SInt16; var ref: SGChannel; var chanType: OSType): ComponentResult; external name '_SGGetIndChannel';
{
 *  SGUpdate()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGUpdate(s: SeqGrabComponent; updateRgn: RgnHandle): ComponentResult; external name '_SGUpdate';
{
 *  SGGetPause()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGGetPause(s: SeqGrabComponent; var paused: Byte): ComponentResult; external name '_SGGetPause';
type
    ConstComponentListPtr               = ^Component;
    {
     *  SGSettingsDialog()
     *
     *  Availability:
     *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
     *    Windows:          in qtmlClient.lib 3.0 and later
        }
function SGSettingsDialog(s: SeqGrabComponent; c: SGChannel; numPanels: SInt16; panelList: ConstComponentListPtr; flags: SInt32; proc: SGModalFilterUPP; procRefNum: SInt32): ComponentResult; external name '_SGSettingsDialog';
{
 *  SGGetAlignmentProc()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGGetAlignmentProc(s: SeqGrabComponent; alignmentProc: ICMAlignmentProcRecordPtr): ComponentResult; external name '_SGGetAlignmentProc';
{
 *  SGSetChannelSettings()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGSetChannelSettings(s: SeqGrabComponent; c: SGChannel; ud: UserData; flags: SInt32): ComponentResult; external name '_SGSetChannelSettings';
{
 *  SGGetChannelSettings()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGGetChannelSettings(s: SeqGrabComponent; c: SGChannel; var ud: UserData; flags: SInt32): ComponentResult; external name '_SGGetChannelSettings';
{
 *  SGGetMode()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGGetMode(s: SeqGrabComponent; var previewMode: boolean; var recordMode: boolean): ComponentResult; external name '_SGGetMode';
{
 *  SGSetDataRef()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGSetDataRef(s: SeqGrabComponent; dataRef: Handle; dataRefType: OSType; whereFlags: SInt32): ComponentResult; external name '_SGSetDataRef';
{
 *  SGGetDataRef()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGGetDataRef(s: SeqGrabComponent; var dataRef: Handle; var dataRefType: OSType; var whereFlags: SInt32): ComponentResult; external name '_SGGetDataRef';
{
 *  SGNewOutput()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGNewOutput(s: SeqGrabComponent; dataRef: Handle; dataRefType: OSType; whereFlags: SInt32; var sgOut: SGOutput): ComponentResult; external name '_SGNewOutput';
{
 *  SGDisposeOutput()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGDisposeOutput(s: SeqGrabComponent; sgOut: SGOutput): ComponentResult; external name '_SGDisposeOutput';
{
 *  SGSetOutputFlags()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGSetOutputFlags(s: SeqGrabComponent; sgOut: SGOutput; whereFlags: SInt32): ComponentResult; external name '_SGSetOutputFlags';
{
 *  SGSetChannelOutput()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGSetChannelOutput(s: SeqGrabComponent; c: SGChannel; sgOut: SGOutput): ComponentResult; external name '_SGSetChannelOutput';
{
 *  SGGetDataOutputStorageSpaceRemaining()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGGetDataOutputStorageSpaceRemaining(s: SeqGrabComponent; sgOut: SGOutput; var space: UInt32): ComponentResult; external name '_SGGetDataOutputStorageSpaceRemaining';
{
 *  SGHandleUpdateEvent()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGHandleUpdateEvent(s: SeqGrabComponent; const (*var*) event: EventRecord; var handled: boolean): ComponentResult; external name '_SGHandleUpdateEvent';
{
 *  SGSetOutputNextOutput()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGSetOutputNextOutput(s: SeqGrabComponent; sgOut: SGOutput; nextOut: SGOutput): ComponentResult; external name '_SGSetOutputNextOutput';
{
 *  SGGetOutputNextOutput()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGGetOutputNextOutput(s: SeqGrabComponent; sgOut: SGOutput; var nextOut: SGOutput): ComponentResult; external name '_SGGetOutputNextOutput';
{
 *  SGSetOutputMaximumOffset()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGSetOutputMaximumOffset(s: SeqGrabComponent; sgOut: SGOutput; const (*var*) maxOffset: wide): ComponentResult; external name '_SGSetOutputMaximumOffset';
{
 *  SGGetOutputMaximumOffset()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGGetOutputMaximumOffset(s: SeqGrabComponent; sgOut: SGOutput; var maxOffset: wide): ComponentResult; external name '_SGGetOutputMaximumOffset';
{
 *  SGGetOutputDataReference()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGGetOutputDataReference(s: SeqGrabComponent; sgOut: SGOutput; var dataRef: Handle; var dataRefType: OSType): ComponentResult; external name '_SGGetOutputDataReference';
{
 *  SGWriteExtendedMovieData()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGWriteExtendedMovieData(s: SeqGrabComponent; c: SGChannel; p: Ptr; len: SInt32; var offset: wide; var sgOut: SGOutput): ComponentResult; external name '_SGWriteExtendedMovieData';
{
 *  SGGetStorageSpaceRemaining64()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function SGGetStorageSpaceRemaining64(s: SeqGrabComponent; var bytes: wide): ComponentResult; external name '_SGGetStorageSpaceRemaining64';
{
 *  SGGetDataOutputStorageSpaceRemaining64()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 5.0 and later
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 5.0 and later
 }
function SGGetDataOutputStorageSpaceRemaining64(s: SeqGrabComponent; sgOut: SGOutput; var space: wide): ComponentResult; external name '_SGGetDataOutputStorageSpaceRemaining64';
{
    calls from Channel to seqGrab
}
{
 *  SGWriteMovieData()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGWriteMovieData(s: SeqGrabComponent; c: SGChannel; p: Ptr; len: SInt32; var offset: SInt32): ComponentResult; external name '_SGWriteMovieData';
{
 *  SGAddFrameReference()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGAddFrameReference(s: SeqGrabComponent; frameInfo: SeqGrabFrameInfoPtr): ComponentResult; external name '_SGAddFrameReference';
{
 *  SGGetNextFrameReference()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGGetNextFrameReference(s: SeqGrabComponent; frameInfo: SeqGrabFrameInfoPtr; var frameDuration: TimeValue; var frameNumber: SInt32): ComponentResult; external name '_SGGetNextFrameReference';
{
 *  SGGetTimeBase()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGGetTimeBase(s: SeqGrabComponent; var tb: TimeBase): ComponentResult; external name '_SGGetTimeBase';
{
 *  SGSortDeviceList()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGSortDeviceList(s: SeqGrabComponent; list: SGDeviceList): ComponentResult; external name '_SGSortDeviceList';
{
 *  SGAddMovieData()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGAddMovieData(s: SeqGrabComponent; c: SGChannel; p: Ptr; len: SInt32; var offset: SInt32; chRefCon: SInt32; time: TimeValue; writeType: SInt16): ComponentResult; external name '_SGAddMovieData';
{
 *  SGChangedSource()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGChangedSource(s: SeqGrabComponent; c: SGChannel): ComponentResult; external name '_SGChangedSource';
{
 *  SGAddExtendedFrameReference()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGAddExtendedFrameReference(s: SeqGrabComponent; frameInfo: SeqGrabExtendedFrameInfoPtr): ComponentResult; external name '_SGAddExtendedFrameReference';
{
 *  SGGetNextExtendedFrameReference()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGGetNextExtendedFrameReference(s: SeqGrabComponent; frameInfo: SeqGrabExtendedFrameInfoPtr; var frameDuration: TimeValue; var frameNumber: SInt32): ComponentResult; external name '_SGGetNextExtendedFrameReference';
{
 *  SGAddExtendedMovieData()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGAddExtendedMovieData(s: SeqGrabComponent; c: SGChannel; p: Ptr; len: SInt32; var offset: wide; chRefCon: SInt32; time: TimeValue; writeType: SInt16; var whichOutput: SGOutput): ComponentResult; external name '_SGAddExtendedMovieData';
{
 *  SGAddOutputDataRefToMedia()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGAddOutputDataRefToMedia(s: SeqGrabComponent; sgOut: SGOutput; theMedia: Media; desc: SampleDescriptionHandle): ComponentResult; external name '_SGAddOutputDataRefToMedia';
{
 *  SGSetSettingsSummary()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 6.0 and later
 *    CarbonLib:        in CarbonLib 1.6 and later
 *    Mac OS X:         in version 10.2 and later
 *    Windows:          in qtmlClient.lib 6.0 and later
 }
function SGSetSettingsSummary(s: SeqGrabComponent; summaryText: Handle): ComponentResult; external name '_SGSetSettingsSummary';
{** Sequence Grab CHANNEL Component Stuff **}

{
 *  SGSetChannelUsage()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGSetChannelUsage(c: SGChannel; usage: SInt32): ComponentResult; external name '_SGSetChannelUsage';
{
 *  SGGetChannelUsage()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGGetChannelUsage(c: SGChannel; var usage: SInt32): ComponentResult; external name '_SGGetChannelUsage';
{
 *  SGSetChannelBounds()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGSetChannelBounds(c: SGChannel; const (*var*) bounds: Rect): ComponentResult; external name '_SGSetChannelBounds';
{
 *  SGGetChannelBounds()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGGetChannelBounds(c: SGChannel; var bounds: Rect): ComponentResult; external name '_SGGetChannelBounds';
{
 *  SGSetChannelVolume()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGSetChannelVolume(c: SGChannel; volume: SInt16): ComponentResult; external name '_SGSetChannelVolume';
{
 *  SGGetChannelVolume()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGGetChannelVolume(c: SGChannel; var volume: SInt16): ComponentResult; external name '_SGGetChannelVolume';
{
 *  SGGetChannelInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGGetChannelInfo(c: SGChannel; var channelInfo: SInt32): ComponentResult; external name '_SGGetChannelInfo';
{
 *  SGSetChannelPlayFlags()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGSetChannelPlayFlags(c: SGChannel; playFlags: SInt32): ComponentResult; external name '_SGSetChannelPlayFlags';
{
 *  SGGetChannelPlayFlags()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGGetChannelPlayFlags(c: SGChannel; var playFlags: SInt32): ComponentResult; external name '_SGGetChannelPlayFlags';
{
 *  SGSetChannelMaxFrames()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGSetChannelMaxFrames(c: SGChannel; frameCount: SInt32): ComponentResult; external name '_SGSetChannelMaxFrames';
{
 *  SGGetChannelMaxFrames()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGGetChannelMaxFrames(c: SGChannel; var frameCount: SInt32): ComponentResult; external name '_SGGetChannelMaxFrames';
{
 *  SGSetChannelRefCon()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGSetChannelRefCon(c: SGChannel; refCon: SInt32): ComponentResult; external name '_SGSetChannelRefCon';
{
 *  SGSetChannelClip()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGSetChannelClip(c: SGChannel; theClip: RgnHandle): ComponentResult; external name '_SGSetChannelClip';
{
 *  SGGetChannelClip()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGGetChannelClip(c: SGChannel; var theClip: RgnHandle): ComponentResult; external name '_SGGetChannelClip';
{
 *  SGGetChannelSampleDescription()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGGetChannelSampleDescription(c: SGChannel; sampleDesc: Handle): ComponentResult; external name '_SGGetChannelSampleDescription';
{
 *  SGGetChannelDeviceList()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGGetChannelDeviceList(c: SGChannel; selectionFlags: SInt32; var list: SGDeviceList): ComponentResult; external name '_SGGetChannelDeviceList';
{
 *  SGSetChannelDevice()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGSetChannelDevice(c: SGChannel; name: StringPtr): ComponentResult; external name '_SGSetChannelDevice';
{
 *  SGSetChannelMatrix()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGSetChannelMatrix(c: SGChannel; const (*var*) m: MatrixRecord): ComponentResult; external name '_SGSetChannelMatrix';
{
 *  SGGetChannelMatrix()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGGetChannelMatrix(c: SGChannel; var m: MatrixRecord): ComponentResult; external name '_SGGetChannelMatrix';
{
 *  SGGetChannelTimeScale()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGGetChannelTimeScale(c: SGChannel; var scale: TimeScale): ComponentResult; external name '_SGGetChannelTimeScale';
{
 *  SGChannelPutPicture()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGChannelPutPicture(c: SGChannel): ComponentResult; external name '_SGChannelPutPicture';
{
 *  SGChannelSetRequestedDataRate()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGChannelSetRequestedDataRate(c: SGChannel; bytesPerSecond: SInt32): ComponentResult; external name '_SGChannelSetRequestedDataRate';
{
 *  SGChannelGetRequestedDataRate()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGChannelGetRequestedDataRate(c: SGChannel; var bytesPerSecond: SInt32): ComponentResult; external name '_SGChannelGetRequestedDataRate';
{
 *  SGChannelSetDataSourceName()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGChannelSetDataSourceName(c: SGChannel; const (*var*) name: Str255; scriptTag: ScriptCode): ComponentResult; external name '_SGChannelSetDataSourceName';
{
 *  SGChannelGetDataSourceName()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGChannelGetDataSourceName(c: SGChannel; var name: Str255; var scriptTag: ScriptCode): ComponentResult; external name '_SGChannelGetDataSourceName';
{
 *  SGChannelSetCodecSettings()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function SGChannelSetCodecSettings(c: SGChannel; settings: Handle): ComponentResult; external name '_SGChannelSetCodecSettings';
{
 *  SGChannelGetCodecSettings()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function SGChannelGetCodecSettings(c: SGChannel; var settings: Handle): ComponentResult; external name '_SGChannelGetCodecSettings';
{
 *  SGGetChannelTimeBase()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.0.2 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 4.0 and later
 }
function SGGetChannelTimeBase(c: SGChannel; var tb: TimeBase): ComponentResult; external name '_SGGetChannelTimeBase';
{
 *  SGGetChannelRefCon()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 6.0 and later
 *    CarbonLib:        in CarbonLib 1.6 and later
 *    Mac OS X:         in version 10.2 and later
 *    Windows:          in qtmlClient.lib 6.0 and later
 }
function SGGetChannelRefCon(c: SGChannel; var refCon: SInt32): ComponentResult; external name '_SGGetChannelRefCon';
{ A utility call to find out the current device and input names, instead of having to call GetDeviceList and walk it yourself }
{
 *  SGGetChannelDeviceAndInputNames()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 6.0 and later
 *    CarbonLib:        in CarbonLib 1.6 and later
 *    Mac OS X:         in version 10.2 and later
 *    Windows:          in qtmlClient.lib 6.0 and later
 }
function SGGetChannelDeviceAndInputNames(c: SGChannel; var outDeviceName: Str255; var outInputName: Str255; var outInputNumber: SInt16): ComponentResult; external name '_SGGetChannelDeviceAndInputNames';
{ A media format independent call for this. Inputs start at 0 here (Sound starts at 1, VDIGs at 0 in direct calls) }
{
 *  SGSetChannelDeviceInput()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 6.0 and later
 *    CarbonLib:        in CarbonLib 1.6 and later
 *    Mac OS X:         in version 10.2 and later
 *    Windows:          in qtmlClient.lib 6.0 and later
 }
function SGSetChannelDeviceInput(c: SGChannel; inInputNumber: SInt16): ComponentResult; external name '_SGSetChannelDeviceInput';
{ A call to bracket SetSettings related calls, to give downstream components an opportunity to deal with the entire
    settings change in one go }

const
    sgSetSettingsBegin          = $01;                          {  SGSetSettings related set calls about to start }
    sgSetSettingsEnd            = $02;                          {  Finished SGSetSettings calls. Get ready to use the new settings }

    {
     *  SGSetChannelSettingsStateChanging()
     *
     *  Availability:
     *    Non-Carbon CFM:   in QuickTimeLib 6.0 and later
     *    CarbonLib:        in CarbonLib 1.6 and later
     *    Mac OS X:         in version 10.2 and later
     *    Windows:          in qtmlClient.lib 6.0 and later
        }
function SGSetChannelSettingsStateChanging(c: SGChannel; inFlags: UInt32): ComponentResult; external name '_SGSetChannelSettingsStateChanging';
{
    calls from seqGrab to Channel
}
{
 *  SGInitChannel()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGInitChannel(c: SGChannel; owner: SeqGrabComponent): ComponentResult; external name '_SGInitChannel';
{
 *  SGWriteSamples()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGWriteSamples(c: SGChannel; m: Movie; theFile: AliasHandle): ComponentResult; external name '_SGWriteSamples';
{
 *  SGGetDataRate()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGGetDataRate(c: SGChannel; var bytesPerSecond: SInt32): ComponentResult; external name '_SGGetDataRate';
{
 *  SGAlignChannelRect()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGAlignChannelRect(c: SGChannel; var r: Rect): ComponentResult; external name '_SGAlignChannelRect';
{
    Dorky dialog panel calls
}
{
 *  SGPanelGetDitl()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGPanelGetDitl(s: SeqGrabComponent; var ditl: Handle): ComponentResult; external name '_SGPanelGetDitl';
{
 *  SGPanelGetTitle()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGPanelGetTitle(s: SeqGrabComponent; var title: Str255): ComponentResult; external name '_SGPanelGetTitle';
{
 *  SGPanelCanRun()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGPanelCanRun(s: SeqGrabComponent; c: SGChannel): ComponentResult; external name '_SGPanelCanRun';
{
 *  SGPanelInstall()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGPanelInstall(s: SeqGrabComponent; c: SGChannel; d: DialogRef; itemOffset: SInt16): ComponentResult; external name '_SGPanelInstall';
{
 *  SGPanelEvent()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGPanelEvent(s: SeqGrabComponent; c: SGChannel; d: DialogRef; itemOffset: SInt16; const (*var*) theEvent: EventRecord; var itemHit: SInt16; var handled: boolean): ComponentResult; external name '_SGPanelEvent';
{
 *  SGPanelItem()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGPanelItem(s: SeqGrabComponent; c: SGChannel; d: DialogRef; itemOffset: SInt16; itemNum: SInt16): ComponentResult; external name '_SGPanelItem';
{
 *  SGPanelRemove()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGPanelRemove(s: SeqGrabComponent; c: SGChannel; d: DialogRef; itemOffset: SInt16): ComponentResult; external name '_SGPanelRemove';
{
 *  SGPanelSetGrabber()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGPanelSetGrabber(s: SeqGrabComponent; sg: SeqGrabComponent): ComponentResult; external name '_SGPanelSetGrabber';
{
 *  SGPanelSetResFile()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGPanelSetResFile(s: SeqGrabComponent; resRef: SInt16): ComponentResult; external name '_SGPanelSetResFile';
{
 *  SGPanelGetSettings()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGPanelGetSettings(s: SeqGrabComponent; c: SGChannel; var ud: UserData; flags: SInt32): ComponentResult; external name '_SGPanelGetSettings';
{
 *  SGPanelSetSettings()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGPanelSetSettings(s: SeqGrabComponent; c: SGChannel; ud: UserData; flags: SInt32): ComponentResult; external name '_SGPanelSetSettings';
{
 *  SGPanelValidateInput()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGPanelValidateInput(s: SeqGrabComponent; var ok: boolean): ComponentResult; external name '_SGPanelValidateInput';
{
 *  SGPanelSetEventFilter()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGPanelSetEventFilter(s: SeqGrabComponent; proc: SGModalFilterUPP; refCon: SInt32): ComponentResult; external name '_SGPanelSetEventFilter';
{
    SGPanelGetDITLForSize is used to retrieve user interface elements that fit within a specified size
    panel.  The component should return badComponentSelector for sizes it does not support.  The component
    is required to support kSGSmallestDITLSize, and it is recommended to support kSGLargestDITLSize.

    If SGPanelGetDITLForSize is unimplemented entirely, the panel is assumed to not have resizable UI elements.
}

const
    kSGSmallestDITLSize         = -1;                           {  requestedSize h and v set to this to retrieve small size }
    kSGLargestDITLSize          = -2;                           {  requestedSize h and v set to this to retrieve large size }

    {
     *  SGPanelGetDITLForSize()
     *
     *  Availability:
     *    Non-Carbon CFM:   in QuickTimeLib 6.0 and later
     *    CarbonLib:        in CarbonLib 1.6 and later
     *    Mac OS X:         in version 10.2 and later
     *    Windows:          in qtmlClient.lib 6.0 and later
        }
function SGPanelGetDITLForSize(s: SeqGrabComponent; var ditl: Handle; var requestedSize: Point): ComponentResult; external name '_SGPanelGetDITLForSize';
{** Sequence Grab VIDEO CHANNEL Component Stuff **}
{
    Video stuff
}

type
    SGCompressInfoPtr = ^SGCompressInfo;
    SGCompressInfo = record
        buffer:                 Ptr;
        bufferSize:             UInt32;
        similarity:             SInt8;
        reserved:               SInt8;
    end;

    SGGrabBottleProcPtr = function(c: SGChannel; bufferNum: SInt16; refCon: SInt32): ComponentResult;

    SGGrabCompleteBottleProcPtr = function(c: SGChannel; bufferNum: SInt16; var done: boolean; refCon: SInt32): ComponentResult;

    SGDisplayBottleProcPtr = function(c: SGChannel; bufferNum: SInt16; var mp: MatrixRecord; clipRgn: RgnHandle; refCon: SInt32): ComponentResult;

    SGCompressBottleProcPtr = function(c: SGChannel; bufferNum: SInt16; refCon: SInt32): ComponentResult;

    SGCompressCompleteBottleProcPtr = function(c: SGChannel; bufferNum: SInt16; var done: boolean; var ci: SGCompressInfo; refCon: SInt32): ComponentResult;

    SGAddFrameBottleProcPtr = function(c: SGChannel; bufferNum: SInt16; atTime: TimeValue; scale: TimeScale; const (*var*) ci: SGCompressInfo; refCon: SInt32): ComponentResult;

    SGTransferFrameBottleProcPtr = function(c: SGChannel; bufferNum: SInt16; var mp: MatrixRecord; clipRgn: RgnHandle; refCon: SInt32): ComponentResult;

    {       Note that UInt8 *queuedFrameCount replaces Boolean *done. 0(==false) still means no frames, and 1(==true) one,
        but if more than one are available the number should be returned here. The value 2 previously meant more than one frame,
        so some VDIGs may return 2 even if more than 2 are available, and some will still return 1 as they are using the original definition.   }
    SGGrabCompressCompleteBottleProcPtr = function(c: SGChannel; var queuedFrameCount: UInt8; var ci: SGCompressInfo; var t: TimeRecord; refCon: SInt32): ComponentResult;

    SGDisplayCompressBottleProcPtr = function(c: SGChannel; dataPtr: Ptr; desc: ImageDescriptionHandle; var mp: MatrixRecord; clipRgn: RgnHandle; refCon: SInt32): ComponentResult;

    SGGrabBottleUPP = ^SInt32; { an opaque UPP }
    SGGrabCompleteBottleUPP = ^SInt32; { an opaque UPP }
    SGDisplayBottleUPP = ^SInt32; { an opaque UPP }
    SGCompressBottleUPP = ^SInt32; { an opaque UPP }
    SGCompressCompleteBottleUPP = ^SInt32; { an opaque UPP }
    SGAddFrameBottleUPP = ^SInt32; { an opaque UPP }
    SGTransferFrameBottleUPP = ^SInt32; { an opaque UPP }
    SGGrabCompressCompleteBottleUPP = ^SInt32; { an opaque UPP }
    SGDisplayCompressBottleUPP = ^SInt32; { an opaque UPP }
    VideoBottlesPtr = ^VideoBottles;
    VideoBottles = record
        procCount:              SInt16;
        grabProc:               SGGrabBottleUPP;
        grabCompleteProc:       SGGrabCompleteBottleUPP;
        displayProc:            SGDisplayBottleUPP;
        compressProc:           SGCompressBottleUPP;
        compressCompleteProc:   SGCompressCompleteBottleUPP;
        addFrameProc:           SGAddFrameBottleUPP;
        transferFrameProc:      SGTransferFrameBottleUPP;
        grabCompressCompleteProc: SGGrabCompressCompleteBottleUPP;
        displayCompressProc:    SGDisplayCompressBottleUPP;
    end;

    {
     *  SGGetSrcVideoBounds()
     *
     *  Availability:
     *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
     *    Windows:          in qtmlClient.lib 3.0 and later
        }
function SGGetSrcVideoBounds(c: SGChannel; var r: Rect): ComponentResult; external name '_SGGetSrcVideoBounds';
{
 *  SGSetVideoRect()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGSetVideoRect(c: SGChannel; const (*var*) r: Rect): ComponentResult; external name '_SGSetVideoRect';
{
 *  SGGetVideoRect()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGGetVideoRect(c: SGChannel; var r: Rect): ComponentResult; external name '_SGGetVideoRect';
{
 *  SGGetVideoCompressorType()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGGetVideoCompressorType(c: SGChannel; var compressorType: OSType): ComponentResult; external name '_SGGetVideoCompressorType';
{
 *  SGSetVideoCompressorType()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGSetVideoCompressorType(c: SGChannel; compressorType: OSType): ComponentResult; external name '_SGSetVideoCompressorType';
{
 *  SGSetVideoCompressor()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGSetVideoCompressor(c: SGChannel; depth: SInt16; compressor: CompressorComponent; spatialQuality: CodecQ; temporalQuality: CodecQ; keyFrameRate: SInt32): ComponentResult; external name '_SGSetVideoCompressor';
{
 *  SGGetVideoCompressor()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGGetVideoCompressor(c: SGChannel; var depth: SInt16; var compressor: CompressorComponent; var spatialQuality: CodecQ; var temporalQuality: CodecQ; var keyFrameRate: SInt32): ComponentResult; external name '_SGGetVideoCompressor';
{
 *  SGGetVideoDigitizerComponent()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGGetVideoDigitizerComponent(c: SGChannel): ComponentInstance; external name '_SGGetVideoDigitizerComponent';
{
 *  SGSetVideoDigitizerComponent()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGSetVideoDigitizerComponent(c: SGChannel; vdig: ComponentInstance): ComponentResult; external name '_SGSetVideoDigitizerComponent';
{
 *  SGVideoDigitizerChanged()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGVideoDigitizerChanged(c: SGChannel): ComponentResult; external name '_SGVideoDigitizerChanged';
{
 *  SGSetVideoBottlenecks()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGSetVideoBottlenecks(c: SGChannel; var vb: VideoBottles): ComponentResult; external name '_SGSetVideoBottlenecks';
{
 *  SGGetVideoBottlenecks()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGGetVideoBottlenecks(c: SGChannel; var vb: VideoBottles): ComponentResult; external name '_SGGetVideoBottlenecks';
{
 *  SGGrabFrame()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGGrabFrame(c: SGChannel; bufferNum: SInt16): ComponentResult; external name '_SGGrabFrame';
{
 *  SGGrabFrameComplete()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGGrabFrameComplete(c: SGChannel; bufferNum: SInt16; var done: boolean): ComponentResult; external name '_SGGrabFrameComplete';
{
 *  SGDisplayFrame()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGDisplayFrame(c: SGChannel; bufferNum: SInt16; const (*var*) mp: MatrixRecord; clipRgn: RgnHandle): ComponentResult; external name '_SGDisplayFrame';
{
 *  SGCompressFrame()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGCompressFrame(c: SGChannel; bufferNum: SInt16): ComponentResult; external name '_SGCompressFrame';
{
 *  SGCompressFrameComplete()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGCompressFrameComplete(c: SGChannel; bufferNum: SInt16; var done: boolean; var ci: SGCompressInfo): ComponentResult; external name '_SGCompressFrameComplete';
{
 *  SGAddFrame()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGAddFrame(c: SGChannel; bufferNum: SInt16; atTime: TimeValue; scale: TimeScale; const (*var*) ci: SGCompressInfo): ComponentResult; external name '_SGAddFrame';
{
 *  SGTransferFrameForCompress()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGTransferFrameForCompress(c: SGChannel; bufferNum: SInt16; const (*var*) mp: MatrixRecord; clipRgn: RgnHandle): ComponentResult; external name '_SGTransferFrameForCompress';
{
 *  SGSetCompressBuffer()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGSetCompressBuffer(c: SGChannel; depth: SInt16; const (*var*) compressSize: Rect): ComponentResult; external name '_SGSetCompressBuffer';
{
 *  SGGetCompressBuffer()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGGetCompressBuffer(c: SGChannel; var depth: SInt16; var compressSize: Rect): ComponentResult; external name '_SGGetCompressBuffer';
{
 *  SGGetBufferInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGGetBufferInfo(c: SGChannel; bufferNum: SInt16; var bufferPM: PixMapHandle; var bufferRect: Rect; var compressBuffer: GWorldPtr; var compressBufferRect: Rect): ComponentResult; external name '_SGGetBufferInfo';
{
 *  SGSetUseScreenBuffer()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGSetUseScreenBuffer(c: SGChannel; useScreenBuffer: boolean): ComponentResult; external name '_SGSetUseScreenBuffer';
{
 *  SGGetUseScreenBuffer()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGGetUseScreenBuffer(c: SGChannel; var useScreenBuffer: boolean): ComponentResult; external name '_SGGetUseScreenBuffer';
{    Note that UInt8 *queuedFrameCount replaces Boolean *done. 0(==false) still means no frames, and 1(==true) one,
    but if more than one are available the number should be returned here. The value 2 previously meant more than one frame,
    so some VDIGs may return 2 even if more than 2 are available, and some will still return 1 as they are using the original definition. }
{
 *  SGGrabCompressComplete()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGGrabCompressComplete(c: SGChannel; var queuedFrameCount: UInt8; var ci: SGCompressInfo; var tr: TimeRecord): ComponentResult; external name '_SGGrabCompressComplete';
{
 *  SGDisplayCompress()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGDisplayCompress(c: SGChannel; dataPtr: Ptr; desc: ImageDescriptionHandle; var mp: MatrixRecord; clipRgn: RgnHandle): ComponentResult; external name '_SGDisplayCompress';
{
 *  SGSetFrameRate()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGSetFrameRate(c: SGChannel; frameRate: Fixed): ComponentResult; external name '_SGSetFrameRate';
{
 *  SGGetFrameRate()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGGetFrameRate(c: SGChannel; var frameRate: Fixed): ComponentResult; external name '_SGGetFrameRate';
{
 *  SGSetPreferredPacketSize()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGSetPreferredPacketSize(c: SGChannel; preferredPacketSizeInBytes: SInt32): ComponentResult; external name '_SGSetPreferredPacketSize';
{
 *  SGGetPreferredPacketSize()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGGetPreferredPacketSize(c: SGChannel; var preferredPacketSizeInBytes: SInt32): ComponentResult; external name '_SGGetPreferredPacketSize';
{
 *  SGSetUserVideoCompressorList()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGSetUserVideoCompressorList(c: SGChannel; compressorTypes: Handle): ComponentResult; external name '_SGSetUserVideoCompressorList';
{
 *  SGGetUserVideoCompressorList()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGGetUserVideoCompressorList(c: SGChannel; var compressorTypes: Handle): ComponentResult; external name '_SGGetUserVideoCompressorList';
{** Sequence Grab SOUND CHANNEL Component Stuff **}

{
    Sound stuff
}
{
 *  SGSetSoundInputDriver()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGSetSoundInputDriver(c: SGChannel; const (*var*) driverName: Str255): ComponentResult; external name '_SGSetSoundInputDriver';
{
 *  SGGetSoundInputDriver()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGGetSoundInputDriver(c: SGChannel): SInt32; external name '_SGGetSoundInputDriver';
{
 *  SGSoundInputDriverChanged()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGSoundInputDriverChanged(c: SGChannel): ComponentResult; external name '_SGSoundInputDriverChanged';
{
 *  SGSetSoundRecordChunkSize()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGSetSoundRecordChunkSize(c: SGChannel; seconds: SInt32): ComponentResult; external name '_SGSetSoundRecordChunkSize';
{
 *  SGGetSoundRecordChunkSize()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGGetSoundRecordChunkSize(c: SGChannel): SInt32; external name '_SGGetSoundRecordChunkSize';
{
 *  SGSetSoundInputRate()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGSetSoundInputRate(c: SGChannel; rate: Fixed): ComponentResult; external name '_SGSetSoundInputRate';
{
 *  SGGetSoundInputRate()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGGetSoundInputRate(c: SGChannel): Fixed; external name '_SGGetSoundInputRate';
{
 *  SGSetSoundInputParameters()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGSetSoundInputParameters(c: SGChannel; sampleSize: SInt16; numChannels: SInt16; compressionType: OSType): ComponentResult; external name '_SGSetSoundInputParameters';
{
 *  SGGetSoundInputParameters()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGGetSoundInputParameters(c: SGChannel; var sampleSize: SInt16; var numChannels: SInt16; var compressionType: OSType): ComponentResult; external name '_SGGetSoundInputParameters';
{
 *  SGSetAdditionalSoundRates()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGSetAdditionalSoundRates(c: SGChannel; rates: Handle): ComponentResult; external name '_SGSetAdditionalSoundRates';
{
 *  SGGetAdditionalSoundRates()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGGetAdditionalSoundRates(c: SGChannel; var rates: Handle): ComponentResult; external name '_SGGetAdditionalSoundRates';
{
    Text stuff
}
{
 *  SGSetFontName()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGSetFontName(c: SGChannel; pstr: StringPtr): ComponentResult; external name '_SGSetFontName';
{
 *  SGSetFontSize()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGSetFontSize(c: SGChannel; fontSize: SInt16): ComponentResult; external name '_SGSetFontSize';
{
 *  SGSetTextForeColor()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGSetTextForeColor(c: SGChannel; var theColor: RGBColor): ComponentResult; external name '_SGSetTextForeColor';
{
 *  SGSetTextBackColor()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGSetTextBackColor(c: SGChannel; var theColor: RGBColor): ComponentResult; external name '_SGSetTextBackColor';
{
 *  SGSetJustification()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGSetJustification(c: SGChannel; just: SInt16): ComponentResult; external name '_SGSetJustification';
{
 *  SGGetTextReturnToSpaceValue()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGGetTextReturnToSpaceValue(c: SGChannel; var rettospace: SInt16): ComponentResult; external name '_SGGetTextReturnToSpaceValue';
{
 *  SGSetTextReturnToSpaceValue()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGSetTextReturnToSpaceValue(c: SGChannel; rettospace: SInt16): ComponentResult; external name '_SGSetTextReturnToSpaceValue';
{
    Music stuff
}
{
 *  SGGetInstrument()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGGetInstrument(c: SGChannel; var td: ToneDescription): ComponentResult; external name '_SGGetInstrument';
{
 *  SGSetInstrument()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 2.5 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function SGSetInstrument(c: SGChannel; var td: ToneDescription): ComponentResult; external name '_SGSetInstrument';
const
    sgChannelAtom               = $6368616E (* 'chan' *);
    sgChannelSettingsAtom       = $63746F6D (* 'ctom' *);
    sgChannelDescription        = $63647363 (* 'cdsc' *);
    sgChannelSettings           = $63736574 (* 'cset' *);

    sgDeviceNameType            = $6E616D65 (* 'name' *);
    sgDeviceDisplayNameType     = $646E616D (* 'dnam' *);
    sgDeviceUIDType             = $64756964 (* 'duid' *);
    sgInputUIDType              = $69756964 (* 'iuid' *);
    sgUsageType                 = $75736520 (* 'use ' *);
    sgPlayFlagsType             = $706C7966 (* 'plyf' *);
    sgClipType                  = $636C6970 (* 'clip' *);
    sgMatrixType                = $6D747278 (* 'mtrx' *);
    sgVolumeType                = $766F6C75 (* 'volu' *);

    sgPanelSettingsAtom         = $70746F6D (* 'ptom' *);
    sgPanelDescription          = $70647363 (* 'pdsc' *);
    sgPanelSettings             = $70736574 (* 'pset' *);

    sgcSoundCompressionType     = $73636D70 (* 'scmp' *);
    sgcSoundCodecSettingsType   = $63646563 (* 'cdec' *);
    sgcSoundSampleRateType      = $73726174 (* 'srat' *);
    sgcSoundChannelCountType    = $7363686E (* 'schn' *);
    sgcSoundSampleSizeType      = $7373697A (* 'ssiz' *);
    sgcSoundInputType           = $73696E70 (* 'sinp' *);
    sgcSoundGainType            = $6761696E (* 'gain' *);

    sgcVideoHueType             = $68756520 (* 'hue ' *);
    sgcVideoSaturationType      = $73617472 (* 'satr' *);
    sgcVideoContrastType        = $74727374 (* 'trst' *);
    sgcVideoSharpnessType       = $73687270 (* 'shrp' *);
    sgcVideoBrigtnessType       = $62726974 (* 'brit' *);
    sgcVideoBlackLevelType      = $626C6B6C (* 'blkl' *);
    sgcVideoWhiteLevelType      = $7768746C (* 'whtl' *);
    sgcVideoInputType           = $76696E70 (* 'vinp' *);
    sgcVideoFormatType          = $76737464 (* 'vstd' *);
    sgcVideoFilterType          = $76666C74 (* 'vflt' *);
    sgcVideoRectType            = $76726374 (* 'vrct' *);
    sgcVideoDigitizerType       = $76646967 (* 'vdig' *);





type
    QTVideoOutputComponent              = ComponentInstance;
    {  Component type and subtype enumerations }

const
    QTVideoOutputComponentType  = $766F7574 (* 'vout' *);
    QTVideoOutputComponentBaseSubType = $62617365 (* 'base' *);


    {  QTVideoOutput Component flags }

    kQTVideoOutputDontDisplayToUser = $00000001;

    {  Display mode atom types }

    kQTVODisplayModeItem        = $71646D69 (* 'qdmi' *);
    kQTVODimensions             = $64696D6E (* 'dimn' *);                       {  atom contains two longs - pixel count - width, height }
    kQTVOResolution             = $7265736C (* 'resl' *);                       {  atom contains two Fixed - hRes, vRes in dpi }
    kQTVORefreshRate            = $72656672 (* 'refr' *);                       {  atom contains one Fixed - refresh rate in Hz }
    kQTVOPixelType              = $7069786C (* 'pixl' *);                       {  atom contains one OSType - pixel format of mode }
    kQTVOName                   = $6E616D65 (* 'name' *);                       {  atom contains string (no length byte) - name of mode for display to user }
    kQTVODecompressors          = $6465636F (* 'deco' *);                       {  atom contains other atoms indicating supported decompressors }
                                                                {  kQTVODecompressors sub-atoms }
    kQTVODecompressorType       = $64657479 (* 'dety' *);                       {  atom contains one OSType - decompressor type code }
    kQTVODecompressorContinuous = $636F6E74 (* 'cont' *);                       {  atom contains one Boolean - true if this type is displayed continuously }
    kQTVODecompressorComponent  = $636D7074 (* 'cmpt' *);                       {  atom contains one Component - component id of decompressor }

    {   * These are QTVideoOutput procedures *  }
    {
     *  QTVideoOutputGetDisplayModeList()
     *
     *  Availability:
     *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
     *    Windows:          in qtmlClient.lib 3.0 and later
        }
function QTVideoOutputGetDisplayModeList(vo: QTVideoOutputComponent; var outputs: QTAtomContainer): ComponentResult; external name '_QTVideoOutputGetDisplayModeList';
{
 *  QTVideoOutputGetCurrentClientName()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function QTVideoOutputGetCurrentClientName(vo: QTVideoOutputComponent; var str: Str255): ComponentResult; external name '_QTVideoOutputGetCurrentClientName';
{
 *  QTVideoOutputSetClientName()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function QTVideoOutputSetClientName(vo: QTVideoOutputComponent; const (*var*) str: Str255): ComponentResult; external name '_QTVideoOutputSetClientName';
{
 *  QTVideoOutputGetClientName()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function QTVideoOutputGetClientName(vo: QTVideoOutputComponent; var str: Str255): ComponentResult; external name '_QTVideoOutputGetClientName';
{
 *  QTVideoOutputBegin()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function QTVideoOutputBegin(vo: QTVideoOutputComponent): ComponentResult; external name '_QTVideoOutputBegin';
{
 *  QTVideoOutputEnd()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function QTVideoOutputEnd(vo: QTVideoOutputComponent): ComponentResult; external name '_QTVideoOutputEnd';
{
 *  QTVideoOutputSetDisplayMode()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function QTVideoOutputSetDisplayMode(vo: QTVideoOutputComponent; displayModeID: SInt32): ComponentResult; external name '_QTVideoOutputSetDisplayMode';
{
 *  QTVideoOutputGetDisplayMode()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function QTVideoOutputGetDisplayMode(vo: QTVideoOutputComponent; var displayModeID: SInt32): ComponentResult; external name '_QTVideoOutputGetDisplayMode';
{
 *  QTVideoOutputCustomConfigureDisplay()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function QTVideoOutputCustomConfigureDisplay(vo: QTVideoOutputComponent; filter: ModalFilterUPP): ComponentResult; external name '_QTVideoOutputCustomConfigureDisplay';
{
 *  QTVideoOutputSaveState()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function QTVideoOutputSaveState(vo: QTVideoOutputComponent; var state: QTAtomContainer): ComponentResult; external name '_QTVideoOutputSaveState';
{
 *  QTVideoOutputRestoreState()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function QTVideoOutputRestoreState(vo: QTVideoOutputComponent; state: QTAtomContainer): ComponentResult; external name '_QTVideoOutputRestoreState';
{
 *  QTVideoOutputGetGWorld()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function QTVideoOutputGetGWorld(vo: QTVideoOutputComponent; var gw: GWorldPtr): ComponentResult; external name '_QTVideoOutputGetGWorld';
{
 *  QTVideoOutputGetGWorldParameters()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function QTVideoOutputGetGWorldParameters(vo: QTVideoOutputComponent; var baseAddr: Ptr; var rowBytes: SInt32; var colorTable: CTabHandle): ComponentResult; external name '_QTVideoOutputGetGWorldParameters';
{
 *  QTVideoOutputGetIndSoundOutput()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function QTVideoOutputGetIndSoundOutput(vo: QTVideoOutputComponent; index: SInt32; var outputComponent: Component): ComponentResult; external name '_QTVideoOutputGetIndSoundOutput';
{
 *  QTVideoOutputGetClock()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function QTVideoOutputGetClock(vo: QTVideoOutputComponent; var clock: ComponentInstance): ComponentResult; external name '_QTVideoOutputGetClock';
{
 *  QTVideoOutputSetEchoPort()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 3.0 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 3.0 and later
 }
function QTVideoOutputSetEchoPort(vo: QTVideoOutputComponent; echoPort: CGrafPtr): ComponentResult; external name '_QTVideoOutputSetEchoPort';
{
 *  QTVideoOutputGetIndImageDecompressor()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 5.0 and later
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in qtmlClient.lib 5.0 and later
 }
function QTVideoOutputGetIndImageDecompressor(vo: QTVideoOutputComponent; index: SInt32; var codec: Component): ComponentResult; external name '_QTVideoOutputGetIndImageDecompressor';
{
 *  QTVideoOutputBaseSetEchoPort()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QuickTimeLib 6.0 and later
 *    CarbonLib:        in CarbonLib 1.6 and later
 *    Mac OS X:         in version 10.2 and later
 *    Windows:          in qtmlClient.lib 6.0 and later
 }
function QTVideoOutputBaseSetEchoPort(vo: QTVideoOutputComponent; echoPort: CGrafPtr): ComponentResult; external name '_QTVideoOutputBaseSetEchoPort';
{ UPP call backs }

const
    uppDataHCompletionProcInfo = $00000BC0;
    uppVdigIntProcInfo = $000003C0;
    uppStartDocumentHandlerProcInfo = $000000F0;
    uppEndDocumentHandlerProcInfo = $000000F0;
    uppStartElementHandlerProcInfo = $00000FF0;
    uppEndElementHandlerProcInfo = $000003F0;
    uppCharDataHandlerProcInfo = $000003F0;
    uppPreprocessInstructionHandlerProcInfo = $00000FF0;
    uppCommentHandlerProcInfo = $000003F0;
    uppCDataHandlerProcInfo = $000003F0;
    uppSGDataProcInfo = $003BFFE0;
    uppSGModalFilterProcInfo = $00003FD0;
    uppSGGrabBottleProcInfo = $00000EF0;
    uppSGGrabCompleteBottleProcInfo = $00003EF0;
    uppSGDisplayBottleProcInfo = $0000FEF0;
    uppSGCompressBottleProcInfo = $00000EF0;
    uppSGCompressCompleteBottleProcInfo = $0000FEF0;
    uppSGAddFrameBottleProcInfo = $0003FEF0;
    uppSGTransferFrameBottleProcInfo = $0000FEF0;
    uppSGGrabCompressCompleteBottleProcInfo = $0000FFF0;
    uppSGDisplayCompressBottleProcInfo = $0003FFF0;
    {
     *  NewDataHCompletionUPP()
     *
     *  Availability:
     *    Non-Carbon CFM:   available as macro/inline
     *    CarbonLib:        in CarbonLib 1.0 and later
     *    Mac OS X:         in version 10.0 and later
        }
function NewDataHCompletionUPP(userRoutine: DataHCompletionProcPtr): DataHCompletionUPP; external name '_NewDataHCompletionUPP'; { old name was NewDataHCompletionProc }
{
 *  NewVdigIntUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewVdigIntUPP(userRoutine: VdigIntProcPtr): VdigIntUPP; external name '_NewVdigIntUPP'; { old name was NewVdigIntProc }
{
 *  NewStartDocumentHandlerUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewStartDocumentHandlerUPP(userRoutine: StartDocumentHandler): StartDocumentHandlerUPP; external name '_NewStartDocumentHandlerUPP'; { old name was NewStartDocumentHandlerProc }
{
 *  NewEndDocumentHandlerUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewEndDocumentHandlerUPP(userRoutine: EndDocumentHandler): EndDocumentHandlerUPP; external name '_NewEndDocumentHandlerUPP'; { old name was NewEndDocumentHandlerProc }
{
 *  NewStartElementHandlerUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewStartElementHandlerUPP(userRoutine: StartElementHandler): StartElementHandlerUPP; external name '_NewStartElementHandlerUPP'; { old name was NewStartElementHandlerProc }
{
 *  NewEndElementHandlerUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewEndElementHandlerUPP(userRoutine: EndElementHandler): EndElementHandlerUPP; external name '_NewEndElementHandlerUPP'; { old name was NewEndElementHandlerProc }
{
 *  NewCharDataHandlerUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewCharDataHandlerUPP(userRoutine: CharDataHandler): CharDataHandlerUPP; external name '_NewCharDataHandlerUPP'; { old name was NewCharDataHandlerProc }
{
 *  NewPreprocessInstructionHandlerUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewPreprocessInstructionHandlerUPP(userRoutine: PreprocessInstructionHandler): PreprocessInstructionHandlerUPP; external name '_NewPreprocessInstructionHandlerUPP'; { old name was NewPreprocessInstructionHandlerProc }
{
 *  NewCommentHandlerUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewCommentHandlerUPP(userRoutine: CommentHandler): CommentHandlerUPP; external name '_NewCommentHandlerUPP'; { old name was NewCommentHandlerProc }
{
 *  NewCDataHandlerUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.6 and later
 *    Mac OS X:         in version 10.2 and later
 }
function NewCDataHandlerUPP(userRoutine: CDataHandler): CDataHandlerUPP; external name '_NewCDataHandlerUPP'; { old name was NewCDataHandlerProc }
{
 *  NewSGDataUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewSGDataUPP(userRoutine: SGDataProcPtr): SGDataUPP; external name '_NewSGDataUPP'; { old name was NewSGDataProc }
{
 *  NewSGModalFilterUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewSGModalFilterUPP(userRoutine: SGModalFilterProcPtr): SGModalFilterUPP; external name '_NewSGModalFilterUPP'; { old name was NewSGModalFilterProc }
{
 *  NewSGGrabBottleUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewSGGrabBottleUPP(userRoutine: SGGrabBottleProcPtr): SGGrabBottleUPP; external name '_NewSGGrabBottleUPP'; { old name was NewSGGrabBottleProc }
{
 *  NewSGGrabCompleteBottleUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewSGGrabCompleteBottleUPP(userRoutine: SGGrabCompleteBottleProcPtr): SGGrabCompleteBottleUPP; external name '_NewSGGrabCompleteBottleUPP'; { old name was NewSGGrabCompleteBottleProc }
{
 *  NewSGDisplayBottleUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewSGDisplayBottleUPP(userRoutine: SGDisplayBottleProcPtr): SGDisplayBottleUPP; external name '_NewSGDisplayBottleUPP'; { old name was NewSGDisplayBottleProc }
{
 *  NewSGCompressBottleUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewSGCompressBottleUPP(userRoutine: SGCompressBottleProcPtr): SGCompressBottleUPP; external name '_NewSGCompressBottleUPP'; { old name was NewSGCompressBottleProc }
{
 *  NewSGCompressCompleteBottleUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewSGCompressCompleteBottleUPP(userRoutine: SGCompressCompleteBottleProcPtr): SGCompressCompleteBottleUPP; external name '_NewSGCompressCompleteBottleUPP'; { old name was NewSGCompressCompleteBottleProc }
{
 *  NewSGAddFrameBottleUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewSGAddFrameBottleUPP(userRoutine: SGAddFrameBottleProcPtr): SGAddFrameBottleUPP; external name '_NewSGAddFrameBottleUPP'; { old name was NewSGAddFrameBottleProc }
{
 *  NewSGTransferFrameBottleUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewSGTransferFrameBottleUPP(userRoutine: SGTransferFrameBottleProcPtr): SGTransferFrameBottleUPP; external name '_NewSGTransferFrameBottleUPP'; { old name was NewSGTransferFrameBottleProc }
{
 *  NewSGGrabCompressCompleteBottleUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewSGGrabCompressCompleteBottleUPP(userRoutine: SGGrabCompressCompleteBottleProcPtr): SGGrabCompressCompleteBottleUPP; external name '_NewSGGrabCompressCompleteBottleUPP'; { old name was NewSGGrabCompressCompleteBottleProc }
{
 *  NewSGDisplayCompressBottleUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewSGDisplayCompressBottleUPP(userRoutine: SGDisplayCompressBottleProcPtr): SGDisplayCompressBottleUPP; external name '_NewSGDisplayCompressBottleUPP'; { old name was NewSGDisplayCompressBottleProc }
{
 *  DisposeDataHCompletionUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeDataHCompletionUPP(userUPP: DataHCompletionUPP); external name '_DisposeDataHCompletionUPP';
{
 *  DisposeVdigIntUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeVdigIntUPP(userUPP: VdigIntUPP); external name '_DisposeVdigIntUPP';
{
 *  DisposeStartDocumentHandlerUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeStartDocumentHandlerUPP(userUPP: StartDocumentHandlerUPP); external name '_DisposeStartDocumentHandlerUPP';
{
 *  DisposeEndDocumentHandlerUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeEndDocumentHandlerUPP(userUPP: EndDocumentHandlerUPP); external name '_DisposeEndDocumentHandlerUPP';
{
 *  DisposeStartElementHandlerUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeStartElementHandlerUPP(userUPP: StartElementHandlerUPP); external name '_DisposeStartElementHandlerUPP';
{
 *  DisposeEndElementHandlerUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeEndElementHandlerUPP(userUPP: EndElementHandlerUPP); external name '_DisposeEndElementHandlerUPP';
{
 *  DisposeCharDataHandlerUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeCharDataHandlerUPP(userUPP: CharDataHandlerUPP); external name '_DisposeCharDataHandlerUPP';
{
 *  DisposePreprocessInstructionHandlerUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposePreprocessInstructionHandlerUPP(userUPP: PreprocessInstructionHandlerUPP); external name '_DisposePreprocessInstructionHandlerUPP';
{
 *  DisposeCommentHandlerUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeCommentHandlerUPP(userUPP: CommentHandlerUPP); external name '_DisposeCommentHandlerUPP';
{
 *  DisposeCDataHandlerUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.6 and later
 *    Mac OS X:         in version 10.2 and later
 }
procedure DisposeCDataHandlerUPP(userUPP: CDataHandlerUPP); external name '_DisposeCDataHandlerUPP';
{
 *  DisposeSGDataUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeSGDataUPP(userUPP: SGDataUPP); external name '_DisposeSGDataUPP';
{
 *  DisposeSGModalFilterUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeSGModalFilterUPP(userUPP: SGModalFilterUPP); external name '_DisposeSGModalFilterUPP';
{
 *  DisposeSGGrabBottleUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeSGGrabBottleUPP(userUPP: SGGrabBottleUPP); external name '_DisposeSGGrabBottleUPP';
{
 *  DisposeSGGrabCompleteBottleUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeSGGrabCompleteBottleUPP(userUPP: SGGrabCompleteBottleUPP); external name '_DisposeSGGrabCompleteBottleUPP';
{
 *  DisposeSGDisplayBottleUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeSGDisplayBottleUPP(userUPP: SGDisplayBottleUPP); external name '_DisposeSGDisplayBottleUPP';
{
 *  DisposeSGCompressBottleUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeSGCompressBottleUPP(userUPP: SGCompressBottleUPP); external name '_DisposeSGCompressBottleUPP';
{
 *  DisposeSGCompressCompleteBottleUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeSGCompressCompleteBottleUPP(userUPP: SGCompressCompleteBottleUPP); external name '_DisposeSGCompressCompleteBottleUPP';
{
 *  DisposeSGAddFrameBottleUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeSGAddFrameBottleUPP(userUPP: SGAddFrameBottleUPP); external name '_DisposeSGAddFrameBottleUPP';
{
 *  DisposeSGTransferFrameBottleUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeSGTransferFrameBottleUPP(userUPP: SGTransferFrameBottleUPP); external name '_DisposeSGTransferFrameBottleUPP';
{
 *  DisposeSGGrabCompressCompleteBottleUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeSGGrabCompressCompleteBottleUPP(userUPP: SGGrabCompressCompleteBottleUPP); external name '_DisposeSGGrabCompressCompleteBottleUPP';
{
 *  DisposeSGDisplayCompressBottleUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeSGDisplayCompressBottleUPP(userUPP: SGDisplayCompressBottleUPP); external name '_DisposeSGDisplayCompressBottleUPP';
{
 *  InvokeDataHCompletionUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvokeDataHCompletionUPP(request: Ptr; refcon: SInt32; err: OSErr; userRoutine: DataHCompletionUPP); external name '_InvokeDataHCompletionUPP'; { old name was CallDataHCompletionProc }
{
 *  InvokeVdigIntUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvokeVdigIntUPP(flags: SInt32; refcon: SInt32; userRoutine: VdigIntUPP); external name '_InvokeVdigIntUPP'; { old name was CallVdigIntProc }
{
 *  InvokeStartDocumentHandlerUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeStartDocumentHandlerUPP(refcon: SInt32; userRoutine: StartDocumentHandlerUPP): ComponentResult; external name '_InvokeStartDocumentHandlerUPP'; { old name was CallStartDocumentHandlerProc }
{
 *  InvokeEndDocumentHandlerUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeEndDocumentHandlerUPP(refcon: SInt32; userRoutine: EndDocumentHandlerUPP): ComponentResult; external name '_InvokeEndDocumentHandlerUPP'; { old name was CallEndDocumentHandlerProc }
{
 *  InvokeStartElementHandlerUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeStartElementHandlerUPP(name: ConstCStringPtr; var atts: ConstCStringPtr; refcon: SInt32; userRoutine: StartElementHandlerUPP): ComponentResult; external name '_InvokeStartElementHandlerUPP'; { old name was CallStartElementHandlerProc }
{
 *  InvokeEndElementHandlerUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeEndElementHandlerUPP(name: ConstCStringPtr; refcon: SInt32; userRoutine: EndElementHandlerUPP): ComponentResult; external name '_InvokeEndElementHandlerUPP'; { old name was CallEndElementHandlerProc }
{
 *  InvokeCharDataHandlerUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeCharDataHandlerUPP(charData: ConstCStringPtr; refcon: SInt32; userRoutine: CharDataHandlerUPP): ComponentResult; external name '_InvokeCharDataHandlerUPP'; { old name was CallCharDataHandlerProc }
{
 *  InvokePreprocessInstructionHandlerUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokePreprocessInstructionHandlerUPP(name: ConstCStringPtr; atts: ConstCStringPtrPtr; refcon: SInt32; userRoutine: PreprocessInstructionHandlerUPP): ComponentResult; external name '_InvokePreprocessInstructionHandlerUPP'; { old name was CallPreprocessInstructionHandlerProc }
{
 *  InvokeCommentHandlerUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeCommentHandlerUPP(comment: ConstCStringPtr; refcon: SInt32; userRoutine: CommentHandlerUPP): ComponentResult; external name '_InvokeCommentHandlerUPP'; { old name was CallCommentHandlerProc }
{
 *  InvokeCDataHandlerUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.6 and later
 *    Mac OS X:         in version 10.2 and later
 }
function InvokeCDataHandlerUPP(cdata: ConstCStringPtr; refcon: SInt32; userRoutine: CDataHandlerUPP): ComponentResult; external name '_InvokeCDataHandlerUPP'; { old name was CallCDataHandlerProc }
{
 *  InvokeSGDataUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeSGDataUPP(c: SGChannel; p: Ptr; len: SInt32; var offset: SInt32; chRefCon: SInt32; time: TimeValue; writeType: SInt16; refCon: SInt32; userRoutine: SGDataUPP): OSErr; external name '_InvokeSGDataUPP'; { old name was CallSGDataProc }
{
 *  InvokeSGModalFilterUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeSGModalFilterUPP(theDialog: DialogRef; const (*var*) theEvent: EventRecord; var itemHit: SInt16; refCon: SInt32; userRoutine: SGModalFilterUPP): boolean; external name '_InvokeSGModalFilterUPP'; { old name was CallSGModalFilterProc }
{
 *  InvokeSGGrabBottleUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeSGGrabBottleUPP(c: SGChannel; bufferNum: SInt16; refCon: SInt32; userRoutine: SGGrabBottleUPP): ComponentResult; external name '_InvokeSGGrabBottleUPP'; { old name was CallSGGrabBottleProc }
{
 *  InvokeSGGrabCompleteBottleUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeSGGrabCompleteBottleUPP(c: SGChannel; bufferNum: SInt16; var done: boolean; refCon: SInt32; userRoutine: SGGrabCompleteBottleUPP): ComponentResult; external name '_InvokeSGGrabCompleteBottleUPP'; { old name was CallSGGrabCompleteBottleProc }
{
 *  InvokeSGDisplayBottleUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeSGDisplayBottleUPP(c: SGChannel; bufferNum: SInt16; var mp: MatrixRecord; clipRgn: RgnHandle; refCon: SInt32; userRoutine: SGDisplayBottleUPP): ComponentResult; external name '_InvokeSGDisplayBottleUPP'; { old name was CallSGDisplayBottleProc }
{
 *  InvokeSGCompressBottleUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeSGCompressBottleUPP(c: SGChannel; bufferNum: SInt16; refCon: SInt32; userRoutine: SGCompressBottleUPP): ComponentResult; external name '_InvokeSGCompressBottleUPP'; { old name was CallSGCompressBottleProc }
{
 *  InvokeSGCompressCompleteBottleUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeSGCompressCompleteBottleUPP(c: SGChannel; bufferNum: SInt16; var done: boolean; var ci: SGCompressInfo; refCon: SInt32; userRoutine: SGCompressCompleteBottleUPP): ComponentResult; external name '_InvokeSGCompressCompleteBottleUPP'; { old name was CallSGCompressCompleteBottleProc }
{
 *  InvokeSGAddFrameBottleUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeSGAddFrameBottleUPP(c: SGChannel; bufferNum: SInt16; atTime: TimeValue; scale: TimeScale; const (*var*) ci: SGCompressInfo; refCon: SInt32; userRoutine: SGAddFrameBottleUPP): ComponentResult; external name '_InvokeSGAddFrameBottleUPP'; { old name was CallSGAddFrameBottleProc }
{
 *  InvokeSGTransferFrameBottleUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeSGTransferFrameBottleUPP(c: SGChannel; bufferNum: SInt16; var mp: MatrixRecord; clipRgn: RgnHandle; refCon: SInt32; userRoutine: SGTransferFrameBottleUPP): ComponentResult; external name '_InvokeSGTransferFrameBottleUPP'; { old name was CallSGTransferFrameBottleProc }
{
 *  InvokeSGGrabCompressCompleteBottleUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeSGGrabCompressCompleteBottleUPP(c: SGChannel; var queuedFrameCount: UInt8; var ci: SGCompressInfo; var t: TimeRecord; refCon: SInt32; userRoutine: SGGrabCompressCompleteBottleUPP): ComponentResult; external name '_InvokeSGGrabCompressCompleteBottleUPP'; { old name was CallSGGrabCompressCompleteBottleProc }
{
 *  InvokeSGDisplayCompressBottleUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeSGDisplayCompressBottleUPP(c: SGChannel; dataPtr: Ptr; desc: ImageDescriptionHandle; var mp: MatrixRecord; clipRgn: RgnHandle; refCon: SInt32; userRoutine: SGDisplayCompressBottleUPP): ComponentResult; external name '_InvokeSGDisplayCompressBottleUPP'; { old name was CallSGDisplayCompressBottleProc }
{$ALIGN MAC68K}
{#POP}
{unit QuickTimeStreaming}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}


const
    kQTSInfiniteDuration        = $7FFFFFFF;
    kQTSUnknownDuration         = $00000000;
    kQTSNormalForwardRate       = $00010000;
    kQTSStoppedRate             = $00000000;


type
    QTSPresentationRecordPtr = ^QTSPresentationRecord;
    QTSPresentationRecord = record
        data:                   array [0..0] of SInt32;
    end;

    QTSPresentation                     = ^QTSPresentationRecord;
    QTSStreamRecordPtr = ^QTSStreamRecord;
    QTSStreamRecord = record
        data:                   array [0..0] of SInt32;
    end;

    QTSStream                           = ^QTSStreamRecord;
    QTSEditEntryPtr = ^QTSEditEntry;
    QTSEditEntry = record
        presentationDuration:   TimeValue64;
        streamStartTime:        TimeValue64;
        streamRate:             Fixed;
    end;

    QTSEditListPtr = ^QTSEditList;
    QTSEditList = record
        numEdits:               SInt32;
        edits:                  array [0..0] of QTSEditEntry;
    end;

    QTSEditListHandle                   = ^QTSEditListPtr;
    QTSNotificationProcPtr = function(inErr: ComponentResult; inNotificationType: OSType; inNotificationParams: UnivPtr; inRefCon: UnivPtr): ComponentResult;

    QTSNotificationUPP = ^SInt32; { an opaque UPP }
    {   -----------------------------------------
        Get / Set Info
    -----------------------------------------   }

const
    kQTSGetURLLink              = $67756C6C (* 'gull' *);                       {  QTSGetURLLinkRecord*  }

    {    get and set    }
    kQTSTargetBufferDurationInfo = $62756672 (* 'bufr' *);                      {  Fixed* in seconds; expected, not actual  }
    kQTSDurationInfo            = $64757261 (* 'dura' *);                       {  QTSDurationAtom*  }
    kQTSSoundLevelMeteringEnabledInfo = $6D74726E (* 'mtrn' *);                 {  Boolean*  }
    kQTSSoundLevelMeterInfo     = $6C65766D (* 'levm' *);                       {  LevelMeterInfoPtr  }
    kQTSSourceTrackIDInfo       = $6F746964 (* 'otid' *);                       {  UInt32*  }
    kQTSSourceLayerInfo         = $6F6C7972 (* 'olyr' *);                       {  UInt16*  }
    kQTSSourceLanguageInfo      = $6F6C6E67 (* 'olng' *);                       {  UInt16*  }
    kQTSSourceTrackFlagsInfo    = $6F74666C (* 'otfl' *);                       {  SInt32*  }
    kQTSSourceDimensionsInfo    = $6F64696D (* 'odim' *);                       {  QTSDimensionParams*  }
    kQTSSourceVolumesInfo       = $6F766F6C (* 'ovol' *);                       {  QTSVolumesParams*  }
    kQTSSourceMatrixInfo        = $6F6D6174 (* 'omat' *);                       {  MatrixRecord*  }
    kQTSSourceClipRectInfo      = $6F636C70 (* 'oclp' *);                       {  Rect*  }
    kQTSSourceGraphicsModeInfo  = $6F67726D (* 'ogrm' *);                       {  QTSGraphicsModeParams*  }
    kQTSSourceScaleInfo         = $6F73636C (* 'oscl' *);                       {  Point*  }
    kQTSSourceBoundingRectInfo  = $6F726374 (* 'orct' *);                       {  Rect*  }
    kQTSSourceUserDataInfo      = $6F756474 (* 'oudt' *);                       {  UserData  }
    kQTSSourceInputMapInfo      = $6F696D70 (* 'oimp' *);                       {  QTAtomContainer  }
    kQTSInfo_DataProc           = $64617470 (* 'datp' *);                       {  QTSDataProcParams*  }
    kQTSInfo_SendDataExtras     = $64657874 (* 'dext' *);                       {  QTSSendDataExtrasParams*  }
    kQTSInfo_HintTrackID        = $68746964 (* 'htid' *);                       {  long*  }
    kQTSInfo_URL                = $75726C20 (* 'url ' *);                       {  Handle*, cstring in handle  }
    kQTSInfo_Authentication     = $61757570 (* 'auup' *);                       {  QTSAuthenticationParams  }
    kQTSInfo_MediaPacketizer    = $726D706B (* 'rmpk' *);                       {  ComponentInstance  }

    {    get only   }
    kQTSStatisticsInfo          = $73746174 (* 'stat' *);                       {  QTSStatisticsParams*  }
    kQTSMinStatusDimensionsInfo = $6D737464 (* 'mstd' *);                       {  QTSDimensionParams*  }
    kQTSNormalStatusDimensionsInfo = $6E737464 (* 'nstd' *);                    {  QTSDimensionParams*  }
    kQTSTotalDataRateInfo       = $64727474 (* 'drtt' *);                       {  UInt32*, add to what's there  }
    kQTSTotalDataRateInInfo     = $64727469 (* 'drti' *);                       {  UInt32*, add to what's there  }
    kQTSTotalDataRateOutInfo    = $6472746F (* 'drto' *);                       {  UInt32*, add to what's there  }
    kQTSLostPercentInfo         = $6C706374 (* 'lpct' *);                       {  QTSLostPercentParams*, add to what's there  }
    kQTSNumViewersInfo          = $6E766977 (* 'nviw' *);                       {  UInt32*  }
    kQTSMediaTypeInfo           = $6D747970 (* 'mtyp' *);                       {  OSType*  }
    kQTSNameInfo                = $6E616D65 (* 'name' *);                       {  QTSNameParams*  }
    kQTSCanHandleSendDataType   = $63687364 (* 'chsd' *);                       {  QTSCanHandleSendDataTypeParams*  }
    kQTSAnnotationsInfo         = $6D657461 (* 'meta' *);                       {  QTAtomContainer  }
    kQTSRemainingBufferTimeInfo = $62746D73 (* 'btms' *);                       {  UInt32* remaining buffer time before playback, in microseconds  }
    kQTSInfo_SettingsText       = $73747478 (* 'sttx' *);                       {  QTSSettingsTextParams*  }
    kQTSInfo_AverageFrameRate   = $66707320 (* 'fps ' *);                       {  UnsignedFixed*  }



type
    QTSAuthenticationParamsPtr = ^QTSAuthenticationParams;
    QTSAuthenticationParams = record
        flags:                  SInt32;
        userID:                 ConstCStringPtr;                        {  caller disposes of pointer }
        password:               ConstCStringPtr;                        {  caller disposes of pointer }
    end;


const
    kQTSTargetBufferDurationTimeScale = 1000;


type
    QTSPanelFilterParamsPtr = ^QTSPanelFilterParams;
    QTSPanelFilterParams = record
        version:                SInt32;
        inStream:               QTSStream;
        inPanelType:            OSType;
        inPanelSubType:         OSType;
        details:                QTAtomSpec;
    end;

    {  return true to keep this panel }
    QTSPanelFilterProcPtr = function(var inParams: QTSPanelFilterParams; inRefCon: UnivPtr): boolean;

    QTSPanelFilterUPP = ^SInt32; { an opaque UPP }

const
    kQTSSettingsTextSummary     = $73657431 (* 'set1' *);
    kQTSSettingsTextDetails     = $73657464 (* 'setd' *);


type
    QTSSettingsTextParamsPtr = ^QTSSettingsTextParams;
    QTSSettingsTextParams = record
        flags:                  SInt32;                                 {  None yet defined }
        inSettingsSelector:     OSType;                                 {  which kind of setting you want from enum above }
        outSettingsAsText:      Handle;                                 {  QTS allocates; Caller disposes }
        inPanelFilterProc:      QTSPanelFilterUPP;                      {  To get a subset filter with this    }
        inPanelFilterProcRefCon: Ptr;
    end;

    QTSCanHandleSendDataTypeParamsPtr = ^QTSCanHandleSendDataTypeParams;
    QTSCanHandleSendDataTypeParams = record
        modifierTypeOrInputID:  SInt32;
        isModifierType:         boolean;
        returnedCanHandleSendDataType: boolean;                         {  callee sets to true if it can handle it }
    end;

    QTSNameParamsPtr = ^QTSNameParams;
    QTSNameParams = record
        maxNameLength:          SInt32;
        requestedLanguage:      SInt32;
        returnedActualLanguage: SInt32;
        returnedName:           Ptr;                                    {  pascal string; caller supplies }
    end;

    QTSLostPercentParamsPtr = ^QTSLostPercentParams;
    QTSLostPercentParams = record
        receivedPkts:           UInt32;
        lostPkts:               UInt32;
        percent:                Fixed;
    end;

    QTSDimensionParamsPtr = ^QTSDimensionParams;
    QTSDimensionParams = record
        width:                  Fixed;
        height:                 Fixed;
    end;

    QTSVolumesParamsPtr = ^QTSVolumesParams;
    QTSVolumesParams = record
        leftVolume:             SInt16;
        rightVolume:            SInt16;
    end;

    QTSGraphicsModeParamsPtr = ^QTSGraphicsModeParams;
    QTSGraphicsModeParams = record
        graphicsMode:           SInt16;
        opColor:                RGBColor;
    end;

    QTSGetURLLinkRecordPtr = ^QTSGetURLLinkRecord;
    QTSGetURLLinkRecord = record
        displayWhere:           Point;
        returnedURLLink:        Handle;
    end;


const
    kQTSDataProcParamsVersion1  = 1;

    kQTSDataProcType_MediaSample = $6D646961 (* 'mdia' *);
    kQTSDataProcType_HintSample = $68696E74 (* 'hint' *);


type
    QTSDataProcParamsPtr = ^QTSDataProcParams;
    QTSDataProcParams = record
        version:                SInt32;
        flags:                  SInt32;
        stream:                 QTSStream;
        procType:               OSType;
        proc:                   QTSNotificationUPP;
        procRefCon:             Ptr;
    end;


const
    kQTSDataProcSelector_SampleData = $73616D70 (* 'samp' *);
    kQTSDataProcSelector_UserData = $75736572 (* 'user' *);

    kQTSSampleDataCallbackParamsVersion1 = 1;


type
    QTSSampleDataCallbackParamsPtr = ^QTSSampleDataCallbackParams;
    QTSSampleDataCallbackParams = record
        version:                SInt32;
        flags:                  SInt32;
        stream:                 QTSStream;
        procType:               OSType;
        mediaType:              OSType;
        mediaTimeScale:         TimeScale;
        sampleDesc:             SampleDescriptionHandle;
        sampleDescSeed:         UInt32;
        sampleTime:             TimeValue64;
        duration:               TimeValue64;                            {  could be 0  }
        sampleFlags:            SInt32;
        dataLength:             UInt32;
        data:                   Ptr;
    end;


const
    kQTSUserDataCallbackParamsVersion1 = 1;


type
    QTSUserDataCallbackParamsPtr = ^QTSUserDataCallbackParams;
    QTSUserDataCallbackParams = record
        version:                SInt32;
        flags:                  SInt32;
        stream:                 QTSStream;
        procType:               OSType;
        userDataType:           OSType;
        userDataHandle:         Handle;                                 {  caller must make copy if it wants to keep the data around }
    end;


const
    kQTSSendDataExtrasParamsVersion1 = 1;


type
    QTSSendDataExtrasParamsPtr = ^QTSSendDataExtrasParams;
    QTSSendDataExtrasParams = record
        version:                SInt32;
        flags:                  SInt32;
        procType:               OSType;
    end;

    QTSModalFilterProcPtr = function(inDialog: DialogPtr; const (*var*) inEvent: EventRecord; var ioItemHit: SInt16; inRefCon: UnivPtr): boolean;

    QTSModalFilterUPP = ^SInt32; { an opaque UPP }
    {   -----------------------------------------
        Characteristics
    -----------------------------------------   }
    {    characteristics in Movies.h work here too  }

const
    kQTSSupportsPerStreamControlCharacteristic = $70736374 (* 'psct' *);


type
    QTSVideoParamsPtr = ^QTSVideoParams;
    QTSVideoParams = record
        width:                  Fixed;
        height:                 Fixed;
        matrix:                 MatrixRecord;
        gWorld:                 CGrafPtr;
        gdHandle:               GDHandle;
        clip:                   RgnHandle;
        graphicsMode:           SInt16;
        opColor:                RGBColor;
    end;

    QTSAudioParamsPtr = ^QTSAudioParams;
    QTSAudioParams = record
        leftVolume:             SInt16;
        rightVolume:            SInt16;
        bassLevel:              SInt16;
        trebleLevel:            SInt16;
        frequencyBandsCount:    SInt16;
        frequencyBands:         Ptr;
        levelMeteringEnabled:   boolean;
    end;

    QTSMediaParamsPtr = ^QTSMediaParams;
    QTSMediaParams = record
        v:                      QTSVideoParams;
        a:                      QTSAudioParams;
    end;


const
    kQTSMustDraw                = $08;
    kQTSAtEnd                   = $10;
    kQTSPreflightDraw           = $20;
    kQTSSyncDrawing             = $40;

    {    media task result flags    }
    kQTSDidDraw                 = $01;
    kQTSNeedsToDraw             = $04;
    kQTSDrawAgain               = $08;
    kQTSPartialDraw             = $10;

    {   ============================================================================
            Notifications
    ============================================================================    }
    {    ------ notification types ------   }
    kQTSNullNotification        = $6E756C6C (* 'null' *);                       {  NULL  }
    kQTSErrorNotification       = $65727220 (* 'err ' *);                       {  QTSErrorParams*, optional  }
    kQTSNewPresDetectedNotification = $6E657770 (* 'newp' *);                   {  QTSNewPresDetectedParams*  }
    kQTSPresBeginChangingNotification = $70726362 (* 'prcb' *);                 {  NULL  }
    kQTSPresDoneChangingNotification = $70726364 (* 'prcd' *);                  {  NULL  }
    kQTSPresentationChangedNotification = $70726368 (* 'prch' *);               {  NULL  }
    kQTSNewStreamNotification   = $73746E77 (* 'stnw' *);                       {  QTSNewStreamParams*  }
    kQTSStreamBeginChangingNotification = $73746362 (* 'stcb' *);               {  QTSStream  }
    kQTSStreamDoneChangingNotification = $73746364 (* 'stcd' *);                {  QTSStream  }
    kQTSStreamChangedNotification = $73746368 (* 'stch' *);                     {  QTSStreamChangedParams*  }
    kQTSStreamGoneNotification  = $7374676E (* 'stgn' *);                       {  QTSStreamGoneParams*  }
    kQTSPreviewAckNotification  = $7076616B (* 'pvak' *);                       {  QTSStream  }
    kQTSPrerollAckNotification  = $7061636B (* 'pack' *);                       {  QTSStream  }
    kQTSStartAckNotification    = $7361636B (* 'sack' *);                       {  QTSStream  }
    kQTSStopAckNotification     = $7861636B (* 'xack' *);                       {  QTSStream  }
    kQTSStatusNotification      = $73746174 (* 'stat' *);                       {  QTSStatusParams*  }
    kQTSURLNotification         = $75726C20 (* 'url ' *);                       {  QTSURLParams*  }
    kQTSDurationNotification    = $64757261 (* 'dura' *);                       {  QTSDurationAtom*  }
    kQTSNewPresentationNotification = $6E707273 (* 'nprs' *);                   {  QTSPresentation  }
    kQTSPresentationGoneNotification = $78707273 (* 'xprs' *);                  {  QTSPresentation  }
    kQTSPresentationDoneNotification = $70646F6E (* 'pdon' *);                  {  NULL  }
    kQTSBandwidthAlertNotification = $6277616C (* 'bwal' *);                    {  QTSBandwidthAlertParams*  }
    kQTSAnnotationsChangedNotification = $6D657461 (* 'meta' *);                {  NULL  }


    {    flags for QTSErrorParams   }
    kQTSFatalErrorFlag          = $00000001;


type
    QTSErrorParamsPtr = ^QTSErrorParams;
    QTSErrorParams = record
        errorString:            ConstCStringPtr;
        flags:                  SInt32;
    end;

    QTSNewPresDetectedParamsPtr = ^QTSNewPresDetectedParams;
    QTSNewPresDetectedParams = record
        data:                   Ptr;
    end;

    QTSNewStreamParamsPtr = ^QTSNewStreamParams;
    QTSNewStreamParams = record
        stream:                 QTSStream;
    end;

    QTSStreamChangedParamsPtr = ^QTSStreamChangedParams;
    QTSStreamChangedParams = record
        stream:                 QTSStream;
        mediaComponent:         ComponentInstance;                      {  could be NULL  }
    end;

    QTSStreamGoneParamsPtr = ^QTSStreamGoneParams;
    QTSStreamGoneParams = record
        stream:                 QTSStream;
    end;

    QTSStatusParamsPtr = ^QTSStatusParams;
    QTSStatusParams = record
        status:                 UInt32;
        statusString:           ConstCStringPtr;
        detailedStatus:         UInt32;
        detailedStatusString:   ConstCStringPtr;
    end;

    QTSInfoParamsPtr = ^QTSInfoParams;
    QTSInfoParams = record
        infoType:               OSType;
        infoParams:             Ptr;
    end;

    QTSURLParamsPtr = ^QTSURLParams;
    QTSURLParams = record
        urlLength:              UInt32;
        url:                    ConstCStringPtr;
    end;


const
    kQTSBandwidthAlertNeedToStop = $01;
    kQTSBandwidthAlertRestartAt = $02;


type
    QTSBandwidthAlertParamsPtr = ^QTSBandwidthAlertParams;
    QTSBandwidthAlertParams = record
        flags:                  SInt32;
        restartAt:              TimeValue;                              {  new field in QT 4.1 }
        reserved:               Ptr;
    end;

    {   ============================================================================
            Presentation
    ============================================================================    }
    {   -----------------------------------------
         Flags
    -----------------------------------------   }
    {    flags for NewPresentationFromData  }

const
    kQTSAutoModeFlag            = $00000001;
    kQTSDontShowStatusFlag      = $00000008;
    kQTSSendMediaFlag           = $00010000;
    kQTSReceiveMediaFlag        = $00020000;


type
    QTSNewPresentationParamsPtr = ^QTSNewPresentationParams;
    QTSNewPresentationParams = record
        dataType:               OSType;
        data:                   Ptr;
        dataLength:             UInt32;
        editList:               QTSEditListHandle;
        flags:                  SInt32;
        timeScale:              TimeScale;                              {  set to 0 for default timescale  }
        mediaParams:            QTSMediaParamsPtr;
        notificationProc:       QTSNotificationUPP;
        notificationRefCon:     Ptr;
    end;

    QTSPresParamsPtr = ^QTSPresParams;
    QTSPresParams = record
        version:                UInt32;
        editList:               QTSEditListHandle;
        flags:                  SInt32;
        timeScale:              TimeScale;                              {  set to 0 for default timescale  }
        mediaParams:            QTSMediaParamsPtr;
        notificationProc:       QTSNotificationUPP;
        notificationRefCon:     Ptr;
    end;


const
    kQTSPresParamsVersion1      = 1;


type
    QTSPresIdleParamsPtr = ^QTSPresIdleParams;
    QTSPresIdleParams = record
        stream:                 QTSStream;
        movieTimeToDisplay:     TimeValue64;
        flagsIn:                SInt32;
        flagsOut:               SInt32;
    end;


const
    kQTSExportFlag_ShowDialog   = $00000001;

    kQTSExportParamsVersion1    = 1;


type
    QTSExportParamsPtr = ^QTSExportParams;
    QTSExportParams = record
        version:                SInt32;
        exportType:             OSType;
        exportExtraData:        Ptr;
        destinationContainerType: OSType;
        destinationContainerData: Ptr;
        destinationContainerExtras: Ptr;
        flagsIn:                SInt32;
        flagsOut:               SInt32;
        filterProc:             QTSModalFilterUPP;
        filterProcRefCon:       Ptr;
        exportComponent:        Component;                              {  NULL unless you want to override  }
    end;

    {   -----------------------------------------
        Toolbox Init/Close
    -----------------------------------------   }
    {    all "apps" must call this  }
    {
     *  InitializeQTS()
     *
     *  Availability:
     *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
     *    CarbonLib:        in CarbonLib 1.1 and later
     *    Mac OS X:         in version 10.0 and later
     *    Windows:          in QTSClient.lib 4.0 and later
        }
function InitializeQTS: OSErr; external name '_InitializeQTS';

{
 *  TerminateQTS()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function TerminateQTS: OSErr; external name '_TerminateQTS';

{-----------------------------------------
    Presentation Functions
-----------------------------------------}
{
 *  QTSNewPresentation()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function QTSNewPresentation(const (*var*) inParams: QTSNewPresentationParams; var outPresentation: QTSPresentation): OSErr; external name '_QTSNewPresentation';

{
 *  QTSNewPresentationFromData()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 5.0 and later
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 5.0 and later
 }
function QTSNewPresentationFromData(inDataType: OSType; inData: UnivPtr; const (*var*) inDataLength: SInt64; const (*var*) inPresParams: QTSPresParams; var outPresentation: QTSPresentation): OSErr; external name '_QTSNewPresentationFromData';

{
 *  QTSNewPresentationFromFile()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 5.0 and later
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 5.0 and later
 }
function QTSNewPresentationFromFile(const (*var*) inFileSpec: FSSpec; const (*var*) inPresParams: QTSPresParams; var outPresentation: QTSPresentation): OSErr; external name '_QTSNewPresentationFromFile';

{
 *  QTSNewPresentationFromDataRef()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 5.0 and later
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 5.0 and later
 }
function QTSNewPresentationFromDataRef(inDataRef: Handle; inDataRefType: OSType; const (*var*) inPresParams: QTSPresParams; var outPresentation: QTSPresentation): OSErr; external name '_QTSNewPresentationFromDataRef';

{
 *  QTSDisposePresentation()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function QTSDisposePresentation(inPresentation: QTSPresentation; inFlags: SInt32): OSErr; external name '_QTSDisposePresentation';

{
 *  QTSPresExport()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 5.0 and later
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 5.0 and later
 }
function QTSPresExport(inPresentation: QTSPresentation; inStream: QTSStream; var inExportParams: QTSExportParams): OSErr; external name '_QTSPresExport';

{
 *  QTSPresIdle()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
procedure QTSPresIdle(inPresentation: QTSPresentation; var ioParams: QTSPresIdleParams); external name '_QTSPresIdle';

{
 *  QTSPresInvalidateRegion()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function QTSPresInvalidateRegion(inPresentation: QTSPresentation; inRegion: RgnHandle): OSErr; external name '_QTSPresInvalidateRegion';

{-----------------------------------------
    Presentation Configuration
-----------------------------------------}
{
 *  QTSPresSetFlags()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function QTSPresSetFlags(inPresentation: QTSPresentation; inFlags: SInt32; inFlagsMask: SInt32): OSErr; external name '_QTSPresSetFlags';

{
 *  QTSPresGetFlags()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function QTSPresGetFlags(inPresentation: QTSPresentation; var outFlags: SInt32): OSErr; external name '_QTSPresGetFlags';

{
 *  QTSPresGetTimeBase()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function QTSPresGetTimeBase(inPresentation: QTSPresentation; var outTimeBase: TimeBase): OSErr; external name '_QTSPresGetTimeBase';

{
 *  QTSPresGetTimeScale()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function QTSPresGetTimeScale(inPresentation: QTSPresentation; var outTimeScale: TimeScale): OSErr; external name '_QTSPresGetTimeScale';

{
 *  QTSPresSetInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function QTSPresSetInfo(inPresentation: QTSPresentation; inStream: QTSStream; inSelector: OSType; ioParam: UnivPtr): OSErr; external name '_QTSPresSetInfo';

{
 *  QTSPresGetInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function QTSPresGetInfo(inPresentation: QTSPresentation; inStream: QTSStream; inSelector: OSType; ioParam: UnivPtr): OSErr; external name '_QTSPresGetInfo';

{
 *  QTSPresHasCharacteristic()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function QTSPresHasCharacteristic(inPresentation: QTSPresentation; inStream: QTSStream; inCharacteristic: OSType; var outHasIt: boolean): OSErr; external name '_QTSPresHasCharacteristic';

{
 *  QTSPresSetNotificationProc()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function QTSPresSetNotificationProc(inPresentation: QTSPresentation; inNotificationProc: QTSNotificationUPP; inRefCon: UnivPtr): OSErr; external name '_QTSPresSetNotificationProc';

{
 *  QTSPresGetNotificationProc()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function QTSPresGetNotificationProc(inPresentation: QTSPresentation; var outNotificationProc: QTSNotificationUPP; var outRefCon: UnivPtr): OSErr; external name '_QTSPresGetNotificationProc';

{-----------------------------------------
    Presentation Control
-----------------------------------------}
{
 *  QTSPresPreview()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 5.0 and later
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 }
function QTSPresPreview(inPresentation: QTSPresentation; inStream: QTSStream; const (*var*) inTimeValue: TimeValue64; inRate: Fixed; inFlags: SInt32): OSErr; external name '_QTSPresPreview';

{
 *  QTSPresPreroll()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function QTSPresPreroll(inPresentation: QTSPresentation; inStream: QTSStream; inTimeValue: UInt32; inRate: Fixed; inFlags: SInt32): OSErr; external name '_QTSPresPreroll';

{
 *  QTSPresPreroll64()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.1 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.1 and later
 }
function QTSPresPreroll64(inPresentation: QTSPresentation; inStream: QTSStream; const (*var*) inPrerollTime: TimeValue64; inRate: Fixed; inFlags: SInt32): OSErr; external name '_QTSPresPreroll64';

{
 *  QTSPresStart()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function QTSPresStart(inPresentation: QTSPresentation; inStream: QTSStream; inFlags: SInt32): OSErr; external name '_QTSPresStart';

{
 *  QTSPresSkipTo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function QTSPresSkipTo(inPresentation: QTSPresentation; inTimeValue: UInt32): OSErr; external name '_QTSPresSkipTo';

{
 *  QTSPresSkipTo64()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.1 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.1 and later
 }
function QTSPresSkipTo64(inPresentation: QTSPresentation; const (*var*) inTimeValue: TimeValue64): OSErr; external name '_QTSPresSkipTo64';

{
 *  QTSPresStop()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function QTSPresStop(inPresentation: QTSPresentation; inStream: QTSStream; inFlags: SInt32): OSErr; external name '_QTSPresStop';

{============================================================================
        Streams
============================================================================}
{-----------------------------------------
    Stream Functions
-----------------------------------------}
{
 *  QTSPresNewStream()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function QTSPresNewStream(inPresentation: QTSPresentation; inDataType: OSType; inData: UnivPtr; inDataLength: UInt32; inFlags: SInt32; var outStream: QTSStream): OSErr; external name '_QTSPresNewStream';

{
 *  QTSDisposeStream()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function QTSDisposeStream(inStream: QTSStream; inFlags: SInt32): OSErr; external name '_QTSDisposeStream';

{
 *  QTSPresGetNumStreams()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function QTSPresGetNumStreams(inPresentation: QTSPresentation): UInt32; external name '_QTSPresGetNumStreams';

{
 *  QTSPresGetIndStream()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function QTSPresGetIndStream(inPresentation: QTSPresentation; inIndex: UInt32): QTSStream; external name '_QTSPresGetIndStream';

{
 *  QTSGetStreamPresentation()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function QTSGetStreamPresentation(inStream: QTSStream): QTSPresentation; external name '_QTSGetStreamPresentation';

{
 *  QTSPresSetPreferredRate()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function QTSPresSetPreferredRate(inPresentation: QTSPresentation; inRate: Fixed; inFlags: SInt32): OSErr; external name '_QTSPresSetPreferredRate';

{
 *  QTSPresGetPreferredRate()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function QTSPresGetPreferredRate(inPresentation: QTSPresentation; var outRate: Fixed): OSErr; external name '_QTSPresGetPreferredRate';

{
 *  QTSPresSetEnable()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function QTSPresSetEnable(inPresentation: QTSPresentation; inStream: QTSStream; inEnableMode: boolean): OSErr; external name '_QTSPresSetEnable';

{
 *  QTSPresGetEnable()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function QTSPresGetEnable(inPresentation: QTSPresentation; inStream: QTSStream; var outEnableMode: boolean): OSErr; external name '_QTSPresGetEnable';

{
 *  QTSPresSetPresenting()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function QTSPresSetPresenting(inPresentation: QTSPresentation; inStream: QTSStream; inPresentingMode: boolean): OSErr; external name '_QTSPresSetPresenting';

{
 *  QTSPresGetPresenting()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function QTSPresGetPresenting(inPresentation: QTSPresentation; inStream: QTSStream; var outPresentingMode: boolean): OSErr; external name '_QTSPresGetPresenting';

{
 *  QTSPresSetActiveSegment()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.1 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.1 and later
 }
function QTSPresSetActiveSegment(inPresentation: QTSPresentation; inStream: QTSStream; const (*var*) inStartTime: TimeValue64; const (*var*) inDuration: TimeValue64): OSErr; external name '_QTSPresSetActiveSegment';

{
 *  QTSPresGetActiveSegment()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.1 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.1 and later
 }
function QTSPresGetActiveSegment(inPresentation: QTSPresentation; inStream: QTSStream; var outStartTime: TimeValue64; var outDuration: TimeValue64): OSErr; external name '_QTSPresGetActiveSegment';

{
 *  QTSPresSetPlayHints()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function QTSPresSetPlayHints(inPresentation: QTSPresentation; inStream: QTSStream; inFlags: SInt32; inFlagsMask: SInt32): OSErr; external name '_QTSPresSetPlayHints';

{
 *  QTSPresGetPlayHints()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function QTSPresGetPlayHints(inPresentation: QTSPresentation; inStream: QTSStream; var outFlags: SInt32): OSErr; external name '_QTSPresGetPlayHints';

{-----------------------------------------
    Stream Spatial Functions
-----------------------------------------}
{
 *  QTSPresSetGWorld()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function QTSPresSetGWorld(inPresentation: QTSPresentation; inStream: QTSStream; inGWorld: CGrafPtr; inGDHandle: GDHandle): OSErr; external name '_QTSPresSetGWorld';

{
 *  QTSPresGetGWorld()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function QTSPresGetGWorld(inPresentation: QTSPresentation; inStream: QTSStream; var outGWorld: CGrafPtr; var outGDHandle: GDHandle): OSErr; external name '_QTSPresGetGWorld';

{
 *  QTSPresSetClip()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function QTSPresSetClip(inPresentation: QTSPresentation; inStream: QTSStream; inClip: RgnHandle): OSErr; external name '_QTSPresSetClip';

{
 *  QTSPresGetClip()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function QTSPresGetClip(inPresentation: QTSPresentation; inStream: QTSStream; var outClip: RgnHandle): OSErr; external name '_QTSPresGetClip';

{
 *  QTSPresSetMatrix()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function QTSPresSetMatrix(inPresentation: QTSPresentation; inStream: QTSStream; const (*var*) inMatrix: MatrixRecord): OSErr; external name '_QTSPresSetMatrix';

{
 *  QTSPresGetMatrix()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function QTSPresGetMatrix(inPresentation: QTSPresentation; inStream: QTSStream; var outMatrix: MatrixRecord): OSErr; external name '_QTSPresGetMatrix';

{
 *  QTSPresSetDimensions()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function QTSPresSetDimensions(inPresentation: QTSPresentation; inStream: QTSStream; inWidth: Fixed; inHeight: Fixed): OSErr; external name '_QTSPresSetDimensions';

{
 *  QTSPresGetDimensions()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function QTSPresGetDimensions(inPresentation: QTSPresentation; inStream: QTSStream; var outWidth: Fixed; var outHeight: Fixed): OSErr; external name '_QTSPresGetDimensions';

{
 *  QTSPresSetGraphicsMode()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function QTSPresSetGraphicsMode(inPresentation: QTSPresentation; inStream: QTSStream; inMode: SInt16; const (*var*) inOpColor: RGBColor): OSErr; external name '_QTSPresSetGraphicsMode';

{
 *  QTSPresGetGraphicsMode()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function QTSPresGetGraphicsMode(inPresentation: QTSPresentation; inStream: QTSStream; var outMode: SInt16; var outOpColor: RGBColor): OSErr; external name '_QTSPresGetGraphicsMode';

{
 *  QTSPresGetPicture()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function QTSPresGetPicture(inPresentation: QTSPresentation; inStream: QTSStream; var outPicture: PicHandle): OSErr; external name '_QTSPresGetPicture';

{-----------------------------------------
    Stream Sound Functions
-----------------------------------------}
{
 *  QTSPresSetVolumes()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function QTSPresSetVolumes(inPresentation: QTSPresentation; inStream: QTSStream; inLeftVolume: SInt16; inRightVolume: SInt16): OSErr; external name '_QTSPresSetVolumes';

{
 *  QTSPresGetVolumes()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function QTSPresGetVolumes(inPresentation: QTSPresentation; inStream: QTSStream; var outLeftVolume: SInt16; var outRightVolume: SInt16): OSErr; external name '_QTSPresGetVolumes';

{-----------------------------------------
    Sourcing
-----------------------------------------}
{
 *  QTSPresGetSettingsAsText()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 5.0.1 and later
 *    CarbonLib:        in CarbonLib 1.6 and later
 *    Mac OS X:         in version 10.1 and later
 }
function QTSPresGetSettingsAsText(inPresentation: QTSPresentation; inStream: QTSStream; inFlags: SInt32; inSettingsType: OSType; var outText: Handle; inPanelFilterProc: QTSPanelFilterUPP; inPanelFilterProcRefCon: UnivPtr): OSErr; external name '_QTSPresGetSettingsAsText';

{
 *  QTSPresSettingsDialog()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 5.0 and later
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 }
function QTSPresSettingsDialog(inPresentation: QTSPresentation; inStream: QTSStream; inFlags: SInt32; inFilterProc: QTSModalFilterUPP; inFilterProcRefCon: UnivPtr): OSErr; external name '_QTSPresSettingsDialog';

{
 *  QTSPresSettingsDialogWithFilters()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 5.0.1 and later
 *    CarbonLib:        in CarbonLib 1.6 and later
 *    Mac OS X:         in version 10.1 and later
 }
function QTSPresSettingsDialogWithFilters(inPresentation: QTSPresentation; inStream: QTSStream; inFlags: SInt32; inFilterProc: QTSModalFilterUPP; inFilterProcRefCon: UnivPtr; inPanelFilterProc: QTSPanelFilterUPP; inPanelFilterProcRefCon: UnivPtr): OSErr; external name '_QTSPresSettingsDialogWithFilters';

{
 *  QTSPresSetSettings()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 5.0 and later
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 }
function QTSPresSetSettings(inPresentation: QTSPresentation; inStream: QTSStream; inSettings: QTAtomSpecPtr; inFlags: SInt32): OSErr; external name '_QTSPresSetSettings';

{
 *  QTSPresGetSettings()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 5.0 and later
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 }
function QTSPresGetSettings(inPresentation: QTSPresentation; inStream: QTSStream; var outSettings: QTAtomContainer; inFlags: SInt32): OSErr; external name '_QTSPresGetSettings';

{
 *  QTSPresAddSourcer()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 5.0 and later
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 }
function QTSPresAddSourcer(inPresentation: QTSPresentation; inStream: QTSStream; inSourcer: ComponentInstance; inFlags: SInt32): OSErr; external name '_QTSPresAddSourcer';

{
 *  QTSPresRemoveSourcer()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 5.0 and later
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 }
function QTSPresRemoveSourcer(inPresentation: QTSPresentation; inStream: QTSStream; inSourcer: ComponentInstance; inFlags: SInt32): OSErr; external name '_QTSPresRemoveSourcer';

{
 *  QTSPresGetNumSourcers()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 5.0 and later
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 }
function QTSPresGetNumSourcers(inPresentation: QTSPresentation; inStream: QTSStream): UInt32; external name '_QTSPresGetNumSourcers';

{
 *  QTSPresGetIndSourcer()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 5.0 and later
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 }
function QTSPresGetIndSourcer(inPresentation: QTSPresentation; inStream: QTSStream; inIndex: UInt32; var outSourcer: ComponentInstance): OSErr; external name '_QTSPresGetIndSourcer';

{============================================================================
        Misc
============================================================================}
{ flags for Get/SetNetworkAppName }

const
    kQTSNetworkAppNameIsFullNameFlag = $00000001;

    {
     *  QTSSetNetworkAppName()
     *
     *  Availability:
     *    Non-Carbon CFM:   in QTStreamLib 4.1 and later
     *    CarbonLib:        in CarbonLib 1.1 and later
     *    Mac OS X:         in version 10.0 and later
     *    Windows:          in QTSClient.lib 4.1 and later
        }
function QTSSetNetworkAppName(inAppName: ConstCStringPtr; inFlags: SInt32): OSErr; external name '_QTSSetNetworkAppName';

{
 *  QTSGetNetworkAppName()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.1 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.1 and later
 }
function QTSGetNetworkAppName(inFlags: SInt32; var outCStringPtr: CStringPtr): OSErr; external name '_QTSGetNetworkAppName';

{-----------------------------------------
    Statistics Utilities
-----------------------------------------}

type
    QTSStatHelperRecordPtr = ^QTSStatHelperRecord;
    QTSStatHelperRecord = record
        data:                   array [0..0] of SInt32;
    end;

    QTSStatHelper                       = ^QTSStatHelperRecord;

const
    kQTSInvalidStatHelper       = 0;

    {    flags for QTSStatHelperNextParams  }
    kQTSStatHelperReturnPascalStringsFlag = $00000001;


type
    QTSStatHelperNextParamsPtr = ^QTSStatHelperNextParams;
    QTSStatHelperNextParams = record
        flags:                  SInt32;
        returnedStatisticsType: OSType;
        returnedStream:         QTSStream;
        maxStatNameLength:      UInt32;
        returnedStatName:       CStringPtr;                             {  NULL if you don't want it }
        maxStatStringLength:    UInt32;
        returnedStatString:     CStringPtr;                             {  NULL if you don't want it }
        maxStatUnitLength:      UInt32;
        returnedStatUnit:       CStringPtr;                             {  NULL if you don't want it }
    end;

    QTSStatisticsParamsPtr = ^QTSStatisticsParams;
    QTSStatisticsParams = record
        statisticsType:         OSType;
        container:              QTAtomContainer;
        parentAtom:             QTAtom;
        flags:                  SInt32;
    end;

    {    general statistics types   }

const
    kQTSAllStatisticsType       = $616C6C20 (* 'all ' *);
    kQTSShortStatisticsType     = $73687274 (* 'shrt' *);
    kQTSSummaryStatisticsType   = $73756D6D (* 'summ' *);

    {    statistics flags   }
    kQTSGetNameStatisticsFlag   = $00000001;
    kQTSDontGetDataStatisticsFlag = $00000002;
    kQTSUpdateAtomsStatisticsFlag = $00000004;
    kQTSGetUnitsStatisticsFlag  = $00000008;
    kQTSUpdateAllIfNecessaryStatisticsFlag = $00010000;

    {    statistics atom types  }
    kQTSStatisticsStreamAtomType = $7374726D (* 'strm' *);
    kQTSStatisticsNameAtomType  = $6E616D65 (* 'name' *);                       {  chars only, no length or terminator  }
    kQTSStatisticsDataFormatAtomType = $66726D74 (* 'frmt' *);                  {  OSType  }
    kQTSStatisticsDataAtomType  = $64617461 (* 'data' *);
    kQTSStatisticsUnitsAtomType = $756E6974 (* 'unit' *);                       {  OSType  }
    kQTSStatisticsUnitsNameAtomType = $756E696E (* 'unin' *);                   {  chars only, no length or terminator  }

    {    statistics data formats    }
    kQTSStatisticsSInt32DataFormat = $73693332 (* 'si32' *);
    kQTSStatisticsUInt32DataFormat = $75693332 (* 'ui32' *);
    kQTSStatisticsSInt16DataFormat = $73693136 (* 'si16' *);
    kQTSStatisticsUInt16DataFormat = $75693136 (* 'ui16' *);
    kQTSStatisticsFixedDataFormat = $66697864 (* 'fixd' *);
    kQTSStatisticsUnsignedFixedDataFormat = $75666978 (* 'ufix' *);
    kQTSStatisticsStringDataFormat = $73747267 (* 'strg' *);
    kQTSStatisticsOSTypeDataFormat = $6F737470 (* 'ostp' *);
    kQTSStatisticsRectDataFormat = $72656374 (* 'rect' *);
    kQTSStatisticsPointDataFormat = $706F6E74 (* 'pont' *);

    {    statistics units types     }
    kQTSStatisticsNoUnitsType   = 0;
    kQTSStatisticsPercentUnitsType = $70636E74 (* 'pcnt' *);
    kQTSStatisticsBitsPerSecUnitsType = $62707320 (* 'bps ' *);
    kQTSStatisticsFramesPerSecUnitsType = $66707320 (* 'fps ' *);

    {    specific statistics types  }
    kQTSTotalDataRateStat       = $64727474 (* 'drtt' *);
    kQTSTotalDataRateInStat     = $64727469 (* 'drti' *);
    kQTSTotalDataRateOutStat    = $6472746F (* 'drto' *);
    kQTSNetworkIDStringStat     = $6E696473 (* 'nids' *);

    {
     *  QTSNewStatHelper()
     *
     *  Availability:
     *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
     *    CarbonLib:        in CarbonLib 1.1 and later
     *    Mac OS X:         in version 10.0 and later
     *    Windows:          in QTSClient.lib 4.0 and later
        }
function QTSNewStatHelper(inPresentation: QTSPresentation; inStream: QTSStream; inStatType: OSType; inFlags: SInt32; var outStatHelper: QTSStatHelper): OSErr; external name '_QTSNewStatHelper';

{
 *  QTSDisposeStatHelper()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function QTSDisposeStatHelper(inStatHelper: QTSStatHelper): OSErr; external name '_QTSDisposeStatHelper';

{
 *  QTSStatHelperGetStats()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function QTSStatHelperGetStats(inStatHelper: QTSStatHelper): OSErr; external name '_QTSStatHelperGetStats';

{
 *  QTSStatHelperResetIter()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function QTSStatHelperResetIter(inStatHelper: QTSStatHelper): OSErr; external name '_QTSStatHelperResetIter';

{
 *  QTSStatHelperNext()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function QTSStatHelperNext(inStatHelper: QTSStatHelper; var ioParams: QTSStatHelperNextParams): boolean; external name '_QTSStatHelperNext';

{
 *  QTSStatHelperGetNumStats()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function QTSStatHelperGetNumStats(inStatHelper: QTSStatHelper): UInt32; external name '_QTSStatHelperGetNumStats';

{ used by components to put statistics into the atom container }
{
 *  QTSGetOrMakeStatAtomForStream()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function QTSGetOrMakeStatAtomForStream(inContainer: QTAtomContainer; inStream: QTSStream; var outParentAtom: QTAtom): OSErr; external name '_QTSGetOrMakeStatAtomForStream';

{
 *  QTSInsertStatistic()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function QTSInsertStatistic(inContainer: QTAtomContainer; inParentAtom: QTAtom; inStatType: OSType; inStatData: UnivPtr; inStatDataLength: UInt32; inStatDataFormat: OSType; inFlags: SInt32): OSErr; external name '_QTSInsertStatistic';

{
 *  QTSInsertStatisticName()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function QTSInsertStatisticName(inContainer: QTAtomContainer; inParentAtom: QTAtom; inStatType: OSType; inStatName: ConstCStringPtr; inStatNameLength: UInt32): OSErr; external name '_QTSInsertStatisticName';

{
 *  QTSInsertStatisticUnits()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function QTSInsertStatisticUnits(inContainer: QTAtomContainer; inParentAtom: QTAtom; inStatType: OSType; inUnitsType: OSType; inUnitsName: ConstCStringPtr; inUnitsNameLength: UInt32): OSErr; external name '_QTSInsertStatisticUnits';

{============================================================================
        Data Formats
============================================================================}
{-----------------------------------------
    Data Types
-----------------------------------------}
{ universal data types }

const
    kQTSNullDataType            = $4E554C4C (* 'NULL' *);
    kQTSUnknownDataType         = $6875683F (* 'huh?' *);
    kQTSAtomContainerDataType   = $71746163 (* 'qtac' *);                       {  QTAtomContainer  }
    kQTSAtomDataType            = $71746174 (* 'qtat' *);                       {  QTSAtomContainerDataStruct*  }
    kQTSAliasDataType           = $616C6973 (* 'alis' *);
    kQTSFileDataType            = $66737063 (* 'fspc' *);                       {  FSSpec*  }
    kQTSFileSpecDataType        = $66737063 (* 'fspc' *);                       {  FSSpec*  }
    kQTSHandleDataType          = $686E646C (* 'hndl' *);                       {  Handle*  }
    kQTSDataRefDataType         = $64726566 (* 'dref' *);                       {  DataReferencePtr  }

    {    these data types are specific to presentations     }
    kQTSRTSPDataType            = $72747370 (* 'rtsp' *);
    kQTSSDPDataType             = $73647020 (* 'sdp ' *);

    {   -----------------------------------------
        Atom IDs
    -----------------------------------------   }
    kQTSAtomType_Presentation   = $70726573 (* 'pres' *);
    kQTSAtomType_PresentationHeader = $70686472 (* 'phdr' *);                   {  QTSPresentationHeaderAtom  }
    kQTSAtomType_MediaStream    = $6D737472 (* 'mstr' *);
    kQTSAtomType_MediaStreamHeader = $6D736864 (* 'mshd' *);                    {  QTSMediaStreamHeaderAtom  }
    kQTSAtomType_MediaDescriptionText = $6D646573 (* 'mdes' *);                 {  chars, no length  }
    kQTSAtomType_ClipRect       = $636C6970 (* 'clip' *);                       {  QTSClipRectAtom  }
    kQTSAtomType_Duration       = $64757261 (* 'dura' *);                       {  QTSDurationAtom  }
    kQTSAtomType_BufferTime     = $62756672 (* 'bufr' *);                       {  QTSBufferTimeAtom  }


type
    QTSAtomContainerDataStructPtr = ^QTSAtomContainerDataStruct;
    QTSAtomContainerDataStruct = record
        container:              QTAtomContainer;
        parentAtom:             QTAtom;
    end;

    {    flags for QTSPresentationHeaderAtom    }

const
    kQTSPresHeaderTypeIsData    = $00000100;
    kQTSPresHeaderDataIsHandle  = $00000200;


type
    QTSPresentationHeaderAtomPtr = ^QTSPresentationHeaderAtom;
    QTSPresentationHeaderAtom = record
        versionAndFlags:        SInt32;
        conductorOrDataType:    OSType;
        dataAtomType:           OSType;                                 {  where the data really is }
    end;

    QTSMediaStreamHeaderAtomPtr = ^QTSMediaStreamHeaderAtom;
    QTSMediaStreamHeaderAtom = record
        versionAndFlags:        SInt32;
        mediaTransportType:     OSType;
        mediaTransportDataAID:  OSType;                                 {  where the data really is }
    end;

    QTSBufferTimeAtomPtr = ^QTSBufferTimeAtom;
    QTSBufferTimeAtom = record
        versionAndFlags:        SInt32;
        bufferTime:             Fixed;
    end;

    QTSDurationAtomPtr = ^QTSDurationAtom;
    QTSDurationAtom = record
        versionAndFlags:        SInt32;
        timeScale:              TimeScale;
        duration:               TimeValue64;
    end;

    QTSClipRectAtomPtr = ^QTSClipRectAtom;
    QTSClipRectAtom = record
        versionAndFlags:        SInt32;
        clipRect:               Rect;
    end;


const
    kQTSEmptyEditStreamStartTime = -1;



type
    QTSStatus                           = UInt32;

const
    kQTSNullStatus              = 0;
    kQTSUninitializedStatus     = 1;
    kQTSConnectingStatus        = 2;
    kQTSOpeningConnectionDetailedStatus = 3;
    kQTSMadeConnectionDetailedStatus = 4;
    kQTSNegotiatingStatus       = 5;
    kQTSGettingDescriptionDetailedStatus = 6;
    kQTSGotDescriptionDetailedStatus = 7;
    kQTSSentSetupCmdDetailedStatus = 8;
    kQTSReceivedSetupResponseDetailedStatus = 9;
    kQTSSentPlayCmdDetailedStatus = 10;
    kQTSReceivedPlayResponseDetailedStatus = 11;
    kQTSBufferingStatus         = 12;
    kQTSPlayingStatus           = 13;
    kQTSPausedStatus            = 14;
    kQTSAutoConfiguringStatus   = 15;
    kQTSDownloadingStatus       = 16;
    kQTSBufferingWithTimeStatus = 17;
    kQTSWaitingDisconnectStatus = 100;

    {   -----------------------------------------
        QuickTime Preferences Types
    -----------------------------------------   }
    kQTSConnectionPrefsType     = $7374636D (* 'stcm' *);                       {  root atom that all other atoms are contained in }
                                                                {     kQTSNotUsedForProxyPrefsType = 'nopr',     //        comma-delimited list of URLs that are never used for proxies }
    kQTSConnectionMethodPrefsType = $6D746864 (* 'mthd' *);                     {       connection method (OSType that matches one of the following three) }
    kQTSDirectConnectPrefsType  = $64726374 (* 'drct' *);                       {        used if direct connect (QTSDirectConnectPrefsRecord) }
                                                                {     kQTSRTSPProxyPrefsType =     'rtsp',   //   used if RTSP Proxy (QTSProxyPrefsRecord) }
    kQTSSOCKSPrefsType          = $736F636B (* 'sock' *);                       {        used if SOCKS Proxy (QTSProxyPrefsRecord) }

    kQTSDirectConnectHTTPProtocol = $68747470 (* 'http' *);
    kQTSDirectConnectRTSPProtocol = $72747370 (* 'rtsp' *);


type
    QTSDirectConnectPrefsRecordPtr = ^QTSDirectConnectPrefsRecord;
    QTSDirectConnectPrefsRecord = record
        tcpPortID:              UInt32;
        protocol:               OSType;
    end;

    QTSProxyPrefsRecordPtr = ^QTSProxyPrefsRecord;
    QTSProxyPrefsRecord = record
        serverNameStr:          Str255;
        portID:                 UInt32;
    end;


const
    kConnectionActive           = $00000001;
    kConnectionUseSystemPref    = $00000002;


type
    QTSTransportPrefPtr = ^QTSTransportPref;
    QTSTransportPref = record
        protocol:               OSType;                                 {  udp, http, tcp, etc }
        portID:                 SInt32;                                 {  port to use for this connection type }
        flags:                  UInt32;                                 {  connection flags }
        seed:                   UInt32;                                 {  seed value last time this setting was read from system prefs }
    end;


const
    kProxyActive                = $00000001;
    kProxyUseSystemPref         = $00000002;


type
    QTSProxyPrefPtr = ^QTSProxyPref;
    QTSProxyPref = record
        flags:                  UInt32;                                 {  proxy flags }
        portID:                 SInt32;                                 {  port to use for this connection type }
        seed:                   UInt32;                                 {  seed value last time this setting was read from system prefs }
        serverNameStr:          Str255;                                 {  proxy server url }
    end;


const
    kNoProxyUseSystemPref       = $00000001;


type
    QTSNoProxyPrefPtr = ^QTSNoProxyPref;
    QTSNoProxyPref = record
        flags:                  UInt32;                                 {  no-proxy flags }
        seed:                   UInt32;                                 {  seed value last time this setting was read from system prefs }
        urlList:                SInt8;                                  {  NULL terminated, comma delimited list of urls }
    end;


const
    kQTSInstantOnFlag_Enable    = $00000001;                    {  instant on is enabled (read/write) }
    kQTSInstantOnFlag_Permitted = $00000002;                    {  instant on is possible (read only) }



type
    QTSInstantOnPrefPtr = ^QTSInstantOnPref;
    QTSInstantOnPref = record
        flags:                  SInt32;                                 {  flags }
        factor:                 SInt32;                                 {     0-100; default is 50 }
    end;


const
    kQTSTransAndProxyAtomType   = $73747270 (* 'strp' *);                       {  transport/proxy prefs root atom }
    kQTSConnectionPrefsVersion  = $76657273 (* 'vers' *);                       {    prefs format version }
    kQTSTransportPrefsAtomType  = $74726E73 (* 'trns' *);                       {    tranport prefs root atom }
    kQTSConnectionAtomType      = $636F6E6E (* 'conn' *);                       {      connection prefs atom type, one for each transport type }
    kQTSUDPTransportType        = $75647020 (* 'udp ' *);                       {      udp transport prefs }
    kQTSHTTPTransportType       = $68747470 (* 'http' *);                       {      http transport prefs }
    kQTSTCPTransportType        = $74637020 (* 'tcp ' *);                       {      tcp transport prefs     }
    kQTSProxyPrefsAtomType      = $70727879 (* 'prxy' *);                       {    proxy prefs root atom }
    kQTSHTTPProxyPrefsType      = $68747470 (* 'http' *);                       {      http proxy settings }
    kQTSRTSPProxyPrefsType      = $72747370 (* 'rtsp' *);                       {      rtsp proxy settings }
    kQTSSOCKSProxyPrefsType     = $736F636B (* 'sock' *);                       {      socks proxy settings }
    kQTSProxyUserInfoPrefsType  = $75736572 (* 'user' *);                       {    proxy username/password root atom }
    kQTSDontProxyPrefsAtomType  = $6E6F7072 (* 'nopr' *);                       {    no-proxy prefs root atom }
    kQTSDontProxyDataType       = $64617461 (* 'data' *);                       {      no proxy settings }
    kQTSInstantOnPrefsAtomType  = $696E6F6E (* 'inon' *);                       {  instant on prefs }

    {
     *  QTSPrefsAddProxySetting()
     *
     *  Availability:
     *    Non-Carbon CFM:   in QTStreamLib 4.1 and later
     *    CarbonLib:        in CarbonLib 1.1 and later
     *    Mac OS X:         in version 10.0 and later
     *    Windows:          in QTSClient.lib 4.1 and later
        }
function QTSPrefsAddProxySetting(proxyType: OSType; portID: SInt32; flags: UInt32; seed: UInt32; var srvrURL: Str255): OSErr; external name '_QTSPrefsAddProxySetting';

{
 *  QTSPrefsFindProxyByType()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.1 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.1 and later
 }
function QTSPrefsFindProxyByType(proxyType: OSType; flags: UInt32; flagsMask: UInt32; var proxyHndl: UnivPtr; var count: SInt16): OSErr; external name '_QTSPrefsFindProxyByType';

{
 *  QTSPrefsAddConnectionSetting()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.1 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.1 and later
 }
function QTSPrefsAddConnectionSetting(protocol: OSType; portID: SInt32; flags: UInt32; seed: UInt32): OSErr; external name '_QTSPrefsAddConnectionSetting';

{
 *  QTSPrefsFindConnectionByType()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.1 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.1 and later
 }
function QTSPrefsFindConnectionByType(protocol: OSType; flags: UInt32; flagsMask: UInt32; var connectionHndl: UnivPtr; var count: SInt16): OSErr; external name '_QTSPrefsFindConnectionByType';

{
 *  QTSPrefsGetActiveConnection()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.1 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.1 and later
 }
function QTSPrefsGetActiveConnection(protocol: OSType; var connectInfo: QTSTransportPref): OSErr; external name '_QTSPrefsGetActiveConnection';

{
 *  QTSPrefsGetNoProxyURLs()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.1 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.1 and later
 }
function QTSPrefsGetNoProxyURLs(var noProxyHndl: UnivPtr): OSErr; external name '_QTSPrefsGetNoProxyURLs';

{
 *  QTSPrefsSetNoProxyURLs()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.1 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.1 and later
 }
function QTSPrefsSetNoProxyURLs(urls: CStringPtr; flags: UInt32; seed: UInt32): OSErr; external name '_QTSPrefsSetNoProxyURLs';

{
 *  QTSPrefsAddProxyUserInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 5.0.1 and later
 *    CarbonLib:        in CarbonLib 1.6 and later
 *    Mac OS X:         in version 10.1 and later
 *    Windows:          in QTSClient.lib 5.0.1 and later
 }
function QTSPrefsAddProxyUserInfo(proxyType: OSType; flags: SInt32; flagsMask: SInt32; username: StringPtr; password: StringPtr): OSErr; external name '_QTSPrefsAddProxyUserInfo';

{
 *  QTSPrefsFindProxyUserInfoByType()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 5.0.1 and later
 *    CarbonLib:        in CarbonLib 1.6 and later
 *    Mac OS X:         in version 10.1 and later
 *    Windows:          in QTSClient.lib 5.0.1 and later
 }
function QTSPrefsFindProxyUserInfoByType(proxyType: OSType; flags: SInt32; flagsMask: SInt32; username: StringPtr; password: StringPtr): OSErr; external name '_QTSPrefsFindProxyUserInfoByType';

{
 *  QTSPrefsGetInstantOnSettings()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 6.0 and later
 *    CarbonLib:        in CarbonLib 1.6 and later
 *    Mac OS X:         in version 10.2 and later
 *    Windows:          in QTSClient.lib 6.0 and later
 }
function QTSPrefsGetInstantOnSettings(var outPref: QTSInstantOnPref; inFlags: SInt32): OSErr; external name '_QTSPrefsGetInstantOnSettings';

{
 *  QTSPrefsSetInstantOnSettings()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 6.0 and later
 *    CarbonLib:        in CarbonLib 1.6 and later
 *    Mac OS X:         in version 10.2 and later
 *    Windows:          in QTSClient.lib 6.0 and later
 }
function QTSPrefsSetInstantOnSettings(var inPref: QTSInstantOnPref; inFlags: SInt32): OSErr; external name '_QTSPrefsSetInstantOnSettings';


{============================================================================
        Memory Management Services
============================================================================}
{
   These routines allocate normal pointers and handles,
   but do the correct checking, etc.
   Dispose using the normal DisposePtr and DisposeHandle
   Call these routines for one time memory allocations.
   You do not need to set any hints to use these calls.
}

{
 *  QTSNewPtr()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function QTSNewPtr(inByteCount: UInt32; inFlags: SInt32; var outFlags: SInt32): Ptr; external name '_QTSNewPtr';

{
 *  QTSNewHandle()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function QTSNewHandle(inByteCount: UInt32; inFlags: SInt32; var outFlags: SInt32): Handle; external name '_QTSNewHandle';

{  flags in }

const
    kQTSMemAllocClearMem        = $00000001;
    kQTSMemAllocDontUseTempMem  = $00000002;
    kQTSMemAllocTryTempMemFirst = $00000004;
    kQTSMemAllocDontUseSystemMem = $00000008;
    kQTSMemAllocTrySystemMemFirst = $00000010;
    kQTSMemAllocHoldMemory      = $00001000;
    kQTSMemAllocIsInterruptTime = $01010000;                    {  currently not supported for alloc }

    {  flags out }
    kQTSMemAllocAllocatedInTempMem = $00000001;
    kQTSMemAllocAllocatedInSystemMem = $00000002;


type
    QTSMemPtr    = ^SInt32; { an opaque 32-bit type }
    QTSMemPtrPtr = ^QTSMemPtr;  { when a var xx:QTSMemPtr parameter can be nil, it is changed to xx: QTSMemPtrPtr }
    {
       These routines are for buffers that will be recirculated
       you must use QTReleaseMemPtr instead of DisposePtr
       QTSReleaseMemPtr can be used at interrupt time
       but QTSAllocMemPtr currently cannot
    }
    {
     *  QTSAllocMemPtr()
     *
     *  Availability:
     *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
     *    CarbonLib:        in CarbonLib 1.1 and later
     *    Mac OS X:         in version 10.0 and later
     *    Windows:          in QTSClient.lib 4.0 and later
        }
function QTSAllocMemPtr(inByteCount: UInt32; inFlags: SInt32): QTSMemPtr; external name '_QTSAllocMemPtr';

{
 *  QTSReleaseMemPtr()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
procedure QTSReleaseMemPtr(inMemPtr: QTSMemPtr; inFlags: SInt32); external name '_QTSReleaseMemPtr';


{============================================================================
        Buffer Management Services
============================================================================}


const
    kQTSStreamBufferVersion1    = 1;


type
    QTSStreamBufferPtr = ^QTSStreamBuffer;
    QTSStreamBuffer = record
        reserved1:              QTSStreamBufferPtr;
        reserved2:              QTSStreamBufferPtr;
        next:                   QTSStreamBufferPtr;                     {  next message block in a message  }
        rptr:                   Ptr;                                    {  first byte with real data in the DataBuffer  }
        wptr:                   Ptr;                                    {  last+1 byte with real data in the DataBuffer  }
        version:                SInt32;
        metadata:               array [0..3] of UInt32;                 {  usage defined by message sender  }
        flags:                  SInt32;                                 {  reserved  }
        reserved3:              SInt32;
        reserved4:              SInt32;
        reserved5:              SInt32;
        moreMeta:               array [0..7] of UInt32;
    end;

    {  flags for QTSDuplicateMessage }

const
    kQTSDuplicateBufferFlag_CopyData = $00000001;
    kQTSDuplicateBufferFlag_FlattenMessage = $00000002;


    {
     *  QTSNewStreamBuffer()
     *
     *  Availability:
     *    Non-Carbon CFM:   in QTStreamLib 5.0 and later
     *    CarbonLib:        in CarbonLib 1.3 and later
     *    Mac OS X:         in version 10.0 and later
     *    Windows:          in QTSClient.lib 5.0 and later
        }
function QTSNewStreamBuffer(inDataSize: UInt32; inFlags: SInt32; var outStreamBuffer: UnivPtr): OSErr; external name '_QTSNewStreamBuffer';

{
 *  QTSFreeMessage()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
procedure QTSFreeMessage(var inMessage: QTSStreamBuffer); external name '_QTSFreeMessage';

{
    kQTSDuplicateBufferFlag_CopyData - forces a copy of the data itself
    kQTSCopyBufferFlag_FlattenMessage - copies the data if it needs to be flattened
    QTSDuplicateMessage never frees the old message
}
{
 *  QTSDuplicateMessage()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 5.0 and later
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 5.0 and later
 }
function QTSDuplicateMessage(var inMessage: QTSStreamBuffer; inFlags: SInt32; var outDuplicatedMessage: UnivPtr): OSErr; external name '_QTSDuplicateMessage';

{
 *  QTSMessageLength()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function QTSMessageLength(var inMessage: QTSStreamBuffer): UInt32; external name '_QTSMessageLength';

{
 *  QTSStreamBufferDataInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 5.0 and later
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 5.0 and later
 }
procedure QTSStreamBufferDataInfo(var inStreamBuffer: QTSStreamBuffer; var outDataStart: UnivPtr; var outDataMaxLength: UInt32); external name '_QTSStreamBufferDataInfo';

{  ---- old calls (don't use these) }

{
 *  QTSAllocBuffer()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function QTSAllocBuffer(inSize: SInt32): QTSStreamBufferPtr; external name '_QTSAllocBuffer';

{
 *  QTSDupMessage()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function QTSDupMessage(var inMessage: QTSStreamBuffer): QTSStreamBufferPtr; external name '_QTSDupMessage';

{
 *  QTSCopyMessage()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function QTSCopyMessage(var inMessage: QTSStreamBuffer): QTSStreamBufferPtr; external name '_QTSCopyMessage';

{
 *  QTSFlattenMessage()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function QTSFlattenMessage(var inMessage: QTSStreamBuffer): QTSStreamBufferPtr; external name '_QTSFlattenMessage';



{============================================================================
        Misc
============================================================================}
{
 *  QTSGetErrorString()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function QTSGetErrorString(inErrorCode: SInt32; inMaxErrorStringLength: UInt32; outErrorString: CStringPtr; inFlags: SInt32): boolean; external name '_QTSGetErrorString';

{
 *  QTSInitializeMediaParams()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 5.0.1 and later
 *    CarbonLib:        in CarbonLib 1.6 and later
 *    Mac OS X:         in version 10.1 and later
 *    Windows:          in QTSClient.lib 5.0.1 and later
 }
function QTSInitializeMediaParams(var inMediaParams: QTSMediaParams): OSErr; external name '_QTSInitializeMediaParams';



{ UPP call backs }

const
    uppQTSNotificationProcInfo = $00003FF0;
    uppQTSPanelFilterProcInfo = $000003D0;
    uppQTSModalFilterProcInfo = $00003FD0;
    {
     *  NewQTSNotificationUPP()
     *
     *  Availability:
     *    Non-Carbon CFM:   available as macro/inline
     *    CarbonLib:        in CarbonLib 1.3 and later
     *    Mac OS X:         in version 10.0 and later
        }
function NewQTSNotificationUPP(userRoutine: QTSNotificationProcPtr): QTSNotificationUPP; external name '_NewQTSNotificationUPP'; { old name was NewQTSNotificationProc }
{
 *  NewQTSPanelFilterUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.6 and later
 *    Mac OS X:         in version 10.1 and later
 }
function NewQTSPanelFilterUPP(userRoutine: QTSPanelFilterProcPtr): QTSPanelFilterUPP; external name '_NewQTSPanelFilterUPP'; { old name was NewQTSPanelFilterProc }
{
 *  NewQTSModalFilterUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewQTSModalFilterUPP(userRoutine: QTSModalFilterProcPtr): QTSModalFilterUPP; external name '_NewQTSModalFilterUPP'; { old name was NewQTSModalFilterProc }
{
 *  DisposeQTSNotificationUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeQTSNotificationUPP(userUPP: QTSNotificationUPP); external name '_DisposeQTSNotificationUPP';
{
 *  DisposeQTSPanelFilterUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.6 and later
 *    Mac OS X:         in version 10.1 and later
 }
procedure DisposeQTSPanelFilterUPP(userUPP: QTSPanelFilterUPP); external name '_DisposeQTSPanelFilterUPP';
{
 *  DisposeQTSModalFilterUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeQTSModalFilterUPP(userUPP: QTSModalFilterUPP); external name '_DisposeQTSModalFilterUPP';
{
 *  InvokeQTSNotificationUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeQTSNotificationUPP(inErr: ComponentResult; inNotificationType: OSType; inNotificationParams: UnivPtr; inRefCon: UnivPtr; userRoutine: QTSNotificationUPP): ComponentResult; external name '_InvokeQTSNotificationUPP'; { old name was CallQTSNotificationProc }
{
 *  InvokeQTSPanelFilterUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.6 and later
 *    Mac OS X:         in version 10.1 and later
 }
function InvokeQTSPanelFilterUPP(var inParams: QTSPanelFilterParams; inRefCon: UnivPtr; userRoutine: QTSPanelFilterUPP): boolean; external name '_InvokeQTSPanelFilterUPP'; { old name was CallQTSPanelFilterProc }
{
 *  InvokeQTSModalFilterUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 }
function InvokeQTSModalFilterUPP(inDialog: DialogPtr; const (*var*) inEvent: EventRecord; var ioItemHit: SInt16; inRefCon: UnivPtr; userRoutine: QTSModalFilterUPP): boolean; external name '_InvokeQTSModalFilterUPP'; { old name was CallQTSModalFilterProc }
{$ALIGN MAC68K}
{#POP}
{unit QTSMovie}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}


const
    kQTSStreamMediaType         = $7374726D (* 'strm' *);


type
    QTSSampleDescriptionPtr = ^QTSSampleDescription;
    QTSSampleDescription = record
        descSize:               SInt32;
        dataFormat:             SInt32;
        resvd1:                 SInt32;                             {  set to 0 }
        resvd2:                 SInt16;                             {  set to 0 }
        dataRefIndex:           SInt16;
        version:                UInt32;
        resvd3:                 UInt32;                                 {  set to 0 }
        flags:                  SInt32;
                                                                        {  qt atoms follow: }
                                                                        {       long size, long type, some data }
                                                                        {       repeat as necessary }
    end;

    QTSSampleDescriptionHandle          = ^QTSSampleDescriptionPtr;

const
    kQTSSampleDescriptionVersion1 = 1;

    kQTSDefaultMediaTimeScale   = 600;

    {  sample description flags }
    kQTSSampleDescPassSampleDataAsHandleFlag = $00000001;


    {   ============================================================================
            Stream Media Handler
    ============================================================================    }
    {   -----------------------------------------
        Info Selectors
    -----------------------------------------   }
    {    all indexes start at 1     }

    kQTSMediaPresentationInfo   = $70726573 (* 'pres' *);                       {  QTSMediaPresentationParams*  }
    kQTSMediaNotificationInfo   = $6E6F7469 (* 'noti' *);                       {  QTSMediaNotificationParams*  }
    kQTSMediaTotalDataRateInfo  = $64747274 (* 'dtrt' *);                       {  UInt32*, bits/sec  }
    kQTSMediaLostPercentInfo    = $6C737063 (* 'lspc' *);                       {  Fixed*  }
    kQTSMediaNumStreamsInfo     = $6E737472 (* 'nstr' *);                       {  UInt32*  }
    kQTSMediaIndSampleDescriptionInfo = $69736463 (* 'isdc' *);                 {  QTSMediaIndSampleDescriptionParams*  }



type
    QTSMediaPresentationParamsPtr = ^QTSMediaPresentationParams;
    QTSMediaPresentationParams = record
        presentationID:         QTSPresentation;
    end;

    QTSMediaNotificationParamsPtr = ^QTSMediaNotificationParams;
    QTSMediaNotificationParams = record
        notificationProc:       QTSNotificationUPP;
        notificationRefCon:     Ptr;
        flags:                  SInt32;
    end;

    QTSMediaIndSampleDescriptionParamsPtr = ^QTSMediaIndSampleDescriptionParams;
    QTSMediaIndSampleDescriptionParams = record
        index:                  SInt32;
        returnedMediaType:      OSType;
        returnedSampleDescription: SampleDescriptionHandle;
    end;

    {   -----------------------------------------
        QTS Media Handler Selectors
    -----------------------------------------   }

const
    kQTSMediaSetInfoSelect      = $0100;
    kQTSMediaGetInfoSelect      = $0101;
    kQTSMediaSetIndStreamInfoSelect = $0102;
    kQTSMediaGetIndStreamInfoSelect = $0103;

    {   -----------------------------------------
        QTS Media Handler functions
    -----------------------------------------   }
    {
     *  QTSMediaSetInfo()
     *
     *  Availability:
     *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
     *    CarbonLib:        in CarbonLib 1.1 and later
     *    Mac OS X:         in version 10.0 and later
     *    Windows:          in QTSClient.lib 4.0 and later
        }
function QTSMediaSetInfo(mh: MediaHandler; inSelector: OSType; ioParams: UnivPtr): ComponentResult; external name '_QTSMediaSetInfo';
{
 *  QTSMediaGetInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function QTSMediaGetInfo(mh: MediaHandler; inSelector: OSType; ioParams: UnivPtr): ComponentResult; external name '_QTSMediaGetInfo';
{
 *  QTSMediaSetIndStreamInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function QTSMediaSetIndStreamInfo(mh: MediaHandler; inIndex: SInt32; inSelector: OSType; ioParams: UnivPtr): ComponentResult; external name '_QTSMediaSetIndStreamInfo';
{
 *  QTSMediaGetIndStreamInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function QTSMediaGetIndStreamInfo(mh: MediaHandler; inIndex: SInt32; inSelector: OSType; ioParams: UnivPtr): ComponentResult; external name '_QTSMediaGetIndStreamInfo';
{============================================================================
        Hint Media Handler
============================================================================}

const
    kQTSHintMediaType           = $68696E74 (* 'hint' *);

    kQTSHintTrackReference      = $68696E74 (* 'hint' *);




{$ALIGN MAC68K}
{#POP}
{unit QTStreamingComponents}
{$ALIGN MAC68K}









{#PUSH}
{$ALIGN MAC68K}
{#LibExport+}

{============================================================================
        Stream Sourcer
============================================================================}

const
    kQTSSourcerType             = $73726372 (* 'srcr' *);


type
    QTSSourcer                          = ComponentInstance;

const
    kQTSSGChannelSourcerType    = $73676368 (* 'sgch' *);
    kQTSMovieTrackSourcerType   = $7472616B (* 'trak' *);
    kQTSPushDataSourcerType     = $70757368 (* 'push' *);

    {    flags for sourcer data     }
    kQTSSourcerDataFlag_SyncSample = $00000001;
    kQTSPushDataSourcerFlag_SampleTimeIsValid = $80000000;


    kQTSSourcerInitParamsVersion1 = 1;


type
    QTSSourcerInitParamsPtr = ^QTSSourcerInitParams;
    QTSSourcerInitParams = record
        version:                SInt32;
        flags:                  SInt32;
        dataType:               OSType;
        data:                   Ptr;
        dataLength:             UInt32;
    end;

    {
     *  QTSNewSourcer()
     *
     *  Availability:
     *    Non-Carbon CFM:   in QTStreamLib 5.0 and later
     *    CarbonLib:        in CarbonLib 1.3 and later
     *    Mac OS X:         in version 10.0 and later
        }
function QTSNewSourcer(params: UnivPtr; const (*var*) inInitParams: QTSSourcerInitParams; inFlags: SInt32; var outSourcer: ComponentInstance): OSErr; external name '_QTSNewSourcer';

{ info selectors for sourcers - get and set }

const
    kQTSInfo_Track              = $7472616B (* 'trak' *);                       {  QTSTrackParams*  }
    kQTSInfo_Loop               = $6C6F6F70 (* 'loop' *);                       {  QTSLoopParams*  }
    kQTSInfo_SourcerTiming      = $7374696D (* 'stim' *);                       {  QTSSourcerTimingParams*  }
    kQTSInfo_TargetFrameRate    = $74667073 (* 'tfps' *);                       {  Fixed * in frames per second  }
    kQTSInfo_PushData           = $70757368 (* 'push' *);                       {  QTSPushDataParams*  }
    kQTSInfo_SourcerCallbackProc = $73636270 (* 'scbp' *);                      {  QTSSourcerCallbackProcParams*  }
    kQTSInfo_TargetDataRate     = $74647274 (* 'tdrt' *);                       {  UInt32 * in bytes per second  }
    kQTSInfo_AudioAutoGainOnOff = $61676320 (* 'agc ' *);                       {  Boolean*  - error if unavailable }
    kQTSInfo_AudioGain          = $6761696E (* 'gain' *);                       {  Fixed* kFixed1 is unity gain  }
    kQTSInfo_CroppedInputRect   = $63727072 (* 'crpr' *);                       {  Rect* - defined relative to kQTSInfo_FullInputRect below  }
    kQTSInfo_SpatialSettings    = $7370746C (* 'sptl' *);                       {  pointer to SCSpatialSettings struct }
    kQTSInfo_TemporalSettings   = $7470726C (* 'tprl' *);                       {  pointer to SCTemporalSettings struct }
    kQTSInfo_DataRateSettings   = $64726174 (* 'drat' *);                       {  pointer to SCDataRateSettings struct }
    kQTSInfo_CodecFlags         = $63666C67 (* 'cflg' *);                       {  pointer to CodecFlags }
    kQTSInfo_CodecSettings      = $63646563 (* 'cdec' *);                       {  pointer to Handle }
    kQTSInfo_ForceKeyValue      = $6B73696D (* 'ksim' *);                       {  pointer to long }
    kQTSInfo_SoundSampleRate    = $73737274 (* 'ssrt' *);                       {  pointer to UnsignedFixed }
    kQTSInfo_SoundSampleSize    = $73737373 (* 'ssss' *);                       {  pointer to short }
    kQTSInfo_SoundChannelCount  = $73736363 (* 'sscc' *);                       {  pointer to short }
    kQTSInfo_SoundCompression   = $73736374 (* 'ssct' *);                       {  pointer to OSType }
    kQTSInfo_CompressionList    = $6374796C (* 'ctyl' *);                       {  pointer to OSType Handle }
    kQTSInfo_VideoHue           = $68756520 (* 'hue ' *);                       {  UInt16*  }
    kQTSInfo_VideoSaturation    = $73617472 (* 'satr' *);                       {  UInt16*  }
    kQTSInfo_VideoContrast      = $74727374 (* 'trst' *);                       {  UInt16*  }
    kQTSInfo_VideoBrightness    = $62726974 (* 'brit' *);                       {  UInt16*  }
    kQTSInfo_VideoSharpness     = $73687270 (* 'shrp' *);                       {  UInt16*  }
    kQTSInfo_TimeScale          = $7363616C (* 'scal' *);                       {  UInt32*  }
    kQTSInfo_SGChannelDeviceName = $696E6E6D (* 'innm' *);                      {  Handle*  }
    kQTSInfo_SGChannelDeviceList = $7372646C (* 'srdl' *);                      {  SGDeviceList*  }
    kQTSInfo_SGChannelDeviceInput = $73646969 (* 'sdii' *);                     {  short*  }
    kQTSInfo_SGChannelSettings  = $73657367 (* 'sesg' *);                       {  QTSSGChannelSettingsParams  }
    kQTSInfo_PreviewWhileRecordingMode = $73727072 (* 'srpr' *);                {  Boolean*  }
    kQTSInfo_CompressionParams  = $73636370 (* 'sccp' *);                       {  QTAtomContainer*  }

    {    info selectors for sourcers - get only }
    kQTSInfo_SGChannel          = $73676368 (* 'sgch' *);                       {  SGChannel*  }
    kQTSInfo_SGChannelInputName = $73726E6D (* 'srnm' *);                       {  Handle*  }
    kQTSInfo_FullInputRect      = $66756C72 (* 'fulr' *);                       {  Rect*  }

    {    loop flags     }
    kQTSLoopFlag_Loop           = $00000001;

    kQTSLoopParamsVersion1      = 1;


type
    QTSLoopParamsPtr = ^QTSLoopParams;
    QTSLoopParams = record
        version:                SInt32;
        flags:                  SInt32;
        loopFlags:              SInt32;
        flagsMask:              SInt32;
        numLoops:               SInt32;
    end;


const
    kQTSTrackParamsVersion1     = 1;


type
    QTSTrackParamsPtr = ^QTSTrackParams;
    QTSTrackParams = record
        version:                SInt32;
        flags:                  SInt32;
        track:                  Track;
        trackStartOffset:       TimeValue64;                            {  to start other than at the beginning otherwise set to 0 }
        duration:               TimeValue64;                            {  to limit the duration otherwise set to 0 }
        loopParams:             QTSLoopParamsPtr;                       {  set to NULL if not using; default is no looping  }
    end;


const
    kQTSSourcerTimingParamsVersion1 = 1;


type
    QTSSourcerTimingParamsPtr = ^QTSSourcerTimingParams;
    QTSSourcerTimingParams = record
        version:                SInt32;
        flags:                  SInt32;
        timeScale:              TimeScale;
        presentationStartTime:  TimeValue64;
        presentationEndTime:    TimeValue64;
        presentationCurrentTime: TimeValue64;
        localStartTime:         TimeValue64;
        localEndTime:           TimeValue64;
        localCurrentTime:       TimeValue64;
    end;


const
    kQTSPushDataParamsVersion1  = 1;

    kQTSPushDataFlag_SampleTimeIsValid = $00000001;
    kQTSPushDataFlag_DurationIsValid = $00000002;


type
    QTSPushDataParamsPtr = ^QTSPushDataParams;
    QTSPushDataParams = record
        version:                SInt32;
        flags:                  SInt32;
        sampleDescription:      SampleDescriptionHandle;                {  caller owns the handle  }
        sampleDescSeed:         UInt32;
        sampleTime:             TimeValue64;                            {  also set flag if you set this  }
        duration:               TimeValue64;                            {  also set flag if you set this  }
        dataLength:             UInt32;
        dataPtr:                Ptr;                                    {  this does not have to be a real macintosh Ptr  }
    end;


const
    kQTSSourcerCallbackProcParamsVersion1 = 1;



type
    QTSSourcerCallbackProcParamsPtr = ^QTSSourcerCallbackProcParams;
    QTSSourcerCallbackProcParams = record
        version:                SInt32;
        flags:                  SInt32;
        proc:                   QTSNotificationUPP;
        refCon:                 Ptr;
    end;

    {  track sourcer callback selectors }

const
    kQTSSourcerCallback_Done    = $646F6E65 (* 'done' *);                       {  QTSSourcerDoneParams*  }


    {  push data sourcer callback selectors }
    kQTSPushDataSourcerCallback_HasCharacteristic = $050D;      {  QTSPushDataHasCharacteristicParams*  }
    kQTSPushDataSourcerCallback_SetInfo = $0507;                {  QTSPushDataInfoParams*  }
    kQTSPushDataSourcerCallback_GetInfo = $0508;                {  QTSPushDataInfoParams*  }


type
    QTSPushDataHasCharacteristicParamsPtr = ^QTSPushDataHasCharacteristicParams;
    QTSPushDataHasCharacteristicParams = record
        version:                SInt32;
        flags:                  SInt32;
        characteristic:         OSType;
        returnedHasIt:          boolean;
        reserved1:              SInt8;
        reserved2:              SInt8;
        reserved3:              SInt8;
    end;

    QTSPushDataInfoParamsPtr = ^QTSPushDataInfoParams;
    QTSPushDataInfoParams = record
        version:                SInt32;
        flags:                  SInt32;
        selector:               OSType;
        ioParams:               Ptr;
    end;


const
    kQTSSourcerDoneParamsVersion1 = 1;


type
    QTSSourcerDoneParamsPtr = ^QTSSourcerDoneParams;
    QTSSourcerDoneParams = record
        version:                SInt32;
        flags:                  SInt32;
        sourcer:                ComponentInstance;
    end;

    QTSSGChannelSettingsParamsPtr = ^QTSSGChannelSettingsParams;
    QTSSGChannelSettingsParams = record
        settings:               UserData;
        flags:                  SInt32;
    end;


    {   -----------------------------------------
        Stream Sourcer Selectors
    -----------------------------------------   }

const
    kQTSSourcerInitializeSelect = $0500;
    kQTSSourcerSetEnableSelect  = $0503;
    kQTSSourcerGetEnableSelect  = $0504;
    kQTSSourcerSetInfoSelect    = $0507;
    kQTSSourcerGetInfoSelect    = $0508;
    kQTSSourcerSetTimeScaleSelect = $050E;
    kQTSSourcerGetTimeScaleSelect = $050F;
    kQTSSourcerIdleSelect       = $0516;

    {   -----------------------------------------
        Stream Sourcer Prototypes
    -----------------------------------------   }
    {
     *  QTSSourcerInitialize()
     *
     *  Availability:
     *    Non-Carbon CFM:   in QTStreamLib 5.0.1 and later
     *    CarbonLib:        in CarbonLib 1.6 and later
     *    Mac OS X:         in version 10.1 and later
        }
function QTSSourcerInitialize(inSourcer: QTSSourcer; const (*var*) inInitParams: QTSSourcerInitParams): ComponentResult; external name '_QTSSourcerInitialize';
{
 *  QTSSourcerIdle()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 5.0 and later
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 }
function QTSSourcerIdle(inSourcer: QTSSourcer; const (*var*) inTime: TimeValue64; inFlags: SInt32; var outFlags: SInt32): ComponentResult; external name '_QTSSourcerIdle';
{
 *  QTSSourcerSetEnable()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 5.0 and later
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 }
function QTSSourcerSetEnable(inSourcer: QTSSourcer; inEnableMode: boolean; inFlags: SInt32): ComponentResult; external name '_QTSSourcerSetEnable';
{
 *  QTSSourcerGetEnable()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 5.0 and later
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 }
function QTSSourcerGetEnable(inSourcer: QTSSourcer; var outEnableMode: boolean; inFlags: SInt32): ComponentResult; external name '_QTSSourcerGetEnable';
{
 *  QTSSourcerSetTimeScale()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 5.0 and later
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 }
function QTSSourcerSetTimeScale(inSourcer: QTSSourcer; inTimeScale: TimeScale): ComponentResult; external name '_QTSSourcerSetTimeScale';
{
 *  QTSSourcerGetTimeScale()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 5.0 and later
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 }
function QTSSourcerGetTimeScale(inSourcer: QTSSourcer; var outTimeScale: TimeScale): ComponentResult; external name '_QTSSourcerGetTimeScale';
{
 *  QTSSourcerSetInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 5.0 and later
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 }
function QTSSourcerSetInfo(inSourcer: QTSSourcer; inSelector: OSType; ioParams: UnivPtr): ComponentResult; external name '_QTSSourcerSetInfo';
{
 *  QTSSourcerGetInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 5.0 and later
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 }
function QTSSourcerGetInfo(inSourcer: QTSSourcer; inSelector: OSType; ioParams: UnivPtr): ComponentResult; external name '_QTSSourcerGetInfo';
const
    kQTSInfo_InputDeviceName    = $696E6E6D (* 'innm' *);                       {  Handle*  }
    kQTSInfo_InputSourceName    = $73726E6D (* 'srnm' *);                       {  Handle*  }


    {   ============================================================================
            Stream Handler
    ============================================================================    }

    {
        Server edits are only valid for the current chunk
        }

type
    SHServerEditParametersPtr = ^SHServerEditParameters;
    SHServerEditParameters = record
        version:                UInt32;
        editRate:               Fixed;
        dataStartTime_mediaAxis: TimeValue64;
        dataEndTime_mediaAxis:  TimeValue64;
    end;


const
    kSHNoChunkDispatchFlags     = 0;
    kSHChunkFlagSyncSample      = $04;
    kSHChunkFlagDataLoss        = $10;
    kSHChunkFlagExtended        = $20;


type
    SHChunkRecordPtr = ^SHChunkRecord;
    SHChunkRecord = record
        version:                UInt32;
        reserved1:              SInt32;
        flags:                  SInt32;
        dataSize:               UInt32;
        dataPtr:                Ptr;
        reserved2:              SInt32;
        reserved3:              SInt32;
        presentationTime:       TimeValue64;
        reserved4:              SInt32;
        reserved5:              SInt32;
        serverEditParameters:   SHServerEditParametersPtr;
        reserved6:              SInt32;
        reserved7:              SInt32;
    end;


const
    kSHNumExtendedDataLongs     = 10;

    kSHExtendedChunkFlag_HasSampleCount = $01;
    kSHExtendedChunkFlag_HasFrameLengths = $02;


type
    SHExtendedChunkRecordPtr = ^SHExtendedChunkRecord;
    SHExtendedChunkRecord = record
        chunk:                  SHChunkRecord;
        extendedFlags:          SInt32;
        extendedData:           array [0..9] of SInt32;
    end;


    {   ============================================================================
            RTP Components
    ============================================================================    }
    RTPSSRC                             = UInt32;

const
    kRTPInvalidSSRC             = 0;


    {    RTP standard content encodings for audio   }
    kRTPPayload_PCMU            = 0;                            {  8kHz PCM mu-law mono  }
    kRTPPayload_1016            = 1;                            {  8kHz CELP (Fed Std 1016) mono  }
    kRTPPayload_G721            = 2;                            {  8kHz G.721 ADPCM mono  }
    kRTPPayload_GSM             = 3;                            {  8kHz GSM mono  }
    kRTPPayload_G723            = 4;                            {  8kHz G.723 ADPCM mono  }
    kRTPPayload_DVI_8           = 5;                            {  8kHz Intel DVI ADPCM mono  }
    kRTPPayload_DVI_16          = 6;                            {  16kHz Intel DVI ADPCM mono  }
    kRTPPayload_LPC             = 7;                            {  8kHz LPC  }
    kRTPPayload_PCMA            = 8;                            {  8kHz PCM a-law mono  }
    kRTPPayload_L16_44_2        = 10;                           {  44.1kHz 16-bit linear stereo  }
    kRTPPayload_L16_44_1        = 11;                           {  44.1kHz 16-bit linear mono  }
    kRTPPayload_PureVoice       = 12;                           {  8kHz PureVoice mono (QCELP)  }
    kRTPPayload_MPEGAUDIO       = 14;                           {  MPEG I and II audio  }
    kRTPPayload_DVI_11          = 16;                           {  11kHz Intel DVI ADPCM mono  }
    kRTPPayload_DVI_22          = 17;                           {  22kHz Intel DVI ADPCM mono  }

    {    RTP standard content encodings for video   }
    kRTPPayload_CELLB           = 25;                           {  Sun CellB  }
    kRTPPayload_JPEG            = 26;                           {  JPEG  }
    kRTPPayload_CUSEEME         = 27;                           {  Cornell CU-SeeMe  }
    kRTPPayload_NV              = 28;                           {  Xerox PARC nv  }
    kRTPPayload_PICWIN          = 29;                           {  BBN Picture Window  }
    kRTPPayload_CPV             = 30;                           {  Bolter CPV  }
    kRTPPayload_H261            = 31;                           {  CCITT H.261  }
    kRTPPayload_MPEGVIDEO       = 32;                           {  MPEG I and II video  }
    kRTPPayload_H263            = 34;                           {  CCITT H.263  }

    {    Other RTP standard content encodings   }
    kRTPPayload_MPEG2T          = 33;                           {  MPEG 2 Transport  }

    {    Dynamic encodings  }
    kRTPPayload_FirstDynamic    = 96;
    kRTPPayload_LastDynamic     = 127;
    kRTPPayload_Unknown         = $FF;



    {
    -----------------------------------------
        RTP Info selectors
    -----------------------------------------
        }
    {    ----- these are get and set -----  }
    kRTPInfo_SSRC               = $73737263 (* 'ssrc' *);                       {  UInt32*  }
    kRTPInfo_NextSeqNum         = $726E736E (* 'rnsn' *);                       {  UInt16*  }

    {   -----------------------------------------
        RTP Statistics
    -----------------------------------------   }
    kRTPTotalReceivedPktsStat   = $74726370 (* 'trcp' *);
    kRTPTotalLostPktsStat       = $746C7370 (* 'tlsp' *);
    kRTPTotalProcessedPktsStat  = $74707270 (* 'tprp' *);
    kRTPTotalDroppedPktsStat    = $74647270 (* 'tdrp' *);
    kRTPBadHeaderDroppedPktsStat = $62686470 (* 'bhdp' *);
    kRTPOurHeaderDroppedPktsStat = $6F686470 (* 'ohdp' *);
    kRTPNotReceivingSenderDroppedPktsStat = $6E736470 (* 'nsdp' *);
    kRTPNotProcessingDroppedPktsStat = $6E706470 (* 'npdp' *);
    kRTPBadSeqDroppedPktsStat   = $62736470 (* 'bsdp' *);
    kRTPArriveTooLatePktsStat   = $6172746C (* 'artl' *);
    kRTPWaitForSeqDroppedPktsStat = $77736470 (* 'wsdp' *);
    kRTPBadStateDroppedPktsStat = $73746470 (* 'stdp' *);
    kRTPBadPayloadDroppedPktsStat = $62706470 (* 'bpdp' *);
    kRTPNoTimeScaleDroppedPktsStat = $6E746470 (* 'ntdp' *);
    kRTPDupSeqNumDroppedPktsStat = $64736470 (* 'dsdp' *);
    kRTPLostPktsPercentStat     = $6C737070 (* 'lspp' *);
    kRTPDroppedPktsPercentStat  = $64707070 (* 'dppp' *);
    kRTPTotalUnprocessedPktsPercentStat = $74757070 (* 'tupp' *);
    kRTPRTCPDataRateStat        = $72726364 (* 'rrcd' *);
    kRTPPayloadIDStat           = $72706964 (* 'rpid' *);
    kRTPPayloadNameStat         = $72706E6D (* 'rpnm' *);
    kRTPNumPktsInQueueStat      = $726E7071 (* 'rnpq' *);
    kRTPTotalPktsInQueueStat    = $72747071 (* 'rtpq' *);
    kRTPTotalOutOfOrderPktsStat = $72746F6F (* 'rtoo' *);
    kRTPRetransmissionStat      = $72727478 (* 'rrtx' *);


    {   -----------------------------------------
        Payload Info
    -----------------------------------------   }
    kRTPPayloadSpeedTag         = $73706564 (* 'sped' *);                       {  0-255, 255 is fastest }
    kRTPPayloadLossRecoveryTag  = $6C6F7373 (* 'loss' *);                       {  0-255, 0 can't handle any loss, 128 can handle 50% packet loss }
    kRTPPayloadConformanceTag   = $636F6E66 (* 'conf' *);                       {  more than one of these can be present }


type
    RTPPayloadCharacteristicPtr = ^RTPPayloadCharacteristic;
    RTPPayloadCharacteristic = record
        tag:                    OSType;
        value:                  SInt32;
    end;

    {
        pass RTPPayloadSortRequest to QTSFindMediaPacketizer or QTSFindMediaPacketizerForTrack.
        define the characteristics to sort by. tag is key to sort on. value is positive for ascending
        sort (low value first), negative for descending sort (high value first).
        }
    RTPPayloadSortRequestPtr = ^RTPPayloadSortRequest;
    RTPPayloadSortRequest = record
        characteristicCount:    SInt32;
        characteristic:         array [0..0] of RTPPayloadCharacteristic; {  tag is key to sort on, value is + for ascending, - for descending }
    end;

    {    flags for RTPPayloadInfo   }

const
    kRTPPayloadTypeStaticFlag   = $00000001;
    kRTPPayloadTypeDynamicFlag  = $00000002;


type
    RTPPayloadInfoPtr = ^RTPPayloadInfo;
    RTPPayloadInfo = record
        payloadFlags:           SInt32;
        payloadID:              SInt8;
        reserved1:              SInt8;
        reserved2:              SInt8;
        reserved3:              SInt8;
        payloadName:            SInt8;
    end;

    RTPPayloadInfoHandle                = ^RTPPayloadInfoPtr;
    {   ============================================================================
            RTP Reassembler
    ============================================================================    }
    RTPReassembler                      = ComponentInstance;

const
    kRTPReassemblerType         = $72747072 (* 'rtpr' *);

    kRTPBaseReassemblerType     = $676E7263 (* 'gnrc' *);
    kRTP261ReassemblerType      = $68323631 (* 'h261' *);
    kRTP263ReassemblerType      = $68323633 (* 'h263' *);
    kRTP263PlusReassemblerType  = $3236332B (* '263+' *);
    kRTPAudioReassemblerType    = $736F756E (* 'soun' *);
    kRTPQTReassemblerType       = $7174696D (* 'qtim' *);
    kRTPPureVoiceReassemblerType = $51636C70 (* 'Qclp' *);
    kRTPJPEGReassemblerType     = $6A706567 (* 'jpeg' *);
    kRTPQDesign2ReassemblerType = $51444D32 (* 'QDM2' *);
    kRTPSorensonReassemblerType = $53565131 (* 'SVQ1' *);
    kRTPMP3ReassemblerType      = $6D703320 (* 'mp3 ' *);
    kRTPMPEG4AudioReassemblerType = $6D703461 (* 'mp4a' *);
    kRTPMPEG4VideoReassemblerType = $6D703476 (* 'mp4v' *);


type
    RTPRssmInitParamsPtr = ^RTPRssmInitParams;
    RTPRssmInitParams = record
        ssrc:                   RTPSSRC;
        payloadType:            SInt8;
        reserved1:              SInt8;
        reserved2:              SInt8;
        reserved3:              SInt8;
        timeBase:               TimeBase;
        timeScale:              TimeScale;
    end;

    RTPDescParamsPtr = ^RTPDescParams;
    RTPDescParams = record
        container:              QTAtomContainer;
        presentationParentAtom: QTAtom;
        streamParentAtom:       QTAtom;
    end;

    RTPRssmMoreInitParamsPtr = ^RTPRssmMoreInitParams;
    RTPRssmMoreInitParams = record
        initParams:             RTPRssmInitParams;
        version:                SInt32;
        desc:                   RTPDescParams;
    end;


const
    kRTPRssmMoreInitParamsVersion1 = 1;


    {  get/set info selectors }
    kRTPRssmInfo_MoreInitParams = $72726D69 (* 'rrmi' *);



type
    RTPRssmPacketPtr = ^RTPRssmPacket;
    RTPRssmPacket = record
        next:                   RTPRssmPacketPtr;
        prev:                   RTPRssmPacketPtr;
        streamBuffer:           QTSStreamBufferPtr;
        paramsFilledIn:         boolean;
        reserved:               SInt8;
        sequenceNum:            UInt16;
        transportHeaderLength:  UInt32;                                 {  filled in by base }
        payloadHeaderLength:    UInt32;                                 {  derived adjusts this  }
        dataLength:             UInt32;
        serverEditParams:       SHServerEditParameters;
        timeStamp:              TimeValue64;                            {  lower 32 bits is original rtp timestamp }
        chunkFlags:             SInt32;                                 {  these are or'd together }
        flags:                  SInt32;
    end;

    {  flags for RTPRssmPacket struct }

const
    kRTPRssmPacketHasMarkerBitSet = $00000001;
    kRTPRssmPacketHasServerEditFlag = $00010000;

    {  flags for RTPRssmSendStreamBufferRange }
    kRTPRssmCanRefStreamBuffer  = $00000001;

    {  flags for RTPRssmSendPacketList }
    kRTPRssmLostSomePackets     = $00000001;

    {  flags for RTPRssmSetFlags }
    kRTPRssmEveryPacketAChunkFlag = $00000001;
    kRTPRssmQueueAndUseMarkerBitFlag = $00000002;
    kRTPRssmTrackLostPacketsFlag = $00010000;
    kRTPRssmNoReorderingRequiredFlag = $00020000;



type
    RTPSendStreamBufferRangeParamsPtr = ^RTPSendStreamBufferRangeParams;
    RTPSendStreamBufferRangeParams = record
        streamBuffer:           QTSStreamBufferPtr;
        presentationTime:       TimeValue64;
        chunkStartPosition:     UInt32;
        numDataBytes:           UInt32;
        chunkFlags:             SInt32;
        flags:                  SInt32;
        serverEditParams:       SHServerEditParametersPtr;              {  NULL if no edit }
    end;

    {  characteristics }

const
    kRTPCharacteristic_RequiresOrderedPackets = $72726F70 (* 'rrop' *);
    kRTPCharacteristic_TimeStampsNotMonoIncreasing = $74736D69 (* 'tsmi' *);


    kRTPReassemblerInfoResType  = $72736D69 (* 'rsmi' *);


type
    RTPReassemblerInfoPtr = ^RTPReassemblerInfo;
    RTPReassemblerInfo = record
        characteristicCount:    SInt32;
        characteristic:         array [0..0] of RTPPayloadCharacteristic;
                                                                        {  after the last characteristic, the payload name (defined by the MediaPacketizerPayloadInfo }
                                                                        {  structure) is present.  }
    end;

    RTPReassemblerInfoHandle            = ^RTPReassemblerInfoPtr;
    {    RTPReassemblerInfoElement structs are padded to 32 bits    }

const
    kRTPReassemblerInfoPadUpToBytes = 4;


    {
     *  QTSFindReassemblerForPayloadID()
     *
     *  Availability:
     *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
     *    CarbonLib:        in CarbonLib 1.1 and later
     *    Mac OS X:         in version 10.0 and later
     *    Windows:          in QTSClient.lib 4.0 and later
        }
function QTSFindReassemblerForPayloadID(inPayloadID: ByteParameter; var inSortInfo: RTPPayloadSortRequest; var outReassemblerList: QTAtomContainer): OSErr; external name '_QTSFindReassemblerForPayloadID';

{
 *  QTSFindReassemblerForPayloadName()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function QTSFindReassemblerForPayloadName(inPayloadName: ConstCStringPtr; var inSortInfo: RTPPayloadSortRequest; var outReassemblerList: QTAtomContainer): OSErr; external name '_QTSFindReassemblerForPayloadName';

{-----------------------------------------
    RTP Reassembler Selectors
-----------------------------------------}

const
    kRTPRssmSetCapabilitiesSelect = $0100;
    kRTPRssmGetCapabilitiesSelect = $0101;
    kRTPRssmSetPayloadHeaderLengthSelect = $0102;
    kRTPRssmGetPayloadHeaderLengthSelect = $0103;
    kRTPRssmSetTimeScaleSelect  = $0104;
    kRTPRssmGetTimeScaleSelect  = $0105;
    kRTPRssmNewStreamHandlerSelect = $0106;
    kRTPRssmSetStreamHandlerSelect = $0107;
    kRTPRssmGetStreamHandlerSelect = $0108;
    kRTPRssmSendStreamHandlerChangedSelect = $0109;
    kRTPRssmSetSampleDescriptionSelect = $010A;
    kRTPRssmGetChunkAndIncrRefCountSelect = $010D;
    kRTPRssmSendChunkAndDecrRefCountSelect = $010E;
    kRTPRssmSendLostChunkSelect = $010F;
    kRTPRssmSendStreamBufferRangeSelect = $0110;
    kRTPRssmClearCachedPackets  = $0111;
    kRTPRssmFillPacketListParamsSelect = $0113;
    kRTPRssmReleasePacketListSelect = $0114;
    kRTPRssmIncrChunkRefCountSelect = $0115;
    kRTPRssmDecrChunkRefCountSelect = $0116;
    kRTPRssmGetExtChunkAndIncrRefCountSelect = $0117;
    kRTPRssmInitializeSelect    = $0500;
    kRTPRssmHandleNewPacketSelect = $0501;
    kRTPRssmComputeChunkSizeSelect = $0502;
    kRTPRssmAdjustPacketParamsSelect = $0503;
    kRTPRssmCopyDataToChunkSelect = $0504;
    kRTPRssmSendPacketListSelect = $0505;
    kRTPRssmGetTimeScaleFromPacketSelect = $0506;
    kRTPRssmSetInfoSelect       = $0509;
    kRTPRssmGetInfoSelect       = $050A;
    kRTPRssmHasCharacteristicSelect = $050B;
    kRTPRssmResetSelect         = $050C;

    {   -----------------------------------------
        RTP Reassembler functions - base to derived
    -----------------------------------------   }

    {
     *  RTPRssmInitialize()
     *
     *  Availability:
     *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
     *    CarbonLib:        in CarbonLib 1.1 and later
     *    Mac OS X:         in version 10.0 and later
     *    Windows:          in QTSClient.lib 4.0 and later
        }
function RTPRssmInitialize(rtpr: RTPReassembler; var inInitParams: RTPRssmInitParams): ComponentResult; external name '_RTPRssmInitialize';
{
 *  RTPRssmHandleNewPacket()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function RTPRssmHandleNewPacket(rtpr: RTPReassembler; var inStreamBuffer: QTSStreamBuffer; inNumWraparounds: SInt32): ComponentResult; external name '_RTPRssmHandleNewPacket';
{
 *  RTPRssmComputeChunkSize()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function RTPRssmComputeChunkSize(rtpr: RTPReassembler; var inPacketListHead: RTPRssmPacket; inFlags: SInt32; var outChunkDataSize: UInt32): ComponentResult; external name '_RTPRssmComputeChunkSize';
{
 *  RTPRssmAdjustPacketParams()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function RTPRssmAdjustPacketParams(rtpr: RTPReassembler; var inPacket: RTPRssmPacket; inFlags: SInt32): ComponentResult; external name '_RTPRssmAdjustPacketParams';
{
 *  RTPRssmCopyDataToChunk()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function RTPRssmCopyDataToChunk(rtpr: RTPReassembler; var inPacketListHead: RTPRssmPacket; inMaxChunkDataSize: UInt32; var inChunk: SHChunkRecord; inFlags: SInt32): ComponentResult; external name '_RTPRssmCopyDataToChunk';
{
 *  RTPRssmSendPacketList()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function RTPRssmSendPacketList(rtpr: RTPReassembler; var inPacketListHead: RTPRssmPacket; const (*var*) inLastChunkPresentationTime: TimeValue64; inFlags: SInt32): ComponentResult; external name '_RTPRssmSendPacketList';
{
 *  RTPRssmGetTimeScaleFromPacket()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function RTPRssmGetTimeScaleFromPacket(rtpr: RTPReassembler; var inStreamBuffer: QTSStreamBuffer; var outTimeScale: TimeScale): ComponentResult; external name '_RTPRssmGetTimeScaleFromPacket';
{
 *  RTPRssmSetInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function RTPRssmSetInfo(rtpr: RTPReassembler; inSelector: OSType; ioParams: UnivPtr): ComponentResult; external name '_RTPRssmSetInfo';
{
 *  RTPRssmGetInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function RTPRssmGetInfo(rtpr: RTPReassembler; inSelector: OSType; ioParams: UnivPtr): ComponentResult; external name '_RTPRssmGetInfo';
{
 *  RTPRssmHasCharacteristic()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function RTPRssmHasCharacteristic(rtpr: RTPReassembler; inCharacteristic: OSType; var outHasIt: boolean): ComponentResult; external name '_RTPRssmHasCharacteristic';
{
 *  RTPRssmReset()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function RTPRssmReset(rtpr: RTPReassembler; inFlags: SInt32): ComponentResult; external name '_RTPRssmReset';
{-----------------------------------------
    RTP Reassembler functions - derived to base
-----------------------------------------}
{  ----- setup }
{
 *  RTPRssmSetCapabilities()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function RTPRssmSetCapabilities(rtpr: RTPReassembler; inFlags: SInt32; inFlagsMask: SInt32): ComponentResult; external name '_RTPRssmSetCapabilities';
{
 *  RTPRssmGetCapabilities()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function RTPRssmGetCapabilities(rtpr: RTPReassembler; var outFlags: SInt32): ComponentResult; external name '_RTPRssmGetCapabilities';
{
 *  RTPRssmSetPayloadHeaderLength()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function RTPRssmSetPayloadHeaderLength(rtpr: RTPReassembler; inPayloadHeaderLength: UInt32): ComponentResult; external name '_RTPRssmSetPayloadHeaderLength';
{
 *  RTPRssmGetPayloadHeaderLength()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function RTPRssmGetPayloadHeaderLength(rtpr: RTPReassembler; var outPayloadHeaderLength: UInt32): ComponentResult; external name '_RTPRssmGetPayloadHeaderLength';
{
 *  RTPRssmSetTimeScale()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function RTPRssmSetTimeScale(rtpr: RTPReassembler; inSHTimeScale: TimeScale): ComponentResult; external name '_RTPRssmSetTimeScale';
{
 *  RTPRssmGetTimeScale()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function RTPRssmGetTimeScale(rtpr: RTPReassembler; var outSHTimeScale: TimeScale): ComponentResult; external name '_RTPRssmGetTimeScale';
{
 *  RTPRssmNewStreamHandler()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function RTPRssmNewStreamHandler(rtpr: RTPReassembler; inSHType: OSType; inSampleDescription: SampleDescriptionHandle; inSHTimeScale: TimeScale; var outHandler: ComponentInstance): ComponentResult; external name '_RTPRssmNewStreamHandler';
{
 *  RTPRssmSetStreamHandler()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function RTPRssmSetStreamHandler(rtpr: RTPReassembler; inStreamHandler: ComponentInstance): ComponentResult; external name '_RTPRssmSetStreamHandler';
{
 *  RTPRssmGetStreamHandler()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function RTPRssmGetStreamHandler(rtpr: RTPReassembler; var outStreamHandler: ComponentInstance): ComponentResult; external name '_RTPRssmGetStreamHandler';
{
 *  RTPRssmSendStreamHandlerChanged()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function RTPRssmSendStreamHandlerChanged(rtpr: RTPReassembler): ComponentResult; external name '_RTPRssmSendStreamHandlerChanged';
{
 *  RTPRssmSetSampleDescription()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function RTPRssmSetSampleDescription(rtpr: RTPReassembler; inSampleDescription: SampleDescriptionHandle): ComponentResult; external name '_RTPRssmSetSampleDescription';
{  ----- manually sending chunks }
{
 *  RTPRssmGetChunkAndIncrRefCount()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function RTPRssmGetChunkAndIncrRefCount(rtpr: RTPReassembler; inChunkDataSize: UInt32; const (*var*) inChunkPresentationTime: TimeValue64; var outChunk: UnivPtr): ComponentResult; external name '_RTPRssmGetChunkAndIncrRefCount';
{
 *  RTPRssmGetExtChunkAndIncrRefCount()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 6.0 and later
 *    CarbonLib:        in CarbonLib 1.6 and later
 *    Mac OS X:         in version 10.2 and later
 *    Windows:          in qtmlClient.lib 6.0 and later
 }
function RTPRssmGetExtChunkAndIncrRefCount(rtpr: RTPReassembler; inChunkDataSize: UInt32; const (*var*) inChunkPresentationTime: TimeValue64; inFlags: SInt32; var outChunk: UnivPtr): ComponentResult; external name '_RTPRssmGetExtChunkAndIncrRefCount';
{
 *  RTPRssmSendChunkAndDecrRefCount()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function RTPRssmSendChunkAndDecrRefCount(rtpr: RTPReassembler; var inChunk: SHChunkRecord; const (*var*) inServerEdit: SHServerEditParameters): ComponentResult; external name '_RTPRssmSendChunkAndDecrRefCount';
{
 *  RTPRssmSendLostChunk()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function RTPRssmSendLostChunk(rtpr: RTPReassembler; const (*var*) inChunkPresentationTime: TimeValue64): ComponentResult; external name '_RTPRssmSendLostChunk';
{
 *  RTPRssmSendStreamBufferRange()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function RTPRssmSendStreamBufferRange(rtpr: RTPReassembler; var inParams: RTPSendStreamBufferRangeParams): ComponentResult; external name '_RTPRssmSendStreamBufferRange';
{
 *  RTPRssmClearCachedPackets()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function RTPRssmClearCachedPackets(rtpr: RTPReassembler; inFlags: SInt32): ComponentResult; external name '_RTPRssmClearCachedPackets';
{
 *  RTPRssmFillPacketListParams()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function RTPRssmFillPacketListParams(rtpr: RTPReassembler; var inPacketListHead: RTPRssmPacket; inNumWraparounds: SInt32; inFlags: SInt32): ComponentResult; external name '_RTPRssmFillPacketListParams';
{
 *  RTPRssmReleasePacketList()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function RTPRssmReleasePacketList(rtpr: RTPReassembler; var inPacketListHead: RTPRssmPacket): ComponentResult; external name '_RTPRssmReleasePacketList';
{
 *  RTPRssmIncrChunkRefCount()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function RTPRssmIncrChunkRefCount(rtpr: RTPReassembler; var inChunk: SHChunkRecord): ComponentResult; external name '_RTPRssmIncrChunkRefCount';
{
 *  RTPRssmDecrChunkRefCount()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function RTPRssmDecrChunkRefCount(rtpr: RTPReassembler; var inChunk: SHChunkRecord): ComponentResult; external name '_RTPRssmDecrChunkRefCount';
{============================================================================
        RTP Media Packetizer
============================================================================}

const
    kRTPMediaPacketizerType     = $7274706D (* 'rtpm' *);


type
    RTPMediaPacketizer                  = ComponentInstance;

const
    kRTPBaseMediaPacketizerType = $676E7263 (* 'gnrc' *);
    kRTP261MediaPacketizerType  = $68323631 (* 'h261' *);
    kRTP263PlusMediaPacketizerType = $3236332B (* '263+' *);
    kRTPAudioMediaPacketizerType = $736F756E (* 'soun' *);
    kRTPQTMediaPacketizerType   = $7174696D (* 'qtim' *);
    kRTPPureVoiceMediaPacketizerType = $51636C70 (* 'Qclp' *);
    kRTPJPEGMediaPacketizerType = $6A706567 (* 'jpeg' *);
    kRTPQDesign2MediaPacketizerType = $51444D32 (* 'QDM2' *);
    kRTPSorensonMediaPacketizerType = $53565131 (* 'SVQ1' *);
    kRTPMP3MediaPacketizerType  = $6D703320 (* 'mp3 ' *);
    kRTPMPEG4AudioMediaPacketizerType = $6D703461 (* 'mp4a' *);
    kRTPMPEG4VideoMediaPacketizerType = $6D703476 (* 'mp4v' *);


type
    RTPMPSampleRef                      = UInt32;
    RTPMPDataReleaseProcPtr = procedure(var inData: UInt8; inRefCon: UnivPtr);

    RTPMPDataReleaseUPP = ^SInt32; { an opaque UPP }

const
    kMediaPacketizerCanPackEditRate = $01;
    kMediaPacketizerCanPackLayer = $02;
    kMediaPacketizerCanPackVolume = $04;
    kMediaPacketizerCanPackBalance = $08;
    kMediaPacketizerCanPackGraphicsMode = $10;
    kMediaPacketizerCanPackEmptyEdit = $20;



type
    MediaPacketizerRequirementsPtr = ^MediaPacketizerRequirements;
    MediaPacketizerRequirements = record
        mediaType:              OSType;                                 {  media type supported (0 for all) }
        dataFormat:             OSType;                                 {  data format (e.g., compression) supported (0 for all) }
        capabilityFlags:        UInt32;                                 {  ability to handle non-standard track characteristics }
        canPackMatrixType:      SInt8;                                  {  can pack any matrix type up to this (identityMatrixType for identity only) }
        reserved1:              SInt8;
        reserved2:              SInt8;
        reserved3:              SInt8;
    end;

    MediaPacketizerInfoPtr = ^MediaPacketizerInfo;
    MediaPacketizerInfo = record
        mediaType:              OSType;                                 {  media type supported (0 for all) }
        dataFormat:             OSType;                                 {  data format (e.g., compression) supported (0 for all) }
        vendor:                 OSType;                                 {  manufacturer of this packetizer (e.g., 'appl' for Apple) }
        capabilityFlags:        UInt32;                                 {  ability to handle non-standard track characteristics }
        canPackMatrixType:      SInt8;                                  {  can pack any matrix type up to this (identityMatrixType for identity only) }
        reserved1:              SInt8;
        reserved2:              SInt8;
        reserved3:              SInt8;
        characteristicCount:    SInt32;
        characteristic:         array [0..0] of RTPPayloadCharacteristic;
                                                                        {  after the last characteristic, the payload name (defined by the RTPPayloadInfo }
                                                                        {  structure) is present.  }
    end;

    MediaPacketizerInfoHandle           = ^MediaPacketizerInfoPtr;
    {    MediaPacketizerInfo structs are padded to 32 bits  }

const
    kMediaPacketizerInfoPadUpToBytes = 4;

    {
     *  QTSFindMediaPacketizer()
     *
     *  Availability:
     *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
     *    CarbonLib:        in CarbonLib 1.1 and later
     *    Mac OS X:         in version 10.0 and later
     *    Windows:          in QTSClient.lib 4.0 and later
        }
function QTSFindMediaPacketizer(inPacketizerinfo: MediaPacketizerRequirementsPtr; inSampleDescription: SampleDescriptionHandle; inSortInfo: RTPPayloadSortRequestPtr; var outPacketizerList: QTAtomContainer): OSErr; external name '_QTSFindMediaPacketizer';

{
 *  QTSFindMediaPacketizerForTrack()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function QTSFindMediaPacketizerForTrack(inTrack: Track; inSampleDescriptionIndex: SInt32; inSortInfo: RTPPayloadSortRequestPtr; var outPacketizerList: QTAtomContainer): OSErr; external name '_QTSFindMediaPacketizerForTrack';

{
 *  QTSFindMediaPacketizerForPayloadID()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function QTSFindMediaPacketizerForPayloadID(payloadID: SInt32; inSortInfo: RTPPayloadSortRequestPtr; var outPacketizerList: QTAtomContainer): OSErr; external name '_QTSFindMediaPacketizerForPayloadID';

{
 *  QTSFindMediaPacketizerForPayloadName()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function QTSFindMediaPacketizerForPayloadName(payloadName: ConstCStringPtr; inSortInfo: RTPPayloadSortRequestPtr; var outPacketizerList: QTAtomContainer): OSErr; external name '_QTSFindMediaPacketizerForPayloadName';

{  flags for RTPMPInitialize }

const
    kRTPMPRealtimeModeFlag      = $00000001;

    {  flags for RTPMPSampleDataParams }
    kRTPMPSyncSampleFlag        = $00000001;
    kRTPMPRespectDurationFlag   = $00000002;


type
    RTPMPSampleDataParamsPtr = ^RTPMPSampleDataParams;
    RTPMPSampleDataParams = record
        version:                UInt32;
        timeStamp:              UInt32;
        duration:               UInt32;                                 {  0 = unknown duration }
        playOffset:             UInt32;
        playRate:               Fixed;
        flags:                  SInt32;
        sampleDescSeed:         UInt32;
        sampleDescription:      Handle;
        sampleRef:              RTPMPSampleRef;
        dataLength:             UInt32;
        data:                   Ptr;
        releaseProc:            RTPMPDataReleaseUPP;
        refCon:                 Ptr;
    end;

    {  out flags for idle, RTPMPSetSampleData, and RTPMPFlush }

const
    kRTPMPStillProcessingData   = $00000001;                    {  not done with data you've got }


type
    RTPMPPayloadTypeParamsPtr = ^RTPMPPayloadTypeParams;
    RTPMPPayloadTypeParams = record
        flags:                  UInt32;
        payloadNumber:          UInt32;
        nameLength:             SInt16;                             {  in: size of payloadName buffer (counting null terminator) -- this will be reset to needed length and paramErr returned if too small  }
        payloadName:            CStringPtr;                             {  caller must provide buffer  }
    end;

    {   -----------------------------------------
        RTP Media Packetizer Info selectors
    -----------------------------------------   }
    {    info selectors - get only  }

const
    kRTPMPPayloadTypeInfo       = $72747070 (* 'rtpp' *);                       {  RTPMPPayloadTypeParams*  }
    kRTPMPRTPTimeScaleInfo      = $72747074 (* 'rtpt' *);                       {  TimeScale*  }
    kRTPMPRequiredSampleDescriptionInfo = $73647363 (* 'sdsc' *);               {  SampleDescriptionHandle*  }
    kRTPMPMinPayloadSize        = $6D696E73 (* 'mins' *);                       {  UInt32* in bytes, does not include rtp header; default is 0  }
    kRTPMPMinPacketDuration     = $6D696E64 (* 'mind' *);                       {  UInt3* in milliseconds; default is no min required  }
    kRTPMPSuggestedRepeatPktCountInfo = $73727063 (* 'srpc' *);                 {  UInt32*  }
    kRTPMPSuggestedRepeatPktSpacingInfo = $73727073 (* 'srps' *);               {  UInt32* in milliseconds  }
    kRTPMPMaxPartialSampleSizeInfo = $6D707373 (* 'mpss' *);                    {  UInt32* in bytes  }
    kRTPMPPreferredBufferDelayInfo = $70726264 (* 'prbd' *);                    {  UInt32* in milliseconds  }
    kRTPMPPayloadNameInfo       = $6E616D65 (* 'name' *);                       {  StringPtr  }
    kRTPInfo_FormatString       = $666D7470 (* 'fmtp' *);                       {  char **, caller allocates ptr, callee disposes  }

    {   -----------------------------------------
        RTP Media Packetizer Characteristics
    -----------------------------------------   }
    {    also supports relevant ones in Movies.h and QTSToolbox.h   }
    kRTPMPNoSampleDataRequiredCharacteristic = $6E736472 (* 'nsdr' *);
    kRTPMPHasUserSettingsDialogCharacteristic = $73646C67 (* 'sdlg' *);
    kRTPMPPrefersReliableTransportCharacteristic = $72656C79 (* 'rely' *);
    kRTPMPRequiresOutOfBandDimensionsCharacteristic = $726F6264 (* 'robd' *);
    kRTPMPReadsPartialSamplesCharacteristic = $72707370 (* 'rpsp' *);

    {   -----------------------------------------
        RTP Media Packetizer selectors
    -----------------------------------------   }
    kRTPMPInitializeSelect      = $0500;
    kRTPMPPreflightMediaSelect  = $0501;
    kRTPMPIdleSelect            = $0502;
    kRTPMPSetSampleDataSelect   = $0503;
    kRTPMPFlushSelect           = $0504;
    kRTPMPResetSelect           = $0505;
    kRTPMPSetInfoSelect         = $0506;
    kRTPMPGetInfoSelect         = $0507;
    kRTPMPSetTimeScaleSelect    = $0508;
    kRTPMPGetTimeScaleSelect    = $0509;
    kRTPMPSetTimeBaseSelect     = $050A;
    kRTPMPGetTimeBaseSelect     = $050B;
    kRTPMPHasCharacteristicSelect = $050C;
    kRTPMPSetPacketBuilderSelect = $050E;
    kRTPMPGetPacketBuilderSelect = $050F;
    kRTPMPSetMediaTypeSelect    = $0510;
    kRTPMPGetMediaTypeSelect    = $0511;
    kRTPMPSetMaxPacketSizeSelect = $0512;
    kRTPMPGetMaxPacketSizeSelect = $0513;
    kRTPMPSetMaxPacketDurationSelect = $0514;
    kRTPMPGetMaxPacketDurationSelect = $0515;                   {  for export component and apps who want to }
                                                                {  access dialogs for Media-specific settings }
                                                                {  (such as Pure Voice interleave factor) }
    kRTPMPDoUserDialogSelect    = $0516;
    kRTPMPSetSettingsFromAtomContainerAtAtomSelect = $0517;
    kRTPMPGetSettingsIntoAtomContainerAtAtomSelect = $0518;
    kRTPMPGetSettingsAsTextSelect = $0519;
    kRTPMPGetSettingsSelect     = $051A;
    kRTPMPSetSettingsSelect     = $051B;

    {   -----------------------------------------
        RTP Media Packetizer functions
    -----------------------------------------   }

    {
     *  RTPMPInitialize()
     *
     *  Availability:
     *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
     *    CarbonLib:        in CarbonLib 1.1 and later
     *    Mac OS X:         in version 10.0 and later
     *    Windows:          in QTSClient.lib 4.0 and later
        }
function RTPMPInitialize(rtpm: RTPMediaPacketizer; inFlags: SInt32): ComponentResult; external name '_RTPMPInitialize';
{ return noErr if you can handle this media }
{
 *  RTPMPPreflightMedia()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function RTPMPPreflightMedia(rtpm: RTPMediaPacketizer; inMediaType: OSType; inSampleDescription: SampleDescriptionHandle): ComponentResult; external name '_RTPMPPreflightMedia';
{
   do work here if you need to - give up time periodically
   if you're doing time consuming operations
}
{
 *  RTPMPIdle()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function RTPMPIdle(rtpm: RTPMediaPacketizer; inFlags: SInt32; var outFlags: SInt32): ComponentResult; external name '_RTPMPIdle';
{
   caller owns the RTPMPSampleDataParams struct
   media Packetizer must copy any fields of the struct it wants to keep
   media Packetizer must call release proc when done with the data
   you can do the processing work here if it does not take up too
   much cpu time - otherwise do it in idle
}
{
 *  RTPMPSetSampleData()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function RTPMPSetSampleData(rtpm: RTPMediaPacketizer; const (*var*) inSampleData: RTPMPSampleDataParams; var outFlags: SInt32): ComponentResult; external name '_RTPMPSetSampleData';
{
   send everything you have buffered - you will get idles while
   you set the kRTPMPStillProcessingData flag here and in idle
}
{
 *  RTPMPFlush()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function RTPMPFlush(rtpm: RTPMediaPacketizer; inFlags: SInt32; var outFlags: SInt32): ComponentResult; external name '_RTPMPFlush';
{
   dispose of anything buffered and get rid of state
   do not send the buffered data (because presumably
   there is no connection for you to send on)
   state should be the same as if you were just initialized
}
{
 *  RTPMPReset()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function RTPMPReset(rtpm: RTPMediaPacketizer; inFlags: SInt32): ComponentResult; external name '_RTPMPReset';
{-----------------------------------------
    RTP Media Packetizer get / set functions
-----------------------------------------}
{
 *  RTPMPSetInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function RTPMPSetInfo(rtpm: RTPMediaPacketizer; inSelector: OSType; ioParams: UnivPtr): ComponentResult; external name '_RTPMPSetInfo';
{
 *  RTPMPGetInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function RTPMPGetInfo(rtpm: RTPMediaPacketizer; inSelector: OSType; ioParams: UnivPtr): ComponentResult; external name '_RTPMPGetInfo';
{
 *  RTPMPSetTimeScale()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function RTPMPSetTimeScale(rtpm: RTPMediaPacketizer; inTimeScale: TimeScale): ComponentResult; external name '_RTPMPSetTimeScale';
{
 *  RTPMPGetTimeScale()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function RTPMPGetTimeScale(rtpm: RTPMediaPacketizer; var outTimeScale: TimeScale): ComponentResult; external name '_RTPMPGetTimeScale';
{
 *  RTPMPSetTimeBase()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function RTPMPSetTimeBase(rtpm: RTPMediaPacketizer; inTimeBase: TimeBase): ComponentResult; external name '_RTPMPSetTimeBase';
{
 *  RTPMPGetTimeBase()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function RTPMPGetTimeBase(rtpm: RTPMediaPacketizer; var outTimeBase: TimeBase): ComponentResult; external name '_RTPMPGetTimeBase';
{
 *  RTPMPHasCharacteristic()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function RTPMPHasCharacteristic(rtpm: RTPMediaPacketizer; inSelector: OSType; var outHasIt: boolean): ComponentResult; external name '_RTPMPHasCharacteristic';
{
 *  RTPMPSetPacketBuilder()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function RTPMPSetPacketBuilder(rtpm: RTPMediaPacketizer; inPacketBuilder: ComponentInstance): ComponentResult; external name '_RTPMPSetPacketBuilder';
{
 *  RTPMPGetPacketBuilder()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function RTPMPGetPacketBuilder(rtpm: RTPMediaPacketizer; var outPacketBuilder: ComponentInstance): ComponentResult; external name '_RTPMPGetPacketBuilder';
{
 *  RTPMPSetMediaType()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function RTPMPSetMediaType(rtpm: RTPMediaPacketizer; inMediaType: OSType): ComponentResult; external name '_RTPMPSetMediaType';
{
 *  RTPMPGetMediaType()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function RTPMPGetMediaType(rtpm: RTPMediaPacketizer; var outMediaType: OSType): ComponentResult; external name '_RTPMPGetMediaType';
{  size is in bytes }
{
 *  RTPMPSetMaxPacketSize()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function RTPMPSetMaxPacketSize(rtpm: RTPMediaPacketizer; inMaxPacketSize: UInt32): ComponentResult; external name '_RTPMPSetMaxPacketSize';
{
 *  RTPMPGetMaxPacketSize()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function RTPMPGetMaxPacketSize(rtpm: RTPMediaPacketizer; var outMaxPacketSize: UInt32): ComponentResult; external name '_RTPMPGetMaxPacketSize';
{  duration is in milliseconds }
{
 *  RTPMPSetMaxPacketDuration()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function RTPMPSetMaxPacketDuration(rtpm: RTPMediaPacketizer; inMaxPacketDuration: UInt32): ComponentResult; external name '_RTPMPSetMaxPacketDuration';
{
 *  RTPMPGetMaxPacketDuration()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function RTPMPGetMaxPacketDuration(rtpm: RTPMediaPacketizer; var outMaxPacketDuration: UInt32): ComponentResult; external name '_RTPMPGetMaxPacketDuration';
{
 *  RTPMPDoUserDialog()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function RTPMPDoUserDialog(rtpm: RTPMediaPacketizer; inFilterUPP: ModalFilterUPP; var canceled: boolean): ComponentResult; external name '_RTPMPDoUserDialog';
{
 *  RTPMPSetSettingsFromAtomContainerAtAtom()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function RTPMPSetSettingsFromAtomContainerAtAtom(rtpm: RTPMediaPacketizer; inContainer: QTAtomContainer; inParentAtom: QTAtom): ComponentResult; external name '_RTPMPSetSettingsFromAtomContainerAtAtom';
{
 *  RTPMPGetSettingsIntoAtomContainerAtAtom()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function RTPMPGetSettingsIntoAtomContainerAtAtom(rtpm: RTPMediaPacketizer; inOutContainer: QTAtomContainer; inParentAtom: QTAtom): ComponentResult; external name '_RTPMPGetSettingsIntoAtomContainerAtAtom';
{
 *  RTPMPGetSettingsAsText()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function RTPMPGetSettingsAsText(rtpm: RTPMediaPacketizer; var text: Handle): ComponentResult; external name '_RTPMPGetSettingsAsText';
{
 *  RTPMPGetSettings()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 5.0 and later
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 5.0 and later
 }
function RTPMPGetSettings(rtpm: RTPMediaPacketizer; var outSettings: QTAtomContainer; inFlags: SInt32): ComponentResult; external name '_RTPMPGetSettings';
{
 *  RTPMPSetSettings()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 5.0 and later
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 5.0 and later
 }
function RTPMPSetSettings(rtpm: RTPMediaPacketizer; inSettings: QTAtomSpecPtr; inFlags: SInt32): ComponentResult; external name '_RTPMPSetSettings';
{============================================================================
        RTP Packet Builder
============================================================================}

const
    kRTPPacketBuilderType       = $72747062 (* 'rtpb' *);


type
    RTPPacketBuilder                    = ComponentInstance;
    RTPPacketGroupRef    = ^SInt32; { an opaque 32-bit type }
    RTPPacketGroupRefPtr = ^RTPPacketGroupRef;  { when a var xx:RTPPacketGroupRef parameter can be nil, it is changed to xx: RTPPacketGroupRefPtr }
    RTPPacketRef    = ^SInt32; { an opaque 32-bit type }
    RTPPacketRefPtr = ^RTPPacketRef;  { when a var xx:RTPPacketRef parameter can be nil, it is changed to xx: RTPPacketRefPtr }
    RTPPacketRepeatedDataRef    = ^SInt32; { an opaque 32-bit type }
    RTPPacketRepeatedDataRefPtr = ^RTPPacketRepeatedDataRef;  { when a var xx:RTPPacketRepeatedDataRef parameter can be nil, it is changed to xx: RTPPacketRepeatedDataRefPtr }
    {  flags for RTPPBBegin/EndPacket, RTPPBBegin/EndPacketGroup }

const
    kRTPPBSetMarkerFlag         = $00000001;
    kRTPPBRepeatPacketFlag      = $00000002;
    kRTPPBSyncSampleFlag        = $00010000;
    kRTPPBBFrameFlag            = $00020000;
    kRTPPBDontSendFlag          = $10000000;                    {  when set in EndPacketGroup, will not add group }

    kRTPPBUnknownPacketMediaDataLength = 0;

    {  flags for RTPPBGetSampleData }
    kRTPPBEndOfDataFlag         = $00000001;



type
    RTPPBCallbackProcPtr = procedure(inSelector: OSType; ioParams: UnivPtr; inRefCon: UnivPtr);

    RTPPBCallbackUPP = ^SInt32; { an opaque UPP }
    {   -----------------------------------------
        RTP Packet Builder selectors
    -----------------------------------------   }

const
    kRTPPBBeginPacketGroupSelect = $0500;
    kRTPPBEndPacketGroupSelect  = $0501;
    kRTPPBBeginPacketSelect     = $0502;
    kRTPPBEndPacketSelect       = $0503;
    kRTPPBAddPacketLiteralDataSelect = $0504;
    kRTPPBAddPacketSampleDataSelect = $0505;
    kRTPPBAddPacketRepeatedDataSelect = $0506;
    kRTPPBReleaseRepeatedDataSelect = $0507;
    kRTPPBSetPacketSequenceNumberSelect = $0508;
    kRTPPBGetPacketSequenceNumberSelect = $0509;
    kRTPPBSetCallbackSelect     = $050A;
    kRTPPBGetCallbackSelect     = $050B;
    kRTPPBSetInfoSelect         = $050C;
    kRTPPBGetInfoSelect         = $050D;
    kRTPPBSetPacketTimeStampOffsetSelect = $050E;
    kRTPPBGetPacketTimeStampOffsetSelect = $050F;
    kRTPPBAddPacketSampleData64Select = $0510;
    kRTPPBGetSampleDataSelect   = $0511;
    kRTPPBAddRepeatPacketSelect = $0512;

    {   -----------------------------------------
        RTP Packet Builder functions
    -----------------------------------------   }
    {
     *  RTPPBBeginPacketGroup()
     *
     *  Availability:
     *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
     *    CarbonLib:        in CarbonLib 1.1 and later
     *    Mac OS X:         in version 10.0 and later
     *    Windows:          in QTSClient.lib 4.0 and later
        }
function RTPPBBeginPacketGroup(rtpb: RTPPacketBuilder; inFlags: SInt32; inTimeStamp: UInt32; var outPacketGroup: RTPPacketGroupRef): ComponentResult; external name '_RTPPBBeginPacketGroup';
{
 *  RTPPBEndPacketGroup()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function RTPPBEndPacketGroup(rtpb: RTPPacketBuilder; inFlags: SInt32; inPacketGroup: RTPPacketGroupRef): ComponentResult; external name '_RTPPBEndPacketGroup';
{
 *  RTPPBBeginPacket()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function RTPPBBeginPacket(rtpb: RTPPacketBuilder; inFlags: SInt32; inPacketGroup: RTPPacketGroupRef; inPacketMediaDataLength: UInt32; var outPacket: RTPPacketRef): ComponentResult; external name '_RTPPBBeginPacket';
{
 *  RTPPBEndPacket()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function RTPPBEndPacket(rtpb: RTPPacketBuilder; inFlags: SInt32; inPacketGroup: RTPPacketGroupRef; inPacket: RTPPacketRef; inTransmissionTimeOffset: UInt32; inDuration: UInt32): ComponentResult; external name '_RTPPBEndPacket';
{
   non-NULL RTPPacketRepeatedDataRef means this data will be repeated later
   pb must return a repeated data ref
}
{
 *  RTPPBAddPacketLiteralData()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function RTPPBAddPacketLiteralData(rtpb: RTPPacketBuilder; inFlags: SInt32; inPacketGroup: RTPPacketGroupRef; inPacket: RTPPacketRef; var inData: UInt8; inDataLength: UInt32; var outDataRef: RTPPacketRepeatedDataRef): ComponentResult; external name '_RTPPBAddPacketLiteralData';
{
   non-NULL RTPPacketRepeatedDataRef means this data will be repeated later
   pb must return a repeated data ref
}
{
 *  RTPPBAddPacketSampleData()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function RTPPBAddPacketSampleData(rtpb: RTPPacketBuilder; inFlags: SInt32; inPacketGroup: RTPPacketGroupRef; inPacket: RTPPacketRef; var inSampleDataParams: RTPMPSampleDataParams; inSampleOffset: UInt32; inSampleDataLength: UInt32; var outDataRef: RTPPacketRepeatedDataRef): ComponentResult; external name '_RTPPBAddPacketSampleData';
{
   non-NULL RTPPacketRepeatedDataRef means this data will be repeated later
   pb must return a repeated data ref
}
{
 *  RTPPBAddPacketSampleData64()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 5.0 and later
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 5.0 and later
 }
function RTPPBAddPacketSampleData64(rtpb: RTPPacketBuilder; inFlags: SInt32; inPacketGroup: RTPPacketGroupRef; inPacket: RTPPacketRef; var inSampleDataParams: RTPMPSampleDataParams; const (*var*) inSampleOffset: UInt64; inSampleDataLength: UInt32; var outDataRef: RTPPacketRepeatedDataRef): ComponentResult; external name '_RTPPBAddPacketSampleData64';
{
   call to add the repeated data using the ref you got from
   RTPPBAddPacketLiteralData or RTPPBAddPacketSampleData
}
{
 *  RTPPBAddPacketRepeatedData()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function RTPPBAddPacketRepeatedData(rtpb: RTPPacketBuilder; inFlags: SInt32; inPacketGroup: RTPPacketGroupRef; inPacket: RTPPacketRef; inDataRef: RTPPacketRepeatedDataRef): ComponentResult; external name '_RTPPBAddPacketRepeatedData';
{  call when done with repeated data }
{
 *  RTPPBReleaseRepeatedData()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function RTPPBReleaseRepeatedData(rtpb: RTPPacketBuilder; inDataRef: RTPPacketRepeatedDataRef): ComponentResult; external name '_RTPPBReleaseRepeatedData';
{
   seq number is just relative seq number
   don't call if you don't care when seq # is used
}
{
 *  RTPPBSetPacketSequenceNumber()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function RTPPBSetPacketSequenceNumber(rtpb: RTPPacketBuilder; inFlags: SInt32; inPacketGroup: RTPPacketGroupRef; inPacket: RTPPacketRef; inSequenceNumber: UInt32): ComponentResult; external name '_RTPPBSetPacketSequenceNumber';
{
 *  RTPPBGetPacketSequenceNumber()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function RTPPBGetPacketSequenceNumber(rtpb: RTPPacketBuilder; inFlags: SInt32; inPacketGroup: RTPPacketGroupRef; inPacket: RTPPacketRef; var outSequenceNumber: UInt32): ComponentResult; external name '_RTPPBGetPacketSequenceNumber';
{
 *  RTPPBSetPacketTimeStampOffset()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 5.0 and later
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 5.0 and later
 }
function RTPPBSetPacketTimeStampOffset(rtpb: RTPPacketBuilder; inFlags: SInt32; inPacketGroup: RTPPacketGroupRef; inPacket: RTPPacketRef; inTimeStampOffset: SInt32): ComponentResult; external name '_RTPPBSetPacketTimeStampOffset';
{
 *  RTPPBGetPacketTimeStampOffset()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 5.0 and later
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 5.0 and later
 }
function RTPPBGetPacketTimeStampOffset(rtpb: RTPPacketBuilder; inFlags: SInt32; inPacketGroup: RTPPacketGroupRef; inPacket: RTPPacketRef; var outTimeStampOffset: SInt32): ComponentResult; external name '_RTPPBGetPacketTimeStampOffset';
{
 *  RTPPBAddRepeatPacket()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 5.0 and later
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 5.0 and later
 }
function RTPPBAddRepeatPacket(rtpb: RTPPacketBuilder; inFlags: SInt32; inPacketGroup: RTPPacketGroupRef; inPacket: RTPPacketRef; inTransmissionOffset: TimeValue; inSequenceNumber: UInt32): ComponentResult; external name '_RTPPBAddRepeatPacket';
{
   used for communicating with the caller of the media packetizers if needed
   NOT used for communicating with the media packetizers themselves
}
{
 *  RTPPBSetCallback()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function RTPPBSetCallback(rtpb: RTPPacketBuilder; inCallback: RTPPBCallbackUPP; inRefCon: UnivPtr): ComponentResult; external name '_RTPPBSetCallback';
{
 *  RTPPBGetCallback()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function RTPPBGetCallback(rtpb: RTPPacketBuilder; var outCallback: RTPPBCallbackUPP; var outRefCon: UnivPtr): ComponentResult; external name '_RTPPBGetCallback';
{
 *  RTPPBSetInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function RTPPBSetInfo(rtpb: RTPPacketBuilder; inSelector: OSType; ioParams: UnivPtr): ComponentResult; external name '_RTPPBSetInfo';
{
 *  RTPPBGetInfo()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 4.0 and later
 *    CarbonLib:        in CarbonLib 1.1 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 4.0 and later
 }
function RTPPBGetInfo(rtpb: RTPPacketBuilder; inSelector: OSType; ioParams: UnivPtr): ComponentResult; external name '_RTPPBGetInfo';
{
 *  RTPPBGetSampleData()
 *
 *  Availability:
 *    Non-Carbon CFM:   in QTStreamLib 5.0 and later
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 *    Windows:          in QTSClient.lib 5.0 and later
 }
function RTPPBGetSampleData(rtpb: RTPPacketBuilder; var inParams: RTPMPSampleDataParams; const (*var*) inStartOffset: UInt64; var outDataBuffer: UInt8; inBytesToRead: UInt32; var outBytesRead: UInt32; var outFlags: SInt32): ComponentResult; external name '_RTPPBGetSampleData';
{ UPP call backs }

const
    uppRTPMPDataReleaseProcInfo = $000003C0;
    uppRTPPBCallbackProcInfo = $00000FC0;
    {
     *  NewRTPMPDataReleaseUPP()
     *
     *  Availability:
     *    Non-Carbon CFM:   available as macro/inline
     *    CarbonLib:        in CarbonLib 1.3 and later
     *    Mac OS X:         in version 10.0 and later
        }
function NewRTPMPDataReleaseUPP(userRoutine: RTPMPDataReleaseProcPtr): RTPMPDataReleaseUPP; external name '_NewRTPMPDataReleaseUPP'; { old name was NewRTPMPDataReleaseProc }
{
 *  NewRTPPBCallbackUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 }
function NewRTPPBCallbackUPP(userRoutine: RTPPBCallbackProcPtr): RTPPBCallbackUPP; external name '_NewRTPPBCallbackUPP'; { old name was NewRTPPBCallbackProc }
{
 *  DisposeRTPMPDataReleaseUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeRTPMPDataReleaseUPP(userUPP: RTPMPDataReleaseUPP); external name '_DisposeRTPMPDataReleaseUPP';
{
 *  DisposeRTPPBCallbackUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure DisposeRTPPBCallbackUPP(userUPP: RTPPBCallbackUPP); external name '_DisposeRTPPBCallbackUPP';
{
 *  InvokeRTPMPDataReleaseUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvokeRTPMPDataReleaseUPP(var inData: UInt8; inRefCon: UnivPtr; userRoutine: RTPMPDataReleaseUPP); external name '_InvokeRTPMPDataReleaseUPP'; { old name was CallRTPMPDataReleaseProc }
{
 *  InvokeRTPPBCallbackUPP()
 *
 *  Availability:
 *    Non-Carbon CFM:   available as macro/inline
 *    CarbonLib:        in CarbonLib 1.3 and later
 *    Mac OS X:         in version 10.0 and later
 }
procedure InvokeRTPPBCallbackUPP(inSelector: OSType; ioParams: UnivPtr; inRefCon: UnivPtr; userRoutine: RTPPBCallbackUPP); external name '_InvokeRTPPBCallbackUPP'; { old name was CallRTPPBCallbackProc }
{$ALIGN MAC68K}
{#POP}

end.
