// Automatically generated by clay-bindgen
// language: c

import libc.*;
import unix.*;
import cocoa.corefoundation.*;
import cocoa.coreservices.*;

private alias OpaquePointer = RawPointer;
private alias UnknownType = Int;
private alias AUnionType = Int;




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

alias kAllTypeFeaturesOnSelector = 0;
alias kAllTypeFeaturesOffSelector = 1;

alias kRequiredLigaturesOnSelector = 0;
alias kRequiredLigaturesOffSelector = 1;
alias kCommonLigaturesOnSelector = 2;
alias kCommonLigaturesOffSelector = 3;
alias kRareLigaturesOnSelector = 4;
alias kRareLigaturesOffSelector = 5;
alias kLogosOnSelector = 6;
alias kLogosOffSelector = 7;
alias kRebusPicturesOnSelector = 8;
alias kRebusPicturesOffSelector = 9;
alias kDiphthongLigaturesOnSelector = 10;
alias kDiphthongLigaturesOffSelector = 11;
alias kSquaredLigaturesOnSelector = 12;
alias kSquaredLigaturesOffSelector = 13;
alias kAbbrevSquaredLigaturesOnSelector = 14;
alias kAbbrevSquaredLigaturesOffSelector = 15;
alias kSymbolLigaturesOnSelector = 16;
alias kSymbolLigaturesOffSelector = 17;

alias kUnconnectedSelector = 0;
alias kPartiallyConnectedSelector = 1;
alias kCursiveSelector = 2;

alias kUpperAndLowerCaseSelector = 0;
alias kAllCapsSelector = 1;
alias kAllLowerCaseSelector = 2;
alias kSmallCapsSelector = 3;
alias kInitialCapsSelector = 4;
alias kInitialCapsAndSmallCapsSelector = 5;

alias kSubstituteVerticalFormsOnSelector = 0;
alias kSubstituteVerticalFormsOffSelector = 1;

alias kLinguisticRearrangementOnSelector = 0;
alias kLinguisticRearrangementOffSelector = 1;

alias kMonospacedNumbersSelector = 0;
alias kProportionalNumbersSelector = 1;
alias kThirdWidthNumbersSelector = 2;
alias kQuarterWidthNumbersSelector = 3;

alias kWordInitialSwashesOnSelector = 0;
alias kWordInitialSwashesOffSelector = 1;
alias kWordFinalSwashesOnSelector = 2;
alias kWordFinalSwashesOffSelector = 3;
alias kLineInitialSwashesOnSelector = 4;
alias kLineInitialSwashesOffSelector = 5;
alias kLineFinalSwashesOnSelector = 6;
alias kLineFinalSwashesOffSelector = 7;
alias kNonFinalSwashesOnSelector = 8;
alias kNonFinalSwashesOffSelector = 9;

alias kShowDiacriticsSelector = 0;
alias kHideDiacriticsSelector = 1;
alias kDecomposeDiacriticsSelector = 2;

alias kNormalPositionSelector = 0;
alias kSuperiorsSelector = 1;
alias kInferiorsSelector = 2;
alias kOrdinalsSelector = 3;

alias kNoFractionsSelector = 0;
alias kVerticalFractionsSelector = 1;
alias kDiagonalFractionsSelector = 2;

alias kPreventOverlapOnSelector = 0;
alias kPreventOverlapOffSelector = 1;

alias kHyphensToEmDashOnSelector = 0;
alias kHyphensToEmDashOffSelector = 1;
alias kHyphenToEnDashOnSelector = 2;
alias kHyphenToEnDashOffSelector = 3;
alias kSlashedZeroOnSelector = 4;
alias kSlashedZeroOffSelector = 5;
alias kFormInterrobangOnSelector = 6;
alias kFormInterrobangOffSelector = 7;
alias kSmartQuotesOnSelector = 8;
alias kSmartQuotesOffSelector = 9;
alias kPeriodsToEllipsisOnSelector = 10;
alias kPeriodsToEllipsisOffSelector = 11;

alias kHyphenToMinusOnSelector = 0;
alias kHyphenToMinusOffSelector = 1;
alias kAsteriskToMultiplyOnSelector = 2;
alias kAsteriskToMultiplyOffSelector = 3;
alias kSlashToDivideOnSelector = 4;
alias kSlashToDivideOffSelector = 5;
alias kInequalityLigaturesOnSelector = 6;
alias kInequalityLigaturesOffSelector = 7;
alias kExponentsOnSelector = 8;
alias kExponentsOffSelector = 9;

alias kNoOrnamentsSelector = 0;
alias kDingbatsSelector = 1;
alias kPiCharactersSelector = 2;
alias kFleuronsSelector = 3;
alias kDecorativeBordersSelector = 4;
alias kInternationalSymbolsSelector = 5;
alias kMathSymbolsSelector = 6;

alias kNoAlternatesSelector = 0;

alias kDesignLevel1Selector = 0;
alias kDesignLevel2Selector = 1;
alias kDesignLevel3Selector = 2;
alias kDesignLevel4Selector = 3;
alias kDesignLevel5Selector = 4;

alias kNoStyleOptionsSelector = 0;
alias kDisplayTextSelector = 1;
alias kEngravedTextSelector = 2;
alias kIlluminatedCapsSelector = 3;
alias kTitlingCapsSelector = 4;
alias kTallCapsSelector = 5;

alias kTraditionalCharactersSelector = 0;
alias kSimplifiedCharactersSelector = 1;
alias kJIS1978CharactersSelector = 2;
alias kJIS1983CharactersSelector = 3;
alias kJIS1990CharactersSelector = 4;
alias kTraditionalAltOneSelector = 5;
alias kTraditionalAltTwoSelector = 6;
alias kTraditionalAltThreeSelector = 7;
alias kTraditionalAltFourSelector = 8;
alias kTraditionalAltFiveSelector = 9;
alias kExpertCharactersSelector = 10;

alias kLowerCaseNumbersSelector = 0;
alias kUpperCaseNumbersSelector = 1;

alias kProportionalTextSelector = 0;
alias kMonospacedTextSelector = 1;
alias kHalfWidthTextSelector = 2;

alias kNoTransliterationSelector = 0;
alias kHanjaToHangulSelector = 1;
alias kHiraganaToKatakanaSelector = 2;
alias kKatakanaToHiraganaSelector = 3;
alias kKanaToRomanizationSelector = 4;
alias kRomanizationToHiraganaSelector = 5;
alias kRomanizationToKatakanaSelector = 6;
alias kHanjaToHangulAltOneSelector = 7;
alias kHanjaToHangulAltTwoSelector = 8;
alias kHanjaToHangulAltThreeSelector = 9;

alias kNoAnnotationSelector = 0;
alias kBoxAnnotationSelector = 1;
alias kRoundedBoxAnnotationSelector = 2;
alias kCircleAnnotationSelector = 3;
alias kInvertedCircleAnnotationSelector = 4;
alias kParenthesisAnnotationSelector = 5;
alias kPeriodAnnotationSelector = 6;
alias kRomanNumeralAnnotationSelector = 7;
alias kDiamondAnnotationSelector = 8;
alias kInvertedBoxAnnotationSelector = 9;
alias kInvertedRoundedBoxAnnotationSelector = 10;

alias kFullWidthKanaSelector = 0;
alias kProportionalKanaSelector = 1;

alias kFullWidthIdeographsSelector = 0;
alias kProportionalIdeographsSelector = 1;
alias kHalfWidthIdeographsSelector = 2;

alias kCanonicalCompositionOnSelector = 0;
alias kCanonicalCompositionOffSelector = 1;
alias kCompatibilityCompositionOnSelector = 2;
alias kCompatibilityCompositionOffSelector = 3;
alias kTranscodingCompositionOnSelector = 4;
alias kTranscodingCompositionOffSelector = 5;

alias kNoRubyKanaSelector = 0;
alias kRubyKanaSelector = 1;
alias kRubyKanaOnSelector = 2;
alias kRubyKanaOffSelector = 3;

alias kNoCJKSymbolAlternativesSelector = 0;
alias kCJKSymbolAltOneSelector = 1;
alias kCJKSymbolAltTwoSelector = 2;
alias kCJKSymbolAltThreeSelector = 3;
alias kCJKSymbolAltFourSelector = 4;
alias kCJKSymbolAltFiveSelector = 5;

alias kNoIdeographicAlternativesSelector = 0;
alias kIdeographicAltOneSelector = 1;
alias kIdeographicAltTwoSelector = 2;
alias kIdeographicAltThreeSelector = 3;
alias kIdeographicAltFourSelector = 4;
alias kIdeographicAltFiveSelector = 5;

alias kCJKVerticalRomanCenteredSelector = 0;
alias kCJKVerticalRomanHBaselineSelector = 1;

alias kNoCJKItalicRomanSelector = 0;
alias kCJKItalicRomanSelector = 1;
alias kCJKItalicRomanOnSelector = 2;
alias kCJKItalicRomanOffSelector = 3;

alias kHalfWidthCJKRomanSelector = 0;
alias kProportionalCJKRomanSelector = 1;
alias kDefaultCJKRomanSelector = 2;
alias kFullWidthCJKRomanSelector = 3;

alias kSFNTLookupSimpleArray = 0;
alias kSFNTLookupSegmentSingle = 2;
alias kSFNTLookupSegmentArray = 4;
alias kSFNTLookupSingleTable = 6;
alias kSFNTLookupTrimmedArray = 8;

alias SFNTLookupTableFormat = UShort;

alias SFNTLookupValue = UShort;

alias SFNTLookupOffset = UShort;

alias SFNTLookupKind = UInt;

record Struct_SFNTLookupBinarySearchHeader (
    unitSize : UShort,
    nUnits : UShort,
    searchRange : UShort,
    entrySelector : UShort,
    rangeShift : UShort,
);

alias SFNTLookupBinarySearchHeader = Struct_SFNTLookupBinarySearchHeader;

record Struct_SFNTLookupArrayHeader (
    lookupValues : Array[UShort,1],
);

alias SFNTLookupArrayHeader = Struct_SFNTLookupArrayHeader;

record Struct_SFNTLookupTrimmedArrayHeader (
    firstGlyph : UShort,
    count : UShort,
    valueArray : Array[UShort,1],
);

alias SFNTLookupTrimmedArrayHeader = Struct_SFNTLookupTrimmedArrayHeader;

record Struct_SFNTLookupSegment (
    lastGlyph : UShort,
    firstGlyph : UShort,
    value : Array[UShort,1],
);

alias SFNTLookupSegment = Struct_SFNTLookupSegment;

record Struct_SFNTLookupSegmentHeader (
    binSearch : SFNTLookupBinarySearchHeader,
    segments : Array[SFNTLookupSegment,1],
);

alias SFNTLookupSegmentHeader = Struct_SFNTLookupSegmentHeader;

record Struct_SFNTLookupSingle (
    glyph : UShort,
    value : Array[UShort,1],
);

alias SFNTLookupSingle = Struct_SFNTLookupSingle;

record Struct_SFNTLookupSingleHeader (
    binSearch : SFNTLookupBinarySearchHeader,
    entries : Array[SFNTLookupSingle,1],
);

alias SFNTLookupSingleHeader = Struct_SFNTLookupSingleHeader;

alias SFNTLookupFormatSpecificHeader = AUnionType;

record Struct_SFNTLookupTable (
    format : UShort,
    fsHeader : SFNTLookupFormatSpecificHeader,
);

alias SFNTLookupTable = Struct_SFNTLookupTable;

alias SFNTLookupTablePtr = Pointer[SFNTLookupTable];

alias SFNTLookupTableHandle = Pointer[SFNTLookupTablePtr];

alias kSTClassEndOfText = 0;
alias kSTClassOutOfBounds = 1;
alias kSTClassDeletedGlyph = 2;
alias kSTClassEndOfLine = 3;
alias kSTSetMark = 32768;
alias kSTNoAdvance = 16384;
alias kSTMarkEnd = 8192;
alias kSTLigActionMask = 16383;
alias kSTRearrVerbMask = 15;

alias STClass = CUChar;

alias STEntryIndex = CUChar;

record Struct_STHeader (
    filler : CUChar,
    nClasses : CUChar,
    classTableOffset : UShort,
    stateArrayOffset : UShort,
    entryTableOffset : UShort,
);

alias STHeader = Struct_STHeader;

record Struct_STClassTable (
    firstGlyph : UShort,
    nGlyphs : UShort,
    classes : Array[CUChar,1],
);

alias STClassTable = Struct_STClassTable;

record Struct_STEntryZero (
    newState : UShort,
    flags : UShort,
);

alias STEntryZero = Struct_STEntryZero;

record Struct_STEntryOne (
    newState : UShort,
    flags : UShort,
    offset1 : UShort,
);

alias STEntryOne = Struct_STEntryOne;

record Struct_STEntryTwo (
    newState : UShort,
    flags : UShort,
    offset1 : UShort,
    offset2 : UShort,
);

alias STEntryTwo = Struct_STEntryTwo;

alias kSTXHasLigAction = 8192;

alias STXClass = UShort;

alias STXStateIndex = UShort;

alias STXEntryIndex = UShort;

record Struct_STXHeader (
    nClasses : UInt,
    classTableOffset : UInt,
    stateArrayOffset : UInt,
    entryTableOffset : UInt,
);

alias STXHeader = Struct_STXHeader;

alias STXClassTable = SFNTLookupTable;

record Struct_STXEntryZero (
    newState : UShort,
    flags : UShort,
);

alias STXEntryZero = Struct_STXEntryZero;

record Struct_STXEntryOne (
    newState : UShort,
    flags : UShort,
    index1 : UShort,
);

alias STXEntryOne = Struct_STXEntryOne;

record Struct_STXEntryTwo (
    newState : UShort,
    flags : UShort,
    index1 : UShort,
    index2 : UShort,
);

alias STXEntryTwo = Struct_STXEntryTwo;

alias kLCARTag = 1818452338;
alias kLCARCurrentVersion = 65536;
alias kLCARLinearFormat = 0;
alias kLCARCtlPointFormat = 1;

record Struct_LcarCaretClassEntry (
    count : UShort,
    partials : Array[UShort,1],
);

alias LcarCaretClassEntry = Struct_LcarCaretClassEntry;

record Struct_LcarCaretTable (
    version : Int,
    format : UShort,
    lookup : SFNTLookupTable,
);

alias LcarCaretTable = Struct_LcarCaretTable;

alias LcarCaretTablePtr = Pointer[LcarCaretTable];

alias kJUSTTag = 1786082164;
alias kJUSTCurrentVersion = 65536;
alias kJUSTStandardFormat = 0;
alias kJUSTnoGlyphcode = 65535;
alias kJUSTpcDecompositionAction = 0;
alias kJUSTpcUnconditionalAddAction = 1;
alias kJUSTpcConditionalAddAction = 2;
alias kJUSTpcGlyphStretchAction = 3;
alias kJUSTpcDuctilityAction = 4;
alias kJUSTpcGlyphRepeatAddAction = 5;

alias kJUSTKashidaPriority = 0;
alias kJUSTSpacePriority = 1;
alias kJUSTLetterPriority = 2;
alias kJUSTNullPriority = 3;
alias kJUSTPriorityCount = 4;

alias kJUSTOverridePriority = 32768;
alias kJUSTOverrideLimits = 16384;
alias kJUSTOverrideUnlimited = 8192;
alias kJUSTUnlimited = 4096;
alias kJUSTPriorityMask = 3;

alias JustPCActionType = UShort;

alias JustificationFlags = UShort;

record Struct_JustPCDecompositionAction (
    lowerLimit : Int,
    upperLimit : Int,
    order : UShort,
    count : UShort,
    glyphs : Array[UShort,1],
);

alias JustPCDecompositionAction = Struct_JustPCDecompositionAction;

alias JustPCUnconditionalAddAction = UShort;

record Struct_JustPCConditionalAddAction (
    substThreshhold : Int,
    addGlyph : UShort,
    substGlyph : UShort,
);

alias JustPCConditionalAddAction = Struct_JustPCConditionalAddAction;

record Struct_JustPCDuctilityAction (
    ductilityAxis : UInt,
    minimumLimit : Int,
    noStretchValue : Int,
    maximumLimit : Int,
);

alias JustPCDuctilityAction = Struct_JustPCDuctilityAction;

record Struct_JustPCGlyphRepeatAddAction (
    flags : UShort,
    glyph : UShort,
);

alias JustPCGlyphRepeatAddAction = Struct_JustPCGlyphRepeatAddAction;

record Struct_JustPCActionSubrecord (
    theClass : UShort,
    theType : UShort,
    length : UInt,
    data : UInt,
);

alias JustPCActionSubrecord = Struct_JustPCActionSubrecord;

record Struct_JustPCAction (
    actionCount : UInt,
    actions : Array[JustPCActionSubrecord,1],
);

alias JustPCAction = Struct_JustPCAction;

record Struct_JustWidthDeltaEntry (
    justClass : UInt,
    beforeGrowLimit : Int,
    beforeShrinkLimit : Int,
    afterGrowLimit : Int,
    afterShrinkLimit : Int,
    growFlags : UShort,
    shrinkFlags : UShort,
);

alias JustWidthDeltaEntry = Struct_JustWidthDeltaEntry;

record Struct_JustWidthDeltaGroup (
    count : UInt,
    entries : Array[JustWidthDeltaEntry,1],
);

alias JustWidthDeltaGroup = Struct_JustWidthDeltaGroup;

record Struct_JustPostcompTable (
    lookupTable : SFNTLookupTable,
);

alias JustPostcompTable = Struct_JustPostcompTable;

record Struct_JustDirectionTable (
    justClass : UShort,
    widthDeltaClusters : UShort,
    postcomp : UShort,
    lookup : SFNTLookupTable,
);

alias JustDirectionTable = Struct_JustDirectionTable;

record Struct_JustTable (
    version : Int,
    format : UShort,
    horizHeaderOffset : UShort,
    vertHeaderOffset : UShort,
);

alias JustTable = Struct_JustTable;

alias kOPBDTag = 1869636196;
alias kOPBDCurrentVersion = 65536;
alias kOPBDDistanceFormat = 0;
alias kOPBDControlPointFormat = 1;

alias OpbdTableFormat = UShort;

record Struct_OpbdSideValues (
    leftSideShift : Short,
    topSideShift : Short,
    rightSideShift : Short,
    bottomSideShift : Short,
);

alias OpbdSideValues = Struct_OpbdSideValues;

record Struct_OpbdTable (
    version : Int,
    format : UShort,
    lookupTable : SFNTLookupTable,
);

alias OpbdTable = Struct_OpbdTable;

alias kMORTTag = 1836020340;
alias kMORTCurrentVersion = 65536;
alias kMORTCoverVertical = 32768;
alias kMORTCoverDescending = 16384;
alias kMORTCoverIgnoreVertical = 8192;
alias kMORTCoverTypeMask = 15;
alias kMORTRearrangementType = 0;
alias kMORTContextualType = 1;
alias kMORTLigatureType = 2;
alias kMORTSwashType = 4;
alias kMORTInsertionType = 5;
alias kMORTLigLastAction = 2147483648;
alias kMORTLigStoreLigature = 1073741824;
alias kMORTLigFormOffsetMask = 1073741823;
alias kMORTLigFormOffsetShift = 2;
alias kMORTraNoAction = 0;
alias kMORTraxA = 1;
alias kMORTraDx = 2;
alias kMORTraDxA = 3;
alias kMORTraxAB = 4;
alias kMORTraxBA = 5;
alias kMORTraCDx = 6;
alias kMORTraDCx = 7;
alias kMORTraCDxA = 8;
alias kMORTraDCxA = 9;
alias kMORTraDxAB = 10;
alias kMORTraDxBA = 11;
alias kMORTraCDxAB = 12;
alias kMORTraCDxBA = 13;
alias kMORTraDCxAB = 14;
alias kMORTraDCxBA = 15;
alias kMORTDoInsertionsBefore = 128;
alias kMORTIsSplitVowelPiece = 64;
alias kMORTInsertionsCountMask = 63;
alias kMORTCurrInsertKashidaLike = 8192;
alias kMORTMarkInsertKashidaLike = 4096;
alias kMORTCurrInsertBefore = 2048;
alias kMORTMarkInsertBefore = 1024;
alias kMORTMarkJustTableCountMask = 16256;
alias kMORTMarkJustTableCountShift = 7;
alias kMORTCurrJustTableCountMask = 127;
alias kMORTCurrJustTableCountShift = 0;
alias kMORTCurrInsertCountMask = 992;
alias kMORTCurrInsertCountShift = 5;
alias kMORTMarkInsertCountMask = 31;
alias kMORTMarkInsertCountShift = 0;

alias MortSubtableMaskFlags = UInt;

alias MortLigatureActionEntry = UInt;

record Struct_MortRearrangementSubtable (
    header : STHeader,
);

alias MortRearrangementSubtable = Struct_MortRearrangementSubtable;

record Struct_MortContextualSubtable (
    header : STHeader,
    substitutionTableOffset : UShort,
);

alias MortContextualSubtable = Struct_MortContextualSubtable;

record Struct_MortLigatureSubtable (
    header : STHeader,
    ligatureActionTableOffset : UShort,
    componentTableOffset : UShort,
    ligatureTableOffset : UShort,
);

alias MortLigatureSubtable = Struct_MortLigatureSubtable;

record Struct_MortSwashSubtable (
    lookup : SFNTLookupTable,
);

alias MortSwashSubtable = Struct_MortSwashSubtable;

record Struct_MortInsertionSubtable (
    header : STHeader,
);

alias MortInsertionSubtable = Struct_MortInsertionSubtable;

alias MortSpecificSubtable = AUnionType;

record Struct_MortSubtable (
    length : UShort,
    coverage : UShort,
    flags : UInt,
    u : MortSpecificSubtable,
);

alias MortSubtable = Struct_MortSubtable;

record Struct_MortFeatureEntry (
    featureType : UShort,
    featureSelector : UShort,
    enableFlags : UInt,
    disableFlags : UInt,
);

alias MortFeatureEntry = Struct_MortFeatureEntry;

record Struct_MortChain (
    defaultFlags : UInt,
    length : UInt,
    nFeatures : UShort,
    nSubtables : UShort,
    featureEntries : Array[MortFeatureEntry,1],
);

alias MortChain = Struct_MortChain;

record Struct_MortTable (
    version : Int,
    nChains : UInt,
    chains : Array[MortChain,1],
);

alias MortTable = Struct_MortTable;

alias kMORXTag = 1836020344;
alias kMORXCurrentVersion = 131072;
alias kMORXCoverVertical = 2147483648;
alias kMORXCoverDescending = 1073741824;
alias kMORXCoverIgnoreVertical = 536870912;
alias kMORXCoverTypeMask = 255;

record Struct_MorxRearrangementSubtable (
    header : STXHeader,
);

alias MorxRearrangementSubtable = Struct_MorxRearrangementSubtable;

record Struct_MorxContextualSubtable (
    header : STXHeader,
    substitutionTableOffset : UInt,
);

alias MorxContextualSubtable = Struct_MorxContextualSubtable;

record Struct_MorxLigatureSubtable (
    header : STXHeader,
    ligatureActionTableOffset : UInt,
    componentTableOffset : UInt,
    ligatureTableOffset : UInt,
);

alias MorxLigatureSubtable = Struct_MorxLigatureSubtable;

record Struct_MorxInsertionSubtable (
    header : STXHeader,
    insertionGlyphTableOffset : UInt,
);

alias MorxInsertionSubtable = Struct_MorxInsertionSubtable;

alias MorxSpecificSubtable = AUnionType;

record Struct_MorxSubtable (
    length : UInt,
    coverage : UInt,
    flags : UInt,
    u : MorxSpecificSubtable,
);

alias MorxSubtable = Struct_MorxSubtable;

record Struct_MorxChain (
    defaultFlags : UInt,
    length : UInt,
    nFeatures : UInt,
    nSubtables : UInt,
    featureEntries : Array[MortFeatureEntry,1],
);

alias MorxChain = Struct_MorxChain;

record Struct_MorxTable (
    version : Int,
    nChains : UInt,
    chains : Array[MorxChain,1],
);

alias MorxTable = Struct_MorxTable;

alias kPROPTag = 1886547824;
alias kPROPCurrentVersion = 196608;
alias kPROPPairOffsetShift = 8;
alias kPROPPairOffsetSign = 7;
alias kPROPIsFloaterMask = 32768;
alias kPROPCanHangLTMask = 16384;
alias kPROPCanHangRBMask = 8192;
alias kPROPUseRLPairMask = 4096;
alias kPROPPairOffsetMask = 3840;
alias kPROPRightConnectMask = 128;
alias kPROPZeroReserved = 96;
alias kPROPDirectionMask = 31;

alias kPROPLDirectionClass = 0;
alias kPROPRDirectionClass = 1;
alias kPROPALDirectionClass = 2;
alias kPROPENDirectionClass = 3;
alias kPROPESDirectionClass = 4;
alias kPROPETDirectionClass = 5;
alias kPROPANDirectionClass = 6;
alias kPROPCSDirectionClass = 7;
alias kPROPPSDirectionClass = 8;
alias kPROPSDirectionClass = 9;
alias kPROPWSDirectionClass = 10;
alias kPROPONDirectionClass = 11;
alias kPROPSENDirectionClass = 12;
alias kPROPLREDirectionClass = 13;
alias kPROPLRODirectionClass = 14;
alias kPROPRLEDirectionClass = 15;
alias kPROPRLODirectionClass = 16;
alias kPROPPDFDirectionClass = 17;
alias kPROPNSMDirectionClass = 18;
alias kPROPBNDirectionClass = 19;
alias kPROPNumDirectionClasses = 20;

alias PropCharProperties = UShort;

record Struct_PropTable (
    version : Int,
    format : UShort,
    defaultProps : UShort,
    lookup : SFNTLookupTable,
);

alias PropTable = Struct_PropTable;

record Struct_PropLookupSegment (
    lastGlyph : UShort,
    firstGlyph : UShort,
    value : UShort,
);

alias PropLookupSegment = Struct_PropLookupSegment;

record Struct_PropLookupSingle (
    glyph : UShort,
    props : UShort,
);

alias PropLookupSingle = Struct_PropLookupSingle;

alias kTRAKTag = 1953653099;
alias kTRAKCurrentVersion = 65536;
alias kTRAKUniformFormat = 0;

alias TrakValue = Short;

record Struct_TrakTableEntry (
    track : Int,
    nameTableIndex : UShort,
    sizesOffset : UShort,
);

alias TrakTableEntry = Struct_TrakTableEntry;

record Struct_TrakTableData (
    nTracks : UShort,
    nSizes : UShort,
    sizeTableOffset : UInt,
    trakTable : Array[TrakTableEntry,1],
);

alias TrakTableData = Struct_TrakTableData;

record Struct_TrakTable (
    version : Int,
    format : UShort,
    horizOffset : UShort,
    vertOffset : UShort,
);

alias TrakTable = Struct_TrakTable;

alias kKERNTag = 1801810542;
alias kKERNCurrentVersion = 65536;
alias kKERNVertical = 32768;
alias kKERNResetCrossStream = 32768;
alias kKERNCrossStream = 16384;
alias kKERNVariation = 8192;
alias kKERNUnusedBits = 7936;
alias kKERNFormatMask = 255;

alias kKERNOrderedList = 0;
alias kKERNStateTable = 1;
alias kKERNSimpleArray = 2;
alias kKERNIndexArray = 3;

alias kKERNLineStart = 1;
alias kKERNLineEndKerning = 2;
alias kKERNNoCrossKerning = 4;
alias kKERNNotesRequested = 8;
alias kKERNNoStakeNote = 1;
alias kKERNCrossStreamResetNote = 2;
alias kKERNNotApplied = 1;

alias KernTableFormat = CUChar;

alias KernSubtableInfo = UShort;

alias KernKerningValue = Short;

alias KernArrayOffset = UShort;

record Struct_KernVersion0Header (
    version : UShort,
    nTables : UShort,
    firstSubtable : Array[UShort,1],
);

alias KernVersion0Header = Struct_KernVersion0Header;

record Struct_KernTableHeader (
    version : Int,
    nTables : Int,
    firstSubtable : Array[UShort,1],
);

alias KernTableHeader = Struct_KernTableHeader;

alias KernTableHeaderPtr = Pointer[KernTableHeader];

alias KernTableHeaderHandle = Pointer[KernTableHeaderPtr];

record Struct_KernKerningPair (
    left : UShort,
    right : UShort,
);

alias KernKerningPair = Struct_KernKerningPair;

record Struct_KernOrderedListEntry (
    pair : KernKerningPair,
    value : Short,
);

alias KernOrderedListEntry = Struct_KernOrderedListEntry;

alias KernOrderedListEntryPtr = Pointer[KernOrderedListEntry];

record Struct_KernOrderedListHeader (
    nPairs : UShort,
    searchRange : UShort,
    entrySelector : UShort,
    rangeShift : UShort,
    table : Array[UShort,1],
);

alias KernOrderedListHeader = Struct_KernOrderedListHeader;

record Struct_KernStateHeader (
    header : STHeader,
    valueTable : UShort,
    firstTable : Array[CUChar,1],
);

alias KernStateHeader = Struct_KernStateHeader;

record Struct_KernStateEntry (
    newState : UShort,
    flags : UShort,
);

alias KernStateEntry = Struct_KernStateEntry;

record Struct_KernOffsetTable (
    firstGlyph : UShort,
    nGlyphs : UShort,
    offsetTable : Array[UShort,1],
);

alias KernOffsetTable = Struct_KernOffsetTable;

alias KernOffsetTablePtr = Pointer[KernOffsetTable];

record Struct_KernSimpleArrayHeader (
    rowWidth : UShort,
    leftOffsetTable : UShort,
    rightOffsetTable : UShort,
    theArray : UShort,
    firstTable : Array[UShort,1],
);

alias KernSimpleArrayHeader = Struct_KernSimpleArrayHeader;

record Struct_KernIndexArrayHeader (
    glyphCount : UShort,
    kernValueCount : CUChar,
    leftClassCount : CUChar,
    rightClassCount : CUChar,
    flags : CUChar,
    kernValue : Array[Short,1],
    leftClass : Array[CUChar,1],
    rightClass : Array[CUChar,1],
    kernIndex : Array[CUChar,1],
);

alias KernIndexArrayHeader = Struct_KernIndexArrayHeader;

alias KernFormatSpecificHeader = AUnionType;

record Struct_KernVersion0SubtableHeader (
    version : UShort,
    length : UShort,
    stInfo : UShort,
    fsHeader : KernFormatSpecificHeader,
);

alias KernVersion0SubtableHeader = Struct_KernVersion0SubtableHeader;

record Struct_KernSubtableHeader (
    length : Int,
    stInfo : UShort,
    tupleIndex : Short,
    fsHeader : KernFormatSpecificHeader,
);

alias KernSubtableHeader = Struct_KernSubtableHeader;

alias KernSubtableHeaderPtr = Pointer[KernSubtableHeader];

alias kBSLNTag = 1651731566;
alias kBSLNCurrentVersion = 65536;
alias kBSLNDistanceFormatNoMap = 0;
alias kBSLNDistanceFormatWithMap = 1;
alias kBSLNControlPointFormatNoMap = 2;
alias kBSLNControlPointFormatWithMap = 3;

alias kBSLNRomanBaseline = 0;
alias kBSLNIdeographicCenterBaseline = 1;
alias kBSLNIdeographicLowBaseline = 2;
alias kBSLNHangingBaseline = 3;
alias kBSLNMathBaseline = 4;
alias kBSLNLastBaseline = 31;
alias kBSLNNumBaselineClasses = 32;
alias kBSLNNoBaselineOverride = 255;

alias BslnBaselineClass = UInt;

alias BslnBaselineRecord = Array[Int,32];

record Struct_BslnFormat0Part (
    deltas : Array[Short,32],
);

alias BslnFormat0Part = Struct_BslnFormat0Part;

record Struct_BslnFormat1Part (
    deltas : Array[Short,32],
    mappingData : SFNTLookupTable,
);

alias BslnFormat1Part = Struct_BslnFormat1Part;

record Struct_BslnFormat2Part (
    stdGlyph : UShort,
    ctlPoints : Array[Short,32],
);

alias BslnFormat2Part = Struct_BslnFormat2Part;

record Struct_BslnFormat3Part (
    stdGlyph : UShort,
    ctlPoints : Array[Short,32],
    mappingData : SFNTLookupTable,
);

alias BslnFormat3Part = Struct_BslnFormat3Part;

alias BslnFormatUnion = AUnionType;

alias BslnTableFormat = UShort;

record Struct_BslnTable (
    version : Int,
    format : UShort,
    defaultBaseline : UShort,
    parts : BslnFormatUnion,
);

alias BslnTable = Struct_BslnTable;

alias BslnTablePtr = Pointer[BslnTable];

record Struct_ALMXHeader (
    Version : Int,
    Flags : UShort,
    NMasters : UShort,
    FirstGlyph : UShort,
    LastGlyph : UShort,
    lookup : SFNTLookupTable,
);

alias ALMXHeader = Struct_ALMXHeader;

record Struct_ALMXGlyphEntry (
    GlyphIndexOffset : Short,
    HorizontalAdvance : Short,
    XOffsetToHOrigin : Short,
    VerticalAdvance : Short,
    YOffsetToVOrigin : Short,
);

alias ALMXGlyphEntry = Struct_ALMXGlyphEntry;

record Struct_ROTAHeader (
    Version : Int,
    Flags : UShort,
    NMasters : UShort,
    FirstGlyph : UShort,
    LastGlyph : UShort,
    lookup : SFNTLookupTable,
);

alias ROTAHeader = Struct_ROTAHeader;

record Struct_ROTAGlyphEntry (
    GlyphIndexOffset : Short,
    HBaselineOffset : Short,
    VBaselineOffset : Short,
);

alias ROTAGlyphEntry = Struct_ROTAGlyphEntry;

alias CGFloat = Double;

record Struct_CGPoint (
    x : Double,
    y : Double,
);

alias CGPoint = Struct_CGPoint;

record Struct_CGSize (
    width : Double,
    height : Double,
);

alias CGSize = Struct_CGSize;

record Struct_CGRect (
    origin : CGPoint,
    size : CGSize,
);

alias CGRect = Struct_CGRect;

alias CGRectMinXEdge = 0;
alias CGRectMinYEdge = 1;
alias CGRectMaxXEdge = 2;
alias CGRectMaxYEdge = 3;

alias CGRectEdge = Int;

external CGPointZero : CGPoint;

external CGSizeZero : CGSize;

external CGRectZero : CGRect;

external CGRectNull : CGRect;

external CGRectInfinite : CGRect;

external CGRectGetMinX(
    rect : CGRect) : Double;

external CGRectGetMidX(
    rect : CGRect) : Double;

external CGRectGetMaxX(
    rect : CGRect) : Double;

external CGRectGetMinY(
    rect : CGRect) : Double;

external CGRectGetMidY(
    rect : CGRect) : Double;

external CGRectGetMaxY(
    rect : CGRect) : Double;

external CGRectGetWidth(
    rect : CGRect) : Double;

external CGRectGetHeight(
    rect : CGRect) : Double;

external CGPointEqualToPoint(
    point1 : CGPoint,
    point2 : CGPoint) : Bool;

external CGSizeEqualToSize(
    size1 : CGSize,
    size2 : CGSize) : Bool;

external CGRectEqualToRect(
    rect1 : CGRect,
    rect2 : CGRect) : Bool;

external CGRectStandardize(
    rect : CGRect) : CGRect;

external CGRectIsEmpty(
    rect : CGRect) : Bool;

external CGRectIsNull(
    rect : CGRect) : Bool;

external CGRectIsInfinite(
    rect : CGRect) : Bool;

external CGRectInset(
    rect : CGRect,
    dx : Double,
    dy : Double) : CGRect;

external CGRectIntegral(
    rect : CGRect) : CGRect;

external CGRectUnion(
    r1 : CGRect,
    r2 : CGRect) : CGRect;

external CGRectIntersection(
    r1 : CGRect,
    r2 : CGRect) : CGRect;

external CGRectOffset(
    rect : CGRect,
    dx : Double,
    dy : Double) : CGRect;

external CGRectDivide(
    rect : CGRect,
    slice : Pointer[CGRect],
    remainder : Pointer[CGRect],
    amount : Double,
    edge : CGRectEdge);

external CGRectContainsPoint(
    rect : CGRect,
    point : CGPoint) : Bool;

external CGRectContainsRect(
    rect1 : CGRect,
    rect2 : CGRect) : Bool;

external CGRectIntersectsRect(
    rect1 : CGRect,
    rect2 : CGRect) : Bool;

external CGPointCreateDictionaryRepresentation(
    point : CGPoint) : CFDictionaryRef;

external CGPointMakeWithDictionaryRepresentation(
    dict : CFDictionaryRef,
    point : Pointer[CGPoint]) : Bool;

external CGSizeCreateDictionaryRepresentation(
    size : CGSize) : CFDictionaryRef;

external CGSizeMakeWithDictionaryRepresentation(
    dict : CFDictionaryRef,
    size : Pointer[CGSize]) : Bool;

external CGRectCreateDictionaryRepresentation(
    argument0 : CGRect) : CFDictionaryRef;

external CGRectMakeWithDictionaryRepresentation(
    dict : CFDictionaryRef,
    rect : Pointer[CGRect]) : Bool;

alias ATSPoint = CGPoint;

record Struct_ATSFSSpec (
    vRefNum : Short,
    parID : Int,
    name : StrFileName,
);

alias ATSFSSpec = Struct_ATSFSSpec;

alias FMGeneration = UInt;

alias FMFontFamily = Short;

alias FMFontStyle = Short;

alias FMFontSize = Short;

alias FMFont = UInt;

record Struct_FMFontFamilyInstance (
    fontFamily : Short,
    fontStyle : Short,
);

alias FMFontFamilyInstance = Struct_FMFontFamilyInstance;

record Struct_FMFontFamilyIterator (
    reserved : Array[UInt,16],
);

alias FMFontFamilyIterator = Struct_FMFontFamilyIterator;

record Struct_FMFontIterator (
    reserved : Array[UInt,16],
);

alias FMFontIterator = Struct_FMFontIterator;

record Struct_FMFontFamilyInstanceIterator (
    reserved : Array[UInt,16],
);

alias FMFontFamilyInstanceIterator = Struct_FMFontFamilyInstanceIterator;

alias kInvalidGeneration = 0;
alias kInvalidFontFamily = 4294967295;
alias kInvalidFont = 0;

alias kFMCurrentFilterFormat = 0;

alias FMFilterSelector = UInt;

alias kFMFontTechnologyFilterSelector = 1;
alias kFMFontContainerFilterSelector = 2;
alias kFMGenerationFilterSelector = 3;
alias kFMFontFamilyCallbackFilterSelector = 4;
alias kFMFontCallbackFilterSelector = 5;
alias kFMFontDirectoryFilterSelector = 6;
alias kFMFontFileRefFilterSelector = 10;

alias kFMTrueTypeFontTechnology = 1953658213;
alias kFMPostScriptFontTechnology = 1954115633;

alias FMFontFamilyCallbackFilterProcPtr = CCodePointer[[Short,RawPointer],[Int]];

alias FMFontCallbackFilterProcPtr = CCodePointer[[UInt,RawPointer],[Int]];

alias FMFontFamilyCallbackFilterUPP = FMFontFamilyCallbackFilterProcPtr;

alias FMFontCallbackFilterUPP = FMFontCallbackFilterProcPtr;

external NewFMFontFamilyCallbackFilterUPP(
    userRoutine : FMFontFamilyCallbackFilterProcPtr) : FMFontFamilyCallbackFilterUPP;

external NewFMFontCallbackFilterUPP(
    userRoutine : FMFontCallbackFilterProcPtr) : FMFontCallbackFilterUPP;

external DisposeFMFontFamilyCallbackFilterUPP(
    userUPP : FMFontFamilyCallbackFilterUPP);

external DisposeFMFontCallbackFilterUPP(
    userUPP : FMFontCallbackFilterUPP);

external InvokeFMFontFamilyCallbackFilterUPP(
    iFontFamily : Short,
    iRefCon : RawPointer,
    userUPP : FMFontFamilyCallbackFilterUPP) : Int;

external InvokeFMFontCallbackFilterUPP(
    iFont : UInt,
    iRefCon : RawPointer,
    userUPP : FMFontCallbackFilterUPP) : Int;

record Struct_FMFontDirectoryFilter (
    fontFolderDomain : Short,
    reserved : Array[UInt,2],
);

alias FMFontDirectoryFilter = Struct_FMFontDirectoryFilter;

record Struct_FMFilter (
    format : UInt,
    selector : UInt,
    filter : AUnionType,
);

alias FMFilter = Struct_FMFilter;

alias ATSOptionFlags = UInt;

alias ATSGeneration = UInt;

alias ATSFontContainerRef = UInt;

alias ATSFontFamilyRef = UInt;

alias ATSFontRef = UInt;

alias ATSGlyphRef = UShort;

alias ATSFontSize = Double;

alias ATSFontFormat = UInt;

alias kATSFontFormatUnspecified = 0;

alias kATSGenerationUnspecified = 0;
alias kATSFontContainerRefUnspecified = 0;
alias kATSFontFamilyRefUnspecified = 0;
alias kATSFontRefUnspecified = 0;

record Struct_ATSFontMetrics (
    version : UInt,
    ascent : Double,
    descent : Double,
    leading : Double,
    avgAdvanceWidth : Double,
    maxAdvanceWidth : Double,
    minLeftSideBearing : Double,
    minRightSideBearing : Double,
    stemWidth : Double,
    stemHeight : Double,
    capHeight : Double,
    xHeight : Double,
    italicAngle : Double,
    underlinePosition : Double,
    underlineThickness : Double,
);

alias ATSFontMetrics = Struct_ATSFontMetrics;

alias kATSItalicQDSkew = 16384;
alias kATSBoldQDStretch = 98304;
alias kATSRadiansFactor = 1144;

alias ATSCurveType = UShort;

alias kATSCubicCurveType = 1;
alias kATSQuadCurveType = 2;
alias kATSOtherCurveType = 3;

alias kATSDeletedGlyphcode = 65535;

record Struct_ATSUCurvePath (
    vectors : UInt,
    controlBits : Array[UInt,1],
    vector : Array[ATSPoint,1],
);

alias ATSUCurvePath = Struct_ATSUCurvePath;

record Struct_ATSUCurvePaths (
    contours : UInt,
    contour : Array[ATSUCurvePath,1],
);

alias ATSUCurvePaths = Struct_ATSUCurvePaths;

record Struct_ATSGlyphIdealMetrics (
    advance : ATSPoint,
    sideBearing : ATSPoint,
    otherSideBearing : ATSPoint,
);

alias ATSGlyphIdealMetrics = Struct_ATSGlyphIdealMetrics;

record Struct_ATSGlyphScreenMetrics (
    deviceAdvance : ATSPoint,
    topLeft : ATSPoint,
    height : UInt,
    width : UInt,
    sideBearing : ATSPoint,
    otherSideBearing : ATSPoint,
);

alias ATSGlyphScreenMetrics = Struct_ATSGlyphScreenMetrics;

alias GlyphID = UShort;

alias kATSUseGlyphAdvance = 2147483647;
alias kATSUseLineHeight = 2147483647;
alias kATSNoTracking = 2147483648;

alias kATSUseCaretOrigins = 0;
alias kATSUseDeviceOrigins = 1;
alias kATSUseFractionalOrigins = 2;
alias kATSUseOriginFlags = 3;

alias ATSULayoutOperationSelector = UInt;

alias kATSULayoutOperationNone = 0;
alias kATSULayoutOperationJustification = 1;
alias kATSULayoutOperationMorph = 2;
alias kATSULayoutOperationKerningAdjustment = 4;
alias kATSULayoutOperationBaselineAdjustment = 8;
alias kATSULayoutOperationTrackingAdjustment = 16;
alias kATSULayoutOperationPostLayoutAdjustment = 32;
alias kATSULayoutOperationAppleReserved = 4294967232;

alias ATSULayoutOperationCallbackStatus = UInt;

alias kATSULayoutOperationCallbackStatusHandled = 0;
alias kATSULayoutOperationCallbackStatusContinue = 1;

alias ATSLineLayoutOptions = UInt;

alias kATSLineNoLayoutOptions = 0;
alias kATSLineIsDisplayOnly = 1;
alias kATSLineHasNoHangers = 2;
alias kATSLineHasNoOpticalAlignment = 4;
alias kATSLineKeepSpacesOutOfMargin = 8;
alias kATSLineNoSpecialJustification = 16;
alias kATSLineLastNoJustification = 32;
alias kATSLineFractDisable = 64;
alias kATSLineImposeNoAngleForEnds = 128;
alias kATSLineFillOutToWidth = 256;
alias kATSLineTabAdjustEnabled = 512;
alias kATSLineIgnoreFontLeading = 1024;
alias kATSLineApplyAntiAliasing = 2048;
alias kATSLineNoAntiAliasing = 4096;
alias kATSLineDisableNegativeJustification = 8192;
alias kATSLineDisableAutoAdjustDisplayPos = 16384;
alias kATSLineUseQDRendering = 32768;
alias kATSLineDisableAllJustification = 65536;
alias kATSLineDisableAllGlyphMorphing = 131072;
alias kATSLineDisableAllKerningAdjustments = 262144;
alias kATSLineDisableAllBaselineAdjustments = 524288;
alias kATSLineDisableAllTrackingAdjustments = 1048576;
alias kATSLineDisableAllLayoutOperations = 2031616;
alias kATSLineUseDeviceMetrics = 16777216;
alias kATSLineBreakToNearestCharacter = 33554432;
alias kATSLineAppleReserved = 4242538496;

alias ATSStyleRenderingOptions = UInt;

alias kATSStyleNoOptions = 0;
alias kATSStyleNoHinting = 1;
alias kATSStyleApplyAntiAliasing = 2;
alias kATSStyleNoAntiAliasing = 4;
alias kATSStyleAppleReserved = 4294967288;
alias kATSStyleApplyHints = 0;

alias ATSGlyphInfoFlags = UInt;

alias kATSGlyphInfoAppleReserved = 536608744;
alias kATSGlyphInfoIsAttachment = 2147483648;
alias kATSGlyphInfoIsLTHanger = 1073741824;
alias kATSGlyphInfoIsRBHanger = 536870912;
alias kATSGlyphInfoTerminatorGlyph = 524288;
alias kATSGlyphInfoIsWhiteSpace = 262144;
alias kATSGlyphInfoHasImposedWidth = 16;
alias kATSGlyphInfoByteSizeMask = 7;

record Struct_ATSLayoutRecord (
    glyphID : UShort,
    flags : UInt,
    originalOffset : CULong,
    realPos : Int,
);

alias ATSLayoutRecord = Struct_ATSLayoutRecord;

record Struct_ATSTrapezoid (
    upperLeft : FixedPoint,
    upperRight : FixedPoint,
    lowerRight : FixedPoint,
    lowerLeft : FixedPoint,
);

alias ATSTrapezoid = Struct_ATSTrapezoid;

record Struct_ATSJustWidthDeltaEntryOverride (
    beforeGrowLimit : Int,
    beforeShrinkLimit : Int,
    afterGrowLimit : Int,
    afterShrinkLimit : Int,
    growFlags : UShort,
    shrinkFlags : UShort,
);

alias ATSJustWidthDeltaEntryOverride = Struct_ATSJustWidthDeltaEntryOverride;

alias ATSJustPriorityWidthDeltaOverrides = Array[ATSJustWidthDeltaEntryOverride,4];

alias ATSULineRef = OpaquePointer;

alias ATSUDirectLayoutOperationOverrideProcPtr = CCodePointer[[UInt,OpaquePointer,RawPointer,RawPointer,Pointer[UInt]],[Int]];

alias ATSUDirectLayoutOperationOverrideUPP = ATSUDirectLayoutOperationOverrideProcPtr;

external NewATSUDirectLayoutOperationOverrideUPP(
    userRoutine : ATSUDirectLayoutOperationOverrideProcPtr) : ATSUDirectLayoutOperationOverrideUPP;

external DisposeATSUDirectLayoutOperationOverrideUPP(
    userUPP : ATSUDirectLayoutOperationOverrideUPP);

external InvokeATSUDirectLayoutOperationOverrideUPP(
    iCurrentOperation : UInt,
    iLineRef : ATSULineRef,
    iRefCon : URefCon,
    iOperationCallbackParameterPtr : RawPointer,
    oCallbackStatus : Pointer[UInt],
    userUPP : ATSUDirectLayoutOperationOverrideUPP) : Int;

record Struct_ATSULayoutOperationOverrideSpecifier (
    operationSelector : UInt,
    overrideUPP : ATSUDirectLayoutOperationOverrideUPP,
);

alias ATSULayoutOperationOverrideSpecifier = Struct_ATSULayoutOperationOverrideSpecifier;

record Struct_sfntDirectoryEntry (
    tableTag : UInt,
    checkSum : UInt,
    offset : UInt,
    length : UInt,
);

alias sfntDirectoryEntry = Struct_sfntDirectoryEntry;

record Struct_sfntDirectory (
    format : UInt,
    numOffsets : UShort,
    searchRange : UShort,
    entrySelector : UShort,
    rangeShift : UShort,
    table : Array[sfntDirectoryEntry,1],
);

alias sfntDirectory = Struct_sfntDirectory;

alias sizeof_sfntDirectory = 12;

alias cmapFontTableTag = 1668112752;

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

alias kFontUnicodeDefaultSemantics = 0;
alias kFontUnicodeV1_1Semantics = 1;
alias kFontISO10646_1993Semantics = 2;
alias kFontUnicodeV2_0BMPOnlySemantics = 3;
alias kFontUnicodeV2_0FullCoverageSemantics = 4;
alias kFontUnicodeV4_0VariationSequenceSemantics = 5;

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

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

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

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

alias kFontNoPlatformCode = 4294967295;
alias kFontNoScriptCode = 4294967295;
alias kFontNoLanguageCode = 4294967295;

record Struct_sfntCMapSubHeader (
    format : UShort,
    length : UShort,
    languageID : UShort,
);

alias sfntCMapSubHeader = Struct_sfntCMapSubHeader;

alias sizeof_sfntCMapSubHeader = 6;

record Struct_sfntCMapExtendedSubHeader (
    format : UShort,
    reserved : UShort,
    length : UInt,
    language : UInt,
);

alias sfntCMapExtendedSubHeader = Struct_sfntCMapExtendedSubHeader;

alias sizeof_sfntCMapExtendedSubHeader = 12;

record Struct_sfntCMapEncoding (
    platformID : UShort,
    scriptID : UShort,
    offset : UInt,
);

alias sfntCMapEncoding = Struct_sfntCMapEncoding;

alias sizeof_sfntCMapEncoding = 8;

record Struct_sfntCMapHeader (
    version : UShort,
    numTables : UShort,
    encoding : Array[sfntCMapEncoding,1],
);

alias sfntCMapHeader = Struct_sfntCMapHeader;

alias sizeof_sfntCMapHeader = 4;

alias nameFontTableTag = 1851878757;

alias kFontCopyrightName = 0;
alias kFontFamilyName = 1;
alias kFontStyleName = 2;
alias kFontUniqueName = 3;
alias kFontFullName = 4;
alias kFontVersionName = 5;
alias kFontPostscriptName = 6;
alias kFontTrademarkName = 7;
alias kFontManufacturerName = 8;
alias kFontDesignerName = 9;
alias kFontDescriptionName = 10;
alias kFontVendorURLName = 11;
alias kFontDesignerURLName = 12;
alias kFontLicenseDescriptionName = 13;
alias kFontLicenseInfoURLName = 14;
alias kFontPreferredFamilyName = 16;
alias kFontPreferredSubfamilyName = 17;
alias kFontMacCompatibleFullName = 18;
alias kFontSampleTextName = 19;
alias kFontPostScriptCIDName = 20;
alias kFontLastReservedName = 255;

alias kFontNoNameCode = 4294967295;

record Struct_sfntNameRecord (
    platformID : UShort,
    scriptID : UShort,
    languageID : UShort,
    nameID : UShort,
    length : UShort,
    offset : UShort,
);

alias sfntNameRecord = Struct_sfntNameRecord;

alias sizeof_sfntNameRecord = 12;

record Struct_sfntNameHeader (
    format : UShort,
    count : UShort,
    stringOffset : UShort,
    rec : Array[sfntNameRecord,1],
);

alias sfntNameHeader = Struct_sfntNameHeader;

alias sizeof_sfntNameHeader = 6;

alias variationFontTableTag = 1719034226;

record Struct_sfntVariationAxis (
    axisTag : UInt,
    minValue : Int,
    defaultValue : Int,
    maxValue : Int,
    flags : Short,
    nameID : Short,
);

alias sfntVariationAxis = Struct_sfntVariationAxis;

alias sizeof_sfntVariationAxis = 20;

record Struct_sfntInstance (
    nameID : Short,
    flags : Short,
    coord : Array[Int,1],
);

alias sfntInstance = Struct_sfntInstance;

alias sizeof_sfntInstance = 4;

record Struct_sfntVariationHeader (
    version : Int,
    offsetToData : UShort,
    countSizePairs : UShort,
    axisCount : UShort,
    axisSize : UShort,
    instanceCount : UShort,
    instanceSize : UShort,
    axis : Array[sfntVariationAxis,1],
    instance_ : Array[sfntInstance,1],
);

alias sfntVariationHeader = Struct_sfntVariationHeader;

alias sizeof_sfntVariationHeader = 16;

alias descriptorFontTableTag = 1717859171;

record Struct_sfntFontDescriptor (
    name : UInt,
    value : Int,
);

alias sfntFontDescriptor = Struct_sfntFontDescriptor;

record Struct_sfntDescriptorHeader (
    version : Int,
    descriptorCount : Int,
    descriptor : Array[sfntFontDescriptor,1],
);

alias sfntDescriptorHeader = Struct_sfntDescriptorHeader;

alias sizeof_sfntDescriptorHeader = 8;

alias featureFontTableTag = 1717920116;

record Struct_sfntFeatureName (
    featureType : UShort,
    settingCount : UShort,
    offsetToSettings : Int,
    featureFlags : UShort,
    nameID : UShort,
);

alias sfntFeatureName = Struct_sfntFeatureName;

record Struct_sfntFontFeatureSetting (
    setting : UShort,
    nameID : UShort,
);

alias sfntFontFeatureSetting = Struct_sfntFontFeatureSetting;

record Struct_sfntFontRunFeature (
    featureType : UShort,
    setting : UShort,
);

alias sfntFontRunFeature = Struct_sfntFontRunFeature;

record Struct_sfntFeatureHeader (
    version : Int,
    featureNameCount : UShort,
    featureSetCount : UShort,
    reserved : Int,
    names : Array[sfntFeatureName,1],
    settings : Array[sfntFontFeatureSetting,1],
    runs : Array[sfntFontRunFeature,1],
);

alias sfntFeatureHeader = Struct_sfntFeatureHeader;

alias os2FontTableTag = 1330851634;

alias nonGlyphID = 65535;

alias kFontNoPlatform = 4294967295;
alias kFontNoScript = 4294967295;
alias kFontNoLanguage = 4294967295;
alias kFontNoName = 4294967295;

alias FontNameCode = UInt;

alias FontPlatformCode = UInt;

alias FontScriptCode = UInt;

alias FontLanguageCode = UInt;

record Struct_FontVariation (
    name : UInt,
    value : Int,
);

alias FontVariation = Struct_FontVariation;

alias kATSOptionFlagsDefault = 0;
alias kATSOptionFlagsComposeFontPostScriptName = 1;
alias kATSOptionFlagsUseDataForkAsResourceFork = 256;
alias kATSOptionFlagsUseResourceFork = 512;
alias kATSOptionFlagsUseDataFork = 768;

alias kATSIterationCompleted = 4294966316;
alias kATSInvalidFontFamilyAccess = 4294966315;
alias kATSInvalidFontAccess = 4294966314;
alias kATSIterationScopeModified = 4294966313;
alias kATSInvalidFontTableAccess = 4294966312;
alias kATSInvalidFontContainerAccess = 4294966311;
alias kATSInvalidGlyphAccess = 4294966310;

alias ATSFontContext = UInt;

alias kATSFontContextUnspecified = 0;
alias kATSFontContextGlobal = 1;
alias kATSFontContextLocal = 2;

alias kATSOptionFlagsActivateDisabled = 32;
alias kATSOptionFlagsProcessSubdirectories = 64;
alias kATSOptionFlagsDoNotNotify = 128;
alias kATSOptionFlagsRecordPersistently = 262144;

alias kATSOptionFlagsIterateByPrecedenceMask = 32;
alias kATSOptionFlagsIncludeDisabledMask = 128;
alias kATSOptionFlagsIterationScopeMask = 28672;
alias kATSOptionFlagsDefaultScope = 0;
alias kATSOptionFlagsUnRestrictedScope = 4096;
alias kATSOptionFlagsRestrictedScope = 8192;

alias ATSFontFamilyApplierFunction = CCodePointer[[UInt,RawPointer],[Int]];

alias ATSFontApplierFunction = CCodePointer[[UInt,RawPointer],[Int]];

alias ATSFontFamilyIterator = OpaquePointer;

alias ATSFontIterator = OpaquePointer;

alias kATSFontFilterCurrentVersion = 0;

alias kATSFontFilterSelectorUnspecified = 0;
alias kATSFontFilterSelectorGeneration = 3;
alias kATSFontFilterSelectorFontFamily = 7;
alias kATSFontFilterSelectorFontFamilyApplierFunction = 8;
alias kATSFontFilterSelectorFontApplierFunction = 9;
alias kATSFileReferenceFilterSelector = 10;

alias ATSFontFilterSelector = Int;

record Struct_ATSFontFilter (
    version : UInt,
    filterSelector : ATSFontFilterSelector,
    filter : AUnionType,
);

alias ATSFontFilter = Struct_ATSFontFilter;

alias ATSFontNotificationRef = OpaquePointer;

alias ATSFontNotificationInfoRef = OpaquePointer;

alias kATSFontNotifyOptionDefault = 0;
alias kATSFontNotifyOptionReceiveWhileSuspended = 1;

alias ATSFontNotifyOption = Int;

alias kATSFontNotifyActionFontsChanged = 1;
alias kATSFontNotifyActionDirectoriesChanged = 2;

alias ATSFontNotifyAction = Int;

alias ATSNotificationCallback = CCodePointer[[OpaquePointer,RawPointer],[]];

external ATSGetGeneration() : UInt;

external ATSFontActivateFromFileReference(
    iFile : Pointer[FSRef],
    iContext : UInt,
    iFormat : UInt,
    iRefCon : RawPointer,
    iOptions : UInt,
    oContainer : Pointer[UInt]) : Int;

external ATSFontActivateFromMemory(
    iData : LogicalAddress,
    iLength : CULong,
    iContext : UInt,
    iFormat : UInt,
    iReserved : RawPointer,
    iOptions : UInt,
    oContainer : Pointer[UInt]) : Int;

external ATSFontDeactivate(
    iContainer : UInt,
    iRefCon : RawPointer,
    iOptions : UInt) : Int;

external ATSFontGetContainerFromFileReference(
    iFile : Pointer[FSRef],
    iContext : UInt,
    iOptions : UInt,
    oContainer : Pointer[UInt]) : Int;

external ATSFontGetContainer(
    iFont : UInt,
    iOptions : UInt,
    oContainer : Pointer[UInt]) : Int;

external ATSFontSetEnabled(
    iFont : UInt,
    iOptions : UInt,
    iEnabled : CUChar) : Int;

external ATSFontIsEnabled(
    iFont : UInt) : CUChar;

external ATSFontFamilyApplyFunction(
    iFunction : ATSFontFamilyApplierFunction,
    iRefCon : RawPointer) : Int;

external ATSFontFamilyIteratorCreate(
    iContext : UInt,
    iFilter : Pointer[ATSFontFilter],
    iRefCon : RawPointer,
    iOptions : UInt,
    ioIterator : Pointer[ATSFontFamilyIterator]) : Int;

external ATSFontFamilyIteratorRelease(
    ioIterator : Pointer[ATSFontFamilyIterator]) : Int;

external ATSFontFamilyIteratorReset(
    iContext : UInt,
    iFilter : Pointer[ATSFontFilter],
    iRefCon : RawPointer,
    iOptions : UInt,
    ioIterator : Pointer[ATSFontFamilyIterator]) : Int;

external ATSFontFamilyIteratorNext(
    iIterator : ATSFontFamilyIterator,
    oFamily : Pointer[UInt]) : Int;

external ATSFontFamilyFindFromName(
    iName : CFStringRef,
    iOptions : UInt) : UInt;

external ATSFontFamilyGetGeneration(
    iFamily : UInt) : UInt;

external ATSFontFamilyGetName(
    iFamily : UInt,
    iOptions : UInt,
    oName : Pointer[CFStringRef]) : Int;

external ATSFontFamilyGetEncoding(
    iFamily : UInt) : UInt;

external ATSFontApplyFunction(
    iFunction : ATSFontApplierFunction,
    iRefCon : RawPointer) : Int;

external ATSFontIteratorCreate(
    iContext : UInt,
    iFilter : Pointer[ATSFontFilter],
    iRefCon : RawPointer,
    iOptions : UInt,
    ioIterator : Pointer[ATSFontIterator]) : Int;

external ATSFontIteratorRelease(
    ioIterator : Pointer[ATSFontIterator]) : Int;

external ATSFontIteratorReset(
    iContext : UInt,
    iFilter : Pointer[ATSFontFilter],
    iRefCon : RawPointer,
    iOptions : UInt,
    ioIterator : Pointer[ATSFontIterator]) : Int;

external ATSFontIteratorNext(
    iIterator : ATSFontIterator,
    oFont : Pointer[UInt]) : Int;

external ATSFontFindFromName(
    iName : CFStringRef,
    iOptions : UInt) : UInt;

external ATSFontFindFromPostScriptName(
    iName : CFStringRef,
    iOptions : UInt) : UInt;

external ATSFontFindFromContainer(
    iContainer : UInt,
    iOptions : UInt,
    iCount : CULong,
    ioArray : Pointer[UInt],
    oCount : Pointer[CULong]) : Int;

external ATSFontGetGeneration(
    iFont : UInt) : UInt;

external ATSFontGetName(
    iFont : UInt,
    iOptions : UInt,
    oName : Pointer[CFStringRef]) : Int;

external ATSFontGetPostScriptName(
    iFont : UInt,
    iOptions : UInt,
    oName : Pointer[CFStringRef]) : Int;

external ATSFontGetTableDirectory(
    iFont : UInt,
    iBufferSize : CULong,
    ioBuffer : RawPointer,
    oSize : Pointer[CULong]) : Int;

external ATSFontGetTable(
    iFont : UInt,
    iTag : UInt,
    iOffset : CULong,
    iBufferSize : CULong,
    ioBuffer : RawPointer,
    oSize : Pointer[CULong]) : Int;

external ATSFontGetHorizontalMetrics(
    iFont : UInt,
    iOptions : UInt,
    oMetrics : Pointer[ATSFontMetrics]) : Int;

external ATSFontGetVerticalMetrics(
    iFont : UInt,
    iOptions : UInt,
    oMetrics : Pointer[ATSFontMetrics]) : Int;

external ATSFontFamilyFindFromQuickDrawName(
    iName : ConstStr255Param) : UInt;

external ATSFontFamilyGetQuickDrawName(
    iFamily : UInt,
    oName : Pointer[CUChar]) : Int;

external ATSFontGetFileReference(
    iFont : UInt,
    oFile : Pointer[FSRef]) : Int;

external ATSFontGetFontFamilyResource(
    iFont : UInt,
    iBufferSize : CULong,
    ioBuffer : RawPointer,
    oSize : Pointer[CULong]) : Int;

external ATSFontNotify(
    action : ATSFontNotifyAction,
    info : RawPointer) : Int;

external ATSFontNotificationSubscribe(
    callback : ATSNotificationCallback,
    options : ATSFontNotifyOption,
    iRefcon : RawPointer,
    oNotificationRef : Pointer[ATSFontNotificationRef]) : Int;

external ATSFontNotificationUnsubscribe(
    notificationRef : ATSFontNotificationRef) : Int;

record Struct_ATSFontQuerySourceContext (
    version : UInt,
    refCon : RawPointer,
    retain : CFAllocatorRetainCallBack,
    release : CFAllocatorReleaseCallBack,
);

alias ATSFontQuerySourceContext = Struct_ATSFontQuerySourceContext;

alias kATSQueryActivateFontMessage = 1635021665;

alias ATSFontQueryMessageID = Int;

alias ATSFontQueryCallback = CCodePointer[[Int,RawPointer,RawPointer],[RawPointer]];

external ATSCreateFontQueryRunLoopSource(
    queryOrder : CLong,
    sourceOrder : CLong,
    callout : ATSFontQueryCallback,
    context : Pointer[ATSFontQuerySourceContext]) : CFRunLoopSourceRef;

alias kATSFontAutoActivationDefault = 0;
alias kATSFontAutoActivationDisabled = 1;
alias kATSFontAutoActivationEnabled = 2;
alias kATSFontAutoActivationAsk = 4;

alias ATSFontAutoActivationSetting = UInt;

external ATSFontSetGlobalAutoActivationSetting(
    iSetting : UInt) : Int;

external ATSFontGetGlobalAutoActivationSetting() : UInt;

external ATSFontSetAutoActivationSettingForApplication(
    iSetting : UInt,
    iApplicationFileURL : CFURLRef) : Int;

external ATSFontGetAutoActivationSettingForApplication(
    iApplicationFileURL : CFURLRef) : UInt;

alias cexec68K = 1;
alias truetypeStreamType = 1;
alias type1StreamType = 2;
alias type3StreamType = 4;
alias type42StreamType = 8;
alias type42GXStreamType = 16;
alias portableStreamType = 32;
alias flattenedStreamType = 64;
alias cidType2StreamType = 128;
alias cidType0StreamType = 256;
alias type1CFFStreamType = 512;
alias evenOddModifierStreamType = 32768;
alias eexecBinaryModifierStreamType = 65536;
alias unicodeMappingModifierStreamType = 131072;
alias scalerSpecifcModifierMask = 61440;
alias streamTypeModifierMask = 4294963200;

alias scalerStreamTypeFlag = UInt;

alias downloadStreamAction = 0;
alias asciiDownloadStreamAction = 1;
alias fontSizeQueryStreamAction = 2;
alias encodingOnlyStreamAction = 3;
alias prerequisiteQueryStreamAction = 4;
alias prerequisiteItemStreamAction = 5;
alias variationQueryStreamAction = 6;
alias variationPSOperatorStreamAction = 7;

alias scalerStreamAction = Int;

alias selectAllVariations = 4294967295;

record Struct_scalerPrerequisiteItem (
    enumeration : Int,
    size : Int,
    name : Array[CUChar,1],
);

alias scalerPrerequisiteItem = Struct_scalerPrerequisiteItem;

record Struct_scalerStream (
    streamRefCon : RawPointer,
    targetVersion : Pointer[CChar],
    types : UInt,
    action : Int,
    memorySize : UInt,
    variationCount : Int,
    variations : RawPointer,
    info : AUnionType,
);

alias scalerStream = Struct_scalerStream;

record Struct_scalerStreamData (
    hexFlag : Int,
    byteCount : Int,
    data : RawPointer,
);

alias scalerStreamData = Struct_scalerStreamData;

alias CGAffineTransform = Struct_CGAffineTransform;

record Struct_CGAffineTransform (
    a : Double,
    b : Double,
    c : Double,
    d : Double,
    tx : Double,
    ty : Double,
);

external CGAffineTransformIdentity : CGAffineTransform;

external CGAffineTransformMake(
    a : Double,
    b : Double,
    c : Double,
    d : Double,
    tx : Double,
    ty : Double) : CGAffineTransform;

external CGAffineTransformMakeTranslation(
    tx : Double,
    ty : Double) : CGAffineTransform;

external CGAffineTransformMakeScale(
    sx : Double,
    sy : Double) : CGAffineTransform;

external CGAffineTransformMakeRotation(
    angle : Double) : CGAffineTransform;

external CGAffineTransformIsIdentity(
    t : CGAffineTransform) : Bool;

external CGAffineTransformTranslate(
    t : CGAffineTransform,
    tx : Double,
    ty : Double) : CGAffineTransform;

external CGAffineTransformScale(
    t : CGAffineTransform,
    sx : Double,
    sy : Double) : CGAffineTransform;

external CGAffineTransformRotate(
    t : CGAffineTransform,
    angle : Double) : CGAffineTransform;

external CGAffineTransformInvert(
    t : CGAffineTransform) : CGAffineTransform;

external CGAffineTransformConcat(
    t1 : CGAffineTransform,
    t2 : CGAffineTransform) : CGAffineTransform;

external CGAffineTransformEqualToTransform(
    t1 : CGAffineTransform,
    t2 : CGAffineTransform) : Bool;

external CGPointApplyAffineTransform(
    point : CGPoint,
    t : CGAffineTransform) : CGPoint;

external CGSizeApplyAffineTransform(
    size : CGSize,
    t : CGAffineTransform) : CGSize;

external CGRectApplyAffineTransform(
    rect : CGRect,
    t : CGAffineTransform) : CGRect;

alias CGContextRef = OpaquePointer;

alias CGColorRef = OpaquePointer;

alias CGColorSpaceRef = OpaquePointer;

alias CGDataProviderRef = OpaquePointer;

alias CGDataProviderGetBytesCallback = CCodePointer[[RawPointer,RawPointer,CULong],[CULong]];

alias CGDataProviderSkipForwardCallback = CCodePointer[[RawPointer,Int64],[Int64]];

alias CGDataProviderRewindCallback = CCodePointer[[RawPointer],[]];

alias CGDataProviderReleaseInfoCallback = CCodePointer[[RawPointer],[]];

record Struct_CGDataProviderSequentialCallbacks (
    version : UInt,
    getBytes : CGDataProviderGetBytesCallback,
    skipForward : CGDataProviderSkipForwardCallback,
    rewind : CGDataProviderRewindCallback,
    releaseInfo : CGDataProviderReleaseInfoCallback,
);

alias CGDataProviderSequentialCallbacks = Struct_CGDataProviderSequentialCallbacks;

alias CGDataProviderGetBytePointerCallback = CCodePointer[[RawPointer],[RawPointer]];

alias CGDataProviderReleaseBytePointerCallback = CCodePointer[[RawPointer,RawPointer],[]];

alias CGDataProviderGetBytesAtPositionCallback = CCodePointer[[RawPointer,RawPointer,Int64,CULong],[CULong]];

record Struct_CGDataProviderDirectCallbacks (
    version : UInt,
    getBytePointer : CGDataProviderGetBytePointerCallback,
    releaseBytePointer : CGDataProviderReleaseBytePointerCallback,
    getBytesAtPosition : CGDataProviderGetBytesAtPositionCallback,
    releaseInfo : CGDataProviderReleaseInfoCallback,
);

alias CGDataProviderDirectCallbacks = Struct_CGDataProviderDirectCallbacks;

external CGDataProviderGetTypeID() : CULong;

external CGDataProviderCreateSequential(
    info : RawPointer,
    callbacks : Pointer[CGDataProviderSequentialCallbacks]) : CGDataProviderRef;

external CGDataProviderCreateDirect(
    info : RawPointer,
    size : Int64,
    callbacks : Pointer[CGDataProviderDirectCallbacks]) : CGDataProviderRef;

alias CGDataProviderReleaseDataCallback = CCodePointer[[RawPointer,RawPointer,CULong],[]];

external CGDataProviderCreateWithData(
    info : RawPointer,
    data : RawPointer,
    size : CULong,
    releaseData : CGDataProviderReleaseDataCallback) : CGDataProviderRef;

external CGDataProviderCreateWithCFData(
    data : CFDataRef) : CGDataProviderRef;

external CGDataProviderCreateWithURL(
    url : CFURLRef) : CGDataProviderRef;

external CGDataProviderCreateWithFilename(
    filename : Pointer[CChar]) : CGDataProviderRef;

external CGDataProviderRetain(
    provider : CGDataProviderRef) : CGDataProviderRef;

external CGDataProviderRelease(
    provider : CGDataProviderRef);

external CGDataProviderCopyData(
    provider : CGDataProviderRef) : CFDataRef;

alias CGDataProviderSkipBytesCallback = CCodePointer[[RawPointer,CULong],[]];

record Struct_CGDataProviderCallbacks (
    getBytes : CGDataProviderGetBytesCallback,
    skipBytes : CGDataProviderSkipBytesCallback,
    rewind : CGDataProviderRewindCallback,
    releaseProvider : CGDataProviderReleaseInfoCallback,
);

alias CGDataProviderCallbacks = Struct_CGDataProviderCallbacks;

alias CGDataProviderGetBytesAtOffsetCallback = CCodePointer[[RawPointer,RawPointer,CULong,CULong],[CULong]];

record Struct_CGDataProviderDirectAccessCallbacks (
    getBytePointer : CGDataProviderGetBytePointerCallback,
    releaseBytePointer : CGDataProviderReleaseBytePointerCallback,
    getBytes : CGDataProviderGetBytesAtOffsetCallback,
    releaseProvider : CGDataProviderReleaseInfoCallback,
);

alias CGDataProviderDirectAccessCallbacks = Struct_CGDataProviderDirectAccessCallbacks;

external CGDataProviderCreate(
    info : RawPointer,
    callbacks : Pointer[CGDataProviderCallbacks]) : CGDataProviderRef;

external CGDataProviderCreateDirectAccess(
    info : RawPointer,
    size : CULong,
    callbacks : Pointer[CGDataProviderDirectAccessCallbacks]) : CGDataProviderRef;

alias kCGRenderingIntentDefault = 0;
alias kCGRenderingIntentAbsoluteColorimetric = 1;
alias kCGRenderingIntentRelativeColorimetric = 2;
alias kCGRenderingIntentPerceptual = 3;
alias kCGRenderingIntentSaturation = 4;

alias CGColorRenderingIntent = Int;

alias kCGColorSpaceModelUnknown = 4294967295;
alias kCGColorSpaceModelMonochrome = 0;
alias kCGColorSpaceModelRGB = 1;
alias kCGColorSpaceModelCMYK = 2;
alias kCGColorSpaceModelLab = 3;
alias kCGColorSpaceModelDeviceN = 4;
alias kCGColorSpaceModelIndexed = 5;
alias kCGColorSpaceModelPattern = 6;

alias CGColorSpaceModel = Int;

external kCGColorSpaceGenericGray : CFStringRef;

external kCGColorSpaceGenericRGB : CFStringRef;

external kCGColorSpaceGenericCMYK : CFStringRef;

external kCGColorSpaceGenericRGBLinear : CFStringRef;

external kCGColorSpaceAdobeRGB1998 : CFStringRef;

external kCGColorSpaceSRGB : CFStringRef;

external kCGColorSpaceGenericGrayGamma2_2 : CFStringRef;

external CGColorSpaceCreateDeviceGray() : CGColorSpaceRef;

external CGColorSpaceCreateDeviceRGB() : CGColorSpaceRef;

external CGColorSpaceCreateDeviceCMYK() : CGColorSpaceRef;

external CGColorSpaceCreateCalibratedGray(
    whitePoint : Pointer[Double],
    blackPoint : Pointer[Double],
    gamma : Double) : CGColorSpaceRef;

external CGColorSpaceCreateCalibratedRGB(
    whitePoint : Pointer[Double],
    blackPoint : Pointer[Double],
    gamma : Pointer[Double],
    matrix : Pointer[Double]) : CGColorSpaceRef;

external CGColorSpaceCreateLab(
    whitePoint : Pointer[Double],
    blackPoint : Pointer[Double],
    range : Pointer[Double]) : CGColorSpaceRef;

external CGColorSpaceCreateWithICCProfile(
    data : CFDataRef) : CGColorSpaceRef;

external CGColorSpaceCreateICCBased(
    nComponents : CULong,
    range : Pointer[Double],
    profile : CGDataProviderRef,
    alternate : CGColorSpaceRef) : CGColorSpaceRef;

external CGColorSpaceCreateIndexed(
    baseSpace : CGColorSpaceRef,
    lastIndex : CULong,
    colorTable : Pointer[CUChar]) : CGColorSpaceRef;

external CGColorSpaceCreatePattern(
    baseSpace : CGColorSpaceRef) : CGColorSpaceRef;

external CGColorSpaceCreateWithPlatformColorSpace(
    ref_ : RawPointer) : CGColorSpaceRef;

external CGColorSpaceCreateWithName(
    name : CFStringRef) : CGColorSpaceRef;

external CGColorSpaceRetain(
    space : CGColorSpaceRef) : CGColorSpaceRef;

external CGColorSpaceRelease(
    space : CGColorSpaceRef);

external CGColorSpaceCopyName(
    space : CGColorSpaceRef) : CFStringRef;

external CGColorSpaceGetTypeID() : CULong;

external CGColorSpaceGetNumberOfComponents(
    space : CGColorSpaceRef) : CULong;

external CGColorSpaceGetModel(
    space : CGColorSpaceRef) : CGColorSpaceModel;

external CGColorSpaceGetBaseColorSpace(
    space : CGColorSpaceRef) : CGColorSpaceRef;

external CGColorSpaceGetColorTableCount(
    space : CGColorSpaceRef) : CULong;

external CGColorSpaceGetColorTable(
    space : CGColorSpaceRef,
    table : Pointer[CUChar]);

external CGColorSpaceCopyICCProfile(
    space : CGColorSpaceRef) : CFDataRef;

alias CGPatternRef = OpaquePointer;

alias kCGPatternTilingNoDistortion = 0;
alias kCGPatternTilingConstantSpacingMinimalDistortion = 1;
alias kCGPatternTilingConstantSpacing = 2;

alias CGPatternTiling = Int;

alias CGPatternDrawPatternCallback = CCodePointer[[RawPointer,OpaquePointer],[]];

alias CGPatternReleaseInfoCallback = CCodePointer[[RawPointer],[]];

record Struct_CGPatternCallbacks (
    version : UInt,
    drawPattern : CGPatternDrawPatternCallback,
    releaseInfo : CGPatternReleaseInfoCallback,
);

alias CGPatternCallbacks = Struct_CGPatternCallbacks;

external CGPatternGetTypeID() : CULong;

external CGPatternCreate(
    info : RawPointer,
    bounds : CGRect,
    matrix : CGAffineTransform,
    xStep : Double,
    yStep : Double,
    tiling : CGPatternTiling,
    isColored : Bool,
    callbacks : Pointer[CGPatternCallbacks]) : CGPatternRef;

external CGPatternRetain(
    pattern : CGPatternRef) : CGPatternRef;

external CGPatternRelease(
    pattern : CGPatternRef);

external CGColorCreate(
    space : CGColorSpaceRef,
    components : Pointer[Double]) : CGColorRef;

external CGColorCreateGenericGray(
    gray : Double,
    alpha : Double) : CGColorRef;

external CGColorCreateGenericRGB(
    red : Double,
    green : Double,
    blue : Double,
    alpha : Double) : CGColorRef;

external CGColorCreateGenericCMYK(
    cyan : Double,
    magenta : Double,
    yellow : Double,
    black : Double,
    alpha : Double) : CGColorRef;

external CGColorGetConstantColor(
    colorName : CFStringRef) : CGColorRef;

external CGColorCreateWithPattern(
    space : CGColorSpaceRef,
    pattern : CGPatternRef,
    components : Pointer[Double]) : CGColorRef;

external CGColorCreateCopy(
    color : CGColorRef) : CGColorRef;

external CGColorCreateCopyWithAlpha(
    color : CGColorRef,
    alpha : Double) : CGColorRef;

external CGColorRetain(
    color : CGColorRef) : CGColorRef;

external CGColorRelease(
    color : CGColorRef);

external CGColorEqualToColor(
    color1 : CGColorRef,
    color2 : CGColorRef) : Bool;

external CGColorGetNumberOfComponents(
    color : CGColorRef) : CULong;

external CGColorGetComponents(
    color : CGColorRef) : Pointer[Double];

external CGColorGetAlpha(
    color : CGColorRef) : Double;

external CGColorGetColorSpace(
    color : CGColorRef) : CGColorSpaceRef;

external CGColorGetPattern(
    color : CGColorRef) : CGPatternRef;

external CGColorGetTypeID() : CULong;

external kCGColorWhite : CFStringRef;

external kCGColorBlack : CFStringRef;

external kCGColorClear : CFStringRef;

alias CGFontRef = OpaquePointer;

alias CGFontIndex = UShort;

alias CGGlyph = UShort;

alias kCGFontPostScriptFormatType1 = 1;
alias kCGFontPostScriptFormatType3 = 3;
alias kCGFontPostScriptFormatType42 = 42;

alias CGFontPostScriptFormat = Int;

alias kCGFontIndexMax = 65534;
alias kCGFontIndexInvalid = 65535;
alias kCGGlyphMax = 65534;

external CGFontGetTypeID() : CULong;

external CGFontCreateWithPlatformFont(
    platformFontReference : RawPointer) : CGFontRef;

external CGFontCreateWithDataProvider(
    provider : CGDataProviderRef) : CGFontRef;

external CGFontCreateWithFontName(
    name : CFStringRef) : CGFontRef;

external CGFontCreateCopyWithVariations(
    font : CGFontRef,
    variations : CFDictionaryRef) : CGFontRef;

external CGFontRetain(
    font : CGFontRef) : CGFontRef;

external CGFontRelease(
    font : CGFontRef);

external CGFontGetNumberOfGlyphs(
    font : CGFontRef) : CULong;

external CGFontGetUnitsPerEm(
    font : CGFontRef) : Int;

external CGFontCopyPostScriptName(
    font : CGFontRef) : CFStringRef;

external CGFontCopyFullName(
    font : CGFontRef) : CFStringRef;

external CGFontGetAscent(
    font : CGFontRef) : Int;

external CGFontGetDescent(
    font : CGFontRef) : Int;

external CGFontGetLeading(
    font : CGFontRef) : Int;

external CGFontGetCapHeight(
    font : CGFontRef) : Int;

external CGFontGetXHeight(
    font : CGFontRef) : Int;

external CGFontGetFontBBox(
    font : CGFontRef) : CGRect;

external CGFontGetItalicAngle(
    font : CGFontRef) : Double;

external CGFontGetStemV(
    font : CGFontRef) : Double;

external CGFontCopyVariationAxes(
    font : CGFontRef) : CFArrayRef;

external CGFontCopyVariations(
    font : CGFontRef) : CFDictionaryRef;

external CGFontGetGlyphAdvances(
    font : CGFontRef,
    glyphs : Pointer[UShort],
    count : CULong,
    advances : Pointer[Int]) : Bool;

external CGFontGetGlyphBBoxes(
    font : CGFontRef,
    glyphs : Pointer[UShort],
    count : CULong,
    bboxes : Pointer[CGRect]) : Bool;

external CGFontGetGlyphWithGlyphName(
    font : CGFontRef,
    name : CFStringRef) : UShort;

external CGFontCopyGlyphNameForGlyph(
    font : CGFontRef,
    glyph : UShort) : CFStringRef;

external CGFontCanCreatePostScriptSubset(
    font : CGFontRef,
    format : CGFontPostScriptFormat) : Bool;

external CGFontCreatePostScriptSubset(
    font : CGFontRef,
    subsetName : CFStringRef,
    format : CGFontPostScriptFormat,
    glyphs : Pointer[UShort],
    count : CULong,
    encoding : Pointer[UShort]) : CFDataRef;

external CGFontCreatePostScriptEncoding(
    font : CGFontRef,
    encoding : Pointer[UShort]) : CFDataRef;

external CGFontCopyTableTags(
    font : CGFontRef) : CFArrayRef;

external CGFontCopyTableForTag(
    font : CGFontRef,
    tag : UInt) : CFDataRef;

external kCGFontVariationAxisName : CFStringRef;

external kCGFontVariationAxisMinValue : CFStringRef;

external kCGFontVariationAxisMaxValue : CFStringRef;

external kCGFontVariationAxisDefaultValue : CFStringRef;

alias CGGlyphMin = 0;
alias CGGlyphMax = 65534;

alias CGGradientRef = OpaquePointer;

alias kCGGradientDrawsBeforeStartLocation = 1;
alias kCGGradientDrawsAfterEndLocation = 2;

alias CGGradientDrawingOptions = UInt;

external CGGradientGetTypeID() : CULong;

external CGGradientCreateWithColorComponents(
    space : CGColorSpaceRef,
    components : Pointer[Double],
    locations : Pointer[Double],
    count : CULong) : CGGradientRef;

external CGGradientCreateWithColors(
    space : CGColorSpaceRef,
    colors : CFArrayRef,
    locations : Pointer[Double]) : CGGradientRef;

external CGGradientRetain(
    gradient : CGGradientRef) : CGGradientRef;

external CGGradientRelease(
    gradient : CGGradientRef);

alias CGImageRef = OpaquePointer;

alias kCGImageAlphaNone = 0;
alias kCGImageAlphaPremultipliedLast = 1;
alias kCGImageAlphaPremultipliedFirst = 2;
alias kCGImageAlphaLast = 3;
alias kCGImageAlphaFirst = 4;
alias kCGImageAlphaNoneSkipLast = 5;
alias kCGImageAlphaNoneSkipFirst = 6;
alias kCGImageAlphaOnly = 7;

alias CGImageAlphaInfo = Int;

alias kCGBitmapAlphaInfoMask = 31;
alias kCGBitmapFloatComponents = 256;
alias kCGBitmapByteOrderMask = 28672;
alias kCGBitmapByteOrderDefault = 0;
alias kCGBitmapByteOrder16Little = 4096;
alias kCGBitmapByteOrder32Little = 8192;
alias kCGBitmapByteOrder16Big = 12288;
alias kCGBitmapByteOrder32Big = 16384;

alias CGBitmapInfo = UInt;

external CGImageGetTypeID() : CULong;

external CGImageCreate(
    width : CULong,
    height : CULong,
    bitsPerComponent : CULong,
    bitsPerPixel : CULong,
    bytesPerRow : CULong,
    space : CGColorSpaceRef,
    bitmapInfo : UInt,
    provider : CGDataProviderRef,
    decode : Pointer[Double],
    shouldInterpolate : Bool,
    intent : CGColorRenderingIntent) : CGImageRef;

external CGImageMaskCreate(
    width : CULong,
    height : CULong,
    bitsPerComponent : CULong,
    bitsPerPixel : CULong,
    bytesPerRow : CULong,
    provider : CGDataProviderRef,
    decode : Pointer[Double],
    shouldInterpolate : Bool) : CGImageRef;

external CGImageCreateCopy(
    image : CGImageRef) : CGImageRef;

external CGImageCreateWithJPEGDataProvider(
    source : CGDataProviderRef,
    decode : Pointer[Double],
    shouldInterpolate : Bool,
    intent : CGColorRenderingIntent) : CGImageRef;

external CGImageCreateWithPNGDataProvider(
    source : CGDataProviderRef,
    decode : Pointer[Double],
    shouldInterpolate : Bool,
    intent : CGColorRenderingIntent) : CGImageRef;

external CGImageCreateWithImageInRect(
    image : CGImageRef,
    rect : CGRect) : CGImageRef;

external CGImageCreateWithMask(
    image : CGImageRef,
    mask : CGImageRef) : CGImageRef;

external CGImageCreateWithMaskingColors(
    image : CGImageRef,
    components : Pointer[Double]) : CGImageRef;

external CGImageCreateCopyWithColorSpace(
    image : CGImageRef,
    space : CGColorSpaceRef) : CGImageRef;

external CGImageRetain(
    image : CGImageRef) : CGImageRef;

external CGImageRelease(
    image : CGImageRef);

external CGImageIsMask(
    image : CGImageRef) : Bool;

external CGImageGetWidth(
    image : CGImageRef) : CULong;

external CGImageGetHeight(
    image : CGImageRef) : CULong;

external CGImageGetBitsPerComponent(
    image : CGImageRef) : CULong;

external CGImageGetBitsPerPixel(
    image : CGImageRef) : CULong;

external CGImageGetBytesPerRow(
    image : CGImageRef) : CULong;

external CGImageGetColorSpace(
    image : CGImageRef) : CGColorSpaceRef;

external CGImageGetAlphaInfo(
    image : CGImageRef) : CGImageAlphaInfo;

external CGImageGetDataProvider(
    image : CGImageRef) : CGDataProviderRef;

external CGImageGetDecode(
    image : CGImageRef) : Pointer[Double];

external CGImageGetShouldInterpolate(
    image : CGImageRef) : Bool;

external CGImageGetRenderingIntent(
    image : CGImageRef) : CGColorRenderingIntent;

external CGImageGetBitmapInfo(
    image : CGImageRef) : UInt;

alias CGMutablePathRef = OpaquePointer;

alias CGPathRef = OpaquePointer;

external CGPathGetTypeID() : CULong;

external CGPathCreateMutable() : CGMutablePathRef;

external CGPathCreateCopy(
    path : CGPathRef) : CGPathRef;

external CGPathCreateMutableCopy(
    path : CGPathRef) : CGMutablePathRef;

external CGPathRetain(
    path : CGPathRef) : CGPathRef;

external CGPathRelease(
    path : CGPathRef);

external CGPathEqualToPath(
    path1 : CGPathRef,
    path2 : CGPathRef) : Bool;

external CGPathMoveToPoint(
    path : CGMutablePathRef,
    m : Pointer[CGAffineTransform],
    x : Double,
    y : Double);

external CGPathAddLineToPoint(
    path : CGMutablePathRef,
    m : Pointer[CGAffineTransform],
    x : Double,
    y : Double);

external CGPathAddQuadCurveToPoint(
    path : CGMutablePathRef,
    m : Pointer[CGAffineTransform],
    cpx : Double,
    cpy : Double,
    x : Double,
    y : Double);

external CGPathAddCurveToPoint(
    path : CGMutablePathRef,
    m : Pointer[CGAffineTransform],
    cp1x : Double,
    cp1y : Double,
    cp2x : Double,
    cp2y : Double,
    x : Double,
    y : Double);

external CGPathCloseSubpath(
    path : CGMutablePathRef);

external CGPathAddRect(
    path : CGMutablePathRef,
    m : Pointer[CGAffineTransform],
    rect : CGRect);

external CGPathAddRects(
    path : CGMutablePathRef,
    m : Pointer[CGAffineTransform],
    rects : Pointer[CGRect],
    count : CULong);

external CGPathAddLines(
    path : CGMutablePathRef,
    m : Pointer[CGAffineTransform],
    points : Pointer[CGPoint],
    count : CULong);

external CGPathAddEllipseInRect(
    path : CGMutablePathRef,
    m : Pointer[CGAffineTransform],
    rect : CGRect);

external CGPathAddArc(
    path : CGMutablePathRef,
    m : Pointer[CGAffineTransform],
    x : Double,
    y : Double,
    radius : Double,
    startAngle : Double,
    endAngle : Double,
    clockwise : Bool);

external CGPathAddArcToPoint(
    path : CGMutablePathRef,
    m : Pointer[CGAffineTransform],
    x1 : Double,
    y1 : Double,
    x2 : Double,
    y2 : Double,
    radius : Double);

external CGPathAddPath(
    path1 : CGMutablePathRef,
    m : Pointer[CGAffineTransform],
    path2 : CGPathRef);

external CGPathIsEmpty(
    path : CGPathRef) : Bool;

external CGPathIsRect(
    path : CGPathRef,
    rect : Pointer[CGRect]) : Bool;

external CGPathGetCurrentPoint(
    path : CGPathRef) : CGPoint;

external CGPathGetBoundingBox(
    path : CGPathRef) : CGRect;

external CGPathGetPathBoundingBox(
    path : CGPathRef) : CGRect;

external CGPathContainsPoint(
    path : CGPathRef,
    m : Pointer[CGAffineTransform],
    point : CGPoint,
    eoFill : Bool) : Bool;

alias kCGPathElementMoveToPoint = 0;
alias kCGPathElementAddLineToPoint = 1;
alias kCGPathElementAddQuadCurveToPoint = 2;
alias kCGPathElementAddCurveToPoint = 3;
alias kCGPathElementCloseSubpath = 4;

alias CGPathElementType = Int;

record Struct_CGPathElement (
    type : CGPathElementType,
    points : Pointer[CGPoint],
);

alias CGPathElement = Struct_CGPathElement;

alias CGPathApplierFunction = CCodePointer[[RawPointer,Pointer[Struct_CGPathElement]],[]];

external CGPathApply(
    path : CGPathRef,
    info : RawPointer,
    function : CGPathApplierFunction);

alias CGPDFDocumentRef = OpaquePointer;

alias CGPDFPageRef = OpaquePointer;

alias CGPDFDictionaryRef = OpaquePointer;

alias CGPDFArrayRef = OpaquePointer;

alias CGPDFBoolean = CUChar;

alias CGPDFInteger = CLong;

alias CGPDFReal = Double;

alias CGPDFObjectRef = OpaquePointer;

alias kCGPDFObjectTypeNull = 1;
alias kCGPDFObjectTypeBoolean = 2;
alias kCGPDFObjectTypeInteger = 3;
alias kCGPDFObjectTypeReal = 4;
alias kCGPDFObjectTypeName = 5;
alias kCGPDFObjectTypeString = 6;
alias kCGPDFObjectTypeArray = 7;
alias kCGPDFObjectTypeDictionary = 8;
alias kCGPDFObjectTypeStream = 9;

alias CGPDFObjectType = Int;

external CGPDFObjectGetType(
    object : CGPDFObjectRef) : CGPDFObjectType;

external CGPDFObjectGetValue(
    object : CGPDFObjectRef,
    type : CGPDFObjectType,
    value : RawPointer) : Bool;

alias CGPDFStreamRef = OpaquePointer;

alias CGPDFDataFormatRaw = 0;
alias CGPDFDataFormatJPEGEncoded = 1;
alias CGPDFDataFormatJPEG2000 = 2;

alias CGPDFDataFormat = Int;

external CGPDFStreamGetDictionary(
    stream : CGPDFStreamRef) : CGPDFDictionaryRef;

external CGPDFStreamCopyData(
    stream : CGPDFStreamRef,
    format : Pointer[CGPDFDataFormat]) : CFDataRef;

alias CGPDFStringRef = OpaquePointer;

external CGPDFStringGetLength(
    string : CGPDFStringRef) : CULong;

external CGPDFStringGetBytePtr(
    string : CGPDFStringRef) : Pointer[CUChar];

external CGPDFStringCopyTextString(
    string : CGPDFStringRef) : CFStringRef;

external CGPDFStringCopyDate(
    string : CGPDFStringRef) : CFDateRef;

external CGPDFArrayGetCount(
    array : CGPDFArrayRef) : CULong;

external CGPDFArrayGetObject(
    array : CGPDFArrayRef,
    index : CULong,
    value : Pointer[CGPDFObjectRef]) : Bool;

external CGPDFArrayGetNull(
    array : CGPDFArrayRef,
    index : CULong) : Bool;

external CGPDFArrayGetBoolean(
    array : CGPDFArrayRef,
    index : CULong,
    value : Pointer[CUChar]) : Bool;

external CGPDFArrayGetInteger(
    array : CGPDFArrayRef,
    index : CULong,
    value : Pointer[CLong]) : Bool;

external CGPDFArrayGetNumber(
    array : CGPDFArrayRef,
    index : CULong,
    value : Pointer[Double]) : Bool;

external CGPDFArrayGetName(
    array : CGPDFArrayRef,
    index : CULong,
    value : Pointer[Pointer[CChar]]) : Bool;

external CGPDFArrayGetString(
    array : CGPDFArrayRef,
    index : CULong,
    value : Pointer[CGPDFStringRef]) : Bool;

external CGPDFArrayGetArray(
    array : CGPDFArrayRef,
    index : CULong,
    value : Pointer[CGPDFArrayRef]) : Bool;

external CGPDFArrayGetDictionary(
    array : CGPDFArrayRef,
    index : CULong,
    value : Pointer[CGPDFDictionaryRef]) : Bool;

external CGPDFArrayGetStream(
    array : CGPDFArrayRef,
    index : CULong,
    value : Pointer[CGPDFStreamRef]) : Bool;

external CGPDFDictionaryGetCount(
    dict : CGPDFDictionaryRef) : CULong;

external CGPDFDictionaryGetObject(
    dict : CGPDFDictionaryRef,
    key : Pointer[CChar],
    value : Pointer[CGPDFObjectRef]) : Bool;

external CGPDFDictionaryGetBoolean(
    dict : CGPDFDictionaryRef,
    key : Pointer[CChar],
    value : Pointer[CUChar]) : Bool;

external CGPDFDictionaryGetInteger(
    dict : CGPDFDictionaryRef,
    key : Pointer[CChar],
    value : Pointer[CLong]) : Bool;

external CGPDFDictionaryGetNumber(
    dict : CGPDFDictionaryRef,
    key : Pointer[CChar],
    value : Pointer[Double]) : Bool;

external CGPDFDictionaryGetName(
    dict : CGPDFDictionaryRef,
    key : Pointer[CChar],
    value : Pointer[Pointer[CChar]]) : Bool;

external CGPDFDictionaryGetString(
    dict : CGPDFDictionaryRef,
    key : Pointer[CChar],
    value : Pointer[CGPDFStringRef]) : Bool;

external CGPDFDictionaryGetArray(
    dict : CGPDFDictionaryRef,
    key : Pointer[CChar],
    value : Pointer[CGPDFArrayRef]) : Bool;

external CGPDFDictionaryGetDictionary(
    dict : CGPDFDictionaryRef,
    key : Pointer[CChar],
    value : Pointer[CGPDFDictionaryRef]) : Bool;

external CGPDFDictionaryGetStream(
    dict : CGPDFDictionaryRef,
    key : Pointer[CChar],
    value : Pointer[CGPDFStreamRef]) : Bool;

alias CGPDFDictionaryApplierFunction = CCodePointer[[Pointer[CChar],OpaquePointer,RawPointer],[]];

external CGPDFDictionaryApplyFunction(
    dict : CGPDFDictionaryRef,
    function : CGPDFDictionaryApplierFunction,
    info : RawPointer);

alias kCGPDFMediaBox = 0;
alias kCGPDFCropBox = 1;
alias kCGPDFBleedBox = 2;
alias kCGPDFTrimBox = 3;
alias kCGPDFArtBox = 4;

alias CGPDFBox = Int;

external CGPDFPageRetain(
    page : CGPDFPageRef) : CGPDFPageRef;

external CGPDFPageRelease(
    page : CGPDFPageRef);

external CGPDFPageGetDocument(
    page : CGPDFPageRef) : CGPDFDocumentRef;

external CGPDFPageGetPageNumber(
    page : CGPDFPageRef) : CULong;

external CGPDFPageGetBoxRect(
    page : CGPDFPageRef,
    box : CGPDFBox) : CGRect;

external CGPDFPageGetRotationAngle(
    page : CGPDFPageRef) : Int;

external CGPDFPageGetDrawingTransform(
    page : CGPDFPageRef,
    box : CGPDFBox,
    rect : CGRect,
    rotate : Int,
    preserveAspectRatio : Bool) : CGAffineTransform;

external CGPDFPageGetDictionary(
    page : CGPDFPageRef) : CGPDFDictionaryRef;

external CGPDFPageGetTypeID() : CULong;

external CGPDFDocumentCreateWithProvider(
    provider : CGDataProviderRef) : CGPDFDocumentRef;

external CGPDFDocumentCreateWithURL(
    url : CFURLRef) : CGPDFDocumentRef;

external CGPDFDocumentRetain(
    document : CGPDFDocumentRef) : CGPDFDocumentRef;

external CGPDFDocumentRelease(
    document : CGPDFDocumentRef);

external CGPDFDocumentGetVersion(
    document : CGPDFDocumentRef,
    majorVersion : Pointer[Int],
    minorVersion : Pointer[Int]);

external CGPDFDocumentIsEncrypted(
    document : CGPDFDocumentRef) : Bool;

external CGPDFDocumentUnlockWithPassword(
    document : CGPDFDocumentRef,
    password : Pointer[CChar]) : Bool;

external CGPDFDocumentIsUnlocked(
    document : CGPDFDocumentRef) : Bool;

external CGPDFDocumentAllowsPrinting(
    document : CGPDFDocumentRef) : Bool;

external CGPDFDocumentAllowsCopying(
    document : CGPDFDocumentRef) : Bool;

external CGPDFDocumentGetNumberOfPages(
    document : CGPDFDocumentRef) : CULong;

external CGPDFDocumentGetPage(
    document : CGPDFDocumentRef,
    pageNumber : CULong) : CGPDFPageRef;

external CGPDFDocumentGetCatalog(
    document : CGPDFDocumentRef) : CGPDFDictionaryRef;

external CGPDFDocumentGetInfo(
    document : CGPDFDocumentRef) : CGPDFDictionaryRef;

external CGPDFDocumentGetID(
    document : CGPDFDocumentRef) : CGPDFArrayRef;

external CGPDFDocumentGetTypeID() : CULong;

external CGPDFDocumentGetMediaBox(
    document : CGPDFDocumentRef,
    page : Int) : CGRect;

external CGPDFDocumentGetCropBox(
    document : CGPDFDocumentRef,
    page : Int) : CGRect;

external CGPDFDocumentGetBleedBox(
    document : CGPDFDocumentRef,
    page : Int) : CGRect;

external CGPDFDocumentGetTrimBox(
    document : CGPDFDocumentRef,
    page : Int) : CGRect;

external CGPDFDocumentGetArtBox(
    document : CGPDFDocumentRef,
    page : Int) : CGRect;

external CGPDFDocumentGetRotationAngle(
    document : CGPDFDocumentRef,
    page : Int) : Int;

alias CGFunctionRef = OpaquePointer;

alias CGFunctionEvaluateCallback = CCodePointer[[RawPointer,Pointer[Double],Pointer[Double]],[]];

alias CGFunctionReleaseInfoCallback = CCodePointer[[RawPointer],[]];

record Struct_CGFunctionCallbacks (
    version : UInt,
    evaluate : CGFunctionEvaluateCallback,
    releaseInfo : CGFunctionReleaseInfoCallback,
);

alias CGFunctionCallbacks = Struct_CGFunctionCallbacks;

external CGFunctionGetTypeID() : CULong;

external CGFunctionCreate(
    info : RawPointer,
    domainDimension : CULong,
    domain : Pointer[Double],
    rangeDimension : CULong,
    range : Pointer[Double],
    callbacks : Pointer[CGFunctionCallbacks]) : CGFunctionRef;

external CGFunctionRetain(
    function : CGFunctionRef) : CGFunctionRef;

external CGFunctionRelease(
    function : CGFunctionRef);

alias CGShadingRef = OpaquePointer;

external CGShadingGetTypeID() : CULong;

external CGShadingCreateAxial(
    space : CGColorSpaceRef,
    start : CGPoint,
    end : CGPoint,
    function : CGFunctionRef,
    extendStart : Bool,
    extendEnd : Bool) : CGShadingRef;

external CGShadingCreateRadial(
    space : CGColorSpaceRef,
    start : CGPoint,
    startRadius : Double,
    end : CGPoint,
    endRadius : Double,
    function : CGFunctionRef,
    extendStart : Bool,
    extendEnd : Bool) : CGShadingRef;

external CGShadingRetain(
    shading : CGShadingRef) : CGShadingRef;

external CGShadingRelease(
    shading : CGShadingRef);

alias kCGLineJoinMiter = 0;
alias kCGLineJoinRound = 1;
alias kCGLineJoinBevel = 2;

alias CGLineJoin = Int;

alias kCGLineCapButt = 0;
alias kCGLineCapRound = 1;
alias kCGLineCapSquare = 2;

alias CGLineCap = Int;

alias kCGPathFill = 0;
alias kCGPathEOFill = 1;
alias kCGPathStroke = 2;
alias kCGPathFillStroke = 3;
alias kCGPathEOFillStroke = 4;

alias CGPathDrawingMode = Int;

alias kCGTextFill = 0;
alias kCGTextStroke = 1;
alias kCGTextFillStroke = 2;
alias kCGTextInvisible = 3;
alias kCGTextFillClip = 4;
alias kCGTextStrokeClip = 5;
alias kCGTextFillStrokeClip = 6;
alias kCGTextClip = 7;

alias CGTextDrawingMode = Int;

alias kCGEncodingFontSpecific = 0;
alias kCGEncodingMacRoman = 1;

alias CGTextEncoding = Int;

alias kCGInterpolationDefault = 0;
alias kCGInterpolationNone = 1;
alias kCGInterpolationLow = 2;
alias kCGInterpolationMedium = 4;
alias kCGInterpolationHigh = 3;

alias CGInterpolationQuality = Int;

alias kCGBlendModeNormal = 0;
alias kCGBlendModeMultiply = 1;
alias kCGBlendModeScreen = 2;
alias kCGBlendModeOverlay = 3;
alias kCGBlendModeDarken = 4;
alias kCGBlendModeLighten = 5;
alias kCGBlendModeColorDodge = 6;
alias kCGBlendModeColorBurn = 7;
alias kCGBlendModeSoftLight = 8;
alias kCGBlendModeHardLight = 9;
alias kCGBlendModeDifference = 10;
alias kCGBlendModeExclusion = 11;
alias kCGBlendModeHue = 12;
alias kCGBlendModeSaturation = 13;
alias kCGBlendModeColor = 14;
alias kCGBlendModeLuminosity = 15;
alias kCGBlendModeClear = 16;
alias kCGBlendModeCopy = 17;
alias kCGBlendModeSourceIn = 18;
alias kCGBlendModeSourceOut = 19;
alias kCGBlendModeSourceAtop = 20;
alias kCGBlendModeDestinationOver = 21;
alias kCGBlendModeDestinationIn = 22;
alias kCGBlendModeDestinationOut = 23;
alias kCGBlendModeDestinationAtop = 24;
alias kCGBlendModeXOR = 25;
alias kCGBlendModePlusDarker = 26;
alias kCGBlendModePlusLighter = 27;

alias CGBlendMode = Int;

external CGContextGetTypeID() : CULong;

external CGContextSaveGState(
    c : CGContextRef);

external CGContextRestoreGState(
    c : CGContextRef);

external CGContextScaleCTM(
    c : CGContextRef,
    sx : Double,
    sy : Double);

external CGContextTranslateCTM(
    c : CGContextRef,
    tx : Double,
    ty : Double);

external CGContextRotateCTM(
    c : CGContextRef,
    angle : Double);

external CGContextConcatCTM(
    c : CGContextRef,
    transform : CGAffineTransform);

external CGContextGetCTM(
    c : CGContextRef) : CGAffineTransform;

external CGContextSetLineWidth(
    c : CGContextRef,
    width : Double);

external CGContextSetLineCap(
    c : CGContextRef,
    cap : CGLineCap);

external CGContextSetLineJoin(
    c : CGContextRef,
    join : CGLineJoin);

external CGContextSetMiterLimit(
    c : CGContextRef,
    limit : Double);

external CGContextSetLineDash(
    c : CGContextRef,
    phase : Double,
    lengths : Pointer[Double],
    count : CULong);

external CGContextSetFlatness(
    c : CGContextRef,
    flatness : Double);

external CGContextSetAlpha(
    c : CGContextRef,
    alpha : Double);

external CGContextSetBlendMode(
    context : CGContextRef,
    mode : CGBlendMode);

external CGContextBeginPath(
    c : CGContextRef);

external CGContextMoveToPoint(
    c : CGContextRef,
    x : Double,
    y : Double);

external CGContextAddLineToPoint(
    c : CGContextRef,
    x : Double,
    y : Double);

external CGContextAddCurveToPoint(
    c : CGContextRef,
    cp1x : Double,
    cp1y : Double,
    cp2x : Double,
    cp2y : Double,
    x : Double,
    y : Double);

external CGContextAddQuadCurveToPoint(
    c : CGContextRef,
    cpx : Double,
    cpy : Double,
    x : Double,
    y : Double);

external CGContextClosePath(
    c : CGContextRef);

external CGContextAddRect(
    c : CGContextRef,
    rect : CGRect);

external CGContextAddRects(
    c : CGContextRef,
    rects : Pointer[CGRect],
    count : CULong);

external CGContextAddLines(
    c : CGContextRef,
    points : Pointer[CGPoint],
    count : CULong);

external CGContextAddEllipseInRect(
    context : CGContextRef,
    rect : CGRect);

external CGContextAddArc(
    c : CGContextRef,
    x : Double,
    y : Double,
    radius : Double,
    startAngle : Double,
    endAngle : Double,
    clockwise : Int);

external CGContextAddArcToPoint(
    c : CGContextRef,
    x1 : Double,
    y1 : Double,
    x2 : Double,
    y2 : Double,
    radius : Double);

external CGContextAddPath(
    context : CGContextRef,
    path : CGPathRef);

external CGContextReplacePathWithStrokedPath(
    c : CGContextRef);

external CGContextIsPathEmpty(
    context : CGContextRef) : Bool;

external CGContextGetPathCurrentPoint(
    context : CGContextRef) : CGPoint;

external CGContextGetPathBoundingBox(
    context : CGContextRef) : CGRect;

external CGContextCopyPath(
    context : CGContextRef) : CGPathRef;

external CGContextPathContainsPoint(
    context : CGContextRef,
    point : CGPoint,
    mode : CGPathDrawingMode) : Bool;

external CGContextDrawPath(
    c : CGContextRef,
    mode : CGPathDrawingMode);

external CGContextFillPath(
    c : CGContextRef);

external CGContextEOFillPath(
    c : CGContextRef);

external CGContextStrokePath(
    c : CGContextRef);

external CGContextFillRect(
    c : CGContextRef,
    rect : CGRect);

external CGContextFillRects(
    c : CGContextRef,
    rects : Pointer[CGRect],
    count : CULong);

external CGContextStrokeRect(
    c : CGContextRef,
    rect : CGRect);

external CGContextStrokeRectWithWidth(
    c : CGContextRef,
    rect : CGRect,
    width : Double);

external CGContextClearRect(
    c : CGContextRef,
    rect : CGRect);

external CGContextFillEllipseInRect(
    context : CGContextRef,
    rect : CGRect);

external CGContextStrokeEllipseInRect(
    context : CGContextRef,
    rect : CGRect);

external CGContextStrokeLineSegments(
    c : CGContextRef,
    points : Pointer[CGPoint],
    count : CULong);

external CGContextClip(
    c : CGContextRef);

external CGContextEOClip(
    c : CGContextRef);

external CGContextClipToMask(
    c : CGContextRef,
    rect : CGRect,
    mask : CGImageRef);

external CGContextGetClipBoundingBox(
    c : CGContextRef) : CGRect;

external CGContextClipToRect(
    c : CGContextRef,
    rect : CGRect);

external CGContextClipToRects(
    c : CGContextRef,
    rects : Pointer[CGRect],
    count : CULong);

external CGContextSetFillColorWithColor(
    c : CGContextRef,
    color : CGColorRef);

external CGContextSetStrokeColorWithColor(
    c : CGContextRef,
    color : CGColorRef);

external CGContextSetFillColorSpace(
    context : CGContextRef,
    space : CGColorSpaceRef);

external CGContextSetStrokeColorSpace(
    context : CGContextRef,
    space : CGColorSpaceRef);

external CGContextSetFillColor(
    context : CGContextRef,
    components : Pointer[Double]);

external CGContextSetStrokeColor(
    context : CGContextRef,
    components : Pointer[Double]);

external CGContextSetFillPattern(
    context : CGContextRef,
    pattern : CGPatternRef,
    components : Pointer[Double]);

external CGContextSetStrokePattern(
    context : CGContextRef,
    pattern : CGPatternRef,
    components : Pointer[Double]);

external CGContextSetPatternPhase(
    context : CGContextRef,
    phase : CGSize);

external CGContextSetGrayFillColor(
    context : CGContextRef,
    gray : Double,
    alpha : Double);

external CGContextSetGrayStrokeColor(
    context : CGContextRef,
    gray : Double,
    alpha : Double);

external CGContextSetRGBFillColor(
    context : CGContextRef,
    red : Double,
    green : Double,
    blue : Double,
    alpha : Double);

external CGContextSetRGBStrokeColor(
    context : CGContextRef,
    red : Double,
    green : Double,
    blue : Double,
    alpha : Double);

external CGContextSetCMYKFillColor(
    context : CGContextRef,
    cyan : Double,
    magenta : Double,
    yellow : Double,
    black : Double,
    alpha : Double);

external CGContextSetCMYKStrokeColor(
    context : CGContextRef,
    cyan : Double,
    magenta : Double,
    yellow : Double,
    black : Double,
    alpha : Double);

external CGContextSetRenderingIntent(
    context : CGContextRef,
    intent : CGColorRenderingIntent);

external CGContextDrawImage(
    c : CGContextRef,
    rect : CGRect,
    image : CGImageRef);

external CGContextDrawTiledImage(
    c : CGContextRef,
    rect : CGRect,
    image : CGImageRef);

external CGContextGetInterpolationQuality(
    context : CGContextRef) : CGInterpolationQuality;

external CGContextSetInterpolationQuality(
    context : CGContextRef,
    quality : CGInterpolationQuality);

external CGContextSetShadowWithColor(
    context : CGContextRef,
    offset : CGSize,
    blur : Double,
    color : CGColorRef);

external CGContextSetShadow(
    context : CGContextRef,
    offset : CGSize,
    blur : Double);

external CGContextDrawLinearGradient(
    context : CGContextRef,
    gradient : CGGradientRef,
    startPoint : CGPoint,
    endPoint : CGPoint,
    options : UInt);

external CGContextDrawRadialGradient(
    context : CGContextRef,
    gradient : CGGradientRef,
    startCenter : CGPoint,
    startRadius : Double,
    endCenter : CGPoint,
    endRadius : Double,
    options : UInt);

external CGContextDrawShading(
    context : CGContextRef,
    shading : CGShadingRef);

external CGContextSetCharacterSpacing(
    context : CGContextRef,
    spacing : Double);

external CGContextSetTextPosition(
    c : CGContextRef,
    x : Double,
    y : Double);

external CGContextGetTextPosition(
    context : CGContextRef) : CGPoint;

external CGContextSetTextMatrix(
    c : CGContextRef,
    t : CGAffineTransform);

external CGContextGetTextMatrix(
    c : CGContextRef) : CGAffineTransform;

external CGContextSetTextDrawingMode(
    c : CGContextRef,
    mode : CGTextDrawingMode);

external CGContextSetFont(
    c : CGContextRef,
    font : CGFontRef);

external CGContextSetFontSize(
    c : CGContextRef,
    size : Double);

external CGContextSelectFont(
    c : CGContextRef,
    name : Pointer[CChar],
    size : Double,
    textEncoding : CGTextEncoding);

external CGContextShowGlyphsAtPositions(
    context : CGContextRef,
    glyphs : Pointer[UShort],
    positions : Pointer[CGPoint],
    count : CULong);

external CGContextShowText(
    c : CGContextRef,
    string : Pointer[CChar],
    length : CULong);

external CGContextShowTextAtPoint(
    c : CGContextRef,
    x : Double,
    y : Double,
    string : Pointer[CChar],
    length : CULong);

external CGContextShowGlyphs(
    c : CGContextRef,
    g : Pointer[UShort],
    count : CULong);

external CGContextShowGlyphsAtPoint(
    context : CGContextRef,
    x : Double,
    y : Double,
    glyphs : Pointer[UShort],
    count : CULong);

external CGContextShowGlyphsWithAdvances(
    c : CGContextRef,
    glyphs : Pointer[UShort],
    advances : Pointer[CGSize],
    count : CULong);

external CGContextDrawPDFPage(
    c : CGContextRef,
    page : CGPDFPageRef);

external CGContextDrawPDFDocument(
    c : CGContextRef,
    rect : CGRect,
    document : CGPDFDocumentRef,
    page : Int);

external CGContextBeginPage(
    c : CGContextRef,
    mediaBox : Pointer[CGRect]);

external CGContextEndPage(
    c : CGContextRef);

external CGContextRetain(
    c : CGContextRef) : CGContextRef;

external CGContextRelease(
    c : CGContextRef);

external CGContextFlush(
    c : CGContextRef);

external CGContextSynchronize(
    c : CGContextRef);

external CGContextSetShouldAntialias(
    context : CGContextRef,
    shouldAntialias : Bool);

external CGContextSetAllowsAntialiasing(
    context : CGContextRef,
    allowsAntialiasing : Bool);

external CGContextSetShouldSmoothFonts(
    context : CGContextRef,
    shouldSmoothFonts : Bool);

external CGContextSetAllowsFontSmoothing(
    context : CGContextRef,
    allowsFontSmoothing : Bool);

external CGContextSetShouldSubpixelPositionFonts(
    context : CGContextRef,
    shouldSubpixelPositionFonts : Bool);

external CGContextSetAllowsFontSubpixelPositioning(
    context : CGContextRef,
    allowsFontSubpixelPositioning : Bool);

external CGContextSetShouldSubpixelQuantizeFonts(
    context : CGContextRef,
    shouldSubpixelQuantizeFonts : Bool);

external CGContextSetAllowsFontSubpixelQuantization(
    context : CGContextRef,
    allowsFontSubpixelQuantization : Bool);

external CGContextBeginTransparencyLayer(
    context : CGContextRef,
    auxiliaryInfo : CFDictionaryRef);

external CGContextBeginTransparencyLayerWithRect(
    context : CGContextRef,
    rect : CGRect,
    auxiliaryInfo : CFDictionaryRef);

external CGContextEndTransparencyLayer(
    context : CGContextRef);

external CGContextGetUserSpaceToDeviceSpaceTransform(
    context : CGContextRef) : CGAffineTransform;

external CGContextConvertPointToDeviceSpace(
    context : CGContextRef,
    point : CGPoint) : CGPoint;

external CGContextConvertPointToUserSpace(
    context : CGContextRef,
    point : CGPoint) : CGPoint;

external CGContextConvertSizeToDeviceSpace(
    context : CGContextRef,
    size : CGSize) : CGSize;

external CGContextConvertSizeToUserSpace(
    context : CGContextRef,
    size : CGSize) : CGSize;

external CGContextConvertRectToDeviceSpace(
    context : CGContextRef,
    rect : CGRect) : CGRect;

external CGContextConvertRectToUserSpace(
    context : CGContextRef,
    rect : CGRect) : CGRect;

alias CGBitmapContextReleaseDataCallback = CCodePointer[[RawPointer,RawPointer],[]];

external CGBitmapContextCreateWithData(
    data : RawPointer,
    width : CULong,
    height : CULong,
    bitsPerComponent : CULong,
    bytesPerRow : CULong,
    space : CGColorSpaceRef,
    bitmapInfo : UInt,
    releaseCallback : CGBitmapContextReleaseDataCallback,
    releaseInfo : RawPointer) : CGContextRef;

external CGBitmapContextCreate(
    data : RawPointer,
    width : CULong,
    height : CULong,
    bitsPerComponent : CULong,
    bytesPerRow : CULong,
    space : CGColorSpaceRef,
    bitmapInfo : UInt) : CGContextRef;

external CGBitmapContextGetData(
    context : CGContextRef) : RawPointer;

external CGBitmapContextGetWidth(
    context : CGContextRef) : CULong;

external CGBitmapContextGetHeight(
    context : CGContextRef) : CULong;

external CGBitmapContextGetBitsPerComponent(
    context : CGContextRef) : CULong;

external CGBitmapContextGetBitsPerPixel(
    context : CGContextRef) : CULong;

external CGBitmapContextGetBytesPerRow(
    context : CGContextRef) : CULong;

external CGBitmapContextGetColorSpace(
    context : CGContextRef) : CGColorSpaceRef;

external CGBitmapContextGetAlphaInfo(
    context : CGContextRef) : CGImageAlphaInfo;

external CGBitmapContextGetBitmapInfo(
    context : CGContextRef) : UInt;

external CGBitmapContextCreateImage(
    context : CGContextRef) : CGImageRef;

alias CGDataConsumerRef = OpaquePointer;

alias CGDataConsumerPutBytesCallback = CCodePointer[[RawPointer,RawPointer,CULong],[CULong]];

alias CGDataConsumerReleaseInfoCallback = CCodePointer[[RawPointer],[]];

record Struct_CGDataConsumerCallbacks (
    putBytes : CGDataConsumerPutBytesCallback,
    releaseConsumer : CGDataConsumerReleaseInfoCallback,
);

alias CGDataConsumerCallbacks = Struct_CGDataConsumerCallbacks;

external CGDataConsumerGetTypeID() : CULong;

external CGDataConsumerCreate(
    info : RawPointer,
    callbacks : Pointer[CGDataConsumerCallbacks]) : CGDataConsumerRef;

external CGDataConsumerCreateWithURL(
    url : CFURLRef) : CGDataConsumerRef;

external CGDataConsumerCreateWithCFData(
    data : CFMutableDataRef) : CGDataConsumerRef;

external CGDataConsumerRetain(
    consumer : CGDataConsumerRef) : CGDataConsumerRef;

external CGDataConsumerRelease(
    consumer : CGDataConsumerRef);

alias kCGErrorSuccess = 0;
alias kCGErrorFailure = 1000;
alias kCGErrorIllegalArgument = 1001;
alias kCGErrorInvalidConnection = 1002;
alias kCGErrorInvalidContext = 1003;
alias kCGErrorCannotComplete = 1004;
alias kCGErrorNotImplemented = 1006;
alias kCGErrorRangeCheck = 1007;
alias kCGErrorTypeCheck = 1008;
alias kCGErrorInvalidOperation = 1010;
alias kCGErrorNoneAvailable = 1011;
alias kCGErrorNameTooLong = 1005;
alias kCGErrorNoCurrentPoint = 1009;
alias kCGErrorApplicationRequiresNewerSystem = 1015;
alias kCGErrorApplicationNotPermittedToExecute = 1016;
alias kCGErrorApplicationIncorrectExecutableFormatFound = 1023;
alias kCGErrorApplicationIsLaunching = 1024;
alias kCGErrorApplicationAlreadyRunning = 1025;
alias kCGErrorApplicationCanOnlyBeRunInOneSessionAtATime = 1026;
alias kCGErrorClassicApplicationsMustBeLaunchedByClassic = 1027;
alias kCGErrorForkFailed = 1028;
alias kCGErrorRetryRegistration = 1029;
alias kCGErrorFirst = 1000;
alias kCGErrorLast = 1029;

alias CGError = Int;

alias CGLayerRef = OpaquePointer;

external CGLayerCreateWithContext(
    context : CGContextRef,
    size : CGSize,
    auxiliaryInfo : CFDictionaryRef) : CGLayerRef;

external CGLayerRetain(
    layer : CGLayerRef) : CGLayerRef;

external CGLayerRelease(
    layer : CGLayerRef);

external CGLayerGetSize(
    layer : CGLayerRef) : CGSize;

external CGLayerGetContext(
    layer : CGLayerRef) : CGContextRef;

external CGContextDrawLayerInRect(
    context : CGContextRef,
    rect : CGRect,
    layer : CGLayerRef);

external CGContextDrawLayerAtPoint(
    context : CGContextRef,
    point : CGPoint,
    layer : CGLayerRef);

external CGLayerGetTypeID() : CULong;

alias CGPDFContentStreamRef = OpaquePointer;

external CGPDFContentStreamCreateWithPage(
    page : CGPDFPageRef) : CGPDFContentStreamRef;

external CGPDFContentStreamCreateWithStream(
    stream : CGPDFStreamRef,
    streamResources : CGPDFDictionaryRef,
    parent : CGPDFContentStreamRef) : CGPDFContentStreamRef;

external CGPDFContentStreamRetain(
    cs : CGPDFContentStreamRef) : CGPDFContentStreamRef;

external CGPDFContentStreamRelease(
    cs : CGPDFContentStreamRef);

external CGPDFContentStreamGetStreams(
    cs : CGPDFContentStreamRef) : CFArrayRef;

external CGPDFContentStreamGetResource(
    cs : CGPDFContentStreamRef,
    category : Pointer[CChar],
    name : Pointer[CChar]) : CGPDFObjectRef;

external CGPDFContextCreate(
    consumer : CGDataConsumerRef,
    mediaBox : Pointer[CGRect],
    auxiliaryInfo : CFDictionaryRef) : CGContextRef;

external CGPDFContextCreateWithURL(
    url : CFURLRef,
    mediaBox : Pointer[CGRect],
    auxiliaryInfo : CFDictionaryRef) : CGContextRef;

external CGPDFContextClose(
    context : CGContextRef);

external CGPDFContextBeginPage(
    context : CGContextRef,
    pageInfo : CFDictionaryRef);

external CGPDFContextEndPage(
    context : CGContextRef);

external CGPDFContextSetURLForRect(
    context : CGContextRef,
    url : CFURLRef,
    rect : CGRect);

external CGPDFContextAddDestinationAtPoint(
    context : CGContextRef,
    name : CFStringRef,
    point : CGPoint);

external CGPDFContextSetDestinationForRect(
    context : CGContextRef,
    name : CFStringRef,
    rect : CGRect);

external kCGPDFContextMediaBox : CFStringRef;

external kCGPDFContextCropBox : CFStringRef;

external kCGPDFContextBleedBox : CFStringRef;

external kCGPDFContextTrimBox : CFStringRef;

external kCGPDFContextArtBox : CFStringRef;

external kCGPDFContextTitle : CFStringRef;

external kCGPDFContextAuthor : CFStringRef;

external kCGPDFContextSubject : CFStringRef;

external kCGPDFContextKeywords : CFStringRef;

external kCGPDFContextCreator : CFStringRef;

external kCGPDFContextOwnerPassword : CFStringRef;

external kCGPDFContextUserPassword : CFStringRef;

external kCGPDFContextEncryptionKeyLength : CFStringRef;

external kCGPDFContextAllowsPrinting : CFStringRef;

external kCGPDFContextAllowsCopying : CFStringRef;

external kCGPDFContextOutputIntent : CFStringRef;

external kCGPDFXOutputIntentSubtype : CFStringRef;

external kCGPDFXOutputConditionIdentifier : CFStringRef;

external kCGPDFXOutputCondition : CFStringRef;

external kCGPDFXRegistryName : CFStringRef;

external kCGPDFXInfo : CFStringRef;

external kCGPDFXDestinationOutputProfile : CFStringRef;

external kCGPDFContextOutputIntents : CFStringRef;

alias CGPDFOperatorTableRef = OpaquePointer;

alias CGPDFScannerRef = OpaquePointer;

external CGPDFScannerCreate(
    cs : CGPDFContentStreamRef,
    table : CGPDFOperatorTableRef,
    info : RawPointer) : CGPDFScannerRef;

external CGPDFScannerRetain(
    scanner : CGPDFScannerRef) : CGPDFScannerRef;

external CGPDFScannerRelease(
    scanner : CGPDFScannerRef);

external CGPDFScannerScan(
    scanner : CGPDFScannerRef) : Bool;

external CGPDFScannerGetContentStream(
    scanner : CGPDFScannerRef) : CGPDFContentStreamRef;

external CGPDFScannerPopObject(
    scanner : CGPDFScannerRef,
    value : Pointer[CGPDFObjectRef]) : Bool;

external CGPDFScannerPopBoolean(
    scanner : CGPDFScannerRef,
    value : Pointer[CUChar]) : Bool;

external CGPDFScannerPopInteger(
    scanner : CGPDFScannerRef,
    value : Pointer[CLong]) : Bool;

external CGPDFScannerPopNumber(
    scanner : CGPDFScannerRef,
    value : Pointer[Double]) : Bool;

external CGPDFScannerPopName(
    scanner : CGPDFScannerRef,
    value : Pointer[Pointer[CChar]]) : Bool;

external CGPDFScannerPopString(
    scanner : CGPDFScannerRef,
    value : Pointer[CGPDFStringRef]) : Bool;

external CGPDFScannerPopArray(
    scanner : CGPDFScannerRef,
    value : Pointer[CGPDFArrayRef]) : Bool;

external CGPDFScannerPopDictionary(
    scanner : CGPDFScannerRef,
    value : Pointer[CGPDFDictionaryRef]) : Bool;

external CGPDFScannerPopStream(
    scanner : CGPDFScannerRef,
    value : Pointer[CGPDFStreamRef]) : Bool;

alias CGPDFOperatorCallback = CCodePointer[[OpaquePointer,RawPointer],[]];

external CGPDFOperatorTableCreate() : CGPDFOperatorTableRef;

external CGPDFOperatorTableRetain(
    table : CGPDFOperatorTableRef) : CGPDFOperatorTableRef;

external CGPDFOperatorTableRelease(
    table : CGPDFOperatorTableRef);

external CGPDFOperatorTableSetCallback(
    table : CGPDFOperatorTableRef,
    name : Pointer[CChar],
    callback : CGPDFOperatorCallback);

alias CGDirectDisplayID = UInt;

alias CGOpenGLDisplayMask = UInt;

alias CGRefreshRate = Double;

alias CGDirectPaletteRef = OpaquePointer;

alias CGDisplayModeRef = OpaquePointer;

external CGMainDisplayID() : UInt;

external CGGetDisplaysWithPoint(
    point : CGPoint,
    maxDisplays : UInt,
    displays : Pointer[UInt],
    matchingDisplayCount : Pointer[UInt]) : Int;

external CGGetDisplaysWithRect(
    rect : CGRect,
    maxDisplays : UInt,
    displays : Pointer[UInt],
    matchingDisplayCount : Pointer[UInt]) : Int;

external CGGetDisplaysWithOpenGLDisplayMask(
    mask : UInt,
    maxDisplays : UInt,
    displays : Pointer[UInt],
    matchingDisplayCount : Pointer[UInt]) : Int;

external CGGetActiveDisplayList(
    maxDisplays : UInt,
    activeDisplays : Pointer[UInt],
    displayCount : Pointer[UInt]) : Int;

external CGGetOnlineDisplayList(
    maxDisplays : UInt,
    onlineDisplays : Pointer[UInt],
    displayCount : Pointer[UInt]) : Int;

external CGDisplayIDToOpenGLDisplayMask(
    display : UInt) : UInt;

external CGOpenGLDisplayMaskToDisplayID(
    mask : UInt) : UInt;

external CGDisplayBounds(
    display : UInt) : CGRect;

external CGDisplayPixelsWide(
    display : UInt) : CULong;

external CGDisplayPixelsHigh(
    display : UInt) : CULong;

external CGDisplayCopyAllDisplayModes(
    display : UInt,
    options : CFDictionaryRef) : CFArrayRef;

external CGDisplayCopyDisplayMode(
    display : UInt) : CGDisplayModeRef;

external CGDisplaySetDisplayMode(
    display : UInt,
    mode : CGDisplayModeRef,
    options : CFDictionaryRef) : Int;

external CGDisplayModeGetWidth(
    mode : CGDisplayModeRef) : CULong;

external CGDisplayModeGetHeight(
    mode : CGDisplayModeRef) : CULong;

external CGDisplayModeCopyPixelEncoding(
    mode : CGDisplayModeRef) : CFStringRef;

external CGDisplayModeGetRefreshRate(
    mode : CGDisplayModeRef) : Double;

external CGDisplayModeGetIOFlags(
    mode : CGDisplayModeRef) : UInt;

external CGDisplayModeGetIODisplayModeID(
    mode : CGDisplayModeRef) : Int;

external CGDisplayModeIsUsableForDesktopGUI(
    mode : CGDisplayModeRef) : Bool;

external CGDisplayModeGetTypeID() : CULong;

external CGDisplayModeRetain(
    mode : CGDisplayModeRef) : CGDisplayModeRef;

external CGDisplayModeRelease(
    mode : CGDisplayModeRef);

alias CGGammaValue = Float;

external CGSetDisplayTransferByFormula(
    display : UInt,
    redMin : Float,
    redMax : Float,
    redGamma : Float,
    greenMin : Float,
    greenMax : Float,
    greenGamma : Float,
    blueMin : Float,
    blueMax : Float,
    blueGamma : Float) : Int;

external CGGetDisplayTransferByFormula(
    display : UInt,
    redMin : Pointer[Float],
    redMax : Pointer[Float],
    redGamma : Pointer[Float],
    greenMin : Pointer[Float],
    greenMax : Pointer[Float],
    greenGamma : Pointer[Float],
    blueMin : Pointer[Float],
    blueMax : Pointer[Float],
    blueGamma : Pointer[Float]) : Int;

external CGDisplayGammaTableCapacity(
    display : UInt) : UInt;

external CGSetDisplayTransferByTable(
    display : UInt,
    tableSize : UInt,
    redTable : Pointer[Float],
    greenTable : Pointer[Float],
    blueTable : Pointer[Float]) : Int;

external CGGetDisplayTransferByTable(
    display : UInt,
    capacity : UInt,
    redTable : Pointer[Float],
    greenTable : Pointer[Float],
    blueTable : Pointer[Float],
    sampleCount : Pointer[UInt]) : Int;

external CGSetDisplayTransferByByteTable(
    display : UInt,
    tableSize : UInt,
    redTable : Pointer[CUChar],
    greenTable : Pointer[CUChar],
    blueTable : Pointer[CUChar]) : Int;

external CGDisplayRestoreColorSyncSettings();

alias kCGCaptureNoOptions = 0;
alias kCGCaptureNoFill = 1;

alias CGCaptureOptions = UInt;

external CGDisplayIsCaptured(
    display : UInt) : UInt;

external CGDisplayCapture(
    display : UInt) : Int;

external CGDisplayCaptureWithOptions(
    display : UInt,
    options : UInt) : Int;

external CGDisplayRelease(
    display : UInt) : Int;

external CGCaptureAllDisplays() : Int;

external CGCaptureAllDisplaysWithOptions(
    options : UInt) : Int;

external CGReleaseAllDisplays() : Int;

external CGShieldingWindowID(
    display : UInt) : UInt;

external CGShieldingWindowLevel() : Int;

external CGDisplayCreateImage(
    displayID : UInt) : CGImageRef;

external CGDisplayCreateImageForRect(
    display : UInt,
    rect : CGRect) : CGImageRef;

external CGDisplayHideCursor(
    display : UInt) : Int;

external CGDisplayShowCursor(
    display : UInt) : Int;

external CGDisplayMoveCursorToPoint(
    display : UInt,
    point : CGPoint) : Int;

external CGGetLastMouseDelta(
    deltaX : Pointer[Int],
    deltaY : Pointer[Int]);

external CGDisplayCanSetPalette(
    display : UInt) : UInt;

external CGDisplaySetPalette(
    display : UInt,
    palette : CGDirectPaletteRef) : Int;

external CGDisplayWaitForBeamPositionOutsideLines(
    display : UInt,
    upperScanLine : UInt,
    lowerScanLine : UInt) : Int;

external CGDisplayBeamPosition(
    display : UInt) : UInt;

external CGDisplayGetDrawingContext(
    display : UInt) : CGContextRef;

alias CGDisplayCount = UInt;

alias CGDisplayErr = Int;

alias CGBeamPosition = UInt;

alias CGByteValue = CUChar;

alias CGDisplayCoord = Int;

alias CGMouseDelta = Int;

alias CGTableCount = UInt;

external CGDisplayBaseAddress(
    display : UInt) : RawPointer;

external CGDisplayAddressForPosition(
    display : UInt,
    x : Int,
    y : Int) : RawPointer;

external CGDisplayBytesPerRow(
    display : UInt) : CULong;

external CGDisplayAvailableModes(
    display : UInt) : CFArrayRef;

external CGDisplayBestModeForParameters(
    display : UInt,
    bitsPerPixel : CULong,
    width : CULong,
    height : CULong,
    exactMatch : Pointer[UInt]) : CFDictionaryRef;

external CGDisplayBestModeForParametersAndRefreshRate(
    display : UInt,
    bitsPerPixel : CULong,
    width : CULong,
    height : CULong,
    refreshRate : Double,
    exactMatch : Pointer[UInt]) : CFDictionaryRef;

external CGDisplayBestModeForParametersAndRefreshRateWithProperty(
    display : UInt,
    bitsPerPixel : CULong,
    width : CULong,
    height : CULong,
    refreshRate : Double,
    property : CFStringRef,
    exactMatch : Pointer[UInt]) : CFDictionaryRef;

external CGDisplayCurrentMode(
    display : UInt) : CFDictionaryRef;

external CGDisplaySwitchToMode(
    display : UInt,
    mode : CFDictionaryRef) : Int;

external CGDisplayBitsPerPixel(
    display : UInt) : CULong;

external CGDisplayBitsPerSample(
    display : UInt) : CULong;

external CGDisplaySamplesPerPixel(
    display : UInt) : CULong;

alias CGPaletteBlendFraction = Float;

record Struct_CGDeviceColor (
    red : Float,
    green : Float,
    blue : Float,
);

alias CGDeviceColor = Struct_CGDeviceColor;

record Struct_CGDeviceByteColor (
    red : CUChar,
    green : CUChar,
    blue : CUChar,
);

alias CGDeviceByteColor = Struct_CGDeviceByteColor;

external CGPaletteCreateDefaultColorPalette() : CGDirectPaletteRef;

external CGPaletteCreateWithDisplay(
    display : UInt) : CGDirectPaletteRef;

external CGPaletteCreateWithCapacity(
    capacity : UInt) : CGDirectPaletteRef;

external CGPaletteCreateWithSamples(
    samples : Pointer[CGDeviceColor],
    count : UInt) : CGDirectPaletteRef;

external CGPaletteCreateWithByteSamples(
    samples : Pointer[CGDeviceByteColor],
    count : UInt) : CGDirectPaletteRef;

external CGPaletteRelease(
    palette : CGDirectPaletteRef);

external CGPaletteGetColorAtIndex(
    palette : CGDirectPaletteRef,
    index : UInt) : CGDeviceColor;

external CGPaletteGetIndexForColor(
    palette : CGDirectPaletteRef,
    color : CGDeviceColor) : UInt;

external CGPaletteGetNumberOfSamples(
    palette : CGDirectPaletteRef) : UInt;

external CGPaletteSetColorAtIndex(
    palette : CGDirectPaletteRef,
    color : CGDeviceColor,
    index : UInt);

external CGPaletteCreateCopy(
    palette : CGDirectPaletteRef) : CGDirectPaletteRef;

external CGPaletteIsEqualToPalette(
    palette1 : CGDirectPaletteRef,
    palette2 : CGDirectPaletteRef) : Bool;

external CGPaletteCreateFromPaletteBlendedWithColor(
    palette : CGDirectPaletteRef,
    fraction : Float,
    color : CGDeviceColor) : CGDirectPaletteRef;

alias CGDisplayConfigRef = OpaquePointer;

external CGBeginDisplayConfiguration(
    config : Pointer[CGDisplayConfigRef]) : Int;

external CGConfigureDisplayOrigin(
    config : CGDisplayConfigRef,
    display : UInt,
    x : Int,
    y : Int) : Int;

external CGConfigureDisplayWithDisplayMode(
    config : CGDisplayConfigRef,
    display : UInt,
    mode : CGDisplayModeRef,
    options : CFDictionaryRef) : Int;

external CGConfigureDisplayStereoOperation(
    config : CGDisplayConfigRef,
    display : UInt,
    stereo : UInt,
    forceBlueLine : UInt) : Int;

external CGConfigureDisplayMirrorOfDisplay(
    config : CGDisplayConfigRef,
    display : UInt,
    master : UInt) : Int;

external CGCancelDisplayConfiguration(
    config : CGDisplayConfigRef) : Int;

alias kCGConfigureForAppOnly = 0;
alias kCGConfigureForSession = 1;
alias kCGConfigurePermanently = 2;

alias CGConfigureOption = UInt;

external CGCompleteDisplayConfiguration(
    config : CGDisplayConfigRef,
    option : UInt) : Int;

external CGRestorePermanentDisplayConfiguration();

alias kCGDisplayBeginConfigurationFlag = 1;
alias kCGDisplayMovedFlag = 2;
alias kCGDisplaySetMainFlag = 4;
alias kCGDisplaySetModeFlag = 8;
alias kCGDisplayAddFlag = 16;
alias kCGDisplayRemoveFlag = 32;
alias kCGDisplayEnabledFlag = 256;
alias kCGDisplayDisabledFlag = 512;
alias kCGDisplayMirrorFlag = 1024;
alias kCGDisplayUnMirrorFlag = 2048;
alias kCGDisplayDesktopShapeChangedFlag = 4096;

alias CGDisplayChangeSummaryFlags = UInt;

alias CGDisplayReconfigurationCallBack = CCodePointer[[UInt,UInt,RawPointer],[]];

external CGDisplayRegisterReconfigurationCallback(
    callback : CGDisplayReconfigurationCallBack,
    userInfo : RawPointer) : Int;

external CGDisplayRemoveReconfigurationCallback(
    callback : CGDisplayReconfigurationCallBack,
    userInfo : RawPointer) : Int;

external CGDisplaySetStereoOperation(
    display : UInt,
    stereo : UInt,
    forceBlueLine : UInt,
    option : UInt) : Int;

external CGDisplayIsActive(
    display : UInt) : UInt;

external CGDisplayIsAsleep(
    display : UInt) : UInt;

external CGDisplayIsOnline(
    display : UInt) : UInt;

external CGDisplayIsMain(
    display : UInt) : UInt;

external CGDisplayIsBuiltin(
    display : UInt) : UInt;

external CGDisplayIsInMirrorSet(
    display : UInt) : UInt;

external CGDisplayIsAlwaysInMirrorSet(
    display : UInt) : UInt;

external CGDisplayIsInHWMirrorSet(
    display : UInt) : UInt;

external CGDisplayMirrorsDisplay(
    display : UInt) : UInt;

external CGDisplayUsesOpenGLAcceleration(
    display : UInt) : UInt;

external CGDisplayIsStereo(
    display : UInt) : UInt;

external CGDisplayPrimaryDisplay(
    display : UInt) : UInt;

external CGDisplayUnitNumber(
    display : UInt) : UInt;

external CGDisplayVendorNumber(
    display : UInt) : UInt;

external CGDisplayModelNumber(
    display : UInt) : UInt;

external CGDisplaySerialNumber(
    display : UInt) : UInt;

external CGDisplayIOServicePort(
    display : UInt) : UInt;

external CGDisplayScreenSize(
    display : UInt) : CGSize;

external CGDisplayRotation(
    display : UInt) : Double;

external CGDisplayCopyColorSpace(
    display : UInt) : CGColorSpaceRef;

external CGConfigureDisplayMode(
    config : CGDisplayConfigRef,
    display : UInt,
    mode : CFDictionaryRef) : Int;

alias CGDisplayFadeReservationToken = UInt;

alias CGDisplayBlendFraction = Float;

alias CGDisplayFadeInterval = Float;

external CGConfigureDisplayFadeEffect(
    config : CGDisplayConfigRef,
    fadeOutSeconds : Float,
    fadeInSeconds : Float,
    fadeRed : Float,
    fadeGreen : Float,
    fadeBlue : Float) : Int;

alias CGDisplayReservationInterval = Float;

external CGAcquireDisplayFadeReservation(
    seconds : Float,
    token : Pointer[UInt]) : Int;

external CGReleaseDisplayFadeReservation(
    token : UInt) : Int;

external CGDisplayFade(
    token : UInt,
    duration : Float,
    startBlend : Float,
    endBlend : Float,
    redBlend : Float,
    greenBlend : Float,
    blueBlend : Float,
    synchronous : UInt) : Int;

external CGDisplayFadeOperationInProgress() : UInt;

alias CGEventErr = Int;

alias CGButtonCount = UInt;

alias CGWheelCount = UInt;

alias CGCharCode = UShort;

alias CGKeyCode = UShort;

alias CGScreenRefreshCallback = CCodePointer[[UInt,Pointer[Struct_CGRect],RawPointer],[]];

external CGRegisterScreenRefreshCallback(
    callback : CGScreenRefreshCallback,
    userInfo : RawPointer) : Int;

external CGUnregisterScreenRefreshCallback(
    callback : CGScreenRefreshCallback,
    userInfo : RawPointer);

external CGWaitForScreenRefreshRects(
    rects : Pointer[Pointer[CGRect]],
    count : Pointer[UInt]) : Int;

alias kCGScreenUpdateOperationRefresh = 0;
alias kCGScreenUpdateOperationMove = 1;
alias kCGScreenUpdateOperationReducedDirtyRectangleCount = 2147483648;

alias CGScreenUpdateOperation = UInt;

record Struct_CGScreenUpdateMoveDelta (
    dX : Int,
    dY : Int,
);

alias CGScreenUpdateMoveDelta = Struct_CGScreenUpdateMoveDelta;

alias CGScreenUpdateMoveCallback = CCodePointer[[Struct_CGScreenUpdateMoveDelta,CULong,Pointer[Struct_CGRect],RawPointer],[]];

external CGScreenRegisterMoveCallback(
    callback : CGScreenUpdateMoveCallback,
    userInfo : RawPointer) : Int;

external CGScreenUnregisterMoveCallback(
    callback : CGScreenUpdateMoveCallback,
    userInfo : RawPointer);

external CGWaitForScreenUpdateRects(
    requestedOperations : UInt,
    currentOperation : Pointer[UInt],
    rects : Pointer[Pointer[CGRect]],
    rectCount : Pointer[CULong],
    delta : Pointer[CGScreenUpdateMoveDelta]) : Int;

external CGReleaseScreenRefreshRects(
    rects : Pointer[CGRect]);

external CGCursorIsVisible() : UInt;

external CGCursorIsDrawnInFramebuffer() : UInt;

external CGWarpMouseCursorPosition(
    newCursorPosition : CGPoint) : Int;

external CGAssociateMouseAndMouseCursorPosition(
    connected : UInt) : Int;

external CGWindowServerCFMachPort() : CFMachPortRef;

external CGEnableEventStateCombining(
    combineState : UInt) : Int;

external CGInhibitLocalEvents(
    inhibit : UInt) : Int;

external CGPostMouseEvent(
    mouseCursorPosition : CGPoint,
    updateMouseCursorPosition : UInt,
    buttonCount : UInt,
    mouseButtonDown : UInt,
    ..) : Int;

external CGPostScrollWheelEvent(
    wheelCount : UInt,
    wheel1 : Int,
    ..) : Int;

external CGPostKeyboardEvent(
    keyChar : UShort,
    virtualKey : UShort,
    keyDown : UInt) : Int;

alias kCGEventFilterMaskPermitLocalMouseEvents = 1;
alias kCGEventFilterMaskPermitLocalKeyboardEvents = 2;
alias kCGEventFilterMaskPermitSystemDefinedEvents = 4;

alias CGEventFilterMask = UInt;

alias kCGEventSuppressionStateSuppressionInterval = 0;
alias kCGEventSuppressionStateRemoteMouseDrag = 1;
alias kCGNumberOfEventSuppressionStates = 2;

alias CGEventSuppressionState = UInt;

external CGSetLocalEventsFilterDuringSuppressionState(
    filter : UInt,
    state : UInt) : Int;

external CGSetLocalEventsSuppressionInterval(
    seconds : Double) : Int;

alias CGRectCount = UInt;

alias CGEventRef = OpaquePointer;

alias kCGMouseButtonLeft = 0;
alias kCGMouseButtonRight = 1;
alias kCGMouseButtonCenter = 2;

alias CGMouseButton = UInt;

alias kCGScrollEventUnitPixel = 0;
alias kCGScrollEventUnitLine = 1;

alias CGScrollEventUnit = UInt;

alias kCGEventFlagMaskAlphaShift = 65536;
alias kCGEventFlagMaskShift = 131072;
alias kCGEventFlagMaskControl = 262144;
alias kCGEventFlagMaskAlternate = 524288;
alias kCGEventFlagMaskCommand = 1048576;
alias kCGEventFlagMaskHelp = 4194304;
alias kCGEventFlagMaskSecondaryFn = 8388608;
alias kCGEventFlagMaskNumericPad = 2097152;
alias kCGEventFlagMaskNonCoalesced = 256;

alias CGEventFlags = UInt64;

alias kCGEventNull = 0;
alias kCGEventLeftMouseDown = 1;
alias kCGEventLeftMouseUp = 2;
alias kCGEventRightMouseDown = 3;
alias kCGEventRightMouseUp = 4;
alias kCGEventMouseMoved = 5;
alias kCGEventLeftMouseDragged = 6;
alias kCGEventRightMouseDragged = 7;
alias kCGEventKeyDown = 10;
alias kCGEventKeyUp = 11;
alias kCGEventFlagsChanged = 12;
alias kCGEventScrollWheel = 22;
alias kCGEventTabletPointer = 23;
alias kCGEventTabletProximity = 24;
alias kCGEventOtherMouseDown = 25;
alias kCGEventOtherMouseUp = 26;
alias kCGEventOtherMouseDragged = 27;
alias kCGEventTapDisabledByTimeout = 4294967294;
alias kCGEventTapDisabledByUserInput = 4294967295;

alias CGEventType = UInt;

alias CGEventTimestamp = UInt64;

alias kCGMouseEventNumber = 0;
alias kCGMouseEventClickState = 1;
alias kCGMouseEventPressure = 2;
alias kCGMouseEventButtonNumber = 3;
alias kCGMouseEventDeltaX = 4;
alias kCGMouseEventDeltaY = 5;
alias kCGMouseEventInstantMouser = 6;
alias kCGMouseEventSubtype = 7;
alias kCGKeyboardEventAutorepeat = 8;
alias kCGKeyboardEventKeycode = 9;
alias kCGKeyboardEventKeyboardType = 10;
alias kCGScrollWheelEventDeltaAxis1 = 11;
alias kCGScrollWheelEventDeltaAxis2 = 12;
alias kCGScrollWheelEventDeltaAxis3 = 13;
alias kCGScrollWheelEventFixedPtDeltaAxis1 = 93;
alias kCGScrollWheelEventFixedPtDeltaAxis2 = 94;
alias kCGScrollWheelEventFixedPtDeltaAxis3 = 95;
alias kCGScrollWheelEventPointDeltaAxis1 = 96;
alias kCGScrollWheelEventPointDeltaAxis2 = 97;
alias kCGScrollWheelEventPointDeltaAxis3 = 98;
alias kCGScrollWheelEventInstantMouser = 14;
alias kCGTabletEventPointX = 15;
alias kCGTabletEventPointY = 16;
alias kCGTabletEventPointZ = 17;
alias kCGTabletEventPointButtons = 18;
alias kCGTabletEventPointPressure = 19;
alias kCGTabletEventTiltX = 20;
alias kCGTabletEventTiltY = 21;
alias kCGTabletEventRotation = 22;
alias kCGTabletEventTangentialPressure = 23;
alias kCGTabletEventDeviceID = 24;
alias kCGTabletEventVendor1 = 25;
alias kCGTabletEventVendor2 = 26;
alias kCGTabletEventVendor3 = 27;
alias kCGTabletProximityEventVendorID = 28;
alias kCGTabletProximityEventTabletID = 29;
alias kCGTabletProximityEventPointerID = 30;
alias kCGTabletProximityEventDeviceID = 31;
alias kCGTabletProximityEventSystemTabletID = 32;
alias kCGTabletProximityEventVendorPointerType = 33;
alias kCGTabletProximityEventVendorPointerSerialNumber = 34;
alias kCGTabletProximityEventVendorUniqueID = 35;
alias kCGTabletProximityEventCapabilityMask = 36;
alias kCGTabletProximityEventPointerType = 37;
alias kCGTabletProximityEventEnterProximity = 38;
alias kCGEventTargetProcessSerialNumber = 39;
alias kCGEventTargetUnixProcessID = 40;
alias kCGEventSourceUnixProcessID = 41;
alias kCGEventSourceUserData = 42;
alias kCGEventSourceUserID = 43;
alias kCGEventSourceGroupID = 44;
alias kCGEventSourceStateID = 45;
alias kCGScrollWheelEventIsContinuous = 88;

alias CGEventField = UInt;

alias kCGEventMouseSubtypeDefault = 0;
alias kCGEventMouseSubtypeTabletPoint = 1;
alias kCGEventMouseSubtypeTabletProximity = 2;

alias CGEventMouseSubtype = UInt;

alias kCGHIDEventTap = 0;
alias kCGSessionEventTap = 1;
alias kCGAnnotatedSessionEventTap = 2;

alias CGEventTapLocation = UInt;

alias kCGHeadInsertEventTap = 0;
alias kCGTailAppendEventTap = 1;

alias CGEventTapPlacement = UInt;

alias kCGEventTapOptionDefault = 0;
alias kCGEventTapOptionListenOnly = 1;

alias CGEventTapOptions = UInt;

alias CGEventMask = UInt64;

alias CGEventTapProxy = OpaquePointer;

alias CGEventTapCallBack = CCodePointer[[OpaquePointer,UInt,OpaquePointer,RawPointer],[OpaquePointer]];

record Struct___CGEventTapInformation (
    eventTapID : UInt,
    tapPoint : UInt,
    options : UInt,
    eventsOfInterest : UInt64,
    tappingProcess : Int,
    processBeingTapped : Int,
    enabled : Bool,
    minUsecLatency : Float,
    avgUsecLatency : Float,
    maxUsecLatency : Float,
);

alias CGEventTapInformation = Struct___CGEventTapInformation;

alias CGEventSourceRef = OpaquePointer;

alias kCGEventSourceStatePrivate = 4294967295;
alias kCGEventSourceStateCombinedSessionState = 0;
alias kCGEventSourceStateHIDSystemState = 1;

alias CGEventSourceStateID = UInt;

alias CGEventSourceKeyboardType = UInt;

external CGEventGetTypeID() : CULong;

external CGEventCreate(
    source : CGEventSourceRef) : CGEventRef;

external CGEventCreateData(
    allocator : CFAllocatorRef,
    event : CGEventRef) : CFDataRef;

external CGEventCreateFromData(
    allocator : CFAllocatorRef,
    data : CFDataRef) : CGEventRef;

external CGEventCreateMouseEvent(
    source : CGEventSourceRef,
    mouseType : UInt,
    mouseCursorPosition : CGPoint,
    mouseButton : UInt) : CGEventRef;

external CGEventCreateKeyboardEvent(
    source : CGEventSourceRef,
    virtualKey : UShort,
    keyDown : Bool) : CGEventRef;

external CGEventCreateScrollWheelEvent(
    source : CGEventSourceRef,
    units : UInt,
    wheelCount : UInt,
    wheel1 : Int,
    ..) : CGEventRef;

external CGEventCreateCopy(
    event : CGEventRef) : CGEventRef;

external CGEventCreateSourceFromEvent(
    event : CGEventRef) : CGEventSourceRef;

external CGEventSetSource(
    event : CGEventRef,
    source : CGEventSourceRef);

external CGEventGetType(
    event : CGEventRef) : UInt;

external CGEventSetType(
    event : CGEventRef,
    type : UInt);

external CGEventGetTimestamp(
    event : CGEventRef) : UInt64;

external CGEventSetTimestamp(
    event : CGEventRef,
    timestamp : UInt64);

external CGEventGetLocation(
    event : CGEventRef) : CGPoint;

external CGEventGetUnflippedLocation(
    event : CGEventRef) : CGPoint;

external CGEventSetLocation(
    event : CGEventRef,
    location : CGPoint);

external CGEventGetFlags(
    event : CGEventRef) : UInt64;

external CGEventSetFlags(
    event : CGEventRef,
    flags : UInt64);

external CGEventKeyboardGetUnicodeString(
    event : CGEventRef,
    maxStringLength : CULong,
    actualStringLength : Pointer[CULong],
    unicodeString : Pointer[UShort]);

external CGEventKeyboardSetUnicodeString(
    event : CGEventRef,
    stringLength : CULong,
    unicodeString : Pointer[UShort]);

external CGEventGetIntegerValueField(
    event : CGEventRef,
    field : UInt) : Int64;

external CGEventSetIntegerValueField(
    event : CGEventRef,
    field : UInt,
    value : Int64);

external CGEventGetDoubleValueField(
    event : CGEventRef,
    field : UInt) : Double;

external CGEventSetDoubleValueField(
    event : CGEventRef,
    field : UInt,
    value : Double);

external CGEventTapCreate(
    tap : UInt,
    place : UInt,
    options : UInt,
    eventsOfInterest : UInt64,
    callback : CGEventTapCallBack,
    userInfo : RawPointer) : CFMachPortRef;

external CGEventTapCreateForPSN(
    processSerialNumber : RawPointer,
    place : UInt,
    options : UInt,
    eventsOfInterest : UInt64,
    callback : CGEventTapCallBack,
    userInfo : RawPointer) : CFMachPortRef;

external CGEventTapEnable(
    tap : CFMachPortRef,
    enable : Bool);

external CGEventTapIsEnabled(
    tap : CFMachPortRef) : Bool;

external CGEventTapPostEvent(
    proxy : CGEventTapProxy,
    event : CGEventRef);

external CGEventPost(
    tap : UInt,
    event : CGEventRef);

external CGEventPostToPSN(
    processSerialNumber : RawPointer,
    event : CGEventRef);

external CGGetEventTapList(
    maxNumberOfTaps : UInt,
    tapList : Pointer[CGEventTapInformation],
    eventTapCount : Pointer[UInt]) : Int;

external CGEventSourceGetTypeID() : CULong;

external CGEventSourceCreate(
    stateID : UInt) : CGEventSourceRef;

external CGEventSourceGetKeyboardType(
    source : CGEventSourceRef) : UInt;

external CGEventSourceSetKeyboardType(
    source : CGEventSourceRef,
    keyboardType : UInt);

external CGEventSourceGetPixelsPerLine(
    source : CGEventSourceRef) : Double;

external CGEventSourceSetPixelsPerLine(
    source : CGEventSourceRef,
    pixelsPerLine : Double);

external CGEventSourceGetSourceStateID(
    source : CGEventSourceRef) : UInt;

external CGEventSourceButtonState(
    stateID : UInt,
    button : UInt) : Bool;

external CGEventSourceKeyState(
    stateID : UInt,
    key : UShort) : Bool;

external CGEventSourceFlagsState(
    stateID : UInt) : UInt64;

external CGEventSourceSecondsSinceLastEventType(
    stateID : UInt,
    eventType : UInt) : Double;

external CGEventSourceCounterForEventType(
    stateID : UInt,
    eventType : UInt) : UInt;

external CGEventSourceSetUserData(
    source : CGEventSourceRef,
    userData : Int64);

external CGEventSourceGetUserData(
    source : CGEventSourceRef) : Int64;

external CGEventSourceSetLocalEventsFilterDuringSuppressionState(
    source : CGEventSourceRef,
    filter : UInt,
    state : UInt);

external CGEventSourceGetLocalEventsFilterDuringSuppressionState(
    source : CGEventSourceRef,
    state : UInt) : UInt;

external CGEventSourceSetLocalEventsSuppressionInterval(
    source : CGEventSourceRef,
    seconds : Double);

external CGEventSourceGetLocalEventsSuppressionInterval(
    source : CGEventSourceRef) : Double;

external CGGLContextCreate(
    glContext : RawPointer,
    size : CGSize,
    colorspace : CGColorSpaceRef) : CGContextRef;

external CGGLContextUpdateViewportSize(
    c : CGContextRef,
    size : CGSize);

alias CGPSConverterRef = OpaquePointer;

alias CGPSConverterBeginDocumentCallback = CCodePointer[[RawPointer],[]];

alias CGPSConverterEndDocumentCallback = CCodePointer[[RawPointer,Bool],[]];

alias CGPSConverterBeginPageCallback = CCodePointer[[RawPointer,CULong,OpaquePointer],[]];

alias CGPSConverterEndPageCallback = CCodePointer[[RawPointer,CULong,OpaquePointer],[]];

alias CGPSConverterProgressCallback = CCodePointer[[RawPointer],[]];

alias CGPSConverterMessageCallback = CCodePointer[[RawPointer,OpaquePointer],[]];

alias CGPSConverterReleaseInfoCallback = CCodePointer[[RawPointer],[]];

record Struct_CGPSConverterCallbacks (
    version : UInt,
    beginDocument : CGPSConverterBeginDocumentCallback,
    endDocument : CGPSConverterEndDocumentCallback,
    beginPage : CGPSConverterBeginPageCallback,
    endPage : CGPSConverterEndPageCallback,
    noteProgress : CGPSConverterProgressCallback,
    noteMessage : CGPSConverterMessageCallback,
    releaseInfo : CGPSConverterReleaseInfoCallback,
);

alias CGPSConverterCallbacks = Struct_CGPSConverterCallbacks;

external CGPSConverterCreate(
    info : RawPointer,
    callbacks : Pointer[CGPSConverterCallbacks],
    options : CFDictionaryRef) : CGPSConverterRef;

external CGPSConverterConvert(
    converter : CGPSConverterRef,
    provider : CGDataProviderRef,
    consumer : CGDataConsumerRef,
    options : CFDictionaryRef) : Bool;

external CGPSConverterAbort(
    converter : CGPSConverterRef) : Bool;

external CGPSConverterIsConverting(
    converter : CGPSConverterRef) : Bool;

external CGPSConverterGetTypeID() : CULong;

external CGSessionCopyCurrentDictionary() : CFDictionaryRef;

alias CGWindowID = UInt;

alias CGWindowListOption = UInt;

alias CGWindowImageOption = UInt;

alias kCGWindowSharingNone = 0;
alias kCGWindowSharingReadOnly = 1;
alias kCGWindowSharingReadWrite = 2;

alias CGWindowSharingType = UInt;

alias kCGBackingStoreRetained = 0;
alias kCGBackingStoreNonretained = 1;
alias kCGBackingStoreBuffered = 2;

alias CGWindowBackingType = UInt;

external kCGWindowNumber : CFStringRef;

external kCGWindowStoreType : CFStringRef;

external kCGWindowLayer : CFStringRef;

external kCGWindowBounds : CFStringRef;

external kCGWindowSharingState : CFStringRef;

external kCGWindowAlpha : CFStringRef;

external kCGWindowOwnerPID : CFStringRef;

external kCGWindowMemoryUsage : CFStringRef;

external kCGWindowWorkspace : CFStringRef;

external kCGWindowOwnerName : CFStringRef;

external kCGWindowName : CFStringRef;

external kCGWindowIsOnscreen : CFStringRef;

external kCGWindowBackingLocationVideoMemory : CFStringRef;

alias kCGWindowListOptionAll = 0;
alias kCGWindowListOptionOnScreenOnly = 1;
alias kCGWindowListOptionOnScreenAboveWindow = 2;
alias kCGWindowListOptionOnScreenBelowWindow = 4;
alias kCGWindowListOptionIncludingWindow = 8;
alias kCGWindowListExcludeDesktopElements = 16;

external CGWindowListCopyWindowInfo(
    option : UInt,
    relativeToWindow : UInt) : CFArrayRef;

external CGWindowListCreate(
    option : UInt,
    relativeToWindow : UInt) : CFArrayRef;

external CGWindowListCreateDescriptionFromArray(
    windowArray : CFArrayRef) : CFArrayRef;

alias kCGWindowImageDefault = 0;
alias kCGWindowImageBoundsIgnoreFraming = 1;
alias kCGWindowImageShouldBeOpaque = 2;
alias kCGWindowImageOnlyShadows = 4;

external CGWindowListCreateImage(
    screenBounds : CGRect,
    listOption : UInt,
    windowID : UInt,
    imageOption : UInt) : CGImageRef;

external CGWindowListCreateImageFromArray(
    screenBounds : CGRect,
    windowArray : CFArrayRef,
    imageOption : UInt) : CGImageRef;

alias CGWindowLevel = Int;

alias CGWindowLevelKey = Int;

alias kCGBaseWindowLevelKey = 0;
alias kCGMinimumWindowLevelKey = 1;
alias kCGDesktopWindowLevelKey = 2;
alias kCGBackstopMenuLevelKey = 3;
alias kCGNormalWindowLevelKey = 4;
alias kCGFloatingWindowLevelKey = 5;
alias kCGTornOffMenuWindowLevelKey = 6;
alias kCGDockWindowLevelKey = 7;
alias kCGMainMenuWindowLevelKey = 8;
alias kCGStatusWindowLevelKey = 9;
alias kCGModalPanelWindowLevelKey = 10;
alias kCGPopUpMenuWindowLevelKey = 11;
alias kCGDraggingWindowLevelKey = 12;
alias kCGScreenSaverWindowLevelKey = 13;
alias kCGMaximumWindowLevelKey = 14;
alias kCGOverlayWindowLevelKey = 15;
alias kCGHelpWindowLevelKey = 16;
alias kCGUtilityWindowLevelKey = 17;
alias kCGDesktopIconWindowLevelKey = 18;
alias kCGCursorWindowLevelKey = 19;
alias kCGAssistiveTechHighWindowLevelKey = 20;
alias kCGNumberOfWindowLevelKeys = 21;

external CGWindowLevelForKey(
    key : Int) : Int;

alias cmICCProfileVersion4 = 67108864;
alias cmICCProfileVersion2 = 33554432;
alias cmICCProfileVersion21 = 34603008;
alias cmCS2ProfileVersion = 33554432;
alias cmCS1ProfileVersion = 256;

alias cmProfileMajorVersionMask = 4278190080;
alias cmCurrentProfileMajorVersion = 33554432;

alias cmMagicNumber = 1633907568;

alias cmICCReservedFlagsMask = 65535;
alias cmEmbeddedMask = 1;
alias cmEmbeddedUseMask = 2;
alias cmBlackPointCompensationMask = 4;
alias cmCMSReservedFlagsMask = 4294901760;
alias cmQualityMask = 196608;
alias cmInterpolationMask = 262144;
alias cmGamutCheckingMask = 524288;

alias cmEmbeddedProfile = 0;
alias cmEmbeddedUse = 1;

alias cmNormalMode = 0;
alias cmDraftMode = 1;
alias cmBestMode = 2;

alias cmBlackPointCompensation = 1;

alias cmReflectiveTransparentMask = 1;
alias cmGlossyMatteMask = 2;

alias cmReflective = 0;
alias cmGlossy = 1;

alias cmPerceptual = 0;
alias cmRelativeColorimetric = 1;
alias cmSaturation = 2;
alias cmAbsoluteColorimetric = 3;

alias cmAsciiData = 0;
alias cmBinaryData = 1;

alias cmPrtrDefaultScreens = 0;
alias cmLinesPer = 1;

alias cmNumHeaderElements = 10;

alias cmAToB0Tag = 1093812784;
alias cmAToB1Tag = 1093812785;
alias cmAToB2Tag = 1093812786;
alias cmBlueColorantTag = 1649957210;
alias cmBlueTRCTag = 1649693251;
alias cmBToA0Tag = 1110589744;
alias cmBToA1Tag = 1110589745;
alias cmBToA2Tag = 1110589746;
alias cmCalibrationDateTimeTag = 1667329140;
alias cmChromaticAdaptationTag = 1667785060;
alias cmCharTargetTag = 1952543335;
alias cmCopyrightTag = 1668313716;
alias cmDeviceMfgDescTag = 1684893284;
alias cmDeviceModelDescTag = 1684890724;
alias cmGamutTag = 1734438260;
alias cmGrayTRCTag = 1800688195;
alias cmGreenColorantTag = 1733843290;
alias cmGreenTRCTag = 1733579331;
alias cmLuminanceTag = 1819635049;
alias cmMeasurementTag = 1835360627;
alias cmMediaBlackPointTag = 1651208308;
alias cmMediaWhitePointTag = 2004119668;
alias cmNamedColorTag = 1852010348;
alias cmNamedColor2Tag = 1852009522;
alias cmPreview0Tag = 1886545200;
alias cmPreview1Tag = 1886545201;
alias cmPreview2Tag = 1886545202;
alias cmProfileDescriptionTag = 1684370275;
alias cmProfileSequenceDescTag = 1886610801;
alias cmPS2CRD0Tag = 1886610480;
alias cmPS2CRD1Tag = 1886610481;
alias cmPS2CRD2Tag = 1886610482;
alias cmPS2CRD3Tag = 1886610483;
alias cmPS2CSATag = 1886597747;
alias cmPS2RenderingIntentTag = 1886597737;
alias cmRedColorantTag = 1918392666;
alias cmRedTRCTag = 1918128707;
alias cmScreeningDescTag = 1935897188;
alias cmScreeningTag = 1935897198;
alias cmTechnologyTag = 1952801640;
alias cmUcrBgTag = 1650877472;
alias cmViewingConditionsDescTag = 1987405156;
alias cmViewingConditionsTag = 1986618743;

alias cmPS2CRDVMSizeTag = 1886615149;
alias cmVideoCardGammaTag = 1986226036;
alias cmMakeAndModelTag = 1835888484;
alias cmProfileDescriptionMLTag = 1685283693;
alias cmNativeDisplayInfoTag = 1852074350;

alias cmSigCrdInfoType = 1668441193;
alias cmSigCurveType = 1668641398;
alias cmSigDataType = 1684108385;
alias cmSigDateTimeType = 1685350765;
alias cmSigLut16Type = 1835430962;
alias cmSigLut8Type = 1835430961;
alias cmSigMeasurementType = 1835360627;
alias cmSigMultiFunctA2BType = 1832993312;
alias cmSigMultiFunctB2AType = 1833058592;
alias cmSigNamedColorType = 1852010348;
alias cmSigNamedColor2Type = 1852009522;
alias cmSigParametricCurveType = 1885434465;
alias cmSigProfileDescriptionType = 1684370275;
alias cmSigProfileSequenceDescType = 1886610801;
alias cmSigScreeningType = 1935897198;
alias cmSigS15Fixed16Type = 1936077618;
alias cmSigSignatureType = 1936287520;
alias cmSigTextType = 1952807028;
alias cmSigU16Fixed16Type = 1969632050;
alias cmSigU1Fixed15Type = 1969631542;
alias cmSigUInt8Type = 1969827896;
alias cmSigUInt16Type = 1969828150;
alias cmSigUInt32Type = 1969828658;
alias cmSigUInt64Type = 1969829428;
alias cmSigUcrBgType = 1650877472;
alias cmSigUnicodeTextType = 1970567284;
alias cmSigViewingConditionsType = 1986618743;
alias cmSigXYZType = 1482250784;

alias cmSigPS2CRDVMSizeType = 1886615149;
alias cmSigVideoCardGammaType = 1986226036;
alias cmSigMakeAndModelType = 1835888484;
alias cmSigNativeDisplayInfoType = 1852074350;
alias cmSigMultiLocalizedUniCodeType = 1835824483;

alias cmTechnologyDigitalCamera = 1684234605;
alias cmTechnologyFilmScanner = 1718838126;
alias cmTechnologyReflectiveScanner = 1920164718;
alias cmTechnologyInkJetPrinter = 1768580468;
alias cmTechnologyThermalWaxPrinter = 1953980792;
alias cmTechnologyElectrophotographicPrinter = 1701865583;
alias cmTechnologyElectrostaticPrinter = 1702065249;
alias cmTechnologyDyeSublimationPrinter = 1685288290;
alias cmTechnologyPhotographicPaperPrinter = 1919969391;
alias cmTechnologyFilmWriter = 1718645358;
alias cmTechnologyVideoMonitor = 1986618477;
alias cmTechnologyVideoCamera = 1986618467;
alias cmTechnologyProjectionTelevision = 1886024822;
alias cmTechnologyCRTDisplay = 1129468960;
alias cmTechnologyPMDisplay = 1347240992;
alias cmTechnologyAMDisplay = 1095582752;
alias cmTechnologyPhotoCD = 1263551300;
alias cmTechnologyPhotoImageSetter = 1768777587;
alias cmTechnologyGravure = 1735549302;
alias cmTechnologyOffsetLithography = 1868981875;
alias cmTechnologySilkscreen = 1936288875;
alias cmTechnologyFlexography = 1718379896;

alias cmFlare0 = 0;
alias cmFlare100 = 1;

alias cmGeometryUnknown = 0;
alias cmGeometry045or450 = 1;
alias cmGeometry0dord0 = 2;

alias cmStdobsUnknown = 0;
alias cmStdobs1931TwoDegrees = 1;
alias cmStdobs1964TenDegrees = 2;

alias cmIlluminantUnknown = 0;
alias cmIlluminantD50 = 1;
alias cmIlluminantD65 = 2;
alias cmIlluminantD93 = 3;
alias cmIlluminantF2 = 4;
alias cmIlluminantD55 = 5;
alias cmIlluminantA = 6;
alias cmIlluminantEquiPower = 7;
alias cmIlluminantF8 = 8;

alias cmSpotFunctionUnknown = 0;
alias cmSpotFunctionDefault = 1;
alias cmSpotFunctionRound = 2;
alias cmSpotFunctionDiamond = 3;
alias cmSpotFunctionEllipse = 4;
alias cmSpotFunctionLine = 5;
alias cmSpotFunctionSquare = 6;
alias cmSpotFunctionCross = 7;

alias cmXYZData = 1482250784;
alias cmLabData = 1281450528;
alias cmLuvData = 1282766368;
alias cmYCbCrData = 1497588338;
alias cmYxyData = 1501067552;
alias cmRGBData = 1380401696;
alias cmSRGBData = 1934772034;
alias cmGrayData = 1196573017;
alias cmHSVData = 1213421088;
alias cmHLSData = 1212961568;
alias cmCMYKData = 1129142603;
alias cmCMYData = 1129142560;
alias cmMCH5Data = 1296255029;
alias cmMCH6Data = 1296255030;
alias cmMCH7Data = 1296255031;
alias cmMCH8Data = 1296255032;
alias cm3CLRData = 860048466;
alias cm4CLRData = 876825682;
alias cm5CLRData = 893602898;
alias cm6CLRData = 910380114;
alias cm7CLRData = 927157330;
alias cm8CLRData = 943934546;
alias cm9CLRData = 960711762;
alias cm10CLRData = 1094929490;
alias cm11CLRData = 1111706706;
alias cm12CLRData = 1128483922;
alias cm13CLRData = 1145261138;
alias cm14CLRData = 1162038354;
alias cm15CLRData = 1178815570;
alias cmNamedData = 1312902469;

alias cmInputClass = 1935896178;
alias cmDisplayClass = 1835955314;
alias cmOutputClass = 1886549106;
alias cmLinkClass = 1818848875;
alias cmAbstractClass = 1633842036;
alias cmColorSpaceClass = 1936744803;
alias cmNamedColorClass = 1852662636;

alias cmMacintosh = 1095782476;
alias cmMicrosoft = 1297303124;
alias cmSolaris = 1398099543;
alias cmSiliconGraphics = 1397180704;
alias cmTaligent = 1413959252;

alias cmParametricType0 = 0;
alias cmParametricType1 = 1;
alias cmParametricType2 = 2;
alias cmParametricType3 = 3;
alias cmParametricType4 = 4;

alias cmCS1ChromTag = 1667789421;
alias cmCS1TRCTag = 1953653536;
alias cmCS1NameTag = 1851878757;
alias cmCS1CustTag = 1668641652;

record Struct_CMDateTime (
    year : UShort,
    month : UShort,
    dayOfTheMonth : UShort,
    hours : UShort,
    minutes : UShort,
    seconds : UShort,
);

alias CMDateTime = Struct_CMDateTime;

record Struct_CMFixedXYColor (
    x : Int,
    y : Int,
);

alias CMFixedXYColor = Struct_CMFixedXYColor;

record Struct_CMFixedXYZColor (
    X : Int,
    Y : Int,
    Z : Int,
);

alias CMFixedXYZColor = Struct_CMFixedXYZColor;

alias CMXYZComponent = UShort;

record Struct_CMXYZColor (
    X : UShort,
    Y : UShort,
    Z : UShort,
);

alias CMXYZColor = Struct_CMXYZColor;

alias CMProfileMD5 = Array[CUChar,16];

alias CMProfileMD5Ptr = Pointer[CMProfileMD5];

record Struct_CM2Header (
    size : UInt,
    CMMType : UInt,
    profileVersion : UInt,
    profileClass : UInt,
    dataColorSpace : UInt,
    profileConnectionSpace : UInt,
    dateTime : CMDateTime,
    CS2profileSignature : UInt,
    platform : UInt,
    flags : UInt,
    deviceManufacturer : UInt,
    deviceModel : UInt,
    deviceAttributes : Array[UInt,2],
    renderingIntent : UInt,
    white : CMFixedXYZColor,
    creator : UInt,
    reserved : Array[CChar,44],
);

alias CM2Header = Struct_CM2Header;

record Struct_CM4Header (
    size : UInt,
    CMMType : UInt,
    profileVersion : UInt,
    profileClass : UInt,
    dataColorSpace : UInt,
    profileConnectionSpace : UInt,
    dateTime : CMDateTime,
    CS2profileSignature : UInt,
    platform : UInt,
    flags : UInt,
    deviceManufacturer : UInt,
    deviceModel : UInt,
    deviceAttributes : Array[UInt,2],
    renderingIntent : UInt,
    white : CMFixedXYZColor,
    creator : UInt,
    digest : CMProfileMD5,
    reserved : Array[CChar,28],
);

alias CM4Header = Struct_CM4Header;

record Struct_CMTagRecord (
    tag : UInt,
    elementOffset : UInt,
    elementSize : UInt,
);

alias CMTagRecord = Struct_CMTagRecord;

record Struct_CMTagElemTable (
    count : UInt,
    tagList : Array[CMTagRecord,1],
);

alias CMTagElemTable = Struct_CMTagElemTable;

record Struct_CM2Profile (
    header : CM2Header,
    tagTable : CMTagElemTable,
    elemData : Array[CChar,1],
);

alias CM2Profile = Struct_CM2Profile;

alias CM2ProfilePtr = Pointer[Struct_CM2Profile];

alias CM2ProfileHandle = Pointer[Pointer[Struct_CM2Profile]];

record Struct_CMAdaptationMatrixType (
    typeDescriptor : UInt,
    reserved : UInt,
    adaptationMatrix : Array[Int,9],
);

alias CMAdaptationMatrixType = Struct_CMAdaptationMatrixType;

record Struct_CMCurveType (
    typeDescriptor : UInt,
    reserved : UInt,
    countValue : UInt,
    data : Array[UShort,1],
);

alias CMCurveType = Struct_CMCurveType;

record Struct_CMDataType (
    typeDescriptor : UInt,
    reserved : UInt,
    dataFlag : UInt,
    data : Array[CChar,1],
);

alias CMDataType = Struct_CMDataType;

record Struct_CMDateTimeType (
    typeDescriptor : UInt,
    reserved : UInt,
    dateTime : CMDateTime,
);

alias CMDateTimeType = Struct_CMDateTimeType;

record Struct_CMLut16Type (
    typeDescriptor : UInt,
    reserved : UInt,
    inputChannels : CUChar,
    outputChannels : CUChar,
    gridPoints : CUChar,
    reserved2 : CUChar,
    matrix : Array[Array[Int,3],3],
    inputTableEntries : UShort,
    outputTableEntries : UShort,
    inputTable : Array[UShort,1],
);

alias CMLut16Type = Struct_CMLut16Type;

record Struct_CMLut8Type (
    typeDescriptor : UInt,
    reserved : UInt,
    inputChannels : CUChar,
    outputChannels : CUChar,
    gridPoints : CUChar,
    reserved2 : CUChar,
    matrix : Array[Array[Int,3],3],
    inputTable : Array[CUChar,1],
);

alias CMLut8Type = Struct_CMLut8Type;

record Struct_CMMultiFunctLutType (
    typeDescriptor : UInt,
    reserved : UInt,
    inputChannels : CUChar,
    outputChannels : CUChar,
    reserved2 : UShort,
    offsetBcurves : UInt,
    offsetMatrix : UInt,
    offsetMcurves : UInt,
    offsetCLUT : UInt,
    offsetAcurves : UInt,
    data : Array[CUChar,1],
);

alias CMMultiFunctLutType = Struct_CMMultiFunctLutType;

alias CMMultiFunctLutA2BType = Struct_CMMultiFunctLutType;

alias CMMultiFunctLutB2AType = Struct_CMMultiFunctLutType;

record Struct_CMMultiFunctCLUTType (
    gridPoints : Array[CUChar,16],
    entrySize : CUChar,
    reserved : Array[CUChar,3],
    data : Array[CUChar,2],
);

alias CMMultiFunctCLUTType = Struct_CMMultiFunctCLUTType;

record Struct_CMMeasurementType (
    typeDescriptor : UInt,
    reserved : UInt,
    standardObserver : UInt,
    backingXYZ : CMFixedXYZColor,
    geometry : UInt,
    flare : UInt,
    illuminant : UInt,
);

alias CMMeasurementType = Struct_CMMeasurementType;

record Struct_CMNamedColorType (
    typeDescriptor : UInt,
    reserved : UInt,
    vendorFlag : UInt,
    count : UInt,
    prefixName : Array[CUChar,1],
);

alias CMNamedColorType = Struct_CMNamedColorType;

record Struct_CMNamedColor2EntryType (
    rootName : Array[CUChar,32],
    PCSColorCoords : Array[UShort,3],
    DeviceColorCoords : Array[UShort,1],
);

alias CMNamedColor2EntryType = Struct_CMNamedColor2EntryType;

record Struct_CMNamedColor2Type (
    typeDescriptor : UInt,
    reserved : UInt,
    vendorFlag : UInt,
    count : UInt,
    deviceChannelCount : UInt,
    prefixName : Array[CUChar,32],
    suffixName : Array[CUChar,32],
    data : Array[CChar,1],
);

alias CMNamedColor2Type = Struct_CMNamedColor2Type;

record Struct_CMNativeDisplayInfo (
    dataSize : UInt,
    redPhosphor : CMFixedXYColor,
    greenPhosphor : CMFixedXYColor,
    bluePhosphor : CMFixedXYColor,
    whitePoint : CMFixedXYColor,
    redGammaValue : Int,
    greenGammaValue : Int,
    blueGammaValue : Int,
    gammaChannels : UShort,
    gammaEntryCount : UShort,
    gammaEntrySize : UShort,
    gammaData : Array[CChar,1],
);

alias CMNativeDisplayInfo = Struct_CMNativeDisplayInfo;

record Struct_CMNativeDisplayInfoType (
    typeDescriptor : UInt,
    reserved : UInt,
    nativeDisplayInfo : CMNativeDisplayInfo,
);

alias CMNativeDisplayInfoType = Struct_CMNativeDisplayInfoType;

record Struct_CMParametricCurveType (
    typeDescriptor : UInt,
    reserved : UInt,
    functionType : UShort,
    reserved2 : UShort,
    value : Array[Int,1],
);

alias CMParametricCurveType = Struct_CMParametricCurveType;

record Struct_CMTextDescriptionType (
    typeDescriptor : UInt,
    reserved : UInt,
    ASCIICount : UInt,
    ASCIIName : Array[CUChar,2],
);

alias CMTextDescriptionType = Struct_CMTextDescriptionType;

record Struct_CMTextType (
    typeDescriptor : UInt,
    reserved : UInt,
    text : Array[CUChar,1],
);

alias CMTextType = Struct_CMTextType;

record Struct_CMUnicodeTextType (
    typeDescriptor : UInt,
    reserved : UInt,
    text : Array[UShort,1],
);

alias CMUnicodeTextType = Struct_CMUnicodeTextType;

record Struct_CMScreeningChannelRec (
    frequency : Int,
    angle : Int,
    spotFunction : UInt,
);

alias CMScreeningChannelRec = Struct_CMScreeningChannelRec;

record Struct_CMScreeningType (
    typeDescriptor : UInt,
    reserved : UInt,
    screeningFlag : UInt,
    channelCount : UInt,
    channelInfo : Array[CMScreeningChannelRec,1],
);

alias CMScreeningType = Struct_CMScreeningType;

record Struct_CMSignatureType (
    typeDescriptor : UInt,
    reserved : UInt,
    signature : UInt,
);

alias CMSignatureType = Struct_CMSignatureType;

record Struct_CMS15Fixed16ArrayType (
    typeDescriptor : UInt,
    reserved : UInt,
    value : Array[Int,1],
);

alias CMS15Fixed16ArrayType = Struct_CMS15Fixed16ArrayType;

record Struct_CMU16Fixed16ArrayType (
    typeDescriptor : UInt,
    reserved : UInt,
    value : Array[UInt,1],
);

alias CMU16Fixed16ArrayType = Struct_CMU16Fixed16ArrayType;

record Struct_CMUInt8ArrayType (
    typeDescriptor : UInt,
    reserved : UInt,
    value : Array[CUChar,1],
);

alias CMUInt8ArrayType = Struct_CMUInt8ArrayType;

record Struct_CMUInt16ArrayType (
    typeDescriptor : UInt,
    reserved : UInt,
    value : Array[UShort,1],
);

alias CMUInt16ArrayType = Struct_CMUInt16ArrayType;

record Struct_CMUInt32ArrayType (
    typeDescriptor : UInt,
    reserved : UInt,
    value : Array[UInt,1],
);

alias CMUInt32ArrayType = Struct_CMUInt32ArrayType;

record Struct_CMUInt64ArrayType (
    typeDescriptor : UInt,
    reserved : UInt,
    value : Array[UInt,1],
);

alias CMUInt64ArrayType = Struct_CMUInt64ArrayType;

record Struct_CMViewingConditionsType (
    typeDescriptor : UInt,
    reserved : UInt,
    illuminant : CMFixedXYZColor,
    surround : CMFixedXYZColor,
    stdIlluminant : UInt,
);

alias CMViewingConditionsType = Struct_CMViewingConditionsType;

record Struct_CMXYZType (
    typeDescriptor : UInt,
    reserved : UInt,
    XYZ : Array[CMFixedXYZColor,1],
);

alias CMXYZType = Struct_CMXYZType;

record Struct_CMProfileSequenceDescType (
    typeDescriptor : UInt,
    reserved : UInt,
    count : UInt,
    data : Array[CChar,1],
);

alias CMProfileSequenceDescType = Struct_CMProfileSequenceDescType;

record Struct_CMUcrBgType (
    typeDescriptor : UInt,
    reserved : UInt,
    ucrCount : UInt,
    ucrValues : Array[UShort,1],
);

alias CMUcrBgType = Struct_CMUcrBgType;

record Struct_CMIntentCRDVMSize (
    renderingIntent : UInt,
    VMSize : UInt,
);

alias CMIntentCRDVMSize = Struct_CMIntentCRDVMSize;

record Struct_CMPS2CRDVMSizeType (
    typeDescriptor : UInt,
    reserved : UInt,
    count : UInt,
    intentCRD : Array[CMIntentCRDVMSize,1],
);

alias CMPS2CRDVMSizeType = Struct_CMPS2CRDVMSizeType;

alias cmVideoCardGammaTableType = 0;
alias cmVideoCardGammaFormulaType = 1;

record Struct_CMVideoCardGammaTable (
    channels : UShort,
    entryCount : UShort,
    entrySize : UShort,
    data : Array[CChar,1],
);

alias CMVideoCardGammaTable = Struct_CMVideoCardGammaTable;

record Struct_CMVideoCardGammaFormula (
    redGamma : Int,
    redMin : Int,
    redMax : Int,
    greenGamma : Int,
    greenMin : Int,
    greenMax : Int,
    blueGamma : Int,
    blueMin : Int,
    blueMax : Int,
);

alias CMVideoCardGammaFormula = Struct_CMVideoCardGammaFormula;

record Struct_CMVideoCardGamma (
    tagType : UInt,
    u : AUnionType,
);

alias CMVideoCardGamma = Struct_CMVideoCardGamma;

record Struct_CMVideoCardGammaType (
    typeDescriptor : UInt,
    reserved : UInt,
    gamma : CMVideoCardGamma,
);

alias CMVideoCardGammaType = Struct_CMVideoCardGammaType;

record Struct_CMMakeAndModel (
    manufacturer : UInt,
    model : UInt,
    serialNumber : UInt,
    manufactureDate : UInt,
    reserved1 : UInt,
    reserved2 : UInt,
    reserved3 : UInt,
    reserved4 : UInt,
);

alias CMMakeAndModel = Struct_CMMakeAndModel;

record Struct_CMMakeAndModelType (
    typeDescriptor : UInt,
    reserved : UInt,
    makeAndModel : CMMakeAndModel,
);

alias CMMakeAndModelType = Struct_CMMakeAndModelType;

record Struct_CMMultiLocalizedUniCodeEntryRec (
    languageCode : Array[CChar,2],
    regionCode : Array[CChar,2],
    textLength : UInt,
    textOffset : UInt,
);

alias CMMultiLocalizedUniCodeEntryRec = Struct_CMMultiLocalizedUniCodeEntryRec;

record Struct_CMMultiLocalizedUniCodeType (
    typeDescriptor : UInt,
    reserved : UInt,
    entryCount : UInt,
    entrySize : UInt,
);

alias CMMultiLocalizedUniCodeType = Struct_CMMultiLocalizedUniCodeType;

alias CMError = Int;

alias CMProfileRef = OpaquePointer;

alias CMWorldRef = OpaquePointer;

alias CMDisplayIDType = UInt;

alias CMChromaticAdaptation = UInt;

alias cmUseDefaultChromaticAdaptation = 0;
alias cmLinearChromaticAdaptation = 1;
alias cmVonKriesChromaticAdaptation = 2;
alias cmBradfordChromaticAdaptation = 3;

alias CMFlattenProcPtr = CCodePointer[[Int,Pointer[CLong],RawPointer,RawPointer],[Short]];

alias CMFlattenUPP = CMFlattenProcPtr;

alias CMBitmapCallBackProcPtr = CCodePointer[[Int,RawPointer],[CUChar]];

alias CMBitmapCallBackUPP = CMBitmapCallBackProcPtr;

alias CMConcatCallBackProcPtr = CCodePointer[[Int,RawPointer],[CUChar]];

alias CMConcatCallBackUPP = CMConcatCallBackProcPtr;

alias kDefaultCMMSignature = 1634758764;

alias cmPS7bit = 1;
alias cmPS8bit = 2;

alias cmOpenReadSpool = 1;
alias cmOpenWriteSpool = 2;
alias cmReadSpool = 3;
alias cmWriteSpool = 4;
alias cmCloseSpool = 5;

alias cmOpenReadAccess = 1;
alias cmOpenWriteAccess = 2;
alias cmReadAccess = 3;
alias cmWriteAccess = 4;
alias cmCloseAccess = 5;
alias cmCreateNewAccess = 6;
alias cmAbortWriteAccess = 7;
alias cmBeginAccess = 8;
alias cmEndAccess = 9;

alias cmInputUse = 1768845428;
alias cmOutputUse = 1869968496;
alias cmDisplayUse = 1685089401;
alias cmProofUse = 1886549350;

alias CMAppleProfileHeader = AUnionType;

record Struct_CMConcatProfileSet (
    keyIndex : UShort,
    count : UShort,
    profileSet : Array[CMProfileRef,1],
);

alias CMConcatProfileSet = Struct_CMConcatProfileSet;

record Struct_NCMConcatProfileSpec (
    renderingIntent : UInt,
    transformTag : UInt,
    profile : CMProfileRef,
);

alias NCMConcatProfileSpec = Struct_NCMConcatProfileSpec;

record Struct_NCMConcatProfileSet (
    cmm : UInt,
    flags : UInt,
    flagsMask : UInt,
    profileCount : UInt,
    profileSpecs : Array[NCMConcatProfileSpec,1],
);

alias NCMConcatProfileSet = Struct_NCMConcatProfileSet;

alias kNoTransform = 0;
alias kUseAtoB = 1;
alias kUseBtoA = 2;
alias kUseBtoB = 3;
alias kDeviceToPCS = 1;
alias kPCSToDevice = 2;
alias kPCSToPCS = 3;
alias kUseProfileIntent = 4294967295;

record Struct_CMRGBColor (
    red : UShort,
    green : UShort,
    blue : UShort,
);

alias CMRGBColor = Struct_CMRGBColor;

record Struct_CMCMYKColor (
    cyan : UShort,
    magenta : UShort,
    yellow : UShort,
    black : UShort,
);

alias CMCMYKColor = Struct_CMCMYKColor;

record Struct_CMCMYColor (
    cyan : UShort,
    magenta : UShort,
    yellow : UShort,
);

alias CMCMYColor = Struct_CMCMYColor;

record Struct_CMHLSColor (
    hue : UShort,
    lightness : UShort,
    saturation : UShort,
);

alias CMHLSColor = Struct_CMHLSColor;

record Struct_CMHSVColor (
    hue : UShort,
    saturation : UShort,
    value : UShort,
);

alias CMHSVColor = Struct_CMHSVColor;

record Struct_CMLabColor (
    L : UShort,
    a : UShort,
    b : UShort,
);

alias CMLabColor = Struct_CMLabColor;

record Struct_CMLuvColor (
    L : UShort,
    u : UShort,
    v : UShort,
);

alias CMLuvColor = Struct_CMLuvColor;

record Struct_CMYxyColor (
    capY : UShort,
    x : UShort,
    y : UShort,
);

alias CMYxyColor = Struct_CMYxyColor;

record Struct_CMGrayColor (
    gray : UShort,
);

alias CMGrayColor = Struct_CMGrayColor;

record Struct_CMMultichannel5Color (
    components : Array[CUChar,5],
);

alias CMMultichannel5Color = Struct_CMMultichannel5Color;

record Struct_CMMultichannel6Color (
    components : Array[CUChar,6],
);

alias CMMultichannel6Color = Struct_CMMultichannel6Color;

record Struct_CMMultichannel7Color (
    components : Array[CUChar,7],
);

alias CMMultichannel7Color = Struct_CMMultichannel7Color;

record Struct_CMMultichannel8Color (
    components : Array[CUChar,8],
);

alias CMMultichannel8Color = Struct_CMMultichannel8Color;

record Struct_CMNamedColor (
    namedColorIndex : UInt,
);

alias CMNamedColor = Struct_CMNamedColor;

alias CMColor = AUnionType;

record Struct_CMMInfo (
    dataSize : CULong,
    CMMType : UInt,
    CMMMfr : UInt,
    CMMVersion : UInt,
    ASCIIName : Array[CUChar,32],
    ASCIIDesc : Array[CUChar,256],
    UniCodeNameCount : CULong,
    UniCodeName : Array[UShort,32],
    UniCodeDescCount : CULong,
    UniCodeDesc : Array[UShort,256],
);

alias CMMInfo = Struct_CMMInfo;

alias cmColorSpaceSpaceMask = 63;
alias cmColorSpacePremulAlphaMask = 64;
alias cmColorSpaceAlphaMask = 128;
alias cmColorSpaceSpaceAndAlphaMask = 255;
alias cmColorSpacePackingMask = 65280;
alias cmColorSpaceEncodingMask = 983040;
alias cmColorSpaceReservedMask = 4293918720;

alias cmNoColorPacking = 0;
alias cmWord5ColorPacking = 1280;
alias cmWord565ColorPacking = 1536;
alias cmLong8ColorPacking = 2048;
alias cmLong10ColorPacking = 2560;
alias cmAlphaFirstPacking = 4096;
alias cmOneBitDirectPacking = 2816;
alias cmAlphaLastPacking = 0;
alias cm8_8ColorPacking = 10240;
alias cm16_8ColorPacking = 8192;
alias cm24_8ColorPacking = 8448;
alias cm32_8ColorPacking = 2048;
alias cm40_8ColorPacking = 8704;
alias cm48_8ColorPacking = 8960;
alias cm56_8ColorPacking = 9216;
alias cm64_8ColorPacking = 9472;
alias cm32_16ColorPacking = 9728;
alias cm48_16ColorPacking = 10496;
alias cm64_16ColorPacking = 10752;
alias cm32_32ColorPacking = 9984;
alias cmLittleEndianPacking = 16384;
alias cmReverseChannelPacking = 32768;

alias cmSRGB16ChannelEncoding = 65536;

alias cmNoSpace = 0;
alias cmRGBSpace = 1;
alias cmCMYKSpace = 2;
alias cmHSVSpace = 3;
alias cmHLSSpace = 4;
alias cmYXYSpace = 5;
alias cmXYZSpace = 6;
alias cmLUVSpace = 7;
alias cmLABSpace = 8;
alias cmReservedSpace1 = 9;
alias cmGraySpace = 10;
alias cmReservedSpace2 = 11;
alias cmGamutResultSpace = 12;
alias cmNamedIndexedSpace = 16;
alias cmMCFiveSpace = 17;
alias cmMCSixSpace = 18;
alias cmMCSevenSpace = 19;
alias cmMCEightSpace = 20;
alias cmAlphaPmulSpace = 64;
alias cmAlphaSpace = 128;
alias cmRGBASpace = 129;
alias cmGrayASpace = 138;
alias cmRGBAPmulSpace = 193;
alias cmGrayAPmulSpace = 202;

alias cmGray8Space = 10250;
alias cmGray16Space = 10;
alias cmGray16LSpace = 16394;
alias cmGrayA16Space = 8330;
alias cmGrayA32Space = 138;
alias cmGrayA32LSpace = 16522;
alias cmGrayA16PmulSpace = 8394;
alias cmGrayA32PmulSpace = 202;
alias cmGrayA32LPmulSpace = 16586;
alias cmRGB16Space = 1281;
alias cmRGB16LSpace = 17665;
alias cmRGB565Space = 1537;
alias cmRGB565LSpace = 17921;
alias cmRGB24Space = 8449;
alias cmRGB32Space = 2049;
alias cmRGB48Space = 10497;
alias cmRGB48LSpace = 26881;
alias cmARGB32Space = 6273;
alias cmARGB64Space = 14977;
alias cmARGB64LSpace = 31361;
alias cmRGBA32Space = 2177;
alias cmRGBA64Space = 10881;
alias cmRGBA64LSpace = 27265;
alias cmARGB32PmulSpace = 6337;
alias cmARGB64PmulSpace = 15041;
alias cmARGB64LPmulSpace = 31425;
alias cmRGBA32PmulSpace = 2241;
alias cmRGBA64PmulSpace = 10945;
alias cmRGBA64LPmulSpace = 27329;
alias cmCMYK32Space = 2050;
alias cmCMYK64Space = 10754;
alias cmCMYK64LSpace = 27138;
alias cmHSV32Space = 2563;
alias cmHLS32Space = 2564;
alias cmYXY32Space = 2565;
alias cmXYZ24Space = 8454;
alias cmXYZ32Space = 2566;
alias cmXYZ48Space = 10502;
alias cmXYZ48LSpace = 26886;
alias cmLUV32Space = 2567;
alias cmLAB24Space = 8456;
alias cmLAB32Space = 2568;
alias cmLAB48Space = 10504;
alias cmLAB48LSpace = 26888;
alias cmGamutResult1Space = 2828;
alias cmNamedIndexed32Space = 10000;
alias cmNamedIndexed32LSpace = 26384;
alias cmMCFive8Space = 8721;
alias cmMCSix8Space = 8978;
alias cmMCSeven8Space = 9235;
alias cmMCEight8Space = 9492;

alias CMBitmapColorSpace = UInt;

record Struct_CMBitmap (
    image : Pointer[CChar],
    width : CULong,
    height : CULong,
    rowBytes : CULong,
    pixelSize : CULong,
    space : UInt,
    user1 : UInt,
    user2 : UInt,
);

alias CMBitmap = Struct_CMBitmap;

alias CS_MAX_PATH = 1024;

alias cmNoProfileBase = 0;
alias cmPathBasedProfile = 5;
alias cmBufferBasedProfile = 6;

record Struct_CMHandleLocation (
    h : Handle,
);

alias CMHandleLocation = Struct_CMHandleLocation;

record Struct_CMPathLocation (
    path : Array[CChar,1024],
);

alias CMPathLocation = Struct_CMPathLocation;

record Struct_CMBufferLocation (
    buffer : RawPointer,
    size : UInt,
);

alias CMBufferLocation = Struct_CMBufferLocation;

alias CMProfLoc = AUnionType;

record Struct_CMProfileLocation (
    locType : Short,
    u : CMProfLoc,
);

alias CMProfileLocation = Struct_CMProfileLocation;

alias cmOriginalProfileLocationSize = 72;
alias cmCurrentProfileLocationSize = 1032;

alias cmProfileIterateDataVersion1 = 65536;
alias cmProfileIterateDataVersion2 = 131072;
alias cmProfileIterateDataVersion3 = 196608;
alias cmProfileIterateDataVersion4 = 262144;

record Struct_CMProfileIterateData (
    dataVersion : UInt,
    header : CM2Header,
    code : Short,
    name : Str255,
    location : CMProfileLocation,
    uniCodeNameCount : CULong,
    uniCodeName : Pointer[UShort],
    asciiName : Pointer[CUChar],
    makeAndModel : Pointer[CMMakeAndModel],
    digest : Pointer[CMProfileMD5],
);

alias CMProfileIterateData = Struct_CMProfileIterateData;

alias CMProfileIterateProcPtr = CCodePointer[[Pointer[Struct_CMProfileIterateData],RawPointer],[Short]];

alias CMProfileIterateUPP = CMProfileIterateProcPtr;

alias CMMIterateProcPtr = CCodePointer[[Pointer[Struct_CMMInfo],RawPointer],[Short]];

alias CMMIterateUPP = CMMIterateProcPtr;

alias CMLabToLabProcPtr = CCodePointer[[Pointer[Float],Pointer[Float],Pointer[Float],RawPointer],[]];

external CMNewProfile(
    prof : Pointer[CMProfileRef],
    theProfile : Pointer[CMProfileLocation]) : Int;

external NCWNewLinkProfile(
    prof : Pointer[CMProfileRef],
    targetLocation : Pointer[CMProfileLocation],
    profileSet : Pointer[NCMConcatProfileSet],
    proc : CMConcatCallBackUPP,
    refCon : RawPointer) : Int;

external CMMakeProfile(
    prof : CMProfileRef,
    spec : CFDictionaryRef) : Int;

external CMOpenProfile(
    prof : Pointer[CMProfileRef],
    theProfile : Pointer[CMProfileLocation]) : Int;

external CMCloseProfile(
    prof : CMProfileRef) : Int;

external CMUpdateProfile(
    prof : CMProfileRef) : Int;

external CMCopyProfile(
    targetProf : Pointer[CMProfileRef],
    targetLocation : Pointer[CMProfileLocation],
    srcProf : CMProfileRef) : Int;

external CMValidateProfile(
    prof : CMProfileRef,
    valid : Pointer[CUChar],
    preferredCMMnotfound : Pointer[CUChar]) : Int;

external NCMGetProfileLocation(
    prof : CMProfileRef,
    theProfile : Pointer[CMProfileLocation],
    locationSize : Pointer[UInt]) : Int;

external CMProfileCopyICCData(
    allocator : CFAllocatorRef,
    prof : CMProfileRef) : CFDataRef;

external CMGetProfileHeader(
    prof : CMProfileRef,
    header : Pointer[CMAppleProfileHeader]) : Int;

external CMSetProfileHeader(
    prof : CMProfileRef,
    header : Pointer[CMAppleProfileHeader]) : Int;

external CMCloneProfileRef(
    prof : CMProfileRef) : Int;

external CMGetProfileRefCount(
    prof : CMProfileRef,
    count : Pointer[CLong]) : Int;

external CMProfileModified(
    prof : CMProfileRef,
    modified : Pointer[CUChar]) : Int;

external CMGetProfileMD5(
    prof : CMProfileRef,
    digest : Pointer[CUChar]) : Int;

external CMCountProfileElements(
    prof : CMProfileRef,
    elementCount : Pointer[UInt]) : Int;

external CMProfileElementExists(
    prof : CMProfileRef,
    tag : UInt,
    found : Pointer[CUChar]) : Int;

external CMGetProfileElement(
    prof : CMProfileRef,
    tag : UInt,
    elementSize : Pointer[UInt],
    elementData : RawPointer) : Int;

external CMSetProfileElement(
    prof : CMProfileRef,
    tag : UInt,
    elementSize : UInt,
    elementData : RawPointer) : Int;

external CMSetProfileElementSize(
    prof : CMProfileRef,
    tag : UInt,
    elementSize : UInt) : Int;

external CMSetProfileElementReference(
    prof : CMProfileRef,
    elementTag : UInt,
    referenceTag : UInt) : Int;

external CMGetPartialProfileElement(
    prof : CMProfileRef,
    tag : UInt,
    offset : UInt,
    byteCount : Pointer[UInt],
    elementData : RawPointer) : Int;

external CMSetPartialProfileElement(
    prof : CMProfileRef,
    tag : UInt,
    offset : UInt,
    byteCount : UInt,
    elementData : RawPointer) : Int;

external CMGetIndProfileElementInfo(
    prof : CMProfileRef,
    index : UInt,
    tag : Pointer[UInt],
    elementSize : Pointer[UInt],
    refs : Pointer[CUChar]) : Int;

external CMGetIndProfileElement(
    prof : CMProfileRef,
    index : UInt,
    elementSize : Pointer[UInt],
    elementData : RawPointer) : Int;

external CMRemoveProfileElement(
    prof : CMProfileRef,
    tag : UInt) : Int;

external CMGetProfileDescriptions(
    prof : CMProfileRef,
    aName : Pointer[CChar],
    aCount : Pointer[UInt],
    mName : Pointer[CUChar],
    mCode : Pointer[Short],
    uName : Pointer[UShort],
    uCount : Pointer[CULong]) : Int;

external CMSetProfileDescriptions(
    prof : CMProfileRef,
    aName : Pointer[CChar],
    aCount : UInt,
    mName : ConstStr255Param,
    mCode : Short,
    uName : Pointer[UShort],
    uCount : CULong) : Int;

external CMCopyProfileLocalizedStringDictionary(
    prof : CMProfileRef,
    tag : UInt,
    theDict : Pointer[CFDictionaryRef]) : Int;

external CMSetProfileLocalizedStringDictionary(
    prof : CMProfileRef,
    tag : UInt,
    theDict : CFDictionaryRef) : Int;

external CMCopyProfileLocalizedString(
    prof : CMProfileRef,
    tag : UInt,
    reqLocale : CFStringRef,
    locale : Pointer[CFStringRef],
    str : Pointer[CFStringRef]) : Int;

external CMCopyProfileDescriptionString(
    prof : CMProfileRef,
    str : Pointer[CFStringRef]) : Int;

external CMGetNamedColorInfo(
    prof : CMProfileRef,
    deviceChannels : Pointer[UInt],
    deviceColorSpace : Pointer[UInt],
    PCSColorSpace : Pointer[UInt],
    count : Pointer[UInt],
    prefix : StringPtr,
    suffix : StringPtr) : Int;

external CMGetNamedColorValue(
    prof : CMProfileRef,
    name : StringPtr,
    deviceColor : Pointer[CMColor],
    PCSColor : Pointer[CMColor]) : Int;

external CMGetIndNamedColorValue(
    prof : CMProfileRef,
    index : UInt,
    deviceColor : Pointer[CMColor],
    PCSColor : Pointer[CMColor]) : Int;

external CMGetNamedColorIndex(
    prof : CMProfileRef,
    name : StringPtr,
    index : Pointer[UInt]) : Int;

external CMGetNamedColorName(
    prof : CMProfileRef,
    index : UInt,
    name : StringPtr) : Int;

external NCWNewColorWorld(
    cw : Pointer[CMWorldRef],
    src : CMProfileRef,
    dst : CMProfileRef) : Int;

external NCWConcatColorWorld(
    cw : Pointer[CMWorldRef],
    profileSet : Pointer[NCMConcatProfileSet],
    proc : CMConcatCallBackUPP,
    refCon : RawPointer) : Int;

external CWDisposeColorWorld(
    cw : CMWorldRef);

external CWMatchColors(
    cw : CMWorldRef,
    myColors : Pointer[CMColor],
    count : CULong) : Int;

external CWCheckColors(
    cw : CMWorldRef,
    myColors : Pointer[CMColor],
    count : CULong,
    result : Pointer[CUChar]) : Int;

external CWMatchBitmap(
    cw : CMWorldRef,
    bitmap : Pointer[CMBitmap],
    progressProc : CMBitmapCallBackUPP,
    refCon : RawPointer,
    matchedBitmap : Pointer[CMBitmap]) : Int;

external CWCheckBitmap(
    cw : CMWorldRef,
    bitmap : Pointer[CMBitmap],
    progressProc : CMBitmapCallBackUPP,
    refCon : RawPointer,
    resultBitmap : Pointer[CMBitmap]) : Int;

external CWGetCMMSignature(
    cw : CMWorldRef) : UInt;

alias cmTextureRGBtoRGBX8 = 0;
alias cmTextureRGBtoRGBX16 = 1;
alias cmTextureRGBtoRGBXFloat32 = 2;

external CWFillLookupTexture(
    cw : CMWorldRef,
    gridPoints : UInt,
    format : UInt,
    dataSize : UInt,
    data : RawPointer) : Int;

external CMGetSystemProfile(
    prof : Pointer[CMProfileRef]) : Int;

external CMGetDefaultProfileBySpace(
    dataColorSpace : UInt,
    prof : Pointer[CMProfileRef]) : Int;

external CMGetDefaultProfileByUse(
    use : UInt,
    prof : Pointer[CMProfileRef]) : Int;

external CMGetProfileByAVID(
    theID : UInt,
    prof : Pointer[CMProfileRef]) : Int;

external CMSetProfileByAVID(
    theID : UInt,
    prof : CMProfileRef) : Int;

external CMGetGammaByAVID(
    theID : UInt,
    gamma : Pointer[CMVideoCardGamma],
    size : Pointer[UInt]) : Int;

external CMSetGammaByAVID(
    theID : UInt,
    gamma : Pointer[CMVideoCardGamma]) : Int;

external CMIterateColorSyncFolder(
    proc : CMProfileIterateUPP,
    seed : Pointer[UInt],
    count : Pointer[UInt],
    refCon : RawPointer) : Int;

external CMIterateCMMInfo(
    proc : CMMIterateUPP,
    count : Pointer[UInt],
    refCon : RawPointer) : Int;

external CMGetColorSyncVersion(
    version : Pointer[UInt]) : Int;

external CMLaunchControlPanel(
    flags : UInt) : Int;

external CMGetPS2ColorSpace(
    srcProf : CMProfileRef,
    flags : UInt,
    proc : CMFlattenUPP,
    refCon : RawPointer,
    preferredCMMnotfound : Pointer[CUChar]) : Int;

external CMGetPS2ColorRenderingIntent(
    srcProf : CMProfileRef,
    flags : UInt,
    proc : CMFlattenUPP,
    refCon : RawPointer,
    preferredCMMnotfound : Pointer[CUChar]) : Int;

external CMGetPS2ColorRendering(
    srcProf : CMProfileRef,
    dstProf : CMProfileRef,
    flags : UInt,
    proc : CMFlattenUPP,
    refCon : RawPointer,
    preferredCMMnotfound : Pointer[CUChar]) : Int;

external CMGetPS2ColorRenderingVMSize(
    srcProf : CMProfileRef,
    dstProf : CMProfileRef,
    vmSize : Pointer[UInt],
    preferredCMMnotfound : Pointer[CUChar]) : Int;

alias kCMFloatBitmapFlagsNone = 0;
alias kCMFloatBitmapFlagsAlpha = 1;
alias kCMFloatBitmapFlagsAlphaPremul = 2;
alias kCMFloatBitmapFlagsRangeClipped = 4;

alias CMFloatBitmapFlags = Int;

record Struct_CMFloatBitmap (
    version : CULong,
    buffers : Array[Pointer[Float],16],
    height : CULong,
    width : CULong,
    rowStride : CLong,
    colStride : CLong,
    space : UInt,
    flags : CMFloatBitmapFlags,
);

alias CMFloatBitmap = Struct_CMFloatBitmap;

external kCMIlluminantD50 : Array[Float,3];

external kCMIlluminantD65 : Array[Float,3];

external CMFloatBitmapMakeChunky(
    buffer : Pointer[Float],
    height : CULong,
    width : CULong,
    space : UInt) : CMFloatBitmap;

external CMConvertXYZFloatBitmap(
    src : Pointer[CMFloatBitmap],
    srcIlluminantXYZ : Pointer[Float],
    dst : Pointer[CMFloatBitmap],
    dstIlluminantXYZ : Pointer[Float],
    method : UInt) : Int;

external CMConvertRGBFloatBitmap(
    src : Pointer[CMFloatBitmap],
    dst : Pointer[CMFloatBitmap]) : Int;

external CMMatchFloatBitmap(
    cw : CMWorldRef,
    src : Pointer[CMFloatBitmap],
    dst : Pointer[CMFloatBitmap]) : Int;

external CWColorWorldSetProperty(
    cw : CMWorldRef,
    key : CFStringRef,
    value : CFTypeRef);

external CWColorWorldGetProperty(
    cw : CMWorldRef,
    key : CFStringRef) : RawPointer;

external CMM_ConcatColorWorld(
    cw : CMWorldRef,
    profileSet : Pointer[NCMConcatProfileSet],
    proc : CMConcatCallBackUPP,
    refCon : RawPointer) : Int;

external CMM_MatchColors(
    cw : CMWorldRef,
    colors : Pointer[CMColor],
    count : UInt) : Int;

external CMM_CheckColors(
    cw : CMWorldRef,
    colors : Pointer[CMColor],
    count : UInt,
    result : Pointer[CUChar]) : Int;

external CMM_ValidateProfile(
    prof : CMProfileRef,
    valid : Pointer[CUChar]) : Int;

external CMM_MatchBitmap(
    cw : CMWorldRef,
    bitmap : Pointer[CMBitmap],
    progressProc : CMBitmapCallBackUPP,
    refCon : RawPointer,
    matchedBitmap : Pointer[CMBitmap]) : Int;

external CMM_CheckBitmap(
    cw : CMWorldRef,
    bitmap : Pointer[CMBitmap],
    progressProc : CMBitmapCallBackUPP,
    refCon : RawPointer,
    resultBitmap : Pointer[CMBitmap]) : Int;

external CMM_MatchFloatBitmap(
    cw : CMWorldRef,
    bitmap : Pointer[CMFloatBitmap],
    resultBitmap : Pointer[CMFloatBitmap]) : Int;

external CMM_CreateLinkProfile(
    prof : CMProfileRef,
    profileSet : Pointer[NCMConcatProfileSet],
    proc : CMConcatCallBackUPP,
    refCon : RawPointer) : Int;

external CMM_GetProperty(
    cw : CMWorldRef,
    requestedKey : CFStringRef) : CFTypeRef;

alias cmDeviceInfoVersion1 = 65536;
alias cmDeviceProfileInfoVersion1 = 65536;
alias cmDeviceProfileInfoVersion2 = 131072;

alias cmCurrentDeviceInfoVersion = 65536;
alias cmCurrentProfileInfoVersion = 65536;

alias cmDefaultDeviceID = 0;
alias cmDefaultProfileID = 0;

alias cmDeviceStateDefault = 0;
alias cmDeviceStateOffline = 1;
alias cmDeviceStateBusy = 2;
alias cmDeviceStateForceNotify = 2147483648;
alias cmDeviceStateDeviceRsvdBits = 16711680;
alias cmDeviceStateAppleRsvdBits = 4278255615;

alias cmIterateFactoryDeviceProfiles = 1;
alias cmIterateCustomDeviceProfiles = 2;
alias cmIterateCurrentDeviceProfiles = 3;
alias cmIterateAllDeviceProfiles = 4;
alias cmIterateDeviceProfilesMask = 15;

alias cmDeviceDBNotFoundErr = 4294963069;
alias cmDeviceAlreadyRegistered = 4294963068;
alias cmDeviceNotRegistered = 4294963067;
alias cmDeviceProfilesNotFound = 4294963066;
alias cmInternalCFErr = 4294963065;
alias cmPrefsSynchError = 4294963064;

alias CMDeviceState = UInt;

alias CMDeviceID = UInt;

alias CMDeviceProfileID = UInt;

alias cmScannerDeviceClass = 1935896178;
alias cmCameraDeviceClass = 1668117089;
alias cmDisplayDeviceClass = 1835955314;
alias cmPrinterDeviceClass = 1886549106;
alias cmProofDeviceClass = 1886549350;

alias CMDeviceClass = UInt;

record Struct_CMDeviceScope (
    deviceUser : CFStringRef,
    deviceHost : CFStringRef,
);

alias CMDeviceScope = Struct_CMDeviceScope;

alias CMDeviceProfileScope = Struct_CMDeviceScope;

record Struct_CMDeviceInfo (
    dataVersion : UInt,
    deviceClass : UInt,
    deviceID : UInt,
    deviceScope : CMDeviceScope,
    deviceState : UInt,
    defaultProfileID : UInt,
    deviceName : Pointer[CFDictionaryRef],
    profileCount : UInt,
    reserved : UInt,
);

alias CMDeviceInfo = Struct_CMDeviceInfo;

alias CMDeviceInfoPtr = Pointer[Struct_CMDeviceInfo];

record Struct_CMDeviceProfileInfo (
    dataVersion : UInt,
    profileID : UInt,
    profileLoc : CMProfileLocation,
    profileName : CFDictionaryRef,
    reserved : UInt,
);

alias CMDeviceProfileInfo = Struct_CMDeviceProfileInfo;

record Struct_NCMDeviceProfileInfo (
    dataVersion : UInt,
    profileID : UInt,
    profileLoc : CMProfileLocation,
    profileName : CFDictionaryRef,
    profileScope : CMDeviceProfileScope,
    reserved : UInt,
);

alias NCMDeviceProfileInfo = Struct_NCMDeviceProfileInfo;

record Struct_CMDeviceProfileArray (
    profileCount : UInt,
    profiles : Array[CMDeviceProfileInfo,1],
);

alias CMDeviceProfileArray = Struct_CMDeviceProfileArray;

alias CMDeviceProfileArrayPtr = Pointer[Struct_CMDeviceProfileArray];

alias CMIterateDeviceInfoProcPtr = CCodePointer[[Pointer[Struct_CMDeviceInfo],RawPointer],[Short]];

alias CMIterateDeviceProfileProcPtr = CCodePointer[[Pointer[Struct_CMDeviceInfo],Pointer[Struct_NCMDeviceProfileInfo],RawPointer],[Short]];

external CMRegisterColorDevice(
    deviceClass : UInt,
    deviceID : UInt,
    deviceName : CFDictionaryRef,
    deviceScope : Pointer[CMDeviceScope]) : Int;

external CMUnregisterColorDevice(
    deviceClass : UInt,
    deviceID : UInt) : Int;

external CMSetDefaultDevice(
    deviceClass : UInt,
    deviceID : UInt) : Int;

external CMGetDefaultDevice(
    deviceClass : UInt,
    deviceID : Pointer[UInt]) : Int;

external CMSetDeviceFactoryProfiles(
    deviceClass : UInt,
    deviceID : UInt,
    defaultProfID : UInt,
    deviceProfiles : Pointer[CMDeviceProfileArray]) : Int;

external CMGetDeviceFactoryProfiles(
    deviceClass : UInt,
    deviceID : UInt,
    defaultProfID : Pointer[UInt],
    arraySize : Pointer[UInt],
    deviceProfiles : Pointer[CMDeviceProfileArray]) : Int;

external CMSetDeviceDefaultProfileID(
    deviceClass : UInt,
    deviceID : UInt,
    defaultProfID : UInt) : Int;

external CMGetDeviceDefaultProfileID(
    deviceClass : UInt,
    deviceID : UInt,
    defaultProfID : Pointer[UInt]) : Int;

external CMSetDeviceProfile(
    deviceClass : UInt,
    deviceID : UInt,
    profileScope : Pointer[CMDeviceProfileScope],
    profileID : UInt,
    profileLoc : Pointer[CMProfileLocation]) : Int;

external CMGetDeviceProfile(
    deviceClass : UInt,
    deviceID : UInt,
    profileID : UInt,
    profileLoc : Pointer[CMProfileLocation]) : Int;

external CMSetDeviceState(
    deviceClass : UInt,
    deviceID : UInt,
    deviceState : UInt) : Int;

external CMGetDeviceState(
    deviceClass : UInt,
    deviceID : UInt,
    deviceState : Pointer[UInt]) : Int;

external CMGetDeviceInfo(
    deviceClass : UInt,
    deviceID : UInt,
    deviceInfo : Pointer[CMDeviceInfo]) : Int;

external CMIterateColorDevices(
    proc : CMIterateDeviceInfoProcPtr,
    seed : Pointer[UInt],
    count : Pointer[UInt],
    refCon : RawPointer) : Int;

external CMIterateDeviceProfiles(
    proc : CMIterateDeviceProfileProcPtr,
    seed : Pointer[UInt],
    count : Pointer[UInt],
    flags : UInt,
    refCon : RawPointer) : Int;

alias leftCaret = 0;
alias rightCaret = 4294967295;
alias kHilite = 1;

alias smLeftCaret = 0;
alias smRightCaret = 4294967295;
alias smHilite = 1;

alias onlyStyleRun = 0;
alias leftStyleRun = 1;
alias rightStyleRun = 2;
alias middleStyleRun = 3;
alias smOnlyStyleRun = 0;
alias smLeftStyleRun = 1;
alias smRightStyleRun = 2;
alias smMiddleStyleRun = 3;

alias JustStyleCode = Short;

alias TruncCode = Short;

alias truncEnd = 0;
alias truncMiddle = 16384;
alias smTruncEnd = 0;
alias smTruncMiddle = 16384;

alias notTruncated = 0;
alias truncated = 1;
alias truncErr = 4294967295;
alias smNotTruncated = 0;
alias smTruncated = 1;
alias smTruncErr = 4294967295;

alias StyledLineBreakCode = CChar;

alias smBreakWord = 0;
alias smBreakChar = 1;
alias smBreakOverflow = 2;

alias tfAntiAlias = 1;
alias tfUnicode = 2;

record Struct_FontInfo (
    ascent : Short,
    descent : Short,
    widMax : Short,
    leading : Short,
);

alias FontInfo = Struct_FontInfo;

alias FormatOrder = Array[Short,1];

alias FormatOrderPtr = Pointer[FormatOrder];

alias StyleRunDirectionProcPtr = CCodePointer[[Short,RawPointer],[CUChar]];

alias StyleRunDirectionUPP = StyleRunDirectionProcPtr;

external NewStyleRunDirectionUPP(
    userRoutine : StyleRunDirectionProcPtr) : StyleRunDirectionUPP;

external DisposeStyleRunDirectionUPP(
    userUPP : StyleRunDirectionUPP);

external InvokeStyleRunDirectionUPP(
    styleRunIndex : Short,
    dirParam : RawPointer,
    userUPP : StyleRunDirectionUPP) : CUChar;

alias invalColReq = 4294967295;

alias srcCopy = 0;
alias srcOr = 1;
alias srcXor = 2;
alias srcBic = 3;
alias notSrcCopy = 4;
alias notSrcOr = 5;
alias notSrcXor = 6;
alias notSrcBic = 7;
alias patCopy = 8;
alias patOr = 9;
alias patXor = 10;
alias patBic = 11;
alias notPatCopy = 12;
alias notPatOr = 13;
alias notPatXor = 14;
alias notPatBic = 15;
alias grayishTextOr = 49;
alias hilitetransfermode = 50;
alias hilite = 50;
alias blend = 32;
alias addPin = 33;
alias addOver = 34;
alias subPin = 35;
alias addMax = 37;
alias adMax = 37;
alias subOver = 38;
alias adMin = 39;
alias ditherCopy = 64;
alias transparent = 36;

alias italicBit = 1;
alias ulineBit = 2;
alias outlineBit = 3;
alias shadowBit = 4;
alias condenseBit = 5;
alias extendBit = 6;

alias normalBit = 0;
alias inverseBit = 1;
alias redBit = 4;
alias greenBit = 3;
alias blueBit = 2;
alias cyanBit = 8;
alias magentaBit = 7;
alias yellowBit = 6;
alias blackBit = 5;

alias blackColor = 33;
alias whiteColor = 30;
alias redColor = 205;
alias greenColor = 341;
alias blueColor = 409;
alias cyanColor = 273;
alias magentaColor = 137;
alias yellowColor = 69;

alias picLParen = 0;
alias picRParen = 1;

alias clutType = 0;
alias fixedType = 1;
alias directType = 2;

alias gdDevType = 0;
alias interlacedDevice = 2;
alias hwMirroredDevice = 4;
alias roundedDevice = 5;
alias hasAuxMenuBar = 6;
alias burstDevice = 7;
alias ext32Device = 8;
alias ramInit = 10;
alias mainScreen = 11;
alias allInit = 12;
alias screenDevice = 13;
alias noDriver = 14;
alias screenActive = 15;

alias hiliteBit = 7;
alias pHiliteBit = 0;

alias defQDColors = 127;
alias RGBDirect = 16;
alias baseAddr32 = 4;

alias sysPatListID = 0;
alias iBeamCursor = 1;
alias crossCursor = 2;
alias plusCursor = 3;
alias watchCursor = 4;

alias kQDGrafVerbFrame = 0;
alias kQDGrafVerbPaint = 1;
alias kQDGrafVerbErase = 2;
alias kQDGrafVerbInvert = 3;
alias kQDGrafVerbFill = 4;

alias GrafVerb = CChar;

alias chunky = 0;
alias chunkyPlanar = 1;
alias planar = 2;

alias PixelType = CChar;

alias Bits16 = Array[Short,16];

record Struct_Pattern (
    pat : Array[CUChar,8],
);

alias Pattern = Struct_Pattern;

alias ConstPatternParam = Pointer[Pattern];

alias PatPtr = Pointer[Pattern];

alias PatHandle = Pointer[PatPtr];

alias QDByte = CChar;

alias QDPtr = Pointer[CChar];

alias QDHandle = Pointer[QDPtr];

alias QDErr = Short;

alias singleDevicesBit = 0;
alias dontMatchSeedsBit = 1;
alias allDevicesBit = 2;

alias singleDevices = 1;
alias dontMatchSeeds = 2;
alias allDevices = 4;

alias DeviceLoopFlags = CULong;

alias PrinterStatusOpcode = Int;

alias kPrinterFontStatus = 0;
alias kPrinterScalingStatus = 1;

record Struct_PrinterFontStatus (
    oResult : Int,
    iFondID : Short,
    iStyle : CUChar,
);

alias PrinterFontStatus = Struct_PrinterFontStatus;

record Struct_PrinterScalingStatus (
    oScalingFactors : Point,
);

alias PrinterScalingStatus = Struct_PrinterScalingStatus;

record Struct_BitMap (
    baseAddr : Ptr,
    rowBytes : Short,
    bounds : Rect,
);

alias BitMap = Struct_BitMap;

alias BitMapPtr = Pointer[BitMap];

alias BitMapHandle = Pointer[BitMapPtr];

record Struct_Cursor (
    data : Bits16,
    mask : Bits16,
    hotSpot : Point,
);

alias Cursor = Struct_Cursor;

alias CursPtr = Pointer[Cursor];

alias CursHandle = Pointer[CursPtr];

record Struct_PenState (
    pnLoc : Point,
    pnSize : Point,
    pnMode : Short,
    pnPat : Pattern,
);

alias PenState = Struct_PenState;

alias RgnHandle = OpaquePointer;

record Struct_Picture (
    picSize : Short,
    picFrame : Rect,
);

alias Picture = Struct_Picture;

alias PicPtr = Pointer[Picture];

alias PicHandle = Pointer[PicPtr];

record Struct_MacPolygon (
    polySize : Short,
    polyBBox : Rect,
    polyPoints : Array[Point,1],
);

alias MacPolygon = Struct_MacPolygon;

alias Polygon = MacPolygon;

alias PolyPtr = Pointer[MacPolygon];

alias PolyHandle = Pointer[PolyPtr];

alias QDTextProcPtr = CCodePointer[[Short,RawPointer,Struct_Point,Struct_Point],[]];

alias QDLineProcPtr = CCodePointer[[Struct_Point],[]];

alias QDRectProcPtr = CCodePointer[[CChar,Pointer[Struct_Rect]],[]];

alias QDRRectProcPtr = CCodePointer[[CChar,Pointer[Struct_Rect],Short,Short],[]];

alias QDOvalProcPtr = CCodePointer[[CChar,Pointer[Struct_Rect]],[]];

alias QDArcProcPtr = CCodePointer[[CChar,Pointer[Struct_Rect],Short,Short],[]];

alias QDPolyProcPtr = CCodePointer[[CChar,Pointer[Pointer[Struct_MacPolygon]]],[]];

alias QDRgnProcPtr = CCodePointer[[CChar,OpaquePointer],[]];

alias QDBitsProcPtr = CCodePointer[[Pointer[Struct_BitMap],Pointer[Struct_Rect],Pointer[Struct_Rect],Short,OpaquePointer],[]];

alias QDCommentProcPtr = CCodePointer[[Short,Short,Pointer[Pointer[CChar]]],[]];

alias QDTxMeasProcPtr = CCodePointer[[Short,RawPointer,Pointer[Struct_Point],Pointer[Struct_Point],Pointer[Struct_FontInfo]],[Short]];

alias QDGetPicProcPtr = CCodePointer[[RawPointer,Short],[]];

alias QDPutPicProcPtr = CCodePointer[[RawPointer,Short],[]];

alias QDOpcodeProcPtr = CCodePointer[[Pointer[Struct_Rect],Pointer[Struct_Rect],UShort,Short],[]];

alias QDStdGlyphsProcPtr = CCodePointer[[RawPointer,CULong],[Int]];

alias QDJShieldCursorProcPtr = CCodePointer[[Short,Short,Short,Short],[]];

alias QDTextUPP = QDTextProcPtr;

alias QDLineUPP = QDLineProcPtr;

alias QDRectUPP = QDRectProcPtr;

alias QDRRectUPP = QDRRectProcPtr;

alias QDOvalUPP = QDOvalProcPtr;

alias QDArcUPP = QDArcProcPtr;

alias QDPolyUPP = QDPolyProcPtr;

alias QDRgnUPP = QDRgnProcPtr;

alias QDBitsUPP = QDBitsProcPtr;

alias QDCommentUPP = QDCommentProcPtr;

alias QDTxMeasUPP = QDTxMeasProcPtr;

alias QDGetPicUPP = QDGetPicProcPtr;

alias QDPutPicUPP = QDPutPicProcPtr;

alias QDOpcodeUPP = QDOpcodeProcPtr;

alias QDStdGlyphsUPP = QDStdGlyphsProcPtr;

alias QDJShieldCursorUPP = QDJShieldCursorProcPtr;

record Struct_QDProcs (
    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,
);

alias QDProcs = Struct_QDProcs;

alias QDProcsPtr = Pointer[QDProcs];

external NewQDTextUPP(
    userRoutine : QDTextProcPtr) : QDTextUPP;

external NewQDLineUPP(
    userRoutine : QDLineProcPtr) : QDLineUPP;

external NewQDRectUPP(
    userRoutine : QDRectProcPtr) : QDRectUPP;

external NewQDRRectUPP(
    userRoutine : QDRRectProcPtr) : QDRRectUPP;

external NewQDOvalUPP(
    userRoutine : QDOvalProcPtr) : QDOvalUPP;

external NewQDArcUPP(
    userRoutine : QDArcProcPtr) : QDArcUPP;

external NewQDPolyUPP(
    userRoutine : QDPolyProcPtr) : QDPolyUPP;

external NewQDRgnUPP(
    userRoutine : QDRgnProcPtr) : QDRgnUPP;

external NewQDBitsUPP(
    userRoutine : QDBitsProcPtr) : QDBitsUPP;

external NewQDCommentUPP(
    userRoutine : QDCommentProcPtr) : QDCommentUPP;

external NewQDTxMeasUPP(
    userRoutine : QDTxMeasProcPtr) : QDTxMeasUPP;

external NewQDGetPicUPP(
    userRoutine : QDGetPicProcPtr) : QDGetPicUPP;

external NewQDPutPicUPP(
    userRoutine : QDPutPicProcPtr) : QDPutPicUPP;

external NewQDOpcodeUPP(
    userRoutine : QDOpcodeProcPtr) : QDOpcodeUPP;

external NewQDStdGlyphsUPP(
    userRoutine : QDStdGlyphsProcPtr) : QDStdGlyphsUPP;

external NewQDJShieldCursorUPP(
    userRoutine : QDJShieldCursorProcPtr) : QDJShieldCursorUPP;

external DisposeQDTextUPP(
    userUPP : QDTextUPP);

external DisposeQDLineUPP(
    userUPP : QDLineUPP);

external DisposeQDRectUPP(
    userUPP : QDRectUPP);

external DisposeQDRRectUPP(
    userUPP : QDRRectUPP);

external DisposeQDOvalUPP(
    userUPP : QDOvalUPP);

external DisposeQDArcUPP(
    userUPP : QDArcUPP);

external DisposeQDPolyUPP(
    userUPP : QDPolyUPP);

external DisposeQDRgnUPP(
    userUPP : QDRgnUPP);

external DisposeQDBitsUPP(
    userUPP : QDBitsUPP);

external DisposeQDCommentUPP(
    userUPP : QDCommentUPP);

external DisposeQDTxMeasUPP(
    userUPP : QDTxMeasUPP);

external DisposeQDGetPicUPP(
    userUPP : QDGetPicUPP);

external DisposeQDPutPicUPP(
    userUPP : QDPutPicUPP);

external DisposeQDOpcodeUPP(
    userUPP : QDOpcodeUPP);

external DisposeQDStdGlyphsUPP(
    userUPP : QDStdGlyphsUPP);

external DisposeQDJShieldCursorUPP(
    userUPP : QDJShieldCursorUPP);

external InvokeQDTextUPP(
    byteCount : Short,
    textBuf : RawPointer,
    numer : Point,
    denom : Point,
    userUPP : QDTextUPP);

external InvokeQDLineUPP(
    newPt : Point,
    userUPP : QDLineUPP);

external InvokeQDRectUPP(
    verb : CChar,
    r : Pointer[Rect],
    userUPP : QDRectUPP);

external InvokeQDRRectUPP(
    verb : CChar,
    r : Pointer[Rect],
    ovalWidth : Short,
    ovalHeight : Short,
    userUPP : QDRRectUPP);

external InvokeQDOvalUPP(
    verb : CChar,
    r : Pointer[Rect],
    userUPP : QDOvalUPP);

external InvokeQDArcUPP(
    verb : CChar,
    r : Pointer[Rect],
    startAngle : Short,
    arcAngle : Short,
    userUPP : QDArcUPP);

external InvokeQDPolyUPP(
    verb : CChar,
    poly : PolyHandle,
    userUPP : QDPolyUPP);

external InvokeQDRgnUPP(
    verb : CChar,
    rgn : RgnHandle,
    userUPP : QDRgnUPP);

external InvokeQDBitsUPP(
    srcBits : Pointer[BitMap],
    srcRect : Pointer[Rect],
    dstRect : Pointer[Rect],
    mode : Short,
    maskRgn : RgnHandle,
    userUPP : QDBitsUPP);

external InvokeQDCommentUPP(
    kind : Short,
    dataSize : Short,
    dataHandle : Handle,
    userUPP : QDCommentUPP);

external InvokeQDTxMeasUPP(
    byteCount : Short,
    textAddr : RawPointer,
    numer : Pointer[Point],
    denom : Pointer[Point],
    info : Pointer[FontInfo],
    userUPP : QDTxMeasUPP) : Short;

external InvokeQDGetPicUPP(
    dataPtr : RawPointer,
    byteCount : Short,
    userUPP : QDGetPicUPP);

external InvokeQDPutPicUPP(
    dataPtr : RawPointer,
    byteCount : Short,
    userUPP : QDPutPicUPP);

external InvokeQDOpcodeUPP(
    fromRect : Pointer[Rect],
    toRect : Pointer[Rect],
    opcode : UShort,
    version : Short,
    userUPP : QDOpcodeUPP);

external InvokeQDStdGlyphsUPP(
    dataStream : RawPointer,
    size : CULong,
    userUPP : QDStdGlyphsUPP) : Int;

external InvokeQDJShieldCursorUPP(
    left : Short,
    top : Short,
    right : Short,
    bottom : Short,
    userUPP : QDJShieldCursorUPP);

alias WindowPtr = OpaquePointer;

alias DialogPtr = OpaquePointer;

alias GrafPtr = OpaquePointer;

alias WindowRef = WindowPtr;

alias DragConstraint = UShort;

alias kNoConstraint = 0;
alias kVerticalConstraint = 1;
alias kHorizontalConstraint = 2;

alias DragGrayRgnProcPtr = CCodePointer[[],[]];

record Struct_RGBColor (
    red : UShort,
    green : UShort,
    blue : UShort,
);

alias RGBColor = Struct_RGBColor;

alias RGBColorPtr = Pointer[RGBColor];

alias RGBColorHdl = Pointer[RGBColorPtr];

alias ColorSearchProcPtr = CCodePointer[[Pointer[Struct_RGBColor],Pointer[CLong]],[CUChar]];

alias ColorComplementProcPtr = CCodePointer[[Pointer[Struct_RGBColor]],[CUChar]];

alias DragGrayRgnUPP = DragGrayRgnProcPtr;

alias ColorSearchUPP = ColorSearchProcPtr;

alias ColorComplementUPP = ColorComplementProcPtr;

external NewDragGrayRgnUPP(
    userRoutine : DragGrayRgnProcPtr) : DragGrayRgnUPP;

external NewColorSearchUPP(
    userRoutine : ColorSearchProcPtr) : ColorSearchUPP;

external NewColorComplementUPP(
    userRoutine : ColorComplementProcPtr) : ColorComplementUPP;

external DisposeDragGrayRgnUPP(
    userUPP : DragGrayRgnUPP);

external DisposeColorSearchUPP(
    userUPP : ColorSearchUPP);

external DisposeColorComplementUPP(
    userUPP : ColorComplementUPP);

external InvokeDragGrayRgnUPP(
    userUPP : DragGrayRgnUPP);

external InvokeColorSearchUPP(
    rgb : Pointer[RGBColor],
    position : Pointer[CLong],
    userUPP : ColorSearchUPP) : CUChar;

external InvokeColorComplementUPP(
    rgb : Pointer[RGBColor],
    userUPP : ColorComplementUPP) : CUChar;

record Struct_ColorSpec (
    value : Short,
    rgb : RGBColor,
);

alias ColorSpec = Struct_ColorSpec;

alias ColorSpecPtr = Pointer[ColorSpec];

alias CSpecArray = Array[ColorSpec,1];

record Struct_ColorTable (
    ctSeed : Int,
    ctFlags : Short,
    ctSize : Short,
    ctTable : CSpecArray,
);

alias ColorTable = Struct_ColorTable;

alias CTabPtr = Pointer[ColorTable];

alias CTabHandle = Pointer[CTabPtr];

record Struct_xColorSpec (
    value : Short,
    rgb : RGBColor,
    xalpha : Short,
);

alias xColorSpec = Struct_xColorSpec;

alias xColorSpecPtr = Pointer[xColorSpec];

alias xCSpecArray = Array[xColorSpec,1];

record Struct_MatchRec (
    red : UShort,
    green : UShort,
    blue : UShort,
    matchData : CLong,
);

alias MatchRec = Struct_MatchRec;

alias k1MonochromePixelFormat = 1;
alias k2IndexedPixelFormat = 2;
alias k4IndexedPixelFormat = 4;
alias k8IndexedPixelFormat = 8;
alias k16BE555PixelFormat = 16;
alias k24RGBPixelFormat = 24;
alias k32ARGBPixelFormat = 32;
alias k1IndexedGrayPixelFormat = 33;
alias k2IndexedGrayPixelFormat = 34;
alias k4IndexedGrayPixelFormat = 36;
alias k8IndexedGrayPixelFormat = 40;
alias k16LE555PixelFormat = 1278555445;
alias k16LE5551PixelFormat = 892679473;
alias k16BE565PixelFormat = 1110783541;
alias k16LE565PixelFormat = 1278555701;
alias k24BGRPixelFormat = 842285639;
alias k32BGRAPixelFormat = 1111970369;
alias k32ABGRPixelFormat = 1094862674;
alias k32RGBAPixelFormat = 1380401729;
alias kYUVSPixelFormat = 2037741171;
alias kYUVUPixelFormat = 2037741173;
alias kYVU9PixelFormat = 1498830137;
alias kYUV411PixelFormat = 1496592689;
alias kYVYU422PixelFormat = 1498831189;
alias kUYVY422PixelFormat = 1431918169;
alias kYUV211PixelFormat = 1496461617;
alias k2vuyPixelFormat = 846624121;

record Struct_PixMap (
    baseAddr : Ptr,
    rowBytes : Short,
    bounds : Rect,
    pmVersion : Short,
    packType : Short,
    packSize : Int,
    hRes : Int,
    vRes : Int,
    pixelType : Short,
    pixelSize : Short,
    cmpCount : Short,
    cmpSize : Short,
    pixelFormat : UInt,
    pmTable : CTabHandle,
    pmExt : RawPointer,
);

alias PixMap = Struct_PixMap;

alias PixMapPtr = Pointer[PixMap];

alias PixMapHandle = Pointer[PixMapPtr];

record Struct_PixPat (
    patType : Short,
    patMap : PixMapHandle,
    patData : Handle,
    patXData : Handle,
    patXValid : Short,
    patXMap : Handle,
    pat1Data : Pattern,
);

alias PixPat = Struct_PixPat;

alias PixPatPtr = Pointer[PixPat];

alias PixPatHandle = Pointer[PixPatPtr];

record Struct_CCrsr (
    crsrType : Short,
    crsrMap : PixMapHandle,
    crsrData : Handle,
    crsrXData : Handle,
    crsrXValid : Short,
    crsrXHandle : Handle,
    crsr1Data : Bits16,
    crsrMask : Bits16,
    crsrHotSpot : Point,
    crsrXTable : Int,
    crsrID : Int,
);

alias CCrsr = Struct_CCrsr;

alias CCrsrPtr = Pointer[CCrsr];

alias CCrsrHandle = Pointer[CCrsrPtr];

record Struct_GammaTbl (
    gVersion : Short,
    gType : Short,
    gFormulaSize : Short,
    gChanCnt : Short,
    gDataCnt : Short,
    gDataWidth : Short,
    gFormulaData : Array[Short,1],
);

alias GammaTbl = Struct_GammaTbl;

alias GammaTblPtr = Pointer[GammaTbl];

alias GammaTblHandle = Pointer[GammaTblPtr];

record Struct_ITab (
    iTabSeed : Int,
    iTabRes : Short,
    iTTable : Array[CUChar,1],
);

alias ITab = Struct_ITab;

alias ITabPtr = Pointer[ITab];

alias ITabHandle = Pointer[ITabPtr];

record Struct_SProcRec (
    nxtSrch : Handle,
    srchProc : ColorSearchUPP,
);

alias SProcRec = Struct_SProcRec;

alias SProcPtr = Pointer[SProcRec];

alias SProcHndl = Pointer[SProcPtr];

record Struct_CProcRec (
    nxtComp : Handle,
    compProc : ColorComplementUPP,
);

alias CProcRec = Struct_CProcRec;

alias CProcPtr = Pointer[CProcRec];

alias CProcHndl = Pointer[CProcPtr];

alias GDevice = Struct_GDevice;

alias GDPtr = Pointer[GDevice];

alias GDHandle = Pointer[GDPtr];

record Struct_GDevice (
    gdRefNum : Short,
    gdID : Short,
    gdType : Short,
    gdITable : ITabHandle,
    gdResPref : Short,
    gdSearchProc : SProcHndl,
    gdCompProc : CProcHndl,
    gdFlags : Short,
    gdPMap : PixMapHandle,
    gdRefCon : Int,
    gdNextGD : GDHandle,
    gdRect : Rect,
    gdMode : Int,
    gdCCBytes : Short,
    gdCCDepth : Short,
    gdCCXData : Handle,
    gdCCXMask : Handle,
    gdExt : Handle,
);

record Struct_GrafVars (
    rgbOpColor : RGBColor,
    rgbHiliteColor : RGBColor,
    pmFgColor : Handle,
    pmFgIndex : Short,
    pmBkColor : Handle,
    pmBkIndex : Short,
    pmFlags : Short,
);

alias GrafVars = Struct_GrafVars;

alias GVarPtr = Pointer[GrafVars];

alias GVarHandle = Pointer[GVarPtr];

alias CGrafPtr = GrafPtr;

alias QDPrinterStatusProcPtr = CCodePointer[[Int,OpaquePointer,RawPointer],[Int]];

alias QDPrinterStatusUPP = QDPrinterStatusProcPtr;

record Struct_CQDProcs (
    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,
    glyphsProc : QDStdGlyphsUPP,
    printerStatusProc : QDPrinterStatusUPP,
    newProc4 : UniversalProcPtr,
    newProc5 : UniversalProcPtr,
    newProc6 : UniversalProcPtr,
);

alias CQDProcs = Struct_CQDProcs;

alias CQDProcsPtr = Pointer[CQDProcs];

alias CWindowPtr = WindowPtr;

record Struct_ReqListRec (
    reqLSize : Short,
    reqLData : Array[Short,1],
);

alias ReqListRec = Struct_ReqListRec;

record Struct_OpenCPicParams (
    srcRect : Rect,
    hRes : Int,
    vRes : Int,
    version : Short,
    reserved1 : Short,
    reserved2 : Int,
);

alias OpenCPicParams = Struct_OpenCPicParams;

alias DeviceLoopDrawingProcPtr = CCodePointer[[Short,Short,Pointer[Pointer[Struct_GDevice]],RawPointer],[]];

alias DeviceLoopDrawingUPP = DeviceLoopDrawingProcPtr;

external NewDeviceLoopDrawingUPP(
    userRoutine : DeviceLoopDrawingProcPtr) : DeviceLoopDrawingUPP;

external DisposeDeviceLoopDrawingUPP(
    userUPP : DeviceLoopDrawingUPP);

external InvokeDeviceLoopDrawingUPP(
    depth : Short,
    deviceFlags : Short,
    targetDevice : GDHandle,
    userData : SRefCon,
    userUPP : DeviceLoopDrawingUPP);

alias kQDRegionToRectsMsgInit = 1;
alias kQDRegionToRectsMsgParse = 2;
alias kQDRegionToRectsMsgTerminate = 3;

alias kQDParseRegionFromTop = 1;
alias kQDParseRegionFromBottom = 2;
alias kQDParseRegionFromLeft = 4;
alias kQDParseRegionFromRight = 8;
alias kQDParseRegionFromTopLeft = 5;
alias kQDParseRegionFromBottomRight = 10;

alias QDRegionParseDirection = Int;

alias RegionToRectsProcPtr = CCodePointer[[UShort,OpaquePointer,Pointer[Struct_Rect],RawPointer],[Int]];

alias RegionToRectsUPP = RegionToRectsProcPtr;

external NewRegionToRectsUPP(
    userRoutine : RegionToRectsProcPtr) : RegionToRectsUPP;

external DisposeRegionToRectsUPP(
    userUPP : RegionToRectsUPP);

external InvokeRegionToRectsUPP(
    message : UShort,
    rgn : RgnHandle,
    rect : Pointer[Rect],
    refCon : RawPointer,
    userUPP : RegionToRectsUPP) : Int;

external QDRegionToRects(
    rgn : RgnHandle,
    dir : Int,
    proc : RegionToRectsUPP,
    userData : RawPointer) : Int;

external SetRect(
    r : Pointer[Rect],
    left : Short,
    top : Short,
    right : Short,
    bottom : Short);

external OffsetRect(
    r : Pointer[Rect],
    dh : Short,
    dv : Short);

external InsetRect(
    r : Pointer[Rect],
    dh : Short,
    dv : Short);

external SectRect(
    src1 : Pointer[Rect],
    src2 : Pointer[Rect],
    dstRect : Pointer[Rect]) : CUChar;

external UnionRect(
    src1 : Pointer[Rect],
    src2 : Pointer[Rect],
    dstRect : Pointer[Rect]);

external EqualRect(
    rect1 : Pointer[Rect],
    rect2 : Pointer[Rect]) : CUChar;

external EmptyRect(
    r : Pointer[Rect]) : CUChar;

external SetPt(
    pt : Pointer[Point],
    h : Short,
    v : Short);

external ScalePt(
    pt : Pointer[Point],
    srcRect : Pointer[Rect],
    dstRect : Pointer[Rect]);

external MapPt(
    pt : Pointer[Point],
    srcRect : Pointer[Rect],
    dstRect : Pointer[Rect]);

external MapRect(
    r : Pointer[Rect],
    srcRect : Pointer[Rect],
    dstRect : Pointer[Rect]);

external AddPt(
    src : Point,
    dst : Pointer[Point]);

external EqualPt(
    pt1 : Point,
    pt2 : Point) : CUChar;

external PtInRect(
    pt : Point,
    r : Pointer[Rect]) : CUChar;

external Pt2Rect(
    pt1 : Point,
    pt2 : Point,
    dstRect : Pointer[Rect]);

external PtToAngle(
    r : Pointer[Rect],
    pt : Point,
    angle : Pointer[Short]);

external SubPt(
    src : Point,
    dst : Pointer[Point]);

alias colorXorXFer = 52;
alias noiseXFer = 53;
alias customXFer = 54;

alias kXFer1PixelAtATime = 1;
alias kXFerConvertPixelToRGB32 = 2;

record Struct_CustomXFerRec (
    version : UInt,
    srcPixels : RawPointer,
    destPixels : RawPointer,
    resultPixels : RawPointer,
    refCon : UInt,
    pixelSize : UInt,
    pixelCount : UInt,
    firstPixelHV : Point,
    destBounds : Rect,
);

alias CustomXFerRec = Struct_CustomXFerRec;

alias CustomXFerRecPtr = Pointer[CustomXFerRec];

alias CustomXFerProcPtr = CCodePointer[[Pointer[Struct_CustomXFerRec]],[]];

alias kCursorComponentsVersion = 65537;

alias kCursorComponentType = 1668641395;

alias cursorDoesAnimate = 1;
alias cursorDoesHardware = 2;
alias cursorDoesUnreadableScreenBits = 4;

alias kRenderCursorInHardware = 1;
alias kRenderCursorInSoftware = 2;

record Struct_CursorInfo (
    version : CLong,
    capabilities : CLong,
    animateDuration : CLong,
    bounds : Rect,
    hotspot : Point,
    reserved : CLong,
);

alias CursorInfo = Struct_CursorInfo;

alias kCursorComponentInit = 1;
alias kCursorComponentGetInfo = 2;
alias kCursorComponentSetOutputMode = 3;
alias kCursorComponentSetData = 4;
alias kCursorComponentReconfigure = 5;
alias kCursorComponentDraw = 6;
alias kCursorComponentErase = 7;
alias kCursorComponentMove = 8;
alias kCursorComponentAnimate = 9;
alias kCursorComponentLastReserved = 80;

alias QDRegionBitsRef = OpaquePointer;

alias kQDXArrowCursor = 0;
alias kQDXIBeamCursor = 1;
alias kQDXIBeamXORCursor = 2;
alias kQDXAliasCursor = 3;
alias kQDXCopyCursor = 4;
alias kQDXMoveCursor = 5;
alias kQDXNumberOfSystemCursors = 6;

alias QDXSystemCursorID = UInt;

alias kQDUseDefaultTextRendering = 0;
alias kQDUseTrueTypeScalerGlyphs = 1;
alias kQDUseCGTextRendering = 2;
alias kQDUseCGTextMetrics = 4;
alias kQDSupportedFlags = 7;
alias kQDDontChangeFlags = 4294967295;

alias pixPurgeBit = 0;
alias noNewDeviceBit = 1;
alias useTempMemBit = 2;
alias keepLocalBit = 3;
alias useDistantHdwrMemBit = 4;
alias useLocalHdwrMemBit = 5;
alias pixelsPurgeableBit = 6;
alias pixelsLockedBit = 7;
alias nativeEndianPixMapBit = 8;
alias mapPixBit = 16;
alias newDepthBit = 17;
alias alignPixBit = 18;
alias newRowBytesBit = 19;
alias reallocPixBit = 20;
alias clipPixBit = 28;
alias stretchPixBit = 29;
alias ditherPixBit = 30;
alias gwFlagErrBit = 31;

alias pixPurge = 1;
alias noNewDevice = 2;
alias useTempMem = 4;
alias keepLocal = 8;
alias useDistantHdwrMem = 16;
alias useLocalHdwrMem = 32;
alias pixelsPurgeable = 64;
alias pixelsLocked = 128;
alias kNativeEndianPixMap = 256;
alias kAllocDirectDrawSurface = 16384;
alias mapPix = 65536;
alias newDepth = 131072;
alias alignPix = 262144;
alias newRowBytes = 524288;
alias reallocPix = 1048576;
alias clipPix = 268435456;
alias stretchPix = 536870912;
alias ditherPix = 1073741824;
alias gwFlagErr = 2147483648;

alias GWorldFlags = CULong;

alias GWorldPtr = CGrafPtr;

alias deviceIsIndirect = 1;
alias deviceNeedsLock = 2;
alias deviceIsStatic = 4;
alias deviceIsExternalBuffer = 8;
alias deviceIsDDSurface = 16;
alias deviceIsDCISurface = 32;
alias deviceIsGDISurface = 64;
alias deviceIsAScreen = 128;
alias deviceIsOverlaySurface = 256;

alias QDPictRef = OpaquePointer;

alias systemFont = 0;
alias applFont = 1;

alias kFMDefaultOptions = 0;

alias kFMDefaultActivationContext = 0;
alias kFMGlobalActivationContext = 1;
alias kFMLocalActivationContext = 0;

alias kFMDefaultIterationScope = 0;
alias kFMGlobalIterationScope = 1;
alias kFMLocalIterationScope = 0;

alias kPlatformDefaultGuiFontID = 1;

alias commandMark = 17;
alias checkMark = 18;
alias diamondMark = 19;
alias appleMark = 20;

alias propFont = 36864;
alias prpFntH = 36865;
alias prpFntW = 36866;
alias prpFntHW = 36867;
alias fixedFont = 45056;
alias fxdFntH = 45057;
alias fxdFntW = 45058;
alias fxdFntHW = 45059;
alias fontWid = 44208;

record Struct_FMInput (
    family : Short,
    size : Short,
    face : CUChar,
    needBits : CUChar,
    device : Short,
    numer : Point,
    denom : Point,
);

alias FMInput = Struct_FMInput;

record Struct_FMOutput (
    errNum : Short,
    fontHandle : Handle,
    boldPixels : CUChar,
    italicPixels : CUChar,
    ulOffset : CUChar,
    ulShadow : CUChar,
    ulThick : CUChar,
    shadowPixels : CUChar,
    extra : CChar,
    ascent : CUChar,
    descent : CUChar,
    widMax : CUChar,
    leading : CChar,
    curStyle : CChar,
    numer : Point,
    denom : Point,
);

alias FMOutput = Struct_FMOutput;

alias FMOutputPtr = Pointer[FMOutput];

alias FMOutPtr = FMOutputPtr;

record Struct_FMetricRec (
    ascent : Int,
    descent : Int,
    leading : Int,
    widMax : Int,
    wTabHandle : Handle,
);

alias FMetricRec = Struct_FMetricRec;

alias FMetricRecPtr = Pointer[FMetricRec];

alias FMetricRecHandle = Pointer[FMetricRecPtr];

alias FontFamilyID = Short;

alias FontPointSize = Short;

alias kFMUseGlobalScopeOption = 1;

alias kFontIDNewYork = 2;
alias kFontIDGeneva = 3;
alias kFontIDMonaco = 4;
alias kFontIDVenice = 5;
alias kFontIDLondon = 6;
alias kFontIDAthens = 7;
alias kFontIDSanFrancisco = 8;
alias kFontIDToronto = 9;
alias kFontIDCairo = 11;
alias kFontIDLosAngeles = 12;
alias kFontIDTimes = 20;
alias kFontIDHelvetica = 21;
alias kFontIDCourier = 22;
alias kFontIDSymbol = 23;
alias kFontIDMobile = 24;

record Struct_WidEntry (
    widStyle : Short,
);

alias WidEntry = Struct_WidEntry;

record Struct_WidTable (
    numWidths : Short,
);

alias WidTable = Struct_WidTable;

record Struct_AsscEntry (
    fontSize : Short,
    fontStyle : Short,
    fontID : Short,
);

alias AsscEntry = Struct_AsscEntry;

record Struct_FontAssoc (
    numAssoc : Short,
);

alias FontAssoc = Struct_FontAssoc;

record Struct_StyleTable (
    fontClass : Short,
    offset : Int,
    reserved : Int,
    indexes : Array[CChar,48],
);

alias StyleTable = Struct_StyleTable;

record Struct_NameTable (
    stringCount : Short,
    baseFontName : Str255,
);

alias NameTable = Struct_NameTable;

record Struct_KernPair (
    kernFirst : CChar,
    kernSecond : CChar,
    kernWidth : Short,
);

alias KernPair = Struct_KernPair;

record Struct_KernEntry (
    kernStyle : Short,
    kernLength : Short,
);

alias KernEntry = Struct_KernEntry;

record Struct_KernTable (
    numKerns : Short,
);

alias KernTable = Struct_KernTable;

record Struct_WidthTable (
    tabData : Array[Int,256],
    tabFont : Handle,
    sExtra : CLong,
    style : CLong,
    fID : Short,
    fSize : Short,
    face : Short,
    device : Short,
    inNumer : Point,
    inDenom : Point,
    aFID : Short,
    fHand : Handle,
    usedFam : CUChar,
    aFace : CUChar,
    vOutput : Short,
    hOutput : Short,
    vFactor : Short,
    hFactor : Short,
    aSize : Short,
    tabSize : Short,
);

alias WidthTable = Struct_WidthTable;

alias WidthTablePtr = Pointer[WidthTable];

alias WidthTableHdl = Pointer[WidthTablePtr];

record Struct_FamRec (
    ffFlags : Short,
    ffFamID : Short,
    ffFirstChar : Short,
    ffLastChar : Short,
    ffAscent : Short,
    ffDescent : Short,
    ffLeading : Short,
    ffWidMax : Short,
    ffWTabOff : Int,
    ffKernOff : Int,
    ffStylOff : Int,
    ffProperty : Array[Short,9],
    ffIntl : Array[Short,2],
    ffVersion : Short,
);

alias FamRec = Struct_FamRec;

record Struct_FontRec (
    fontType : Short,
    firstChar : Short,
    lastChar : Short,
    widMax : Short,
    kernMax : Short,
    nDescent : Short,
    fRectWidth : Short,
    fRectHeight : Short,
    owTLoc : UShort,
    ascent : Short,
    descent : Short,
    leading : Short,
    rowWords : Short,
);

alias FontRec = Struct_FontRec;

alias FontRecPtr = Pointer[FontRec];

alias FontRecHdl = Pointer[FontRecPtr];

alias pmCourteous = 0;
alias pmDithered = 1;
alias pmTolerant = 2;
alias pmAnimated = 4;
alias pmExplicit = 8;
alias pmWhite = 16;
alias pmBlack = 32;
alias pmInhibitG2 = 256;
alias pmInhibitC2 = 512;
alias pmInhibitG4 = 1024;
alias pmInhibitC4 = 2048;
alias pmInhibitG8 = 4096;
alias pmInhibitC8 = 8192;
alias pmNoUpdates = 32768;
alias pmBkUpdates = 40960;
alias pmFgUpdates = 49152;
alias pmAllUpdates = 57344;

record Struct_ColorInfo (
    ciRGB : RGBColor,
    ciUsage : Short,
    ciTolerance : Short,
    ciDataFields : Array[Short,3],
);

alias ColorInfo = Struct_ColorInfo;

alias ColorInfoPtr = Pointer[ColorInfo];

alias ColorInfoHandle = Pointer[ColorInfoPtr];

record Struct_Palette (
    pmEntries : Short,
    pmDataFields : Array[Short,7],
    pmInfo : Array[ColorInfo,1],
);

alias Palette = Struct_Palette;

alias PalettePtr = Pointer[Palette];

alias PaletteHandle = Pointer[PalettePtr];

alias returnColorTable = 1;
alias returnPalette = 2;
alias recordComments = 4;
alias recordFontInfo = 8;
alias suppressBlackAndWhite = 16;

alias systemMethod = 0;
alias popularMethod = 1;
alias medianMethod = 2;

alias ColorBankIsCustom = 4294967295;
alias ColorBankIsExactAnd555 = 0;
alias ColorBankIs555 = 1;

alias PictInfoID = CLong;

record Struct_CommentSpec (
    count : Short,
    ID : Short,
);

alias CommentSpec = Struct_CommentSpec;

alias CommentSpecPtr = Pointer[CommentSpec];

alias CommentSpecHandle = Pointer[CommentSpecPtr];

record Struct_FontSpec (
    pictFontID : Short,
    sysFontID : Short,
    size : Array[CLong,4],
    style : Short,
    nameOffset : CLong,
);

alias FontSpec = Struct_FontSpec;

alias FontSpecPtr = Pointer[FontSpec];

alias FontSpecHandle = Pointer[FontSpecPtr];

record Struct_PictInfo (
    version : Short,
    uniqueColors : CLong,
    thePalette : PaletteHandle,
    theColorTable : CTabHandle,
    hRes : Int,
    vRes : Int,
    depth : Short,
    sourceRect : Rect,
    textCount : CLong,
    lineCount : CLong,
    rectCount : CLong,
    rRectCount : CLong,
    ovalCount : CLong,
    arcCount : CLong,
    polyCount : CLong,
    regionCount : CLong,
    bitMapCount : CLong,
    pixMapCount : CLong,
    commentCount : CLong,
    uniqueComments : CLong,
    commentHandle : CommentSpecHandle,
    uniqueFonts : CLong,
    fontHandle : FontSpecHandle,
    fontNamesHandle : Handle,
    reserved1 : CLong,
    reserved2 : CLong,
);

alias PictInfo = Struct_PictInfo;

alias PictInfoPtr = Pointer[PictInfo];

alias PictInfoHandle = Pointer[PictInfoPtr];

alias InitPickMethodProcPtr = CCodePointer[[Short,Pointer[UInt],Pointer[Short]],[Short]];

alias RecordColorsProcPtr = CCodePointer[[UInt,Pointer[Struct_RGBColor],Int,Pointer[Int]],[Short]];

alias CalcColorTableProcPtr = CCodePointer[[UInt,Short,RawPointer,Pointer[Struct_ColorSpec]],[Short]];

alias DisposeColorPickMethodProcPtr = CCodePointer[[UInt],[Short]];

alias InitPickMethodUPP = InitPickMethodProcPtr;

alias RecordColorsUPP = RecordColorsProcPtr;

alias CalcColorTableUPP = CalcColorTableProcPtr;

alias DisposeColorPickMethodUPP = DisposeColorPickMethodProcPtr;

external NewInitPickMethodUPP(
    userRoutine : InitPickMethodProcPtr) : InitPickMethodUPP;

external NewRecordColorsUPP(
    userRoutine : RecordColorsProcPtr) : RecordColorsUPP;

external NewCalcColorTableUPP(
    userRoutine : CalcColorTableProcPtr) : CalcColorTableUPP;

external NewDisposeColorPickMethodUPP(
    userRoutine : DisposeColorPickMethodProcPtr) : DisposeColorPickMethodUPP;

external DisposeInitPickMethodUPP(
    userUPP : InitPickMethodUPP);

external DisposeRecordColorsUPP(
    userUPP : RecordColorsUPP);

external DisposeCalcColorTableUPP(
    userUPP : CalcColorTableUPP);

external DisposeDisposeColorPickMethodUPP(
    userUPP : DisposeColorPickMethodUPP);

external InvokeInitPickMethodUPP(
    colorsRequested : Short,
    dataRef : Pointer[UInt],
    colorBankType : Pointer[Short],
    userUPP : InitPickMethodUPP) : Short;

external InvokeRecordColorsUPP(
    dataRef : UInt,
    colorsArray : Pointer[RGBColor],
    colorCount : Int,
    uniqueColors : Pointer[Int],
    userUPP : RecordColorsUPP) : Short;

external InvokeCalcColorTableUPP(
    dataRef : UInt,
    colorsRequested : Short,
    colorBankPtr : RawPointer,
    resultPtr : Pointer[ColorSpec],
    userUPP : CalcColorTableUPP) : Short;

external InvokeDisposeColorPickMethodUPP(
    dataRef : UInt,
    userUPP : DisposeColorPickMethodUPP) : Short;

alias mBaseOffset = 1;
alias mRowBytes = 2;
alias mBounds = 3;
alias mVersion = 4;
alias mHRes = 5;
alias mVRes = 6;
alias mPixelType = 7;
alias mPixelSize = 8;
alias mCmpCount = 9;
alias mCmpSize = 10;
alias mPlaneBytes = 11;
alias mVertRefRate = 14;
alias mVidParams = 1;
alias mTable = 2;
alias mPageCnt = 3;
alias mDevType = 4;
alias oneBitMode = 128;
alias twoBitMode = 129;
alias fourBitMode = 130;
alias eightBitMode = 131;

alias sixteenBitMode = 132;
alias thirtyTwoBitMode = 133;
alias firstVidMode = 128;
alias secondVidMode = 129;
alias thirdVidMode = 130;
alias fourthVidMode = 131;
alias fifthVidMode = 132;
alias sixthVidMode = 133;
alias spGammaDir = 64;
alias spVidNamesDir = 65;

alias kDeclROMtables = 1684366188;
alias kDetailedTimingFormat = 1634886241;

alias kDDCBlockSize = 128;

alias kDDCBlockTypeEDID = 0;

alias kDDCForceReadBit = 0;
alias kDDCForceReadMask = 1;

alias timingInvalid = 0;
alias timingInvalid_SM_T24 = 8;
alias timingApple_FixedRateLCD = 42;
alias timingApple_512x384_60hz = 130;
alias timingApple_560x384_60hz = 135;
alias timingApple_640x480_67hz = 140;
alias timingApple_640x400_67hz = 145;
alias timingVESA_640x480_60hz = 150;
alias timingVESA_640x480_72hz = 152;
alias timingVESA_640x480_75hz = 154;
alias timingVESA_640x480_85hz = 158;
alias timingGTF_640x480_120hz = 159;
alias timingApple_640x870_75hz = 160;
alias timingApple_640x818_75hz = 165;
alias timingApple_832x624_75hz = 170;
alias timingVESA_800x600_56hz = 180;
alias timingVESA_800x600_60hz = 182;
alias timingVESA_800x600_72hz = 184;
alias timingVESA_800x600_75hz = 186;
alias timingVESA_800x600_85hz = 188;
alias timingVESA_1024x768_60hz = 190;
alias timingVESA_1024x768_70hz = 200;
alias timingVESA_1024x768_75hz = 204;
alias timingVESA_1024x768_85hz = 208;
alias timingApple_1024x768_75hz = 210;
alias timingApple_1152x870_75hz = 220;
alias timingAppleNTSC_ST = 230;
alias timingAppleNTSC_FF = 232;
alias timingAppleNTSC_STconv = 234;
alias timingAppleNTSC_FFconv = 236;
alias timingApplePAL_ST = 238;
alias timingApplePAL_FF = 240;
alias timingApplePAL_STconv = 242;
alias timingApplePAL_FFconv = 244;
alias timingVESA_1280x960_75hz = 250;
alias timingVESA_1280x960_60hz = 252;
alias timingVESA_1280x960_85hz = 254;
alias timingVESA_1280x1024_60hz = 260;
alias timingVESA_1280x1024_75hz = 262;
alias timingVESA_1280x1024_85hz = 268;
alias timingVESA_1600x1200_60hz = 280;
alias timingVESA_1600x1200_65hz = 282;
alias timingVESA_1600x1200_70hz = 284;
alias timingVESA_1600x1200_75hz = 286;
alias timingVESA_1600x1200_80hz = 288;
alias timingVESA_1600x1200_85hz = 289;
alias timingVESA_1792x1344_60hz = 296;
alias timingVESA_1792x1344_75hz = 298;
alias timingVESA_1856x1392_60hz = 300;
alias timingVESA_1856x1392_75hz = 302;
alias timingVESA_1920x1440_60hz = 304;
alias timingVESA_1920x1440_75hz = 306;
alias timingSMPTE240M_60hz = 400;
alias timingFilmRate_48hz = 410;
alias timingSony_1600x1024_76hz = 500;
alias timingSony_1920x1080_60hz = 510;
alias timingSony_1920x1080_72hz = 520;
alias timingSony_1920x1200_76hz = 540;
alias timingApple_0x0_0hz_Offline = 550;

alias timingApple12 = 130;
alias timingApple12x = 135;
alias timingApple13 = 140;
alias timingApple13x = 145;
alias timingAppleVGA = 150;
alias timingApple15 = 160;
alias timingApple15x = 165;
alias timingApple16 = 170;
alias timingAppleSVGA = 180;
alias timingApple1Ka = 190;
alias timingApple1Kb = 200;
alias timingApple19 = 210;
alias timingApple21 = 220;
alias timingSony_1900x1200_74hz = 530;
alias timingSony_1900x1200_76hz = 540;

alias kAllModesValid = 0;
alias kAllModesSafe = 1;
alias kReportsTagging = 2;
alias kHasDirectConnection = 3;
alias kIsMonoDev = 4;
alias kUncertainConnection = 5;
alias kTaggingInfoNonStandard = 6;
alias kReportsDDCConnection = 7;
alias kHasDDCConnection = 8;
alias kConnectionInactive = 9;
alias kDependentConnection = 10;
alias kBuiltInConnection = 11;
alias kOverrideConnection = 12;
alias kFastCheckForDDC = 13;
alias kReportsHotPlugging = 14;

alias kUnknownConnect = 1;
alias kPanelConnect = 2;
alias kPanelTFTConnect = 2;
alias kFixedModeCRTConnect = 3;
alias kMultiModeCRT1Connect = 4;
alias kMultiModeCRT2Connect = 5;
alias kMultiModeCRT3Connect = 6;
alias kMultiModeCRT4Connect = 7;
alias kModelessConnect = 8;
alias kFullPageConnect = 9;
alias kVGAConnect = 10;
alias kNTSCConnect = 11;
alias kPALConnect = 12;
alias kHRConnect = 13;
alias kPanelFSTNConnect = 14;
alias kMonoTwoPageConnect = 15;
alias kColorTwoPageConnect = 16;
alias kColor16Connect = 17;
alias kColor19Connect = 18;
alias kGenericCRT = 19;
alias kGenericLCD = 20;
alias kDDCConnect = 21;
alias kNoConnect = 22;

alias kModeValid = 0;
alias kModeSafe = 1;
alias kModeDefault = 2;
alias kModeShowNow = 3;
alias kModeNotResize = 4;
alias kModeRequiresPan = 5;
alias kModeInterlaced = 6;
alias kModeShowNever = 7;
alias kModeSimulscan = 8;
alias kModeNotPreset = 9;
alias kModeBuiltIn = 10;
alias kModeStretched = 11;

alias kDepthDependent = 0;

alias kResolutionHasMultipleDepthSizes = 0;

alias kAVPowerOff = 0;
alias kAVPowerStandby = 1;
alias kAVPowerSuspend = 2;
alias kAVPowerOn = 3;
alias kHardwareSleep = 128;
alias kHardwareWake = 129;
alias kHardwareWakeFromSuspend = 130;
alias kHardwareWakeToDoze = 131;
alias kHardwareWakeToDozeFromSuspend = 132;

alias kPowerStateNeedsRefresh = 0;
alias kPowerStateSleepAwareBit = 1;
alias kPowerStateSleepForbiddenBit = 2;
alias kPowerStateSleepCanPowerOffBit = 3;
alias kPowerStateSleepNoDPMSBit = 4;
alias kPowerStateSleepWaketoDozeBit = 5;
alias kPowerStateNeedsRefreshMask = 1;
alias kPowerStateSleepAwareMask = 2;
alias kPowerStateSleepForbiddenMask = 4;
alias kPowerStateSleepCanPowerOffMask = 8;
alias kPowerStateSleepNoDPMSMask = 16;
alias kPowerStateSleepWaketoDozeMask = 32;

alias cscReset = 0;
alias cscKillIO = 1;
alias cscSetMode = 2;
alias cscSetEntries = 3;
alias cscSetGamma = 4;
alias cscGrayPage = 5;
alias cscGrayScreen = 5;
alias cscSetGray = 6;
alias cscSetInterrupt = 7;
alias cscDirectSetEntries = 8;
alias cscSetDefaultMode = 9;
alias cscSwitchMode = 10;
alias cscSetSync = 11;
alias cscSavePreferredConfiguration = 16;
alias cscSetHardwareCursor = 22;
alias cscDrawHardwareCursor = 23;
alias cscSetConvolution = 24;
alias cscSetPowerState = 25;
alias cscPrivateControlCall = 26;
alias cscSetMultiConnect = 28;
alias cscSetClutBehavior = 29;
alias cscSetDetailedTiming = 31;
alias cscDoCommunication = 33;
alias cscProbeConnection = 34;
alias cscUnusedCall = 127;

alias cscGetMode = 2;
alias cscGetEntries = 3;
alias cscGetPageCnt = 4;
alias cscGetPages = 4;
alias cscGetPageBase = 5;
alias cscGetBaseAddr = 5;
alias cscGetGray = 6;
alias cscGetInterrupt = 7;
alias cscGetGamma = 8;
alias cscGetDefaultMode = 9;
alias cscGetCurMode = 10;
alias cscGetSync = 11;
alias cscGetConnection = 12;
alias cscGetModeTiming = 13;
alias cscGetModeBaseAddress = 14;
alias cscGetScanProc = 15;
alias cscGetPreferredConfiguration = 16;
alias cscGetNextResolution = 17;
alias cscGetVideoParameters = 18;
alias cscGetGammaInfoList = 20;
alias cscRetrieveGammaTable = 21;
alias cscSupportsHardwareCursor = 22;
alias cscGetHardwareCursorDrawState = 23;
alias cscGetConvolution = 24;
alias cscGetPowerState = 25;
alias cscPrivateStatusCall = 26;
alias cscGetDDCBlock = 27;
alias cscGetMultiConnect = 28;
alias cscGetClutBehavior = 29;
alias cscGetTimingRanges = 30;
alias cscGetDetailedTiming = 31;
alias cscGetCommunicationInfo = 32;

alias kDisableHorizontalSyncBit = 0;
alias kDisableVerticalSyncBit = 1;
alias kDisableCompositeSyncBit = 2;
alias kEnableSyncOnBlue = 3;
alias kEnableSyncOnGreen = 4;
alias kEnableSyncOnRed = 5;
alias kNoSeparateSyncControlBit = 6;
alias kTriStateSyncBit = 7;
alias kHorizontalSyncMask = 1;
alias kVerticalSyncMask = 2;
alias kCompositeSyncMask = 4;
alias kDPMSSyncMask = 7;
alias kTriStateSyncMask = 128;
alias kSyncOnBlueMask = 8;
alias kSyncOnGreenMask = 16;
alias kSyncOnRedMask = 32;
alias kSyncOnMask = 56;

alias kDPMSSyncOn = 0;
alias kDPMSSyncStandby = 1;
alias kDPMSSyncSuspend = 2;
alias kDPMSSyncOff = 7;

alias kConvolved = 0;
alias kLiveVideoPassThru = 1;
alias kConvolvedMask = 1;
alias kLiveVideoPassThruMask = 2;

record Struct_VPBlock (
    vpBaseOffset : CLong,
    vpRowBytes : Short,
    vpBounds : Rect,
    vpVersion : Short,
    vpPackType : Short,
    vpPackSize : CLong,
    vpHRes : CLong,
    vpVRes : CLong,
    vpPixelType : Short,
    vpPixelSize : Short,
    vpCmpCount : Short,
    vpCmpSize : Short,
    vpPlaneBytes : CLong,
);

alias VPBlock = Struct_VPBlock;

alias VPBlockPtr = Pointer[VPBlock];

record Struct_VDEntryRecord (
    csTable : Ptr,
);

alias VDEntryRecord = Struct_VDEntryRecord;

alias VDEntRecPtr = Pointer[VDEntryRecord];

record Struct_VDGrayRecord (
    csMode : CUChar,
    filler : CChar,
);

alias VDGrayRecord = Struct_VDGrayRecord;

alias VDGrayPtr = Pointer[VDGrayRecord];

record Struct_VDFlagRecord (
    csMode : CChar,
    filler : CChar,
);

alias VDFlagRecord = Struct_VDFlagRecord;

alias VDFlagRecPtr = Pointer[VDFlagRecord];

record Struct_VDSetEntryRecord (
    csTable : Pointer[ColorSpec],
    csStart : Short,
    csCount : Short,
);

alias VDSetEntryRecord = Struct_VDSetEntryRecord;

alias VDSetEntryPtr = Pointer[VDSetEntryRecord];

record Struct_VDGammaRecord (
    csGTable : Ptr,
);

alias VDGammaRecord = Struct_VDGammaRecord;

alias VDGamRecPtr = Pointer[VDGammaRecord];

record Struct_VDBaseAddressInfoRec (
    csDevData : CLong,
    csDevBase : CLong,
    csModeReserved : Short,
    csModeBase : CLong,
);

alias VDBaseAddressInfoRec = Struct_VDBaseAddressInfoRec;

alias VDBaseAddressInfoPtr = Pointer[VDBaseAddressInfoRec];

record Struct_VDSwitchInfoRec (
    csMode : UShort,
    csData : CULong,
    csPage : UShort,
    csBaseAddr : Ptr,
    csReserved : CULong,
);

alias VDSwitchInfoRec = Struct_VDSwitchInfoRec;

alias VDSwitchInfoPtr = Pointer[VDSwitchInfoRec];

record Struct_VDTimingInfoRec (
    csTimingMode : CULong,
    csTimingReserved : CULong,
    csTimingFormat : CULong,
    csTimingData : CULong,
    csTimingFlags : CULong,
);

alias VDTimingInfoRec = Struct_VDTimingInfoRec;

alias VDTimingInfoPtr = Pointer[VDTimingInfoRec];

record Struct_VDDisplayConnectInfoRec (
    csDisplayType : UShort,
    csConnectTaggedType : CUChar,
    csConnectTaggedData : CUChar,
    csConnectFlags : CULong,
    csDisplayComponent : CULong,
    csConnectReserved : CULong,
);

alias VDDisplayConnectInfoRec = Struct_VDDisplayConnectInfoRec;

alias VDDisplayConnectInfoPtr = Pointer[VDDisplayConnectInfoRec];

record Struct_VDMultiConnectInfoRec (
    csDisplayCountOrNumber : CULong,
    csConnectInfo : VDDisplayConnectInfoRec,
);

alias VDMultiConnectInfoRec = Struct_VDMultiConnectInfoRec;

alias VDMultiConnectInfoPtr = Pointer[VDMultiConnectInfoRec];

alias RawSenseCode = CUChar;

alias kRSCZero = 0;
alias kRSCOne = 1;
alias kRSCTwo = 2;
alias kRSCThree = 3;
alias kRSCFour = 4;
alias kRSCFive = 5;
alias kRSCSix = 6;
alias kRSCSeven = 7;

alias ExtendedSenseCode = CUChar;

alias kESCZero21Inch = 0;
alias kESCOnePortraitMono = 20;
alias kESCTwo12Inch = 33;
alias kESCThree21InchRadius = 49;
alias kESCThree21InchMonoRadius = 52;
alias kESCThree21InchMono = 53;
alias kESCFourNTSC = 10;
alias kESCFivePortrait = 30;
alias kESCSixMSB1 = 3;
alias kESCSixMSB2 = 11;
alias kESCSixMSB3 = 35;
alias kESCSixStandard = 43;
alias kESCSevenPAL = 0;
alias kESCSevenNTSC = 20;
alias kESCSevenVGA = 23;
alias kESCSeven16Inch = 45;
alias kESCSevenPALAlternate = 48;
alias kESCSeven19Inch = 58;
alias kESCSevenDDC = 62;
alias kESCSevenNoDisplay = 63;

alias DepthMode = UShort;

alias kDepthMode1 = 128;
alias kDepthMode2 = 129;
alias kDepthMode3 = 130;
alias kDepthMode4 = 131;
alias kDepthMode5 = 132;
alias kDepthMode6 = 133;

alias kFirstDepthMode = 128;
alias kSecondDepthMode = 129;
alias kThirdDepthMode = 130;
alias kFourthDepthMode = 131;
alias kFifthDepthMode = 132;
alias kSixthDepthMode = 133;

record Struct_VDPageInfo (
    csMode : Short,
    csData : CLong,
    csPage : Short,
    csBaseAddr : Ptr,
);

alias VDPageInfo = Struct_VDPageInfo;

alias VDPgInfoPtr = Pointer[VDPageInfo];

record Struct_VDSizeInfo (
    csHSize : Short,
    csHPos : Short,
    csVSize : Short,
    csVPos : Short,
);

alias VDSizeInfo = Struct_VDSizeInfo;

alias VDSzInfoPtr = Pointer[VDSizeInfo];

record Struct_VDSettings (
    csParamCnt : Short,
    csBrightMax : Short,
    csBrightDef : Short,
    csBrightVal : Short,
    csCntrstMax : Short,
    csCntrstDef : Short,
    csCntrstVal : Short,
    csTintMax : Short,
    csTintDef : Short,
    csTintVal : Short,
    csHueMax : Short,
    csHueDef : Short,
    csHueVal : Short,
    csHorizDef : Short,
    csHorizVal : Short,
    csHorizMax : Short,
    csVertDef : Short,
    csVertVal : Short,
    csVertMax : Short,
);

alias VDSettings = Struct_VDSettings;

alias VDSettingsPtr = Pointer[VDSettings];

record Struct_VDDefMode (
    csID : CUChar,
    filler : CChar,
);

alias VDDefMode = Struct_VDDefMode;

alias VDDefModePtr = Pointer[VDDefMode];

record Struct_VDSyncInfoRec (
    csMode : CUChar,
    csFlags : CUChar,
);

alias VDSyncInfoRec = Struct_VDSyncInfoRec;

alias VDSyncInfoPtr = Pointer[VDSyncInfoRec];

alias AVIDType = UInt;

alias DisplayIDType = UInt;

alias DisplayModeID = UInt;

alias VideoDeviceType = UInt;

alias GammaTableID = UInt;

alias kDisplayModeIDCurrent = 0;
alias kDisplayModeIDInvalid = 4294967295;
alias kDisplayModeIDFindFirstResolution = 4294967294;
alias kDisplayModeIDNoMoreResolutions = 4294967293;
alias kDisplayModeIDFindFirstProgrammable = 4294967292;
alias kDisplayModeIDBootProgrammable = 4294967291;
alias kDisplayModeIDReservedBase = 2147483648;

alias kGammaTableIDFindFirst = 4294967294;
alias kGammaTableIDNoMoreTables = 4294967293;
alias kGammaTableIDSpecific = 0;

alias kGetConnectionCount = 4294967295;
alias kActivateConnection = 0;
alias kDeactivateConnection = 512;

alias kVideoDefaultBus = 0;

alias kVideoBusTypeInvalid = 0;
alias kVideoBusTypeI2C = 1;

alias kVideoNoTransactionType = 0;
alias kVideoSimpleI2CType = 1;
alias kVideoDDCciReplyType = 2;

alias kVideoReplyMicroSecDelayMask = 1;

record Struct_VDResolutionInfoRec (
    csPreviousDisplayModeID : UInt,
    csDisplayModeID : UInt,
    csHorizontalPixels : CULong,
    csVerticalLines : CULong,
    csRefreshRate : Int,
    csMaxDepthMode : UShort,
    csResolutionFlags : CULong,
    csReserved : CULong,
);

alias VDResolutionInfoRec = Struct_VDResolutionInfoRec;

alias VDResolutionInfoPtr = Pointer[VDResolutionInfoRec];

record Struct_VDVideoParametersInfoRec (
    csDisplayModeID : UInt,
    csDepthMode : UShort,
    csVPBlockPtr : VPBlockPtr,
    csPageCount : CULong,
    csDeviceType : UInt,
    csDepthFlags : UInt,
);

alias VDVideoParametersInfoRec = Struct_VDVideoParametersInfoRec;

alias VDVideoParametersInfoPtr = Pointer[VDVideoParametersInfoRec];

record Struct_VDGammaInfoRec (
    csLastGammaID : UInt,
    csNextGammaID : UInt,
    csGammaPtr : Ptr,
    csReserved : CULong,
);

alias VDGammaInfoRec = Struct_VDGammaInfoRec;

alias VDGammaInfoPtr = Pointer[VDGammaInfoRec];

record Struct_VDGetGammaListRec (
    csPreviousGammaTableID : UInt,
    csGammaTableID : UInt,
    csGammaTableSize : CULong,
    csGammaTableName : Pointer[CChar],
);

alias VDGetGammaListRec = Struct_VDGetGammaListRec;

alias VDGetGammaListPtr = Pointer[VDGetGammaListRec];

record Struct_VDRetrieveGammaRec (
    csGammaTableID : UInt,
    csGammaTablePtr : Pointer[GammaTbl],
);

alias VDRetrieveGammaRec = Struct_VDRetrieveGammaRec;

alias VDRetrieveGammaPtr = Pointer[VDRetrieveGammaRec];

record Struct_VDSetHardwareCursorRec (
    csCursorRef : RawPointer,
    csReserved1 : UInt,
    csReserved2 : UInt,
);

alias VDSetHardwareCursorRec = Struct_VDSetHardwareCursorRec;

alias VDSetHardwareCursorPtr = Pointer[VDSetHardwareCursorRec];

record Struct_VDDrawHardwareCursorRec (
    csCursorX : Int,
    csCursorY : Int,
    csCursorVisible : UInt,
    csReserved1 : UInt,
    csReserved2 : UInt,
);

alias VDDrawHardwareCursorRec = Struct_VDDrawHardwareCursorRec;

alias VDDrawHardwareCursorPtr = Pointer[VDDrawHardwareCursorRec];

record Struct_VDSupportsHardwareCursorRec (
    csSupportsHardwareCursor : UInt,
    csReserved1 : UInt,
    csReserved2 : UInt,
);

alias VDSupportsHardwareCursorRec = Struct_VDSupportsHardwareCursorRec;

alias VDSupportsHardwareCursorPtr = Pointer[VDSupportsHardwareCursorRec];

record Struct_VDHardwareCursorDrawStateRec (
    csCursorX : Int,
    csCursorY : Int,
    csCursorVisible : UInt,
    csCursorSet : UInt,
    csReserved1 : UInt,
    csReserved2 : UInt,
);

alias VDHardwareCursorDrawStateRec = Struct_VDHardwareCursorDrawStateRec;

alias VDHardwareCursorDrawStatePtr = Pointer[VDHardwareCursorDrawStateRec];

record Struct_VDConvolutionInfoRec (
    csDisplayModeID : UInt,
    csDepthMode : UShort,
    csPage : CULong,
    csFlags : UInt,
    csReserved : UInt,
);

alias VDConvolutionInfoRec = Struct_VDConvolutionInfoRec;

alias VDConvolutionInfoPtr = Pointer[VDConvolutionInfoRec];

record Struct_VDPowerStateRec (
    powerState : CULong,
    powerFlags : CULong,
    powerReserved1 : CULong,
    powerReserved2 : CULong,
);

alias VDPowerStateRec = Struct_VDPowerStateRec;

alias VDPowerStatePtr = Pointer[VDPowerStateRec];

record Struct_VDPrivateSelectorDataRec (
    privateParameters : LogicalAddress,
    privateParametersSize : CULong,
    privateResults : LogicalAddress,
    privateResultsSize : CULong,
);

alias VDPrivateSelectorDataRec = Struct_VDPrivateSelectorDataRec;

record Struct_VDPrivateSelectorRec (
    reserved : UInt,
    data : Array[VDPrivateSelectorDataRec,1],
);

alias VDPrivateSelectorRec = Struct_VDPrivateSelectorRec;

record Struct_VDDDCBlockRec (
    ddcBlockNumber : UInt,
    ddcBlockType : UInt,
    ddcFlags : UInt,
    ddcReserved : UInt,
    ddcBlockData : Array[CUChar,128],
);

alias VDDDCBlockRec = Struct_VDDDCBlockRec;

alias VDDDCBlockPtr = Pointer[VDDDCBlockRec];

alias kSyncInterlaceMask = 128;
alias kSyncAnalogCompositeMask = 0;
alias kSyncAnalogCompositeSerrateMask = 4;
alias kSyncAnalogCompositeRGBSyncMask = 2;
alias kSyncAnalogBipolarMask = 8;
alias kSyncAnalogBipolarSerrateMask = 4;
alias kSyncAnalogBipolarSRGBSyncMask = 2;
alias kSyncDigitalCompositeMask = 16;
alias kSyncDigitalCompositeSerrateMask = 4;
alias kSyncDigitalCompositeMatchHSyncMask = 4;
alias kSyncDigitalSeperateMask = 24;
alias kSyncDigitalVSyncPositiveMask = 4;
alias kSyncDigitalHSyncPositiveMask = 2;

record Struct_VDDisplayTimingRangeRec (
    csRangeSize : UInt,
    csRangeType : UInt,
    csRangeVersion : UInt,
    csRangeReserved : UInt,
    csRangeBlockIndex : UInt,
    csRangeGroup : UInt,
    csRangeBlockCount : UInt,
    csRangeFlags : UInt,
    csMinPixelClock : UInt64,
    csMaxPixelClock : UInt64,
    csMaxPixelError : UInt,
    csTimingRangeSyncFlags : UInt,
    csTimingRangeSignalLevels : UInt,
    csReserved0 : UInt,
    csMinFrameRate : UInt,
    csMaxFrameRate : UInt,
    csMinLineRate : UInt,
    csMaxLineRate : UInt,
    csMaxHorizontalTotal : UInt,
    csMaxVerticalTotal : UInt,
    csMaxTotalReserved1 : UInt,
    csMaxTotalReserved2 : UInt,
    csCharSizeHorizontalActive : CUChar,
    csCharSizeHorizontalBlanking : CUChar,
    csCharSizeHorizontalSyncOffset : CUChar,
    csCharSizeHorizontalSyncPulse : CUChar,
    csCharSizeVerticalActive : CUChar,
    csCharSizeVerticalBlanking : CUChar,
    csCharSizeVerticalSyncOffset : CUChar,
    csCharSizeVerticalSyncPulse : CUChar,
    csCharSizeHorizontalBorderLeft : CUChar,
    csCharSizeHorizontalBorderRight : CUChar,
    csCharSizeVerticalBorderTop : CUChar,
    csCharSizeVerticalBorderBottom : CUChar,
    csCharSizeHorizontalTotal : CUChar,
    csCharSizeVerticalTotal : CUChar,
    csCharSizeReserved1 : UShort,
    csMinHorizontalActiveClocks : UInt,
    csMaxHorizontalActiveClocks : UInt,
    csMinHorizontalBlankingClocks : UInt,
    csMaxHorizontalBlankingClocks : UInt,
    csMinHorizontalSyncOffsetClocks : UInt,
    csMaxHorizontalSyncOffsetClocks : UInt,
    csMinHorizontalPulseWidthClocks : UInt,
    csMaxHorizontalPulseWidthClocks : UInt,
    csMinVerticalActiveClocks : UInt,
    csMaxVerticalActiveClocks : UInt,
    csMinVerticalBlankingClocks : UInt,
    csMaxVerticalBlankingClocks : UInt,
    csMinVerticalSyncOffsetClocks : UInt,
    csMaxVerticalSyncOffsetClocks : UInt,
    csMinVerticalPulseWidthClocks : UInt,
    csMaxVerticalPulseWidthClocks : UInt,
    csMinHorizontalBorderLeft : UInt,
    csMaxHorizontalBorderLeft : UInt,
    csMinHorizontalBorderRight : UInt,
    csMaxHorizontalBorderRight : UInt,
    csMinVerticalBorderTop : UInt,
    csMaxVerticalBorderTop : UInt,
    csMinVerticalBorderBottom : UInt,
    csMaxVerticalBorderBottom : UInt,
    csReserved1 : UInt,
    csReserved2 : UInt,
    csReserved3 : UInt,
    csReserved4 : UInt,
    csReserved5 : UInt,
    csReserved6 : UInt,
    csReserved7 : UInt,
    csReserved8 : UInt,
);

alias VDDisplayTimingRangeRec = Struct_VDDisplayTimingRangeRec;

alias VDDisplayTimingRangePtr = Pointer[VDDisplayTimingRangeRec];

alias kDMSModeReady = 0;
alias kDMSModeNotReady = 1;
alias kDMSModeFree = 2;

alias kTimingChangeRestrictedErr = 4294956366;
alias kVideoI2CReplyPendingErr = 4294956365;
alias kVideoI2CTransactionErr = 4294956364;
alias kVideoI2CBusyErr = 4294956363;
alias kVideoI2CTransactionTypeErr = 4294956362;
alias kVideoBufferSizeErr = 4294956361;

alias kRangeSupportsSignal_0700_0300_Bit = 0;
alias kRangeSupportsSignal_0714_0286_Bit = 1;
alias kRangeSupportsSignal_1000_0400_Bit = 2;
alias kRangeSupportsSignal_0700_0000_Bit = 3;
alias kRangeSupportsSignal_0700_0300_Mask = 1;
alias kRangeSupportsSignal_0714_0286_Mask = 2;
alias kRangeSupportsSignal_1000_0400_Mask = 4;
alias kRangeSupportsSignal_0700_0000_Mask = 8;

alias kDigitalSignalBit = 0;
alias kAnalogSetupExpectedBit = 1;
alias kDigitalSignalMask = 1;
alias kAnalogSetupExpectedMask = 2;

alias kAnalogSignalLevel_0700_0300 = 0;
alias kAnalogSignalLevel_0714_0286 = 1;
alias kAnalogSignalLevel_1000_0400 = 2;
alias kAnalogSignalLevel_0700_0000 = 3;

alias kRangeSupportsSeperateSyncsBit = 0;
alias kRangeSupportsSyncOnGreenBit = 1;
alias kRangeSupportsCompositeSyncBit = 2;
alias kRangeSupportsVSyncSerrationBit = 3;
alias kRangeSupportsSeperateSyncsMask = 1;
alias kRangeSupportsSyncOnGreenMask = 2;
alias kRangeSupportsCompositeSyncMask = 4;
alias kRangeSupportsVSyncSerrationMask = 8;

alias kSyncPositivePolarityBit = 0;
alias kSyncPositivePolarityMask = 1;

record Struct_VDDetailedTimingRec (
    csTimingSize : UInt,
    csTimingType : UInt,
    csTimingVersion : UInt,
    csTimingReserved : UInt,
    csDisplayModeID : UInt,
    csDisplayModeSeed : UInt,
    csDisplayModeState : UInt,
    csDisplayModeAlias : UInt,
    csSignalConfig : UInt,
    csSignalLevels : UInt,
    csPixelClock : UInt64,
    csMinPixelClock : UInt64,
    csMaxPixelClock : UInt64,
    csHorizontalActive : UInt,
    csHorizontalBlanking : UInt,
    csHorizontalSyncOffset : UInt,
    csHorizontalSyncPulseWidth : UInt,
    csVerticalActive : UInt,
    csVerticalBlanking : UInt,
    csVerticalSyncOffset : UInt,
    csVerticalSyncPulseWidth : UInt,
    csHorizontalBorderLeft : UInt,
    csHorizontalBorderRight : UInt,
    csVerticalBorderTop : UInt,
    csVerticalBorderBottom : UInt,
    csHorizontalSyncConfig : UInt,
    csHorizontalSyncLevel : UInt,
    csVerticalSyncConfig : UInt,
    csVerticalSyncLevel : UInt,
    csReserved1 : UInt,
    csReserved2 : UInt,
    csReserved3 : UInt,
    csReserved4 : UInt,
    csReserved5 : UInt,
    csReserved6 : UInt,
    csReserved7 : UInt,
    csReserved8 : UInt,
);

alias VDDetailedTimingRec = Struct_VDDetailedTimingRec;

alias VDDetailedTimingPtr = Pointer[VDDetailedTimingRec];

alias VDClutBehavior = UInt;

alias VDClutBehaviorPtr = Pointer[UInt];

alias kSetClutAtSetEntries = 0;
alias kSetClutAtVBL = 1;

record Struct_VDCommunicationRec (
    csBusID : Int,
    csCommFlags : UInt,
    csMinReplyDelay : UInt,
    csReserved2 : UInt,
    csSendAddress : UInt,
    csSendType : UInt,
    csSendBuffer : LogicalAddress,
    csSendSize : CULong,
    csReplyAddress : UInt,
    csReplyType : UInt,
    csReplyBuffer : LogicalAddress,
    csReplySize : CULong,
    csReserved3 : UInt,
    csReserved4 : UInt,
    csReserved5 : UInt,
    csReserved6 : UInt,
);

alias VDCommunicationRec = Struct_VDCommunicationRec;

alias VDCommunicationPtr = Pointer[VDCommunicationRec];

record Struct_VDCommunicationInfoRec (
    csBusID : Int,
    csBusType : UInt,
    csMinBus : Int,
    csMaxBus : Int,
    csSupportedTypes : UInt,
    csSupportedCommFlags : UInt,
    csReserved2 : UInt,
    csReserved3 : UInt,
    csReserved4 : UInt,
    csReserved5 : UInt,
    csReserved6 : UInt,
    csReserved7 : UInt,
);

alias VDCommunicationInfoRec = Struct_VDCommunicationInfoRec;

alias VDCommunicationInfoPtr = Pointer[VDCommunicationInfoRec];

alias DMProcessInfoPtr = RawPointer;

alias DMModalFilterUPP = RawPointer;

alias kAESystemConfigNotice = 1668179559;
alias kAEDisplayNotice = 1685287020;
alias kAEDisplaySummary = 1685288301;
alias keyDMConfigVersion = 1684890486;
alias keyDMConfigFlags = 1684890470;
alias keyDMConfigReserved = 1684890482;
alias keyDisplayID = 1684892004;
alias keyDisplayComponent = 1684890723;
alias keyDisplayDevice = 1684890724;
alias keyDisplayFlags = 1684890726;
alias keyDisplayMode = 1684890733;
alias keyDisplayModeReserved = 1684893042;
alias keyDisplayReserved = 1684890738;
alias keyDisplayMirroredId = 1684893033;
alias keyDeviceFlags = 1684300902;
alias keyDeviceDepthMode = 1684300909;
alias keyDeviceRect = 1684300914;
alias keyPixMapRect = 1685087346;
alias keyPixMapHResolution = 1685088370;
alias keyPixMapVResolution = 1685091954;
alias keyPixMapPixelType = 1685090420;
alias keyPixMapPixelSize = 1685090419;
alias keyPixMapCmpCount = 1685087075;
alias keyPixMapCmpSize = 1685087091;
alias keyPixMapAlignment = 1685090401;
alias keyPixMapResReserved = 1685090930;
alias keyPixMapReserved = 1685090418;
alias keyPixMapColorTableSeed = 1685087092;
alias keySummaryMenubar = 1685286242;
alias keySummaryChanges = 1685283688;
alias keyDisplayOldConfig = 1685023844;
alias keyDisplayNewConfig = 1684956535;

alias dmOnlyActiveDisplays = 1;
alias dmAllDisplays = 0;

alias kDependentNotifyClassShowCursor = 1936221042;
alias kDependentNotifyClassDriverOverride = 1852076662;
alias kDependentNotifyClassDisplayMgrOverride = 1684891506;
alias kDependentNotifyClassProfileChanged = 1886547814;

alias kNoSwitchConfirmBit = 0;
alias kDepthNotAvailableBit = 1;
alias kShowModeBit = 3;
alias kModeNotResizeBit = 4;
alias kNeverShowModeBit = 5;

alias kBeginEndConfigureBit = 0;
alias kMovedDisplayBit = 1;
alias kSetMainDisplayBit = 2;
alias kSetDisplayModeBit = 3;
alias kAddDisplayBit = 4;
alias kRemoveDisplayBit = 5;
alias kNewDisplayBit = 6;
alias kDisposeDisplayBit = 7;
alias kEnabledDisplayBit = 8;
alias kDisabledDisplayBit = 9;
alias kMirrorDisplayBit = 10;
alias kUnMirrorDisplayBit = 11;

alias kDMNotifyRequestConnectionProbe = 0;
alias kDMNotifyInstalled = 1;
alias kDMNotifyEvent = 2;
alias kDMNotifyRemoved = 3;
alias kDMNotifyPrep = 4;
alias kDMNotifyExtendEvent = 5;
alias kDMNotifyDependents = 6;
alias kDMNotifySuspendConfigure = 7;
alias kDMNotifyResumeConfigure = 8;
alias kDMNotifyRequestDisplayProbe = 9;
alias kDMNotifyDisplayWillSleep = 10;
alias kDMNotifyDisplayDidWake = 11;
alias kExtendedNotificationProc = 65536;

alias kFullNotify = 0;
alias kFullDependencyNotify = 1;

alias kDummyDeviceID = 255;
alias kInvalidDisplayID = 0;
alias kFirstDisplayID = 256;

alias kAllowDuplicatesBit = 0;

alias kSuppressNumberBit = 0;
alias kSuppressNumberMask = 1;
alias kForceNumberBit = 1;
alias kForceNumberMask = 2;
alias kSuppressNameBit = 2;
alias kSuppressNameMask = 4;

alias kDMSupressNumbersMask = 1;
alias kDMForceNumbersMask = 2;
alias kDMSupressNameMask = 4;

alias kNoFidelity = 0;
alias kMinimumFidelity = 1;
alias kDefaultFidelity = 500;
alias kDefaultManufacturerFidelity = 1000;

alias kAnyPanelType = 0;
alias kAnyEngineType = 0;
alias kAnyDeviceType = 0;
alias kAnyPortType = 0;

alias kPLIncludeOfflineDevicesBit = 0;

alias kForceConfirmBit = 0;
alias kForceConfirmMask = 1;

alias kDisplayModeListNotPreferredBit = 0;
alias kDisplayModeListNotPreferredMask = 1;

alias kComponentListNotPreferredBit = 0;
alias kComponentListNotPreferredMask = 1;

alias kDisplayTimingInfoVersionZero = 1;
alias kDisplayTimingInfoReservedCountVersionZero = 16;
alias kDisplayModeEntryVersionZero = 0;
alias kDisplayModeEntryVersionOne = 1;

alias kMakeAndModelReservedCount = 4;

alias kDisplayGestaltDisplayCommunicationAttr = 1668246893;
alias kDisplayGestaltForbidI2CMask = 1;
alias kDisplayGestaltUseI2CPowerMask = 2;
alias kDisplayGestaltCalibratorAttr = 1667329129;
alias kDisplayGestaltBrightnessAffectsGammaMask = 1;
alias kDisplayGestaltViewAngleAffectsGammaMask = 2;

alias DMFidelityType = UInt;

alias DMListType = RawPointer;

alias DMListIndexType = UInt;

alias AVPowerStateRec = VDPowerStateRec;

alias AVPowerStatePtr = Pointer[VDPowerStateRec];

record Struct_DMDisplayTimingInfoRec (
    timingInfoVersion : UInt,
    timingInfoAttributes : UInt,
    timingInfoRelativeQuality : Int,
    timingInfoRelativeDefault : Int,
    timingInfoReserved : Array[UInt,16],
);

alias DMDisplayTimingInfoRec = Struct_DMDisplayTimingInfoRec;

alias DMDisplayTimingInfoPtr = Pointer[DMDisplayTimingInfoRec];

record Struct_DMComponentListEntryRec (
    itemID : UInt,
    itemComponent : Component,
    itemDescription : ComponentDescription,
    itemClass : UInt,
    itemFidelity : UInt,
    itemSubClass : UInt,
    itemSort : Point,
    itemFlags : UInt,
    itemReserved : UInt,
    itemFuture1 : UInt,
    itemFuture2 : UInt,
    itemFuture3 : UInt,
    itemFuture4 : UInt,
);

alias DMComponentListEntryRec = Struct_DMComponentListEntryRec;

alias DMComponentListEntryPtr = Pointer[DMComponentListEntryRec];

record Struct_AVLocationRec (
    locationConstant : UInt,
);

alias AVLocationRec = Struct_AVLocationRec;

alias AVLocationPtr = Pointer[AVLocationRec];

record Struct_DMDepthInfoRec (
    depthSwitchInfo : VDSwitchInfoPtr,
    depthVPBlock : VPBlockPtr,
    depthFlags : UInt,
    depthReserved1 : UInt,
    depthReserved2 : UInt,
);

alias DMDepthInfoRec = Struct_DMDepthInfoRec;

alias DMDepthInfoPtr = Pointer[DMDepthInfoRec];

record Struct_DMDepthInfoBlockRec (
    depthBlockCount : UInt,
    depthVPBlock : DMDepthInfoPtr,
    depthBlockFlags : UInt,
    depthBlockReserved1 : UInt,
    depthBlockReserved2 : UInt,
);

alias DMDepthInfoBlockRec = Struct_DMDepthInfoBlockRec;

alias DMDepthInfoBlockPtr = Pointer[DMDepthInfoBlockRec];

record Struct_DMDisplayModeListEntryRec (
    displayModeFlags : UInt,
    displayModeSwitchInfo : VDSwitchInfoPtr,
    displayModeResolutionInfo : VDResolutionInfoPtr,
    displayModeTimingInfo : VDTimingInfoPtr,
    displayModeDepthBlockInfo : DMDepthInfoBlockPtr,
    displayModeVersion : UInt,
    displayModeName : StringPtr,
    displayModeDisplayInfo : DMDisplayTimingInfoPtr,
);

alias DMDisplayModeListEntryRec = Struct_DMDisplayModeListEntryRec;

alias DMDisplayModeListEntryPtr = Pointer[DMDisplayModeListEntryRec];

record Struct_DependentNotifyRec (
    notifyType : UInt,
    notifyClass : UInt,
    notifyPortID : UInt,
    notifyComponent : ComponentInstance,
    notifyVersion : UInt,
    notifyFlags : UInt,
    notifyReserved : UInt,
    notifyFuture : UInt,
);

alias DependentNotifyRec = Struct_DependentNotifyRec;

alias DependentNotifyPtr = Pointer[DependentNotifyRec];

record Struct_DMMakeAndModelRec (
    manufacturer : UInt,
    model : UInt,
    serialNumber : UInt,
    manufactureDate : UInt,
    makeReserved : Array[UInt,4],
);

alias DMMakeAndModelRec = Struct_DMMakeAndModelRec;

alias DMMakeAndModelPtr = Pointer[DMMakeAndModelRec];

alias kIncludeOnlineActiveDisplaysMask = 1;
alias kIncludeOnlineDisabledDisplaysMask = 2;
alias kIncludeOfflineDisplaysMask = 4;
alias kIncludeOfflineDummyDisplaysMask = 8;
alias kIncludeHardwareMirroredDisplaysMask = 16;

alias kDMModeListIncludeAllModesMask = 1;
alias kDMModeListIncludeOfflineModesMask = 2;
alias kDMModeListExcludeDriverModesMask = 4;
alias kDMModeListExcludeDisplayModesMask = 8;
alias kDMModeListExcludeCustomModesMask = 16;
alias kDMModeListPreferStretchedModesMask = 32;
alias kDMModeListPreferSafeModesMask = 64;

record Struct_DisplayListEntryRec (
    displayListEntryGDevice : GDHandle,
    displayListEntryDisplayID : UInt,
    displayListEntryIncludeFlags : UInt,
    displayListEntryReserved1 : UInt,
    displayListEntryReserved2 : UInt,
    displayListEntryReserved3 : UInt,
    displayListEntryReserved4 : UInt,
    displayListEntryReserved5 : UInt,
);

alias DisplayListEntryRec = Struct_DisplayListEntryRec;

alias DisplayListEntryPtr = Pointer[DisplayListEntryRec];

record Struct_DMProfileListEntryRec (
    profileRef : RawPointer,
    profileReserved1 : Ptr,
    profileReserved2 : Ptr,
    profileReserved3 : Ptr,
);

alias DMProfileListEntryRec = Struct_DMProfileListEntryRec;

alias DMProfileListEntryPtr = Pointer[DMProfileListEntryRec];

alias DMNotificationProcPtr = CCodePointer[[Pointer[Struct_AEDesc]],[]];

alias DMExtendedNotificationProcPtr = CCodePointer[[RawPointer,Short,RawPointer],[]];

alias DMComponentListIteratorProcPtr = CCodePointer[[RawPointer,UInt,Pointer[Struct_DMComponentListEntryRec]],[]];

alias DMDisplayModeListIteratorProcPtr = CCodePointer[[RawPointer,UInt,Pointer[Struct_DMDisplayModeListEntryRec]],[]];

alias DMProfileListIteratorProcPtr = CCodePointer[[RawPointer,UInt,Pointer[Struct_DMProfileListEntryRec]],[]];

alias DMDisplayListIteratorProcPtr = CCodePointer[[RawPointer,UInt,Pointer[Struct_DisplayListEntryRec]],[]];

alias DMNotificationUPP = DMNotificationProcPtr;

alias DMExtendedNotificationUPP = DMExtendedNotificationProcPtr;

alias DMComponentListIteratorUPP = DMComponentListIteratorProcPtr;

alias DMDisplayModeListIteratorUPP = DMDisplayModeListIteratorProcPtr;

alias DMProfileListIteratorUPP = DMProfileListIteratorProcPtr;

alias DMDisplayListIteratorUPP = DMDisplayListIteratorProcPtr;

external NewDMNotificationUPP(
    userRoutine : DMNotificationProcPtr) : DMNotificationUPP;

external NewDMExtendedNotificationUPP(
    userRoutine : DMExtendedNotificationProcPtr) : DMExtendedNotificationUPP;

external NewDMComponentListIteratorUPP(
    userRoutine : DMComponentListIteratorProcPtr) : DMComponentListIteratorUPP;

external NewDMDisplayModeListIteratorUPP(
    userRoutine : DMDisplayModeListIteratorProcPtr) : DMDisplayModeListIteratorUPP;

external NewDMProfileListIteratorUPP(
    userRoutine : DMProfileListIteratorProcPtr) : DMProfileListIteratorUPP;

external NewDMDisplayListIteratorUPP(
    userRoutine : DMDisplayListIteratorProcPtr) : DMDisplayListIteratorUPP;

external DisposeDMNotificationUPP(
    userUPP : DMNotificationUPP);

external DisposeDMExtendedNotificationUPP(
    userUPP : DMExtendedNotificationUPP);

external DisposeDMComponentListIteratorUPP(
    userUPP : DMComponentListIteratorUPP);

external DisposeDMDisplayModeListIteratorUPP(
    userUPP : DMDisplayModeListIteratorUPP);

external DisposeDMProfileListIteratorUPP(
    userUPP : DMProfileListIteratorUPP);

external DisposeDMDisplayListIteratorUPP(
    userUPP : DMDisplayListIteratorUPP);

external InvokeDMNotificationUPP(
    theEvent : Pointer[AppleEvent],
    userUPP : DMNotificationUPP);

external InvokeDMExtendedNotificationUPP(
    userData : RawPointer,
    theMessage : Short,
    notifyData : RawPointer,
    userUPP : DMExtendedNotificationUPP);

external InvokeDMComponentListIteratorUPP(
    userData : RawPointer,
    itemIndex : UInt,
    componentInfo : DMComponentListEntryPtr,
    userUPP : DMComponentListIteratorUPP);

external InvokeDMDisplayModeListIteratorUPP(
    userData : RawPointer,
    itemIndex : UInt,
    displaymodeInfo : DMDisplayModeListEntryPtr,
    userUPP : DMDisplayModeListIteratorUPP);

external InvokeDMProfileListIteratorUPP(
    userData : RawPointer,
    itemIndex : UInt,
    profileInfo : DMProfileListEntryPtr,
    userUPP : DMProfileListIteratorUPP);

external InvokeDMDisplayListIteratorUPP(
    userData : RawPointer,
    itemIndex : UInt,
    displaymodeInfo : DisplayListEntryPtr,
    userUPP : DMDisplayListIteratorUPP);

alias FNSMatchOptions = UInt;

alias kFNSMatchNames = 1;
alias kFNSMatchTechnology = 2;
alias kFNSMatchGlyphs = 4;
alias kFNSMatchEncodings = 8;
alias kFNSMatchQDMetrics = 16;
alias kFNSMatchATSUMetrics = 32;
alias kFNSMatchKerning = 64;
alias kFNSMatchWSLayout = 128;
alias kFNSMatchAATLayout = 256;
alias kFNSMatchPrintEncoding = 512;
alias kFNSMissingDataNoMatch = 2147483648;
alias kFNSMatchAll = 4294967295;
alias kFNSMatchDefaults = 0;

alias FNSObjectVersion = UInt;

alias kFNSVersionDontCare = 0;
alias kFNSCurSysInfoVersion = 1;

alias FNSFeatureFlags = UInt;

record Struct_FNSSysInfo (
    iSysInfoVersion : UInt,
    oFeatures : UInt,
    oCurRefVersion : UInt,
    oMinRefVersion : UInt,
    oCurProfileVersion : UInt,
    oMinProfileVersion : UInt,
    oFontSyncVersion : UShort,
);

alias FNSSysInfo = Struct_FNSSysInfo;

alias FNSFontReference = OpaquePointer;

alias kFNSCreatorDefault = 0;
alias kFNSProfileFileType = 1718514544;

alias FNSFontProfile = OpaquePointer;

alias ATSUTextLayout = OpaquePointer;

alias ATSUStyle = OpaquePointer;

alias ATSUFontFallbacks = OpaquePointer;

alias ATSUTextMeasurement = Int;

alias ATSUFontID = UInt;

alias ATSUFontFeatureType = UShort;

alias ATSUFontFeatureSelector = UShort;

alias ATSUFontVariationAxis = UInt;

alias ATSUFontVariationValue = Int;

alias ATSUAttributeTag = UInt;

alias kATSULineWidthTag = 1;
alias kATSULineRotationTag = 2;
alias kATSULineDirectionTag = 3;
alias kATSULineJustificationFactorTag = 4;
alias kATSULineFlushFactorTag = 5;
alias kATSULineBaselineValuesTag = 6;
alias kATSULineLayoutOptionsTag = 7;
alias kATSULineAscentTag = 8;
alias kATSULineDescentTag = 9;
alias kATSULineLangRegionTag = 10;
alias kATSULineTextLocatorTag = 11;
alias kATSULineTruncationTag = 12;
alias kATSULineFontFallbacksTag = 13;
alias kATSULineDecimalTabCharacterTag = 14;
alias kATSULayoutOperationOverrideTag = 15;
alias kATSULineHighlightCGColorTag = 17;
alias kATSUMaxLineTag = 18;
alias kATSULineLanguageTag = 10;
alias kATSUCGContextTag = 32767;
alias kATSUQDBoldfaceTag = 256;
alias kATSUQDItalicTag = 257;
alias kATSUQDUnderlineTag = 258;
alias kATSUQDCondensedTag = 259;
alias kATSUQDExtendedTag = 260;
alias kATSUFontTag = 261;
alias kATSUSizeTag = 262;
alias kATSUColorTag = 263;
alias kATSULangRegionTag = 264;
alias kATSUVerticalCharacterTag = 265;
alias kATSUImposeWidthTag = 266;
alias kATSUBeforeWithStreamShiftTag = 267;
alias kATSUAfterWithStreamShiftTag = 268;
alias kATSUCrossStreamShiftTag = 269;
alias kATSUTrackingTag = 270;
alias kATSUHangingInhibitFactorTag = 271;
alias kATSUKerningInhibitFactorTag = 272;
alias kATSUDecompositionFactorTag = 273;
alias kATSUBaselineClassTag = 274;
alias kATSUPriorityJustOverrideTag = 275;
alias kATSUNoLigatureSplitTag = 276;
alias kATSUNoCaretAngleTag = 277;
alias kATSUSuppressCrossKerningTag = 278;
alias kATSUNoOpticalAlignmentTag = 279;
alias kATSUForceHangingTag = 280;
alias kATSUNoSpecialJustificationTag = 281;
alias kATSUStyleTextLocatorTag = 282;
alias kATSUStyleRenderingOptionsTag = 283;
alias kATSUAscentTag = 284;
alias kATSUDescentTag = 285;
alias kATSULeadingTag = 286;
alias kATSUGlyphSelectorTag = 287;
alias kATSURGBAlphaColorTag = 288;
alias kATSUFontMatrixTag = 289;
alias kATSUStyleUnderlineCountOptionTag = 290;
alias kATSUStyleUnderlineColorOptionTag = 291;
alias kATSUStyleStrikeThroughTag = 292;
alias kATSUStyleStrikeThroughCountOptionTag = 293;
alias kATSUStyleStrikeThroughColorOptionTag = 294;
alias kATSUStyleDropShadowTag = 295;
alias kATSUStyleDropShadowBlurOptionTag = 296;
alias kATSUStyleDropShadowOffsetOptionTag = 297;
alias kATSUStyleDropShadowColorOptionTag = 298;
alias kATSUMaxStyleTag = 299;
alias kATSULanguageTag = 264;
alias kATSUMaxATSUITagValue = 65535;

alias ATSUAttributeValuePtr = RawPointer;

alias ConstATSUAttributeValuePtr = RawPointer;

record Struct_ATSUAttributeInfo (
    fTag : UInt,
    fValueSize : CULong,
);

alias ATSUAttributeInfo = Struct_ATSUAttributeInfo;

record Struct_ATSUCaret (
    fX : Int,
    fY : Int,
    fDeltaX : Int,
    fDeltaY : Int,
);

alias ATSUCaret = Struct_ATSUCaret;

alias ATSUCursorMovementType = UShort;

alias kATSUByCharacter = 0;
alias kATSUByTypographicCluster = 1;
alias kATSUByWord = 2;
alias kATSUByCharacterCluster = 3;
alias kATSUByCluster = 1;

alias ATSULineTruncation = UInt;

alias kATSUTruncateNone = 0;
alias kATSUTruncateStart = 1;
alias kATSUTruncateEnd = 2;
alias kATSUTruncateMiddle = 3;
alias kATSUTruncateSpecificationMask = 7;
alias kATSUTruncFeatNoSquishing = 8;

alias ATSUStyleLineCountType = UShort;

alias kATSUStyleSingleLineCount = 1;
alias kATSUStyleDoubleLineCount = 2;

alias ATSUVerticalCharacterType = UShort;

alias kATSUStronglyHorizontal = 0;
alias kATSUStronglyVertical = 1;

alias ATSUStyleComparison = UShort;

alias kATSUStyleUnequal = 0;
alias kATSUStyleContains = 1;
alias kATSUStyleEquals = 2;
alias kATSUStyleContainedBy = 3;

alias ATSUFontFallbackMethod = UShort;

alias kATSUDefaultFontFallbacks = 0;
alias kATSULastResortOnlyFallback = 1;
alias kATSUSequentialFallbacksPreferred = 2;
alias kATSUSequentialFallbacksExclusive = 3;

alias ATSUTabType = UShort;

alias kATSULeftTab = 0;
alias kATSUCenterTab = 1;
alias kATSURightTab = 2;
alias kATSUDecimalTab = 3;
alias kATSUNumberTabTypes = 4;

record Struct_ATSUTab (
    tabPosition : Int,
    tabType : UShort,
);

alias ATSUTab = Struct_ATSUTab;

record Struct_ATSURGBAlphaColor (
    red : Float,
    green : Float,
    blue : Float,
    alpha : Float,
);

alias ATSURGBAlphaColor = Struct_ATSURGBAlphaColor;

alias GlyphCollection = UShort;

alias kGlyphCollectionGID = 0;
alias kGlyphCollectionAdobeCNS1 = 1;
alias kGlyphCollectionAdobeGB1 = 2;
alias kGlyphCollectionAdobeJapan1 = 3;
alias kGlyphCollectionAdobeJapan2 = 4;
alias kGlyphCollectionAdobeKorea1 = 5;
alias kGlyphCollectionUnspecified = 255;

record Struct_ATSUGlyphSelector (
    collection : UShort,
    glyphID : UShort,
);

alias ATSUGlyphSelector = Struct_ATSUGlyphSelector;

record Struct_ATSUGlyphInfo (
    glyphID : UShort,
    reserved : UShort,
    layoutFlags : UInt,
    charIndex : CULong,
    style : ATSUStyle,
    deltaY : Float,
    idealX : Float,
    screenX : Short,
    caretX : Short,
);

alias ATSUGlyphInfo = Struct_ATSUGlyphInfo;

record Struct_ATSUGlyphInfoArray (
    layout : ATSUTextLayout,
    numGlyphs : CULong,
    glyphs : Array[ATSUGlyphInfo,1],
);

alias ATSUGlyphInfoArray = Struct_ATSUGlyphInfoArray;

alias ATSUHighlightMethod = UInt;

alias kInvertHighlighting = 0;
alias kRedrawHighlighting = 1;

alias ATSUBackgroundDataType = UInt;

alias kATSUBackgroundColor = 0;
alias kATSUBackgroundCallback = 1;

alias ATSUBackgroundColor = ATSURGBAlphaColor;

alias RedrawBackgroundProcPtr = CCodePointer[[OpaquePointer,CULong,CULong,Pointer[Struct_ATSTrapezoid],CULong],[CUChar]];

alias RedrawBackgroundUPP = RedrawBackgroundProcPtr;

external NewRedrawBackgroundUPP(
    userRoutine : RedrawBackgroundProcPtr) : RedrawBackgroundUPP;

external DisposeRedrawBackgroundUPP(
    userUPP : RedrawBackgroundUPP);

external InvokeRedrawBackgroundUPP(
    iLayout : ATSUTextLayout,
    iTextOffset : CULong,
    iTextLength : CULong,
    iUnhighlightArea : Pointer[ATSTrapezoid],
    iTrapezoidCount : CULong,
    userUPP : RedrawBackgroundUPP) : CUChar;

alias ATSUBackgroundData = AUnionType;

record Struct_ATSUUnhighlightData (
    dataType : UInt,
    unhighlightData : ATSUBackgroundData,
);

alias ATSUUnhighlightData = Struct_ATSUUnhighlightData;

alias kATSULeftToRightBaseDirection = 0;
alias kATSURightToLeftBaseDirection = 1;

alias kATSUInvalidFontID = 0;

alias kATSUUseLineControlWidth = 2147483647;

alias kATSUNoSelector = 65535;

alias kATSUFromTextBeginning = 4294967295;
alias kATSUToTextEnd = 4294967295;
alias kATSUFromPreviousLayout = 4294967294;
alias kATSUFromFollowingLayout = 4294967293;

alias kATSUUseGrafPortPenLoc = 4294967295;
alias kATSUClearAll = 4294967295;

external ATSUCreateStyle(
    oStyle : Pointer[ATSUStyle]) : Int;

external ATSUDisposeStyle(
    iStyle : ATSUStyle) : Int;

external ATSUSetAttributes(
    iStyle : ATSUStyle,
    iAttributeCount : CULong,
    iTag : Pointer[UInt],
    iValueSize : Pointer[CULong],
    iValue : Pointer[ATSUAttributeValuePtr]) : Int;

external ATSUCreateTextLayoutWithTextPtr(
    iText : ConstUniCharArrayPtr,
    iTextOffset : CULong,
    iTextLength : CULong,
    iTextTotalLength : CULong,
    iNumberOfRuns : CULong,
    iRunLengths : Pointer[CULong],
    iStyles : Pointer[ATSUStyle],
    oTextLayout : Pointer[ATSUTextLayout]) : Int;

external ATSUClearLayoutCache(
    iTextLayout : ATSUTextLayout,
    iLineStart : CULong) : Int;

external ATSUDisposeTextLayout(
    iTextLayout : ATSUTextLayout) : Int;

external ATSUSetTextLayoutRefCon(
    iTextLayout : ATSUTextLayout,
    iRefCon : URefCon) : Int;

external ATSUTextMoved(
    iTextLayout : ATSUTextLayout,
    iNewLocation : ConstUniCharArrayPtr) : Int;

external ATSUSetLayoutControls(
    iTextLayout : ATSUTextLayout,
    iAttributeCount : CULong,
    iTag : Pointer[UInt],
    iValueSize : Pointer[CULong],
    iValue : Pointer[ATSUAttributeValuePtr]) : Int;

external ATSUSetRunStyle(
    iTextLayout : ATSUTextLayout,
    iStyle : ATSUStyle,
    iRunStart : CULong,
    iRunLength : CULong) : Int;

external ATSUMatchFontsToText(
    iTextLayout : ATSUTextLayout,
    iTextStart : CULong,
    iTextLength : CULong,
    oFontID : Pointer[UInt],
    oChangedOffset : Pointer[CULong],
    oChangedLength : Pointer[CULong]) : Int;

external ATSUSetTransientFontMatching(
    iTextLayout : ATSUTextLayout,
    iTransientFontMatching : CUChar) : Int;

external ATSUDrawText(
    iTextLayout : ATSUTextLayout,
    iLineOffset : CULong,
    iLineLength : CULong,
    iLocationX : Int,
    iLocationY : Int) : Int;

external ATSUGetGlyphBounds(
    iTextLayout : ATSUTextLayout,
    iTextBasePointX : Int,
    iTextBasePointY : Int,
    iBoundsCharStart : CULong,
    iBoundsCharLength : CULong,
    iTypeOfBounds : UShort,
    iMaxNumberOfBounds : CULong,
    oGlyphBounds : Pointer[ATSTrapezoid],
    oActualNumberOfBounds : Pointer[CULong]) : Int;

external ATSUPositionToOffset(
    iTextLayout : ATSUTextLayout,
    iLocationX : Int,
    iLocationY : Int,
    ioPrimaryOffset : Pointer[CULong],
    oIsLeading : Pointer[CUChar],
    oSecondaryOffset : Pointer[CULong]) : Int;

external ATSUSetFontFeatures(
    iStyle : ATSUStyle,
    iFeatureCount : CULong,
    iType : Pointer[UShort],
    iSelector : Pointer[UShort]) : Int;

alias ATSQuadraticNewPathProcPtr = CCodePointer[[RawPointer],[Int]];

alias ATSQuadraticNewPathUPP = ATSQuadraticNewPathProcPtr;

external NewATSQuadraticNewPathUPP(
    userRoutine : ATSQuadraticNewPathProcPtr) : ATSQuadraticNewPathUPP;

external DisposeATSQuadraticNewPathUPP(
    userUPP : ATSQuadraticNewPathUPP);

external InvokeATSQuadraticNewPathUPP(
    callBackDataPtr : RawPointer,
    userUPP : ATSQuadraticNewPathUPP) : Int;

alias ATSQuadraticLineProcPtr = CCodePointer[[Pointer[Struct_Float32Point],Pointer[Struct_Float32Point],RawPointer],[Int]];

alias ATSQuadraticLineUPP = ATSQuadraticLineProcPtr;

external NewATSQuadraticLineUPP(
    userRoutine : ATSQuadraticLineProcPtr) : ATSQuadraticLineUPP;

external DisposeATSQuadraticLineUPP(
    userUPP : ATSQuadraticLineUPP);

external InvokeATSQuadraticLineUPP(
    pt1 : Pointer[Float32Point],
    pt2 : Pointer[Float32Point],
    callBackDataPtr : RawPointer,
    userUPP : ATSQuadraticLineUPP) : Int;

alias ATSQuadraticCurveProcPtr = CCodePointer[[Pointer[Struct_Float32Point],Pointer[Struct_Float32Point],Pointer[Struct_Float32Point],RawPointer],[Int]];

alias ATSQuadraticCurveUPP = ATSQuadraticCurveProcPtr;

external NewATSQuadraticCurveUPP(
    userRoutine : ATSQuadraticCurveProcPtr) : ATSQuadraticCurveUPP;

external DisposeATSQuadraticCurveUPP(
    userUPP : ATSQuadraticCurveUPP);

external InvokeATSQuadraticCurveUPP(
    pt1 : Pointer[Float32Point],
    controlPt : Pointer[Float32Point],
    pt2 : Pointer[Float32Point],
    callBackDataPtr : RawPointer,
    userUPP : ATSQuadraticCurveUPP) : Int;

alias ATSQuadraticClosePathProcPtr = CCodePointer[[RawPointer],[Int]];

alias ATSQuadraticClosePathUPP = ATSQuadraticClosePathProcPtr;

external NewATSQuadraticClosePathUPP(
    userRoutine : ATSQuadraticClosePathProcPtr) : ATSQuadraticClosePathUPP;

external DisposeATSQuadraticClosePathUPP(
    userUPP : ATSQuadraticClosePathUPP);

external InvokeATSQuadraticClosePathUPP(
    callBackDataPtr : RawPointer,
    userUPP : ATSQuadraticClosePathUPP) : Int;

alias ATSCubicMoveToProcPtr = CCodePointer[[Pointer[Struct_Float32Point],RawPointer],[Int]];

alias ATSCubicMoveToUPP = ATSCubicMoveToProcPtr;

external NewATSCubicMoveToUPP(
    userRoutine : ATSCubicMoveToProcPtr) : ATSCubicMoveToUPP;

external DisposeATSCubicMoveToUPP(
    userUPP : ATSCubicMoveToUPP);

external InvokeATSCubicMoveToUPP(
    pt : Pointer[Float32Point],
    callBackDataPtr : RawPointer,
    userUPP : ATSCubicMoveToUPP) : Int;

alias ATSCubicLineToProcPtr = CCodePointer[[Pointer[Struct_Float32Point],RawPointer],[Int]];

alias ATSCubicLineToUPP = ATSCubicLineToProcPtr;

external NewATSCubicLineToUPP(
    userRoutine : ATSCubicLineToProcPtr) : ATSCubicLineToUPP;

external DisposeATSCubicLineToUPP(
    userUPP : ATSCubicLineToUPP);

external InvokeATSCubicLineToUPP(
    pt : Pointer[Float32Point],
    callBackDataPtr : RawPointer,
    userUPP : ATSCubicLineToUPP) : Int;

alias ATSCubicCurveToProcPtr = CCodePointer[[Pointer[Struct_Float32Point],Pointer[Struct_Float32Point],Pointer[Struct_Float32Point],RawPointer],[Int]];

alias ATSCubicCurveToUPP = ATSCubicCurveToProcPtr;

external NewATSCubicCurveToUPP(
    userRoutine : ATSCubicCurveToProcPtr) : ATSCubicCurveToUPP;

external DisposeATSCubicCurveToUPP(
    userUPP : ATSCubicCurveToUPP);

external InvokeATSCubicCurveToUPP(
    pt1 : Pointer[Float32Point],
    pt2 : Pointer[Float32Point],
    pt3 : Pointer[Float32Point],
    callBackDataPtr : RawPointer,
    userUPP : ATSCubicCurveToUPP) : Int;

alias ATSCubicClosePathProcPtr = CCodePointer[[RawPointer],[Int]];

alias ATSCubicClosePathUPP = ATSCubicClosePathProcPtr;

external NewATSCubicClosePathUPP(
    userRoutine : ATSCubicClosePathProcPtr) : ATSCubicClosePathUPP;

external DisposeATSCubicClosePathUPP(
    userUPP : ATSCubicClosePathUPP);

external InvokeATSCubicClosePathUPP(
    callBackDataPtr : RawPointer,
    userUPP : ATSCubicClosePathUPP) : Int;

alias ATSUFlattenedDataStreamFormat = UInt;

alias kATSUDataStreamUnicodeStyledText = 1970500716;

alias ATSUFlattenStyleRunOptions = UInt;

alias kATSUFlattenOptionNoOptionsMask = 0;

alias ATSUUnFlattenStyleRunOptions = UInt;

alias kATSUUnFlattenOptionNoOptionsMask = 0;

record Struct_ATSUStyleRunInfo (
    runLength : UInt,
    styleObjectIndex : UInt,
);

alias ATSUStyleRunInfo = Struct_ATSUStyleRunInfo;

alias kATSFlatDataUstlVersion0 = 0;
alias kATSFlatDataUstlVersion1 = 1;
alias kATSFlatDataUstlVersion2 = 2;
alias kATSFlatDataUstlCurrentVersion = 2;

record Struct_ATSFlatDataMainHeaderBlock (
    version : UInt,
    sizeOfDataBlock : UInt,
    offsetToTextLayouts : UInt,
    offsetToStyleRuns : UInt,
    offsetToStyleList : UInt,
);

alias ATSFlatDataMainHeaderBlock = Struct_ATSFlatDataMainHeaderBlock;

record Struct_ATSFlatDataTextLayoutDataHeader (
    sizeOfLayoutData : UInt,
    textLayoutLength : UInt,
    offsetToLayoutControls : UInt,
    offsetToLineInfo : UInt,
);

alias ATSFlatDataTextLayoutDataHeader = Struct_ATSFlatDataTextLayoutDataHeader;

record Struct_ATSFlatDataTextLayoutHeader (
    numFlattenedTextLayouts : UInt,
    flattenedTextLayouts : Array[ATSFlatDataTextLayoutDataHeader,1],
);

alias ATSFlatDataTextLayoutHeader = Struct_ATSFlatDataTextLayoutHeader;

record Struct_ATSFlatDataLayoutControlsDataHeader (
    numberOfLayoutControls : UInt,
    controlArray : Array[ATSUAttributeInfo,1],
);

alias ATSFlatDataLayoutControlsDataHeader = Struct_ATSFlatDataLayoutControlsDataHeader;

record Struct_ATSFlatDataLineInfoData (
    lineLength : UInt,
    numberOfLineControls : UInt,
);

alias ATSFlatDataLineInfoData = Struct_ATSFlatDataLineInfoData;

record Struct_ATSFlatDataLineInfoHeader (
    numberOfLines : UInt,
    lineInfoArray : Array[ATSFlatDataLineInfoData,1],
);

alias ATSFlatDataLineInfoHeader = Struct_ATSFlatDataLineInfoHeader;

record Struct_ATSFlatDataStyleRunDataHeader (
    numberOfStyleRuns : UInt,
    styleRunArray : Array[ATSUStyleRunInfo,1],
);

alias ATSFlatDataStyleRunDataHeader = Struct_ATSFlatDataStyleRunDataHeader;

record Struct_ATSFlatDataStyleListStyleDataHeader (
    sizeOfStyleInfo : UInt,
    numberOfSetAttributes : UInt,
    numberOfSetFeatures : UInt,
    numberOfSetVariations : UInt,
);

alias ATSFlatDataStyleListStyleDataHeader = Struct_ATSFlatDataStyleListStyleDataHeader;

record Struct_ATSFlatDataStyleListHeader (
    numberOfStyles : UInt,
    styleDataArray : Array[ATSFlatDataStyleListStyleDataHeader,1],
);

alias ATSFlatDataStyleListHeader = Struct_ATSFlatDataStyleListHeader;

record Struct_ATSFlatDataStyleListFeatureData (
    theFeatureType : UShort,
    theFeatureSelector : UShort,
);

alias ATSFlatDataStyleListFeatureData = Struct_ATSFlatDataStyleListFeatureData;

record Struct_ATSFlatDataStyleListVariationData (
    theVariationAxis : UInt,
    theVariationValue : Int,
);

alias ATSFlatDataStyleListVariationData = Struct_ATSFlatDataStyleListVariationData;

alias ATSFlatDataFontSpeciferType = UInt;

alias kATSFlattenedFontSpecifierRawNameData = 1851878756;

record Struct_ATSFlatDataFontNameDataHeader (
    nameSpecifierType : UInt,
    nameSpecifierSize : UInt,
);

alias ATSFlatDataFontNameDataHeader = Struct_ATSFlatDataFontNameDataHeader;

record Struct_ATSFlatDataFontSpecRawNameData (
    fontNameType : UInt,
    fontNamePlatform : UInt,
    fontNameScript : UInt,
    fontNameLanguage : UInt,
    fontNameLength : UInt,
);

alias ATSFlatDataFontSpecRawNameData = Struct_ATSFlatDataFontSpecRawNameData;

record Struct_ATSFlatDataFontSpecRawNameDataHeader (
    numberOfFlattenedNames : UInt,
    nameDataArray : Array[ATSFlatDataFontSpecRawNameData,1],
);

alias ATSFlatDataFontSpecRawNameDataHeader = Struct_ATSFlatDataFontSpecRawNameDataHeader;

alias ATSUDirectDataSelector = UInt;

alias kATSUDirectDataAdvanceDeltaFixedArray = 0;
alias kATSUDirectDataBaselineDeltaFixedArray = 1;
alias kATSUDirectDataDeviceDeltaSInt16Array = 2;
alias kATSUDirectDataStyleIndexUInt16Array = 3;
alias kATSUDirectDataStyleSettingATSUStyleSettingRefArray = 4;
alias kATSUDirectDataLayoutRecordATSLayoutRecordVersion1 = 100;
alias kATSUDirectDataLayoutRecordATSLayoutRecordCurrent = 100;

alias ATSUStyleSettingRef = OpaquePointer;

external ATSUDirectGetLayoutDataArrayPtrFromLineRef(
    iLineRef : ATSULineRef,
    iDataSelector : UInt,
    iCreate : CUChar,
    oLayoutDataArrayPtr : Pointer[RawPointer],
    oLayoutDataCount : Pointer[CULong]) : Int;

external ATSUDirectReleaseLayoutDataArrayPtr(
    iLineRef : ATSULineRef,
    iDataSelector : UInt,
    iLayoutDataArrayPtr : Pointer[RawPointer]) : Int;

alias HIShapeRef = OpaquePointer;

alias HIMutableShapeRef = OpaquePointer;

alias kHIShapeEnumerateInit = 1;
alias kHIShapeEnumerateRect = 2;
alias kHIShapeEnumerateTerminate = 3;

alias kHIShapeParseFromTop = 0;
alias kHIShapeParseFromBottom = 1;
alias kHIShapeParseFromLeft = 0;
alias kHIShapeParseFromRight = 2;
alias kHIShapeParseFromTopLeft = 0;
alias kHIShapeParseFromBottomRight = 3;

alias HIShapeEnumerateProcPtr = CCodePointer[[Int,OpaquePointer,Pointer[Struct_CGRect],RawPointer],[Int]];

external HIShapeGetTypeID() : CULong;

external HIShapeCreateEmpty() : HIShapeRef;

external HIShapeCreateWithQDRgn(
    inRgn : RgnHandle) : HIShapeRef;

external HIShapeCreateWithRect(
    inRect : Pointer[CGRect]) : HIShapeRef;

external HIShapeCreateCopy(
    inShape : HIShapeRef) : HIShapeRef;

external HIShapeCreateIntersection(
    inShape1 : HIShapeRef,
    inShape2 : HIShapeRef) : HIShapeRef;

external HIShapeCreateDifference(
    inShape1 : HIShapeRef,
    inShape2 : HIShapeRef) : HIShapeRef;

external HIShapeCreateUnion(
    inShape1 : HIShapeRef,
    inShape2 : HIShapeRef) : HIShapeRef;

external HIShapeCreateXor(
    inShape1 : HIShapeRef,
    inShape2 : HIShapeRef) : HIShapeRef;

external HIShapeIsEmpty(
    inShape : HIShapeRef) : CUChar;

external HIShapeIsRectangular(
    inShape : HIShapeRef) : CUChar;

external HIShapeContainsPoint(
    inShape : HIShapeRef,
    inPoint : Pointer[CGPoint]) : CUChar;

external HIShapeIntersectsRect(
    inShape : HIShapeRef,
    inRect : Pointer[CGRect]) : CUChar;

external HIShapeGetBounds(
    inShape : HIShapeRef,
    outRect : Pointer[CGRect]) : Pointer[CGRect];

external HIShapeGetAsQDRgn(
    inShape : HIShapeRef,
    outRgn : RgnHandle) : Int;

external HIShapeReplacePathInCGContext(
    inShape : HIShapeRef,
    inContext : CGContextRef) : Int;

external HIShapeEnumerate(
    inShape : HIShapeRef,
    inOptions : UInt,
    inProc : HIShapeEnumerateProcPtr,
    inRefcon : RawPointer) : Int;

external HIShapeCreateMutable() : HIMutableShapeRef;

external HIShapeCreateMutableCopy(
    inOrig : HIShapeRef) : HIMutableShapeRef;

external HIShapeCreateMutableWithRect(
    inRect : Pointer[CGRect]) : HIMutableShapeRef;

external HIShapeSetEmpty(
    inShape : HIMutableShapeRef) : Int;

external HIShapeSetWithShape(
    inDestShape : HIMutableShapeRef,
    inSrcShape : HIShapeRef) : Int;

external HIShapeIntersect(
    inShape1 : HIShapeRef,
    inShape2 : HIShapeRef,
    outResult : HIMutableShapeRef) : Int;

external HIShapeDifference(
    inShape1 : HIShapeRef,
    inShape2 : HIShapeRef,
    outResult : HIMutableShapeRef) : Int;

external HIShapeUnion(
    inShape1 : HIShapeRef,
    inShape2 : HIShapeRef,
    outResult : HIMutableShapeRef) : Int;

external HIShapeXor(
    inShape1 : HIShapeRef,
    inShape2 : HIShapeRef,
    outResult : HIMutableShapeRef) : Int;

external HIShapeOffset(
    inShape : HIMutableShapeRef,
    inDX : Double,
    inDY : Double) : Int;

external HIShapeInset(
    inShape : HIMutableShapeRef,
    inDX : Double,
    inDY : Double) : Int;

external HIShapeUnionWithRect(
    inShape : HIMutableShapeRef,
    inRect : Pointer[CGRect]) : Int;

alias kAlignNone = 0;
alias kAlignVerticalCenter = 1;
alias kAlignTop = 2;
alias kAlignBottom = 3;
alias kAlignHorizontalCenter = 4;
alias kAlignAbsoluteCenter = 5;
alias kAlignCenterTop = 6;
alias kAlignCenterBottom = 7;
alias kAlignLeft = 8;
alias kAlignCenterLeft = 9;
alias kAlignTopLeft = 10;
alias kAlignBottomLeft = 11;
alias kAlignRight = 12;
alias kAlignCenterRight = 13;
alias kAlignTopRight = 14;
alias kAlignBottomRight = 15;

alias atNone = 0;
alias atVerticalCenter = 1;
alias atTop = 2;
alias atBottom = 3;
alias atHorizontalCenter = 4;
alias atAbsoluteCenter = 5;
alias atCenterTop = 6;
alias atCenterBottom = 7;
alias atLeft = 8;
alias atCenterLeft = 9;
alias atTopLeft = 10;
alias atBottomLeft = 11;
alias atRight = 12;
alias atCenterRight = 13;
alias atTopRight = 14;
alias atBottomRight = 15;

alias IconAlignmentType = Short;

alias kTransformNone = 0;
alias kTransformDisabled = 1;
alias kTransformOffline = 2;
alias kTransformOpen = 3;
alias kTransformLabel1 = 256;
alias kTransformLabel2 = 512;
alias kTransformLabel3 = 768;
alias kTransformLabel4 = 1024;
alias kTransformLabel5 = 1280;
alias kTransformLabel6 = 1536;
alias kTransformLabel7 = 1792;
alias kTransformSelected = 16384;
alias kTransformSelectedDisabled = 16385;
alias kTransformSelectedOffline = 16386;
alias kTransformSelectedOpen = 16387;

alias ttNone = 0;
alias ttDisabled = 1;
alias ttOffline = 2;
alias ttOpen = 3;
alias ttLabel1 = 256;
alias ttLabel2 = 512;
alias ttLabel3 = 768;
alias ttLabel4 = 1024;
alias ttLabel5 = 1280;
alias ttLabel6 = 1536;
alias ttLabel7 = 1792;
alias ttSelected = 16384;
alias ttSelectedDisabled = 16385;
alias ttSelectedOffline = 16386;
alias ttSelectedOpen = 16387;

alias IconTransformType = Short;

alias kSelectorLarge1Bit = 1;
alias kSelectorLarge4Bit = 2;
alias kSelectorLarge8Bit = 4;
alias kSelectorLarge32Bit = 8;
alias kSelectorLarge8BitMask = 16;
alias kSelectorSmall1Bit = 256;
alias kSelectorSmall4Bit = 512;
alias kSelectorSmall8Bit = 1024;
alias kSelectorSmall32Bit = 2048;
alias kSelectorSmall8BitMask = 4096;
alias kSelectorMini1Bit = 65536;
alias kSelectorMini4Bit = 131072;
alias kSelectorMini8Bit = 262144;
alias kSelectorHuge1Bit = 16777216;
alias kSelectorHuge4Bit = 33554432;
alias kSelectorHuge8Bit = 67108864;
alias kSelectorHuge32Bit = 134217728;
alias kSelectorHuge8BitMask = 268435456;
alias kSelectorAllLargeData = 255;
alias kSelectorAllSmallData = 65280;
alias kSelectorAllMiniData = 16711680;
alias kSelectorAllHugeData = 4278190080;
alias kSelectorAll1BitData = 16843009;
alias kSelectorAll4BitData = 33686018;
alias kSelectorAll8BitData = 67372036;
alias kSelectorAll32BitData = 134219784;
alias kSelectorAllAvailableData = 4294967295;

alias IconSelectorValue = UInt;

alias svLarge1Bit = 1;
alias svLarge4Bit = 2;
alias svLarge8Bit = 4;
alias svSmall1Bit = 256;
alias svSmall4Bit = 512;
alias svSmall8Bit = 1024;
alias svMini1Bit = 65536;
alias svMini4Bit = 131072;
alias svMini8Bit = 262144;
alias svAllLargeData = 255;
alias svAllSmallData = 65280;
alias svAllMiniData = 16711680;
alias svAll1BitData = 16843009;
alias svAll4BitData = 33686018;
alias svAll8BitData = 67372036;
alias svAllAvailableData = 4294967295;

alias IconActionProcPtr = CCodePointer[[UInt,Pointer[Pointer[Pointer[CChar]]],RawPointer],[Short]];

alias IconGetterProcPtr = CCodePointer[[UInt,RawPointer],[Pointer[Pointer[CChar]]]];

alias IconActionUPP = IconActionProcPtr;

alias IconGetterUPP = IconGetterProcPtr;

external NewIconActionUPP(
    userRoutine : IconActionProcPtr) : IconActionUPP;

external NewIconGetterUPP(
    userRoutine : IconGetterProcPtr) : IconGetterUPP;

external DisposeIconActionUPP(
    userUPP : IconActionUPP);

external DisposeIconGetterUPP(
    userUPP : IconGetterUPP);

external InvokeIconActionUPP(
    theType : UInt,
    theIcon : Pointer[Handle],
    yourDataPtr : RawPointer,
    userUPP : IconActionUPP) : Short;

external InvokeIconGetterUPP(
    theType : UInt,
    yourDataPtr : RawPointer,
    userUPP : IconGetterUPP) : Handle;

alias PlotIconRefFlags = UInt;

alias kPlotIconRefNormalFlags = 0;
alias kPlotIconRefNoImage = 2;
alias kPlotIconRefNoMask = 4;

external IconRefToIconFamily(
    theIconRef : IconRef,
    whichIcons : UInt,
    iconFamily : Pointer[IconFamilyHandle]) : Short;

external SetIconFamilyData(
    iconFamily : IconFamilyHandle,
    iconType : UInt,
    h : Handle) : Short;

external GetIconFamilyData(
    iconFamily : IconFamilyHandle,
    iconType : UInt,
    h : Handle) : Short;

external PlotIconRefInContext(
    inContext : CGContextRef,
    inRect : Pointer[CGRect],
    inAlign : Short,
    inTransform : Short,
    inLabelColor : Pointer[RGBColor],
    inFlags : UInt,
    inIconRef : IconRef) : Int;

external IconRefContainsCGPoint(
    testPt : Pointer[CGPoint],
    iconRect : Pointer[CGRect],
    align : Short,
    iconServicesUsageFlags : UInt,
    theIconRef : IconRef) : CUChar;

external IconRefIntersectsCGRect(
    testRect : Pointer[CGRect],
    iconRect : Pointer[CGRect],
    align : Short,
    iconServicesUsageFlags : UInt,
    theIconRef : IconRef) : CUChar;

external IconRefToHIShape(
    iconRect : Pointer[CGRect],
    align : Short,
    iconServicesUsageFlags : UInt,
    theIconRef : IconRef) : HIShapeRef;

external IsIconRefMaskEmpty(
    iconRef : IconRef) : CUChar;

external GetIconRefVariant(
    inIconRef : IconRef,
    inVariant : UInt,
    outTransform : Pointer[Short]) : IconRef;

alias icPrefNotFoundErr = 4294966630;
alias icPermErr = 4294966629;
alias icPrefDataErr = 4294966628;
alias icInternalErr = 4294966627;
alias icTruncatedErr = 4294966626;
alias icNoMoreWritersErr = 4294966625;
alias icNothingToOverrideErr = 4294966624;
alias icNoURLErr = 4294966623;
alias icConfigNotFoundErr = 4294966622;
alias icConfigInappropriateErr = 4294966621;
alias icProfileNotFoundErr = 4294966620;
alias icTooManyProfilesErr = 4294966619;

alias kICComponentInterfaceVersion0 = 0;
alias kICComponentInterfaceVersion1 = 65536;
alias kICComponentInterfaceVersion2 = 131072;
alias kICComponentInterfaceVersion3 = 196608;
alias kICComponentInterfaceVersion4 = 262144;
alias kICComponentInterfaceVersion = 262144;

alias ICInstance = OpaquePointer;

alias ICAttr = UInt;

alias kICAttrLockedBit = 0;
alias kICAttrVolatileBit = 1;

alias kICAttrNoChange = 4294967295;
alias kICAttrLockedMask = 1;
alias kICAttrVolatileMask = 2;

alias ICPerm = CUChar;

alias icNoPerm = 0;
alias icReadOnlyPerm = 1;
alias icReadWritePerm = 2;

alias ICProfileID = Int;

alias ICProfileIDPtr = Pointer[Int];

alias kICNilProfileID = 0;

alias kICNoUserInteractionBit = 0;

alias kICNoUserInteractionMask = 1;

alias kICFileType = 1229144432;
alias kICCreator = 1229144432;

alias kInternetEventClass = 1196773964;
alias kAEGetURL = 1196773964;
alias kAEFetchURL = 1179996748;
alias keyAEAttaching = 1098146664;

alias kICEditPreferenceEventClass = 1229144432;
alias kICEditPreferenceEvent = 1229144432;
alias keyICEditPreferenceDestination = 1684370292;

alias kICComponentVersion = 0;
alias kICNumVersion = 1;

record Struct_ICFontRecord (
    size : Short,
    face : CUChar,
    pad : CChar,
    font : Str255,
);

alias ICFontRecord = Struct_ICFontRecord;

alias ICFontRecordPtr = Pointer[ICFontRecord];

alias ICFontRecordHandle = Pointer[ICFontRecordPtr];

record Struct_ICCharTable (
    netToMac : Array[CUChar,256],
    macToNet : Array[CUChar,256],
);

alias ICCharTable = Struct_ICCharTable;

alias ICCharTablePtr = Pointer[ICCharTable];

alias ICCharTableHandle = Pointer[ICCharTablePtr];

record Struct_ICAppSpec (
    fCreator : UInt,
    name : Str63,
);

alias ICAppSpec = Struct_ICAppSpec;

alias ICAppSpecPtr = Pointer[ICAppSpec];

alias ICAppSpecHandle = Pointer[ICAppSpecPtr];

record Struct_ICAppSpecList (
    numberOfItems : Short,
    appSpecs : Array[ICAppSpec,1],
);

alias ICAppSpecList = Struct_ICAppSpecList;

alias ICAppSpecListPtr = Pointer[ICAppSpecList];

alias ICAppSpecListHandle = Pointer[ICAppSpecListPtr];

record Struct_ICFileSpec (
    volName : Str31,
    volCreationDate : Int,
    fss : FSSpec,
    alias_ : AliasRecord,
);

alias ICFileSpec = Struct_ICFileSpec;

alias ICFileSpecPtr = Pointer[ICFileSpec];

alias ICFileSpecHandle = Pointer[ICFileSpecPtr];

alias kICFileSpecHeaderSize = 106;

alias ICMapEntryFlags = Int;

alias ICFixedLength = Short;

record Struct_ICMapEntry (
    totalLength : Short,
    fixedLength : Short,
    version : Short,
    fileType : UInt,
    fileCreator : UInt,
    postCreator : UInt,
    flags : Int,
    extension : Str255,
    creatorAppName : Str255,
    postAppName : Str255,
    MIMEType : Str255,
    entryName : Str255,
);

alias ICMapEntry = Struct_ICMapEntry;

alias ICMapEntryPtr = Pointer[ICMapEntry];

alias ICMapEntryHandle = Pointer[ICMapEntryPtr];

alias kICMapFixedLength = 22;

alias kICMapBinaryBit = 0;
alias kICMapResourceForkBit = 1;
alias kICMapDataForkBit = 2;
alias kICMapPostBit = 3;
alias kICMapNotIncomingBit = 4;
alias kICMapNotOutgoingBit = 5;

alias kICMapBinaryMask = 1;
alias kICMapResourceForkMask = 2;
alias kICMapDataForkMask = 4;
alias kICMapPostMask = 8;
alias kICMapNotIncomingMask = 16;
alias kICMapNotOutgoingMask = 32;

alias ICServiceEntryFlags = Short;

record Struct_ICServiceEntry (
    name : Str255,
    port : Short,
    flags : Short,
);

alias ICServiceEntry = Struct_ICServiceEntry;

alias ICServiceEntryPtr = Pointer[ICServiceEntry];

alias ICServiceEntryHandle = Pointer[ICServiceEntryPtr];

alias kICServicesTCPBit = 0;
alias kICServicesUDPBit = 1;

alias kICServicesTCPMask = 1;
alias kICServicesUDPMask = 2;

record Struct_ICServices (
    count : Short,
    services : Array[ICServiceEntry,1],
);

alias ICServices = Struct_ICServices;

alias ICServicesPtr = Pointer[ICServices];

alias ICServicesHandle = Pointer[ICServicesPtr];

external ICStart(
    inst : Pointer[ICInstance],
    signature : UInt) : Int;

external ICStop(
    inst : ICInstance) : Int;

external ICGetVersion(
    inst : ICInstance,
    whichVersion : CLong,
    version : Pointer[UInt]) : Int;

external ICGetConfigName(
    inst : ICInstance,
    longname : CUChar,
    name : Pointer[CUChar]) : Int;

external ICGetSeed(
    inst : ICInstance,
    seed : Pointer[CLong]) : Int;

external ICGetPerm(
    inst : ICInstance,
    perm : Pointer[CUChar]) : Int;

external ICBegin(
    inst : ICInstance,
    perm : CUChar) : Int;

external ICGetPref(
    inst : ICInstance,
    key : ConstStr255Param,
    attr : Pointer[UInt],
    buf : RawPointer,
    size : Pointer[CLong]) : Int;

external ICSetPref(
    inst : ICInstance,
    key : ConstStr255Param,
    attr : UInt,
    buf : RawPointer,
    size : CLong) : Int;

external ICFindPrefHandle(
    inst : ICInstance,
    key : ConstStr255Param,
    attr : Pointer[UInt],
    prefh : Handle) : Int;

external ICGetPrefHandle(
    inst : ICInstance,
    key : ConstStr255Param,
    attr : Pointer[UInt],
    prefh : Pointer[Handle]) : Int;

external ICSetPrefHandle(
    inst : ICInstance,
    key : ConstStr255Param,
    attr : UInt,
    prefh : Handle) : Int;

external ICCountPref(
    inst : ICInstance,
    count : Pointer[CLong]) : Int;

external ICGetIndPref(
    inst : ICInstance,
    index : CLong,
    key : Pointer[CUChar]) : Int;

external ICDeletePref(
    inst : ICInstance,
    key : ConstStr255Param) : Int;

external ICEnd(
    inst : ICInstance) : Int;

external ICGetDefaultPref(
    inst : ICInstance,
    key : ConstStr255Param,
    prefH : Handle) : Int;

external ICEditPreferences(
    inst : ICInstance,
    key : ConstStr255Param) : Int;

external ICLaunchURL(
    inst : ICInstance,
    hint : ConstStr255Param,
    data : RawPointer,
    len : CLong,
    selStart : Pointer[CLong],
    selEnd : Pointer[CLong]) : Int;

external ICParseURL(
    inst : ICInstance,
    hint : ConstStr255Param,
    data : RawPointer,
    len : CLong,
    selStart : Pointer[CLong],
    selEnd : Pointer[CLong],
    url : Handle) : Int;

external ICCreateGURLEvent(
    inst : ICInstance,
    helperCreator : UInt,
    urlH : Handle,
    theEvent : Pointer[AppleEvent]) : Int;

external ICSendGURLEvent(
    inst : ICInstance,
    theEvent : Pointer[AppleEvent]) : Int;

external ICMapFilename(
    inst : ICInstance,
    filename : ConstStr255Param,
    entry : Pointer[ICMapEntry]) : Int;

external ICMapTypeCreator(
    inst : ICInstance,
    fType : UInt,
    fCreator : UInt,
    filename : ConstStr255Param,
    entry : Pointer[ICMapEntry]) : Int;

external ICMapEntriesFilename(
    inst : ICInstance,
    entries : Handle,
    filename : ConstStr255Param,
    entry : Pointer[ICMapEntry]) : Int;

external ICMapEntriesTypeCreator(
    inst : ICInstance,
    entries : Handle,
    fType : UInt,
    fCreator : UInt,
    filename : ConstStr255Param,
    entry : Pointer[ICMapEntry]) : Int;

external ICCountMapEntries(
    inst : ICInstance,
    entries : Handle,
    count : Pointer[CLong]) : Int;

external ICGetIndMapEntry(
    inst : ICInstance,
    entries : Handle,
    index : CLong,
    pos : Pointer[CLong],
    entry : Pointer[ICMapEntry]) : Int;

external ICGetMapEntry(
    inst : ICInstance,
    entries : Handle,
    pos : CLong,
    entry : Pointer[ICMapEntry]) : Int;

external ICSetMapEntry(
    inst : ICInstance,
    entries : Handle,
    pos : CLong,
    entry : Pointer[ICMapEntry]) : Int;

external ICDeleteMapEntry(
    inst : ICInstance,
    entries : Handle,
    pos : CLong) : Int;

external ICAddMapEntry(
    inst : ICInstance,
    entries : Handle,
    entry : Pointer[ICMapEntry]) : Int;

external ICGetCurrentProfile(
    inst : ICInstance,
    currentID : Pointer[Int]) : Int;

external ICSetCurrentProfile(
    inst : ICInstance,
    newID : Int) : Int;

external ICCountProfiles(
    inst : ICInstance,
    count : Pointer[CLong]) : Int;

external ICGetIndProfile(
    inst : ICInstance,
    index : CLong,
    thisID : Pointer[Int]) : Int;

external ICGetProfileName(
    inst : ICInstance,
    thisID : Int,
    name : Pointer[CUChar]) : Int;

external ICSetProfileName(
    inst : ICInstance,
    thisID : Int,
    name : ConstStr255Param) : Int;

external ICAddProfile(
    inst : ICInstance,
    prototypeID : Int,
    newID : Pointer[Int]) : Int;

external ICDeleteProfile(
    inst : ICInstance,
    thisID : Int) : Int;

alias kNoProcess = 0;
alias kSystemProcess = 1;
alias kCurrentProcess = 2;

alias LaunchFlags = UShort;

alias launchContinue = 16384;
alias launchNoFileFlags = 2048;
alias launchUseMinimum = 1024;
alias launchDontSwitch = 512;
alias launchAllow24Bit = 256;
alias launchInhibitDaemon = 128;

record Struct_AppParameters (
    theMsgEvent : UnnamedRecord,
    eventRefCon : UInt,
    messageLength : UInt,
);

record UnnamedRecord (
    what : UShort,
    message : UInt,
    when : UInt,
    where : Point,
    modifiers : UShort,
);

alias AppParameters = Struct_AppParameters;

alias AppParametersPtr = Pointer[AppParameters];

record Struct_LaunchParamBlockRec (
    reserved1 : UInt,
    reserved2 : UShort,
    launchBlockID : UShort,
    launchEPBLength : UInt,
    launchFileFlags : UShort,
    launchControlFlags : UShort,
    launchAppRef : FSRefPtr,
    launchProcessSN : ProcessSerialNumber,
    launchPreferredSize : UInt,
    launchMinimumSize : UInt,
    launchAvailableSize : UInt,
    launchAppParameters : AppParametersPtr,
);

alias LaunchParamBlockRec = Struct_LaunchParamBlockRec;

alias LaunchPBPtr = Pointer[LaunchParamBlockRec];

alias extendedBlock = 19523;
alias extendedBlockLen = 40;

alias modeReserved = 16777216;
alias modeControlPanel = 524288;
alias modeLaunchDontSwitch = 262144;
alias modeDeskAccessory = 131072;
alias modeMultiLaunch = 65536;
alias modeNeedSuspendResume = 16384;
alias modeCanBackground = 4096;
alias modeDoesActivateOnFGSwitch = 2048;
alias modeOnlyBackground = 1024;
alias modeGetFrontClicks = 512;
alias modeGetAppDiedMsg = 256;
alias mode32BitCompatible = 128;
alias modeHighLevelEventAware = 64;
alias modeLocalAndRemoteHLEvents = 32;
alias modeStationeryAware = 16;
alias modeUseTextEditServices = 8;
alias modeDisplayManagerAware = 4;

alias ProcessApplicationTransformState = UInt;

alias kProcessTransformToForegroundApplication = 1;

record Struct_ProcessInfoRec (
    processInfoLength : UInt,
    processName : StringPtr,
    processNumber : ProcessSerialNumber,
    processType : UInt,
    processSignature : UInt,
    processMode : UInt,
    processLocation : Ptr,
    processSize : UInt,
    processFreeMem : UInt,
    processLauncher : ProcessSerialNumber,
    processLaunchDate : UInt,
    processActiveTime : UInt,
    processAppRef : FSRefPtr,
);

alias ProcessInfoRec = Struct_ProcessInfoRec;

alias ProcessInfoRecPtr = Pointer[ProcessInfoRec];

record Struct_ProcessInfoExtendedRec (
    processInfoLength : UInt,
    processName : StringPtr,
    processNumber : ProcessSerialNumber,
    processType : UInt,
    processSignature : UInt,
    processMode : UInt,
    processLocation : Ptr,
    processSize : UInt,
    processFreeMem : UInt,
    processLauncher : ProcessSerialNumber,
    processLaunchDate : UInt,
    processActiveTime : UInt,
    processAppRef : FSRefPtr,
    processTempMemTotal : UInt,
    processPurgeableTempMemTotal : UInt,
);

alias ProcessInfoExtendedRec = Struct_ProcessInfoExtendedRec;

alias ProcessInfoExtendedRecPtr = Pointer[ProcessInfoExtendedRec];

record Struct_SizeResourceRec (
    flags : UShort,
    preferredHeapSize : UInt,
    minimumHeapSize : UInt,
);

alias SizeResourceRec = Struct_SizeResourceRec;

alias SizeResourceRecPtr = Pointer[SizeResourceRec];

alias SizeResourceRecHandle = Pointer[SizeResourceRecPtr];

alias kProcessDictionaryIncludeAllInformationMask = 4294967295;

alias kQuitBeforeNormalTimeMask = 1;
alias kQuitAtNormalTimeMask = 2;
alias kQuitBeforeFBAsQuitMask = 4;
alias kQuitBeforeShellQuitsMask = 8;
alias kQuitBeforeTerminatorAppQuitsMask = 16;
alias kQuitNeverMask = 32;
alias kQuitOptionsMask = 127;
alias kQuitNotQuitDuringInstallMask = 256;
alias kQuitNotQuitDuringLogoutMask = 512;

external LaunchApplication(
    LaunchParams : LaunchPBPtr) : Short;

external GetCurrentProcess(
    PSN : Pointer[ProcessSerialNumber]) : Short;

external GetFrontProcess(
    PSN : Pointer[ProcessSerialNumber]) : Short;

external GetNextProcess(
    PSN : Pointer[ProcessSerialNumber]) : Short;

external GetProcessInformation(
    PSN : Pointer[ProcessSerialNumber],
    info : Pointer[ProcessInfoRec]) : Short;

external ProcessInformationCopyDictionary(
    PSN : Pointer[ProcessSerialNumber],
    infoToReturn : UInt) : CFDictionaryRef;

external SetFrontProcess(
    PSN : Pointer[ProcessSerialNumber]) : Short;

alias kSetFrontProcessFrontWindowOnly = 1;
alias kSetFrontProcessCausedByUser = 2;

external SetFrontProcessWithOptions(
    inProcess : Pointer[ProcessSerialNumber],
    inOptions : UInt) : Int;

external WakeUpProcess(
    PSN : Pointer[ProcessSerialNumber]) : Short;

external SameProcess(
    PSN1 : Pointer[ProcessSerialNumber],
    PSN2 : Pointer[ProcessSerialNumber],
    result : Pointer[CUChar]) : Short;

external ExitToShell();

external KillProcess(
    inProcess : Pointer[ProcessSerialNumber]) : Short;

external GetProcessBundleLocation(
    psn : Pointer[ProcessSerialNumber],
    location : Pointer[FSRef]) : Int;

external CopyProcessName(
    psn : Pointer[ProcessSerialNumber],
    name : Pointer[CFStringRef]) : Int;

external GetProcessPID(
    psn : Pointer[ProcessSerialNumber],
    pid : Pointer[Int]) : Int;

external GetProcessForPID(
    pid : Int,
    psn : Pointer[ProcessSerialNumber]) : Int;

external IsProcessVisible(
    psn : Pointer[ProcessSerialNumber]) : CUChar;

external ShowHideProcess(
    psn : Pointer[ProcessSerialNumber],
    visible : CUChar) : Short;

external TransformProcessType(
    psn : Pointer[ProcessSerialNumber],
    transformState : UInt) : Int;

alias initDev = 0;
alias hitDev = 1;
alias closeDev = 2;
alias nulDev = 3;
alias updateDev = 4;
alias activDev = 5;
alias deactivDev = 6;
alias keyEvtDev = 7;
alias macDev = 8;
alias undoDev = 9;
alias cutDev = 10;
alias copyDev = 11;
alias pasteDev = 12;
alias clearDev = 13;
alias cursorDev = 14;

alias cdevGenErr = 4294967295;
alias cdevMemErr = 0;
alias cdevResErr = 1;
alias cdevUnset = 3;

alias PasteboardRef = OpaquePointer;

alias PasteboardItemID = RawPointer;

alias badPasteboardSyncErr = 4294942166;
alias badPasteboardIndexErr = 4294942165;
alias badPasteboardItemErr = 4294942164;
alias badPasteboardFlavorErr = 4294942163;
alias duplicatePasteboardFlavorErr = 4294942162;
alias notPasteboardOwnerErr = 4294942161;
alias noPasteboardPromiseKeeperErr = 4294942160;

alias PasteboardSyncFlags = UInt;

alias kPasteboardModified = 1;
alias kPasteboardClientIsOwner = 2;

alias PasteboardFlavorFlags = UInt;

alias kPasteboardFlavorNoFlags = 0;
alias kPasteboardFlavorSenderOnly = 1;
alias kPasteboardFlavorSenderTranslated = 2;
alias kPasteboardFlavorNotSaved = 4;
alias kPasteboardFlavorRequestOnly = 8;
alias kPasteboardFlavorSystemTranslated = 256;
alias kPasteboardFlavorPromised = 512;

alias PasteboardStandardLocation = UInt;

alias kPasteboardStandardLocationTrash = 1953657704;
alias kPasteboardStandardLocationUnknown = 1970170734;

external PasteboardGetTypeID() : CULong;

external PasteboardCreate(
    inName : CFStringRef,
    outPasteboard : Pointer[PasteboardRef]) : Int;

external PasteboardSynchronize(
    inPasteboard : PasteboardRef) : UInt;

external PasteboardClear(
    inPasteboard : PasteboardRef) : Int;

external PasteboardCopyName(
    inPasteboard : PasteboardRef,
    outName : Pointer[CFStringRef]) : Int;

external PasteboardGetItemCount(
    inPasteboard : PasteboardRef,
    outItemCount : Pointer[CULong]) : Int;

external PasteboardGetItemIdentifier(
    inPasteboard : PasteboardRef,
    inIndex : CLong,
    outItem : Pointer[PasteboardItemID]) : Int;

external PasteboardCopyItemFlavors(
    inPasteboard : PasteboardRef,
    inItem : PasteboardItemID,
    outFlavorTypes : Pointer[CFArrayRef]) : Int;

external PasteboardGetItemFlavorFlags(
    inPasteboard : PasteboardRef,
    inItem : PasteboardItemID,
    inFlavorType : CFStringRef,
    outFlags : Pointer[UInt]) : Int;

external PasteboardCopyItemFlavorData(
    inPasteboard : PasteboardRef,
    inItem : PasteboardItemID,
    inFlavorType : CFStringRef,
    outData : Pointer[CFDataRef]) : Int;

external PasteboardPutItemFlavor(
    inPasteboard : PasteboardRef,
    inItem : PasteboardItemID,
    inFlavorType : CFStringRef,
    inData : CFDataRef,
    inFlags : UInt) : Int;

external PasteboardCopyPasteLocation(
    inPasteboard : PasteboardRef,
    outPasteLocation : Pointer[CFURLRef]) : Int;

external PasteboardSetPasteLocation(
    inPasteboard : PasteboardRef,
    inPasteLocation : CFURLRef) : Int;

alias PasteboardPromiseKeeperProcPtr = CCodePointer[[OpaquePointer,RawPointer,OpaquePointer,RawPointer],[Int]];

external PasteboardSetPromiseKeeper(
    inPasteboard : PasteboardRef,
    inPromiseKeeper : PasteboardPromiseKeeperProcPtr,
    inContext : RawPointer) : Int;

external PasteboardResolvePromises(
    inPasteboard : PasteboardRef) : Int;

alias TranslationRef = OpaquePointer;

alias badTranslationRefErr = 4294964265;

alias TranslationFlags = UInt;

alias kTranslationDataTranslation = 1;
alias kTranslationFileTranslation = 2;

external TranslationGetTypeID() : CULong;

external TranslationCreate(
    inSourceType : CFStringRef,
    inDestinationType : CFStringRef,
    inTranslationFlags : UInt,
    outTranslation : Pointer[TranslationRef]) : Int;

external TranslationCreateWithSourceArray(
    inSourceTypes : CFArrayRef,
    inTranslationFlags : UInt,
    outDestinationTypes : Pointer[CFArrayRef],
    outTranslations : Pointer[CFDictionaryRef]) : Int;

external TranslationPerformForData(
    inTranslation : TranslationRef,
    inSourceData : CFDataRef,
    outDestinationData : Pointer[CFDataRef]) : Int;

external TranslationPerformForFile(
    inTranslation : TranslationRef,
    inSourceFile : Pointer[FSRef],
    inDestinationDirectory : Pointer[FSRef],
    inDestinationName : CFStringRef,
    outTranslatedFile : Pointer[FSRef]) : Int;

external TranslationPerformForURL(
    inTranslation : TranslationRef,
    inSourceURL : CFURLRef,
    inDestinationURL : CFURLRef,
    outTranslatedURL : Pointer[CFURLRef]) : Int;

external TranslationCopySourceType(
    inTranslation : TranslationRef,
    outSourceType : Pointer[CFStringRef]) : Int;

external TranslationCopyDestinationType(
    inTranslation : TranslationRef,
    outDestinationType : Pointer[CFStringRef]) : Int;

external TranslationGetTranslationFlags(
    inTranslation : TranslationRef,
    outTranslationFlags : Pointer[UInt]) : Int;

alias kAXErrorSuccess = 0;
alias kAXErrorFailure = 4294942096;
alias kAXErrorIllegalArgument = 4294942095;
alias kAXErrorInvalidUIElement = 4294942094;
alias kAXErrorInvalidUIElementObserver = 4294942093;
alias kAXErrorCannotComplete = 4294942092;
alias kAXErrorAttributeUnsupported = 4294942091;
alias kAXErrorActionUnsupported = 4294942090;
alias kAXErrorNotificationUnsupported = 4294942089;
alias kAXErrorNotImplemented = 4294942088;
alias kAXErrorNotificationAlreadyRegistered = 4294942087;
alias kAXErrorNotificationNotRegistered = 4294942086;
alias kAXErrorAPIDisabled = 4294942085;
alias kAXErrorNoValue = 4294942084;
alias kAXErrorParameterizedAttributeUnsupported = 4294942083;
alias kAXErrorNotEnoughPrecision = 4294942082;

alias AXError = Int;

external AXAPIEnabled() : CUChar;

external AXIsProcessTrusted() : CUChar;

external AXMakeProcessTrusted(
    executablePath : CFStringRef) : Int;

alias AXUIElementRef = OpaquePointer;

alias kAXCopyMultipleAttributeOptionStopOnError = 1;

alias AXCopyMultipleAttributeOptions = UInt;

external AXUIElementGetTypeID() : CULong;

external AXUIElementCopyAttributeNames(
    element : AXUIElementRef,
    names : Pointer[CFArrayRef]) : Int;

external AXUIElementCopyAttributeValue(
    element : AXUIElementRef,
    attribute : CFStringRef,
    value : Pointer[CFTypeRef]) : Int;

external AXUIElementGetAttributeValueCount(
    element : AXUIElementRef,
    attribute : CFStringRef,
    count : Pointer[CLong]) : Int;

external AXUIElementCopyAttributeValues(
    element : AXUIElementRef,
    attribute : CFStringRef,
    index : CLong,
    maxValues : CLong,
    values : Pointer[CFArrayRef]) : Int;

external AXUIElementIsAttributeSettable(
    element : AXUIElementRef,
    attribute : CFStringRef,
    settable : Pointer[CUChar]) : Int;

external AXUIElementSetAttributeValue(
    element : AXUIElementRef,
    attribute : CFStringRef,
    value : CFTypeRef) : Int;

external AXUIElementCopyMultipleAttributeValues(
    element : AXUIElementRef,
    attributes : CFArrayRef,
    options : UInt,
    values : Pointer[CFArrayRef]) : Int;

external AXUIElementCopyParameterizedAttributeNames(
    element : AXUIElementRef,
    names : Pointer[CFArrayRef]) : Int;

external AXUIElementCopyParameterizedAttributeValue(
    element : AXUIElementRef,
    parameterizedAttribute : CFStringRef,
    parameter : CFTypeRef,
    result : Pointer[CFTypeRef]) : Int;

external AXUIElementCopyActionNames(
    element : AXUIElementRef,
    names : Pointer[CFArrayRef]) : Int;

external AXUIElementCopyActionDescription(
    element : AXUIElementRef,
    action : CFStringRef,
    description : Pointer[CFStringRef]) : Int;

external AXUIElementPerformAction(
    element : AXUIElementRef,
    action : CFStringRef) : Int;

external AXUIElementCopyElementAtPosition(
    application : AXUIElementRef,
    x : Float,
    y : Float,
    element : Pointer[AXUIElementRef]) : Int;

external AXUIElementCreateApplication(
    pid : Int) : AXUIElementRef;

external AXUIElementCreateSystemWide() : AXUIElementRef;

external AXUIElementGetPid(
    element : AXUIElementRef,
    pid : Pointer[Int]) : Int;

external AXUIElementSetMessagingTimeout(
    element : AXUIElementRef,
    timeoutInSeconds : Float) : Int;

external AXUIElementPostKeyboardEvent(
    application : AXUIElementRef,
    keyChar : UShort,
    virtualKey : UShort,
    keyDown : CUChar) : Int;

alias AXObserverRef = OpaquePointer;

alias AXObserverCallback = CCodePointer[[OpaquePointer,OpaquePointer,OpaquePointer,RawPointer],[]];

external AXObserverGetTypeID() : CULong;

external AXObserverCreate(
    application : Int,
    callback : AXObserverCallback,
    outObserver : Pointer[AXObserverRef]) : Int;

external AXObserverAddNotification(
    observer : AXObserverRef,
    element : AXUIElementRef,
    notification : CFStringRef,
    refcon : RawPointer) : Int;

external AXObserverRemoveNotification(
    observer : AXObserverRef,
    element : AXUIElementRef,
    notification : CFStringRef) : Int;

external AXObserverGetRunLoopSource(
    observer : AXObserverRef) : CFRunLoopSourceRef;

alias kAXValueCGPointType = 1;
alias kAXValueCGSizeType = 2;
alias kAXValueCGRectType = 3;
alias kAXValueCFRangeType = 4;
alias kAXValueAXErrorType = 5;
alias kAXValueIllegalType = 0;

alias AXValueType = Int;

alias AXValueRef = OpaquePointer;

external AXValueGetTypeID() : CULong;

external AXValueCreate(
    theType : AXValueType,
    valuePtr : RawPointer) : AXValueRef;

external AXValueGetType(
    value : AXValueRef) : AXValueType;

external AXValueGetValue(
    value : AXValueRef,
    theType : AXValueType,
    valuePtr : RawPointer) : CUChar;

external kAXFontTextAttribute : CFStringRef;

external kAXForegroundColorTextAttribute : CFStringRef;

external kAXBackgroundColorTextAttribute : CFStringRef;

external kAXUnderlineColorTextAttribute : CFStringRef;

external kAXStrikethroughColorTextAttribute : CFStringRef;

external kAXUnderlineTextAttribute : CFStringRef;

external kAXSuperscriptTextAttribute : CFStringRef;

external kAXStrikethroughTextAttribute : CFStringRef;

external kAXShadowTextAttribute : CFStringRef;

external kAXAttachmentTextAttribute : CFStringRef;

external kAXLinkTextAttribute : CFStringRef;

external kAXNaturalLanguageTextAttribute : CFStringRef;

external kAXReplacementStringTextAttribute : CFStringRef;

external kAXMisspelledTextAttribute : CFStringRef;

external kAXFontNameKey : CFStringRef;

external kAXFontFamilyKey : CFStringRef;

external kAXVisibleNameKey : CFStringRef;

external kAXFontSizeKey : CFStringRef;

alias kAXUnderlineStyleNone = 0;
alias kAXUnderlineStyleSingle = 1;
alias kAXUnderlineStyleThick = 2;
alias kAXUnderlineStyleDouble = 9;

alias AXUnderlineStyle = UInt;

external kAXForegoundColorTextAttribute : CFStringRef;

alias UAZoomChangeFocusType = UInt;

alias kUAZoomFocusTypeOther = 0;
alias kUAZoomFocusTypeInsertionPoint = 1;

external UAZoomEnabled() : CUChar;

external UAZoomChangeFocus(
    inRect : Pointer[CGRect],
    inHighlightRect : Pointer[CGRect],
    inType : UInt) : Int;

alias ColorSyncProfileRef = OpaquePointer;

alias ColorSyncMutableProfileRef = OpaquePointer;

external kColorSyncGenericGrayProfile : CFStringRef;

external kColorSyncGenericGrayGamma22Profile : CFStringRef;

external kColorSyncGenericRGBProfile : CFStringRef;

external kColorSyncGenericCMYKProfile : CFStringRef;

external kColorSyncSRGBProfile : CFStringRef;

external kColorSyncAdobeRGB1998Profile : CFStringRef;

external kColorSyncGenericLabProfile : CFStringRef;

external kColorSyncGenericXYZProfile : CFStringRef;

external kColorSyncProfileHeader : CFStringRef;

external kColorSyncProfileClass : CFStringRef;

external kColorSyncProfileColorSpace : CFStringRef;

external kColorSyncProfilePCS : CFStringRef;

external kColorSyncProfileURL : CFStringRef;

external kColorSyncProfileDescription : CFStringRef;

external kColorSyncProfileMD5Digest : CFStringRef;

external ColorSyncProfileGetTypeID() : CULong;

external ColorSyncProfileCreate(
    data : CFDataRef,
    error : Pointer[CFErrorRef]) : ColorSyncProfileRef;

external ColorSyncProfileCreateWithURL(
    url : CFURLRef,
    error : Pointer[CFErrorRef]) : ColorSyncProfileRef;

external ColorSyncProfileCreateWithName(
    name : CFStringRef) : ColorSyncProfileRef;

external ColorSyncProfileCreateWithDisplayID(
    displayID : UInt) : ColorSyncProfileRef;

external ColorSyncProfileCreateDeviceProfile(
    deviceClass : CFStringRef,
    deviceID : CFUUIDRef,
    profileID : CFTypeRef) : ColorSyncProfileRef;

external ColorSyncProfileCreateMutable() : ColorSyncMutableProfileRef;

external ColorSyncProfileCreateMutableCopy(
    prof : ColorSyncProfileRef) : ColorSyncMutableProfileRef;

external ColorSyncProfileCreateLink(
    profileInfo : CFArrayRef,
    options : CFDictionaryRef) : ColorSyncProfileRef;

external ColorSyncProfileVerify(
    prof : ColorSyncProfileRef,
    errors : Pointer[CFErrorRef],
    warnings : Pointer[CFErrorRef]) : Bool;

external ColorSyncProfileEstimateGammaWithDisplayID(
    displayID : Int,
    error : Pointer[CFErrorRef]) : Float;

external ColorSyncProfileEstimateGamma(
    prof : ColorSyncProfileRef,
    error : Pointer[CFErrorRef]) : Float;

record UnnamedStruct83 (
    digest : Array[CUChar,16],
);

alias ColorSyncMD5 = UnnamedStruct83;

external ColorSyncProfileGetMD5(
    prof : ColorSyncProfileRef) : ColorSyncMD5;

external ColorSyncProfileCopyData(
    prof : ColorSyncProfileRef,
    error : Pointer[CFErrorRef]) : CFDataRef;

external ColorSyncProfileGetURL(
    prof : ColorSyncProfileRef,
    error : Pointer[CFErrorRef]) : CFURLRef;

external ColorSyncProfileCopyHeader(
    prof : ColorSyncProfileRef) : CFDataRef;

external ColorSyncProfileSetHeader(
    prof : ColorSyncMutableProfileRef,
    header : CFDataRef);

external ColorSyncProfileCopyDescriptionString(
    prof : ColorSyncProfileRef) : CFStringRef;

external ColorSyncProfileCopyTagSignatures(
    prof : ColorSyncProfileRef) : CFArrayRef;

external ColorSyncProfileContainsTag(
    prof : ColorSyncProfileRef,
    signature : CFStringRef) : Bool;

external ColorSyncProfileCopyTag(
    prof : ColorSyncProfileRef,
    signature : CFStringRef) : CFDataRef;

external ColorSyncProfileSetTag(
    prof : ColorSyncMutableProfileRef,
    signature : CFStringRef,
    data : CFDataRef);

external ColorSyncProfileRemoveTag(
    prof : ColorSyncMutableProfileRef,
    signature : CFStringRef);

alias ColorSyncProfileIterateCallback = CCodePointer[[OpaquePointer,RawPointer],[Bool]];

external ColorSyncIterateInstalledProfiles(
    callBack : ColorSyncProfileIterateCallback,
    seed : Pointer[UInt],
    userInfo : RawPointer,
    error : Pointer[CFErrorRef]);

alias ColorSyncTransformRef = OpaquePointer;

external ColorSyncTransformGetTypeID() : CULong;

external ColorSyncTransformCreate(
    profileSequence : CFArrayRef,
    options : CFDictionaryRef) : ColorSyncTransformRef;

external ColorSyncTransformCopyProperty(
    transform : ColorSyncTransformRef,
    key : CFTypeRef,
    options : CFDictionaryRef) : CFTypeRef;

external ColorSyncTransformSetProperty(
    transform : ColorSyncTransformRef,
    key : CFTypeRef,
    property : CFTypeRef);

alias kColorSync1BitGamut = 1;
alias kColorSync8BitInteger = 2;
alias kColorSync16BitInteger = 3;
alias kColorSync16BitFloat = 4;
alias kColorSync32BitInteger = 5;
alias kColorSync32BitNamedColorIndex = 6;
alias kColorSync32BitFloat = 7;

alias ColorSyncDataDepth = Int;

alias kColorSyncAlphaNone = 0;
alias kColorSyncAlphaPremultipliedLast = 1;
alias kColorSyncAlphaPremultipliedFirst = 2;
alias kColorSyncAlphaLast = 3;
alias kColorSyncAlphaFirst = 4;
alias kColorSyncAlphaNoneSkipLast = 5;
alias kColorSyncAlphaNoneSkipFirst = 6;

alias ColorSyncAlphaInfo = Int;

alias kColorSyncAlphaInfoMask = 31;
alias kColorSyncByteOrderMask = 28672;
alias kColorSyncByteOrderDefault = 0;
alias kColorSyncByteOrder16Little = 4096;
alias kColorSyncByteOrder32Little = 8192;
alias kColorSyncByteOrder16Big = 12288;
alias kColorSyncByteOrder32Big = 16384;

alias ColorSyncDataLayout = UInt;

external ColorSyncTransformConvert(
    transform : ColorSyncTransformRef,
    width : CULong,
    height : CULong,
    dst : RawPointer,
    dstDepth : ColorSyncDataDepth,
    dstLayout : UInt,
    dstBytesPerRow : CULong,
    src : RawPointer,
    srcDepth : ColorSyncDataDepth,
    srcLayout : UInt,
    srcBytesPerRow : CULong,
    options : CFDictionaryRef) : Bool;

external kColorSyncProfile : CFStringRef;

external kColorSyncRenderingIntent : CFStringRef;

external kColorSyncRenderingIntentPerceptual : CFStringRef;

external kColorSyncRenderingIntentRelative : CFStringRef;

external kColorSyncRenderingIntentSaturation : CFStringRef;

external kColorSyncRenderingIntentAbsolute : CFStringRef;

external kColorSyncRenderingIntentUseProfileHeader : CFStringRef;

external kColorSyncTransformTag : CFStringRef;

external kColorSyncTransformDeviceToPCS : CFStringRef;

external kColorSyncTransformPCSToPCS : CFStringRef;

external kColorSyncTransformPCSToDevice : CFStringRef;

external kColorSyncTransformDeviceToDevice : CFStringRef;

external kColorSyncTransformGamutCheck : CFStringRef;

external kColorSyncBlackPointCompensation : CFStringRef;

external kColorSyncPreferredCMM : CFStringRef;

external kColorSyncConvertQuality : CFStringRef;

external kColorSyncBestQuality : CFStringRef;

external kColorSyncNormalQuality : CFStringRef;

external kColorSyncDraftQuality : CFStringRef;

external kColorSyncConvertThreadCount : CFStringRef;

external kColorSyncTranformInfo : CFStringRef;

external kColorSyncTransformCreator : CFStringRef;

external kColorSyncTransformSrcSpace : CFStringRef;

external kColorSyncTransformDstSpace : CFStringRef;

external kColorSyncTransformFullConversionData : CFStringRef;

external kColorSyncTransformSimplifiedConversionData : CFStringRef;

external kColorSyncTransformParametricConversionData : CFStringRef;

external kColorSyncConversionMatrix : CFStringRef;

external kColorSyncConversionParamCurve0 : CFStringRef;

external kColorSyncConversionParamCurve1 : CFStringRef;

external kColorSyncConversionParamCurve2 : CFStringRef;

external kColorSyncConversionParamCurve3 : CFStringRef;

external kColorSyncConversionParamCurve4 : CFStringRef;

external kColorSyncConversion1DLut : CFStringRef;

external kColorSyncConversionGridPoints : CFStringRef;

external kColorSyncConversionChannelID : CFStringRef;

external kColorSyncConversion3DLut : CFStringRef;

external kColorSyncConversionInpChan : CFStringRef;

external kColorSyncConversionOutChan : CFStringRef;

external kColorSyncConversionBPC : CFStringRef;

alias ColorSyncCMMRef = OpaquePointer;

external ColorSyncCMMGetTypeID() : CULong;

external ColorSyncCMMCreate(
    cmmBundle : CFBundleRef) : ColorSyncCMMRef;

external ColorSyncCMMGetBundle(
    argument0 : ColorSyncCMMRef) : CFBundleRef;

external ColorSyncCMMCopyLocalizedName(
    argument0 : ColorSyncCMMRef) : CFStringRef;

external ColorSyncCMMCopyCMMIdentifier(
    argument0 : ColorSyncCMMRef) : CFStringRef;

alias ColorSyncCMMIterateCallback = CCodePointer[[OpaquePointer,RawPointer],[Bool]];

external ColorSyncIterateInstalledCMMs(
    callBack : ColorSyncCMMIterateCallback,
    userInfo : RawPointer);

alias CMMInitializeLinkProfileProc = CCodePointer[[OpaquePointer,OpaquePointer,OpaquePointer],[Bool]];

alias CMMInitializeTransformProc = CCodePointer[[OpaquePointer,OpaquePointer,OpaquePointer],[Bool]];

alias CMMApplyTransformProc = CCodePointer[[OpaquePointer,CULong,CULong,CULong,Pointer[RawPointer],Int,UInt,CULong,CULong,Pointer[RawPointer],Int,UInt,CULong,OpaquePointer],[Bool]];

alias CMMCreateTransformPropertyProc = CCodePointer[[OpaquePointer,RawPointer,OpaquePointer],[RawPointer]];

external kCMMInitializeLinkProfileProcName : CFStringRef;

external kCMMInitializeTransformProcName : CFStringRef;

external kCMMApplyTransformProcName : CFStringRef;

external kCMMCreateTransformPropertyProcName : CFStringRef;

external kColorSyncDeviceID : CFStringRef;

external kColorSyncDeviceClass : CFStringRef;

external kColorSyncCameraDeviceClass : CFStringRef;

external kColorSyncDisplayDeviceClass : CFStringRef;

external kColorSyncPrinterDeviceClass : CFStringRef;

external kColorSyncScannerDeviceClass : CFStringRef;

external kColorSyncDeviceProfileURL : CFStringRef;

external kColorSyncDeviceDescription : CFStringRef;

external kColorSyncDeviceDescriptions : CFStringRef;

external kColorSyncFactoryProfiles : CFStringRef;

external kColorSyncCustomProfiles : CFStringRef;

external kColorSyncDeviceModeDescription : CFStringRef;

external kColorSyncDeviceModeDescriptions : CFStringRef;

external kColorSyncDeviceDefaultProfileID : CFStringRef;

external kColorSyncDeviceHostScope : CFStringRef;

external kColorSyncDeviceUserScope : CFStringRef;

external kColorSyncProfileHostScope : CFStringRef;

external kColorSyncProfileUserScope : CFStringRef;

external kColorSyncDeviceProfileIsFactory : CFStringRef;

external kColorSyncDeviceProfileIsDefault : CFStringRef;

external kColorSyncDeviceProfileIsCurrent : CFStringRef;

external kColorSyncDeviceProfileID : CFStringRef;

external kColorSyncDeviceRegisteredNotification : CFStringRef;

external kColorSyncDeviceUnregisteredNotification : CFStringRef;

external kColorSyncDeviceProfilesNotification : CFStringRef;

external kColorSyncDisplayDeviceProfilesNotification : CFStringRef;

external ColorSyncRegisterDevice(
    deviceClass : CFStringRef,
    deviceID : CFUUIDRef,
    deviceInfo : CFDictionaryRef) : Bool;

external ColorSyncUnregisterDevice(
    deviceClass : CFStringRef,
    deviceID : CFUUIDRef) : Bool;

external ColorSyncDeviceSetCustomProfiles(
    deviceClass : CFStringRef,
    deviceID : CFUUIDRef,
    profileInfo : CFDictionaryRef) : Bool;

external ColorSyncDeviceCopyDeviceInfo(
    deviceClass : CFStringRef,
    devID : CFUUIDRef) : CFDictionaryRef;

alias ColorSyncDeviceProfileIterateCallback = CCodePointer[[OpaquePointer,RawPointer],[Bool]];

external ColorSyncIterateDeviceProfiles(
    callBack : ColorSyncDeviceProfileIterateCallback,
    userInfo : RawPointer);

alias PMObject = RawPointer;

alias PMPrintSettings = OpaquePointer;

alias PMPageFormat = OpaquePointer;

alias PMPrintSession = OpaquePointer;

alias PMPrinter = OpaquePointer;

alias PMServer = OpaquePointer;

alias PMPreset = OpaquePointer;

alias PMPaper = OpaquePointer;

alias kPMCancel = 128;

alias PMDestinationType = UShort;

alias kPMDestinationInvalid = 0;
alias kPMDestinationPrinter = 1;
alias kPMDestinationFile = 2;
alias kPMDestinationFax = 3;
alias kPMDestinationPreview = 4;
alias kPMDestinationProcessPDF = 5;

alias PMOrientation = UShort;

alias kPMPortrait = 1;
alias kPMLandscape = 2;
alias kPMReversePortrait = 3;
alias kPMReverseLandscape = 4;

alias PMPrinterState = UShort;

alias kPMPrinterIdle = 3;
alias kPMPrinterProcessing = 4;
alias kPMPrinterStopped = 5;

alias PMColorSpaceModel = UInt;

alias kPMUnknownColorSpaceModel = 0;
alias kPMGrayColorSpaceModel = 1;
alias kPMRGBColorSpaceModel = 2;
alias kPMCMYKColorSpaceModel = 3;
alias kPMDevNColorSpaceModel = 4;

alias PMQualityMode = UInt;

alias kPMQualityLowest = 0;
alias kPMQualityInkSaver = 1;
alias kPMQualityDraft = 4;
alias kPMQualityNormal = 8;
alias kPMQualityPhoto = 11;
alias kPMQualityBest = 13;
alias kPMQualityHighest = 15;

alias PMPaperType = UInt;

alias kPMPaperTypeUnknown = 0;
alias kPMPaperTypePlain = 1;
alias kPMPaperTypeCoated = 2;
alias kPMPaperTypePremium = 3;
alias kPMPaperTypeGlossy = 4;
alias kPMPaperTypeTransparency = 5;
alias kPMPaperTypeTShirt = 6;

alias PMScalingAlignment = UShort;

alias kPMScalingPinTopLeft = 1;
alias kPMScalingPinTopRight = 2;
alias kPMScalingPinBottomLeft = 3;
alias kPMScalingPinBottomRight = 4;
alias kPMScalingCenterOnPaper = 5;
alias kPMScalingCenterOnImgArea = 6;

alias PMDuplexMode = UInt;

alias kPMDuplexNone = 1;
alias kPMDuplexNoTumble = 2;
alias kPMDuplexTumble = 3;
alias kPMSimplexTumble = 4;

alias PMLayoutDirection = UShort;

alias kPMLayoutLeftRightTopBottom = 1;
alias kPMLayoutLeftRightBottomTop = 2;
alias kPMLayoutRightLeftTopBottom = 3;
alias kPMLayoutRightLeftBottomTop = 4;
alias kPMLayoutTopBottomLeftRight = 5;
alias kPMLayoutTopBottomRightLeft = 6;
alias kPMLayoutBottomTopLeftRight = 7;
alias kPMLayoutBottomTopRightLeft = 8;

alias PMBorderType = UShort;

alias kPMBorderSingleHairline = 1;
alias kPMBorderDoubleHairline = 2;
alias kPMBorderSingleThickline = 3;
alias kPMBorderDoubleThickline = 4;

alias PMPrintDialogOptionFlags = UInt;

alias kPMHideInlineItems = 0;
alias kPMShowDefaultInlineItems = 32768;
alias kPMShowInlineCopies = 1;
alias kPMShowInlinePageRange = 2;
alias kPMShowInlinePageRangeWithSelection = 64;
alias kPMShowInlinePaperSize = 4;
alias kPMShowInlineOrientation = 8;
alias kPMShowInlineScale = 128;
alias kPMShowPageAttributesPDE = 256;

alias PMPPDDomain = UShort;

alias kAllPPDDomains = 1;
alias kSystemPPDDomain = 2;
alias kLocalPPDDomain = 3;
alias kNetworkPPDDomain = 4;
alias kUserPPDDomain = 5;
alias kCUPSPPDDomain = 6;

alias kPMNoError = 0;
alias kPMGeneralError = 4294936426;
alias kPMOutOfScope = 4294936425;
alias kPMInvalidParameter = 4294967246;
alias kPMNoDefaultPrinter = 4294936424;
alias kPMNotImplemented = 4294936423;
alias kPMNoSuchEntry = 4294936422;
alias kPMInvalidPrintSettings = 4294936421;
alias kPMInvalidPageFormat = 4294936420;
alias kPMValueOutOfRange = 4294936419;
alias kPMLockIgnored = 4294936418;

alias kPMInvalidPrintSession = 4294936417;
alias kPMInvalidPrinter = 4294936416;
alias kPMObjectInUse = 4294936415;
alias kPMInvalidPreset = 4294936397;

alias kPMPrintAllPages = 4294967295;

alias kPMUnlocked = 0;

record Struct_PMRect (
    top : Double,
    left : Double,
    bottom : Double,
    right : Double,
);

alias PMRect = Struct_PMRect;

record Struct_PMResolution (
    hRes : Double,
    vRes : Double,
);

alias PMResolution = Struct_PMResolution;

record Struct_PMLanguageInfo (
    level : Str32,
    version : Str32,
    release : Str32,
);

alias PMLanguageInfo = Struct_PMLanguageInfo;

alias PMPaperMargins = PMRect;

alias kPMDataFormatXMLDefault = 0;
alias kPMDataFormatXMLMinimal = 1;
alias kPMDataFormatXMLCompressed = 2;

alias PMDataFormat = Int;

external PMRetain(
    object : PMObject) : Int;

external PMRelease(
    object : PMObject) : Int;

external PMCreateSession(
    printSession : Pointer[PMPrintSession]) : Int;

external PMSessionError(
    printSession : PMPrintSession) : Int;

external PMSessionSetError(
    printSession : PMPrintSession,
    printError : Int) : Int;

external PMSessionBeginCGDocumentNoDialog(
    printSession : PMPrintSession,
    printSettings : PMPrintSettings,
    pageFormat : PMPageFormat) : Int;

external PMSessionEndDocumentNoDialog(
    printSession : PMPrintSession) : Int;

external PMSessionBeginPageNoDialog(
    printSession : PMPrintSession,
    pageFormat : PMPageFormat,
    pageFrame : Pointer[PMRect]) : Int;

external PMSessionEndPageNoDialog(
    printSession : PMPrintSession) : Int;

external PMSessionGetCGGraphicsContext(
    printSession : PMPrintSession,
    context : Pointer[CGContextRef]) : Int;

external PMSessionGetDestinationType(
    printSession : PMPrintSession,
    printSettings : PMPrintSettings,
    destTypeP : Pointer[UShort]) : Int;

external PMSessionCopyDestinationFormat(
    printSession : PMPrintSession,
    printSettings : PMPrintSettings,
    destFormatP : Pointer[CFStringRef]) : Int;

external PMSessionCopyDestinationLocation(
    printSession : PMPrintSession,
    printSettings : PMPrintSettings,
    destLocationP : Pointer[CFURLRef]) : Int;

external PMSessionSetDestination(
    printSession : PMPrintSession,
    printSettings : PMPrintSettings,
    destType : UShort,
    destFormat : CFStringRef,
    destLocation : CFURLRef) : Int;

external PMSessionCopyOutputFormatList(
    printSession : PMPrintSession,
    destType : UShort,
    documentFormatP : Pointer[CFArrayRef]) : Int;

external PMSessionCreatePageFormatList(
    printSession : PMPrintSession,
    printer : PMPrinter,
    pageFormatList : Pointer[CFArrayRef]) : Int;

external PMSessionCreatePrinterList(
    printSession : PMPrintSession,
    printerList : Pointer[CFArrayRef],
    currentIndex : Pointer[CLong],
    currentPrinter : Pointer[PMPrinter]) : Int;

external PMSessionGetCurrentPrinter(
    printSession : PMPrintSession,
    currentPrinter : Pointer[PMPrinter]) : Int;

external PMSessionSetCurrentPMPrinter(
    session : PMPrintSession,
    printer : PMPrinter) : Int;

external PMSessionGetDataFromSession(
    printSession : PMPrintSession,
    key : CFStringRef,
    data : Pointer[CFTypeRef]) : Int;

external PMSessionSetDataInSession(
    printSession : PMPrintSession,
    key : CFStringRef,
    data : CFTypeRef) : Int;

external PMCreatePageFormat(
    pageFormat : Pointer[PMPageFormat]) : Int;

external PMSessionDefaultPageFormat(
    printSession : PMPrintSession,
    pageFormat : PMPageFormat) : Int;

external PMSessionValidatePageFormat(
    printSession : PMPrintSession,
    pageFormat : PMPageFormat,
    result : Pointer[CUChar]) : Int;

external PMCopyPageFormat(
    formatSrc : PMPageFormat,
    formatDest : PMPageFormat) : Int;

external PMCreatePageFormatWithPMPaper(
    pageFormat : Pointer[PMPageFormat],
    paper : PMPaper) : Int;

external PMPageFormatCreateDataRepresentation(
    pageFormat : PMPageFormat,
    data : Pointer[CFDataRef],
    format : PMDataFormat) : Int;

external PMPageFormatCreateWithDataRepresentation(
    data : CFDataRef,
    pageFormat : Pointer[PMPageFormat]) : Int;

external PMGetAdjustedPageRect(
    pageFormat : PMPageFormat,
    pageRect : Pointer[PMRect]) : Int;

external PMGetAdjustedPaperRect(
    pageFormat : PMPageFormat,
    paperRect : Pointer[PMRect]) : Int;

external PMGetOrientation(
    pageFormat : PMPageFormat,
    orientation : Pointer[UShort]) : Int;

external PMGetPageFormatExtendedData(
    pageFormat : PMPageFormat,
    dataID : UInt,
    size : Pointer[UInt],
    extendedData : RawPointer) : Int;

external PMPageFormatGetPrinterID(
    pageFormat : PMPageFormat,
    printerID : Pointer[CFStringRef]) : Int;

external PMGetScale(
    pageFormat : PMPageFormat,
    scale : Pointer[Double]) : Int;

external PMGetUnadjustedPageRect(
    pageFormat : PMPageFormat,
    pageRect : Pointer[PMRect]) : Int;

external PMGetUnadjustedPaperRect(
    pageFormat : PMPageFormat,
    paperRect : Pointer[PMRect]) : Int;

external PMSetOrientation(
    pageFormat : PMPageFormat,
    orientation : UShort,
    lock : CUChar) : Int;

external PMSetPageFormatExtendedData(
    pageFormat : PMPageFormat,
    dataID : UInt,
    size : UInt,
    extendedData : RawPointer) : Int;

external PMSetScale(
    pageFormat : PMPageFormat,
    scale : Double) : Int;

external PMCreatePrintSettings(
    printSettings : Pointer[PMPrintSettings]) : Int;

external PMSessionDefaultPrintSettings(
    printSession : PMPrintSession,
    printSettings : PMPrintSettings) : Int;

external PMSessionValidatePrintSettings(
    printSession : PMPrintSession,
    printSettings : PMPrintSettings,
    result : Pointer[CUChar]) : Int;

external PMCopyPrintSettings(
    settingSrc : PMPrintSettings,
    settingDest : PMPrintSettings) : Int;

external PMPrintSettingsCreateDataRepresentation(
    printSettings : PMPrintSettings,
    data : Pointer[CFDataRef],
    format : PMDataFormat) : Int;

external PMPrintSettingsCreateWithDataRepresentation(
    data : CFDataRef,
    printSettings : Pointer[PMPrintSettings]) : Int;

external PMGetCollate(
    printSettings : PMPrintSettings,
    collate : Pointer[CUChar]) : Int;

external PMGetCopies(
    printSettings : PMPrintSettings,
    copies : Pointer[UInt]) : Int;

external PMGetDuplex(
    printSettings : PMPrintSettings,
    duplexSetting : Pointer[UInt]) : Int;

external PMGetFirstPage(
    printSettings : PMPrintSettings,
    first : Pointer[UInt]) : Int;

external PMGetLastPage(
    printSettings : PMPrintSettings,
    last : Pointer[UInt]) : Int;

external PMGetPageRange(
    printSettings : PMPrintSettings,
    minPage : Pointer[UInt],
    maxPage : Pointer[UInt]) : Int;

external PMPrintSettingsGetJobName(
    printSettings : PMPrintSettings,
    name : Pointer[CFStringRef]) : Int;

external PMPrintSettingsGetValue(
    printSettings : PMPrintSettings,
    key : CFStringRef,
    value : Pointer[CFTypeRef]) : Int;

external PMSetCollate(
    printSettings : PMPrintSettings,
    collate : CUChar) : Int;

external PMSetCopies(
    printSettings : PMPrintSettings,
    copies : UInt,
    lock : CUChar) : Int;

external PMSetDuplex(
    printSettings : PMPrintSettings,
    duplexSetting : UInt) : Int;

external PMSetFirstPage(
    printSettings : PMPrintSettings,
    first : UInt,
    lock : CUChar) : Int;

external PMSetLastPage(
    printSettings : PMPrintSettings,
    last : UInt,
    lock : CUChar) : Int;

external PMSetPageRange(
    printSettings : PMPrintSettings,
    minPage : UInt,
    maxPage : UInt) : Int;

external PMPrintSettingsSetJobName(
    printSettings : PMPrintSettings,
    name : CFStringRef) : Int;

external PMPrintSettingsSetValue(
    printSettings : PMPrintSettings,
    key : CFStringRef,
    value : CFTypeRef,
    locked : CUChar) : Int;

external PMPrintSettingsCopyAsDictionary(
    printSettings : PMPrintSettings,
    settingsDictionary : Pointer[CFDictionaryRef]) : Int;

external PMPrintSettingsCopyKeys(
    printSettings : PMPrintSettings,
    settingsKeys : Pointer[CFArrayRef]) : Int;

external PMCreateGenericPrinter(
    printer : Pointer[PMPrinter]) : Int;

external PMServerCreatePrinterList(
    server : PMServer,
    printerList : Pointer[CFArrayRef]) : Int;

external PMServerLaunchPrinterBrowser(
    server : PMServer,
    options : CFDictionaryRef) : Int;

external PMPrinterCreateFromPrinterID(
    printerID : CFStringRef) : PMPrinter;

external PMPrinterCopyDescriptionURL(
    printer : PMPrinter,
    descriptionType : CFStringRef,
    fileURL : Pointer[CFURLRef]) : Int;

external PMPrinterCopyDeviceURI(
    printer : PMPrinter,
    deviceURI : Pointer[CFURLRef]) : Int;

external PMPrinterCopyHostName(
    printer : PMPrinter,
    hostNameP : Pointer[CFStringRef]) : Int;

external PMPrinterCopyPresets(
    printer : PMPrinter,
    presetList : Pointer[CFArrayRef]) : Int;

external PMPrinterGetCommInfo(
    printer : PMPrinter,
    supportsControlCharRangeP : Pointer[CUChar],
    supportsEightBitP : Pointer[CUChar]) : Int;

external PMPrinterGetID(
    printer : PMPrinter) : CFStringRef;

external PMPrinterGetLocation(
    printer : PMPrinter) : CFStringRef;

external PMPrinterGetDriverCreator(
    printer : PMPrinter,
    creator : Pointer[UInt]) : Int;

external PMPrinterGetDriverReleaseInfo(
    printer : PMPrinter,
    release : Pointer[VersRec]) : Int;

external PMPrinterGetPrinterResolutionCount(
    printer : PMPrinter,
    countP : Pointer[UInt]) : Int;

external PMPrinterGetIndexedPrinterResolution(
    printer : PMPrinter,
    index : UInt,
    resolutionP : Pointer[PMResolution]) : Int;

external PMPrinterGetOutputResolution(
    printer : PMPrinter,
    printSettings : PMPrintSettings,
    resolutionP : Pointer[PMResolution]) : Int;

external PMPrinterSetOutputResolution(
    printer : PMPrinter,
    printSettings : PMPrintSettings,
    resolutionP : Pointer[PMResolution]) : Int;

external PMPrinterGetLanguageInfo(
    printer : PMPrinter,
    info : Pointer[PMLanguageInfo]) : Int;

external PMPrinterGetMakeAndModelName(
    printer : PMPrinter,
    makeAndModel : Pointer[CFStringRef]) : Int;

external PMPrinterGetMimeTypes(
    printer : PMPrinter,
    settings : PMPrintSettings,
    mimeTypes : Pointer[CFArrayRef]) : Int;

external PMPrinterGetName(
    printer : PMPrinter) : CFStringRef;

external PMPrinterGetPaperList(
    printer : PMPrinter,
    paperList : Pointer[CFArrayRef]) : Int;

external PMPrinterGetState(
    printer : PMPrinter,
    state : Pointer[UShort]) : Int;

external PMPrinterIsDefault(
    printer : PMPrinter) : CUChar;

external PMPrinterIsFavorite(
    printer : PMPrinter) : CUChar;

external PMPrinterIsPostScriptCapable(
    printer : PMPrinter) : CUChar;

external PMPrinterIsPostScriptPrinter(
    printer : PMPrinter,
    isPSPrinter : Pointer[CUChar]) : Int;

external PMPrinterIsRemote(
    printer : PMPrinter,
    isRemoteP : Pointer[CUChar]) : Int;

external PMPrinterSetDefault(
    printer : PMPrinter) : Int;

external PMPresetCopyName(
    preset : PMPreset,
    name : Pointer[CFStringRef]) : Int;

external PMPresetCreatePrintSettings(
    preset : PMPreset,
    session : PMPrintSession,
    printSettings : Pointer[PMPrintSettings]) : Int;

external PMPresetGetAttributes(
    preset : PMPreset,
    attributes : Pointer[CFDictionaryRef]) : Int;

external PMGetPageFormatPaper(
    format : PMPageFormat,
    paper : Pointer[PMPaper]) : Int;

external PMPaperCreateCustom(
    printer : PMPrinter,
    id : CFStringRef,
    name : CFStringRef,
    width : Double,
    height : Double,
    margins : Pointer[PMPaperMargins],
    paperP : Pointer[PMPaper]) : Int;

external PMPaperGetWidth(
    paper : PMPaper,
    paperWidth : Pointer[Double]) : Int;

external PMPaperGetHeight(
    paper : PMPaper,
    paperHeight : Pointer[Double]) : Int;

external PMPaperGetMargins(
    paper : PMPaper,
    paperMargins : Pointer[PMPaperMargins]) : Int;

external PMPaperGetID(
    paper : PMPaper,
    paperID : Pointer[CFStringRef]) : Int;

external PMPaperGetName(
    paper : PMPaper,
    paperName : Pointer[CFStringRef]) : Int;

external PMPaperGetPPDPaperName(
    paper : PMPaper,
    paperName : Pointer[CFStringRef]) : Int;

external PMPaperCreateLocalizedName(
    paper : PMPaper,
    printer : PMPrinter,
    paperName : Pointer[CFStringRef]) : Int;

external PMPaperGetPrinterID(
    paper : PMPaper,
    printerID : Pointer[CFStringRef]) : Int;

external PMPaperIsCustom(
    paper : PMPaper) : CUChar;

external PMWorkflowCopyItems(
    workflowItems : Pointer[CFArrayRef]) : Int;

external PMWorkflowSubmitPDFWithOptions(
    workflowItem : CFURLRef,
    title : CFStringRef,
    options : Pointer[CChar],
    pdfFile : CFURLRef) : Int;

external PMWorkflowSubmitPDFWithSettings(
    workflowItem : CFURLRef,
    settings : PMPrintSettings,
    pdfFile : CFURLRef) : Int;

external PMPrinterPrintWithProvider(
    printer : PMPrinter,
    settings : PMPrintSettings,
    format : PMPageFormat,
    mimeType : CFStringRef,
    provider : CGDataProviderRef) : Int;

external PMPrinterPrintWithFile(
    printer : PMPrinter,
    settings : PMPrintSettings,
    format : PMPageFormat,
    mimeType : CFStringRef,
    fileURL : CFURLRef) : Int;

external PMPrinterWritePostScriptToURL(
    printer : PMPrinter,
    settings : PMPrintSettings,
    format : PMPageFormat,
    mimeType : CFStringRef,
    sourceFileURL : CFURLRef,
    destinationFileURL : CFURLRef) : Int;

external PMPrintSettingsToOptions(
    settings : PMPrintSettings,
    options : Pointer[Pointer[CChar]]) : Int;

external PMPrintSettingsToOptionsWithPrinterAndPageFormat(
    settings : PMPrintSettings,
    printer : PMPrinter,
    pageFormat : PMPageFormat,
    options : Pointer[Pointer[CChar]]) : Int;

external PMPrinterSendCommand(
    printer : PMPrinter,
    commandString : CFStringRef,
    jobTitle : CFStringRef,
    options : CFDictionaryRef) : Int;

external PMPrinterCopyState(
    printer : PMPrinter,
    stateDict : Pointer[CFDictionaryRef]) : Int;

external PMCopyAvailablePPDs(
    domain : UShort,
    ppds : Pointer[CFArrayRef]) : Int;

external PMCopyLocalizedPPD(
    ppd : CFURLRef,
    localizedPPD : Pointer[CFURLRef]) : Int;

external PMCopyPPDData(
    ppd : CFURLRef,
    data : Pointer[CFDataRef]) : Int;

external PMCGImageCreateWithEPSDataProvider(
    epsDataProvider : CGDataProviderRef,
    epsPreview : CGImageRef) : CGImageRef;

external PMFlattenPageFormatToCFData(
    pageFormat : PMPageFormat,
    flatFormat : Pointer[CFDataRef]) : Int;

external PMFlattenPageFormatToURL(
    pageFormat : PMPageFormat,
    flattenFileURL : CFURLRef) : Int;

external PMUnflattenPageFormatWithCFData(
    flattenCFData : CFDataRef,
    pageFormat : Pointer[PMPageFormat]) : Int;

external PMUnflattenPageFormatWithURL(
    flattenFileURL : CFURLRef,
    pageFormat : Pointer[PMPageFormat]) : Int;

external PMFlattenPrintSettingsToCFData(
    printSettings : PMPrintSettings,
    flatSetting : Pointer[CFDataRef]) : Int;

external PMFlattenPrintSettingsToURL(
    printSettings : PMPrintSettings,
    flattenFileURL : CFURLRef) : Int;

external PMUnflattenPrintSettingsWithCFData(
    flattenCFData : CFDataRef,
    printSettings : Pointer[PMPrintSettings]) : Int;

external PMUnflattenPrintSettingsWithURL(
    flattenFileURL : CFURLRef,
    printSettings : Pointer[PMPrintSettings]) : Int;

external PMGetPrintSettingsExtendedData(
    printSettings : PMPrintSettings,
    dataID : UInt,
    size : Pointer[UInt],
    extendedData : RawPointer) : Int;

external PMSetPrintSettingsExtendedData(
    printSettings : PMPrintSettings,
    dataID : UInt,
    size : UInt,
    extendedData : RawPointer) : Int;

alias kPMCoverPageNone = 1;
alias kPMCoverPageBefore = 2;
alias kPMCoverPageAfter = 3;

alias kPMPageToPaperMappingNone = 1;
alias kPMPageToPaperMappingScaleToFit = 2;

alias PMPageToPaperMappingType = Int;

alias kPMAllocationFailure = 4294967188;
alias kPMInternalError = 4294936426;
alias kPMInvalidIndex = 4294936414;
alias kPMStringConversionFailure = 4294936413;
alias kPMXMLParseError = 4294936412;
alias kPMInvalidJobTemplate = 4294936411;
alias kPMInvalidPrinterInfo = 4294936410;
alias kPMInvalidConnection = 4294936409;
alias kPMInvalidKey = 4294936408;
alias kPMInvalidValue = 4294936407;
alias kPMInvalidAllocator = 4294936406;
alias kPMInvalidTicket = 4294936405;
alias kPMInvalidItem = 4294936404;
alias kPMInvalidType = 4294936403;
alias kPMInvalidReply = 4294936402;
alias kPMInvalidFileType = 4294936401;
alias kPMInvalidObject = 4294936400;
alias kPMInvalidPaper = 4294936399;
alias kPMInvalidCalibrationTarget = 4294936398;
alias kPMNoDefaultItem = 4294957796;
alias kPMNoDefaultSettings = 4294957795;
alias kPMInvalidPDEContext = 4294957766;
alias kPMDontSwitchPDEError = 4294957765;
alias kPMUnableToFindProcess = 4294957764;
alias kPMFeatureNotInstalled = 4294957763;
alias kPMInvalidPBMRef = 4294957756;
alias kPMNoSelectedPrinters = 4294957755;
alias kPMInvalidLookupSpec = 4294957754;
alias kPMSyncRequestFailed = 4294957753;
alias kPMEditRequestFailed = 4294957752;
alias kPMPrBrowserNoUI = 4294957751;
alias kPMTicketTypeNotFound = 4294957716;
alias kPMUpdateTicketFailed = 4294957715;
alias kPMValidateTicketFailed = 4294957714;
alias kPMSubTicketNotFound = 4294957713;
alias kPMInvalidSubTicket = 4294957712;
alias kPMDeleteSubTicketFailed = 4294957711;
alias kPMItemIsLocked = 4294957710;
alias kPMTicketIsLocked = 4294957709;
alias kPMTemplateIsLocked = 4294957708;
alias kPMKeyNotFound = 4294957707;
alias kPMKeyNotUnique = 4294957706;
alias kPMUnknownDataType = 4294957705;
alias kPMCreateMessageFailed = 4294957676;
alias kPMServerCommunicationFailed = 4294957675;
alias kPMKeyOrValueNotFound = 4294957673;
alias kPMMessagingError = 4294957672;
alias kPMServerNotFound = 4294957666;
alias kPMServerAlreadyRunning = 4294957665;
alias kPMServerSuspended = 4294957664;
alias kPMServerAttributeRestricted = 4294957663;
alias kPMFileOrDirOperationFailed = 4294957662;
alias kPMUserOrGroupNotFound = 4294957661;
alias kPMPermissionError = 4294957660;
alias kPMUnknownMessage = 4294957659;
alias kPMQueueNotFound = 4294957658;
alias kPMQueueAlreadyExists = 4294957657;
alias kPMQueueJobFailed = 4294957656;
alias kPMJobNotFound = 4294957655;
alias kPMJobBusy = 4294957654;
alias kPMJobCanceled = 4294957653;
alias kPMDocumentNotFound = 4294957652;
alias kPMPMSymbolNotFound = 4294957636;
alias kPMIOMSymbolNotFound = 4294957635;
alias kPMCVMSymbolNotFound = 4294957634;
alias kPMInvalidPMContext = 4294957633;
alias kPMInvalidIOMContext = 4294957632;
alias kPMInvalidCVMContext = 4294957631;
alias kPMInvalidJobID = 4294957630;
alias kPMNoPrinterJobID = 4294957629;
alias kPMJobStreamOpenFailed = 4294957628;
alias kPMJobStreamReadFailed = 4294957627;
alias kPMJobStreamEndError = 4294957626;
alias kPMJobManagerAborted = 4294957625;
alias kPMJobGetTicketBadFormatError = 4294957624;
alias kPMJobGetTicketReadError = 4294957623;
alias kPMPluginNotFound = 4294957595;
alias kPMPluginRegisterationFailed = 4294957594;
alias kPMFontNotFound = 4294957593;
alias kPMFontNameTooLong = 4294957592;
alias kPMGeneralCGError = 4294957591;
alias kPMInvalidState = 4294957590;
alias kPMUnexpectedImagingError = 4294957589;
alias kPMInvalidPrinterAddress = 4294957516;
alias kPMOpenFailed = 4294957515;
alias kPMReadFailed = 4294957514;
alias kPMWriteFailed = 4294957513;
alias kPMStatusFailed = 4294957512;
alias kPMCloseFailed = 4294957511;
alias kPMUnsupportedConnection = 4294957510;
alias kPMIOAttrNotAvailable = 4294957509;
alias kPMReadGotZeroData = 4294957508;
alias kPMLastErrorCodeToMakeMaintenanceOfThisListEasier = 4294957497;

alias kDictionaryFileType = 1684628340;
alias kDCMDictionaryHeaderSignature = 1684628340;
alias kDCMDictionaryHeaderVersion = 2;

alias kDCMAnyFieldTag = 707406378;
alias kDCMAnyFieldType = 707406378;

alias keyDCMFieldTag = 1718903143;
alias keyDCMFieldType = 1718909296;
alias keyDCMMaxRecordSize = 1836217210;
alias keyDCMFieldAttributes = 1717662834;
alias keyDCMFieldDefaultData = 1717855590;
alias keyDCMFieldName = 1718509933;
alias keyDCMFieldFindMethods = 1717988964;

alias typeDCMFieldAttributes = 1717662834;
alias typeDCMFindMethod = 1718449256;

alias kDCMIndexedFieldMask = 1;
alias kDCMRequiredFieldMask = 2;
alias kDCMIdentifyFieldMask = 4;
alias kDCMFixedSizeFieldMask = 8;
alias kDCMHiddenFieldMask = 2147483648;

alias DCMFieldAttributes = UInt;

alias pDCMAccessMethod = 1634563172;
alias pDCMPermission = 1885696621;
alias pDCMListing = 1818850164;
alias pDCMMaintenance = 1836346979;
alias pDCMLocale = 1819239276;
alias pDCMClass = 1885564019;
alias pDCMCopyright = 1768842863;

alias kDCMReadOnlyDictionary = 0;
alias kDCMReadWriteDictionary = 1;

alias kDCMAllowListing = 0;
alias kDCMProhibitListing = 1;

alias kDCMUserDictionaryClass = 0;
alias kDCMSpecificDictionaryClass = 1;
alias kDCMBasicDictionaryClass = 2;

alias kDCMFindMethodExactMatch = 1025515552;
alias kDCMFindMethodBeginningMatch = 1650947956;
alias kDCMFindMethodContainsMatch = 1668247156;
alias kDCMFindMethodEndingMatch = 1701733491;
alias kDCMFindMethodForwardTrie = 1718907497;
alias kDCMFindMethodBackwardTrie = 1651798633;

alias DCMFindMethod = UInt;

alias kDCMCanUseFileDictionaryMask = 1;
alias kDCMCanUseMemoryDictionaryMask = 2;
alias kDCMCanStreamDictionaryMask = 4;
alias kDCMCanHaveMultipleIndexMask = 8;
alias kDCMCanModifyDictionaryMask = 16;
alias kDCMCanCreateDictionaryMask = 32;
alias kDCMCanAddDictionaryFieldMask = 64;
alias kDCMCanUseTransactionMask = 128;

alias DCMAccessMethodFeature = UInt;

alias DCMUniqueID = UInt;

alias DCMObjectID = OpaquePointer;

alias DCMAccessMethodID = DCMObjectID;

alias DCMDictionaryID = DCMObjectID;

alias DCMObjectRef = OpaquePointer;

alias DCMDictionaryRef = DCMObjectRef;

alias DCMDictionaryStreamRef = DCMObjectRef;

alias DCMObjectIterator = OpaquePointer;

alias DCMAccessMethodIterator = DCMObjectIterator;

alias DCMDictionaryIterator = DCMObjectIterator;

alias DCMFoundRecordIterator = OpaquePointer;

alias DCMFieldTag = UInt;

alias DCMFieldType = UInt;

record Struct_DCMDictionaryHeader (
    headerSignature : UInt,
    headerVersion : UInt,
    headerSize : UInt,
    accessMethod : Str63,
);

alias DCMDictionaryHeader = Struct_DCMDictionaryHeader;

alias DCMProgressFilterProcPtr = CCodePointer[[CUChar,UShort,UInt],[CUChar]];

alias DCMProgressFilterUPP = DCMProgressFilterProcPtr;

alias kMaxYomiLengthInAppleJapaneseDictionary = 40;
alias kMaxKanjiLengthInAppleJapaneseDictionary = 64;

alias kDCMJapaneseYomiTag = 2037345641;
alias kDCMJapaneseHyokiTag = 1752788843;
alias kDCMJapaneseHinshiTag = 1751740019;
alias kDCMJapaneseWeightTag = 1751740004;
alias kDCMJapanesePhoneticTag = 1752461166;
alias kDCMJapaneseAccentTag = 1633906292;
alias kDCMJapaneseOnKunReadingTag = 1332628334;
alias kDCMJapaneseFukugouInfoTag = 1718971253;

alias kDCMJapaneseYomiType = 1970567284;
alias kDCMJapaneseHyokiType = 1970567284;
alias kDCMJapaneseHinshiType = 1751740019;
alias kDCMJapaneseWeightType = 1936224114;
alias kDCMJapanesePhoneticType = 1970567284;
alias kDCMJapaneseAccentType = 1652126821;
alias kDCMJapaneseOnKunReadingType = 1970567284;
alias kDCMJapaneseFukugouInfoType = 1718971253;

alias LAEnvironmentRef = OpaquePointer;

alias LAContextRef = OpaquePointer;

alias LAPropertyKey = UInt;

alias LAPropertyType = UInt;

record Struct_LAMorphemeRec (
    sourceTextLength : UInt,
    sourceTextPtr : LogicalAddress,
    morphemeTextLength : UInt,
    morphemeTextPtr : LogicalAddress,
    partOfSpeech : UInt,
);

alias LAMorphemeRec = Struct_LAMorphemeRec;

record Struct_LAMorphemesArray (
    morphemesCount : CULong,
    processedTextLength : UInt,
    morphemesTextLength : UInt,
    morphemes : Array[LAMorphemeRec,1],
);

alias LAMorphemesArray = Struct_LAMorphemesArray;

alias LAMorphemesArrayPtr = Pointer[LAMorphemesArray];

alias kLAMorphemesArrayVersion = 0;

alias LAMorphemeBundle = AERecord;

alias LAMorphemePath = AERecord;

alias LAMorpheme = AERecord;

alias LAHomograph = AERecord;

alias keyAELAMorphemeBundle = 1819108962;
alias keyAELAMorphemePath = 1819108976;
alias keyAELAMorpheme = 1819108974;
alias keyAELAHomograph = 1819108968;

alias typeLAMorphemeBundle = 1919247215;
alias typeLAMorphemePath = 1919247215;
alias typeLAMorpheme = 1818850164;
alias typeLAHomograph = 1818850164;

alias keyAEMorphemePartOfSpeechCode = 1818324323;
alias keyAEMorphemeTextRange = 1818324340;

alias typeAEMorphemePartOfSpeechCode = 1818324323;
alias typeAEMorphemeTextRange = 1818324340;

alias MorphemePartOfSpeech = UInt;

record Struct_MorphemeTextRange (
    sourceOffset : UInt,
    length : UInt,
);

alias MorphemeTextRange = Struct_MorphemeTextRange;

alias kLAEndOfSourceTextMask = 1;

alias kLADefaultEdge = 0;
alias kLAFreeEdge = 1;
alias kLAIncompleteEdge = 2;

alias kLAAllMorphemes = 0;

alias kAppleJapaneseDictionarySignature = 1785487726;

alias kMaxInputLengthOfAppleJapaneseEngine = 200;

alias JapanesePartOfSpeech = UInt;

alias HomographWeight = UShort;

alias HomographAccent = CUChar;

alias keyAEHomographDicInfo = 1818323044;
alias keyAEHomographWeight = 1818323063;
alias keyAEHomographAccent = 1818323041;

alias typeAEHomographDicInfo = 1818323044;
alias typeAEHomographWeight = 1936224114;
alias typeAEHomographAccent = 1818323041;

record Struct_HomographDicInfoRec (
    dictionaryID : DCMDictionaryID,
    uniqueID : UInt,
);

alias HomographDicInfoRec = Struct_HomographDicInfoRec;

alias kLASpeechRoughClassMask = 61440;
alias kLASpeechMediumClassMask = 65280;
alias kLASpeechStrictClassMask = 65520;
alias kLASpeechKatsuyouMask = 15;

alias kLASpeechMeishi = 0;
alias kLASpeechFutsuuMeishi = 0;
alias kLASpeechJinmei = 256;
alias kLASpeechJinmeiSei = 272;
alias kLASpeechJinmeiMei = 288;
alias kLASpeechChimei = 512;
alias kLASpeechSetsubiChimei = 528;
alias kLASpeechSoshikimei = 768;
alias kLASpeechKoyuuMeishi = 1024;
alias kLASpeechSahenMeishi = 1280;
alias kLASpeechKeidouMeishi = 1536;
alias kLASpeechRentaishi = 4096;
alias kLASpeechFukushi = 8192;
alias kLASpeechSetsuzokushi = 12288;
alias kLASpeechKandoushi = 16384;
alias kLASpeechDoushi = 20480;
alias kLASpeechGodanDoushi = 20480;
alias kLASpeechKagyouGodan = 20480;
alias kLASpeechSagyouGodan = 20496;
alias kLASpeechTagyouGodan = 20512;
alias kLASpeechNagyouGodan = 20528;
alias kLASpeechMagyouGodan = 20544;
alias kLASpeechRagyouGodan = 20560;
alias kLASpeechWagyouGodan = 20576;
alias kLASpeechGagyouGodan = 20592;
alias kLASpeechBagyouGodan = 20608;
alias kLASpeechIchidanDoushi = 20736;
alias kLASpeechKahenDoushi = 20992;
alias kLASpeechSahenDoushi = 21248;
alias kLASpeechZahenDoushi = 21504;
alias kLASpeechKeiyoushi = 24576;
alias kLASpeechKeiyoudoushi = 28672;
alias kLASpeechSettougo = 32768;
alias kLASpeechSuujiSettougo = 33024;
alias kLASpeechSetsubigo = 36864;
alias kLASpeechJinmeiSetsubigo = 37120;
alias kLASpeechChimeiSetsubigo = 37376;
alias kLASpeechSoshikimeiSetsubigo = 37632;
alias kLASpeechSuujiSetsubigo = 37888;
alias kLASpeechMuhinshi = 40960;
alias kLASpeechTankanji = 40960;
alias kLASpeechKigou = 41216;
alias kLASpeechKuten = 41232;
alias kLASpeechTouten = 41248;
alias kLASpeechSuushi = 41472;
alias kLASpeechDokuritsugo = 41728;
alias kLASpeechSeiku = 41984;
alias kLASpeechJodoushi = 45056;
alias kLASpeechJoshi = 49152;

alias kLASpeechKatsuyouGokan = 1;
alias kLASpeechKatsuyouMizen = 2;
alias kLASpeechKatsuyouRenyou = 3;
alias kLASpeechKatsuyouSyuushi = 4;
alias kLASpeechKatsuyouRentai = 5;
alias kLASpeechKatsuyouKatei = 6;
alias kLASpeechKatsuyouMeirei = 7;

alias kTextToSpeechSynthType = 1953788771;
alias kTextToSpeechVoiceType = 1953789540;
alias kTextToSpeechVoiceFileType = 1953789542;
alias kTextToSpeechVoiceBundleType = 1953789538;

alias kNoEndingProsody = 1;
alias kNoSpeechInterrupt = 2;
alias kPreflightThenPause = 4;

alias kImmediate = 0;
alias kEndOfWord = 1;
alias kEndOfSentence = 2;

alias soStatus = 1937006964;
alias soErrors = 1701999215;
alias soInputMode = 1768845428;
alias soCharacterMode = 1667785074;
alias soNumberMode = 1852662386;
alias soRate = 1918989413;
alias soPitchBase = 1885495667;
alias soPitchMod = 1886220132;
alias soVolume = 1987013741;
alias soSynthType = 1986359923;
alias soRecentSync = 1937337955;
alias soPhonemeSymbols = 1885893497;
alias soCurrentVoice = 1668706168;
alias soCommandDelimiter = 1684826477;
alias soReset = 1920165236;
alias soCurrentA5 = 1836663093;
alias soRefCon = 1919247971;
alias soTextDoneCallBack = 1952736098;
alias soSpeechDoneCallBack = 1935958882;
alias soSyncCallBack = 1937335138;
alias soErrorCallBack = 1701995362;
alias soPhonemeCallBack = 1885889378;
alias soWordCallBack = 2003067746;
alias soSynthExtension = 2020896356;
alias soSoundOutput = 1936614511;
alias soOutputToFileWithCFURL = 1869635942;
alias soOutputToExtAudioFile = 1869635960;
alias soOutputToAudioDevice = 1869635940;
alias soPhonemeOptions = 1886351476;

alias kSpeechImmediateBoundary = 0;
alias kSpeechWordBoundary = 1;
alias kSpeechSentenceBoundary = 2;

alias SpeechBoundary = UInt;

alias modeText = 1413830740;
alias modePhonemes = 1346916174;
alias modeNormal = 1313821261;
alias modeLiteral = 1280594508;

alias soVoiceDescription = 1768842863;
alias soVoiceFile = 1718773094;

alias kSpeechGenerateTune = 1;
alias kSpeechRelativePitch = 2;
alias kSpeechRelativeDuration = 4;
alias kSpeechShowSyllables = 8;

alias kAudioUnitSubType_SpeechSynthesis = 1953788784;
alias kAudioUnitProperty_Voice = 3330;
alias kAudioUnitProperty_SpeechChannel = 3331;

record Struct_SpeechChannelRecord (
    data : Array[CLong,1],
);

alias SpeechChannelRecord = Struct_SpeechChannelRecord;

alias SpeechChannel = Pointer[SpeechChannelRecord];

record Struct_VoiceSpec (
    creator : UInt,
    id : UInt,
);

alias VoiceSpec = Struct_VoiceSpec;

alias VoiceSpecPtr = Pointer[VoiceSpec];

alias kNeuter = 0;
alias kMale = 1;
alias kFemale = 2;

record Struct_VoiceDescription (
    length : Int,
    voice : VoiceSpec,
    version : Int,
    name : Str63,
    comment : Str255,
    gender : Short,
    age : Short,
    script : Short,
    language : Short,
    region : Short,
    reserved : Array[Int,4],
);

alias VoiceDescription = Struct_VoiceDescription;

record Struct_VoiceFileInfo (
    fileSpec : FSSpec,
    resID : Short,
);

alias VoiceFileInfo = Struct_VoiceFileInfo;

record Struct_SpeechStatusInfo (
    outputBusy : CUChar,
    outputPaused : CUChar,
    inputBytesLeft : CLong,
    phonemeCode : Short,
);

alias SpeechStatusInfo = Struct_SpeechStatusInfo;

record Struct_SpeechErrorInfo (
    count : Short,
    oldest : Short,
    oldPos : CLong,
    newest : Short,
    newPos : CLong,
);

alias SpeechErrorInfo = Struct_SpeechErrorInfo;

record Struct_SpeechVersionInfo (
    synthType : UInt,
    synthSubType : UInt,
    synthManufacturer : UInt,
    synthFlags : Int,
    synthVersion : NumVersion,
);

alias SpeechVersionInfo = Struct_SpeechVersionInfo;

record Struct_PhonemeInfo (
    opcode : Short,
    phStr : Str15,
    exampleStr : Str31,
    hiliteStart : Short,
    hiliteEnd : Short,
);

alias PhonemeInfo = Struct_PhonemeInfo;

record Struct_PhonemeDescriptor (
    phonemeCount : Short,
    thePhonemes : Array[PhonemeInfo,1],
);

alias PhonemeDescriptor = Struct_PhonemeDescriptor;

record Struct_SpeechXtndData (
    synthCreator : UInt,
    synthData : Array[CUChar,2],
);

alias SpeechXtndData = Struct_SpeechXtndData;

record Struct_DelimiterInfo (
    startDelimiter : Array[CUChar,2],
    endDelimiter : Array[CUChar,2],
);

alias DelimiterInfo = Struct_DelimiterInfo;

external kSpeechStatusProperty : CFStringRef;

external kSpeechErrorsProperty : CFStringRef;

external kSpeechInputModeProperty : CFStringRef;

external kSpeechCharacterModeProperty : CFStringRef;

external kSpeechNumberModeProperty : CFStringRef;

external kSpeechRateProperty : CFStringRef;

external kSpeechPitchBaseProperty : CFStringRef;

external kSpeechPitchModProperty : CFStringRef;

external kSpeechVolumeProperty : CFStringRef;

external kSpeechSynthesizerInfoProperty : CFStringRef;

external kSpeechRecentSyncProperty : CFStringRef;

external kSpeechPhonemeSymbolsProperty : CFStringRef;

external kSpeechCurrentVoiceProperty : CFStringRef;

external kSpeechCommandDelimiterProperty : CFStringRef;

external kSpeechResetProperty : CFStringRef;

external kSpeechOutputToFileURLProperty : CFStringRef;

external kSpeechOutputToExtAudioFileProperty : CFStringRef;

external kSpeechOutputToAudioDeviceProperty : CFStringRef;

external kSpeechRefConProperty : CFStringRef;

external kSpeechTextDoneCallBack : CFStringRef;

external kSpeechSpeechDoneCallBack : CFStringRef;

external kSpeechSyncCallBack : CFStringRef;

external kSpeechPhonemeCallBack : CFStringRef;

external kSpeechErrorCFCallBack : CFStringRef;

external kSpeechWordCFCallBack : CFStringRef;

external kSpeechPhonemeOptionsProperty : CFStringRef;

external kSpeechModeText : CFStringRef;

external kSpeechModePhoneme : CFStringRef;

external kSpeechModeNormal : CFStringRef;

external kSpeechModeLiteral : CFStringRef;

external kSpeechNoEndingProsody : CFStringRef;

external kSpeechNoSpeechInterrupt : CFStringRef;

external kSpeechPreflightThenPause : CFStringRef;

external kSpeechStatusOutputBusy : CFStringRef;

external kSpeechStatusOutputPaused : CFStringRef;

external kSpeechStatusNumberOfCharactersLeft : CFStringRef;

external kSpeechStatusPhonemeCode : CFStringRef;

external kSpeechErrorCount : CFStringRef;

external kSpeechErrorOldest : CFStringRef;

external kSpeechErrorOldestCharacterOffset : CFStringRef;

external kSpeechErrorNewest : CFStringRef;

external kSpeechErrorNewestCharacterOffset : CFStringRef;

external kSpeechSynthesizerInfoIdentifier : CFStringRef;

external kSpeechSynthesizerInfoManufacturer : CFStringRef;

external kSpeechSynthesizerInfoVersion : CFStringRef;

external kSpeechPhonemeInfoOpcode : CFStringRef;

external kSpeechPhonemeInfoSymbol : CFStringRef;

external kSpeechPhonemeInfoExample : CFStringRef;

external kSpeechPhonemeInfoHiliteStart : CFStringRef;

external kSpeechPhonemeInfoHiliteEnd : CFStringRef;

external kSpeechVoiceCreator : CFStringRef;

external kSpeechVoiceID : CFStringRef;

external kSpeechCommandPrefix : CFStringRef;

external kSpeechCommandSuffix : CFStringRef;

external kSpeechDictionaryLocaleIdentifier : CFStringRef;

external kSpeechDictionaryModificationDate : CFStringRef;

external kSpeechDictionaryPronunciations : CFStringRef;

external kSpeechDictionaryAbbreviations : CFStringRef;

external kSpeechDictionaryEntrySpelling : CFStringRef;

external kSpeechDictionaryEntryPhonemes : CFStringRef;

external kSpeechErrorCallbackSpokenString : CFStringRef;

external kSpeechErrorCallbackCharacterOffset : CFStringRef;

alias SpeechTextDoneProcPtr = CCodePointer[[Pointer[Struct_SpeechChannelRecord],RawPointer,Pointer[RawPointer],Pointer[CULong],Pointer[Int]],[]];

alias SpeechDoneProcPtr = CCodePointer[[Pointer[Struct_SpeechChannelRecord],RawPointer],[]];

alias SpeechSyncProcPtr = CCodePointer[[Pointer[Struct_SpeechChannelRecord],RawPointer,UInt],[]];

alias SpeechErrorProcPtr = CCodePointer[[Pointer[Struct_SpeechChannelRecord],RawPointer,Short,CLong],[]];

alias SpeechPhonemeProcPtr = CCodePointer[[Pointer[Struct_SpeechChannelRecord],RawPointer,Short],[]];

alias SpeechWordProcPtr = CCodePointer[[Pointer[Struct_SpeechChannelRecord],RawPointer,CULong,UShort],[]];

alias SpeechTextDoneUPP = SpeechTextDoneProcPtr;

alias SpeechDoneUPP = SpeechDoneProcPtr;

alias SpeechSyncUPP = SpeechSyncProcPtr;

alias SpeechErrorUPP = SpeechErrorProcPtr;

alias SpeechPhonemeUPP = SpeechPhonemeProcPtr;

alias SpeechWordUPP = SpeechWordProcPtr;

external NewSpeechTextDoneUPP(
    userRoutine : SpeechTextDoneProcPtr) : SpeechTextDoneUPP;

external NewSpeechDoneUPP(
    userRoutine : SpeechDoneProcPtr) : SpeechDoneUPP;

external NewSpeechSyncUPP(
    userRoutine : SpeechSyncProcPtr) : SpeechSyncUPP;

external NewSpeechErrorUPP(
    userRoutine : SpeechErrorProcPtr) : SpeechErrorUPP;

external NewSpeechPhonemeUPP(
    userRoutine : SpeechPhonemeProcPtr) : SpeechPhonemeUPP;

external NewSpeechWordUPP(
    userRoutine : SpeechWordProcPtr) : SpeechWordUPP;

external DisposeSpeechTextDoneUPP(
    userUPP : SpeechTextDoneUPP);

external DisposeSpeechDoneUPP(
    userUPP : SpeechDoneUPP);

external DisposeSpeechSyncUPP(
    userUPP : SpeechSyncUPP);

external DisposeSpeechErrorUPP(
    userUPP : SpeechErrorUPP);

external DisposeSpeechPhonemeUPP(
    userUPP : SpeechPhonemeUPP);

external DisposeSpeechWordUPP(
    userUPP : SpeechWordUPP);

external InvokeSpeechTextDoneUPP(
    chan : SpeechChannel,
    refCon : SRefCon,
    nextBuf : Pointer[RawPointer],
    byteLen : Pointer[CULong],
    controlFlags : Pointer[Int],
    userUPP : SpeechTextDoneUPP);

external InvokeSpeechDoneUPP(
    chan : SpeechChannel,
    refCon : SRefCon,
    userUPP : SpeechDoneUPP);

external InvokeSpeechSyncUPP(
    chan : SpeechChannel,
    refCon : SRefCon,
    syncMessage : UInt,
    userUPP : SpeechSyncUPP);

external InvokeSpeechErrorUPP(
    chan : SpeechChannel,
    refCon : SRefCon,
    theError : Short,
    bytePos : CLong,
    userUPP : SpeechErrorUPP);

external InvokeSpeechPhonemeUPP(
    chan : SpeechChannel,
    refCon : SRefCon,
    phonemeOpcode : Short,
    userUPP : SpeechPhonemeUPP);

external InvokeSpeechWordUPP(
    chan : SpeechChannel,
    refCon : SRefCon,
    wordPos : CULong,
    wordLen : UShort,
    userUPP : SpeechWordUPP);

alias SpeechErrorCFProcPtr = CCodePointer[[Pointer[Struct_SpeechChannelRecord],RawPointer,OpaquePointer],[]];

alias SpeechWordCFProcPtr = CCodePointer[[Pointer[Struct_SpeechChannelRecord],RawPointer,OpaquePointer,UnnamedStruct9],[]];

external SpeechManagerVersion() : NumVersion;

external MakeVoiceSpec(
    creator : UInt,
    id : UInt,
    voice : Pointer[VoiceSpec]) : Short;

external CountVoices(
    numVoices : Pointer[Short]) : Short;

external GetIndVoice(
    index : Short,
    voice : Pointer[VoiceSpec]) : Short;

external GetVoiceDescription(
    voice : Pointer[VoiceSpec],
    info : Pointer[VoiceDescription],
    infoLength : CLong) : Short;

external GetVoiceInfo(
    voice : Pointer[VoiceSpec],
    selector : UInt,
    voiceInfo : RawPointer) : Short;

external NewSpeechChannel(
    voice : Pointer[VoiceSpec],
    chan : Pointer[SpeechChannel]) : Short;

external DisposeSpeechChannel(
    chan : SpeechChannel) : Short;

external SpeakString(
    textToBeSpoken : ConstStr255Param) : Short;

external SpeakText(
    chan : SpeechChannel,
    textBuf : RawPointer,
    textBytes : CULong) : Short;

external SpeakBuffer(
    chan : SpeechChannel,
    textBuf : RawPointer,
    textBytes : CULong,
    controlFlags : Int) : Short;

external StopSpeech(
    chan : SpeechChannel) : Short;

external StopSpeechAt(
    chan : SpeechChannel,
    whereToStop : Int) : Short;

external PauseSpeechAt(
    chan : SpeechChannel,
    whereToPause : Int) : Short;

external ContinueSpeech(
    chan : SpeechChannel) : Short;

external SpeechBusy() : Short;

external SpeechBusySystemWide() : Short;

external SetSpeechRate(
    chan : SpeechChannel,
    rate : Int) : Short;

external GetSpeechRate(
    chan : SpeechChannel,
    rate : Pointer[Int]) : Short;

external SetSpeechPitch(
    chan : SpeechChannel,
    pitch : Int) : Short;

external GetSpeechPitch(
    chan : SpeechChannel,
    pitch : Pointer[Int]) : Short;

external SetSpeechInfo(
    chan : SpeechChannel,
    selector : UInt,
    speechInfo : RawPointer) : Short;

external GetSpeechInfo(
    chan : SpeechChannel,
    selector : UInt,
    speechInfo : RawPointer) : Short;

external TextToPhonemes(
    chan : SpeechChannel,
    textBuf : RawPointer,
    textBytes : CULong,
    phonemeBuf : Handle,
    phonemeBytes : Pointer[CLong]) : Short;

external UseDictionary(
    chan : SpeechChannel,
    dictionary : Handle) : Short;

external SpeakCFString(
    chan : SpeechChannel,
    aString : CFStringRef,
    options : CFDictionaryRef) : Short;

external UseSpeechDictionary(
    chan : SpeechChannel,
    speechDictionary : CFDictionaryRef) : Short;

external CopyPhonemesFromText(
    chan : SpeechChannel,
    text : CFStringRef,
    phonemes : Pointer[CFStringRef]) : Short;

external CopySpeechProperty(
    chan : SpeechChannel,
    property : CFStringRef,
    object : Pointer[CFTypeRef]) : Short;

external SetSpeechProperty(
    chan : SpeechChannel,
    property : CFStringRef,
    object : CFTypeRef) : Short;

external SpeechSynthesisRegisterModuleURL(
    url : CFURLRef) : Short;

external SpeechSynthesisUnregisterModuleURL(
    url : CFURLRef) : Short;

external kCTFontSymbolicTrait : CFStringRef;

external kCTFontWeightTrait : CFStringRef;

external kCTFontWidthTrait : CFStringRef;

external kCTFontSlantTrait : CFStringRef;

alias kCTFontClassMaskShift = 28;

alias kCTFontItalicTrait = 1;
alias kCTFontBoldTrait = 2;
alias kCTFontExpandedTrait = 32;
alias kCTFontCondensedTrait = 64;
alias kCTFontMonoSpaceTrait = 1024;
alias kCTFontVerticalTrait = 2048;
alias kCTFontUIOptimizedTrait = 4096;
alias kCTFontClassMaskTrait = 4026531840;

alias CTFontSymbolicTraits = UInt;

alias kCTFontUnknownClass = 0;
alias kCTFontOldStyleSerifsClass = 268435456;
alias kCTFontTransitionalSerifsClass = 536870912;
alias kCTFontModernSerifsClass = 805306368;
alias kCTFontClarendonSerifsClass = 1073741824;
alias kCTFontSlabSerifsClass = 1342177280;
alias kCTFontFreeformSerifsClass = 1879048192;
alias kCTFontSansSerifClass = 2147483648;
alias kCTFontOrnamentalsClass = 2415919104;
alias kCTFontScriptsClass = 2684354560;
alias kCTFontSymbolicClass = 3221225472;

alias CTFontStylisticClass = UInt;

alias CTFontDescriptorRef = OpaquePointer;

external CTFontDescriptorGetTypeID() : CULong;

external kCTFontURLAttribute : CFStringRef;

external kCTFontNameAttribute : CFStringRef;

external kCTFontDisplayNameAttribute : CFStringRef;

external kCTFontFamilyNameAttribute : CFStringRef;

external kCTFontStyleNameAttribute : CFStringRef;

external kCTFontTraitsAttribute : CFStringRef;

external kCTFontVariationAttribute : CFStringRef;

external kCTFontSizeAttribute : CFStringRef;

external kCTFontMatrixAttribute : CFStringRef;

external kCTFontCascadeListAttribute : CFStringRef;

external kCTFontCharacterSetAttribute : CFStringRef;

external kCTFontLanguagesAttribute : CFStringRef;

external kCTFontBaselineAdjustAttribute : CFStringRef;

external kCTFontMacintoshEncodingsAttribute : CFStringRef;

external kCTFontFeaturesAttribute : CFStringRef;

external kCTFontFeatureSettingsAttribute : CFStringRef;

external kCTFontFixedAdvanceAttribute : CFStringRef;

external kCTFontOrientationAttribute : CFStringRef;

alias kCTFontDefaultOrientation = 0;
alias kCTFontHorizontalOrientation = 1;
alias kCTFontVerticalOrientation = 2;

alias CTFontOrientation = UInt;

external kCTFontFormatAttribute : CFStringRef;

alias kCTFontFormatUnrecognized = 0;
alias kCTFontFormatOpenTypePostScript = 1;
alias kCTFontFormatOpenTypeTrueType = 2;
alias kCTFontFormatTrueType = 3;
alias kCTFontFormatPostScript = 4;
alias kCTFontFormatBitmap = 5;

alias CTFontFormat = UInt;

external kCTFontRegistrationScopeAttribute : CFStringRef;

external kCTFontPriorityAttribute : CFStringRef;

alias kCTFontPrioritySystem = 10000;
alias kCTFontPriorityNetwork = 20000;
alias kCTFontPriorityComputer = 30000;
alias kCTFontPriorityUser = 40000;
alias kCTFontPriorityDynamic = 50000;
alias kCTFontPriorityProcess = 60000;

alias CTFontPriority = UInt;

external kCTFontEnabledAttribute : CFStringRef;

external CTFontDescriptorCreateWithNameAndSize(
    name : CFStringRef,
    size : Double) : CTFontDescriptorRef;

external CTFontDescriptorCreateWithAttributes(
    attributes : CFDictionaryRef) : CTFontDescriptorRef;

external CTFontDescriptorCreateCopyWithAttributes(
    original : CTFontDescriptorRef,
    attributes : CFDictionaryRef) : CTFontDescriptorRef;

external CTFontDescriptorCreateCopyWithVariation(
    original : CTFontDescriptorRef,
    variationIdentifier : CFNumberRef,
    variationValue : Double) : CTFontDescriptorRef;

external CTFontDescriptorCreateCopyWithFeature(
    original : CTFontDescriptorRef,
    featureTypeIdentifier : CFNumberRef,
    featureSelectorIdentifier : CFNumberRef) : CTFontDescriptorRef;

external CTFontDescriptorCreateMatchingFontDescriptors(
    descriptor : CTFontDescriptorRef,
    mandatoryAttributes : CFSetRef) : CFArrayRef;

external CTFontDescriptorCreateMatchingFontDescriptor(
    descriptor : CTFontDescriptorRef,
    mandatoryAttributes : CFSetRef) : CTFontDescriptorRef;

external CTFontDescriptorCopyAttributes(
    descriptor : CTFontDescriptorRef) : CFDictionaryRef;

external CTFontDescriptorCopyAttribute(
    descriptor : CTFontDescriptorRef,
    attribute : CFStringRef) : CFTypeRef;

external CTFontDescriptorCopyLocalizedAttribute(
    descriptor : CTFontDescriptorRef,
    attribute : CFStringRef,
    language : Pointer[CFStringRef]) : CFTypeRef;

alias CTFontRef = OpaquePointer;

external CTFontGetTypeID() : CULong;

external kCTFontCopyrightNameKey : CFStringRef;

external kCTFontFamilyNameKey : CFStringRef;

external kCTFontSubFamilyNameKey : CFStringRef;

external kCTFontStyleNameKey : CFStringRef;

external kCTFontUniqueNameKey : CFStringRef;

external kCTFontFullNameKey : CFStringRef;

external kCTFontVersionNameKey : CFStringRef;

external kCTFontPostScriptNameKey : CFStringRef;

external kCTFontTrademarkNameKey : CFStringRef;

external kCTFontManufacturerNameKey : CFStringRef;

external kCTFontDesignerNameKey : CFStringRef;

external kCTFontDescriptionNameKey : CFStringRef;

external kCTFontVendorURLNameKey : CFStringRef;

external kCTFontDesignerURLNameKey : CFStringRef;

external kCTFontLicenseNameKey : CFStringRef;

external kCTFontLicenseURLNameKey : CFStringRef;

external kCTFontSampleTextNameKey : CFStringRef;

external kCTFontPostScriptCIDNameKey : CFStringRef;

external CTFontCreateWithName(
    name : CFStringRef,
    size : Double,
    matrix : Pointer[CGAffineTransform]) : CTFontRef;

external CTFontCreateWithFontDescriptor(
    descriptor : CTFontDescriptorRef,
    size : Double,
    matrix : Pointer[CGAffineTransform]) : CTFontRef;

alias kCTFontOptionsDefault = 0;
alias kCTFontOptionsPreventAutoActivation = 1;
alias kCTFontOptionsPreferSystemFont = 4;

alias CTFontOptions = CULong;

external CTFontCreateWithNameAndOptions(
    name : CFStringRef,
    size : Double,
    matrix : Pointer[CGAffineTransform],
    options : CULong) : CTFontRef;

external CTFontCreateWithFontDescriptorAndOptions(
    descriptor : CTFontDescriptorRef,
    size : Double,
    matrix : Pointer[CGAffineTransform],
    options : CULong) : CTFontRef;

alias kCTFontNoFontType = 4294967295;
alias kCTFontUserFontType = 0;
alias kCTFontUserFixedPitchFontType = 1;
alias kCTFontSystemFontType = 2;
alias kCTFontEmphasizedSystemFontType = 3;
alias kCTFontSmallSystemFontType = 4;
alias kCTFontSmallEmphasizedSystemFontType = 5;
alias kCTFontMiniSystemFontType = 6;
alias kCTFontMiniEmphasizedSystemFontType = 7;
alias kCTFontViewsFontType = 8;
alias kCTFontApplicationFontType = 9;
alias kCTFontLabelFontType = 10;
alias kCTFontMenuTitleFontType = 11;
alias kCTFontMenuItemFontType = 12;
alias kCTFontMenuItemMarkFontType = 13;
alias kCTFontMenuItemCmdKeyFontType = 14;
alias kCTFontWindowTitleFontType = 15;
alias kCTFontPushButtonFontType = 16;
alias kCTFontUtilityWindowTitleFontType = 17;
alias kCTFontAlertHeaderFontType = 18;
alias kCTFontSystemDetailFontType = 19;
alias kCTFontEmphasizedSystemDetailFontType = 20;
alias kCTFontToolbarFontType = 21;
alias kCTFontSmallToolbarFontType = 22;
alias kCTFontMessageFontType = 23;
alias kCTFontPaletteFontType = 24;
alias kCTFontToolTipFontType = 25;
alias kCTFontControlContentFontType = 26;

alias CTFontUIFontType = UInt;

external CTFontCreateUIFontForLanguage(
    uiType : UInt,
    size : Double,
    language : CFStringRef) : CTFontRef;

external CTFontCreateCopyWithAttributes(
    font : CTFontRef,
    size : Double,
    matrix : Pointer[CGAffineTransform],
    attributes : CTFontDescriptorRef) : CTFontRef;

external CTFontCreateCopyWithSymbolicTraits(
    font : CTFontRef,
    size : Double,
    matrix : Pointer[CGAffineTransform],
    symTraitValue : UInt,
    symTraitMask : UInt) : CTFontRef;

external CTFontCreateCopyWithFamily(
    font : CTFontRef,
    size : Double,
    matrix : Pointer[CGAffineTransform],
    family : CFStringRef) : CTFontRef;

external CTFontCreateForString(
    currentFont : CTFontRef,
    string : CFStringRef,
    range : CFRange) : CTFontRef;

external CTFontCopyFontDescriptor(
    font : CTFontRef) : CTFontDescriptorRef;

external CTFontCopyAttribute(
    font : CTFontRef,
    attribute : CFStringRef) : CFTypeRef;

external CTFontGetSize(
    font : CTFontRef) : Double;

external CTFontGetMatrix(
    font : CTFontRef) : CGAffineTransform;

external CTFontGetSymbolicTraits(
    font : CTFontRef) : UInt;

external CTFontCopyTraits(
    font : CTFontRef) : CFDictionaryRef;

external CTFontCopyPostScriptName(
    font : CTFontRef) : CFStringRef;

external CTFontCopyFamilyName(
    font : CTFontRef) : CFStringRef;

external CTFontCopyFullName(
    font : CTFontRef) : CFStringRef;

external CTFontCopyDisplayName(
    font : CTFontRef) : CFStringRef;

external CTFontCopyName(
    font : CTFontRef,
    nameKey : CFStringRef) : CFStringRef;

external CTFontCopyLocalizedName(
    font : CTFontRef,
    nameKey : CFStringRef,
    language : Pointer[CFStringRef]) : CFStringRef;

external CTFontCopyCharacterSet(
    font : CTFontRef) : CFCharacterSetRef;

external CTFontGetStringEncoding(
    font : CTFontRef) : UInt;

external CTFontCopySupportedLanguages(
    font : CTFontRef) : CFArrayRef;

external CTFontGetGlyphsForCharacters(
    font : CTFontRef,
    characters : Pointer[UShort],
    glyphs : Pointer[UShort],
    count : CLong) : Bool;

external CTFontGetAscent(
    font : CTFontRef) : Double;

external CTFontGetDescent(
    font : CTFontRef) : Double;

external CTFontGetLeading(
    font : CTFontRef) : Double;

external CTFontGetUnitsPerEm(
    font : CTFontRef) : UInt;

external CTFontGetGlyphCount(
    font : CTFontRef) : CLong;

external CTFontGetBoundingBox(
    font : CTFontRef) : CGRect;

external CTFontGetUnderlinePosition(
    font : CTFontRef) : Double;

external CTFontGetUnderlineThickness(
    font : CTFontRef) : Double;

external CTFontGetSlantAngle(
    font : CTFontRef) : Double;

external CTFontGetCapHeight(
    font : CTFontRef) : Double;

external CTFontGetXHeight(
    font : CTFontRef) : Double;

external CTFontGetGlyphWithName(
    font : CTFontRef,
    glyphName : CFStringRef) : UShort;

external CTFontGetBoundingRectsForGlyphs(
    font : CTFontRef,
    orientation : UInt,
    glyphs : Pointer[UShort],
    boundingRects : Pointer[CGRect],
    count : CLong) : CGRect;

external CTFontGetAdvancesForGlyphs(
    font : CTFontRef,
    orientation : UInt,
    glyphs : Pointer[UShort],
    advances : Pointer[CGSize],
    count : CLong) : Double;

external CTFontGetVerticalTranslationsForGlyphs(
    font : CTFontRef,
    glyphs : Pointer[UShort],
    translations : Pointer[CGSize],
    count : CLong);

external CTFontCreatePathForGlyph(
    font : CTFontRef,
    glyph : UShort,
    transform : Pointer[CGAffineTransform]) : CGPathRef;

external kCTFontVariationAxisIdentifierKey : CFStringRef;

external kCTFontVariationAxisMinimumValueKey : CFStringRef;

external kCTFontVariationAxisMaximumValueKey : CFStringRef;

external kCTFontVariationAxisDefaultValueKey : CFStringRef;

external kCTFontVariationAxisNameKey : CFStringRef;

external CTFontCopyVariationAxes(
    font : CTFontRef) : CFArrayRef;

external CTFontCopyVariation(
    font : CTFontRef) : CFDictionaryRef;

external kCTFontFeatureTypeIdentifierKey : CFStringRef;

external kCTFontFeatureTypeNameKey : CFStringRef;

external kCTFontFeatureTypeExclusiveKey : CFStringRef;

external kCTFontFeatureTypeSelectorsKey : CFStringRef;

external kCTFontFeatureSelectorIdentifierKey : CFStringRef;

external kCTFontFeatureSelectorNameKey : CFStringRef;

external kCTFontFeatureSelectorDefaultKey : CFStringRef;

external kCTFontFeatureSelectorSettingKey : CFStringRef;

external CTFontCopyFeatures(
    font : CTFontRef) : CFArrayRef;

external CTFontCopyFeatureSettings(
    font : CTFontRef) : CFArrayRef;

external CTFontCopyGraphicsFont(
    font : CTFontRef,
    attributes : Pointer[CTFontDescriptorRef]) : CGFontRef;

external CTFontCreateWithGraphicsFont(
    graphicsFont : CGFontRef,
    size : Double,
    matrix : Pointer[CGAffineTransform],
    attributes : CTFontDescriptorRef) : CTFontRef;

external CTFontGetPlatformFont(
    font : CTFontRef,
    attributes : Pointer[CTFontDescriptorRef]) : UInt;

external CTFontCreateWithPlatformFont(
    platformFont : UInt,
    size : Double,
    matrix : Pointer[CGAffineTransform],
    attributes : CTFontDescriptorRef) : CTFontRef;

external CTFontCreateWithQuickdrawInstance(
    name : ConstStr255Param,
    identifier : Short,
    style : CUChar,
    size : Double) : CTFontRef;

alias kCTFontTableBASE = 1111577413;
alias kCTFontTableCFF = 1128678944;
alias kCTFontTableDSIG = 1146308935;
alias kCTFontTableEBDT = 1161970772;
alias kCTFontTableEBLC = 1161972803;
alias kCTFontTableEBSC = 1161974595;
alias kCTFontTableGDEF = 1195656518;
alias kCTFontTableGPOS = 1196445523;
alias kCTFontTableGSUB = 1196643650;
alias kCTFontTableJSTF = 1246975046;
alias kCTFontTableLTSH = 1280594760;
alias kCTFontTableOS2 = 1330851634;
alias kCTFontTablePCLT = 1346587732;
alias kCTFontTableVDMX = 1447316824;
alias kCTFontTableVORG = 1448038983;
alias kCTFontTableZapf = 1516335206;
alias kCTFontTableAcnt = 1633906292;
alias kCTFontTableAvar = 1635148146;
alias kCTFontTableBdat = 1650745716;
alias kCTFontTableBhed = 1651008868;
alias kCTFontTableBloc = 1651273571;
alias kCTFontTableBsln = 1651731566;
alias kCTFontTableCmap = 1668112752;
alias kCTFontTableCvar = 1668702578;
alias kCTFontTableCvt = 1668707360;
alias kCTFontTableFdsc = 1717859171;
alias kCTFontTableFeat = 1717920116;
alias kCTFontTableFmtx = 1718449272;
alias kCTFontTableFpgm = 1718642541;
alias kCTFontTableFvar = 1719034226;
alias kCTFontTableGasp = 1734439792;
alias kCTFontTableGlyf = 1735162214;
alias kCTFontTableGvar = 1735811442;
alias kCTFontTableHdmx = 1751412088;
alias kCTFontTableHead = 1751474532;
alias kCTFontTableHhea = 1751672161;
alias kCTFontTableHmtx = 1752003704;
alias kCTFontTableHsty = 1752396921;
alias kCTFontTableJust = 1786082164;
alias kCTFontTableKern = 1801810542;
alias kCTFontTableLcar = 1818452338;
alias kCTFontTableLoca = 1819239265;
alias kCTFontTableMaxp = 1835104368;
alias kCTFontTableMort = 1836020340;
alias kCTFontTableMorx = 1836020344;
alias kCTFontTableName = 1851878757;
alias kCTFontTableOpbd = 1869636196;
alias kCTFontTablePost = 1886352244;
alias kCTFontTablePrep = 1886545264;
alias kCTFontTableProp = 1886547824;
alias kCTFontTableTrak = 1953653099;
alias kCTFontTableVhea = 1986553185;
alias kCTFontTableVmtx = 1986884728;

alias CTFontTableTag = UInt;

alias kCTFontTableOptionNoOptions = 0;
alias kCTFontTableOptionExcludeSynthetic = 1;

alias CTFontTableOptions = UInt;

external CTFontCopyAvailableTables(
    font : CTFontRef,
    options : UInt) : CFArrayRef;

external CTFontCopyTable(
    font : CTFontRef,
    table : UInt,
    options : UInt) : CFDataRef;

alias CTFontCollectionRef = OpaquePointer;

external CTFontCollectionGetTypeID() : CULong;

alias CTFontCollectionSortDescriptorsCallback = CCodePointer[[OpaquePointer,OpaquePointer,RawPointer],[CLong]];

external kCTFontCollectionRemoveDuplicatesOption : CFStringRef;

external CTFontCollectionCreateFromAvailableFonts(
    options : CFDictionaryRef) : CTFontCollectionRef;

external CTFontCollectionCreateWithFontDescriptors(
    descriptors : CFArrayRef,
    options : CFDictionaryRef) : CTFontCollectionRef;

external CTFontCollectionCreateCopyWithFontDescriptors(
    original : CTFontCollectionRef,
    descriptors : CFArrayRef,
    options : CFDictionaryRef) : CTFontCollectionRef;

external CTFontCollectionCreateMatchingFontDescriptors(
    collection : CTFontCollectionRef) : CFArrayRef;

external CTFontCollectionCreateMatchingFontDescriptorsSortedWithCallback(
    collection : CTFontCollectionRef,
    sortCallback : CTFontCollectionSortDescriptorsCallback,
    refCon : RawPointer) : CFArrayRef;

external kCTFontManagerErrorDomain : CFStringRef;

external kCTFontManagerErrorFontURLsKey : CFStringRef;

alias kCTFontManagerErrorFileNotFound = 101;
alias kCTFontManagerErrorInsufficientPermissions = 102;
alias kCTFontManagerErrorUnrecognizedFormat = 103;
alias kCTFontManagerErrorInvalidFontData = 104;
alias kCTFontManagerErrorAlreadyRegistered = 105;

alias kCTFontManagerErrorNotRegistered = 201;
alias kCTFontManagerErrorInUse = 202;
alias kCTFontManagerErrorSystemRequired = 202;

alias CTFontManagerError = CLong;

external CTFontManagerCopyAvailablePostScriptNames() : CFArrayRef;

external CTFontManagerCopyAvailableFontFamilyNames() : CFArrayRef;

external CTFontManagerCopyAvailableFontURLs() : CFArrayRef;

external CTFontManagerCompareFontFamilyNames(
    family1 : RawPointer,
    family2 : RawPointer,
    context : RawPointer) : CLong;

external CTFontManagerCreateFontDescriptorsFromURL(
    fileURL : CFURLRef) : CFArrayRef;

alias kCTFontManagerScopeNone = 0;
alias kCTFontManagerScopeProcess = 1;
alias kCTFontManagerScopeUser = 2;
alias kCTFontManagerScopeSession = 3;

alias CTFontManagerScope = UInt;

external CTFontManagerRegisterFontsForURL(
    fontURL : CFURLRef,
    scope : UInt,
    error : Pointer[CFErrorRef]) : Bool;

external CTFontManagerUnregisterFontsForURL(
    fontURL : CFURLRef,
    scope : UInt,
    error : Pointer[CFErrorRef]) : Bool;

external CTFontManagerRegisterFontsForURLs(
    fontURLs : CFArrayRef,
    scope : UInt,
    errors : Pointer[CFArrayRef]) : Bool;

external CTFontManagerUnregisterFontsForURLs(
    fontURLs : CFArrayRef,
    scope : UInt,
    errors : Pointer[CFArrayRef]) : Bool;

external CTFontManagerEnableFontDescriptors(
    descriptors : CFArrayRef,
    enable : Bool);

external CTFontManagerGetScopeForURL(
    fontURL : CFURLRef) : UInt;

external CTFontManagerIsSupportedFont(
    fontURL : CFURLRef) : Bool;

external CTFontManagerCreateFontRequestRunLoopSource(
    sourceOrder : CLong,
    createMatchesCallback : UnknownType) : CFRunLoopSourceRef;

external kCTFontManagerBundleIdentifier : CFStringRef;

alias kCTFontManagerAutoActivationDefault = 0;
alias kCTFontManagerAutoActivationDisabled = 1;
alias kCTFontManagerAutoActivationEnabled = 2;
alias kCTFontManagerAutoActivationPromptUser = 3;

alias CTFontManagerAutoActivationSetting = UInt;

external CTFontManagerSetAutoActivationSetting(
    bundleIdentifier : CFStringRef,
    setting : UInt);

external CTFontManagerGetAutoActivationSetting(
    bundleIdentifier : CFStringRef) : UInt;

external kCTFontManagerRegisteredFontsChangedNotification : CFStringRef;

alias CTFrameRef = OpaquePointer;

external CTFrameGetTypeID() : CULong;

alias kCTFrameProgressionTopToBottom = 0;
alias kCTFrameProgressionRightToLeft = 1;

alias CTFrameProgression = UInt;

external kCTFrameProgressionAttributeName : CFStringRef;

external CTFrameGetStringRange(
    frame : CTFrameRef) : CFRange;

external CTFrameGetVisibleStringRange(
    frame : CTFrameRef) : CFRange;

external CTFrameGetPath(
    frame : CTFrameRef) : CGPathRef;

external CTFrameGetFrameAttributes(
    frame : CTFrameRef) : CFDictionaryRef;

external CTFrameGetLines(
    frame : CTFrameRef) : CFArrayRef;

external CTFrameGetLineOrigins(
    frame : CTFrameRef,
    range : CFRange,
    origins : Pointer[CGPoint]);

external CTFrameDraw(
    frame : CTFrameRef,
    context : CGContextRef);

alias CTLineRef = OpaquePointer;

alias kCTLineTruncationStart = 0;
alias kCTLineTruncationEnd = 1;
alias kCTLineTruncationMiddle = 2;

alias CTLineTruncationType = UInt;

external CTLineGetTypeID() : CULong;

external CTLineCreateWithAttributedString(
    string : CFAttributedStringRef) : CTLineRef;

external CTLineCreateTruncatedLine(
    line : CTLineRef,
    width : Double,
    truncationType : UInt,
    truncationToken : CTLineRef) : CTLineRef;

external CTLineCreateJustifiedLine(
    line : CTLineRef,
    justificationFactor : Double,
    justificationWidth : Double) : CTLineRef;

external CTLineGetGlyphCount(
    line : CTLineRef) : CLong;

external CTLineGetGlyphRuns(
    line : CTLineRef) : CFArrayRef;

external CTLineGetStringRange(
    line : CTLineRef) : CFRange;

external CTLineGetPenOffsetForFlush(
    line : CTLineRef,
    flushFactor : Double,
    flushWidth : Double) : Double;

external CTLineDraw(
    line : CTLineRef,
    context : CGContextRef);

external CTLineGetImageBounds(
    line : CTLineRef,
    context : CGContextRef) : CGRect;

external CTLineGetTypographicBounds(
    line : CTLineRef,
    ascent : Pointer[Double],
    descent : Pointer[Double],
    leading : Pointer[Double]) : Double;

external CTLineGetTrailingWhitespaceWidth(
    line : CTLineRef) : Double;

external CTLineGetStringIndexForPosition(
    line : CTLineRef,
    position : CGPoint) : CLong;

external CTLineGetOffsetForStringIndex(
    line : CTLineRef,
    charIndex : CLong,
    secondaryOffset : Pointer[Double]) : Double;

alias CTTypesetterRef = OpaquePointer;

external CTTypesetterGetTypeID() : CULong;

external kCTTypesetterOptionDisableBidiProcessing : CFStringRef;

external kCTTypesetterOptionForcedEmbeddingLevel : CFStringRef;

external CTTypesetterCreateWithAttributedString(
    string : CFAttributedStringRef) : CTTypesetterRef;

external CTTypesetterCreateWithAttributedStringAndOptions(
    string : CFAttributedStringRef,
    options : CFDictionaryRef) : CTTypesetterRef;

external CTTypesetterCreateLine(
    typesetter : CTTypesetterRef,
    stringRange : CFRange) : CTLineRef;

external CTTypesetterSuggestLineBreak(
    typesetter : CTTypesetterRef,
    startIndex : CLong,
    width : Double) : CLong;

external CTTypesetterSuggestClusterBreak(
    typesetter : CTTypesetterRef,
    startIndex : CLong,
    width : Double) : CLong;

alias CTFramesetterRef = OpaquePointer;

external CTFramesetterGetTypeID() : CULong;

external CTFramesetterCreateWithAttributedString(
    string : CFAttributedStringRef) : CTFramesetterRef;

external CTFramesetterCreateFrame(
    framesetter : CTFramesetterRef,
    stringRange : CFRange,
    path : CGPathRef,
    frameAttributes : CFDictionaryRef) : CTFrameRef;

external CTFramesetterGetTypesetter(
    framesetter : CTFramesetterRef) : CTTypesetterRef;

external CTFramesetterSuggestFrameSizeWithConstraints(
    framesetter : CTFramesetterRef,
    stringRange : CFRange,
    frameAttributes : CFDictionaryRef,
    constraints : CGSize,
    fitRange : Pointer[CFRange]) : CGSize;

alias CTGlyphInfoRef = OpaquePointer;

external CTGlyphInfoGetTypeID() : CULong;

alias kCTIdentityMappingCharacterCollection = 0;
alias kCTAdobeCNS1CharacterCollection = 1;
alias kCTAdobeGB1CharacterCollection = 2;
alias kCTAdobeJapan1CharacterCollection = 3;
alias kCTAdobeJapan2CharacterCollection = 4;
alias kCTAdobeKorea1CharacterCollection = 5;

alias CTCharacterCollection = UShort;

external CTGlyphInfoCreateWithGlyphName(
    glyphName : CFStringRef,
    font : CTFontRef,
    baseString : CFStringRef) : CTGlyphInfoRef;

external CTGlyphInfoCreateWithGlyph(
    glyph : UShort,
    font : CTFontRef,
    baseString : CFStringRef) : CTGlyphInfoRef;

external CTGlyphInfoCreateWithCharacterIdentifier(
    cid : UShort,
    collection : UShort,
    baseString : CFStringRef) : CTGlyphInfoRef;

external CTGlyphInfoGetGlyphName(
    glyphInfo : CTGlyphInfoRef) : CFStringRef;

external CTGlyphInfoGetCharacterIdentifier(
    glyphInfo : CTGlyphInfoRef) : UShort;

external CTGlyphInfoGetCharacterCollection(
    glyphInfo : CTGlyphInfoRef) : UShort;

alias CTParagraphStyleRef = OpaquePointer;

external CTParagraphStyleGetTypeID() : CULong;

alias kCTLeftTextAlignment = 0;
alias kCTRightTextAlignment = 1;
alias kCTCenterTextAlignment = 2;
alias kCTJustifiedTextAlignment = 3;
alias kCTNaturalTextAlignment = 4;

alias CTTextAlignment = CUChar;

alias kCTLineBreakByWordWrapping = 0;
alias kCTLineBreakByCharWrapping = 1;
alias kCTLineBreakByClipping = 2;
alias kCTLineBreakByTruncatingHead = 3;
alias kCTLineBreakByTruncatingTail = 4;
alias kCTLineBreakByTruncatingMiddle = 5;

alias CTLineBreakMode = CUChar;

alias kCTWritingDirectionNatural = 4294967295;
alias kCTWritingDirectionLeftToRight = 0;
alias kCTWritingDirectionRightToLeft = 1;

alias CTWritingDirection = CChar;

alias kCTParagraphStyleSpecifierAlignment = 0;
alias kCTParagraphStyleSpecifierFirstLineHeadIndent = 1;
alias kCTParagraphStyleSpecifierHeadIndent = 2;
alias kCTParagraphStyleSpecifierTailIndent = 3;
alias kCTParagraphStyleSpecifierTabStops = 4;
alias kCTParagraphStyleSpecifierDefaultTabInterval = 5;
alias kCTParagraphStyleSpecifierLineBreakMode = 6;
alias kCTParagraphStyleSpecifierLineHeightMultiple = 7;
alias kCTParagraphStyleSpecifierMaximumLineHeight = 8;
alias kCTParagraphStyleSpecifierMinimumLineHeight = 9;
alias kCTParagraphStyleSpecifierLineSpacing = 10;
alias kCTParagraphStyleSpecifierParagraphSpacing = 11;
alias kCTParagraphStyleSpecifierParagraphSpacingBefore = 12;
alias kCTParagraphStyleSpecifierBaseWritingDirection = 13;
alias kCTParagraphStyleSpecifierCount = 14;

alias CTParagraphStyleSpecifier = UInt;

record Struct_CTParagraphStyleSetting (
    spec : UInt,
    valueSize : CULong,
    value : RawPointer,
);

alias CTParagraphStyleSetting = Struct_CTParagraphStyleSetting;

external CTParagraphStyleCreate(
    settings : Pointer[CTParagraphStyleSetting],
    settingCount : CLong) : CTParagraphStyleRef;

external CTParagraphStyleCreateCopy(
    paragraphStyle : CTParagraphStyleRef) : CTParagraphStyleRef;

external CTParagraphStyleGetValueForSpecifier(
    paragraphStyle : CTParagraphStyleRef,
    spec : UInt,
    valueBufferSize : CULong,
    valueBuffer : RawPointer) : Bool;

alias CTRunRef = OpaquePointer;

alias kCTRunStatusNoStatus = 0;
alias kCTRunStatusRightToLeft = 1;
alias kCTRunStatusNonMonotonic = 2;
alias kCTRunStatusHasNonIdentityMatrix = 4;

alias CTRunStatus = UInt;

external CTRunGetTypeID() : CULong;

external CTRunGetGlyphCount(
    run : CTRunRef) : CLong;

external CTRunGetAttributes(
    run : CTRunRef) : CFDictionaryRef;

external CTRunGetStatus(
    run : CTRunRef) : UInt;

external CTRunGetGlyphsPtr(
    run : CTRunRef) : Pointer[UShort];

external CTRunGetGlyphs(
    run : CTRunRef,
    range : CFRange,
    buffer : Pointer[UShort]);

external CTRunGetPositionsPtr(
    run : CTRunRef) : Pointer[CGPoint];

external CTRunGetPositions(
    run : CTRunRef,
    range : CFRange,
    buffer : Pointer[CGPoint]);

external CTRunGetAdvancesPtr(
    run : CTRunRef) : Pointer[CGSize];

external CTRunGetAdvances(
    run : CTRunRef,
    range : CFRange,
    buffer : Pointer[CGSize]);

external CTRunGetStringIndicesPtr(
    run : CTRunRef) : Pointer[CLong];

external CTRunGetStringIndices(
    run : CTRunRef,
    range : CFRange,
    buffer : Pointer[CLong]);

external CTRunGetStringRange(
    run : CTRunRef) : CFRange;

external CTRunGetTypographicBounds(
    run : CTRunRef,
    range : CFRange,
    ascent : Pointer[Double],
    descent : Pointer[Double],
    leading : Pointer[Double]) : Double;

external CTRunGetImageBounds(
    run : CTRunRef,
    context : CGContextRef,
    range : CFRange) : CGRect;

external CTRunGetTextMatrix(
    run : CTRunRef) : CGAffineTransform;

external CTRunDraw(
    run : CTRunRef,
    context : CGContextRef,
    range : CFRange);

external kCTFontAttributeName : CFStringRef;

external kCTForegroundColorFromContextAttributeName : CFStringRef;

external kCTKernAttributeName : CFStringRef;

external kCTLigatureAttributeName : CFStringRef;

external kCTForegroundColorAttributeName : CFStringRef;

external kCTParagraphStyleAttributeName : CFStringRef;

external kCTStrokeWidthAttributeName : CFStringRef;

external kCTStrokeColorAttributeName : CFStringRef;

external kCTUnderlineStyleAttributeName : CFStringRef;

external kCTSuperscriptAttributeName : CFStringRef;

external kCTUnderlineColorAttributeName : CFStringRef;

external kCTVerticalFormsAttributeName : CFStringRef;

external kCTGlyphInfoAttributeName : CFStringRef;

external kCTCharacterShapeAttributeName : CFStringRef;

alias kCTUnderlineStyleNone = 0;
alias kCTUnderlineStyleSingle = 1;
alias kCTUnderlineStyleThick = 2;
alias kCTUnderlineStyleDouble = 9;

alias CTUnderlineStyle = Int;

alias kCTUnderlinePatternSolid = 0;
alias kCTUnderlinePatternDot = 256;
alias kCTUnderlinePatternDash = 512;
alias kCTUnderlinePatternDashDot = 768;
alias kCTUnderlinePatternDashDotDot = 1024;

alias CTUnderlineStyleModifiers = Int;

alias CTTextTabRef = OpaquePointer;

external CTTextTabGetTypeID() : CULong;

external kCTTabColumnTerminatorsAttributeName : CFStringRef;

external CTTextTabCreate(
    alignment : CUChar,
    location : Double,
    options : CFDictionaryRef) : CTTextTabRef;

external CTTextTabGetAlignment(
    tab : CTTextTabRef) : CUChar;

external CTTextTabGetLocation(
    tab : CTTextTabRef) : Double;

external CTTextTabGetOptions(
    tab : CTTextTabRef) : CFDictionaryRef;

external CTGetCoreTextVersion() : UInt;

alias CGImageSourceRef = OpaquePointer;

alias kCGImageStatusUnexpectedEOF = 4294967291;
alias kCGImageStatusInvalidData = 4294967292;
alias kCGImageStatusUnknownType = 4294967293;
alias kCGImageStatusReadingHeader = 4294967294;
alias kCGImageStatusIncomplete = 4294967295;
alias kCGImageStatusComplete = 0;

alias CGImageSourceStatus = Int;

external kCGImageSourceTypeIdentifierHint : CFStringRef;

external kCGImageSourceShouldCache : CFStringRef;

external kCGImageSourceShouldAllowFloat : CFStringRef;

external kCGImageSourceCreateThumbnailFromImageIfAbsent : CFStringRef;

external kCGImageSourceCreateThumbnailFromImageAlways : CFStringRef;

external kCGImageSourceThumbnailMaxPixelSize : CFStringRef;

external kCGImageSourceCreateThumbnailWithTransform : CFStringRef;

external CGImageSourceGetTypeID() : CULong;

external CGImageSourceCopyTypeIdentifiers() : CFArrayRef;

external CGImageSourceCreateWithDataProvider(
    provider : CGDataProviderRef,
    options : CFDictionaryRef) : CGImageSourceRef;

external CGImageSourceCreateWithData(
    data : CFDataRef,
    options : CFDictionaryRef) : CGImageSourceRef;

external CGImageSourceCreateWithURL(
    url : CFURLRef,
    options : CFDictionaryRef) : CGImageSourceRef;

external CGImageSourceGetType(
    isrc : CGImageSourceRef) : CFStringRef;

external CGImageSourceGetCount(
    isrc : CGImageSourceRef) : CULong;

external CGImageSourceCopyProperties(
    isrc : CGImageSourceRef,
    options : CFDictionaryRef) : CFDictionaryRef;

external CGImageSourceCopyPropertiesAtIndex(
    isrc : CGImageSourceRef,
    index : CULong,
    options : CFDictionaryRef) : CFDictionaryRef;

external CGImageSourceCreateImageAtIndex(
    isrc : CGImageSourceRef,
    index : CULong,
    options : CFDictionaryRef) : CGImageRef;

external CGImageSourceCreateThumbnailAtIndex(
    isrc : CGImageSourceRef,
    index : CULong,
    options : CFDictionaryRef) : CGImageRef;

external CGImageSourceCreateIncremental(
    options : CFDictionaryRef) : CGImageSourceRef;

external CGImageSourceUpdateData(
    isrc : CGImageSourceRef,
    data : CFDataRef,
    final : Bool);

external CGImageSourceUpdateDataProvider(
    isrc : CGImageSourceRef,
    provider : CGDataProviderRef,
    final : Bool);

external CGImageSourceGetStatus(
    isrc : CGImageSourceRef) : CGImageSourceStatus;

external CGImageSourceGetStatusAtIndex(
    isrc : CGImageSourceRef,
    index : CULong) : CGImageSourceStatus;

alias CGImageDestinationRef = OpaquePointer;

external kCGImageDestinationLossyCompressionQuality : CFStringRef;

external kCGImageDestinationBackgroundColor : CFStringRef;

external CGImageDestinationGetTypeID() : CULong;

external CGImageDestinationCopyTypeIdentifiers() : CFArrayRef;

external CGImageDestinationCreateWithDataConsumer(
    consumer : CGDataConsumerRef,
    type : CFStringRef,
    count : CULong,
    options : CFDictionaryRef) : CGImageDestinationRef;

external CGImageDestinationCreateWithData(
    data : CFMutableDataRef,
    type : CFStringRef,
    count : CULong,
    options : CFDictionaryRef) : CGImageDestinationRef;

external CGImageDestinationCreateWithURL(
    url : CFURLRef,
    type : CFStringRef,
    count : CULong,
    options : CFDictionaryRef) : CGImageDestinationRef;

external CGImageDestinationSetProperties(
    idst : CGImageDestinationRef,
    properties : CFDictionaryRef);

external CGImageDestinationAddImage(
    idst : CGImageDestinationRef,
    image : CGImageRef,
    properties : CFDictionaryRef);

external CGImageDestinationAddImageFromSource(
    idst : CGImageDestinationRef,
    isrc : CGImageSourceRef,
    index : CULong,
    properties : CFDictionaryRef);

external CGImageDestinationFinalize(
    idst : CGImageDestinationRef) : Bool;

external kCGImagePropertyTIFFDictionary : CFStringRef;

external kCGImagePropertyGIFDictionary : CFStringRef;

external kCGImagePropertyJFIFDictionary : CFStringRef;

external kCGImagePropertyExifDictionary : CFStringRef;

external kCGImagePropertyPNGDictionary : CFStringRef;

external kCGImagePropertyIPTCDictionary : CFStringRef;

external kCGImagePropertyGPSDictionary : CFStringRef;

external kCGImagePropertyRawDictionary : CFStringRef;

external kCGImagePropertyCIFFDictionary : CFStringRef;

external kCGImagePropertyMakerCanonDictionary : CFStringRef;

external kCGImagePropertyMakerNikonDictionary : CFStringRef;

external kCGImagePropertyMakerMinoltaDictionary : CFStringRef;

external kCGImagePropertyMakerFujiDictionary : CFStringRef;

external kCGImagePropertyMakerOlympusDictionary : CFStringRef;

external kCGImagePropertyMakerPentaxDictionary : CFStringRef;

external kCGImageProperty8BIMDictionary : CFStringRef;

external kCGImagePropertyDNGDictionary : CFStringRef;

external kCGImagePropertyExifAuxDictionary : CFStringRef;

external kCGImagePropertyFileSize : CFStringRef;

external kCGImagePropertyPixelHeight : CFStringRef;

external kCGImagePropertyPixelWidth : CFStringRef;

external kCGImagePropertyDPIHeight : CFStringRef;

external kCGImagePropertyDPIWidth : CFStringRef;

external kCGImagePropertyDepth : CFStringRef;

external kCGImagePropertyOrientation : CFStringRef;

external kCGImagePropertyIsFloat : CFStringRef;

external kCGImagePropertyIsIndexed : CFStringRef;

external kCGImagePropertyHasAlpha : CFStringRef;

external kCGImagePropertyColorModel : CFStringRef;

external kCGImagePropertyProfileName : CFStringRef;

external kCGImagePropertyColorModelRGB : CFStringRef;

external kCGImagePropertyColorModelGray : CFStringRef;

external kCGImagePropertyColorModelCMYK : CFStringRef;

external kCGImagePropertyColorModelLab : CFStringRef;

external kCGImagePropertyTIFFCompression : CFStringRef;

external kCGImagePropertyTIFFPhotometricInterpretation : CFStringRef;

external kCGImagePropertyTIFFDocumentName : CFStringRef;

external kCGImagePropertyTIFFImageDescription : CFStringRef;

external kCGImagePropertyTIFFMake : CFStringRef;

external kCGImagePropertyTIFFModel : CFStringRef;

external kCGImagePropertyTIFFOrientation : CFStringRef;

external kCGImagePropertyTIFFXResolution : CFStringRef;

external kCGImagePropertyTIFFYResolution : CFStringRef;

external kCGImagePropertyTIFFResolutionUnit : CFStringRef;

external kCGImagePropertyTIFFSoftware : CFStringRef;

external kCGImagePropertyTIFFTransferFunction : CFStringRef;

external kCGImagePropertyTIFFDateTime : CFStringRef;

external kCGImagePropertyTIFFArtist : CFStringRef;

external kCGImagePropertyTIFFHostComputer : CFStringRef;

external kCGImagePropertyTIFFCopyright : CFStringRef;

external kCGImagePropertyTIFFWhitePoint : CFStringRef;

external kCGImagePropertyTIFFPrimaryChromaticities : CFStringRef;

external kCGImagePropertyJFIFVersion : CFStringRef;

external kCGImagePropertyJFIFXDensity : CFStringRef;

external kCGImagePropertyJFIFYDensity : CFStringRef;

external kCGImagePropertyJFIFDensityUnit : CFStringRef;

external kCGImagePropertyJFIFIsProgressive : CFStringRef;

external kCGImagePropertyExifExposureTime : CFStringRef;

external kCGImagePropertyExifFNumber : CFStringRef;

external kCGImagePropertyExifExposureProgram : CFStringRef;

external kCGImagePropertyExifSpectralSensitivity : CFStringRef;

external kCGImagePropertyExifISOSpeedRatings : CFStringRef;

external kCGImagePropertyExifOECF : CFStringRef;

external kCGImagePropertyExifVersion : CFStringRef;

external kCGImagePropertyExifDateTimeOriginal : CFStringRef;

external kCGImagePropertyExifDateTimeDigitized : CFStringRef;

external kCGImagePropertyExifComponentsConfiguration : CFStringRef;

external kCGImagePropertyExifCompressedBitsPerPixel : CFStringRef;

external kCGImagePropertyExifShutterSpeedValue : CFStringRef;

external kCGImagePropertyExifApertureValue : CFStringRef;

external kCGImagePropertyExifBrightnessValue : CFStringRef;

external kCGImagePropertyExifExposureBiasValue : CFStringRef;

external kCGImagePropertyExifMaxApertureValue : CFStringRef;

external kCGImagePropertyExifSubjectDistance : CFStringRef;

external kCGImagePropertyExifMeteringMode : CFStringRef;

external kCGImagePropertyExifLightSource : CFStringRef;

external kCGImagePropertyExifFlash : CFStringRef;

external kCGImagePropertyExifFocalLength : CFStringRef;

external kCGImagePropertyExifSubjectArea : CFStringRef;

external kCGImagePropertyExifMakerNote : CFStringRef;

external kCGImagePropertyExifUserComment : CFStringRef;

external kCGImagePropertyExifSubsecTime : CFStringRef;

external kCGImagePropertyExifSubsecTimeOrginal : CFStringRef;

external kCGImagePropertyExifSubsecTimeDigitized : CFStringRef;

external kCGImagePropertyExifFlashPixVersion : CFStringRef;

external kCGImagePropertyExifColorSpace : CFStringRef;

external kCGImagePropertyExifPixelXDimension : CFStringRef;

external kCGImagePropertyExifPixelYDimension : CFStringRef;

external kCGImagePropertyExifRelatedSoundFile : CFStringRef;

external kCGImagePropertyExifFlashEnergy : CFStringRef;

external kCGImagePropertyExifSpatialFrequencyResponse : CFStringRef;

external kCGImagePropertyExifFocalPlaneXResolution : CFStringRef;

external kCGImagePropertyExifFocalPlaneYResolution : CFStringRef;

external kCGImagePropertyExifFocalPlaneResolutionUnit : CFStringRef;

external kCGImagePropertyExifSubjectLocation : CFStringRef;

external kCGImagePropertyExifExposureIndex : CFStringRef;

external kCGImagePropertyExifSensingMethod : CFStringRef;

external kCGImagePropertyExifFileSource : CFStringRef;

external kCGImagePropertyExifSceneType : CFStringRef;

external kCGImagePropertyExifCFAPattern : CFStringRef;

external kCGImagePropertyExifCustomRendered : CFStringRef;

external kCGImagePropertyExifExposureMode : CFStringRef;

external kCGImagePropertyExifWhiteBalance : CFStringRef;

external kCGImagePropertyExifDigitalZoomRatio : CFStringRef;

external kCGImagePropertyExifFocalLenIn35mmFilm : CFStringRef;

external kCGImagePropertyExifSceneCaptureType : CFStringRef;

external kCGImagePropertyExifGainControl : CFStringRef;

external kCGImagePropertyExifContrast : CFStringRef;

external kCGImagePropertyExifSaturation : CFStringRef;

external kCGImagePropertyExifSharpness : CFStringRef;

external kCGImagePropertyExifDeviceSettingDescription : CFStringRef;

external kCGImagePropertyExifSubjectDistRange : CFStringRef;

external kCGImagePropertyExifImageUniqueID : CFStringRef;

external kCGImagePropertyExifGamma : CFStringRef;

external kCGImagePropertyExifAuxLensInfo : CFStringRef;

external kCGImagePropertyExifAuxLensModel : CFStringRef;

external kCGImagePropertyExifAuxSerialNumber : CFStringRef;

external kCGImagePropertyExifAuxLensID : CFStringRef;

external kCGImagePropertyExifAuxLensSerialNumber : CFStringRef;

external kCGImagePropertyExifAuxImageNumber : CFStringRef;

external kCGImagePropertyExifAuxFlashCompensation : CFStringRef;

external kCGImagePropertyExifAuxOwnerName : CFStringRef;

external kCGImagePropertyExifAuxFirmware : CFStringRef;

external kCGImagePropertyGIFLoopCount : CFStringRef;

external kCGImagePropertyGIFDelayTime : CFStringRef;

external kCGImagePropertyGIFImageColorMap : CFStringRef;

external kCGImagePropertyGIFHasGlobalColorMap : CFStringRef;

external kCGImagePropertyPNGGamma : CFStringRef;

external kCGImagePropertyPNGInterlaceType : CFStringRef;

external kCGImagePropertyPNGXPixelsPerMeter : CFStringRef;

external kCGImagePropertyPNGYPixelsPerMeter : CFStringRef;

external kCGImagePropertyPNGsRGBIntent : CFStringRef;

external kCGImagePropertyPNGChromaticities : CFStringRef;

external kCGImagePropertyGPSVersion : CFStringRef;

external kCGImagePropertyGPSLatitudeRef : CFStringRef;

external kCGImagePropertyGPSLatitude : CFStringRef;

external kCGImagePropertyGPSLongitudeRef : CFStringRef;

external kCGImagePropertyGPSLongitude : CFStringRef;

external kCGImagePropertyGPSAltitudeRef : CFStringRef;

external kCGImagePropertyGPSAltitude : CFStringRef;

external kCGImagePropertyGPSTimeStamp : CFStringRef;

external kCGImagePropertyGPSSatellites : CFStringRef;

external kCGImagePropertyGPSStatus : CFStringRef;

external kCGImagePropertyGPSMeasureMode : CFStringRef;

external kCGImagePropertyGPSDOP : CFStringRef;

external kCGImagePropertyGPSSpeedRef : CFStringRef;

external kCGImagePropertyGPSSpeed : CFStringRef;

external kCGImagePropertyGPSTrackRef : CFStringRef;

external kCGImagePropertyGPSTrack : CFStringRef;

external kCGImagePropertyGPSImgDirectionRef : CFStringRef;

external kCGImagePropertyGPSImgDirection : CFStringRef;

external kCGImagePropertyGPSMapDatum : CFStringRef;

external kCGImagePropertyGPSDestLatitudeRef : CFStringRef;

external kCGImagePropertyGPSDestLatitude : CFStringRef;

external kCGImagePropertyGPSDestLongitudeRef : CFStringRef;

external kCGImagePropertyGPSDestLongitude : CFStringRef;

external kCGImagePropertyGPSDestBearingRef : CFStringRef;

external kCGImagePropertyGPSDestBearing : CFStringRef;

external kCGImagePropertyGPSDestDistanceRef : CFStringRef;

external kCGImagePropertyGPSDestDistance : CFStringRef;

external kCGImagePropertyGPSProcessingMethod : CFStringRef;

external kCGImagePropertyGPSAreaInformation : CFStringRef;

external kCGImagePropertyGPSDateStamp : CFStringRef;

external kCGImagePropertyGPSDifferental : CFStringRef;

external kCGImagePropertyIPTCObjectTypeReference : CFStringRef;

external kCGImagePropertyIPTCObjectAttributeReference : CFStringRef;

external kCGImagePropertyIPTCObjectName : CFStringRef;

external kCGImagePropertyIPTCEditStatus : CFStringRef;

external kCGImagePropertyIPTCEditorialUpdate : CFStringRef;

external kCGImagePropertyIPTCUrgency : CFStringRef;

external kCGImagePropertyIPTCSubjectReference : CFStringRef;

external kCGImagePropertyIPTCCategory : CFStringRef;

external kCGImagePropertyIPTCSupplementalCategory : CFStringRef;

external kCGImagePropertyIPTCFixtureIdentifier : CFStringRef;

external kCGImagePropertyIPTCKeywords : CFStringRef;

external kCGImagePropertyIPTCContentLocationCode : CFStringRef;

external kCGImagePropertyIPTCContentLocationName : CFStringRef;

external kCGImagePropertyIPTCReleaseDate : CFStringRef;

external kCGImagePropertyIPTCReleaseTime : CFStringRef;

external kCGImagePropertyIPTCExpirationDate : CFStringRef;

external kCGImagePropertyIPTCExpirationTime : CFStringRef;

external kCGImagePropertyIPTCSpecialInstructions : CFStringRef;

external kCGImagePropertyIPTCActionAdvised : CFStringRef;

external kCGImagePropertyIPTCReferenceService : CFStringRef;

external kCGImagePropertyIPTCReferenceDate : CFStringRef;

external kCGImagePropertyIPTCReferenceNumber : CFStringRef;

external kCGImagePropertyIPTCDateCreated : CFStringRef;

external kCGImagePropertyIPTCTimeCreated : CFStringRef;

external kCGImagePropertyIPTCDigitalCreationDate : CFStringRef;

external kCGImagePropertyIPTCDigitalCreationTime : CFStringRef;

external kCGImagePropertyIPTCOriginatingProgram : CFStringRef;

external kCGImagePropertyIPTCProgramVersion : CFStringRef;

external kCGImagePropertyIPTCObjectCycle : CFStringRef;

external kCGImagePropertyIPTCByline : CFStringRef;

external kCGImagePropertyIPTCBylineTitle : CFStringRef;

external kCGImagePropertyIPTCCity : CFStringRef;

external kCGImagePropertyIPTCSubLocation : CFStringRef;

external kCGImagePropertyIPTCProvinceState : CFStringRef;

external kCGImagePropertyIPTCCountryPrimaryLocationCode : CFStringRef;

external kCGImagePropertyIPTCCountryPrimaryLocationName : CFStringRef;

external kCGImagePropertyIPTCOriginalTransmissionReference : CFStringRef;

external kCGImagePropertyIPTCHeadline : CFStringRef;

external kCGImagePropertyIPTCCredit : CFStringRef;

external kCGImagePropertyIPTCSource : CFStringRef;

external kCGImagePropertyIPTCCopyrightNotice : CFStringRef;

external kCGImagePropertyIPTCContact : CFStringRef;

external kCGImagePropertyIPTCCaptionAbstract : CFStringRef;

external kCGImagePropertyIPTCWriterEditor : CFStringRef;

external kCGImagePropertyIPTCImageType : CFStringRef;

external kCGImagePropertyIPTCImageOrientation : CFStringRef;

external kCGImagePropertyIPTCLanguageIdentifier : CFStringRef;

external kCGImagePropertyIPTCStarRating : CFStringRef;

external kCGImagePropertyIPTCCreatorContactInfo : CFStringRef;

external kCGImagePropertyIPTCRightsUsageTerms : CFStringRef;

external kCGImagePropertyIPTCScene : CFStringRef;

external kCGImagePropertyIPTCContactInfoCity : CFStringRef;

external kCGImagePropertyIPTCContactInfoCountry : CFStringRef;

external kCGImagePropertyIPTCContactInfoAddress : CFStringRef;

external kCGImagePropertyIPTCContactInfoPostalCode : CFStringRef;

external kCGImagePropertyIPTCContactInfoStateProvince : CFStringRef;

external kCGImagePropertyIPTCContactInfoEmails : CFStringRef;

external kCGImagePropertyIPTCContactInfoPhones : CFStringRef;

external kCGImagePropertyIPTCContactInfoWebURLs : CFStringRef;

external kCGImageProperty8BIMLayerNames : CFStringRef;

external kCGImagePropertyDNGVersion : CFStringRef;

external kCGImagePropertyDNGBackwardVersion : CFStringRef;

external kCGImagePropertyDNGUniqueCameraModel : CFStringRef;

external kCGImagePropertyDNGLocalizedCameraModel : CFStringRef;

external kCGImagePropertyDNGCameraSerialNumber : CFStringRef;

external kCGImagePropertyDNGLensInfo : CFStringRef;

external kCGImagePropertyCIFFDescription : CFStringRef;

external kCGImagePropertyCIFFFirmware : CFStringRef;

external kCGImagePropertyCIFFOwnerName : CFStringRef;

external kCGImagePropertyCIFFImageName : CFStringRef;

external kCGImagePropertyCIFFImageFileName : CFStringRef;

external kCGImagePropertyCIFFReleaseMethod : CFStringRef;

external kCGImagePropertyCIFFReleaseTiming : CFStringRef;

external kCGImagePropertyCIFFRecordID : CFStringRef;

external kCGImagePropertyCIFFSelfTimingTime : CFStringRef;

external kCGImagePropertyCIFFCameraSerialNumber : CFStringRef;

external kCGImagePropertyCIFFImageSerialNumber : CFStringRef;

external kCGImagePropertyCIFFContinuousDrive : CFStringRef;

external kCGImagePropertyCIFFFocusMode : CFStringRef;

external kCGImagePropertyCIFFMeteringMode : CFStringRef;

external kCGImagePropertyCIFFShootingMode : CFStringRef;

external kCGImagePropertyCIFFLensModel : CFStringRef;

external kCGImagePropertyCIFFLensMaxMM : CFStringRef;

external kCGImagePropertyCIFFLensMinMM : CFStringRef;

external kCGImagePropertyCIFFWhiteBalanceIndex : CFStringRef;

external kCGImagePropertyCIFFFlashExposureComp : CFStringRef;

external kCGImagePropertyCIFFMeasuredEV : CFStringRef;

external kCGImagePropertyMakerNikonISOSetting : CFStringRef;

external kCGImagePropertyMakerNikonColorMode : CFStringRef;

external kCGImagePropertyMakerNikonQuality : CFStringRef;

external kCGImagePropertyMakerNikonWhiteBalanceMode : CFStringRef;

external kCGImagePropertyMakerNikonSharpenMode : CFStringRef;

external kCGImagePropertyMakerNikonFocusMode : CFStringRef;

external kCGImagePropertyMakerNikonFlashSetting : CFStringRef;

external kCGImagePropertyMakerNikonISOSelection : CFStringRef;

external kCGImagePropertyMakerNikonFlashExposureComp : CFStringRef;

external kCGImagePropertyMakerNikonImageAdjustment : CFStringRef;

external kCGImagePropertyMakerNikonLensAdapter : CFStringRef;

external kCGImagePropertyMakerNikonLensType : CFStringRef;

external kCGImagePropertyMakerNikonLensInfo : CFStringRef;

external kCGImagePropertyMakerNikonFocusDistance : CFStringRef;

external kCGImagePropertyMakerNikonDigitalZoom : CFStringRef;

external kCGImagePropertyMakerNikonShootingMode : CFStringRef;

external kCGImagePropertyMakerNikonCameraSerialNumber : CFStringRef;

external kCGImagePropertyMakerNikonShutterCount : CFStringRef;

external kCGImagePropertyMakerCanonOwnerName : CFStringRef;

external kCGImagePropertyMakerCanonCameraSerialNumber : CFStringRef;

external kCGImagePropertyMakerCanonImageSerialNumber : CFStringRef;

external kCGImagePropertyMakerCanonFlashExposureComp : CFStringRef;

external kCGImagePropertyMakerCanonContinuousDrive : CFStringRef;

external kCGImagePropertyMakerCanonLensModel : CFStringRef;

external kCGImagePropertyMakerCanonFirmware : CFStringRef;

external kCGImagePropertyMakerCanonAspectRatioInfo : CFStringRef;
